咸鱼的反击
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.
 
 
 

162 lines
6.4 KiB

import User from "../../FrameWork/User/User";
import Common5 from "../../Platform/th/Common5";
import GameBaseScript from "../GameRoomRes/GameBaseScript";
import TaskManager, { MainTaskIdEnum } from "../JuQingChat/TaskManager";
import UserManager from "../Manager/UserManager";
import NewGuideScript from "../NewGuide/NewGuideScript";
import PrefabManage, { GameType } from "../PrefabManager/PrefabManage";
import GetAward from "../SCommon/GetAward";
import DHBase from "./DHBase";
import selectButtons from "./selectButtons";
const { ccclass, property, disallowMultiple, menu } = cc._decorator;
@ccclass
@disallowMultiple()
@menu('对话剧情/DH_3')
export default class DH_3 extends DHBase {
chatConfig = [
{ effectUrl: 'DH/DH_3/sound/我要的钱带来了没', delayTime: 6.08, str: '我要的钱带来了没', posi: 'qipao2' },
{ effectUrl: 'DH/DH_3/sound/2000万一分不少,把人放了。', delayTime: 5.53, str: '2000万一分不少,把人放了。', posi: '-1' },
{ effectUrl: 'DH/DH_3/sound/人就在里面,你自己进去带走吧', delayTime: 4.53, str: '人就在里面,你自己进去带走吧', posi: 'qipao2' },
{ effectUrl: 'DH/DH_3/sound/萌萌,你怎么了!!', delayTime: 4.53, str: '萌萌,你怎么了!!', posi: '-1' },
]
@property(sp.Skeleton)
nanzhu: sp.Skeleton = null
@property(sp.Skeleton)
heishehui: sp.Skeleton = null
@property(cc.ProgressBar)
progress: cc.ProgressBar = null
@property(cc.Node)
m_bg: cc.Node = null
@property(cc.Node)
MoveNodes: cc.Node = null
start() {
// Common5.playRemoteAudioMusic("remotesound/effect/打雷下雨声", true)
Common5.preLoadRemoteAudioByChatConfig(this.chatConfig);
super.start();
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
let mainId = mainTaskInfo.Id
if (mainId == MainTaskIdEnum.MainTask_605) {
this.continueStory();
} else {
this.m_bg.getChildByName("砸").active = true
}
// this.scheduleOnce(() => {
// PrefabManage.preloadPrefabByType(GameType.DH_39)
// })
}
// 继续剧情
continueStory() {
// this.scheduleOnce(() => {
// PrefabManage.preloadPrefabByType(GameType.DH_4)
// })
const dialogEvents = [
(func) => {
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
// this.heishehui.setAnimation(0, "小弟说话", true)
});
},
(func) => {
this.m_bg.getChildByName("needGoodNode_605").active = true
// this.heishehui.setAnimation(0, "小弟待机", true)
// this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => {
// // this.nanzhu.setAnimation(0, "侧头笑说话", true)
// });
},
]
const dialogCallFunc = (logEvents: any[]) => {
logEvents.shift()(() => {
if (logEvents.length > 0) {
dialogCallFunc(logEvents);
} else {
// PrefabManage.loadPrefabByType(GameType.GetAward, null, (prefabNode) => {
// let goods = [{ goodId: 1733, goodNum: 1 }];
// prefabNode.getComponent(GetAward).initView(goods, () => {
// // TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_530)
// // User.setRoomGoodStatus("DH_39")
// // UserManager.clearAndaddStructureFlash("cf_FengRenYuan")
// });
// });
// TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_202)
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_203)
// this.node.destroy()
}
});
}
dialogCallFunc(dialogEvents);
}
guideView(nodeArray, opacity = -1) {
PrefabManage.loadPrefabByType(GameType.GuideMskNode, this.node, (prefab) => {
// prefab.zIndex = 199
let guideNodeArray = nodeArray
let firstNode = guideNodeArray.shift()
prefab.getComponent(NewGuideScript).setBindNode(firstNode, guideNodeArray)
if (opacity != -1) {
prefab.getComponent(NewGuideScript).setOpacityMaskNode(opacity)
}
})
}
onTouch() {
this.m_bg.getChildByName("needGoodNode_605").active = false
UserManager.subMoney(20000000)
this.showQiPao(this.chatConfig[this.dialogIndex++], () => {
this.showQiPao(this.chatConfig[this.dialogIndex++], () => {
this.m_bg.getChildByName("砸").active = true
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_605)
TaskManager.setCurTask(MainTaskIdEnum.MainTask_606)
}, () => {
// this.heishehui.setAnimation(0, "小弟说话", true)
});
}, () => {
// this.heishehui.setAnimation(0, "小弟说话", true)
});
}
onTouchZaSuo() {
this.progress.progress += 0.1
if (this.progress.progress >= 1) {
this.m_bg.getChildByName("砸").active = false
this.m_bg.getChildByName("背景1").active = true
this.showQiPao(this.chatConfig[this.dialogIndex++], ()=>{
User.setStatistics("zhangJie", 6)
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_606)
TaskManager.setCurTask(MainTaskIdEnum.MainTask_701)
this.m_bg.getChildByName("前往医院").active = true
}, () => {
// this.heishehui.setAnimation(0, "小弟说话", true)
});
}
}
onTouchGoYiYuan() {
PrefabManage.showBlackGuoDu(() => {
PrefabManage.loadPrefabByType(GameType.DH_4)
this.node.removeFromParent()
this.node.destroy()
})
}
runBg(time, scale, endnode, callFunc) {
cc.Tween.stopAllByTarget(this.m_bg)
cc.tween(this.m_bg)
.to(time, { scale: scale })
.start()
cc.tween(this.m_bg)
.sequence(
cc.tween().to(time, { position: cc.v2(-endnode.position.x * scale, -endnode.position.y * scale) }),
cc.tween().call(() => {
callFunc()
})
)
.start()
}
}