| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265 |
- 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
- */
|