Folder structure

This commit is contained in:
Martin 2022-12-12 09:15:27 +01:00
parent 76ccbd2084
commit f7b345ef93
20 changed files with 855 additions and 367 deletions

View File

@ -0,0 +1,85 @@
[
{
"__type__": "cc.Prefab",
"_name": "AppRoot",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"persistent": false,
"asyncLoadAssets": false
},
{
"__type__": "cc.Node",
"_name": "AppRoot",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": null,
"_children": [],
"_active": true,
"_components": [
{
"__id__": 2
}
],
"_prefab": {
"__id__": 4
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "4943dSvt9FBvLizJ1HhFOzg",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 3
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "27BpfekuJFg5U8UHM0svbc"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "f6TS0IBq9EGpNVBB7WXcF6"
}
]

View File

@ -0,0 +1,13 @@
{
"ver": "1.1.40",
"importer": "prefab",
"imported": true,
"uuid": "2e5e69ef-0211-425c-9580-f5e760127619",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "AppRoot"
}
}

View File

@ -0,0 +1,12 @@
{
"ver": "1.1.0",
"importer": "directory",
"imported": true,
"uuid": "7b350bd0-c53a-4636-8db8-6ed38757d599",
"files": [],
"subMetas": {},
"userData": {
"compressionType": {},
"isRemoteBundle": {}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -18,30 +18,199 @@
"__id__": 2 "__id__": 2
}, },
{ {
"__id__": 4 "__id__": 10
} }
], ],
"_active": true, "_active": true,
"_components": [], "_components": [],
"_prefab": null, "_prefab": {
"__id__": 20
},
"autoReleaseAssets": false, "autoReleaseAssets": false,
"_globals": { "_globals": {
"__id__": 12 "__id__": 21
}, },
"_id": "1a3bccb5-bbb7-4058-846c-ed41b52415b0" "_id": "1a3bccb5-bbb7-4058-846c-ed41b52415b0"
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "AppRoot",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 1 "__id__": 1
}, },
"_prefab": {
"__id__": 3
},
"__editorExtras__": {}
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 2
},
"asset": {
"__uuid__": "2e5e69ef-0211-425c-9580-f5e760127619",
"__expectedType__": "cc.Prefab"
},
"fileId": "f6TS0IBq9EGpNVBB7WXcF6",
"instance": {
"__id__": 4
}
},
{
"__type__": "cc.PrefabInstance",
"fileId": "aeBYrvCbhJPrl9WFxYv6HW",
"mountedChildren": [],
"mountedComponents": [],
"propertyOverrides": [
{
"__id__": 5
},
{
"__id__": 7
},
{
"__id__": 8
},
{
"__id__": 9
}
],
"removedComponents": []
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 6
},
"propertyPath": [
"_name"
],
"value": "AppRoot"
},
{
"__type__": "cc.TargetInfo",
"localID": [
"f6TS0IBq9EGpNVBB7WXcF6"
]
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 6
},
"propertyPath": [
"_lpos"
],
"value": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 6
},
"propertyPath": [
"_lrot"
],
"value": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 6
},
"propertyPath": [
"_euler"
],
"value": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
}
},
{
"__type__": "cc.Node",
"_name": "Menu",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 11
},
{
"__id__": 13
}
],
"_active": true,
"_components": [
{
"__id__": 16
},
{
"__id__": 17
},
{
"__id__": 18
},
{
"__id__": 19
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 320,
"y": 480,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "1bbjilihVLsrcjC6Bkf6/2"
},
{
"__type__": "cc.Node",
"_name": "Camera",
"_objFlags": 0,
"_parent": {
"__id__": 10
},
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 3 "__id__": 12
} }
], ],
"_prefab": null, "_prefab": null,
@ -49,7 +218,7 @@
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 0, "y": 0,
"z": 0 "z": 1000
}, },
"_lrot": { "_lrot": {
"__type__": "cc.Quat", "__type__": "cc.Quat",
@ -71,90 +240,66 @@
"y": 0, "y": 0,
"z": 0 "z": 0
}, },
"_id": "58b/Etqn1D0LBB1esUnUos" "_id": "00gMEox2dKs5OZF6dNq6Ph"
}, },
{ {
"__type__": "4943dSvt9FBvLizJ1HhFOzg", "__type__": "cc.Camera",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 2 "__id__": 11
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
"_id": "eeXuVZFQ1KNpRron3jnCKj" "_projection": 0,
}, "_priority": 1073741824,
{ "_fov": 45,
"__type__": "cc.Node", "_fovAxis": 0,
"_name": "Menu", "_orthoHeight": 480,
"_objFlags": 0, "_near": 1,
"_parent": { "_far": 2000,
"__id__": 1 "_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
}, },
"_children": [ "_depth": 1,
{ "_stencil": 0,
"__id__": 5 "_clearFlags": 6,
} "_rect": {
], "__type__": "cc.Rect",
"_active": true,
"_components": [
{
"__id__": 9
},
{
"__id__": 10
},
{
"__id__": 11
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 320,
"y": 480.00000000000006,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0, "x": 0,
"y": 0, "y": 0,
"z": 0, "width": 1,
"w": 1 "height": 1
}, },
"_lscale": { "_aperture": 19,
"__type__": "cc.Vec3", "_shutter": 7,
"x": 1, "_iso": 0,
"y": 1, "_screenScale": 1,
"z": 1 "_visibility": 41943040,
}, "_targetTexture": null,
"_layer": 33554432, "_cameraType": -1,
"_euler": { "_trackingType": 0,
"__type__": "cc.Vec3", "_id": "31ELbgwJ1B7oQPudIYOXn5"
"x": 0,
"y": 0,
"z": 0
},
"_id": "beI88Z2HpFELqR4T5EMHpg"
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "Sprite", "_name": "Sprite",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 4 "__id__": 10
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 6 "__id__": 14
}, },
{ {
"__id__": 7 "__id__": 15
},
{
"__id__": 8
} }
], ],
"_prefab": null, "_prefab": null,
@ -184,20 +329,20 @@
"y": 0, "y": 0,
"z": 0 "z": 0
}, },
"_id": "d48yPBDBxC0rb7vKh/2se2" "_id": "e8TprDYH9A/q3+npC+6JfK"
}, },
{ {
"__type__": "cc.UITransform", "__type__": "cc.UITransform",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 5 "__id__": 13
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 40, "width": 102.2,
"height": 40 "height": 40
}, },
"_anchorPoint": { "_anchorPoint": {
@ -205,14 +350,14 @@
"x": 0.5, "x": 0.5,
"y": 0.5 "y": 0.5
}, },
"_id": "73Y2tSGG9AkLjwor4zDIda" "_id": "3bM1/JCd5CI4KtT2wE4DLx"
}, },
{ {
"__type__": "cc.Sprite", "__type__": "cc.Sprite",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 5 "__id__": 13
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@ -221,8 +366,8 @@
"_dstBlendFactor": 4, "_dstBlendFactor": 4,
"_color": { "_color": {
"__type__": "cc.Color", "__type__": "cc.Color",
"r": 235, "r": 255,
"g": 2, "g": 255,
"b": 255, "b": 255,
"a": 255 "a": 255
}, },
@ -232,7 +377,7 @@
}, },
"_type": 0, "_type": 0,
"_fillType": 0, "_fillType": 0,
"_sizeMode": 1, "_sizeMode": 0,
"_fillCenter": { "_fillCenter": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
"x": 0, "x": 0,
@ -243,25 +388,14 @@
"_isTrimmedMode": true, "_isTrimmedMode": true,
"_useGrayscale": false, "_useGrayscale": false,
"_atlas": null, "_atlas": null,
"_id": "72StvrPGhHK4bp9R7RA2NO" "_id": "61f5gttftKjJUo3WDA6ZG3"
},
{
"__type__": "22c61zFd7hNRaAttffaS6ep",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
},
"_enabled": true,
"__prefab": null,
"_id": "0e1btqtltATbmaReZXZW4r"
}, },
{ {
"__type__": "cc.UITransform", "__type__": "cc.UITransform",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 4 "__id__": 10
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@ -275,14 +409,29 @@
"x": 0.5, "x": 0.5,
"y": 0.5 "y": 0.5
}, },
"_id": "d6rUX5yfhMlKoWX2bSbawx" "_id": "77sRtbA2xDJKLPTTLUxbE9"
},
{
"__type__": "cc.Canvas",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 10
},
"_enabled": true,
"__prefab": null,
"_cameraComponent": {
"__id__": 12
},
"_alignCanvasWithScreen": true,
"_id": "eeGIEoaYNDCIMhXubllIM7"
}, },
{ {
"__type__": "cc.Widget", "__type__": "cc.Widget",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 4 "__id__": 10
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
@ -290,8 +439,8 @@
"_target": null, "_target": null,
"_left": 0, "_left": 0,
"_right": 0, "_right": 0,
"_top": 5.684341886080802e-14, "_top": 0,
"_bottom": 5.684341886080802e-14, "_bottom": 0,
"_horizontalCenter": 0, "_horizontalCenter": 0,
"_verticalCenter": 0, "_verticalCenter": 0,
"_isAbsLeft": true, "_isAbsLeft": true,
@ -304,35 +453,44 @@
"_originalHeight": 0, "_originalHeight": 0,
"_alignMode": 2, "_alignMode": 2,
"_lockFlags": 0, "_lockFlags": 0,
"_id": "c5V1EV8IpMtrIvY1OE9t2u" "_id": "72JoP41fdMTK8qAaheLgpm"
}, },
{ {
"__type__": "cc.RenderRoot2D", "__type__": "22c61zFd7hNRaAttffaS6ep",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 4 "__id__": 10
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
"_id": "2aCNE8+JdDk581XA25TXI9" "_id": "12ZDz/3H9Ff76Ay4iDl43K"
},
{
"__type__": "cc.PrefabInfo",
"fileId": "1a3bccb5-bbb7-4058-846c-ed41b52415b0",
"nestedPrefabInstanceRoots": [
{
"__id__": 2
}
]
}, },
{ {
"__type__": "cc.SceneGlobals", "__type__": "cc.SceneGlobals",
"ambient": { "ambient": {
"__id__": 13 "__id__": 22
}, },
"shadows": { "shadows": {
"__id__": 14 "__id__": 23
}, },
"_skybox": { "_skybox": {
"__id__": 15 "__id__": 24
}, },
"fog": { "fog": {
"__id__": 16 "__id__": 25
}, },
"octree": { "octree": {
"__id__": 17 "__id__": 26
} }
}, },
{ {

View File

@ -0,0 +1,18 @@
import { Component, _decorator } from "cc";
import { GameRunner } from "../Menu/GameRunner";
import { delay } from "../Services/Utils/AsyncUtils";
import { Game } from "./Game";
const { ccclass } = _decorator;
@ccclass("TestGameRunner")
export class TestGameRunner extends Component {
public start(): void {
if (GameRunner.Instance.IsRunning) return;
this.playTestGameAsync();
}
public async playTestGameAsync(): Promise<void> {
while (Game.Instance == null) await delay(100);
Game.Instance.playGame();
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "605c7b1b-d7fb-4e85-bdcb-9f102cc45197",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -7,6 +7,8 @@ import { delay } from "../Services/Utils/AsyncUtils";
export class GameRunner { export class GameRunner {
private static instance: GameRunner = new GameRunner(); private static instance: GameRunner = new GameRunner();
private isRunning = false;
// eslint-disable-next-line @typescript-eslint/no-empty-function // eslint-disable-next-line @typescript-eslint/no-empty-function
private constructor() {} private constructor() {}
@ -14,7 +16,12 @@ export class GameRunner {
return this.instance; return this.instance;
} }
public get IsRunning(): boolean {
return this.isRunning;
}
public async playGame(): Promise<void> { public async playGame(): Promise<void> {
this.isRunning = true;
director.loadScene("Game"); director.loadScene("Game");
const userData: UserData = AppRoot.Instance.SaveSystem.load(); const userData: UserData = AppRoot.Instance.SaveSystem.load();
while (Game.Instance == null) await delay(10); while (Game.Instance == null) await delay(10);
@ -24,5 +31,7 @@ export class GameRunner {
console.log("Gold coins: " + result); console.log("Gold coins: " + result);
console.log("All gold coins: " + userData.game.goldCoins); console.log("All gold coins: " + userData.game.goldCoins);
this.isRunning = false;
} }
} }

View File

@ -1,10 +1,11 @@
import { _decorator, Component, Node } from "cc"; import { _decorator, Component, Node } from "cc";
import { GameRunner } from "./GameRunner"; import { GameRunner } from "./GameRunner";
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@ccclass("Menu") @ccclass("Menu")
export class Menu extends Component { export class Menu extends Component {
public start(): void { public async start(): Promise<void> {
GameRunner.Instance.playGame(); GameRunner.Instance.playGame();
} }
} }

12
assets/Scripts/Utils.meta Normal file
View File

@ -0,0 +1,12 @@
{
"ver": "1.1.0",
"importer": "directory",
"imported": true,
"uuid": "a90f4b1c-a934-4656-b7b0-e60a0cfcfd24",
"files": [],
"subMetas": {},
"userData": {
"compressionType": {},
"isRemoteBundle": {}
}
}