瀏覽代碼

接入个人设置的部分协议

leiyasi 1 年之前
父節點
當前提交
9931d724ae

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

@@ -134,7 +134,6 @@ namespace GFGGame
             await RoleLimitSProxy.ReqUnitLimitInfos();
             await InstanceZonesSProxy.GetInstanceZonesInfos();
             await StorageSProxy.ReqGetClientValues();
-            await RoleInfoSProxy.ReqPersonalInfo();
             //功能协议数据不要放这里获取,放在AfterEnterGame函数中
 
             GameGlobal.lastLoginTime = StorageDataManager.Instance.GetStorageValue(ConstStorageId.LAST_LOGIN_TIME);

+ 8 - 4
GameClient/Assets/Game/HotUpdate/Data/RoleDataManager.cs

@@ -69,13 +69,11 @@ namespace GFGGame
             }
         }
 
-        private static int _saveDressUpBgToMainBg = 0;
         public static int saveDressUpBgToMainBg
         {
             get
             {
-                //return GameGlobal.myNumericComponent.GetAsInt(NumericType.IsOpenChangeGearBg);
-                return _saveDressUpBgToMainBg;
+                return GameGlobal.myNumericComponent.GetAsInt(NumericType.IsOpenChangeGearBg);
             }
         }
 
@@ -379,8 +377,14 @@ namespace GFGGame
             float endTime = GameGlobal.myNumericComponent.GetAsLong(NumericType.MonthCardGoldEndTime);
             if (endTime > TimeHelper.ServerNow() && saveDressUpBgToMainBg == 1)
             {
-                mainBgID = dressUpBgID;
+                SaveMainBgID(dressUpBgID);
             }
         }
+
+        public static void SaveMainBgID(int bgID)
+        {
+            mainBgID = bgID;
+            RoleInfoSProxy.ReqSaveMainBgID(bgID);
+        }
     }
 }

+ 2 - 3
GameClient/Assets/Game/HotUpdate/ServerProxy/FriendSProxy.cs

@@ -265,10 +265,10 @@ namespace GFGGame
 
 
         //请求搜索其他玩家
-        public static async ETTask<bool> ReqSearchRole(string roleName)
+        public static async ETTask<bool> ReqSearchRole(long roleID, string roleName)
         {
             S2C_SearchRole response = null;
-            response = (S2C_SearchRole)await MessageHelper.SendToServer(new C2S_SearchRole() { RoleName = roleName });
+            response = (S2C_SearchRole)await MessageHelper.SendToServer(new C2S_SearchRole() { RoleId = roleID, RoleName = roleName });
             if (response != null)
             {
                 if (response.Error == ErrorCode.ERR_Success)
@@ -276,7 +276,6 @@ namespace GFGGame
                     FriendDataManager.Instance.ClearSearchDatas();
                     for (int i = 0; i < response.RoleList.Count; i++)
                     {
-
                         OtherRoleInfoData roleInfo = new OtherRoleInfoData();
                         roleInfo.roleId = response.RoleList[i].RoleId;
                         roleInfo.roleName = response.RoleList[i].RoleName;

+ 42 - 6
GameClient/Assets/Game/HotUpdate/ServerProxy/RoleInfoSProxy.cs

@@ -19,18 +19,24 @@ namespace GFGGame
                     RoleDataManager.headBorderId = response.HeadBorderItemId;
                     RoleDataManager.photoDatas = response.PictureIds;
 
-                    //for(int i = 0; i < response.ItemList.Count; i++)
-                    //{
-                    //    RoleDataManager.badgeDatas.Add(response.ItemList[i]);
-                    //}
-                    //RoleDataManager.mainBgID = response.MyMainBgId;
-                    //RoleDataManager.achievementTaskCollect = (int)response.AchievementTaskCollect;
+                    RoleDataManager.badgeDatas.Clear();
+                    for (int i = 0; i < response.ItemList.Count; i++)
+                    {
+                        RoleDataManager.badgeDatas.Add(response.ItemList[i]);
+                    }
+
+                    if(response.MyMainBgId != 0)
+                    {
+                        RoleDataManager.mainBgID = response.MyMainBgId;
+                    }
+                    RoleDataManager.achievementTaskCollect = response.AchievementTaskCollect;
 
                     return true;
                 }
             }
             return false;
         }
+
         //请求其他玩家详细信息
         public static async ETTask<OtherRoleInfoDetailData> ReqOtherRoleDetailInfo(long otherRoleId)
         {
@@ -188,5 +194,35 @@ namespace GFGGame
             }
             return false;
         }
