From 4644a73ea0cb3726aa5a5c576a5bfa208f1fade4 Mon Sep 17 00:00:00 2001 From: reng Date: Thu, 20 Nov 2025 19:08:03 +0800 Subject: [PATCH] update --- Assets/Scenes/Scene-MOTY.unity | 100 ++++++++++++++++++++++++++----- Assets/Scripts/MotyOscHandler.cs | 29 +++++++-- 2 files changed, 110 insertions(+), 19 deletions(-) diff --git a/Assets/Scenes/Scene-MOTY.unity b/Assets/Scenes/Scene-MOTY.unity index 6392646..bd21ea5 100644 --- a/Assets/Scenes/Scene-MOTY.unity +++ b/Assets/Scenes/Scene-MOTY.unity @@ -848,6 +848,7 @@ MonoBehaviour: videoStandby: {fileID: 291798772} videoIntro: {fileID: 1629399498} videoEnding: {fileID: 1426676209} + videoAd: {fileID: 1499937801} mask: {fileID: 1255800685} _fadeDuration: 1 _hintDuration: 0.5 @@ -959,6 +960,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 291798771} + - {fileID: 1499937800} - {fileID: 1426676208} - {fileID: 1819050385} m_Father: {fileID: 473271735} @@ -1253,8 +1255,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 104, y: 0} - m_SizeDelta: {x: 208, y: 0} + m_AnchoredPosition: {x: 114.75, y: 0} + m_SizeDelta: {x: 229.5, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &366298495 MonoBehaviour: @@ -3497,8 +3499,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 384.125, y: -208} - m_SizeDelta: {x: 109.75, y: 0} + m_AnchoredPosition: {x: 707, y: -229.5} + m_SizeDelta: {x: 202, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &696492449 MonoBehaviour: @@ -4153,8 +4155,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 54.875, y: 0} - m_SizeDelta: {x: 208, y: 0} + m_AnchoredPosition: {x: 101, y: 0} + m_SizeDelta: {x: 229.5, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &830016229 MonoBehaviour: @@ -4763,8 +4765,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 104, y: 0} - m_SizeDelta: {x: 208, y: 0} + m_AnchoredPosition: {x: 114.75, y: 0} + m_SizeDelta: {x: 229.5, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1060364296 MonoBehaviour: @@ -5307,10 +5309,10 @@ RectTransform: - {fileID: 555167254} m_Father: {fileID: 1317646465} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 60, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 707.5, y: -60} + m_SizeDelta: {x: 0, y: 60} m_Pivot: {x: 1, y: 0} --- !u!114 &1255800684 MonoBehaviour: @@ -6218,6 +6220,76 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1494193408} m_CullTransparentMesh: 1 +--- !u!1 &1499937799 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1499937800} + - component: {fileID: 1499937801} + m_Layer: 5 + m_Name: Video Player-Ad + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &1499937800 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1499937799} + 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: [] + m_Father: {fileID: 337468572} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 100, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!328 &1499937801 +VideoPlayer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1499937799} + m_Enabled: 1 + m_VideoClip: {fileID: 32900000, guid: f318bc40e37de8f4fa449e6a7d83f667, type: 3} + m_TargetCameraAlpha: 1 + m_TargetCamera3DLayout: 0 + m_TargetCamera: {fileID: 0} + m_TargetTexture: {fileID: 8400000, guid: 6c974968dd7933a4daab7dba5fd02dfd, type: 2} + m_TimeReference: 0 + m_TargetMaterialRenderer: {fileID: 0} + m_TargetMaterialProperty: + m_RenderMode: 2 + m_AspectRatio: 5 + m_DataSource: 1 + m_TimeUpdateMode: 2 + m_PlaybackSpeed: 1 + m_AudioOutputMode: 0 + m_TargetAudioSources: [] + m_DirectAudioVolumes: [] + m_Url: file://../Material/moty/ad.mp4 + m_EnabledAudioTracks: + m_DirectAudioMutes: + m_ControlledAudioTrackCount: 0 + m_PlayOnAwake: 1 + m_SkipOnDrop: 1 + m_Looping: 0 + m_WaitForFirstFrame: 0 + m_FrameReadyEventEnabled: 0 + m_VideoShaders: [] --- !u!1 &1584358534 GameObject: m_ObjectHideFlags: 0 @@ -6851,8 +6923,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 219.5, y: -208} - m_SizeDelta: {x: 219.5, y: 0} + m_AnchoredPosition: {x: 404, y: -229.5} + m_SizeDelta: {x: 404, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1811530096 MonoBehaviour: diff --git a/Assets/Scripts/MotyOscHandler.cs b/Assets/Scripts/MotyOscHandler.cs index cc73f2c..5040162 100644 --- a/Assets/Scripts/MotyOscHandler.cs +++ b/Assets/Scripts/MotyOscHandler.cs @@ -29,6 +29,10 @@ public class MotyOscHandler : MonoBehaviour [SerializeField] public VideoPlayer videoEnding; + [SerializeField] + public VideoPlayer videoAd; + + [SerializeField] public Image mask; @@ -133,27 +137,39 @@ public class MotyOscHandler : MonoBehaviour videoIntro.time = 0f; videoIntro.Play(); - StartCoroutine(FadeCanvasGroup(intro, intro.alpha, 0f, _fadeDuration)); + if (intro.alpha > 0f) StartCoroutine(FadeCanvasGroup(intro, intro.alpha, 0f, _fadeDuration)); break; case "end": videoStandby.gameObject.SetActive(false); videoEnding.gameObject.SetActive(true); - + videoAd.gameObject.SetActive(false); + videoEnding.time = 0f; videoEnding.Play(); - StartCoroutine(FadeCanvasGroup(intro, intro.alpha, 1f, _fadeDuration)); + if (intro.alpha < 1f) StartCoroutine(FadeCanvasGroup(intro, intro.alpha, 1f, _fadeDuration)); break; case "standby": videoStandby.gameObject.SetActive(true); videoEnding.gameObject.SetActive(false); - + videoAd.gameObject.SetActive(false); + videoStandby.time = 0f; videoStandby.Play(); - StartCoroutine(FadeCanvasGroup(intro, intro.alpha, 1f, _fadeDuration)); + if (intro.alpha < 1f) StartCoroutine(FadeCanvasGroup(intro, intro.alpha, 1f, _fadeDuration)); + break; + case "ad": + videoStandby.gameObject.SetActive(false); + videoEnding.gameObject.SetActive(false); + videoAd.gameObject.SetActive(true); + + videoAd.time = 0f; + videoAd.Play(); + if (intro.alpha < 1f) StartCoroutine(FadeCanvasGroup(intro, intro.alpha, 1f, _fadeDuration)); break; case "reset": videoStandby.gameObject.SetActive(false); videoEnding.gameObject.SetActive(false); + videoAd.gameObject.SetActive(false); StartCoroutine(FadeCanvasGroup(intro, intro.alpha, 0f, _fadeDuration)); break; } @@ -216,6 +232,9 @@ public class MotyOscHandler : MonoBehaviour ToggleVideo("end"); + break; + case "ad": + ToggleVideo("ad"); break; default: Debug.LogWarning("Unknown status: " + status);