|
@@ -16,6 +16,7 @@ namespace GFGGame
|
|
|
private UI_TurnTableUI _ui;
|
|
|
private ValueBarController _valueBarController;
|
|
|
private int activityID;
|
|
|
+ private int propID;
|
|
|
private int WaitTime;
|
|
|
private float duratio;
|
|
|
//这里固定旋转
|
|
@@ -114,12 +115,12 @@ namespace GFGGame
|
|
|
}
|
|
|
normalEndValue.Clear();
|
|
|
activityID = ActivityDataManager.Instance.GetCurOpenActiveByType(ActivityDataManager.Instance.TurnTableActivityType);
|
|
|
- int propID = TurntableLuckyBoxCfgArray.Instance.GetCfgByActivityId(activityID).CostID;
|
|
|
+ propID = TurntableLuckyBoxCfgArray.Instance.GetCfgByActivityId(activityID).CostID;
|
|
|
int dropId = TurntableLuckyBoxCfgArray.Instance.GetCfgByActivityId(activityID).DropId;
|
|
|
rewardItemList = DropOutCfgArray.Instance.GetCfgsByid(dropId);
|
|
|
rewardList = TurntableRewardCfgArray.Instance.GetCfgsByActivityId(activityID);
|
|
|
_valueBarController.OnShown();
|
|
|
- _valueBarController.UpdateList(new List<int>() { propID, ConstItemID.DIAMOND_PURPLE});
|
|
|
+ _valueBarController.UpdateList(new List<int>() { propID, ConstItemID.DIAMOND_RED, ConstItemID.DIAMOND_PURPLE});
|
|
|
UpdateView();
|
|
|
UpdateRewardItem();
|
|
|
UpdateReward();
|
|
@@ -141,14 +142,14 @@ namespace GFGGame
|
|
|
{
|
|
|
base.AddEventListener();
|
|
|
EventAgent.AddEventListener(ConstMessage.SHOP_BUY, UpdateView);
|
|
|
- EventAgent.AddEventListener(ConstMessage.RED_CHANGE, UpdateReward);
|
|
|
+ EventAgent.AddEventListener(ConstMessage.TurnTable_DateCHANGE, UpdateReward);
|
|
|
EventAgent.AddEventListener(ConstMessage.REWARDVIEW_CLOTHER, ShowReward);
|
|
|
}
|
|
|
protected override void RemoveEventListener()
|
|
|
{
|
|
|
base.RemoveEventListener();
|
|
|
EventAgent.RemoveEventListener(ConstMessage.SHOP_BUY, UpdateView);
|
|
|
- EventAgent.RemoveEventListener(ConstMessage.RED_CHANGE, UpdateReward);
|
|
|
+ EventAgent.RemoveEventListener(ConstMessage.TurnTable_DateCHANGE, UpdateReward);
|
|
|
EventAgent.RemoveEventListener(ConstMessage.REWARDVIEW_CLOTHER, ShowReward);
|
|
|
}
|
|
|
private void ShowReward()
|
|
@@ -241,7 +242,7 @@ namespace GFGGame
|
|
|
//更新下面次数的物品
|
|
|
private void UpdateReward()
|
|
|
{
|
|
|
- if(ActivityDataManager.Instance.TurnSpecialRewardList.Count > 0)
|
|
|
+ if(ActivityDataManager.Instance.TurnSpecialRewardList != null && ActivityDataManager.Instance.TurnSpecialRewardList.Count > 0)
|
|
|
{
|
|
|
_ui.m_specialEffect.visible = true;
|
|
|
}
|
|
@@ -335,49 +336,105 @@ namespace GFGGame
|
|
|
}
|
|
|
private async void OnClickBtnStartOne()
|
|
|
{
|
|
|
- bool result = await ActivitySProxy.ReqTurnTableWish(1);
|
|
|
- if (result)
|
|
|
- {
|
|
|
- wishType = 0;
|
|
|
- _ui.m_btnStartOne.touchable = false;
|
|
|
- _ui.m_btnStartThree.touchable = false;
|
|
|
- await TurnStart(0);
|
|
|
- await Task.Delay(WaitTime);
|
|
|
- BonusController.TryShowBonusList(ItemUtil.CreateItemDataList(ActivityDataManager.Instance.TurnRewardList));
|
|
|
- ActivityDataManager.Instance.TurnRewardList.Clear();
|
|
|
- UpdateReward();
|
|
|
- _ui.m_btnStartOne.touchable = true;
|
|
|
- _ui.m_btnStartThree.touchable = true;
|
|
|
+ ItemData item;
|
|
|
+ if (BagDataManager.Instance.GetBagData().TryGetValue(propID, out item))
|
|
|
+ {
|
|
|
+ if (item.num >= 1)
|
|
|
+ {
|
|
|
+ bool result = await ActivitySProxy.ReqTurnTableWish(1);
|
|
|
+ if (result)
|
|
|
+ {
|
|
|
+ wishType = 0;
|
|
|
+ _ui.m_btnStartOne.touchable = false;
|
|
|
+ _ui.m_btnStartThree.touchable = false;
|
|
|
+ await TurnStart(0);
|
|
|
+ await Task.Delay(WaitTime);
|
|
|
+ BonusController.TryShowBonusList(ItemUtil.CreateItemDataList(ActivityDataManager.Instance.TurnRewardList));
|
|
|
+ ActivityDataManager.Instance.TurnRewardList.Clear();
|
|
|
+ UpdateReward();
|
|
|
+ _ui.m_btnStartOne.touchable = true;
|
|
|
+ _ui.m_btnStartThree.touchable = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //Debug.LogError("许愿失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (ActivityDataManager.Instance.CHECK_TIPS_OPEN == false)
|
|
|
+ TurnTipsController.Show(propID, 1, null, true);
|
|
|
+ else
|
|
|
+ {
|
|
|
+ OnBuyItem(propID, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- //Debug.LogError("许愿失败");
|
|
|
+ if (ActivityDataManager.Instance.CHECK_TIPS_OPEN == false)
|
|
|
+ TurnTipsController.Show(propID, 1, null, true);
|
|
|
+ else
|
|
|
+ {
|
|
|
+ OnBuyItem(propID, 1);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
private async void OnClickBtnStartThree()
|
|
|
{
|
|
|
- bool result = await ActivitySProxy.ReqTurnTableWish(2);
|
|
|
- if (result)
|
|
|
- {
|
|
|
- _ui.m_btnStartOne.touchable = false;
|
|
|
- _ui.m_btnStartThree.touchable = false;
|
|
|
- await TurnStart(0);
|
|
|
- await Task.Delay(WaitTime);
|
|
|
- await TurnStart(1);
|
|
|
- await Task.Delay(WaitTime);
|
|
|
- await TurnStart(2);
|
|
|
- await Task.Delay(WaitTime);
|
|
|
- BonusController.TryShowBonusList(ItemUtil.CreateItemDataList(ActivityDataManager.Instance.TurnRewardList));
|
|
|
- ActivityDataManager.Instance.TurnRewardList.Clear();
|
|
|
- _ui.m_btnStartOne.touchable = true;
|
|
|
- _ui.m_btnStartThree.touchable = true;
|
|
|
- UpdateReward();
|
|
|
+ ItemData item;
|
|
|
+ if (BagDataManager.Instance.GetBagData().TryGetValue(propID, out item))
|
|
|
+ {
|
|
|
+ if(item.num >= 3)
|
|
|
+ {
|
|
|
+ bool result = await ActivitySProxy.ReqTurnTableWish(2);
|
|
|
+ if (result)
|
|
|
+ {
|
|
|
+ _ui.m_btnStartOne.touchable = false;
|
|
|
+ _ui.m_btnStartThree.touchable = false;
|
|
|
+ await TurnStart(0);
|
|
|
+ await Task.Delay(WaitTime);
|
|
|
+ await TurnStart(1);
|
|
|
+ await Task.Delay(WaitTime);
|
|
|
+ await TurnStart(2);
|
|
|
+ await Task.Delay(WaitTime);
|
|
|
+ BonusController.TryShowBonusList(ItemUtil.CreateItemDataList(ActivityDataManager.Instance.TurnRewardList));
|
|
|
+ ActivityDataManager.Instance.TurnRewardList.Clear();
|
|
|
+ _ui.m_btnStartOne.touchable = true;
|
|
|
+ _ui.m_btnStartThree.touchable = true;
|
|
|
+ UpdateReward();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //Debug.LogError("许愿失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (ActivityDataManager.Instance.CHECK_TIPS_OPEN == false)
|
|
|
+ TurnTipsController.Show(propID, 3,null, true);
|
|
|
+ else
|
|
|
+ {
|
|
|
+ OnBuyItem(propID, 3);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- //Debug.LogError("许愿失败");
|
|
|
+ if (ActivityDataManager.Instance.CHECK_TIPS_OPEN == false)
|
|
|
+ TurnTipsController.Show(propID, 3, null, true);
|
|
|
+ else
|
|
|
+ {
|
|
|
+ OnBuyItem(propID, 3);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ private async void OnBuyItem(int itemId, long count)
|
|
|
+ {
|
|
|
+ var _result = await ItemExchangeSProxy.ItemExchange(itemId, count);
|
|
|
+ if (_result)
|
|
|
+ BonusController.TryShowBonusList(ItemUtil.CreateItemDataList(itemId, count));
|
|
|
+ }
|
|
|
private void OnClickBtnShop()
|
|
|
{
|
|
|
ViewManager.Show<StoreView>(new object[] { ConstStoreTabId.STORE_GIFT_BAG, ConstStoreSubId.STORE_ACTIVITY_EXCHANGE });
|