From 21a1542f9d99466b2aedd0992a1032b37b4154a3 Mon Sep 17 00:00:00 2001
From: client_Hale <339726288@qq.com>
Date: 星期一, 20 八月 2018 20:21:08 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master' into Skill_Polymorph_BeatBackPlayer

---
 UI/HUD/HeadUpName.cs |   53 +++++++++++++++++++++++++++++++++--------------------
 1 files changed, 33 insertions(+), 20 deletions(-)

diff --git a/UI/HUD/HeadUpName.cs b/UI/HUD/HeadUpName.cs
index 0b6dae5..b006e8f 100644
--- a/UI/HUD/HeadUpName.cs
+++ b/UI/HUD/HeadUpName.cs
@@ -80,38 +80,50 @@
         {
             m_PlayerName.text = _name;
             m_HangHint.gameObject.SetActive(_hang);
-            SetRealm(_realm);
+            SetPlayerRealm(_realm);
             SetTitle(_titleId);
             SetAlliance(_alliance);
             SyncPosition(true);
         }
 
-        public void SetRealm(int _realm)
+        public void SetPlayerRealm(int _realm)
         {
-            m_Realm.gameObject.SetActive(_realm > 0);
-            m_PlayerName.alignment = _realm > 0 ? TextAnchor.MiddleLeft : TextAnchor.MiddleCenter;
-
-            if (_realm > 0)
+            if (m_Realm)
             {
-                var realmConfig = ConfigManager.Instance.GetTemplate<RealmConfig>(_realm);
-                if (realmConfig != null)
+                if (_realm > 0)
                 {
+                    m_Realm.gameObject.SetActive(true);
+                    m_PlayerName.alignment = TextAnchor.MiddleLeft;
+                    var realmConfig = ConfigManager.Instance.GetTemplate<RealmConfig>(_realm);
                     m_Realm.SetSprite(realmConfig.Img);
                     SetImageMaterialTexture(realmConfig.Img);
                 }
+                else
+                {
+                    m_Realm.gameObject.SetActive(false);
+                    m_PlayerName.alignment = TextAnchor.MiddleCenter;
+                }
             }
+
         }
 
-        public void SetFunctionalNpcRealm(int _realm)
+        public void SetNpcRealm(int _realm)
         {
-            m_Realm.gameObject.SetActive(true);
-            m_PlayerName.alignment = TextAnchor.MiddleLeft;
-
-            var realmConfig = ConfigManager.Instance.GetTemplate<RealmConfig>(_realm);
-            if (realmConfig != null)
+            if (m_Realm != null)
             {
-                m_Realm.SetSprite(realmConfig.Img);
-                SetImageMaterialTexture(realmConfig.Img);
+                if (ConfigManager.Instance.ContainKey<RealmConfig>(_realm))
+                {
+                    m_Realm.gameObject.SetActive(true);
+                    m_PlayerName.alignment = TextAnchor.MiddleLeft;
+                    var realmConfig = ConfigManager.Instance.GetTemplate<RealmConfig>(_realm);
+                    m_Realm.SetSprite(realmConfig.Img);
+                    SetImageMaterialTexture(realmConfig.Img);
+                }
+                else
+                {
+                    m_PlayerName.alignment = TextAnchor.MiddleCenter;
+                    m_Realm.gameObject.SetActive(false);
+                }
             }
         }
 
@@ -193,7 +205,7 @@
 
         public void SetNPCName(string _name)
         {
-            SetFunctionalNpcRealm(0);
+            SetNpcRealm(999);
             m_PlayerName.text = _name;
             SyncPosition(true);
         }
@@ -203,7 +215,7 @@
             var config = ConfigManager.Instance.GetTemplate<NPCConfig>(_id);
             if (config != null)
             {
-                SetFunctionalNpcRealm(config.Realm);
+                SetNpcRealm(config.ClientRealm);
                 m_PlayerName.text = config.charName;
             }
 
@@ -217,10 +229,11 @@
             findPreciousModel.bossInfoUpdateEvent -= UpdateNpcRebornTime;
             findPreciousModel.bossInfoUpdateEvent += UpdateNpcRebornTime;
             npcId = _npcId;
+
             var config = ConfigManager.Instance.GetTemplate<NPCConfig>(_npcId);
             if (config != null)
             {
-                SetRealm(config.Realm);
+                SetNpcRealm(config.ClientRealm);
                 m_PlayerName.text = config.charName;
             }
 
@@ -279,7 +292,7 @@
             var config = ConfigManager.Instance.GetTemplate<NPCConfig>(_npcId);
             if (config != null)
             {
-                SetRealm(config.Realm);
+                SetNpcRealm(config.ClientRealm);
                 m_PlayerName.text = StringUtility.Contact(config.charName, Language.Get("HeadUpName_Monster", _level));
                 monsterLevel = _level;
                 monsterType = (E_MonsterType)config.IsBoss;

--
Gitblit v1.8.0