소스 검색

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

# Conflicts:
#	GameClient/Assets/Game/CSShare
#	GameClient/Assets/Game/HotUpdate/Controller/GameController.cs
zhaoyang 3 년 전
부모
커밋
164d60d937
20개의 변경된 파일333개의 추가작업 그리고 233개의 파일을 삭제
  1. 1 1
      GameClient/Assets/Game/CSShare
  2. 51 0
      GameClient/Assets/Game/HotUpdate/Controller/ErrorCodeController.cs
  3. 11 0
      GameClient/Assets/Game/HotUpdate/Controller/ErrorCodeController.cs.meta
  4. 32 118
      GameClient/Assets/Game/HotUpdate/Controller/GameController.cs
  5. 162 0
      GameClient/Assets/Game/HotUpdate/Controller/LoginController.cs
  6. 11 0
      GameClient/Assets/Game/HotUpdate/Controller/LoginController.cs.meta
  7. 2 2
      GameClient/Assets/Game/HotUpdate/Controller/PromptController.cs
  8. 1 1
      GameClient/Assets/Game/HotUpdate/Data/Handler/RoleDataHandler.cs
  9. 1 0
      GameClient/Assets/Game/HotUpdate/ETView/AppStart_Init.cs
  10. 8 0
      GameClient/Assets/Game/HotUpdate/ETView/Numeric.meta
  11. 8 0
      GameClient/Assets/Game/HotUpdate/ETView/Numeric/Event.meta
  12. 18 0
      GameClient/Assets/Game/HotUpdate/ETView/Numeric/Event/NumericWatcher_RefreshMainUI.cs
  13. 11 0
      GameClient/Assets/Game/HotUpdate/ETView/Numeric/Event/NumericWatcher_RefreshMainUI.cs.meta
  14. 0 1
      GameClient/Assets/Game/HotUpdate/GameGlobal.cs
  15. 7 14
      GameClient/Assets/Game/HotUpdate/Net/Proxy/GameProxy.cs
  16. 1 73
      GameClient/Assets/Game/HotUpdate/Net/Proxy/LoginProxy.cs
  17. 1 1
      GameClient/Assets/Game/HotUpdate/Views/CreateRole/CreateRoleView.cs
  18. 1 1
      GameClient/Assets/Game/HotUpdate/Views/Login/LoginInputView.cs
  19. 5 20
      GameClient/Assets/Game/HotUpdate/Views/Login/LoginView.cs
  20. 1 1
      GameClient/Assets/Game/HotUpdate/Views/Login/RegisterView.cs

+ 1 - 1
GameClient/Assets/Game/CSShare

@@ -1 +1 @@
-Subproject commit 76b2d0fc6359d89630eb94bda3397997db4ab486
+Subproject commit ad0257407375208cc914e34f031fdb710a7192d9

+ 51 - 0
GameClient/Assets/Game/HotUpdate/Controller/ErrorCodeController.cs

@@ -0,0 +1,51 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using UnityEngine;
+
+namespace GFGGame
+{
+    public class ErrorCodeController
+    {
+        public static bool Handler(int errorCode)
+        {
+            if (errorCode == ET.ErrorCode.ERR_Success)
+            {
+                return false;
+            }
+            else if (errorCode == ET.ErrorCode.ERR_NetWorkError)
+            {
+                Alert.Show("连接服务器失败:\n请检查网络和服务器状态")
+                .SetRightButton(true, "知道啦", (object data) =>
+                {
+                    Application.Quit();
+                });
+            }
+            else if (errorCode == ET.ErrorCode.ERR_ClientVersionError)
+            {
+                Alert.Show("版本已更新,请联系研发获取最新版本")
+                    .SetLeftButton(true, "知道了", (data) => {
+                        Application.Quit();
+                    });
+            }
+            else if (errorCode == ET.ErrorCode.ERR_AntiAddiction)
+            {
+                string promptStr = "您属于未成年人,已被纳入防沉迷系统。每日22时至次日8时,本游戏将无法为未成年人用户提供游戏服务。";
+                Alert.Show(promptStr)
+                    .SetRightButton(true, "知道啦", (object data) =>
+                    {
+
+                    });
+            }
+            else
+            {
+                PromptController.Instance.ShowFloatTextPrompt("errorCode " + errorCode.ToString());
+                ET.Log.Error("errorCode" + errorCode.ToString());
+                return true;
+            }
+            return false;
+        }
+    }
+}