+
+        public static async ETTask<bool> ReqSaveMainBgID(int bgID)
+        {
+            S2C_UpMyMainBg response;
+            response = (S2C_UpMyMainBg)await MessageHelper.SendToServer(new C2S_UpMyMainBg() { MyMainBgId = bgID });
+            if (response != null)
+            {
+                if (response.Error == ErrorCode.ERR_Success)
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        public static async ETTask<bool> ReqSaveBadgeList(List<int> itemList)
+        {
+            S2C_UpWearBadges response;
+            response = (S2C_UpWearBadges)await MessageHelper.SendToServer(new C2S_UpWearBadges() { ItemList = itemList });
+            if (response != null)
+            {
+                if (response.Error == ErrorCode.ERR_Success)
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+
     }
 }

+ 12 - 7
GameClient/Assets/Game/HotUpdate/ServerProxy/SettingSProxy.cs

@@ -12,16 +12,21 @@ namespace GFGGame
         /// </summary>
         /// <param name="code"></param>
         /// <returns></returns>
-        public static async ETTask<bool> ReqGiftCodeInfo(string code)
+        public static async ETTask<bool> ReqGiftCodeCheck(string code)
         {
-            var response = (S2C_RedeemRewards)await MessageHelper.SendToServer(new C2S_RedeemRewards { ActivationCode = code });
-            if(!(response is { Error: ErrorCode.ERR_Success }))
+            S2C_RedeemRewards response;
+            response = (S2C_RedeemRewards)await MessageHelper.SendToServer(new C2S_RedeemRewards() { ActivationCode = code });
+            if (response != null)
             {
-                return false;
+                if (response.Error == ErrorCode.ERR_Success)
+                {
+                    // 奖励弹窗
+                    BonusController.TryShowBonusList(ItemUtil.CreateItemDataList(response.ItemList));
+                    EventAgent.DispatchEvent(ConstMessage.RED_CHANGE);
+                    return true;
+                }
             }
-            // 奖励弹窗
-            BonusController.TryShowBonusList(ItemUtil.CreateItemDataList(response.ItemList));
-            return true;
+            return false;
         }
     }
 }

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Views/Friend/FriendAddView.cs

@@ -125,7 +125,7 @@ namespace GFGGame
                 PromptController.Instance.ShowFloatTextPrompt("请输入至少两个字符");
                 return;
             }
-            bool result = await FriendSProxy.ReqSearchRole(_ui.m_txtSearch.text);
+            bool result = await FriendSProxy.ReqSearchRole(RoleDataManager.roleId, _ui.m_txtSearch.text);
             if (result)
             {
                 _ui.m_txtTips.text = "搜索结果";

+ 10 - 4
GameClient/Assets/Game/HotUpdate/Views/RoleInfo/BadgeChooseView.cs

@@ -3,6 +3,7 @@ using UnityEngine;
 using UI.RoleInfo;
 using FairyGUI;
 using System.Collections.Generic;
+using System.Threading.Tasks;
 
 namespace GFGGame
 {
@@ -68,8 +69,8 @@ namespace GFGGame
 
             UI_BadgeItem badgeItem = UI_BadgeItem.Proxy(gObject);
             badgeItem.m_name.text = _badgeList[index].name;
-            //badgeItem.m_iconImg.url = ResPathUtil.GetIconPath(_badgeList[index]);
-            badgeItem.m_iconImg.url = "ui://RoleInfo/linshj1_l";
+            badgeItem.m_iconImg.url = ResPathUtil.GetIconPath(_badgeList[index]);
+            //badgeItem.m_iconImg.url = "ui://RoleInfo/linshj1_l";
 
             if (RoleDataManager.HaveBadge(_badgeList[index].id))
             {
@@ -106,8 +107,7 @@ namespace GFGGame
         private void RemoveBadge()
         {
             RoleDataManager.badgeDatas.Remove(selectedID);
-
-            Hide();
+            UpdateBadgeList();
         }
 
         private void SetBadge(EventContext eventContext)
@@ -124,6 +124,12 @@ namespace GFGGame
                 int index = RoleDataManager.badgeDatas.FindIndex(x => x.Equals(selectedID));
                 RoleDataManager.badgeDatas[index] = id;
             }
+            UpdateBadgeList();
+        }
+
+        private async Task UpdateBadgeList()
+        {
+            await RoleInfoSProxy.ReqSaveBadgeList(RoleDataManager.badgeDatas);
 
             Hide();
         }

+ 4 - 1
GameClient/Assets/Game/HotUpdate/Views/RoleInfo/InputGiftCodeView.cs

@@ -4,6 +4,9 @@ using UI.RoleInfo;
 
 namespace GFGGame
 {
+    /// <summary>
+    /// 兑换码输入界面
+    /// </summary>
     public class InputGiftCodeView : BaseWindow
     {
         private UI_InputGiftCodeUI _ui;
@@ -40,7 +43,7 @@ namespace GFGGame
                 return;
             }
 
-            bool result = await SettingSProxy.ReqGiftCodeInfo(code);
+            bool result = await SettingSProxy.ReqGiftCodeCheck(code);
             if (result)
             {
                 _ui.m_inputCode.text = "";

+ 13 - 6
GameClient/Assets/Game/HotUpdate/Views/RoleInfo/MainBgChooseView.cs

@@ -50,7 +50,8 @@ namespace GFGGame
             base.OnShown();
             SetDefaultSelectedBg();
             InitMainUIPreview();
-            UpdateSaveDressUpBgToggleState();
+
+            UpdateSaveDressUpBgBtn();
         }
 
         protected override void OnHide()
@@ -129,7 +130,7 @@ namespace GFGGame
         private void OnClickBtnChange()
         {
             PromptController.Instance.ShowFloatTextPrompt("主界面背景已更换");
-            RoleDataManager.mainBgID = (int)_ui.m_bgList.GetChildAt(_ui.m_bgList.selectedIndex).data;
+            RoleDataManager.SaveMainBgID((int)_ui.m_bgList.GetChildAt(_ui.m_bgList.selectedIndex).data);
             Hide();
         }
 
@@ -193,6 +194,7 @@ namespace GFGGame
                         .SetRightButton(true, "确认", (object data) =>
                         {
                             RoleInfoSProxy.ReqSaveChangeGearSwitch(1);
+
                             ViewManager.Show<DressUpView>(null, true);
                             ViewManager.DeleteViewStackCountDown("MainUIView");
                         });
@@ -203,9 +205,8 @@ namespace GFGGame
                     .SetLeftButton(true)
                     .SetRightButton(true, "确认", (object data) =>
                     {
-                        RoleInfoSProxy.ReqSaveChangeGearSwitch(0);
-                        RoleDataManager.mainBgID = MainBackgroundCfgArray.Instance.dataArray[0].id;
-                        UpdateSaveDressUpBgToggleState();
+                        UpdateSaveDressUpBgToggleState(0);
+                        RoleDataManager.SaveMainBgID(MainBackgroundCfgArray.Instance.dataArray[0].id);
                     });
                 }
             }
