mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
fix: Updated examples to handle StopClient for Host
This commit is contained in:
parent
3d9e95e52c
commit
d3038478cf
@ -175,8 +175,8 @@ Camera:
|
||||
near clip plane: 0.3
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 0
|
||||
orthographic size: 5
|
||||
orthographic: 1
|
||||
orthographic size: 15
|
||||
m_Depth: -1
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
|
@ -38,7 +38,7 @@ RenderSettings:
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
m_IndirectSpecularColor: {r: 0.2312071, g: 0.2344121, b: 0.27077314, a: 1}
|
||||
m_IndirectSpecularColor: {r: 0.043674428, g: 0.044857424, b: 0.059592403, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
@ -212,6 +212,7 @@ Transform:
|
||||
m_LocalRotation: {x: 0.55403227, y: -0.21201213, z: 0.14845248, w: 0.79124016}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
@ -268,8 +269,8 @@ Camera:
|
||||
near clip plane: 0.3
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 0
|
||||
orthographic size: 5
|
||||
orthographic: 1
|
||||
orthographic size: 15
|
||||
m_Depth: -1
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
@ -295,6 +296,7 @@ Transform:
|
||||
m_LocalRotation: {x: 0, y: -0.2658926, z: 0, w: 0.9640027}
|
||||
m_LocalPosition: {x: 3.84, y: 1.91, z: -10}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
@ -388,6 +390,7 @@ Transform:
|
||||
m_LocalRotation: {x: 0.9848078, y: -0, z: -0, w: -0.17364809}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 3
|
||||
@ -481,6 +484,7 @@ Transform:
|
||||
m_LocalRotation: {x: 0.28678825, y: -0.70940644, z: -0.4967319, w: -0.4095759}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 4
|
||||
@ -574,6 +578,7 @@ Transform:
|
||||
m_LocalRotation: {x: 0.9063079, y: 0, z: 0, w: 0.42261827}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 2
|
||||
@ -608,6 +613,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_SendPointerHoverToParent: 1
|
||||
m_HorizontalAxis: Horizontal
|
||||
m_VerticalAxis: Vertical
|
||||
m_SubmitButton: Submit
|
||||
@ -640,6 +646,7 @@ Transform:
|
||||
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: 0}
|
||||
m_RootOrder: 5
|
||||
|
@ -35,6 +35,7 @@ public override void OnStopLocalPlayer()
|
||||
mainCam.transform.SetParent(null);
|
||||
SceneManager.MoveGameObjectToScene(mainCam.gameObject, SceneManager.GetActiveScene());
|
||||
mainCam.orthographic = true;
|
||||
mainCam.orthographicSize = 15f;
|
||||
mainCam.transform.localPosition = new Vector3(0f, 70f, 0f);
|
||||
mainCam.transform.localEulerAngles = new Vector3(90f, 0f, 0f);
|
||||
}
|
||||
|
@ -37,7 +37,8 @@ public override void OnStopServer()
|
||||
|
||||
public override void OnStopClient()
|
||||
{
|
||||
StartCoroutine(UnloadScenes());
|
||||
if (mode == NetworkManagerMode.Offline)
|
||||
StartCoroutine(UnloadScenes());
|
||||
}
|
||||
|
||||
IEnumerator LoadSubScenes()
|
||||
|
@ -118,7 +118,8 @@ public override void OnStopServer()
|
||||
IEnumerator ServerUnloadSubScenes()
|
||||
{
|
||||
for (int index = 0; index < subScenes.Count; index++)
|
||||
yield return SceneManager.UnloadSceneAsync(subScenes[index]);
|
||||
if (subScenes[index].IsValid())
|
||||
yield return SceneManager.UnloadSceneAsync(subScenes[index]);
|
||||
|
||||
subScenes.Clear();
|
||||
subscenesLoaded = false;
|
||||
@ -131,8 +132,8 @@ IEnumerator ServerUnloadSubScenes()
|
||||
/// </summary>
|
||||
public override void OnStopClient()
|
||||
{
|
||||
// make sure we're not in host mode
|
||||
if (mode == NetworkManagerMode.ClientOnly)
|
||||
// Make sure we're not in ServerOnly mode now after stopping host client
|
||||
if (mode == NetworkManagerMode.Offline)
|
||||
StartCoroutine(ClientUnloadSubScenes());
|
||||
}
|
||||
|
||||
@ -140,10 +141,8 @@ public override void OnStopClient()
|
||||
IEnumerator ClientUnloadSubScenes()
|
||||
{
|
||||
for (int index = 0; index < SceneManager.sceneCount; index++)
|
||||
{
|
||||
if (SceneManager.GetSceneAt(index) != SceneManager.GetActiveScene())
|
||||
yield return SceneManager.UnloadSceneAsync(SceneManager.GetSceneAt(index));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
Loading…
Reference in New Issue
Block a user