觉醒时刻
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.

377 lines
14 KiB

1 week ago
import { ryw_Event } from "../../FrameWork/Event/EventEnum";
import EventMgr from "../../FrameWork/Event/EventMgr";
import User from "../../FrameWork/User/User";
import Common5 from "../../Platform/th/Common5";
import TouZiXieYiShu from "../GameMethodRes/TouZiXieYiShu/TouZiXieYiShu";
import GameBaseScript from "../GameRoomRes/GameBaseScript";
import TaskManager, { MainTaskIdEnum } from "../JuQingChat/TaskManager";
import BagManager from "../Manager/BagManager";
import InterfaceManager from "../Manager/InterfaceManager";
import UserManager from "../Manager/UserManager";
import PrefabManage, { GameType } from "../PrefabManager/PrefabManage";
import GetAward from "../SCommon/GetAward";
import ChaDianListScript2 from "../WenZiRes/WenZiCommon/ChaDianListScript2";
import DHBase from "./DHBase";
const { ccclass, property } = cc._decorator;
let ChadianConfig = {
chadianIconList: [
{
bandleName: "DH_14",
name: "茬点1",
url: "res/茬点1",
isCheck: false
},
{
bandleName: "DH_14",
name: "茬点2",
url: "res/茬点2",
isCheck: false
},
{
bandleName: "DH_14",
name: "茬点3",
url: "res/茬点3",
isCheck: false
},
{
bandleName: "DH_14",
name: "茬点4",
url: "res/茬点4",
isCheck: false
}
],
chadianLog: [
{
str: "丢了什么东西吗?",
posi: -1,
delayTime: 1.2,
effectUrl: "DH/DH_14/sound/丢了什么东西吗?"
},
{
str: "看着像被下了药。",
posi: -1,
delayTime: 1.9,
effectUrl: "DH/DH_14/sound/看着像被下了药。"
},
{
str: "这是偷着盖了什么章?",
posi: -1,
delay: 1.7,
effectUrl: "DH/DH_14/sound/这是偷着盖了什么章?"
},
{
str: "钱老板资产都被转移走了?",
posi: -1,
delayTime: 1.96,
effectUrl: "DH/DH_14/sound/钱老板资产都被转移走了?"
},
]
}
@ccclass
export default class DH_14 extends DHBase {
chatConfig = [
{ effectUrl: 'DH/DH_14/sound/辰哥,他们诬陷我!', delayTime: 2.3, str: '辰哥,他们诬陷我!', posi: 'qipao1' },
{ effectUrl: 'DH/DH_14/sound/等我用银针唤醒钱老板,就真相大白了!', delayTime: 2.95, str: '等我用银针唤醒钱老板,就真相大白了!', posi: '-1' },
{ effectUrl: 'DH/DH_14/sound/你随意,就是这贱人干的!', delayTime: 3.2, str: '你随意,就是这贱人干的!', posi: 'qipao2' },
{ effectUrl: 'DH/DH_14/sound/是她送的汤,是她害的我!', delayTime: 3.27, str: '是她送的汤,是她害的我!', posi: 'qipao3' },
{ effectUrl: 'DH/DH_14/sound/没,我没有,辰哥,找白诗诗,她能给我作证!', delayTime: 6, str: '没,我没有,辰哥,找白诗诗,她能给我作证!', posi: 'qipao1' },
]
@property(cc.Node)
anruoruo: cc.Node = null;
@property(cc.Node)
jincha: cc.Node = null;
@property(cc.Node)
liumeng: cc.Node = null;
@property(cc.Node)
qianlaoban: cc.Node = null;
@property(cc.Node)
qianlaoban_2: cc.Node = null;
@property(cc.Node)
zhazhen: cc.Node = null;
@property(cc.Node)
btn_zhenjiu: cc.Node = null;
chadianStep: number = 0
start() {
this.scheduleOnce(() => {
PrefabManage.preloadPrefabByType(GameType.DH_15)
})
Common5.playRemoteAudioMusic('CommonSound/背景音111')
GameBaseScript.preLoadRemoteAudio(ChadianConfig);
GameBaseScript.preLoadRemoteAudioByChatConfig(this.chatConfig);
super.start();
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
let mainId = mainTaskInfo.Id
if (mainId == MainTaskIdEnum.MainTask_904) {
this.btn_zhenjiu.active = true
} else {
this.continueStory();
}
// this.scheduleOnce(() => {
// PrefabManage.preloadPrefabByType(GameType.DH_59)
// })
// EventMgr.onEvent_custom(ryw_Event.RefreshJuQingDuiHua, () => {
// this.RefreshJuQingDuiHua();
// }, this);
EventMgr.onEvent_custom(ryw_Event.NormalTouchEndCheck, (data_) => {
this.normalTouchCallback(data_.targetNode);
}, this);
}
// 继续剧情
continueStory() {
let anruoruoSpine = this.anruoruo.getComponent(sp.Skeleton)
anruoruoSpine.setAnimation(0, "安若若有锁链", true)
let jinchaSpine = this.jincha.getComponent(sp.Skeleton)
jinchaSpine.setAnimation(0, "警察", true)
let liumengSpine = this.liumeng.getComponent(sp.Skeleton)
liumengSpine.setAnimation(0, "待机", true)
let qianlaobanSpine = this.qianlaoban.getComponent(sp.Skeleton)
qianlaobanSpine.setAnimation(0, "睡觉", true)
this.node.getChildByName("hezi").active = false
this.node.getChildByName("qianyoucai").active = false
this.node.getChildByName("yinzhang").active = false
this.node.getChildByName("shouji").active = false
const dialogEvents = [
(func) => {
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
anruoruoSpine.setAnimation(0, "安若若有锁链说话", true)
});
},
(func) => {
anruoruoSpine.setAnimation(0, "安若若有锁链", true)
func()
},
]
const dialogCallFunc = (logEvents: any[]) => {
logEvents.shift()(() => {
if (logEvents.length > 0) {
dialogCallFunc(logEvents);
} else {
this.node.getChildByName("hezi").active = true
this.node.getChildByName("qianyoucai").active = true
this.node.getChildByName("yinzhang").active = true
this.node.getChildByName("shouji").active = true
let chadianIconList = this.node.getChildByName('chadianIconList');
let scr: ChaDianListScript2 = chadianIconList.getComponent(ChaDianListScript2);
scr.setChaDianData(ChadianConfig.chadianIconList);
chadianIconList.active = true;
this.chadianStep = 0;
}
});
}
dialogCallFunc(dialogEvents);
}
// 继续剧情
continueStory1() {
let anruoruoSpine = this.anruoruo.getComponent(sp.Skeleton)
anruoruoSpine.setAnimation(0, "安若若有锁链", true)
let jinchaSpine = this.jincha.getComponent(sp.Skeleton)
jinchaSpine.setAnimation(0, "警察", true)
let liumengSpine = this.liumeng.getComponent(sp.Skeleton)
liumengSpine.setAnimation(0, "待机", true)
let qianlaobanSpine = this.qianlaoban.getComponent(sp.Skeleton)
qianlaobanSpine.setAnimation(0, "睡觉", true)
const dialogEvents = [
(func) => {
this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => {
});
},
(func) => {
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
liumengSpine.setAnimation(0, "说话", true)
});
},
(func) => {
liumengSpine.setAnimation(0, "待机", true)
func()
},
]
const dialogCallFunc = (logEvents: any[]) => {
logEvents.shift()(() => {
if (logEvents.length > 0) {
dialogCallFunc(logEvents);
} else {
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_902)
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_903)
// PrefabManage.showBlackGuoDu(() => {
// PrefabManage.loadPrefabByType(GameType.CityPrefab)
// this.node.destroy()
// })
}
});
}
dialogCallFunc(dialogEvents);
}
// 继续剧情
continueStory2() {
let anruoruoSpine = this.anruoruo.getComponent(sp.Skeleton)
anruoruoSpine.setAnimation(0, "安若若有锁链", true)
let jinchaSpine = this.jincha.getComponent(sp.Skeleton)
jinchaSpine.setAnimation(0, "警察", true)
let liumengSpine = this.liumeng.getComponent(sp.Skeleton)
liumengSpine.setAnimation(0, "待机", true)
let qianlaoban_2Spine = this.qianlaoban_2.getComponent(sp.Skeleton)
qianlaoban_2Spine.setAnimation(0, "待机", true)
const dialogEvents = [
(func) => {
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
qianlaoban_2Spine.setAnimation(0, "说话", true)
});
},
(func) => {
qianlaoban_2Spine.setAnimation(0, "待机", true)
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
anruoruoSpine.setAnimation(0, "安若若有锁链说话", true)
});
},
(func) => {
liumengSpine.setAnimation(0, "安若若有锁链", true)
func()
},
(func) => {
// 人都走掉
cc.tween(this.anruoruo)
.sequence(
cc.tween().by(1, { position: cc.v3(1000, 0, 0) }),
cc.tween().call(() => {
func()
})
)
.start()
cc.tween(this.jincha)
.sequence(
cc.tween().by(1, { position: cc.v3(1000, 0, 0) }),
cc.tween().call(() => {
})
)
.start()
this.liumeng.setScale(-1, 1, 1)
cc.tween(this.liumeng)
.sequence(
cc.tween().by(1, { position: cc.v3(-1000, 0, 0) }),
cc.tween().call(() => {
})
)
.start()
this.qianlaoban_2.setScale(-1, 1, 1)
cc.tween(this.qianlaoban_2)
.sequence(
cc.tween().by(1, { position: cc.v3(-1000, 0, 0) }),
cc.tween().call(() => {
})
)
.start()
},
]
const dialogCallFunc = (logEvents: any[]) => {
logEvents.shift()(() => {
if (logEvents.length > 0) {
dialogCallFunc(logEvents);
} else {
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_904)
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_905)
// PrefabManage.showBlackGuoDu(() => {
// PrefabManage.loadPrefabByType(GameType.CityPrefab)
// this.node.destroy()
// })
}
});
}
dialogCallFunc(dialogEvents);
}
normalTouchCallback(targetNode) {
switch (targetNode.name) {
case "hezi":
EventMgr.emitEvent_custom(ryw_Event.touchChaDianCheck, { touchIndex: 0 })
this.showQiPao(ChadianConfig.chadianLog[0], this.gameChaDianCallback.bind(this));
break;
case "qianyoucai":
EventMgr.emitEvent_custom(ryw_Event.touchChaDianCheck, { touchIndex: 1 })
this.showQiPao(ChadianConfig.chadianLog[1], this.gameChaDianCallback.bind(this));
break;
case "yinzhang":
EventMgr.emitEvent_custom(ryw_Event.touchChaDianCheck, { touchIndex: 2 });
this.showQiPao(ChadianConfig.chadianLog[2], this.gameChaDianCallback.bind(this));
break;
case "shouji":
EventMgr.emitEvent_custom(ryw_Event.touchChaDianCheck, { touchIndex: 3 });
this.showQiPao(ChadianConfig.chadianLog[3], this.gameChaDianCallback.bind(this));
break;
default:
break;
}
}
gameChaDianCallback() {
this.chadianStep++;
if (this.chadianStep >= 4) {
this.node.getChildByName("chadianIconList").active = false;
this.continueStory1()
}
}
onTouchZhenJiu() {
this.btn_zhenjiu.active = false
this.zhazhen.active = true
this.zhazhen.getComponent(sp.Skeleton).setAnimation(0, "扎针", false)
this.zhazhen.getComponent(sp.Skeleton).setCompleteListener(() => {
this.zhazhen.getComponent(sp.Skeleton).setCompleteListener(null)
this.zhazhen.active = false
this.qianlaoban.active = false
this.qianlaoban_2.active = true
this.dialogIndex = 3
this.continueStory2();
})
}
// 震屏效果
// 参数:duration 震屏时间
shakeEffect(duration) {
this.node.runAction(
cc.repeatForever(
cc.sequence(
// cc.moveTo(0.02, cc.v2(5, 7)),
// cc.moveTo(0.02, cc.v2(-6, 7)),
// cc.moveTo(0.02, cc.v2(-13, 3)),
// cc.moveTo(0.02, cc.v2(3, -6)),
// cc.moveTo(0.02, cc.v2(-5, 5)),
// cc.moveTo(0.02, cc.v2(2, -8)),
// cc.moveTo(0.02, cc.v2(-8, -10)),
// cc.moveTo(0.02, cc.v2(3, 10)),
// cc.moveTo(0.02, cc.v2(0, 0))
cc.moveTo(0.2, cc.v2(5, 7)),
// cc.moveTo(0.2, cc.v2(-6, 7)),
cc.moveTo(0.2, cc.v2(-13, 3)),
// cc.moveTo(0.2, cc.v2(3, -6)),
cc.moveTo(0.2, cc.v2(-5, 5)),
// cc.moveTo(0.2, cc.v2(2, -8)),
cc.moveTo(0.2, cc.v2(-8, -10)),
// cc.moveTo(0.2, cc.v2(3, 10)),
cc.moveTo(0.2, cc.v2(0, 0))
)
)
);
setTimeout(() => {
this.node.stopAllActions();
this.node.setPosition(0, 0);
}, duration * 1000);
}
}