Hide TipPanel at opening start, show it when opening finishes, and hide it when switching camera

This commit is contained in:
yangbear
2026-07-10 23:58:43 +08:00
parent fec97295be
commit b35afe1022
2 changed files with 14 additions and 11 deletions
@@ -94,14 +94,14 @@ public class OpeningFlowController : MonoBehaviour
{
Debug.Log($"[OpeningFlow] PlayOpeningFlow() 被调用, enable={_enableOpeningFlow}");
// 展示 TipPanel,一直保持到切换 camera2
// 开场动画开始,隐藏 TipPanel
var tipPanel = GameObject.Find("TipPanel");
if (tipPanel == null)
{
var allT = Resources.FindObjectsOfTypeAll<Transform>();
foreach(var t in allT) { if (t.name == "TipPanel") { tipPanel = t.gameObject; break; } }
}
if (tipPanel != null) tipPanel.SetActive(true);
if (tipPanel != null) tipPanel.SetActive(false);
// 再次确保开场隐藏鞋子
var shose = GameObject.Find("Shose");
@@ -177,14 +177,6 @@ public class OpeningFlowController : MonoBehaviour
private void SwitchToCamera2()
{
var tipPanel = GameObject.Find("TipPanel");
if (tipPanel == null)
{
var allT = Resources.FindObjectsOfTypeAll<Transform>();
foreach(var t in allT) { if (t.name == "TipPanel") { tipPanel = t.gameObject; break; } }
}
if (tipPanel != null) tipPanel.SetActive(false);
var cam2Go = GameObject.Find("camera2");
if (cam2Go != null) { var c = cam2Go.GetComponent<Camera>(); if (c != null) { c.enabled = true; Debug.Log("[OpeningFlow] camera2 已启用"); } }
else Debug.LogWarning("[OpeningFlow] 未找到 camera2");
+12 -1
View File
@@ -462,9 +462,20 @@ public class PageController : MonoBehaviour
Debug.Log($"PageController: 开始等待 {waitTime} 秒以切换摄像机并激活鞋子");
// --- 开场动画结束,开始显示 TipPanel,直到切换到 camera2 再由切换逻辑隐藏 ---
var tipPanel = GameObject.Find("TipPanel");
if (tipPanel == null)
{
var allT = Resources.FindObjectsOfTypeAll<Transform>();
foreach(var t in allT) { if (t.name == "TipPanel") { tipPanel = t.gameObject; break; } }
}
if (tipPanel != null) tipPanel.SetActive(true);
// ---------------------------------------------------------------------
yield return new WaitForSeconds(waitTime);
// 2. 切换到 camera3
// 2. 切换到 camera3 (注意原逻辑是切到 camera3,如果说是要在这里隐藏TipPanel)
if (tipPanel != null) tipPanel.SetActive(false);
if (am != null) am.SwitchToCamera3();
}