1 Commits

Author SHA1 Message Date
ed5d3cd222 feat: json loader (Work In Progress) 2025-02-03 16:56:46 +01:00
311 changed files with 2374 additions and 31124 deletions

View File

@ -7,10 +7,9 @@ charset = utf-8
indent_style = space
end_of_line = lf
[*.asmdef]
indent_size = 4
[*.{json,jsonc,asmdef}]
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
[*.{yml,yaml,sh,puml,md}]
indent_size = 2
@ -28,11 +27,6 @@ indent_style = tab
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
indent_size = 2
[*.{json,jsonc}]
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
[*.builds]
indent_size = 2

View File

@ -2,15 +2,17 @@ name: "ci"
on:
push:
branches: [develop, staging, main]
branches: [develop]
pull_request:
branches: [develop, staging, main]
permissions:
contents: write
pull-requests: write
jobs:
lint-commit:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v4.2.2"
- uses: "wagoid/commitlint-github-action@v6.1.2"
lint-editorconfig-checker:
runs-on: "ubuntu-latest"
steps:
@ -18,82 +20,38 @@ jobs:
- uses: "editorconfig-checker/action-editorconfig-checker@main"
- run: "editorconfig-checker"
build-windows:
# test:
# permissions:
# checks: "write"
# runs-on: "ubuntu-latest"
# steps:
# - uses: "actions/checkout@v4.2.2"
# with:
# lfs: true
# - uses: "actions/cache@v4.2.0"
# with:
# path: "Library"
# key: "Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}"
# restore-keys: |
# "Library-"
# - uses: "game-ci/unity-test-runner@v4.3.1"
# env:
# UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
# UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
# UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
# with:
# githubToken: ${{ secrets.GITHUB_TOKEN }}
build:
runs-on: "ubuntu-latest"
outputs:
build-path: ${{ steps.upload.outputs.path }}
steps:
- uses: "actions/checkout@v4.2.2"
with:
lfs: true
- uses: "actions/cache@v4.2.3"
with:
path: "Library"
key: "Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}"
restore-keys: |
"Library-"
- uses: "game-ci/unity-builder@v4.3.0"
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
targetPlatform: "StandaloneWindows64"
- name: Upload Windows Build Artifact
id: upload
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4.4.3
with:
name: build-windows
path: build/
owerwrite: true
build-macos:
runs-on: "ubuntu-latest"
outputs:
build-path: ${{ steps.upload.outputs.path }}
steps:
- uses: "actions/checkout@v4.2.2"
with:
lfs: true
- uses: "actions/cache@v4.2.3"
with:
path: "Library"
key: "Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}"
restore-keys: |
"Library-"
- uses: "game-ci/unity-builder@v4.3.0"
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
targetPlatform: "StandaloneOSX"
- name: Upload macOS Build Artifact
id: upload
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4.3.0
with:
name: build-macos
path: build/
owerwrite: true
build-linux:
runs-on: "ubuntu-latest"
outputs:
build-path: ${{ steps.upload.outputs.path }}
steps:
- uses: "actions/checkout@v4.2.2"
with:
lfs: true
- uses: "actions/cache@v4.2.3"
- uses: "actions/cache@v4.2.0"
with:
path: "Library"
key: "Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}"
@ -108,66 +66,7 @@ jobs:
with:
targetPlatform: "StandaloneLinux64"
- name: Upload Linux Build Artifact
id: upload
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4.6.2
with:
name: build-linux
path: build/
owerwrite: true
create-release:
needs: [build-windows, build-macos, build-linux]
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Get version from commit message
id: get_version
run: |
COMMIT_MESSAGE="${{ github.event.head_commit.message }}"
# Extract the version number after "chore(release): "
VERSION=$(echo "$COMMIT_MESSAGE" | sed -n 's/^chore(release): \(v[0-9]*\.[0-9]*\.[0-9]*[-a-zA-Z0-9.]*\).*$/\1/p')
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
shell: bash
- name: Download Windows Build Artifact
uses: actions/download-artifact@v4.3.0
with:
name: build-windows
path: build/windows
- name: Download macOS Build Artifact
uses: actions/download-artifact@v4.3.0
with:
name: build-macos
path: build/macos
- name: Download Linux Build Artifact
uses: actions/download-artifact@v4.3.0
with:
name: build-linux
path: build/linux
- name: Zip Builds
run: |
cd build/windows
zip -r ../windows.zip .
cd ../macos
zip -r ../macos.zip .
cd ../linux
zip -r ../linux.zip .
- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v2.2.2
with:
tag_name: ${{ steps.get_version.outputs.version }}
name: ${{ steps.get_version.outputs.version }}
body: |
🎮 Automatic ${{ github.ref == 'refs/heads/main' && 'Production' || 'Pre-release' }} build
prerelease: ${{ github.ref != 'refs/heads/main' }}
files: |
build/windows.zip
build/macos.zip
build/linux.zip
# - uses: "actions/upload-artifact@v4.4.3"
# with:
# name: "Build"
# path: "build"

