Skip to content

Commit

Permalink
Download links
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmfinol committed Oct 18, 2023
1 parent a3da801 commit 2201155
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 61 deletions.
33 changes: 8 additions & 25 deletions Assets/Scripts/Cgs/CardGameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,9 @@ private void Awake()
UnityCardGame.UnityInvalid.CoroutineRunner = this;
DontDestroyOnLoad(gameObject);

#if !UNITY_WEBGL
if (!Directory.Exists(UnityCardGame.GamesDirectoryPath))
CreateDefaultCardGames();
LookupCardGames();
#endif

if (Debug.isDebugBuild)
Application.logMessageReceived += ShowLogToUser;
Expand All @@ -186,15 +184,12 @@ private void Awake()

ResetCurrentToDefault();

Debug.Log("CardGameManager is Awake!");
}

private void Start()
{
#if !UNITY_WEBGL
Debug.Log("CardGameManager::Start:CheckDeepLinks");
Debug.Log("CardGameManager::Awake:CheckDeepLinks");
CheckDeepLinks();
#endif

Debug.Log("CardGameManager is Awake!");
}

// ReSharper disable once MemberCanBeMadeStatic.Local
Expand All @@ -203,7 +198,9 @@ private void CreateDefaultCardGames()
#if UNITY_ANDROID && !UNITY_EDITOR
UnityFileMethods.ExtractAndroidStreamingAssets(UnityCardGame.GamesDirectoryPath);
#else
UnityFileMethods.CopyDirectory(Application.streamingAssetsPath, UnityCardGame.GamesDirectoryPath);
UnityFileMethods.CopyDirectory(
Application.streamingAssetsPath + Tags.StandardPlayingCardsDirectoryName,
UnityCardGame.GamesDirectoryPath + Tags.StandardPlayingCardsDirectoryName);
#endif
}

Expand Down Expand Up @@ -384,23 +381,9 @@ private static string GetAutoUpdateUrl(string deepLink)
return null;
}

if (deepLink.StartsWith(Tags.DynamicLinkUriDomain))
{
var dynamicLinkUri = new Uri(deepLink);
deepLink = HttpUtility.UrlDecode(HttpUtility.ParseQueryString(dynamicLinkUri.Query).Get("link"));
Debug.Log("GetAutoUpdateUrl::dynamicLink: " + deepLink);
if (string.IsNullOrEmpty(deepLink) || !Uri.IsWellFormedUriString(deepLink, UriKind.RelativeOrAbsolute))
{
Debug.LogWarning("GetAutoUpdateUrl::dynamicLinkMalformed: " + deepLink);
return null;
}
}

var deepLinkDecoded = HttpUtility.UrlDecode(deepLink);
Debug.Log("GetAutoUpdateUrl::deepLinkDecoded: " + deepLinkDecoded);
var deepLinkUriQuery = new Uri(deepLinkDecoded).Query;
var deepLinkUriQuery = new Uri(deepLink).Query;
Debug.Log("GetAutoUpdateUrl::deepLinkUriQuery: " + deepLinkUriQuery);
var autoUpdateUrl = HttpUtility.ParseQueryString(deepLinkUriQuery).Get("url");
var autoUpdateUrl = HttpUtility.UrlDecode(HttpUtility.ParseQueryString(deepLinkUriQuery).Get("url"));
Debug.Log("GetAutoUpdateUrl::autoUpdateUrl: " + autoUpdateUrl);

return autoUpdateUrl;
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Cgs/Menu/DownloadMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private IEnumerator Download()
[UsedImplicitly]
public void GoToGamesList()
{
Application.OpenURL(Tags.GameListUrl);
Application.OpenURL(Tags.CgsGamesListUrl);
}
}
}
33 changes: 1 addition & 32 deletions Assets/Scripts/Cgs/Tags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,8 @@ public static class Tags
public const string CardViewer = "CardViewer";
public const string PlayableViewer = "PlayableViewer";

public const string GameListUrl = "https://www.reddit.com/r/CardGameSimulator/comments/fl1p5z/official_games_list/";
public const string DynamicLinkUriDomain = "https://cgs.link";
public const string CgsWebsite = "https://www.cardgamesimulator.com/";

public const string StandardPlayingCardsDirectoryName = "Standard Playing [email protected]";

#if UNITY_WEBGL
public const string StandardPlayingCardsJsonFileName = "Standard Playing Cards.json";

public const string StandPlayingCardsJsonFileContent =
"{\"name\":\"Standard Playing Cards\",\"autoUpdateUrl\":\"https://www.cardgamesimulator.com/games/Standard/Standard.json\"}";

public const string DominoesDirectoryName = "[email protected]";
public const string DominoesJsonFileName = "Dominoes.json";

public const string DominoesJsonFileContent =
"{\"name\":\"Dominoes\",\"autoUpdateUrl\":\"https://www.cardgamesimulator.com/games/Dominoes/Dominoes.json\"}";

public const string DominoesCardBackUrl = "https://www.cardgamesimulator.com/games/Dominoes/CardBack.png";
public const string MahjongDirectoryName = "[email protected]";
public const string MahjongJsonFileName = "Mahjong.json";

public const string MahjongJsonFileContent =
"{\"name\":\"Mahjong\",\"autoUpdateUrl\":\"https://www.cardgamesimulator.com/games/Mahjong/Mahjong.json\"}";

public const string MahjongCardBackUrl = "https://www.cardgamesimulator.com/games/Mahjong/CardBack.png";
public const string ArcmageDirectoryName = "[email protected]";
public const string ArcmageJsonFileName = "Arcmage.json";

public const string ArcmageJsonFileContent =
"{\"name\":\"Arcmage\",\"autoUpdateUrl\":\"https://www.cardgamesimulator.com/games/Arcmage/Arcmage.json\"}";

public const string ArcmageCardBackUrl = "https://www.cardgamesimulator.com/games/Arcmage/CardBack.png";
#endif
public const string CgsGamesListUrl = "https://cgs.games/link";
}
}
6 changes: 3 additions & 3 deletions ProjectSettings/ProjectSettings.asset

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2201155

Please sign in to comment.