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.
147 lines
6.4 KiB
147 lines
6.4 KiB
import User from "../../FrameWork/User/User";
|
|
import Common5 from "../../Platform/th/Common5";
|
|
import GameBaseScript from "../GameRoomRes/GameBaseScript";
|
|
import TaskManager, { MainTaskIdEnum } from "../JuQingChat/TaskManager";
|
|
import UserManager from "../Manager/UserManager";
|
|
import NewGuideScript from "../NewGuide/NewGuideScript";
|
|
import PrefabManage, { GameType } from "../PrefabManager/PrefabManage";
|
|
import GetAward from "../SCommon/GetAward";
|
|
import DHBase from "./DHBase";
|
|
const { ccclass, property, disallowMultiple, menu } = cc._decorator;
|
|
|
|
@ccclass
|
|
@disallowMultiple()
|
|
@menu('对话剧情/DH_19')
|
|
export default class DH_19 extends DHBase {
|
|
chatConfig = [
|
|
{ effectUrl: 'DH/DH_19/sound/哈哈!汉升,不错,夺得了这青年美食大赛的冠军。', delayTime: 6.65, str: '哈哈!汉升,不错,夺得了这青年美食大赛的冠军。', posi: 'qipao2' },
|
|
{ effectUrl: 'DH/DH_19/sound/全是师傅教导的好。', delayTime: 1.32, str: '全是师傅教导的好。', posi: '-1' },
|
|
{ effectUrl: 'DH/DH_19/sound/回去好好练习我教你的东西,争取早点来市区发展。', delayTime: 5.24, str: '回去好好练习我教你的东西,争取早点来市区发展。', posi: 'qipao2' },
|
|
{ effectUrl: 'DH/DH_19/sound/好的师傅,我争取尽快达到二级面点师,早点去市区。', delayTime: 4.35, str: '好的师傅,我争取尽快达到二级面点师,早点去市区。', posi: '-1' },
|
|
{ effectUrl: 'DH/DH_19/sound/(柳家父子应该要过来了吧,哼!这次我先收点利息!)', delayTime: 4.87, str: '(柳家父子应该要过来了吧,哼!这次我先收点利息!)', posi: '-1' },
|
|
]
|
|
|
|
@property(sp.Skeleton)
|
|
spine: sp.Skeleton = null
|
|
@property(sp.Skeleton)
|
|
nanzhu: sp.Skeleton = null
|
|
|
|
@property(cc.Node)
|
|
m_bg: cc.Node = null
|
|
@property(cc.Node)
|
|
MoveNodes: cc.Node = null
|
|
|
|
start() {
|
|
Common5.playRemoteAudioMusic('remotesound/effect/颁奖-10秒', false)
|
|
Common5.preLoadRemoteAudioByChatConfig(this.chatConfig);
|
|
super.start();
|
|
this.continueStory();
|
|
// this.scheduleOnce(() => {
|
|
// PrefabManage.preloadPrefabByType(GameType.DH_199)
|
|
// })
|
|
}
|
|
|
|
// 继续剧情
|
|
continueStory() {
|
|
this.scheduleOnce(() => {
|
|
PrefabManage.preloadPrefabByType(GameType.DH_20)
|
|
})
|
|
this.spine.setAnimation(0, "待机", true)
|
|
const dialogEvents = [
|
|
(func) => {
|
|
this.scheduleOnce(() => {
|
|
this.runBg(2, 3, this.MoveNodes.getChildByName("颁奖"), () => {
|
|
func()
|
|
})
|
|
}, 1)
|
|
},
|
|
// (func) => {
|
|
// this.runBg(1, 1, this.node, () => {
|
|
// func()
|
|
// })
|
|
// },
|
|
(func) => {
|
|
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
|
|
this.spine.setAnimation(0, "老头说话", true)
|
|
});
|
|
},
|
|
(func) => {
|
|
this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => {
|
|
this.spine.setAnimation(0, "男主说话", true)
|
|
});
|
|
},
|
|
(func) => {
|
|
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
|
|
this.spine.setAnimation(0, "老头说话", true)
|
|
});
|
|
},
|
|
(func) => {
|
|
this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => {
|
|
this.spine.setAnimation(0, "男主说话", true)
|
|
});
|
|
},
|
|
(func) => {
|
|
this.spine.setAnimation(0, "待机", true)
|
|
this.runBg(1, 5, this.MoveNodes.getChildByName("男主"), () => {
|
|
this.spine.node.active = false
|
|
this.nanzhu.node.active = true
|
|
this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => {
|
|
// this.spine.setAnimation(0, "男主说话", true)
|
|
});
|
|
})
|
|
},
|
|
]
|
|
const dialogCallFunc = (logEvents: any[]) => {
|
|
logEvents.shift()(() => {
|
|
if (logEvents.length > 0) {
|
|
dialogCallFunc(logEvents);
|
|
} else {
|
|
this.spine.setAnimation(0, "待机", true)
|
|
PrefabManage.showBlackGuoDu(() => {
|
|
PrefabManage.loadPrefabByType(GameType.DH_20)
|
|
this.node.removeFromParent()
|
|
this.node.destroy()
|
|
})
|
|
// PrefabManage.loadPrefabByType(GameType.GetAward, null, (prefabNode) => {
|
|
// let goods = [{ goodId: 1733, goodNum: 1 }];
|
|
// prefabNode.getComponent(GetAward).initView(goods, () => {
|
|
// // TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_530)
|
|
// // User.setRoomGoodStatus("DH_199")
|
|
// // UserManager.clearAndaddStructureFlash("cf_FengRenYuan")
|
|
// });
|
|
// });
|
|
// TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_202)
|
|
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_203)
|
|
// this.node.destroy()
|
|
}
|
|
});
|
|
}
|
|
dialogCallFunc(dialogEvents);
|
|
}
|
|
|
|
guideView(nodeArray, opacity = -1) {
|
|
PrefabManage.loadPrefabByType(GameType.GuideMskNode, this.node, (prefab) => {
|
|
// prefab.zIndex = 199
|
|
let guideNodeArray = nodeArray
|
|
let firstNode = guideNodeArray.shift()
|
|
prefab.getComponent(NewGuideScript).setBindNode(firstNode, guideNodeArray)
|
|
if (opacity != -1) {
|
|
prefab.getComponent(NewGuideScript).setOpacityMaskNode(opacity)
|
|
}
|
|
})
|
|
}
|
|
|
|
runBg(time, scale, endnode, callFunc) {
|
|
cc.tween(this.m_bg)
|
|
.to(time, { scale: scale })
|
|
.start()
|
|
cc.tween(this.m_bg)
|
|
.sequence(
|
|
cc.tween().to(time, { position: cc.v2(-endnode.position.x * scale, -endnode.position.y * scale) }),
|
|
cc.tween().call(() => {
|
|
callFunc()
|
|
})
|
|
)
|
|
.start()
|
|
}
|
|
}
|
|
|