Jelajahi Sumber

角色名字存储唯一

guodong 1 tahun lalu
induk
melakukan
84fb61b21b

+ 7 - 2
GameClient/Assets/Game/HotUpdate/Data/RoleDataManager.cs

@@ -8,7 +8,13 @@ namespace GFGGame
     {
         public static bool powerTimeServerLock;
         public static long roleId;
-        public static string roleName;
+        public static string roleName
+        {
+            get
+            {
+                return GameGlobal.zoneScene.GetComponent<RoleInfosComponent>().GetCurrentRoleName();
+            }
+        }
         public static int rechargeTotalMon
         {
             get
@@ -227,7 +233,6 @@ namespace GFGGame
 
         public static void InitServerData()
         {
-            roleName = GameGlobal.zoneScene.GetComponent<RoleInfosComponent>().GetCurrentRoleName();
             roleId = GameGlobal.zoneScene.GetComponent<RoleInfosComponent>().CurrentRoleId;
         }
         /// <summary>

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

@@ -134,7 +134,6 @@ namespace GFGGame
             {
                 if (response.Error == ErrorCode.ERR_Success)
                 {
-                    RoleDataManager.roleName = response.Name;
                     GameGlobal.zoneScene.GetComponent<RoleInfosComponent>().GetCurrentRole().Name = response.Name;
                     EventAgent.DispatchEvent(ConstMessage.CHANGE_ROLE_NAME);
                     return true;