Egret成语大挑战-游戏场景页逻辑(四)
/**
* 初始化 加载关卡信息
*/
class SceneGame extends eui.Component implements eui.UIComponent {
// 返回按钮
public btn_back:eui.Button;
// 问题图片
public img_question:eui.Image;
// win
public gp_win:eui.Group;
// 成语解释
public lab_cyjs:eui.Label;
// 成语出处
public lab_cycc:eui.Label;
// 元宝
public lab_yb:eui.Label;
// 下一题按钮
public btn_next:eui.Button;
// 答案
public gp_answer:eui.Group;
// 选字
public gp_words:eui.Group;
// 记录当前关卡
public cur_level:number;
private static shared: SceneGame;
public static getInstance() {
if (!SceneGame.shared) {
SceneGame.shared = new SceneGame();
}
return SceneGame.shared;
}
public constructor() {
super();
}
protected partAdded(partName: string, instance: any): void {
super.partAdded(partName, instance);
}
protected childrenCreated(): void {
super.childrenCreated();
this.init();
}
private init() {
this.btn_back.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTapBackBtn, this);
this.btn_next.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTapNext, this);
}
/**
* 初始化游戏场景
*/
public initLevelData(level: number) {
//记录当前关卡
this.cur_level = level;
// 获取本关卡的数据
let curret_levelData: LevelDataItem = LevelDataManager.getInstance().getLevelData(level);
// 设置问题图片
this.img_question.source = “resource/assets/data/” + curret_levelData.img;
// 设置问题字 先把自己关卡的成语(四个字)和混淆字(六个字)拼接起来
let words: string = curret_levelData.answer + curret_levelData.word;
//拼接20个字符
while (words.length == 10) {
let i = Math.floor(Math.random() * LevelDataManager.getInstance().totalLevels);
if (i != level) {
let random_levelData: LevelDataItem = LevelDataManager.getInstance().getLevelData(i);
words += (random_levelData.answer + random_levelData.word);
}
}
// 把words变成数组
let words_arr = words.split(“”);
// console.log(words_arr);
words_arr = this.randomList(words_arr);
// console.log(words_arr);
// 初始化单词组的文字,渲染并显示出来
for (let i: number = 0; i < this.gp_words.numChildren; i++) {
let gp_word_item = this.gp_words.getChildAt(i);
gp_word_item.setWordText(words_arr[i]);
gp_word_item.visible = true;
}
// 初始化问题组,清空组内数据
for (let i: number = 0; i < this.gp_answer.numChildren; i++) {
let gp_answer_item = this.gp_answer.getChildAt(i);
gp_answer_item.setSelectWord(null);
gp_answer_item.selected_word = null;
gp_answer_item.visible = true;
}
}
/**
* 返回按钮回调函数
*/
private onTapBackBtn() {
this.parent.addChild(SceneLevel.getInstance());
this.parent.removeChild(this);
}
/**
* 下一题按钮
*/
private onTapNext() {
// 先把游戏正解场景隐藏起来
this.gp_win.visible = false;
SceneLevel.getInstance().setMileStoneLevel(this.cur_level + 1);
// 重新初始化游戏场景
this.initLevelData(this.cur_level + 1);
}
//点击选择区域的文字
public onTapSelectWord(w: Word) {
SoundManage.getInstance().playTapWord();
let sel: AnswerWord = null;
for (let i: number = 0; i < this.gp_answer.numChildren; i++) {
let answer_word = this.gp_answer.getChildAt(i);
if (answer_word.getWordText() == “”) {
sel = answer_word;
break;
}
}
//找到空白的文字
if (sel) {
sel.setSelectWord(w);
}
//初始化文本内容并绘制内容
let answer_str: string = “”;
for (let i: number = 0; i < this.gp_answer.numChildren; i++) {
let gp_answer_item = this.gp_answer.getChildAt(i);
answer_str += gp_answer_item.getWordText();
}
//选项填满了,开始匹配json文件中的answer正确与否
if (answer_str.length == 4) {
if (answer_str == LevelDataManager.getInstance().getLevelData(this.cur_level).answer) {
SoundManage.getInstance().playRight();
this.showWin();
} else {
SoundManage.getInstance().playWrong();
}
}
}
private showWin() {
let data: LevelDataItem = LevelDataManager.getInstance().getLevelData(this.cur_level);
this.lab_cyjs.text = data.tip;
this.lab_cycc.text = data.content;
this.gp_win.visible = true;
}
/**
* 对一个数组进行随机排列
*/
private randomList(arr: string[]): string[] {
var array = [];
while (arr.length > 0) {
var i = Math.floor(Math.random() * arr.length)
// array.push(arr.splice(i,1)[0]);
array.push(arr[i]);
arr.splice(i, 1);
}
return array;
}
}

