ui stule update
This commit is contained in:
1 parent
28046f901e
commit
86e3de904e
11 files changed
+59
-29
No files matched your search
@@ -1,8 +1,9 @@
|
||||
using Cthangover.Core.Battle;
|
||||
using Cthangover.Core.Battle;
|
||||
using Cthangover.Core.Battle.Actions;
|
||||
using Cthangover.Core.Characters;
|
||||
using Cthangover.TurnBattle;
|
||||
using Cthangover.FFBattle.UI;
|
||||
using Cthangover.Core.UI.Theming;
|
||||
using Godot;
|
||||
|
||||
namespace Cthangover.FFBattle.Actions
|
||||
@@ -70,7 +71,7 @@ namespace Cthangover.FFBattle.Actions
|
||||
|
||||
if (result.Result)
|
||||
{
|
||||
Target.Flash(new Color(1f, 0.3f, 0.3f, 1f), 0.2f);
|
||||
Target.Flash(UiTokens.Danger, 0.2f);
|
||||
Target.Shake(4f, 0.25f);
|
||||
|
||||
if (result.Target.Damage > 0)
|
||||
@@ -115,3 +116,4 @@ namespace Cthangover.FFBattle.Actions
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
using Cthangover.Core.Battle;
|
||||
using Cthangover.Core.Battle;
|
||||
using Cthangover.Core.Battle.Actions;
|
||||
using Cthangover.Core.Characters;
|
||||
using Cthangover.TurnBattle;
|
||||
using Cthangover.FFBattle.UI;
|
||||
using Cthangover.Core.UI.Theming;
|
||||
using Godot;
|
||||
|
||||
namespace Cthangover.FFBattle.Actions
|
||||
@@ -70,7 +71,7 @@ namespace Cthangover.FFBattle.Actions
|
||||
|
||||
if (result.Result)
|
||||
{
|
||||
Target.Flash(new Color(0.3f, 1f, 0.3f, 1f), 0.4f);
|
||||
Target.Flash(UiTokens.Success, 0.4f);
|
||||
|
||||
if (result.Target.Defence > 0)
|
||||
ShowDamageBehaviour.SpawnDefence(result.Target.Defence, Target, Target.GlobalPosition);
|
||||
@@ -113,3 +114,4 @@ namespace Cthangover.FFBattle.Actions
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Cthangover.Core.Characters;
|
||||
using Cthangover.Core.Characters;
|
||||
using Cthangover.Core.Items;
|
||||
using Cthangover.FFBattle.UI;
|
||||
using Cthangover.Core.UI.Theming;
|
||||
using Godot;
|
||||
|
||||
namespace Cthangover.FFBattle.Actions
|
||||
@@ -84,7 +85,7 @@ namespace Cthangover.FFBattle.Actions
|
||||
var localTarget = Target.GlobalPosition - Source.Position;
|
||||
var iconStart = Source.GlobalPosition - Source.Position + new Vector2(20, -70);
|
||||
_itemIcon.Position = iconStart.Lerp(localTarget + new Vector2(20, -20), EaseInOutQuad(progress));
|
||||
_itemIcon.Modulate = new Color(1, 1, 1, 1f - progress * 0.5f);
|
||||
_itemIcon.Modulate = UiTokens.Alpha(UiTokens.White, 1f - progress * 0.5f);
|
||||
}
|
||||
|
||||
if (!_effectApplied && progress >= 0.3f)
|
||||
@@ -96,7 +97,7 @@ namespace Cthangover.FFBattle.Actions
|
||||
|
||||
Source.UpdateInfo();
|
||||
Target.UpdateInfo();
|
||||
Target.Flash(new Color(0.5f, 1f, 0.5f, 1f), 0.3f);
|
||||
Target.Flash(UiTokens.Success, 0.3f);
|
||||
}
|
||||
|
||||
if (progress >= 1f)
|
||||
@@ -139,3 +140,5 @@ namespace Cthangover.FFBattle.Actions
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+8
-4
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
@@ -10,6 +10,7 @@ using Cthangover.Core.Settings;
|
||||
using Cthangover.Core.Scenes;
|
||||
using Cthangover.Core.Utils;
|
||||
using Cthangover.FFBattle.UI;
|
||||
using Cthangover.Core.UI.Theming;
|
||||
using Godot;
|
||||
|
||||
namespace Cthangover.FFBattle
|
||||
@@ -254,7 +255,7 @@ namespace Cthangover.FFBattle
|
||||
|
||||
foreach (var widget in _playerPanel.Widgets)
|
||||
widget.ClearHighlight();
|
||||
_currentCharacter?.Highlight(new Color(0, 0.6f, 1f, 0.6f));
|
||||
_currentCharacter?.Highlight(UiTokens.Alpha(UiTokens.Info, 0.6f));
|
||||
}
|
||||
|
||||
private void OnMenuItemSelected(int index)
|
||||
@@ -427,13 +428,13 @@ namespace Cthangover.FFBattle
|
||||
{
|
||||
foreach (var widget in _playerPanel.Widgets)
|
||||
if (!widget.IsDead)
|
||||
widget.Highlight(new Color(0.3f, 1f, 0.3f, 0.5f));
|
||||
widget.Highlight(UiTokens.Alpha(UiTokens.Success, 0.5f));
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var widget in _enemyPanel.Widgets)
|
||||
if (!widget.IsDead)
|
||||
widget.Highlight(new Color(1f, 0.3f, 0.3f, 0.5f));
|
||||
widget.Highlight(UiTokens.Alpha(UiTokens.Danger, 0.5f));
|
||||
}
|
||||
|
||||
_onTargetSelected = null;
|
||||
@@ -868,3 +869,6 @@ namespace Cthangover.FFBattle
|
||||
public void AdvancePlayerTurn() => OnPlayerTurnEnd();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using Cthangover.Core.Mods;
|
||||
using Cthangover.Core.Mods.Resolvers;
|
||||
using Cthangover.Core.Characters;
|
||||
using Cthangover.Core.UI;
|
||||
using Cthangover.Core.UI.Theming;
|
||||
using Godot;
|
||||
|
||||
namespace Cthangover.FFBattle.UI
|
||||
@@ -40,6 +41,8 @@ namespace Cthangover.FFBattle.UI
|
||||
|
||||
protected override void Construct()
|
||||
{
|
||||
CthangoverTheme.Apply(this);
|
||||
|
||||
_sprite = GetNode<TextureRect>("Sprite");
|
||||
_hpBg = GetNode<ColorRect>("HpBg");
|
||||
_hpFill = GetNode<ColorRect>("HpFill");
|
||||
@@ -58,7 +61,7 @@ namespace Cthangover.FFBattle.UI
|
||||
_selection.Texture = _cachedSelectTex;
|
||||
_selection.ExpandMode = TextureRect.ExpandModeEnum.IgnoreSize;
|
||||
_selection.StretchMode = TextureRect.StretchModeEnum.Scale;
|
||||
_selection.Modulate = new Color(0, 0, 0, 0);
|
||||
_selection.Modulate = UiTokens.Alpha(UiTokens.White, 0f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,11 +96,11 @@ namespace Cthangover.FFBattle.UI
|
||||
_hpFill.Size = new Vector2((Size.X - 8) * hpPercent, 18);
|
||||
|
||||
if (hpPercent > 0.5f)
|
||||
_hpFill.Color = new Color(0.1f, 0.85f, 0.1f, 1f);
|
||||
_hpFill.Color = UiTokens.HpOk;
|
||||
else if (hpPercent > 0.25f)
|
||||
_hpFill.Color = new Color(0.85f, 0.85f, 0.1f, 1f);
|
||||
_hpFill.Color = UiTokens.Warning;
|
||||
else
|
||||
_hpFill.Color = new Color(0.85f, 0.1f, 0.1f, 1f);
|
||||
_hpFill.Color = UiTokens.HpLow;
|
||||
}
|
||||
|
||||
/// <summary>Shows a coloured selection overlay with a 0.15s tween fade-in. Used for target highlighting and selection indication.</summary>
|
||||
@@ -121,7 +124,7 @@ namespace Cthangover.FFBattle.UI
|
||||
_animTween?.Kill();
|
||||
_animTween = CreateTween();
|
||||
_animTween.SetEase(Tween.EaseType.Out).SetTrans(Tween.TransitionType.Quad);
|
||||
_animTween.TweenProperty(_selection, "modulate", new Color(0, 0, 0, 0), 0.15f);
|
||||
_animTween.TweenProperty(_selection, "modulate", UiTokens.Alpha(UiTokens.White, 0f), 0.15f);
|
||||
}
|
||||
|
||||
/// <summary>Rapidly oscillates the widget's position with random offsets (6 iterations) to simulate impact feedback.</summary>
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using Cthangover.Core.Characters;
|
||||
using Cthangover.Core.Scenes;
|
||||
using Cthangover.Core.UI;
|
||||
using Cthangover.Core.UI.Theming;
|
||||
using Godot;
|
||||
|
||||
namespace Cthangover.FFBattle.UI
|
||||
@@ -32,7 +33,10 @@ namespace Cthangover.FFBattle.UI
|
||||
/// <summary>Raised when an enemy widget is clicked (used for target selection).</summary>
|
||||
public event System.Action<FFCharacterWidget> OnEnemyClicked;
|
||||
|
||||
protected override void Construct() { }
|
||||
protected override void Construct()
|
||||
{
|
||||
CthangoverTheme.Apply(this);
|
||||
}
|
||||
|
||||
/// <summary>Number of enemy widget instances currently managed (including dead).</summary>
|
||||
public int EnemyCount => Widgets.Count;
|
||||
|
||||
+13
-4
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using Cthangover.Core.UI;
|
||||
using Cthangover.Core.UI.Theming;
|
||||
using Godot;
|
||||
|
||||
namespace Cthangover.FFBattle.UI
|
||||
@@ -36,7 +37,7 @@ namespace Cthangover.FFBattle.UI
|
||||
public partial class FFMenuPanel : ModWidget
|
||||
{
|
||||
private ColorRect _background;
|
||||
private ColorRect _border;
|
||||
private Panel _border;
|
||||
private Label _cursorLabel;
|
||||
private List<Label> _itemLabels = new();
|
||||
private Tween _cursorTween;
|
||||
@@ -74,9 +75,17 @@ namespace Cthangover.FFBattle.UI
|
||||
|
||||
protected override void Construct()
|
||||
{
|
||||
CthangoverTheme.Apply(this);
|
||||
|
||||
_background = GetNode<ColorRect>("Background");
|
||||
_border = GetNode<ColorRect>("Border");
|
||||
_background.Color = UiTokens.Surface2;
|
||||
|
||||
_border = GetNode<Panel>("Border");
|
||||
_border.AddThemeStyleboxOverride("panel",
|
||||
UiKit.Frame(UiTokens.RadiusSm, UiTokens.Alpha(UiTokens.White, 0f), UiTokens.AccentLine, 2));
|
||||
|
||||
_cursorLabel = GetNode<Label>("Cursor");
|
||||
_cursorLabel.AddThemeColorOverride("font_color", UiTokens.AccentBright);
|
||||
|
||||
GuiInput += OnPanelGuiInput;
|
||||
}
|
||||
@@ -101,8 +110,8 @@ namespace Cthangover.FFBattle.UI
|
||||
label.Text = entries[i].Label;
|
||||
label.AddThemeFontSizeOverride("font_size", 17);
|
||||
label.AddThemeColorOverride("font_color", entries[i].Enabled
|
||||
? new Color(1f, 1f, 1f, 1f)
|
||||
: new Color(0.5f, 0.5f, 0.5f, 1f));
|
||||
? UiTokens.Ink
|
||||
: UiTokens.Faint);
|
||||
label.MouseFilter = MouseFilterEnum.Stop;
|
||||
label.Position = new Vector2(PADDING + 24, PADDING + i * ITEM_HEIGHT + CURSOR_OFFSET_Y);
|
||||
label.Size = new Vector2(width - PADDING * 2 - 24, ITEM_HEIGHT);
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Linq;
|
||||
using Cthangover.Core.Characters;
|
||||
using Cthangover.Core.Scenes;
|
||||
using Cthangover.Core.UI;
|
||||
using Cthangover.Core.UI.Theming;
|
||||
using Godot;
|
||||
|
||||
namespace Cthangover.FFBattle.UI
|
||||
@@ -25,7 +26,10 @@ namespace Cthangover.FFBattle.UI
|
||||
/// <summary>Raised when a player widget is clicked — routed to <see cref="FFBattleCore"/> for character selection.</summary>
|
||||
public event System.Action<FFCharacterWidget> OnWidgetClicked;
|
||||
|
||||
protected override void Construct() { }
|
||||
protected override void Construct()
|
||||
{
|
||||
CthangoverTheme.Apply(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates <see cref="FFCharacterWidget"/> instances for each player, scales
|
||||
|
||||
Reference in new issue
Block a user