添加“奖励 3 选 1”UI

- RewardSelectForm:其中包括 3 个可选的 RewardItem ,刷新和放弃按钮
- 应用战斗节点基地生命产生的额外事件
This commit is contained in:
SepComet
2026-03-02 21:42:27 +08:00
parent daba9cbdf9
commit 3e52a4df55
52 changed files with 4495 additions and 133 deletions
@@ -7,5 +7,6 @@ namespace GeometryTD.UI
public string Title;
public long InstanceId;
public TowerCompSlotType ComponentSlotType;
public IconAreaContext IconAreaContext;
}
}
@@ -93,7 +93,8 @@ namespace GeometryTD.UI
{
Title = $"[Tower] {tower.Name} ({tower.Rarity})",
InstanceId = tower.InstanceId,
ComponentSlotType = TowerCompSlotType.None
ComponentSlotType = TowerCompSlotType.None,
IconAreaContext = BuildIconAreaContext(tower.Rarity)
});
}
}
@@ -106,7 +107,8 @@ namespace GeometryTD.UI
{
Title = $"[Muzzle] {item.Name} ({item.Rarity})",
InstanceId = item.InstanceId,
ComponentSlotType = TowerCompSlotType.Muzzle
ComponentSlotType = TowerCompSlotType.Muzzle,
IconAreaContext = BuildIconAreaContext(item.Rarity)
});
}
}
@@ -119,7 +121,8 @@ namespace GeometryTD.UI
{
Title = $"[Bearing] {item.Name} ({item.Rarity})",
InstanceId = item.InstanceId,
ComponentSlotType = TowerCompSlotType.Bearing
ComponentSlotType = TowerCompSlotType.Bearing,
IconAreaContext = BuildIconAreaContext(item.Rarity)
});
}
}
@@ -132,7 +135,8 @@ namespace GeometryTD.UI
{
Title = $"[Base] {item.Name} ({item.Rarity})",
InstanceId = item.InstanceId,
ComponentSlotType = TowerCompSlotType.Base
ComponentSlotType = TowerCompSlotType.Base,
IconAreaContext = BuildIconAreaContext(item.Rarity)
});
}
}
@@ -158,6 +162,15 @@ namespace GeometryTD.UI
_itemContextMap[itemContext.InstanceId] = itemContext;
}
private static IconAreaContext BuildIconAreaContext(RarityType rarity)
{
return new IconAreaContext
{
Rarity = rarity,
Icon = null
};
}
private void OnRepoItemSelected(object sender, GameEventArgs e)
{
if (!(e is RepoItemSelectedEventArgs args))
@@ -1,4 +1,3 @@
using System.Collections.Generic;
using GeometryTD.Definition;
namespace GeometryTD.UI
@@ -2,7 +2,6 @@ using GeometryTD.CustomEvent;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using UnityGameFramework.Runtime;
namespace GeometryTD.UI
{
@@ -10,6 +9,7 @@ namespace GeometryTD.UI
{
[SerializeField] private TMP_Text _titleText;
[SerializeField] private Image _highlightImage;
[SerializeField] private IconArea _iconArea;
private static readonly Color NormalColor = new Color32(40, 40, 40, 180);
private static readonly Color SelectedColor = new Color32(255, 216, 102, 255);
@@ -31,6 +31,8 @@ namespace GeometryTD.UI
_titleText.text = context.Title ?? string.Empty;
}
_iconArea.OnInit(context.IconAreaContext);
SetSelected(false);
}