|
|
@@ -1,4 +1,5 @@
|
|
|
import Time from "../../../MOKA/util/Time";
|
|
|
+import { Utils } from "../../../MOKA/util/Utils";
|
|
|
import GeneralVO from "../../vo/GeneralVO";
|
|
|
|
|
|
const { ccclass, property } = cc._decorator;
|
|
|
@@ -17,6 +18,8 @@ export default class DrawItem extends cc.Component {
|
|
|
|
|
|
@property({ type: cc.Sprite, displayName: "图_背光" })
|
|
|
img_light: cc.Sprite = null;
|
|
|
+ @property({ type: cc.Sprite, displayName: "图_背光开_先显示" })
|
|
|
+ img_light_before: cc.Sprite = null;
|
|
|
@property({ type: cc.Sprite, displayName: "图_背光开" })
|
|
|
img_light_opened: cc.Sprite = null;
|
|
|
|
|
|
@@ -54,9 +57,11 @@ export default class DrawItem extends cc.Component {
|
|
|
@property({ type: sp.Skeleton, displayName: "动画_高品质3" })
|
|
|
spine_best3: sp.Skeleton = null;
|
|
|
|
|
|
+ private initPos: cc.Vec2 = cc.v2();
|
|
|
isOpened = false;
|
|
|
|
|
|
onLoad() {
|
|
|
+ this.initPos = this.node.getPosition();
|
|
|
this.init();
|
|
|
}
|
|
|
|
|
|
@@ -64,11 +69,13 @@ export default class DrawItem extends cc.Component {
|
|
|
this.isOpened = false;
|
|
|
cc.Tween.stopAllByTarget(this.btn_open);
|
|
|
cc.Tween.stopAllByTarget(this.node_opened);
|
|
|
+ this.node.setPosition(this.initPos);
|
|
|
this.btn_open.scaleX = 1;
|
|
|
this.node_opened.scaleX = 0;
|
|
|
this.node_opened.active = false;
|
|
|
this.img_camp.node.active = false;
|
|
|
this.node_hasHero.active = false;
|
|
|
+ this.img_light_before.node.active = false;
|
|
|
|
|
|
this.spine_zi.node.active = false;
|
|
|
this.spine_best1.node.active = false;
|
|
|
@@ -95,12 +102,12 @@ export default class DrawItem extends cc.Component {
|
|
|
|
|
|
if (general.color == 1) {
|
|
|
cc.tween(this.btn_open)
|
|
|
- .to(0.2, { scaleX: 0 })
|
|
|
+ .to(0.25, { scaleX: 0 })
|
|
|
.call(() => {
|
|
|
this.node_opened.active = true;
|
|
|
|
|
|
cc.tween(this.node_opened)
|
|
|
- .to(0.2, { scaleX: 1 })
|
|
|
+ .to(0.25, { scaleX: 1 })
|
|
|
.call(() => {
|
|
|
this.img_camp.node.active = true;
|
|
|
|
|
|
@@ -166,16 +173,14 @@ export default class DrawItem extends cc.Component {
|
|
|
*/
|
|
|
async playAni(type: number, isSlice: boolean, num: number) {
|
|
|
if (type == 1) {
|
|
|
- this.spine_zi.node.active = true;
|
|
|
- this.spine_zi.setAnimation(0, "animation", false);
|
|
|
|
|
|
cc.tween(this.btn_open)
|
|
|
- .to(0.2, { scaleX: 0 })
|
|
|
+ .to(0.25, { scaleX: 0 })
|
|
|
.call(() => {
|
|
|
this.node_opened.active = true;
|
|
|
|
|
|
cc.tween(this.node_opened)
|
|
|
- .to(0.2, { scaleX: 1 })
|
|
|
+ .to(0.25, { scaleX: 1 })
|
|
|
.call(() => {
|
|
|
this.img_camp.node.active = true;
|
|
|
|
|
|
@@ -184,47 +189,72 @@ export default class DrawItem extends cc.Component {
|
|
|
this.txt_slice.string = "x" + num;
|
|
|
})
|
|
|
.start();
|
|
|
+ this.playZiAni();
|
|
|
})
|
|
|
.start();
|
|
|
|
|
|
- await Time.WaitForSeconds(this.spine_zi.findAnimation("animation").duration + 0.1);
|
|
|
- if (cc.isValid(this.node)) {
|
|
|
- this.spine_zi.node.active = false;
|
|
|
- }
|
|
|
+
|
|
|
} else {
|
|
|
- this.spine_best1.node.active = true;
|
|
|
- this.spine_best1.setAnimation(0, "animation", true);
|
|
|
- await Time.WaitForSeconds(this.spine_best1.findAnimation("animation").duration + 1);
|
|
|
- this.spine_best1.node.active = false;
|
|
|
- this.spine_best2.node.active = true;
|
|
|
- this.spine_best2.setAnimation(0, "animation", false);
|
|
|
+ this.img_light.node.active = false;
|
|
|
+ this.img_light_before.node.active = true;
|
|
|
|
|
|
- cc.tween(this.btn_open)
|
|
|
- .to(0.2, { scaleX: 0 })
|
|
|
+ cc.tween(this.node)
|
|
|
+ .to(0.4, { position: cc.v2(this.node.x, this.node.y + 30) })
|
|
|
.call(() => {
|
|
|
- this.node_opened.active = true;
|
|
|
+ this.playBest1Ani();
|
|
|
+ Utils.ScreenShock(this.node, 1.5, () => {
|
|
|
+ if (!cc.isValid(this.node)) return;
|
|
|
+ this.spine_best1.node.active = false;
|
|
|
+ this.spine_best2.node.active = true;
|
|
|
+ this.spine_best2.setAnimation(0, "animation", false);
|
|
|
+
|
|
|
+ cc.tween(this.btn_open)
|
|
|
+ .to(0.25, { scaleX: 0 })
|
|
|
+ .call(() => {
|
|
|
+ this.node_opened.active = true;
|
|
|
|
|
|
- cc.tween(this.node_opened)
|
|
|
- .to(0.2, { scaleX: 1 })
|
|
|
- .call(() => {
|
|
|
- this.img_camp.node.active = true;
|
|
|
+ cc.tween(this.node_opened)
|
|
|
+ .to(0.25, { scaleX: 1 })
|
|
|
+ .call(() => {
|
|
|
+ this.img_camp.node.active = true;
|
|
|
|
|
|
- //碎片判断 是否已拥有该武将
|
|
|
- this.node_hasHero.active = isSlice;
|
|
|
- this.txt_slice.string = "x" + num;
|
|
|
+ //碎片判断 是否已拥有该武将
|
|
|
+ this.node_hasHero.active = isSlice;
|
|
|
+ this.txt_slice.string = "x" + num;
|
|
|
|
|
|
- this.playAniCard();
|
|
|
- })
|
|
|
- .start();
|
|
|
+ this.playAniCard();
|
|
|
+ })
|
|
|
+ .start();
|
|
|
+ })
|
|
|
+ .start();
|
|
|
+ });
|
|
|
})
|
|
|
.start();
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ async playZiAni() {
|
|
|
+ this.spine_zi.node.active = true;
|
|
|
+ this.spine_zi.setAnimation(0, "animation", false);
|
|
|
+ await Time.WaitForSeconds(this.spine_zi.findAnimation("animation").duration + 0.1);
|
|
|
+ if (cc.isValid(this.node)) {
|
|
|
+ this.spine_zi.node.active = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ async playBest1Ani() {
|
|
|
+ this.spine_best1.node.active = true;
|
|
|
+ this.spine_best1.setAnimation(0, "animation", true);
|
|
|
+ await Time.WaitForSeconds(this.spine_best1.findAnimation("animation").duration + 1);
|
|
|
+ }
|
|
|
+
|
|
|
async playAniCard() {
|
|
|
this.spine_best3.node.active = true;
|
|
|
this.spine_best3.setAnimation(0, "animation", false);
|
|
|
await Time.WaitForSeconds(this.spine_best3.findAnimation("animation").duration + 0.1);
|
|
|
+ if (!cc.isValid(this.node)) return;
|
|
|
this.spine_best3.node.active = false;
|
|
|
}
|
|
|
}
|