diff --git a/.nginx/webgl.conf b/.nginx/webgl.conf index 5af1a976c..fcb12c5ec 100644 --- a/.nginx/webgl.conf +++ b/.nginx/webgl.conf @@ -5,7 +5,7 @@ server { location / { root /webgl; index index.html; - try_files $uri /index.html; + try_files $uri /index.html =404; } error_page 404 /404.html; diff --git a/Assets/Plugins/LoadMinigame.jslib b/Assets/Plugins/LoadMinigame.jslib index 5c57a7750..cd45dbf65 100644 --- a/Assets/Plugins/LoadMinigame.jslib +++ b/Assets/Plugins/LoadMinigame.jslib @@ -15,6 +15,7 @@ mergeInto(LibraryManager.library, { if (event.data === "CLOSE ME") { SendMessage("GameManager", "MinigameDone"); iframe.remove(); + setTimeout(() => { window.parent.postMessage("FOCUS ME"); }, 100); // Wait a bit to give the overworld time to query the new data before focusing it } }) } diff --git a/Assets/Scripts/GameManager/DataManager.cs b/Assets/Scripts/GameManager/DataManager.cs index 0c9031c04..40b5b4755 100644 --- a/Assets/Scripts/GameManager/DataManager.cs +++ b/Assets/Scripts/GameManager/DataManager.cs @@ -829,12 +829,14 @@ private string GenerateWorldBarrierInfoTextWithoutInBetweenWorld(int originWorld if (highestActiveDungeon == 0) { int activeMinigameCount = getActiveMinigameCount(originWorldIndex); - + Debug.Log("World " + originWorldIndex + " has no active minigames"); if (activeMinigameCount == 0) { - return "ERROR - PLEASE CONTACT THE DEVELOPERS"; + string log = "World " + originWorldIndex + " has no active minigames"; + Debug.Log(log); + return "ERROR - PLEASE CONTACT THE DEVELOPERS: " + log; } - + Debug.Log("World " + originWorldIndex + " has no active minigames"); return "COMPLETE " + activeMinigameCount + " MORE MINIGAMES TO UNLOCK THIS AREA."; } else if (highestActiveDungeon == highestUnlockedDungeon) @@ -843,7 +845,9 @@ private string GenerateWorldBarrierInfoTextWithoutInBetweenWorld(int originWorld if (activeMinigameCount == 0) { - return "ERROR - PLEASE CONTACT THE DEVELOPERS"; + string log = "World " + originWorldIndex + ", Dungeon " + highestUnlockedDungeon + " has no active minigames"; + Debug.Log(log); + return "ERROR - PLEASE CONTACT THE DEVELOPERS: " + log; } return "COMPLETE " + activeMinigameCount + " MORE MINIGAMES IN DUNGEON " + originWorldIndex + @@ -877,7 +881,9 @@ private string GenerateWorldBarrierInfoTextWithInBetweenWorld(int originWorldInd if (activeMinigameCount == 0) { - return "ERROR - PLEASE CONTACT THE DEVELOPERS"; + string log = "World " + inBetweenWorld + " has no active minigames"; + Debug.Log(log); + return "ERROR - PLEASE CONTACT THE DEVELOPERS: " + log; } return "COMPLETE " + activeMinigameCount + " MORE MINIGAMES IN WORLD " + inBetweenWorld + @@ -889,7 +895,9 @@ private string GenerateWorldBarrierInfoTextWithInBetweenWorld(int originWorldInd if (activeMinigameCount == 0) { - return "ERROR - PLEASE CONTACT THE DEVELOPERS"; + string log = "World " + inBetweenWorld + ", Dungeon " + highestUnlockedDungeon + " has no active minigames"; + Debug.Log(log); + return "ERROR - PLEASE CONTACT THE DEVELOPERS: " + log; } return "COMPLETE " + activeMinigameCount + " MORE MINIGAMES IN DUNGEON " + inBetweenWorld + @@ -932,7 +940,9 @@ private string GenerateDungeonBarrierInfoText(int originWorldIndex, int destinat if (activeMinigameCount == 0) { - return "ERROR - PLEASE CONTACT THE DEVELOPERS"; + string log = "World " + originWorldIndex + " has no active minigames"; + Debug.Log(log); + return "ERROR - PLEASE CONTACT THE DEVELOPERS: " + log; } return "COMPLETE " + activeMinigameCount + " MORE MINIGAMES TO UNLOCK THIS AREA."; @@ -943,7 +953,9 @@ private string GenerateDungeonBarrierInfoText(int originWorldIndex, int destinat if (activeMinigameCount == 0) { - return "ERROR - PLEASE CONTACT THE DEVELOPERS"; + string log = "World " + originWorldIndex + ", Dungeon " + (destinationAreaIndex - 1) + " has no active minigames"; + Debug.Log(log); + return "ERROR - PLEASE CONTACT THE DEVELOPERS: " + log; } return "COMPLETE " + activeMinigameCount + " MORE MINIGAMES IN DUNGEON " + originWorldIndex + "-" + @@ -1036,4 +1048,4 @@ private int getActiveMinigameCount(int worldIndex, int dungeonIndex) return activeMinigameCount; } -} \ No newline at end of file +} diff --git a/Assets/Scripts/GameManager/GameManager.cs b/Assets/Scripts/GameManager/GameManager.cs index 26435c17c..266cc3f41 100644 --- a/Assets/Scripts/GameManager/GameManager.cs +++ b/Assets/Scripts/GameManager/GameManager.cs @@ -223,7 +223,7 @@ private string BuildSceneName() public void MinigameDone() { Debug.Log("Start minigame respawn at: " + minigameRespawnPosition.x + ", " + minigameRespawnPosition.y); - Reload(); + LoadingManager.Instance.ReloadDataAndCheckConsistency(); } /// @@ -587,4 +587,4 @@ private AchievementStatistic[] GetDummyAchievements() statistcs[1] = achievementStatistic2; return statistcs; } -} \ No newline at end of file +} diff --git a/Assets/Scripts/Scene Loading/LoadingManager.cs b/Assets/Scripts/Scene Loading/LoadingManager.cs index 824e30275..3cd214d44 100644 --- a/Assets/Scripts/Scene Loading/LoadingManager.cs +++ b/Assets/Scripts/Scene Loading/LoadingManager.cs @@ -179,7 +179,25 @@ public async UniTask ReloadData(string sceneToLoad, int worldIndex, int dungeonI Debug.Log("Game Manager not online yet."); return; } + + ReloadDataAndCheckConsistency(); + + slider.value = 0.85f; + progressText.text = "85%"; + loadingText.text = "SETTING UP PLAYER..."; + + GameObject.FindGameObjectWithTag("Player").transform.position = playerPosition; + slider.value = 1; + progressText.text = "100%"; + loadingText.text = "DONE..."; + + await SceneManager.UnloadSceneAsync("LoadingScreen"); + } + + public async void ReloadDataAndCheckConsistency() { + + Debug.Log("Start getting old unlocked areas"); AreaLocationDTO[] unlockedAreasOld = DataManager.Instance.GetPlayerData().unlockedAreas; Debug.Log("Start fetching data"); @@ -191,37 +209,42 @@ public async UniTask ReloadData(string sceneToLoad, int worldIndex, int dungeonI Debug.Log("Validate data"); if (loadingSuccesful) { + + Debug.Log("Load offline mode"); await SceneManager.LoadSceneAsync("OfflineMode", LoadSceneMode.Additive); + Debug.Log("Loaded offline mode"); return; } - slider.value = 0.5f; - progressText.text = "50%"; - loadingText.text = "PROCESSING DATA..."; + if (slider != null) { + Debug.Log("set slider value"); + slider.value = 0.5f; + } + if (progressText != null) { + Debug.Log("set progress text"); + progressText.text = "50%"; + } + if (loadingText != null) { + Debug.Log("set loading text"); + loadingText.text = "PROCESSING DATA..."; + } + Debug.Log("start setting data"); GameManager.Instance.SetData(worldIndex, dungeonIndex); + Debug.Log("collect new unlocked areas"); AreaLocationDTO[] unlockedAreasNew = DataManager.Instance.GetPlayerData().unlockedAreas; + Debug.Log("setup progressbar"); SetupProgessBar(unlockedAreasNew); + Debug.Log("check for new unlocked areas"); string infoText = CheckForNewUnlockedArea(unlockedAreasOld, unlockedAreasNew); if (infoText != "") { + Debug.Log("new areas have been unlocked"); await SceneManager.LoadSceneAsync("InfoScreen", LoadSceneMode.Additive); string headerText = ""; InfoManager.Instance.DisplayInfo(headerText, infoText); } - - slider.value = 0.85f; - progressText.text = "85%"; - loadingText.text = "SETTING UP PLAYER..."; - - GameObject.FindGameObjectWithTag("Player").transform.position = playerPosition; - - slider.value = 1; - progressText.text = "100%"; - loadingText.text = "DONE..."; - - await SceneManager.UnloadSceneAsync("LoadingScreen"); } /// @@ -382,4 +405,4 @@ public async void UnloadUnneededScenesExcept(string openScene) } #endregion -} \ No newline at end of file +} diff --git a/Packages/manifest.json b/Packages/manifest.json index 9385f3940..98ef7d148 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -13,6 +13,7 @@ "com.unity.test-framework": "1.1.31", "com.unity.textmeshpro": "3.0.6", "com.unity.timeline": "1.6.4", + "com.unity.toolchain.linux-x86_64": "2.0.5", "com.unity.ugui": "1.0.0", "com.unity.visualscripting": "1.7.6", "com.unity.xr.legacyinputhelpers": "2.1.9", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 68e176a08..5088ad792 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -206,6 +206,22 @@ }, "url": "https://packages.unity.com" }, + "com.unity.sysroot": { + "version": "2.0.6", + "depth": 1, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.com" + }, + "com.unity.sysroot.linux-x86_64": { + "version": "2.0.5", + "depth": 1, + "source": "registry", + "dependencies": { + "com.unity.sysroot": "2.0.6" + }, + "url": "https://packages.unity.com" + }, "com.unity.test-framework": { "version": "1.1.31", "depth": 0, @@ -238,6 +254,16 @@ }, "url": "https://packages.unity.com" }, + "com.unity.toolchain.linux-x86_64": { + "version": "2.0.5", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.sysroot": "2.0.6", + "com.unity.sysroot.linux-x86_64": "2.0.5" + }, + "url": "https://packages.unity.com" + }, "com.unity.ugui": { "version": "1.0.0", "depth": 0, diff --git a/docker-compose-dev.yaml b/docker-compose-dev.yaml index 2fa82f12a..3d46c97dc 100644 --- a/docker-compose-dev.yaml +++ b/docker-compose-dev.yaml @@ -126,7 +126,7 @@ services: overworld: container_name: overworld - image: ghcr.io/gamify-it/overworld:main + image: ghcr.io/gamify-it/overworld:bugfix-do-not-reload-after-minigame restart: always pull_policy: always volumes: