| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [ Date ]: Saturday, September 09, 2017 |
| | | //-------------------------------------------------------- |
| | | using vnxbqy.UI; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | // //-------------------------------------------------------- |
| | | // // [Author]: 第二世界 |
| | | // // [ Date ]: Saturday, September 09, 2017 |
| | | // //-------------------------------------------------------- |
| | | // using vnxbqy.UI; |
| | | // using System.Collections; |
| | | // using System.Collections.Generic; |
| | | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using UnityStandardAssets.ImageEffects; |
| | | // using UnityEngine; |
| | | // using UnityEngine.UI; |
| | | // using UnityStandardAssets.ImageEffects; |
| | | |
| | | namespace vnxbqy.UI |
| | | { |
| | | // namespace vnxbqy.UI |
| | | // { |
| | | |
| | | public class UI3DModelExhibition : MonoBehaviour |
| | | { |
| | | [SerializeField] Transform m_PlayerShowPoint; |
| | | [SerializeField] Transform m_HorseShowPoint; |
| | | [SerializeField] Transform m_WingShowPoint; |
| | | [SerializeField] Transform m_NPCShowPoint; |
| | | [SerializeField] Transform m_DialogPoint; |
| | | [SerializeField] Transform m_EquipmentPoint; |
| | | [SerializeField] Camera m_ShowCamera; |
| | | [SerializeField] ColorCorrectionCurves m_CameraColor; |
| | | // public class UI3DModelExhibition : MonoBehaviour |
| | | // { |
| | | // [SerializeField] Transform m_PlayerShowPoint; |
| | | // [SerializeField] Transform m_HorseShowPoint; |
| | | // [SerializeField] Transform m_WingShowPoint; |
| | | // [SerializeField] Transform m_NPCShowPoint; |
| | | // [SerializeField] Transform m_DialogPoint; |
| | | // [SerializeField] Transform m_EquipmentPoint; |
| | | // [SerializeField] Camera m_ShowCamera; |
| | | // [SerializeField] ColorCorrectionCurves m_CameraColor; |
| | | |
| | | public bool interactable { get; set; } |
| | | // public bool interactable { get; set; } |
| | | |
| | | UI3DShowHero playerModel = new UI3DShowHero(); |
| | | // UI3DShowHero playerModel = new UI3DShowHero(); |
| | | |
| | | int m_HorseModelId = 0; |
| | | GameObject horseModel = null; |
| | | public GameObject NpcModelHorse { |
| | | get { return horseModel; } |
| | | set { horseModel = value; } |
| | | } |
| | | // int m_HorseModelId = 0; |
| | | // GameObject horseModel = null; |
| | | // public GameObject NpcModelHorse { |
| | | // get { return horseModel; } |
| | | // set { horseModel = value; } |
| | | // } |
| | | |
| | | int m_NPCId = 0; |
| | | GameObject npcModel = null; |
| | | SFXController m_NpcEffect; |
| | | readonly List<SFXController> m_BindEffectList = new List<SFXController>(); |
| | | public GameObject NpcModelPet { |
| | | get { return npcModel; } |
| | | set { npcModel = value; } |
| | | } |
| | | // int m_NPCId = 0; |
| | | // GameObject npcModel = null; |
| | | // SFXController m_NpcEffect; |
| | | // readonly List<SFXController> m_BindEffectList = new List<SFXController>(); |
| | | // public GameObject NpcModelPet { |
| | | // get { return npcModel; } |
| | | // set { npcModel = value; } |
| | | // } |
| | | |
| | | int m_WingModelId = 0; |
| | | GameObject wingModel = null; |
| | | // int m_WingModelId = 0; |
| | | // GameObject wingModel = null; |
| | | |
| | | int m_EquipmentModelId = 0; |
| | | GameObject equipmentModel = null; |
| | | // int m_EquipmentModelId = 0; |
| | | // GameObject equipmentModel = null; |
| | | |
| | | SFXController godWeaponEffect = null; |
| | | // SFXController godWeaponEffect = null; |
| | | |
| | | SFXController horsePetEffect = null; |
| | | // SFXController horsePetEffect = null; |
| | | |
| | | Coroutine m_SwtichAnimationCoroutine = null; |
| | | // Coroutine m_SwtichAnimationCoroutine = null; |
| | | |
| | | bool isShowingPlayer = false; |
| | | bool isShowingHorse = false; |
| | | bool isShowingNPC = false; |
| | | bool isShowingPet = false; |
| | | bool isShowinEquipment = false; |
| | | // bool isShowingPlayer = false; |
| | | // bool isShowingHorse = false; |
| | | // bool isShowingNPC = false; |
| | | // bool isShowingPet = false; |
| | | // bool isShowinEquipment = false; |
| | | |
| | | EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } } |
| | | ReikiRootModel reikiRootModel { get { return ModelCenter.Instance.GetModel<ReikiRootModel>(); } } |
| | | PetModel petModel { get { return ModelCenter.Instance.GetModel<PetModel>(); } } |
| | | // EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } } |
| | | // ReikiRootModel reikiRootModel { get { return ModelCenter.Instance.GetModel<ReikiRootModel>(); } } |
| | | // PetModel petModel { get { return ModelCenter.Instance.GetModel<PetModel>(); } } |
| | | |
| | | TitleModel titleModel { get { return ModelCenter.Instance.GetModel<TitleModel>(); } } |
| | | // TitleModel titleModel { get { return ModelCenter.Instance.GetModel<TitleModel>(); } } |
| | | |
| | | static UI3DModelExhibition m_Instance = null; |
| | | public static UI3DModelExhibition Instance { |
| | | get { |
| | | if (m_Instance == null) |
| | | { |
| | | CreateStage(); |
| | | } |
| | | // static UI3DModelExhibition m_Instance = null; |
| | | // public static UI3DModelExhibition Instance { |
| | | // get { |
| | | // if (m_Instance == null) |
| | | // { |
| | | // CreateStage(); |
| | | // } |
| | | |
| | | return m_Instance; |
| | | } |
| | | } |
| | | // return m_Instance; |
| | | // } |
| | | // } |
| | | |
| | | static UI3DModelExhibition m_InstanceClone1 = null; |
| | | public static UI3DModelExhibition InstanceClone1 { |
| | | get { |
| | | if (m_InstanceClone1 == null) |
| | | { |
| | | CreateCloneStageEx(ref m_InstanceClone1, 1); |
| | | } |
| | | return m_InstanceClone1; |
| | | } |
| | | } |
| | | // static UI3DModelExhibition m_InstanceClone1 = null; |
| | | // public static UI3DModelExhibition InstanceClone1 { |
| | | // get { |
| | | // if (m_InstanceClone1 == null) |
| | | // { |
| | | // CreateCloneStageEx(ref m_InstanceClone1, 1); |
| | | // } |
| | | // return m_InstanceClone1; |
| | | // } |
| | | // } |
| | | |
| | | static UI3DModelExhibition m_InstanceClone2 = null; |
| | | public static UI3DModelExhibition InstanceClone2 |
| | | { |
| | | get |
| | | { |
| | | if (m_InstanceClone2 == null) |
| | | { |
| | | CreateCloneStageEx(ref m_InstanceClone2, 2); |
| | | } |
| | | return m_InstanceClone2; |
| | | } |
| | | } |
| | | // static UI3DModelExhibition m_InstanceClone2 = null; |
| | | // public static UI3DModelExhibition InstanceClone2 |
| | | // { |
| | | // get |
| | | // { |
| | | // if (m_InstanceClone2 == null) |
| | | // { |
| | | // CreateCloneStageEx(ref m_InstanceClone2, 2); |
| | | // } |
| | | // return m_InstanceClone2; |
| | | // } |
| | | // } |
| | | |
| | | static UI3DModelExhibition m_InstanceClone3 = null; |
| | | public static UI3DModelExhibition InstanceClone3 |
| | | { |
| | | get |
| | | { |
| | | if (m_InstanceClone3 == null) |
| | | { |
| | | CreateCloneStageEx(ref m_InstanceClone3, 3); |
| | | } |
| | | return m_InstanceClone3; |
| | | } |
| | | } |
| | | // static UI3DModelExhibition m_InstanceClone3 = null; |
| | | // public static UI3DModelExhibition InstanceClone3 |
| | | // { |
| | | // get |
| | | // { |
| | | // if (m_InstanceClone3 == null) |
| | | // { |
| | | // CreateCloneStageEx(ref m_InstanceClone3, 3); |
| | | // } |
| | | // return m_InstanceClone3; |
| | | // } |
| | | // } |
| | | |
| | | static UI3DModelExhibition m_InstanceClone4 = null; |
| | | public static UI3DModelExhibition InstanceClone4 |
| | | { |
| | | get |
| | | { |
| | | if (m_InstanceClone4 == null) |
| | | { |
| | | CreateCloneStageEx(ref m_InstanceClone4, 4); |
| | | } |
| | | return m_InstanceClone4; |
| | | } |
| | | } |
| | | // static UI3DModelExhibition m_InstanceClone4 = null; |
| | | // public static UI3DModelExhibition InstanceClone4 |
| | | // { |
| | | // get |
| | | // { |
| | | // if (m_InstanceClone4 == null) |
| | | // { |
| | | // CreateCloneStageEx(ref m_InstanceClone4, 4); |
| | | // } |
| | | // return m_InstanceClone4; |
| | | // } |
| | | // } |
| | | |
| | | static UI3DModelExhibition m_InstanceClone5 = null; |
| | | public static UI3DModelExhibition InstanceClone5 |
| | | { |
| | | get |
| | | { |
| | | if (m_InstanceClone5 == null) |
| | | { |
| | | CreateCloneStageEx(ref m_InstanceClone5, 5); |
| | | } |
| | | return m_InstanceClone5; |
| | | } |
| | | } |
| | | // static UI3DModelExhibition m_InstanceClone5 = null; |
| | | // public static UI3DModelExhibition InstanceClone5 |
| | | // { |
| | | // get |
| | | // { |
| | | // if (m_InstanceClone5 == null) |
| | | // { |
| | | // CreateCloneStageEx(ref m_InstanceClone5, 5); |
| | | // } |
| | | // return m_InstanceClone5; |
| | | // } |
| | | // } |
| | | |
| | | static UI3DModelExhibition m_InstanceClone6 = null; |
| | | public static UI3DModelExhibition InstanceClone6 |
| | | { |
| | | get |
| | | { |
| | | if (m_InstanceClone6 == null) |
| | | { |
| | | CreateCloneStageEx(ref m_InstanceClone6, 6); |
| | | } |
| | | return m_InstanceClone6; |
| | | } |
| | | } |
| | | // static UI3DModelExhibition m_InstanceClone6 = null; |
| | | // public static UI3DModelExhibition InstanceClone6 |
| | | // { |
| | | // get |
| | | // { |
| | | // if (m_InstanceClone6 == null) |
| | | // { |
| | | // CreateCloneStageEx(ref m_InstanceClone6, 6); |
| | | // } |
| | | // return m_InstanceClone6; |
| | | // } |
| | | // } |
| | | |
| | | static UI3DModelExhibition m_InstanceClone7 = null; |
| | | public static UI3DModelExhibition InstanceClone7 |
| | | { |
| | | get |
| | | { |
| | | if (m_InstanceClone7 == null) |
| | | { |
| | | CreateCloneStageEx(ref m_InstanceClone7, 7); |
| | | } |
| | | return m_InstanceClone7; |
| | | } |
| | | } |
| | | // static UI3DModelExhibition m_InstanceClone7 = null; |
| | | // public static UI3DModelExhibition InstanceClone7 |
| | | // { |
| | | // get |
| | | // { |
| | | // if (m_InstanceClone7 == null) |
| | | // { |
| | | // CreateCloneStageEx(ref m_InstanceClone7, 7); |
| | | // } |
| | | // return m_InstanceClone7; |
| | | // } |
| | | // } |
| | | |
| | | static UI3DModelExhibition m_InstanceClone8 = null; |
| | | public static UI3DModelExhibition InstanceClone8 |
| | | { |
| | | get |
| | | { |
| | | if (m_InstanceClone8 == null) |
| | | { |
| | | CreateCloneStageEx(ref m_InstanceClone8, 8); |
| | | } |
| | | return m_InstanceClone8; |
| | | } |
| | | } |
| | | // static UI3DModelExhibition m_InstanceClone8 = null; |
| | | // public static UI3DModelExhibition InstanceClone8 |
| | | // { |
| | | // get |
| | | // { |
| | | // if (m_InstanceClone8 == null) |
| | | // { |
| | | // CreateCloneStageEx(ref m_InstanceClone8, 8); |
| | | // } |
| | | // return m_InstanceClone8; |
| | | // } |
| | | // } |
| | | |
| | | static void CreateStage() |
| | | { |
| | | var prefab = BuiltInLoader.LoadPrefab("UI3DModelExhibitionStage"); |
| | | var gameObject = GameObject.Instantiate(prefab); |
| | | m_Instance = gameObject.GetComponent<UI3DModelExhibition>(); |
| | | m_Instance.transform.position = new Vector3(1000, 2000, 3000); |
| | | m_Instance.name = "UI3DModelExhibitionStage"; |
| | | m_Instance.SetActive(true); |
| | | m_Instance.m_ShowCamera.enabled = false; |
| | | DontDestroyOnLoad(gameObject); |
| | | } |
| | | // static void CreateStage() |
| | | // { |
| | | // var prefab = BuiltInLoader.LoadPrefab("UI3DModelExhibitionStage"); |
| | | // var gameObject = GameObject.Instantiate(prefab); |
| | | // m_Instance = gameObject.GetComponent<UI3DModelExhibition>(); |
| | | // m_Instance.transform.position = new Vector3(1000, 2000, 3000); |
| | | // m_Instance.name = "UI3DModelExhibitionStage"; |
| | | // m_Instance.SetActive(true); |
| | | // m_Instance.m_ShowCamera.enabled = false; |
| | | // DontDestroyOnLoad(gameObject); |
| | | // } |
| | | |
| | | static void CreateCloneStage() |
| | | { |
| | | var prefab = BuiltInLoader.LoadPrefab("UI3DModelExhibitionStage"); |
| | | var gameObject = GameObject.Instantiate(prefab); |
| | | m_InstanceClone1 = gameObject.GetComponent<UI3DModelExhibition>(); |
| | | m_InstanceClone1.transform.position = new Vector3(2000, 4000, 5000); |
| | | m_InstanceClone1.name = "UI3DModelExhibitionStage(clone1)"; |
| | | m_InstanceClone1.SetActive(true); |
| | | m_InstanceClone1.m_ShowCamera.enabled = false; |
| | | DontDestroyOnLoad(gameObject); |
| | | } |
| | | // static void CreateCloneStage() |
| | | // { |
| | | // var prefab = BuiltInLoader.LoadPrefab("UI3DModelExhibitionStage"); |
| | | // var gameObject = GameObject.Instantiate(prefab); |
| | | // m_InstanceClone1 = gameObject.GetComponent<UI3DModelExhibition>(); |
| | | // m_InstanceClone1.transform.position = new Vector3(2000, 4000, 5000); |
| | | // m_InstanceClone1.name = "UI3DModelExhibitionStage(clone1)"; |
| | | // m_InstanceClone1.SetActive(true); |
| | | // m_InstanceClone1.m_ShowCamera.enabled = false; |
| | | // DontDestroyOnLoad(gameObject); |
| | | // } |
| | | |
| | | static void CreateCloneStageEx(ref UI3DModelExhibition instance, int index) |
| | | { |
| | | var prefab = BuiltInLoader.LoadPrefab("UI3DModelExhibitionStage"); |
| | | var gameObject = GameObject.Instantiate(prefab); |
| | | instance = gameObject.GetComponent<UI3DModelExhibition>(); |
| | | instance.transform.position = new Vector3(1000 + index * 200, 1000 + index * 200, 5000); |
| | | instance.name = "UI3DModelExhibitionStage(clone" + index + ")"; |
| | | instance.SetActive(true); |
| | | instance.m_ShowCamera.enabled = false; |
| | | DontDestroyOnLoad(gameObject); |
| | | } |
| | | // static void CreateCloneStageEx(ref UI3DModelExhibition instance, int index) |
| | | // { |
| | | // var prefab = BuiltInLoader.LoadPrefab("UI3DModelExhibitionStage"); |
| | | // var gameObject = GameObject.Instantiate(prefab); |
| | | // instance = gameObject.GetComponent<UI3DModelExhibition>(); |
| | | // instance.transform.position = new Vector3(1000 + index * 200, 1000 + index * 200, 5000); |
| | | // instance.name = "UI3DModelExhibitionStage(clone" + index + ")"; |
| | | // instance.SetActive(true); |
| | | // instance.m_ShowCamera.enabled = false; |
| | | // DontDestroyOnLoad(gameObject); |
| | | // } |
| | | |
| | | public string GetName() |
| | | { |
| | | return this.name; |
| | | } |
| | | // public string GetName() |
| | | // { |
| | | // return this.name; |
| | | // } |
| | | |
| | | public void ShowPlayerBodyEffect(int effectId, float scale = 1) |
| | | { |
| | | if (playerModel != null) |
| | | { |
| | | playerModel.ShowTitleBodyEffect(effectId, scale); |
| | | } |
| | | } |
| | | // public void ShowPlayerBodyEffect(int effectId, float scale = 1) |
| | | // { |
| | | // if (playerModel != null) |
| | | // { |
| | | // playerModel.ShowTitleBodyEffect(effectId, scale); |
| | | // } |
| | | // } |
| | | |
| | | public void HidePlayerBodyEffect() |
| | | { |
| | | if (playerModel != null) |
| | | { |
| | | playerModel.HideTitleRootEffect(); |
| | | } |
| | | } |
| | | // public void HidePlayerBodyEffect() |
| | | // { |
| | | // if (playerModel != null) |
| | | // { |
| | | // playerModel.HideTitleRootEffect(); |
| | | // } |
| | | // } |
| | | |
| | | //玩家自己的UI模型展示 |
| | | public void ShowPlayer(RawImage rawImage, int job, bool isDialogue = false, float scale = 0) |
| | | { |
| | | var apperance = equipModel.GetAppearance(); |
| | | var reikiRootEffectId = PlayerDatas.Instance.baseData.reikiRootEffectId; |
| | | // //玩家自己的UI模型展示 |
| | | // public void ShowPlayer(RawImage rawImage, int job, bool isDialogue = false, float scale = 0) |
| | | // { |
| | | // var apperance = equipModel.GetAppearance(); |
| | | // var reikiRootEffectId = PlayerDatas.Instance.baseData.reikiRootEffectId; |
| | | |
| | | var data = new UI3DPlayerExhibitionData |
| | | { |
| | | job = job, |
| | | fashionClothesId = apperance.fashionClothes, |
| | | fashionWeaponId = apperance.fashionWeapon, |
| | | fashionSecondaryId = apperance.fashionSecondary, |
| | | clothesId = apperance.clothes, |
| | | weaponId = apperance.weapon, |
| | | secondaryId = apperance.secondary, |
| | | wingsId = apperance.wings, |
| | | suitLevel = apperance.isSuit ? 1 : 0, |
| | | reikiRootEffectId = isDialogue ? 0 : reikiRootEffectId, |
| | | isDialogue = isDialogue, |
| | | equipLevel = PlayerDatas.Instance.baseData.suitLevel, |
| | | scale = scale, |
| | | titleID = PlayerDatas.Instance.baseData.TitleID |
| | | // var data = new UI3DPlayerExhibitionData |
| | | // { |
| | | // job = job, |
| | | // fashionClothesId = apperance.fashionClothes, |
| | | // fashionWeaponId = apperance.fashionWeapon, |
| | | // fashionSecondaryId = apperance.fashionSecondary, |
| | | // clothesId = apperance.clothes, |
| | | // weaponId = apperance.weapon, |
| | | // secondaryId = apperance.secondary, |
| | | // wingsId = apperance.wings, |
| | | // suitLevel = apperance.isSuit ? 1 : 0, |
| | | // reikiRootEffectId = isDialogue ? 0 : reikiRootEffectId, |
| | | // isDialogue = isDialogue, |
| | | // equipLevel = PlayerDatas.Instance.baseData.suitLevel, |
| | | // scale = scale, |
| | | // titleID = PlayerDatas.Instance.baseData.TitleID |
| | | |
| | | }; |
| | | // }; |
| | | |
| | | DrawPlayer(rawImage, data); |
| | | } |
| | | // DrawPlayer(rawImage, data); |
| | | // } |
| | | |
| | | public void ShowPlayer(RawImage rawImage, UI3DPlayerExhibitionData data) |
| | | { |
| | | DrawPlayer(rawImage, data); |
| | | } |
| | | // public void ShowPlayer(RawImage rawImage, UI3DPlayerExhibitionData data) |
| | | // { |
| | | // DrawPlayer(rawImage, data); |
| | | // } |
| | | |
| | | public void ShowSitDownPlayer(RawImage rawImage, int job) |
| | | { |
| | | ShowPlayer(rawImage, job, false); |
| | | if (playerModel != null) |
| | | { |
| | | playerModel.SitDown(); |
| | | } |
| | | } |
| | | // public void ShowSitDownPlayer(RawImage rawImage, int job) |
| | | // { |
| | | // ShowPlayer(rawImage, job, false); |
| | | // if (playerModel != null) |
| | | // { |
| | | // playerModel.SitDown(); |
| | | // } |
| | | // } |
| | | |
| | | void DrawPlayer(RawImage rawImage, UI3DPlayerExhibitionData data) |
| | | { |
| | | StopShow(); |
| | | // void DrawPlayer(RawImage rawImage, UI3DPlayerExhibitionData data) |
| | | // { |
| | | // StopShow(); |
| | | |
| | | var isDialogue = data.isDialogue; |
| | | var instance = playerModel.Show(data, isDialogue ? m_DialogPoint : m_PlayerShowPoint); |
| | | interactable = !isDialogue; |
| | | // var isDialogue = data.isDialogue; |
| | | // var instance = playerModel.Show(data, isDialogue ? m_DialogPoint : m_PlayerShowPoint); |
| | | // interactable = !isDialogue; |
| | | |
| | | if (!data.keepRotation) |
| | | { |
| | | m_PlayerShowPoint.localEulerAngles = Vector3.zero; |
| | | } |
| | | // if (!data.keepRotation) |
| | | // { |
| | | // m_PlayerShowPoint.localEulerAngles = Vector3.zero; |
| | | // } |
| | | |
| | | if (isDialogue) |
| | | { |
| | | instance.transform.localPosition = GeneralDefine.heroDialogueOffset; |
| | | instance.transform.localEulerAngles = GeneralDefine.heroDialogueRotation; |
| | | if (data.scale <= 0) |
| | | instance.transform.localScale = GeneralDefine.heroDialogueScale * Vector3.one; |
| | | else |
| | | instance.transform.localScale = GeneralDefine.heroDialogueScale * data.scale * Vector3.one; |
| | | } |
| | | else |
| | | { |
| | | if (data.scale > 0) |
| | | instance.transform.localScale = data.scale * Vector3.one; |
| | | } |
| | | // if (isDialogue) |
| | | // { |
| | | // instance.transform.localPosition = GeneralDefine.heroDialogueOffset; |
| | | // instance.transform.localEulerAngles = GeneralDefine.heroDialogueRotation; |
| | | // if (data.scale <= 0) |
| | | // instance.transform.localScale = GeneralDefine.heroDialogueScale * Vector3.one; |
| | | // else |
| | | // instance.transform.localScale = GeneralDefine.heroDialogueScale * data.scale * Vector3.one; |
| | | // } |
| | | // else |
| | | // { |
| | | // if (data.scale > 0) |
| | | // instance.transform.localScale = data.scale * Vector3.one; |
| | | // } |
| | | |
| | | m_ShowCamera.enabled = true; |
| | | isShowingPlayer = true; |
| | | ResetCameraColor(); |
| | | // m_ShowCamera.enabled = true; |
| | | // isShowingPlayer = true; |
| | | // ResetCameraColor(); |
| | | |
| | | if (playerModel != null) |
| | | { |
| | | playerModel.StandUp(); |
| | | } |
| | | // if (playerModel != null) |
| | | // { |
| | | // playerModel.StandUp(); |
| | | // } |
| | | |
| | | BindGestureCatcher(rawImage, interactable); |
| | | } |
| | | // BindGestureCatcher(rawImage, interactable); |
| | | // } |
| | | |
| | | public void ShowHourse(int modelId, RawImage rawImage) |
| | | { |
| | | StopShow(); |
| | | m_ShowCamera.enabled = true; |
| | | // public void ShowHourse(int modelId, RawImage rawImage) |
| | | // { |
| | | // StopShow(); |
| | | // m_ShowCamera.enabled = true; |
| | | |
| | | var instance = UI3DModelFactory.LoadUIHorse(modelId); |
| | | if (instance == null) |
| | | { |
| | | return; |
| | | } |
| | | // var instance = UI3DModelFactory.LoadUIHorse(modelId); |
| | | // if (instance == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | |
| | | isShowingHorse = true; |
| | | interactable = true; |
| | | // isShowingHorse = true; |
| | | // interactable = true; |
| | | |
| | | m_HorseModelId = modelId; |
| | | horseModel = instance; |
| | | // m_HorseModelId = modelId; |
| | | // horseModel = instance; |
| | | |
| | | m_HorseShowPoint.rotation = Quaternion.identity; |
| | | // m_HorseShowPoint.rotation = Quaternion.identity; |
| | | |
| | | var modelConfig = ModelResConfig.Get(modelId); |
| | | var position = modelConfig.UIOffset; |
| | | var rotation = modelConfig.UIRotation; |
| | | instance.transform.SetParentEx(m_HorseShowPoint, position, rotation, modelConfig.UIScale); |
| | | instance.SetActive(true); |
| | | ResetCameraColor(); |
| | | // var modelConfig = ModelResConfig.Get(modelId); |
| | | // var position = modelConfig.UIOffset; |
| | | // var rotation = modelConfig.UIRotation; |
| | | // instance.transform.SetParentEx(m_HorseShowPoint, position, rotation, modelConfig.UIScale); |
| | | // instance.SetActive(true); |
| | | // ResetCameraColor(); |
| | | |
| | | ShowNpcEffect(instance.transform, modelConfig.ResourcesName); |
| | | // ShowNpcEffect(instance.transform, modelConfig.ResourcesName); |
| | | |
| | | BindGestureCatcher(rawImage, interactable); |
| | | } |
| | | // BindGestureCatcher(rawImage, interactable); |
| | | // } |
| | | |
| | | public void ShowHourse(UI3DHorsePetData data, RawImage rawImage) |
| | | { |
| | | StopShow(); |
| | | m_ShowCamera.enabled = true; |
| | | // public void ShowHourse(UI3DHorsePetData data, RawImage rawImage) |
| | | // { |
| | | // StopShow(); |
| | | // m_ShowCamera.enabled = true; |
| | | |
| | | var horseConfig = HorseConfig.Get(data.id); |
| | | if (horseConfig == null) |
| | | { |
| | | return; |
| | | } |
| | | // var horseConfig = HorseConfig.Get(data.id); |
| | | // if (horseConfig == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | |
| | | var instance = UI3DModelFactory.LoadUIHorse(horseConfig.Model); |
| | | if (instance == null) |
| | | { |
| | | return; |
| | | } |
| | | // var instance = UI3DModelFactory.LoadUIHorse(horseConfig.Model); |
| | | // if (instance == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | |
| | | isShowingHorse = true; |
| | | interactable = true; |
| | | // isShowingHorse = true; |
| | | // interactable = true; |
| | | |
| | | m_HorseModelId = horseConfig.Model; |
| | | horseModel = instance; |
| | | // m_HorseModelId = horseConfig.Model; |
| | | // horseModel = instance; |
| | | |
| | | m_HorseShowPoint.rotation = Quaternion.identity; |
| | | // m_HorseShowPoint.rotation = Quaternion.identity; |
| | | |
| | | var modelConfig = ModelResConfig.Get(horseConfig.Model); |
| | | var position = modelConfig.UIOffset; |
| | | var rotation = modelConfig.UIRotation; |
| | | instance.transform.SetParentEx(m_HorseShowPoint, position, rotation, modelConfig.UIScale); |
| | | instance.SetActive(true); |
| | | ResetCameraColor(); |
| | | // var modelConfig = ModelResConfig.Get(horseConfig.Model); |
| | | // var position = modelConfig.UIOffset; |
| | | // var rotation = modelConfig.UIRotation; |
| | | // instance.transform.SetParentEx(m_HorseShowPoint, position, rotation, modelConfig.UIScale); |
| | | // instance.SetActive(true); |
| | | // ResetCameraColor(); |
| | | |
| | | ShowNpcEffect(instance.transform, modelConfig.ResourcesName); |
| | | // ShowNpcEffect(instance.transform, modelConfig.ResourcesName); |
| | | |
| | | if (horseModel && data.isRun) |
| | | { |
| | | var animator = horseModel.GetComponentInChildren<Animator>(); |
| | | if (animator != null) |
| | | { |
| | | m_SwtichAnimationCoroutine = StartCoroutine(Co_SwitchAnimation(animator, GAStaticDefine.State_RunHash)); |
| | | } |
| | | } |
| | | // if (horseModel && data.isRun) |
| | | // { |
| | | // var animator = horseModel.GetComponentInChildren<Animator>(); |
| | | // if (animator != null) |
| | | // { |
| | | // m_SwtichAnimationCoroutine = StartCoroutine(Co_SwitchAnimation(animator, GAStaticDefine.State_RunHash)); |
| | | // } |
| | | // } |
| | | |
| | | if (horseModel && data.skinIndex > 0) |
| | | { |
| | | var horsePetEffectId = petModel.GetPetHorseEffect(data.id, data.skinIndex); |
| | | if (horsePetEffectId != 0) |
| | | { |
| | | horsePetEffect = SFXPlayUtility.Instance.Play(horsePetEffectId, horseModel.transform); |
| | | if (horsePetEffect != null) |
| | | { |
| | | horsePetEffect.duration = 0f; |
| | | horsePetEffect.SetParticleEmissionRateOverTime(2f); |
| | | } |
| | | } |
| | | } |
| | | // if (horseModel && data.skinIndex > 0) |
| | | // { |
| | | // var horsePetEffectId = petModel.GetPetHorseEffect(data.id, data.skinIndex); |
| | | // if (horsePetEffectId != 0) |
| | | // { |
| | | // horsePetEffect = SFXPlayUtility.Instance.Play(horsePetEffectId, horseModel.transform); |
| | | // if (horsePetEffect != null) |
| | | // { |
| | | // horsePetEffect.duration = 0f; |
| | | // horsePetEffect.SetParticleEmissionRateOverTime(2f); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | BindGestureCatcher(rawImage, interactable); |
| | | } |
| | | // BindGestureCatcher(rawImage, interactable); |
| | | // } |
| | | |
| | | private GameObject ObjEquipment; |
| | | public void ShowEquipment(int modelId, Vector3 localEulerAngles, float scale, RawImage rawImage, bool interactable = false) |
| | | { |
| | | var instance = UI3DModelFactory.LoadUIWing(modelId); |
| | | ObjEquipment = instance; |
| | | if (instance == null) |
| | | { |
| | | return; |
| | | } |
| | | // private GameObject ObjEquipment; |
| | | // public void ShowEquipment(int modelId, Vector3 localEulerAngles, float scale, RawImage rawImage, bool interactable = false) |
| | | // { |
| | | // var instance = UI3DModelFactory.LoadUIWing(modelId); |
| | | // ObjEquipment = instance; |
| | | // if (instance == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | |
| | | StopShow(); |
| | | // StopShow(); |
| | | |
| | | isShowinEquipment = true; |
| | | m_ShowCamera.enabled = true; |
| | | m_EquipmentModelId = modelId; |
| | | equipmentModel = instance; |
| | | instance.transform.SetParentEx(m_EquipmentPoint, Vector3.zero, localEulerAngles, Vector3.one * scale); |
| | | instance.SetActive(true); |
| | | ResetCameraColor(); |
| | | BindGestureCatcher(rawImage, interactable); |
| | | } |
| | | // isShowinEquipment = true; |
| | | // m_ShowCamera.enabled = true; |
| | | // m_EquipmentModelId = modelId; |
| | | // equipmentModel = instance; |
| | | // instance.transform.SetParentEx(m_EquipmentPoint, Vector3.zero, localEulerAngles, Vector3.one * scale); |
| | | // instance.SetActive(true); |
| | | // ResetCameraColor(); |
| | | // BindGestureCatcher(rawImage, interactable); |
| | | // } |
| | | |
| | | public void ShowWing(int _modelId, RawImage _rawImage) |
| | | { |
| | | StopShow(); |
| | | // public void ShowWing(int _modelId, RawImage _rawImage) |
| | | // { |
| | | // StopShow(); |
| | | |
| | | var instance = UI3DModelFactory.LoadUIWing(_modelId); |
| | | if (instance == null) |
| | | { |
| | | return; |
| | | } |
| | | // var instance = UI3DModelFactory.LoadUIWing(_modelId); |
| | | // if (instance == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | |
| | | m_ShowCamera.enabled = true; |
| | | interactable = true; |
| | | // m_ShowCamera.enabled = true; |
| | | // interactable = true; |
| | | |
| | | m_WingModelId = _modelId; |
| | | wingModel = instance; |
| | | // m_WingModelId = _modelId; |
| | | // wingModel = instance; |
| | | |
| | | m_WingShowPoint.rotation = Quaternion.identity; |
| | | var modelConfig = ModelResConfig.Get(_modelId); |
| | | var position = modelConfig.UIOffset; |
| | | var rotation = modelConfig.UIRotation; |
| | | instance.transform.SetParentEx(m_WingShowPoint, position, rotation, modelConfig.UIScale); |
| | | // m_WingShowPoint.rotation = Quaternion.identity; |
| | | // var modelConfig = ModelResConfig.Get(_modelId); |
| | | // var position = modelConfig.UIOffset; |
| | | // var rotation = modelConfig.UIRotation; |
| | | // instance.transform.SetParentEx(m_WingShowPoint, position, rotation, modelConfig.UIScale); |
| | | |
| | | instance.SetActive(true); |
| | | ResetCameraColor(); |
| | | var animator = instance.GetComponent<Animator>(); |
| | | if (animator != null) |
| | | { |
| | | animator.Play("UI_Idle_Single"); |
| | | } |
| | | // instance.SetActive(true); |
| | | // ResetCameraColor(); |
| | | // var animator = instance.GetComponent<Animator>(); |
| | | // if (animator != null) |
| | | // { |
| | | // animator.Play("UI_Idle_Single"); |
| | | // } |
| | | |
| | | BindGestureCatcher(_rawImage, interactable); |
| | | } |
| | | // BindGestureCatcher(_rawImage, interactable); |
| | | // } |
| | | |
| | | public void ShowNPC(RawImage rawImage, UI3DNPCExhibitionData data) |
| | | { |
| | | StopShow(); |
| | | ResetCameraColor(); |
| | | var config = NPCConfig.Get(data.npcId); |
| | | m_NPCId = data.npcId; |
| | | var job = 0; |
| | | if (config.MODE.Contains("A_Zs")) |
| | | { |
| | | job = 1; |
| | | } |
| | | else if (config.MODE.Contains("A_Fs")) |
| | | { |
| | | job = 2; |
| | | } |
| | | // public void ShowNPC(RawImage rawImage, UI3DNPCExhibitionData data) |
| | | // { |
| | | // StopShow(); |
| | | // ResetCameraColor(); |
| | | // var config = NPCConfig.Get(data.npcId); |
| | | // m_NPCId = data.npcId; |
| | | // var job = 0; |
| | | // if (config.MODE.Contains("A_Zs")) |
| | | // { |
| | | // job = 1; |
| | | // } |
| | | // else if (config.MODE.Contains("A_Fs")) |
| | | // { |
| | | // job = 2; |
| | | // } |
| | | |
| | | var offset = config.UIModeLOffset; |
| | | var eulerAngles = config.UIModelRotation; |
| | | var scale = Vector3.one * config.UIModeLProportion; |
| | | // var offset = config.UIModeLOffset; |
| | | // var eulerAngles = config.UIModelRotation; |
| | | // var scale = Vector3.one * config.UIModeLProportion; |
| | | |
| | | var isPlayer = job != 0; |
| | | if (isPlayer) |
| | | { |
| | | var instance = UI3DModelFactory.LoadUINPC(data.npcId); |
| | | if (instance == null) |
| | | { |
| | | DebugEx.LogFormat("无法获得npc模型资源,id :{0}", data.npcId); |
| | | return; |
| | | } |
| | | // var isPlayer = job != 0; |
| | | // if (isPlayer) |
| | | // { |
| | | // var instance = UI3DModelFactory.LoadUINPC(data.npcId); |
| | | // if (instance == null) |
| | | // { |
| | | // Debug.LogFormat("无法获得npc模型资源,id :{0}", data.npcId); |
| | | // return; |
| | | // } |
| | | |
| | | instance.transform.SetParentEx(data.isDialogue ? m_DialogPoint : m_NPCShowPoint, offset, eulerAngles, scale); |
| | | npcModel = instance; |
| | | isShowingNPC = true; |
| | | // instance.transform.SetParentEx(data.isDialogue ? m_DialogPoint : m_NPCShowPoint, offset, eulerAngles, scale); |
| | | // npcModel = instance; |
| | | // isShowingNPC = true; |
| | | |
| | | var _configName = string.Empty; |
| | | // var _configName = string.Empty; |
| | | |
| | | if (job == 1) |
| | | { |
| | | _configName = config.MODE.Substring(config.MODE.LastIndexOf("A_")); |
| | | } |
| | | else if (job == 2) |
| | | { |
| | | _configName = config.MODE.Substring(config.MODE.LastIndexOf("A_")); |
| | | } |
| | | // if (job == 1) |
| | | // { |
| | | // _configName = config.MODE.Substring(config.MODE.LastIndexOf("A_")); |
| | | // } |
| | | // else if (job == 2) |
| | | // { |
| | | // _configName = config.MODE.Substring(config.MODE.LastIndexOf("A_")); |
| | | // } |
| | | |
| | | if (!string.IsNullOrEmpty(_configName)) |
| | | { |
| | | var _renderer = instance.GetComponentInChildren<SkinnedMeshRenderer>(); |
| | | if (_renderer) |
| | | { |
| | | MaterialLoader.Release(_renderer.material); |
| | | // if (!string.IsNullOrEmpty(_configName)) |
| | | // { |
| | | // var _renderer = instance.GetComponentInChildren<SkinnedMeshRenderer>(); |
| | | // if (_renderer) |
| | | // { |
| | | // MaterialLoader.Release(_renderer.material); |
| | | |
| | | var _modelResConfig = ModelResConfig.GetClothesConfig(_configName); |
| | | if (_modelResConfig != null) |
| | | { |
| | | _renderer.material = MaterialLoader.LoadClothesMaterial(_modelResConfig.ID, false, false); |
| | | } |
| | | } |
| | | } |
| | | // var _modelResConfig = ModelResConfig.GetClothesConfig(_configName); |
| | | // if (_modelResConfig != null) |
| | | // { |
| | | // _renderer.material = MaterialLoader.LoadClothesMaterial(_modelResConfig.ID, false, false); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | var ids = config.Equips.Split('|'); |
| | | var weaponId = int.Parse(ids[0]); |
| | | var secondaryId = ids.Length > 1 ? int.Parse(ids[1]) : 0; |
| | | var wingId = ids.Length > 3 ? int.Parse(ids[3]) : 0; |
| | | // var ids = config.Equips.Split('|'); |
| | | // var weaponId = int.Parse(ids[0]); |
| | | // var secondaryId = ids.Length > 1 ? int.Parse(ids[1]) : 0; |
| | | // var wingId = ids.Length > 3 ? int.Parse(ids[3]) : 0; |
| | | |
| | | playerModel.Show(instance, job, weaponId, wingId, secondaryId, m_PlayerShowPoint); |
| | | playerModel.StandUp(); |
| | | // playerModel.Show(instance, job, weaponId, wingId, secondaryId, m_PlayerShowPoint); |
| | | // playerModel.StandUp(); |
| | | |
| | | m_PlayerShowPoint.localEulerAngles = Vector3.zero; |
| | | isShowingPlayer = true; |
| | | // m_PlayerShowPoint.localEulerAngles = Vector3.zero; |
| | | // isShowingPlayer = true; |
| | | |
| | | interactable = true; |
| | | m_ShowCamera.enabled = true; |
| | | BindGestureCatcher(rawImage, interactable); |
| | | } |
| | | else |
| | | { |
| | | ShowNPC(data.npcId, offset, eulerAngles, rawImage, data.gray, data.isDialogue); |
| | | } |
| | | } |
| | | // interactable = true; |
| | | // m_ShowCamera.enabled = true; |
| | | // BindGestureCatcher(rawImage, interactable); |
| | | // } |
| | | // else |
| | | // { |
| | | // ShowNPC(data.npcId, offset, eulerAngles, rawImage, data.gray, data.isDialogue); |
| | | // } |
| | | // } |
| | | |
| | | public void ShowNPC(int _npcId, Vector3 _localEulerAngles, RawImage _rawImage, bool _gray = false, bool _isDialogue = false) |
| | | { |
| | | ShowNPC(_npcId, Vector3.zero, _localEulerAngles, _rawImage, _gray, _isDialogue); |
| | | } |
| | | // public void ShowNPC(int _npcId, Vector3 _localEulerAngles, RawImage _rawImage, bool _gray = false, bool _isDialogue = false) |
| | | // { |
| | | // ShowNPC(_npcId, Vector3.zero, _localEulerAngles, _rawImage, _gray, _isDialogue); |
| | | // } |
| | | |
| | | public void ShowNPC(int _npcId, Vector3 _offset, Vector3 _localEulerAngles, RawImage _rawImage, bool _gray = false, bool _isDialogue = false) |
| | | { |
| | | StopShow(); |
| | | m_ShowCamera.enabled = true; |
| | | m_NPCId = _npcId; |
| | | // public void ShowNPC(int _npcId, Vector3 _offset, Vector3 _localEulerAngles, RawImage _rawImage, bool _gray = false, bool _isDialogue = false) |
| | | // { |
| | | // StopShow(); |
| | | // m_ShowCamera.enabled = true; |
| | | // m_NPCId = _npcId; |
| | | |
| | | var instance = UI3DModelFactory.LoadUINPC(_npcId); |
| | | if (instance == null) |
| | | { |
| | | return; |
| | | } |
| | | // var instance = UI3DModelFactory.LoadUINPC(_npcId); |
| | | // if (instance == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | |
| | | interactable = !_isDialogue; |
| | | isShowingNPC = true; |
| | | // interactable = !_isDialogue; |
| | | // isShowingNPC = true; |
| | | |
| | | if (!_isDialogue) |
| | | { |
| | | m_NPCShowPoint.localEulerAngles = _localEulerAngles; |
| | | } |
| | | // if (!_isDialogue) |
| | | // { |
| | | // m_NPCShowPoint.localEulerAngles = _localEulerAngles; |
| | | // } |
| | | |
| | | npcModel = instance; |
| | | var config = NPCConfig.Get(_npcId); |
| | | instance.transform.SetParentEx(_isDialogue ? m_DialogPoint : m_NPCShowPoint, _offset, Quaternion.identity, Vector3.one * config.UIModeLProportion); |
| | | if (config.NPCEffect != 0) |
| | | { |
| | | var effectConfig = EffectConfig.Get(config.NPCEffect); |
| | | var parent = instance.transform; |
| | | if (!string.IsNullOrEmpty(effectConfig.nodeName)) |
| | | { |
| | | parent = instance.transform.GetChildTransformDeeply(effectConfig.nodeName); |
| | | } |
| | | m_NpcEffect = SFXPlayUtility.Instance.PlayBattleEffect(config.NPCEffect, parent); |
| | | } |
| | | // npcModel = instance; |
| | | // var config = NPCConfig.Get(_npcId); |
| | | // instance.transform.SetParentEx(_isDialogue ? m_DialogPoint : m_NPCShowPoint, _offset, Quaternion.identity, Vector3.one * config.UIModeLProportion); |
| | | // if (config.NPCEffect != 0) |
| | | // { |
| | | // var effectConfig = EffectConfig.Get(config.NPCEffect); |
| | | // var parent = instance.transform; |
| | | // if (!string.IsNullOrEmpty(effectConfig.nodeName)) |
| | | // { |
| | | // parent = instance.transform.GetChildTransformDeeply(effectConfig.nodeName); |
| | | // } |
| | | // m_NpcEffect = SFXPlayUtility.Instance.PlayBattleEffect(config.NPCEffect, parent); |
| | | // } |
| | | |
| | | if (_isDialogue) |
| | | { |
| | | instance.transform.localEulerAngles = _localEulerAngles; |
| | | } |
| | | // if (_isDialogue) |
| | | // { |
| | | // instance.transform.localEulerAngles = _localEulerAngles; |
| | | // } |
| | | |
| | | instance.SetActive(true); |
| | | // instance.SetActive(true); |
| | | |
| | | if (npcModel) |
| | | { |
| | | ShowNpcEffect(npcModel.transform, config.MODE); |
| | | } |
| | | // if (npcModel) |
| | | // { |
| | | // ShowNpcEffect(npcModel.transform, config.MODE); |
| | | // } |
| | | |
| | | ResetCameraColor(_gray); |
| | | m_CameraColor.saturation = _gray ? 0.08f : 1f; |
| | | // ResetCameraColor(_gray); |
| | | // m_CameraColor.saturation = _gray ? 0.08f : 1f; |
| | | |
| | | if (_npcId == 10104001) |
| | | { |
| | | _rawImage.SetActive(false); |
| | | UI3DModelShowSpecialNPC.Display(npcModel); |
| | | } |
| | | else |
| | | { |
| | | BindGestureCatcher(_rawImage, interactable); |
| | | } |
| | | } |
| | | // if (_npcId == 10104001) |
| | | // { |
| | | // _rawImage.SetActive(false); |
| | | // UI3DModelShowSpecialNPC.Display(npcModel); |
| | | // } |
| | | // else |
| | | // { |
| | | // BindGestureCatcher(_rawImage, interactable); |
| | | // } |
| | | // } |
| | | |
| | | public void ShowPet(UI3DHorsePetData data, RawImage _rawImage) |
| | | { |
| | | StopShow(); |
| | | m_ShowCamera.enabled = true; |
| | | m_NPCId = data.id; |
| | | // public void ShowPet(UI3DHorsePetData data, RawImage _rawImage) |
| | | // { |
| | | // StopShow(); |
| | | // m_ShowCamera.enabled = true; |
| | | // m_NPCId = data.id; |
| | | |
| | | var instance = UI3DModelFactory.LoadUINPC(data.id); |
| | | if (instance == null) |
| | | { |
| | | return; |
| | | } |
| | | // var instance = UI3DModelFactory.LoadUINPC(data.id); |
| | | // if (instance == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | |
| | | interactable = true; |
| | | isShowingPet = true; |
| | | // interactable = true; |
| | | // isShowingPet = true; |
| | | |
| | | m_NPCShowPoint.localEulerAngles = data.localEulerAngles; |
| | | // m_NPCShowPoint.localEulerAngles = data.localEulerAngles; |
| | | |
| | | npcModel = instance; |
| | | var config = NPCConfig.Get(data.id); |
| | | instance.transform.SetParentEx(m_NPCShowPoint, data.offset, Quaternion.identity, Vector3.one * config.UIModeLProportion); |
| | | if (config.NPCEffect != 0) |
| | | { |
| | | var effectConfig = EffectConfig.Get(config.NPCEffect); |
| | | var parent = instance.transform; |
| | | if (!string.IsNullOrEmpty(effectConfig.nodeName)) |
| | | { |
| | | parent = instance.transform.GetChildTransformDeeply(effectConfig.nodeName); |
| | | } |
| | | m_NpcEffect = SFXPlayUtility.Instance.PlayBattleEffect(config.NPCEffect, parent); |
| | | } |
| | | // npcModel = instance; |
| | | // var config = NPCConfig.Get(data.id); |
| | | // instance.transform.SetParentEx(m_NPCShowPoint, data.offset, Quaternion.identity, Vector3.one * config.UIModeLProportion); |
| | | // if (config.NPCEffect != 0) |
| | | // { |
| | | // var effectConfig = EffectConfig.Get(config.NPCEffect); |
| | | // var parent = instance.transform; |
| | | // if (!string.IsNullOrEmpty(effectConfig.nodeName)) |
| | | // { |
| | | // parent = instance.transform.GetChildTransformDeeply(effectConfig.nodeName); |
| | | // } |
| | | // m_NpcEffect = SFXPlayUtility.Instance.PlayBattleEffect(config.NPCEffect, parent); |
| | | // } |
| | | |
| | | instance.SetActive(true); |
| | | // instance.SetActive(true); |
| | | |
| | | if (npcModel && data.skinIndex == 0) |
| | | { |
| | | ShowNpcEffect(npcModel.transform, config.MODE); |
| | | } |
| | | else |
| | | { |
| | | HideNpcEffect(); |
| | | } |
| | | // if (npcModel && data.skinIndex == 0) |
| | | // { |
| | | // ShowNpcEffect(npcModel.transform, config.MODE); |
| | | // } |
| | | // else |
| | | // { |
| | | // HideNpcEffect(); |
| | | // } |
| | | |
| | | if (npcModel && data.isRun) |
| | | { |
| | | var animator = npcModel.GetComponentInChildren<Animator>(); |
| | | if (animator != null) |
| | | { |
| | | m_SwtichAnimationCoroutine = StartCoroutine(Co_SwitchAnimation(animator, GAStaticDefine.State_RunHash)); |
| | | } |
| | | } |
| | | // if (npcModel && data.isRun) |
| | | // { |
| | | // var animator = npcModel.GetComponentInChildren<Animator>(); |
| | | // if (animator != null) |
| | | // { |
| | | // m_SwtichAnimationCoroutine = StartCoroutine(Co_SwitchAnimation(animator, GAStaticDefine.State_RunHash)); |
| | | // } |
| | | // } |
| | | |
| | | if (npcModel && data.skinIndex > 0) |
| | | { |
| | | var horsePetEffectId = petModel.GetPetHorseEffect(data.id, data.skinIndex); |
| | | var effectNode = petModel.GetPetHorseEffectNode(data.id, data.skinIndex); |
| | | if (horsePetEffectId != 0) |
| | | { |
| | | var parent = instance.transform; |
| | | if (!string.IsNullOrEmpty(effectNode)) |
| | | { |
| | | parent = npcModel.transform.GetChildTransformDeeply(effectNode); |
| | | } |
| | | horsePetEffect = SFXPlayUtility.Instance.Play(horsePetEffectId, parent); |
| | | if (horsePetEffect != null) |
| | | { |
| | | horsePetEffect.duration = 0f; |
| | | } |
| | | } |
| | | } |
| | | // if (npcModel && data.skinIndex > 0) |
| | | // { |
| | | // var horsePetEffectId = petModel.GetPetHorseEffect(data.id, data.skinIndex); |
| | | // var effectNode = petModel.GetPetHorseEffectNode(data.id, data.skinIndex); |
| | | // if (horsePetEffectId != 0) |
| | | // { |
| | | // var parent = instance.transform; |
| | | // if (!string.IsNullOrEmpty(effectNode)) |
| | | // { |
| | | // parent = npcModel.transform.GetChildTransformDeeply(effectNode); |
| | | // } |
| | | // horsePetEffect = SFXPlayUtility.Instance.Play(horsePetEffectId, parent); |
| | | // if (horsePetEffect != null) |
| | | // { |
| | | // horsePetEffect.duration = 0f; |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | ResetCameraColor(); |
| | | // ResetCameraColor(); |
| | | |
| | | if (data.id == 10104001) |
| | | { |
| | | _rawImage.SetActive(false); |
| | | UI3DModelShowSpecialNPC.Display(npcModel); |
| | | } |
| | | else |
| | | { |
| | | BindGestureCatcher(_rawImage, interactable); |
| | | } |
| | | } |
| | | // if (data.id == 10104001) |
| | | // { |
| | | // _rawImage.SetActive(false); |
| | | // UI3DModelShowSpecialNPC.Display(npcModel); |
| | | // } |
| | | // else |
| | | // { |
| | | // BindGestureCatcher(_rawImage, interactable); |
| | | // } |
| | | // } |
| | | |
| | | public void StopShow() |
| | | { |
| | | m_ShowCamera.enabled = false; |
| | | // public void StopShow() |
| | | // { |
| | | // m_ShowCamera.enabled = false; |
| | | |
| | | playerModel.Dispose(); |
| | | isShowingPlayer = false; |
| | | // playerModel.Dispose(); |
| | | // isShowingPlayer = false; |
| | | |
| | | if (m_SwtichAnimationCoroutine != null) |
| | | { |
| | | StopCoroutine(m_SwtichAnimationCoroutine); |
| | | m_SwtichAnimationCoroutine = null; |
| | | } |
| | | // if (m_SwtichAnimationCoroutine != null) |
| | | // { |
| | | // StopCoroutine(m_SwtichAnimationCoroutine); |
| | | // m_SwtichAnimationCoroutine = null; |
| | | // } |
| | | |
| | | if (m_NPCId != 0) |
| | | { |
| | | var config = NPCConfig.Get(m_NPCId); |
| | | if (config != null) |
| | | { |
| | | var job = 0; |
| | | if (config.MODE.Contains("A_Zs")) |
| | | { |
| | | job = 1; |
| | | } |
| | | else if (config.MODE.Contains("A_Fs")) |
| | | { |
| | | job = 2; |
| | | } |
| | | if (job != 0) |
| | | { |
| | | var _renderer = npcModel.GetComponentInChildren<SkinnedMeshRenderer>(); |
| | | if (_renderer) |
| | | { |
| | | MaterialLoader.Release(_renderer.material); |
| | | _renderer.material = _renderer.sharedMaterial = null; |
| | | _renderer.materials = _renderer.sharedMaterials = new Material[0]; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // if (m_NPCId != 0) |
| | | // { |
| | | // var config = NPCConfig.Get(m_NPCId); |
| | | // if (config != null) |
| | | // { |
| | | // var job = 0; |
| | | // if (config.MODE.Contains("A_Zs")) |
| | | // { |
| | | // job = 1; |
| | | // } |
| | | // else if (config.MODE.Contains("A_Fs")) |
| | | // { |
| | | // job = 2; |
| | | // } |
| | | // if (job != 0) |
| | | // { |
| | | // var _renderer = npcModel.GetComponentInChildren<SkinnedMeshRenderer>(); |
| | | // if (_renderer) |
| | | // { |
| | | // MaterialLoader.Release(_renderer.material); |
| | | // _renderer.material = _renderer.sharedMaterial = null; |
| | | // _renderer.materials = _renderer.sharedMaterials = new Material[0]; |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | |
| | | if (horsePetEffect != null) |
| | | { |
| | | if (horseModel != null) |
| | | { |
| | | horsePetEffect.SetParticleEmissionRateOverTime(0f); |
| | | // if (horsePetEffect != null) |
| | | // { |
| | | // if (horseModel != null) |
| | | // { |
| | | // horsePetEffect.SetParticleEmissionRateOverTime(0f); |
| | | |
| | | } |
| | | SFXPlayUtility.Instance.Release(horsePetEffect); |
| | | horsePetEffect = null; |
| | | } |
| | | // } |
| | | // SFXPlayUtility.Instance.Release(horsePetEffect); |
| | | // horsePetEffect = null; |
| | | // } |
| | | |
| | | if (npcModel != null) |
| | | { |
| | | npcModel.transform.localScale = Vector3.one; |
| | | if (m_NpcEffect != null) |
| | | { |
| | | SFXPlayUtility.Instance.Release(m_NpcEffect); |
| | | m_NpcEffect = null; |
| | | } |
| | | // if (npcModel != null) |
| | | // { |
| | | // npcModel.transform.localScale = Vector3.one; |
| | | // if (m_NpcEffect != null) |
| | | // { |
| | | // SFXPlayUtility.Instance.Release(m_NpcEffect); |
| | | // m_NpcEffect = null; |
| | | // } |
| | | |
| | | if (isShowingPet) |
| | | { |
| | | var animator = npcModel.GetComponentInChildren<Animator>(); |
| | | if (animator != null) |
| | | { |
| | | animator.Play(GAStaticDefine.State_IdleHash, 0); |
| | | } |
| | | } |
| | | // if (isShowingPet) |
| | | // { |
| | | // var animator = npcModel.GetComponentInChildren<Animator>(); |
| | | // if (animator != null) |
| | | // { |
| | | // animator.Play(GAStaticDefine.State_IdleHash, 0); |
| | | // } |
| | | // } |
| | | |
| | | UI3DModelFactory.ReleaseUINPC(m_NPCId, npcModel); |
| | | npcModel = null; |
| | | } |
| | | // UI3DModelFactory.ReleaseUINPC(m_NPCId, npcModel); |
| | | // npcModel = null; |
| | | // } |
| | | |
| | | m_NPCId = 0; |
| | | isShowingNPC = false; |
| | | isShowingPet = false; |
| | | // m_NPCId = 0; |
| | | // isShowingNPC = false; |
| | | // isShowingPet = false; |
| | | |
| | | if (horseModel != null) |
| | | { |
| | | horseModel.transform.localScale = Vector3.one; |
| | | var animator = horseModel.GetComponentInChildren<Animator>(); |
| | | if (animator != null) |
| | | { |
| | | animator.Play(GAStaticDefine.State_IdleHash, 0); |
| | | } |
| | | UI3DModelFactory.ReleaseUIHourse(m_HorseModelId, horseModel); |
| | | horseModel = null; |
| | | } |
| | | m_HorseModelId = 0; |
| | | isShowingHorse = false; |
| | | // if (horseModel != null) |
| | | // { |
| | | // horseModel.transform.localScale = Vector3.one; |
| | | // var animator = horseModel.GetComponentInChildren<Animator>(); |
| | | // if (animator != null) |
| | | // { |
| | | // animator.Play(GAStaticDefine.State_IdleHash, 0); |
| | | // } |
| | | // UI3DModelFactory.ReleaseUIHourse(m_HorseModelId, horseModel); |
| | | // horseModel = null; |
| | | // } |
| | | // m_HorseModelId = 0; |
| | | // isShowingHorse = false; |
| | | |
| | | if (wingModel != null) |
| | | { |
| | | wingModel.transform.localScale = Vector3.one; |
| | | UI3DModelFactory.ReleaseUIWing(m_WingModelId, wingModel); |
| | | wingModel = null; |
| | | } |
| | | m_WingModelId = 0; |
| | | // if (wingModel != null) |
| | | // { |
| | | // wingModel.transform.localScale = Vector3.one; |
| | | // UI3DModelFactory.ReleaseUIWing(m_WingModelId, wingModel); |
| | | // wingModel = null; |
| | | // } |
| | | // m_WingModelId = 0; |
| | | |
| | | if (equipmentModel != null) |
| | | { |
| | | UI3DModelFactory.ReleaseUIWing(m_EquipmentModelId, equipmentModel); |
| | | equipmentModel = null; |
| | | } |
| | | m_EquipmentModelId = 0; |
| | | isShowinEquipment = false; |
| | | // if (equipmentModel != null) |
| | | // { |
| | | // UI3DModelFactory.ReleaseUIWing(m_EquipmentModelId, equipmentModel); |
| | | // equipmentModel = null; |
| | | // } |
| | | // m_EquipmentModelId = 0; |
| | | // isShowinEquipment = false; |
| | | |
| | | if (godWeaponEffect != null) |
| | | { |
| | | SFXPlayUtility.Instance.Release(godWeaponEffect); |
| | | godWeaponEffect = null; |
| | | } |
| | | // if (godWeaponEffect != null) |
| | | // { |
| | | // SFXPlayUtility.Instance.Release(godWeaponEffect); |
| | | // godWeaponEffect = null; |
| | | // } |
| | | |
| | | UI3DModelShowSpecialNPC.Dispose(); |
| | | interactable = false; |
| | | } |
| | | // UI3DModelShowSpecialNPC.Dispose(); |
| | | // interactable = false; |
| | | // } |
| | | |
| | | public void ResetCameraColor(bool _enable = false) |
| | | { |
| | | m_CameraColor.enabled = _enable; |
| | | } |
| | | // public void ResetCameraColor(bool _enable = false) |
| | | // { |
| | | // m_CameraColor.enabled = _enable; |
| | | // } |
| | | |
| | | private void LateUpdate() |
| | | { |
| | | if (isShowinEquipment && ObjEquipment != null) |
| | | { |
| | | if (WindowCenter.Instance.IsOpen("FirstTimeRechargeWin")) |
| | | { |
| | | ObjEquipment.transform.Rotate(WindowCenter.Instance.Get<FirstTimeRechargeWin>().RotateVector * 1f, Space.Self); |
| | | } |
| | | if (WindowCenter.Instance.IsOpen("FirstChargeTrialWin")) |
| | | { |
| | | ObjEquipment.transform.Rotate(WindowCenter.Instance.Get<FirstChargeTrialWin>().RotateVector * 1f, Space.Self); |
| | | } |
| | | } |
| | | } |
| | | // private void LateUpdate() |
| | | // { |
| | | // if (isShowinEquipment && ObjEquipment != null) |
| | | // { |
| | | // if (WindowCenter.Instance.IsOpen("FirstTimeRechargeWin")) |
| | | // { |
| | | // ObjEquipment.transform.Rotate(WindowCenter.Instance.Get<FirstTimeRechargeWin>().RotateVector * 1f, Space.Self); |
| | | // } |
| | | // if (WindowCenter.Instance.IsOpen("FirstChargeTrialWin")) |
| | | // { |
| | | // ObjEquipment.transform.Rotate(WindowCenter.Instance.Get<FirstChargeTrialWin>().RotateVector * 1f, Space.Self); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | private void OnDrag3DModel(Vector2 deltaPosition) |
| | | { |
| | | if (!interactable) |
| | | { |
| | | return; |
| | | } |
| | | // private void OnDrag3DModel(Vector2 deltaPosition) |
| | | // { |
| | | // if (!interactable) |
| | | // { |
| | | // return; |
| | | // } |
| | | |
| | | if (isShowingPlayer) |
| | | { |
| | | m_PlayerShowPoint.localEulerAngles += new Vector3(0, -deltaPosition.x, 0); |
| | | } |
| | | // if (isShowingPlayer) |
| | | // { |
| | | // m_PlayerShowPoint.localEulerAngles += new Vector3(0, -deltaPosition.x, 0); |
| | | // } |
| | | |
| | | if (isShowingHorse) |
| | | { |
| | | m_HorseShowPoint.localEulerAngles += new Vector3(0, -deltaPosition.x, 0); |
| | | } |
| | | // if (isShowingHorse) |
| | | // { |
| | | // m_HorseShowPoint.localEulerAngles += new Vector3(0, -deltaPosition.x, 0); |
| | | // } |
| | | |
| | | if (isShowingNPC) |
| | | { |
| | | m_NPCShowPoint.localEulerAngles += new Vector3(0, -deltaPosition.x, 0); |
| | | } |
| | | // if (isShowingNPC) |
| | | // { |
| | | // m_NPCShowPoint.localEulerAngles += new Vector3(0, -deltaPosition.x, 0); |
| | | // } |
| | | |
| | | |
| | | if (isShowingPet) |
| | | { |
| | | m_NPCShowPoint.localEulerAngles += new Vector3(0, -deltaPosition.x, 0); |
| | | } |
| | | } |
| | | // if (isShowingPet) |
| | | // { |
| | | // m_NPCShowPoint.localEulerAngles += new Vector3(0, -deltaPosition.x, 0); |
| | | // } |
| | | // } |
| | | |
| | | private void ShowNpcEffect(Transform parent, string modelName) |
| | | { |
| | | HideNpcEffect(); |
| | | // private void ShowNpcEffect(Transform parent, string modelName) |
| | | // { |
| | | // HideNpcEffect(); |
| | | |
| | | var _boneList = ModelResConfig.GetBoneList(modelName); |
| | | var _effectlist = ModelResConfig.GetEffectList(modelName); |
| | | // var _boneList = ModelResConfig.GetBoneList(modelName); |
| | | // var _effectlist = ModelResConfig.GetEffectList(modelName); |
| | | |
| | | if (_boneList != null && _effectlist != null) |
| | | { |
| | | for (int i = 0; i < _boneList.Count; ++i) |
| | | { |
| | | if (_boneList[i].Equals("null")) |
| | | { |
| | | var _ctrl = SFXPlayUtility.Instance.PlayBattleEffect(_effectlist[i], parent); |
| | | m_BindEffectList.Add(_ctrl); |
| | | } |
| | | else |
| | | { |
| | | // if (_boneList != null && _effectlist != null) |
| | | // { |
| | | // for (int i = 0; i < _boneList.Count; ++i) |
| | | // { |
| | | // if (_boneList[i].Equals("null")) |
| | | // { |
| | | // var _ctrl = SFXPlayUtility.Instance.PlayBattleEffect(_effectlist[i], parent); |
| | | // m_BindEffectList.Add(_ctrl); |
| | | // } |
| | | // else |
| | | // { |
| | | |
| | | var _ctrl = SFXPlayUtility.Instance.PlayBattleEffect(_effectlist[i], parent.GetChildTransformDeeply(_boneList[i])); |
| | | m_BindEffectList.Add(_ctrl); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // var _ctrl = SFXPlayUtility.Instance.PlayBattleEffect(_effectlist[i], parent.GetChildTransformDeeply(_boneList[i])); |
| | | // m_BindEffectList.Add(_ctrl); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | private void HideNpcEffect() |
| | | { |
| | | foreach (var _ctrl in m_BindEffectList) |
| | | { |
| | | SFXPlayUtility.Instance.Release(_ctrl); |
| | | } |
| | | m_BindEffectList.Clear(); |
| | | } |
| | | // private void HideNpcEffect() |
| | | // { |
| | | // foreach (var _ctrl in m_BindEffectList) |
| | | // { |
| | | // SFXPlayUtility.Instance.Release(_ctrl); |
| | | // } |
| | | // m_BindEffectList.Clear(); |
| | | // } |
| | | |
| | | private void BindGestureCatcher(RawImage rawImage, bool interable) |
| | | { |
| | | if (rawImage == null) |
| | | { |
| | | return; |
| | | } |
| | | // private void BindGestureCatcher(RawImage rawImage, bool interable) |
| | | // { |
| | | // if (rawImage == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | |
| | | var x = rawImage.rectTransform.rect.height * 4f / 3; |
| | | var y = rawImage.rectTransform.rect.height; |
| | | rawImage.rectTransform.sizeDelta = new Vector2(x, y); |
| | | rawImage.texture = m_ShowCamera.targetTexture; |
| | | rawImage.material = MaterialUtility.GetGUIRenderTextureMaterial(); |
| | | rawImage.SetActive(true); |
| | | // var x = rawImage.rectTransform.rect.height * 4f / 3; |
| | | // var y = rawImage.rectTransform.rect.height; |
| | | // rawImage.rectTransform.sizeDelta = new Vector2(x, y); |
| | | // rawImage.texture = m_ShowCamera.targetTexture; |
| | | // rawImage.material = MaterialUtility.GetGUIRenderTextureMaterial(); |
| | | // rawImage.SetActive(true); |
| | | |
| | | if (interable) |
| | | { |
| | | rawImage.raycastTarget = true; |
| | | var gestureCatcher = rawImage.AddMissingComponent<GestureCatcher>(); |
| | | gestureCatcher.SetDragListener(OnDrag3DModel); |
| | | } |
| | | else |
| | | { |
| | | rawImage.raycastTarget = false; |
| | | } |
| | | } |
| | | // if (interable) |
| | | // { |
| | | // rawImage.raycastTarget = true; |
| | | // var gestureCatcher = rawImage.AddMissingComponent<GestureCatcher>(); |
| | | // gestureCatcher.SetDragListener(OnDrag3DModel); |
| | | // } |
| | | // else |
| | | // { |
| | | // rawImage.raycastTarget = false; |
| | | // } |
| | | // } |
| | | |
| | | IEnumerator Co_SwitchAnimation(Animator animator,int stateHash) |
| | | { |
| | | yield return null; |
| | | yield return null; |
| | | if (animator != null) |
| | | { |
| | | animator.Play(stateHash, 0); |
| | | } |
| | | } |
| | | // IEnumerator Co_SwitchAnimation(Animator animator,int stateHash) |
| | | // { |
| | | // yield return null; |
| | | // yield return null; |
| | | // if (animator != null) |
| | | // { |
| | | // animator.Play(stateHash, 0); |
| | | // } |
| | | // } |
| | | |
| | | } |
| | | // } |
| | | |
| | | public struct UI3DPlayerExhibitionData |
| | | { |
| | | public int job; |
| | | public int clothesId; |
| | | public int suitLevel; |
| | | public int weaponId; |
| | | public int wingsId; |
| | | public int secondaryId; |
| | | public int fashionClothesId; |
| | | public int fashionWeaponId; |
| | | public int fashionSecondaryId; |
| | | public int reikiRootEffectId; |
| | | public bool isDialogue; |
| | | public bool keepRotation; |
| | | public int equipLevel; |
| | | public float scale; |
| | | public int titleID; |
| | | } |
| | | // public struct UI3DPlayerExhibitionData |
| | | // { |
| | | // public int job; |
| | | // public int clothesId; |
| | | // public int suitLevel; |
| | | // public int weaponId; |
| | | // public int wingsId; |
| | | // public int secondaryId; |
| | | // public int fashionClothesId; |
| | | // public int fashionWeaponId; |
| | | // public int fashionSecondaryId; |
| | | // public int reikiRootEffectId; |
| | | // public bool isDialogue; |
| | | // public bool keepRotation; |
| | | // public int equipLevel; |
| | | // public float scale; |
| | | // public int titleID; |
| | | // } |
| | | |
| | | public struct UI3DNPCExhibitionData |
| | | { |
| | | public int npcId; |
| | | public bool gray; |
| | | public bool isDialogue; |
| | | } |
| | | // public struct UI3DNPCExhibitionData |
| | | // { |
| | | // public int npcId; |
| | | // public bool gray; |
| | | // public bool isDialogue; |
| | | // } |
| | | |
| | | |
| | | public struct UI3DHorsePetData |
| | | { |
| | | public int id; |
| | | public int skinIndex; |
| | | public bool isRun; |
| | | public Vector3 offset; |
| | | public Vector3 localEulerAngles; |
| | | } |
| | | } |
| | | // public struct UI3DHorsePetData |
| | | // { |
| | | // public int id; |
| | | // public int skinIndex; |
| | | // public bool isRun; |
| | | // public Vector3 offset; |
| | | // public Vector3 localEulerAngles; |
| | | // } |
| | | // } |
| | | |
| | | |
| | | |