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

138 lines
5.7 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 RoomCommon from "../GameRoomRes/RoomCommon/RoomCommon";
import TaskManager, { MainTaskIdEnum } from "../JuQingChat/TaskManager";
import BagManager from "../Manager/BagManager";
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_8 extends DHBase {
chatConfig = [
{ effectUrl: 'DH/DH_8/sound/这是我家的医院,赶紧让这个老太婆滚蛋!', delayTime: 4.78, str: '这是我家的医院,赶紧让这个老太婆滚蛋!', posi: 'qipao2' },
{ effectUrl: 'DH/DH_8/sound/傅思远,你这是在找死!', delayTime: 4.1, str: '傅思远,你这是在找死!', posi: '-1' },
{ effectUrl: 'DH/DH_8/sound/上次你打了我,这次我就搞你家人,滚蛋吧!', delayTime: 6.32, str: '上次你打了我,这次我就搞你家人,滚蛋吧!', posi: 'qipao3' },
]
@property(cc.Node)
nanzhu: cc.Node = null;
@property(cc.Node)
fanpai: cc.Node = null;
// @property(cc.Node)
// yaoshan: cc.Node = null;
start() {
this.scheduleOnce(() => {
PrefabManage.preloadPrefabByType(GameType.DH_9)
})
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.continueStory1();
// }, this);
}
// 继续剧情
continueStory() {
let fanpaiSpine = this.fanpai.getComponent(sp.Skeleton)
fanpaiSpine.setAnimation(0, "反派待机", true)
let nanzhuSpine = this.nanzhu.getComponent(sp.Skeleton)
nanzhuSpine.node.active = false
const dialogEvents = [
(func) => {
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
fanpaiSpine.setAnimation(0, "反派说话", true)
});
},
(func) => {
fanpaiSpine.setAnimation(0, "反派待机", true)
nanzhuSpine.node.active = true
nanzhuSpine.setAnimation(0, "男主入场", false)
nanzhuSpine.setCompleteListener(() => {
nanzhuSpine.setCompleteListener(null)
this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => {
nanzhuSpine.setAnimation(0, "男主指人说话", true)
});
})
},
(func) => {
nanzhuSpine.node.active = false
fanpaiSpine.setAnimation(0, "反派抓衣领反派说话", true)
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
});
},
]
const dialogCallFunc = (logEvents: any[]) => {
logEvents.shift()(() => {
if (logEvents.length > 0) {
dialogCallFunc(logEvents);
} else {
// TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_604)
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_605)
// PrefabManage.loadPrefabByType(GameType.CityPrefab)
User.setRoomBtnIndex(0)
PrefabManage.showBlackGuoDu(() => {
PrefabManage.loadPrefabByType(GameType.RoomCommon, null, (prefab) => {
let parentNode = prefab.getComponent(RoomCommon).getMainNode()
PrefabManage.loadPrefabByType(GameType.DH_9, parentNode)
})
this.node.destroy()
},null,"男主被傅少赶出医院后...")
}
});
}
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);
}
}