diff --git a/Assets/ExportStick/Scripts/Incensegamemanager.cs b/Assets/ExportStick/Scripts/Incensegamemanager.cs
index 89fc190..7935b96 100644
--- a/Assets/ExportStick/Scripts/Incensegamemanager.cs
+++ b/Assets/ExportStick/Scripts/Incensegamemanager.cs
@@ -47,7 +47,7 @@ public class IncenseGameManager : MonoBehaviour
private bool gameActive = true;
private int gameOverCountdownVal; // ✅ 新增:當前倒計時數值
- void Start()
+ void OnEnable()
{
InitializeGame();
}
diff --git a/Assets/Scripts/Server/ServerGameSticksPanel.cs b/Assets/Scripts/Server/ServerGameSticksPanel.cs
index 2318ad4..b228c01 100644
--- a/Assets/Scripts/Server/ServerGameSticksPanel.cs
+++ b/Assets/Scripts/Server/ServerGameSticksPanel.cs
@@ -8,113 +8,29 @@ public class ServerGameSticksPanel : MonoBehaviour
{
public static ServerGameSticksPanel Instance;
- public GameObject introPanel;
- public GameObject playPanel;
- public GameObject checkPanel;
-
- public VideoPlayer introVideoPlayer;
- public RawImage introRawImage;
-
- public TMP_Text playStatusText;
-
- private int gameTimeCountdownSecVal = 60;
-
- public void processStep(int step)
- {
- if (introPanel)
- {
- introPanel.SetActive(step == 1);
- if (step == 1)
- {
- gameTimeCountdownSecVal = 60;
- if (introVideoPlayer)
- {
- introVideoPlayer.Play();
- }
- }
- }
- if (playPanel)
- {
- playPanel.SetActive(step == 2);
- if (step == 2)
- {
- StartCoroutine(GameTimeCountdown());
- }
- }
- if (checkPanel)
- {
- checkPanel.SetActive(step == 3);
- if (step == 3)
- {
-
-
- }
- }
- }
-
- IEnumerator GameTimeCountdown()
- {
- yield return new WaitForSeconds(1f);
-
-
-
- gameTimeCountdownSecVal--;
- playStatusText.text = "倒計時 : " + gameTimeCountdownSecVal.ToString() + "s";
- if (gameTimeCountdownSecVal > 0)
- {
- StartCoroutine(GameTimeCountdown());
- }
- else
- {
- if (ServerWorkSceneController.Instance)
- {
- ServerWorkSceneController.Instance.processStep(17); // go to gameWaittingPanel
- }
- }
-
- }
-
- void SetupIntroVideoPlayer()
- {
- if (introVideoPlayer != null)
- {
- // 設置影片結束事件
- introVideoPlayer.loopPointReached += OnIntroVideoFinished;
-
- // 設置影片顯示
- if (introVideoPlayer != null)
- {
- introVideoPlayer.targetTexture = null;
- introVideoPlayer.renderMode = VideoRenderMode.RenderTexture;
- RenderTexture rt = new RenderTexture(1920, 1080, 24);
- introVideoPlayer.targetTexture = rt;
- introRawImage.texture = rt;
- }
- }
- }
-
- void OnIntroVideoFinished(VideoPlayer vp)
- {
- Debug.Log("影片播放完成");
- //StartCoroutine(LoadNextScene());
- processStep(2);
- }
+ private CustomerReportSystem customReportScript;
private void Awake()
{
Instance = this;
+ customReportScript = gameObject.GetComponentInChildren(includeInactive: true);
}
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
- SetupIntroVideoPlayer();
- init();
+ customReportScript.OnCustomerReportConfirmed = OnCustomerReportConfirmed;
}
-
- public void init()
+
+ private void OnCustomerReportConfirmed(int[] values)
{
- processStep(1);
+ if (values.Length < 3) { return; }
+ if (ServerWorkTopRightScore.Instance == null) { return; }
+
+ GlobalData.VIRTUE_SCORE = values[0];
+ GlobalData.KARMA_SCORE = values[1];
+ GlobalData.SINCERITY_SCORE = values[2];
+ ServerWorkTopRightScore.Instance.UpdateScoreVals();
}
// Update is called once per frame
diff --git a/Assets/Scripts/Server/ServerGameTalkingPanel.cs b/Assets/Scripts/Server/ServerGameTalkingPanel.cs
index 0f24469..002c17c 100644
--- a/Assets/Scripts/Server/ServerGameTalkingPanel.cs
+++ b/Assets/Scripts/Server/ServerGameTalkingPanel.cs
@@ -217,9 +217,6 @@ public class ServerGameTalkingPanel : MonoBehaviour
{
playChatText.text = "";
statusText.text = "倒計時 : " + gameTimeCountdownSecVal.ToString() + "s";
- //打開時更新數值
- int[] scores = { GlobalData.VIRTUE_SCORE, GlobalData.KARMA_SCORE, GlobalData.SINCERITY_SCORE };
- customReportScript.SetAllCustomerValues(scores);
StartCoroutine(GameTimeCountdown());
}
}
diff --git a/Assets/Scripts/Server/ServerGameTypingPanel.cs b/Assets/Scripts/Server/ServerGameTypingPanel.cs
index e5e140b..d895982 100644
--- a/Assets/Scripts/Server/ServerGameTypingPanel.cs
+++ b/Assets/Scripts/Server/ServerGameTypingPanel.cs
@@ -65,9 +65,6 @@ public class ServerGameTypingPanel : MonoBehaviour
if (step == 3)
{
checkText.text = result;
- //打開時更新數值
- int[] scores = { GlobalData.VIRTUE_SCORE, GlobalData.KARMA_SCORE, GlobalData.SINCERITY_SCORE };
- customReportScript.SetAllCustomerValues(scores);
StartCoroutine(GameTimeCountdown());
}
}
diff --git a/Assets/Scripts/Server/ServerWorkSceneController.cs b/Assets/Scripts/Server/ServerWorkSceneController.cs
index 3794917..918026d 100644
--- a/Assets/Scripts/Server/ServerWorkSceneController.cs
+++ b/Assets/Scripts/Server/ServerWorkSceneController.cs
@@ -30,6 +30,7 @@ public class ServerWorkSceneController : MonoBehaviour
void Awake()
{
Instance = this;
+ gameSticksPanel.GetOrAddComponent();
}
private void OnEnable()
{
diff --git a/Assets/Scripts/Utils/CustomerReportSystem.cs b/Assets/Scripts/Utils/CustomerReportSystem.cs
index c4b9b21..059dfcb 100644
--- a/Assets/Scripts/Utils/CustomerReportSystem.cs
+++ b/Assets/Scripts/Utils/CustomerReportSystem.cs
@@ -1,3 +1,4 @@
+using System;
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
@@ -63,6 +64,13 @@ public class CustomerReportSystem : MonoBehaviour
InitializeCustomerReport();
}
+ private void OnEnable()
+ {
+ //打開時更新數值
+ int[] scores = { GlobalData.VIRTUE_SCORE, GlobalData.KARMA_SCORE, GlobalData.SINCERITY_SCORE };
+ SetAllCustomerValues(scores);
+ }
+
private void Start()
{
SetupEventListeners();