Browse Source

Merge branch 'master' of http://10.108.64.190:3000/gfg/client

guodong 1 year ago
parent
commit
7beb57b930

+ 2 - 2
GameClient/Assets/Game/HotUpdate/Controller/BuyTipsController.cs

@@ -7,13 +7,13 @@ namespace GFGGame
     {
     {
         private static BuyTipsView _buyTipsView;
         private static BuyTipsView _buyTipsView;
 
 
-        public static void Show(int itemId, long count, Action onSuccess = null)
+        public static void Show(int itemId, long count, Action onSuccess = null,bool showCheck = false)
         {
         {
             if (_buyTipsView == null)
             if (_buyTipsView == null)
             {
             {
                 _buyTipsView = new BuyTipsView();
                 _buyTipsView = new BuyTipsView();
             }
             }
-            _buyTipsView.SetParams(itemId, count, onSuccess);
+            _buyTipsView.SetParams(itemId, count, onSuccess, showCheck);
             _buyTipsView.Show();
             _buyTipsView.Show();
         }
         }
 
 

+ 20 - 4
GameClient/Assets/Game/HotUpdate/Data/LuckyBoxDataManager.cs

@@ -16,6 +16,8 @@ namespace GFGGame
 
 
         public const float ANIMATION_TIME = 1.2f; //翻牌获得物品展示时间
         public const float ANIMATION_TIME = 1.2f; //翻牌获得物品展示时间
 
 
+        public bool CHECK_TIPS_OPEN = false; //提示弹窗是否打开
+
         private List<ItemData> _rewardsList;//当前奖励,每次抽奖后刷新
         private List<ItemData> _rewardsList;//当前奖励,每次抽奖后刷新
         private Dictionary<int, ItemData> _firstRewardsList = new Dictionary<int, ItemData>();//首次获得的奖励
         private Dictionary<int, ItemData> _firstRewardsList = new Dictionary<int, ItemData>();//首次获得的奖励
         private Dictionary<int, List<LuckyBoxBonusData>> _dicShowList = new Dictionary<int, List<LuckyBoxBonusData>>();
         private Dictionary<int, List<LuckyBoxBonusData>> _dicShowList = new Dictionary<int, List<LuckyBoxBonusData>>();
@@ -242,7 +244,10 @@ namespace GFGGame
             }
             }
             else if (hasNum >= costNum)
             else if (hasNum >= costNum)
             {
             {
-                AlertUI.Show(string.Format("是否花费{0}个{1}摘星{2}次?", costNum, itemCfg.name, times)).SetLeftButton(true).SetRightButton(true, "确定", (object data) => { onSuccess(); });
+                if(LuckyBoxDataManager.Instance.CHECK_TIPS_OPEN == false)
+                    AlertUI.Show(string.Format("是否花费{0}个{1}摘星{2}次?", costNum, itemCfg.name, times)).SetLeftButton(true).SetRightButton(true, "确定", (object data) => { onSuccess(); });
+                else
+                    onSuccess();
             }
             }
             else
             else
             {
             {
@@ -269,9 +274,13 @@ namespace GFGGame
                     {
                     {
                         ItemUtil.ExchangeItemById(costId, needNum, false, onSuccess);
                         ItemUtil.ExchangeItemById(costId, needNum, false, onSuccess);
                     }
                     }
-                    else
-                    {
-                        BuyTipsController.Show(costId, needNum, onSuccess);
+                    else {
+                        if (LuckyBoxDataManager.Instance.CHECK_TIPS_OPEN == false)
+                            BuyTipsController.Show(costId, needNum, onSuccess, true);
+                        else
+                        {
+                            OnBuyItem(costId, needNum, onSuccess);
+                        }
                     }
                     }
                 }
                 }
                 else//购买消耗品的道具不足,提示购买 购买消耗品的道具
                 else//购买消耗品的道具不足,提示购买 购买消耗品的道具
@@ -281,6 +290,13 @@ namespace GFGGame
             }
             }
         }
         }
 
 
