import { RichData } from "../datas/RichData"; import AdM from "../manager/AdM"; import GameM, { AUDIO_TYPE } from "../manager/GameM"; import GuideMng from "../manager/GuideMng"; import BasePanel from "../uiFrames/BasePanel"; import EffectNode from "./EffectNode"; const { ccclass, property } = cc._decorator; @ccclass export default class RichBookPanel extends BasePanel { @property(cc.Node) panelNode: cc.Node = null; @property(cc.Node) panel_ask: cc.Node = null; @property(cc.Node) panel_result: cc.Node = null; @property(cc.Node) panel_result_panelNode: cc.Node = null; @property(cc.Node) panel_result_suc: cc.Node = null; @property(cc.Node) panel_result_fail: cc.Node = null; @property(cc.Node) panel_analysis: cc.Node = null; @property(cc.Label) txtSubject: cc.Label = null; @property(cc.Toggle) tog1: cc.Toggle = null; @property(cc.Toggle) tog2: cc.Toggle = null; @property(cc.Label) txtAnswer1: cc.Label = null; @property(cc.Label) txtAnswer2: cc.Label = null; @property(cc.Node) signSuc: cc.Node = null; @property(cc.Label) txtSucReward: cc.Label = null; @property(cc.Node) signFail: cc.Node = null; @property(cc.Label) txtFailReward: cc.Label = null; @property(cc.Label) txtResultSub: cc.Label = null; @property(cc.Label) txtResultAns: cc.Label = null; @property(cc.Label) txtAnalysis: cc.Label = null; /**题目*/ question: any = null; /* answerFour: "" answerOne: "悟空" answerRemarkFour: "" answerRemarkOne: "" answerRemarkThree: "" answerRemarkTwo: "" answerThree: "" answerTwo: "悟净" appid: "wxef592f91d2d125f5" id: 97 remark: "" standardAnswer: 2 标准答案 answerTwo是正确答案 title: "沙和尚,法号____" type: 1 */ private isAnswerOk: boolean = false; OnEnter(question: any) { this.panel_ask.active = true; this.panel_result.active = false; this.question = question; this.txtSubject.string = question.title; this.txtAnswer1.string = question.answerOne; this.txtAnswer2.string = question.answerTwo; this.tog1.isChecked = false; this.tog2.isChecked = false; this.txtResultSub.string = question.title; //this.txtAnswer1.node.color = cc.color(255, 255, 255, 255); //this.txtAnswer2.node.color = cc.color(255, 255, 255, 255); this.txtAnalysis.string = question.remark; this.isCanClick = true; this.panelNode.scale = 0; this.node.active = true; cc.tween(this.panelNode).to(0.2, { scale: 1 }, { easing: "backOut" }) .call(() => { }) .start(); } OnExit() { this.node.active = false; this.panel_result.active = false; } AnswerSure() { this.signSuc.active = false; this.isAnswerOk = true; this.panel_result_panelNode.scale = 0; this.panel_result.active = true; cc.tween(this.panel_result_panelNode).to(0.2, { scale: 1 }, { easing: "backOut" }) .call(() => { }) .start(); this.txtSucReward.string = "x" + (RichData.Ins.doubleRemain > 0 ? 6 : 3); this.panel_result_suc.active = true; this.panel_result_fail.active = false; GameM.audioM.playEffect(AUDIO_TYPE.sutraanswersure); this.scheduleOnce(() => { this.signSuc.scale = 10; this.signSuc.active = true; cc.tween(this.signSuc).to(0.3, { scale: 1 }).start(); }, 0.5); } AnswerFail() { this.signFail.active = false; this.isAnswerOk = false; this.panel_result_panelNode.scale = 0; this.panel_result.active = true; cc.tween(this.panel_result_panelNode).to(0.2, { scale: 1 }, { easing: "backOut" }) .call(() => { }) .start(); this.txtFailReward.string = "x" + (RichData.Ins.doubleRemain > 0 ? 2 : 1); this.panel_result_suc.active = false; this.panel_result_fail.active = true; GameM.audioM.playEffect(AUDIO_TYPE.sutraanswererror); this.scheduleOnce(() => { this.signFail.scale = 10; this.signFail.active = true; cc.tween(this.signFail).to(0.3, { scale: 1 }).start(); }, 0.5); } Click_Tog1() { //if (this.tog1.isChecked) // this.txtAnswer1.node.color = cc.color(92, 20, 20, 255); //else // this.txtAnswer1.node.color = cc.color(255, 255, 255, 255); //this.txtAnswer2.node.color = cc.color(255, 255, 255, 255); GameM.audioM.playEffect(AUDIO_TYPE.button); } Click_Tog2() { //if (this.tog2.isChecked) // this.txtAnswer2.node.color = cc.color(92, 20, 20, 255); //else // this.txtAnswer2.node.color = cc.color(255, 255, 255, 255); //this.txtAnswer1.node.color = cc.color(255, 255, 255, 255); GameM.audioM.playEffect(AUDIO_TYPE.button); } Click_CommitBtn() { if (!this.tog1.isChecked && !this.tog2.isChecked) { EffectNode.instance.PlayTip("请选择你的答案"); return; } this.txtResultAns.string = (this.question.standardAnswer == 1 ? this.question.answerOne : this.question.answerTwo) + "(我的答案:" + (this.tog1.isChecked ? this.question.answerOne : this.question.answerTwo) + ")"; if (this.question.standardAnswer == 1) { if (this.tog1.isChecked) { this.AnswerSure(); } else { this.AnswerFail(); } } else if (this.question.standardAnswer == 2) { if (this.tog2.isChecked) { this.AnswerSure(); } else { this.AnswerFail(); } } GameM.audioM.playEffect(AUDIO_TYPE.button); } Click_CloseBtn() { if (!this.isCanClick) return; this.isCanClick = false; this.OnExit(); GameM.audioM.playEffect(AUDIO_TYPE.button); } isCanClick = true; Click_GetBtn() { if (!this.isCanClick) return; this.isCanClick = false; this.scheduleOnce(() => { this.OnExit(); }, 0.3); if (this.isAnswerOk) { if (RichData.Ins.doubleRemain > 0) { RichData.Ins.UpdateItemCard(0, 0, 0, 0, 1, 3 * 2, -1, () => { RichData.Ins.PlayParticleEft(30004, 5, this.node); }, false); } else { RichData.Ins.UpdateItemCard(0, 0, 0, 0, 1, 3, 0, () => { RichData.Ins.PlayParticleEft(30004, 5, this.node); }, false); } AdM.onSendEvent('Qujing_Questions_True', '取经答题正确', "qujing"); } else { if (RichData.Ins.doubleRemain > 0) { RichData.Ins.UpdateItemCard(0, 0, 0, 0, 1, 1 * 2, -1, () => { RichData.Ins.PlayParticleEft(30004, 5, this.node); }, false); } else { RichData.Ins.UpdateItemCard(0, 0, 0, 0, 1, 1, 0, () => { RichData.Ins.PlayParticleEft(30004, 5, this.node); }, false); } AdM.onSendEvent('Qujing_Questions_False', '取经答题错误', "qujing"); } setTimeout(() => { //引导取经 大富翁 GuideMng.Ins.CheckRichGuide23(); }, 500); GameM.audioM.playEffect(AUDIO_TYPE.button); AdM.onSendEvent('Qujing_GetScriptures', '取经获得经书', "qujing"); } Click_AnalysisBtn() { this.panel_analysis.active = true; } Click_AnalysisCloseBtn() { this.panel_analysis.active = false; } } /* IT 2.35 Program Files 3.38 Program Files 86 4.76 ProgramData 1.42 Windows 23.7 Windows.old 34.7 (占用 28.9) 用户 31.5 (占用 25.9) hiberfil.sys 6.38 pagefile.sys 10 */