|
@@ -47,16 +47,18 @@ namespace GFGGame
|
|
|
_rewardListUI = _ui.m_panel.m_scrollPane.m_list;
|
|
|
_rewardListUI.itemRenderer = RenderListReward;
|
|
|
_rewardListUI.numItems = ActivityAfuGiftDataManager.Instance.RewardCfgs.Count;
|
|
|
- InitUI();
|
|
|
}
|
|
|
|
|
|
protected override void OnShown()
|
|
|
{
|
|
|
base.OnShown();
|
|
|
+
|
|
|
+ InitUI();
|
|
|
+ UpdateState();
|
|
|
ProgressAutoLocate();
|
|
|
UpdateTime(null);
|
|
|
Timers.inst.Add(1, 0, UpdateTime);
|
|
|
- UpdateState();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
protected override void OnHide()
|
|
@@ -80,25 +82,19 @@ namespace GFGGame
|
|
|
private void InitUI()
|
|
|
{
|
|
|
_ui.m_c1.SetSelectedIndex(ActivityAfuGiftDataManager.Instance.GetIsBuy() ? 1 : 0);
|
|
|
- // 使列表宽度等于子节点的总宽度
|
|
|
- float itemWidth = _rewardListUI.GetChildAt(0).width;
|
|
|
- float columnGap = _rewardListUI.columnGap;
|
|
|
- _rewardListUI.width = CalculateListWidth(_rewardListUI.numItems, itemWidth, columnGap);
|
|
|
- Timers.inst.StartCoroutine(InitProgressWidth());
|
|
|
+ _rewardListUI.ResizeToFit();
|
|
|
+ InitProgressWidth();
|
|
|
}
|
|
|
|
|
|
- private IEnumerator InitProgressWidth()
|
|
|
+ private void InitProgressWidth()
|
|
|
{
|
|
|
GProgressBar gProgressBar = _ui.m_panel.m_scrollPane.m_progress;
|
|
|
- gProgressBar.width = 0;
|
|
|
- // 等待窗口动画结束
|
|
|
- yield return new WaitForSeconds(0.3f);
|
|
|
// 根据列表 初始化进度条长度
|
|
|
float marginLeft = 149;
|
|
|
gProgressBar.width = marginLeft + _rewardListUI.GetChildAt(_rewardListUI.numChildren - 1).position.x - _rewardListUI.GetChildAt(0).position.x;
|
|
|
// 初始化进度条值
|
|
|
int indexDay = ActivityAfuGiftDataManager.Instance.GetIndexDay();
|
|
|
- gProgressBar.value = CalculateProgressCount(indexDay, _rewardListUI.numChildren);
|
|
|
+ gProgressBar.value = CalculateProgressValue(indexDay, _rewardListUI.numChildren);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -110,12 +106,7 @@ namespace GFGGame
|
|
|
= (ActivityAfuGiftDataManager.Instance.GetIndexDay() - 1) * (_rewardListUI.GetChildAt(0).width + _rewardListUI.columnGap);
|
|
|
}
|
|
|
|
|
|
- private float CalculateListWidth(int num, float itemWidth, float columnGap)
|
|
|
- {
|
|
|
- return num * itemWidth + (num - 1) * columnGap;
|
|
|
- }
|
|
|
-
|
|
|
- private double CalculateProgressCount(int indexDay, int sumDay)
|
|
|
+ private double CalculateProgressValue(int indexDay, int sumDay)
|
|
|
{
|
|
|
int defaultLen = 18;
|
|
|
if (indexDay == sumDay)
|
|
@@ -174,7 +165,8 @@ namespace GFGGame
|
|
|
// 已经到达的日期
|
|
|
int passDay = ActivityAfuGiftDataManager.Instance.GetIndexDay();
|
|
|
bool arrive = dayIndex <= passDay;
|
|
|
-
|
|
|
+
|
|
|
+ // 显示锁/遮罩
|
|
|
if (isVip)
|
|
|
{
|
|
|
if (ActivityAfuGiftDataManager.Instance.GetIsBuy())
|
|
@@ -195,7 +187,6 @@ namespace GFGGame
|
|
|
int getState;
|
|
|
if (arrive)
|
|
|
{
|
|
|
- // Vip专属
|
|
|
if (isVip)
|
|
|
{
|
|
|
getState = ActivityAfuGiftDataManager.Instance.GetSuperRewardStateByDay(dayIndex - 1);
|
|
@@ -230,6 +221,14 @@ namespace GFGGame
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ canGet = false;
|
|
|
+ comItem.m_grpGot.visible = false;
|
|
|
+ obj.touchable = true;
|
|
|
+ // 隐藏红点
|
|
|
+ RedDotController.Instance.SetComRedDot(obj.asCom, false);
|
|
|
+ }
|
|
|
|
|
|
obj.data = new GetState
|
|
|
{
|
|
@@ -247,7 +246,7 @@ namespace GFGGame
|
|
|
|
|
|
if (getState.canGet)
|
|
|
{
|
|
|
- GetReward(getState, (int)obj.parent.data + 1);
|
|
|
+ ActivityAfuGiftProxy.ReqGetReward(getState.isVip, (int)obj.parent.data + 1).Coroutine();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -255,36 +254,6 @@ namespace GFGGame
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private async Task GetReward(GetState getState, int indexDay)
|
|
|
- {
|
|
|
- ActivityAfuGiftDataManager.Instance.ClearGetReward();
|
|
|
- await ActivityAfuGiftProxy.ReqGetReward(getState.isVip, indexDay);
|
|
|
- // 奖励弹窗
|
|
|
- BonusController.TryShowBonusList(ActivityAfuGiftDataManager.Instance.GetRewardList);
|
|
|
- }
|
|
|
-
|
|
|
- private async Task GetAllReward()
|
|
|
- {
|
|
|
- int passDay = ActivityAfuGiftDataManager.Instance.GetIndexDay();
|
|
|
- ActivityAfuGiftDataManager.Instance.ClearGetReward();
|
|
|
-
|
|
|
- for (int i = passDay - 1; i >= 0; i--)
|
|
|
- {
|
|
|
- if (ActivityAfuGiftDataManager.Instance.GetNormalRewardStateByDay(i) == ConstBonusStatus.CAN_GET)
|
|
|
- {
|
|
|
- await ActivityAfuGiftProxy.ReqGetReward(false, (i + 1));
|
|
|
- }
|
|
|
-
|
|
|
- if (ActivityAfuGiftDataManager.Instance.GetSuperRewardStateByDay(i) == ConstBonusStatus.CAN_GET)
|
|
|
- {
|
|
|
- await ActivityAfuGiftProxy.ReqGetReward(true, (i + 1));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 奖励弹窗
|
|
|
- BonusController.TryShowBonusList(ActivityAfuGiftDataManager.Instance.GetRewardList);
|
|
|
- }
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 领取所有奖励按钮
|
|
|
/// </summary>
|
|
@@ -297,7 +266,7 @@ namespace GFGGame
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- GetAllReward();
|
|
|
+ ActivityAfuGiftProxy.ReqGetAllReward().Coroutine();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|