| | |
| | | [SerializeField] Transform m_NPCShowPoint;
|
| | | [SerializeField] Transform m_DialogPoint;
|
| | | [SerializeField] Transform m_EquipmentPoint;
|
| | | [SerializeField] Transform m_GodWeaponEffectPoint;
|
| | | [SerializeField] Camera m_ShowCamera;
|
| | | [SerializeField] bool m_Interactable = false;
|
| | | [SerializeField] UI3DModelInteractProcessor m_InteractProcessor;
|
| | | [SerializeField] ColorCorrectionCurves m_CameraColor;
|
| | |
|
| | | public bool interactable {
|
| | |
| | |
|
| | | Vector2 prePosition = Vector2.zero;
|
| | |
|
| | | PackModel playerPack { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
|
| | | EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } }
|
| | |
|
| | | public static UI3DModelExhibition Instance { get; private set; }
|
| | |
| | | playerModel.StandUp();
|
| | | }
|
| | |
|
| | | if (rawImage != null)
|
| | | {
|
| | | 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();
|
| | | m_InteractProcessor.rectTransform = rawImage.rectTransform;
|
| | | }
|
| | | BindGestureCatcher(rawImage, interactable);
|
| | | }
|
| | |
|
| | | public void ShowHourse(int modelId, RawImage rawImage)
|
| | | {
|
| | | StopShow();
|
| | | m_ShowCamera.enabled = true;
|
| | |
|
| | | if (rawImage != null)
|
| | | {
|
| | | 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();
|
| | | m_InteractProcessor.rectTransform = rawImage.rectTransform;
|
| | | }
|
| | |
|
| | | var instance = UI3DModelFactory.LoadUIHorse(modelId);
|
| | | if (instance == null)
|
| | |
| | | ResetCameraColor();
|
| | |
|
| | | ShowNpcEffect(instance.transform, modelConfig.ResourcesName);
|
| | |
|
| | | BindGestureCatcher(rawImage, interactable);
|
| | | }
|
| | |
|
| | | private GameObject ObjEquipment;
|
| | |
| | | instance.transform.SetParentEx(m_EquipmentPoint, Vector3.zero, localEulerAngles, Vector3.one);
|
| | | instance.SetActive(true);
|
| | | ResetCameraColor();
|
| | | if (rawImage != null)
|
| | | {
|
| | | 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();
|
| | | m_InteractProcessor.rectTransform = rawImage.rectTransform;
|
| | | }
|
| | | BindGestureCatcher(rawImage, interactable);
|
| | | }
|
| | |
|
| | | public void ShowWing(int _modelId, Vector3 _localEulerAngles, RawImage _rawImage)
|
| | | {
|
| | | StopShow();
|
| | |
|
| | | if (_rawImage != null)
|
| | | {
|
| | | 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();
|
| | | m_InteractProcessor.rectTransform = _rawImage.rectTransform;
|
| | | }
|
| | |
|
| | | var instance = UI3DModelFactory.LoadUIWing(_modelId);
|
| | | if (instance == null)
|
| | |
| | | {
|
| | | animator.Play("UI_Idle_Single");
|
| | | }
|
| | |
|
| | | BindGestureCatcher(_rawImage, interactable);
|
| | | }
|
| | |
|
| | | public void ShowNPC(RawImage rawImage, UI3DNPCExhibitionData data)
|
| | |
| | |
|
| | | interactable = true;
|
| | | m_ShowCamera.enabled = true;
|
| | | if (rawImage != null)
|
| | | {
|
| | | 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();
|
| | | m_InteractProcessor.rectTransform = rawImage.rectTransform;
|
| | | }
|
| | | BindGestureCatcher(rawImage, interactable);
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | StopShow();
|
| | | m_ShowCamera.enabled = true;
|
| | | m_NPCId = _npcId;
|
| | | if (_rawImage != null)
|
| | | {
|
| | | 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();
|
| | | m_InteractProcessor.rectTransform = _rawImage.rectTransform;
|
| | | }
|
| | |
|
| | | var instance = UI3DModelFactory.LoadUINPC(_npcId);
|
| | | if (instance == null)
|
| | |
| | | ResetCameraColor(_gray);
|
| | | m_CameraColor.saturation = _gray ? 0.08f : 1f;
|
| | |
|
| | | BindGestureCatcher(_rawImage, interactable);
|
| | | }
|
| | |
|
| | | public void StopShow()
|
| | |
| | | m_CameraColor.enabled = _enable;
|
| | | }
|
| | |
|
| | | private void Awake()
|
| | | {
|
| | | m_InteractProcessor.clickEvent += OnClick3DModel;
|
| | | m_InteractProcessor.beginDragEvent += OnBeginDrag3DModel;
|
| | | m_InteractProcessor.endDragEvent += OnEndDrag3DModel;
|
| | | m_InteractProcessor.dragingEvent += OnDrag3DModel;
|
| | | }
|
| | |
|
| | | private void OnDestroy()
|
| | | {
|
| | | m_InteractProcessor.clickEvent -= OnClick3DModel;
|
| | | m_InteractProcessor.beginDragEvent -= OnBeginDrag3DModel;
|
| | | m_InteractProcessor.endDragEvent -= OnEndDrag3DModel;
|
| | | m_InteractProcessor.dragingEvent -= OnDrag3DModel;
|
| | | }
|
| | |
|
| | | private void LateUpdate()
|
| | | {
|
| | | if (isShowinEquipment && ObjEquipment != null)
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private void OnBeginDrag3DModel(Vector2 _position)
|
| | | private void OnDrag3DModel(Vector2 deltaPosition)
|
| | | {
|
| | | if (!m_Interactable)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | prePosition = _position;
|
| | | }
|
| | |
|
| | | private void OnDrag3DModel(Vector2 _position)
|
| | | {
|
| | | if (!m_Interactable)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | var delta = _position - prePosition;
|
| | | if (isShowingPlayer)
|
| | | {
|
| | | m_PlayerShowPoint.localEulerAngles += new Vector3(0, -delta.x, 0);
|
| | | m_PlayerShowPoint.localEulerAngles += new Vector3(0, -deltaPosition.x, 0);
|
| | | }
|
| | |
|
| | | if (isShowingHorse)
|
| | | {
|
| | | m_HorseShowPoint.localEulerAngles += new Vector3(0, -delta.x, 0);
|
| | | m_HorseShowPoint.localEulerAngles += new Vector3(0, -deltaPosition.x, 0);
|
| | | }
|
| | |
|
| | | if (isShowingNPC)
|
| | | {
|
| | | m_NPCShowPoint.localEulerAngles += new Vector3(0, -delta.x, 0);
|
| | | }
|
| | |
|
| | | prePosition = _position;
|
| | | }
|
| | |
|
| | | private void OnEndDrag3DModel(Vector2 _position)
|
| | | {
|
| | | if (!m_Interactable)
|
| | | {
|
| | | return;
|
| | | }
|
| | | }
|
| | |
|
| | | private void OnClick3DModel()
|
| | | {
|
| | | if (!m_Interactable)
|
| | | {
|
| | | return;
|
| | | m_NPCShowPoint.localEulerAngles += new Vector3(0, -deltaPosition.x, 0);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | m_BindEffectList.Clear();
|
| | | }
|
| | |
|
| | | 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();
|
| | |
|
| | | if (interable)
|
| | | {
|
| | | rawImage.raycastTarget = true;
|
| | | var gestureCatcher = rawImage.AddMissingComponent<GestureCatcher>();
|
| | | gestureCatcher.SetDragListener(OnDrag3DModel);
|
| | | }
|
| | | else
|
| | | {
|
| | | rawImage.raycastTarget = false;
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | public struct UI3DPlayerExhibitionData
|