|
@@ -38,6 +38,8 @@ namespace GFGGame
|
|
|
_ui.m_SpecialReward.m_RewardList.itemRenderer = SpecialRewardRender;
|
|
|
_ui.m_tip.onClick.Add(RuleController.ShowRuleView);
|
|
|
_ui.m_tip.data = 300012;
|
|
|
+ _ui.m_LevelProcess.m_NumProcess.icon =
|
|
|
+ ResPathUtil.GetCommonGameResPath(ItemCfgArray.Instance.GetCfg(ConstItemID.BATTLE_PASS_CURRENCY).res);
|
|
|
}
|
|
|
|
|
|
protected override void OnHide()
|
|
@@ -103,25 +105,32 @@ namespace GFGGame
|
|
|
}
|
|
|
|
|
|
//继续领取
|
|
|
- private async void OnBtnContinueClick(EventContext context)
|
|
|
+ private void OnBtnContinueClick(EventContext context)
|
|
|
{
|
|
|
- if (!(context.sender is GObject obj)) return;
|
|
|
- var id = (int)obj.data;
|
|
|
- var isBuy = BattlePassTaskDataManager.Instance.GetIsBuy();
|
|
|
- if (!isBuy)
|
|
|
- {
|
|
|
- ViewManager.Show<OpenBattlePassView>(null, new object[] { typeof(BattlePassTaskView).FullName, null });
|
|
|
- return;
|
|
|
- }
|
|
|
- var get = await BattlePassTaskSProxy.GetBattlePassReward(id);
|
|
|
- if (!get) return;
|
|
|
- SetBattlePassLevel();
|
|
|
+ // if (!(context.sender is GObject obj)) return;
|
|
|
+ // var id = (int)obj.data;
|
|
|
+ // var isBuy = BattlePassTaskDataManager.Instance.GetIsBuy();
|
|
|
+ // if (!isBuy)
|
|
|
+ // {
|
|
|
+ ViewManager.Show<OpenBattlePassView>(null, new object[] { typeof(BattlePassTaskView).FullName, null });
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // var get = await BattlePassTaskSProxy.GetBattlePassReward(id);
|
|
|
+ // if (!get) return;
|
|
|
+ // SetBattlePassLevel();
|
|
|
}
|
|
|
|
|
|
//领取全部奖励
|
|
|
private async void OnBtnGetAllClick(EventContext context)
|
|
|
{
|
|
|
- var get = await BattlePassTaskSProxy.GetAllBattlePassReward();
|
|
|
+ var get = await BattlePassTaskSProxy.GetAllBattlePassReward(onSuccess: () =>
|
|
|
+ {
|
|
|
+ var isBuy = BattlePassTaskDataManager.Instance.GetIsBuy();
|
|
|
+ if (isBuy) return;
|
|
|
+ ViewManager.Show<BuyBattlePassLevelView>(null,
|
|
|
+ new object[] { typeof(BattlePassTaskView).FullName, null });
|
|
|
+ });
|
|
|
+ SetBattlePassLevel();
|
|
|
if (!get) return;
|
|
|
SetBattlePassLevel();
|
|
|
}
|
|
@@ -140,6 +149,7 @@ namespace GFGGame
|
|
|
{
|
|
|
var item = UI_BattlePassRewardItem.Proxy(obj);
|
|
|
var level = index + 1;
|
|
|
+
|
|
|
//设置进度
|
|
|
item.m_imageProgress.visible = BattlePassTaskDataManager.Instance.GetBattlePassLevel() >= level;
|
|
|
//这里跳过为0的第一个配置
|
|
@@ -150,16 +160,25 @@ namespace GFGGame
|
|
|
var bonusNormalArr = battlePassCfg.bonusNormalArr;
|
|
|
if (bonusNormalArr != null && bonusNormalArr.Length > 0)
|
|
|
{
|
|
|
+ item.m_NormalReward.visible = true;
|
|
|
var itemData = ItemUtil.createItemData(bonusNormalArr[0]);
|
|
|
- item.m_NormalReward.data ??= new ItemView(item.m_NormalReward);
|
|
|
- (item.m_NormalReward.data as ItemView)?.SetData(itemData);
|
|
|
- (item.m_NormalReward.data as ItemView)?.ChangeTxtCountStyle();
|
|
|
+ var itemView = new ItemView(item.m_NormalReward);
|
|
|
+ item.m_NormalReward.data ??= itemView;
|
|
|
+ itemView.SetData(itemData);
|
|
|
+ itemView.ChangeTxtCountStyle();
|
|
|
+ itemView.GrpGotVisible = BattlePassTaskDataManager.Instance.CheckLevelRewardGet(level);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ item.m_NormalReward.data = null;
|
|
|
+ item.m_NormalReward.visible = false;
|
|
|
}
|
|
|
if (item.m_RewardList.data == null)
|
|
|
{
|
|
|
item.m_RewardList.itemRenderer = SpecialRewardRender;
|
|
|
}
|
|
|
- item.m_RewardList.data = battlePassCfg.bonusSpecialArr;
|
|
|
+ var superLevelRewardGet = BattlePassTaskDataManager.Instance.CheckSuperLevelRewardGet(level);
|
|
|
+ item.m_RewardList.data = (battlePassCfg.bonusSpecialArr, superLevelRewardGet);
|
|
|
item.m_RewardList.numItems = battlePassCfg.bonusSpecialArr.Length;
|
|
|
//获取玩家当前的通行证等级
|
|
|
var state = BattlePassTaskDataManager.Instance.GetRewardState(level);
|
|
@@ -173,12 +192,14 @@ namespace GFGGame
|
|
|
//SpecialRewardRender
|
|
|
private static void SpecialRewardRender(int index, GObject obj)
|
|
|
{
|
|
|
- var parentData = (int[][])obj.parent.data;
|
|
|
- var itemInfo = parentData[index];
|
|
|
+ var keyValuePair = ((int[][], bool))obj.parent.data;
|
|
|
+ var itemInfo = keyValuePair.Item1[index];
|
|
|
var itemData = ItemUtil.createItemData(itemInfo);
|
|
|
- obj.data ??= new ItemView(obj as GComponent);
|
|
|
- (obj.data as ItemView)?.SetData(itemData);
|
|
|
- (obj.data as ItemView)?.ChangeTxtCountStyle();
|
|
|
+ var itemView = new ItemView(obj as GComponent);
|
|
|
+ obj.data ??= itemView;
|
|
|
+ itemView.SetData(itemData);
|
|
|
+ itemView.ChangeTxtCountStyle();
|
|
|
+ itemView.GrpGotVisible = keyValuePair.Item2;
|
|
|
}
|
|
|
|
|
|
//根据状态设置按钮
|
|
@@ -235,14 +256,24 @@ namespace GFGGame
|
|
|
//获取当前等级的经验
|
|
|
var battlePassCfg =
|
|
|
BattlePassCfgArray.Instance.GetCfgByidAndlevel(seasonId, dataManager.GetBattlePassLevel());
|
|
|
- uiExpProcess.target.max = battlePassCfg.value;
|
|
|
- uiExpProcess.target.value = dataManager.GetBattlePassExp();
|
|
|
- uiExpProcess.m_NumProcess.SetVar("value", dataManager.GetBattlePassExp().ToString())
|
|
|
- .SetVar("maxValue", battlePassCfg.value.ToString()).FlushVars();
|
|
|
- //刷新奖励列表
|
|
|
- _rewardCfgs = new List<BattlePassCfg>(BattlePassCfgArray.Instance.GetCfgsByid(seasonId));
|
|
|
- //去掉第一个为0的配置
|
|
|
- _ui.m_RewardList.numItems = _rewardCfgs.Count - 1;
|
|
|
+ if (battlePassCfg == null)
|
|
|
+ {
|
|
|
+ //已经超过了最大等级
|
|
|
+ uiExpProcess.target.max = 100;
|
|
|
+ uiExpProcess.target.value = 0;
|
|
|
+ uiExpProcess.m_c1.selectedIndex = 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ uiExpProcess.target.max = battlePassCfg.value;
|
|
|
+ uiExpProcess.target.value = dataManager.GetBattlePassExp();
|
|
|
+ uiExpProcess.m_NumProcess.SetVar("value", dataManager.GetBattlePassExp().ToString())
|
|
|
+ .SetVar("maxValue", battlePassCfg.value.ToString()).FlushVars();
|
|
|
+ //刷新奖励列表
|
|
|
+ _rewardCfgs = new List<BattlePassCfg>(BattlePassCfgArray.Instance.GetCfgsByid(seasonId));
|
|
|
+ //去掉第一个为0的配置
|
|
|
+ _ui.m_RewardList.numItems = _rewardCfgs.Count - 1;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void SetOpenBattlePassBtnStatus()
|
|
@@ -273,12 +304,18 @@ namespace GFGGame
|
|
|
var bonusNormalArr = battlePassCfg.bonusNormalArr;
|
|
|
if (bonusNormalArr != null && bonusNormalArr.Length > 0)
|
|
|
{
|
|
|
+ uiBattlePassReward.m_NormalReward.visible = true;
|
|
|
var itemData = ItemUtil.createItemData(bonusNormalArr[0]);
|
|
|
var item = new ItemView(uiBattlePassReward.m_NormalReward);
|
|
|
item.SetData(itemData);
|
|
|
item.ChangeTxtCountStyle();
|
|
|
}
|
|
|
- uiBattlePassReward.m_RewardList.data = battlePassCfg.bonusSpecialArr;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ uiBattlePassReward.m_NormalReward.visible = false;
|
|
|
+ }
|
|
|
+ var state = BattlePassTaskDataManager.Instance.CheckSuperLevelRewardGet(level);
|
|
|
+ uiBattlePassReward.m_RewardList.data = (battlePassCfg.bonusSpecialArr, state);
|
|
|
uiBattlePassReward.m_RewardList.numItems = battlePassCfg.bonusSpecialArr.Length;
|
|
|
}
|
|
|
}
|