diff --git a/assets/Buttons/store.png b/assets/Buttons/store.png new file mode 100644 index 0000000..2f75d7f Binary files /dev/null and b/assets/Buttons/store.png differ diff --git a/assets/Buttons/store.png.meta b/assets/Buttons/store.png.meta new file mode 100644 index 0000000..f23550f --- /dev/null +++ b/assets/Buttons/store.png.meta @@ -0,0 +1,34 @@ +{ + "ver": "2.3.3", + "uuid": "d5a4cceb-814a-4da2-8392-18fa4a00df30", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "platformSettings": {}, + "subMetas": { + "store": { + "ver": "1.0.4", + "uuid": "6a617218-3c12-47bf-a1fa-6432bff4391c", + "rawTextureUuid": "d5a4cceb-814a-4da2-8392-18fa4a00df30", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": -1, + "trimX": 50, + "trimY": 74, + "width": 400, + "height": 354, + "rawWidth": 500, + "rawHeight": 500, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/assets/Game.fire b/assets/Game.fire index b289b3a..736ec57 100644 --- a/assets/Game.fire +++ b/assets/Game.fire @@ -177,7 +177,7 @@ "__type__": "cc.Vec3", "x": 0, "y": 0, - "z": 540.3998519614897 + "z": 769.896583964366 }, "_scale": { "__type__": "cc.Vec3", @@ -551,9 +551,7 @@ ], "_srcBlendFactor": 770, "_dstBlendFactor": 771, - "_spriteFrame": { - "__uuid__": "14cd4280-b3a7-4ac6-858b-63ca8d96ba56" - }, + "_spriteFrame": null, "_type": 0, "_sizeMode": 1, "_fillType": 0, @@ -2877,8 +2875,8 @@ }, "component": "", "_componentId": "3a2abJhRaJFyrM9SBg5rWtB", - "handler": "closeGame", - "customEventData": "" + "handler": "loadScene", + "customEventData": "Menu" }, { "__type__": "3a2abJhRaJFyrM9SBg5rWtB", diff --git a/assets/Level.fire b/assets/Level.fire index 6296ec4..5e044ad 100644 --- a/assets/Level.fire +++ b/assets/Level.fire @@ -168,7 +168,7 @@ "__type__": "cc.Vec3", "x": 0, "y": 0, - "z": 782.0090764356186 + "z": 769.896583964366 }, "_scale": { "__type__": "cc.Vec3", @@ -1436,8 +1436,8 @@ }, "component": "", "_componentId": "3a2abJhRaJFyrM9SBg5rWtB", - "handler": "backToMenu", - "customEventData": "" + "handler": "loadScene", + "customEventData": "Menu" }, { "__type__": "cc.Canvas", diff --git a/assets/Menu.fire b/assets/Menu.fire index d961df8..2140bb8 100644 --- a/assets/Menu.fire +++ b/assets/Menu.fire @@ -69,19 +69,22 @@ }, { "__id__": 17 + }, + { + "__id__": 22 } ], "_active": true, "_level": 1, "_components": [ { - "__id__": 22 + "__id__": 27 }, { - "__id__": 23 + "__id__": 28 }, { - "__id__": 24 + "__id__": 29 } ], "_prefab": null, @@ -165,7 +168,7 @@ "__type__": "cc.Vec3", "x": 0, "y": 0, - "z": 782.0090764356186 + "z": 769.896583964366 }, "_scale": { "__type__": "cc.Vec3", @@ -464,8 +467,8 @@ }, "component": "", "_componentId": "3a2abJhRaJFyrM9SBg5rWtB", - "handler": "loadLevelsScene", - "customEventData": "" + "handler": "loadScene", + "customEventData": "Level" }, { "__type__": "3a2abJhRaJFyrM9SBg5rWtB", @@ -663,8 +666,8 @@ }, "component": "", "_componentId": "3a2abJhRaJFyrM9SBg5rWtB", - "handler": "showSettings", - "customEventData": "" + "handler": "loadScene", + "customEventData": "Settings" }, { "__type__": "3a2abJhRaJFyrM9SBg5rWtB", @@ -862,6 +865,192 @@ "_enabled": true, "_id": "51E8zpuHRFWLDHsTbGhIA+" }, + { + "__type__": "cc.Node", + "_name": "store", + "_objFlags": 0, + "_parent": { + "__id__": 2 + }, + "_children": [], + "_active": true, + "_level": 2, + "_components": [ + { + "__id__": 23 + }, + { + "__id__": 24 + }, + { + "__id__": 26 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 200, + "height": 200 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_position": { + "__type__": "cc.Vec3", + "x": -1, + "y": -180, + "z": 0 + }, + "_scale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 0.44, + "z": 1 + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "groupIndex": 0, + "_id": "42YIx2Q65JeY2wwZpRL+KD" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 22 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "6a617218-3c12-47bf-a1fa-6432bff4391c" + }, + "_type": 0, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "9eghOuG3ZJ5LEkvSTze7lr" + }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 22 + }, + "_enabled": true, + "duration": 0.1, + "zoomScale": 1.2, + "clickEvents": [ + { + "__id__": 25 + } + ], + "_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": "d262sPCHNCRL0e3yX+sRZ2" + }, + { + "__type__": "cc.ClickEvent", + "target": { + "__id__": 22 + }, + "component": "", + "_componentId": "3a2abJhRaJFyrM9SBg5rWtB", + "handler": "loadScene", + "customEventData": "Store" + }, + { + "__type__": "3a2abJhRaJFyrM9SBg5rWtB", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 22 + }, + "_enabled": true, + "_id": "91rA30YV5CVojuLNftsAyb" + }, { "__type__": "cc.Canvas", "_name": "", diff --git a/assets/Score.fire b/assets/Score.fire index c9e24a6..e41ec4e 100644 --- a/assets/Score.fire +++ b/assets/Score.fire @@ -165,7 +165,7 @@ "__type__": "cc.Vec3", "x": 0, "y": 0, - "z": 540.3998519614897 + "z": 769.896583964366 }, "_scale": { "__type__": "cc.Vec3", @@ -250,7 +250,7 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 300, + "width": 350, "height": 330 }, "_anchorPoint": { @@ -261,7 +261,7 @@ "_position": { "__type__": "cc.Vec3", "x": 0, - "y": 174.068, + "y": 133.919, "z": 0 }, "_scale": { @@ -448,14 +448,14 @@ }, "_position": { "__type__": "cc.Vec3", - "x": 0, - "y": -105.207, + "x": -1.401, + "y": -48.251, "z": 0 }, "_scale": { "__type__": "cc.Vec3", "x": 1, - "y": 1, + "y": 0.316, "z": 1 }, "_eulerAngles": { @@ -579,8 +579,8 @@ }, "component": "", "_componentId": "3a2abJhRaJFyrM9SBg5rWtB", - "handler": "closeGame", - "customEventData": "" + "handler": "loadScene", + "customEventData": "Menu" }, { "__type__": "3a2abJhRaJFyrM9SBg5rWtB", diff --git a/assets/Scripts/FinalScore.ts b/assets/Scripts/FinalScore.ts index a3ccb16..0348590 100644 --- a/assets/Scripts/FinalScore.ts +++ b/assets/Scripts/FinalScore.ts @@ -9,6 +9,7 @@ // - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html import GameData from "./GameData"; +import SoundManager from "./SoundsManager"; const {ccclass, property} = cc._decorator; @@ -24,6 +25,7 @@ export default class NewClass extends cc.Component { onLoad () { this.label.string = GameData.instance.getScore().toString(); + SoundManager.instance.playMusic('Judgement', true); } // update (dt) {} diff --git a/assets/Scripts/GameData.ts b/assets/Scripts/GameData.ts index a234ff8..a7f2053 100644 --- a/assets/Scripts/GameData.ts +++ b/assets/Scripts/GameData.ts @@ -24,16 +24,20 @@ export default class GameData extends cc.Component { public static get instance(): GameData { if (!this._instance) { this._instance = new GameData(); + this._instance.soundEnabled = cc.sys.localStorage.getItem('soundEnabled') !== 'false'; + this._instance.musicEnabled = cc.sys.localStorage.getItem('musicEnabled') !== 'false'; } return this._instance; } public setSoundEnabled(enabled: boolean) { this.soundEnabled = enabled; + cc.sys.localStorage.setItem('soundEnabled', enabled.toString()); } public setMusicEnabled(enabled: boolean) { this.musicEnabled = enabled; + cc.sys.localStorage.setItem('musicEnabled', enabled.toString()); } public setScore(score: number) { @@ -66,6 +70,4 @@ export default class GameData extends cc.Component { public get enemyMoveTime(): number { return this.levelConfig[this.selectedLevel].playerSpeed; } - - } diff --git a/assets/Scripts/SwitchScreens.ts b/assets/Scripts/SwitchScreens.ts index 401f813..807e925 100644 --- a/assets/Scripts/SwitchScreens.ts +++ b/assets/Scripts/SwitchScreens.ts @@ -25,13 +25,6 @@ export default class MenuScreen extends cc.Component { } } - loadLevelsScene() { - SoundManager.instance.playEffect('click'); - cc.director.preloadScene('Level', () => { - cc.director.loadScene('Level'); - }); - } - loadGameScene(event, customData) { SoundManager.instance.playEffect('click'); const selectedLevel = Number(customData); @@ -42,11 +35,14 @@ export default class MenuScreen extends cc.Component { }); } - closeGame() { - GameData.instance.setScore(0); + loadScene(event, sceneName) { SoundManager.instance.playEffect('click'); - SoundManager.instance.stopMusic(); - cc.director.loadScene('Menu'); + if(sceneName === 'Menu') { + SoundManager.instance.stopMusic(); + } + cc.director.preloadScene(sceneName, () => { + cc.director.loadScene(sceneName); + }); } killGame() { @@ -57,16 +53,4 @@ export default class MenuScreen extends cc.Component { 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'); - }); - } } diff --git a/assets/Settings.fire b/assets/Settings.fire index b141385..41e56fe 100644 --- a/assets/Settings.fire +++ b/assets/Settings.fire @@ -165,7 +165,7 @@ "__type__": "cc.Vec3", "x": 0, "y": 0, - "z": 782.0090764356186 + "z": 769.896583964366 }, "_scale": { "__type__": "cc.Vec3", @@ -460,8 +460,8 @@ }, "component": "", "_componentId": "3a2abJhRaJFyrM9SBg5rWtB", - "handler": "closeGame", - "customEventData": "" + "handler": "loadScene", + "customEventData": "Menu" }, { "__type__": "3a2abJhRaJFyrM9SBg5rWtB", diff --git a/assets/Store.fire b/assets/Store.fire index 69c0333..d69ec17 100644 --- a/assets/Store.fire +++ b/assets/Store.fire @@ -1 +1,247 @@ -[{"__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}}] \ No newline at end of file +[ + { + "__type__": "cc.SceneAsset", + "_name": "", + "_objFlags": 0, + "_native": "", + "scene": { + "__id__": 1 + } + }, + { + "__type__": "cc.Scene", + "_objFlags": 0, + "_parent": null, + "_children": [ + { + "__id__": 2 + } + ], + "_active": true, + "_level": 0, + "_components": [], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 0, + "height": 0 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_scale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_is3DNode": true, + "groupIndex": 0, + "autoReleaseAssets": false, + "_id": "b9648456-60cb-4d20-b846-8a96221d7570" + }, + { + "__type__": "cc.Node", + "_name": "Canvas", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 3 + } + ], + "_active": true, + "_level": 0, + "_components": [ + { + "__id__": 5 + }, + { + "__id__": 6 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 960, + "height": 640 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_position": { + "__type__": "cc.Vec3", + "x": 480, + "y": 320, + "z": 0 + }, + "_scale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1.5, + "z": 1 + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "groupIndex": 0, + "_id": "7fzvwQu2NNEaRCn99ZF43F" + }, + { + "__type__": "cc.Node", + "_name": "Main Camera", + "_objFlags": 0, + "_parent": { + "__id__": 2 + }, + "_children": [], + "_active": true, + "_level": 1, + "_components": [ + { + "__id__": 4 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 0, + "height": 0 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_position": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 769.896583964366 + }, + "_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": "06sWDu489LoLHr64ncR4nN" + }, + { + "__type__": "cc.Camera", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 3 + }, + "_enabled": true, + "_cullingMask": 4294967295, + "_clearFlags": 7, + "_backgroundColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_depth": -1, + "_zoomRatio": 1, + "_targetTexture": null, + "_fov": 60, + "_orthoSize": 10, + "_nearClip": 1, + "_farClip": 4096, + "_ortho": true, + "_rect": { + "__type__": "cc.Rect", + "x": 0, + "y": 0, + "width": 1, + "height": 1 + }, + "_renderStages": 1, + "_id": "9bOIzkblRGOKyKH4qNdyIP" + }, + { + "__type__": "cc.Canvas", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "_designResolution": { + "__type__": "cc.Size", + "width": 960, + "height": 640 + }, + "_fitWidth": true, + "_fitHeight": true, + "_id": "e6woeJOMVAFYFX4rUYx48e" + }, + { + "__type__": "19aaeSYSZZGULvtl5gcIKyn", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "protonSM": { + "__uuid__": "59b8f7eb-f327-47e0-aa01-42ecad377557" + }, + "protonMD": { + "__uuid__": "75af4f59-790b-4c40-ba2e-54ffc1cc3c23" + }, + "protonLG": { + "__uuid__": "9c3d7d56-f77a-4e1f-a64c-865e00c80cff" + }, + "_id": "56a0edbDtBQqUAtJ2NG/Hu" + } +] \ No newline at end of file diff --git a/assets/ships/alienship1.png b/assets/ships/player1.png similarity index 100% rename from assets/ships/alienship1.png rename to assets/ships/player1.png diff --git a/assets/ships/alienship1.png.meta b/assets/ships/player1.png.meta similarity index 97% rename from assets/ships/alienship1.png.meta rename to assets/ships/player1.png.meta index 0d0cd39..2282e9f 100644 --- a/assets/ships/alienship1.png.meta +++ b/assets/ships/player1.png.meta @@ -9,7 +9,7 @@ "packable": true, "platformSettings": {}, "subMetas": { - "alienship1": { + "player1": { "ver": "1.0.4", "uuid": "14cd4280-b3a7-4ac6-858b-63ca8d96ba56", "rawTextureUuid": "e8932f3f-2b74-4bb6-8b86-cdb96e6ae25f", diff --git a/assets/ships/player2.png b/assets/ships/player2.png new file mode 100644 index 0000000..df80423 Binary files /dev/null and b/assets/ships/player2.png differ diff --git a/assets/ships/player2.png.meta b/assets/ships/player2.png.meta new file mode 100644 index 0000000..8092ba5 --- /dev/null +++ b/assets/ships/player2.png.meta @@ -0,0 +1,34 @@ +{ + "ver": "2.3.3", + "uuid": "d743834a-5238-49db-a251-8cb48ce30816", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "platformSettings": {}, + "subMetas": { + "player2": { + "ver": "1.0.4", + "uuid": "16a01726-3afc-4177-ae5e-baa3ab1b2c75", + "rawTextureUuid": "d743834a-5238-49db-a251-8cb48ce30816", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 7.5, + "offsetY": 11.5, + "trimX": 18, + "trimY": 11, + "width": 479, + "height": 455, + "rawWidth": 500, + "rawHeight": 500, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/assets/ships/player3.png b/assets/ships/player3.png new file mode 100644 index 0000000..309682d Binary files /dev/null and b/assets/ships/player3.png differ diff --git a/assets/ships/player3.png.meta b/assets/ships/player3.png.meta new file mode 100644 index 0000000..f4e1158 --- /dev/null +++ b/assets/ships/player3.png.meta @@ -0,0 +1,34 @@ +{ + "ver": "2.3.3", + "uuid": "923d7e23-4edc-4338-971b-e736e7dce92b", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "platformSettings": {}, + "subMetas": { + "player3": { + "ver": "1.0.4", + "uuid": "6440914a-8642-4fef-86e4-0efd31840fde", + "rawTextureUuid": "923d7e23-4edc-4338-971b-e736e7dce92b", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 14.5, + "offsetY": 10, + "trimX": 82, + "trimY": 9, + "width": 477, + "height": 370, + "rawWidth": 612, + "rawHeight": 408, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file