From 64be5af337818a95337f771272f2651f49bea235 Mon Sep 17 00:00:00 2001
From: Client_PangDeRong <593317293@qq.com>
Date: 星期三, 22 八月 2018 15:27:12 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts

---
 System/Realm/RealmBossShow.cs |  204 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 200 insertions(+), 4 deletions(-)

diff --git a/System/Realm/RealmBossShow.cs b/System/Realm/RealmBossShow.cs
index b2aaa7d..891a8e6 100644
--- a/System/Realm/RealmBossShow.cs
+++ b/System/Realm/RealmBossShow.cs
@@ -11,7 +11,12 @@
         [SerializeField, Header("灞曠ず鏃堕棿")] float m_DisplayTime = 15f;
         [SerializeField, Header("鐗规晥浣嶇疆")] Vector3 m_EffectPosition = Vector3.zero;
 
-        UI3DShowHero showHero = new UI3DShowHero();
+        GameObject clothesModel;
+        Animator clothesAnimator;
+
+        Transform showPoint;
+
+        List<SFXController> closthesSFXList = new List<SFXController>();
 
         static RealmBossShow m_Instance = null;
         public static RealmBossShow Instance
@@ -134,10 +139,11 @@
             }
             #endregion
 
-            var _hero = showHero.Show(_job, _clothesId, _suitLevel, _weaponId, _wingsId, _secondaryId, m_HeroStage);
+            showPoint = m_HeroStage;
+            var _hero = ShowHero(_job, _clothesId, _suitLevel, _weaponId, _wingsId, _secondaryId);
             if (_hero != null)
             {
-                showHero.SitDown();
+                SitDown();
                 LayerUtility.SetLayer(m_HeroStage.gameObject, LayerUtility.BossShow, true);
             }
         }
@@ -185,12 +191,202 @@
             showCamera.enabled = false;
             m_Effect.gameObject.SetActive(false);
             transform.localPosition = new Vector3(0, 4000, 5000);
-            showHero.Dispose();
             if (m_Effect != null)
             {
                 SFXPlayUtility.Instance.Release(m_Effect);
                 m_Effect = null;
             }
