// using System; 
 | 
// using System.Collections; 
 | 
// using System.Collections.Generic; 
 | 
  
 | 
// using UnityEngine; 
 | 
// using UnityEngine.UI; 
 | 
  
 | 
// namespace vnxbqy.UI 
 | 
// { 
 | 
//     public class UI3DHeroSkillShow : MonoBehaviour 
 | 
//     { 
 | 
//         static UI3DHeroSkillShow m_Instance = null; 
 | 
//         public static UI3DHeroSkillShow Instance { 
 | 
//             get { 
 | 
//                 if (m_Instance == null) 
 | 
//                 { 
 | 
//                     var gameObject = Instantiate(UILoader.LoadTreasure("Misc", "UI3DHeroSkillShow")); 
 | 
//                     m_Instance = gameObject.GetComponent<UI3DHeroSkillShow>(); 
 | 
//                     Instance.transform.position = new Vector3(0, 4000, 5000); 
 | 
//                     m_Instance.name = "UI3DHeroSkillShow"; 
 | 
//                     m_Instance.SetActive(true); 
 | 
//                     DontDestroyOnLoad(gameObject); 
 | 
//                 } 
 | 
  
 | 
//                 return m_Instance; 
 | 
//             } 
 | 
//         } 
 | 
  
 | 
//         [SerializeField] Transform m_Stage; 
 | 
//         [SerializeField] Camera m_ShowCamera; 
 | 
//         [SerializeField] Animator m_CameraAnimator; 
 | 
//         [SerializeField] List<RuntimeAnimatorController> m_HeroShowControllers; 
 | 
//         [SerializeField] List<TreasureSkill> m_TreasureSkills; 
 | 
//         [SerializeField] List<SkillAct> m_SkillActs; 
 | 
  
 | 
//         UI3DShowHero m_HeroShow = new UI3DShowHero(); 
 | 
  
 | 
//         PackModel playerPack { get { return ModelCenter.Instance.GetModel<PackModel>(); } } 
 | 
  
 | 
//         Transform m_HeroPoint; 
 | 
//         public Transform hero { 
 | 
//             get { 
 | 
//                 return m_HeroPoint; 
 | 
//             } 
 | 
//         } 
 | 
  
 | 
//         Animator m_HeroAnimator; 
 | 
  
 | 
//         Action m_HeroSkillCompletet; 
 | 
  
 | 
//         SFXController m_SkillExtraSfx; 
 | 
  
 | 
//         public int cacheSkillId { get; private set; } 
 | 
  
 | 
//         public Camera showCamera { get { return m_ShowCamera; } } 
 | 
  
 | 
//         public SFXController skillEffect; 
 | 
  
 | 
//         public Transform MP_Name1 { 
 | 
//             get { 
 | 
//                 var mp_name = hero.GetChildTransformDeeply("A_Name2"); 
 | 
//                 if (!mp_name) 
 | 
//                 { 
 | 
//                     return hero; 
 | 
//                 } 
 | 
//                 return mp_name; 
 | 
//             } 
 | 
//         } 
 | 
  
 | 
//         public Transform MP_Weapon { 
 | 
//             get { 
 | 
//                 var mp_weapon = hero.GetChildTransformDeeply(WEAPON_NODE); 
 | 
//                 if (mp_weapon != null) 
 | 
//                 { 
 | 
//                     if (mp_weapon.childCount > 0) 
 | 
//                     { 
 | 
//                         return mp_weapon.GetChild(0); 
 | 
//                     } 
 | 
//                     return mp_weapon; 
 | 
//                 } 
 | 
//                 return hero; 
 | 
//             } 
 | 
//         } 
 | 
  
 | 
//         const string WEAPON_NODE = "Bip001 Prop1"; 
 | 
  
 | 
  
 | 
//         private void ShowHeroSkill(int _skillId, string _clip) 
 | 
//         { 
 | 
//             if (UI3DTreasureSelectStage.Instance.IsOpen) 
 | 
//             { 
 | 
//                 UI3DTreasureSelectStage.Instance.showCamera.enabled = false; 
 | 