+ 11 - 0
GameClient/Assets/Game/HotUpdate/Controller/ErrorCodeController.cs.meta

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

+ 32 - 118
GameClient/Assets/Game/HotUpdate/Controller/GameController.cs

@@ -8,12 +8,11 @@ namespace GFGGame
 {
     public class GameController
     {
-        public static void Start()
+
+        public static async ET.ETTask Start()
         {
-            LoginProxy.SayHi((LoginResult result) =>
-            {
-                CheckShowLoginView();
-            });
+            await LoginController.CheckVersion();
+            CheckShowLoginView();
         }
 
         private static void CheckShowLoginView()
@@ -34,7 +33,7 @@ namespace GFGGame
                 {
                     if (doLogin)
                     {
-                        LoginProxy.LoginAsVisitor();
+                        //LoginProxy.LoginAsVisitor();
                     }
                     return true;
                 }
@@ -45,7 +44,7 @@ namespace GFGGame
                 {
                     if (doLogin)
                     {
-                        LoginProxy.Login(account, password);
+                        LoginController.Login(account, password, true).Coroutine();
                     }
                     return true;
                 }
@@ -53,52 +52,6 @@ namespace GFGGame
             return false;
         }
 
-        public static void OnLoginSuccess(LoginResult result)
-        {
-            ViewManager.Hide<LoginInputView>();
-            ViewManager.Hide<RegisterView>();
-            if (GameGlobal.isOfflineVisitor)
-            {
-                GameProxy.ReqRoleInfo(GameGlobal.userId);
-            }
-            else
-            {
-                User user = result.user;
-                GameGlobal.userId = user.id;
-                GameGlobal.userAge = user.age;
-                if (GameGlobal.isVisitor)
-                {
-                    PlayerPrefs.SetFloat(GameConst.VISITOR_ID_KEY, GameGlobal.userId);
-                }
-                else
-                {
-                    PlayerPrefs.SetString(GameConst.ACCOUNT_LAST_LOGIN_KEY, user.account);
-                    PlayerPrefs.SetString(GameConst.PASSWORD_LAST_LOGIN_KEY, user.password);
-                }
-                GameController.CheckSpecialAccount(user.account);
-                LocalCache.SetBool(GameConst.LAST_LOGIN_IS_VISITOR_KEY, GameGlobal.isVisitor);
-                PlayerPrefs.Save();
-                GameProxy.ReqRoleInfo(GameGlobal.userId);
-            }
-        }
-
-        public static void OnLoginFail(LoginResult result)
-        {
-            if (result.code == 107)
-            {
-                string promptStr = "您属于未成年人,已被纳入防沉迷系统。每日22时至次日8时,本游戏将无法为未成年人用户提供游戏服务。";
-                Alert.Show(promptStr)
-                    .SetRightButton(true, "知道啦", (object data) =>
-                    {
-
-                    });
-            }
-            else
-            {
-                ViewManager.Show<LoginInputView>();
-            }
-        }
-
         public static void CheckSpecialAccount(string account)
         {
             GameGlobal.antiAddiction = !(account.IndexOf("sygfg") == 0);
@@ -107,81 +60,44 @@ namespace GFGGame
         public static void ShowCreateRole()
         {
             ViewManager.Show(ViewName.CREATE_ROLE_VIEW);
-            Alert.Show("是否跳过引导?如果您是第一次体验,建议不要跳过引导!")
-                .SetLeftButton(true, "不用")
-                .SetRightButton(true, "跳过", (obj) =>
-                {
-                    GameGlobal.skipGuide = true;
-                });
         }
 
-        public static void PreEnterGame(GameResult result)
+        public static void PreEnterGame()
         {
-            RoleInfo roleInfo = null;
+            //RoleInfo roleInfo = null;
             GetSuitItemController.enable = false;
             DressUpMenuSuitDataManager.InitData();
             DressUpMenuItemDataManager.InitData();
-            if (!GameGlobal.isOfflineVisitor)
-            {
-                roleInfo = result.roleInfo;
-                bool rerult = AntiAddictionController.CheckAntiAddiction(roleInfo.onlineTimeSecs, roleInfo.onlineDurationSecs, roleInfo.onlineDurationSecsDay);
-                if (rerult)
-                {
-                    return;
-                }
-                ServerDataManager.SetServerTime(roleInfo.serverTime);
-                RoleDataManager.InitServerData(roleInfo);
-                ItemDataManager.InitServerData(result.roleItemList);
-                CustomSuitDataManager.InitServerData(roleInfo.suitIndex, result.roleSuitList);
-                StoryDataManager.InitServerData(roleInfo);
-                GuideDataManager.InitServerData(result.roleGuideList);
-                DressUpMenuSuitDataManager.InitServerData(result.systemSuitList);
-                CardDataManager.InitServerData(result.roleCardList);
-                SkillDataManager.Instance.InitServerData(result.roleSkillList);
-                SkillDataManager.Instance.SetDicPassivitySkillCfg();
-            }
-            else
-            {
-                RoleDataManager.InitServerData(null);
-                ItemDataManager.InitServerData(null);
-                CustomSuitDataManager.InitServerData(0, null);
-                StoryDataManager.InitServerData(null);
-                GuideDataManager.InitServerData(null);
-                DressUpMenuSuitDataManager.InitServerData(null);
-                CardDataManager.InitServerData(null);
-                SkillDataManager.Instance.InitServerData(null);
-                SkillDataManager.Instance.SetDicPassivitySkillCfg();
-
-            }
+            //roleInfo = result.roleInfo;
+            //bool rerult = AntiAddictionController.CheckAntiAddiction(roleInfo.onlineTimeSecs, roleInfo.onlineDurationSecs, roleInfo.onlineDurationSecsDay);
+            //if (rerult)
+            //{
+            //    return;
+            //}
+            //ServerDataManager.SetServerTime(roleInfo.serverTime);
+            //RoleDataManager.InitServerData(roleInfo);
+            //ItemDataManager.InitServerData(result.roleItemList);
+            //CustomSuitDataManager.InitServerData(roleInfo.suitIndex, result.roleSuitList);
+            //StoryDataManager.InitServerData(roleInfo);
+            //GuideDataManager.InitServerData(result.roleGuideList);
+            //DressUpMenuSuitDataManager.InitServerData(result.systemSuitList);
+            //CardDataManager.InitServerData(result.roleCardList);
             GetSuitItemController.enable = true;
-            RoleDataHandler.StartUpdate();
+            //RoleDataHandler.StartUpdate();
 
             GFGUIPackage.AddPackage(ResPathUtil.GetUIPackagePath("CommonGame"));
             GFGUIPackage.AddPackage(ResPathUtil.GetUIPackagePath("Main"));
 
-            if (GameGlobal.isOfflineVisitor)
-            {
-                Alert.Show("离线体验可以选择跳过引导并获取所有衣服。")
-                    .SetLeftButton(true, "跳过引导", (object data) =>
+            Alert.Show("是否跳过引导?如果您是第一次体验,建议不要跳过引导!")
+                    .SetLeftButton(true, "不用", (obj) =>
                     {
-                        GameGlobal.skipGuide = true;
-                        GMController.GetAllDressUpItem();
                         EnterGame();
                     })
-                    .SetRightButton(true, "体验引导", (object data) =>
+                    .SetRightButton(true, "跳过", (obj) =>
                     {
-                        GameGlobal.skipGuide = false;
+                        GameGlobal.skipGuide = true;
                         EnterGame();
                     });
-            }
-            else
-            {
-                if (RoleDataManager.lvl >= 50)
-                {
-                    GameGlobal.skipGuide = true;
-                }
-                EnterGame();
-            }
         }
 
         public static void QuitToLoginView(bool logout)
@@ -194,9 +110,7 @@ namespace GFGGame
             GameGlobal.skipGuide = false;
             RoleDataHandler.StopUpdate();
             CardDataManager.Clear();
-            DecomposeDataManager.Instance.Clear();
             PhotographDataManager.Instance.Clear();
-            SkillDataManager.Instance.Clear();
             if (logout)
             {
                 Logout();
@@ -231,10 +145,10 @@ namespace GFGGame
             else
             {
                 StoryDataManager.currentChapter = 1;
-                if (GameGlobal.isFirstEntry == true)
+                if (!StoryDataManager.CheckLevelPass(1, 1))
                 {
-                    // ViewManager.Show(ViewName.STORY_CHAPTER_VIEW, StoryDataManager.currentChapter, new object[] { ViewName.STORY_CHAPTER_LIST_VIEW, });
-                    StoryController.ShowPriorStoryDialog();
+                    ViewManager.Show(ViewName.STORY_CHAPTER_VIEW, StoryDataManager.currentChapter, new object[] { ViewName.STORY_CHAPTER_LIST_VIEW,  });
+                    StoryController.ShowLevelView(StoryDataManager.currentChapter, 1);
                 }
                 else
                 {
@@ -246,8 +160,8 @@ namespace GFGGame
 
         private static void AfterEnterGame()
         {
-            GameProxy.ReqGetStoryScoreList();
-            GameProxy.ReqGetStoryStarList();
+            //GameProxy.ReqGetStoryScoreList();
+            //GameProxy.ReqGetStoryStarList();
         }
 
         public static void PrepareUpdateTreasure()

+ 162 - 0
GameClient/Assets/Game/HotUpdate/Controller/LoginController.cs

@@ -0,0 +1,162 @@
+using ET;
+using UnityEngine;
+
+namespace GFGGame
+{
+    public class LoginController
+    {
+
+        public static async ET.ETTask CheckVersion()
+        {
+            ViewManager.Show<ModalStatusView>("连接中...");
+            int errorCode = 0;
+            errorCode = await ET.LoginHelper.CheckVersion(GameGlobal.zoneScene, ET.ConstValue.LoginAddress, GameConst.SERVER_VERSION);
+            ViewManager.Hide<ModalStatusView>();
+            if (errorCode != ET.ErrorCode.ERR_Success)
+            {
+                ErrorCodeController.Handler(errorCode);
+                await ETTask.Create();
+            }
+        }
+
+        public static async ET.ETTask Login(string account, string password, bool isMD5 = false)
+        {
+            ViewManager.Show<ModalStatusView>("登录中...");
+            int errorCode = await ET.LoginHelper.Login(GameGlobal.zoneScene, ET.ConstValue.LoginAddress, account, password, isMD5);
+            ViewManager.Hide<ModalStatusView>();
+            if (errorCode == ET.ErrorCode.ERR_Success)
+            {
+                GameGlobal.isVisitor = false;
+                ViewManager.Hide<LoginInputView>();
+                ViewManager.Hide<RegisterView>();
+                AccountInfoComponent accountInfoComponent = GameGlobal.zoneScene.GetComponent<AccountInfoComponent>();
+                GameGlobal.userId = accountInfoComponent.AccountId;
+                GameGlobal.userAge = accountInfoComponent.Age;
+                if (GameGlobal.isVisitor)
+                {
+                    //PlayerPrefs.SetFloat(GameConst.VISITOR_ID_KEY, GameGlobal.userId);
+                }
+                else
+                {
+                    var passwordMD5 = password;
+                    //密码禁止明文传输
+                    if (!isMD5)
+                    {
+                        passwordMD5 = MD5Helper.stringMD5(password);
+                    }
+                    PlayerPrefs.SetString(GameConst.ACCOUNT_LAST_LOGIN_KEY, account);
+                    PlayerPrefs.SetString(GameConst.PASSWORD_LAST_LOGIN_KEY, passwordMD5);
+                }
+                GameController.CheckSpecialAccount(account);
+                LocalCache.SetBool(GameConst.LAST_LOGIN_IS_VISITOR_KEY, GameGlobal.isVisitor);
+                PlayerPrefs.Save();
+                await GetServerInfos();
+                await GetRoles();
+            }
+            else
+            {
+                if(ErrorCodeController.Handler(errorCode))
+                {
+                    ViewManager.Show<LoginInputView>();
+                }
+            }
+        }
+
+        public static async ETTask Register(string account, string password, string name, string identityNum, string code)
+        {
+            ViewManager.Show<ModalStatusView>("注册中...");
+            int errorCode = await LoginHelper.Register(GameGlobal.zoneScene, ET.ConstValue.LoginAddress, account, password, name, identityNum, code);
+            ViewManager.Hide<ModalStatusView>();
+            if (errorCode == ErrorCode.ERR_Success)
+            {
+                Login(account, password).Coroutine();
+            }
+            else
+            {
+                ErrorCodeController.Handler(errorCode);
+            }
+        }
+
+        public static async ETTask GetServerInfos()
+        {
+            int errorCode = await LoginHelper.GetServerInfos(GameGlobal.zoneScene);
+            if(errorCode != ErrorCode.ERR_Success)
+            {
+                ErrorCodeController.Handler(errorCode);
+                await ETTask.Create();
+                return;
+            }
+            var serverInfosComponent = GameGlobal.zoneScene.GetComponent<ServerInfosComponent>();
+            if (serverInfosComponent.ServerInfoList.Count <= 0)
+            {
+                Alert.Show("服务器列表为空:\n请检查网络和服务器状态")
+                    .SetRightButton(true, "知道啦", (object data) =>
+                    {
+                        Application.Quit();
+                    });
+                await ETTask.Create();
+                return;
+            }
+            var serverInfo = serverInfosComponent.ServerInfoList[0];
+            serverInfosComponent.CurrentServerId = int.Parse(serverInfo.Id.ToString());
+        }
+
+        public static async ETTask GetRoles()
+        {
+            int errorCode = await LoginHelper.GetRoles(GameGlobal.zoneScene);
+            if(errorCode != ErrorCode.ERR_Success)
+            {
+                ErrorCodeController.Handler(errorCode);
+                await ETTask.Create();
+            }
+            var roleInfosComponent = GameGlobal.zoneScene.GetComponent<RoleInfosComponent>();
+            if (roleInfosComponent.RoleInfos != null && roleInfosComponent.RoleInfos.Count > 0)
+            {
+                var roleInfo = roleInfosComponent.RoleInfos[0];
+                roleInfosComponent.CurrentRoleId = roleInfo.Id;
+                await ReqEnterGame();
+            }
+            else
+            {
+                GameController.ShowCreateRole();
+            }
+        }
+
+        public static async ETTask ReqCreateRole(string roleName)
+        {
+            int errorCode = await ET.LoginHelper.CreateRole(GameGlobal.zoneScene, roleName);
+            if (errorCode != ErrorCode.ERR_Success)
+            {
+                ErrorCodeController.Handler(errorCode);
+                return;
+            }
+
+            var roleInfosComponent = GameGlobal.zoneScene.GetComponent<RoleInfosComponent>();
+            if (roleInfosComponent.RoleInfos != null && roleInfosComponent.RoleInfos.Count > 0)
+            {
+                var roleInfo = roleInfosComponent.RoleInfos[0];
+                roleInfosComponent.CurrentRoleId = roleInfo.Id;
+                await ReqEnterGame();
+            }
+
+            ViewManager.Hide(ViewName.CREATE_ROLE_VIEW);
+        }
+
+        public static async ETTask ReqEnterGame()
+        {
+            int errorCode = await LoginHelper.GetRealmKey(GameGlobal.zoneScene);
+            if(errorCode != ErrorCode.ERR_Success)
+            {
+                ErrorCodeController.Handler(errorCode);
+                return;
+            }
+            errorCode = await LoginHelper.EnterGame(GameGlobal.zoneScene);
+            if (errorCode != ErrorCode.ERR_Success)
+            {
+                ErrorCodeController.Handler(errorCode);
+                return;
+            }
+            GameController.PreEnterGame();
+        }
+    }
+}

+ 11 - 0
GameClient/Assets/Game/HotUpdate/Controller/LoginController.cs.meta

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

+ 2 - 2
GameClient/Assets/Game/HotUpdate/Controller/PromptController.cs

@@ -22,7 +22,7 @@ namespace GFGGame
             {
                 GComponent ui = _uis[0];
                 long endTime = (long)ui.data;
-                if (endTime < ServerDataManager.currentTimeMillis)
+                if (endTime < ET.TimeHelper.ClientNow())
                 {
                     _uis.Remove(ui);
                     GTweener gTweener = ui.TweenFade(0, 0.5f);
@@ -68,7 +68,7 @@ namespace GFGGame
                 ui.x = preui.x;
                 ui.y = preui.y + 50;
             }
-            ui.data = ServerDataManager.currentTimeMillis + 3000;
+            ui.data = ET.TimeHelper.ClientNow() + 3000;
             _uis.Add(ui);
         }
 

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Data/Handler/RoleDataHandler.cs

@@ -32,7 +32,7 @@ namespace GFGGame
             int currentTimeSecs = ServerDataManager.currentTimeSecs;
             if(currentTimeSecs >= _heartbeatCDEnd) 
             {
-                GameProxy.ReqUpdateTime();
+                //GameProxy.ReqUpdateTime();
                 _heartbeatCDEnd = currentTimeSecs + INTERVAL_HEARTBEAT;
             }
             int day = ServerDataManager.CurrentDay;

+ 1 - 0
GameClient/Assets/Game/HotUpdate/ETView/AppStart_Init.cs

@@ -14,6 +14,7 @@ namespace ET
             Game.Scene.AddComponent<NetThreadComponent>();
             Game.Scene.AddComponent<SessionStreamDispatcher>();
             Game.Scene.AddComponent<ZoneSceneManagerComponent>();
+            Game.Scene.AddComponent<NumericWatcherComponent>();
 
             GameGlobal.zoneScene = SceneFactory.CreateZoneScene(1, "Game", Game.Scene);
             ET.Log.Trace("AppStart completed");

+ 8 - 0
GameClient/Assets/Game/HotUpdate/ETView/Numeric.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 9cb45779ec6a31a4f9c1b07f29971482
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 8 - 0
GameClient/Assets/Game/HotUpdate/ETView/Numeric/Event.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 9283fec05969fc74abdb5ccbfaa7a7d4
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 18 - 0
GameClient/Assets/Game/HotUpdate/ETView/Numeric/Event/NumericWatcher_RefreshMainUI.cs

@@ -0,0 +1,18 @@
+using ET.EventType;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ET
+{
+    [NumericWatcher(NumericType.LVL)]
+    public class NumericWatcher_RefreshMainUI : INumericWatcher
+    {
+        public void Run(NumbericChange args)
+        {
+            //args.Parent.ZoneScene().GetComponent<UIComponent>().GetDlgLogic<DlgMain>()?.Refresh();
+        }
+    }
+}

+ 11 - 0
GameClient/Assets/Game/HotUpdate/ETView/Numeric/Event/NumericWatcher_RefreshMainUI.cs.meta

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

+ 0 - 1
GameClient/Assets/Game/HotUpdate/GameGlobal.cs

@@ -8,7 +8,6 @@ namespace GFGGame
 {
     public class GameGlobal
     {
-        public static bool isOfflineVisitor = false;
         public static bool isVisitor = false;
         public static bool isFirstEntry = false;
 

+ 7 - 14
GameClient/Assets/Game/HotUpdate/Net/Proxy/GameProxy.cs

@@ -38,10 +38,6 @@ namespace GFGGame
                     ViewManager.Hide(ViewName.CREATE_ROLE_VIEW);
                     GameGlobal.isFirstEntry = true;
                     GameController.PreEnterGame(result);
-                    if (GameGlobal.isOfflineVisitor)
-                    {
-                        RoleDataManager.roleName = name;
-                    }
                     if (GameGlobal.skipGuide)
                     {
                         ReqUpdateStoryProgress(10, 100, 100010, 10100);
@@ -255,17 +251,14 @@ namespace GFGGame
         private static void ResultHandler(string data, Action<GameResult> callback)
         {
             GameResult resultObj = null;
-            if (!GameGlobal.isOfflineVisitor)
+            resultObj = null;
+            if (data != null)
             {
-                resultObj = null;
-                if (data != null)
-                {
-                    resultObj = JsonMapper.ToObject<GameResult>(data);
-                }
-                if (resultObj != null && resultObj.code != 0)
-                {
-                    PromptController.Instance.ShowFloatTextPrompt(resultObj.message);
-                }
+                resultObj = JsonMapper.ToObject<GameResult>(data);
+            }
+            if (resultObj != null && resultObj.code != 0)
+            {
+                PromptController.Instance.ShowFloatTextPrompt(resultObj.message);
             }
 
             if (callback != null)

+ 1 - 73
GameClient/Assets/Game/HotUpdate/Net/Proxy/LoginProxy.cs

@@ -6,79 +6,7 @@ namespace GFGGame
 {
     public class LoginProxy
     {
-        private const string API_HI = "hi";
-        private const string API_LOGIN = "login";
-        private const string API_LOGIN_AS_VISITOR = "loginAsVisitor";
-        private const string API_REGISTER = "register";
-
-        public static void SayHi(Action<LoginResult> callback)
-        {
-            //ViewManager.Show(ViewName.MODAL_STATUS_VIEW, "连接中...");
-            ViewManager.Show<ModalStatusView>("连接中...");
-            Get(API_HI, (LoginResult result) => {
-                ViewManager.Hide<ModalStatusView>();
-                if(result.version == GameConst.SERVER_VERSION || Application.isEditor)
-                {
-                    callback(result);
-                }
-                else
-                {
-                    Alert.Show("版本已更新,请联系研发获取最新版本")
-                    .SetLeftButton(true, "知道了", (data) => {
-                        Application.Quit();
-                    }); ;
-                }
-            });
-        }
-
-        public static void Login(string account, string password)
-        {
-            ViewManager.Show<ModalStatusView>("登录中...");
-            string data = JsonUtil.createJsonStr("account", account, "password", password);
-            Post(API_LOGIN, data, (LoginResult result) => {
-                ViewManager.Hide<ModalStatusView>();
-                if(result == null || result.code == 0) {
-                    GameGlobal.isVisitor = false;
-                    GameController.OnLoginSuccess(result);
-                } else {
-                    GameController.OnLoginFail(result);
-                }
-            });            
-        }
-
-        public static void LoginAsVisitor()
-        {
-            ViewManager.Show<ModalStatusView>("登录中...");
-            long id = (long)PlayerPrefs.GetFloat(GameConst.VISITOR_ID_KEY, -1);
-            string data = JsonUtil.createJsonStr("id", "" + id);
-            Post(API_LOGIN_AS_VISITOR, data, (LoginResult result) => {
-                ViewManager.Hide<ModalStatusView>();
-                if(result == null || result.code == 0)
-                {
-                    GameGlobal.isVisitor = true;
-                    GameController.OnLoginSuccess(result);
-                } else {
-                    GameController.OnLoginFail(result);
-                }
-            });  
-        }
-
-        public static void Register(string account, string password, string name, string identityNum, string code)
-        {
-            ViewManager.Show<ModalStatusView>("注册中...");
-            string data = JsonUtil.createJsonStr("account", account, "password", password, "name", name, "identityNum", identityNum, "code", code);
-            Post(API_REGISTER, data, (LoginResult result) => {
-                ViewManager.Hide<ModalStatusView>();
-                if(result == null || result.code == 0)
-                {
-                    GameGlobal.isVisitor = false;
-                    GameController.OnLoginSuccess(result);
-                } else {
-                    GameController.OnLoginFail(result);
-                }
-            });            
-        }
-
+        
         private static void Get(string methodName, Action<LoginResult> callback)
         {
             HttpTool.Instance.Get(GameGlobal.loginApiUrl, methodName, (string data) => {

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Views/CreateRole/CreateRoleView.cs

@@ -44,7 +44,7 @@ namespace GFGGame
             if (_ui.m_inputName.text.Length > 0)
             {
                 string roleName = _ui.m_inputName.text;
-                GameProxy.ReqCreateRole(GameGlobal.userId, roleName);
+                LoginController.ReqCreateRole(roleName).Coroutine();
             }
         }
 

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Views/Login/LoginInputView.cs

@@ -43,7 +43,7 @@ namespace GFGGame
 
         private void OnClickBtnSure()
         {
-            LoginProxy.Login(_ui.m_inputAccount.text, _ui.m_inputPassword.text);
+            LoginController.Login(_ui.m_inputAccount.text, _ui.m_inputPassword.text).Coroutine();
         }
 
         private void OnClickBtnCancel()

+ 5 - 20
GameClient/Assets/Game/HotUpdate/Views/Login/LoginView.cs

@@ -51,17 +51,10 @@ namespace GFGGame
                 _sceneObject = GameObject.Instantiate(_scenePrefab);
             }
             SceneController.UpdateLoginScene(_sceneObject);
-            if (GameGlobal.isOfflineVisitor)
+            _ui.m_btnLogout.visible = GameController.CheckLoginCache(false);
+            if (!_ui.m_btnLogout.visible)
             {
-                _ui.m_btnLogout.visible = false;
-            }
-            else
-            {
-                _ui.m_btnLogout.visible = GameController.CheckLoginCache(false);
-                if (!_ui.m_btnLogout.visible)
-                {
-                    ViewManager.Show<LoginInputView>();
-                }
+                ViewManager.Show<LoginInputView>();
             }
         }
 
@@ -82,18 +75,10 @@ namespace GFGGame
 
         private void OnClickBtnStart()
         {
-            if (GameGlobal.isOfflineVisitor)
+            if (!GameController.CheckLoginCache(true))
             {
-                LoginProxy.LoginAsVisitor();
+                ViewManager.Show<LoginInputView>();
             }
-            else
-            {
-                if (!GameController.CheckLoginCache(true))
-                {
-                    ViewManager.Show<LoginInputView>();
-                }
-            }
-
         }
 
         private void OnClickBtnLogout()

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Views/Login/RegisterView.cs

@@ -115,7 +115,7 @@ namespace GFGGame
                 }
             }
 
-            LoginProxy.Register(account, password, realName, idNumberStr, CODE);
+            LoginController.Register(account, password, realName, idNumberStr, CODE).Coroutine();
         }
 
         private void OnClickRichTextAgreeLink(string eventname)