Эх сурвалжийг харах

Merge branch 'guodong'

# Conflicts:
#	GameClient/Assets/Game/HotUpdate/Views/Studio/StudioBuyNumView.cs
#	GameClient/Assets/Game/Launcher/LauncherConfig.cs
#	GameClient/Assets/ResIn/Config/excelConfig.sqlite.bytes
guodong 2 жил өмнө
parent
commit
3d69e66348
21 өөрчлөгдсөн 256 нэмэгдсэн , 118 устгасан
  1. 2 2
      GameClient/Assets/Game/HotUpdate/Constant/ConstMessage.cs
  2. 1 0
      GameClient/Assets/Game/HotUpdate/Controller/GameController.cs
  3. 3 2
      GameClient/Assets/Game/HotUpdate/Data/InstanceZonesDataManager.cs
  4. 49 0
      GameClient/Assets/Game/HotUpdate/Data/RoleLimitDataManager.cs
  5. 11 0
      GameClient/Assets/Game/HotUpdate/Data/RoleLimitDataManager.cs.meta
  6. 2 11
      GameClient/Assets/Game/HotUpdate/Data/StudioDataManager.cs
  7. 31 0
      GameClient/Assets/Game/HotUpdate/Data/VO/RoleLimitData.cs
  8. 11 0
      GameClient/Assets/Game/HotUpdate/Data/VO/RoleLimitData.cs.meta
  9. 0 15
      GameClient/Assets/Game/HotUpdate/Data/VO/StudioData.cs
  10. 48 0
      GameClient/Assets/Game/HotUpdate/ServerProxy/RoleLimitSProxy.cs
  11. 11 0
      GameClient/Assets/Game/HotUpdate/ServerProxy/RoleLimitSProxy.cs.meta
  12. 2 26
      GameClient/Assets/Game/HotUpdate/ServerProxy/StudioSProxy.cs
  13. 3 3
      GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryFightQuicklyView.cs
  14. 4 2
      GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryLevelInfoView.cs
  15. 25 13
      GameClient/Assets/Game/HotUpdate/Views/Studio/StudioBaseView.cs
  16. 17 12
      GameClient/Assets/Game/HotUpdate/Views/Studio/StudioBuyNumView.cs
  17. 2 3
      GameClient/Assets/Game/HotUpdate/Views/Studio/StudioFabricView.cs
  18. 26 17
      GameClient/Assets/Game/HotUpdate/Views/Studio/StudioFilingView.cs
  19. 2 3
      GameClient/Assets/Game/HotUpdate/Views/Studio/StudioMetalView.cs
  20. 2 3
      GameClient/Assets/Game/HotUpdate/Views/Studio/StudioPorcelainView.cs
  21. 4 6
      GameClient/Assets/Game/HotUpdate/Views/Studio/StudioPropertyView.cs

+ 2 - 2
GameClient/Assets/Game/HotUpdate/Constant/ConstMessage.cs

@@ -48,8 +48,8 @@ namespace GFGGame
         //剧情战斗快速完成,展示奖励
         public const string STORY_FIGHT_QUICKLY_SUCCESS = "STORY_FIGHT_QUICKLY_SUCCESS";
 
-        public const string BUY_STUDIO_PLAY_TIMES = "BUY_STUDIO_PLAY_TIMES";//购买工作室次数
-        public const string NOTICE_STUDIO_PLAY_TIMES = "NOTICE_STUDIO_PLAY_TIMES";//工作室次数变化通知
+        public const string NOTICE_LIMIT_CHANGED = "NOTICE_LIMIT_CHANGED";//限制次数变化通知
+
         public const string FILING_SCORE_CHANGE = "FILING_SCORE_CHANGE";//查阅建档分数奖励变化
         public const string FILLING_CHANGE_CHAPTER = "FILLING_CHANGE_CHAPTER";//查阅建档切换npc
 

+ 1 - 0
GameClient/Assets/Game/HotUpdate/Controller/GameController.cs

@@ -103,6 +103,7 @@ namespace GFGGame
 
             LeagueSproxy.ReqGetLeagueInfo().Coroutine();
             await ItemProxy.GetItemInfos();
+            await RoleLimitSProxy.ReqUnitLimitInfos();
             await InstanceZonesSProxy.GetInstanceZonesInfos();
             await StorageSProxy.ReqGetClientValues();
             await SuitFosterProxy.SendGetSuitInfos();

+ 3 - 2
GameClient/Assets/Game/HotUpdate/Data/InstanceZonesDataManager.cs

