Commit 62bcc43e authored by unknown's avatar unknown

关卡完成流程可以跑通了

parent 53993467
...@@ -32,23 +32,23 @@ ...@@ -32,23 +32,23 @@
"__id__": 30 "__id__": 30
}, },
{ {
"__id__": 38 "__id__": 39
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{
"__id__": 46
},
{ {
"__id__": 48 "__id__": 48
}, },
{ {
"__id__": 50 "__id__": 50
},
{
"__id__": 52
} }
], ],
"_prefab": { "_prefab": {
"__id__": 52 "__id__": 54
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
...@@ -677,7 +677,7 @@ ...@@ -677,7 +677,7 @@
} }
], ],
"_prefab": { "_prefab": {
"__id__": 37 "__id__": 38
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
...@@ -790,7 +790,11 @@ ...@@ -790,7 +790,11 @@
"__prefab": { "__prefab": {
"__id__": 36 "__id__": 36
}, },
"clickEvents": [], "clickEvents": [
{
"__id__": 37
}
],
"_interactable": true, "_interactable": true,
"_transition": 3, "_transition": 3,
"_normalColor": { "_normalColor": {
...@@ -837,6 +841,16 @@ ...@@ -837,6 +841,16 @@
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "bab2m7GQpEdK7/w/Xyxise" "fileId": "bab2m7GQpEdK7/w/Xyxise"
}, },
{
"__type__": "cc.ClickEvent",
"target": {
"__id__": 1
},
"component": "",
"_componentId": "8a7161MaaNDPaefS5tbTQY9",
"handler": "onBackBtnClick",
"customEventData": ""
},
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {
...@@ -858,17 +872,17 @@ ...@@ -858,17 +872,17 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 39 "__id__": 40
}, },
{ {
"__id__": 41 "__id__": 42
}, },
{ {
"__id__": 43 "__id__": 44
} }
], ],
"_prefab": { "_prefab": {
"__id__": 45 "__id__": 47
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
...@@ -903,11 +917,11 @@ ...@@ -903,11 +917,11 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 38 "__id__": 39
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 40 "__id__": 41
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
...@@ -930,11 +944,11 @@ ...@@ -930,11 +944,11 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 38 "__id__": 39
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 42 "__id__": 43
}, },
"_visFlags": 0, "_visFlags": 0,
"_customMaterial": null, "_customMaterial": null,
...@@ -975,13 +989,17 @@ ...@@ -975,13 +989,17 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 38 "__id__": 39
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 44 "__id__": 45
}, },
"clickEvents": [], "clickEvents": [
{
"__id__": 46
}
],
"_interactable": true, "_interactable": true,
"_transition": 3, "_transition": 3,
"_normalColor": { "_normalColor": {
...@@ -1028,6 +1046,16 @@ ...@@ -1028,6 +1046,16 @@
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "f6YaZtthBERbd7xsEBpWCk" "fileId": "f6YaZtthBERbd7xsEBpWCk"
}, },
{
"__type__": "cc.ClickEvent",
"target": {
"__id__": 1
},
"component": "",
"_componentId": "8a7161MaaNDPaefS5tbTQY9",
"handler": "onContinueBtnClick",
"customEventData": ""
},
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {
...@@ -1047,7 +1075,7 @@ ...@@ -1047,7 +1075,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 47 "__id__": 49
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
...@@ -1074,7 +1102,7 @@ ...@@ -1074,7 +1102,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 49 "__id__": 51
}, },
"_alignFlags": 45, "_alignFlags": 45,
"_target": null, "_target": null,
...@@ -1109,7 +1137,7 @@ ...@@ -1109,7 +1137,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 51 "__id__": 53
}, },
"_id": "" "_id": ""
}, },
......
import { _decorator, Component, Node, director } from 'cc'; import { _decorator, Component, Node, director } from 'cc';
import { levelMgr } from '../../../../startFolder/script/LevelMgr';
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@ccclass('ChallengeFailView') @ccclass('ChallengeFailView')
...@@ -14,10 +15,10 @@ export class ChallengeFailView extends Component { ...@@ -14,10 +15,10 @@ export class ChallengeFailView extends Component {
} }
onBackBtnClick() { onBackBtnClick() {
director.emit(""); levelMgr.backLevelHome();
} }
onContinueBtnClick() { onContinueBtnClick() {
director.emit(""); levelMgr.loadLevel();
} }
} }
import { _decorator, Component, Node, Label, director } from 'cc'; import { _decorator, Component, Node, Label, director } from 'cc';
import { Utils } from '../../../../startFolder/script/common/Utils'; import { Utils } from '../../../../startFolder/script/common/Utils';
import { levelMgr } from '../../../../startFolder/script/LevelMgr';
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@ccclass('ChallengeSuccView') @ccclass('ChallengeSuccView')
...@@ -34,11 +35,14 @@ export class ChallengeSuccView extends Component { ...@@ -34,11 +35,14 @@ export class ChallengeSuccView extends Component {
} }
onBackBtnClick() { onBackBtnClick() {
director.emit(""); if(levelMgr.unLockCount <= levelMgr.runLevel) levelMgr.unLockCount += 1;
levelMgr.backLevelHome();
} }
onContinueBtnClick() { onContinueBtnClick() {
director.emit(""); if(levelMgr.unLockCount <= levelMgr.runLevel) levelMgr.unLockCount += 1;
levelMgr.runLevel += 1;
levelMgr.loadLevel();
} }
} }
\ No newline at end of file
...@@ -196,6 +196,12 @@ export class SchulteCtr extends Component { ...@@ -196,6 +196,12 @@ export class SchulteCtr extends Component {
}); });
} }
onDestroy(){
director.off("click_block");
director.off("continue_game");
director.off("begin_countdown_end");
}
reset() { reset() {
// tween(this.node).stop(); // tween(this.node).stop();
this.isPlayCountdownMus = false; this.isPlayCountdownMus = false;
......
...@@ -20,11 +20,13 @@ export class LevelHomeCtr extends Component { ...@@ -20,11 +20,13 @@ export class LevelHomeCtr extends Component {
start() { start() {
// [3] // [3]
if (!levelMgr.loadedOutData) {
// levelMgr.loadedOutData = true;
director.on("load_level", this.loadLevel, this);
levelMgr.gameIdHead = 10; levelMgr.gameIdHead = 10;
levelMgr.unLockCount = 1; levelMgr.unLockCount = 1;
}
//
director.on("load_level", this.loadLevel, this);
this.updateStar(); this.updateStar();
} }
...@@ -51,17 +53,17 @@ export class LevelHomeCtr extends Component { ...@@ -51,17 +53,17 @@ export class LevelHomeCtr extends Component {
starArr.push(this.secondLayout!.children[i]!.getComponent(LevelStarCtr)!); starArr.push(this.secondLayout!.children[i]!.getComponent(LevelStarCtr)!);
} }
let levelArr = levelMgr.getLevelItfArr(levelMgr.gameIdHead); let levelArr = levelMgr.getLevelItfArr(levelMgr.gameIdHead);
console.log(`个数`, count); // console.log(`个数`, count);
for (let i = 0; i < starArr.length; ++i) { for (let i = 0; i < starArr.length; ++i) {
if (i >= count) starArr[i].node.active = false; if (i >= count) starArr[i].node.active = false;
else starArr[i].node.active = true; else starArr[i].node.active = true;
if (i >= count) continue; if (i >= count) continue;
if (!levelArr[i]) continue; if (!levelArr[i]) continue;
starArr[i].setLevel(levelArr[i].level); starArr[i].setLevel(levelArr[i].level);
if (i < levelMgr.unLockCount) { if (i < levelMgr.unLockCount - 1) {
starArr[i].setFinish(); starArr[i].setFinish();
} }
else if (i == levelMgr.unLockCount) { else if (i == levelMgr.unLockCount - 1) {
starArr[i].setUnLock(); starArr[i].setUnLock();
} }
else { else {
......
...@@ -14,7 +14,8 @@ class LevelMgr { ...@@ -14,7 +14,8 @@ class LevelMgr {
} }
// //
private _gameIdHead = 0; public loadedOutData = false;
private _gameIdHead = 10;
public set gameIdHead(value: number){ public set gameIdHead(value: number){
this._gameIdHead = value; this._gameIdHead = value;
} }
...@@ -22,7 +23,7 @@ class LevelMgr { ...@@ -22,7 +23,7 @@ class LevelMgr {
public get gameIdHead(){ public get gameIdHead(){
return this._gameIdHead; return this._gameIdHead;
} }
private _unLockCount = 0; private _unLockCount = 1;
public set unLockCount(value: number){ public set unLockCount(value: number){
if(value > this.getLevelCount(this._gameIdHead)) return; if(value > this.getLevelCount(this._gameIdHead)) return;
this._unLockCount = value; this._unLockCount = value;
...@@ -32,7 +33,7 @@ class LevelMgr { ...@@ -32,7 +33,7 @@ class LevelMgr {
return this._unLockCount; return this._unLockCount;
} }
private _runLevel = 0; private _runLevel = 1;
public set runLevel(value: number){ public set runLevel(value: number){
if(value > this.getLevelCount(this._gameIdHead)) return; if(value > this.getLevelCount(this._gameIdHead)) return;
this._runLevel = value; this._runLevel = value;
...@@ -64,8 +65,8 @@ class LevelMgr { ...@@ -64,8 +65,8 @@ class LevelMgr {
} }
public backLevelHome(){ public backLevelHome(){
director.loadScene("begin", () => { director.loadScene("LevelScene", () => {
find("Canvas")?.getComponent("LevelHomeCtr");
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment