浏览代码

套装养护代码迁移

zhaoyang 3 年之前
父节点
当前提交
9f27b6a499

+ 1 - 1
GameClient/Assets/Game/CSShare

@@ -1 +1 @@
-Subproject commit 5f06b58befeba8a42714a75498ca484d4b1d7b38
+Subproject commit 41f2aadf00fcac50fcb917638b11f92485785cc6

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

@@ -164,7 +164,7 @@ namespace GFGGame
             //GameProxy.ReqGetStoryStarList();
 
             ItemHelper.GetItemAttributeInfos().Coroutine();
-            SuitFosterHelper.SendGetSuitInfos().Coroutine();
+            SuitFosterProxy.SendGetSuitInfos().Coroutine();
             StorySProxy.GetStoryInfos().Coroutine();
         }
 

+ 100 - 0
GameClient/Assets/Game/HotUpdate/ServerProxy/SuitFosterProxy.cs

@@ -0,0 +1,100 @@
+using System;
+using GFGGame;
+
+namespace ET
+{
+    public static class SuitFosterProxy
+    {
+        //获取所有养护套装信息
+        public static async ETTask<int> SendGetSuitInfos()
+        {
+            M2C_GetSuitInfos getSuitInfos = null;
+            Session session = null;
+            try
+            {
+                session = GameGlobal.zoneScene.GetComponent<SessionComponent>().Session;
+                getSuitInfos = (M2C_GetSuitInfos)await session.Call(new C2M_GetSuitInfos() { });
+            }
+            catch
+            {
+                return ErrorCode.ERR_NetWorkError;
+            }
+            if (getSuitInfos.Error != ErrorCode.ERR_Success)
+            {
+                return getSuitInfos.Error;
+            }
+
+            DressUpMenuSuitDataManager.SetSuitInfo(getSuitInfos.SuitInfos);
+
+            return ErrorCode.ERR_Success;
+        }
+
+        //养护套装
+        public static async ETTask<int> SendMaintainSuit(int suitId, int maintainStep)
+        {
+            M2C_MaintainSuit maintainSuit = null;
+            Session session = null;
+            try
+            {
+                session = GameGlobal.zoneScene.GetComponent<SessionComponent>().Session;
+                maintainSuit = (M2C_MaintainSuit)await session.Call(new C2M_MaintainSuit() { SuitId = suitId, MaintainStep = maintainStep });
+            }
+            catch
+            {
+                return ErrorCode.ERR_NetWorkError;
+            }
+            if (maintainSuit.Error != ErrorCode.ERR_Success)
+            {
+                return maintainSuit.Error;
+            }
+            SuitFosterDataManager.Instance.SetMaintainSuit(suitId, maintainSuit.MaintainStep);
+
+            return ErrorCode.ERR_Success;
+        }
+
+        //领取养护套装奖励
+        public static async ETTask<int> SendGetMaintainSuitBonus(int suitId, int maintainStep)
+        {
+            M2C_GetMaintainSuitBonus getMaintainSuitBonus = null;
+            Session session = null;
+            try
+            {
+                session = GameGlobal.zoneScene.GetComponent<SessionComponent>().Session;
+                getMaintainSuitBonus = (M2C_GetMaintainSuitBonus)await session.Call(new C2M_GetMaintainSuitBonus() { SuitId = suitId, MaintainStep = maintainStep });
+            }
+            catch
+            {
+                return ErrorCode.ERR_NetWorkError;
+            }
+            if (getMaintainSuitBonus.Error != ErrorCode.ERR_Success)
+            {
+                return getMaintainSuitBonus.Error;
+            }
+            SuitFosterDataManager.Instance.SetMaintainBonusSteps(suitId, getMaintainSuitBonus.MaintainStep);
+
+            return ErrorCode.ERR_Success;
+        }
+
+        //换新套装
+        public static async ETTask<int> SendMakeNewSuit(int suitId)
+        {
+            M2C_MakeNewSuit makeNewSuit = null;
+            Session session = null;
+            try
+            {
+                session = GameGlobal.zoneScene.GetComponent<SessionComponent>().Session;
+                makeNewSuit = (M2C_MakeNewSuit)await session.Call(new C2M_MakeNewSuit() { SuitId = suitId });
+            }
+            catch
+            {
+                return ErrorCode.ERR_NetWorkError;
+            }
+            if (makeNewSuit.Error != ErrorCode.ERR_Success)
+            {
+                return makeNewSuit.Error;
+            }
+            SuitFosterDataManager.Instance.SetMakeNewSuit(suitId, makeNewSuit.MakeNewState);
+            return ErrorCode.ERR_Success;
+        }
+    }
+}

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

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

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Views/ClothingFoster/SuitFosterView.cs

@@ -102,7 +102,7 @@ namespace GFGGame
                 PromptController.Instance.ShowFloatTextPrompt("材料不足");
                 return;
             }
-            SuitFosterHelper.SendMaintainSuit(_suitId, _index + 1).Coroutine();
+            SuitFosterProxy.SendMaintainSuit(_suitId, _index + 1).Coroutine();
             this.Hide();
         }
     }

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Views/ClothingFoster/SuitListView.cs

@@ -51,7 +51,7 @@ namespace GFGGame
             _ui.m_btnHaveGot.selected = true;
             _ui.m_btnNotGet.selected = true;
 
-            SuitFosterHelper.SendGetSuitInfos().Coroutine();
+            SuitFosterProxy.SendGetSuitInfos().Coroutine();
             UpdateListSuit();
             EventAgent.AddEventListener(ConstMessage.ITEM_CHANGED, UpdateSuitStatus);
         }

+ 2 - 2
GameClient/Assets/Game/HotUpdate/Views/ClothingFoster/SuitView.cs

@@ -233,7 +233,7 @@ namespace GFGGame
             }
             else
             {
-                SuitFosterHelper.SendGetMaintainSuitBonus(_suitId, index + 1).Coroutine();
+                SuitFosterProxy.SendGetMaintainSuitBonus(_suitId, index + 1).Coroutine();
             }
         }
         private void OnClickBtnPropertyShow()
@@ -355,7 +355,7 @@ namespace GFGGame
                 PromptController.Instance.ShowFloatTextPrompt(string.Format("完成{0}开启换新", SuitFosterDataManager.Instance.stepNames[cfg.renewOpenLv - 1]));
                 return;
             }
-            SuitFosterHelper.SendMakeNewSuit(_suitId).Coroutine();
+            SuitFosterProxy.SendMakeNewSuit(_suitId).Coroutine();
         }
         private void OnListenerRenew()
         {

+ 8 - 8
GameClient/Assets/Game/HotUpdate/Views/ViewManager.cs

@@ -52,10 +52,10 @@ namespace GFGGame
         public static void Show(string viewName, object viewData = null, object[] goBackParams = null, bool hideOthers = false, bool resetGobackParams = false)
         {
             string[] names = viewName.Split('.');
-            if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(names[names.Length - 1]))
-            {
-                return;
-            }
+            // if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(names[names.Length - 1]))
+            // {
+            //     return;
+            // }
             if (hideOthers)
             {
                 HideAllView(viewName);
@@ -118,10 +118,10 @@ namespace GFGGame
         {
             string viewName = typeof(T).FullName;
             string[] names = viewName.Split('.');
-            if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(names[names.Length - 1]))
-            {
-                return false;
-            }
+            // if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(names[names.Length - 1]))
+            // {
+            //     return false;
+            // }
             if (hideOthers)
             {
                 HideAllView(viewName);