فهرست منبع

登录添加删除中的账号提示

guodong 1 سال پیش
والد
کامیت
3c4a5c7fb6

+ 38 - 16
GameClient/Assets/Game/HotUpdate/Controller/LoginController.cs

@@ -12,10 +12,10 @@ namespace GFGGame
             ViewManager.Show<LoginView>();
         }
 
-        public static async ET.ETTask LoginTest(string account)
+        public static async ET.ETTask LoginTest(string account, bool cancelDelete = false)
         {
             ViewManager.Show<ModalStatusView>("登录中...");
-            int errorCode = await ET.LoginHelper.LoginTest(GameGlobal.zoneScene, GameConfig.LoginAddress, account);
+            (int errorCode, long deleteTime) = await ET.LoginHelper.LoginTest(GameGlobal.zoneScene, GameConfig.LoginAddress, account, cancelDelete);
 
             if (errorCode == ET.ErrorCode.ERR_Success)
             {
@@ -42,15 +42,15 @@ namespace GFGGame
             }
             else
             {
-                OnLoginFail(errorCode, account);
+                OnLoginFail(errorCode, account, deleteTime, null, false);
             }
         }
 
 
-        public static async ET.ETTask Login(string account, string password, bool isMD5 = false)
+        public static async ET.ETTask Login(string account, string password, bool isMD5 = false, bool cancelDelete = false)
         {
             ViewManager.Show<ModalStatusView>("登录中...");
-            int errorCode = await ET.LoginHelper.Login(GameGlobal.zoneScene, GameConfig.LoginAddress, account, password, isMD5);
+            (int errorCode, long deleteTime) = await ET.LoginHelper.Login(GameGlobal.zoneScene, GameConfig.LoginAddress, account, password, isMD5, cancelDelete);
 
             if (errorCode == ET.ErrorCode.ERR_Success)
             {
@@ -82,7 +82,7 @@ namespace GFGGame
             }
             else
             {
-                OnLoginFail(errorCode, account);
+                OnLoginFail(errorCode, account, deleteTime, password, isMD5);
             }
         }
 
@@ -101,6 +101,38 @@ namespace GFGGame
 
             ViewManager.Hide<ModalStatusView>();
         }
+        private static void OnLoginFail(int errorCode, string account, long deleteTime, string password, bool isMD5)
+        {
+            ViewManager.Hide<ModalStatusView>();
+            if(errorCode == ErrorCode.ERR_LoginIsLimit && deleteTime > 0)
+            {
+                //删除账号提示
+                AlertSystem.Show("账号注销处理中,若确定登录将取消账号注销,是否确定登录游戏?")
+                    .SetLeftButton(true, "取消", (o)=>
+                    {
+                        GameController.QuitToLoginView(true);
+                        EventAgent.DispatchEvent(ConstMessage.LOGIN_FAIL, account);
+                    })
+                    .SetRightButton(true, "确定", (o)=>
+                    {
+                        if(string.IsNullOrEmpty(password))
+                        {
+                            LoginTest(account, true).Coroutine();
+                        }
+                        else
+                        {
+                            Login(account, password, isMD5, true).Coroutine();
+                        }
+                    });
+                return;
+            }
+            if (ErrorCodeController.Handler(errorCode))
+            {
+                GameController.QuitToLoginView(true);
+            }
+            EventAgent.DispatchEvent(ConstMessage.LOGIN_FAIL, account);
+        }
+
         private static async ETTask ReqNoticeInfo()
         {
             int result = await LoginHelper.ReqGetLatestNotice();
@@ -124,16 +156,6 @@ namespace GFGGame
             return;
         }
 
