Skip to content

Commit

Permalink
Rename to FinolDigital.Cgs.Json and cgs.json
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmfinol committed Jan 22, 2025
1 parent 3870809 commit 9993227
Show file tree
Hide file tree
Showing 31 changed files with 73 additions and 74 deletions.
38 changes: 19 additions & 19 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,41 +36,41 @@ jobs:
dotnet-version: 6.0.x
- name: Build
run: dotnet build --configuration Release /p:Version=${VERSION}
- name: Upload FinolDigital.Cgs.CardGameDef.dll
- name: Upload FinolDigital.Cgs.Json.dll
uses: actions/upload-artifact@v4
with:
name: FinolDigital.Cgs.CardGameDef.dll
path: FinolDigital.Cgs.CardGameDef/bin/Release/netstandard2.1/FinolDigital.Cgs.CardGameDef.dll
name: FinolDigital.Cgs.Json.dll
path: FinolDigital.Cgs.Json/bin/Release/netstandard2.1/FinolDigital.Cgs.Json.dll
- name: Generate schema
run: dotnet SchemaGeneration/bin/Release/net6.0/SchemaGeneration.dll
- name: Copy schema
run: cp CardGameDef.json schema/
- name: Upload CardGameDef.json
run: cp cgs.json schema/
- name: Upload cgs.json
uses: actions/upload-artifact@v4
with:
name: CardGameDef.json
path: CardGameDef.json
name: cgs.json
path: cgs.json
- name: Pack
run: dotnet pack --configuration Release /p:Version=${VERSION}
- name: Upload nuget package
uses: actions/upload-artifact@v4
with:
name: FinolDigital.Cgs.CardGameDef.${{ steps.versioning.outputs.version }}.nupkg
path: FinolDigital.Cgs.CardGameDef/bin/Release/FinolDigital.Cgs.CardGameDef.${{ steps.versioning.outputs.version }}.nupkg
name: FinolDigital.Cgs.Json.${{ steps.versioning.outputs.version }}.nupkg
path: FinolDigital.Cgs.Json/bin/Release/FinolDigital.Cgs.Json.${{ steps.versioning.outputs.version }}.nupkg
- name: Update nuget settings
if: github.event.action == 'published'
run: dotnet nuget add source --username [email protected] --password ${{ secrets.CGS_PAT }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/finol-digital/index.json"
- name: Push nuget package
if: github.event.action == 'published'
run: dotnet nuget push "FinolDigital.Cgs.CardGameDef/bin/Release/FinolDigital.Cgs.CardGameDef.${VERSION}.nupkg" --source "github"
run: dotnet nuget push "FinolDigital.Cgs.Json/bin/Release/FinolDigital.Cgs.Json.${VERSION}.nupkg" --source "github"
- name: Raise PR for schema
if: github.event.action == 'published'
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.CGS_PAT }}
path: schema
branch: cardgamedef-${{ needs.build.outputs.version }}
title: CardGameDef ${{ needs.build.outputs.version }}
branch: cgsjson-${{ needs.build.outputs.version }}
title: Cgs.json ${{ needs.build.outputs.version }}

