From 38f9b07b07ec2171010d14bc902401d9a5a740fd Mon Sep 17 00:00:00 2001 From: terric Date: Wed, 15 Nov 2023 01:01:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BC=B9=E5=87=BA=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/HudUI.cs | 66 +++++++ Assets/HudUI.cs.meta | 11 ++ Assets/Resources/Animation/Popup Wait.anim | 122 ++++++++++++ .../Resources/Animation/Popup Wait.anim.meta | 8 + Assets/Resources/Animation/Popup.controller | 2 +- Assets/Resources/UI/HUDRoot.prefab | 173 ++++++++++++++++++ Assets/Resources/UI/HUDRoot.prefab.meta | 7 + Assets/Resources/UI/PopupNotification.prefab | 2 - Assets/Scenes/YogaMain.unity | 125 +------------ Assets/Scripts/EventManager.cs | 2 + .../Scripts/PoseCheck/MotionCaptureManager.cs | 2 + Assets/Scripts/UI/NotificationPopupUI.cs | 34 ++-- Assets/Scripts/UI/UILoadConfig.cs | 1 + Assets/Scripts/UI/UIManager.cs | 49 +++-- ProjectSettings/ProjectSettings.asset | 5 +- 15 files changed, 451 insertions(+), 158 deletions(-) create mode 100644 Assets/HudUI.cs create mode 100644 Assets/HudUI.cs.meta create mode 100644 Assets/Resources/Animation/Popup Wait.anim create mode 100644 Assets/Resources/Animation/Popup Wait.anim.meta create mode 100644 Assets/Resources/UI/HUDRoot.prefab create mode 100644 Assets/Resources/UI/HUDRoot.prefab.meta diff --git a/Assets/HudUI.cs b/Assets/HudUI.cs new file mode 100644 index 0000000..6e443df --- /dev/null +++ b/Assets/HudUI.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + + +public class HudUI : UIHudBase +{ + private static Queue _msgHintQueue = new Queue(); + private NotificationPopupUI _hintPannel; + + private bool _isHintShowing = false; + + private void Awake() + { + _hintPannel = transform.Find("PopupNotification").GetComponent(); + _hintPannel.GetComponent().alpha = 0; + _msgHintQueue.Clear(); + } + + private void OnEnable() + { + EventManager.Instance.AddEventListener(YogaEventType.ShowHint, PushHint); + } + + private void OnDisable() + { + EventManager.Instance.RemoveEventListener(YogaEventType.ShowHint, PushHint); + } + + private void PushHint(object[] args) + { + var msg = new Msg(); + if (args.Length < 2) + throw new Exception("²ÎÊý´íÎó"); + msg.Title = args[0].ToString(); + msg.Content = args[1].ToString(); + _msgHintQueue.Enqueue(msg); + } + + public override void Init(object[] pageData) + { + base.Init(pageData); + } + + private void Update() + { + if (_msgHintQueue.Count > 0 && !_isHintShowing) + { + var msg = _msgHintQueue.Dequeue(); + StartCoroutine(ShowHint(msg)); + } + } + + private IEnumerator ShowHint(Msg msg) + { + _isHintShowing = true; + yield return _hintPannel.Show(msg.Title, msg.Content); + _isHintShowing = false; + } +} +internal class Msg +{ + public string Title { get; set; } + public string Content { get; set; } +} \ No newline at end of file diff --git a/Assets/HudUI.cs.meta b/Assets/HudUI.cs.meta new file mode 100644 index 0000000..be7eeb0 --- /dev/null +++ b/Assets/HudUI.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 685773266ab8a444e9ff5131cde3c8ae +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Animation/Popup Wait.anim b/Assets/Resources/Animation/Popup Wait.anim new file mode 100644 index 0000000..ed113d1 --- /dev/null +++ b/Assets/Resources/Animation/Popup Wait.anim @@ -0,0 +1,122 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Popup Wait + serializedVersion: 7 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_Alpha + path: + classID: 225 + script: {fileID: 0} + flags: 0 + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 1574349066 + script: {fileID: 0} + typeID: 225 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_Alpha + path: + classID: 225 + script: {fileID: 0} + flags: 0 + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Resources/Animation/Popup Wait.anim.meta b/Assets/Resources/Animation/Popup Wait.anim.meta new file mode 100644 index 0000000..121fd19 --- /dev/null +++ b/Assets/Resources/Animation/Popup Wait.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0123030b699cc2f4cadff610e9bc51f5 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Animation/Popup.controller b/Assets/Resources/Animation/Popup.controller index 60f970c..db57f4f 100644 --- a/Assets/Resources/Animation/Popup.controller +++ b/Assets/Resources/Animation/Popup.controller @@ -90,7 +90,7 @@ AnimatorState: m_MirrorParameterActive: 0 m_CycleOffsetParameterActive: 0 m_TimeParameterActive: 0 - m_Motion: {fileID: 7400000, guid: e6f95ed20d7d0454587557ad08f762c5, type: 2} + m_Motion: {fileID: 7400000, guid: 0123030b699cc2f4cadff610e9bc51f5, type: 2} m_Tag: m_SpeedParameter: m_MirrorParameter: diff --git a/Assets/Resources/UI/HUDRoot.prefab b/Assets/Resources/UI/HUDRoot.prefab new file mode 100644 index 0000000..7b723cd --- /dev/null +++ b/Assets/Resources/UI/HUDRoot.prefab @@ -0,0 +1,173 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &591297386902869668 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7882980980823895129} + - component: {fileID: 44101575073041383} + m_Layer: 5 + m_Name: HUDRoot + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7882980980823895129 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 591297386902869668} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1252863757881792527} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &44101575073041383 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 591297386902869668} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 685773266ab8a444e9ff5131cde3c8ae, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1001 &1332753061905480905 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 7882980980823895129} + m_Modifications: + - target: {fileID: 1350301964240770, guid: a5c1511e3af132c44b6f11542f709726, type: 3} + propertyPath: m_Name + value: PopupNotification + objectReference: {fileID: 0} + - target: {fileID: 224140982003034070, guid: a5c1511e3af132c44b6f11542f709726, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224140982003034070, guid: a5c1511e3af132c44b6f11542f709726, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224140982003034070, guid: a5c1511e3af132c44b6f11542f709726, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224140982003034070, guid: a5c1511e3af132c44b6f11542f709726, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224140982003034070, guid: a5c1511e3af132c44b6f11542f709726, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} + propertyPath: m_Pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} + propertyPath: m_SizeDelta.x + value: 400 + objectReference: {fileID: 0} + - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} + propertyPath: m_AnchoredPosition.x + value: 230 + objectReference: {fileID: 0} + - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} + propertyPath: m_AnchoredPosition.y + value: -100 + objectReference: {fileID: 0} + - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: a5c1511e3af132c44b6f11542f709726, type: 3} +--- !u!224 &1252863757881792527 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} + m_PrefabInstance: {fileID: 1332753061905480905} + m_PrefabAsset: {fileID: 0} diff --git a/Assets/Resources/UI/HUDRoot.prefab.meta b/Assets/Resources/UI/HUDRoot.prefab.meta new file mode 100644 index 0000000..22bf9f3 --- /dev/null +++ b/Assets/Resources/UI/HUDRoot.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 7ad6fce66f482004e87ca323e8da2520 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/UI/PopupNotification.prefab b/Assets/Resources/UI/PopupNotification.prefab index fa46893..a9e9058 100644 --- a/Assets/Resources/UI/PopupNotification.prefab +++ b/Assets/Resources/UI/PopupNotification.prefab @@ -281,8 +281,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 3be22eabbf04710439f8c8d016bd725c, type: 3} m_Name: m_EditorClassIdentifier: - Title: {fileID: 0} - Description: {fileID: 0} --- !u!1 &1517711807492522 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/YogaMain.unity b/Assets/Scenes/YogaMain.unity index e194102..07fdbdc 100644 --- a/Assets/Scenes/YogaMain.unity +++ b/Assets/Scenes/YogaMain.unity @@ -459,128 +459,6 @@ MonoBehaviour: mipBias: 0 varianceClampScale: 0.9 contrastAdaptiveSharpening: 0 ---- !u!1001 &1076621316 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 1763781738} - m_Modifications: - - target: {fileID: 1350301964240770, guid: a5c1511e3af132c44b6f11542f709726, type: 3} - propertyPath: m_Name - value: PopupNotification - objectReference: {fileID: 0} - - target: {fileID: 224140982003034070, guid: a5c1511e3af132c44b6f11542f709726, type: 3} - propertyPath: m_AnchorMax.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 224140982003034070, guid: a5c1511e3af132c44b6f11542f709726, type: 3} - propertyPath: m_AnchorMin.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 224140982003034070, guid: a5c1511e3af132c44b6f11542f709726, type: 3} - propertyPath: m_SizeDelta.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 224140982003034070, guid: a5c1511e3af132c44b6f11542f709726, type: 3} - propertyPath: m_AnchoredPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 224140982003034070, guid: a5c1511e3af132c44b6f11542f709726, type: 3} - propertyPath: m_AnchoredPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} - propertyPath: m_Pivot.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} - propertyPath: m_Pivot.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} - propertyPath: m_AnchorMax.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} - propertyPath: m_AnchorMax.y - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} - propertyPath: m_AnchorMin.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} - propertyPath: m_AnchorMin.y - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} - propertyPath: m_SizeDelta.x - value: 400 - objectReference: {fileID: 0} - - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} - propertyPath: m_SizeDelta.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} - propertyPath: m_AnchoredPosition.x - value: 230 - objectReference: {fileID: 0} - - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} - propertyPath: m_AnchoredPosition.y - value: -100 - objectReference: {fileID: 0} - - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: a5c1511e3af132c44b6f11542f709726, type: 3} ---- !u!224 &1076621317 stripped -RectTransform: - m_CorrespondingSourceObject: {fileID: 224602918499771590, guid: a5c1511e3af132c44b6f11542f709726, type: 3} - m_PrefabInstance: {fileID: 1076621316} - m_PrefabAsset: {fileID: 0} --- !u!1 &1190353382 GameObject: m_ObjectHideFlags: 0 @@ -1332,8 +1210,7 @@ RectTransform: m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 0, y: 0, z: 0} m_ConstrainProportionsScale: 1 - m_Children: - - {fileID: 1076621317} + m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 5, z: 0} m_AnchorMin: {x: 0, y: 0} diff --git a/Assets/Scripts/EventManager.cs b/Assets/Scripts/EventManager.cs index 6db175c..b625a64 100644 --- a/Assets/Scripts/EventManager.cs +++ b/Assets/Scripts/EventManager.cs @@ -82,4 +82,6 @@ public enum YogaEventType ActionFailed, PlayAnimation, UpdateProgress, + ShowHint, + ShowMessage, } \ No newline at end of file diff --git a/Assets/Scripts/PoseCheck/MotionCaptureManager.cs b/Assets/Scripts/PoseCheck/MotionCaptureManager.cs index 6b490ff..ce3cb28 100644 --- a/Assets/Scripts/PoseCheck/MotionCaptureManager.cs +++ b/Assets/Scripts/PoseCheck/MotionCaptureManager.cs @@ -218,6 +218,8 @@ namespace Yoga } AvatarAction actionType = (AvatarAction)args.FirstOrDefault(); + UIManager.Instance.ShowHint(actionType.ToString(), "Follow the robot!"); + //检测动作 var startTime = DateTime.Now; diff --git a/Assets/Scripts/UI/NotificationPopupUI.cs b/Assets/Scripts/UI/NotificationPopupUI.cs index 35ed45b..5f5d639 100644 --- a/Assets/Scripts/UI/NotificationPopupUI.cs +++ b/Assets/Scripts/UI/NotificationPopupUI.cs @@ -1,30 +1,34 @@ +using System; using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; -public class NotificationPopupUI : UIPopupBase +public class NotificationPopupUI : MonoBehaviour { - public TMP_Text Title; - public TMP_Text Description; + private TextMeshProUGUI _title; + private TextMeshProUGUI _description; + private Animator _animator; private void Awake() { - Title = transform.Find("Title").GetComponent(); - Description = transform.Find("Description").GetComponent(); + _title = transform.Find("Title").GetComponent(); + _description = transform.Find("Description").GetComponent(); + _animator = GetComponent(); + transform.gameObject.SetActive(true); + transform.GetComponent().alpha = 0; } - public override void Init(object[] pageData) + public IEnumerator Show(string title, string content) { - base.Init(pageData); - //args[0] = title, args[1] = description - Title.text = pageData[0].ToString(); - Description.text = pageData[1].ToString(); - } - - public override void OnEnter() - { - base.OnEnter(); + if (!transform.gameObject.activeSelf) + transform.gameObject.SetActive(true); + transform.GetComponent().alpha = 0; + _title.text = title; + _description.text = content; + _animator.Play("In"); + yield return new WaitForSeconds(3f); + _animator.Play("Out"); } } diff --git a/Assets/Scripts/UI/UILoadConfig.cs b/Assets/Scripts/UI/UILoadConfig.cs index 3f087ba..edc3761 100644 --- a/Assets/Scripts/UI/UILoadConfig.cs +++ b/Assets/Scripts/UI/UILoadConfig.cs @@ -13,6 +13,7 @@ public static class UILoadConfig { "ActionGuideVideoPanel" , "UI/ActionGuideVideoPanel" }, { "GuideUI" , "UI/GuideUI" }, { "ClearingSettlementUI" , "UI/ClearingSettlementUI" }, + { "HudUI" , "UI/HUDRoot" }, }; public static string GetPath(string typeName) diff --git a/Assets/Scripts/UI/UIManager.cs b/Assets/Scripts/UI/UIManager.cs index 14d4679..9e0c24a 100644 --- a/Assets/Scripts/UI/UIManager.cs +++ b/Assets/Scripts/UI/UIManager.cs @@ -6,6 +6,7 @@ using System.Linq; using OpenCVForUnity.CoreModule; using UnityEngine.SceneManagement; using Yoga; +using OpenCVForUnityExample; public class UIManager : MonoSingleton { @@ -16,10 +17,14 @@ public class UIManager : MonoSingleton private RectTransform _uiPanelRoot; private RectTransform _uiPopRoot; - private RectTransform _hudRoot; + + private HudUI _hud; private Transform _uiRootTrans; + //hud Ò³Ãæ + private NotificationPopupUI _hintPannel; + public override void Init() { //²éÕÒµ±Ç°sceneµÄÉãÏñ»ú @@ -79,17 +84,21 @@ public class UIManager : MonoSingleton //hud ¹ÒÔؽڵã if (transform.Find("HUDRoot") == null) { - _hudRoot = new GameObject("HUDRoot").AddComponent(); - _hudRoot.SetParent(_uiRootTrans); - _hudRoot.anchoredPosition = Vector2.zero; - _hudRoot.anchorMin = Vector2.zero; - _hudRoot.anchorMax = Vector2.one; - _hudRoot.offsetMin = Vector2.zero; - _hudRoot.offsetMax = Vector2.zero; + _hud = GetPanel(); + _hud.transform.SetParent(_uiRootTrans); + var rect = _hud.transform.GetComponent(); + rect.anchorMin = Vector2.zero; + rect.anchorMax = Vector2.one; + rect.pivot = new Vector2(0.5f, 0.5f); + rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, Screen.width); + rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, Screen.height); + rect.offsetMin = Vector2.zero; + rect.offsetMax = Vector2.zero; + _hud.Init(null); } else - _hudRoot = transform.Find("HUDRoot").GetComponent(); - _hudRoot.SetSiblingIndex(3); + _hud = transform.Find("HUDRoot").GetComponent(); + _hud.transform.SetSiblingIndex(3); } private T GetPanel() where T : UIBase @@ -111,9 +120,13 @@ public class UIManager : MonoSingleton else if (panel is UIPopupBase) panelGo.transform.SetParent(_uiPopRoot); else if (panel is UIHudBase) - panelGo.transform.SetParent(_hudRoot); + { + panelGo.transform.localPosition = Vector3.zero; + //hudÒ³Ãæ²»ÐèÒª»º´æ + return panel as T; + } else - throw new Exception("UIManager.GetPanel() : panel is not a type of UIPanelBase, UIPopupBase or UIHudBase"); + throw new Exception("UIManager.GetPanel() : panel is not a type of UIPanelBase, UIPopupBase"); panelGo.transform.localPosition = Vector3.zero; @@ -227,4 +240,16 @@ public class UIManager : MonoSingleton nextPanel.OnResume(); } } + + //hud Ò³Ãæ + public void ShowHint(string title, string content) + { + EventManager.Instance.Dispatch(YogaEventType.ShowHint, title, content); + } + + public void ShowMsgBox(string title, string content) + { + EventManager.Instance.Dispatch(YogaEventType.ShowMessage, title, content); + } } + diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index f117856..a5f7436 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -136,10 +136,7 @@ PlayerSettings: vulkanEnableCommandBufferRecycling: 1 loadStoreDebugModeEnabled: 0 bundleVersion: 0.13 - preloadedAssets: - - {fileID: 11400000, guid: e909ead19248db448b564bc342b7c221, type: 2} - - {fileID: 11400000, guid: 9bb62c82f36383440a845a9a59025c6f, type: 2} - - {fileID: 2671796653090180050, guid: b1802c783fe98e94a9bd4fd13519cef8, type: 2} + preloadedAssets: [] metroInputSource: 0 wsaTransparentSwapchain: 0 m_HolographicPauseOnTrackingLoss: 1