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

201 lines
8.5 KiB

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 DHBase from "./DHBase";
const { ccclass, property } = cc._decorator;
@ccclass
export default class DH_13 extends DHBase {
chatConfig = [
{ effectUrl: 'DH/DH_13/sound/狗东西,竟敢来我家!', delayTime: 3.1, str: '狗东西,竟敢来我家!', posi: 'qipao3' },
{ effectUrl: 'DH/DH_13/sound/这能让你家老爷子苏醒5分钟,和你换一份药材,合理吧!', delayTime: 4.94, str: '这能让你家老爷子苏醒5分钟,和你换一份药材,合理吧!', posi: '-1' },
{ effectUrl: 'DH/DH_13/sound/我警告你!别坏老子好事,不然让你活不过明天!', delayTime: 5.77, str: '我警告你!别坏老子好事,不然让你活不过明天!', posi: 'qipao2' },
{ effectUrl: 'DH/DH_13/sound/柳梦把事情做的怎么样了,龙少在催了!', delayTime: 3.97, str: '柳梦把事情做的怎么样了,龙少在催了!', posi: 'qipao3' },
{ effectUrl: 'DH/DH_13/sound/就差一个替罪羊了。', delayTime: 2.4, str: '就差一个替罪羊了。', posi: 'qipao1' },
{ effectUrl: 'DH/DH_13/sound/听说柳梦是叶辰的前女友?有意思。', delayTime: 4.3, str: '听说柳梦是叶辰的前女友?有意思。', posi: 'qipao3' },
]
@property(cc.Node)
fanpai: cc.Node = null;
@property(cc.Node)
texie: cc.Node = null;
@property(cc.Node)
shouxia: cc.Node = null;
start() {
this.scheduleOnce(() => {
PrefabManage.preloadPrefabByType(GameType.DH_14)
})
GameBaseScript.preLoadRemoteAudioByChatConfig(this.chatConfig);
super.start();
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
let mainId = mainTaskInfo.Id
this.continueStory();
// this.scheduleOnce(() => {
// PrefabManage.preloadPrefabByType(GameType.DH_59)
// })
// EventMgr.onEvent_custom(ryw_Event.RefreshJuQingDuiHua, () => {
// this.RefreshJuQingDuiHua();
// }, this);
}
// 继续剧情
continueStory() {
let fanpaiSpine = this.fanpai.getComponent(sp.Skeleton)
fanpaiSpine.setAnimation(0, "待机", true)
let texieSpine = this.texie.getComponent(sp.Skeleton)
this.texie.active = false
texieSpine.setAnimation(0, "待机", true)
let shouxiaSpine = this.shouxia.getComponent(sp.Skeleton)
this.shouxia.active = false
shouxiaSpine.setAnimation(0, "待机", true)
const dialogEvents = [
(func) => {
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
fanpaiSpine.setAnimation(0, "说话", true)
});
},
(func) => {
fanpaiSpine.setAnimation(0, "递壶", false)
fanpaiSpine.setCompleteListener(() => {
fanpaiSpine.setCompleteListener(null)
fanpaiSpine.setAnimation(0, "递壶待机", true)
func()
})
},
(func) => {
this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => {
});
},
(func) => {
Common5.playRemoteAudioEffect("action_effect/打翻保温盒");
fanpaiSpine.setAnimation(0, "打掉壶", false)
fanpaiSpine.setCompleteListener(() => {
fanpaiSpine.setCompleteListener(null)
this.texie.active = true
this.fanpai.active = false
texieSpine.setAnimation(0, "待机", true)
func()
})
},
(func) => {
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
texieSpine.setAnimation(0, "说话", true)
});
},
(func) => {
PrefabManage.showBlackGuoDu(() => {
this.texie.active = false
this.fanpai.active = true
fanpaiSpine.setAnimation(0, "待机", true)
}, () => {
func()
},"叶辰离开后...")
// cc.tween(this.node)
// .sequence(
// cc.tween().to(1, { opacity: 0 }),
// cc.tween().call(() => {
// this.texie.active = false
// this.fanpai.active = true
// fanpaiSpine.setAnimation(0, "待机", true)
// }),
// cc.tween().to(1, { opacity: 255 }),
// cc.tween().call(() => {
// func()
// }),
// )
// .start()
},
(func) => {
this.shouxia.active = true
shouxiaSpine.setAnimation(0, "入场", false)
this.node.getChildByName("nameplate").active = true
shouxiaSpine.setCompleteListener(() => {
shouxiaSpine.setCompleteListener(null)
shouxiaSpine.setAnimation(0, "待机", true)
func()
})
},
(func) => {
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
fanpaiSpine.setAnimation(0, "说话", true)
});
},
(func) => {
fanpaiSpine.setAnimation(0, "待机", true)
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
});
},
(func) => {
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
fanpaiSpine.setAnimation(0, "说话", true)
});
},
]
const dialogCallFunc = (logEvents: any[]) => {
logEvents.shift()(() => {
if (logEvents.length > 0) {
dialogCallFunc(logEvents);
} else {
PrefabManage.showBlackGuoDu(() => {
PrefabManage.loadPrefabByType(GameType.CityPrefab)
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_808)
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_809)
this.node.destroy()
}, () => {
})
}
});
}
dialogCallFunc(dialogEvents);
}
// 震屏效果
// 参数: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);
}
}