Um das Beste aus Ihrer Zeit mit Online Casino Demos herauszuholen, sollten Sie regelmäßig
spielen und sich spezifische Ziele setzen. Im Folgenden finden Sie
eine detaillierte Übersicht über Strategien und
Ansätze, die Ihnen helfen, Ihre Zeit mit Demospielen optimal zu nutzen. Diese Reflexion hilft
Ihnen nicht nur dabei, Ihre Fähigkeiten zu verbessern, sondern auch bei der Entscheidung für zukünftige Echtgeldspiele.
Jetzt sind Sie bereit zu spielen!
Die Dauer der Aktivierung des Freispiels, die Dauer des
Freispiels und die Dauer des Freispielergebnisses betragen 7 Tage.
In diesem Fall gilt die 3-fache Einzahlungsanforderung nicht und sowohl die Gewinne als auch die Einzahlung können ohne Durchspielen abgehoben werden. Der dritte Einzahlungsbonus beträgt 70% bis zu 600 € + 150 Freispiele.
References:
https://online-spielhallen.de/bruno-casino-auszahlung-ihr-umfassender-leitfaden/
On the official SkyCrown casino website, you will find a special section which is called “Promotions”.
They will allow you to have more money for gambling and betting.
And every gambling company also understands this point.
Every gambler wants to have additional opportunities for gambling and betting.
You can also find all the necessary information about them on the SkyCrown casino’s
official website. That is why many gamblers choose this casino.
Skycrown Casino offers over 30 payment methods, ensuring flexibility and convenience for players.
Whether you’re a fan of classic casino titles or searching for unique gameplay mechanics, Skycrown has something for everyone.
With the first 5 deposits, players can receive up to A$4,000
and 400 Free Spins. Offers competitive bonuses and lightning-fast cryptocurrency payouts.
A good casino responds fast, solves issues clearly, and provides transparent bonus terms.
Australians love gaming on the go, so make sure the casino is mobile-friendly.
You can join tables instantly, interact with dealers and players,
and even tip if you’re feeling generous (or lucky).
Everything loads fast, whether you’re on desktop or mobile.
You’ll never run out of fresh spins or bonus rounds.
If you’re from skycrown australia and love spinning reels, you’re in luck.
References:
https://blackcoin.co/casino-weather-your-comprehensive-guide/
RocketPlay Casino supports various deposit and withdrawal options, including credit cards,
e-wallets, and cryptocurrencies. The casino frequently updates
its promotional calendar, ensuring continuous rewards for regular players.
The VIP program rewards loyal players with exclusive benefits, such as higher withdrawal limits,
personalized promotions, and dedicated customer support.
In addition to welcome bonuses, RocketPlay Casino features weekly promotions,
free spin rewards, cashback offers, and high-stakes tournaments.
A second deposit bonus offers a 200% match up to AUD 1,000, requiring a
minimum deposit of AUD 50.
Regular promotions and a tiered VIP program reward loyalty with cashback, bonuses,
and exclusive perks. New players benefit from a generous
welcome package of up to $2,000 plus 100 free spins. Some games don’t fully count toward
wagering, which can extend the process. Responsible gambling tools and AI-driven monitoring further show a genuine focus on player safety.
At our casino, players can find a wide selection of
crypto games and get exclusive bonuses for payments in crypto.
For fans of live dealer online casino Australia games,
we offer an immersive experience with professional dealers and authentic casino atmosphere.
As one of the best Aussie online casinos, we offer multiple payment methods
to start playing for real money and claim generous bonuses at start.
New players can also take advantage of exclusive welcome bonuses that match deposits, providing additional funds and potential free spins to enhance their
overall gaming experience.
References:
https://blackcoin.co/play-free-slots-%f0%9f%8e%b0-browse-19430-online-slot-games/
paypal casino online
References:
starlikekorea.com
online betting with paypal winnersbet
References:
https://www.lms.pidernegi.org/employer/paypal-casinos-2025-best-paypal-slot-sites-in-the-uk/