测试三阵营
This commit is contained in:
@@ -17,7 +17,11 @@ namespace TcgEngine.UI
|
||||
public bool is_opponent;
|
||||
public Text pname;
|
||||
public AvatarUI avatar;
|
||||
public IconBar mana_bar;
|
||||
public IconBar mana_bar; // 保留原有mana条,作为通用mana显示
|
||||
|
||||
[Header("Team Mana Bars")]
|
||||
public IconBar[] team_mana_bars = new IconBar[3]; // ManaBar_0, ManaBar_1, ManaBar_2
|
||||
|
||||
public Text hp_txt;
|
||||
public Text hp_max_txt;
|
||||
|
||||
@@ -68,8 +72,57 @@ namespace TcgEngine.UI
|
||||
if (player != null)
|
||||
{
|
||||
pname.text = player.username;
|
||||
|
||||
// 更新通用mana条
|
||||
mana_bar.value = player.mana;
|
||||
mana_bar.max_value = player.mana_max;
|
||||
|
||||
// 更新阵营mana条 - fire, forest, water
|
||||
if (team_mana_bars.Length >= 3)
|
||||
{
|
||||
// ManaBar_0 = fire
|
||||
if (team_mana_bars[0] != null)
|
||||
{
|
||||
team_mana_bars[0].value = player.mana_fire;
|
||||
team_mana_bars[0].max_value = player.mana_max;
|
||||
Debug.Log($"Fire Mana: {player.mana_fire}/{player.mana_max}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("team_mana_bars[0] is null!");
|
||||
}
|
||||
|
||||
// ManaBar_1 = forest
|
||||
if (team_mana_bars[1] != null)
|
||||
{
|
||||
team_mana_bars[1].value = player.mana_forest;
|
||||
team_mana_bars[1].max_value = player.mana_max;
|
||||
Debug.Log($"Forest Mana: {player.mana_forest}/{player.mana_max}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("team_mana_bars[1] is null!");
|
||||
}
|
||||
|
||||
// ManaBar_2 = water
|
||||
if (team_mana_bars[2] != null)
|
||||
{
|
||||
team_mana_bars[2].value = player.mana_water;
|
||||
team_mana_bars[2].max_value = player.mana_max;
|
||||
Debug.Log($"Water Mana: {player.mana_water}/{player.mana_max}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("team_mana_bars[2] is null!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning($"team_mana_bars.Length = {team_mana_bars.Length}, expected 3");
|
||||
}
|
||||
|
||||
|
||||
|
||||
hp_txt.text = prev_hp.ToString();
|
||||
hp_max_txt.text = "/" + player.hp_max.ToString();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user