+
+            for (int i = closthesSFXList.Count - 1; i >= 0; i--)
+            {
+                if (closthesSFXList[i] != null)
+                {
+                    Destroy(closthesSFXList[i].gameObject);
+                }
+            }
+            closthesSFXList.Clear();
+
+            if (clothesModel != null)
+            {
+                Destroy(clothesModel);
+                clothesModel = null;
+                clothesAnimator = null;
+            }
+        }
+
+        GameObject ShowHero(int _job, int _clothes, int suitID, int _weaponId, int _wingsId, int _secondaryId)
+        {
+            PutOnClothes(_job, _clothes, suitID);
+            return clothesModel;
+        }
+
+        public void SitDown()
+        {
+            if (clothesModel != null)
+            {
+                var animator = clothesModel.GetComponent<Animator>();
+                animator.Play(GAStaticDefine.State_SitDown);
+            }
+        }
+
+        public void PutOnClothes(int _job, int itemID, int suitID)
+        {
+            var newClothes = 0;
+            var config = Config.Instance.Get<JobSetupConfig>(_job);
+
+            if (itemID == 0)
+            {
+                newClothes = config.BaseEquip[0];
+            }
+            else
+            {
+                var item = Config.Instance.Get<ItemConfig>(itemID);
+                newClothes = item == null ? newClothes = config.BaseEquip[0] : item.ChangeOrd;
+            }
+
+            var _prefab = InstanceResourcesLoader.LoadModelRes(newClothes);
+            if (!_prefab)
+            {
+                newClothes = config.BaseEquip[0];
+            }
+
+            LoadClothes(newClothes);
+
+            LoadClothesEffect(_job, itemID, suitID);
+        }
+
+        private void LoadClothes(int resID)
+        {
+            var prefab = InstanceResourcesLoader.LoadModelRes(resID);
+            if (clothesModel == null)
+            {
+                clothesModel = Instantiate(prefab, Constants.Special_Hide_Position, Quaternion.identity);
+            }
+
+            clothesModel.transform.SetParent(null);
+            clothesModel.transform.localScale = Vector3.one;
+
+            LayerUtility.SetLayer(clothesModel, LayerUtility.Player, false);
+            var skinnedMeshRenderer = clothesModel.GetComponentInChildren<SkinnedMeshRenderer>(true);
+            LayerUtility.SetLayer(skinnedMeshRenderer.gameObject, LayerUtility.Player, false);
+            clothesModel.SetActive(true);
+            clothesModel.transform.SetParentEx(showPoint, Vector3.zero, Quaternion.identity, Vector3.one);
+            clothesAnimator = clothesModel.GetComponent<Animator>();
+
+            if (clothesAnimator == null)
+            {
+                DebugEx.LogErrorFormat("瑙掕壊璧勬簮: {0} 娌℃湁鍔ㄧ敾鎺у埗鍣�", resID);
+            }
+
+            // 鍔ㄧ敾鐘舵�佹満淇敼
+            if (clothesAnimator)
+            {
+                RuntimeAnimatorController _controller = AnimatorControllerLoader.Load(AnimatorControllerLoader.controllerUISuffix, resID);
+                clothesAnimator.runtimeAnimatorController = _controller;
+                clothesAnimator.enabled = true;
+            }
+        }
+
+        public void LoadClothesEffect(int job,int clothedID, int suitLevel)
+        {
+            var _equipModel = ModelCenter.Instance.GetModel<PlayerPackModel>().GetSinglePackModel(PackType.rptEquip);
+            if (_equipModel == null)
+            {
+                if (DTC0309_tagPlayerLoginInfo.equipSuitID > 0)
+                {
+                    PutOnEffect(DTC0309_tagPlayerLoginInfo.equipSuitID);
+                }
+                return;
+            }
+
+            int _suitCount = 0;
+
+            int _start = (int)RoleEquipType.retHat;
+            int _end = (int)RoleEquipType.retShoes;
+
+            ItemModel _itemModel = null;
+
+            _itemModel = _equipModel.GetItemModelByIndex((int)RoleEquipType.retClothes);
+
+            if (_itemModel == null)
+            {
+                return;
+            }
+
+            int _rank = _itemModel.chinItemModel.LV;
+
+            for (int i = _start; i <= _end; ++i)
+            {
+                _itemModel = _equipModel.GetItemModelByIndex(i);
+
+                if (_itemModel == null)
+                {
+                    continue;
+                }
+
+                if (_itemModel.chinItemModel.SuiteiD <= 0)
+                {
+                    continue;
+                }
+
+                if (i == (int)RoleEquipType.retClothes)
+                {
+                    _rank = _itemModel.chinItemModel.LV;
+                }
+
+                var suitModel = ModelCenter.Instance.GetModel<PlayerSuitModel>();
+                if (suitModel.suitModelDict.ContainsKey(i))
+                {
+                    if (suitModel.suitModelDict[i].ContainsKey(1)
+                     || suitModel.suitModelDict[i].ContainsKey(2))
+                    {
+                        if (_itemModel.chinItemModel.LV >= _rank)
+                        {
+                            _suitCount += 1;
+                        }
+                    }
+                }
+            }
+
+            if (_suitCount == 5)
+            {
+                int _type = 1;
+
+                int _suitEffectID = _type * 1000 + job * 100 + _rank;
+
+                PutOnEffect(_suitEffectID);
+            }
+        }
+
+        public void PutOnEffect(int id)
+        {
+            SuitEffectConfig _suitEffect = Config.Instance.Get<SuitEffectConfig>(id);
+
+            // 涓婄壒鏁�
+            if (_suitEffect != null)
+            {
+                Transform _parent = null;
+                SFXController _sfx = null;
+                for (int i = 0; _suitEffect.bindbones != null && i < _suitEffect.bindbones.Length; ++i)
+                {
+                    if (string.IsNullOrEmpty(_suitEffect.bindbones[i])
+                        || _suitEffect.effectIds[i] == 0)
+                    {
+                        continue;
+                    }
+
+                    _parent = clothesModel.transform.GetChildTransformDeeply(_suitEffect.bindbones[i]);
+
+                    if (_parent == null)
+                    {
+                        Debug.LogErrorFormat("濂楄: {0} 閰嶇疆鐨勯楠艰妭鐐�: {1} 涓嶅瓨鍦�", id, _suitEffect.bindbones[i]);
+                        continue;
+                    }
+
+                    _sfx = SFXPlayUtility.Instance.PlayBattleEffect(_suitEffect.effectIds[i], _parent);
+                    closthesSFXList.Add(_sfx);
+                }
+            }
         }
     }
 }

--
Gitblit v1.8.0