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

移除改成重绘

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