Commit be550940 authored by 王勇霞's avatar 王勇霞

移除改成重绘

parent aece1a34
......@@ -892,5 +892,5 @@ export const ResJson = {
}
}
],
"path": "https://yun.duiba.com.cn/db_games/activity/template/1669191757/resource/"
"path": "https://yun.duiba.com.cn/db_games/activity/template/1669275926/resource/"
}
\ No newline at end of file
......@@ -14,6 +14,7 @@ export class Game extends Scene {
needGuide = false;
uiConfig = defaultUI;
mainBg;
backBtn: FYGE.Sprite;
ruleBtn: FYGE.Sprite;
startBtn: FYGE.Sprite;
......@@ -31,22 +32,25 @@ export class Game extends Scene {
guideCardList = []; // 新手引导中的卡片列表
cardList = []; // 游戏中的卡片列表
guideStep = 1; // 引导步数
uiList = []; // 用于重新绘制
initUi() {
this.needGuide = Tools.gameData.needGuide; // 模板中传过来的
this.uiConfig = Tools.gameData.uiConfig; // 模板中传过来的UI
UI.Sp(this, this.uiConfig.mainBg, 0, 0);
this.mainBg = UI.Sp(this, this.uiConfig.mainBg, 0, 0);
this.backBtn = UI.Sp(this, this.uiConfig.serviceBtn, 0, 274);
this.ruleBtn = UI.Sp(this, this.uiConfig.ruleBtn, 608, 274);
this.startBtn = UI.Sp(this, this.uiConfig.mainBtn, 224, 1231);
// 遍历生成底图
this.uiList = []
for (let i = 0; i < 8; i++) {
UI.Sp(
let cardUi = UI.Sp(
this,
this.uiConfig["cardFontBg" + ((i + 1) % 4 === 0 ? 4 : (i + 1) % 4)],
Math.floor(i % 4) * 168 + 50,
Math.floor(i / 4) * 360 - 15 + 538
);
this.uiList.push(cardUi)
}
// 如果是新手引导阶段, 有手势引导
if (this.needGuide) {
......@@ -199,9 +203,20 @@ export class Game extends Scene {
this.removeChild(this.gamelayer);
}
editConfigImg(e) {
Tools.gameData.uiConfig = e.data.config;
this.removeAllChildren();
this.initUi();
this.uiConfig = e.data.config;
this.upDateUI();
}
upDateUI() {
this.mainBg.texture = FYGE.Texture.fromUrl(this.uiConfig.mainBg);
this.backBtn.texture = FYGE.Texture.fromUrl(this.uiConfig.serviceBtn);
this.ruleBtn.texture = FYGE.Texture.fromUrl(this.uiConfig.ruleBtn);
this.startBtn.texture = FYGE.Texture.fromUrl(this.uiConfig.mainBtn);
this.uiList.map((item, i) => {
item.texture = FYGE.Texture.fromUrl(
this.uiConfig["cardFontBg" + ((i + 1) % 4 === 0 ? 4 : (i + 1) % 4)]
)
});
}
initEvents() {
super.initEvents();
......
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