store-v2 #1

Merged
Bomber merged 16 commits from store-v2 into main 2025-11-07 12:13:22 +00:00
19 changed files with 1940 additions and 7 deletions
Showing only changes of commit d2525f5022 - Show all commits

BIN
assets/Buttons/frame.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

View File

@ -0,0 +1,34 @@
{
"ver": "2.3.3",
"uuid": "5081a280-3f38-463a-8e51-d89aa64a9d65",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"platformSettings": {},
"subMetas": {
"frame": {
"ver": "1.0.4",
"uuid": "e5d1a5e1-1c0e-4cf7-a537-9b884ae8641e",
"rawTextureUuid": "5081a280-3f38-463a-8e51-d89aa64a9d65",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0.5,
"offsetY": 0.5,
"trimX": 83,
"trimY": 66,
"width": 447,
"height": 275,
"rawWidth": 612,
"rawHeight": 408,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

BIN
assets/Buttons/goback.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

View File

@ -0,0 +1,34 @@
{
"ver": "2.3.3",
"uuid": "c1c1e95d-6a5a-4f63-8272-3d0e3bbab123",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"platformSettings": {},
"subMetas": {
"goback": {
"ver": "1.0.4",
"uuid": "98e2ff50-ce1b-4b6c-bde1-d9517b6be722",
"rawTextureUuid": "c1c1e95d-6a5a-4f63-8272-3d0e3bbab123",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0.5,
"trimX": 82,
"trimY": 79,
"width": 336,
"height": 341,
"rawWidth": 500,
"rawHeight": 500,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 KiB

View File

@ -0,0 +1,34 @@
{
"ver": "2.3.3",
"uuid": "95bb0bf8-78d3-4358-85dd-fe8463e2af39",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"platformSettings": {},
"subMetas": {
"settings-modal": {
"ver": "1.0.4",
"uuid": "f06c442e-7357-4371-b505-c0e86e22aef5",
"rawTextureUuid": "95bb0bf8-78d3-4358-85dd-fe8463e2af39",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 2,
"offsetY": 17,
"trimX": 31,
"trimY": 68,
"width": 350,
"height": 442,
"rawWidth": 408,
"rawHeight": 612,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

BIN
assets/Buttons/settings.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

View File

@ -0,0 +1,34 @@
{
"ver": "2.3.3",
"uuid": "b4220f86-5134-435a-b1d9-07e973964587",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"platformSettings": {},
"subMetas": {
"settings": {
"ver": "1.0.4",
"uuid": "137a4fa3-a5b5-4d35-8ca0-0aef23ca8a59",
"rawTextureUuid": "b4220f86-5134-435a-b1d9-07e973964587",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -0.5,
"offsetY": -7.5,
"trimX": 56,
"trimY": 68,
"width": 387,
"height": 379,
"rawWidth": 500,
"rawHeight": 500,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

View File

@ -72,16 +72,19 @@
},
{
"__id__": 23
},
{
"__id__": 29
}
],
"_active": true,
"_level": 0,
"_components": [
{
"__id__": 29
"__id__": 34
},
{
"__id__": 30
"__id__": 35
}
],
"_prefab": null,
@ -165,7 +168,7 @@
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 540.3904070535626
"z": 782.0090764356186
},
"_scale": {
"__type__": "cc.Vec3",
@ -1248,6 +1251,194 @@
"_enabled": true,
"_id": "66rwOafM5EjKiP+oFLy0Hv"
},
{
"__type__": "cc.Node",
"_name": "goback",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_level": 1,
"_components": [
{
"__id__": 30
},
{
"__id__": 31
},
{
"__id__": 32
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 50,
"height": 50
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_position": {
"__type__": "cc.Vec3",
"x": -400.979,
"y": 495.623,
"z": 0
},
"_scale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"groupIndex": 0,
"_id": "a5xZBpnnpCjasoib1HSFrG"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 29
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "98e2ff50-ce1b-4b6c-bde1-d9517b6be722"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "4bJcp1y3hIEIWDUY5w066v"
},
{
"__type__": "3a2abJhRaJFyrM9SBg5rWtB",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 29
},
"_enabled": true,
"_id": "ff6bUxkLpPSp+uI5zuwGci"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 29
},
"_enabled": true,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [
{
"__id__": 33
}
],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 0,
"transition": 0,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_N$hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": {
"__id__": 29
},
"_id": "5bmLmjh5pM0Lv/WwOCqURq"
},
{
"__type__": "cc.ClickEvent",
"target": {
"__id__": 29
},
"component": "",
"_componentId": "3a2abJhRaJFyrM9SBg5rWtB",
"handler": "backToMenu",
"customEventData": ""
},
{
"__type__": "cc.Canvas",
"_name": "",

View File

@ -63,19 +63,25 @@
},
{
"__id__": 5
},
{
"__id__": 11
},
{
"__id__": 17
}
],
"_active": true,
"_level": 1,
"_components": [
{
"__id__": 11
"__id__": 22
},
{
"__id__": 12
"__id__": 23
},
{
"__id__": 13
"__id__": 24
}
],
"_prefab": null,
@ -159,7 +165,7 @@
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 540.3998519614897
"z": 782.0090764356186
},
"_scale": {
"__type__": "cc.Vec3",
@ -471,6 +477,391 @@
"_enabled": true,
"_id": "b1l7jFcrZGValOGBcgRpBB"
},
{
"__type__": "cc.Node",
"_name": "settings",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_level": 2,
"_components": [
{
"__id__": 12
},
{
"__id__": 13
},
{
"__id__": 14
},
{
"__id__": 16
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_position": {
"__type__": "cc.Vec3",
"x": -380,
"y": 500,
"z": 0
},
"_scale": {
"__type__": "cc.Vec3",
"x": 0.7,
"y": 0.7,
"z": 1
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"groupIndex": 0,
"_id": "35D9sfXk1B/bXTnd0UD26Q"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 11
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "137a4fa3-a5b5-4d35-8ca0-0aef23ca8a59"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "32T8+u0j9LE4Qliu4SvW1L"
},
{
"__type__": "3a2abJhRaJFyrM9SBg5rWtB",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 11
},
"_enabled": true,
"_id": "d2fPfqTpdLt5xGmp8DKfYU"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 11
},
"_enabled": true,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [
{
"__id__": 15
}
],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 0,
"transition": 0,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_N$hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": null,
"_id": "71QrqFThBM2oFVHDHtcICv"
},
{
"__type__": "cc.ClickEvent",
"target": {
"__id__": 11
},
"component": "",
"_componentId": "3a2abJhRaJFyrM9SBg5rWtB",
"handler": "showSettings",
"customEventData": ""
},
{
"__type__": "3a2abJhRaJFyrM9SBg5rWtB",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 11
},
"_enabled": true,
"_id": "52lnLNPYlDFJiujnKqDoa9"
},
{
"__type__": "cc.Node",
"_name": "closeTheGame",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_level": 2,
"_components": [
{
"__id__": 18
},
{
"__id__": 19
},
{
"__id__": 21
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_position": {
"__type__": "cc.Vec3",
"x": 400,
"y": 500,
"z": 0
},
"_scale": {
"__type__": "cc.Vec3",
"x": 0.6,
"y": 0.6,
"z": 1
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"groupIndex": 0,
"_id": "75o6Nt1g5KBoTpCSkhzL6a"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 17
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "181fdba8-d507-4cdd-801d-1929957e02e6"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "809ak7JrtBppxAxjhRLbgV"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 17
},
"_enabled": true,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [
{
"__id__": 20
}
],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 0,
"transition": 0,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_N$hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": null,
"_id": "96gTxmFx1GDr38ty/9OIdD"
},
{
"__type__": "cc.ClickEvent",
"target": {
"__id__": 17
},
"component": "",
"_componentId": "3a2abJhRaJFyrM9SBg5rWtB",
"handler": "killGame",
"customEventData": ""
},
{
"__type__": "3a2abJhRaJFyrM9SBg5rWtB",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 17
},
"_enabled": true,
"_id": "51E8zpuHRFWLDHsTbGhIA+"
},
{
"__type__": "cc.Canvas",
"_name": "",

View File

@ -18,6 +18,9 @@ export default class GameData extends cc.Component {
public selectedLevel: number = 1;
public score: number = 0;
public soundEnabled: boolean = true;
public musicEnabled: boolean = true;
public static get instance(): GameData {
if (!this._instance) {
this._instance = new GameData();
@ -25,6 +28,14 @@ export default class GameData extends cc.Component {
return this._instance;
}
public setSoundEnabled(enabled: boolean) {
this.soundEnabled = enabled;
}
public setMusicEnabled(enabled: boolean) {
this.musicEnabled = enabled;
}
public setScore(score: number) {
this.score = score;
}

View File

@ -0,0 +1,59 @@
// Learn TypeScript:
// - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/typescript.html
// - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
// - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
// - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html
const {ccclass, property} = cc._decorator;
import SoundManager from "./SoundsManager";
import GameData from "./GameData";
@ccclass
export default class NewClass extends cc.Component {
@property(cc.Label)
soundLabel: cc.Label = null;
@property(cc.Label)
musicLabel: cc.Label = null;
controlSound() {
SoundManager.instance.playEffect('click');
if(GameData.instance.soundEnabled) {
this.soundLabel.string = 'OFF';
} else {
this.soundLabel.string = 'ON';
}
GameData.instance.setSoundEnabled(!GameData.instance.soundEnabled);
}
controlMusic() {
SoundManager.instance.playEffect('click');
if(GameData.instance.musicEnabled) {
this.musicLabel.string = 'OFF';
GameData.instance.setMusicEnabled(!GameData.instance.musicEnabled);
SoundManager.instance.stopMusic();
} else {
this.musicLabel.string = 'ON';
GameData.instance.setMusicEnabled(!GameData.instance.musicEnabled);
SoundManager.instance.playMusic('Judgement', true);
}
}
onLoad() {
if(GameData.instance.soundEnabled) {
this.soundLabel.string = 'ON';
} else {
this.soundLabel.string = 'OFF';
}
if(GameData.instance.musicEnabled) {
this.musicLabel.string = 'ON';
} else {
this.musicLabel.string = 'OFF';
}
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "300f0ae2-df3d-4140-9830-e23556d238dc",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@ -8,6 +8,8 @@
// - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
// - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html
import GameData from "./GameData";
const {ccclass, property} = cc._decorator;
@ccclass
@ -45,6 +47,9 @@ export default class SoundManager extends cc.Component {
// ✅ Play short effects (clicks, shots, explosions)
playEffect(name: string, loop: boolean = false) {
if(!GameData.instance.soundEnabled) {
return;
}
const clip = this.sounds[name];
if (clip) {
cc.audioEngine.setEffectsVolume(0.2);
@ -56,6 +61,9 @@ export default class SoundManager extends cc.Component {
// ✅ Play/Stop background music
playMusic(name: string, loop: boolean = true) {
if(!GameData.instance.musicEnabled) {
return;
}
const clip = this.sounds[name];
if (clip) {
if (this.musicId !== -1) {

View File

@ -48,4 +48,25 @@ export default class MenuScreen extends cc.Component {
SoundManager.instance.stopMusic();
cc.director.loadScene('Menu');
}
killGame() {
GameData.instance.setScore(0);
SoundManager.instance.playEffect('click');
this.scheduleOnce(() => {
SoundManager.instance.stopMusic();
cc.game.end();
}, 0.25);
}
backToMenu() {
SoundManager.instance.playEffect('click');
cc.director.loadScene('Menu');
}
showSettings() {
SoundManager.instance.playEffect('click');
cc.director.preloadScene('Settings', () => {
cc.director.loadScene('Settings');
});
}
}

1092
assets/Settings.fire Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
{
"ver": "1.2.1",
"uuid": "6dfa2e82-6ef5-4231-bb1f-7ad1d2ec5cce",
"asyncLoadAssets": false,
"autoReleaseAssets": false,
"subMetas": {}
}

1
assets/Store.fire Normal file
View File

@ -0,0 +1 @@
[{"__type__":"cc.SceneAsset","scene":{"__id__":1}},{"__type__":"cc.Scene","_children":[{"__id__":2}]},{"__type__":"cc.Node","_name":"Canvas","_parent":{"__id__":1},"_children":[],"_components":[{"__id__":3}]},{"__type__":"cc.Canvas","node":{"__id__":2},"_fitWidth":false,"_fitHeight":true,"_designResolution":{"__type__":"cc.Size","width":960,"height":640}}]

7
assets/Store.fire.meta Normal file
View File

@ -0,0 +1,7 @@
{
"ver": "1.2.1",
"uuid": "b9648456-60cb-4d20-b846-8a96221d7570",
"asyncLoadAssets": false,
"autoReleaseAssets": false,
"subMetas": {}
}