瀏覽代碼

清理离线体验

guodong 3 年之前
父節點
當前提交
85aecee59e

+ 1 - 1
GameClient/Assets/Game/CSShare

@@ -1 +1 @@
-Subproject commit 636691841fe8e087929e669d3867a3cf0c6de531
+Subproject commit 27d93a64bb0e2e686a7850ef06da727c0bfb9546

+ 26 - 64
GameClient/Assets/Game/HotUpdate/Controller/GameController.cs

@@ -57,29 +57,22 @@ namespace GFGGame
         {
             ViewManager.Hide<LoginInputView>();
             ViewManager.Hide<RegisterView>();
-            if (GameGlobal.isOfflineVisitor)
+            User user = result.user;
+            GameGlobal.userId = user.id;
+            GameGlobal.userAge = user.age;
+            if (GameGlobal.isVisitor)
             {
-                GameProxy.ReqRoleInfo(GameGlobal.userId);
+                PlayerPrefs.SetFloat(GameConst.VISITOR_ID_KEY, 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);
+                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)
@@ -121,62 +114,31 @@ namespace GFGGame
             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);
-            }
-            else
+            roleInfo = result.roleInfo;
+            bool rerult = AntiAddictionController.CheckAntiAddiction(roleInfo.onlineTimeSecs, roleInfo.onlineDurationSecs, roleInfo.onlineDurationSecsDay);
+            if (rerult)
             {
-                RoleDataManager.InitServerData(null);
-                ItemDataManager.InitServerData(null);
-                CustomSuitDataManager.InitServerData(0, null);
-                StoryDataManager.InitServerData(null);
-                GuideDataManager.InitServerData(null);
-                DressUpMenuSuitDataManager.InitServerData(null);
-                CardDataManager.InitServerData(null);
+                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();
 
             GFGUIPackage.AddPackage(ResPathUtil.GetUIPackagePath("CommonGame"));
             GFGUIPackage.AddPackage(ResPathUtil.GetUIPackagePath("Main"));
 
-            if (GameGlobal.isOfflineVisitor)
+            if (RoleDataManager.lvl >= 50)
             {
-                Alert.Show("离线体验可以选择跳过引导并获取所有衣服。")
-                    .SetLeftButton(true, "跳过引导", (object data) =>
-                    {
-                        GameGlobal.skipGuide = true;
-                        GMController.GetAllDressUpItem();
-                        EnterGame();
-                    })
-                    .SetRightButton(true, "体验引导", (object data) =>
-                    {
-                        GameGlobal.skipGuide = false;
-                        EnterGame();
-                    });
-            }
-            else
-            {
-                if (RoleDataManager.lvl >= 50)
-                {
-                    GameGlobal.skipGuide = true;
-                }
-                EnterGame();
+                GameGlobal.skipGuide = true;
             }
+            EnterGame();
         }
 
         public static void QuitToLoginView(bool logout)

+ 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 antiAddiction = true;

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

@@ -37,10 +37,6 @@ namespace GFGGame
                 {
                     ViewManager.Hide(ViewName.CREATE_ROLE_VIEW);
                     GameController.PreEnterGame(result);
-                    if (GameGlobal.isOfflineVisitor)
-                    {
-                        RoleDataManager.roleName = name;
-                    }
                     if (GameGlobal.skipGuide)
                     {
                         ReqUpdateStoryProgress(10, 100, 100010, 10100);
@@ -254,17 +250,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)

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

@@ -13,7 +13,6 @@ namespace GFGGame
 
         public static void SayHi(Action<LoginResult> callback)
         {
-            //ViewManager.Show(ViewName.MODAL_STATUS_VIEW, "连接中...");
             ViewManager.Show<ModalStatusView>("连接中...");
             Get(API_HI, (LoginResult result) => {
                 ViewManager.Hide<ModalStatusView>();

+ 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()