@@ -221,7 +222,13 @@ namespace GFGGame
             ViewManager.Show<StoreView>(new object[] { ConstStoreTabId.STORE_MONTH_CARD, ConstStoreSubId.STORE_MONTH_GOLD_CARD });
         }
 
-        private void UpdateSaveDressUpBgToggleState()
+        private async Task UpdateSaveDressUpBgToggleState(int isOn)
+        {
+            await RoleInfoSProxy.ReqSaveChangeGearSwitch(isOn);
+            UpdateSaveDressUpBgBtn();
+        }
+
+        private void UpdateSaveDressUpBgBtn()
         {
             UI_ButtonToggle2 buttonToggle2 = UI_ButtonToggle2.Proxy(_ui.m_btnSaveDressUpBg.target);
             buttonToggle2.m_type.SetSelectedIndex(RoleDataManager.saveDressUpBgToMainBg);

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Views/RoleInfo/PersonalPhotoView.cs

@@ -117,7 +117,7 @@ namespace GFGGame
             bool result = await RoleInfoSProxy.ReqModifyShowPhoto(RoleDataManager.photoDatas);
             if (result)
             {
-                ViewManager.GoBackFrom(typeof(PersonalPhotoView).FullName);
+                Hide();
             }
         }
     }

+ 17 - 8
GameClient/Assets/Game/HotUpdate/Views/RoleInfo/RoleInfoView.cs

@@ -1,5 +1,6 @@
 using ET;
 using FairyGUI;
+using System.Threading.Tasks;
 using UI.CommonGame;
 using UI.RoleInfo;
 using UnityEngine;
@@ -76,13 +77,8 @@ namespace GFGGame
             }
 
             _ui.m_txtSlogan.text = RoleDataManager.slogan;
-            UpdateHead();
-            UpdatePhotoList();
-            UpdateRedDot();
-            UpdateCollectProgress();
-            UpdateInfo();
+            UpdateAllInfo();
 
-            _ui.m_badgeList.numItems = _ui.m_badgeList.numItems;
         }
 
         protected override void OnHide()
@@ -190,8 +186,8 @@ namespace GFGGame
                     gObject.data = badgeID;
                     buttonBadge.m_type.SetSelectedIndex(1);
                     // 加载徽章图片
-                    //buttonBadge.m_iconImg.url = ResPathUtil.GetIconPath(ItemCfgArray.Instance.GetCfg(badgeID));
-                    buttonBadge.m_iconImg.url = "ui://RoleInfo/linshj1";
+                    buttonBadge.m_iconImg.url = ResPathUtil.GetIconPath(ItemCfgArray.Instance.GetCfg(badgeID));
+                    //buttonBadge.m_iconImg.url = "ui://RoleInfo/linshj1";
                 }
             }
             else
@@ -285,5 +281,18 @@ namespace GFGGame
             _ui.m_leagueName.text = RoleInfoManager.Instance.GetLeagueName();
             _ui.m_txtRoleID.text = RoleInfoManager.Instance.GetRoleID().ToString();
         }
+
+        private async Task UpdateAllInfo()
+        {
+            await RoleInfoSProxy.ReqPersonalInfo();
+            UpdateHead();
+            UpdatePhotoList();
+            UpdateRedDot();
+            UpdateCollectProgress();
+            UpdateInfo();
+
+            _ui.m_badgeList.numItems = _ui.m_badgeList.numItems;
+
+        }
     }
 }