//             } 
 | 
  
 | 
//             cacheSkillId = _skillId; 
 | 
  
 | 
//             var _job = PlayerDatas.Instance.baseData.Job; 
 | 
  
 | 
//             #region 装备 
 | 
//             var appearance = ModelCenter.Instance.GetModel<EquipModel>().GetAppearance(); 
 | 
  
 | 
//             var _clothesId = appearance.clothes; 
 | 
//             var _wingsId = appearance.wings; 
 | 
//             var _secondaryId = appearance.secondary; 
 | 
//             var _weaponId = appearance.weapon; 
 | 
//             var fashionClothesId = appearance.fashionClothes; 
 | 
//             var fashionWeaponId = appearance.fashionWeapon; 
 | 
//             var fashionSecondaryId = appearance.fashionSecondary; 
 | 
  
 | 
//             int _suitLevel = 0; 
 | 
//             #endregion 
 | 
  
 | 
//             UI3DPlayerExhibitionData data = new UI3DPlayerExhibitionData() 
 | 
//             { 
 | 
//                 job = _job, 
 | 
//                 fashionClothesId = fashionClothesId, 
 | 
//                 clothesId = _clothesId, 
 | 
//                 suitLevel = _suitLevel, 
 | 
//                 fashionWeaponId = fashionWeaponId, 
 | 
//                 weaponId = _weaponId, 
 | 
//                 wingsId = _wingsId, 
 | 
//                 fashionSecondaryId = fashionSecondaryId, 
 | 
//                 secondaryId = _secondaryId, 
 | 
//                 isDialogue = false, 
 | 
//             }; 
 | 
  
 | 
//             var _hero = m_HeroShow.Show(data, m_Stage); 
 | 
//             if (_hero != null) 
 | 
//             { 
 | 
//                 m_HeroPoint = _hero.transform; 
 | 
//                 m_HeroAnimator = _hero.GetComponent<Animator>(); 
 | 
//                 if (m_HeroAnimator != null) 
 | 
//                 { 
 | 
//                     m_HeroAnimator.runtimeAnimatorController = m_HeroShowControllers[_job - 1]; 
 | 
//                     StartCoroutine(Co_PlaySkill()); 
 | 
//                 } 
 | 
//             } 
 | 
  
 | 
//             m_Stage.localEulerAngles = Vector3.zero; 
 | 
//             m_ShowCamera.SetActive(true); 
 | 
  
 | 
//             m_CameraAnimator.Play(_clip, 0, 0); 
 | 
//             m_CameraAnimator.speed = 0; 
 | 
//         } 
 | 
  
 | 
//         public void ShowTreasureSkill(int _treasureId, Action callback) 
 | 
//         { 
 | 
//             StopShow(); 
 | 
  
 | 
//             Treasure _treasure; 
 | 
//             ModelCenter.Instance.GetModel<TreasureModel>().TryGetTreasure(_treasureId, out _treasure); 
 | 
//             if (_treasure != null) 
 | 
//             { 
 | 
//                 m_HeroSkillCompletet = callback; 
 | 
//                 var _skillId = _treasure.skillId; 
 | 
//                 var _index = m_TreasureSkills.FindIndex((x) => 
 | 
//                 { 
 | 
//                     return x.treasureId == _treasureId; 
 | 
//                 }); 
 | 
//                 var _treasureSkill = _index != -1 ? m_TreasureSkills[_index] : m_TreasureSkills[0]; 
 | 
//                 _index = _treasureSkill.clip.FindIndex((x) => 
 | 
//                 { 
 | 
//                     return (int)x.job == PlayerDatas.Instance.baseData.Job; 
 | 
//                 }); 
 | 
//                 var _clip = _index != -1 ? _treasureSkill.clip[_index] : _treasureSkill.clip[0]; 
 | 
//                 ShowHeroSkill(_skillId, _clip.clip); 
 | 
//                 if (_treasureSkill.effects != null && _treasureSkill.effects.Count > 0) 
 | 
//                 { 
 | 
//                     _index = _treasureSkill.effects.FindIndex((x) => 
 | 