@@ -360,8 +360,9 @@ namespace GFGGame
             title = "";
             if (type == ConstInstanceZonesType.Studio)
             {
-                StudioData studioData = StudioDataManager.Instance.GetStudioDataById(levelCfg.chapterId);
-                times = Math.Min(times, studioData.TotalPlayTimes - studioData.PlayTimes);
+                var studioCfg = StudioCfgArray.Instance.GetCfg(levelCfg.chapterId);
+                var limitData = RoleLimitDataManager.GetLimitData(studioCfg.limit);
+                times = Math.Min(times, limitData.TotalPlayMax - limitData.PlayTimes);
             }
             title = string.Format("挑战{0}次", NumberUtil.GetChiniseNumberText(times));
         }

+ 49 - 0
GameClient/Assets/Game/HotUpdate/Data/RoleLimitDataManager.cs

@@ -0,0 +1,49 @@
+using System.Collections.Generic;
+using ET;
+
+namespace GFGGame
+{
+    public class RoleLimitDataManager
+    {
+        private static Dictionary<int, RoleLimitData> _roleLimitDatas = new Dictionary<int, RoleLimitData>();
+
+        public static void InitServerData(List<UnitLimitInfoProto> unitLimitInfoProtos)
+        {
+            _roleLimitDatas.Clear();
+            foreach (var proto in unitLimitInfoProtos)
+            {
+                var data = new RoleLimitData();
+                data.FromMessage(proto);
+                _roleLimitDatas.Add(proto.LimitId, data);
+            }
+        }
+
+        public static void UpdateLimitData(UnitLimitInfoProto proto)
+        {
+            _roleLimitDatas.TryGetValue(proto.LimitId, out var data);
+            if(data == null)
+            {
+                data = new RoleLimitData();
+                _roleLimitDatas.Add(proto.LimitId, data);
+            }
+            data.FromMessage(proto);
+            EventAgent.DispatchEvent(ConstMessage.NOTICE_LIMIT_CHANGED, proto.LimitId);
+        }
+
+        public static RoleLimitData GetLimitData(int limitId)
+        {
+            _roleLimitDatas.TryGetValue(limitId, out var data);
+            return data;
+        }
+
+        public static bool CheckPlayTimesEnough(int limitId, int times)
+        {
+            var data = GetLimitData(limitId);
+            if(data == null)
+            {
+                return true;
+            }
+            return data.TotalPlayMax >= data.PlayTimes + times;
+        }
+    }
+}

+ 11 - 0
GameClient/Assets/Game/HotUpdate/Data/RoleLimitDataManager.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 4bc871ce004f24a49987d09ee99321cf
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 2 - 11
GameClient/Assets/Game/HotUpdate/Data/StudioDataManager.cs

@@ -38,21 +38,13 @@ namespace GFGGame
             }
             _StudioInfoById[studioData.ChapterId] = studioData;
         }
-        public void RspBuyStudioPlayTimes(int chapterId, int buyTimes, int totalPlayTimes)
-        {
-            _StudioInfoById[chapterId].BuyTimes = buyTimes;
-            _StudioInfoById[chapterId].TotalPlayTimes = totalPlayTimes;
 
-        }
         public void RspFilingScoreReward(int chapterId, int index)
         {
             _StudioInfoById[chapterId].RewardsStatus[index] = ConstBonusStatus.GOT;
 
         }
-        public void NoticeStudioPlayTimes(int chapterId, int PlayTimes)
-        {
-            _StudioInfoById[chapterId].PlayTimes = PlayTimes;
-        }
+
         public void NoticeFilingScoreBonusChanged(int chapterId, int chapterScore, List<int> rewardsStatus)
         {
             _StudioInfoById[chapterId].ChapterScore = chapterScore;
@@ -68,8 +60,7 @@ namespace GFGGame
             }
             else
             {
-                int totalPlayTimes = StudioCfgArray.Instance.GetCfg(id).num;
-                StudioData studioData = new StudioData() { ChapterId = id, BuyTimes = 0, PlayTimes = 0, TotalPlayTimes = totalPlayTimes };
+                StudioData studioData = new StudioData() { ChapterId = id };
                 RspStudioInfos(studioData);
                 return studioData;
             }

+ 31 - 0
GameClient/Assets/Game/HotUpdate/Data/VO/RoleLimitData.cs

