Skip to content

Commit

Permalink
Merge pull request #173 from finol-digital/develop
Browse files Browse the repository at this point in the history
Bug Fix
  • Loading branch information
davidmfinol authored Jan 23, 2025
2 parents 0c49d7a + a3ba04b commit 068a56a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 37 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ jobs:
permissions:
checks: write
contents: write
outputs:
isPr: ${{ steps.PR.outputs.pr_found }}
steps:
- name: Pre-pull Unity Docker image
run: |
Expand Down Expand Up @@ -88,6 +90,10 @@ jobs:
branch: main
file_pattern: fastlane/metadata
commit_message: Update Release Notes (MINOR)
- uses: 8BitJonny/[email protected]
id: PR
with:
sha: ${{ github.event.pull_request.head.sha }}

lint:
name: Quality Check
Expand Down Expand Up @@ -216,7 +222,7 @@ jobs:
androidTargetSdkVersion: AndroidApiLevel34
- name: Upload Build
uses: actions/upload-artifact@v4
if: github.event_name == 'pull_request' || github.event.action == 'published' || contains(github.event.inputs.workflow_mode, matrix.targetPlatform) || (contains(github.event.inputs.workflow_mode, 'Steam') && matrix.targetPlatform == 'StandaloneLinux64')
if: needs.tests.outputs.isPr == 'true' || github.event.action == 'published' || contains(github.event.inputs.workflow_mode, matrix.targetPlatform) || (contains(github.event.inputs.workflow_mode, 'Steam') && matrix.targetPlatform == 'StandaloneLinux64')
with:
path: build/${{ matrix.targetPlatform }}
name: cgs-${{ matrix.targetPlatform }}
Expand Down Expand Up @@ -374,8 +380,8 @@ jobs:
deployToGooglePlayTest:
name: Deploy to the Google Play Store Test
runs-on: ubuntu-latest
needs: buildWithLinux
if: github.event_name == 'pull_request'
needs: [tests, buildWithLinux]
if: needs.tests.outputs.isPr == 'true'
steps:
- name: Checkout Repository
uses: actions/checkout@v4
Expand Down
29 changes: 7 additions & 22 deletions Assets/Scripts/Cgs/CardGameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ public class CardGameManager : MonoBehaviour
// Show all Debug.Log() to help with debugging?
private const bool IsMessengerDebugLogVerbose = false;
public const string PlayerPrefsDefaultGame = "DefaultGame";
public const string DefaultNameWarning = "Found game with default name. Deleting it.";
public const string SelectionErrorMessage = "Could not select the card game because it is not recognized!: ";
public const string DownloadErrorMessage = "Error downloading game!: ";
public const string LoadErrorMessage = "Error loading game!: ";
public const string LoadErrorDeletePrompt = "Error loading game! Delete?: ";

public const string FileNotFoundErrorMessage = "ERROR: File Not Found at {0}";
public const string OverwriteGamePrompt = "Game already exists. Overwrite?";
Expand Down Expand Up @@ -208,28 +208,13 @@ internal void LookupCardGames()
foreach (var gameDirectory in Directory.GetDirectories(UnityCardGame.GamesDirectoryPath))
{
var gameDirectoryName = gameDirectory[(UnityCardGame.GamesDirectoryPath.Length + 1)..];
var (gameName, _) = CardGame.GetNameAndHost(gameDirectoryName);
if (gameName.Equals(CardGame.DefaultName))
{
Debug.LogWarning(DefaultNameWarning);
try
{
Directory.Delete(gameDirectory, true);
}
catch (Exception ex)
{
Debug.LogError(DeleteErrorMessage + ex.Message);
}
}
var newCardGame = new UnityCardGame(this, gameDirectoryName);
newCardGame.ReadProperties();
if (!string.IsNullOrEmpty(newCardGame.Error))
Messenger.Ask(LoadErrorDeletePrompt + gameDirectoryName, () => { },
() => { Directory.Delete(gameDirectory, true); });
else
{
var newCardGame = new UnityCardGame(this, gameDirectoryName);
newCardGame.ReadProperties();
if (!string.IsNullOrEmpty(newCardGame.Error))
Debug.LogError(LoadErrorMessage + newCardGame.Error);
else
AllCardGames[newCardGame.Id] = newCardGame;
}
AllCardGames[newCardGame.Id] = newCardGame;
}
}

Expand Down
16 changes: 6 additions & 10 deletions Assets/Scripts/FinolDigital.Cgs.Json.Unity/UnityCardGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,26 +174,22 @@ public void ReadProperties()
{
try
{
// We need to read the cgs.json file, but reading it can cause *Game:Name/ID* to change, so account for that
// We need to read the cgs.json file, but reading it can cause *Game:ID* to change, so account for that
var gameDirectoryPath = GameDirectoryPath;
var gameFilePath = GameFilePath;
if (!File.Exists(gameFilePath))
gameFilePath = GameBackupFilePath;
var gameDirectoryPath = GameDirectoryPath;

ClearDefinitionLists();
JsonConvert.PopulateObject(File.ReadAllText(gameFilePath), this);
RefreshId();
if (!gameFilePath.Equals(GameFilePath) && File.Exists(gameFilePath))
{
var newGameFilePath =
Path.Combine(gameDirectoryPath,
UnityFileMethods.GetSafeFileName(Name) + UnityFileMethods.JsonExtension);
File.Copy(gameFilePath, newGameFilePath, true);
}

if (!gameDirectoryPath.Equals(GameDirectoryPath) && Directory.Exists(gameDirectoryPath))
if (!gameDirectoryPath.Equals(GameDirectoryPath) && Directory.Exists(gameDirectoryPath) && !Directory.Exists(GameDirectoryPath))
Directory.Move(gameDirectoryPath, GameDirectoryPath);

if (!gameFilePath.Equals(GameFilePath) && File.Exists(gameFilePath) && !File.Exists(GameFilePath))
File.Copy(gameFilePath, GameFilePath, true);

// We're being greedy about loading these now, since these could be shown before the game is selected
if (File.Exists(BannerImageFilePath))
BannerImageSprite = UnityFileMethods.CreateSprite(BannerImageFilePath);
Expand Down
8 changes: 6 additions & 2 deletions docs/pages/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ permalink: roadmap.html

# Roadmap

## What's New - v1.127
Game-Deleting Bug-Fix!
## What's New - v1.128
Bug Fix

## Sprint - Priority 1
- Bug-Fix: If a player that isn't host in a multiplayer room draws cards too quickly it can bug out and some of the cards vanish without showing in hand
- Bugs: [https://github.com/finol-digital/Card-Game-Simulator/issues](https://github.com/finol-digital/Card-Game-Simulator/issues)
- Have a set starting hand consisting of specific cards
- Be able to change what Deck the "Draw" button is bound to (player specific)
- Load specific decks when the game is created in multiplayer mode, right now it only works for singleplayer
- Allow mobile users to either lock rotation or move around the playmat with 1 finger
- Deck Editor: Options for Deck File Format
- Integration: Associate native app with cgs.gg
- Platforms: Multi-player and Developer Mode on Web
Expand Down

0 comments on commit 068a56a

Please sign in to comment.