|
@@ -12,43 +12,44 @@ const { ccclass, property } = _decorator;
|
|
|
|
|
|
@ccclass('view_game_play_ji_yi_li')
|
|
|
export class view_game_play_ji_yi_li extends base_view {
|
|
|
- @property(Node) img_1:Node;
|
|
|
- @property(Node) bottom_node:Node;
|
|
|
- @property(Node) question_node:Node;
|
|
|
+ @property(Node) img_1: Node;
|
|
|
+ @property(Node) bottom_node: Node;
|
|
|
+ @property(Node) question_node: Node;
|
|
|
protected initUI(): void {
|
|
|
}
|
|
|
|
|
|
public initView(data: any, isUpdate?: boolean): void {
|
|
|
- this.m_data = data;
|
|
|
+ this.m_data = data;
|
|
|
let self = this;
|
|
|
this.categoryid = config.PLAY_TYPE.JI_YI_LI
|
|
|
let levels_item = gameManager.get_cur_level_by_categoryid(this.categoryid);
|
|
|
- let call_back = ()=>{
|
|
|
+ let call_back = () => {
|
|
|
self.initAnswerView()
|
|
|
}
|
|
|
- tools.loadRemoteImgByCategoryid(this.categoryid,levels_item.level,this.m_data.img,(sf)=>{
|
|
|
- self.img_1.getComponent(Sprite).spriteFrame = sf;
|
|
|
- call_back();
|
|
|
+ tools.loadRemoteImgByCategoryid(this.categoryid, levels_item.level, this.m_data.img, (sf) => {
|
|
|
+ self.img_1.getComponent(Sprite).spriteFrame = sf;
|
|
|
+ call_back();
|
|
|
+ })
|
|
|
+ gameManager.loadPlayMusicByCategoryId(this.categoryid, () => {
|
|
|
+ gameManager.playGamePlayMusicByCategoryId(this.categoryid, true);
|
|
|
})
|
|
|
- gameManager.loadPlayMusicByCategoryId(this.categoryid,()=>{
|
|
|
- gameManager.playGamePlayMusicByCategoryId(this.categoryid,true);
|
|
|
- })
|
|
|
}
|
|
|
|
|
|
- showStep1(){
|
|
|
+ showStep1() {
|
|
|
this.img_1.active = true;
|
|
|
this.question_node.active = false;
|
|
|
this.lab_title.active = true;
|
|
|
+ this.bottom_node.active = true;
|
|
|
}
|
|
|
- showStep2(){
|
|
|
+ showStep2() {
|
|
|
this.img_1.active = false;
|
|
|
this.question_node.active = true;
|
|
|
this.lab_title.active = false;
|
|
|
this.bottom_node.active = false;
|
|
|
}
|
|
|
- initAnswerView(){
|
|
|
+ initAnswerView() {
|
|
|
this.showStep1()
|
|
|
- let index = Util.getRandomInt(0,this.m_data.memory_problem.length-1);
|
|
|
+ let index = Util.getRandomInt(0, this.m_data.memory_problem.length - 1);
|
|
|
this.isShowWin = false;
|
|
|
this.old_coin_number = gameManager.get_user_coin();
|
|
|
this.lab_coin.getComponent(Label).string = Util.coinNumberToK(this.old_coin_number);
|
|
@@ -56,14 +57,14 @@ export class view_game_play_ji_yi_li extends base_view {
|
|
|
let problem = this.m_data.memory_problem[index];
|
|
|
let answer = this.m_data.memory_answer[index];
|
|
|
let correct_answer = this.m_data.memory_correct_answer[index];
|
|
|
- this.question_node.getComponent(question).initView(problem,answer,correct_answer,this.on_question_item_click.bind(this))
|
|
|
+ this.question_node.getComponent(question).initView(problem, answer, correct_answer, this.on_question_item_click.bind(this))
|
|
|
this.start_time_count(this.m_data.s_time)
|
|
|
}
|
|
|
|
|
|
- on_question_item_click(isRight:boolean){
|
|
|
- if(isRight){
|
|
|
+ on_question_item_click(isRight: boolean) {
|
|
|
+ if (isRight) {
|
|
|
this.showWin()
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
this.showFail()
|
|
|
}
|
|
|
}
|
|
@@ -75,26 +76,26 @@ export class view_game_play_ji_yi_li extends base_view {
|
|
|
protected onFailReStartClick(fail_view: fail): void {
|
|
|
gameManager.playBtnSound()
|
|
|
let self = this;
|
|
|
- if(this.m_data.ads_restart==1){
|
|
|
- SdkUtil.showVideoAd(config.rewardVideoAdUnitId.Resume_AdUnitId,(res)=>{
|
|
|
- if(res.isEnded){
|
|
|
- self.initAnswerView()
|
|
|
- fail_view.close()
|
|
|
- }
|
|
|
- // 统计-激励视频广告
|
|
|
- let collect_data = StatisticsManager.get_collect_data(this.categoryid, this.m_data.id, 0, res, config.STATISTICS_ACTION_TYPE.CHONG_XIN_KAI_SHI)
|
|
|
- StatisticsManager.request_collect_rewardVideoData(collect_data)
|
|
|
- })
|
|
|
- }else{
|
|
|
- fail_view.close()
|
|
|
- self.initAnswerView()
|
|
|
+ if (this.m_data.ads_restart == 1) {
|
|
|
+ SdkUtil.showVideoAd(config.rewardVideoAdUnitId.Resume_AdUnitId, (res) => {
|
|
|
+ if (res.isEnded) {
|
|
|
+ self.initAnswerView()
|
|
|
+ fail_view.close()
|
|
|
+ }
|
|
|
+ // 统计-激励视频广告
|
|
|
+ let collect_data = StatisticsManager.get_collect_data(this.categoryid, this.m_data.id, 0, res, config.STATISTICS_ACTION_TYPE.CHONG_XIN_KAI_SHI)
|
|
|
+ StatisticsManager.request_collect_rewardVideoData(collect_data)
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ fail_view.close()
|
|
|
+ self.initAnswerView()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
protected onFailQuitClick(fail_view: fail): void {
|
|
|
- gameManager.playBtnSound()
|
|
|
- fail_view.close()
|
|
|
- this.close()
|
|
|
+ gameManager.playBtnSound()
|
|
|
+ fail_view.close()
|
|
|
+ this.close()
|
|
|
}
|
|
|
|
|
|
}
|