- New turn order: produce -> transfer -> move -> collision resolution - Collisions now destroy weaker pieces (status > level > mutual destruction) instead of halting the simulation. SimPhase.Collision removed. - Add piece Level property (all level 1 in proto, prepared for future) - Production fires every turn (interval concept removed), buffer = Amount (default 1, future 2-4), leftovers overwritten each turn - Transfer tiebreaker: status > level > clockwise direction (alternating even/odd turns in y-up coords), replaces distance-to-production - Demands always accept matching cargo even when already satisfied - TurnNumber added to all turn events for animation grouping - Simultaneous animations: produce flash, cargo slide, parallel piece moves - Camera centering fix + middle-click pan - GDD updated with new rules + lore section added Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
62 lines
2 KiB
C#
62 lines
2 KiB
C#
using Godot;
|
|
using System.Collections.Generic;
|
|
using Chessistics.Engine.Model;
|
|
|
|
namespace Chessistics.Scripts.UI;
|
|
|
|
public partial class ObjectivePanel : VBoxContainer
|
|
{
|
|
private readonly Dictionary<Coords, (Label label, ProgressBar bar)> _entries = new();
|
|
|
|
public void Setup(IReadOnlyList<DemandDef> demands)
|
|
{
|
|
foreach (var child in GetChildren())
|
|
child.QueueFree();
|
|
_entries.Clear();
|
|
|
|
var title = new Label { Text = "OBJECTIFS" };
|
|
title.AddThemeFontSizeOverride("font_size", 16);
|
|
title.AddThemeColorOverride("font_color", new Color("#FFD700"));
|
|
AddChild(title);
|
|
|
|
AddChild(new HSeparator());
|
|
|
|
foreach (var demand in demands)
|
|
{
|
|
var vbox = new VBoxContainer();
|
|
|
|
var label = new Label { Text = $"{demand.Name}: 0/{demand.Amount} {demand.Cargo}" };
|
|
label.AddThemeFontSizeOverride("font_size", 12);
|
|
vbox.AddChild(label);
|
|
|
|
var bar = new ProgressBar
|
|
{
|
|
MinValue = 0,
|
|
MaxValue = demand.Amount,
|
|
Value = 0,
|
|
CustomMinimumSize = new Vector2(180, 16),
|
|
ShowPercentage = false
|
|
};
|
|
vbox.AddChild(bar);
|
|
|
|
var deadline = new Label { Text = $"Deadline: {demand.Deadline} coups" };
|
|
deadline.AddThemeFontSizeOverride("font_size", 10);
|
|
deadline.AddThemeColorOverride("font_color", new Color("#AAAAAA"));
|
|
vbox.AddChild(deadline);
|
|
|
|
AddChild(vbox);
|
|
_entries[demand.Position] = (label, bar);
|
|
}
|
|
}
|
|
|
|
public void UpdateProgress(Coords demandCell, string name, int current, int required)
|
|
{
|
|
if (!_entries.TryGetValue(demandCell, out var entry)) return;
|
|
|
|
entry.label.Text = $"{name}: {current}/{required}";
|
|
entry.bar.Value = current;
|
|
|
|
if (current >= required)
|
|
entry.label.AddThemeColorOverride("font_color", new Color("#44CC44"));
|
|
}
|
|
}
|