diff --git a/Assets/MyGame/Scripts/Net/APIRequest/Params/HallRequest.cs b/Assets/MyGame/Scripts/Net/APIRequest/Params/HallRequest.cs
index d4cd96a75..21445f476 100644
--- a/Assets/MyGame/Scripts/Net/APIRequest/Params/HallRequest.cs
+++ b/Assets/MyGame/Scripts/Net/APIRequest/Params/HallRequest.cs
@@ -188,11 +188,18 @@ namespace Assets.MyGame.Scripts.Net.APIRequest.Params
public int type; // �������� 1=��Ӣ 2=����
}
- /// ��ȡ�û������б���GET��
+ /// 获取用户任务列表(GET)
[Serializable]
public class GetUserTaskListParam : RequestParamBase
{
- public int taskType = -1; // -1=ȫ��
+ public int taskType = -1; // -1=全部
+ }
+
+ /// 领取 Vip 每日礼包(GET)参数:当前 vip 等级,领取 V1~vipLevel 所有每日礼包
+ [Serializable]
+ public class GetVipDayGiftParam : RequestParamBase
+ {
+ public int vipLevel;
}
/// 发送全服广播(GET)
diff --git a/Assets/MyGame/Scripts/Net/APIRequestList_Hall.cs b/Assets/MyGame/Scripts/Net/APIRequestList_Hall.cs
index 8446b567d..89a5b53f0 100644
--- a/Assets/MyGame/Scripts/Net/APIRequestList_Hall.cs
+++ b/Assets/MyGame/Scripts/Net/APIRequestList_Hall.cs
@@ -164,12 +164,13 @@ namespace Assets.MyGame.Scripts.Net
///
/// 领取 Vip 每日礼包(GET)
- /// 参数:用户ID
+ /// 参数:当前 vip 等级(领取 V1~vipLevel 所有每日礼包)
/// 返回:GiftInfo(礼包信息)
///
- public static void GetVipDayGift( Action callback)
+ public static void GetVipDayGift(int vipLevel, Action callback)
{
- APIManager.Response(APIType.Hall_GetVipDayGift, callback);
+ APIManager.Response(APIType.Hall_GetVipDayGift,
+ new GetVipDayGiftParam { vipLevel = vipLevel }, callback);
}
///
diff --git a/Assets/MyGame/aa/UI/Home/Sub/UIHome_BY_ShopPanel.cs b/Assets/MyGame/aa/UI/Home/Sub/UIHome_BY_ShopPanel.cs
index c3ac8827a..6ceb935b3 100644
--- a/Assets/MyGame/aa/UI/Home/Sub/UIHome_BY_ShopPanel.cs
+++ b/Assets/MyGame/aa/UI/Home/Sub/UIHome_BY_ShopPanel.cs
@@ -218,6 +218,11 @@ public class UIHome_BY_ShopPanel : SubUIBase
foreach (var item in gameConfig.propConfig)
{
if (item.isSale == false || item.isEnable == false) continue;
+ // 炮台/翅膀/战神已有单独的 Tab,这里剔除
+ if (item.type == (int)PropEnum.炮台
+ || item.type == (int)PropEnum.翅膀
+ || item.type == (int)PropEnum.VIP经验
+ || item.type == (int)PropEnum.战神) continue;
var obj = Instantiate(obj_ItemPrefab, tra_PrefabParent).transform;
if (item.sprite_Icon == null)
diff --git a/Assets/MyGame/aa/UI/Home/Sub/UIHome_BY_VIPPanel.cs b/Assets/MyGame/aa/UI/Home/Sub/UIHome_BY_VIPPanel.cs
index 68e709a2c..edc84d8e5 100644
--- a/Assets/MyGame/aa/UI/Home/Sub/UIHome_BY_VIPPanel.cs
+++ b/Assets/MyGame/aa/UI/Home/Sub/UIHome_BY_VIPPanel.cs
@@ -35,6 +35,7 @@ public class UIHome_BY_VIPPanel : SubUIBase
public List img_VIPNumBG;
private int vipLevel = 0;
+ private int currentDisplayLevel = 0; // 当前正在查看的等级(用于数据刷新后还原显示)
private List vipConfigs;
public override void Awake()
@@ -51,6 +52,9 @@ public class UIHome_BY_VIPPanel : SubUIBase
private void OnUserDataChanged()
{
vipLevel = GameManager.Instance.user.assets.vipLevel;
+ // 拉取到最新 UserToken 后,刷新当前查看等级的 UI(经验、进度条、按钮状态等)
+ if (currentDisplayLevel > 0 && vipConfigs != null)
+ UpdateVIPPanel(currentDisplayLevel);
}
protected override void OnShow(object args = null)
@@ -115,6 +119,8 @@ public class UIHome_BY_VIPPanel : SubUIBase
var config = vipConfigs?.Find(v => v.level == level);
if (config == null) return;
+ currentDisplayLevel = level;
+
txt_VIPLevel.text = $"{level}";
txt_VIPContent.text = config.remark;
@@ -170,32 +176,38 @@ public class UIHome_BY_VIPPanel : SubUIBase
}
else
{
- btn_Award_Get.gameObject.SetActive(true);
- btn_Award_GetEnd.SetActive(false);
btn_Award_NotUnlock.SetActive(false);
- btn_Award_Get.onClick.RemoveAllListeners();
- btn_Award_Get.onClick.AddListener(() =>
+ // 按等级独立判断:vipGift 为未领取的 Vip 礼包等级集合,包含当前等级则可领取
+ bool canReceive = assets?.vipGift != null && System.Array.IndexOf(assets.vipGift, level) >= 0;
+ btn_Award_Get.gameObject.SetActive(canReceive);
+ btn_Award_GetEnd.SetActive(!canReceive);
+
+ if (canReceive)
{
- APIRequestList.GetVipDayGift(result =>
+ btn_Award_Get.onClick.RemoveAllListeners();
+ btn_Award_Get.onClick.AddListener(() =>
{
- if (result != null)
+ // 传入当前查看的等级,领取该等级的每日礼包
+ APIRequestList.GetVipDayGift(level, result =>
{
- UIManager.Instance.ShowBoardError("领取成功");
-
- btn_Award_Get.gameObject.SetActive(false);
- btn_Award_GetEnd.SetActive(true);
-
- var userId = GameManager.Instance?.user?.id;
- if (!string.IsNullOrEmpty(userId))
- APIRequestList.GetUser(userId, a => GameManager.Instance.UpdataUserData(a));
- }
- else
- {
- UIManager.Instance.ShowBoardError("领取失败");
- }
+ if (result != null)
+ {
+ UIManager.Instance.ShowBoardError("领取成功");
+ // 拉取服务器最新 UserToken(含更新后的 vipGift),触发 OnUserDataChanged 刷新 UI
+ APIRequestList.GetUser(user =>
+ {
+ if (user != null)
+ GameManager.Instance.UpdataUserData(user);
+ });
+ }
+ else
+ {
+ UIManager.Instance.ShowBoardError("领取失败");
+ }
+ });
});
- });
+ }
}
}