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.
389 lines
17 KiB
389 lines
17 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";
|
|
import selectButtons from "./selectButtons";
|
|
const { ccclass, property, disallowMultiple, menu } = cc._decorator;
|
|
|
|
@ccclass
|
|
@disallowMultiple()
|
|
@menu('对话剧情/DH_4')
|
|
export default class DH_4 extends DHBase {
|
|
chatConfig = [
|
|
{ effectUrl: 'DH/DH_4/sound/不可能的,不可能的。', delayTime: 1.84, str: '不可能的,不可能的。', posi: '-1' },
|
|
{ effectUrl: 'DH/DH_4/sound/汉升哥哥、在家吗', delayTime: 2.05, str: '汉升哥哥、在家吗', posi: 'qipao2' },
|
|
{ effectUrl: 'DH/DH_4/sound/嗯?这怎么回到老家了。我这是重生了?', delayTime: 4.87, str: '嗯?这怎么回到老家了。我这是重生了?', posi: '-1' },
|
|
{ effectUrl: 'DH/DH_4/sound/2020年?我回到10年前了?', delayTime: 3.59, str: '2020年?我回到10年前了?', posi: '-1' },
|
|
{ effectUrl: 'DH/DH_4/sound/瑶瑶,怎么了,你那酒鬼父亲又打你了?', delayTime: 4.38, str: '瑶瑶,怎么了,你那酒鬼父亲又打你了?', posi: '-1' },
|
|
// { effectUrl: 'DH/DH_4/sound/汉升哥哥,你帮帮我。', delayTime: 2.13, str: '汉升哥哥,你帮帮我。', posi: 'qipao1' },
|
|
{ effectUrl: 'DH/DH_4/sound/我爸用50万把我卖给了龙哥,我逃出来的时候被他弄伤了。', delayTime: 5.37, str: '我爸用50万把我卖给了龙哥,我逃出来的时候被他弄伤了。', posi: 'qipao1' },
|
|
{ effectUrl: 'DH/DH_4/sound/真是畜生!瑶瑶,伤到哪了?我先给你擦下药吧。', delayTime: 5.45, str: '真是畜生!瑶瑶,伤到哪了?我先给你擦下药吧。', posi: '-1' },
|
|
{ effectUrl: 'DH/DH_4/sound/他打到我后背了,谢谢你,汉升哥哥。', delayTime: 3.88, str: '他打到我后背了,谢谢你,汉升哥哥。', posi: 'qipao1' },
|
|
{ effectUrl: 'DH/DH_4/sound/汉升哥哥,你帮帮我。', delayTime: 2.13, str: '汉升哥哥,你帮帮我。', posi: 'qipao1' },
|
|
{ effectUrl: 'DH/DH_4/sound/你没救了,直男癌晚期!', delayTime: 3, str: '你没救了,直男癌晚期!', posi: '-1' },
|
|
// { effectUrl: 'DH/DH_4/sound/我愿称你为天下第一犟', delayTime: 3, str: '我愿称你为天下第一犟', posi: '-1' },
|
|
]
|
|
|
|
@property(sp.Skeleton)
|
|
nanzhu: sp.Skeleton = null
|
|
|
|
@property(sp.Skeleton)
|
|
nanzhu_zhanqi: sp.Skeleton = null
|
|
|
|
@property(sp.Skeleton)
|
|
suyao: sp.Skeleton = null
|
|
|
|
@property(sp.Skeleton)
|
|
yinxiao: sp.Skeleton = null
|
|
|
|
@property(cc.Node)
|
|
m_bg: cc.Node = null
|
|
@property(cc.Node)
|
|
MoveNodes: cc.Node = null
|
|
|
|
@property(cc.Node)
|
|
opendoor: cc.Node = null
|
|
// @property(cc.Node)
|
|
// buttons: cc.Node = null
|
|
selectNum: number = 0;
|
|
|
|
start() {
|
|
Common5.playRemoteAudioMusic("remotesound/effect/轻快-10秒", true)
|
|
Common5.preLoadRemoteAudioByChatConfig(this.chatConfig);
|
|
super.start();
|
|
this.continueStory();
|
|
// this.scheduleOnce(() => {
|
|
// PrefabManage.preloadPrefabByType(GameType.DH_49)
|
|
// })
|
|
}
|
|
|
|
// 继续剧情
|
|
continueStory() {
|
|
this.scheduleOnce(() => {
|
|
PrefabManage.preloadPrefabByType(GameType.DH_5)
|
|
})
|
|
this.m_bg.getChildByName("开门").active = false
|
|
this.nanzhu_zhanqi.node.active = false
|
|
this.nanzhu.node.active = true
|
|
this.nanzhu.setAnimation(0, "男主躺皱眉待机", true)
|
|
this.suyao.node.active = false
|
|
this.yinxiao.node.active = false
|
|
const dialogEvents = [
|
|
(func) => {
|
|
this.runBg(1, 3, this.MoveNodes.getChildByName("男主"), () => {
|
|
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
|
|
this.nanzhu.setAnimation(0, "男主躺皱眉说话", true)
|
|
});
|
|
});
|
|
},
|
|
(func) => {
|
|
this.nanzhu.setAnimation(0, "男主躺皱眉待机", true)
|
|
// this.runBg(1, 3, this.MoveNodes.getChildByName("门"), () => {
|
|
this.yinxiao.node.active = true
|
|
this.yinxiao.setAnimation(0, "音效", true)
|
|
Common5.playRemoteAudioEffect('remotesound/effect/敲门')
|
|
this.scheduleOnce(() => {
|
|
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
|
|
// this.nanzhu.setAnimation(0, "说话", true)
|
|
});
|
|
}, 1)
|
|
// });
|
|
},
|
|
(func) => {
|
|
this.yinxiao.node.active = false
|
|
this.runBg(1, 3, this.MoveNodes.getChildByName("男主"), () => {
|
|
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
|
|
this.nanzhu.setAnimation(0, "男主坐说话", true)
|
|
});
|
|
});
|
|
},
|
|
// (func) => {
|
|
// this.nanzhu.setAnimation(0, "男主坐", true)
|
|
// this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
|
|
// this.nanzhu.setAnimation(0, "男主坐说话", true)
|
|
// });
|
|
// },
|
|
(func) => {
|
|
this.nanzhu.setAnimation(0, "男主抬头坐", true)
|
|
this.runBg(1, 1.5, this.MoveNodes.getChildByName("男主日历"), () => {
|
|
let node = this.m_bg.getChildByName('guide')
|
|
node.active = true
|
|
this.guideView([node], 100)
|
|
// this.scheduleOnce(() => {
|
|
// func()
|
|
// }, 1)
|
|
});
|
|
},
|
|
// (func) => {
|
|
// this.runBg(1, 3, this.MoveNodes.getChildByName("男主"), () => {
|
|
// this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
|
|
// this.nanzhu.setAnimation(0, "男主抬头坐说话", true)
|
|
// });
|
|
// });
|
|
// },
|
|
// (func) => {
|
|
// this.nanzhu_zhanqi.node.active = true
|
|
// this.nanzhu.node.active = false
|
|
// // this.nanzhu.setAnimation(0, "男主抬头坐", true)
|
|
// this.nanzhu_zhanqi.setAnimation(0, "下床走动", false)
|
|
// this.nanzhu_zhanqi.setCompleteListener(() => {
|
|
// this.nanzhu_zhanqi.setCompleteListener(null)
|
|
// this.opendoor.active = true
|
|
// this.nanzhu_zhanqi.setAnimation(0, "待机", true)
|
|
// })
|
|
// this.runBg(1, 1, this.node, () => {
|
|
|
|
// });
|
|
// },
|
|
]
|
|
const dialogCallFunc = (logEvents: any[]) => {
|
|
logEvents.shift()(() => {
|
|
if (logEvents.length > 0) {
|
|
dialogCallFunc(logEvents);
|
|
} else {
|
|
// 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_49")
|
|
// // UserManager.clearAndaddStructureFlash("cf_FengRenYuan")
|
|
// });
|
|
// });
|
|
// TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_202)
|
|
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_203)
|
|
// this.node.destroy()
|
|
}
|
|
});
|
|
}
|
|
dialogCallFunc(dialogEvents);
|
|
}
|
|
|
|
// 继续剧情
|
|
continueStory2() {
|
|
const dialogEvents = [
|
|
(func) => {
|
|
// this.suyao.node.active = true
|
|
let posi = this.suyao.node.position.clone()
|
|
cc.tween(this.suyao.node)
|
|
.sequence(
|
|
cc.tween().by(0, { position: cc.v3(-1000, 0, 0) }),
|
|
cc.tween().set({ active: true }),
|
|
cc.tween().to(0.5, { position: posi }),
|
|
cc.tween().call(() => {
|
|
func()
|
|
})
|
|
)
|
|
.start()
|
|
},
|
|
(func) => {
|
|
this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => {
|
|
this.nanzhu_zhanqi.setAnimation(0, "说话", true)
|
|
});
|
|
},
|
|
(func) => {
|
|
this.nanzhu_zhanqi.setAnimation(0, "待机", true)
|
|
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
|
|
this.suyao.setAnimation(0, "说话", true)
|
|
});
|
|
},
|
|
// (func) => {
|
|
// this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
|
|
// this.suyao.setAnimation(0, "说话", true)
|
|
// });
|
|
// },
|
|
(func) => {
|
|
this.suyao.setAnimation(0, "待机", true)
|
|
this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => {
|
|
this.nanzhu_zhanqi.setAnimation(0, "说话", true)
|
|
});
|
|
},
|
|
(func) => {
|
|
this.nanzhu_zhanqi.setAnimation(0, "待机", true)
|
|
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
|
|
this.suyao.setAnimation(0, "说话", true)
|
|
});
|
|
},
|
|
(func) => {
|
|
this.suyao.setAnimation(0, "待机", true)
|
|
// this.buttons.active = true
|
|
// this.selectNum = 1
|
|
this.showSelect()
|
|
},
|
|
]
|
|
const dialogCallFunc = (logEvents: any[]) => {
|
|
logEvents.shift()(() => {
|
|
if (logEvents.length > 0) {
|
|
dialogCallFunc(logEvents);
|
|
} else {
|
|
// 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_49")
|
|
// // 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()
|
|
}
|
|
|
|
onTouchOpenDoor() {
|
|
this.opendoor.active = false
|
|
this.m_bg.getChildByName("开门").active = true
|
|
this.continueStory2()
|
|
}
|
|
|
|
showSelect() {
|
|
this.selectNum++
|
|
if (this.selectNum == 3) {
|
|
// this.showQiPao(this.chatConfig[this.dialogIndex++], () => {
|
|
this.goTask()
|
|
// });
|
|
return
|
|
}
|
|
PrefabManage.loadPrefabByType(GameType.selectButtons, this.node, (node) => {
|
|
let strs = ['帮苏瑶涂药,有惊喜哦!', '苏瑶自己涂药']
|
|
if (this.selectNum == 2) {
|
|
strs = ['帮苏瑶涂药,有惊喜哦!', '不帮,就让苏瑶自己涂!']
|
|
}
|
|
let actives = [true, true]
|
|
let funcs = [
|
|
() => {
|
|
this.goTask()
|
|
},
|
|
() => {
|
|
this.showQiPao(this.chatConfig[this.dialogIndex++], () => {
|
|
if (this.selectNum == 1) {
|
|
this.suyao.setAnimation(0, "待机", true)
|
|
}
|
|
this.showSelect()
|
|
}, () => {
|
|
if (this.selectNum == 1) {
|
|
this.suyao.setAnimation(0, "说话", true)
|
|
}
|
|
});
|
|
},
|
|
]
|
|
let isvideo = [true, false]
|
|
node.getComponent(selectButtons).init(strs, actives, funcs, isvideo)
|
|
|
|
if (this.selectNum == 2) {
|
|
node.getComponent(selectButtons).setTitle('苏瑶自己涂不到,求你帮忙')
|
|
}
|
|
})
|
|
}
|
|
|
|
// onTouchSelect1() {
|
|
// this.buttons.active = false
|
|
// this.goTask()
|
|
// }
|
|
|
|
// onTouchSelect2() {
|
|
// this.buttons.active = false
|
|
// if (this.selectNum == 1) {
|
|
// this.showQiPao(this.chatConfig[this.dialogIndex++], () => {
|
|
// this.buttons.active = true
|
|
// this.selectNum = 2
|
|
// });
|
|
// } else if (this.selectNum == 2) {
|
|
// this.showQiPao(this.chatConfig[this.dialogIndex++], () => {
|
|
// this.buttons.active = true
|
|
// this.selectNum = 3
|
|
// });
|
|
// } else if (this.selectNum == 3) {
|
|
// this.showQiPao(this.chatConfig[this.dialogIndex++], () => {
|
|
// this.goTask()
|
|
// });
|
|
// }
|
|
|
|
// }
|
|
|
|
onTouchGuide(event) {
|
|
let node = event.target
|
|
node.active = false
|
|
this.node.getChildByName("日历").active = true
|
|
}
|
|
|
|
onTouchRiLi() {
|
|
Common5.playRemoteAudioEffect("remotesound/effect/游戏点击音效")
|
|
this.node.getChildByName("日历").active = false
|
|
this.runBg(1, 3, this.MoveNodes.getChildByName("男主"), () => {
|
|
this.showQiPao(this.chatConfig[this.dialogIndex++], () => {
|
|
this.nanzhu_zhanqi.node.active = true
|
|
this.nanzhu.node.active = false
|
|
// this.nanzhu.setAnimation(0, "男主抬头坐", true)
|
|
Common5.playRemoteAudioEffect('remotesound/effect/拖鞋走路')
|
|
this.nanzhu_zhanqi.setAnimation(0, "下床走动", false)
|
|
this.nanzhu_zhanqi.setCompleteListener(() => {
|
|
this.nanzhu_zhanqi.setCompleteListener(null)
|
|
// this.opendoor.active = true
|
|
this.nanzhu_zhanqi.setAnimation(0, "待机", true)
|
|
PrefabManage.loadPrefabByType(GameType.selectButtons, this.node, (node) => {
|
|
let strs = ['开门']
|
|
let actives = [true]
|
|
let funcs = [
|
|
() => {
|
|
this.onTouchOpenDoor()
|
|
Common5.playRemoteAudioEffect('remotesound/effect/开门声')
|
|
},
|
|
]
|
|
let isvideo = [false]
|
|
node.getComponent(selectButtons).init(strs, actives, funcs, isvideo)
|
|
})
|
|
})
|
|
this.runBg(0.5, 2, this.MoveNodes.getChildByName("走动男主"), () => {
|
|
this.runBg(2, 1, this.node, () => {
|
|
|
|
});
|
|
});
|
|
}, () => {
|
|
this.nanzhu.setAnimation(0, "男主抬头坐说话", true)
|
|
});
|
|
});
|
|
}
|
|
|
|
goTask() {
|
|
User.setFirstStepIndex(4)
|
|
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_501)
|
|
TaskManager.setCurTask(MainTaskIdEnum.MainTask_502)
|
|
PrefabManage.loadPrefabByType(GameType.DH_5)
|
|
this.node.removeFromParent()
|
|
this.node.destroy()
|
|
}
|
|
}
|
|
|