3
.gitignore vendored
View File

@ -76,6 +76,3 @@ crashlytics-build.properties
# Ignore temporaries from GameCI
/[Aa]rtifacts/
/[Cc]odeCoverage/
# Saves
/[Aa]ssets/[Rr]esources/LevelsStats

View File

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

Before

Width:  |  Height:  |  Size: 1004 KiB

After

Width:  |  Height:  |  Size: 1004 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 1.0 MiB

View File

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

Before

Width:  |  Height:  |  Size: 454 KiB

After

Width:  |  Height:  |  Size: 454 KiB

View File

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

View File

@ -1,10 +1,10 @@
fileFormatVersion: 2
guid: 808dc3764eb4591e3bf63576aae4bc00
guid: eed5a0d2b4493ec4ca90bb1bd7316047
TextureImporter:
internalIDToNameTable:
- first:
213: -4346244404228752641
second: Arrow_0
213: -8811806715494619191
second: ExitButton_0
externalObjects: {}
serializedVersion: 13
mipmaps:
@ -113,13 +113,13 @@ TextureImporter:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: Arrow_0
name: ExitButton_0
rect:
serializedVersion: 2
x: 20
y: 20
width: 185
height: 219
x: 143
y: 123
width: 284
height: 252
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
@ -128,8 +128,8 @@ TextureImporter:
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: ffa7ae2edb90fa3c0800000000000000
internalID: -4346244404228752641
spriteID: 9c7aa8daa7c26b580800000000000000
internalID: -8811806715494619191
vertices: []
indices:
edges: []
@ -148,7 +148,7 @@ TextureImporter:
spriteCustomMetadata:
entries: []
nameFileIdTable:
Arrow_0: -4346244404228752641
ExitButton_0: -8811806715494619191
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -1,10 +1,10 @@
fileFormatVersion: 2
guid: 79b56765ff1452848bd947d19c642244
guid: 4cc2ad05a74922248a49910d3aaa5442
TextureImporter:
internalIDToNameTable:
- first:
213: -6564193165698205349
second: Remove_0
213: 6693083200273925831
second: LevelStatsBtn_0
externalObjects: {}
serializedVersion: 13
mipmaps:
@ -97,7 +97,7 @@ TextureImporter:
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Android
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
@ -113,7 +113,7 @@ TextureImporter:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: Remove_0
name: LevelStatsBtn_0
rect:
serializedVersion: 2
x: 0
@ -128,8 +128,8 @@ TextureImporter:
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: b59f289281d47e4a0800000000000000
internalID: -6564193165698205349
spriteID: 7c6467c85bb92ec50800000000000000
internalID: 6693083200273925831
vertices: []
indices:
edges: []
@ -148,7 +148,7 @@ TextureImporter:
spriteCustomMetadata:
entries: []
nameFileIdTable:
Remove_0: -6564193165698205349
LevelStatsBtn_0: 6693083200273925831
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 KiB

View File

@ -1,10 +1,10 @@
fileFormatVersion: 2
guid: ec309b6331938a340a7154aff62f824a
guid: 7b0f71ceca28c434ca33829e4a13b313
TextureImporter:
internalIDToNameTable:
- first:
213: -6584411455828649921
second: light-speed_0
213: -1958676783162264248
second: PlayButton_0
externalObjects: {}
serializedVersion: 13
mipmaps:
@ -113,13 +113,13 @@ TextureImporter:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: light-speed_0
name: PlayButton_0
rect:
serializedVersion: 2
x: 97
y: 0
width: 344
height: 500
x: 280
y: 180
width: 503
height: 545
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
@ -128,8 +128,8 @@ TextureImporter:
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: f381258aaa87f94a0800000000000000
internalID: -6584411455828649921
spriteID: 845fecdd7d161d4e0800000000000000
internalID: -1958676783162264248
vertices: []
indices:
edges: []
@ -148,7 +148,7 @@ TextureImporter:
spriteCustomMetadata:
entries: []
nameFileIdTable:
light-speed_0: -6584411455828649921
PlayButton_0: -1958676783162264248
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View File

