(client) feat:健康给予,路径优化,结算界面,商店界面 (#60)

Co-authored-by: m0_75251201 <m0_75251201@noreply.gitcode.com>
Reviewed-on: http://47.107.252.169:3000/Roguelite-Game-Developing-Team/Gen_Hack-and-Slash-Roguelite/pulls/60
This commit is contained in:
2025-10-10 14:08:23 +08:00
parent 9a797479ff
commit 16b49f3d3a
1900 changed files with 114053 additions and 34157 deletions

View File

@@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;
using Data;
using Managers;
@@ -25,34 +24,34 @@ namespace UI
// 目标角色动画显示尺寸
private float targetCharacterAnimationDisplaySize = 600f;
// 当前选中的角色索引
public int currentCharacter;
// 存储角色动画和角色定义的列表
public List<(TemporaryAnimatorImageUI, CharacterDef)> characterAnimation = new();
// 当前选中的角色索引
public int currentCharacter = 0;
// 获取当前选中的角色定义
public CharacterDef SelectedCharacter => characterAnimation[currentCharacter].Item2;
/// <summary>
/// 当脚本实例被启用时调用。
/// 初始化角色UI加载角色数据并生成动画。
/// 当脚本实例被启用时调用。
/// 初始化角色UI加载角色数据并生成动画。
/// </summary>
private void Start()
{
Program.Instance.FocusedDimension.OnDimensionLoaded += MapLoaded;
enterButton.interactable = false;
buttonText.text = "地图加载中";
var characterDefs = DefineManager.Instance.QueryDefinesByType<CharacterDef>();
if (characterDefs == null || characterDefs.Length == 0)
{
Debug.LogWarning("未找到任何角色定义禁用SelectCharacterUI。");
gameObject.SetActive(false);
return;
}
foreach (var def in characterDefs)
{
if (def.drawingOrder == null)
@@ -120,7 +119,6 @@ namespace UI
}
UpdateUI(currentCharacter); // 初始显示第一个角色
}
private void MapLoaded(Dimension dimension)
@@ -131,7 +129,7 @@ namespace UI
}
/// <summary>
/// 更新UI显示当前选中角色的动画和信息。
/// 更新UI显示当前选中角色的动画和信息。
/// </summary>
/// <param name="newCharacterIndex">新角色的索引。</param>
public void UpdateUI(int newCharacterIndex)
@@ -163,9 +161,7 @@ namespace UI
{
var previousAnimator = characterAnimation[currentCharacter].Item1;
if (previousAnimator != null && previousAnimator.gameObject.activeSelf)
{
previousAnimator.gameObject.SetActive(false);
}
}
currentCharacter = newCharacterIndex; // 更新当前角色索引
@@ -173,23 +169,18 @@ namespace UI
// 激活新的角色动画
var currentAnimator = characterAnimation[currentCharacter].Item1;
if (currentAnimator != null)
{
currentAnimator.gameObject.SetActive(true);
}
else
{
// 如果当前选中的角色动画组件丢失,记录警告并尝试继续显示信息
Debug.LogWarning($"当前选中角色的动画组件为null (索引: {currentCharacter})。");
// 考虑更强大的错误处理跳到下一个有效角色或者禁用此UI。
}
// 考虑更强大的错误处理跳到下一个有效角色或者禁用此UI。
// 更新角色信息
var def = characterAnimation[currentCharacter].Item2;
characterInformation.text = $"<color=#FFBF00>{def.label}</color>\n{def.description}";
}
/// <summary>
/// 处理用户点击左箭头按钮的逻辑,切换到上一个角色。
/// 处理用户点击左箭头按钮的逻辑,切换到上一个角色。
/// </summary>
public void OnLeft()
{
@@ -207,7 +198,7 @@ namespace UI
}
/// <summary>
/// 处理用户点击右箭头按钮的逻辑,切换到下一个角色。
/// 处理用户点击右箭头按钮的逻辑,切换到下一个角色。
/// </summary>
public void OnRight()
{
@@ -225,7 +216,7 @@ namespace UI
}
/// <summary>
/// 处理用户点击“确认”按钮的逻辑选择当前角色并关闭UI。
/// 处理用户点击“确认”按钮的逻辑选择当前角色并关闭UI。
/// </summary>
public void OnEnter()
{