Skip to content

Commit

Permalink
loading screen fix
Browse files Browse the repository at this point in the history
  • Loading branch information
shnok committed Jun 17, 2024
1 parent 01a03bb commit 5634c27
Show file tree
Hide file tree
Showing 12 changed files with 586 additions and 705 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<ui:VisualElement name="UIContainer" focusable="false" usage-hints="GroupTransform" style="opacity: 1; display: flex; background-color: rgba(173, 110, 0, 0); flex-grow: 1;">
<ui:VisualElement name="Spacer" style="flex-grow: 1;" />
</ui:VisualElement>
<ui:VisualElement name="Loading" style="flex-grow: 1; position: absolute; background-color: rgb(0, 0, 0); width: 100%; height: 100%; align-self: center; justify-content: flex-end;">
<ui:VisualElement name="Loading" style="flex-grow: 1; position: absolute; background-color: rgb(0, 0, 0); width: 100%; height: 100%; align-self: center; justify-content: flex-end; display: none;">
<ui:Label tabindex="-1" text="Loading..." parse-escape-sequences="true" display-tooltip-when-elided="true" style="justify-content: space-around; align-items: flex-end; -unity-text-align: upper-right; -unity-font: resource(&apos;Data/UI/Font/tahoma&apos;); -unity-font-definition: initial; color: rgb(255, 255, 255); margin-bottom: 17px; margin-left: 3px; margin-right: 19px; font-size: 25px;" />
</ui:VisualElement>
</ui:UXML>
224 changes: 112 additions & 112 deletions l2-unity/Assets/Scenes/Menu.unity
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ RenderSettings:
m_ReflectionBounces: 1
m_ReflectionIntensity: 0.245
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_Sun: {fileID: 1061591418}
m_IndirectSpecularColor: {r: 0.063133255, g: 0.093109384, b: 0.10891574, a: 0.245}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
Expand Down Expand Up @@ -124,6 +124,75 @@ NavMeshSettings:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!21 &160557713
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Override
m_Shader: {fileID: 4800000, guid: a3a3bc8785681554d9558e2ea68f100e, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs: []
m_Ints: []
m_Floats:
- _AdvancedCat: 1
- _Banner: 1
- _DirectionalCat: 1
- _DirectionalFalloff: 2
- _DirectionalIntensity: 1
- _FarDistanceHeight: 0
- _FarDistanceOffset: 0
- _FogAxisMode: 1
- _FogCameraMode: 0
- _FogCat: 1
- _FogColorDuo: 1
- _FogDistanceEnd: 100
- _FogDistanceFalloff: 2
- _FogDistanceStart: 0
- _FogHeightEnd: 100
- _FogHeightFalloff: 2
- _FogHeightStart: 0
- _FogIntensity: 1
- _FogLayersMode: 0
- _IsHeightFogPreset: 1
- _IsHeightFogShader: 1
- _JitterIntensity: 1
- _NoiseCat: 1
- _NoiseDistanceEnd: 50
- _NoiseIntensity: 1
- _NoiseMax: 1
- _NoiseMin: 0
- _NoiseModeBlend: 1
- _NoiseScale: 30
- _SkyboxCat: 1
- _SkyboxFogBottom: 0
- _SkyboxFogFalloff: 1
- _SkyboxFogFill: 1
- _SkyboxFogHeight: 1
- _SkyboxFogIntensity: 1
- _SkyboxFogOffset: 0
m_Colors:
- _DirectionalColor: {r: 1, g: 0.7793103, b: 0.5, a: 1}
- _DirectionalDir: {r: 0, g: 0, b: 0, a: 0}
- _FogAxisOption: {r: 0, g: 0, b: 0, a: 0}
- _FogColorEnd: {r: 0.8862745, g: 1.443137, b: 2, a: 1}
- _FogColorStart: {r: 0.4411765, g: 0.722515, b: 1, a: 1}
- _NoiseSpeed: {r: 0.5, g: 0, b: 0.5, a: 0}
m_BuildTextureStacks: []
--- !u!21 &355784177
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -302,41 +371,6 @@ PrefabInstance:
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 2bc6245aea0342f4f8c76719bfe12012, type: 3}
--- !u!21 &716871526
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Height Fog Global
m_Shader: {fileID: 4800000, guid: 3a7ef1b66bafb7a448a880ef76d2e6e6, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3001
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs: []
m_Ints: []
m_Floats:
- _AdvancedCat: 1
- _Banner: 1
- _DirectionalCat: 1
- _FogCat: 1
- _HeightFogGlobal: 1
- _IsHeightFogShader: 1
- _NoiseCat: 1
- _SkyboxCat: 1
m_Colors: []
m_BuildTextureStacks: []
--- !u!1 &803395386
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -425,41 +459,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 8b0fe3925e7292c4ba50fe5673c88b55, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!21 &855168623
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Height Fog Global
m_Shader: {fileID: 4800000, guid: 3a7ef1b66bafb7a448a880ef76d2e6e6, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3001
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs: []
m_Ints: []
m_Floats:
- _AdvancedCat: 1
- _Banner: 1
- _DirectionalCat: 1
- _FogCat: 1
- _HeightFogGlobal: 1
- _IsHeightFogShader: 1
- _NoiseCat: 1
- _SkyboxCat: 1
m_Colors: []
m_BuildTextureStacks: []
--- !u!1001 &1001879169
PrefabInstance:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -682,7 +681,7 @@ PrefabInstance:
- target: {fileID: 14083907825353274, guid: 8742fc349ac4f354d9cfb98ebb79a0e3, type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 716871526}
objectReference: {fileID: 2003590081}
- target: {fileID: 2134954596300280144, guid: 8742fc349ac4f354d9cfb98ebb79a0e3, type: 3}
propertyPath: m_Name
value: Height Fog Global
Expand Down Expand Up @@ -772,6 +771,41 @@ PrefabInstance:
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 8742fc349ac4f354d9cfb98ebb79a0e3, type: 3}
--- !u!21 &1444068933
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Height Fog Global
m_Shader: {fileID: 4800000, guid: 3a7ef1b66bafb7a448a880ef76d2e6e6, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3001
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs: []
m_Ints: []
m_Floats:
- _AdvancedCat: 1
- _Banner: 1
- _DirectionalCat: 1
- _FogCat: 1
- _HeightFogGlobal: 1
- _IsHeightFogShader: 1
- _NoiseCat: 1
- _SkyboxCat: 1
m_Colors: []
m_BuildTextureStacks: []
--- !u!1001 &1447152442
PrefabInstance:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -833,23 +867,23 @@ PrefabInstance:
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: babd2d27777f4774581e9efa23af7856, type: 3}
--- !u!21 &1601338621
--- !u!21 &2003590081
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Override
m_Shader: {fileID: 4800000, guid: a3a3bc8785681554d9558e2ea68f100e, type: 3}
m_Name: Height Fog Global
m_Shader: {fileID: 4800000, guid: 3a7ef1b66bafb7a448a880ef76d2e6e6, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
m_CustomRenderQueue: 3001
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
Expand All @@ -861,46 +895,12 @@ Material:
- _AdvancedCat: 1
- _Banner: 1
- _DirectionalCat: 1
- _DirectionalFalloff: 2
- _DirectionalIntensity: 1
- _FarDistanceHeight: 0
- _FarDistanceOffset: 0
- _FogAxisMode: 1
- _FogCameraMode: 0
- _FogCat: 1
- _FogColorDuo: 1
- _FogDistanceEnd: 100
- _FogDistanceFalloff: 2
- _FogDistanceStart: 0
- _FogHeightEnd: 100
- _FogHeightFalloff: 2
- _FogHeightStart: 0
- _FogIntensity: 1
- _FogLayersMode: 0
- _IsHeightFogPreset: 1
- _HeightFogGlobal: 1
- _IsHeightFogShader: 1
- _JitterIntensity: 1
- _NoiseCat: 1
- _NoiseDistanceEnd: 50
- _NoiseIntensity: 1
- _NoiseMax: 1
- _NoiseMin: 0
- _NoiseModeBlend: 1
- _NoiseScale: 30
- _SkyboxCat: 1
- _SkyboxFogBottom: 0
- _SkyboxFogFalloff: 1
- _SkyboxFogFill: 1
- _SkyboxFogHeight: 1
- _SkyboxFogIntensity: 1
- _SkyboxFogOffset: 0
m_Colors:
- _DirectionalColor: {r: 1, g: 0.7793103, b: 0.5, a: 1}
- _DirectionalDir: {r: 0, g: 0, b: 0, a: 0}
- _FogAxisOption: {r: 0, g: 0, b: 0, a: 0}
- _FogColorEnd: {r: 0.8862745, g: 1.443137, b: 2, a: 1}
- _FogColorStart: {r: 0.4411765, g: 0.722515, b: 1, a: 1}
- _NoiseSpeed: {r: 0.5, g: 0, b: 0.5, a: 0}
m_Colors: []
m_BuildTextureStacks: []
--- !u!114 &1769945945372889719
MonoBehaviour:
Expand Down
10 changes: 1 addition & 9 deletions l2-unity/Assets/Scripts/Game/Manager/CameraManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ void Awake() {
}

private void Start() {
Debug.Log(GameObject.Find("Login").GetComponent<Camera>());
Debug.Log(GameObject.Find("CharSelect").GetComponent<Camera>());
Debug.Log(GameObject.Find("DarkElf").GetComponent<Camera>());
Debug.Log(GameObject.Find("Orc").GetComponent<Camera>());
Debug.Log(GameObject.Find("Dwarf").GetComponent<Camera>());
Debug.Log(GameObject.Find("Elf").GetComponent<Camera>());

Debug.Log(GameObject.Find("Human"));
cameras.Add("Login", GameObject.Find("Login").GetComponent<Camera>());
cameras.Add("CharSelect", GameObject.Find("CharSelect").GetComponent<Camera>());
cameras.Add("DarkElf", GameObject.Find("DarkElf").GetComponent<Camera>());
Expand All @@ -42,7 +34,7 @@ public void SwitchCamera(string camera) {
DisableMainCamera();

if (cameras.TryGetValue(camera, out Camera obj)) {
Debug.Log(camera + " enbaled.");
Debug.Log(camera + " camera enabled.");
obj.enabled = true;
}
}
Expand Down
12 changes: 12 additions & 0 deletions l2-unity/Assets/Scripts/Game/Manager/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public void LogOut() {
}

public void OnWorldSceneLoaded() {
GameObject.Destroy(L2LoginUI.Instance.gameObject);
ClientPacketHandler.Instance.SendLoadWorld();
}

Expand All @@ -55,9 +56,14 @@ public void OnConnectionAllowed() {
public void OnCharacterSelect() {
_gameState = GameState.IN_GAME;

L2LoginUI.Instance.StartLoading();
SceneLoader.Instance.LoadGame();
}

public void OnWorldLoading() {
L2GameUI.Instance.StartLoading();
}

public void OnRelogin() {
_gameState = GameState.LOGIN;

Expand All @@ -71,7 +77,13 @@ public void OnDisconnect() {
SceneLoader.Instance.LoadMenu();
}

public void OnStartingGame() {
Debug.Log("On Starting game");
L2LoginUI.Instance.StartLoading();
}

public void OnGameLaunched() {
Debug.Log("On game launched");
L2LoginUI.Instance.StopLoading();
}
}
5 changes: 3 additions & 2 deletions l2-unity/Assets/Scripts/Game/Manager/SceneLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ private void Start() {
}

public void LoadMenu() {
GameManager.Instance.OnStartingGame();
SwitchScene(_menuScene, ((AsyncOperation o) => {
L2LoginUI.Instance.StartLoading();
LoadScene(_lobbyScene, (AsyncOperation operation) => {
OnSceneLoad(operation, _lobbyScene);
});
Expand All @@ -41,6 +41,7 @@ public void LoadMenu() {
public void LoadGame() {
_totalLoadedScenes = 0;
SwitchScene(_gameScene, ((AsyncOperation o) => {
GameManager.Instance.OnWorldLoading();
for (int i = 0; i < _mapList.Count; i++) {
var map = _mapList[i];
LoadScene(map, (AsyncOperation operation) => {
Expand Down Expand Up @@ -109,7 +110,7 @@ IEnumerator StartGame() {

private void OnSceneLoad(AsyncOperation operation, string sceneName) {
if(sceneName == _lobbyScene) {
L2LoginUI.Instance.StopLoading();
GameManager.Instance.OnGameLaunched();
}
}
}
Loading

0 comments on commit 5634c27

Please sign in to comment.