-        private static void OnLoginFail(int errorCode, string account)
-        {
-            ViewManager.Hide<ModalStatusView>();
-            if (ErrorCodeController.Handler(errorCode))
-            {
-                GameController.QuitToLoginView(true);
-            }
-            EventAgent.DispatchEvent(ConstMessage.LOGIN_FAIL, account);
-        }
-
         public static async ETTask Register(string account, string password, string name, string identityNum, string code)
         {
             ViewManager.Show<ModalStatusView>("注册中...");

+ 12 - 10
GameClient/Assets/Game/HotUpdate/ETCodes/Hotfix/App/Login/LoginHelper.cs

@@ -5,7 +5,7 @@ namespace ET
 {
     public static class LoginHelper
     {
-        public static async ETTask<int> LoginTest(Scene zoneScene, string address, string account)
+        public static async ETTask<(int, long)> LoginTest(Scene zoneScene, string address, string account, bool cancelDelete)
         {
             A2C_LoginAccount a2CLoginAccount = null;
             Session accountSession = null;
@@ -18,27 +18,28 @@ namespace ET
                     Account = account,
                     Version = GameConst.SERVER_VERSION,
                     PlatformId = LauncherConfig.platformId,
-                    ChannelId = LauncherConfig.ChannelId
+                    ChannelId = LauncherConfig.ChannelId,
+                    CancelDelete = cancelDelete
                 });
             }
             catch (Exception e)
             {
                 accountSession?.Dispose();
                 Log.Debug(e.ToString());
-                return ErrorCode.ERR_NetWorkError;
+                return (ErrorCode.ERR_NetWorkError, 0);
             }
 
             if (a2CLoginAccount.Error != ErrorCode.ERR_Success)
             {
                 accountSession?.Dispose();
-                return a2CLoginAccount.Error;
+                return (a2CLoginAccount.Error, a2CLoginAccount.DeleteTime);
             }
             OnLoginSuccess(zoneScene, a2CLoginAccount, accountSession, account);
 
-            return ErrorCode.ERR_Success;
+            return (ErrorCode.ERR_Success, 0);
         }
 
-        public static async ETTask<int> Login(Scene zoneScene, string address, string account, string password, bool isMD5)
+        public static async ETTask<(int, long)> Login(Scene zoneScene, string address, string account, string password, bool isMD5, bool cancelDelete)
         {
             A2C_LoginAccount a2CLoginAccount = null;
             Session accountSession = null;
@@ -57,24 +58,25 @@ namespace ET
                     Password = passwordMD5,
                     Version = GameConst.SERVER_VERSION,
                     PlatformId = LauncherConfig.platformId,
-                    ChannelId = LauncherConfig.ChannelId
+                    ChannelId = LauncherConfig.ChannelId,
+                    CancelDelete = cancelDelete
                 });
             }
             catch (Exception e)
             {
                 accountSession?.Dispose();
                 Log.Debug(e.ToString());
-                return ErrorCode.ERR_NetWorkError;
+                return (ErrorCode.ERR_NetWorkError, 0);
             }
 
             if (a2CLoginAccount.Error != ErrorCode.ERR_Success)
             {
                 accountSession?.Dispose();
-                return a2CLoginAccount.Error;
+                return (a2CLoginAccount.Error, a2CLoginAccount.DeleteTime);
             }
             OnLoginSuccess(zoneScene, a2CLoginAccount, accountSession, account);
 
-            return ErrorCode.ERR_Success;
+            return (ErrorCode.ERR_Success, 0);
         }
 
         public static void OnLoginSuccess(Scene zoneScene, A2C_LoginAccount a2CLoginAccount, Session accountSession, string account)

+ 3 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/DeleteAccount/UI_DeleteAccountUI.cs

@@ -23,6 +23,7 @@ namespace UI.DeleteAccount
         public GTextField m_txtAccount;
         public GTextField m_txtLvl;
         public GGroup m_groupSure;
+        public GTextField m_txtSuccess;
         public UI_Button19 m_btnQuit;
         public GGroup m_groupResult;
         public UI_ComTextProtocal m_txtComp_2;
