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

195 lines
7.8 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 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_22 extends DHBase {
chatConfig = [
{ effectUrl: 'DH/DH_22/sound/快还钱,还钱!', delayTime: 1.8, str: '快还钱,还钱!', posi: 'qipao2' },
{ effectUrl: 'DH/DH_22/sound/快还钱,还钱!', delayTime: 1.8, str: '快还钱,还钱!', posi: 'qipao3' },
{ effectUrl: 'DH/DH_22/sound/傅少,你真是好算计啊!', delayTime: 4.8, str: '傅少,你真是好算计啊!', posi: '-1' },
{ effectUrl: 'DH/DH_22/sound/今天不还,就告到你破产!', delayTime: 3, str: '今天不还,就告到你破产!', posi: 'qipao1' },
{ effectUrl: 'DH/DH_22/sound/哼!好戏还在后头呢!', delayTime: 3.2, str: '哼!好戏还在后头呢!', posi: 'qipao1' },
]
@property(sp.Skeleton)
fushao: sp.Skeleton = null;
@property(sp.Skeleton)
taizhai_1: sp.Skeleton = null;
@property(sp.Skeleton)
taizhai_2: sp.Skeleton = null;
start() {
this.scheduleOnce(() => {
PrefabManage.preloadPrefabByType(GameType.DH_23)
})
GameBaseScript.preLoadRemoteAudioByChatConfig(this.chatConfig);
super.start();
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
let mainId = mainTaskInfo.Id
if (mainId == MainTaskIdEnum.MainTask_1505) {
this.dialogIndex = 4;
// this.continueStory1();
// this.qianzong.node.active = false
// this.qianjicai.node.active = false
// this.touziren.node.active = false
// this.qianzong_big.node.active = true
this.node.getChildByName("needGoodNode1").active = true
this.node.getChildByName("needGoodNode2").active = true
this.fushao.setAnimation(0, "待机", true)
this.taizhai_1.setAnimation(0, "待机", true)
this.taizhai_2.setAnimation(0, "待机", true)
} else if (mainId > MainTaskIdEnum.MainTask_1503 && mainId < MainTaskIdEnum.MainTask_1505) {
} else {
// this.qianzong.node.active = true
// this.qianjicai.node.active = true
// this.touziren.node.active = true
// this.qianzong_big.node.active = false
this.continueStory();
}
// this.scheduleOnce(() => {
// PrefabManage.preloadPrefabByType(GameType.DH_59)
// })
// EventMgr.onEvent_custom(ryw_Event.RefreshJuQingDuiHua, () => {
// this.continueStory1();
// }, this);
}
// 继续剧情
continueStory() {
this.fushao.setAnimation(0, "待机", true)
this.taizhai_1.setAnimation(0, "待机", true)
this.taizhai_2.setAnimation(0, "待机", true)
const dialogEvents = [
(func) => {
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
this.taizhai_1.setAnimation(0, "说话", true)
this.showQiPao(this.chatConfig[this.dialogIndex++], null, () => {
this.taizhai_2.setAnimation(0, "说话", true)
});
});
},
(func) => {
this.taizhai_1.setAnimation(0, "待机", true)
this.taizhai_2.setAnimation(0, "待机", true)
this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => {
});
},
(func) => {
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
this.fushao.setAnimation(0, "说话", true)
});
},
(func) => {
this.fushao.setAnimation(0, "待机", true)
func()
},
]
const dialogCallFunc = (logEvents: any[]) => {
logEvents.shift()(() => {
if (logEvents.length > 0) {
dialogCallFunc(logEvents);
} else {
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_1502)
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_1503)
// PrefabManage.showBlackGuoDu(() => {
// this.node.destroy()
// })
}
});
}
dialogCallFunc(dialogEvents);
}
onTouchMoney1() {
UserManager.subMoney(800000000)
this.node.getChildByName("needGoodNode1").active = false
cc.tween(this.taizhai_1.node)
.to(0.5, { position: cc.v3(-1000, this.taizhai_1.node.position.y) })
.start()
this.checkTask()
}
onTouchMoney2() {
UserManager.subMoney(400000000)
this.node.getChildByName("needGoodNode2").active = false
cc.tween(this.taizhai_2.node)
.to(0.5, { position: cc.v3(-1000, this.taizhai_1.node.position.y) })
.start()
this.checkTask()
}
checkTask() {
if (!this.node.getChildByName("needGoodNode1").active && !this.node.getChildByName("needGoodNode2").active) {
this.showQiPao(this.chatConfig[this.dialogIndex++], () => {
cc.tween(this.fushao.node)
.sequence(
cc.tween().call(() => {
this.fushao.node.setScale(-1, 1, 1)
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_1505)
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_1601)
// PrefabManage.showBlackGuoDu(() => {
// this.node.destroy()
// })
}),
cc.tween().by(1, { position: cc.v3(1000, 0, 0) })
)
.start()
}, () => {
this.fushao.setAnimation(0, "说话", true)
});
}
}
// 震屏效果
// 参数: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);
}
}