浏览代码

Merge remote-tracking branch 'remotes/origin/zhaoyang' into guodong

guodong 3 年之前
父节点
当前提交
0cfc8de505

+ 1 - 1
GameClient/Assets/Game/CSShare

@@ -1 +1 @@
-Subproject commit 6d5b81d457f66747f9bc40378e2267c4336454a0
+Subproject commit 51295e8448759c276f71656eda26fc0060dbc837

+ 11 - 11
GameClient/Assets/Game/HotUpdate/ServerProxy/InstanceZonesSProxy.cs

@@ -13,9 +13,9 @@ namespace GFGGame
         {
         {
             M2C_GetInstanceZonesInfos response = null;
             M2C_GetInstanceZonesInfos response = null;
             response = (M2C_GetInstanceZonesInfos)await MessageHelper.SendToServer(new C2M_GetInstanceZonesInfos());
             response = (M2C_GetInstanceZonesInfos)await MessageHelper.SendToServer(new C2M_GetInstanceZonesInfos());
-            if(response != null)
+            if (response != null)
             {
             {
-                if(response.Error == ErrorCode.ERR_Success)
+                if (response.Error == ErrorCode.ERR_Success)
                 {
                 {
                     InstanceZonesDataManager.InitScoreList(response.ksScore, response.vsScore);
                     InstanceZonesDataManager.InitScoreList(response.ksScore, response.vsScore);
                     InstanceZonesDataManager.InitStarList(response.ksStar, response.vsStar);
                     InstanceZonesDataManager.InitStarList(response.ksStar, response.vsStar);
@@ -58,25 +58,25 @@ namespace GFGGame
                 NpcScore = npcScore,
                 NpcScore = npcScore,
                 UseRecommend = useRecomend
                 UseRecommend = useRecomend
             });
             });
-            if(response != null)
+            if (response != null)
             {
             {
-                if(response.Error == ErrorCode.ERR_Success)
+                if (response.Error == ErrorCode.ERR_Success)
                 {
                 {
                     //更新数据
                     //更新数据
                     InstanceZonesDataManager.TryUpdateScore(response.LevelCfgId, response.Score);
                     InstanceZonesDataManager.TryUpdateScore(response.LevelCfgId, response.Score);
                     InstanceZonesDataManager.TryUpdateLevelStar(response.LevelCfgId, response.Star);
                     InstanceZonesDataManager.TryUpdateLevelStar(response.LevelCfgId, response.Star);
                     //展示奖励
                     //展示奖励
                     List<ItemData> bonusList = StoryBonusDataCache.GetBonusList(response.LevelCfgId, response.HasOnceBonus);
                     List<ItemData> bonusList = StoryBonusDataCache.GetBonusList(response.LevelCfgId, response.HasOnceBonus);
-                    if(response.RandomBonusList != null)
+                    if (response.RandomBonusList != null)
                     {
                     {
-                        foreach(var item in response.RandomBonusList)
+                        foreach (var item in response.RandomBonusList)
                         {
                         {
                             var itemData = ItemUtil.createItemData(item.ConfigId, item.Count);
                             var itemData = ItemUtil.createItemData(item.ConfigId, item.Count);
                             bonusList.Add(itemData);
                             bonusList.Add(itemData);
                         }
                         }
                     }
                     }
 
 
-                    if(response.HasOnceBonus)
+                    if (response.HasOnceBonus)
                     {
                     {
                         //首次通过要检查是否有功能开启
                         //首次通过要检查是否有功能开启
                         FunctionOpenDataManager.Instance.CheckHasChapterFunOpen(response.LevelCfgId);
                         FunctionOpenDataManager.Instance.CheckHasChapterFunOpen(response.LevelCfgId);
@@ -109,7 +109,7 @@ namespace GFGGame
             {
             {
                 if (response.Error == ErrorCode.ERR_Success)
                 if (response.Error == ErrorCode.ERR_Success)
                 {
                 {
-                    InstanceZonesDataManager.TryUpdateScore(response.LevelCfgId, response.Score); 
+                    InstanceZonesDataManager.TryUpdateScore(response.LevelCfgId, response.Score);
                 }
                 }
             }
             }
         }
         }
@@ -121,7 +121,7 @@ namespace GFGGame
             response = (M2C_FinishInstanceZonesFightQuickly)await MessageHelper.SendToServer(new C2M_FinishInstanceZonesFightQuickly()
             response = (M2C_FinishInstanceZonesFightQuickly)await MessageHelper.SendToServer(new C2M_FinishInstanceZonesFightQuickly()
             {
             {
                 LevelCfgId = levelCfgId,
                 LevelCfgId = levelCfgId,
-                times = times
+                Times = times
             });
             });
             if (response != null)
             if (response != null)
             {
             {
@@ -129,13 +129,13 @@ namespace GFGGame
                 {
                 {
                     List<List<ItemData>> bonusLists = new List<List<ItemData>>();
                     List<List<ItemData>> bonusLists = new List<List<ItemData>>();
                     List<ItemData> allList = new List<ItemData>();
                     List<ItemData> allList = new List<ItemData>();
-                    foreach(var proto in response.RandomBonusList)
+                    foreach (var proto in response.RandomBonusList)
                     {
                     {
                         var itemData = ItemUtil.createItemData(proto.ConfigId, proto.Count);
                         var itemData = ItemUtil.createItemData(proto.ConfigId, proto.Count);
                         allList.Add(itemData);
                         allList.Add(itemData);
                     }
                     }
                     var index = 0;
                     var index = 0;
-                    for(int i = 0; i < response.BonusLengths.Count; ++i)
+                    for (int i = 0; i < response.BonusLengths.Count; ++i)
                     {
                     {
                         var len = response.BonusLengths[i];
                         var len = response.BonusLengths[i];
 
 

+ 2 - 2
GameClient/Assets/Game/HotUpdate/ServerProxy/ItemExchangeSProxy.cs

@@ -7,12 +7,12 @@ namespace GFGGame
         public static async ETTask<bool> ItemExchange(int buyId, int buyCount)
         public static async ETTask<bool> ItemExchange(int buyId, int buyCount)
         {
         {
             M2C_ItemExchange response = null;
             M2C_ItemExchange response = null;
-            response = (M2C_ItemExchange)await MessageHelper.SendToServer(new C2M_ItemExchange() { ItemId = buyId, times = buyCount });
+            response = (M2C_ItemExchange)await MessageHelper.SendToServer(new C2M_ItemExchange() { ItemId = buyId, Times = buyCount });
             if (response != null)
             if (response != null)
             {
             {
                 if (response.Error == ErrorCode.ERR_Success)
                 if (response.Error == ErrorCode.ERR_Success)
                 {
                 {
-                    ItemDataManager.InitItemExchange(response.ItemId, response.times);
+                    ItemDataManager.InitItemExchange(response.ItemId, response.Times);
                     EventAgent.DispatchEvent(ConstMessage.SHOP_BUY);
                     EventAgent.DispatchEvent(ConstMessage.SHOP_BUY);
                     return true;
                     return true;
                 }
                 }

+ 1 - 1
GameClient/Assets/Game/HotUpdate/ServerProxy/MainStorySProxy.cs

@@ -32,7 +32,7 @@ namespace GFGGame
             {
             {
                 if (response.Error == ErrorCode.ERR_Success)
                 if (response.Error == ErrorCode.ERR_Success)
                 {
                 {
-                    MainStoryDataManager.InitBoxBonusStates(response.ksBonusState, response.vsBonusState);
+                    MainStoryDataManager.InitBoxBonusStates(response.KsBonusState, response.VsBonusState);
                 }
                 }
             }
             }
         }
         }

+ 3 - 3
GameClient/Assets/Game/HotUpdate/Views/CommonGame/BuyConfirmView.cs

@@ -61,7 +61,7 @@ namespace GFGGame
             _maxTimes = ItemExchangeCfgArray.Instance.GetCfg(_itemId).maxLimit;
             _maxTimes = ItemExchangeCfgArray.Instance.GetCfg(_itemId).maxLimit;
             if (_maxTimes != 0)
             if (_maxTimes != 0)
             {
             {
-                _ui.m_txtNum.text = string.Format("今日剩余购买次数{0}/{1}", _buyTimes, _maxTimes);
+                _ui.m_txtNum.text = string.Format("今日剩余购买次数{0}/{1}", _maxTimes - _buyTimes, _maxTimes);
             }
             }
             if (_message != "")
             if (_message != "")
             {
             {
@@ -70,7 +70,7 @@ namespace GFGGame
         }
         }
         private async void OnClickBtnSure()
         private async void OnClickBtnSure()
         {
         {
-            if ((_buyTimes + _count) <= 0 && _maxTimes != 0)
+            if (_maxTimes > 0 && (_buyTimes + _count) >= _maxTimes)
             {
             {
                 PromptController.Instance.ShowFloatTextPrompt("购买次数不足!");
                 PromptController.Instance.ShowFloatTextPrompt("购买次数不足!");
                 return;
                 return;
@@ -81,7 +81,7 @@ namespace GFGGame
             if (ItemDataManager.GetItemNum(costId) < coustNum)
             if (ItemDataManager.GetItemNum(costId) < coustNum)
             {
             {
                 ItemCfg costCfg = ItemCfgArray.Instance.GetCfg(costId);
                 ItemCfg costCfg = ItemCfgArray.Instance.GetCfg(costId);
-                if (_itemId == ConstItemID.GOLD)
+                if (_itemId == ConstItemID.DIAMOND_PURPLE)
                 {
                 {
                     PromptController.Instance.ShowFloatTextPrompt(string.Format("{0}不足,请前往商城选购", costCfg.name));
                     PromptController.Instance.ShowFloatTextPrompt(string.Format("{0}不足,请前往商城选购", costCfg.name));
 
 

+ 49 - 45
GameClient/Assets/Game/HotUpdate/Views/CommonGame/BuyCountView.cs

@@ -2,6 +2,7 @@ using UI.CommonGame;
 using System;
 using System;
 using FairyGUI;
 using FairyGUI;
 using System.Collections.Generic;
 using System.Collections.Generic;
+using UnityEngine;
 
 
 namespace GFGGame
 namespace GFGGame
 {
 {
@@ -40,7 +41,7 @@ namespace GFGGame
         /// </summary>
         /// </summary>
         private int _costNum;
         private int _costNum;
         /// <summary>
         /// <summary>
-        /// 最大购买
+        /// 最大购买次数
         /// </summary>
         /// </summary>
         private int _maxCanBuy;
         private int _maxCanBuy;
         // private int _perCount;
         // private int _perCount;
@@ -83,7 +84,7 @@ namespace GFGGame
         /// 
         /// 
         /// </summary>
         /// </summary>
         /// <param name="buyId">购买物品对应的编号,非必须为物品Id</param>
         /// <param name="buyId">购买物品对应的编号,非必须为物品Id</param>
-        /// <param name="minBuyCount">最低兑换数</param>
+        /// <param name="minBuyCount">最低兑换数</param>
         /// <param name="buyType">购买类型,对应ConstBuyType</param>
         /// <param name="buyType">购买类型,对应ConstBuyType</param>
         /// <param name="shopType">商店类型,仅buytype为TYPE_SHOP时有用</param>
         /// <param name="shopType">商店类型,仅buytype为TYPE_SHOP时有用</param>
         /// <param name="onSuccess"></param>
         /// <param name="onSuccess"></param>
@@ -112,8 +113,9 @@ namespace GFGGame
             else if (buyType == ConstBuyType.TYPE_ITEM)
             else if (buyType == ConstBuyType.TYPE_ITEM)
             {
             {
                 ItemExchangeCfg itemExchangeCfg = ItemExchangeCfgArray.Instance.GetCfg(buyId);
                 ItemExchangeCfg itemExchangeCfg = ItemExchangeCfgArray.Instance.GetCfg(buyId);
-                int maxBuyCount = (int)Math.Floor((decimal)(ItemDataManager.GetItemNum(itemExchangeCfg.costId) / itemExchangeCfg.costNumArr[0]));
+                _count = (int)Math.Ceiling(Convert.ToDecimal(minBuyCount) / Convert.ToDecimal(itemExchangeCfg.num));
 
 
+                int maxBuyCount = (int)Math.Floor((decimal)(ItemDataManager.GetItemNum(itemExchangeCfg.costId) / itemExchangeCfg.costNumArr[0]));
                 _maxCanBuy = Math.Min(Math.Min(maxCount, maxBuyCount), itemExchangeCfg.maxLimit == 0 ? maxCount : itemExchangeCfg.maxLimit - ItemDataManager.GetItemExchangeTimes(buyId));
                 _maxCanBuy = Math.Min(Math.Min(maxCount, maxBuyCount), itemExchangeCfg.maxLimit == 0 ? maxCount : itemExchangeCfg.maxLimit - ItemDataManager.GetItemExchangeTimes(buyId));
                 _itemId = buyId;
                 _itemId = buyId;
 
 
@@ -154,44 +156,7 @@ namespace GFGGame
             SetBtnState();
             SetBtnState();
         }
         }
 
 
-        private void OnTouchPlusBegin()
-        {
-            _selectTimeCount = 0;
-            _consumeSelectIndex = 1;
-            Timers.inst.Add(_delay / 1000, 0, OnTimedEvent);
-        }
-        private void OnTouchMinusBegin()
-        {
-            _selectTimeCount = 0;
-            _consumeSelectIndex = 0;
-            Timers.inst.Add(_delay / 1000, 0, OnTimedEvent);
-        }
-        private void OnTimedEvent(object param)
-        {
-            _selectTimeCount += _delay;
 
 
-            if (_selectTimeCount >= longpress)
-            {
-                if (_consumeSelectIndex == 0)
-                {
-                    if (!CommonUtil.Instance.CheckPointIsOnComponent(_ui.m_btnMinus, CommonUtil.Instance.GetMouseV2Point()))
-                    {
-                        Timers.inst.Remove(OnTimedEvent);
-                        return;
-                    }
-                    this.OnClickBtnMinus();
-                }
-                else
-                {
-                    if (!CommonUtil.Instance.CheckPointIsOnComponent(_ui.m_btnPlus, CommonUtil.Instance.GetMouseV2Point()))
-                    {
-                        Timers.inst.Remove(OnTimedEvent);
-                        return;
-                    }
-                    this.OnClickBtnPlus();
-                }
-            }
-        }
         private void OnClickBtnAll()
         private void OnClickBtnAll()
         {
         {
             _count = _maxCanBuy;
             _count = _maxCanBuy;
@@ -216,7 +181,7 @@ namespace GFGGame
         {
         {
             string inputStr = _ui.m_txtCount.text.Trim();
             string inputStr = _ui.m_txtCount.text.Trim();
 
 
-            if (inputStr == null || int.Parse(inputStr) <= _minBuyCount)
+            if (_count <= _minBuyCount)
             {
             {
                 _ui.m_btnMinus.enabled = false;
                 _ui.m_btnMinus.enabled = false;
             }
             }
@@ -226,7 +191,7 @@ namespace GFGGame
 
 
             }
             }
 
 
-            if (inputStr != null && (int.Parse(inputStr) >= _maxCanBuy))
+            if (_count >= _maxCanBuy)
             {
             {
                 _ui.m_btnPlus.enabled = false;
                 _ui.m_btnPlus.enabled = false;
                 _ui.m_btnAll.enabled = false;
                 _ui.m_btnAll.enabled = false;
@@ -244,7 +209,7 @@ namespace GFGGame
             int price = int.Parse(_ui.m_txtPrice.text.Trim());
             int price = int.Parse(_ui.m_txtPrice.text.Trim());
 
 
 
 
-            if (count > 0)
+            if (_count > 0)
             {
             {
                 if (price > ItemDataManager.GetItemNum(_costId))
                 if (price > ItemDataManager.GetItemNum(_costId))
                 {
                 {
@@ -271,10 +236,10 @@ namespace GFGGame
                         case ConstBuyType.TYPE_NORMAL:
                         case ConstBuyType.TYPE_NORMAL:
                             break;
                             break;
                         case ConstBuyType.TYPE_ITEM:
                         case ConstBuyType.TYPE_ITEM:
-                            result = await ItemExchangeSProxy.ItemExchange(_buyId, count);
+                            result = await ItemExchangeSProxy.ItemExchange(_buyId, _count);
                             break;
                             break;
                         case ConstBuyType.TYPE_SHOP:
                         case ConstBuyType.TYPE_SHOP:
-                            result = await ShopSProxy.ShopBuy(_shopType, _buyId, count);
+                            result = await ShopSProxy.ShopBuy(_shopType, _buyId, _count);
                             break;
                             break;
                     }
                     }
                     if (_onSuccess != null)
                     if (_onSuccess != null)
@@ -313,13 +278,52 @@ namespace GFGGame
             }
             }
             else if (_buyType == ConstBuyType.TYPE_ITEM)
             else if (_buyType == ConstBuyType.TYPE_ITEM)
             {
             {
+                ItemExchangeCfg itemExchangeCfg = ItemExchangeCfgArray.Instance.GetCfg(_itemId);
+                int _exchangeCount = (int)Math.Ceiling(Convert.ToDecimal(count) / Convert.ToDecimal(itemExchangeCfg.num));
 
 
                 ItemExchangeCfgArray.Instance.GetMoneyIdAndNum(_itemId, ItemDataManager.GetItemExchangeTimes(_itemId), count, out _costId, out _costNum, out _buyNum);
                 ItemExchangeCfgArray.Instance.GetMoneyIdAndNum(_itemId, ItemDataManager.GetItemExchangeTimes(_itemId), count, out _costId, out _costNum, out _buyNum);
 
 
             }
             }
         }
         }
 
 
+        private void OnTouchPlusBegin()
+        {
+            _selectTimeCount = 0;
+            _consumeSelectIndex = 1;
+            Timers.inst.Add(_delay / 1000, 0, OnTimedEvent);
+        }
+        private void OnTouchMinusBegin()
+        {
+            _selectTimeCount = 0;
+            _consumeSelectIndex = 0;
+            Timers.inst.Add(_delay / 1000, 0, OnTimedEvent);
+        }
+        private void OnTimedEvent(object param)
+        {
+            _selectTimeCount += _delay;
 
 
+            if (_selectTimeCount >= longpress)
+            {
+                if (_consumeSelectIndex == 0)
+                {
+                    if (!CommonUtil.Instance.CheckPointIsOnComponent(_ui.m_btnMinus, CommonUtil.Instance.GetMouseV2Point()))
+                    {
+                        Timers.inst.Remove(OnTimedEvent);
+                        return;
+                    }
+                    this.OnClickBtnMinus();
+                }
+                else
+                {
+                    if (!CommonUtil.Instance.CheckPointIsOnComponent(_ui.m_btnPlus, CommonUtil.Instance.GetMouseV2Point()))
+                    {
+                        Timers.inst.Remove(OnTimedEvent);
+                        return;
+                    }
+                    this.OnClickBtnPlus();
+                }
+            }
+        }
         public void Reset()
         public void Reset()
         {
         {
             _buyId = 0;
             _buyId = 0;