From 585a8bcf9a2c72b170c8f981735f7034fa3e8c0c Mon Sep 17 00:00:00 2001 From: "chiyu.lin" Date: Tue, 18 Nov 2025 18:34:52 +0800 Subject: [PATCH] fix Q13 Q14 update text & countdown 60s --- Assets/Scenes/Server/ServerWorkScene.unity | 161 ++++++++++++++++-- .../Server/ServerWorkGameFinalPanel.cs | 46 +++++ Assets/Scripts/Utils/GlobalData.cs | 5 + 3 files changed, 201 insertions(+), 11 deletions(-) diff --git a/Assets/Scenes/Server/ServerWorkScene.unity b/Assets/Scenes/Server/ServerWorkScene.unity index bec7a42..d2dc6e7 100644 --- a/Assets/Scenes/Server/ServerWorkScene.unity +++ b/Assets/Scenes/Server/ServerWorkScene.unity @@ -680,6 +680,7 @@ RectTransform: - {fileID: 669591507} - {fileID: 1799202180} - {fileID: 1586239280} + - {fileID: 210382441} m_Father: {fileID: 85247803} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} @@ -1674,11 +1675,13 @@ MonoBehaviour: wordsLeftButton: {fileID: 1799202181} wordsRightButton: {fileID: 1586239281} wordsInputField: {fileID: 197304220} - wordsMessageTypeText: {fileID: 392621887} + wordsMessageTypeText: {fileID: 505411232} wordsMessageText: {fileID: 865729178} wordsPresentText: {fileID: 700040132} waittingVideoPlayer: {fileID: 1389573209} waittingRawImage: {fileID: 1100893614} + countdownText: {fileID: 210382442} + wordsCountdownTime: 60 --- !u!1 &91459950 GameObject: m_ObjectHideFlags: 0 @@ -3700,9 +3703,9 @@ RectTransform: m_Father: {fileID: 856404095} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_SizeDelta: {x: -17, y: 0} m_Pivot: {x: 0, y: 1} --- !u!114 &209353858 MonoBehaviour: @@ -3755,6 +3758,142 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 209353856} m_CullTransparentMesh: 1 +--- !u!1 &210382440 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 210382441} + - component: {fileID: 210382443} + - component: {fileID: 210382442} + m_Layer: 5 + m_Name: Status + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &210382441 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 210382440} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 41462179} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 480} + m_SizeDelta: {x: 200, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &210382442 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 210382440} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.TextMeshPro::TMPro.TextMeshProUGUI + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: XXXXX + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 2cfe2255ddbc8dc44b75239d2f654cd0, type: 2} + m_sharedMaterial: {fileID: -2170148179293471370, guid: 2cfe2255ddbc8dc44b75239d2f654cd0, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4282532418 + m_fontColor: {r: 0.25882354, g: 0.25882354, b: 0.25882354, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 36 + m_fontSizeBase: 36 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 1 + m_HorizontalAlignment: 1 + m_VerticalAlignment: 256 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_TextWrappingMode: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 0 + m_ActiveFontFeatures: 6e72656b + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_EmojiFallbackSupport: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: -115.43753, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!222 &210382443 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 210382440} + m_CullTransparentMesh: 1 --- !u!1 &223687182 GameObject: m_ObjectHideFlags: 0 @@ -5456,7 +5595,7 @@ MonoBehaviour: m_TargetGraphic: {fileID: 1887351187} m_HandleRect: {fileID: 1887351186} m_Direction: 2 - m_Value: 1.0000005 + m_Value: 1 m_Size: 0.79486334 m_NumberOfSteps: 0 m_OnValueChanged: @@ -7253,10 +7392,10 @@ RectTransform: m_Children: [] m_Father: {fileID: 631945161} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 458.341, y: -150} + m_SizeDelta: {x: 916.682, y: 300} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &542996589 MonoBehaviour: @@ -9291,7 +9430,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &732267258 RectTransform: m_ObjectHideFlags: 0 @@ -24020,8 +24159,8 @@ RectTransform: m_Children: [] m_Father: {fileID: 1980493388} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 0.20513666} + m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 20, y: 20} m_Pivot: {x: 0.5, y: 0.5} diff --git a/Assets/Scripts/Server/ServerWorkGameFinalPanel.cs b/Assets/Scripts/Server/ServerWorkGameFinalPanel.cs index 2802712..0738c54 100644 --- a/Assets/Scripts/Server/ServerWorkGameFinalPanel.cs +++ b/Assets/Scripts/Server/ServerWorkGameFinalPanel.cs @@ -1,4 +1,5 @@ using System; +using System.Collections; using TMPro; using Unity.VisualScripting; using UnityEngine; @@ -37,6 +38,9 @@ public class ServerWorkGameFinalPanel : MonoBehaviour public VideoPlayer waittingVideoPlayer; public RawImage waittingRawImage; + public TMP_Text countdownText; + + public int wordsCountdownTime = GlobalData.WORD_COUNTDOWN_TIME; private void Awake() { @@ -178,6 +182,20 @@ public class ServerWorkGameFinalPanel : MonoBehaviour { introPresentText.text = ServerWorkMessagePanel.workPresent; } + + //更新word系列文字 + if (wordsMessageTypeText) + { + wordsMessageTypeText.text = introMessageTypeText?.text ?? ""; + } + if (wordsMessageText) + { + wordsMessageText.text = introMessageText?.text ?? ""; + } + if (wordsPresentText) + { + wordsPresentText.text = introPresentText?.text ?? ""; + } } else { @@ -189,6 +207,13 @@ public class ServerWorkGameFinalPanel : MonoBehaviour if (replyPanel) { replyPanel.SetActive(step == 2); + //倒數時間 + if (step == 2) + { + wordsCountdownTime = GlobalData.WORD_COUNTDOWN_TIME; + UpdateWordsCountdownText(); + StartCoroutine(WordCountdown()); + } } if (waittingPanel) { @@ -199,4 +224,25 @@ public class ServerWorkGameFinalPanel : MonoBehaviour } } } + + IEnumerator WordCountdown() + { + yield return new WaitForSeconds(1f); + wordsCountdownTime--; + UpdateWordsCountdownText(); + + if (wordsCountdownTime > 0) + { + StartCoroutine(WordCountdown()); + } + else + { + wordsSubmitButton_onClicked(); + } + } + + private void UpdateWordsCountdownText() + { + countdownText.text = "倒計時 : " + wordsCountdownTime.ToString() + "s"; + } } diff --git a/Assets/Scripts/Utils/GlobalData.cs b/Assets/Scripts/Utils/GlobalData.cs index dc8be0a..a2d15b4 100644 --- a/Assets/Scripts/Utils/GlobalData.cs +++ b/Assets/Scripts/Utils/GlobalData.cs @@ -27,4 +27,9 @@ public class GlobalData /// 小遊戲 - 對話的倒數時間 /// public const int GAME_TALK_COUNTDOWN_TIME = 120; + + /// + /// 詩籤的倒數時間 + /// + public const int WORD_COUNTDOWN_TIME = 60; }