Commit 8d8b6143 authored by 杨一航's avatar 杨一航

feat: 流程调整

parent 0243e50c
This diff is collapsed.
...@@ -20,7 +20,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -20,7 +20,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
itemBg = null; itemBg = null;
@property(cc.Node) @property(cc.Node)
rect = null; rect: cc.Node = null;
@property(cc.Node) @property(cc.Node)
box = null; box = null;
...@@ -30,6 +30,9 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -30,6 +30,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
@property(cc.Node) @property(cc.Node)
btn_start: cc.Node = null; btn_start: cc.Node = null;
@property(cc.Node)
btn_restart: cc.Node = null;
@property(cc.Node) @property(cc.Node)
btn_end: cc.Node = null; btn_end: cc.Node = null;
...@@ -99,7 +102,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -99,7 +102,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
startPage() { startPage() {
this.btn_start.active = false; this.btn_start.active = false;
this.cover.active = false; this.cover.active = false;
this.btn_restart.active = false;
this.boyNode.getComponent(Boy).playRun(-1); this.boyNode.getComponent(Boy).playRun(-1);
this.boyNode.scaleX = -0.5; this.boyNode.scaleX = -0.5;
...@@ -109,13 +112,32 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -109,13 +112,32 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.initPageView(); this.initPageView();
}
restartPage() {
this.btn_start.active = false;
this.btn_restart.active = false;
this.cover.active = false;
this.btn_end.active = false;
this.dragRoot.children.forEach((val) => {
val.removeAllChildren();
});
this.rect.removeAllChildren();
this.boyNode.getComponent(Boy).playtalk(-1);
this.playAudioByUrl(this.data.start_audio_url, () => {
this.boyNode.getComponent(Boy).playNormal();
this.initPageView();
})
} }
initBg() { initBg() {
const bgNode = cc.find('Canvas/bg'); const bgNode = cc.find('Canvas/bg');
bgNode.scale = this._mapScaleMax; bgNode.scale = this._mapScaleMax;
cc.tween(this.btn_start).to(0.3, { scale: 1.1 }).to(0.2, { scale: 1 }).delay(1).union().repeatForever().start(); cc.tween(this.btn_start).to(0.3, { scale: 1.1 }).to(0.2, { scale: 1 }).delay(1).union().repeatForever().start();
cc.tween(this.btn_restart).to(0.3, { scale: 1.1 }).to(0.2, { scale: 1 }).delay(1).union().repeatForever().start();
this.btn_restart.active = false;
this.cover.active = true; this.cover.active = true;
this.btn_start.on("click", this.startPage, this) this.btn_start.on("click", this.startPage, this)
this.btn_restart.on("click", this.restartPage, this)
this.btn_start.active = false; this.btn_start.active = false;
this.btn_end.active = false; this.btn_end.active = false;
...@@ -177,7 +199,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -177,7 +199,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
cc.log(keyMap) cc.log(keyMap)
for (let i = 0; i < this.dragData.length; ++i) { for (let i = 0; i < this.dragData.length; ++i) {
list[i].removeAllChildren();
let itemInfo = this.dragData[i]; let itemInfo = this.dragData[i];
let key = itemInfo.text let key = itemInfo.text
let dragNode = cc.instantiate(this.dragObj); let dragNode = cc.instantiate(this.dragObj);
...@@ -219,6 +241,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -219,6 +241,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.playAudioByUrl(this.data.end_audio_url, () => { this.playAudioByUrl(this.data.end_audio_url, () => {
this.boyNode.getComponent(Boy).playNormal(); this.boyNode.getComponent(Boy).playNormal();
this.btn_end.active = true; this.btn_end.active = true;
this.btn_restart.active = true;
}) })
......
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