CDN fight 3

This commit is contained in:
dingo
2025-12-20 13:04:31 -05:00
parent 317e14e042
commit 8390fdf42e
8 changed files with 1999 additions and 47 deletions
+29 -9
View File
@@ -70,11 +70,25 @@ public class DungeonMobDefinition
// Visuals
/// <summary>
/// Path to the mob's .tscn scene file on CDN (e.g., "scenes/mobs/skeleton.tscn")
/// JSON configuration for mob sprites and animations
/// Example: {
/// "sprites": {
/// "idle_front": "assets/sprites/skeleton_idle_front.png",
/// "idle_back": "assets/sprites/skeleton_idle_back.png",
/// "run_front": "assets/sprites/skeleton_run_front.png"
/// },
/// "frameWidth": 64,
/// "frameHeight": 64,
/// "fps": 8,
/// "animations": {
/// "idle_front": {"frames": 8, "loop": true},
/// "run_front": {"frames": 8, "loop": true}
/// }
/// }
/// If null/empty, client uses fallback placeholder shape
/// </summary>
[MaxLength(256)]
public string? ScenePath { get; set; }
[MaxLength(4096)]
public string? SpriteConfigJson { get; set; }
/// <summary>
/// Color tint applied to the mob (hex, e.g., "#ff0000" for red variant)
@@ -87,16 +101,22 @@ public class DungeonMobDefinition
/// </summary>
public float Scale { get; set; } = 1.0f;
// Legacy fields - kept for backwards compatibility, ScenePath takes priority
[MaxLength(128)]
public string SpriteSheet { get; set; } = "";
public int SpriteWidth { get; set; } = 32;
public int SpriteHeight { get; set; } = 32;
public float AnimationSpeed { get; set; } = 8f; // Frames per second
public bool IsEnabled { get; set; } = true;
// Helper to get parsed sprite config
[NotMapped]
public Dictionary<string, object>? SpriteConfig
{
get
{
if (string.IsNullOrEmpty(SpriteConfigJson)) return null;
try { return System.Text.Json.JsonSerializer.Deserialize<Dictionary<string, object>>(SpriteConfigJson); }
catch { return null; }
}
}
// Helper methods for JSON parsing
[NotMapped]
public Dictionary<string, float> Resistances