//                     { 
 | 
//                         return (int)x.job == PlayerDatas.Instance.baseData.Job; 
 | 
//                     }); 
 | 
//                     var _effect = _index != -1 ? _treasureSkill.effects[_index] : _treasureSkill.effects[0]; 
 | 
//                     StartCoroutine(Co_PlayExtraEffect(_effect)); 
 | 
//                 } 
 | 
//             } 
 | 
//         } 
 | 
  
 | 
//         private void StartPlaySkill(int _skillId) 
 | 
//         { 
 | 
//             var config = SkillConfig.Get(_skillId); 
 | 
//             if (config == null) 
 | 
//             { 
 | 
//                 return; 
 | 
//             } 
 | 
//             var skillActMark = config.Skillactmark; 
 | 
  
 | 
//             var index = m_SkillActs.FindIndex((x) => 
 | 
//             { 
 | 
//                 return x.skillId == _skillId; 
 | 
//             }); 
 | 
  
 | 
//             if (index != -1) 
 | 
//             { 
 | 
//                 skillActMark = m_SkillActs[index].mark; 
 | 
//             } 
 | 
  
 | 
//             if (skillActMark > 0 && skillActMark < 20) 
 | 
//             { 
 | 
//                 switch (config.Skillactmark) 
 | 
//                 { 
 | 
//                     case 10: 
 | 
//                         m_HeroAnimator.Play(GAStaticDefine.State_Attack1Hash, 0); 
 | 
//                         break; 
 | 
//                     case 11: 
 | 
//                         m_HeroAnimator.Play(GAStaticDefine.State_Attack2Hash, 0); 
 | 
//                         break; 
 | 
//                     case 12: 
 | 
//                         m_HeroAnimator.Play(GAStaticDefine.State_Attack3Hash, 0); 
 | 
//                         break; 
 | 
//                     case 13: 
 | 
//                         m_HeroAnimator.Play(GAStaticDefine.State_Attack4Hash, 0); 
 | 
//                         break; 
 | 
//                 } 
 | 
//             } 
 | 
//             else 
 | 
//             { 
 | 
//                 switch (skillActMark) 
 | 
//                 { 
 | 
//                     case 21: 
 | 
//                         m_HeroAnimator.Play(GAStaticDefine.State_Skill21, 0); 
 | 
//                         break; 
 | 
//                     case 22: 
 | 
//                         m_HeroAnimator.Play(GAStaticDefine.State_Skill22, 0); 
 | 
//                         break; 
 | 
//                     case 23: 
 | 
//                         m_HeroAnimator.Play(GAStaticDefine.State_Skill23, 0); 
 | 
//                         break; 
 | 
//                     case 24: 
 | 
//                         m_HeroAnimator.Play(GAStaticDefine.State_Skill24, 0); 
 | 
//                         break; 
 | 
//                     case 25: 
 | 
//                         m_HeroAnimator.Play(GAStaticDefine.State_Skill25, 0); 
 | 
//                         break; 
 | 
//                     case 26: 
 | 
//                         m_HeroAnimator.Play(GAStaticDefine.State_Skill26, 0); 
 | 
//                         break; 
 | 
//                     case 27: 
 | 
//                         m_HeroAnimator.Play(GAStaticDefine.State_Skill27, 0); 
 | 
//                         break; 
 | 
//                     case 28: 
 | 
//                         m_HeroAnimator.Play(GAStaticDefine.State_Skill28, 0); 
 | 
//                         break; 
 | 
//                     case 29: 
 | 
//                         m_HeroAnimator.Play(GAStaticDefine.State_Skill29, 0); 
 | 
//                         break; 
 | 
//                     case 99: 
 | 
//                         m_HeroAnimator.Play(GAStaticDefine.State_RollHash, 0); 
 | 
//                         break; 
 | 
//                 } 
 | 
//             } 
 | 
  
 | 
  
 | 
//         } 
 | 
  
 | 
//         IEnumerator Co_PlaySkill() 
 | 
//         { 
 | 
//             yield return WaitingForSecondConst.WaitMS1000; 
 | 