@@ -0,0 +1,31 @@
+using ET;
+
+namespace GFGGame
+{
+    public class RoleLimitData
+    {
+
+        /// <summary>
+        /// 已购买次数
+        /// </summary>
+        public int BuyTimes;
+
+        /// <summary>
+        /// 已挑战次数
+        /// </summary>
+        public int PlayTimes;
+
+        /// <summary>
+        /// 最大可挑战次数
+        /// </summary>
+        public int TotalPlayMax;
+
+        public void FromMessage(UnitLimitInfoProto proto)
+        {
+            BuyTimes = proto.BuyTimes;
+            PlayTimes = proto.PlayTimes;
+            TotalPlayMax = proto.PlayTimesMax;
+        }
+
+    }
+}

+ 11 - 0
GameClient/Assets/Game/HotUpdate/Data/VO/RoleLimitData.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: c1f3452b391de794b8e8c6151ecdc778
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 0 - 15
GameClient/Assets/Game/HotUpdate/Data/VO/StudioData.cs

@@ -10,21 +10,6 @@ namespace GFGGame
         public int ChapterId;
 
         /// <summary>
-        /// 已购买次数
-        /// </summary>
-        public int BuyTimes;
-
-        /// <summary>
-        /// 已挑战次数
-        /// </summary>
-        public int PlayTimes;
-
-        /// <summary>
-        /// 可挑战次数
-        /// </summary>
-        public int TotalPlayTimes;
-
-        /// <summary>
         /// 查阅建档一章总分
         /// </summary>
         public int ChapterScore;

+ 48 - 0
GameClient/Assets/Game/HotUpdate/ServerProxy/RoleLimitSProxy.cs

@@ -0,0 +1,48 @@
+using ET;
+using GFGGame;
+
+namespace ET
+{
+    public class M2C_NoticeUnitLimitPlayTimesHandler : AMHandler<M2C_NoticeUnitLimitPlayTimes>
+    {
+        protected override async ETTask Run(Session session, M2C_NoticeUnitLimitPlayTimes message)
+        {
+            RoleLimitDataManager.UpdateLimitData(message.UnitLimitInfo);
+            await ETTask.CompletedTask;
+        }
+    }
+}
+
+namespace GFGGame
+{
+    public class RoleLimitSProxy
+    {
+
+        public static async ETTask ReqUnitLimitInfos()
+        {
+            S2C_GetUnitLimitInfos response = null;
+            response = (S2C_GetUnitLimitInfos)await MessageHelper.SendToServer(new C2S_GetUnitLimitInfos());
+            if (response != null)
+            {
+                if (response.Error == ErrorCode.ERR_Success)
+                {
+                    RoleLimitDataManager.InitServerData(response.UnitLimitInfos);
+                }
+            }
+        }
+
+        //请求购买次数
+        public static async ETTask ReqBuyLimitPlayTimes(int chapterId, int buyType, int buyCount)
+        {
+            M2C_BuyUnitLimitPlayTimes response = null;
+            response = (M2C_BuyUnitLimitPlayTimes)await MessageHelper.SendToServer(new C2M_BuyUnitLimitPlayTimes() { LimitId = chapterId, BuyType = buyType, BuyCount = buyCount });
+            if (response != null)
+            {
+                if (response.Error == ErrorCode.ERR_Success)
+                {
+                    //数据会通过通用推送协议另外推送
+                }
+            }
+        }
+    }
+}

+ 11 - 0
GameClient/Assets/Game/HotUpdate/ServerProxy/RoleLimitSProxy.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 35b851266c5d887468690837f6ce679b
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 2 - 26
GameClient/Assets/Game/HotUpdate/ServerProxy/StudioSProxy.cs