@@ -93,6 +94,7 @@ namespace UI.DeleteAccount
             m_txtAccount = (GTextField)comp.GetChild("txtAccount");
             m_txtLvl = (GTextField)comp.GetChild("txtLvl");
             m_groupSure = (GGroup)comp.GetChild("groupSure");
+            m_txtSuccess = (GTextField)comp.GetChild("txtSuccess");
             m_btnQuit = (UI_Button19)UI_Button19.Create(comp.GetChild("btnQuit"));
             m_groupResult = (GGroup)comp.GetChild("groupResult");
             m_txtComp_2 = (UI_ComTextProtocal)UI_ComTextProtocal.Create(comp.GetChild("txtComp"));
@@ -123,6 +125,7 @@ namespace UI.DeleteAccount
             m_txtAccount = null;
             m_txtLvl = null;
             m_groupSure = null;
+            m_txtSuccess = null;
             m_btnQuit.Dispose();
             m_btnQuit = null;
             m_groupResult = null;

+ 1 - 1
GameClient/Assets/Game/HotUpdate/GameConfig.cs

@@ -35,7 +35,7 @@ namespace GFGGame
             var result = JsonMapper.ToObject<Result>(json);
             LoginAddress = result.loginApiUrl;
             // LoginAddress = "http://login.gfg.com:10005";
-            //LoginAddress = "10.108.64.100:10005";//测试地址
+            LoginAddress = "10.108.64.127:10005";//测试地址
             showGM = int.Parse(result.showGM);
             if(!string.IsNullOrEmpty(result.openTime))
             {

+ 61 - 0
GameClient/Assets/Game/HotUpdate/ServerProxy/AccountSProxy.cs

@@ -0,0 +1,61 @@
+using ET;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace GFGGame
+{
+    public static class AccountSProxy
+    {
+        public static async ETTask<bool> ReqDeleteAccount(string name, string identityNum)
+        {
+            A2C_ReqDeleteAccount response = null;
+            bool notLogin = false;
+            Session accountSession = GameGlobal.zoneScene.GetComponent<SessionComponent>().AccountSession;
+            if (accountSession == null || accountSession.IsDisposed)
+            {
+                notLogin = true;
+                accountSession = GameGlobal.zoneScene.GetComponent<NetKcpComponent>().Create(NetworkHelper.ToIPEndPoint(GameConfig.LoginAddress));
+            }
+            try
+            {
+                AccountInfoComponent accountInfoComponent = GameGlobal.zoneScene.GetComponent<AccountInfoComponent>();
+                response = (A2C_ReqDeleteAccount)await accountSession?.Call(new C2A_ReqDeleteAccount()
+                {
+                    Account = accountInfoComponent.Account,
+                    Name = name,
+                    IdentityNum = identityNum,
+                    PlatformId = LauncherConfig.platformId,
+                    ChannelId = LauncherConfig.ChannelId
+                });
+            }
+            catch(Exception e)
+            {
+                Log.Debug(e.ToString());
+                ErrorCodeController.Handler(ErrorCode.ERR_NetWorkError);
+                if (notLogin)
+                {
+                    accountSession?.Dispose();
+                }
+                return false;
+            }
+            if(response.Error != ErrorCode.ERR_Success)
+            {
+                ErrorCodeController.Handler(response.Error);
+
+                if (notLogin)
+                {
+                    accountSession?.Dispose();
+                }
+                return false;
+            }
+            if (notLogin)
+            {
+                accountSession?.Dispose();
+            }
+            return true;
+        }
+    }
+}

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

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

+ 1 - 0
GameClient/Assets/Game/HotUpdate/ServerProxy/MessageHelper.cs

@@ -27,5 +27,6 @@ namespace GFGGame
                 return null;
             }
         }
+
     }
 }

+ 12 - 0
GameClient/Assets/Game/HotUpdate/Utils/TimeUtil.cs

@@ -94,6 +94,18 @@ namespace GFGGame
         }
 
         /// <summary>
