Skip to content

Commit

Permalink
Apply edit
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmfinol committed May 9, 2024
1 parent 6e31159 commit b5a4f93
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions Assets/Scripts/Cgs/Menu/CardGameEditorMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public class CardGameEditorMenu : Modal
public const string SelectPlayMatImageFilePrompt = "Select PlayMat Image File";
#endif
public const string ImportImageWarningMessage = "No image file selected for import!";
public const string CreateWarningMessage = "A game with that name already exists!";
public const string CreationWarningMessage = "Failed to create the custom card game! ";
public const string CreationCleanupErrorMessage = "Failed to both create and cleanup during creation! ";

Expand Down Expand Up @@ -425,14 +424,24 @@ private IEnumerator CreateGame()
yield break;

var gameName = GameName.Trim().Replace("@", "");
if (CardGameManager.Instance.AllCardGames.ContainsKey(gameName))
{
CardGameManager.Instance.Messenger.Show(CreateWarningMessage);
yield break;
}

var unityCardGame = _game;
if (!_isEdit)
if (_isEdit)
{
unityCardGame.Name = gameName;
unityCardGame.CardSize = new Float2(_width, _height);
unityCardGame.BannerImageFileType = BannerImageFileType == 0 ? "png" : "jpg";
unityCardGame.CardBackImageFileType = CardBackImageFileType == 0 ? "png" : "jpg";
unityCardGame.PlayMatImageFileType = PlayMatImageFileType == 0 ? "png" : "jpg";
unityCardGame.Copyright = string.IsNullOrWhiteSpace(Copyright) ? "" : Copyright;
unityCardGame.RulesUrl =
Uri.IsWellFormedUriString(RulesUrl, UriKind.Absolute) ? new Uri(RulesUrl) : null;
unityCardGame.CardPrimaryProperty = string.IsNullOrWhiteSpace(CardProperty) ? "" : CardProperty;
unityCardGame.CardProperties = string.IsNullOrWhiteSpace(CardProperty)
? new List<PropertyDef>()
: Of(CardProperty);
}
else
{
unityCardGame = new UnityCardGame(CardGameManager.Instance, gameName)
{
Expand Down

0 comments on commit b5a4f93

Please sign in to comment.