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

179 lines
7.9 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";
const { ccclass, property, disallowMultiple, menu } = cc._decorator;
@ccclass
@disallowMultiple()
@menu('对话剧情/DH_1')
export default class DH_1 extends DHBase {
chatConfig = [
{ effectUrl: 'DH/DH_1/sound/这是夏芸家吗?', delayTime: 1.5, str: '这是夏芸家吗?', posi: 'qipao2' },
{ effectUrl: 'DH/DH_1/sound/是的,我是夏芸前夫,你是?', delayTime: 3, str: '是的,我是夏芸前夫,你是?', posi: '-1' },
{ effectUrl: 'DH/DH_1/sound/管你什么前夫后夫,夏芸用这房子抵押借了500万高利贷。', delayTime: 5.29, str: '管你什么前夫后夫,夏芸用这房子抵押借了500万高利贷。', posi: 'qipao2' },
{ effectUrl: 'DH/DH_1/sound/现在找不到她人,我们是过来收房子的。', delayTime: 3.43, str: '现在找不到她人,我们是过来收房子的。', posi: 'qipao2' },
{ effectUrl: 'DH/DH_1/sound/什么?500万?我跟她已经离婚了,房子跟她没一毛钱关系。', delayTime: 6.34, str: '什么?500万?我跟她已经离婚了,房子跟她没一毛钱关系。', posi: '-1' },
{ effectUrl: 'DH/DH_1/sound/三天内拿不出500万,就乖乖把房子交出来。', delayTime: 3.64, str: '三天内拿不出500万,就乖乖把房子交出来。', posi: 'qipao1' },
]
@property(sp.Skeleton)
nanzhu: sp.Skeleton = null
@property(sp.Skeleton)
openDoor: sp.Skeleton = null
@property(sp.Skeleton)
daerguang: sp.Skeleton = null
@property(cc.Node)
m_bg: cc.Node = null
@property(cc.Node)
MoveNodes: cc.Node = null
// @property(cc.Camera)
// m_camera: cc.Camera = null
start() {
// Common5.playRemoteAudioMusic("remotesound/effect/小美满-8秒", true)
Common5.preLoadRemoteAudioByChatConfig(this.chatConfig);
super.start();
// this.node.getChildByName("guide").active = false
this.continueStory();
// this.scheduleOnce(() => {
// PrefabManage.preloadPrefabByType(GameType.DH_29)
// })
}
// 继续剧情
continueStory() {
// this.scheduleOnce(() => {
// PrefabManage.preloadPrefabByType(GameType.DH_2)
// })
// this.nanzhu.setAnimation(0, "下面持续", true)
// this.heishehui.setAnimation(0, "小弟待机", true)
const dialogEvents = [
(func) => {
this.openDoor.timeScale = 0.5
this.openDoor.node.active = true
Common5.playRemoteAudioEffect('effect/开门')
this.openDoor.setAnimation(0, "开门", false)
this.openDoor.setCompleteListener(() => {
this.openDoor.setCompleteListener(null)
this.openDoor.node.active = false
func()
})
},
(func) => {
this.m_bg.getChildByName("关门").active = false
this.nanzhu.node.active = true
Common5.playRemoteAudioEffect('effect/踢门')
this.nanzhu.setAnimation(0, "踢门", false)
this.nanzhu.setCompleteListener(() => {
this.nanzhu.setCompleteListener(null)
this.nanzhu.setAnimation(0, "黑社会待机", true)
func()
})
},
(func) => {
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
this.nanzhu.setAnimation(0, "黑社会说话", true)
});
},
(func) => {
this.nanzhu.setAnimation(0, "黑社会待机", true)
this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => {
});
},
(func) => {
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
this.nanzhu.setAnimation(0, "黑社会说话", true)
});
},
(func) => {
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
});
},
(func) => {
this.nanzhu.setAnimation(0, "黑社会待机", true)
this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => {
});
},
(func) => {
this.nanzhu.node.active = false
this.daerguang.node.active = true
Common5.playEffectCustom('KaiChangGuanQia1Gai', 'sound/打耳光')
this.daerguang.setAnimation(0, "打耳光", false)
this.daerguang.setCompleteListener(() => {
this.daerguang.setCompleteListener(null)
this.daerguang.node.active = false
func()
})
},
(func) => {
this.nanzhu.node.active = true
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
this.nanzhu.setAnimation(0, "倒地黑社会说话", true)
});
},
]
const dialogCallFunc = (logEvents: any[]) => {
logEvents.shift()(() => {
if (logEvents.length > 0) {
dialogCallFunc(logEvents);
} else {
this.nanzhu.setAnimation(0, "倒地", true)
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_501)
TaskManager.setCurTask(MainTaskIdEnum.MainTask_502)
PrefabManage.showBlackGuoDu(() => {
PrefabManage.loadPrefabByType(GameType.MainHall)
this.node.removeFromParent()
this.node.destroy()
})
// 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_29")
// // 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)
}
})
}
runBg(time, scale, endnode, callFunc) {
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()
}
}