Commit 4445b545 authored by wildfirecode13's avatar wildfirecode13

update

parent ed4651d3
......@@ -70,6 +70,7 @@ export class Main {
console.log("初始化皮肤配置完成")
//加载通用资源
await RES.loadGroup("common");
await RES.loadGroup("svga");
console.log("通用资源加载完成")
//h5环境时,隐藏加载中
if (FYGE.getEnv() == "web" && document.getElementById("__loading__")) document.getElementById("__loading__").style.display = "none";
......
export const createMask = (w, h,r, p) => {
const m = new FYGE.Shape();
m.beginFill(1, 1);
m.drawRoundedRect(0, 0, w, h,r,r,r,r);
m.endFill();
p && p.addChild(m);
return m
}
\ No newline at end of file
import { createMask } from "./createMask";
export const getImage = (url, parent?, w?, h? ,rad?): Promise<FYGE.Sprite> => {
return new Promise((r) => {
FYGE.GlobalLoader.loadImage((success, image) => {
if (success) {
const c = new FYGE.Sprite;
if (parent) parent.addChild(c);
const texture = FYGE.Texture.from(image);
const pic = new FYGE.Sprite();
pic.texture = texture;
pic.width=w;
pic.height=h;
c.addChild(pic);
const m = createMask(w, h, rad, c);
c.mask = m;
r(c);
}
}, url);
});
}
\ No newline at end of file
import { RES } from "../../module/RES";
import { Panel } from "../../module/views/Panel";
import centerTextField from "../common/centerTextField";
import { createMask } from "../common/createMask";
import { getImage } from "../common/getImage";
import getObject from "../common/getObject";
let section;
export class PrizePanel extends Panel {
share_share_go(){
console.log('share_share_go');
start() {
super.start();
const prizename = '活动活动黑乎乎的后sdfsdffsdfsdff端df和';
const prizeimg = 'https://yun.duiba.com.cn/db_games/sxbank.png';
const size = 164;
getImage(prizeimg, this.prizeContainer, size, size, 10);
getObject(this, 'prize_name').text = prizename;
}
click_prize_open() {
console.log('click_prize_open');
}
get groupNames() { return ["prize"] }
get skinName() { return "prize" }
prizeContainer: FYGE.Sprite;
initUi() {
super.initUi();
var skin = RES.getSkinDataByName(this.skinName);
this.position.set(skin.x, skin.y);
centerTextField(getObject(this,'prize_name'),731);
centerTextField(getObject(this, 'prize_name'), 731);
centerTextField(getObject(this, 'prize_tips'), 731);
const container = this.prizeContainer = this.addChild(new FYGE.Sprite);
container.position.set(286, 276);
window['q'] = container;
}
initEvents() {
super.initEvents();
// getObject(this, 'share_fail_btn').addEventListener(FYGE.MouseEvent.CLICK, this.share_share_go, this);
getObject(this, 'prize_open').addEventListener(FYGE.MouseEvent.CLICK, this.click_prize_open, this);
}
removeEvents() {
super.removeEvents();
// getObject(this, 'share_fail_btn').removeEventListener(FYGE.MouseEvent.CLICK, this.share_share_go, this);
getObject(this, 'prize_open').removeEventListener(FYGE.MouseEvent.CLICK, this.click_prize_open, this);
}
protected get closeBtns(): any[] {
return [getObject(this,'prize_close')]
return [getObject(this, 'prize_close')]
}
}
......@@ -30,7 +30,7 @@ export class IndexScene extends Scene {
start() {
super.start();
showPanel(SharePanel);
showPanel(PrizePanel);
getObject(this,'index_sharetips').visible=false;
this.initContainer();
this.initmask();
......
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