//             if (m_HeroAnimator != null) 
 | 
//             { 
 | 
//                 StartPlaySkill(cacheSkillId); 
 | 
//             } 
 | 
  
 | 
//             m_CameraAnimator.speed = 1; 
 | 
//             yield return null; 
 | 
//             var _showTime = m_CameraAnimator.GetCurrentAnimatorStateInfo(0).length; 
 | 
//             yield return new WaitForSeconds(_showTime); 
 | 
//             if (m_HeroSkillCompletet != null) 
 | 
//             { 
 | 
//                 m_HeroSkillCompletet(); 
 | 
//             } 
 | 
//             StopShow(); 
 | 
//         } 
 | 
  
 | 
//         IEnumerator Co_PlayExtraEffect(Effect effect) 
 | 
//         { 
 | 
//             yield return new WaitForSeconds(effect.startTime); 
 | 
//             if (m_SkillExtraSfx != null) 
 | 
//             { 
 | 
//                 SFXPlayUtility.Instance.Release(m_SkillExtraSfx); 
 | 
//                 m_SkillExtraSfx = null; 
 | 
//             } 
 | 
//             var parent = hero; 
 | 
//             if (!string.IsNullOrEmpty(effect.parentName) && hero != null) 
 | 
//             { 
 | 
//                 parent = hero.GetChildTransformDeeply(effect.parentName, true); 
 | 
//             } 
 | 
//             m_SkillExtraSfx = SFXPlayUtility.Instance.Play(effect.id, parent); 
 | 
//             if (m_SkillExtraSfx != null) 
 | 
//             { 
 | 
//                 m_SkillExtraSfx.duration = effect.duration; 
 | 
//                 m_SkillExtraSfx.transform.localPosition = effect.position; 
 | 
//             } 
 | 
//         } 
 | 
  
 | 
//         public void StopShow() 
 | 
//         { 
 | 
//             if (UI3DTreasureSelectStage.Instance.IsOpen) 
 | 
//             { 
 | 
//                 UI3DTreasureSelectStage.Instance.showCamera.enabled = true; 
 | 
//             } 
 | 
//             m_ShowCamera.SetActive(false); 
 | 
//             m_HeroSkillCompletet = null; 
 | 
//             m_HeroShow.Dispose(); 
 | 
//             if (m_SkillExtraSfx != null) 
 | 
//             { 
 | 
//                 SFXPlayUtility.Instance.Release(m_SkillExtraSfx); 
 | 
//                 m_SkillExtraSfx = null; 
 | 
//             } 
 | 
  
 | 
//             if (skillEffect != null) 
 | 
//             { 
 | 
//                 SFXPlayUtility.Instance.Release(skillEffect); 
 | 
//                 skillEffect = null; 
 | 
//             } 
 | 
//         } 
 | 
  
 | 
//         [Serializable] 
 | 
//         public struct CameraClip 
 | 
//         { 
 | 
//             public PlayerJob job; 
 | 
//             public string clip; 
 | 
//         } 
 | 
  
 | 
//         [Serializable] 
 | 
//         public struct Effect 
 | 
//         { 
 | 
//             public PlayerJob job; 
 | 
//             public int id; 
 | 
//             public float startTime; 
 | 
//             public float duration; 
 | 
//             public string parentName; 
 | 
//             public Vector3 position; 
 | 
//         } 
 | 
  
 | 
//         [Serializable] 
 | 
//         public struct TreasureSkill 
 | 
//         { 
 | 
//             public int treasureId; 
 | 
//             public List<CameraClip> clip; 
 | 
//             public List<Effect> effects; 
 | 
//         } 
 | 
  
 | 
//         [Serializable] 
 | 
//         public struct SkillAct 
 | 
//         { 
 | 
//             public int skillId; 
 | 
//             public int mark; 
 | 
//         } 
 | 
  
 | 
//         public enum PlayerJob 
 | 
//         { 
 | 
//             Qiang = 1, 
 | 
//             Fashi, 
 | 
//         } 
 | 
//     } 
 | 
// } 
 |