咸鱼的反击
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.
 
 
 

260 lines
13 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 selectButton from "./selectButton";
import selectButtons from "./selectButtons";
const { ccclass, property, disallowMultiple, menu } = cc._decorator;
@ccclass
@disallowMultiple()
@menu('对话剧情/DH_23')
export default class DH_23 extends DHBase {
chatConfig = [
{ effectUrl: 'DH/DH_23/sound/陈先生,我这次也是代表鸿福楼来邀请您的。', delayTime: 4.46, str: '陈先生,我这次也是代表鸿福楼来邀请您的。', posi: 'qipao2' },
{ effectUrl: 'DH/DH_23/sound/上次不是拒绝了吗,怎么这次换你这位美女来招揽了。', delayTime: 4.22, str: '上次不是拒绝了吗,怎么这次换你这位美女来招揽了。', posi: '-1' },
{ effectUrl: 'DH/DH_23/sound/嗯,我想再尝试劝劝您。陈先生,尝尝这个甜点。', delayTime: 5.21, str: '嗯,我想再尝试劝劝您。陈先生,尝尝这个甜点。', posi: 'qipao2' },
{ effectUrl: 'DH/DH_23/sound/嗯,跟你给人的感观一样,很清甜。', delayTime: 3.57, str: '嗯,跟你给人的感观一样,很清甜。', posi: '-1' },
{ effectUrl: 'DH/DH_23/sound/(接下来她应该会靠近我,帮我擦嘴吧)', delayTime: 2.89, str: '(接下来她应该会靠近我,帮我擦嘴吧)', posi: '-1' },
{ effectUrl: 'DH/DH_23/sound/是吗,那你喜欢清甜味的吗?你看你,跟个孩子样。', delayTime: 5.19, str: '是吗,那你喜欢清甜味的吗?你看你,跟个孩子样。', posi: 'qipao3' },
{ effectUrl: 'DH/DH_23/sound/嗯,我个人还是蛮喜欢的,但是我不会去鸿福楼的。', delayTime: 4.38, str: '嗯,我个人还是蛮喜欢的,但是我不会去鸿福楼的。', posi: '-1' },
{ effectUrl: 'DH/DH_23/sound/为什么?难道我这个美女都不能打动你吗?', delayTime: 4.82, str: '为什么?难道我这个美女都不能打动你吗?', posi: 'qipao3' },
{ effectUrl: 'DH/DH_23/sound/美女我有兴趣,但是去鸿福楼就算了吧。', delayTime: 3.15, str: '美女我有兴趣,但是去鸿福楼就算了吧。', posi: '-1' },
]
@property(sp.Skeleton)
nanzhu: sp.Skeleton = null
@property(sp.Skeleton)
liuruyan: sp.Skeleton = null
@property(sp.Skeleton)
daogao: sp.Skeleton = null
@property(cc.Node)
m_bg: cc.Node = null
@property(cc.Node)
MoveNodes: cc.Node = null
selectAccept: boolean;
start() {
Common5.playRemoteAudioMusic("remotesound/effect/轻快-10秒", true)
Common5.preLoadRemoteAudioByChatConfig(this.chatConfig);
super.start();
this.continueStory();
// this.scheduleOnce(() => {
// PrefabManage.preloadPrefabByType(GameType.DH_239)
// })
}
// 继续剧情
continueStory() {
this.scheduleOnce(() => {
PrefabManage.preloadPrefabByType(GameType.DH_24)
})
this.nanzhu.setAnimation(0, "男干净待机", true)
this.liuruyan.setAnimation(0, "女待机", true)
this.daogao.setAnimation(0, "蛋糕位置1", false)
const dialogEvents = [
(func) => {
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
this.liuruyan.setAnimation(0, "女说话", true)
});
},
(func) => {
this.liuruyan.setAnimation(0, "女待机", true)
this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => {
this.nanzhu.setAnimation(0, "男干净说话", true)
});
},
(func) => {
this.nanzhu.setAnimation(0, "男干净待机", true)
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
this.liuruyan.setAnimation(0, "女说话", true)
});
},
(func) => {
this.daogao.node.active = false
this.liuruyan.timeScale = 0.8
this.liuruyan.setAnimation(0, "女推蛋糕", false)
this.liuruyan.setCompleteListener(() => {
this.liuruyan.setCompleteListener(null)
this.liuruyan.setAnimation(0, "女待机", true)
this.nanzhu.timeScale = 0.8
this.nanzhu.setAnimation(0, "男吃蛋糕", false)
this.nanzhu.setCompleteListener(() => {
this.nanzhu.setCompleteListener(null)
this.daogao.node.active = true
this.daogao.setAnimation(0, "蛋糕位置2", false)
this.liuruyan.timeScale = 1
this.nanzhu.timeScale = 1
this.nanzhu.setAnimation(0, "男嘴角蛋糕待机", true)
this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => {
this.nanzhu.setAnimation(0, "男嘴角蛋糕说话", true)
});
})
})
},
(func) => {
this.nanzhu.setAnimation(0, "男嘴角蛋糕待机", true)
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
});
},
(func) => {
this.nanzhu.setAnimation(0, "男嘴角蛋糕待机", true)
this.liuruyan.setAnimation(0, "女站起", false)
this.liuruyan.setCompleteListener(() => {
this.liuruyan.setCompleteListener(null)
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
this.liuruyan.setAnimation(0, "女站说话", true)
});
})
},
(func) => {
this.liuruyan.setAnimation(0, "女站待机", true)
PrefabManage.loadPrefabByType(GameType.selectButtons, this.node, (node) => {
let strs = ['拒绝擦嘴', '接受擦嘴']
let actives = [true, true]
let funcs = [
() => {
this.selectAccept = false
func()
},
() => {
this.selectAccept = true
this.runBg(1, 2, this.MoveNodes.getChildByName("男主"), () => {
this.nanzhu.node.active = false
this.liuruyan.timeScale = 0.4
Common5.playRemoteAudioMusic('remotesound/effect/暧昧-10秒', false)
this.scheduleOnce(() => {
Common5.playRemoteAudioEffect('remotesound/effect/心跳')
}, 0.1)
this.liuruyan.setAnimation(0, "女擦嘴角", false)
this.liuruyan.setCompleteListener(() => {
this.liuruyan.setCompleteListener(null)
this.liuruyan.timeScale = 1
this.liuruyan.setAnimation(0, "女站待机", true)
this.nanzhu.node.active = true
this.nanzhu.setAnimation(0, "男脸红待机", true)
this.runBg(1, 1, this.node, () => {
func()
})
})
})
},
]
let isvideo = [false, true]
node.getComponent(selectButtons).init(strs, actives, funcs, isvideo)
// node.getComponent(selectButton).init("拒绝擦嘴", "接受擦嘴", () => {
// this.selectAccept = false
// func()
// }, () => {
// this.selectAccept = true
// this.nanzhu.node.active = false
// this.liuruyan.setAnimation(0, "女擦嘴角", false)
// this.liuruyan.setCompleteListener(() => {
// this.liuruyan.setCompleteListener(null)
// this.liuruyan.setAnimation(0, "女站待机", true)
// this.nanzhu.node.active = true
// this.nanzhu.setAnimation(0, "男脸红待机", true)
// func()
// })
// }, false, true)
})
},
(func) => {
this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => {
if (this.selectAccept) {
this.nanzhu.setAnimation(0, "男脸红说话", true)
} else {
this.nanzhu.setAnimation(0, "男嘴角蛋糕说话", true)
}
});
},
(func) => {
if (this.selectAccept) {
this.nanzhu.setAnimation(0, "男脸红待机", true)
} else {
this.nanzhu.setAnimation(0, "男嘴角蛋糕待机", true)
}
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
this.liuruyan.setAnimation(0, "女站说话", true)
});
},
(func) => {
this.liuruyan.setAnimation(0, "女站待机", true)
this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => {
if (this.selectAccept) {
this.nanzhu.setAnimation(0, "男脸红说话", true)
} else {
this.nanzhu.setAnimation(0, "男嘴角蛋糕说话", true)
}
});
},
]
const dialogCallFunc = (logEvents: any[]) => {
logEvents.shift()(() => {
if (logEvents.length > 0) {
dialogCallFunc(logEvents);
} else {
if (this.selectAccept) {
this.nanzhu.setAnimation(0, "男脸红待机", true)
} else {
this.nanzhu.setAnimation(0, "男吃蛋糕待机", true)
}
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_525)
TaskManager.setCurTask(MainTaskIdEnum.MainTask_526)
PrefabManage.showBlackGuoDu(() => {
this.node.removeFromParent()
this.node.destroy()
PrefabManage.loadPrefabByType(GameType.MainHall)
})
// 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_239")
// // 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()
}
}