updateCgs:
name: Update CGS
Expand All @@ -81,28 +81,28 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4
with:
path: FinolDigital.Cgs.CardGameDef
path: FinolDigital.Cgs.Json
- name: Checkout CGS project
uses: actions/checkout@v4
with:
repository: finol-digital/Card-Game-Simulator
token: ${{ secrets.CGS_PAT }}
path: Card-Game-Simulator
lfs: true
- name: Download FinolDigital.Cgs.CardGameDef.dll
- name: Download FinolDigital.Cgs.Json.dll
uses: actions/download-artifact@v4
with:
name: FinolDigital.Cgs.CardGameDef.dll
name: FinolDigital.Cgs.Json.dll
path: Card-Game-Simulator/Assets/Plugins
- name: Download CardGameDef.json
- name: Download cgs.json
uses: actions/download-artifact@v4
with:
name: CardGameDef.json
name: cgs.json
path: Card-Game-Simulator/docs/schema
- name: Raise PR to Card-Game-Simulator
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.CGS_PAT }}
path: Card-Game-Simulator
branch: cardgamedef-${{ needs.build.outputs.version }}
title: CardGameDef ${{ needs.build.outputs.version }}
branch: cgsjson-${{ needs.build.outputs.version }}
title: Cgs.json ${{ needs.build.outputs.version }}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33424.131
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FinolDigital.Cgs.CardGameDef", "FinolDigital.Cgs.CardGameDef\FinolDigital.Cgs.CardGameDef.csproj", "{97F6023F-DC26-47C9-A047-82D0EDBD04BC}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FinolDigital.Cgs.Json", "FinolDigital.Cgs.Json\FinolDigital.Cgs.Json.csproj", "{97F6023F-DC26-47C9-A047-82D0EDBD04BC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchemaGeneration", "SchemaGeneration\SchemaGeneration.csproj", "{EE6FC5DC-D94D-4FF3-B705-CF44772E22B7}"
EndProject
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FinolDigital.Cgs.CardGameDef
namespace FinolDigital.Cgs.Json
{
using System;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FinolDigital.Cgs.CardGameDef
namespace FinolDigital.Cgs.Json
{
using System.Runtime.Serialization;
using Newtonsoft.Json;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FinolDigital.Cgs.CardGameDef
namespace FinolDigital.Cgs.Json
{
using System;
using System.ComponentModel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FinolDigital.Cgs.CardGameDef
namespace FinolDigital.Cgs.Json
{
using System;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FinolDigital.Cgs.CardGameDef
namespace FinolDigital.Cgs.Json
{
using System;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
namespace FinolDigital.Cgs.CardGameDef
namespace FinolDigital.Cgs.Json
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using Cgs.CardGameDef.Decks;
using Cgs.Json.Decks;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FinolDigital.Cgs.CardGameDef
namespace FinolDigital.Cgs.Json
{
using Newtonsoft.Json;
using System.ComponentModel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FinolDigital.Cgs.CardGameDef
namespace FinolDigital.Cgs.Json
{
using System;
using System.ComponentModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

namespace FinolDigital.Cgs.CardGameDef.Decks
namespace FinolDigital.Cgs.Json.Decks
{
using System;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// https://github.com/RiotGames/LoRDeckCodes/blob/main/LoRDeckCodes/CardCodeAndCount.cs

namespace FinolDigital.Cgs.CardGameDef.Decks
namespace FinolDigital.Cgs.Json.Decks
{
public class CardCodeAndCount
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// https://github.com/RiotGames/LoRDeckCodes/blob/main/LoRDeckCodes/LoRDeckEncoder.cs

namespace FinolDigital.Cgs.CardGameDef.Decks
namespace FinolDigital.Cgs.Json.Decks
{
using System;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
THE POSSIBILITY OF SUCH DAMAGE.
*/

namespace FinolDigital.Cgs.CardGameDef.Decks
namespace FinolDigital.Cgs.Json.Decks
{
using System;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FinolDigital.Cgs.CardGameDef
namespace FinolDigital.Cgs.Json
{
using System;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FinolDigital.Cgs.CardGameDef
namespace FinolDigital.Cgs.Json
{
using System.ComponentModel;
using Newtonsoft.Json;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FinolDigital.Cgs.CardGameDef
namespace FinolDigital.Cgs.Json
{
using Newtonsoft.Json.Converters;
using Newtonsoft.Json;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
<Company>Finol Digital LLC</Company>
<Authors>David Finol</Authors>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Description>Card Game Simulator (CGS) custom card game specification</Description>
<PackageProjectUrl>https://www.cardgamesimulator.com/custom.html</PackageProjectUrl>
<Description>Card Game Simulator (CGS) Card Game Specification</Description>
<PackageProjectUrl>https://github.com/finol-digital/FinolDigital.Cgs.Json</PackageProjectUrl>
<PackageIcon>Logo.png</PackageIcon>
<PackageIconUrl />
<PackageTags>card game simulator json schema</PackageTags>
<PackageReleaseNotes>Card Game Simulator (CGS) custom card game specification</PackageReleaseNotes>
<PackageTags>card game simulator json schema specification</PackageTags>
<PackageReleaseNotes>Card Game Simulator (CGS) Card Game Specification</PackageReleaseNotes>
<RepositoryUrl>https://github.com/finol-digital/FinolDigital.Cgs.CardGameDef</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Title>CGS Custom Card Game</Title>
<Title>CGS Card Game Specification</Title>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Copyright>Copyright (c) Finol Digital LLC 2023</Copyright>
<Copyright>Copyright (c) Finol Digital LLC</Copyright>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FinolDigital.Cgs.CardGameDef
namespace FinolDigital.Cgs.Json
{
using Newtonsoft.Json;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FinolDigital.Cgs.CardGameDef
namespace FinolDigital.Cgs.Json
{
using System.ComponentModel;
using Newtonsoft.Json;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FinolDigital.Cgs.CardGameDef
namespace FinolDigital.Cgs.Json
{
using System.Collections.Generic;
using System.ComponentModel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FinolDigital.Cgs.CardGameDef
namespace FinolDigital.Cgs.Json
{
using System;
using System.ComponentModel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FinolDigital.Cgs.CardGameDef
namespace FinolDigital.Cgs.Json
{
using Newtonsoft.Json;
using System.ComponentModel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FinolDigital.Cgs.CardGameDef
namespace FinolDigital.Cgs.Json
{
using Newtonsoft.Json.Converters;
using Newtonsoft.Json;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FinolDigital.Cgs.CardGameDef
namespace FinolDigital.Cgs.Json
{
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FinolDigital.Cgs.CardGameDef
namespace FinolDigital.Cgs.Json
{
using System;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FinolDigital.Cgs.CardGameDef
namespace FinolDigital.Cgs.Json
{
using System.Runtime.Serialization;
using Newtonsoft.Json;
Expand Down
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Card Game Simulator - Custom Card Game
# Card Game Simulator - Card Game Specification

## The Specification
A custom card game in CGS follows the `FinolDigital.Cgs.CardGameDef` specification.
[Card Game Simulator](https://www.cardgamesimulator.com) (CGS) follows this `FinolDigital.Cgs.Json` specification.
This specification primarily includes information on sets of cards and a definition of what properties those cards have.
Ancillary information can include decks and boards to use with the game.
See below for the full specification.

## CGS games directory
Custom games are created with a new folder within the persistent games data directory.
Games are created with a new folder within the persistent games data directory.
The location of this persistent data directory varies depending on platform.
Some examples include:
- Android: /Data/Data/com.finoldigital.cardgamesim/files/games/
Expand All @@ -18,7 +18,7 @@ Some examples include:
## Custom game folder structure
The structure of this custom game folder is:
- *Game:Id*/
- *Game:Name*.json
- cgs.json
- AllCards.json
- AllDecks.json
- AllSets.json
Expand All @@ -40,15 +40,16 @@ The structure of this custom game folder is:
* ...

## JSON File Structure
The GGS AutoUpdate Url that is used to download a card game is actually a pointer to the *Game:Name*.json file.
CGS generates the rest of the folder structure based off that *CardGameDef.json* file.
The GGS AutoUpdate Url that is used to download a card game is actually a pointer to the `cgs.json` file.
CGS generates the rest of the folder structure based off that file.

You can create your own json and [validate](https://www.jsonschemavalidator.net/) against these schema:
- [CardGameDef](https://github.com/finol-digital/FinolDigital.Cgs.CardGameDef/blob/main/schema/CardGameDef.json)
- [AllCards](https://github.com/finol-digital/FinolDigital.Cgs.CardGameDef/blob/main/schema/AllCards.json)
- [AllDecks](https://github.com/finol-digital/FinolDigital.Cgs.CardGameDef/blob/main/schema/AllDecks.json)
- [AllSets](https://github.com/finol-digital/FinolDigital.Cgs.CardGameDef/blob/main/schema/AllSets.json)
- [cgs.json](https://github.com/finol-digital/FinolDigital.Cgs.CardGameDef/blob/main/schema/CardGameDef.json)
- [AllCards.json](https://github.com/finol-digital/FinolDigital.Cgs.CardGameDef/blob/main/schema/AllCards.json)
- [AllDecks.json](https://github.com/finol-digital/FinolDigital.Cgs.CardGameDef/blob/main/schema/AllDecks.json)
- [AllSets.json](https://github.com/finol-digital/FinolDigital.Cgs.CardGameDef/blob/main/schema/AllSets.json)

## Examples
The default examples can be found in the [CGS GitHub Repository](https://github.com/finol-digital/Card-Game-Simulator/tree/develop/docs/games).

Further examples can be found in the [CGS Google Drive folder](https://drive.google.com/open?id=1kVms-_CXRw1e4Ob18fRkS84MN_cxQGF5).
16 changes: 7 additions & 9 deletions SchemaGeneration/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// See https://aka.ms/new-console-template for more information

/*
using FinolDigital.Cgs.CardGameDef;
using FinolDigital.Cgs.Json;
using Json.Schema;
using Json.Schema.Generation;
using System.Text.Json;
Expand All @@ -11,17 +11,16 @@
string jsonSchemaString = JsonSerializer.Serialize(jsonSchema, new JsonSerializerOptions { ReferenceHandler = ReferenceHandler.IgnoreCycles });
File.WriteAllText(SchemaFilePath, jsonSchemaString);*/

using FinolDigital.Cgs.CardGameDef;
using FinolDigital.Cgs.Json;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using NJsonSchema;
using NJsonSchema.Generation;

string SchemaFilePath = "CardGameDef.json";
string SchemaVersion = "https://json-schema.org/draft/2019-09/schema";
string SchemaId = "https://cardgamesim.finoldigital.com/schema/CardGameDef.json";
string SchemaTitle = "CGS Custom Card Game";
string SchemaDescription = "Card Game Simulator (CGS) custom card game specification";
string SchemaFileName = "cgs.json";
string SchemaId = "https://cardgamesim.finoldigital.com/schema/cgs.json";
string SchemaTitle = "CGS Card Game Specification";
string SchemaDescription = "Card Game Simulator (CGS) Card Game Specification";

var settings = new JsonSchemaGeneratorSettings
{
Expand All @@ -33,10 +32,9 @@
}
};
var jsonSchema = JsonSchema.FromType<CardGame>(settings);
jsonSchema.SchemaVersion = SchemaVersion; // this unfortunately doesn't work, and manual edits are required to change from v4 to v2019
jsonSchema.Id = SchemaId;
jsonSchema.Title = SchemaTitle;
jsonSchema.Description = SchemaDescription;
// HACK: cardImageUrl uses a custom implementation of uri-template to allow for more versatility
jsonSchema.Properties["cardImageUrl"].Format = "uri-template";
File.WriteAllText(SchemaFilePath, jsonSchema.ToJson());
File.WriteAllText(SchemaFileName, jsonSchema.ToJson());
2 changes: 1 addition & 1 deletion SchemaGeneration/SchemaGeneration.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\FinolDigital.Cgs.CardGameDef\FinolDigital.Cgs.CardGameDef.csproj" />
<ProjectReference Include="..\FinolDigital.Cgs.Json\FinolDigital.Cgs.Json.csproj" />
</ItemGroup>

</Project>
Loading

0 comments on commit 9993227

Please sign in to comment.