Skip to content

Commit

Permalink
Fix WebGL
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmfinol committed Nov 4, 2024
1 parent e9dff59 commit b474287
Show file tree
Hide file tree
Showing 177 changed files with 9 additions and 1,716 deletions.
9 changes: 2 additions & 7 deletions Assets/Scripts/Cgs/CardGameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ internal void LookupCardGames()
#else
CreateDefaultCardGames();
#endif

foreach (var gameDirectory in Directory.GetDirectories(UnityCardGame.GamesDirectoryPath))
{
var gameDirectoryName = gameDirectory[(UnityCardGame.GamesDirectoryPath.Length + 1)..];
Expand All @@ -228,6 +227,7 @@ internal void LookupCardGames()
{
var newCardGame = new UnityCardGame(this, gameDirectoryName);
newCardGame.ReadProperties();
Debug.LogWarning(newCardGame.ToString());
if (!string.IsNullOrEmpty(newCardGame.Error))
Debug.LogError(LoadErrorMessage + newCardGame.Error);
else
Expand Down Expand Up @@ -405,7 +405,7 @@ private IEnumerator Start()
yield return null;

bool isMissingGame =
Current == null || Current == UnityCardGame.UnityInvalid || !string.IsNullOrEmpty(Current.Error);
Current == null || Current == UnityCardGame.UnityInvalid || !string.IsNullOrEmpty(Current.Error) || !Curent.HasLoaded;
if (isMissingGame)
yield return StartGetDefaultCardGames();
}
Expand Down Expand Up @@ -606,11 +606,6 @@ internal void ResetGameScene()
return;
}

#if UNITY_WEBGL
foreach (var game in AllCardGames.Values)
game.ReadProperties();
#endif

// Now is the safest time to set this game as the preferred default game for the player
PlayerPrefs.SetString(PlayerPrefsDefaultGame, Current.Id);

Expand Down
6 changes: 6 additions & 0 deletions Assets/Scripts/Cgs/Menu/MainMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ private static bool HasSeenWelcome
public Image nextCardImage;
public List<GameObject> selectableButtons;

public Button joinButton;
public GameObject quitButton;

private GamesManagementMenu GamesManagement =>
Expand Down Expand Up @@ -115,6 +116,9 @@ private void Start()
ResizeFooter();
versionText.text = TitleScreen.VersionMessage;

#if UNITY_WEBGL
joinButton.interactable = false;
#endif
#if UNITY_STANDALONE || UNITY_WSA
quitButton.SetActive(true);
#else
Expand Down Expand Up @@ -250,10 +254,12 @@ public void StartGame()
[UsedImplicitly]
public void JoinGame()
{
#if !UNITY_WEBGL
if (Time.timeSinceLevelLoad < StartBufferTime)
return;
CardGameManager.Instance.IsSearchingForServer = true;
SceneManager.LoadScene(PlayModeSceneIndex);
#endif
}

[UsedImplicitly]
Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ playYoutubeId: PriDuaM6MEk
- iOS via [the App Store](https://apps.apple.com/us/app/card-game-simulator/id1392877362?ls=1)
- Android via [Google Play](https://play.google.com/store/apps/details?id=com.finoldigital.cardgamesim)
- Linux via [Steam](https://store.steampowered.com/app/1742850/Card_Game_Simulator/)
- Web via [cgs.gg](https://cgs.gg)

## How to Play

Expand Down
Loading

0 comments on commit b474287

Please sign in to comment.