Skip to content

Commit 7de7c31

Browse files
committed
feat: Add additive scene load event
1 parent 8de7d8b commit 7de7c31

File tree

13 files changed

+188
-297
lines changed

13 files changed

+188
-297
lines changed

Assets/JCSUnity/Prefabs/Events.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!1 &4456751601256660041
4+
GameObject:
5+
m_ObjectHideFlags: 0
6+
m_CorrespondingSourceObject: {fileID: 0}
7+
m_PrefabInstance: {fileID: 0}
8+
m_PrefabAsset: {fileID: 0}
9+
serializedVersion: 6
10+
m_Component:
11+
- component: {fileID: 2726090515488495221}
12+
- component: {fileID: 1195507366169514482}
13+
m_Layer: 0
14+
m_Name: JCS_AdditiveSceneLoadEvent
15+
m_TagString: Untagged
16+
m_Icon: {fileID: 0}
17+
m_NavMeshLayer: 0
18+
m_StaticEditorFlags: 0
19+
m_IsActive: 1
20+
--- !u!4 &2726090515488495221
21+
Transform:
22+
m_ObjectHideFlags: 0
23+
m_CorrespondingSourceObject: {fileID: 0}
24+
m_PrefabInstance: {fileID: 0}
25+
m_PrefabAsset: {fileID: 0}
26+
m_GameObject: {fileID: 4456751601256660041}
27+
serializedVersion: 2
28+
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
29+
m_LocalPosition: {x: -0, y: 0, z: 0}
30+
m_LocalScale: {x: 1, y: 1, z: 1}
31+
m_ConstrainProportionsScale: 0
32+
m_Children: []
33+
m_Father: {fileID: 0}
34+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
35+
--- !u!114 &1195507366169514482
36+
MonoBehaviour:
37+
m_ObjectHideFlags: 0
38+
m_CorrespondingSourceObject: {fileID: 0}
39+
m_PrefabInstance: {fileID: 0}
40+
m_PrefabAsset: {fileID: 0}
41+
m_GameObject: {fileID: 4456751601256660041}
42+
m_Enabled: 1
43+
m_EditorHideFlags: 0
44+
m_Script: {fileID: 11500000, guid: 136c7c32473946948b843e1cf110bc57, type: 3}
45+
m_Name:
46+
m_EditorClassIdentifier:
47+
sceneNames: []

Assets/JCSUnity/Prefabs/Events/JCS_AdditiveSceneLoadEvent.prefab.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/**
2+
* $File: JCS_AddictiveSceneLoadEvent.cs $
3+
* $Date: 2025-08-27 05:10:36 $
4+
* $Revision: $
5+
* $Creator: Jen-Chieh Shen $
6+
* $Notice: See LICENSE.txt for modification and distribution information
7+
* Copyright (c) 2025 by Shen, Jen-Chieh $
8+
*/
9+
using System.Collections.Generic;
10+
using UnityEngine;
11+
using UnityEngine.SceneManagement;
12+
using MyBox;
13+
14+
namespace JCSUnity
15+
{
16+
/// <summary>
17+
/// Event that loads a list of additive scenes.
18+
///
19+
/// This is used for working with multiple scenes and use
20+
/// thoses scenes as an overlays.
21+
/// </summary>
22+
public class JCS_AdditiveSceneLoadEvent : MonoBehaviour
23+
{
24+
/* Variables */
25+
26+
[Separator("Initialize Variables (JCS_AdditiveSceneLoadEvent)")]
27+
28+
[Tooltip("A list of addictive scene to load.")]
29+
[Scene]
30+
public List<string> sceneNames = null;
31+
32+
[Tooltip("Load scene asynchronously.")]
33+
[SerializeField]
34+
private bool mUseAsync = false;
35+
36+
/* Setter & Getter */
37+
38+
public bool useAsync { get { return mUseAsync; } set { mUseAsync = value; } }
39+
40+
/* Functions */
41+
42+
private void Awake()
43+
{
44+
foreach (string sceneName in sceneNames)
45+
{
46+
if (mUseAsync)
47+
SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Additive);
48+
else
49+
SceneManager.LoadScene(sceneName, LoadSceneMode.Additive);
50+
}
51+
}
52+
}
53+
}

Assets/_Project/Scripts/Others/FT_AppQuit.cs.meta renamed to Assets/JCSUnity/Scripts/Events/System/JCS_AdditiveSceneLoadEvent.cs.meta

Lines changed: 3 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/JCSUnity/Scripts/Managers/JCS_NetworkManager.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ public void CheckConnectionWithTime()
127127
if (SERVER_CLOSE)
128128
{
129129
Debug.Log("Server End!");
130-
JCS_UtilFunctions.PopIsConnectDialogue();
131130
}
132131
else if (FIRST_LOGIN)
133132
{

Assets/JCSUnity/Scripts/Managers/JCS_UIManager.cs

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -144,36 +144,17 @@ private void Start()
144144
this.mFadeScreen = JCS_Util.Instantiate(path).GetComponent<JCS_FadeScreen>();
145145
}
146146

147+
#if UNITY_EDITOR
147148
private void Update()
148149
{
149-
#if UNITY_EDITOR
150150
Test();
151-
#endif
152-
153-
#if (UNITY_EDITOR || UNITY_STANDALONE)
154-
155-
// Exit in game diagloue not in game UI!!
156-
// (Admin input)
157-
if (Input.GetKeyDown(KeyCode.Escape))
158-
JCS_UtilFunctions.DestoryCurrentDialogue(JCS_DialogueType.PLAYER_DIALOGUE);
159-
#endif
160151
}
161152

162-
#if UNITY_EDITOR
163153
private void Test()
164154
{
165155
if (!mTestWithKey)
166156
return;
167157

168-
//if (JCS_Input.GetKeyDown(KeyCode.A))
169-
// JCS_UtilFunctions.PopIsConnectDialogue();
170-
//if (JCS_Input.GetKeyDown(KeyCode.S))
171-
// JCS_UtilFunctions.PopSettingDialogue();
172-
//if (JCS_Input.GetKeyDown(KeyCode.D))
173-
// JCS_UtilFunctions.PopInGameUI();
174-
//if (JCS_Input.GetKeyDown(KeyCode.F))
175-
// JCS_UtilFunctions.PopTalkDialogue();
176-
177158
if (JCS_Input.GetKeyDown(KeyCode.A))
178159
{
179160
Color col = Color.red;

Assets/JCSUnity/Scripts/Network/JCS_TCPSocket.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ public void Connect(string hostname, int port)
8686
catch (Exception ex)
8787
{
8888
Debug.LogError("Server Connect failed: " + ex.Message);
89-
JCS_UtilFunctions.PopIsConnectDialogue();
9089
}
9190
}
9291

Assets/JCSUnity/Scripts/Network/JCS_UDPSocket.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ public void Connect(string hostname, int port)
8888
catch (Exception ex)
8989
{
9090
Debug.LogError("Server Connect failed: " + ex.Message);
91-
JCS_UtilFunctions.PopIsConnectDialogue();
9291
}
9392
}
9493

0 commit comments

Comments
 (0)