|
|
@@ -1,3 +1,4 @@
|
|
|
+import Time from "../../../MOKA/util/Time";
|
|
|
import GeneralVO from "../../vo/GeneralVO";
|
|
|
|
|
|
const { ccclass, property } = cc._decorator;
|
|
|
@@ -43,6 +44,16 @@ export default class DrawItem extends cc.Component {
|
|
|
@property({ type: cc.Material, displayName: "材质_灰色" })
|
|
|
mat_gray: cc.Material = null;
|
|
|
|
|
|
+ @property({ type: sp.Skeleton, displayName: "动画_紫色" })
|
|
|
+ spine_zi: sp.Skeleton = null;
|
|
|
+
|
|
|
+ @property({ type: sp.Skeleton, displayName: "动画_高品质1" })
|
|
|
+ spine_best1: sp.Skeleton = null;
|
|
|
+ @property({ type: sp.Skeleton, displayName: "动画_高品质2" })
|
|
|
+ spine_best2: sp.Skeleton = null;
|
|
|
+ @property({ type: sp.Skeleton, displayName: "动画_高品质3" })
|
|
|
+ spine_best3: sp.Skeleton = null;
|
|
|
+
|
|
|
isOpened = false;
|
|
|
|
|
|
onLoad() {
|
|
|
@@ -58,6 +69,11 @@ export default class DrawItem extends cc.Component {
|
|
|
this.node_opened.active = false;
|
|
|
this.img_camp.node.active = false;
|
|
|
this.node_hasHero.active = false;
|
|
|
+
|
|
|
+ this.spine_zi.node.active = false;
|
|
|
+ this.spine_best1.node.active = false;
|
|
|
+ this.spine_best2.node.active = false;
|
|
|
+ this.spine_best3.node.active = false;
|
|
|
}
|
|
|
|
|
|
/**抽卡
|
|
|
@@ -77,23 +93,28 @@ export default class DrawItem extends cc.Component {
|
|
|
}
|
|
|
this.img_hero.spriteFrame = asset;
|
|
|
|
|
|
- cc.tween(this.btn_open)
|
|
|
- .to(0.2, { 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;
|
|
|
+ if (general.color == 1) {
|
|
|
+ cc.tween(this.btn_open)
|
|
|
+ .to(0.2, { 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;
|
|
|
+
|
|
|
+ //碎片判断 是否已拥有该武将
|
|
|
+ this.node_hasHero.active = isSlice;
|
|
|
+ this.txt_slice.string = "x" + num;
|
|
|
+ })
|
|
|
+ .start();
|
|
|
+ })
|
|
|
+ .start();
|
|
|
+ } else {
|
|
|
+ this.playAni(general.color == 2 ? 1 : 2, isSlice, num);
|
|
|
+ }
|
|
|
|
|
|
- //碎片判断 是否已拥有该武将
|
|
|
- this.node_hasHero.active = isSlice;
|
|
|
- this.txt_slice.string = "x" + num;
|
|
|
- })
|
|
|
- .start();
|
|
|
- })
|
|
|
- .start();
|
|
|
});
|
|
|
cc.loader.loadRes("module/general/texture/icon_camp_" + general.camp, cc.SpriteFrame, (errr, asset) => {
|
|
|
if (errr) { return; }
|
|
|
@@ -135,4 +156,75 @@ export default class DrawItem extends cc.Component {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 播放翻牌动画
|
|
|
+ * @param type 1 紫色 2 橙色和红色
|
|
|
+ * @param isSlice 是否为碎片
|
|
|
+ * @param num 碎片数量
|
|
|
+ */
|
|
|
+ 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 })
|
|
|
+ .call(() => {
|
|
|
+ this.node_opened.active = true;
|
|
|
+
|
|
|
+ cc.tween(this.node_opened)
|
|
|
+ .to(0.2, { scaleX: 1 })
|
|
|
+ .call(() => {
|
|
|
+ this.img_camp.node.active = true;
|
|
|
+
|
|
|
+ //碎片判断 是否已拥有该武将
|
|
|
+ this.node_hasHero.active = isSlice;
|
|
|
+ this.txt_slice.string = "x" + num;
|
|
|
+ })
|
|
|
+ .start();
|
|
|
+ })
|
|
|
+ .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);
|
|
|
+
|
|
|
+ cc.tween(this.btn_open)
|
|
|
+ .to(0.2, { 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;
|
|
|
+
|
|
|
+ //碎片判断 是否已拥有该武将
|
|
|
+ this.node_hasHero.active = isSlice;
|
|
|
+ this.txt_slice.string = "x" + num;
|
|
|
+
|
|
|
+ this.playAniCard();
|
|
|
+ })
|
|
|
+ .start();
|
|
|
+ })
|
|
|
+ .start();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ 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);
|
|
|
+ this.spine_best3.node.active = false;
|
|
|
+ }
|
|
|
}
|