main #1
1
.gitignore
vendored
1
.gitignore
vendored
@ -98,3 +98,4 @@ InitTestScene*.unity*
|
|||||||
# Auto-generated scenes by play mode tests
|
# Auto-generated scenes by play mode tests
|
||||||
/[Aa]ssets/[Ii]nit[Tt]est[Ss]cene*.unity*
|
/[Aa]ssets/[Ii]nit[Tt]est[Ss]cene*.unity*
|
||||||
|
|
||||||
|
.idea/
|
||||||
|
|||||||
@ -680,6 +680,7 @@ RectTransform:
|
|||||||
- {fileID: 669591507}
|
- {fileID: 669591507}
|
||||||
- {fileID: 1799202180}
|
- {fileID: 1799202180}
|
||||||
- {fileID: 1586239280}
|
- {fileID: 1586239280}
|
||||||
|
- {fileID: 210382441}
|
||||||
m_Father: {fileID: 85247803}
|
m_Father: {fileID: 85247803}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
@ -1674,11 +1675,13 @@ MonoBehaviour:
|
|||||||
wordsLeftButton: {fileID: 1799202181}
|
wordsLeftButton: {fileID: 1799202181}
|
||||||
wordsRightButton: {fileID: 1586239281}
|
wordsRightButton: {fileID: 1586239281}
|
||||||
wordsInputField: {fileID: 197304220}
|
wordsInputField: {fileID: 197304220}
|
||||||
wordsMessageTypeText: {fileID: 392621887}
|
wordsMessageTypeText: {fileID: 505411232}
|
||||||
wordsMessageText: {fileID: 865729178}
|
wordsMessageText: {fileID: 865729178}
|
||||||
wordsPresentText: {fileID: 700040132}
|
wordsPresentText: {fileID: 700040132}
|
||||||
waittingVideoPlayer: {fileID: 1389573209}
|
waittingVideoPlayer: {fileID: 1389573209}
|
||||||
waittingRawImage: {fileID: 1100893614}
|
waittingRawImage: {fileID: 1100893614}
|
||||||
|
countdownText: {fileID: 210382442}
|
||||||
|
wordsCountdownTime: 60
|
||||||
--- !u!1 &91459950
|
--- !u!1 &91459950
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -3700,9 +3703,9 @@ RectTransform:
|
|||||||
m_Father: {fileID: 856404095}
|
m_Father: {fileID: 856404095}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 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_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 0, y: 0}
|
m_SizeDelta: {x: -17, y: 0}
|
||||||
m_Pivot: {x: 0, y: 1}
|
m_Pivot: {x: 0, y: 1}
|
||||||
--- !u!114 &209353858
|
--- !u!114 &209353858
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@ -3755,6 +3758,142 @@ CanvasRenderer:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 209353856}
|
m_GameObject: {fileID: 209353856}
|
||||||
m_CullTransparentMesh: 1
|
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
|
--- !u!1 &223687182
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -5456,7 +5595,7 @@ MonoBehaviour:
|
|||||||
m_TargetGraphic: {fileID: 1887351187}
|
m_TargetGraphic: {fileID: 1887351187}
|
||||||
m_HandleRect: {fileID: 1887351186}
|
m_HandleRect: {fileID: 1887351186}
|
||||||
m_Direction: 2
|
m_Direction: 2
|
||||||
m_Value: 1.0000005
|
m_Value: 1
|
||||||
m_Size: 0.79486334
|
m_Size: 0.79486334
|
||||||
m_NumberOfSteps: 0
|
m_NumberOfSteps: 0
|
||||||
m_OnValueChanged:
|
m_OnValueChanged:
|
||||||
@ -7253,10 +7392,10 @@ RectTransform:
|
|||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 631945161}
|
m_Father: {fileID: 631945161}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 1}
|
||||||
m_AnchorMax: {x: 0, y: 0}
|
m_AnchorMax: {x: 0, y: 1}
|
||||||
m_AnchoredPosition: {x: 0, y: 0}
|
m_AnchoredPosition: {x: 458.341, y: -150}
|
||||||
m_SizeDelta: {x: 0, y: 0}
|
m_SizeDelta: {x: 916.682, y: 300}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!114 &542996589
|
--- !u!114 &542996589
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@ -9291,7 +9430,7 @@ GameObject:
|
|||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 1
|
m_IsActive: 0
|
||||||
--- !u!224 &732267258
|
--- !u!224 &732267258
|
||||||
RectTransform:
|
RectTransform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -24020,8 +24159,8 @@ RectTransform:
|
|||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1980493388}
|
m_Father: {fileID: 1980493388}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 0.20513666}
|
||||||
m_AnchorMax: {x: 0, y: 0}
|
m_AnchorMax: {x: 1, y: 1}
|
||||||
m_AnchoredPosition: {x: 0, y: 0}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 20, y: 20}
|
m_SizeDelta: {x: 20, y: 20}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
|||||||
@ -20,11 +20,11 @@ public class ClientFinalSceneController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
SetupVideoPlayer();
|
SetupVideoPlayer();
|
||||||
|
|
||||||
// 開始播放影片
|
// 開始播放影片
|
||||||
if (videoPlayer != null)
|
if (videoPlayer != null)
|
||||||
{
|
{
|
||||||
videoPlayer.Play();
|
videoPlayer.Play();
|
||||||
Debug.Log("開始播放影片");
|
Debug.Log("開始播放影片");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,10 +32,10 @@ public class ClientFinalSceneController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (videoPlayer != null)
|
if (videoPlayer != null)
|
||||||
{
|
{
|
||||||
// 設置影片結束事件
|
// 設置影片結束事件
|
||||||
videoPlayer.loopPointReached += OnVideoFinished;
|
videoPlayer.loopPointReached += OnVideoFinished;
|
||||||
|
|
||||||
// 設置影片顯示
|
// 設置影片顯示
|
||||||
if (videoDisplay != null)
|
if (videoDisplay != null)
|
||||||
{
|
{
|
||||||
videoPlayer.targetTexture = null;
|
videoPlayer.targetTexture = null;
|
||||||
@ -49,7 +49,7 @@ public class ClientFinalSceneController : MonoBehaviour
|
|||||||
|
|
||||||
void OnVideoFinished(VideoPlayer vp)
|
void OnVideoFinished(VideoPlayer vp)
|
||||||
{
|
{
|
||||||
Debug.Log("影片播放完成,準備跳轉");
|
Debug.Log("影片播放完成,準備跳轉");
|
||||||
StartCoroutine(LoadNextScene());
|
StartCoroutine(LoadNextScene());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -20,11 +20,11 @@ public class ClientGameBackToRealSceneController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
SetupVideoPlayer();
|
SetupVideoPlayer();
|
||||||
|
|
||||||
// 開始播放影片
|
// 開始播放影片
|
||||||
if (videoPlayer != null)
|
if (videoPlayer != null)
|
||||||
{
|
{
|
||||||
videoPlayer.Play();
|
videoPlayer.Play();
|
||||||
Debug.Log("開始播放影片");
|
Debug.Log("開始播放影片");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,10 +32,10 @@ public class ClientGameBackToRealSceneController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (videoPlayer != null)
|
if (videoPlayer != null)
|
||||||
{
|
{
|
||||||
// 設置影片結束事件
|
// 設置影片結束事件
|
||||||
videoPlayer.loopPointReached += OnVideoFinished;
|
videoPlayer.loopPointReached += OnVideoFinished;
|
||||||
|
|
||||||
// 設置影片顯示
|
// 設置影片顯示
|
||||||
if (videoDisplay != null)
|
if (videoDisplay != null)
|
||||||
{
|
{
|
||||||
videoPlayer.targetTexture = null;
|
videoPlayer.targetTexture = null;
|
||||||
@ -49,7 +49,7 @@ public class ClientGameBackToRealSceneController : MonoBehaviour
|
|||||||
|
|
||||||
void OnVideoFinished(VideoPlayer vp)
|
void OnVideoFinished(VideoPlayer vp)
|
||||||
{
|
{
|
||||||
Debug.Log("影片播放完成,準備跳轉");
|
Debug.Log("影片播放完成,準備跳轉");
|
||||||
if (!string.IsNullOrEmpty(ClientLastWordsSceneController.words))
|
if (!string.IsNullOrEmpty(ClientLastWordsSceneController.words))
|
||||||
{
|
{
|
||||||
StartCoroutine(LoadNextScene());
|
StartCoroutine(LoadNextScene());
|
||||||
|
|||||||
@ -23,7 +23,7 @@ public class ClientGameTalkingSceneController : MonoBehaviour
|
|||||||
public Button finishGoToNextButton;
|
public Button finishGoToNextButton;
|
||||||
public Button finishBackToMenuButton;
|
public Button finishBackToMenuButton;
|
||||||
|
|
||||||
private int playCountdownSecVal = 120;
|
private int playCountdownSecVal = GlobalData.GAME_TALK_COUNTDOWN_TIME;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
@ -57,7 +57,7 @@ public class ClientGameTalkingSceneController : MonoBehaviour
|
|||||||
ClientMessageHandler.Instance.SendMessageToServer("gameTalkingPeopleSay", playMessageInputField.text);
|
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 = "";
|
playMessageInputField.text = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,7 +65,7 @@ public class ClientGameTalkingSceneController : MonoBehaviour
|
|||||||
public void onReceivedChatMessage(string message)
|
public void onReceivedChatMessage(string message)
|
||||||
{
|
{
|
||||||
|
|
||||||
playChatText.text = "-神明-<br>" + message + "<br>" + playChatText.text;
|
playChatText.text = "-神明-<br>" + message + "<br>" + playChatText.text;
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerator StatusCountdown()
|
IEnumerator StatusCountdown()
|
||||||
@ -74,7 +74,7 @@ public class ClientGameTalkingSceneController : MonoBehaviour
|
|||||||
|
|
||||||
playCountdownSecVal--;
|
playCountdownSecVal--;
|
||||||
|
|
||||||
playCountdownText.text = "時間倒數 " + playCountdownSecVal.ToString() + "秒";
|
playCountdownText.text = "時間倒數 " + playCountdownSecVal.ToString() + "秒";
|
||||||
|
|
||||||
if (playCountdownSecVal > 0)
|
if (playCountdownSecVal > 0)
|
||||||
{
|
{
|
||||||
@ -116,7 +116,7 @@ public class ClientGameTalkingSceneController : MonoBehaviour
|
|||||||
if (step == 1)
|
if (step == 1)
|
||||||
{
|
{
|
||||||
playCount++;
|
playCount++;
|
||||||
playCountdownSecVal = 120;
|
playCountdownSecVal = GlobalData.GAME_TALK_COUNTDOWN_TIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,7 +35,7 @@ public class ClientGameTypingSceneController : MonoBehaviour
|
|||||||
|
|
||||||
playCountdownSecVal--;
|
playCountdownSecVal--;
|
||||||
|
|
||||||
playCountdownText.text = "時間倒數 " + playCountdownSecVal.ToString() + "秒";
|
playCountdownText.text = "時間倒數 " + playCountdownSecVal.ToString() + "秒";
|
||||||
|
|
||||||
if (playCountdownSecVal > 0)
|
if (playCountdownSecVal > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -7,7 +7,7 @@ public class ClientGlobalMenuManager : MonoBehaviour
|
|||||||
{
|
{
|
||||||
public static ClientGlobalMenuManager Instance;
|
public static ClientGlobalMenuManager Instance;
|
||||||
|
|
||||||
[Header("UI 元件")]
|
[Header("UI 元件")]
|
||||||
public GameObject menuButton;
|
public GameObject menuButton;
|
||||||
public GameObject menuPanel;
|
public GameObject menuPanel;
|
||||||
public Button homeButton;
|
public Button homeButton;
|
||||||
@ -20,7 +20,7 @@ public class ClientGlobalMenuManager : MonoBehaviour
|
|||||||
if (Instance == null)
|
if (Instance == null)
|
||||||
{
|
{
|
||||||
Instance = this;
|
Instance = this;
|
||||||
// 將整個 Canvas 設為 DontDestroyOnLoad
|
// 將整個 Canvas 設為 DontDestroyOnLoad
|
||||||
if (transform.parent != null)
|
if (transform.parent != null)
|
||||||
{
|
{
|
||||||
DontDestroyOnLoad(transform.root.gameObject);
|
DontDestroyOnLoad(transform.root.gameObject);
|
||||||
@ -44,11 +44,11 @@ public class ClientGlobalMenuManager : MonoBehaviour
|
|||||||
|
|
||||||
void InitializeMenu()
|
void InitializeMenu()
|
||||||
{
|
{
|
||||||
// 確保選單面板一開始是隱藏的
|
// 確保選單面板一開始是隱藏的
|
||||||
if (menuPanel != null)
|
if (menuPanel != null)
|
||||||
menuPanel.SetActive(false);
|
menuPanel.SetActive(false);
|
||||||
|
|
||||||
// 綁定按鈕事件
|
// 綁定按鈕事件
|
||||||
if (menuButton != null)
|
if (menuButton != null)
|
||||||
{
|
{
|
||||||
Button btn = menuButton.GetComponent<Button>();
|
Button btn = menuButton.GetComponent<Button>();
|
||||||
@ -83,7 +83,7 @@ public class ClientGlobalMenuManager : MonoBehaviour
|
|||||||
skipButton.onClick.AddListener(SkipButton);
|
skipButton.onClick.AddListener(SkipButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Log("Client GlobalMenuManager 初始化完成");
|
Debug.Log("Client GlobalMenuManager 初始化完成");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ public class ClientGlobalMenuManager : MonoBehaviour
|
|||||||
if (menuPanel != null)
|
if (menuPanel != null)
|
||||||
{
|
{
|
||||||
menuPanel.SetActive(true);
|
menuPanel.SetActive(true);
|
||||||
Debug.Log("選單已打開");
|
Debug.Log("選單已打開");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,20 +101,20 @@ public class ClientGlobalMenuManager : MonoBehaviour
|
|||||||
if (menuPanel != null)
|
if (menuPanel != null)
|
||||||
{
|
{
|
||||||
menuPanel.SetActive(false);
|
menuPanel.SetActive(false);
|
||||||
Debug.Log("選單已關閉");
|
Debug.Log("選單已關閉");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GoToHome()
|
void GoToHome()
|
||||||
{
|
{
|
||||||
Debug.Log("返回主頁");
|
Debug.Log("返回主頁");
|
||||||
SceneManager.LoadScene("ClientHomeScene");
|
SceneManager.LoadScene("ClientHomeScene");
|
||||||
CloseMenu();
|
CloseMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuitApplication()
|
void QuitApplication()
|
||||||
{
|
{
|
||||||
Debug.Log("離開程式");
|
Debug.Log("離開程式");
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
UnityEditor.EditorApplication.isPlaying = false;
|
UnityEditor.EditorApplication.isPlaying = false;
|
||||||
#else
|
#else
|
||||||
|
|||||||
@ -10,7 +10,7 @@ public class ClientHomeSceneController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
public static ClientHomeSceneController Instance;
|
public static ClientHomeSceneController Instance;
|
||||||
|
|
||||||
[Header("UI じン")]
|
[Header("UI 元件")]
|
||||||
public Button startButton;
|
public Button startButton;
|
||||||
|
|
||||||
void Awake()
|
void Awake()
|
||||||
|
|||||||
@ -9,7 +9,7 @@ public class ClientHomeWaittingSceneController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
public static ClientHomeWaittingSceneController Instance;
|
public static ClientHomeWaittingSceneController Instance;
|
||||||
|
|
||||||
[Header("UI 元件")]
|
[Header("UI 元件")]
|
||||||
public TMP_Text statusText;
|
public TMP_Text statusText;
|
||||||
|
|
||||||
private bool isConnecting = false;
|
private bool isConnecting = false;
|
||||||
@ -35,7 +35,7 @@ public class ClientHomeWaittingSceneController : MonoBehaviour
|
|||||||
|
|
||||||
if (statusText != null)
|
if (statusText != null)
|
||||||
{
|
{
|
||||||
statusText.text = "等待神明的降臨";
|
statusText.text = "等待神明的降臨";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,28 +46,28 @@ public class ClientHomeWaittingSceneController : MonoBehaviour
|
|||||||
|
|
||||||
if (statusText != null)
|
if (statusText != null)
|
||||||
{
|
{
|
||||||
statusText.text = "等待神明的降臨.";
|
statusText.text = "等待神明的降臨.";
|
||||||
}
|
}
|
||||||
|
|
||||||
// 設置 NetworkManager
|
// 設置 NetworkManager
|
||||||
if (ClientNetworkManager.Instance != null)
|
if (ClientNetworkManager.Instance != null)
|
||||||
{
|
{
|
||||||
//ClientNetworkManager.Instance.StopClient();
|
//ClientNetworkManager.Instance.StopClient();
|
||||||
ClientNetworkManager.Instance.networkAddress = ClientInitSceneController.ServerAddr;
|
ClientNetworkManager.Instance.networkAddress = ClientInitSceneController.ServerAddr;
|
||||||
|
|
||||||
// 使用 Telepathy (TCP) Transport
|
// 使用 Telepathy (TCP) Transport
|
||||||
TelepathyTransport transport = ClientNetworkManager.Instance.GetComponent<TelepathyTransport>();
|
TelepathyTransport transport = ClientNetworkManager.Instance.GetComponent<TelepathyTransport>();
|
||||||
if (transport != null)
|
if (transport != null)
|
||||||
{
|
{
|
||||||
transport.port = ClientInitSceneController.ServerPort;
|
transport.port = ClientInitSceneController.ServerPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 開始連線
|
// 開始連線
|
||||||
ClientNetworkManager.Instance.StartClient();
|
ClientNetworkManager.Instance.StartClient();
|
||||||
Debug.Log($"開始連線到 {ClientInitSceneController.ServerAddr}:{ClientInitSceneController.ServerPort}");
|
Debug.Log($"開始連線到 {ClientInitSceneController.ServerAddr}:{ClientInitSceneController.ServerPort}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 等待連線
|
// 等待連線
|
||||||
float timeout = 3f;
|
float timeout = 3f;
|
||||||
float elapsed = 0f;
|
float elapsed = 0f;
|
||||||
|
|
||||||
@ -79,11 +79,11 @@ public class ClientHomeWaittingSceneController : MonoBehaviour
|
|||||||
|
|
||||||
if (NetworkClient.isConnected)
|
if (NetworkClient.isConnected)
|
||||||
{
|
{
|
||||||
Debug.Log("連線成功!等待 Welcome 訊息...");
|
Debug.Log("連線成功!等待 Welcome 訊息...");
|
||||||
|
|
||||||
if (statusText != null)
|
if (statusText != null)
|
||||||
{
|
{
|
||||||
statusText.text = "等待神明的降臨..";
|
statusText.text = "等待神明的降臨..";
|
||||||
}
|
}
|
||||||
|
|
||||||
// send welcome
|
// send welcome
|
||||||
@ -93,16 +93,16 @@ public class ClientHomeWaittingSceneController : MonoBehaviour
|
|||||||
ClientMessageHandler.Instance.SendMessageToServer("welcome", "hello");
|
ClientMessageHandler.Instance.SendMessageToServer("welcome", "hello");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 等待 Welcome 訊息
|
// 等待 Welcome 訊息
|
||||||
yield return StartCoroutine(WaitForWelcomeMessage());
|
yield return StartCoroutine(WaitForWelcomeMessage());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.LogError("連線失敗!");
|
Debug.LogError("連線失敗!");
|
||||||
|
|
||||||
if (statusText != null)
|
if (statusText != null)
|
||||||
{
|
{
|
||||||
statusText.text = "等待神明的降臨...!";
|
statusText.text = "等待神明的降臨...!";
|
||||||
}
|
}
|
||||||
|
|
||||||
isConnecting = false;
|
isConnecting = false;
|
||||||
@ -124,11 +124,11 @@ public class ClientHomeWaittingSceneController : MonoBehaviour
|
|||||||
|
|
||||||
if (!welcomeReceived)
|
if (!welcomeReceived)
|
||||||
{
|
{
|
||||||
Debug.LogError("未收到 Welcome 訊息!");
|
Debug.LogError("未收到 Welcome 訊息!");
|
||||||
|
|
||||||
if (statusText != null)
|
if (statusText != null)
|
||||||
{
|
{
|
||||||
statusText.text = "等待神明的降臨...!!";
|
statusText.text = "等待神明的降臨...!!";
|
||||||
}
|
}
|
||||||
|
|
||||||
isConnecting = false;
|
isConnecting = false;
|
||||||
@ -139,11 +139,11 @@ public class ClientHomeWaittingSceneController : MonoBehaviour
|
|||||||
public void OnWelcomeMessageReceived()
|
public void OnWelcomeMessageReceived()
|
||||||
{
|
{
|
||||||
welcomeReceived = true;
|
welcomeReceived = true;
|
||||||
Debug.Log("Welcome 訊息已驗證,準備跳轉場景");
|
Debug.Log("Welcome 訊息已驗證,準備跳轉場景");
|
||||||
|
|
||||||
if (statusText != null)
|
if (statusText != null)
|
||||||
{
|
{
|
||||||
statusText.text = "等待神明的降臨...";
|
statusText.text = "等待神明的降臨...";
|
||||||
}
|
}
|
||||||
|
|
||||||
StartCoroutine(LoadIntroScene());
|
StartCoroutine(LoadIntroScene());
|
||||||
|
|||||||
@ -38,7 +38,7 @@ public class ClientInitSceneController : MonoBehaviour
|
|||||||
|
|
||||||
void InitializeClient()
|
void InitializeClient()
|
||||||
{
|
{
|
||||||
Debug.Log("ªì©l¤Æ Client...");
|
Debug.Log("初始化 Client...");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,7 @@ public class ClientIntroSceneController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
public static ClientIntroSceneController Instance;
|
public static ClientIntroSceneController Instance;
|
||||||
|
|
||||||
[Header("影片播放")]
|
[Header("影片播放")]
|
||||||
public VideoPlayer videoPlayer;
|
public VideoPlayer videoPlayer;
|
||||||
public RawImage videoDisplay;
|
public RawImage videoDisplay;
|
||||||
|
|
||||||
@ -21,11 +21,11 @@ public class ClientIntroSceneController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
SetupVideoPlayer();
|
SetupVideoPlayer();
|
||||||
|
|
||||||
// 開始播放影片
|
// 開始播放影片
|
||||||
if (videoPlayer != null)
|
if (videoPlayer != null)
|
||||||
{
|
{
|
||||||
videoPlayer.Play();
|
videoPlayer.Play();
|
||||||
Debug.Log("開始播放介紹影片");
|
Debug.Log("開始播放介紹影片");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,10 +33,10 @@ public class ClientIntroSceneController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (videoPlayer != null)
|
if (videoPlayer != null)
|
||||||
{
|
{
|
||||||
// 設置影片結束事件
|
// 設置影片結束事件
|
||||||
videoPlayer.loopPointReached += OnVideoFinished;
|
videoPlayer.loopPointReached += OnVideoFinished;
|
||||||
|
|
||||||
// 設置影片顯示
|
// 設置影片顯示
|
||||||
if (videoDisplay != null)
|
if (videoDisplay != null)
|
||||||
{
|
{
|
||||||
videoPlayer.targetTexture = null;
|
videoPlayer.targetTexture = null;
|
||||||
@ -50,7 +50,7 @@ public class ClientIntroSceneController : MonoBehaviour
|
|||||||
|
|
||||||
void OnVideoFinished(VideoPlayer vp)
|
void OnVideoFinished(VideoPlayer vp)
|
||||||
{
|
{
|
||||||
Debug.Log("影片播放完成,準備跳轉到 ClientWorkScene");
|
Debug.Log("影片播放完成,準備跳轉到 ClientWorkScene");
|
||||||
StartCoroutine(LoadNextScene());
|
StartCoroutine(LoadNextScene());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,7 @@ public class ClientMessageHandler : MonoBehaviour
|
|||||||
|
|
||||||
void OnServerMessageReceived(GameMessage msg)
|
void OnServerMessageReceived(GameMessage msg)
|
||||||
{
|
{
|
||||||
Debug.Log($"收到 Server 訊息: {msg.action} {msg.payload}");
|
Debug.Log($"收到 Server 訊息: {msg.action} {msg.payload}");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -42,7 +42,7 @@ public class ClientMessageHandler : MonoBehaviour
|
|||||||
switch(msg.payload)
|
switch(msg.payload)
|
||||||
{
|
{
|
||||||
case "hello":
|
case "hello":
|
||||||
Debug.Log("Welcome 訊息驗證成功");
|
Debug.Log("Welcome 訊息驗證成功");
|
||||||
|
|
||||||
// clean data
|
// clean data
|
||||||
ClientWorkMessageHandleSceneController.cleanData();
|
ClientWorkMessageHandleSceneController.cleanData();
|
||||||
@ -107,7 +107,7 @@ public class ClientMessageHandler : MonoBehaviour
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
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 };
|
GameMessage msg = new GameMessage { action = action, payload = message };
|
||||||
NetworkClient.Send(msg);
|
NetworkClient.Send(msg);
|
||||||
Debug.Log($"發送訊息到 Server: {message}");
|
Debug.Log($"發送訊息到 Server: {message}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.LogError($"發送訊息到 Server 失敗: {message}");
|
Debug.LogError($"發送訊息到 Server 失敗: {message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,7 +21,7 @@ public class ClientNetworkManager : NetworkManager
|
|||||||
public override void OnClientConnect()
|
public override void OnClientConnect()
|
||||||
{
|
{
|
||||||
base.OnClientConnect();
|
base.OnClientConnect();
|
||||||
Debug.Log("Client 已連接到 Server");
|
Debug.Log("Client 已連接到 Server");
|
||||||
if (ClientMessageHandler.Instance != null)
|
if (ClientMessageHandler.Instance != null)
|
||||||
{
|
{
|
||||||
ClientMessageHandler.Instance.RegisterHandler();
|
ClientMessageHandler.Instance.RegisterHandler();
|
||||||
@ -35,7 +35,7 @@ public class ClientNetworkManager : NetworkManager
|
|||||||
ClientMessageHandler.Instance.UnregisterHandler();
|
ClientMessageHandler.Instance.UnregisterHandler();
|
||||||
}
|
}
|
||||||
base.OnClientDisconnect();
|
base.OnClientDisconnect();
|
||||||
Debug.Log("Client 已斷開連接");
|
Debug.Log("Client 已斷開連接");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -9,7 +9,7 @@ public class ClientWorkMessageFinishSceneController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
public static ClientWorkMessageFinishSceneController Instance;
|
public static ClientWorkMessageFinishSceneController Instance;
|
||||||
|
|
||||||
[Header("影片播放")]
|
[Header("影片播放")]
|
||||||
public VideoPlayer videoPlayer;
|
public VideoPlayer videoPlayer;
|
||||||
public RawImage videoDisplay;
|
public RawImage videoDisplay;
|
||||||
|
|
||||||
@ -22,11 +22,11 @@ public class ClientWorkMessageFinishSceneController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
SetupVideoPlayer();
|
SetupVideoPlayer();
|
||||||
|
|
||||||
// 開始播放影片
|
// 開始播放影片
|
||||||
if (videoPlayer != null)
|
if (videoPlayer != null)
|
||||||
{
|
{
|
||||||
videoPlayer.Play();
|
videoPlayer.Play();
|
||||||
Debug.Log("開始播放影片");
|
Debug.Log("開始播放影片");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,10 +34,10 @@ public class ClientWorkMessageFinishSceneController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (videoPlayer != null)
|
if (videoPlayer != null)
|
||||||
{
|
{
|
||||||
// 設置影片結束事件
|
// 設置影片結束事件
|
||||||
videoPlayer.loopPointReached += OnVideoFinished;
|
videoPlayer.loopPointReached += OnVideoFinished;
|
||||||
|
|
||||||
// 設置影片顯示
|
// 設置影片顯示
|
||||||
if (videoDisplay != null)
|
if (videoDisplay != null)
|
||||||
{
|
{
|
||||||
videoPlayer.targetTexture = null;
|
videoPlayer.targetTexture = null;
|
||||||
@ -51,7 +51,7 @@ public class ClientWorkMessageFinishSceneController : MonoBehaviour
|
|||||||
|
|
||||||
void OnVideoFinished(VideoPlayer vp)
|
void OnVideoFinished(VideoPlayer vp)
|
||||||
{
|
{
|
||||||
Debug.Log("影片播放完成,準備跳轉");
|
Debug.Log("影片播放完成,準備跳轉");
|
||||||
StartCoroutine(LoadNextScene());
|
StartCoroutine(LoadNextScene());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,7 @@ public class ClientWorkMessageHandleSceneController : MonoBehaviour
|
|||||||
public static string messageResult = "";
|
public static string messageResult = "";
|
||||||
public static string messageResultText = "";
|
public static string messageResultText = "";
|
||||||
|
|
||||||
[Header("影片播放")]
|
[Header("影片播放")]
|
||||||
public VideoPlayer videoPlayer;
|
public VideoPlayer videoPlayer;
|
||||||
public RawImage videoDisplay;
|
public RawImage videoDisplay;
|
||||||
|
|
||||||
@ -32,11 +32,11 @@ public class ClientWorkMessageHandleSceneController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
SetupVideoPlayer();
|
SetupVideoPlayer();
|
||||||
|
|
||||||
// 開始播放影片
|
// 開始播放影片
|
||||||
if (videoPlayer != null)
|
if (videoPlayer != null)
|
||||||
{
|
{
|
||||||
videoPlayer.Play();
|
videoPlayer.Play();
|
||||||
Debug.Log("開始播放影片");
|
Debug.Log("開始播放影片");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,10 +44,10 @@ public class ClientWorkMessageHandleSceneController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (videoPlayer != null)
|
if (videoPlayer != null)
|
||||||
{
|
{
|
||||||
// 設置影片結束事件
|
// 設置影片結束事件
|
||||||
videoPlayer.loopPointReached += OnVideoFinished;
|
videoPlayer.loopPointReached += OnVideoFinished;
|
||||||
|
|
||||||
// 設置影片顯示
|
// 設置影片顯示
|
||||||
if (videoDisplay != null)
|
if (videoDisplay != null)
|
||||||
{
|
{
|
||||||
videoPlayer.targetTexture = null;
|
videoPlayer.targetTexture = null;
|
||||||
@ -62,7 +62,7 @@ public class ClientWorkMessageHandleSceneController : MonoBehaviour
|
|||||||
|
|
||||||
void OnVideoFinished(VideoPlayer vp)
|
void OnVideoFinished(VideoPlayer vp)
|
||||||
{
|
{
|
||||||
//Debug.Log("影片播放完成,準備跳轉到 ClientWorkScene");
|
//Debug.Log("影片播放完成,準備跳轉到 ClientWorkScene");
|
||||||
//StartCoroutine(LoadNextScene());
|
//StartCoroutine(LoadNextScene());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -28,10 +28,10 @@ public class ClientWorkMessageResultExitSceneController : MonoBehaviour
|
|||||||
}
|
}
|
||||||
if (step2VideoPlayer != null)
|
if (step2VideoPlayer != null)
|
||||||
{
|
{
|
||||||
// 砞竚紇<EFBFBD>挡<EFBFBD>ㄆン
|
// 設置影片結束事件
|
||||||
step2VideoPlayer.loopPointReached += step2VideoPlayer_onVideoFinished;
|
step2VideoPlayer.loopPointReached += step2VideoPlayer_onVideoFinished;
|
||||||
|
|
||||||
// 砞竚紇<EFBFBD>陪ボ
|
// 設置影片顯示
|
||||||
if (step2RawImage != null)
|
if (step2RawImage != null)
|
||||||
{
|
{
|
||||||
step2VideoPlayer.targetTexture = null;
|
step2VideoPlayer.targetTexture = null;
|
||||||
|
|||||||
@ -9,7 +9,7 @@ public class ClientWorkMessageResultNoSceneController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
public static ClientWorkMessageResultNoSceneController Instance;
|
public static ClientWorkMessageResultNoSceneController Instance;
|
||||||
|
|
||||||
[Header("影片播放")]
|
[Header("影片播放")]
|
||||||
public VideoPlayer videoPlayer;
|
public VideoPlayer videoPlayer;
|
||||||
public RawImage videoDisplay;
|
public RawImage videoDisplay;
|
||||||
|
|
||||||
@ -22,11 +22,11 @@ public class ClientWorkMessageResultNoSceneController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
SetupVideoPlayer();
|
SetupVideoPlayer();
|
||||||
|
|
||||||
// 開始播放影片
|
// 開始播放影片
|
||||||
if (videoPlayer != null)
|
if (videoPlayer != null)
|
||||||
{
|
{
|
||||||
videoPlayer.Play();
|
videoPlayer.Play();
|
||||||
Debug.Log("開始播放影片");
|
Debug.Log("開始播放影片");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,10 +34,10 @@ public class ClientWorkMessageResultNoSceneController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (videoPlayer != null)
|
if (videoPlayer != null)
|
||||||
{
|
{
|
||||||
// 設置影片結束事件
|
// 設置影片結束事件
|
||||||
videoPlayer.loopPointReached += OnVideoFinished;
|
videoPlayer.loopPointReached += OnVideoFinished;
|
||||||
|
|
||||||
// 設置影片顯示
|
// 設置影片顯示
|
||||||
if (videoDisplay != null)
|
if (videoDisplay != null)
|
||||||
{
|
{
|
||||||
videoPlayer.targetTexture = null;
|
videoPlayer.targetTexture = null;
|
||||||
@ -51,7 +51,7 @@ public class ClientWorkMessageResultNoSceneController : MonoBehaviour
|
|||||||
|
|
||||||
void OnVideoFinished(VideoPlayer vp)
|
void OnVideoFinished(VideoPlayer vp)
|
||||||
{
|
{
|
||||||
Debug.Log("影片播放完成,準備跳轉");
|
Debug.Log("影片播放完成,準備跳轉");
|
||||||
StartCoroutine(LoadNextScene());
|
StartCoroutine(LoadNextScene());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@ public class ClientWorkMessageResultNotSureSceneController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
public static ClientWorkMessageResultNotSureSceneController Instance;
|
public static ClientWorkMessageResultNotSureSceneController Instance;
|
||||||
|
|
||||||
[Header("影片播放")]
|
[Header("影片播放")]
|
||||||
public VideoPlayer videoPlayer;
|
public VideoPlayer videoPlayer;
|
||||||
public RawImage videoDisplay;
|
public RawImage videoDisplay;
|
||||||
|
|
||||||
@ -22,11 +22,11 @@ public class ClientWorkMessageResultNotSureSceneController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
SetupVideoPlayer();
|
SetupVideoPlayer();
|
||||||
|
|
||||||
// 開始播放影片
|
// 開始播放影片
|
||||||
if (videoPlayer != null)
|
if (videoPlayer != null)
|
||||||
{
|
{
|
||||||
videoPlayer.Play();
|
videoPlayer.Play();
|
||||||
Debug.Log("開始播放影片");
|
Debug.Log("開始播放影片");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,10 +34,10 @@ public class ClientWorkMessageResultNotSureSceneController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (videoPlayer != null)
|
if (videoPlayer != null)
|
||||||
{
|
{
|
||||||
// 設置影片結束事件
|
// 設置影片結束事件
|
||||||
videoPlayer.loopPointReached += OnVideoFinished;
|
videoPlayer.loopPointReached += OnVideoFinished;
|
||||||
|
|
||||||
// 設置影片顯示
|
// 設置影片顯示
|
||||||
if (videoDisplay != null)
|
if (videoDisplay != null)
|
||||||
{
|
{
|
||||||
videoPlayer.targetTexture = null;
|
videoPlayer.targetTexture = null;
|
||||||
@ -51,7 +51,7 @@ public class ClientWorkMessageResultNotSureSceneController : MonoBehaviour
|
|||||||
|
|
||||||
void OnVideoFinished(VideoPlayer vp)
|
void OnVideoFinished(VideoPlayer vp)
|
||||||
{
|
{
|
||||||
Debug.Log("影片播放完成,準備跳轉");
|
Debug.Log("影片播放完成,準備跳轉");
|
||||||
StartCoroutine(LoadNextScene());
|
StartCoroutine(LoadNextScene());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -54,10 +54,10 @@ public class ClientWorkMessageResultView2SceneController : MonoBehaviour
|
|||||||
|
|
||||||
if (step4VideoPlayer != null)
|
if (step4VideoPlayer != null)
|
||||||
{
|
{
|
||||||
// 砞竚紇<EFBFBD>挡<EFBFBD>ㄆン
|
// 設置影片結束事件
|
||||||
step4VideoPlayer.loopPointReached += step4VideoPlayer_onVideoFinished;
|
step4VideoPlayer.loopPointReached += step4VideoPlayer_onVideoFinished;
|
||||||
|
|
||||||
// 砞竚紇<EFBFBD>陪ボ
|
// 設置影片顯示
|
||||||
if (step4RawImage != null)
|
if (step4RawImage != null)
|
||||||
{
|
{
|
||||||
step4VideoPlayer.targetTexture = null;
|
step4VideoPlayer.targetTexture = null;
|
||||||
@ -70,10 +70,10 @@ public class ClientWorkMessageResultView2SceneController : MonoBehaviour
|
|||||||
}
|
}
|
||||||
if (step5VideoPlayer != null)
|
if (step5VideoPlayer != null)
|
||||||
{
|
{
|
||||||
// 砞竚紇<EFBFBD>挡<EFBFBD>ㄆン
|
// 設置影片結束事件
|
||||||
step5VideoPlayer.loopPointReached += step5VideoPlayer_onVideoFinished;
|
step5VideoPlayer.loopPointReached += step5VideoPlayer_onVideoFinished;
|
||||||
|
|
||||||
// 砞竚紇<EFBFBD>陪ボ
|
// 設置影片顯示
|
||||||
if (step5RawImage != null)
|
if (step5RawImage != null)
|
||||||
{
|
{
|
||||||
step5VideoPlayer.targetTexture = null;
|
step5VideoPlayer.targetTexture = null;
|
||||||
|
|||||||
@ -9,7 +9,7 @@ public class ClientWorkMessageResultYesSceneController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
public static ClientWorkMessageResultYesSceneController Instance;
|
public static ClientWorkMessageResultYesSceneController Instance;
|
||||||
|
|
||||||
[Header("影片播放")]
|
[Header("影片播放")]
|
||||||
public VideoPlayer videoPlayer;
|
public VideoPlayer videoPlayer;
|
||||||
public RawImage videoDisplay;
|
public RawImage videoDisplay;
|
||||||
|
|
||||||
@ -22,11 +22,11 @@ public class ClientWorkMessageResultYesSceneController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
SetupVideoPlayer();
|
SetupVideoPlayer();
|
||||||
|
|
||||||
// 開始播放影片
|
// 開始播放影片
|
||||||
if (videoPlayer != null)
|
if (videoPlayer != null)
|
||||||
{
|
{
|
||||||
videoPlayer.Play();
|
videoPlayer.Play();
|
||||||
Debug.Log("開始播放影片");
|
Debug.Log("開始播放影片");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,10 +34,10 @@ public class ClientWorkMessageResultYesSceneController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (videoPlayer != null)
|
if (videoPlayer != null)
|
||||||
{
|
{
|
||||||
// 設置影片結束事件
|
// 設置影片結束事件
|
||||||
videoPlayer.loopPointReached += OnVideoFinished;
|
videoPlayer.loopPointReached += OnVideoFinished;
|
||||||
|
|
||||||
// 設置影片顯示
|
// 設置影片顯示
|
||||||
if (videoDisplay != null)
|
if (videoDisplay != null)
|
||||||
{
|
{
|
||||||
videoPlayer.targetTexture = null;
|
videoPlayer.targetTexture = null;
|
||||||
@ -51,7 +51,7 @@ public class ClientWorkMessageResultYesSceneController : MonoBehaviour
|
|||||||
|
|
||||||
void OnVideoFinished(VideoPlayer vp)
|
void OnVideoFinished(VideoPlayer vp)
|
||||||
{
|
{
|
||||||
Debug.Log("影片播放完成,準備跳轉");
|
Debug.Log("影片播放完成,準備跳轉");
|
||||||
StartCoroutine(LoadNextScene());
|
StartCoroutine(LoadNextScene());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,7 @@ public class ClientWorkSceneController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
public static ClientWorkSceneController Instance;
|
public static ClientWorkSceneController Instance;
|
||||||
|
|
||||||
[Header("UI 元件")]
|
[Header("UI 元件")]
|
||||||
public TMP_InputField messageTextInputField;
|
public TMP_InputField messageTextInputField;
|
||||||
public TMP_InputField messagePresentInputField;
|
public TMP_InputField messagePresentInputField;
|
||||||
public Button submitButton;
|
public Button submitButton;
|
||||||
@ -64,7 +64,7 @@ public class ClientWorkSceneController : MonoBehaviour
|
|||||||
messageTextInputField.onValueChanged.AddListener(textInputField_onValueChanged);
|
messageTextInputField.onValueChanged.AddListener(textInputField_onValueChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Log("ClientWorkScene 初始化完成");
|
Debug.Log("ClientWorkScene 初始化完成");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void textInputField_onValueChanged(string arg0)
|
private void textInputField_onValueChanged(string arg0)
|
||||||
|
|||||||
@ -4,11 +4,11 @@ using UnityEngine.UI;
|
|||||||
[RequireComponent(typeof(Toggle))]
|
[RequireComponent(typeof(Toggle))]
|
||||||
public class ExclusiveToggleVisual : MonoBehaviour
|
public class ExclusiveToggleVisual : MonoBehaviour
|
||||||
{
|
{
|
||||||
[Header("選中時圖片")]
|
[Header("選中時圖片")]
|
||||||
[SerializeField] private Sprite onBackground;
|
[SerializeField] private Sprite onBackground;
|
||||||
[SerializeField] private Sprite onCheckmark;
|
[SerializeField] private Sprite onCheckmark;
|
||||||
|
|
||||||
[Header("未選中時圖片(留空 = 原始圖)")]
|
[Header("未選中時圖片(留空 = 原始圖)")]
|
||||||
[SerializeField] private Sprite offBackground;
|
[SerializeField] private Sprite offBackground;
|
||||||
[SerializeField] private Sprite offCheckmark;
|
[SerializeField] private Sprite offCheckmark;
|
||||||
|
|
||||||
@ -23,15 +23,15 @@ public class ExclusiveToggleVisual : MonoBehaviour
|
|||||||
bgImage = toggle.targetGraphic as Image;
|
bgImage = toggle.targetGraphic as Image;
|
||||||
checkImage = toggle.graphic as Image;
|
checkImage = toggle.graphic as Image;
|
||||||
|
|
||||||
// 儲存原始圖片(供 off 狀態使用)
|
// 儲存原始圖片(供 off 狀態使用)
|
||||||
if (bgImage) origBg = bgImage.sprite;
|
if (bgImage) origBg = bgImage.sprite;
|
||||||
if (checkImage) origCheck = checkImage.sprite;
|
if (checkImage) origCheck = checkImage.sprite;
|
||||||
|
|
||||||
// 關閉 UI 焦點干擾
|
// 關閉 UI 焦點干擾
|
||||||
toggle.transition = Selectable.Transition.None;
|
toggle.transition = Selectable.Transition.None;
|
||||||
toggle.navigation = new Navigation { mode = Navigation.Mode.None };
|
toggle.navigation = new Navigation { mode = Navigation.Mode.None };
|
||||||
|
|
||||||
// 初始 + 監聽
|
// 初始 + 監聽
|
||||||
SyncVisual();
|
SyncVisual();
|
||||||
toggle.onValueChanged.AddListener(_ => SyncVisual());
|
toggle.onValueChanged.AddListener(_ => SyncVisual());
|
||||||
}
|
}
|
||||||
@ -40,11 +40,11 @@ public class ExclusiveToggleVisual : MonoBehaviour
|
|||||||
{
|
{
|
||||||
bool isOn = toggle.isOn;
|
bool isOn = toggle.isOn;
|
||||||
|
|
||||||
// 背景圖
|
// 背景圖
|
||||||
if (bgImage && onBackground)
|
if (bgImage && onBackground)
|
||||||
bgImage.sprite = isOn ? onBackground : (offBackground ?? origBg);
|
bgImage.sprite = isOn ? onBackground : (offBackground ?? origBg);
|
||||||
|
|
||||||
// Checkmark 圖(僅在選中時顯示)
|
// Checkmark 圖(僅在選中時顯示)
|
||||||
if (checkImage)
|
if (checkImage)
|
||||||
{
|
{
|
||||||
if (onCheckmark)
|
if (onCheckmark)
|
||||||
@ -53,6 +53,6 @@ public class ExclusiveToggleVisual : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 外部可強制刷新(如動態換圖)
|
// 外部可強制刷新(如動態換圖)
|
||||||
public void Refresh() => SyncVisual();
|
public void Refresh() => SyncVisual();
|
||||||
}
|
}
|
||||||
@ -20,7 +20,7 @@ public class PersistentNetworkManager : MonoBehaviour
|
|||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
// 單例模式:確保只有一個 NetworkManager 存在
|
// 單例模式:確保只有一個 NetworkManager 存在
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
{
|
{
|
||||||
instance = this;
|
instance = this;
|
||||||
@ -29,22 +29,22 @@ public class PersistentNetworkManager : MonoBehaviour
|
|||||||
networkManager = GetComponent<NetworkManager>();
|
networkManager = GetComponent<NetworkManager>();
|
||||||
if (networkManager != null)
|
if (networkManager != null)
|
||||||
{
|
{
|
||||||
// 確保 NetworkManager 也設置為不銷毀
|
// 確保 NetworkManager 也設置為不銷毀
|
||||||
networkManager.dontDestroyOnLoad = true;
|
networkManager.dontDestroyOnLoad = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Log("NetworkManager 已設置為跨場景保持");
|
Debug.Log("NetworkManager 已設置為跨場景保持");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 如果已經存在實例,銷毀這個重複的
|
// 如果已經存在實例,銷毀這個重複的
|
||||||
Debug.Log("NetworkManager 已存在,銷毀重複物件");
|
Debug.Log("NetworkManager 已存在,銷毀重複物件");
|
||||||
Destroy(gameObject);
|
Destroy(gameObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 獲取 NetworkManager 實例
|
/// 獲取 NetworkManager 實例
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static NetworkManager GetNetworkManager()
|
public static NetworkManager GetNetworkManager()
|
||||||
{
|
{
|
||||||
@ -56,7 +56,7 @@ public class PersistentNetworkManager : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 檢查是否已連線
|
/// 檢查是否已連線
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool IsConnected()
|
public static bool IsConnected()
|
||||||
{
|
{
|
||||||
@ -64,7 +64,7 @@ public class PersistentNetworkManager : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 檢查是否為 Server
|
/// 檢查是否為 Server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool IsServer()
|
public static bool IsServer()
|
||||||
{
|
{
|
||||||
@ -72,7 +72,7 @@ public class PersistentNetworkManager : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 清理連線(當需要完全重置時使用)
|
/// 清理連線(當需要完全重置時使用)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void CleanupConnections()
|
public static void CleanupConnections()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,7 +4,7 @@ using Mirror;
|
|||||||
|
|
||||||
public class SceneController : MonoBehaviour
|
public class SceneController : MonoBehaviour
|
||||||
{
|
{
|
||||||
[Header("場景名稱設置")]
|
[Header("場景名稱設置")]
|
||||||
public string initSceneName = "InitScene";
|
public string initSceneName = "InitScene";
|
||||||
|
|
||||||
public string serverHomeSceneName = "ServerHomeScene";
|
public string serverHomeSceneName = "ServerHomeScene";
|
||||||
|
|||||||
@ -2,6 +2,6 @@ using Mirror;
|
|||||||
|
|
||||||
public class EmptyNetworkPlayer : NetworkBehaviour
|
public class EmptyNetworkPlayer : NetworkBehaviour
|
||||||
{
|
{
|
||||||
// 這是一個空的 Player 腳本,僅用於滿足 NetworkManager 的要求
|
// 這是一個空的 Player 腳本,僅用於滿足 NetworkManager 的要求
|
||||||
// 實際上不會被使用,因為我們的應用不需要生成 Player 物件
|
// 實際上不會被使用,因為我們的應用不需要生成 Player 物件
|
||||||
}
|
}
|
||||||
@ -7,7 +7,7 @@ public class GlobalMenuManager : MonoBehaviour
|
|||||||
{
|
{
|
||||||
public static GlobalMenuManager Instance;
|
public static GlobalMenuManager Instance;
|
||||||
|
|
||||||
[Header("UI 元件")]
|
[Header("UI 元件")]
|
||||||
public GameObject menuButton;
|
public GameObject menuButton;
|
||||||
public GameObject menuPanel;
|
public GameObject menuPanel;
|
||||||
public Button homeButton;
|
public Button homeButton;
|
||||||
@ -20,7 +20,7 @@ public class GlobalMenuManager : MonoBehaviour
|
|||||||
if (Instance == null)
|
if (Instance == null)
|
||||||
{
|
{
|
||||||
Instance = this;
|
Instance = this;
|
||||||
// 重要:將整個 Canvas 設為 DontDestroyOnLoad
|
// 重要:將整個 Canvas 設為 DontDestroyOnLoad
|
||||||
if (transform.parent != null)
|
if (transform.parent != null)
|
||||||
{
|
{
|
||||||
DontDestroyOnLoad(transform.root.gameObject);
|
DontDestroyOnLoad(transform.root.gameObject);
|
||||||
@ -44,11 +44,11 @@ public class GlobalMenuManager : MonoBehaviour
|
|||||||
|
|
||||||
void InitializeMenu()
|
void InitializeMenu()
|
||||||
{
|
{
|
||||||
// 確保選單面板一開始是隱藏的
|
// 確保選單面板一開始是隱藏的
|
||||||
if (menuPanel != null)
|
if (menuPanel != null)
|
||||||
menuPanel.SetActive(false);
|
menuPanel.SetActive(false);
|
||||||
|
|
||||||
// 綁定按鈕事件
|
// 綁定按鈕事件
|
||||||
if (menuButton != null)
|
if (menuButton != null)
|
||||||
{
|
{
|
||||||
menuButton.GetComponent<Button>().onClick.AddListener(OpenMenu);
|
menuButton.GetComponent<Button>().onClick.AddListener(OpenMenu);
|
||||||
|
|||||||
@ -23,26 +23,26 @@ public class NetworkGameManager : NetworkManager
|
|||||||
public override void OnStartServer()
|
public override void OnStartServer()
|
||||||
{
|
{
|
||||||
base.OnStartServer();
|
base.OnStartServer();
|
||||||
Debug.Log("Server 已啟動");
|
Debug.Log("Server 已啟動");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnServerConnect(NetworkConnectionToClient conn)
|
public override void OnServerConnect(NetworkConnectionToClient conn)
|
||||||
{
|
{
|
||||||
base.OnServerConnect(conn);
|
base.OnServerConnect(conn);
|
||||||
Debug.Log($"客戶端已連接: {conn.connectionId}");
|
Debug.Log($"客戶端已連接: {conn.connectionId}");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnServerDisconnect(NetworkConnectionToClient conn)
|
public override void OnServerDisconnect(NetworkConnectionToClient conn)
|
||||||
{
|
{
|
||||||
base.OnServerDisconnect(conn);
|
base.OnServerDisconnect(conn);
|
||||||
Debug.Log($"客戶端已斷開: {conn.connectionId}");
|
Debug.Log($"客戶端已斷開: {conn.connectionId}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 覆寫這個方法來避免自動生成 Player
|
// 覆寫這個方法來避免自動生成 Player
|
||||||
public override void OnServerAddPlayer(NetworkConnectionToClient conn)
|
public override void OnServerAddPlayer(NetworkConnectionToClient conn)
|
||||||
{
|
{
|
||||||
// 不自動生成 Player,只是記錄連接
|
// 不自動生成 Player,只是記錄連接
|
||||||
Debug.Log($"客戶端請求加入,但 Server 模式不需要生成 Player: {conn.connectionId}");
|
Debug.Log($"客戶端請求加入,但 Server 模式不需要生成 Player: {conn.connectionId}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -28,7 +28,7 @@ public class NetworkMessageHandler : MonoBehaviour
|
|||||||
|
|
||||||
void OnClientMessageReceived(NetworkConnectionToClient conn, GameMessage msg)
|
void OnClientMessageReceived(NetworkConnectionToClient conn, GameMessage msg)
|
||||||
{
|
{
|
||||||
Debug.Log($"¦¬¨ì«È¤áºÝ°T®§: {msg.action} {msg.payload}");
|
Debug.Log($"收到客戶端訊息: {msg.action} {msg.payload}");
|
||||||
|
|
||||||
switch (msg.action)
|
switch (msg.action)
|
||||||
{
|
{
|
||||||
@ -203,11 +203,11 @@ public class NetworkMessageHandler : MonoBehaviour
|
|||||||
{
|
{
|
||||||
GameMessage msg = new GameMessage { action = action, payload = message };
|
GameMessage msg = new GameMessage { action = action, payload = message };
|
||||||
CurrentConn.Send(msg);
|
CurrentConn.Send(msg);
|
||||||
Debug.Log($"µo°e¨ì«È¤áºÝ: {message}");
|
Debug.Log($"發送到客戶端: {message}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.Log($"µo°e¨ì«È¤áºÝ¥¢±Ñ: {message}");
|
Debug.Log($"發送到客戶端失敗: {message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -26,14 +26,14 @@ public class ServerGameTalkingPanel : MonoBehaviour
|
|||||||
public Button sample4Button;
|
public Button sample4Button;
|
||||||
public Button sample5Button;
|
public Button sample5Button;
|
||||||
|
|
||||||
private int gameTimeCountdownSecVal = 100;
|
private int gameTimeCountdownSecVal = GlobalData.GAME_TALK_COUNTDOWN_TIME;
|
||||||
|
|
||||||
private string[] sampleTexts = {
|
private string[] sampleTexts = {
|
||||||
"汝行街上,見一老嫗跌倒,身旁五千金鈔隨風散。若只得一瞬之舉,汝先救人,抑或先拾錢?",
|
"汝行街上,見一老嫗跌倒,身旁五千金鈔隨風散。若只得一瞬之舉,汝先救人,抑或先拾錢?",
|
||||||
"汝見一孩以假幣買食,攤主未覺。若揭穿,孩餓;若不言,誤教。汝何選?",
|
"汝見一孩以假幣買食,攤主未覺。若揭穿,孩餓;若不言,誤教。汝何選?",
|
||||||
"友人誤將重物砸壞汝物,卻以為無人知曉。汝心明白真相,是當面直言,還是靜默讓他安?",
|
"友人誤將重物砸壞汝物,卻以為無人知曉。汝心明白真相,是當面直言,還是靜默讓他安?",
|
||||||
"汝於雨夜撞傷野貓,車無損,人未見。汝會停車查看,抑或遠去以免麻煩?",
|
"汝於雨夜撞傷野貓,車無損,人未見。汝會停車查看,抑或遠去以免麻煩?",
|
||||||
"汝在工廠,知上司指示排放廢水入河,若揭發,恐遭解雇;若隱瞞,公司利潤倍增。汝何解?"
|
"汝在工廠,知上司指示排放廢水入河,若揭發,恐遭解雇;若隱瞞,公司利潤倍增。汝何解?"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -116,10 +116,10 @@ public class ServerGameTalkingPanel : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (introVideoPlayer != null)
|
if (introVideoPlayer != null)
|
||||||
{
|
{
|
||||||
// 設置影片結束事件
|
// 設置影片結束事件
|
||||||
introVideoPlayer.loopPointReached += OnIntroVideoFinished;
|
introVideoPlayer.loopPointReached += OnIntroVideoFinished;
|
||||||
|
|
||||||
// 設置影片顯示
|
// 設置影片顯示
|
||||||
if (introVideoPlayer != null)
|
if (introVideoPlayer != null)
|
||||||
{
|
{
|
||||||
introVideoPlayer.targetTexture = null;
|
introVideoPlayer.targetTexture = null;
|
||||||
@ -133,14 +133,14 @@ public class ServerGameTalkingPanel : MonoBehaviour
|
|||||||
|
|
||||||
void OnIntroVideoFinished(VideoPlayer vp)
|
void OnIntroVideoFinished(VideoPlayer vp)
|
||||||
{
|
{
|
||||||
Debug.Log("影片播放完成");
|
Debug.Log("影片播放完成");
|
||||||
//StartCoroutine(LoadNextScene());
|
//StartCoroutine(LoadNextScene());
|
||||||
processStep(2);
|
processStep(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onReceivedChatMessage(string message)
|
public void onReceivedChatMessage(string message)
|
||||||
{
|
{
|
||||||
playChatText.text = "-信眾-<br>" + message + "<br>" + playChatText.text;
|
playChatText.text = "-信眾-<br>" + message + "<br>" + playChatText.text;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void playSendButton_onClick()
|
private void playSendButton_onClick()
|
||||||
@ -151,7 +151,7 @@ public class ServerGameTalkingPanel : MonoBehaviour
|
|||||||
{
|
{
|
||||||
NetworkMessageHandler.Instance.SendMessageToClient("gameTalkingGodSay", playInputField.text);
|
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 = "";
|
playInputField.text = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -160,7 +160,7 @@ public class ServerGameTalkingPanel : MonoBehaviour
|
|||||||
{
|
{
|
||||||
yield return new WaitForSeconds(1f);
|
yield return new WaitForSeconds(1f);
|
||||||
|
|
||||||
if (gameTimeCountdownSecVal == 100)
|
if (gameTimeCountdownSecVal == GlobalData.GAME_TALK_COUNTDOWN_TIME)
|
||||||
{
|
{
|
||||||
if (NetworkMessageHandler.Instance)
|
if (NetworkMessageHandler.Instance)
|
||||||
{
|
{
|
||||||
@ -169,7 +169,7 @@ public class ServerGameTalkingPanel : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
gameTimeCountdownSecVal--;
|
gameTimeCountdownSecVal--;
|
||||||
statusText.text = "倒計時 : <color=\"red\">" + gameTimeCountdownSecVal.ToString() + "</color>s";
|
statusText.text = "倒計時 : <color=\"red\">" + gameTimeCountdownSecVal.ToString() + "</color>s";
|
||||||
if (gameTimeCountdownSecVal > 0)
|
if (gameTimeCountdownSecVal > 0)
|
||||||
{
|
{
|
||||||
StartCoroutine(GameTimeCountdown());
|
StartCoroutine(GameTimeCountdown());
|
||||||
@ -191,7 +191,7 @@ public class ServerGameTalkingPanel : MonoBehaviour
|
|||||||
introPanel.SetActive(step == 1);
|
introPanel.SetActive(step == 1);
|
||||||
if (step == 1)
|
if (step == 1)
|
||||||
{
|
{
|
||||||
gameTimeCountdownSecVal = 100;
|
gameTimeCountdownSecVal = GlobalData.GAME_TALK_COUNTDOWN_TIME;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (playPanel)
|
if (playPanel)
|
||||||
@ -200,12 +200,8 @@ public class ServerGameTalkingPanel : MonoBehaviour
|
|||||||
if (step == 2)
|
if (step == 2)
|
||||||
{
|
{
|
||||||
playChatText.text = "";
|
playChatText.text = "";
|
||||||
|
statusText.text = "倒計時 : <color=\"red\">" + gameTimeCountdownSecVal.ToString() + "</color>s";
|
||||||
if (statusText.text == "--")
|
StartCoroutine(GameTimeCountdown());
|
||||||
{
|
|
||||||
statusText.text = "倒計時 : <color=\"red\">" + gameTimeCountdownSecVal.ToString() + "</color>s";
|
|
||||||
StartCoroutine(GameTimeCountdown());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,10 +71,10 @@ public class ServerGameTypingPanel : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (introVideoPlayer != null)
|
if (introVideoPlayer != null)
|
||||||
{
|
{
|
||||||
// 設置影片結束事件
|
// 設置影片結束事件
|
||||||
introVideoPlayer.loopPointReached += OnIntroVideoFinished;
|
introVideoPlayer.loopPointReached += OnIntroVideoFinished;
|
||||||
|
|
||||||
// 設置影片顯示
|
// 設置影片顯示
|
||||||
if (introVideoPlayer != null)
|
if (introVideoPlayer != null)
|
||||||
{
|
{
|
||||||
introVideoPlayer.targetTexture = null;
|
introVideoPlayer.targetTexture = null;
|
||||||
@ -88,7 +88,7 @@ public class ServerGameTypingPanel : MonoBehaviour
|
|||||||
|
|
||||||
void OnIntroVideoFinished(VideoPlayer vp)
|
void OnIntroVideoFinished(VideoPlayer vp)
|
||||||
{
|
{
|
||||||
Debug.Log("影片播放完成");
|
Debug.Log("影片播放完成");
|
||||||
//StartCoroutine(LoadNextScene());
|
//StartCoroutine(LoadNextScene());
|
||||||
processStep(2);
|
processStep(2);
|
||||||
}
|
}
|
||||||
@ -97,10 +97,10 @@ public class ServerGameTypingPanel : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (introVideoPlayer != null)
|
if (introVideoPlayer != null)
|
||||||
{
|
{
|
||||||
// 設置影片結束事件
|
// 設置影片結束事件
|
||||||
playVideoPlayer.loopPointReached += OnPlayVideoFinished;
|
playVideoPlayer.loopPointReached += OnPlayVideoFinished;
|
||||||
|
|
||||||
// 設置影片顯示
|
// 設置影片顯示
|
||||||
if (playVideoPlayer != null)
|
if (playVideoPlayer != null)
|
||||||
{
|
{
|
||||||
playVideoPlayer.targetTexture = null;
|
playVideoPlayer.targetTexture = null;
|
||||||
@ -114,7 +114,7 @@ public class ServerGameTypingPanel : MonoBehaviour
|
|||||||
|
|
||||||
void OnPlayVideoFinished(VideoPlayer vp)
|
void OnPlayVideoFinished(VideoPlayer vp)
|
||||||
{
|
{
|
||||||
Debug.Log("影片播放完成");
|
Debug.Log("影片播放完成");
|
||||||
//StartCoroutine(LoadNextScene());
|
//StartCoroutine(LoadNextScene());
|
||||||
OnReceivedResult();
|
OnReceivedResult();
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ public class ServerGameTypingPanel : MonoBehaviour
|
|||||||
|
|
||||||
|
|
||||||
gameTimeCountdownSecVal--;
|
gameTimeCountdownSecVal--;
|
||||||
statusText.text = "倒計時 : <color=\"red\">" + gameTimeCountdownSecVal.ToString() + "</color>s";
|
statusText.text = "倒計時 : <color=\"red\">" + gameTimeCountdownSecVal.ToString() + "</color>s";
|
||||||
if (gameTimeCountdownSecVal > 0)
|
if (gameTimeCountdownSecVal > 0)
|
||||||
{
|
{
|
||||||
StartCoroutine(GameTimeCountdown());
|
StartCoroutine(GameTimeCountdown());
|
||||||
|
|||||||
@ -13,10 +13,10 @@ public class ServerGameWaittingPanel : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (introVideoPlayer != null)
|
if (introVideoPlayer != null)
|
||||||
{
|
{
|
||||||
// 設置影片結束事件
|
// 設置影片結束事件
|
||||||
introVideoPlayer.loopPointReached += OnIntroVideoFinished;
|
introVideoPlayer.loopPointReached += OnIntroVideoFinished;
|
||||||
|
|
||||||
// 設置影片顯示
|
// 設置影片顯示
|
||||||
if (introVideoPlayer != null)
|
if (introVideoPlayer != null)
|
||||||
{
|
{
|
||||||
introVideoPlayer.isLooping = true;
|
introVideoPlayer.isLooping = true;
|
||||||
@ -31,7 +31,7 @@ public class ServerGameWaittingPanel : MonoBehaviour
|
|||||||
|
|
||||||
void OnIntroVideoFinished(VideoPlayer vp)
|
void OnIntroVideoFinished(VideoPlayer vp)
|
||||||
{
|
{
|
||||||
//Debug.Log("影片播放完成");
|
//Debug.Log("影片播放完成");
|
||||||
//StartCoroutine(LoadNextScene());
|
//StartCoroutine(LoadNextScene());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@ public class ServerHomeSceneController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
public static ServerHomeSceneController Instance;
|
public static ServerHomeSceneController Instance;
|
||||||
|
|
||||||
[Header("UI じン")]
|
[Header("UI 元件")]
|
||||||
public Button StartBtn;
|
public Button StartBtn;
|
||||||
|
|
||||||
void Awake()
|
void Awake()
|
||||||
|
|||||||
@ -8,7 +8,7 @@ public class ServerHomeWaittingSceneController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
public static ServerHomeWaittingSceneController Instance;
|
public static ServerHomeWaittingSceneController Instance;
|
||||||
|
|
||||||
[Header("UI 元件")]
|
[Header("UI 元件")]
|
||||||
public TMP_Text waitingText;
|
public TMP_Text waitingText;
|
||||||
|
|
||||||
private bool clientConnected = false;
|
private bool clientConnected = false;
|
||||||
@ -27,7 +27,7 @@ public class ServerHomeWaittingSceneController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (waitingText != null)
|
if (waitingText != null)
|
||||||
{
|
{
|
||||||
waitingText.text = "等待您的客戶加入…";
|
waitingText.text = "等待您的客戶加入…";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ public class ServerHomeWaittingSceneController : MonoBehaviour
|
|||||||
if (!clientConnected)
|
if (!clientConnected)
|
||||||
{
|
{
|
||||||
clientConnected = true;
|
clientConnected = true;
|
||||||
Debug.Log("客戶端已連接,準備跳轉場景");
|
Debug.Log("客戶端已連接,準備跳轉場景");
|
||||||
|
|
||||||
|
|
||||||
StartCoroutine(LoadIntroScene());
|
StartCoroutine(LoadIntroScene());
|
||||||
|
|||||||
@ -12,14 +12,14 @@ public class ServerInitSceneController : MonoBehaviour
|
|||||||
|
|
||||||
void InitializeServer()
|
void InitializeServer()
|
||||||
{
|
{
|
||||||
Debug.Log("初始化 Server...");
|
Debug.Log("初始化 Server...");
|
||||||
|
|
||||||
// 啟動 Server
|
// 啟動 Server
|
||||||
if (NetworkGameManager.Instance != null)
|
if (NetworkGameManager.Instance != null)
|
||||||
{
|
{
|
||||||
NetworkGameManager.Instance.StartServer();
|
NetworkGameManager.Instance.StartServer();
|
||||||
|
|
||||||
// 等待一秒後自動連接本地 Client
|
// 等待一秒後自動連接本地 Client
|
||||||
StartCoroutine(AutoConnectLocalClient());
|
StartCoroutine(AutoConnectLocalClient());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,10 +31,10 @@ public class ServerInitSceneController : MonoBehaviour
|
|||||||
if (NetworkGameManager.Instance != null)
|
if (NetworkGameManager.Instance != null)
|
||||||
{
|
{
|
||||||
NetworkGameManager.Instance.StartClient();
|
NetworkGameManager.Instance.StartClient();
|
||||||
Debug.Log("本地 Client 已連接到 Server");
|
Debug.Log("本地 Client 已連接到 Server");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化完成,跳到 ServerHomeScene
|
// 初始化完成,跳到 ServerHomeScene
|
||||||
yield return new WaitForSeconds(0.5f);
|
yield return new WaitForSeconds(0.5f);
|
||||||
SceneManager.LoadScene("ServerHomeScene");
|
SceneManager.LoadScene("ServerHomeScene");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,7 @@ public class ServerIntroSceneController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
public static ServerIntroSceneController Instance;
|
public static ServerIntroSceneController Instance;
|
||||||
|
|
||||||
[Header("影片播放")]
|
[Header("影片播放")]
|
||||||
public VideoPlayer videoPlayer;
|
public VideoPlayer videoPlayer;
|
||||||
public RawImage videoDisplay;
|
public RawImage videoDisplay;
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ public class ServerIntroSceneController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
SetupVideoPlayer();
|
SetupVideoPlayer();
|
||||||
|
|
||||||
// 開始播放影片
|
// 開始播放影片
|
||||||
if (videoPlayer != null)
|
if (videoPlayer != null)
|
||||||
{
|
{
|
||||||
videoPlayer.Play();
|
videoPlayer.Play();
|
||||||
@ -31,10 +31,10 @@ public class ServerIntroSceneController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (videoPlayer != null)
|
if (videoPlayer != null)
|
||||||
{
|
{
|
||||||
// 設置影片結束事件
|
// 設置影片結束事件
|
||||||
videoPlayer.loopPointReached += OnVideoFinished;
|
videoPlayer.loopPointReached += OnVideoFinished;
|
||||||
|
|
||||||
// 設置影片顯示
|
// 設置影片顯示
|
||||||
if (videoDisplay != null)
|
if (videoDisplay != null)
|
||||||
{
|
{
|
||||||
videoPlayer.targetTexture = null;
|
videoPlayer.targetTexture = null;
|
||||||
@ -48,7 +48,7 @@ public class ServerIntroSceneController : MonoBehaviour
|
|||||||
|
|
||||||
void OnVideoFinished(VideoPlayer vp)
|
void OnVideoFinished(VideoPlayer vp)
|
||||||
{
|
{
|
||||||
Debug.Log("影片播放完成");
|
Debug.Log("影片播放完成");
|
||||||
StartCoroutine(LoadNextScene());
|
StartCoroutine(LoadNextScene());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@ public class ServerWorkExitWorkPanel : MonoBehaviour
|
|||||||
{
|
{
|
||||||
public static ServerWorkExitWorkPanel Instance;
|
public static ServerWorkExitWorkPanel Instance;
|
||||||
|
|
||||||
[Header("影片播放")]
|
[Header("影片播放")]
|
||||||
public VideoPlayer videoPlayer;
|
public VideoPlayer videoPlayer;
|
||||||
public RawImage videoDisplay;
|
public RawImage videoDisplay;
|
||||||
|
|
||||||
@ -50,10 +50,10 @@ public class ServerWorkExitWorkPanel : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (videoPlayer != null)
|
if (videoPlayer != null)
|
||||||
{
|
{
|
||||||
// 設置影片結束事件
|
// 設置影片結束事件
|
||||||
videoPlayer.loopPointReached += OnVideoFinished;
|
videoPlayer.loopPointReached += OnVideoFinished;
|
||||||
|
|
||||||
// 設置影片顯示
|
// 設置影片顯示
|
||||||
if (videoDisplay != null)
|
if (videoDisplay != null)
|
||||||
{
|
{
|
||||||
videoPlayer.targetTexture = null;
|
videoPlayer.targetTexture = null;
|
||||||
@ -67,7 +67,7 @@ public class ServerWorkExitWorkPanel : MonoBehaviour
|
|||||||
|
|
||||||
void OnVideoFinished(VideoPlayer vp)
|
void OnVideoFinished(VideoPlayer vp)
|
||||||
{
|
{
|
||||||
Debug.Log("影片播放完成");
|
Debug.Log("影片播放完成");
|
||||||
StartCoroutine(LoadHomeScene());
|
StartCoroutine(LoadHomeScene());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using Unity.VisualScripting;
|
using Unity.VisualScripting;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@ -11,11 +12,11 @@ public class ServerWorkGameFinalPanel : MonoBehaviour
|
|||||||
|
|
||||||
private int currentSampleWordsIndex = 0;
|
private int currentSampleWordsIndex = 0;
|
||||||
private string[] sampleWords = {
|
private string[] sampleWords = {
|
||||||
"福在心間非遠方行誠一步百事昌天開一線容人渡前路微光漸放芒",
|
"福在心間非遠方行誠一步百事昌天開一線容人渡前路微光漸放芒",
|
||||||
"命裡有時終必至急行反失遠行期靜看潮起潮又落好風自會送舟歸",
|
"命裡有時終必至急行反失遠行期靜看潮起潮又落好風自會送舟歸",
|
||||||
"心誠萬事皆能順莫急莫慌自有門天道酬勤終不負善念長存歸本根",
|
"心誠萬事皆能順莫急莫慌自有門天道酬勤終不負善念長存歸本根",
|
||||||
"汝問蒼天天不語早知汝路自難移命數原非神可改徒然叩首費心思",
|
"汝問蒼天天不語早知汝路自難移命數原非神可改徒然叩首費心思",
|
||||||
"求財無財空添亂問愛無愛更心煩問命問天徒自苦不如回家補個眠"
|
"求財無財空添亂問愛無愛更心煩問命問天徒自苦不如回家補個眠"
|
||||||
};
|
};
|
||||||
|
|
||||||
public GameObject introPanel;
|
public GameObject introPanel;
|
||||||
@ -37,6 +38,9 @@ public class ServerWorkGameFinalPanel : MonoBehaviour
|
|||||||
|
|
||||||
public VideoPlayer waittingVideoPlayer;
|
public VideoPlayer waittingVideoPlayer;
|
||||||
public RawImage waittingRawImage;
|
public RawImage waittingRawImage;
|
||||||
|
public TMP_Text countdownText;
|
||||||
|
|
||||||
|
public int wordsCountdownTime = GlobalData.WORD_COUNTDOWN_TIME;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
@ -70,10 +74,10 @@ public class ServerWorkGameFinalPanel : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (waittingVideoPlayer != null)
|
if (waittingVideoPlayer != null)
|
||||||
{
|
{
|
||||||
// 設置影片結束事件
|
// 設置影片結束事件
|
||||||
waittingVideoPlayer.loopPointReached += OnIntroVideoFinished;
|
waittingVideoPlayer.loopPointReached += OnIntroVideoFinished;
|
||||||
|
|
||||||
// 設置影片顯示
|
// 設置影片顯示
|
||||||
if (waittingVideoPlayer != null)
|
if (waittingVideoPlayer != null)
|
||||||
{
|
{
|
||||||
waittingVideoPlayer.isLooping = true;
|
waittingVideoPlayer.isLooping = true;
|
||||||
@ -88,7 +92,7 @@ public class ServerWorkGameFinalPanel : MonoBehaviour
|
|||||||
|
|
||||||
void OnIntroVideoFinished(VideoPlayer vp)
|
void OnIntroVideoFinished(VideoPlayer vp)
|
||||||
{
|
{
|
||||||
//Debug.Log("影片播放完成");
|
//Debug.Log("影片播放完成");
|
||||||
//StartCoroutine(LoadNextScene());
|
//StartCoroutine(LoadNextScene());
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -157,16 +161,16 @@ public class ServerWorkGameFinalPanel : MonoBehaviour
|
|||||||
switch (ServerWorkMessagePanel.workMessageType)
|
switch (ServerWorkMessagePanel.workMessageType)
|
||||||
{
|
{
|
||||||
case "TypeMoneyButton":
|
case "TypeMoneyButton":
|
||||||
introMessageTypeText.text = "財運";
|
introMessageTypeText.text = "財運";
|
||||||
break;
|
break;
|
||||||
case "TypeHealthButton":
|
case "TypeHealthButton":
|
||||||
introMessageTypeText.text = "健康";
|
introMessageTypeText.text = "健康";
|
||||||
break;
|
break;
|
||||||
case "TypeLoveButton":
|
case "TypeLoveButton":
|
||||||
introMessageTypeText.text = "愛情";
|
introMessageTypeText.text = "愛情";
|
||||||
break;
|
break;
|
||||||
default: // "TypeWorkButton"
|
default: // "TypeWorkButton"
|
||||||
introMessageTypeText.text = "工作";
|
introMessageTypeText.text = "工作";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -178,6 +182,20 @@ public class ServerWorkGameFinalPanel : MonoBehaviour
|
|||||||
{
|
{
|
||||||
introPresentText.text = ServerWorkMessagePanel.workPresent;
|
introPresentText.text = ServerWorkMessagePanel.workPresent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//更新word系列文字
|
||||||
|
if (wordsMessageTypeText)
|
||||||
|
{
|
||||||
|
wordsMessageTypeText.text = introMessageTypeText?.text ?? "";
|
||||||
|
}
|
||||||
|
if (wordsMessageText)
|
||||||
|
{
|
||||||
|
wordsMessageText.text = introMessageText?.text ?? "";
|
||||||
|
}
|
||||||
|
if (wordsPresentText)
|
||||||
|
{
|
||||||
|
wordsPresentText.text = introPresentText?.text ?? "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -189,6 +207,13 @@ public class ServerWorkGameFinalPanel : MonoBehaviour
|
|||||||
if (replyPanel)
|
if (replyPanel)
|
||||||
{
|
{
|
||||||
replyPanel.SetActive(step == 2);
|
replyPanel.SetActive(step == 2);
|
||||||
|
//倒數時間
|
||||||
|
if (step == 2)
|
||||||
|
{
|
||||||
|
wordsCountdownTime = GlobalData.WORD_COUNTDOWN_TIME;
|
||||||
|
UpdateWordsCountdownText();
|
||||||
|
StartCoroutine(WordCountdown());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (waittingPanel)
|
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 = "倒計時 : <color=\"red\">" + wordsCountdownTime.ToString() + "</color>s";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class ServerWorkIntroPanel : MonoBehaviour
|
|||||||
{
|
{
|
||||||
public static ServerWorkIntroPanel Instance;
|
public static ServerWorkIntroPanel Instance;
|
||||||
|
|
||||||
[Header("UI じン")]
|
[Header("UI 元件")]
|
||||||
public Button checkButton;
|
public Button checkButton;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
|
|||||||
@ -11,7 +11,7 @@ public class ServerWorkMessagePanel : MonoBehaviour
|
|||||||
public static string workPresent = "";
|
public static string workPresent = "";
|
||||||
public static int workMessageCount = 0;
|
public static int workMessageCount = 0;
|
||||||
|
|
||||||
[Header("UI 元件")]
|
[Header("UI 元件")]
|
||||||
public GameObject messageLoadPanel;
|
public GameObject messageLoadPanel;
|
||||||
public GameObject messageReceivedPanel;
|
public GameObject messageReceivedPanel;
|
||||||
public TMP_Text messageInfoText;
|
public TMP_Text messageInfoText;
|
||||||
@ -59,13 +59,13 @@ public class ServerWorkMessagePanel : MonoBehaviour
|
|||||||
}
|
}
|
||||||
if (messageInfoText)
|
if (messageInfoText)
|
||||||
{
|
{
|
||||||
messageInfoText.text = "系統提示:請稍後,連接客戶的願望中...";
|
messageInfoText.text = "系統提示:請稍後,連接客戶的願望中...";
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( messageInfoText)
|
if ( messageInfoText)
|
||||||
{
|
{
|
||||||
messageInfoText.text = "系統提示:客戶已傳達願望給您,是否要幫助此客戶?請點擊回覆";
|
messageInfoText.text = "系統提示:客戶已傳達願望給您,是否要幫助此客戶?請點擊回覆";
|
||||||
}
|
}
|
||||||
if (messageLoadPanel)
|
if (messageLoadPanel)
|
||||||
{
|
{
|
||||||
@ -80,16 +80,16 @@ public class ServerWorkMessagePanel : MonoBehaviour
|
|||||||
switch(workMessageType)
|
switch(workMessageType)
|
||||||
{
|
{
|
||||||
case "TypeMoneyButton":
|
case "TypeMoneyButton":
|
||||||
typeText.text = "財運";
|
typeText.text = "財運";
|
||||||
break;
|
break;
|
||||||
case "TypeHealthButton":
|
case "TypeHealthButton":
|
||||||
typeText.text = "健康";
|
typeText.text = "健康";
|
||||||
break;
|
break;
|
||||||
case "TypeLoveButton":
|
case "TypeLoveButton":
|
||||||
typeText.text = "愛情";
|
typeText.text = "愛情";
|
||||||
break;
|
break;
|
||||||
default: // "TypeWorkButton"
|
default: // "TypeWorkButton"
|
||||||
typeText.text = "工作";
|
typeText.text = "工作";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class ServerWorkMessageReplyContinuePanel : MonoBehaviour
|
|||||||
{
|
{
|
||||||
public static ServerWorkMessageReplyContinuePanel Instance;
|
public static ServerWorkMessageReplyContinuePanel Instance;
|
||||||
|
|
||||||
[Header("影片播放")]
|
[Header("影片播放")]
|
||||||
public VideoPlayer videoPlayer;
|
public VideoPlayer videoPlayer;
|
||||||
public RawImage videoDisplay;
|
public RawImage videoDisplay;
|
||||||
|
|
||||||
@ -34,10 +34,10 @@ public class ServerWorkMessageReplyContinuePanel : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (videoPlayer != null)
|
if (videoPlayer != null)
|
||||||
{
|
{
|
||||||
// 設置影片結束事件
|
// 設置影片結束事件
|
||||||
videoPlayer.loopPointReached += OnVideoFinished;
|
videoPlayer.loopPointReached += OnVideoFinished;
|
||||||
|
|
||||||
// 設置影片顯示
|
// 設置影片顯示
|
||||||
if (videoDisplay != null)
|
if (videoDisplay != null)
|
||||||
{
|
{
|
||||||
videoPlayer.targetTexture = null;
|
videoPlayer.targetTexture = null;
|
||||||
@ -52,7 +52,7 @@ public class ServerWorkMessageReplyContinuePanel : MonoBehaviour
|
|||||||
|
|
||||||
void OnVideoFinished(VideoPlayer vp)
|
void OnVideoFinished(VideoPlayer vp)
|
||||||
{
|
{
|
||||||
//Debug.Log("影片播放完成");
|
//Debug.Log("影片播放完成");
|
||||||
if (ServerWorkSceneController.Instance)
|
if (ServerWorkSceneController.Instance)
|
||||||
{
|
{
|
||||||
ServerWorkSceneController.Instance.processStep(13);
|
ServerWorkSceneController.Instance.processStep(13);
|
||||||
|
|||||||
@ -8,7 +8,7 @@ public class ServerWorkMessageReplyExitPanel : MonoBehaviour
|
|||||||
{
|
{
|
||||||
public static ServerWorkMessageReplyExitPanel Instance;
|
public static ServerWorkMessageReplyExitPanel Instance;
|
||||||
|
|
||||||
[Header("影片播放")]
|
[Header("影片播放")]
|
||||||
public VideoPlayer videoPlayer;
|
public VideoPlayer videoPlayer;
|
||||||
public RawImage videoDisplay;
|
public RawImage videoDisplay;
|
||||||
|
|
||||||
@ -42,10 +42,10 @@ public class ServerWorkMessageReplyExitPanel : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (videoPlayer != null)
|
if (videoPlayer != null)
|
||||||
{
|
{
|
||||||
// 設置影片結束事件
|
// 設置影片結束事件
|
||||||
videoPlayer.loopPointReached += OnVideoFinished;
|
videoPlayer.loopPointReached += OnVideoFinished;
|
||||||
|
|
||||||
// 設置影片顯示
|
// 設置影片顯示
|
||||||
if (videoDisplay != null)
|
if (videoDisplay != null)
|
||||||
{
|
{
|
||||||
videoPlayer.targetTexture = null;
|
videoPlayer.targetTexture = null;
|
||||||
@ -59,7 +59,7 @@ public class ServerWorkMessageReplyExitPanel : MonoBehaviour
|
|||||||
|
|
||||||
void OnVideoFinished(VideoPlayer vp)
|
void OnVideoFinished(VideoPlayer vp)
|
||||||
{
|
{
|
||||||
Debug.Log("影片播放完成");
|
Debug.Log("影片播放完成");
|
||||||
ServerWorkSceneController.Instance.processStep(10);
|
ServerWorkSceneController.Instance.processStep(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@ public class ServerWorkMessageReplyWait1Panel : MonoBehaviour
|
|||||||
{
|
{
|
||||||
public static ServerWorkMessageReplyWait1Panel Instance;
|
public static ServerWorkMessageReplyWait1Panel Instance;
|
||||||
|
|
||||||
[Header("影片播放")]
|
[Header("影片播放")]
|
||||||
public VideoPlayer videoPlayer;
|
public VideoPlayer videoPlayer;
|
||||||
public RawImage videoDisplay;
|
public RawImage videoDisplay;
|
||||||
|
|
||||||
@ -42,10 +42,10 @@ public class ServerWorkMessageReplyWait1Panel : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (videoPlayer != null)
|
if (videoPlayer != null)
|
||||||
{
|
{
|
||||||
// 設置影片結束事件
|
// 設置影片結束事件
|
||||||
videoPlayer.loopPointReached += OnVideoFinished;
|
videoPlayer.loopPointReached += OnVideoFinished;
|
||||||
|
|
||||||
// 設置影片顯示
|
// 設置影片顯示
|
||||||
if (videoDisplay != null)
|
if (videoDisplay != null)
|
||||||
{
|
{
|
||||||
videoPlayer.targetTexture = null;
|
videoPlayer.targetTexture = null;
|
||||||
@ -59,7 +59,7 @@ public class ServerWorkMessageReplyWait1Panel : MonoBehaviour
|
|||||||
|
|
||||||
void OnVideoFinished(VideoPlayer vp)
|
void OnVideoFinished(VideoPlayer vp)
|
||||||
{
|
{
|
||||||
Debug.Log("影片播放完成");
|
Debug.Log("影片播放完成");
|
||||||
ServerWorkSceneController.Instance.processStep(6);
|
ServerWorkSceneController.Instance.processStep(6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class ServerWorkMessageReplyWait1WorkingPanel : MonoBehaviour
|
|||||||
{
|
{
|
||||||
public static ServerWorkMessageReplyWait1WorkingPanel Instance;
|
public static ServerWorkMessageReplyWait1WorkingPanel Instance;
|
||||||
|
|
||||||
[Header("影片播放")]
|
[Header("影片播放")]
|
||||||
public VideoPlayer videoPlayer;
|
public VideoPlayer videoPlayer;
|
||||||
public RawImage videoDisplay;
|
public RawImage videoDisplay;
|
||||||
|
|
||||||
@ -40,10 +40,10 @@ public class ServerWorkMessageReplyWait1WorkingPanel : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (videoPlayer != null)
|
if (videoPlayer != null)
|
||||||
{
|
{
|
||||||
// 設置影片結束事件
|
// 設置影片結束事件
|
||||||
videoPlayer.loopPointReached += OnVideoFinished;
|
videoPlayer.loopPointReached += OnVideoFinished;
|
||||||
|
|
||||||
// 設置影片顯示
|
// 設置影片顯示
|
||||||
if (videoDisplay != null)
|
if (videoDisplay != null)
|
||||||
{
|
{
|
||||||
videoPlayer.targetTexture = null;
|
videoPlayer.targetTexture = null;
|
||||||
@ -58,7 +58,7 @@ public class ServerWorkMessageReplyWait1WorkingPanel : MonoBehaviour
|
|||||||
|
|
||||||
void OnVideoFinished(VideoPlayer vp)
|
void OnVideoFinished(VideoPlayer vp)
|
||||||
{
|
{
|
||||||
//Debug.Log("影片播放完成");
|
//Debug.Log("影片播放完成");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,7 @@ public class ServerWorkMessageReplyWait2Panel : MonoBehaviour
|
|||||||
{
|
{
|
||||||
public static ServerWorkMessageReplyWait2Panel Instance;
|
public static ServerWorkMessageReplyWait2Panel Instance;
|
||||||
|
|
||||||
[Header("影片播放")]
|
[Header("影片播放")]
|
||||||
public VideoPlayer videoPlayer;
|
public VideoPlayer videoPlayer;
|
||||||
public RawImage videoDisplay;
|
public RawImage videoDisplay;
|
||||||
|
|
||||||
@ -41,10 +41,10 @@ public class ServerWorkMessageReplyWait2Panel : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (videoPlayer != null)
|
if (videoPlayer != null)
|
||||||
{
|
{
|
||||||
// 設置影片結束事件
|
// 設置影片結束事件
|
||||||
videoPlayer.loopPointReached += OnVideoFinished;
|
videoPlayer.loopPointReached += OnVideoFinished;
|
||||||
|
|
||||||
// 設置影片顯示
|
// 設置影片顯示
|
||||||
if (videoDisplay != null)
|
if (videoDisplay != null)
|
||||||
{
|
{
|
||||||
videoPlayer.targetTexture = null;
|
videoPlayer.targetTexture = null;
|
||||||
@ -58,7 +58,7 @@ public class ServerWorkMessageReplyWait2Panel : MonoBehaviour
|
|||||||
|
|
||||||
void OnVideoFinished(VideoPlayer vp)
|
void OnVideoFinished(VideoPlayer vp)
|
||||||
{
|
{
|
||||||
Debug.Log("影片播放完成");
|
Debug.Log("影片播放完成");
|
||||||
ServerWorkSceneController.Instance.processStep(8);
|
ServerWorkSceneController.Instance.processStep(8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class ServerWorkMessageReplyWait2WorkingPanel : MonoBehaviour
|
|||||||
{
|
{
|
||||||
public static ServerWorkMessageReplyWait2WorkingPanel Instance;
|
public static ServerWorkMessageReplyWait2WorkingPanel Instance;
|
||||||
|
|
||||||
[Header("影片播放")]
|
[Header("影片播放")]
|
||||||
public VideoPlayer videoPlayer;
|
public VideoPlayer videoPlayer;
|
||||||
public RawImage videoDisplay;
|
public RawImage videoDisplay;
|
||||||
|
|
||||||
@ -41,10 +41,10 @@ public class ServerWorkMessageReplyWait2WorkingPanel : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (videoPlayer != null)
|
if (videoPlayer != null)
|
||||||
{
|
{
|
||||||
// 設置影片結束事件
|
// 設置影片結束事件
|
||||||
videoPlayer.loopPointReached += OnVideoFinished;
|
videoPlayer.loopPointReached += OnVideoFinished;
|
||||||
|
|
||||||
// 設置影片顯示
|
// 設置影片顯示
|
||||||
if (videoDisplay != null)
|
if (videoDisplay != null)
|
||||||
{
|
{
|
||||||
videoPlayer.targetTexture = null;
|
videoPlayer.targetTexture = null;
|
||||||
@ -59,7 +59,7 @@ public class ServerWorkMessageReplyWait2WorkingPanel : MonoBehaviour
|
|||||||
|
|
||||||
void OnVideoFinished(VideoPlayer vp)
|
void OnVideoFinished(VideoPlayer vp)
|
||||||
{
|
{
|
||||||
//Debug.Log("影片播放完成");
|
//Debug.Log("影片播放完成");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,11 +16,11 @@ public class ServerWorkMessageReplyWordsPanel : MonoBehaviour
|
|||||||
|
|
||||||
private int currentSampleWordsIndex = 0;
|
private int currentSampleWordsIndex = 0;
|
||||||
private string[] sampleWords = {
|
private string[] sampleWords = {
|
||||||
"福在心間非遠方行誠一步百事昌天開一線容人渡前路微光漸放芒",
|
"福在心間非遠方行誠一步百事昌天開一線容人渡前路微光漸放芒",
|
||||||
"命裡有時終必至急行反失遠行期靜看潮起潮又落好風自會送舟歸",
|
"命裡有時終必至急行反失遠行期靜看潮起潮又落好風自會送舟歸",
|
||||||
"心誠萬事皆能順莫急莫慌自有門天道酬勤終不負善念長存歸本根",
|
"心誠萬事皆能順莫急莫慌自有門天道酬勤終不負善念長存歸本根",
|
||||||
"汝問蒼天天不語早知汝路自難移命數原非神可改徒然叩首費心思",
|
"汝問蒼天天不語早知汝路自難移命數原非神可改徒然叩首費心思",
|
||||||
"求財無財空添亂問愛無愛更心煩問命問天徒自苦不如回家補個眠"
|
"求財無財空添亂問愛無愛更心煩問命問天徒自苦不如回家補個眠"
|
||||||
};
|
};
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
|
|||||||
8
Assets/Scripts/Utils.meta
Normal file
8
Assets/Scripts/Utils.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d0cf37a1ad53db44aac1eee1fffaf555
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
35
Assets/Scripts/Utils/GlobalData.cs
Normal file
35
Assets/Scripts/Utils/GlobalData.cs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class GlobalData
|
||||||
|
{
|
||||||
|
#region <目前沒用到>
|
||||||
|
/*
|
||||||
|
///<summary>
|
||||||
|
/// 伺服器 IP
|
||||||
|
///</summary>
|
||||||
|
public static string SERVER_IP
|
||||||
|
{
|
||||||
|
set { _SERVER_IP = value; }
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _SERVER_IP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private static string _SERVER_IP = "127.0.0.1";
|
||||||
|
///<summary>
|
||||||
|
/// 伺服器 Port
|
||||||
|
///</summary>
|
||||||
|
public const ushort _SERVER_PORT = 17777;
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 小遊戲 - 對話的倒數時間
|
||||||
|
/// </summary>
|
||||||
|
public const int GAME_TALK_COUNTDOWN_TIME = 120;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 詩籤的倒數時間
|
||||||
|
/// </summary>
|
||||||
|
public const int WORD_COUNTDOWN_TIME = 60;
|
||||||
|
}
|
||||||
2
Assets/Scripts/Utils/GlobalData.cs.meta
Normal file
2
Assets/Scripts/Utils/GlobalData.cs.meta
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 14598982ddaf08a45802c011ef834d76
|
||||||
Loading…
Reference in New Issue
Block a user