觉醒时刻
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.
 
 
 
juexingshike/assets/Scripts/MyRoom/TaskResult.ts

294 lines
12 KiB

import AppPlatform from "../../FrameWork/Util/AppPlatform";
import Common5 from "../../Platform/th/Common5";
let AllConfig = [
{idTag:1,successStr:'发小安若若发来微信信息!',successBtnStr:'确认',
failStr:'',failADBtnStr:'',failContinueBtnStr:''},
{idTag:2,selectContentStr:'眼光太差投资人很不高兴,哄不好了',selectLeftBtnStr:'重新试穿',selectRightBtnStr:'最美衣服'},
{idTag:3,successStr:'投资人心情不错,再接再厉',successBtnStr:'确认',
failStr:'',failADBtnStr:'',failContinueBtnStr:''},
{idTag:4,successStr:'钱已赚够可前往卖货郎买药',successBtnStr:'确认',
failStr:'',failADBtnStr:'',failContinueBtnStr:''},
{idTag:5,successStr:'老婆夏芸发来微信消息!',successBtnStr:'查看',
failStr:'',failADBtnStr:'',failContinueBtnStr:''},
]
// export interface TaskResultInfo{
// id:number,
// isSuccess?:boolean,
// isNeedSelectView:boolean,
// selectLeftFunc:any,
// selectRightFunc:
// }
const {ccclass, property} = cc._decorator;
@ccclass
export default class TaskResult extends cc.Component {
@property(cc.Node)
selelctNode: cc.Node = null;
@property(cc.Node)
selelctNode2: cc.Node = null;
// @property(cc.Node)
// selectNode3: cc.Node = null;
@property(cc.Node)
successNode: cc.Node = null;
// @property(cc.Node)
// successNode3: cc.Node = null;
// @property([cc.SpriteFrame])
// successTittleSp:cc.SpriteFrame[] = []
@property(cc.Node)
failNode: cc.Node = null;
// @property([cc.SpriteFrame])
// failTittleSp:cc.SpriteFrame[] = []
continueBtnFunc = null
adBtnFunc = null
successBtnFunc = null
// resultInfo = null
isLeftBtnRight = false
successNode2:cc.Node = null
start () {
}
//直接成功失败,不需要选择
initView1(id,isSuccess,continueBtnFunc,adBtnFunc?){
this.continueBtnFunc = continueBtnFunc
this.adBtnFunc = adBtnFunc
let selectConfig = null
for(let i=0;i<AllConfig.length;i++){
if(id == AllConfig[i].idTag){
selectConfig = AllConfig[i]
break
}
}
this.selelctNode.active = false
this.successNode.active = true
// this.successNode.getChildByName('tittleSp').getComponent(cc.Sprite).spriteFrame = this.successTittleSp[id]?this.successTittleSp[id]:this.successTittleSp[0]
this.failNode.active = false
this.successNode.getChildByName('contentStr').getComponent(cc.Label).string = selectConfig.successStr
this.successNode.getChildByName('btnContinue').getChildByName('btnContinueStr').getComponent(cc.Label).string = selectConfig.successBtnStr
if(isSuccess){
this.successNode.getChildByName('剧情完成').active = true
this.successNode.getChildByName('剧情事件').active = false
}else{
this.successNode.getChildByName('剧情完成').active = false
this.successNode.getChildByName('剧情事件').active = true
// this.successNode.active = false
// this.failNode.active = true
// // this.failNode.getChildByName('tittleSp').getComponent(cc.Sprite).spriteFrame = this.failTittleSp[id]?this.failTittleSp[id]:this.failTittleSp[0]
// this.failNode.getChildByName('contentStr').getComponent(cc.Label).string = selectConfig.failStr
// this.failNode.getChildByName('btnAD').getChildByName('label').getComponent(cc.Label).string = selectConfig.failADBtnStr
// this.failNode.getChildByName('btnMoney').getChildByName('btnContinueStr').getComponent(cc.Label).string = selectConfig.failContinueBtnStr
}
}
// //需要先选择再弹成功失败
// initView2(id,isLeftBtnRight,successBtnFunc,continueBtnFunc,adBtnFunc){
// this.isLeftBtnRight = isLeftBtnRight
// this.successBtnFunc = successBtnFunc
// this.continueBtnFunc = continueBtnFunc
// this.adBtnFunc = adBtnFunc
// let selectConfig = null
// for(let i=0;i<AllConfig.length;i++){
// if(id == AllConfig[i].idTag){
// selectConfig = AllConfig[i]
// break
// }
// }
// this.selelctNode.active = true
// this.selelctNode.getChildByName('contentStr').getComponent(cc.Label).string = selectConfig.selectContentStr
// this.selelctNode.getChildByName('btnLeft').getChildByName('str').getComponent(cc.Label).string = selectConfig.selectLeftBtnStr
// this.selelctNode.getChildByName('btnRight').getChildByName('str').getComponent(cc.Label).string = selectConfig.selectRightBtnStr
// this.failNode.getChildByName('contentStr').getComponent(cc.Label).string = selectConfig.failStr
// this.failNode.getChildByName('btnAD').getChildByName('label').getComponent(cc.Label).string = selectConfig.failADBtnStr
// this.failNode.getChildByName('btnMoney').getChildByName('btnContinueStr').getComponent(cc.Label).string = selectConfig.failContinueBtnStr
// if(selectConfig.failADBtnStr == ''){
// this.failNode.getChildByName('btnAD').active = false
// this.failNode.getChildByName('btnMoney').x = 0
// }
// }
// //直接成功失败不需要选择成功有两个按钮情况
// initView3(id,isSuccess,continueBtnFunc,adBtnFunc?,successStr?){
// this.successNode2 = this.node.getChildByName('successNode2')
// this.continueBtnFunc = continueBtnFunc
// this.adBtnFunc = adBtnFunc
// let selectConfig = null
// for(let i=0;i<AllConfig.length;i++){
// if(id == AllConfig[i].idTag){
// selectConfig = AllConfig[i]
// break
// }
// }
// this.selelctNode.active = false
// if(isSuccess){
// this.successNode2.active = true
// // this.successNode2.getChildByName('tittleSp').getComponent(cc.Sprite).spriteFrame = this.successTittleSp[id]
// this.failNode.active = false
// this.successNode2.getChildByName('contentStr').getComponent(cc.Label).string = successStr?successStr:selectConfig.successStr
// this.successNode2.getChildByName('btnContinue').getChildByName('btnContinueStr').getComponent(cc.Label).string = selectConfig.successBtnStr
// this.successNode2.getChildByName('btnAD').getChildByName('label').getComponent(cc.Label).string = selectConfig.successBtnStr2
// }else{
// this.successNode2.active = false
// this.failNode.active = true
// // this.failNode.getChildByName('tittleSp').getComponent(cc.Sprite).spriteFrame = this.failTittleSp[id]
// this.failNode.getChildByName('contentStr').getComponent(cc.Label).string = selectConfig.failStr
// this.failNode.getChildByName('btnAD').getChildByName('label').getComponent(cc.Label).string = selectConfig.failADBtnStr
// this.failNode.getChildByName('btnMoney').getChildByName('btnContinueStr').getComponent(cc.Label).string = selectConfig.failContinueBtnStr
// }
// }
//两个按钮选择直接结束
initView4(id,isSuccess,continueBtnFunc,adBtnFunc?){
this.selelctNode2.active = true
this.continueBtnFunc = continueBtnFunc
this.adBtnFunc = adBtnFunc
let selectConfig = null
for(let i=0;i<AllConfig.length;i++){
if(id == AllConfig[i].idTag){
selectConfig = AllConfig[i]
break
}
}
this.selelctNode2.getChildByName('contentStr').getComponent(cc.Label).string = selectConfig.selectContentStr
this.selelctNode2.getChildByName('btnLeft').getChildByName('str').getComponent(cc.Label).string = selectConfig.selectLeftBtnStr
this.selelctNode2.getChildByName('btnRight').getChildByName('str').getComponent(cc.Label).string = selectConfig.selectRightBtnStr
}
// //需要先选择再弹成功失败,成功失败都有弹框选择
// initView5(id,successBtnFunc,continueBtnFunc,adBtnFunc){
// this.selectNode3.active = true
// this.successBtnFunc = successBtnFunc
// this.continueBtnFunc = continueBtnFunc
// this.adBtnFunc = adBtnFunc
// let selectConfig = null
// for(let i=0;i<AllConfig.length;i++){
// if(id == AllConfig[i].idTag){
// selectConfig = AllConfig[i]
// break
// }
// }
// this.selectNode3.getChildByName('contentStr').getComponent(cc.Label).string = selectConfig.selectContentStr
// this.selectNode3.getChildByName('btnLeft').getChildByName('str').getComponent(cc.Label).string = selectConfig.selectLeftBtnStr
// this.selectNode3.getChildByName('btnRight').getChildByName('str').getComponent(cc.Label).string = selectConfig.selectRightBtnStr
// // {idTag:0,selectContentStr:'收到前男友求和价值5万的999朵玫瑰',selectLeftBtnStr:'含泪收下',selectRightBtnStr:'反手扔掉',
// // successStr:'被生气的许婉如抓到打了一耳光耳鸣了花费医药费1万',successADBtnStr:'挽回损失',successBtnStr:'确定',
// // failStr:'王俊辉恼羞成怒索赔5万',failADBtnStr:'挽回损失',failContinueBtnStr:'确定'},
// this.successNode3.getChildByName('contentStr').getComponent(cc.Label).string = selectConfig.successStr
// this.successNode3.getChildByName('btnContinue').getChildByName('btnContinueStr').getComponent(cc.Label).string = selectConfig.successBtnStr
// this.successNode3.getChildByName('btnAD').getChildByName('label').getComponent(cc.Label).string = selectConfig.successADBtnStr
// this.failNode.getChildByName('contentStr').getComponent(cc.Label).string = selectConfig.failStr
// this.failNode.getChildByName('btnAD').getChildByName('label').getComponent(cc.Label).string = selectConfig.failADBtnStr
// this.failNode.getChildByName('btnMoney').getChildByName('btnContinueStr').getComponent(cc.Label).string = selectConfig.failContinueBtnStr
// // if(selectConfig.failADBtnStr == ''){
// // this.failNode.getChildByName('btnAD').active = false
// // this.failNode.getChildByName('btnMoney').x = 0
// // }
// }
onBtnADClick(){
let tab = {
onClose: (finish)=>{
if (finish) {
// Common5.ReportDY("inLevel", '任务文字剧情-AD-失败');
this.adBtnFunc && this.adBtnFunc()
this.node.removeFromParent()
this.node.destroy()
}
else{
Common5.showTips_custom("广告未观看完");
}
},onFailed:()=>{
}
}
AppPlatform.playVideo_custom(tab)
}
onBtnContinue(){
this.continueBtnFunc && this.continueBtnFunc()
this.node.removeFromParent()
this.node.destroy()
}
onLeftBtnClick(){
if(this.isLeftBtnRight){
this.successBtnFunc && this.successBtnFunc()
this.node.removeFromParent()
this.node.destroy()
}else{
this.failNode.active = true
this.selelctNode.active = false
}
}
onRightBtnClick(){
if(this.isLeftBtnRight){
this.failNode.active = true
this.selelctNode.active = false
}else{
this.successBtnFunc && this.successBtnFunc()
this.node.removeFromParent()
this.node.destroy()
}
}
onLeftBtnClick2(){
this.continueBtnFunc && this.continueBtnFunc()
this.node.removeFromParent()
this.node.destroy()
}
onRightBtnClick2(){
let tab = {
onClose: (finish)=>{
if (finish) {
this.adBtnFunc && this.adBtnFunc()
this.node.removeFromParent()
this.node.destroy()
}
else{
Common5.showTips_custom("广告未观看完");
}
},onFailed:()=>{
}
}
AppPlatform.playVideo_custom(tab)
}
onSuccessClick3(){
this.successBtnFunc && this.successBtnFunc()
this.node.removeFromParent()
this.node.destroy()
}
// onLeftBtnClick3(){
// this.selectNode3.active = false
// this.successNode3.active = true
// }
// onRightBtnClick3(){
// this.selectNode3.active = false
// this.failNode.active = true
// }
}