using System.Collections.Generic; using Core.Utility; using Excel2Json; using Fort23.UTool; using GameLogic.Bag; using GameLogic.Player; namespace Fort23.Mono { [UIBinding(prefab = "BoxPanel")] public partial class BoxPanel : UIPanel { private OpenBoxConfig openBoxConfig; public static async void OpenBoxPanel() { BoxPanel boxPanel = await UIManager.Instance.LoadAndOpenPanel(null, layer: UILayer.Top); boxPanel.OpenPanel(); } private void Init() { } protected override void AddEvent() { } protected override void DelEvent() { } public override void AddButtonEvent() { oneButton.onClick.AddListener(OnButtonCallBack); tenButton.onClick.AddListener(TenButtonCallBack); close.onClick.AddListener(CloseButtonCallBack); bg.onClick.AddListener(CloseButtonCallBack); } private void OnButtonCallBack() { ItemInfo itemInfo= BagController.Instance.GetItemInfo(GlobalParam.Item_Coin_ID); if (itemInfo.count < 500) { return; } List allIitem = DropManager.Instance.DropItem(openBoxConfig.reward); BagController.Instance.AddItem(allIitem); if (allIitem.Count > 0) { Dictionary lable = new Dictionary(); lable.Add("one", allIitem[0].itemID.ToString()); PottingMobile._CustomEvent("oneBox", lable); } BagController.Instance.DeductCoin(500); UIManager.Instance.LoadAndOpenPanel( 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) { return; } List allIitem = new List(); string message = ""; for (int i = 0; i < 10; i++) { List currItem = DropManager.Instance.DropItem(openBoxConfig.reward); for (int j = 0; j < currItem.Count; j++) { message += "_" + currItem[j].itemID.ToString(); } allIitem.AddRange(currItem); } if (allIitem.Count > 0) { Dictionary lable = new Dictionary(); lable.Add("tenBox", message); PottingMobile._CustomEvent("oneBox", lable); } BagController.Instance.AddItem(allIitem); BagController.Instance.DeductCoin(4500); UIManager.Instance.LoadAndOpenPanel( delegate(RewardsPanel panel) { panel.InitRewardsPanel(allIitem, CloseButtonCallBack); }, layer: UILayer.Top); } private void CloseButtonCallBack() { UIManager.Instance.HideUIUIPanel(this); } public void OpenPanel() { openBoxConfig = ConfigComponent.Instance.Get(1); onCion.text = "x" + openBoxConfig.oneConsume; tenCion.text = "x" + openBoxConfig.tenConsume; } } }