This commit is contained in:
2026-07-13 00:12:44 +08:00
parent 05bc1e286b
commit ffcdfa3b77
11 changed files with 441 additions and 17 deletions
+13 -3
View File
@@ -1,4 +1,4 @@
using Assets.MyGame.Scripts.Net;
using Assets.MyGame.Scripts.Net;
using Assets.MyGame.Scripts.Net.API.GameConfig_SubClass;
using Assets.MyGame.Scripts.Net.APIRequest.Objs;
using Assets.MyGame.Scripts.Net.APIResponses.HomeMain_User;
@@ -208,15 +208,25 @@ public class UIHomeMain : UIBase
}
public void UpdateUserData()
{
if (GameManager.Instance?.user?.assets == null) return;
tMP_GoldCoinNum.text = GameManager.Instance.user.assets.gold.ToString();
tMP_DiamondNum.text = GameManager.Instance.user.assets.diamond.ToString();
userName.text = GameManager.Instance.user.BaseInfo.userName;
userID.text = GameManager.Instance.user.BaseInfo.number;
img_VIP.sprite = sprite_VIP[GameManager.Instance.user.assets.vipLevel];
// VIP 图标越界保护:vipLevel 超出列表范围时用最后一个,避免异常中断刷新
int vipLevel = GameManager.Instance.user.assets.vipLevel;
if (sprite_VIP != null && sprite_VIP.Count > 0 && img_VIP != null)
{
int idx = Mathf.Clamp(vipLevel, 0, sprite_VIP.Count - 1);
img_VIP.sprite = sprite_VIP[idx];
}
RefreshAvatar();
RefreshAvatarFrame();
img_VIP.SetNativeSize();
if (img_VIP != null) img_VIP.SetNativeSize();
}
private void RefreshAvatar()