提交pv
This commit is contained in:
@@ -15,6 +15,10 @@ namespace GameFramework
|
||||
[SerializeField] Button settingsButton;
|
||||
[SerializeField] Button creditsButton;
|
||||
[SerializeField] Button quitButton;
|
||||
[SerializeField] Button storyReplayButton;
|
||||
|
||||
[Header("剧情 PV")]
|
||||
[SerializeField] StoryPVPlayer storyPVPlayer;
|
||||
|
||||
[Header("Settings Panel")]
|
||||
[SerializeField] GameObject settingsPanel;
|
||||
@@ -35,6 +39,15 @@ namespace GameFramework
|
||||
creditsButton = FindButton("CreditsButton");
|
||||
if (quitButton == null)
|
||||
quitButton = FindButton("QuitButton");
|
||||
if (storyReplayButton == null)
|
||||
storyReplayButton = FindButton("StoryReplayButton");
|
||||
if (storyPVPlayer == null)
|
||||
{
|
||||
// 使用 FindObjectsByType 包含 inactive 对象,避免找不到隐藏的 VideoOverlay
|
||||
var players = FindObjectsByType<StoryPVPlayer>(FindObjectsInactive.Include, FindObjectsSortMode.None);
|
||||
if (players.Length > 0)
|
||||
storyPVPlayer = players[0];
|
||||
}
|
||||
|
||||
if (settingsPanel == null)
|
||||
settingsPanel = GameObject.Find("SettingsPanel");
|
||||
@@ -55,6 +68,12 @@ namespace GameFramework
|
||||
creditsButton.onClick.AddListener(OnCreditsClick);
|
||||
if (quitButton != null)
|
||||
quitButton.onClick.AddListener(OnQuitClick);
|
||||
if (storyReplayButton != null)
|
||||
{
|
||||
// 避免 Inspector 中已绑定的事件导致重复触发
|
||||
storyReplayButton.onClick.RemoveAllListeners();
|
||||
storyReplayButton.onClick.AddListener(OnStoryReplayClick);
|
||||
}
|
||||
|
||||
if (settingsBackButton != null)
|
||||
settingsBackButton.onClick.AddListener(OnSettingsBackClick);
|
||||
@@ -119,5 +138,18 @@ namespace GameFramework
|
||||
Application.Quit();
|
||||
#endif
|
||||
}
|
||||
|
||||
void OnStoryReplayClick()
|
||||
{
|
||||
if (storyPVPlayer != null)
|
||||
{
|
||||
Debug.Log($"[MainMenu] 播放 PV, StoryPVPlayer on: {storyPVPlayer.gameObject.name}");
|
||||
storyPVPlayer.Play();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("[MainMenu] StoryPVPlayer 未配置!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user