1
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user