Petition-to-the-Gods-V3/Assets/Scripts/Server/ServerWorkSceneController.cs
2025-11-19 12:30:07 +08:00

257 lines
7.3 KiB
C#

using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.UI;
public class ServerWorkSceneController : MonoBehaviour
{
public static ServerWorkSceneController Instance;
public GameObject introPanel;
public GameObject messagePanel;
public GameObject messageReplyPanel;
public GameObject messageReplyWordsPanel;
public GameObject messageReplyWait1Panel;
public GameObject messageReplyWait1WorkingPanel;
public GameObject messageReplyWait2Panel;
public GameObject messageReplyWait2WorkingPanel;
public GameObject messageReplyExitPanel;
public GameObject messageReplyExitSurveyPanel;
public GameObject exitWorkPanel;
public GameObject messageReplyContinuePanel;
public GameObject gamePanel;
public GameObject gameTalkingPanel;
public GameObject gameTypingPanel;
public GameObject gameSticksPanel;
public GameObject gameWaittingPanel;
public GameObject gameFinalPanel;
public GameObject gameFinalSurveyPanel;
void Awake()
{
Instance = this;
}
private void OnEnable()
{
}
private void OnDisable()
{
Instance = null;
}
void Start()
{
SetupScene();
}
void SetupScene()
{
processStep(1);
}
public void processStep(int step)
{
if (introPanel)
{
introPanel.SetActive(step == 1 ? true : false);
if (step == 1)
{
ServerWorkMessagePanel.workMessageCount = 0;
ServerWorkMessagePanel.workMessage = "";
ServerWorkMessagePanel.workMessageType = "";
ServerWorkMessagePanel.workPresent = "";
}
}
if (messagePanel)
{
messagePanel.SetActive(step == 2 ? true : false);
if (step == 2)
{
}
}
if (messageReplyPanel)
{
messageReplyPanel.SetActive(step == 3 ? true : false);
}
if (messageReplyWordsPanel)
{
messageReplyWordsPanel.SetActive(step == 4 ? true : false);
}
if (messageReplyWait1Panel)
{
messageReplyWait1Panel.SetActive(step == 5 ? true : false);
if (ServerWorkMessageReplyWait1Panel.Instance)
{
if (step == 5)
{
ServerWorkMessageReplyWait1Panel.Instance.play();
}
else
{
ServerWorkMessageReplyWait1Panel.Instance.stop();
}
}
}
if (messageReplyWait1WorkingPanel)
{
messageReplyWait1WorkingPanel.SetActive(step == 6 ? true : false);
if (ServerWorkMessageReplyWait1WorkingPanel.Instance)
{
if (step == 6)
{
ServerWorkMessageReplyWait1WorkingPanel.Instance.play();
}
else
{
ServerWorkMessageReplyWait1WorkingPanel.Instance.stop();
}
}
}
if (messageReplyWait2Panel)
{
messageReplyWait2Panel.SetActive(step == 7 ? true : false);
if (ServerWorkMessageReplyWait2Panel.Instance)
{
if (step == 7)
{
ServerWorkMessageReplyWait2Panel.Instance.play();
}
else
{
ServerWorkMessageReplyWait2Panel.Instance.stop();
}
}
}
if (messageReplyWait2WorkingPanel)
{
messageReplyWait2WorkingPanel.SetActive(step == 8 ? true : false);
if (ServerWorkMessageReplyWait2WorkingPanel.Instance)
{
if (step == 8)
{
ServerWorkMessageReplyWait2WorkingPanel.Instance.play();
}
else
{
ServerWorkMessageReplyWait2WorkingPanel.Instance.stop();
}
}
}
if (messageReplyExitPanel)
{
messageReplyExitPanel.SetActive(step == 9 ? true : false);
if (ServerWorkMessageReplyExitPanel.Instance)
{
if (step == 9)
{
ServerWorkMessageReplyExitPanel.Instance.play();
}
else
{
ServerWorkMessageReplyExitPanel.Instance.stop();
}
}
}
if (messageReplyExitSurveyPanel)
{
messageReplyExitSurveyPanel.SetActive(step == 10 ? true : false);
}
if (exitWorkPanel)
{
exitWorkPanel.SetActive(step == 11 ? true : false);
if (ServerWorkExitWorkPanel.Instance)
{
if (step == 11)
{
ServerWorkExitWorkPanel.Instance.play();
}
else
{
ServerWorkExitWorkPanel.Instance.stop();
}
}
}
if (messageReplyContinuePanel)
{
messageReplyContinuePanel.SetActive(step == 12 ? true : false);
if (ServerWorkMessageReplyContinuePanel.Instance)
{
if (step == 12)
{
ServerWorkMessageReplyContinuePanel.Instance.play();
}
else
{
ServerWorkMessageReplyContinuePanel.Instance.stop();
}
}
}
if (gamePanel)
{
gamePanel.SetActive(step == 13 ? true : false);
if (step == 13)
{
//ServerGamePanel.nameOfTheGameWillBeOpened = "";
}
}
if (gameTalkingPanel)
{
gameTalkingPanel.SetActive(step == 14 ? true : false);
if (step == 14)
{
if (ServerGameTalkingPanel.Instance)
{
ServerGameTalkingPanel.Instance.init();
}
}
}
if (gameTypingPanel)
{
gameTypingPanel.SetActive(step == 15 ? true : false);
if (step == 15)
{
if (ServerGameTypingPanel.Instance)
{
ServerGameTypingPanel.Instance.init();
}
}
}
if (gameSticksPanel)
{
gameSticksPanel.SetActive(step == 16 ? true : false);
}
if (gameWaittingPanel)
{
gameWaittingPanel.SetActive(step == 17 ? true : false);
}
if (gameFinalPanel)
{
gameFinalPanel.SetActive(step == 18 ? true : false);
if (ServerWorkGameFinalPanel.Instance)
{
ServerWorkGameFinalPanel.Instance.init();
}
}
if (gameFinalSurveyPanel)
{
gameFinalSurveyPanel.SetActive(step == 19 ? true : false);
}
}
// ServerWorkSceneController.cs 腳本中
public void GoToGameWaitingPanel()
{
// 呼叫核心流程方法,將步驟設定為 17
processStep(17);
Debug.Log("Confirmed Sticks. Switching to Step 17 (Game Waiting Panel).");
}
}