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

217 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_15 extends DHBase {
chatConfig = [
{ effectUrl: 'DH/DH_15/sound/辰哥,我舍不得你。', delayTime: 4.7, str: '辰哥,我舍不得你。', posi: 'qipao2' },
{ effectUrl: 'DH/DH_15/sound/能不走吗,我也舍不得你。', delayTime: 2.8, str: '能不走吗,我也舍不得你。', posi: '-1' },
{ effectUrl: 'DH/DH_15/sound/不行的,家族下了死命令。', delayTime: 3.4, str: '不行的,家族下了死命令。', posi: 'qipao2' },
{ effectUrl: 'DH/DH_15/sound/等我一会,我答应过你,给你买最好的东西。', delayTime: 3.7, str: '等我一会,我答应过你,给你买最好的东西。', posi: '-1' },
{ effectUrl: 'DH/DH_15/sound/等我,我一定会接你回来!', delayTime: 2.7, str: '等我,我一定会接你回来!', posi: '-1' },
]
@property(cc.Node)
anruoruo: cc.Node = null;
@property(cc.Node)
texie: cc.Node = null;
@property(cc.Node)
car: cc.Node = null;
@property(cc.Node)
baobiao: cc.Node = null;
start() {
this.scheduleOnce(() => {
PrefabManage.preloadPrefabByType(GameType.DH_16)
})
GameBaseScript.preLoadRemoteAudioByChatConfig(this.chatConfig);
super.start();
this.texie.active = false
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
let mainId = mainTaskInfo.Id
if (mainId == MainTaskIdEnum.MainTask_910) {
this.continueStory();
}
// this.scheduleOnce(() => {
// PrefabManage.preloadPrefabByType(GameType.DH_59)
// })
EventMgr.onceEvent_custom(ryw_Event.RefreshJuQingDuiHua, () => {
this.RefreshJuQingDuiHua();
}, this);
}
// 继续剧情
continueStory() {
let anruoruoSpine = this.anruoruo.getComponent(sp.Skeleton)
anruoruoSpine.setAnimation(0, "安若若", true)
const dialogEvents = [
(func) => {
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
anruoruoSpine.setAnimation(0, "安若若说话", true)
});
},
(func) => {
anruoruoSpine.setAnimation(0, "安若若", true)
this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => {
});
},
(func) => {
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
anruoruoSpine.setAnimation(0, "安若若说话", true)
});
},
(func) => {
anruoruoSpine.setAnimation(0, "安若若", true)
this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => {
});
},
]
const dialogCallFunc = (logEvents: any[]) => {
logEvents.shift()(() => {
if (logEvents.length > 0) {
dialogCallFunc(logEvents);
} else {
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_910)
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_911)
// PrefabManage.showBlackGuoDu(() => {
// PrefabManage.loadPrefabByType(GameType.CityPrefab)
// this.node.destroy()
// })
}
});
}
dialogCallFunc(dialogEvents);
}
// 继续剧情
RefreshJuQingDuiHua() {
let anruoruoSpine = this.anruoruo.getComponent(sp.Skeleton)
this.scheduleOnce(() => {
this.node.getChildByName("needGoodNode1").active = false
})
let texieSpine = this.texie.getComponent(sp.Skeleton)
this.texie.active = true
const dialogEvents = [
(func) => {
cc.tween(this.texie)
.sequence(
cc.tween().delay(2),
cc.tween().call(() => {
Common5.playRemoteAudioEffect("action_effect/亲吻");
texieSpine.setAnimation(0, "animation", false)
texieSpine.setCompleteListener(() => {
texieSpine.setCompleteListener(null)
func()
})
})
)
.start()
},
(func) => {
this.texie.active = false
anruoruoSpine.setAnimation(0, "安若若", true)
this.showClickDialog(this.chatConfig[4], func, () => {
});
},
(func) => {
cc.tween(this.anruoruo)
.sequence(
cc.tween().to(1, { opacity: 0 }),
cc.tween().delay(0.5),
cc.tween().call(() => {
func()
})
)
.start()
cc.tween(this.baobiao)
.sequence(
cc.tween().to(1, { opacity: 0 }),
cc.tween().delay(0.5),
cc.tween().call(() => {
})
)
.start()
},
(func) => {
cc.tween(this.car)
.sequence(
cc.tween().by(1, { position: cc.v3(-2000, 0, 0) }),
cc.tween().delay(0.5),
cc.tween().call(() => {
func()
})
)
.start()
},
]
const dialogCallFunc = (logEvents: any[]) => {
logEvents.shift()(() => {
if (logEvents.length > 0) {
dialogCallFunc(logEvents);
} else {
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_912)
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_1001)
EventMgr.emitEvent_custom(ryw_Event.EnterNextGame, true)
// PrefabManage.showBlackGuoDu(() => {
// PrefabManage.loadPrefabByType(GameType.CityPrefab)
// 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);
}
}