@@ -4,16 +4,7 @@ using GFGGame;
 
 namespace ET
 {
-    public class NoticeStudioPlayTimes : AMHandler<M2C_NoticeStudioPlayTimes>
-    {
-        protected override async ETTask Run(Session session, M2C_NoticeStudioPlayTimes message)
-        {
-            StudioDataManager.Instance.NoticeStudioPlayTimes(message.ChapterId, message.PlayTimes);
-            EventAgent.DispatchEvent(ConstMessage.NOTICE_STUDIO_PLAY_TIMES);
-
-            await ETTask.CompletedTask;
-        }
-    }
+    
     public class NoticeFilingScoreBonusChanged : AMHandler<S2C_FilingScoreBonusChanged>
     {
         protected override async ETTask Run(Session session, S2C_FilingScoreBonusChanged message)
@@ -42,7 +33,7 @@ namespace GFGGame
                 {
                     for (int i = 0; i < response.infos.Count; i++)
                     {
-                        StudioData studioData = new StudioData { ChapterId = response.infos[i].ChapterId, BuyTimes = response.infos[i].BuyTimes, PlayTimes = response.infos[i].PlayTimes, TotalPlayTimes = response.infos[i].TotalPlayTimes, ChapterScore = response.infos[i].ChapterScore, RewardsStatus = response.infos[i].BonusStatusList };
+                        StudioData studioData = new StudioData { ChapterId = response.infos[i].ChapterId, ChapterScore = response.infos[i].ChapterScore, RewardsStatus = response.infos[i].BonusStatusList };
                         StudioDataManager.Instance.RspStudioInfos(studioData);
                     }
                     StudioDataManager.Instance.PorcelainTheme = response.RepairPorcelainTheme;
@@ -51,21 +42,6 @@ namespace GFGGame
             }
         }
 
-        //请求购买副本挑战次数
-        public static async ETTask ReqBuyStudioPlayTimes(int chapterId, int buyType, int buyCount)
-        {
-            M2C_BuyStudioPlayTimes response = null;
-            response = (M2C_BuyStudioPlayTimes)await MessageHelper.SendToServer(new C2M_BuyStudioPlayTimes() { ChapterId = chapterId, BuyType = buyType, BuyCount = buyCount });
-            if (response != null)
-            {
-                if (response.Error == ErrorCode.ERR_Success)
-                {
-                    StudioDataManager.Instance.RspBuyStudioPlayTimes(response.ChapterId, response.BuyTimes, response.TotalPlayTimes);
-                    EventAgent.DispatchEvent(ConstMessage.BUY_STUDIO_PLAY_TIMES);
-
-                }
-            }
-        }
         //领取查阅建档分数宝箱
         public static async ETTask ReqFilingScoreRewards(int chapterId)
         {

+ 3 - 3
GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryFightQuicklyView.cs

@@ -109,11 +109,11 @@ namespace GFGGame
                 }
                 else if (levelCfg.type == ConstInstanceZonesType.Studio)
                 {
-                    StudioData studioData = StudioDataManager.Instance.GetStudioDataById(levelCfg.chapterId);
-                    if (studioData.TotalPlayTimes - studioData.PlayTimes == 0)
+                    var studioCfg = StudioCfgArray.Instance.GetCfg(levelCfg.chapterId);
+                    if (!RoleLimitDataManager.CheckPlayTimesEnough(studioCfg.limit, 1))
                     {
                         PromptController.Instance.ShowFloatTextPrompt("挑战次数不足");
-                        ViewManager.Show<StudioBuyNumView>(levelCfg.chapterId);
+                        ViewManager.Show<StudioBuyNumView>(studioCfg.limit);
                     }
                     else
                     {

+ 4 - 2
GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryLevelInfoView.cs

@@ -104,7 +104,8 @@ namespace GFGGame
                 {
                     if (levelCfg.type == ConstInstanceZonesType.Studio)
                     {
-                        ViewManager.Show<StudioBuyNumView>(levelCfg.chapterId);
+                        var studioCfg = StudioCfgArray.Instance.GetCfg(levelCfg.chapterId);
+                        ViewManager.Show<StudioBuyNumView>(studioCfg.limit);
                     }
                     else
                     {
@@ -142,7 +143,8 @@ namespace GFGGame
                 {
                     if (levelCfg.type == ConstInstanceZonesType.Studio)
                     {
-                        ViewManager.Show<StudioBuyNumView>(levelCfg.chapterId);
+                        var studioCfg = StudioCfgArray.Instance.GetCfg(levelCfg.chapterId);
+                        ViewManager.Show<StudioBuyNumView>(studioCfg.limit);
                     }
                     else
                     {

+ 25 - 13
GameClient/Assets/Game/HotUpdate/Views/Studio/StudioBaseView.cs

@@ -1,5 +1,3 @@
-
-using System;
 using System.Collections.Generic;
 using ET;
 using FairyGUI;
@@ -17,9 +15,8 @@ namespace GFGGame
         private GTextField _txtNum;
         private GButton _btnBuy;
 
-        protected StudioCfg studioCfg;
+        protected StudioCfg _studioCfg;
         protected List<StoryLevelCfg> storyLevelCfgs;
-        protected StudioData studioData;
         protected int curIndex = 0;
 
         public override void Dispose()
@@ -61,8 +58,7 @@ namespace GFGGame
         protected override void AddEventListener()
         {
             base.AddEventListener();
-            EventAgent.AddEventListener(ConstMessage.BUY_STUDIO_PLAY_TIMES, UpdateView);
-            EventAgent.AddEventListener(ConstMessage.NOTICE_STUDIO_PLAY_TIMES, UpdateView);
+            EventAgent.AddEventListener(ConstMessage.NOTICE_LIMIT_CHANGED, OnLimitChanged);
         }
         public void AddChildCom(GComponent com)
         {
@@ -93,23 +89,39 @@ namespace GFGGame
             _ui.target.RemoveChildAt(1);
             base.OnHide();
             _valueBarController.OnHide();
-            studioCfg = null;
+            _studioCfg = null;
             storyLevelCfgs = null;
-            studioData = null;
             Timers.inst.Remove(UpdateShowTime);
 
         }
         protected override void RemoveEventListener()
         {
             base.RemoveEventListener();
-            EventAgent.RemoveEventListener(ConstMessage.BUY_STUDIO_PLAY_TIMES, UpdateView);
-            EventAgent.RemoveEventListener(ConstMessage.NOTICE_STUDIO_PLAY_TIMES, UpdateView);
+            EventAgent.RemoveEventListener(ConstMessage.NOTICE_LIMIT_CHANGED, OnLimitChanged);
+        }
+
+        private void OnLimitChanged(EventContext context)
+        {
+            int limitId = (int)context.data;
+            if (this._studioCfg.limit != limitId)
+            {
+                return;
+            }
+            UpdateView();
         }
+
         protected void UpdateView()
         {
-            studioData = StudioDataManager.Instance.GetStudioDataById(this.studioCfg.id);
-            _txtNum.text = string.Format("剩余次数:{0}/{1}", this.studioData.TotalPlayTimes - this.studioData.PlayTimes, studioCfg.num);
+            var limitData = RoleLimitDataManager.GetLimitData(this._studioCfg.limit);
+            var limitCfg = LimitCfgArray.Instance.GetCfg(this._studioCfg.limit);
+            _txtNum.text = string.Format("剩余次数:{0}/{1}", limitData.TotalPlayMax - limitData.PlayTimes, limitCfg.num);
         }
+
+        private void UpdateView(int limitId)
+        {
+
+        }
+
         private void UpdateShowTime(object param)
         {
             long curTime = TimeHelper.ServerNow();
@@ -166,7 +178,7 @@ namespace GFGGame
 
         private void OnCliclBtnBuy()
         {
-            ViewManager.Show<StudioBuyNumView>(this.studioCfg.id);
+            ViewManager.Show<StudioBuyNumView>(this._studioCfg.limit);
         }
     }
 }

+ 17 - 12
GameClient/Assets/Game/HotUpdate/Views/Studio/StudioBuyNumView.cs

@@ -10,9 +10,9 @@ namespace GFGGame
     public class StudioBuyNumView : BaseWindow
     {
         private UI_StudioBuyNumUI _ui;
-        private int _chapterId;
-        private StudioData _studioData;
-        private StudioCfg _studioCfg;
+        private int _limitId;
+        private RoleLimitData _studioData;
+        private LimitCfg _studioCfg;
 
         private int _index;
 
@@ -45,7 +45,7 @@ namespace GFGGame
         protected override void AddEventListener()
         {
             base.AddEventListener();
-            EventAgent.AddEventListener(ConstMessage.BUY_STUDIO_PLAY_TIMES, OnListenerBuyTimeComplete);
+            EventAgent.AddEventListener(ConstMessage.NOTICE_LIMIT_CHANGED, OnLimitChanged);
         }
         protected override void OnShown()
         {
@@ -53,11 +53,12 @@ namespace GFGGame
             UpdateView();
         }
 
+
         private void UpdateView()
         {
-            _chapterId = (int)this.viewData;
-            _studioData = StudioDataManager.Instance.GetStudioDataById(_chapterId);
-            _studioCfg = StudioCfgArray.Instance.GetCfg(_chapterId);
+            _limitId = (int)this.viewData;
+            _studioData = RoleLimitDataManager.GetLimitData(_limitId);
+            _studioCfg = LimitCfgArray.Instance.GetCfg(_limitId);
 
             _ui.m_c1.selectedIndex = 0;
             _ui.m_txtNum.text = string.Format("(今天已兑换{0}/{1}次)", _studioData.BuyTimes, _studioCfg.buyNum);
@@ -66,7 +67,7 @@ namespace GFGGame
 
             if (_studioCfg.moneyId <= 0) return;
             _ui.m_c1.selectedIndex = 1;
-            StudioCfgArray.Instance.GetMoneyIdAndNum(_studioCfg.id, _studioData.BuyTimes, 1, out int moneyId, out int moneyNum);
+            LimitCfgArray.Instance.GetMoneyIdAndNum(_studioCfg.id, _studioData.BuyTimes, 1, out int moneyId, out int moneyNum);
             ItemUtil.UpdateItemNumAndNeedNum(_ui.m_comCostCurrent, _studioCfg.moneyId, moneyNum, true);
 
         }
@@ -78,7 +79,7 @@ namespace GFGGame
         protected override void RemoveEventListener()
         {
             base.RemoveEventListener();
-            EventAgent.RemoveEventListener(ConstMessage.BUY_STUDIO_PLAY_TIMES, OnListenerBuyTimeComplete);
+            EventAgent.RemoveEventListener(ConstMessage.NOTICE_LIMIT_CHANGED, OnLimitChanged);
         }
         private void OnClickBtnBuy(int type)
         {
@@ -87,18 +88,22 @@ namespace GFGGame
                 PromptController.Instance.ShowFloatTextPrompt("今日购买次数已达上限", MessageType.ERR);
                 return;
             }
-            StudioCfgArray.Instance.GetMoneyIdAndNum(_studioCfg.id, _studioData.BuyTimes, 1, out int moneyId, out int moneyNum);
+            LimitCfgArray.Instance.GetMoneyIdAndNum(_studioCfg.id, _studioData.BuyTimes, 1, out int moneyId, out int moneyNum);
 
             if (type == BUY_TYPE_0 && ItemDataManager.GetItemNum(_studioCfg.itemID) < _studioCfg.itemNum || type == BUY_TYPE_1 && ItemDataManager.GetItemNum(moneyId) < moneyNum)
             {
                 PromptController.Instance.ShowFloatTextPrompt("道具不足", MessageType.ERR);
                 return;
             }
-            StudioSProxy.ReqBuyStudioPlayTimes(_chapterId, type, 1).Coroutine();
+            RoleLimitSProxy.ReqBuyLimitPlayTimes(_limitId, type, 1).Coroutine();
 
         }
-        private void OnListenerBuyTimeComplete()
+        private void OnLimitChanged(EventContext context = null)
         {
+            if((int)context.data != _limitId)
+            {
+                return;
+            }
             PromptController.Instance.ShowFloatTextPrompt("购买成功", MessageType.SUCCESS);
             UpdateView();
             if (_studioData.BuyTimes == _studioCfg.buyNum)

+ 2 - 3
GameClient/Assets/Game/HotUpdate/Views/Studio/StudioFabricView.cs

@@ -28,9 +28,8 @@ namespace GFGGame
             AddChildCom(com);
 
             StudioDataManager.Instance.VIEW_NAME = typeof(StudioFabricView).FullName;
-            this.studioCfg = StudioCfgArray.Instance.GetCfgsByfunId(typeof(StudioFabricView).Name)[0];
-            this.studioData = StudioDataManager.Instance.GetStudioDataById(this.studioCfg.id);
-            this.storyLevelCfgs = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(this.studioCfg.type, this.studioCfg.subType, this.studioCfg.id);
+            this._studioCfg = StudioCfgArray.Instance.GetCfgsByfunId(typeof(StudioFabricView).Name)[0];
+            this.storyLevelCfgs = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(this._studioCfg.type, this._studioCfg.subType, this._studioCfg.id);
             list.numItems = this.storyLevelCfgs.Count;
             list.ScrollToView(curIndex);
 

+ 26 - 17
GameClient/Assets/Game/HotUpdate/Views/Studio/StudioFilingView.cs

@@ -10,7 +10,7 @@ namespace GFGGame
     {
         private UI_StudioFilingUI _ui;
         private ValueBarController _valueBarController;
-        private StudioCfg _filingCfg;
+        private StudioCfg _studioCfg;
         private List<StoryLevelCfg> _storyLevelCfgs;
 
         public override void Dispose()
@@ -52,8 +52,7 @@ namespace GFGGame
             base.AddEventListener();
             EventAgent.AddEventListener(ConstMessage.STORY_LEVEL_CHANGE, UpdateView);
             EventAgent.AddEventListener(ConstMessage.FILLING_CHANGE_CHAPTER, UpdateView);
-            EventAgent.AddEventListener(ConstMessage.NOTICE_STUDIO_PLAY_TIMES, UpdateView);
-            EventAgent.AddEventListener(ConstMessage.BUY_STUDIO_PLAY_TIMES, UpdateView);
+            EventAgent.AddEventListener(ConstMessage.NOTICE_LIMIT_CHANGED, OnLimitChanged);
             EventAgent.AddEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
 
         }
@@ -83,30 +82,40 @@ namespace GFGGame
             base.RemoveEventListener();
             EventAgent.RemoveEventListener(ConstMessage.STORY_LEVEL_CHANGE, UpdateView);
             EventAgent.RemoveEventListener(ConstMessage.FILLING_CHANGE_CHAPTER, UpdateView);
-            EventAgent.RemoveEventListener(ConstMessage.NOTICE_STUDIO_PLAY_TIMES, UpdateView);
-            EventAgent.RemoveEventListener(ConstMessage.BUY_STUDIO_PLAY_TIMES, UpdateView);
+            EventAgent.RemoveEventListener(ConstMessage.NOTICE_LIMIT_CHANGED, OnLimitChanged);
             EventAgent.RemoveEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
 
         }
 
+        private void OnLimitChanged(EventContext context)
+        {
+            int limitId = (int)context.data;
+            if (this._studioCfg.limit != limitId)
+            {
+                return;
+            }
+            UpdateView();
+        }
+
         private void UpdateView()
         {
-            StudioData studioData = StudioDataManager.Instance.GetStudioDataById(StudioDataManager.Instance.filingChapterId);
+            _studioCfg = StudioCfgArray.Instance.GetCfg(StudioDataManager.Instance.filingChapterId);
+            RoleLimitData limitData = RoleLimitDataManager.GetLimitData(this._studioCfg.limit);
+            var limitCfg = LimitCfgArray.Instance.GetCfg(this._studioCfg.limit);
 
-            _filingCfg = StudioCfgArray.Instance.GetCfg(StudioDataManager.Instance.filingChapterId);
-            _ui.m_loaBg.url = ResPathUtil.GetBgImgPath(_filingCfg.res);
-            _ui.m_btnChange.title = _filingCfg.name;
-            _ui.m_txtNum.text = string.Format("剩余次数:{0}/{1}", studioData.TotalPlayTimes - studioData.PlayTimes, _filingCfg.num);
+            _ui.m_loaBg.url = ResPathUtil.GetBgImgPath(_studioCfg.res);
+            _ui.m_btnChange.title = _studioCfg.name;
+            _ui.m_txtNum.text = string.Format("剩余次数:{0}/{1}", limitData.TotalPlayMax - limitData.PlayTimes, limitCfg.num);
 
-            SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(_filingCfg.suitId);
+            SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(_studioCfg.suitId);
             _ui.m_txtSuitName.text = suitCfg.name;
 
-            DressUpMenuSuitDataManager.GetSuitProgressBySuitId(_filingCfg.suitId, out int count, out int totalCount);
+            DressUpMenuSuitDataManager.GetSuitProgressBySuitId(_studioCfg.suitId, out int count, out int totalCount);
             _ui.m_txtSuitProgress.text = string.Format("({0}/{1})", count, totalCount);
 
             _ui.m_suitIcon.url = ResPathUtil.GetIconPath(suitCfg.res, "png");
 
-            _storyLevelCfgs = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(_filingCfg.type, _filingCfg.subType, StudioDataManager.Instance.filingChapterId);
+            _storyLevelCfgs = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(_studioCfg.type, _studioCfg.subType, StudioDataManager.Instance.filingChapterId);
             _ui.m_list.numItems = _storyLevelCfgs.Count;
 
             UpdateRedDot();
@@ -142,7 +151,7 @@ namespace GFGGame
                 item.m_loaBg.url = "ui://Studio/cyjd_di_2";
                 item.m_loaItem.visible = false;
                 item.m_loaIcon.visible = true;
-                item.m_loaIcon.url = string.Format("ui://Studio/{0}", _filingCfg.res);
+                item.m_loaIcon.url = string.Format("ui://Studio/{0}", _studioCfg.res);
             }
             item.m_grpLock.visible = index > 0 && !InstanceZonesDataManager.CheckLevelPass(_storyLevelCfgs[index - 1].id);
             item.m_comFlower.m_c1.selectedIndex = InstanceZonesDataManager.GetStarCountHistory(_storyLevelCfgs[index].id);
@@ -188,18 +197,18 @@ namespace GFGGame
         }
         private void OnBtnAddClick()
         {
-            ViewManager.Show<StudioBuyNumView>(StudioDataManager.Instance.filingChapterId);
+            ViewManager.Show<StudioBuyNumView>(_studioCfg.limit);
         }
         private void OnBtnSuitClick()
         {
-            SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(_filingCfg.suitId);
+            SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(_studioCfg.suitId);
             if (suitCfg.syntheticStoryLevelId > 0 && !InstanceZonesDataManager.CheckLevelPass(suitCfg.syntheticStoryLevelId))
             {
                 StoryLevelCfg cfg = StoryLevelCfgArray.Instance.GetCfg(suitCfg.syntheticStoryLevelId);
                 PromptController.Instance.ShowFloatTextPrompt(string.Format("需通关{0}关卡解锁", cfg.name));
                 return;
             }
-            ViewManager.Show<ClothingSyntheticView>(new object[] { _filingCfg.suitId }, new object[] { typeof(StudioFilingView).FullName, this.viewData }, true);
+            ViewManager.Show<ClothingSyntheticView>(new object[] { _studioCfg.suitId }, new object[] { typeof(StudioFilingView).FullName, this.viewData }, true);
         }
         private void UpdateRedDot()
         {

+ 2 - 3
GameClient/Assets/Game/HotUpdate/Views/Studio/StudioMetalView.cs

@@ -28,9 +28,8 @@ namespace GFGGame
 
             StudioDataManager.Instance.VIEW_NAME = typeof(StudioMetalView).FullName;
 
-            this.studioCfg = StudioCfgArray.Instance.GetCfgsByfunId(typeof(StudioMetalView).Name)[0];
-            this.studioData = StudioDataManager.Instance.GetStudioDataById(this.studioCfg.id);
-            this.storyLevelCfgs = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(this.studioCfg.type, this.studioCfg.subType, this.studioCfg.id);
+            this._studioCfg = StudioCfgArray.Instance.GetCfgsByfunId(typeof(StudioMetalView).Name)[0];
+            this.storyLevelCfgs = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(this._studioCfg.type, this._studioCfg.subType, this._studioCfg.id);
             list.numItems = this.storyLevelCfgs.Count;
             list.ScrollToView(curIndex);
 

+ 2 - 3
GameClient/Assets/Game/HotUpdate/Views/Studio/StudioPorcelainView.cs

@@ -33,9 +33,8 @@ namespace GFGGame
             com.GetChild("loaBg").asLoader.url = ResPathUtil.GetBgImgPath("hz_bjbj");
 
             StudioDataManager.Instance.VIEW_NAME = typeof(StudioPorcelainView).FullName;
-            this.studioCfg = StudioCfgArray.Instance.GetCfgsByfunId(typeof(StudioPorcelainView).Name)[StudioDataManager.Instance.PorcelainTheme - 1];
-            this.studioData = StudioDataManager.Instance.GetStudioDataById(this.studioCfg.id);
-            this.storyLevelCfgs = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(this.studioCfg.type, this.studioCfg.subType, this.studioCfg.id);
+            this._studioCfg = StudioCfgArray.Instance.GetCfgsByfunId(typeof(StudioPorcelainView).Name)[StudioDataManager.Instance.PorcelainTheme - 1];
+            this.storyLevelCfgs = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(this._studioCfg.type, this._studioCfg.subType, this._studioCfg.id);
 
             com.GetChild("loaScore").asLoader.url = string.Format("ui://Studio/cqxf_zdqh_{0}", StudioDataManager.Instance.PorcelainTheme);
             list.numItems = this.storyLevelCfgs.Count;

+ 4 - 6
GameClient/Assets/Game/HotUpdate/Views/Studio/StudioPropertyView.cs

@@ -51,9 +51,8 @@ namespace GFGGame
             _croProperty.selectedIndex = _propertySelectIndex;
             StudioDataManager.Instance.PROPERTY_SELECT_INDEX = _propertySelectIndex;
 
-            this.studioCfg = studioCfgs[_propertySelectIndex];
-            this.studioData = StudioDataManager.Instance.GetStudioDataById(this.studioCfg.id);
-            this.storyLevelCfgs = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(this.studioCfg.type, this.studioCfg.subType, this.studioCfg.id);
+            this._studioCfg = studioCfgs[_propertySelectIndex];
+            this.storyLevelCfgs = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(this._studioCfg.type, this._studioCfg.subType, this._studioCfg.id);
 
             list.numItems = this.storyLevelCfgs.Count;
             list.ScrollToView(curIndex);
@@ -133,9 +132,8 @@ namespace GFGGame
                 return;
             }
             // _propertySelectIndex = index;
-            this.studioCfg = studioCfg;
-            this.studioData = StudioDataManager.Instance.GetStudioDataById(this.studioCfg.id);
-            this.storyLevelCfgs = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(this.studioCfg.type, this.studioCfg.subType, this.studioCfg.id);
+            this._studioCfg = studioCfg;
+            this.storyLevelCfgs = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(this._studioCfg.type, this._studioCfg.subType, this._studioCfg.id);
             list.numItems = this.storyLevelCfgs.Count;
             list.ScrollToView(curIndex);
             UpdateView();