change to utf-8
This commit is contained in:
parent
2b9e24bafc
commit
7ef751b275
@ -20,11 +20,11 @@ public class ClientFinalSceneController : MonoBehaviour
|
||||
{
|
||||
SetupVideoPlayer();
|
||||
|
||||
// 開始播放影片
|
||||
// 開始播放影片
|
||||
if (videoPlayer != null)
|
||||
{
|
||||
videoPlayer.Play();
|
||||
Debug.Log("開始播放影片");
|
||||
Debug.Log("開始播放影片");
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,10 +32,10 @@ public class ClientFinalSceneController : MonoBehaviour
|
||||
{
|
||||
if (videoPlayer != null)
|
||||
{
|
||||
// 設置影片結束事件
|
||||
// 設置影片結束事件
|
||||
videoPlayer.loopPointReached += OnVideoFinished;
|
||||
|
||||
// 設置影片顯示
|
||||
// 設置影片顯示
|
||||
if (videoDisplay != null)
|
||||
{
|
||||
videoPlayer.targetTexture = null;
|
||||
@ -49,7 +49,7 @@ public class ClientFinalSceneController : MonoBehaviour
|
||||
|
||||
void OnVideoFinished(VideoPlayer vp)
|
||||
{
|
||||
Debug.Log("影片播放完成,準備跳轉");
|
||||
Debug.Log("影片播放完成,準備跳轉");
|
||||
StartCoroutine(LoadNextScene());
|
||||
}
|
||||
|
||||
|
||||
@ -20,11 +20,11 @@ public class ClientGameBackToRealSceneController : MonoBehaviour
|
||||
{
|
||||
SetupVideoPlayer();
|
||||
|
||||
// 開始播放影片
|
||||
// 開始播放影片
|
||||
if (videoPlayer != null)
|
||||
{
|
||||
videoPlayer.Play();
|
||||
Debug.Log("開始播放影片");
|
||||
Debug.Log("開始播放影片");
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,10 +32,10 @@ public class ClientGameBackToRealSceneController : MonoBehaviour
|
||||
{
|
||||
if (videoPlayer != null)
|
||||
{
|
||||
// 設置影片結束事件
|
||||
// 設置影片結束事件
|
||||
videoPlayer.loopPointReached += OnVideoFinished;
|
||||
|
||||
// 設置影片顯示
|
||||
// 設置影片顯示
|
||||
if (videoDisplay != null)
|
||||
{
|
||||
videoPlayer.targetTexture = null;
|
||||
@ -49,7 +49,7 @@ public class ClientGameBackToRealSceneController : MonoBehaviour
|
||||
|
||||
void OnVideoFinished(VideoPlayer vp)
|
||||
{
|
||||
Debug.Log("影片播放完成,準備跳轉");
|
||||
Debug.Log("影片播放完成,準備跳轉");
|
||||
if (!string.IsNullOrEmpty(ClientLastWordsSceneController.words))
|
||||
{
|
||||
StartCoroutine(LoadNextScene());
|
||||
|
||||
@ -57,7 +57,7 @@ public class ClientGameTalkingSceneController : MonoBehaviour
|
||||
ClientMessageHandler.Instance.SendMessageToServer("gameTalkingPeopleSay", playMessageInputField.text);
|
||||
}
|
||||
|
||||
playChatText.text = "<align=\"right\"><color=#63584A>-信眾-<br>" + playMessageInputField.text + "</color></align><br>" + playChatText.text;
|
||||
playChatText.text = "<align=\"right\"><color=#63584A>-信眾-<br>" + playMessageInputField.text + "</color></align><br>" + playChatText.text;
|
||||
playMessageInputField.text = "";
|
||||
}
|
||||
}
|
||||
@ -65,7 +65,7 @@ public class ClientGameTalkingSceneController : MonoBehaviour
|
||||
public void onReceivedChatMessage(string message)
|
||||
{
|
||||
|
||||
playChatText.text = "-神明-<br>" + message + "<br>" + playChatText.text;
|
||||
playChatText.text = "-神明-<br>" + message + "<br>" + playChatText.text;
|
||||
}
|
||||
|
||||
IEnumerator StatusCountdown()
|
||||
@ -74,7 +74,7 @@ public class ClientGameTalkingSceneController : MonoBehaviour
|
||||
|
||||
playCountdownSecVal--;
|
||||
|
||||
playCountdownText.text = "時間倒數 " + playCountdownSecVal.ToString() + "秒";
|
||||
playCountdownText.text = "時間倒數 " + playCountdownSecVal.ToString() + "秒";
|
||||
|
||||
if (playCountdownSecVal > 0)
|
||||
{
|
||||
|
||||
@ -35,7 +35,7 @@ public class ClientGameTypingSceneController : MonoBehaviour
|
||||
|
||||
playCountdownSecVal--;
|
||||
|
||||
playCountdownText.text = "時間倒數 " + playCountdownSecVal.ToString() + "秒";
|
||||
playCountdownText.text = "時間倒數 " + playCountdownSecVal.ToString() + "秒";
|
||||
|
||||
if (playCountdownSecVal > 0)
|
||||
{
|
||||
|
||||
@ -7,7 +7,7 @@ public class ClientGlobalMenuManager : MonoBehaviour
|
||||
{
|
||||
public static ClientGlobalMenuManager Instance;
|
||||
|
||||
[Header("UI 元件")]
|
||||
[Header("UI 元件")]
|
||||
public GameObject menuButton;
|
||||
public GameObject menuPanel;
|
||||
public Button homeButton;
|
||||
@ -20,7 +20,7 @@ public class ClientGlobalMenuManager : MonoBehaviour
|
||||
if (Instance == null)
|
||||
{
|
||||
Instance = this;
|
||||
// 將整個 Canvas 設為 DontDestroyOnLoad
|
||||
// 將整個 Canvas 設為 DontDestroyOnLoad
|
||||
if (transform.parent != null)
|
||||
{
|
||||
DontDestroyOnLoad(transform.root.gameObject);
|
||||
@ -44,11 +44,11 @@ public class ClientGlobalMenuManager : MonoBehaviour
|
||||
|
||||
void InitializeMenu()
|
||||
{
|
||||
// 確保選單面板一開始是隱藏的
|
||||
// 確保選單面板一開始是隱藏的
|
||||
if (menuPanel != null)
|
||||
menuPanel.SetActive(false);
|
||||
|
||||
// 綁定按鈕事件
|
||||
// 綁定按鈕事件
|
||||
if (menuButton != null)
|
||||
{
|
||||
Button btn = menuButton.GetComponent<Button>();
|
||||
@ -83,7 +83,7 @@ public class ClientGlobalMenuManager : MonoBehaviour
|
||||
skipButton.onClick.AddListener(SkipButton);
|
||||
}
|
||||
|
||||
Debug.Log("Client GlobalMenuManager 初始化完成");
|
||||
Debug.Log("Client GlobalMenuManager 初始化完成");
|
||||
}
|
||||
|
||||
|
||||
@ -92,7 +92,7 @@ public class ClientGlobalMenuManager : MonoBehaviour
|
||||
if (menuPanel != null)
|
||||
{
|
||||
menuPanel.SetActive(true);
|
||||
Debug.Log("選單已打開");
|
||||
Debug.Log("選單已打開");
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,20 +101,20 @@ public class ClientGlobalMenuManager : MonoBehaviour
|
||||
if (menuPanel != null)
|
||||
{
|
||||
menuPanel.SetActive(false);
|
||||
Debug.Log("選單已關閉");
|
||||
Debug.Log("選單已關閉");
|
||||
}
|
||||
}
|
||||
|
||||
void GoToHome()
|
||||
{
|
||||
Debug.Log("返回主頁");
|
||||
Debug.Log("返回主頁");
|
||||
SceneManager.LoadScene("ClientHomeScene");
|
||||
CloseMenu();
|
||||
}
|
||||
|
||||
void QuitApplication()
|
||||
{
|
||||
Debug.Log("離開程式");
|
||||
Debug.Log("離開程式");
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorApplication.isPlaying = false;
|
||||
#else
|
||||
|
||||
@ -10,7 +10,7 @@ public class ClientHomeSceneController : MonoBehaviour
|
||||
{
|
||||
public static ClientHomeSceneController Instance;
|
||||
|
||||
[Header("UI じン")]
|
||||
[Header("UI 元件")]
|
||||
public Button startButton;
|
||||
|
||||
void Awake()
|
||||
|
||||
@ -9,7 +9,7 @@ public class ClientHomeWaittingSceneController : MonoBehaviour
|
||||
{
|
||||
public static ClientHomeWaittingSceneController Instance;
|
||||
|
||||
[Header("UI 元件")]
|
||||
[Header("UI 元件")]
|
||||
public TMP_Text statusText;
|
||||
|
||||
private bool isConnecting = false;
|
||||
@ -35,7 +35,7 @@ public class ClientHomeWaittingSceneController : MonoBehaviour
|
||||
|
||||
if (statusText != null)
|
||||
{
|
||||
statusText.text = "等待神明的降臨";
|
||||
statusText.text = "等待神明的降臨";
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,28 +46,28 @@ public class ClientHomeWaittingSceneController : MonoBehaviour
|
||||
|
||||
if (statusText != null)
|
||||
{
|
||||
statusText.text = "等待神明的降臨.";
|
||||
statusText.text = "等待神明的降臨.";
|
||||
}
|
||||
|
||||
// 設置 NetworkManager
|
||||
// 設置 NetworkManager
|
||||
if (ClientNetworkManager.Instance != null)
|
||||
{
|
||||
//ClientNetworkManager.Instance.StopClient();
|
||||
ClientNetworkManager.Instance.networkAddress = ClientInitSceneController.ServerAddr;
|
||||
|
||||
// 使用 Telepathy (TCP) Transport
|
||||
// 使用 Telepathy (TCP) Transport
|
||||
TelepathyTransport transport = ClientNetworkManager.Instance.GetComponent<TelepathyTransport>();
|
||||
if (transport != null)
|
||||
{
|
||||
transport.port = ClientInitSceneController.ServerPort;
|
||||
}
|
||||
|
||||
// 開始連線
|
||||
// 開始連線
|
||||
ClientNetworkManager.Instance.StartClient();
|
||||
Debug.Log($"開始連線到 {ClientInitSceneController.ServerAddr}:{ClientInitSceneController.ServerPort}");
|
||||
Debug.Log($"開始連線到 {ClientInitSceneController.ServerAddr}:{ClientInitSceneController.ServerPort}");
|
||||
}
|
||||
|
||||
// 等待連線
|
||||
// 等待連線
|
||||
float timeout = 3f;
|
||||
float elapsed = 0f;
|
||||
|
||||
@ -79,11 +79,11 @@ public class ClientHomeWaittingSceneController : MonoBehaviour
|
||||
|
||||
if (NetworkClient.isConnected)
|
||||
{
|
||||
Debug.Log("連線成功!等待 Welcome 訊息...");
|
||||
Debug.Log("連線成功!等待 Welcome 訊息...");
|
||||
|
||||
if (statusText != null)
|
||||
{
|
||||
statusText.text = "等待神明的降臨..";
|
||||
statusText.text = "等待神明的降臨..";
|
||||
}
|
||||
|
||||
// send welcome
|
||||
@ -93,16 +93,16 @@ public class ClientHomeWaittingSceneController : MonoBehaviour
|
||||
ClientMessageHandler.Instance.SendMessageToServer("welcome", "hello");
|
||||
}
|
||||
|
||||
// 等待 Welcome 訊息
|
||||
// 等待 Welcome 訊息
|
||||
yield return StartCoroutine(WaitForWelcomeMessage());
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("連線失敗!");
|
||||
Debug.LogError("連線失敗!");
|
||||
|
||||
if (statusText != null)
|
||||
{
|
||||
statusText.text = "等待神明的降臨...!";
|
||||
statusText.text = "等待神明的降臨...!";
|
||||
}
|
||||
|
||||
isConnecting = false;
|
||||
@ -124,11 +124,11 @@ public class ClientHomeWaittingSceneController : MonoBehaviour
|
||||
|
||||
if (!welcomeReceived)
|
||||
{
|
||||
Debug.LogError("未收到 Welcome 訊息!");
|
||||
Debug.LogError("未收到 Welcome 訊息!");
|
||||
|
||||
if (statusText != null)
|
||||
{
|
||||
statusText.text = "等待神明的降臨...!!";
|
||||
statusText.text = "等待神明的降臨...!!";
|
||||
}
|
||||
|
||||
isConnecting = false;
|
||||
@ -139,11 +139,11 @@ public class ClientHomeWaittingSceneController : MonoBehaviour
|
||||
public void OnWelcomeMessageReceived()
|
||||
{
|
||||
welcomeReceived = true;
|
||||
Debug.Log("Welcome 訊息已驗證,準備跳轉場景");
|
||||
Debug.Log("Welcome 訊息已驗證,準備跳轉場景");
|
||||
|
||||
if (statusText != null)
|
||||
{
|
||||
statusText.text = "等待神明的降臨...";
|
||||
statusText.text = "等待神明的降臨...";
|
||||
}
|
||||
|
||||
StartCoroutine(LoadIntroScene());
|
||||
|
||||
@ -38,7 +38,7 @@ public class ClientInitSceneController : MonoBehaviour
|
||||
|
||||
void InitializeClient()
|
||||
{
|
||||
Debug.Log("ªì©l¤Æ Client...");
|
||||
Debug.Log("初始化 Client...");
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ public class ClientIntroSceneController : MonoBehaviour
|
||||
{
|
||||
public static ClientIntroSceneController Instance;
|
||||
|
||||
[Header("影片播放")]
|
||||
[Header("影片播放")]
|
||||
public VideoPlayer videoPlayer;
|
||||
public RawImage videoDisplay;
|
||||
|
||||
@ -21,11 +21,11 @@ public class ClientIntroSceneController : MonoBehaviour
|
||||
{
|
||||
SetupVideoPlayer();
|
||||
|
||||
// 開始播放影片
|
||||
// 開始播放影片
|
||||
if (videoPlayer != null)
|
||||
{
|
||||
videoPlayer.Play();
|
||||
Debug.Log("開始播放介紹影片");
|
||||
Debug.Log("開始播放介紹影片");
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,10 +33,10 @@ public class ClientIntroSceneController : MonoBehaviour
|
||||
{
|
||||
if (videoPlayer != null)
|
||||
{
|
||||
// 設置影片結束事件
|
||||
// 設置影片結束事件
|
||||
videoPlayer.loopPointReached += OnVideoFinished;
|
||||
|
||||
// 設置影片顯示
|
||||
// 設置影片顯示
|
||||
if (videoDisplay != null)
|
||||
{
|
||||
videoPlayer.targetTexture = null;
|
||||
@ -50,7 +50,7 @@ public class ClientIntroSceneController : MonoBehaviour
|
||||
|
||||
void OnVideoFinished(VideoPlayer vp)
|
||||
{
|
||||
Debug.Log("影片播放完成,準備跳轉到 ClientWorkScene");
|
||||
Debug.Log("影片播放完成,準備跳轉到 ClientWorkScene");
|
||||
StartCoroutine(LoadNextScene());
|
||||
}
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ public class ClientMessageHandler : MonoBehaviour
|
||||
|
||||
void OnServerMessageReceived(GameMessage msg)
|
||||
{
|
||||
Debug.Log($"收到 Server 訊息: {msg.action} {msg.payload}");
|
||||
Debug.Log($"收到 Server 訊息: {msg.action} {msg.payload}");
|
||||
|
||||
try
|
||||
{
|
||||
@ -42,7 +42,7 @@ public class ClientMessageHandler : MonoBehaviour
|
||||
switch(msg.payload)
|
||||
{
|
||||
case "hello":
|
||||
Debug.Log("Welcome 訊息驗證成功");
|
||||
Debug.Log("Welcome 訊息驗證成功");
|
||||
|
||||
// clean data
|
||||
ClientWorkMessageHandleSceneController.cleanData();
|
||||
@ -107,7 +107,7 @@ public class ClientMessageHandler : MonoBehaviour
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError($"解析 JSON 失敗: {e.Message}");
|
||||
Debug.LogError($"解析 JSON 失敗: {e.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,11 +117,11 @@ public class ClientMessageHandler : MonoBehaviour
|
||||
{
|
||||
GameMessage msg = new GameMessage { action = action, payload = message };
|
||||
NetworkClient.Send(msg);
|
||||
Debug.Log($"發送訊息到 Server: {message}");
|
||||
Debug.Log($"發送訊息到 Server: {message}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"發送訊息到 Server 失敗: {message}");
|
||||
Debug.LogError($"發送訊息到 Server 失敗: {message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ public class ClientNetworkManager : NetworkManager
|
||||
public override void OnClientConnect()
|
||||
{
|
||||
base.OnClientConnect();
|
||||
Debug.Log("Client 已連接到 Server");
|
||||
Debug.Log("Client 已連接到 Server");
|
||||
if (ClientMessageHandler.Instance != null)
|
||||
{
|
||||
ClientMessageHandler.Instance.RegisterHandler();
|
||||
@ -35,7 +35,7 @@ public class ClientNetworkManager : NetworkManager
|
||||
ClientMessageHandler.Instance.UnregisterHandler();
|
||||
}
|
||||
base.OnClientDisconnect();
|
||||
Debug.Log("Client 已斷開連接");
|
||||
Debug.Log("Client 已斷開連接");
|
||||
}
|
||||
|
||||
}
|
||||
@ -9,7 +9,7 @@ public class ClientWorkMessageFinishSceneController : MonoBehaviour
|
||||
{
|
||||
public static ClientWorkMessageFinishSceneController Instance;
|
||||
|
||||
[Header("影片播放")]
|
||||
[Header("影片播放")]
|
||||
public VideoPlayer videoPlayer;
|
||||
public RawImage videoDisplay;
|
||||
|
||||
@ -22,11 +22,11 @@ public class ClientWorkMessageFinishSceneController : MonoBehaviour
|
||||
{
|
||||
SetupVideoPlayer();
|
||||
|
||||
// 開始播放影片
|
||||
// 開始播放影片
|
||||
if (videoPlayer != null)
|
||||
{
|
||||
videoPlayer.Play();
|
||||
Debug.Log("開始播放影片");
|
||||
Debug.Log("開始播放影片");
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,10 +34,10 @@ public class ClientWorkMessageFinishSceneController : MonoBehaviour
|
||||
{
|
||||
if (videoPlayer != null)
|
||||
{
|
||||
// 設置影片結束事件
|
||||
// 設置影片結束事件
|
||||
videoPlayer.loopPointReached += OnVideoFinished;
|
||||
|
||||
// 設置影片顯示
|
||||
// 設置影片顯示
|
||||
if (videoDisplay != null)
|
||||
{
|
||||
videoPlayer.targetTexture = null;
|
||||
@ -51,7 +51,7 @@ public class ClientWorkMessageFinishSceneController : MonoBehaviour
|
||||
|
||||
void OnVideoFinished(VideoPlayer vp)
|
||||
{
|
||||
Debug.Log("影片播放完成,準備跳轉");
|
||||
Debug.Log("影片播放完成,準備跳轉");
|
||||
StartCoroutine(LoadNextScene());
|
||||
}
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ public class ClientWorkMessageHandleSceneController : MonoBehaviour
|
||||
public static string messageResult = "";
|
||||
public static string messageResultText = "";
|
||||
|
||||
[Header("影片播放")]
|
||||
[Header("影片播放")]
|
||||
public VideoPlayer videoPlayer;
|
||||
public RawImage videoDisplay;
|
||||
|
||||
@ -32,11 +32,11 @@ public class ClientWorkMessageHandleSceneController : MonoBehaviour
|
||||
{
|
||||
SetupVideoPlayer();
|
||||
|
||||
// 開始播放影片
|
||||
// 開始播放影片
|
||||
if (videoPlayer != null)
|
||||
{
|
||||
videoPlayer.Play();
|
||||
Debug.Log("開始播放影片");
|
||||
Debug.Log("開始播放影片");
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,10 +44,10 @@ public class ClientWorkMessageHandleSceneController : MonoBehaviour
|
||||
{
|
||||
if (videoPlayer != null)
|
||||
{
|
||||
// 設置影片結束事件
|
||||
// 設置影片結束事件
|
||||
videoPlayer.loopPointReached += OnVideoFinished;
|
||||
|
||||
// 設置影片顯示
|
||||
// 設置影片顯示
|
||||
if (videoDisplay != null)
|
||||
{
|
||||
videoPlayer.targetTexture = null;
|
||||
@ -62,7 +62,7 @@ public class ClientWorkMessageHandleSceneController : MonoBehaviour
|
||||
|
||||
void OnVideoFinished(VideoPlayer vp)
|
||||
{
|
||||
//Debug.Log("影片播放完成,準備跳轉到 ClientWorkScene");
|
||||
//Debug.Log("影片播放完成,準備跳轉到 ClientWorkScene");
|
||||
//StartCoroutine(LoadNextScene());
|
||||
}
|
||||
|
||||
|
||||
@ -28,10 +28,10 @@ public class ClientWorkMessageResultExitSceneController : MonoBehaviour
|
||||
}
|
||||
if (step2VideoPlayer != null)
|
||||
{
|
||||
// 砞竚紇<EFBFBD>挡<EFBFBD>ㄆン
|
||||
// 設置影片結束事件
|
||||
step2VideoPlayer.loopPointReached += step2VideoPlayer_onVideoFinished;
|
||||
|
||||
// 砞竚紇<EFBFBD>陪ボ
|
||||
// 設置影片顯示
|
||||
if (step2RawImage != null)
|
||||
{
|
||||
step2VideoPlayer.targetTexture = null;
|
||||
|
||||
@ -9,7 +9,7 @@ public class ClientWorkMessageResultNoSceneController : MonoBehaviour
|
||||
{
|
||||
public static ClientWorkMessageResultNoSceneController Instance;
|
||||
|
||||
[Header("影片播放")]
|
||||
[Header("影片播放")]
|
||||
public VideoPlayer videoPlayer;
|
||||
public RawImage videoDisplay;
|
||||
|
||||
@ -22,11 +22,11 @@ public class ClientWorkMessageResultNoSceneController : MonoBehaviour
|
||||
{
|
||||
SetupVideoPlayer();
|
||||
|
||||
// 開始播放影片
|
||||
// 開始播放影片
|
||||
if (videoPlayer != null)
|
||||
{
|
||||
videoPlayer.Play();
|
||||
Debug.Log("開始播放影片");
|
||||
Debug.Log("開始播放影片");
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,10 +34,10 @@ public class ClientWorkMessageResultNoSceneController : MonoBehaviour
|
||||
{
|
||||
if (videoPlayer != null)
|
||||
{
|
||||
// 設置影片結束事件
|
||||
// 設置影片結束事件
|
||||
videoPlayer.loopPointReached += OnVideoFinished;
|
||||
|
||||
// 設置影片顯示
|
||||
// 設置影片顯示
|
||||
if (videoDisplay != null)
|
||||
{
|
||||
videoPlayer.targetTexture = null;
|
||||
@ -51,7 +51,7 @@ public class ClientWorkMessageResultNoSceneController : MonoBehaviour
|
||||
|
||||
void OnVideoFinished(VideoPlayer vp)
|
||||
{
|
||||
Debug.Log("影片播放完成,準備跳轉");
|
||||
Debug.Log("影片播放完成,準備跳轉");
|
||||
StartCoroutine(LoadNextScene());
|
||||
}
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ public class ClientWorkMessageResultNotSureSceneController : MonoBehaviour
|
||||
{
|
||||
public static ClientWorkMessageResultNotSureSceneController Instance;
|
||||
|
||||
[Header("影片播放")]
|
||||
[Header("影片播放")]
|
||||
public VideoPlayer videoPlayer;
|
||||
public RawImage videoDisplay;
|
||||
|
||||
@ -22,11 +22,11 @@ public class ClientWorkMessageResultNotSureSceneController : MonoBehaviour
|
||||
{
|
||||
SetupVideoPlayer();
|
||||
|
||||
// 開始播放影片
|
||||
// 開始播放影片
|
||||
if (videoPlayer != null)
|
||||
{
|
||||
videoPlayer.Play();
|
||||
Debug.Log("開始播放影片");
|
||||
Debug.Log("開始播放影片");
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,10 +34,10 @@ public class ClientWorkMessageResultNotSureSceneController : MonoBehaviour
|
||||
{
|
||||
if (videoPlayer != null)
|
||||
{
|
||||
// 設置影片結束事件
|
||||
// 設置影片結束事件
|
||||
videoPlayer.loopPointReached += OnVideoFinished;
|
||||
|
||||
// 設置影片顯示
|
||||
// 設置影片顯示
|
||||
if (videoDisplay != null)
|
||||
{
|
||||
videoPlayer.targetTexture = null;
|
||||
@ -51,7 +51,7 @@ public class ClientWorkMessageResultNotSureSceneController : MonoBehaviour
|
||||
|
||||
void OnVideoFinished(VideoPlayer vp)
|
||||
{
|
||||
Debug.Log("影片播放完成,準備跳轉");
|
||||
Debug.Log("影片播放完成,準備跳轉");
|
||||
StartCoroutine(LoadNextScene());
|
||||
}
|
||||
|
||||
|
||||
@ -54,10 +54,10 @@ public class ClientWorkMessageResultView2SceneController : MonoBehaviour
|
||||
|
||||
if (step4VideoPlayer != null)
|
||||
{
|
||||
// 砞竚紇<EFBFBD>挡<EFBFBD>ㄆン
|
||||
// 設置影片結束事件
|
||||
step4VideoPlayer.loopPointReached += step4VideoPlayer_onVideoFinished;
|
||||
|
||||
// 砞竚紇<EFBFBD>陪ボ
|
||||
// 設置影片顯示
|
||||
if (step4RawImage != null)
|
||||
{
|
||||
step4VideoPlayer.targetTexture = null;
|
||||
@ -70,10 +70,10 @@ public class ClientWorkMessageResultView2SceneController : MonoBehaviour
|
||||
}
|
||||
if (step5VideoPlayer != null)
|
||||
{
|
||||
// 砞竚紇<EFBFBD>挡<EFBFBD>ㄆン
|
||||
// 設置影片結束事件
|
||||
step5VideoPlayer.loopPointReached += step5VideoPlayer_onVideoFinished;
|
||||
|
||||
// 砞竚紇<EFBFBD>陪ボ
|
||||
// 設置影片顯示
|
||||
if (step5RawImage != null)
|
||||
{
|
||||
step5VideoPlayer.targetTexture = null;
|
||||
|
||||
@ -9,7 +9,7 @@ public class ClientWorkMessageResultYesSceneController : MonoBehaviour
|
||||
{
|
||||
public static ClientWorkMessageResultYesSceneController Instance;
|
||||
|
||||
[Header("影片播放")]
|
||||
[Header("影片播放")]
|
||||
public VideoPlayer videoPlayer;
|
||||
public RawImage videoDisplay;
|
||||
|
||||
@ -22,11 +22,11 @@ public class ClientWorkMessageResultYesSceneController : MonoBehaviour
|
||||
{
|
||||
SetupVideoPlayer();
|
||||
|
||||
// 開始播放影片
|
||||
// 開始播放影片
|
||||
if (videoPlayer != null)
|
||||
{
|
||||
videoPlayer.Play();
|
||||
Debug.Log("開始播放影片");
|
||||
Debug.Log("開始播放影片");
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,10 +34,10 @@ public class ClientWorkMessageResultYesSceneController : MonoBehaviour
|
||||
{
|
||||
if (videoPlayer != null)
|
||||
{
|
||||
// 設置影片結束事件
|
||||
// 設置影片結束事件
|
||||
videoPlayer.loopPointReached += OnVideoFinished;
|
||||
|
||||
// 設置影片顯示
|
||||
// 設置影片顯示
|
||||
if (videoDisplay != null)
|
||||
{
|
||||
videoPlayer.targetTexture = null;
|
||||
@ -51,7 +51,7 @@ public class ClientWorkMessageResultYesSceneController : MonoBehaviour
|
||||
|
||||
void OnVideoFinished(VideoPlayer vp)
|
||||
{
|
||||
Debug.Log("影片播放完成,準備跳轉");
|
||||
Debug.Log("影片播放完成,準備跳轉");
|
||||
StartCoroutine(LoadNextScene());
|
||||
}
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ public class ClientWorkSceneController : MonoBehaviour
|
||||
{
|
||||
public static ClientWorkSceneController Instance;
|
||||
|
||||
[Header("UI 元件")]
|
||||
[Header("UI 元件")]
|
||||
public TMP_InputField messageTextInputField;
|
||||
public TMP_InputField messagePresentInputField;
|
||||
public Button submitButton;
|
||||
@ -64,7 +64,7 @@ public class ClientWorkSceneController : MonoBehaviour
|
||||
messageTextInputField.onValueChanged.AddListener(textInputField_onValueChanged);
|
||||
}
|
||||
|
||||
Debug.Log("ClientWorkScene 初始化完成");
|
||||
Debug.Log("ClientWorkScene 初始化完成");
|
||||
}
|
||||
|
||||
private void textInputField_onValueChanged(string arg0)
|
||||
|
||||
@ -4,11 +4,11 @@ using UnityEngine.UI;
|
||||
[RequireComponent(typeof(Toggle))]
|
||||
public class ExclusiveToggleVisual : MonoBehaviour
|
||||
{
|
||||
[Header("選中時圖片")]
|
||||
[Header("選中時圖片")]
|
||||
[SerializeField] private Sprite onBackground;
|
||||
[SerializeField] private Sprite onCheckmark;
|
||||
|
||||
[Header("未選中時圖片(留空 = 原始圖)")]
|
||||
[Header("未選中時圖片(留空 = 原始圖)")]
|
||||
[SerializeField] private Sprite offBackground;
|
||||
[SerializeField] private Sprite offCheckmark;
|
||||
|
||||
@ -23,15 +23,15 @@ public class ExclusiveToggleVisual : MonoBehaviour
|
||||
bgImage = toggle.targetGraphic as Image;
|
||||
checkImage = toggle.graphic as Image;
|
||||
|
||||
// 儲存原始圖片(供 off 狀態使用)
|
||||
// 儲存原始圖片(供 off 狀態使用)
|
||||
if (bgImage) origBg = bgImage.sprite;
|
||||
if (checkImage) origCheck = checkImage.sprite;
|
||||
|
||||
// 關閉 UI 焦點干擾
|
||||
// 關閉 UI 焦點干擾
|
||||
toggle.transition = Selectable.Transition.None;
|
||||
toggle.navigation = new Navigation { mode = Navigation.Mode.None };
|
||||
|
||||
// 初始 + 監聽
|
||||
// 初始 + 監聽
|
||||
SyncVisual();
|
||||
toggle.onValueChanged.AddListener(_ => SyncVisual());
|
||||
}
|
||||
@ -40,11 +40,11 @@ public class ExclusiveToggleVisual : MonoBehaviour
|
||||
{
|
||||
bool isOn = toggle.isOn;
|
||||
|
||||
// 背景圖
|
||||
// 背景圖
|
||||
if (bgImage && onBackground)
|
||||
bgImage.sprite = isOn ? onBackground : (offBackground ?? origBg);
|
||||
|
||||
// Checkmark 圖(僅在選中時顯示)
|
||||
// Checkmark 圖(僅在選中時顯示)
|
||||
if (checkImage)
|
||||
{
|
||||
if (onCheckmark)
|
||||
@ -53,6 +53,6 @@ public class ExclusiveToggleVisual : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
// 外部可強制刷新(如動態換圖)
|
||||
// 外部可強制刷新(如動態換圖)
|
||||
public void Refresh() => SyncVisual();
|
||||
}
|
||||
@ -20,7 +20,7 @@ public class PersistentNetworkManager : MonoBehaviour
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
// 單例模式:確保只有一個 NetworkManager 存在
|
||||
// 單例模式:確保只有一個 NetworkManager 存在
|
||||
if (instance == null)
|
||||
{
|
||||
instance = this;
|
||||
@ -29,22 +29,22 @@ public class PersistentNetworkManager : MonoBehaviour
|
||||
networkManager = GetComponent<NetworkManager>();
|
||||
if (networkManager != null)
|
||||
{
|
||||
// 確保 NetworkManager 也設置為不銷毀
|
||||
// 確保 NetworkManager 也設置為不銷毀
|
||||
networkManager.dontDestroyOnLoad = true;
|
||||
}
|
||||
|
||||
Debug.Log("NetworkManager 已設置為跨場景保持");
|
||||
Debug.Log("NetworkManager 已設置為跨場景保持");
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果已經存在實例,銷毀這個重複的
|
||||
Debug.Log("NetworkManager 已存在,銷毀重複物件");
|
||||
// 如果已經存在實例,銷毀這個重複的
|
||||
Debug.Log("NetworkManager 已存在,銷毀重複物件");
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 獲取 NetworkManager 實例
|
||||
/// 獲取 NetworkManager 實例
|
||||
/// </summary>
|
||||
public static NetworkManager GetNetworkManager()
|
||||
{
|
||||
@ -56,7 +56,7 @@ public class PersistentNetworkManager : MonoBehaviour
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 檢查是否已連線
|
||||
/// 檢查是否已連線
|
||||
/// </summary>
|
||||
public static bool IsConnected()
|
||||
{
|
||||
@ -64,7 +64,7 @@ public class PersistentNetworkManager : MonoBehaviour
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 檢查是否為 Server
|
||||
/// 檢查是否為 Server
|
||||
/// </summary>
|
||||
public static bool IsServer()
|
||||
{
|
||||
@ -72,7 +72,7 @@ public class PersistentNetworkManager : MonoBehaviour
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清理連線(當需要完全重置時使用)
|
||||
/// 清理連線(當需要完全重置時使用)
|
||||
/// </summary>
|
||||
public static void CleanupConnections()
|
||||
{
|
||||
|
||||
@ -4,7 +4,7 @@ using Mirror;
|
||||
|
||||
public class SceneController : MonoBehaviour
|
||||
{
|
||||
[Header("場景名稱設置")]
|
||||
[Header("場景名稱設置")]
|
||||
public string initSceneName = "InitScene";
|
||||
|
||||
public string serverHomeSceneName = "ServerHomeScene";
|
||||
|
||||
@ -2,6 +2,6 @@ using Mirror;
|
||||
|
||||
public class EmptyNetworkPlayer : NetworkBehaviour
|
||||
{
|
||||
// 這是一個空的 Player 腳本,僅用於滿足 NetworkManager 的要求
|
||||
// 實際上不會被使用,因為我們的應用不需要生成 Player 物件
|
||||
// 這是一個空的 Player 腳本,僅用於滿足 NetworkManager 的要求
|
||||
// 實際上不會被使用,因為我們的應用不需要生成 Player 物件
|
||||
}
|
||||
@ -7,7 +7,7 @@ public class GlobalMenuManager : MonoBehaviour
|
||||
{
|
||||
public static GlobalMenuManager Instance;
|
||||
|
||||
[Header("UI 元件")]
|
||||
[Header("UI 元件")]
|
||||
public GameObject menuButton;
|
||||
public GameObject menuPanel;
|
||||
public Button homeButton;
|
||||
@ -20,7 +20,7 @@ public class GlobalMenuManager : MonoBehaviour
|
||||
if (Instance == null)
|
||||
{
|
||||
Instance = this;
|
||||
// 重要:將整個 Canvas 設為 DontDestroyOnLoad
|
||||
// 重要:將整個 Canvas 設為 DontDestroyOnLoad
|
||||
if (transform.parent != null)
|
||||
{
|
||||
DontDestroyOnLoad(transform.root.gameObject);
|
||||
@ -44,11 +44,11 @@ public class GlobalMenuManager : MonoBehaviour
|
||||
|
||||
void InitializeMenu()
|
||||
{
|
||||
// 確保選單面板一開始是隱藏的
|
||||
// 確保選單面板一開始是隱藏的
|
||||
if (menuPanel != null)
|
||||
menuPanel.SetActive(false);
|
||||
|
||||
// 綁定按鈕事件
|
||||
// 綁定按鈕事件
|
||||
if (menuButton != null)
|
||||
{
|
||||
menuButton.GetComponent<Button>().onClick.AddListener(OpenMenu);
|
||||
|
||||
@ -23,26 +23,26 @@ public class NetworkGameManager : NetworkManager
|
||||
public override void OnStartServer()
|
||||
{
|
||||
base.OnStartServer();
|
||||
Debug.Log("Server 已啟動");
|
||||
Debug.Log("Server 已啟動");
|
||||
}
|
||||
|
||||
public override void OnServerConnect(NetworkConnectionToClient conn)
|
||||
{
|
||||
base.OnServerConnect(conn);
|
||||
Debug.Log($"客戶端已連接: {conn.connectionId}");
|
||||
Debug.Log($"客戶端已連接: {conn.connectionId}");
|
||||
|
||||
}
|
||||
|
||||
public override void OnServerDisconnect(NetworkConnectionToClient conn)
|
||||
{
|
||||
base.OnServerDisconnect(conn);
|
||||
Debug.Log($"客戶端已斷開: {conn.connectionId}");
|
||||
Debug.Log($"客戶端已斷開: {conn.connectionId}");
|
||||
}
|
||||
|
||||
// 覆寫這個方法來避免自動生成 Player
|
||||
// 覆寫這個方法來避免自動生成 Player
|
||||
public override void OnServerAddPlayer(NetworkConnectionToClient conn)
|
||||
{
|
||||
// 不自動生成 Player,只是記錄連接
|
||||
Debug.Log($"客戶端請求加入,但 Server 模式不需要生成 Player: {conn.connectionId}");
|
||||
// 不自動生成 Player,只是記錄連接
|
||||
Debug.Log($"客戶端請求加入,但 Server 模式不需要生成 Player: {conn.connectionId}");
|
||||
}
|
||||
}
|
||||
@ -28,7 +28,7 @@ public class NetworkMessageHandler : MonoBehaviour
|
||||
|
||||
void OnClientMessageReceived(NetworkConnectionToClient conn, GameMessage msg)
|
||||
{
|
||||
Debug.Log($"¦¬¨ì«È¤áºÝ°T®§: {msg.action} {msg.payload}");
|
||||
Debug.Log($"收到客戶端訊息: {msg.action} {msg.payload}");
|
||||
|
||||
switch (msg.action)
|
||||
{
|
||||
@ -203,11 +203,11 @@ public class NetworkMessageHandler : MonoBehaviour
|
||||
{
|
||||
GameMessage msg = new GameMessage { action = action, payload = message };
|
||||
CurrentConn.Send(msg);
|
||||
Debug.Log($"µo°e¨ì«È¤áºÝ: {message}");
|
||||
Debug.Log($"發送到客戶端: {message}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"µo°e¨ì«È¤áºÝ¥¢±Ñ: {message}");
|
||||
Debug.Log($"發送到客戶端失敗: {message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -29,11 +29,11 @@ public class ServerGameTalkingPanel : MonoBehaviour
|
||||
private int gameTimeCountdownSecVal = 100;
|
||||
|
||||
private string[] sampleTexts = {
|
||||
"汝行街上,見一老嫗跌倒,身旁五千金鈔隨風散。若只得一瞬之舉,汝先救人,抑或先拾錢?",
|
||||
"汝見一孩以假幣買食,攤主未覺。若揭穿,孩餓;若不言,誤教。汝何選?",
|
||||
"友人誤將重物砸壞汝物,卻以為無人知曉。汝心明白真相,是當面直言,還是靜默讓他安?",
|
||||
"汝於雨夜撞傷野貓,車無損,人未見。汝會停車查看,抑或遠去以免麻煩?",
|
||||
"汝在工廠,知上司指示排放廢水入河,若揭發,恐遭解雇;若隱瞞,公司利潤倍增。汝何解?"
|
||||
"汝行街上,見一老嫗跌倒,身旁五千金鈔隨風散。若只得一瞬之舉,汝先救人,抑或先拾錢?",
|
||||
"汝見一孩以假幣買食,攤主未覺。若揭穿,孩餓;若不言,誤教。汝何選?",
|
||||
"友人誤將重物砸壞汝物,卻以為無人知曉。汝心明白真相,是當面直言,還是靜默讓他安?",
|
||||
"汝於雨夜撞傷野貓,車無損,人未見。汝會停車查看,抑或遠去以免麻煩?",
|
||||
"汝在工廠,知上司指示排放廢水入河,若揭發,恐遭解雇;若隱瞞,公司利潤倍增。汝何解?"
|
||||
};
|
||||
|
||||
|
||||
@ -116,10 +116,10 @@ public class ServerGameTalkingPanel : MonoBehaviour
|
||||
{
|
||||
if (introVideoPlayer != null)
|
||||
{
|
||||
// 設置影片結束事件
|
||||
// 設置影片結束事件
|
||||
introVideoPlayer.loopPointReached += OnIntroVideoFinished;
|
||||
|
||||
// 設置影片顯示
|
||||
// 設置影片顯示
|
||||
if (introVideoPlayer != null)
|
||||
{
|
||||
introVideoPlayer.targetTexture = null;
|
||||
@ -133,14 +133,14 @@ public class ServerGameTalkingPanel : MonoBehaviour
|
||||
|
||||
void OnIntroVideoFinished(VideoPlayer vp)
|
||||
{
|
||||
Debug.Log("影片播放完成");
|
||||
Debug.Log("影片播放完成");
|
||||
//StartCoroutine(LoadNextScene());
|
||||
processStep(2);
|
||||
}
|
||||
|
||||
public void onReceivedChatMessage(string message)
|
||||
{
|
||||
playChatText.text = "-信眾-<br>" + message + "<br>" + playChatText.text;
|
||||
playChatText.text = "-信眾-<br>" + message + "<br>" + playChatText.text;
|
||||
}
|
||||
|
||||
private void playSendButton_onClick()
|
||||
@ -151,7 +151,7 @@ public class ServerGameTalkingPanel : MonoBehaviour
|
||||
{
|
||||
NetworkMessageHandler.Instance.SendMessageToClient("gameTalkingGodSay", playInputField.text);
|
||||
}
|
||||
playChatText.text = "<align=\"right\"><color=#63584A>-神明-<br>" + playInputField.text + "</color></align><br>" + playChatText.text;
|
||||
playChatText.text = "<align=\"right\"><color=#63584A>-神明-<br>" + playInputField.text + "</color></align><br>" + playChatText.text;
|
||||
playInputField.text = "";
|
||||
}
|
||||
}
|
||||
@ -169,7 +169,7 @@ public class ServerGameTalkingPanel : MonoBehaviour
|
||||
}
|
||||
|
||||
gameTimeCountdownSecVal--;
|
||||
statusText.text = "倒計時 : <color=\"red\">" + gameTimeCountdownSecVal.ToString() + "</color>s";
|
||||
statusText.text = "倒計時 : <color=\"red\">" + gameTimeCountdownSecVal.ToString() + "</color>s";
|
||||
if (gameTimeCountdownSecVal > 0)
|
||||
{
|
||||
StartCoroutine(GameTimeCountdown());
|
||||
@ -203,7 +203,7 @@ public class ServerGameTalkingPanel : MonoBehaviour
|
||||
|
||||
if (statusText.text == "--")
|
||||
{
|
||||
statusText.text = "倒計時 : <color=\"red\">" + gameTimeCountdownSecVal.ToString() + "</color>s";
|
||||
statusText.text = "倒計時 : <color=\"red\">" + gameTimeCountdownSecVal.ToString() + "</color>s";
|
||||
StartCoroutine(GameTimeCountdown());
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,10 +71,10 @@ public class ServerGameTypingPanel : MonoBehaviour
|
||||
{
|
||||
if (introVideoPlayer != null)
|
||||
{
|
||||
// 設置影片結束事件
|
||||
// 設置影片結束事件
|
||||
introVideoPlayer.loopPointReached += OnIntroVideoFinished;
|
||||
|
||||
// 設置影片顯示
|
||||
// 設置影片顯示
|
||||
if (introVideoPlayer != null)
|
||||
{
|
||||
introVideoPlayer.targetTexture = null;
|
||||
@ -88,7 +88,7 @@ public class ServerGameTypingPanel : MonoBehaviour
|
||||
|
||||
void OnIntroVideoFinished(VideoPlayer vp)
|
||||
{
|
||||
Debug.Log("影片播放完成");
|
||||
Debug.Log("影片播放完成");
|
||||
//StartCoroutine(LoadNextScene());
|
||||
processStep(2);
|
||||
}
|
||||
@ -97,10 +97,10 @@ public class ServerGameTypingPanel : MonoBehaviour
|
||||
{
|
||||
if (introVideoPlayer != null)
|
||||
{
|
||||
// 設置影片結束事件
|
||||
// 設置影片結束事件
|
||||
playVideoPlayer.loopPointReached += OnPlayVideoFinished;
|
||||
|
||||
// 設置影片顯示
|
||||
// 設置影片顯示
|
||||
if (playVideoPlayer != null)
|
||||
{
|
||||
playVideoPlayer.targetTexture = null;
|
||||
@ -114,7 +114,7 @@ public class ServerGameTypingPanel : MonoBehaviour
|
||||
|
||||
void OnPlayVideoFinished(VideoPlayer vp)
|
||||
{
|
||||
Debug.Log("影片播放完成");
|
||||
Debug.Log("影片播放完成");
|
||||
//StartCoroutine(LoadNextScene());
|
||||
OnReceivedResult();
|
||||
|
||||
@ -136,7 +136,7 @@ public class ServerGameTypingPanel : MonoBehaviour
|
||||
|
||||
|
||||
gameTimeCountdownSecVal--;
|
||||
statusText.text = "倒計時 : <color=\"red\">" + gameTimeCountdownSecVal.ToString() + "</color>s";
|
||||
statusText.text = "倒計時 : <color=\"red\">" + gameTimeCountdownSecVal.ToString() + "</color>s";
|
||||
if (gameTimeCountdownSecVal > 0)
|
||||
{
|
||||
StartCoroutine(GameTimeCountdown());
|
||||
|
||||
@ -13,10 +13,10 @@ public class ServerGameWaittingPanel : MonoBehaviour
|
||||
{
|
||||
if (introVideoPlayer != null)
|
||||
{
|
||||
// 設置影片結束事件
|
||||
// 設置影片結束事件
|
||||
introVideoPlayer.loopPointReached += OnIntroVideoFinished;
|
||||
|
||||
// 設置影片顯示
|
||||
// 設置影片顯示
|
||||
if (introVideoPlayer != null)
|
||||
{
|
||||
introVideoPlayer.isLooping = true;
|
||||
@ -31,7 +31,7 @@ public class ServerGameWaittingPanel : MonoBehaviour
|
||||
|
||||
void OnIntroVideoFinished(VideoPlayer vp)
|
||||
{
|
||||
//Debug.Log("影片播放完成");
|
||||
//Debug.Log("影片播放完成");
|
||||
//StartCoroutine(LoadNextScene());
|
||||
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ public class ServerHomeSceneController : MonoBehaviour
|
||||
{
|
||||
public static ServerHomeSceneController Instance;
|
||||
|
||||
[Header("UI じン")]
|
||||
[Header("UI 元件")]
|
||||
public Button StartBtn;
|
||||
|
||||
void Awake()
|
||||
|
||||
@ -8,7 +8,7 @@ public class ServerHomeWaittingSceneController : MonoBehaviour
|
||||
{
|
||||
public static ServerHomeWaittingSceneController Instance;
|
||||
|
||||
[Header("UI 元件")]
|
||||
[Header("UI 元件")]
|
||||
public TMP_Text waitingText;
|
||||
|
||||
private bool clientConnected = false;
|
||||
@ -27,7 +27,7 @@ public class ServerHomeWaittingSceneController : MonoBehaviour
|
||||
{
|
||||
if (waitingText != null)
|
||||
{
|
||||
waitingText.text = "等待您的客戶加入…";
|
||||
waitingText.text = "等待您的客戶加入…";
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ public class ServerHomeWaittingSceneController : MonoBehaviour
|
||||
if (!clientConnected)
|
||||
{
|
||||
clientConnected = true;
|
||||
Debug.Log("客戶端已連接,準備跳轉場景");
|
||||
Debug.Log("客戶端已連接,準備跳轉場景");
|
||||
|
||||
|
||||
StartCoroutine(LoadIntroScene());
|
||||
|
||||
@ -12,14 +12,14 @@ public class ServerInitSceneController : MonoBehaviour
|
||||
|
||||
void InitializeServer()
|
||||
{
|
||||
Debug.Log("初始化 Server...");
|
||||
Debug.Log("初始化 Server...");
|
||||
|
||||
// 啟動 Server
|
||||
// 啟動 Server
|
||||
if (NetworkGameManager.Instance != null)
|
||||
{
|
||||
NetworkGameManager.Instance.StartServer();
|
||||
|
||||
// 等待一秒後自動連接本地 Client
|
||||
// 等待一秒後自動連接本地 Client
|
||||
StartCoroutine(AutoConnectLocalClient());
|
||||
}
|
||||
}
|
||||
@ -31,10 +31,10 @@ public class ServerInitSceneController : MonoBehaviour
|
||||
if (NetworkGameManager.Instance != null)
|
||||
{
|
||||
NetworkGameManager.Instance.StartClient();
|
||||
Debug.Log("本地 Client 已連接到 Server");
|
||||
Debug.Log("本地 Client 已連接到 Server");
|
||||
}
|
||||
|
||||
// 初始化完成,跳到 ServerHomeScene
|
||||
// 初始化完成,跳到 ServerHomeScene
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
SceneManager.LoadScene("ServerHomeScene");
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ public class ServerIntroSceneController : MonoBehaviour
|
||||
{
|
||||
public static ServerIntroSceneController Instance;
|
||||
|
||||
[Header("影片播放")]
|
||||
[Header("影片播放")]
|
||||
public VideoPlayer videoPlayer;
|
||||
public RawImage videoDisplay;
|
||||
|
||||
@ -20,7 +20,7 @@ public class ServerIntroSceneController : MonoBehaviour
|
||||
{
|
||||
SetupVideoPlayer();
|
||||
|
||||
// 開始播放影片
|
||||
// 開始播放影片
|
||||
if (videoPlayer != null)
|
||||
{
|
||||
videoPlayer.Play();
|
||||
@ -31,10 +31,10 @@ public class ServerIntroSceneController : MonoBehaviour
|
||||
{
|
||||
if (videoPlayer != null)
|
||||
{
|
||||
// 設置影片結束事件
|
||||
// 設置影片結束事件
|
||||
videoPlayer.loopPointReached += OnVideoFinished;
|
||||
|
||||
// 設置影片顯示
|
||||
// 設置影片顯示
|
||||
if (videoDisplay != null)
|
||||
{
|
||||
videoPlayer.targetTexture = null;
|
||||
@ -48,7 +48,7 @@ public class ServerIntroSceneController : MonoBehaviour
|
||||
|
||||
void OnVideoFinished(VideoPlayer vp)
|
||||
{
|
||||
Debug.Log("影片播放完成");
|
||||
Debug.Log("影片播放完成");
|
||||
StartCoroutine(LoadNextScene());
|
||||
}
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ public class ServerWorkExitWorkPanel : MonoBehaviour
|
||||
{
|
||||
public static ServerWorkExitWorkPanel Instance;
|
||||
|
||||
[Header("影片播放")]
|
||||
[Header("影片播放")]
|
||||
public VideoPlayer videoPlayer;
|
||||
public RawImage videoDisplay;
|
||||
|
||||
@ -50,10 +50,10 @@ public class ServerWorkExitWorkPanel : MonoBehaviour
|
||||
{
|
||||
if (videoPlayer != null)
|
||||
{
|
||||
// 設置影片結束事件
|
||||
// 設置影片結束事件
|
||||
videoPlayer.loopPointReached += OnVideoFinished;
|
||||
|
||||
// 設置影片顯示
|
||||
// 設置影片顯示
|
||||
if (videoDisplay != null)
|
||||
{
|
||||
videoPlayer.targetTexture = null;
|
||||
@ -67,7 +67,7 @@ public class ServerWorkExitWorkPanel : MonoBehaviour
|
||||
|
||||
void OnVideoFinished(VideoPlayer vp)
|
||||
{
|
||||
Debug.Log("影片播放完成");
|
||||
Debug.Log("影片播放完成");
|
||||
StartCoroutine(LoadHomeScene());
|
||||
}
|
||||
|
||||
|
||||
@ -11,11 +11,11 @@ public class ServerWorkGameFinalPanel : MonoBehaviour
|
||||
|
||||
private int currentSampleWordsIndex = 0;
|
||||
private string[] sampleWords = {
|
||||
"福在心間非遠方行誠一步百事昌天開一線容人渡前路微光漸放芒",
|
||||
"命裡有時終必至急行反失遠行期靜看潮起潮又落好風自會送舟歸",
|
||||
"心誠萬事皆能順莫急莫慌自有門天道酬勤終不負善念長存歸本根",
|
||||
"汝問蒼天天不語早知汝路自難移命數原非神可改徒然叩首費心思",
|
||||
"求財無財空添亂問愛無愛更心煩問命問天徒自苦不如回家補個眠"
|
||||
"福在心間非遠方行誠一步百事昌天開一線容人渡前路微光漸放芒",
|
||||
"命裡有時終必至急行反失遠行期靜看潮起潮又落好風自會送舟歸",
|
||||
"心誠萬事皆能順莫急莫慌自有門天道酬勤終不負善念長存歸本根",
|
||||
"汝問蒼天天不語早知汝路自難移命數原非神可改徒然叩首費心思",
|
||||
"求財無財空添亂問愛無愛更心煩問命問天徒自苦不如回家補個眠"
|
||||
};
|
||||
|
||||
public GameObject introPanel;
|
||||
@ -70,10 +70,10 @@ public class ServerWorkGameFinalPanel : MonoBehaviour
|
||||
{
|
||||
if (waittingVideoPlayer != null)
|
||||
{
|
||||
// 設置影片結束事件
|
||||
// 設置影片結束事件
|
||||
waittingVideoPlayer.loopPointReached += OnIntroVideoFinished;
|
||||
|
||||
// 設置影片顯示
|
||||
// 設置影片顯示
|
||||
if (waittingVideoPlayer != null)
|
||||
{
|
||||
waittingVideoPlayer.isLooping = true;
|
||||
@ -88,7 +88,7 @@ public class ServerWorkGameFinalPanel : MonoBehaviour
|
||||
|
||||
void OnIntroVideoFinished(VideoPlayer vp)
|
||||
{
|
||||
//Debug.Log("影片播放完成");
|
||||
//Debug.Log("影片播放完成");
|
||||
//StartCoroutine(LoadNextScene());
|
||||
|
||||
}
|
||||
@ -157,16 +157,16 @@ public class ServerWorkGameFinalPanel : MonoBehaviour
|
||||
switch (ServerWorkMessagePanel.workMessageType)
|
||||
{
|
||||
case "TypeMoneyButton":
|
||||
introMessageTypeText.text = "財運";
|
||||
introMessageTypeText.text = "財運";
|
||||
break;
|
||||
case "TypeHealthButton":
|
||||
introMessageTypeText.text = "健康";
|
||||
introMessageTypeText.text = "健康";
|
||||
break;
|
||||
case "TypeLoveButton":
|
||||
introMessageTypeText.text = "愛情";
|
||||
introMessageTypeText.text = "愛情";
|
||||
break;
|
||||
default: // "TypeWorkButton"
|
||||
introMessageTypeText.text = "工作";
|
||||
introMessageTypeText.text = "工作";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ public class ServerWorkIntroPanel : MonoBehaviour
|
||||
{
|
||||
public static ServerWorkIntroPanel Instance;
|
||||
|
||||
[Header("UI じン")]
|
||||
[Header("UI 元件")]
|
||||
public Button checkButton;
|
||||
|
||||
private void Awake()
|
||||
|
||||
@ -11,7 +11,7 @@ public class ServerWorkMessagePanel : MonoBehaviour
|
||||
public static string workPresent = "";
|
||||
public static int workMessageCount = 0;
|
||||
|
||||
[Header("UI 元件")]
|
||||
[Header("UI 元件")]
|
||||
public GameObject messageLoadPanel;
|
||||
public GameObject messageReceivedPanel;
|
||||
public TMP_Text messageInfoText;
|
||||
@ -59,13 +59,13 @@ public class ServerWorkMessagePanel : MonoBehaviour
|
||||
}
|
||||
if (messageInfoText)
|
||||
{
|
||||
messageInfoText.text = "系統提示:請稍後,連接客戶的願望中...";
|
||||
messageInfoText.text = "系統提示:請稍後,連接客戶的願望中...";
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ( messageInfoText)
|
||||
{
|
||||
messageInfoText.text = "系統提示:客戶已傳達願望給您,是否要幫助此客戶?請點擊回覆";
|
||||
messageInfoText.text = "系統提示:客戶已傳達願望給您,是否要幫助此客戶?請點擊回覆";
|
||||
}
|
||||
if (messageLoadPanel)
|
||||
{
|
||||
@ -80,16 +80,16 @@ public class ServerWorkMessagePanel : MonoBehaviour
|
||||
switch(workMessageType)
|
||||
{
|
||||
case "TypeMoneyButton":
|
||||
typeText.text = "財運";
|
||||
typeText.text = "財運";
|
||||
break;
|
||||
case "TypeHealthButton":
|
||||
typeText.text = "健康";
|
||||
typeText.text = "健康";
|
||||
break;
|
||||
case "TypeLoveButton":
|
||||
typeText.text = "愛情";
|
||||
typeText.text = "愛情";
|
||||
break;
|
||||
default: // "TypeWorkButton"
|
||||
typeText.text = "工作";
|
||||
typeText.text = "工作";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ public class ServerWorkMessageReplyContinuePanel : MonoBehaviour
|
||||
{
|
||||
public static ServerWorkMessageReplyContinuePanel Instance;
|
||||
|
||||
[Header("影片播放")]
|
||||
[Header("影片播放")]
|
||||
public VideoPlayer videoPlayer;
|
||||
public RawImage videoDisplay;
|
||||
|
||||
@ -34,10 +34,10 @@ public class ServerWorkMessageReplyContinuePanel : MonoBehaviour
|
||||
{
|
||||
if (videoPlayer != null)
|
||||
{
|
||||
// 設置影片結束事件
|
||||
// 設置影片結束事件
|
||||
videoPlayer.loopPointReached += OnVideoFinished;
|
||||
|
||||
// 設置影片顯示
|
||||
// 設置影片顯示
|
||||
if (videoDisplay != null)
|
||||
{
|
||||
videoPlayer.targetTexture = null;
|
||||
@ -52,7 +52,7 @@ public class ServerWorkMessageReplyContinuePanel : MonoBehaviour
|
||||
|
||||
void OnVideoFinished(VideoPlayer vp)
|
||||
{
|
||||
//Debug.Log("影片播放完成");
|
||||
//Debug.Log("影片播放完成");
|
||||
if (ServerWorkSceneController.Instance)
|
||||
{
|
||||
ServerWorkSceneController.Instance.processStep(13);
|
||||
|
||||
@ -8,7 +8,7 @@ public class ServerWorkMessageReplyExitPanel : MonoBehaviour
|
||||
{
|
||||
public static ServerWorkMessageReplyExitPanel Instance;
|
||||
|
||||
[Header("影片播放")]
|
||||
[Header("影片播放")]
|
||||
public VideoPlayer videoPlayer;
|
||||
public RawImage videoDisplay;
|
||||
|
||||
@ -42,10 +42,10 @@ public class ServerWorkMessageReplyExitPanel : MonoBehaviour
|
||||
{
|
||||
if (videoPlayer != null)
|
||||
{
|
||||
// 設置影片結束事件
|
||||
// 設置影片結束事件
|
||||
videoPlayer.loopPointReached += OnVideoFinished;
|
||||
|
||||
// 設置影片顯示
|
||||
// 設置影片顯示
|
||||
if (videoDisplay != null)
|
||||
{
|
||||
videoPlayer.targetTexture = null;
|
||||
@ -59,7 +59,7 @@ public class ServerWorkMessageReplyExitPanel : MonoBehaviour
|
||||
|
||||
void OnVideoFinished(VideoPlayer vp)
|
||||
{
|
||||
Debug.Log("影片播放完成");
|
||||
Debug.Log("影片播放完成");
|
||||
ServerWorkSceneController.Instance.processStep(10);
|
||||
}
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ public class ServerWorkMessageReplyWait1Panel : MonoBehaviour
|
||||
{
|
||||
public static ServerWorkMessageReplyWait1Panel Instance;
|
||||
|
||||
[Header("影片播放")]
|
||||
[Header("影片播放")]
|
||||
public VideoPlayer videoPlayer;
|
||||
public RawImage videoDisplay;
|
||||
|
||||
@ -42,10 +42,10 @@ public class ServerWorkMessageReplyWait1Panel : MonoBehaviour
|
||||
{
|
||||
if (videoPlayer != null)
|
||||
{
|
||||
// 設置影片結束事件
|
||||
// 設置影片結束事件
|
||||
videoPlayer.loopPointReached += OnVideoFinished;
|
||||
|
||||
// 設置影片顯示
|
||||
// 設置影片顯示
|
||||
if (videoDisplay != null)
|
||||
{
|
||||
videoPlayer.targetTexture = null;
|
||||
@ -59,7 +59,7 @@ public class ServerWorkMessageReplyWait1Panel : MonoBehaviour
|
||||
|
||||
void OnVideoFinished(VideoPlayer vp)
|
||||
{
|
||||
Debug.Log("影片播放完成");
|
||||
Debug.Log("影片播放完成");
|
||||
ServerWorkSceneController.Instance.processStep(6);
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ public class ServerWorkMessageReplyWait1WorkingPanel : MonoBehaviour
|
||||
{
|
||||
public static ServerWorkMessageReplyWait1WorkingPanel Instance;
|
||||
|
||||
[Header("影片播放")]
|
||||
[Header("影片播放")]
|
||||
public VideoPlayer videoPlayer;
|
||||
public RawImage videoDisplay;
|
||||
|
||||
@ -40,10 +40,10 @@ public class ServerWorkMessageReplyWait1WorkingPanel : MonoBehaviour
|
||||
{
|
||||
if (videoPlayer != null)
|
||||
{
|
||||
// 設置影片結束事件
|
||||
// 設置影片結束事件
|
||||
videoPlayer.loopPointReached += OnVideoFinished;
|
||||
|
||||
// 設置影片顯示
|
||||
// 設置影片顯示
|
||||
if (videoDisplay != null)
|
||||
{
|
||||
videoPlayer.targetTexture = null;
|
||||
@ -58,7 +58,7 @@ public class ServerWorkMessageReplyWait1WorkingPanel : MonoBehaviour
|
||||
|
||||
void OnVideoFinished(VideoPlayer vp)
|
||||
{
|
||||
//Debug.Log("影片播放完成");
|
||||
//Debug.Log("影片播放完成");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ public class ServerWorkMessageReplyWait2Panel : MonoBehaviour
|
||||
{
|
||||
public static ServerWorkMessageReplyWait2Panel Instance;
|
||||
|
||||
[Header("影片播放")]
|
||||
[Header("影片播放")]
|
||||
public VideoPlayer videoPlayer;
|
||||
public RawImage videoDisplay;
|
||||
|
||||
@ -41,10 +41,10 @@ public class ServerWorkMessageReplyWait2Panel : MonoBehaviour
|
||||
{
|
||||
if (videoPlayer != null)
|
||||
{
|
||||
// 設置影片結束事件
|
||||
// 設置影片結束事件
|
||||
videoPlayer.loopPointReached += OnVideoFinished;
|
||||
|
||||
// 設置影片顯示
|
||||
// 設置影片顯示
|
||||
if (videoDisplay != null)
|
||||
{
|
||||
videoPlayer.targetTexture = null;
|
||||
@ -58,7 +58,7 @@ public class ServerWorkMessageReplyWait2Panel : MonoBehaviour
|
||||
|
||||
void OnVideoFinished(VideoPlayer vp)
|
||||
{
|
||||
Debug.Log("影片播放完成");
|
||||
Debug.Log("影片播放完成");
|
||||
ServerWorkSceneController.Instance.processStep(8);
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ public class ServerWorkMessageReplyWait2WorkingPanel : MonoBehaviour
|
||||
{
|
||||
public static ServerWorkMessageReplyWait2WorkingPanel Instance;
|
||||
|
||||
[Header("影片播放")]
|
||||
[Header("影片播放")]
|
||||
public VideoPlayer videoPlayer;
|
||||
public RawImage videoDisplay;
|
||||
|
||||
@ -41,10 +41,10 @@ public class ServerWorkMessageReplyWait2WorkingPanel : MonoBehaviour
|
||||
{
|
||||
if (videoPlayer != null)
|
||||
{
|
||||
// 設置影片結束事件
|
||||
// 設置影片結束事件
|
||||
videoPlayer.loopPointReached += OnVideoFinished;
|
||||
|
||||
// 設置影片顯示
|
||||
// 設置影片顯示
|
||||
if (videoDisplay != null)
|
||||
{
|
||||
videoPlayer.targetTexture = null;
|
||||
@ -59,7 +59,7 @@ public class ServerWorkMessageReplyWait2WorkingPanel : MonoBehaviour
|
||||
|
||||
void OnVideoFinished(VideoPlayer vp)
|
||||
{
|
||||
//Debug.Log("影片播放完成");
|
||||
//Debug.Log("影片播放完成");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,11 +16,11 @@ public class ServerWorkMessageReplyWordsPanel : MonoBehaviour
|
||||
|
||||
private int currentSampleWordsIndex = 0;
|
||||
private string[] sampleWords = {
|
||||
"福在心間非遠方行誠一步百事昌天開一線容人渡前路微光漸放芒",
|
||||
"命裡有時終必至急行反失遠行期靜看潮起潮又落好風自會送舟歸",
|
||||
"心誠萬事皆能順莫急莫慌自有門天道酬勤終不負善念長存歸本根",
|
||||
"汝問蒼天天不語早知汝路自難移命數原非神可改徒然叩首費心思",
|
||||
"求財無財空添亂問愛無愛更心煩問命問天徒自苦不如回家補個眠"
|
||||
"福在心間非遠方行誠一步百事昌天開一線容人渡前路微光漸放芒",
|
||||
"命裡有時終必至急行反失遠行期靜看潮起潮又落好風自會送舟歸",
|
||||
"心誠萬事皆能順莫急莫慌自有門天道酬勤終不負善念長存歸本根",
|
||||
"汝問蒼天天不語早知汝路自難移命數原非神可改徒然叩首費心思",
|
||||
"求財無財空添亂問愛無愛更心煩問命問天徒自苦不如回家補個眠"
|
||||
};
|
||||
|
||||
private void Awake()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user