| 
					
				 | 
			
			
				@@ -1,12 +1,14 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-using System; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-using UnityEngine; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using UnityEngine; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using UnityEngine.UI; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using UnityEngine.Video; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using YooAsset; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using GFGGame.Launcher; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using System.Collections; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using System; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 namespace GFGGame 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public class UICGView : SingletonBase<UICGView> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public class UICGView : SingletonMonoBase<UICGView> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private const float VideoWidth = 1920f; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private const float VideoHeight = 1080f; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -19,6 +21,7 @@ namespace GFGGame 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public void Show() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            MusicManager.Instance.Stop(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             string path = ResPathUtil.GetUUIPrefabPath("UICG"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             handle = YooAssets.LoadAssetSync<GameObject>(path); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             _ui = handle.InstantiateSync(UGUIManager.Instance.desktop.transform); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -39,15 +42,59 @@ namespace GFGGame 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             videoPlayer = _ui.transform.Find("VideoPlayer").GetComponent<VideoPlayer>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             videoPlayer.loopPointReached += OnVideoEnded; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            videoPlayer.prepareCompleted += OnVideoPrepared; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             string assetPath = ResPathUtil.GetVideoPath("cg"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             videoHandle = YooAssets.LoadRawFileSync(assetPath); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             videoPlayer.url = videoHandle.GetRawFilePath(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             videoPlayer.Play(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private void OnVideoPrepared(VideoPlayer source) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            videoPlayer.prepareCompleted -= OnVideoPrepared; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            StartCoroutine(FadeButtonOverTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        IEnumerator FadeButtonOverTime() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Image buttonImage = btnFullScreen.GetComponent<Image>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Text buttonText = btnFullScreen.GetComponentInChildren<Text>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            yield return new WaitForSeconds((float)videoPlayer.length - 3f); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (buttonImage != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // 获取初始颜色 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Color startColor = buttonImage.color; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Color startColorText = buttonText.color; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // 目标颜色,透明度设为 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Color targetColor = new Color(startColor.r, startColor.g, startColor.b, 0f); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Color targetColorText = new Color(startColorText.r, startColorText.g, startColorText.b, 0f); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                float fadeDuration = 1f; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // 记录开始时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                float startTime = Time.time; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                while (Time.time - startTime < fadeDuration) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    // 在一定时间内逐渐插值颜色 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    float t = (Time.time - startTime) / fadeDuration; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    buttonImage.color = Color.Lerp(startColor, targetColor, t); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    buttonText.color = Color.Lerp(startColorText, targetColorText, t); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    yield return null; // 等待下一帧 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // 设置最终颜色,确保透明度为 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                buttonImage.color = targetColor; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                buttonText.color = targetColorText; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private void OnVideoEnded(VideoPlayer source) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            videoPlayer.loopPointReached -= OnVideoEnded; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             this.Hide(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             StoryController.ShowLevelView(100001001); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 |