Commit eeaddacf authored by haiyoucuv's avatar haiyoucuv

1

parent 0b717c2f
......@@ -68,7 +68,7 @@
<option name="presentableId" value="Default" />
<updated>1577324647364</updated>
<workItem from="1577324653437" duration="32303000" />
<workItem from="1577410840738" duration="3763000" />
<workItem from="1577410840738" duration="4120000" />
</task>
<servers />
</component>
......
......@@ -429,44 +429,43 @@ export default class Crop extends eui.Component {
}
this.cropMv && this.removeChild(this.cropMv) && (this.cropMv = null);
this.optionMv && this.removeChild(this.optionMv) && (this.optionMv = null);
let _name = '';
let upName = '';
if((petData[this.petId].type == 'plant' && this.state == 3)
|| (petData[this.petId].type == 'animal' && this.state == 4)
|| this.data.data.canGather) {
_name = 'up2';
upName = 'up2';
} else {
_name = 'up1';
upName = 'up1';
}
/// TODO 坑爹,1级展示未成熟,2级展示未成熟, 三级展示半成熟,只有可收取才展示成熟
let mvId = (this.state == 1) ? this.state : this.state - 1;
// console.log(this.data.data.canGather);
(this.data.data.canGather) ? mvId = (petData[this.petId].type == 'animal' ? 4 : 3) : mvId;
/// TODO 坑爹,1级展示未成熟,2级展示未成熟, 三级展示半成熟,只有可收取才展示成熟
loadSvga(getSvga(_name)).then( // 加载升级动画
(__mv: egret.MovieClip) => {
loadSvga(getSvga(upName)).then( // 加载升级动画
(upMv: egret.MovieClip) => {
loadSvga(getSvga(`${petData[this.petId].key}${mvId}_birth`)).then( // 加载出生动画
(_mv: egret.MovieClip) => {
__mv.gotoAndPlay(1, 1);
__mv.x = (_name == 'up2') ? 0 : 10;
__mv.y = (_name == 'up2') ? -35 : 20;
this.addChild(__mv);
__mv.addEventListener(egret.Event.COMPLETE, () => {
this.removeChild(__mv);
(birthMv: egret.MovieClip) => {
upMv.gotoAndPlay(1, 1);
upMv.x = (upName == 'up2') ? 0 : 10;
upMv.y = (upName == 'up2') ? -35 : 20;
this.addChild(upMv);
upMv.addEventListener(egret.Event.COMPLETE, () => {
this.removeChild(upMv);
}, this);
this.addChild(_mv);
this.addChild(birthMv);
let pos = (mvId == 3 && this.petId == 4) ? petData[this.petId]['catherPos'] : petData[this.petId]['pos'];
_mv.x = pos[0];
_mv.y = pos[1];
_mv.addEventListener(egret.Event.COMPLETE, () => {
_mv.stop();
birthMv.x = pos[0];
birthMv.y = pos[1];
birthMv.addEventListener(egret.Event.COMPLETE, () => {
birthMv.stop();
let name = `${petData[this.petId].key}${mvId}`;
loadSvga(getSvga(name)).then(
(mv: egret.MovieClip) => {
this.removeChild(_mv);
this.removeChild(birthMv);
this.addChild(mv);
this.cropMv = mv;
this.cropMv.x = pos[0];
this.cropMv.y = pos[1];
this.cropMv.pixelHitTest = true;
......@@ -489,8 +488,8 @@ export default class Crop extends eui.Component {
private addOption(name) {
this.optionMv && this.removeChild(this.optionMv) && (this.optionMv = null);
loadSvga(getSvga(name)).then(
(mv: egret.DisplayObject) => {
this.optionMv = mv;
(optionMv: egret.DisplayObject) => {
this.optionMv = optionMv;
this.addChild(this.optionMv);
this.optionMv.x = 80;
this.optionMv.y = -85;
......
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