+        private async void OnBuyItem(int itemId, long count, Action onSuccess = null)
+        {
+            var _result = await ItemExchangeSProxy.ItemExchange(itemId, count);
+            if (_result)
+                BonusController.TryShowBonusList(ItemUtil.CreateItemDataList(itemId, count), onSuccess);
+        }
+
         private int GetCostNum(int boxId, int times)
         private int GetCostNum(int boxId, int times)
         {
         {
             LuckyBoxCfg cfg = LuckyBoxCfgArray.Instance.GetCfg(boxId);
             LuckyBoxCfg cfg = LuckyBoxCfgArray.Instance.GetCfg(boxId);

+ 3 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Common/UI_AlertUI.cs

@@ -12,6 +12,7 @@ namespace UI.Common
         public GTextField m_txtTips;
         public GTextField m_txtTips;
         public GButton m_btnLeft;
         public GButton m_btnLeft;
         public GButton m_btnRight;
         public GButton m_btnRight;
+        public GButton m_btnCheck;
         public const string URL = "ui://mk0fwx0xl55o0";
         public const string URL = "ui://mk0fwx0xl55o0";
         public const string PACKAGE_NAME = "Common";
         public const string PACKAGE_NAME = "Common";
         public const string RES_NAME = "AlertUI";
         public const string RES_NAME = "AlertUI";
@@ -64,6 +65,7 @@ namespace UI.Common
             m_txtTips = (GTextField)comp.GetChild("txtTips");
             m_txtTips = (GTextField)comp.GetChild("txtTips");
             m_btnLeft = (GButton)comp.GetChild("btnLeft");
             m_btnLeft = (GButton)comp.GetChild("btnLeft");
             m_btnRight = (GButton)comp.GetChild("btnRight");
             m_btnRight = (GButton)comp.GetChild("btnRight");
+            m_btnCheck = (GButton)comp.GetChild("btnCheck");
         }
         }
         public void Dispose(bool disposeTarget = false)
         public void Dispose(bool disposeTarget = false)
         {
         {
@@ -72,6 +74,7 @@ namespace UI.Common
             m_txtTips = null;
             m_txtTips = null;
             m_btnLeft = null;
             m_btnLeft = null;
             m_btnRight = null;
             m_btnRight = null;
+            m_btnCheck = null;
             if(disposeTarget && target != null)
             if(disposeTarget && target != null)
             {
             {
                 target.RemoveFromParent();
                 target.RemoveFromParent();

+ 6 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/CommonGame/UI_BuyTipsUI.cs

@@ -7,12 +7,14 @@ namespace UI.CommonGame
     public partial class UI_BuyTipsUI
     public partial class UI_BuyTipsUI
     {
     {
         public GComponent target;
         public GComponent target;
+        public Controller m_checkType;
         public GComponent m_bg;
         public GComponent m_bg;
         public GTextField m_txtNeed;
         public GTextField m_txtNeed;
         public GTextField m_txtCost;
         public GTextField m_txtCost;
         public GLoader m_loaNeed;
         public GLoader m_loaNeed;
         public GButton m_btnCancel;
         public GButton m_btnCancel;
         public GButton m_btnSure;
         public GButton m_btnSure;
+        public GButton m_btnCheck;
         public const string URL = "ui://eg2y0ldpds629g";
         public const string URL = "ui://eg2y0ldpds629g";
         public const string PACKAGE_NAME = "CommonGame";
         public const string PACKAGE_NAME = "CommonGame";
         public const string RES_NAME = "BuyTipsUI";
         public const string RES_NAME = "BuyTipsUI";
@@ -60,21 +62,25 @@ namespace UI.CommonGame
 
 
         private void Init(GComponent comp)
         private void Init(GComponent comp)
         {
         {
+            m_checkType = comp.GetController("checkType");
             m_bg = (GComponent)comp.GetChild("bg");
             m_bg = (GComponent)comp.GetChild("bg");
             m_txtNeed = (GTextField)comp.GetChild("txtNeed");
             m_txtNeed = (GTextField)comp.GetChild("txtNeed");
             m_txtCost = (GTextField)comp.GetChild("txtCost");
             m_txtCost = (GTextField)comp.GetChild("txtCost");
             m_loaNeed = (GLoader)comp.GetChild("loaNeed");
             m_loaNeed = (GLoader)comp.GetChild("loaNeed");
             m_btnCancel = (GButton)comp.GetChild("btnCancel");
             m_btnCancel = (GButton)comp.GetChild("btnCancel");
             m_btnSure = (GButton)comp.GetChild("btnSure");
             m_btnSure = (GButton)comp.GetChild("btnSure");
+            m_btnCheck = (GButton)comp.GetChild("btnCheck");
         }
         }
         public void Dispose(bool disposeTarget = false)
         public void Dispose(bool disposeTarget = false)
         {
         {
+            m_checkType = null;
             m_bg = null;
             m_bg = null;
             m_txtNeed = null;
             m_txtNeed = null;
             m_txtCost = null;
             m_txtCost = null;
             m_loaNeed = null;
             m_loaNeed = null;
             m_btnCancel = null;
             m_btnCancel = null;
             m_btnSure = null;
             m_btnSure = null;
+            m_btnCheck = null;
             if(disposeTarget && target != null)
             if(disposeTarget && target != null)
             {
             {
                 target.RemoveFromParent();
                 target.RemoveFromParent();

+ 63 - 72
GameClient/Assets/Game/HotUpdate/Views/ActivityHuaRongDao/ActivityHuaRongDaoView.cs

@@ -79,10 +79,6 @@ namespace GFGGame
                 _blankItem = UIPackage.CreateObject("ActivityHuaRongDao", "item");
                 _blankItem = UIPackage.CreateObject("ActivityHuaRongDao", "item");
                 _ui.target.AddChild(_blankItem);
                 _ui.target.AddChild(_blankItem);
             }
             }
-
-            _ui.m_maskTouch.onTouchBegin.Add(TouchBegin);
-            _ui.m_maskTouch.onTouchEnd.Add(TouchEnd);
-
         }
         }
 
 
         protected override void OnShown()
         protected override void OnShown()
@@ -232,6 +228,7 @@ namespace GFGGame
             {
             {
                 GObject gObject = UIPackage.CreateObject("ActivityHuaRongDao", "item");
                 GObject gObject = UIPackage.CreateObject("ActivityHuaRongDao", "item");
                 gObject.name = "item" + i;
                 gObject.name = "item" + i;
+                gObject.onClick.Add(OnItemClick);
                 _ui.m_items.target.AddChild(gObject);
                 _ui.m_items.target.AddChild(gObject);
                 _items.Add(gObject);
                 _items.Add(gObject);
             }
             }
@@ -253,103 +250,77 @@ namespace GFGGame
             inputPos.y = context.inputEvent.y;
             inputPos.y = context.inputEvent.y;
         }
         }
 
 
-        private void TouchEnd(EventContext context)
+        private Grid CheckCanMove(int num)
         {
         {
-            GridInfo numGrid = null;
-            GridInfo nullGrid = new GridInfo();
+            int indexX = 0;
+            int indexY = 0;
 
 
-            // 找到格子
+            // 找到格子
             for (int i = 0; i < _gridNum; i++)
             for (int i = 0; i < _gridNum; i++)
             {
             {
                 for (int j = 0; j < _gridNum; j++)
                 for (int j = 0; j < _gridNum; j++)
                 {
                 {
-                    if (_gridArr[i, j].num == 0)
+                    if (_gridArr[i, j].num == num)
                     {
                     {
-                        nullGrid.row = i;
-                        nullGrid.col = j;
+                        indexX = i;
+                        indexY = j;
                         break;
                         break;
                     }
                     }
                 }
                 }
             }
             }
 
 
-            // 左
-            if ((context.inputEvent.x - inputPos.x) < 0 && Mathf.Abs(context.inputEvent.x - inputPos.x) > Mathf.Abs(context.inputEvent.y - inputPos.y))
-            {
-                numGrid = CheckHaveNumGrid(nullGrid.row, nullGrid.col + 1);
-            }
-
-            // 右
-            if ((context.inputEvent.x - inputPos.x) > 0 && Mathf.Abs(context.inputEvent.x - inputPos.x) > Mathf.Abs(context.inputEvent.y - inputPos.y))
-            {
-                numGrid = CheckHaveNumGrid(nullGrid.row, nullGrid.col - 1);
-            }
-
-            // 上
-            if ((context.inputEvent.y - inputPos.y) < 0 && Mathf.Abs(context.inputEvent.y - inputPos.y) > Mathf.Abs(context.inputEvent.x - inputPos.x))
+            // 判断格子四个方向是否有空格
+            if (CheckHaveNullGrid(indexX - 1, indexY) || CheckHaveNullGrid(indexX, indexY - 1)
+                || CheckHaveNullGrid(indexX + 1, indexY) || CheckHaveNullGrid(indexX, indexY + 1))
             {
             {
-                numGrid = CheckHaveNumGrid(nullGrid.row + 1, nullGrid.col);
-            }
-
-            // 下
-            if ((context.inputEvent.y - inputPos.y) > 0 && Mathf.Abs(context.inputEvent.y - inputPos.y) > Mathf.Abs(context.inputEvent.x - inputPos.x))
-            {
-                numGrid = CheckHaveNumGrid(nullGrid.row - 1, nullGrid.col);
-            }
-
-            if (numGrid != null)
-            {
-                int num = numGrid.num;
-                Grid grid = UpdateGridInfo(numGrid, nullGrid);
-                MoveItem(grid, num);
+                return UpdateGridInfo(num);
             }
             }
 
 
+            return null;
         }
         }
 
 
-        private void MoveItem(Grid newGrid, int changeNum)
+        private bool CheckHaveNullGrid(int indexX, int indexY)
         {
         {
-            for (int i = 0; i < _items.Count; i++)
+            if (indexX >= 0 && indexX < _gridNum)
             {
             {
-                GObject obj = _items[i];
-                int num = (int)obj.data;
-
-                if (num == changeNum)
+                if (indexY >= 0 && indexY < _gridNum)
                 {
                 {
-                    _ui.m_maskGlobal.visible = true;
-                    obj.TweenMove(newGrid.pos, 0.1f).OnComplete(() =>
-                    {
-                        _ui.m_maskGlobal.visible = false;
-                        if (CheckWin())
-                        {
-                            ControlMenuItemVisual(false);
-                            Win(_cancellationTokenSource.Token);
-                        }
-                    });
-                    return;
+                    return _gridArr[indexX, indexY].num == 0;
                 }
                 }
             }
             }
+
+            return false;
         }
         }
 
 
-        /// <summary>
-        /// 查看空白格附近是否存在数字格
-        /// </summary>
-        /// <param name="indexX"></param>
-        /// <param name="indexY"></param>
-        /// <returns></returns>
-        private GridInfo CheckHaveNumGrid(int indexX, int indexY)
+        private Grid UpdateGridInfo(int num)
         {
         {
-            if (indexX >= 0 && indexX < _gridNum)
+            Vector2 nullGridindex = new Vector2(-1, 0);
+            Vector2 numGridindex = new Vector2(-1, 0);
+
+
+            for (int i = 0; i < _gridNum; i++)
             {
             {
-                if (indexY >= 0 && indexY < _gridNum)
+                for (int j = 0; j < _gridNum; j++)
                 {
                 {
-                    GridInfo grid = new GridInfo();
-                    grid.row = indexX;
-                    grid.col = indexY;
-                    grid.num = _gridArr[indexX, indexY].num;
-                    return grid;
+                    if (_gridArr[i, j].num == num)
+                    {
+                        numGridindex = new Vector2(i, j);
+                    }
+                    else if (_gridArr[i, j].num == 0)
+                    {
+                        nullGridindex = new Vector2(i, j);
+                    }
+                    if (numGridindex.x != -1 && nullGridindex.x != -1)
+                    {
+                        break;
+                    }
                 }
                 }
             }
             }
 
 
-            return null;
+            _gridArr[(int)numGridindex.x, (int)numGridindex.y].num = 0;
+            _gridArr[(int)nullGridindex.x, (int)nullGridindex.y].num = num;
+
+            return _gridArr[(int)nullGridindex.x, (int)nullGridindex.y];
         }
         }
 
 
         /// <summary>
         /// <summary>
@@ -554,7 +525,7 @@ namespace GFGGame
         private void OnChangeLookOriginState()
         private void OnChangeLookOriginState()
         {
         {
             bool look = (_ui.m_state.selectedIndex == 1);
             bool look = (_ui.m_state.selectedIndex == 1);
-            _ui.m_maskTouch.touchable = !look;
+            _ui.m_items.target.touchable = !look;
             _ui.m_items.target.visible = !look;
             _ui.m_items.target.visible = !look;
             _ui.m_itemsOrigin.target.visible = look;
             _ui.m_itemsOrigin.target.visible = look;
         }
         }
@@ -569,5 +540,25 @@ namespace GFGGame
         {
         {
             return ResPathUtil.GetHUARONGDAOPicPath(res);
             return ResPathUtil.GetHUARONGDAOPicPath(res);
         }
         }
+
+        private void OnItemClick(EventContext eventContext)
+        {
+            GObject obj = eventContext.sender as GObject;
+            int num = (int)obj.data;
+            Grid newGrid = CheckCanMove(num);
+            if (newGrid != null)
+            {
+                _ui.m_maskGlobal.visible = true;
+                obj.TweenMove(newGrid.pos, 0.1f).OnComplete(() =>
+                {
+                    _ui.m_maskGlobal.visible = false;
+                    if (CheckWin())
+                    {
+                        ControlMenuItemVisual(false);
+                        Win(_cancellationTokenSource.Token);
+                    }
+                });
+            }
+        }
     }
     }
 }
 }

