|
@@ -1,4 +1,4 @@
|
|
|
-import { _decorator, EventTouch, Node, Label,Animation, Vec3, EditBox} from 'cc';
|
|
|
+import { _decorator, EventTouch, Node, Label,Animation, Vec3, EditBox, Tween, tween, easing} from 'cc';
|
|
|
import List from '../third/List';
|
|
|
import { Utils } from '../utils/Utils';
|
|
|
import MsgHints from '../utils/MsgHints';
|
|
@@ -27,9 +27,7 @@ export class Main extends BaseExp {
|
|
|
public level_lable: Label;
|
|
|
@autoBind({ type: List, tooltip: "任务数据" })
|
|
|
public task_scrollView: List;
|
|
|
- @property({ type: Animation, tooltip: "进入游戏动画" })
|
|
|
- public enterAnim: Animation;
|
|
|
- @property({ type: [Node], tooltip: "动画位置节点数组" })
|
|
|
+ @property({ type: [Node], tooltip: "武器按钮、飞镖按钮、任务列表界面 动画位置节点数组" })
|
|
|
public animPosArr: Array<Node> = [];
|
|
|
|
|
|
//所有主要页面
|
|
@@ -54,8 +52,6 @@ export class Main extends BaseExp {
|
|
|
start() {
|
|
|
this.hasAnim = false;
|
|
|
this.closeOnBlank = false;
|
|
|
- //存储初始位置到类属性
|
|
|
- this.originalPositions = this.animPosArr.map(e => e.position.clone());
|
|
|
uiMgr.panels.set(Constants.mainUIs.main, this.node);
|
|
|
//注册动态变化值
|
|
|
stateMgr.registerUI(Constants.gold, this.gold_lable);
|
|
@@ -69,6 +65,33 @@ export class Main extends BaseExp {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 激活时的位置信息
|
|
|
+ */
|
|
|
+ protected onEnable(): void {
|
|
|
+ //存储初始位置到类属性
|
|
|
+ this.originalPositions = this.animPosArr.map(e => e.position.clone());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 进入的时候的动画
|
|
|
+ */
|
|
|
+ public enterAnim(){
|
|
|
+ const task_view_pos: Vec3 = this.originalPositions[0];
|
|
|
+ const arsenal_btn_pos: Vec3 = this.originalPositions[1];
|
|
|
+ const boomerang_btn_pos: Vec3 = this.originalPositions[2];
|
|
|
+ let posArr:Vec3[] = [
|
|
|
+ new Vec3(task_view_pos.x,task_view_pos.y + 622,task_view_pos.z),
|
|
|
+ new Vec3(arsenal_btn_pos.x - 148,arsenal_btn_pos.y,arsenal_btn_pos.z),
|
|
|
+ new Vec3(boomerang_btn_pos.x + 148,boomerang_btn_pos.y,boomerang_btn_pos.z)
|
|
|
+ ];
|
|
|
+ this.animPosArr.forEach((e: Node,i: number) => {
|
|
|
+ tween(e)
|
|
|
+ .to(0.7, { position: posArr[i]}, { easing: easing.backOut})
|
|
|
+ .start();
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 加载数据
|
|
|
*/
|
|
@@ -112,7 +135,7 @@ export class Main extends BaseExp {
|
|
|
userIns.data.level = parseInt(this.editBox.string);
|
|
|
}
|
|
|
this.isLoad = true;
|
|
|
- this.enterAnim.play();
|
|
|
+ this.enterAnim();
|
|
|
this.scheduleOnce(() => {
|
|
|
//加载敌人
|
|
|
Game.I.buildEnemys.loadLevelEnemys();
|