|
@@ -1,8 +1,8 @@
|
|
|
using System.Collections.Generic;
|
|
|
-using System.Linq;
|
|
|
using ET;
|
|
|
using FairyGUI;
|
|
|
using UI.Task;
|
|
|
+using UnityEngine;
|
|
|
|
|
|
namespace GFGGame
|
|
|
{
|
|
@@ -12,8 +12,11 @@ namespace GFGGame
|
|
|
|
|
|
private List<BattlePassCfg> _rewardCfgs;
|
|
|
|
|
|
+ private int maxShowIndex;
|
|
|
+
|
|
|
public override void Dispose()
|
|
|
{
|
|
|
+ maxShowIndex = 0;
|
|
|
if (_ui != null)
|
|
|
{
|
|
|
_ui.Dispose();
|
|
@@ -33,12 +36,10 @@ namespace GFGGame
|
|
|
clickBlankToClose = false;
|
|
|
|
|
|
_ui.m_btnOpen.onClick.Add(OnBtnOpenClick);
|
|
|
- // _ui.m_btnGet.onClick.Add(OnBtnGetClick);
|
|
|
- // _ui.m_btnContinue.onClick.Add(OnBtnContinueClick);
|
|
|
- // _ui.m_btnGetAll.onClick.Add(OnBtnGetAllClick);
|
|
|
- // _ui.m_btnGo.onClick.Add(OnBtnGoClick);
|
|
|
+ _ui.m_btnBuyLevel.onClick.Add(OnBtnBuyLevel);
|
|
|
_ui.m_btnGetAll.onClick.Add(OnBtnGetAllClick);
|
|
|
_ui.m_RewardList.itemRenderer = ListBoxRewardItemRender;
|
|
|
+ _ui.m_SpecialReward.m_RewardList.itemRenderer = SpecialRewardRender;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -52,16 +53,20 @@ namespace GFGGame
|
|
|
_ui.m_RewardList.numItems = _rewardCfgs.Count - 1;
|
|
|
SetSeasonLeftTime();
|
|
|
SetBattlePassLevel();
|
|
|
+ SetOpenBattlePassBtnStatus();
|
|
|
+ FreshSpecialReward();
|
|
|
}
|
|
|
|
|
|
|
|
|
//开启通行证
|
|
|
private void OnBtnOpenClick(EventContext context)
|
|
|
{
|
|
|
+ ViewManager.Show<OpenBattlePassView>(null, new object[] { typeof(BattlePassTaskView).FullName, null });
|
|
|
}
|
|
|
|
|
|
private void OnBtnBuyLevel(EventContext context)
|
|
|
{
|
|
|
+ ViewManager.Show<BuyBattlePassLevelView>(null, new object[] { typeof(BattlePassTaskView).FullName, null });
|
|
|
}
|
|
|
|
|
|
//领取奖励
|
|
@@ -97,8 +102,9 @@ namespace GFGGame
|
|
|
private void ListBoxRewardItemRender(int index, GObject obj)
|
|
|
{
|
|
|
var item = UI_BattlePassRewardItem.Proxy(obj);
|
|
|
+ var level = index + 1;
|
|
|
//这里跳过为0的第一个配置
|
|
|
- var battlePassCfg = _rewardCfgs[index + 1];
|
|
|
+ var battlePassCfg = _rewardCfgs[level];
|
|
|
//设置等级
|
|
|
item.m_Level.text = battlePassCfg.level.ToString();
|
|
|
//设置奖励
|
|
@@ -121,11 +127,11 @@ namespace GFGGame
|
|
|
item.m_RewardList.data = battlePassCfg.bonusSpecialArr;
|
|
|
item.m_RewardList.numItems = battlePassCfg.bonusSpecialArr.Length;
|
|
|
//获取玩家当前的通行证等级
|
|
|
- var dataManager = BattlePassTaskDataManager.Instance;
|
|
|
- var state = 1;
|
|
|
+ var state = BattlePassTaskDataManager.Instance.GetRewardState(level);
|
|
|
//设置按钮状态
|
|
|
SetBtnState(item, battlePassCfg.id, state);
|
|
|
item.target.data = battlePassCfg;
|
|
|
+ maxShowIndex = Mathf.Max(maxShowIndex, level);
|
|
|
UI_BattlePassRewardItem.ProxyEnd();
|
|
|
}
|
|
|
|
|
@@ -148,7 +154,6 @@ namespace GFGGame
|
|
|
item.m_loaIcon.url = ResPathUtil.GetCommonGameResPath(itemCfg.res);
|
|
|
item.m_num.text = num.ToString();
|
|
|
}
|
|
|
-
|
|
|
UI_RewardIconYellow.ProxyEnd();
|
|
|
}
|
|
|
|
|
@@ -200,7 +205,6 @@ namespace GFGGame
|
|
|
_ui.m_LeftTime.text = TimeUtil.FormattingTime(TimeHelper.ServerNow(), seasonEndTime);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
private void SetBattlePassLevel()
|
|
|
{
|
|
|
//获取玩家当前的通行证等级
|
|
@@ -213,12 +217,43 @@ namespace GFGGame
|
|
|
BattlePassCfgArray.Instance.GetCfgByidAndlevel(dataManager.GetSeasonId(),
|
|
|
dataManager.GetBattlePassLevel());
|
|
|
uiExpProcess.target.max = battlePassCfg.value;
|
|
|
- uiExpProcess.target.value = 50;
|
|
|
+ uiExpProcess.target.value = dataManager.GetBattlePassExp();
|
|
|
+ uiExpProcess.m_NumProcess.SetVar("value", dataManager.GetBattlePassExp().ToString())
|
|
|
+ .SetVar("maxValue", battlePassCfg.value.ToString()).FlushVars();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void SetOpenBattlePassBtnStatus()
|
|
|
+ {
|
|
|
+ //通行证是否购买
|
|
|
+ var isBuy = BattlePassTaskDataManager.Instance.GetIsBuy();
|
|
|
+ _ui.m_c1.selectedIndex = isBuy ? 0 : 1;
|
|
|
}
|
|
|
|
|
|
//刷新特别大奖展示
|
|
|
private void FreshSpecialReward()
|
|
|
{
|
|
|
+ var battlePassCfg = BattlePassTaskDataManager.Instance.GetSpecialCfg(maxShowIndex);
|
|
|
+ var uiBattlePassReward = _ui.m_SpecialReward;
|
|
|
+ if (battlePassCfg == null)
|
|
|
+ {
|
|
|
+ uiBattlePassReward.target.visible = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ uiBattlePassReward.target.visible = true;
|
|
|
+ uiBattlePassReward.m_Level.text = battlePassCfg.level.ToString();
|
|
|
+ //设置奖励
|
|
|
+ var bonusNormalArr = battlePassCfg.bonusNormalArr;
|
|
|
+ if (bonusNormalArr != null && bonusNormalArr.Length > 0)
|
|
|
+ {
|
|
|
+ var itemCfg = ItemCfgArray.Instance.GetCfg(bonusNormalArr[0][0]);
|
|
|
+ if (itemCfg != null)
|
|
|
+ {
|
|
|
+ uiBattlePassReward.m_NormalReward.m_loaIcon.url = ResPathUtil.GetCommonGameResPath(itemCfg.res);
|
|
|
+ uiBattlePassReward.m_NormalReward.m_num.text = bonusNormalArr[0][1].ToString();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ uiBattlePassReward.m_RewardList.data = battlePassCfg.bonusSpecialArr;
|
|
|
+ uiBattlePassReward.m_RewardList.numItems = battlePassCfg.bonusSpecialArr.Length;
|
|
|
}
|
|
|
}
|
|
|
}
|