You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
250 lines
9.0 KiB
250 lines
9.0 KiB
// Learn TypeScript:
|
|
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
|
|
// Learn Attribute:
|
|
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
|
|
// Learn life-cycle callbacks:
|
|
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
|
|
|
|
import { ryw_Event } from "../../FrameWork/Event/EventEnum";
|
|
import EventMgr from "../../FrameWork/Event/EventMgr";
|
|
import GameReport from "../../FrameWork/Report/ZyZyReport";
|
|
import User from "../../FrameWork/User/User";
|
|
import AppPlatform from "../../FrameWork/Util/AppPlatform";
|
|
import Common from "../../FrameWork/Util/Common";
|
|
import Common5 from "../../Platform/th/Common5";
|
|
import TaskManager from "../../Scripts/JuQingChat/TaskManager";
|
|
import Game from "../../Scripts/WenZiRes/ui/Game";
|
|
|
|
|
|
const { ccclass, property } = cc._decorator;
|
|
|
|
@ccclass
|
|
export default class tishi extends cc.Component {
|
|
|
|
|
|
@property(cc.Node)
|
|
answerBtnNode: cc.Node = null;
|
|
|
|
@property(cc.Node)
|
|
answerNode: cc.Node = null;
|
|
@property(cc.Node)
|
|
guizetishiNode: cc.Node = null;
|
|
|
|
@property(cc.Node)
|
|
tipNode: cc.Node = null;
|
|
|
|
@property(cc.Label)
|
|
tipLabe: cc.Label = null;
|
|
@property(cc.Label)
|
|
answerLabel: cc.Label = null;
|
|
@property(cc.Label)
|
|
guizetishiLabel: cc.Label = null;
|
|
@property(cc.Label)
|
|
newTipSpeLabel: cc.Label = null;
|
|
@property(cc.Label)
|
|
newTipNormalLabel: cc.Label = null;
|
|
@property(cc.Node)
|
|
newTipNode: cc.Node = null;
|
|
@property(cc.Node)
|
|
newTipBtnNode: cc.Node = null;
|
|
@property(cc.Node)
|
|
newTipContentNode: cc.Node = null;
|
|
@property(cc.Node)
|
|
newTipLabel: cc.Node = null;
|
|
@property(cc.Node)
|
|
imganswerNode: cc.Node = null;
|
|
@property(cc.Sprite)
|
|
answerImg: cc.Sprite = null;
|
|
|
|
|
|
// LIFE-CYCLE CALLBACKS:
|
|
|
|
// onLoad () {}
|
|
curNode = null
|
|
curData = null
|
|
|
|
subLevel = 0
|
|
SpeTip: string;
|
|
start() {
|
|
this.initText();
|
|
this.refBtnStat();
|
|
EventMgr.onEvent_custom(ryw_Event.finish_game, () => {
|
|
this.node.removeFromParent();
|
|
this.node.destroy();
|
|
}, this)
|
|
}
|
|
refBtnStat() {
|
|
let answer = User.getUnlockWordgameAnswer(50);
|
|
let answerIndex = answer[this.subLevel];
|
|
if (answerIndex == 1) {
|
|
this.answerBtnNode.active = true;
|
|
this.answerNode.active = false;
|
|
this.guizetishiNode.active = false;
|
|
this.imganswerNode.active = false;
|
|
this.newTipNode.active = false;
|
|
this.tipNode.active = true;
|
|
}
|
|
else if (answerIndex == 2) {
|
|
this.imganswerNode.active = false;
|
|
this.answerNode.active = false;
|
|
this.guizetishiNode.active = false;
|
|
this.newTipNode.active = true;
|
|
this.tipNode.active = false;
|
|
}
|
|
}
|
|
answerAd() {
|
|
let tab = {
|
|
onClose: (finish) => {
|
|
if (finish) {
|
|
User.setShowAdNum(User.getShowAdNum() + 1)
|
|
Common5.ReportDY("inLevel", `任务${TaskManager.getCurUnLockMainTaskId()}-AD-救助美女答案`)
|
|
let bundle = 'jiuzhumeinv'
|
|
if (bundle.includes('Level')) {
|
|
GameReport.ADReport("救助美女" + '答案', 1, "失物招领")
|
|
Common5.ReportDY("inLevel", '失物招领-AD-答案')
|
|
} else {
|
|
GameReport.ADReport("救助美女" + '答案', 1, "总裁训练营")
|
|
Common5.ReportDY("inLevel", '总裁训练营-AD-答案')
|
|
}
|
|
|
|
User.unlockWordgameAnswer(50, this.subLevel, 2);
|
|
this.refBtnStat();
|
|
}
|
|
else {
|
|
let bundle = 'jiuzhumeinv'
|
|
if (bundle.includes('Level')) {
|
|
GameReport.ADReport("救助美女" + '答案', 0, "失物招领")
|
|
} else {
|
|
GameReport.ADReport("救助美女" + '答案', 0, "总裁训练营")
|
|
}
|
|
Common5.showTips_custom("广告未观看完");
|
|
}
|
|
}, onFailed: () => {
|
|
}
|
|
}
|
|
AppPlatform.playVideo_custom(tab)
|
|
}
|
|
initText() {
|
|
if (Common.GameSubTipConfigs) {
|
|
let tip = Common.GameSubTipConfigs[this.subLevel];
|
|
if (tip) {
|
|
this.tipLabe.string = tip;
|
|
}
|
|
let answer = User.getUnlockWordgameAnswer(50);
|
|
let tipIndex = Common.GameSubTipConfigs.length - 1;
|
|
if (answer) {
|
|
// this.newTipNormalLabel.string = "";
|
|
let allUnlock = true;
|
|
this.newTipContentNode.removeAllChildren();
|
|
for (let i = 0; i < Common.GameSubTipConfigs.length; i++) {
|
|
let numStr = (i + 1).toString();
|
|
let tmpStr = "";
|
|
let tmpNode = cc.instantiate(this.newTipLabel);
|
|
if (i + 1 < 10) {
|
|
numStr = "0" + numStr;
|
|
}
|
|
let answerIndex = answer[i];
|
|
if (answerIndex == 2) {
|
|
tmpStr = numStr + ":" + Common.GameSubTipConfigs[i];
|
|
}
|
|
else {
|
|
tmpStr = numStr + ":未获得";
|
|
allUnlock = false;
|
|
}
|
|
// if (i < Common.GameSubTipConfigs.length-1){
|
|
// this.newTipNormalLabel.string += "\r\n";
|
|
// }
|
|
tmpNode.getComponent(cc.Label).string = tmpStr;
|
|
this.newTipContentNode.addChild(tmpNode);
|
|
tmpNode.active = true;
|
|
let isFinish = false;
|
|
// for (let j = 0; j < Game.ins.finishSub.length; j++) {
|
|
// if (i == Game.ins.finishSub[j]) {
|
|
// isFinish = true;
|
|
// break;
|
|
// }
|
|
// }
|
|
if (!isFinish) {
|
|
tipIndex = Math.min(tipIndex, i);
|
|
tmpNode.color = cc.color(127, 127, 127);
|
|
}
|
|
}
|
|
if (allUnlock) {
|
|
this.newTipBtnNode.active = false;
|
|
}
|
|
else {
|
|
this.newTipBtnNode.active = true;
|
|
}
|
|
|
|
}
|
|
if (this.SpeTip == "") {
|
|
console.log(tipIndex)
|
|
this.newTipSpeLabel.string = Common.GameSubTipConfigs[tipIndex];
|
|
}
|
|
else {
|
|
this.newTipSpeLabel.string = this.SpeTip;
|
|
}
|
|
}
|
|
if (Common.GameSubAnswerConfigs) {
|
|
|
|
let answer = Common.GameSubAnswerConfigs[this.subLevel];
|
|
if (answer) {
|
|
this.answerLabel.string = answer;
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
newTipBtn() {
|
|
let tab = {
|
|
onClose: (finish) => {
|
|
if (finish) {
|
|
User.setShowAdNum(User.getShowAdNum() + 1)
|
|
Common5.ReportDY("inLevel", `任务${TaskManager.getCurUnLockMainTaskId()}-AD-救助美女提示`)
|
|
let bundle = 'jiuzhumeinv'
|
|
if (bundle.includes('Level')) {
|
|
GameReport.ADReport("救助美女" + '提示', 1, "失物招领")
|
|
Common5.ReportDY("inLevel", '失物招领-AD-提示')
|
|
} else {
|
|
GameReport.ADReport("救助美女" + '提示', 1, "总裁训练营")
|
|
Common5.ReportDY("inLevel", '总裁训练营-AD-提示')
|
|
|
|
}
|
|
|
|
let index = 0;
|
|
let answer = User.getUnlockWordgameAnswer(50)
|
|
if (answer) {
|
|
for (let i = 0; i < Common.GameSubTipConfigs.length; i++) {
|
|
if (answer[i] != 2) {
|
|
index = i;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
User.unlockWordgameAnswer(50, index, 2);
|
|
this.subLevel = index;
|
|
this.initText();
|
|
return;
|
|
}
|
|
else {
|
|
let bundle = 'jiuzhumeinv'
|
|
if (bundle.includes('Level')) {
|
|
GameReport.ADReport("救助美女" + '提示', 0, "失物招领")
|
|
} else {
|
|
GameReport.ADReport("救助美女" + '提示', 0, "总裁训练营")
|
|
}
|
|
Common5.showTips_custom("广告未观看完");
|
|
}
|
|
}, onFailed: () => {
|
|
}
|
|
}
|
|
AppPlatform.playVideo_custom(tab)
|
|
}
|
|
btnClose() {
|
|
this.node.active = false
|
|
// this.node.removeFromParent();
|
|
// this.node.destroy();
|
|
// EventMgr.emitEvent_custom(ryw_Event.tooltipClose);
|
|
}
|
|
// update (dt) {}
|
|
}
|
|
|