fix Q25
改為CustomerReportSystem開啟時更新數值 同步遊戲3的報表
This commit is contained in:
parent
40e56630e6
commit
40ce37edff
@ -47,7 +47,7 @@ public class IncenseGameManager : MonoBehaviour
|
|||||||
private bool gameActive = true;
|
private bool gameActive = true;
|
||||||
private int gameOverCountdownVal; // ✅ 新增:當前倒計時數值
|
private int gameOverCountdownVal; // ✅ 新增:當前倒計時數值
|
||||||
|
|
||||||
void Start()
|
void OnEnable()
|
||||||
{
|
{
|
||||||
InitializeGame();
|
InitializeGame();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,113 +8,29 @@ public class ServerGameSticksPanel : MonoBehaviour
|
|||||||
{
|
{
|
||||||
public static ServerGameSticksPanel Instance;
|
public static ServerGameSticksPanel Instance;
|
||||||
|
|
||||||
public GameObject introPanel;
|
private CustomerReportSystem customReportScript;
|
||||||
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 = "倒計時 : <color=\"red\">" + gameTimeCountdownSecVal.ToString() + "</color>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 void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
Instance = this;
|
Instance = this;
|
||||||
|
customReportScript = gameObject.GetComponentInChildren<CustomerReportSystem>(includeInactive: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
SetupIntroVideoPlayer();
|
customReportScript.OnCustomerReportConfirmed = OnCustomerReportConfirmed;
|
||||||
init();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
// Update is called once per frame
|
||||||
|
|||||||
@ -217,9 +217,6 @@ public class ServerGameTalkingPanel : MonoBehaviour
|
|||||||
{
|
{
|
||||||
playChatText.text = "";
|
playChatText.text = "";
|
||||||
statusText.text = "倒計時 : <color=\"red\">" + gameTimeCountdownSecVal.ToString() + "</color>s";
|
statusText.text = "倒計時 : <color=\"red\">" + gameTimeCountdownSecVal.ToString() + "</color>s";
|
||||||
//打開時更新數值
|
|
||||||
int[] scores = { GlobalData.VIRTUE_SCORE, GlobalData.KARMA_SCORE, GlobalData.SINCERITY_SCORE };
|
|
||||||
customReportScript.SetAllCustomerValues(scores);
|
|
||||||
StartCoroutine(GameTimeCountdown());
|
StartCoroutine(GameTimeCountdown());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -65,9 +65,6 @@ public class ServerGameTypingPanel : MonoBehaviour
|
|||||||
if (step == 3)
|
if (step == 3)
|
||||||
{
|
{
|
||||||
checkText.text = result;
|
checkText.text = result;
|
||||||
//打開時更新數值
|
|
||||||
int[] scores = { GlobalData.VIRTUE_SCORE, GlobalData.KARMA_SCORE, GlobalData.SINCERITY_SCORE };
|
|
||||||
customReportScript.SetAllCustomerValues(scores);
|
|
||||||
StartCoroutine(GameTimeCountdown());
|
StartCoroutine(GameTimeCountdown());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,6 +30,7 @@ public class ServerWorkSceneController : MonoBehaviour
|
|||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
Instance = this;
|
Instance = this;
|
||||||
|
gameSticksPanel.GetOrAddComponent<ServerGameSticksPanel>();
|
||||||
}
|
}
|
||||||
private void OnEnable()
|
private void OnEnable()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
@ -63,6 +64,13 @@ public class CustomerReportSystem : MonoBehaviour
|
|||||||
InitializeCustomerReport();
|
InitializeCustomerReport();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnEnable()
|
||||||
|
{
|
||||||
|
//打開時更新數值
|
||||||
|
int[] scores = { GlobalData.VIRTUE_SCORE, GlobalData.KARMA_SCORE, GlobalData.SINCERITY_SCORE };
|
||||||
|
SetAllCustomerValues(scores);
|
||||||
|
}
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
SetupEventListeners();
|
SetupEventListeners();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user