浼樺寲
This commit is contained in:
parent
0941d5584d
commit
c9bc460ad7
@ -4,8 +4,9 @@
|
|||||||
"references": [
|
"references": [
|
||||||
"GUID:6055be8ebefd69e48b49212b09b47b2f",
|
"GUID:6055be8ebefd69e48b49212b09b47b2f",
|
||||||
"GUID:5553d74549d54e74cb548b3ab58a8483",
|
"GUID:5553d74549d54e74cb548b3ab58a8483",
|
||||||
|
"GUID:75b6f2078d190f14dbda4a5b747d709c",
|
||||||
"GUID:a19b414bea3b97240a91aeab9a8eab36",
|
"GUID:a19b414bea3b97240a91aeab9a8eab36",
|
||||||
"GUID:75b6f2078d190f14dbda4a5b747d709c"
|
"GUID:198eb6af143bbc4488e2779d96697e06"
|
||||||
],
|
],
|
||||||
"includePlatforms": [],
|
"includePlatforms": [],
|
||||||
"excludePlatforms": [],
|
"excludePlatforms": [],
|
||||||
|
@ -3,6 +3,7 @@ using UnityEngine;
|
|||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
using System;
|
using System;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using AudioType = AlicizaX.Audio.Runtime.AudioType;
|
||||||
|
|
||||||
namespace AlicizaX.UI.Extension
|
namespace AlicizaX.UI.Extension
|
||||||
{
|
{
|
||||||
@ -20,7 +21,7 @@ namespace AlicizaX.UI.Extension
|
|||||||
public class ButtonSoundCell
|
public class ButtonSoundCell
|
||||||
{
|
{
|
||||||
public ButtonSoundType ButtonSoundType = ButtonSoundType.Click;
|
public ButtonSoundType ButtonSoundType = ButtonSoundType.Click;
|
||||||
public int ButtonUISoundName = 10007;
|
public string ButtonUISoundName = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public delegate void ButtonBeginDragCallback(PointerEventData eventData);
|
public delegate void ButtonBeginDragCallback(PointerEventData eventData);
|
||||||
@ -31,7 +32,6 @@ namespace AlicizaX.UI.Extension
|
|||||||
|
|
||||||
public class UIButtonSuper : Button, IBeginDragHandler, IDragHandler, IEndDragHandler
|
public class UIButtonSuper : Button, IBeginDragHandler, IDragHandler, IEndDragHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
public List<ButtonSoundCell> m_ButtonUISounds = new List<ButtonSoundCell>();
|
public List<ButtonSoundCell> m_ButtonUISounds = new List<ButtonSoundCell>();
|
||||||
|
|
||||||
[Tooltip("是否可以点击")] public bool m_CanClick = true;
|
[Tooltip("是否可以点击")] public bool m_CanClick = true;
|
||||||
@ -169,7 +169,8 @@ namespace AlicizaX.UI.Extension
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// AlicizaFramework.SystemModule.Audio.Play(buttonSound.ButtonUISoundName);
|
|
||||||
|
GameApp.Audio.Play(AudioType.UISound, buttonSound.ButtonUISoundName, false, GameApp.Audio.UISoundVolume, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnPointerEnter(PointerEventData eventData)
|
public override void OnPointerEnter(PointerEventData eventData)
|
||||||
@ -237,6 +238,3 @@ namespace AlicizaX.UI.Extension
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
8
Runtime/UI3DWidget.meta
Normal file
8
Runtime/UI3DWidget.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c71e8ff5c53e58f4789054d9490f55dc
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
55
Runtime/UI3DWidget/UI3DDisplay.Touch.cs
Normal file
55
Runtime/UI3DWidget/UI3DDisplay.Touch.cs
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
// using UnityEngine;
|
||||||
|
// using UnityEngine.EventSystems;
|
||||||
|
//
|
||||||
|
// namespace AlicizaX.UI.Extension
|
||||||
|
// {
|
||||||
|
// public class UI3DDisplayTouch : MonoBehaviour, IPointerDownHandler, IPointerUpHandler, IDragHandler
|
||||||
|
// {
|
||||||
|
// private GameObject m_dragObject;
|
||||||
|
// private bool m_CanDrag = true;
|
||||||
|
// private float m_DragSpeed = 20.0f;
|
||||||
|
// private float m_DragRotation;
|
||||||
|
// private Vector3 m_ShowRotation = Vector3.zero;
|
||||||
|
// private Transform view;
|
||||||
|
//
|
||||||
|
// public void SetObject(GameObject obj)
|
||||||
|
// {
|
||||||
|
// m_dragObject = obj;
|
||||||
|
// m_ShowRotation = obj.transform.eulerAngles;
|
||||||
|
// view = obj.GetComponent<Transform>();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void Disopose()
|
||||||
|
// {
|
||||||
|
// m_dragObject = null;
|
||||||
|
// view = null;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// //拖拽
|
||||||
|
// public void OnDrag(PointerEventData eventData)
|
||||||
|
// {
|
||||||
|
// if (!m_CanDrag) return;
|
||||||
|
// if (!view) return;
|
||||||
|
// if (!m_dragObject || !(m_DragSpeed > 0.0f)) return;
|
||||||
|
//
|
||||||
|
// var delta = eventData.delta.x;
|
||||||
|
// var deltaRot = -m_DragSpeed * delta * Time.deltaTime;
|
||||||
|
//
|
||||||
|
// m_DragRotation += deltaRot;
|
||||||
|
// var showRotation = Quaternion.Euler(m_ShowRotation);
|
||||||
|
// var showUp = showRotation * Vector3.up;
|
||||||
|
// showRotation *= Quaternion.AngleAxis(m_DragRotation, showUp);
|
||||||
|
// view.rotation = showRotation;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// //按下
|
||||||
|
// public void OnPointerDown(PointerEventData eventData)
|
||||||
|
// {
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// //抬起
|
||||||
|
// public void OnPointerUp(PointerEventData eventData)
|
||||||
|
// {
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
11
Runtime/UI3DWidget/UI3DDisplay.Touch.cs.meta
Normal file
11
Runtime/UI3DWidget/UI3DDisplay.Touch.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6c7e5a7e59b57b941b930876a7839219
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
109
Runtime/UI3DWidget/UI3DDisplay.cs
Normal file
109
Runtime/UI3DWidget/UI3DDisplay.cs
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
// using System;
|
||||||
|
// using Sirenix.OdinInspector;
|
||||||
|
// using UnityEngine;
|
||||||
|
// using UnityEngine.UI;
|
||||||
|
//
|
||||||
|
// namespace AlicizaX.UI.Extension
|
||||||
|
// {
|
||||||
|
// [RequireComponent(typeof(RawImage))]
|
||||||
|
// public class UI3DDisplay : MonoBehaviour
|
||||||
|
// {
|
||||||
|
// private Camera m_Camera;
|
||||||
|
// private GameObject m_ShowObject;
|
||||||
|
// private RenderTexture m_ShowTexure;
|
||||||
|
// private UI3DDisplayTouch m_UI3DDisplayTouch;
|
||||||
|
//
|
||||||
|
// private RawImage m_ShowImage;
|
||||||
|
//
|
||||||
|
// [ReadOnly]
|
||||||
|
// [SerializeField]
|
||||||
|
// private int m_ResolutionX = 512;
|
||||||
|
//
|
||||||
|
// [SerializeField]
|
||||||
|
// [ReadOnly]
|
||||||
|
// private int m_ResolutionY = 512;
|
||||||
|
//
|
||||||
|
// private readonly int m_RenderTextureDepthBuffer = 16;
|
||||||
|
//
|
||||||
|
// void Awake()
|
||||||
|
// {
|
||||||
|
// UI3DDisplayHelper.UI3DDisplayHandler = this;
|
||||||
|
// m_ShowImage = GetComponent<RawImage>();
|
||||||
|
// m_UI3DDisplayTouch = GetComponentInChildren<UI3DDisplayTouch>();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// #if UNITY_EDITOR
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// [SerializeField] [Header("分辨率")] [OnValueChanged("OnEditResolutionChanged")]
|
||||||
|
// private int EditResolution = 512;
|
||||||
|
//
|
||||||
|
// private void OnEditResolutionChanged()
|
||||||
|
// {
|
||||||
|
// if (!getPlayingState) return;
|
||||||
|
// m_ResolutionX = EditResolution;
|
||||||
|
// m_ResolutionY = EditResolution;
|
||||||
|
// var rect = transform.GetComponent<RectTransform>();
|
||||||
|
// if (Math.Abs(rect.sizeDelta.x - m_ResolutionX) > 0.01f ||
|
||||||
|
// Math.Abs(rect.sizeDelta.y - m_ResolutionY) > 0.01f)
|
||||||
|
// rect.sizeDelta = new Vector2(m_ResolutionX, m_ResolutionY);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// [ShowIf("getPlayingState")] [SerializeField]
|
||||||
|
// GameObject previewPrefab;
|
||||||
|
//
|
||||||
|
// [ShowIf("getPlayingState")] [SerializeField]
|
||||||
|
// Camera previewCamera;
|
||||||
|
//
|
||||||
|
// bool getPlayingState => !Application.isPlaying;
|
||||||
|
//
|
||||||
|
// [Sirenix.OdinInspector.Button("预览")]
|
||||||
|
// private void Preview()
|
||||||
|
// {
|
||||||
|
// if (m_ShowObject != null)
|
||||||
|
// {
|
||||||
|
// UnityEngine.Object.DestroyImmediate(m_ShowObject);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// m_ShowObject = UnityEngine.Object.Instantiate(previewPrefab);
|
||||||
|
// m_Camera = previewCamera;
|
||||||
|
// if (m_ShowTexure != null)
|
||||||
|
// {
|
||||||
|
// RenderTexture.ReleaseTemporary(m_ShowTexure);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// m_ShowTexure = RenderTexture.GetTemporary(m_ResolutionX, m_ResolutionY, m_RenderTextureDepthBuffer);
|
||||||
|
// m_ShowObject.SetLayerRecursively(LayerDefine.UI3DObject);
|
||||||
|
// m_Camera.targetTexture = m_ShowTexure;
|
||||||
|
// GetComponent<RawImage>().texture = m_ShowTexure;
|
||||||
|
// }
|
||||||
|
// #endif
|
||||||
|
//
|
||||||
|
// public void SetUp(GameObject obj)
|
||||||
|
// {
|
||||||
|
// m_ShowObject = obj;
|
||||||
|
// m_Camera = CameraManaer.Instance.UI3DRenderCamera;
|
||||||
|
// if (m_ShowTexure != null)
|
||||||
|
// {
|
||||||
|
// RenderTexture.ReleaseTemporary(m_ShowTexure);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// m_ShowTexure = RenderTexture.GetTemporary(m_ResolutionX, m_ResolutionY, m_RenderTextureDepthBuffer);
|
||||||
|
// m_ShowObject.SetLayerRecursively(LayerDefine.UI3DObject);
|
||||||
|
// m_Camera.targetTexture = m_ShowTexure;
|
||||||
|
// m_ShowImage.texture = m_ShowTexure;
|
||||||
|
// m_UI3DDisplayTouch.SetObject(m_ShowObject);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// void OnDestroy()
|
||||||
|
// {
|
||||||
|
// m_UI3DDisplayTouch.Disopose();
|
||||||
|
// if (m_ShowTexure != null)
|
||||||
|
// {
|
||||||
|
// RenderTexture.ReleaseTemporary(m_ShowTexure);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
11
Runtime/UI3DWidget/UI3DDisplay.cs.meta
Normal file
11
Runtime/UI3DWidget/UI3DDisplay.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: deb3e5100b564344bb27065b64ae01d7
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user