Commit 62bcc43e authored by unknown's avatar unknown

关卡完成流程可以跑通了

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