|
@@ -4,6 +4,7 @@ using Excel2Json;
|
|
|
using Fort23.UTool;
|
|
|
using GameLogic.Bag;
|
|
|
using GameLogic.Player;
|
|
|
+using UnityEngine;
|
|
|
|
|
|
namespace Fort23.Mono
|
|
|
{
|
|
@@ -40,56 +41,48 @@ namespace Fort23.Mono
|
|
|
|
|
|
private void OnButtonCallBack()
|
|
|
{
|
|
|
- ItemInfo itemInfo= BagController.Instance.GetItemInfo(GlobalParam.Item_Coin_ID);
|
|
|
- if (itemInfo.count < 500)
|
|
|
+
|
|
|
+ if (BagController.Instance.IsEnough(GlobalParam.Item_Coin_ID, openBoxConfig.oneConsume))
|
|
|
{
|
|
|
- return;
|
|
|
- }
|
|
|
+ BagController.Instance.DeductCoin(openBoxConfig.oneConsume);
|
|
|
+ List<ItemInfo> allIitem = DropManager.Instance.DropItem(openBoxConfig.reward);
|
|
|
+ BagController.Instance.AddItem(allIitem);
|
|
|
|
|
|
- List<ItemInfo> allIitem = DropManager.Instance.DropItem(openBoxConfig.reward);
|
|
|
- BagController.Instance.AddItem(allIitem);
|
|
|
- if (allIitem.Count > 0)
|
|
|
+ UIManager.Instance.LoadAndOpenPanel<RewardsPanel>(delegate(RewardsPanel panel)
|
|
|
+ {
|
|
|
+ panel.InitRewardsPanel(allIitem, CloseButtonCallBack);
|
|
|
+ }, layer: UILayer.Top);
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
- Dictionary<string, string> lable = new Dictionary<string, string>();
|
|
|
- lable.Add("one", allIitem[0].itemID.ToString());
|
|
|
- PottingMobile._CustomEvent("oneBox", lable);
|
|
|
+ TipMessagePanel.OpenTipMessagePanel("金币不足", Vector2.zero);
|
|
|
}
|
|
|
- BagController.Instance.DeductCoin(500);
|
|
|
- UIManager.Instance.LoadAndOpenPanel<RewardsPanel>(
|
|
|
- delegate(RewardsPanel panel) { panel.InitRewardsPanel(allIitem, CloseButtonCallBack); },
|
|
|
- layer: UILayer.Top);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private void TenButtonCallBack()
|
|
|
{
|
|
|
- ItemInfo itemInfo= BagController.Instance.GetItemInfo(GlobalParam.Item_Coin_ID);
|
|
|
- if (itemInfo.count < 4500)
|
|
|
+ if (BagController.Instance.IsEnough(GlobalParam.Item_Coin_ID, openBoxConfig.oneConsume))
|
|
|
{
|
|
|
- return;
|
|
|
- }
|
|
|
- List<ItemInfo> allIitem = new List<ItemInfo>();
|
|
|
- string message = "";
|
|
|
- for (int i = 0; i < 10; i++)
|
|
|
- {
|
|
|
- List<ItemInfo> currItem = DropManager.Instance.DropItem(openBoxConfig.reward);
|
|
|
- for (int j = 0; j < currItem.Count; j++)
|
|
|
+ BagController.Instance.DeductCoin(openBoxConfig.tenConsume);
|
|
|
+
|
|
|
+ List<ItemInfo> allIitem = new List<ItemInfo>();
|
|
|
+ for (int i = 0; i < 10; i++)
|
|
|
{
|
|
|
- message += "_" + currItem[j].itemID.ToString();
|
|
|
+ List<ItemInfo> currItem = DropManager.Instance.DropItem(openBoxConfig.reward);
|
|
|
+ allIitem.AddRange(currItem);
|
|
|
}
|
|
|
- allIitem.AddRange(currItem);
|
|
|
+
|
|
|
+ BagController.Instance.AddItem(allIitem);
|
|
|
+
|
|
|
+ UIManager.Instance.LoadAndOpenPanel<RewardsPanel>(
|
|
|
+ delegate(RewardsPanel panel) { panel.InitRewardsPanel(allIitem, CloseButtonCallBack); },
|
|
|
+ layer: UILayer.Top);
|
|
|
}
|
|
|
- if (allIitem.Count > 0)
|
|
|
+ else
|
|
|
{
|
|
|
- Dictionary<string, string> lable = new Dictionary<string, string>();
|
|
|
- lable.Add("tenBox", message);
|
|
|
- PottingMobile._CustomEvent("oneBox", lable);
|
|
|
+ TipMessagePanel.OpenTipMessagePanel("金币不足", Vector2.zero);
|
|
|
}
|
|
|
-
|
|
|
- BagController.Instance.AddItem(allIitem);
|
|
|
- BagController.Instance.DeductCoin(4500);
|
|
|
- UIManager.Instance.LoadAndOpenPanel<RewardsPanel>(
|
|
|
- delegate(RewardsPanel panel) { panel.InitRewardsPanel(allIitem, CloseButtonCallBack); },
|
|
|
- layer: UILayer.Top);
|
|
|
}
|
|
|
|
|
|
private void CloseButtonCallBack()
|