+ 9 - 0
GameClient/Assets/Game/HotUpdate/Views/Common/Alert/AlertWindow.cs

@@ -66,6 +66,8 @@ namespace GFGGame
                 this.Hide();
                 this.Hide();
                 m_rightButtonCallback?.Invoke(m_data);
                 m_rightButtonCallback?.Invoke(m_data);
             });
             });
+
+            _ui.m_btnCheck.onClick.Add(OnBtnCheckClick);
         }
         }
 
 
         protected override void OnShown()
         protected override void OnShown()
@@ -92,12 +94,19 @@ namespace GFGGame
         //        }
         //        }
         //    }
         //    }
         //}
         //}
+
+        private void OnBtnCheckClick()
+        {
+            LuckyBoxDataManager.Instance.CHECK_TIPS_OPEN = _ui.m_btnCheck.selected;
+        }
+
         public IAlert SetLayer(string setlayer)
         public IAlert SetLayer(string setlayer)
         {
         {
             layer = setlayer;
             layer = setlayer;
             return this;
             return this;
 
 
         }
         }
+
         private void updateButtonPosition()
         private void updateButtonPosition()
         {
         {
             float xLeftButton = m_xLeftButton;
             float xLeftButton = m_xLeftButton;

+ 19 - 2
GameClient/Assets/Game/HotUpdate/Views/CommonGame/BuyTipsView.cs

@@ -14,6 +14,7 @@ namespace GFGGame
         private int _costCount;
         private int _costCount;
         private bool _result = false;
         private bool _result = false;
         private Action _onSuccess;
         private Action _onSuccess;
+        private bool _showCheck = false;
 
 
         public override void Dispose()
         public override void Dispose()
         {
         {
@@ -37,19 +38,25 @@ namespace GFGGame
 
 
             _ui.m_btnSure.onClick.Add(OnClickBtnSure);
             _ui.m_btnSure.onClick.Add(OnClickBtnSure);
             _ui.m_btnCancel.onClick.Add(OnClickBtnCancel);
             _ui.m_btnCancel.onClick.Add(OnClickBtnCancel);
+            _ui.m_btnCancel.onClick.Add(OnClickBtnCancel);
+            _ui.m_btnCheck.onClick.Add(OnBtnCheckClick);
         }
         }
-        public void SetParams(int itemId, long count, Action onSuccess = null)
+
+        public void SetParams(int itemId, long count, Action onSuccess = null, bool showCheck = false)
         {
         {
             _itemId = itemId;
             _itemId = itemId;
             _count = count;
             _count = count;
 
 
             _onSuccess = onSuccess;
             _onSuccess = onSuccess;
+            _showCheck = showCheck;
         }
         }
+
         protected override void OnShown()
         protected override void OnShown()
         {
         {
             base.OnShown();
             base.OnShown();
             UpdateView();
             UpdateView();
         }
         }
+
         private void UpdateView()
         private void UpdateView()
         {
         {
             ItemExchangeCfgArray.Instance.GetMoneyIdAndNum(_itemId, ItemDataManager.GetItemExchangeTimes(_itemId), (int)_count, out _costId, out _costCount, out int buyNum);
             ItemExchangeCfgArray.Instance.GetMoneyIdAndNum(_itemId, ItemDataManager.GetItemExchangeTimes(_itemId), (int)_count, out _costId, out _costCount, out int buyNum);
@@ -58,7 +65,13 @@ namespace GFGGame
             _ui.m_loaNeed.url = ResPathUtil.GetCommonGameResPath(itemCfg.res);
             _ui.m_loaNeed.url = ResPathUtil.GetCommonGameResPath(itemCfg.res);
             ItemCfg costCfg = ItemCfgArray.Instance.GetCfg(_costId);
             ItemCfg costCfg = ItemCfgArray.Instance.GetCfg(_costId);
             _ui.m_txtCost.text = string.Format("是否花费{0}{1}购买?", _costCount, costCfg.name);
             _ui.m_txtCost.text = string.Format("是否花费{0}{1}购买?", _costCount, costCfg.name);
+
+            if (_showCheck)
+                _ui.m_checkType.selectedIndex = 1;
+            else
+                _ui.m_checkType.selectedIndex = 0;
         }
         }
+
         private async void OnClickBtnSure()
         private async void OnClickBtnSure()
         {
         {
 
 
@@ -70,11 +83,15 @@ namespace GFGGame
 
 
             this.Hide();
             this.Hide();
         }
         }
+
         private void OnClickBtnCancel()
         private void OnClickBtnCancel()
         {
         {
             this.Hide();
             this.Hide();
         }
         }
 
 
+        private void OnBtnCheckClick()
+        {
+            LuckyBoxDataManager.Instance.CHECK_TIPS_OPEN = _ui.m_btnCheck.selected;
+        }
     }
     }
-
 }
 }

BIN
GameClient/Assets/ResIn/UI/ActivityHuaRongDao/ActivityHuaRongDao_fui.bytes


BIN
GameClient/Assets/ResIn/UI/Common/Common_fui.bytes


BIN
GameClient/Assets/ResIn/UI/CommonGame/CommonGame_fui.bytes