Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nginx/webgl.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions Assets/Plugins/LoadMinigame.jslib
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
})
}
Expand Down
30 changes: 21 additions & 9 deletions Assets/Scripts/GameManager/DataManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 +
Expand Down Expand Up @@ -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 +
Expand All @@ -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 +
Expand Down Expand Up @@ -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.";
Expand All @@ -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 + "-" +
Expand Down Expand Up @@ -1036,4 +1048,4 @@ private int getActiveMinigameCount(int worldIndex, int dungeonIndex)

return activeMinigameCount;
}
}
}
4 changes: 2 additions & 2 deletions Assets/Scripts/GameManager/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ private string BuildSceneName()
public void MinigameDone()
{
Debug.Log("Start minigame respawn at: " + minigameRespawnPosition.x + ", " + minigameRespawnPosition.y);
Reload();
LoadingManager.Instance.ReloadDataAndCheckConsistency();
}

/// <summary>
Expand Down Expand Up @@ -587,4 +587,4 @@ private AchievementStatistic[] GetDummyAchievements()
statistcs[1] = achievementStatistic2;
return statistcs;
}
}
}
55 changes: 39 additions & 16 deletions Assets/Scripts/Scene Loading/LoadingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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");
}

/// <summary>
Expand Down Expand Up @@ -382,4 +405,4 @@ public async void UnloadUnneededScenesExcept(string openScene)
}

#endregion
}
}
1 change: 1 addition & 0 deletions Packages/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
26 changes: 26 additions & 0 deletions Packages/packages-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion docker-compose-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down