Add sprite padding, updated values, and deploy improvements

Sprite fixes:
- Pad rectangular card images to squares with transparent pixels
- Centers image to maintain aspect ratio in game preview UI

Card values updated to new scale:
- Common: 25, Uncommon: 100, Rare: 500
- Very Rare: 2500, Ultra Rare: 12500, Legendary: 62500

Deploy script improvements:
- Add --no-example flag to exclude ExampleSet during testing
- Show which sets are copied/skipped during deployment

Git configuration:
- Only track ExampleSet in CardSets/, ignore user content

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Cal Corum 2025-11-19 23:02:17 -06:00
parent b10ecbf733
commit 42b71e3447
4 changed files with 60 additions and 17 deletions

6
.gitignore vendored
View File

@ -22,9 +22,9 @@ packages/
# Debug logs
*.log
# Card set images (user-generated content)
# Uncomment if you don't want to track example images
# CardSets/*/images/
# Card sets - only ExampleSet is tracked in git
CardSets/*
!CardSets/ExampleSet/
# Preview image (generate your own)
# preview.png

View File

@ -14,8 +14,8 @@
# Add your own cards below! Just follow the format above.
# Place corresponding images in the images/ subfolder.
Duck Hero | Example Set | 001 | duck_hero.png | Rare | 0.01 | 100 | The brave defender of all ponds
Golden Quacker | Example Set | 002 | golden_quacker.png | Ultra Rare | 0.01 | 500 | A legendary duck made of pure gold
Pond Guardian | Example Set | 003 | pond_guardian.png | Uncommon | 0.01 | 25
Bread Seeker | Example Set | 004 | bread_seeker.png | Common | 0.01 | 10
Feathered Fury | Example Set | 005 | feathered_fury.png | Rare | 0.01 | 75 | Known for its fierce battle cry
Duck Hero | Example Set | 001 | duck_hero.png | Rare | 0.01 | 500 | The brave defender of all ponds
Golden Quacker | Example Set | 002 | golden_quacker.png | Ultra Rare | 0.01 | 12500 | A legendary duck made of pure gold
Pond Guardian | Example Set | 003 | pond_guardian.png | Uncommon | 0.01 | 100
Bread Seeker | Example Set | 004 | bread_seeker.png | Common | 0.01 | 25
Feathered Fury | Example Set | 005 | feathered_fury.png | Rare | 0.01 | 500 | Known for its fierce battle cry

View File

@ -1,6 +1,6 @@
#!/bin/bash
# Deploy Trading Card Mod to Escape from Duckov
# Usage: ./deploy.sh [--release]
# Usage: ./deploy.sh [--release] [--no-example]
set -e
@ -9,11 +9,20 @@ GAME_PATH="/mnt/NV2/SteamLibrary/steamapps/common/Escape from Duckov"
MOD_NAME="TradingCardMod"
MOD_DIR="$GAME_PATH/Duckov_Data/Mods/$MOD_NAME"
# Build configuration
# Parse arguments
BUILD_CONFIG="Debug"
if [[ "$1" == "--release" ]]; then
BUILD_CONFIG="Release"
fi
EXCLUDE_EXAMPLE=false
for arg in "$@"; do
case $arg in
--release)
BUILD_CONFIG="Release"
;;
--no-example)
EXCLUDE_EXAMPLE=true
;;
esac
done
echo "=== Trading Card Mod Deployment ==="
echo "Build config: $BUILD_CONFIG"
@ -47,7 +56,18 @@ fi
# Copy card sets
echo "[4/4] Copying card sets..."
if [[ -d "CardSets" ]]; then
cp -r CardSets/* "$MOD_DIR/CardSets/" 2>/dev/null || true
for set_dir in CardSets/*/; do
set_name=$(basename "$set_dir")
# Skip ExampleSet if --no-example flag is set
if [[ "$EXCLUDE_EXAMPLE" == true && "$set_name" == "ExampleSet" ]]; then
echo " Skipping: $set_name (--no-example)"
continue
fi
cp -r "$set_dir" "$MOD_DIR/CardSets/"
echo " Copied: $set_name"
done
fi
echo ""

View File

@ -666,10 +666,33 @@ namespace TradingCardMod
texture.filterMode = FilterMode.Bilinear;
texture.Apply();
// Pad to square if rectangular (game preview expects square icons)
Texture2D finalTexture = texture;
if (texture.width != texture.height)
{
int size = Mathf.Max(texture.width, texture.height);
finalTexture = new Texture2D(size, size, TextureFormat.RGBA32, false);
// Fill with transparent pixels
Color[] clearPixels = new Color[size * size];
for (int i = 0; i < clearPixels.Length; i++)
{
clearPixels[i] = Color.clear;
}
finalTexture.SetPixels(clearPixels);
// Center the original image
int offsetX = (size - texture.width) / 2;
int offsetY = (size - texture.height) / 2;
finalTexture.SetPixels(offsetX, offsetY, texture.width, texture.height, texture.GetPixels());
finalTexture.filterMode = FilterMode.Bilinear;
finalTexture.Apply();
}
// Create sprite from texture
Sprite sprite = Sprite.Create(
texture,
new Rect(0f, 0f, texture.width, texture.height),
finalTexture,
new Rect(0f, 0f, finalTexture.width, finalTexture.height),
new Vector2(0.5f, 0.5f),
100f
);
@ -681,7 +704,7 @@ namespace TradingCardMod
// Store references on the holder to prevent GC
var resourceHolder = holder.AddComponent<CardResourceHolder>();
resourceHolder.Texture = texture;
resourceHolder.Texture = finalTexture;
resourceHolder.Sprite = sprite;
return sprite;