Commit b06a2644 authored by wildfirecode13's avatar wildfirecode13

u

parent 73ce2275
...@@ -4,10 +4,28 @@ import { Panel } from "../../module/views/Panel"; ...@@ -4,10 +4,28 @@ import { Panel } from "../../module/views/Panel";
import getObject from "../common/getObject"; import getObject from "../common/getObject";
import { ProgressBarS } from "../common/ProgressBarS"; import { ProgressBarS } from "../common/ProgressBarS";
import { showShareMask } from "../common/ShareMask"; import { showShareMask } from "../common/ShareMask";
import { MONEY_PERCENT } from "../datas"; import { MAX_MONEY, MONEY_PERCENT } from "../datas";
import { IndexScene } from "../scenes/IndexScene"; import { IndexScene } from "../scenes/IndexScene";
import updateShareFunc from "../share"; import updateShareFunc from "../share";
import { getPxTokenSave, sendWebNet, WebNetName } from "../WebNet"; import { getPxTokenSave, sendWebNet, WebNetName } from "../WebNet";
const createMask = (w, h) => {
const s = new FYGE.Shape();
s.beginFill(0, 1);
s.drawRect(0, 0, w, h);
s.endFill();
return s
}
const cloneTextField = (prize_tips2) => {
const tf = new FYGE.TextField();
tf.font = prize_tips2.font;
tf.size = prize_tips2.size;
tf.fillColor = prize_tips2.fillColor;
tf.text = prize_tips2.text;
return tf;
}
export class PrizePanel extends Panel { export class PrizePanel extends Panel {
amountTxt: FYGE.TextField; amountTxt: FYGE.TextField;
percentTxt: FYGE.TextField; percentTxt: FYGE.TextField;
...@@ -26,7 +44,7 @@ export class PrizePanel extends Panel { ...@@ -26,7 +44,7 @@ export class PrizePanel extends Panel {
.to({ scaleX: 1, scaleY: 1, x: skin.x, y: skin.y }, 300, FYGE.Ease.getBackOut(2)) .to({ scaleX: 1, scaleY: 1, x: skin.x, y: skin.y }, 300, FYGE.Ease.getBackOut(2))
.call(() => { .call(() => {
this.isShowing = false; this.isShowing = false;
}) });
} }
initUi() { initUi() {
...@@ -44,6 +62,11 @@ export class PrizePanel extends Panel { ...@@ -44,6 +62,11 @@ export class PrizePanel extends Panel {
async start(data) { async start(data) {
super.start(); super.start();
const prize_title2 = getObject(this,'prize_title2');
prize_title2.visible=false
const index = this.getChildIndex(prize_title2);
const svga = this.addChildAt(new FYGE.MovieClip(RES.getRes('prize.svga')),index);
svga.position.set(598/2-500/2,-100);
const prize_tips1 = getObject(this, 'prize_tips1'); const prize_tips1 = getObject(this, 'prize_tips1');
const prize_tips2 = getObject(this, 'prize_tips2'); const prize_tips2 = getObject(this, 'prize_tips2');
const prize_tip3 = getObject(this, 'prize_tip3'); const prize_tip3 = getObject(this, 'prize_tip3');
...@@ -55,26 +78,49 @@ export class PrizePanel extends Panel { ...@@ -55,26 +78,49 @@ export class PrizePanel extends Panel {
prize_tip3.textWidth = 595; prize_tip3.textWidth = 595;
prize_tip3.x = 0; prize_tip3.x = 0;
prize_tip3.textAlign = 'center'; prize_tip3.textAlign = 'center';
prize_tip3.text = `${data}/1000000`; prize_tip3.text = `${data}/${MAX_MONEY}`;
let percent = MONEY_PERCENT; let percent = MONEY_PERCENT;
if (data / 1000000 > percent) { if (data / MAX_MONEY > percent) {
percent = data / 1000000; percent = data / MAX_MONEY;
} }
const progressBar = new ProgressBarS(getObject(this, 'prize_progress')); const progressBar = new ProgressBarS(getObject(this, 'prize_progress'));
progressBar.value = percent; // progressBar.value = percent;
const aniWrapper = new FYGE.Sprite();
aniWrapper.position.set(prize_tips2.x, prize_tips2.y);
const mask1 = createMask(prize_tips2.textWidth, prize_tips2.textHeight);
aniWrapper.addChild(mask1);
aniWrapper.mask = mask1;
this.addChild(aniWrapper);
const textWrapper = new FYGE.Sprite();
aniWrapper.addChild(textWrapper);
for (let i = 2; i <= 9; i++) {
const tf = cloneTextField(prize_tips2);
tf.text = i * Math.pow(10,data.toString().length-1) + '';
tf.y = prize_tips2.textHeight * (i - 1);
console.log(tf.text)
textWrapper.addChild(tf);
}
textWrapper.addChild(prize_tips2);
prize_tips2.position.set(0, 0);
textWrapper.y = -prize_tips2.textHeight * 9;
FYGE.Tween.get(textWrapper).to({ y: 0 }, 700, FYGE.Ease.quadOut).call(()=>{
const __tmp__ = { a: 0 };
FYGE.Tween.get(__tmp__, {
loop: false, onChange: (param) => {
progressBar.value =percent*__tmp__.a;
}
}).to({ a: 1 }, 300)
});
getPxTokenSave().then(token => { getPxTokenSave().then(token => {
sendWebNet(WebNetName.createItem, { token: token }).then(createItemResult => { sendWebNet(WebNetName.createItem, { token: token }).then(createItemResult => {
updateShareFunc('inPrizePanel', createItemResult.data) updateShareFunc('inPrizePanel', createItemResult.data)
}); });
}) });
getObject(this, 'prize_close').addEventListener(FYGE.MouseEvent.CLICK, () => {
console.log('123')
}, this);
} }
hidePanel() { hidePanel() {
......
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