头像路径
This commit is contained in:
@@ -76,13 +76,12 @@ namespace TcgEngine.UI
|
||||
hp_txt.text = prev_hp.ToString();
|
||||
hp_max_txt.text = "/" + player.hp_max.ToString();
|
||||
|
||||
AvatarData adata = AvatarData.Get(player.avatar);
|
||||
if (avatar != null && adata != null && !killed)
|
||||
avatar.SetAvatar(adata);
|
||||
|
||||
delayed_damage_timer -= Time.deltaTime;
|
||||
if (!IsDamagedDelayed())
|
||||
prev_hp = player.hp;
|
||||
// 默认头像
|
||||
string avatarId = !string.IsNullOrEmpty(player.avatar) ? player.avatar : "horse";
|
||||
string avatarPath = "Avatar/" + avatarId + ".png";
|
||||
|
||||
// 设置头像路径
|
||||
SetAvatarByPath(avatarPath);
|
||||
}
|
||||
|
||||
|
||||
@@ -93,6 +92,17 @@ namespace TcgEngine.UI
|
||||
SlowUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通过路径设置头像
|
||||
/// </summary>
|
||||
private void SetAvatarByPath(string avatarPath)
|
||||
{
|
||||
if (avatar != null && !killed)
|
||||
{
|
||||
avatar.SetAvatarPath(avatarPath);
|
||||
}
|
||||
}
|
||||
|
||||
void SlowUpdate()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user