+        /// 将时间戳转换成yyyy-mm-dd hh-mm-ss格式
+        /// </summary>
+        /// <param name="timeMsec">毫秒</param>
+        public static string FormattingTimeMinute(long timeMsec, char split = '-')
+        {
+            DateTime date = TimeInfo.Instance.ToDateTime(timeMsec);
+            string str = date.ToString(string.Format("yyyy{0}MM{0}dd HH:mm", split));
+
+            return str;
+        }
+
+        /// <summary>
         /// 将时间戳转换成yyyy/MM/dd格式
         /// </summary>
         /// <param name="timeMsec">毫秒</param>

+ 15 - 3
GameClient/Assets/Game/HotUpdate/Views/DeleteAccount/DeleteAccountView.cs

@@ -2,6 +2,7 @@
 using ET;
 using UI.DeleteAccount;
 using UnityEngine;
+using System;
 
 namespace GFGGame
 {
@@ -122,10 +123,10 @@ namespace GFGGame
 
         private void OnClickBtnQuit(EventContext context)
         {
-            Application.Quit();
+            GameController.QuitToLoginView(true);
         }
 
-        private void OnClickBtnSure(EventContext context)
+        private async void OnClickBtnSure(EventContext context)
         {
             string realName = _ui.m_inputName.text;
             string idNumberStr = _ui.m_inputIDNumber.text;
@@ -139,7 +140,12 @@ namespace GFGGame
                 PromptController.Instance.ShowFloatTextPrompt("请输入身份证号");
                 return;
             }
-            _ui.m_c1.selectedIndex = IndexResult;
+            bool result = await AccountSProxy.ReqDeleteAccount(realName, idNumberStr);
+            if(result)
+            {
+                _ui.m_c1.selectedIndex = IndexResult;
+                UpdateSuccessTab();
+            }
         }
 
         private void OnClickBtnNext2(EventContext context)
@@ -162,5 +168,11 @@ namespace GFGGame
             _ui.m_c1.selectedIndex = IndexText2;
         }
 
+        private void UpdateSuccessTab()
+        {
+            long targetTime = TimeUtil.AddDays(15);
+            var targetTimeStr = TimeUtil.FormattingTimeMinute(targetTime);
+            _ui.m_txtSuccess.SetVar("time", targetTimeStr).FlushVars();
+        }
     }
 }

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

@@ -49,6 +49,11 @@ namespace GFGGame
             _ui.m_btnAddNum.onClick.Add(OnClickBtnAddCount);
             _ui.m_btnSetNum.onClick.Add(OnClickBtnSetCount);
             _ui.m_ComBtn.m_btnTeaPartyStart.onClick.Add(OnClickBtnTeaPartyStart);
+
+
+            var dataArray = RoleLevelCfgArray.Instance.dataArray;
+            RoleLevelCfg maxLvlCfg = dataArray[dataArray.Length - 1];
+            _ui.m_ComBtn.m_txtRoleLv.text = maxLvlCfg.id + "";
         }
 
         protected override void OnShown()
@@ -248,7 +253,7 @@ namespace GFGGame
             }
             OnClickBtnGetAllDressUpItem();
             OnClickBtnGetAllCardItem();
-            _ui.m_ComBtn.m_txtRoleLv.text = "99";
+
             OnClickBtnSetLv();
             InitChapterText();
             OnClickBtnSetChapter();

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

@@ -62,7 +62,7 @@ namespace GFGGame
             _ui.m_childrenAgree.onClick.Add(OnChildrenAgreeClick);
             _ui.m_txtDeleteAccount.onClick.Add(OnClickTxtDeleteAccount);
 
-            _ui.m_groupAccount.visible = false;
+            _ui.m_groupAccount.visible = GameConfig.tsStatus > 0;
         }
 
         protected override void OnShown()

BIN
GameClient/Assets/ResIn/UI/DeleteAccount/DeleteAccount_fui.bytes