Commit 7840f124 authored by shunx 马's avatar shunx 马

合并

parents f5a7032c 4445b545
...@@ -70,6 +70,7 @@ export class Main { ...@@ -70,6 +70,7 @@ export class Main {
console.log("初始化皮肤配置完成") console.log("初始化皮肤配置完成")
//加载通用资源 //加载通用资源
await RES.loadGroup("common"); await RES.loadGroup("common");
await RES.loadGroup("svga");
console.log("通用资源加载完成") console.log("通用资源加载完成")
//h5环境时,隐藏加载中 //h5环境时,隐藏加载中
if (FYGE.getEnv() == "web" && document.getElementById("__loading__")) document.getElementById("__loading__").style.display = "none"; 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
...@@ -46,7 +46,7 @@ export class RulePanel extends Panel { ...@@ -46,7 +46,7 @@ export class RulePanel extends Panel {
section.style.overflowY = "auto"; section.style.overflowY = "auto";
section.style.width = 432 + "px"; section.style.width = 432 + "px";
section.style.height = 492 + "px"; section.style.height = 492 + "px";
section.style.lineHeight = 48 + "px"; section.style.lineHeight = 36 + "px";
section.style.fontSize = this.ruleTxt.size + 'px'; section.style.fontSize = this.ruleTxt.size + 'px';
section.style.color = this.ruleTxt.fillColor; section.style.color = this.ruleTxt.fillColor;
section.style.whiteSpace = "pre-line"; section.style.whiteSpace = "pre-line";
......
...@@ -6,8 +6,13 @@ import getObject from "../common/getObject"; ...@@ -6,8 +6,13 @@ import getObject from "../common/getObject";
let section; let section;
export class CostPanel extends Panel { export class CostPanel extends Panel {
share_share_go(){ start(){
console.log('share_share_go'); super.start();
const cost = 1234567890;
getObject(this,'cost_tips').text = `消耗${cost}积分拆开1个盲盒`
}
cost_open(){
console.log('cost_open');
} }
get groupNames() { return ["cost"] } get groupNames() { return ["cost"] }
...@@ -22,11 +27,12 @@ export class CostPanel extends Panel { ...@@ -22,11 +27,12 @@ export class CostPanel extends Panel {
initEvents() { initEvents() {
super.initEvents(); super.initEvents();
// getObject(this, 'share_fail_btn').addEventListener(FYGE.MouseEvent.CLICK, this.share_share_go, this); getObject(this, 'cost_open').addEventListener(FYGE.MouseEvent.CLICK, this.cost_open, this);
} }
removeEvents() { removeEvents() {
super.removeEvents(); super.removeEvents();
// getObject(this, 'share_fail_btn').removeEventListener(FYGE.MouseEvent.CLICK, this.share_share_go, this); getObject(this, 'cost_open').removeEventListener(FYGE.MouseEvent.CLICK, this.cost_open, this);
} }
protected get closeBtns(): any[] { protected get closeBtns(): any[] {
......
import { RES } from "../../module/RES"; import { RES } from "../../module/RES";
import { Panel } from "../../module/views/Panel"; import { Panel } from "../../module/views/Panel";
import centerTextField from "../common/centerTextField"; import centerTextField from "../common/centerTextField";
import { createMask } from "../common/createMask";
import { getImage } from "../common/getImage";
import getObject from "../common/getObject"; import getObject from "../common/getObject";
let section; let section;
export class PrizePanel extends Panel { export class PrizePanel extends Panel {
share_share_go(){ start() {
console.log('share_share_go'); 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 groupNames() { return ["prize"] }
get skinName() { return "prize" } get skinName() { return "prize" }
prizeContainer: FYGE.Sprite;
initUi() { initUi() {
super.initUi(); super.initUi();
var skin = RES.getSkinDataByName(this.skinName); var skin = RES.getSkinDataByName(this.skinName);
this.position.set(skin.x, skin.y); 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() { initEvents() {
super.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() { removeEvents() {
super.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[] { protected get closeBtns(): any[] {
return [getObject(this,'prize_close')] return [getObject(this, 'prize_close')]
} }
} }
...@@ -31,8 +31,13 @@ export class IndexScene extends Scene { ...@@ -31,8 +31,13 @@ export class IndexScene extends Scene {
start() { start() {
super.start(); super.start();
<<<<<<< HEAD
this.getIndex(); this.getIndex();
// showPanel(SharePanel); // showPanel(SharePanel);
=======
showPanel(PrizePanel);
>>>>>>> 4445b545174f45bdb5de86ca86be78b8f149ecec
getObject(this,'index_sharetips').visible=false; getObject(this,'index_sharetips').visible=false;
this.initContainer(); this.initContainer();
this.initmask(); 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