@ -1,10 +1,10 @@
fileFormatVersion: 2
guid: 1b21bd4ccae70934eb86a3a2a6928e98
guid: 2937fecef4993e64cb555077cf09d377
TextureImporter:
internalIDToNameTable:
- first:
213: -4781373940957465942
second: exit_0
213: -1655109142887154325
second: SettingsButton_0
externalObjects: {}
serializedVersion: 13
mipmaps:
@ -113,13 +113,13 @@ TextureImporter:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: exit_0
name: SettingsButton_0
rect:
serializedVersion: 2
x: 31
y: 31
width: 298
height: 298
x: 63
y: 133
width: 233
height: 92
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
@ -128,8 +128,8 @@ TextureImporter:
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: aa2bbe6cbb525adb0800000000000000
internalID: -4781373940957465942
spriteID: b6db5b1f00fd709e0800000000000000
internalID: -1655109142887154325
vertices: []
indices:
edges: []
@ -148,7 +148,7 @@ TextureImporter:
spriteCustomMetadata:
entries: []
nameFileIdTable:
exit_0: -4781373940957465942
SettingsButton_0: -1655109142887154325
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:

View File

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 279 KiB

After

Width:  |  Height:  |  Size: 279 KiB

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

View File

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

38
Assets/LevelLoader.cs Normal file
View File

@ -0,0 +1,38 @@
using UnityEngine;
using UnityEngine.UI;
using System.IO;
using System.Text.Json;
public class LevelLoader : MonoBehaviour
{
[SerializeField]
public Text levelNameText;
void Start()
{
levelNameText.text = "Coucou";
string filePath = "level.json";
if (File.Exists(filePath))
{
string json = File.ReadAllText(filePath);
Level level = JsonSerializer.Deserialize<Level>(json, new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
Console.WriteLine($"Name: {level.Name}");
Console.WriteLine($"MusicPath: {level.MusicPath}");
Console.WriteLine($"TotalJumps: {level.TotalJumps}");
Console.WriteLine($"TotalAttempts: {level.TotalAttempts}");
Console.WriteLine($"KilledCount: {level.KilledCount}");
}
else
{
Console.WriteLine("JSON file not found.");
}
}
void Update()
{
}
}

View File

@ -0,0 +1,13 @@
{
"name": "Back on Track",
"music": "",
"elements": [
{
"type": "Spike",
"position": {
"x": 0,
"y": 0
}
}
]
}

20
Assets/MainMenu.cs Normal file
View File

@ -0,0 +1,20 @@
using UnityEngine;
using UnityEngine.SceneManagement;
public class MainMenu : MonoBehaviour
{
public void LaunchGame()
{
SceneManager.LoadSceneAsync("SelectLevelScene");
}
public void OpenSettings()
{
// SceneManager.LoadSceneAsync(?);
}
public void QuitGame()
{
Application.Quit();
}
}

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 6b0d0b1b64df4dd87945cd95cc7484c7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,80 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &3654053280041398781
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4104371471751400115}
- component: {fileID: 1415423667558431683}
m_Layer: 0
m_Name: AICollider
m_TagString: AICollider
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4104371471751400115
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3654053280041398781}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 86.53131, y: 53.261993, z: -5.1268225}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!61 &1415423667558431683
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3654053280041398781}
m_Enabled: 1
serializedVersion: 3
m_Density: 1
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_ForceSendLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ForceReceiveLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ContactCaptureLayers:
serializedVersion: 2
m_Bits: 4294967295
m_CallbackLayers:
serializedVersion: 2
m_Bits: 4294967295
m_IsTrigger: 1
m_UsedByEffector: 0
m_CompositeOperation: 0
m_CompositeOrder: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0, y: 0}
oldSize: {x: 0, y: 0}
newSize: {x: 0, y: 0}
adaptiveTilingThreshold: 0
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
m_Size: {x: 1, y: 1}
m_EdgeRadius: 0

Some files were not shown because too many files have changed in this diff Show More