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

433 lines
22 KiB

3 months ago
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";
import taskState from "./taskState";
const { ccclass, property, disallowMultiple, menu } = cc._decorator;
@ccclass
@disallowMultiple()
@menu('对话剧情/DH_27')
export default class DH_27 extends DHBase {
chatConfig = [
{ effectUrl: 'DH/DH_27/sound/汉升哥哥,我们终于搬到市区来了,我太开心了。', delayTime: 3.88, str: '汉升哥哥,我们终于搬到市区来了,我太开心了。', posi: 'qipao2' },
{ effectUrl: 'DH/DH_27/sound/你这是要跟我求婚吗?太快了吧。', delayTime: 3.57, str: '你这是要跟我求婚吗?太快了吧。', posi: 'qipao2' },
{ effectUrl: 'DH/DH_27/sound/你还记得我喜欢这个花啊,太爱你了,汉升哥哥。', delayTime: 4.35, str: '你还记得我喜欢这个花啊,太爱你了,汉升哥哥。', posi: 'qipao2' },
{ effectUrl: 'DH/DH_27/sound/汉升哥哥,我在你眼里就是一个势力的女人吗?', delayTime: 4.19, str: '汉升哥哥,我在你眼里就是一个势力的女人吗?', posi: 'qipao2' },
{ effectUrl: 'DH/DH_27/sound/瑶瑶,最近一直摆摊你肯定全身酸痛吧!', delayTime: 3.46, str: '瑶瑶,最近一直摆摊你肯定全身酸痛吧!', posi: '-1' },
{ effectUrl: 'DH/DH_27/sound/讨厌,汉升哥哥,你就想着占我便宜。', delayTime: 3.52, str: '讨厌,汉升哥哥,你就想着占我便宜。', posi: 'qipao2' },
{ effectUrl: 'DH/DH_27/sound/那汉升哥哥你帮我按按腿吧,我都要站不稳了。', delayTime: 4.9, str: '那汉升哥哥你帮我按按腿吧,我都要站不稳了。', posi: 'qipao2' },
{ effectUrl: 'DH/DH_27/sound/讨厌,汉升哥哥,这里不行啦', delayTime: 3.2, str: '讨厌,汉升哥哥,这里不行啦', posi: 'qipao1' },
{ effectUrl: 'DH/DH_27/sound/你竟然不亲自帮我,让我去医院?', delayTime: 2.57, str: '你竟然不亲自帮我,让我去医院?', posi: 'qipao2' },
{ effectUrl: 'DH/DH_27/sound/汉升哥哥,你今晚要过来跟我一起睡吗?', delayTime: 4.35, str: '汉升哥哥,你今晚要过来跟我一起睡吗?', posi: 'qipao2' },
{ effectUrl: 'DH/DH_27/sound/什么!你竟然还拒绝?', delayTime: 2.13, str: '什么!你竟然还拒绝?', posi: 'qipao2' },
{ effectUrl: 'DH/DH_27/sound/汉升哥哥,你怎么能这样,人家还没和你结婚呢?', delayTime: 4.19, str: '汉升哥哥,你怎么能这样,人家还没和你结婚呢?', posi: 'qipao2' },
{ effectUrl: 'DH/DH_27/sound/哼,算你识相!', delayTime: 1.53, str: '哼,算你识相!', posi: 'qipao2' },
{ effectUrl: 'DH/DH_27/sound/瑶瑶,最近一直摆摊你肯定全身酸痛吧!', delayTime: 3.46, str: '瑶瑶,最近一直摆摊你肯定全身酸痛吧!', posi: '-1' },
]
@property(sp.Skeleton)
suyao: sp.Skeleton = null
@property(sp.Skeleton)
anmo: sp.Skeleton = null
@property(sp.Skeleton)
songhua: sp.Skeleton = null
@property(cc.Node)
m_bg: cc.Node = null
@property(cc.Node)
MoveNodes: cc.Node = null
@property(cc.Node)
touchnode: cc.Node = null
@property(cc.Node)
chouti: cc.Node = null
@property(cc.Node)
anmobg: cc.Node = null
pigu: boolean = false;
start() {
Common5.playRemoteAudioMusic("remotesound/effect/轻快-10秒", true)
Common5.preLoadRemoteAudioByChatConfig(this.chatConfig);
super.start();
this.continueStory();
// this.scheduleOnce(() => {
// PrefabManage.preloadPrefabByType(GameType.DH_279)
// })
}
// 继续剧情
continueStory() {
this.scheduleOnce(() => {
PrefabManage.preloadPrefabByType(GameType.DH_28)
})
this.touchnode.active = false
this.anmobg.active = false
this.suyao.setAnimation(0, "待机", true)
const dialogEvents = [
(func) => {
this.showQiPao(this.chatConfig[0], func, () => {
this.suyao.setAnimation(0, "开心说话", true)
});
},
(func) => {
this.suyao.setAnimation(0, "待机", true)
PrefabManage.loadPrefabByType(GameType.selectButtons, this.node, (node) => {
let strs = ['戒指', '鲜花', '包包']
let actives = [true, true, true]
let funcs = [
() => {
this.showQiPao(this.chatConfig[1], () => {
PrefabManage.loadPrefabByType(GameType.taskState, this.node, (node) => {
node.getComponent(taskState).showFail("任务失败。重新开始", () => {
this.continueStory()
}, () => {
this.suyao.node.active = false
this.songhua.node.active = true
this.songhua.setAnimation(0, "送花", false)
this.songhua.setCompleteListener(() => {
this.songhua.setCompleteListener(null)
this.showQiPao(this.chatConfig[2], () => {
this.suyao.node.active = true
this.songhua.node.active = false
this.suyao.setAnimation(0, "飞吻", false)
this.suyao.setCompleteListener(() => {
this.suyao.setCompleteListener(null)
func()
})
}, () => {
this.songhua.setAnimation(0, "抱花说话", true)
});
})
})
})
// PrefabManage.showTextTips("任务失败。重新开始")
// this.continueStory()
}, () => {
this.suyao.setAnimation(0, "开心说话", true)
});
},
() => {
this.suyao.node.active = false
this.songhua.node.active = true
this.songhua.setAnimation(0, "送花", false)
this.songhua.setCompleteListener(() => {
this.songhua.setCompleteListener(null)
this.showQiPao(this.chatConfig[2], () => {
this.suyao.node.active = true
this.songhua.node.active = false
this.suyao.setAnimation(0, "飞吻", false)
this.suyao.setCompleteListener(() => {
this.suyao.setCompleteListener(null)
func()
})
}, () => {
this.songhua.setAnimation(0, "抱花说话", true)
});
})
},
() => {
func()
// this.showQiPao(this.chatConfig[13], () => {
// func()
// // PrefabManage.loadPrefabByType(GameType.taskState, this.node, (node) => {
// // node.getComponent(taskState).showFail("任务失败。重新开始", () => {
// // this.continueStory()
// // }, () => {
// // this.suyao.node.active = false
// // this.songhua.node.active = true
// // this.songhua.setAnimation(0, "送花", false)
// // this.songhua.setCompleteListener(() => {
// // this.songhua.setCompleteListener(null)
// // this.showQiPao(this.chatConfig[2], () => {
// // this.suyao.node.active = true
// // this.songhua.node.active = false
// // this.suyao.setAnimation(0, "飞吻", false)
// // this.suyao.setCompleteListener(() => {
// // this.suyao.setCompleteListener(null)
// // func()
// // })
// // }, () => {
// // this.songhua.setAnimation(0, "抱花说话", true)
// // });
// // })
// // })
// // })
// // PrefabManage.showTextTips("任务失败。重新开始")
// // this.continueStory()
// }, () => {
// // this.suyao.setAnimation(0, "失望说话", true)
// });
}
]
let isvideo = [false, true, false]
node.getComponent(selectButtons).init(strs, actives, funcs, isvideo)
node.getComponent(selectButtons).setTitle("请选择送给苏瑶的礼物")
})
},
(func) => {
this.suyao.setAnimation(0, "待机", true)
this.showQiPao(this.chatConfig[4], func, () => {
});
},
(func) => {
PrefabManage.loadPrefabByType(GameType.selectButtons, this.node, (node) => {
let strs = ['帮苏瑶洗澡推油', '帮苏瑶按摩', '带苏瑶去医院']
let actives = [true, true, true]
let funcs = [
() => {
this.showQiPao(this.chatConfig[5], () => {
PrefabManage.loadPrefabByType(GameType.taskState, this.node, (node) => {
node.getComponent(taskState).showFail("任务失败。重新开始", () => {
this.continueStory()
}, () => {
this.showQiPao(this.chatConfig[6], () => {
func()
}, () => {
this.suyao.setAnimation(0, "开心说话", true)
});
})
})
// PrefabManage.showTextTips("任务失败。重新开始")
// this.continueStory()
}, () => {
this.suyao.setAnimation(0, "开心说话", true)
});
},
() => {
this.showQiPao(this.chatConfig[6], () => {
func()
}, () => {
this.suyao.setAnimation(0, "开心说话", true)
});
},
() => {
this.continueStory1()
// this.showQiPao(this.chatConfig[8], () => {
// PrefabManage.loadPrefabByType(GameType.taskState, this.node, (node) => {
// node.getComponent(taskState).showFail("任务失败。重新开始", () => {
// this.continueStory()
// }, () => {
// this.showQiPao(this.chatConfig[6], () => {
// func()
// }, () => {
// this.suyao.setAnimation(0, "开心说话", true)
// });
// })
// })
// }, () => {
// this.suyao.setAnimation(0, "失望说话", true)
// });
}
]
let isvideo = [false, true, false]
node.getComponent(selectButtons).init(strs, actives, funcs, isvideo)
})
},
(func) => {
this.anmobg.active = true
this.anmo.setAnimation(0, "待机", true)
let node = this.anmobg.getChildByName("guide")
this.guideView([node])
},
]
const dialogCallFunc = (logEvents: any[]) => {
logEvents.shift()(() => {
if (logEvents.length > 0) {
dialogCallFunc(logEvents);
} else {
// this.suyao.setAnimation(0, "待机", true)
// TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_531)
// TaskManager.setCurTask(MainTaskIdEnum.MainTask_532)
// PrefabManage.showBlackGuoDu(() => {
// 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_269")
// // UserManager.clearAndaddStructureFlash("cf_FengRenYuan")
// });
// });
// TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_202)
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_203)
// this.node.destroy()
}
});
}
dialogCallFunc(dialogEvents);
}
// 继续剧情
continueStory1() {
this.anmobg.active = false
this.touchnode.active = false
this.suyao.setAnimation(0, "待机", true)
const dialogEvents = [
(func) => {
this.showQiPao(this.chatConfig[9], func, () => {
this.suyao.setAnimation(0, "开心说话", true)
});
},
(func) => {
this.suyao.setAnimation(0, "待机", true)
PrefabManage.loadPrefabByType(GameType.selectButtons, this.node, (node) => {
let strs = ['拒绝', '接受', '都不选,送苏瑶玩偶']
let actives = [true, true, true]
let funcs = [
() => {
this.showQiPao(this.chatConfig[10], () => {
PrefabManage.loadPrefabByType(GameType.taskState, this.node, (node) => {
node.getComponent(taskState).showFail("任务失败。重新开始", () => {
this.continueStory1()
}, () => {
this.chouti.active = true
})
})
// PrefabManage.showTextTips("任务失败。重新开始")
// this.continueStory1()
}, () => {
this.suyao.setAnimation(0, "失望说话", true)
});
},
() => {
this.showQiPao(this.chatConfig[11], () => {
this.goTask()
// PrefabManage.loadPrefabByType(GameType.taskState, this.node, (node) => {
// node.getComponent(taskState).showFail("任务失败。重新开始", () => {
// this.continueStory1()
// }, () => {
// this.chouti.active = true
// })
// })
}, () => {
this.suyao.setAnimation(0, "开心说话", true)
});
},
() => {
// this.touchnode.active = true
this.onTouch()
this.guideView([this.chouti])
}
]
let isvideo = [false, false, true]
node.getComponent(selectButtons).init(strs, actives, funcs, isvideo)
})
},
]
const dialogCallFunc = (logEvents: any[]) => {
logEvents.shift()(() => {
if (logEvents.length > 0) {
dialogCallFunc(logEvents);
} else {
// this.suyao.setAnimation(0, "待机", true)
// TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_531)
// TaskManager.setCurTask(MainTaskIdEnum.MainTask_532)
// PrefabManage.showBlackGuoDu(() => {
// 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_269")
// // 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()
}
onTouchAnmo(event) {
event.target.active = false
Common5.playRemoteAudioEffect('remotesound/effect/心跳', true)
this.anmo.setAnimation(0, "按摩连续", true)
this.scheduleOnce(() => {
this.continueStory1()
cc.audioEngine.stopAllEffects()
}, 10)
}
onTouchPiGu() {
if (!this.pigu) {
this.pigu = true
this.showQiPao(this.chatConfig[7], () => {
}, () => {
});
}
}
onTouch() {
this.touchnode.active = false
this.chouti.active = true
}
onTouchxianglian() {
this.scheduleOnce(() => {
Common5.playRemoteAudioEffect('remotesound/effect/暧昧-10秒')
}, 0.1)
this.chouti.active = false
this.suyao.setAnimation(0, "抱礼物待机", true)
this.showQiPao(this.chatConfig[12], () => {
this.goTask()
}, () => {
this.suyao.setAnimation(0, "抱礼物说话", true)
});
}
goTask() {
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_533)
TaskManager.setCurTask(MainTaskIdEnum.MainTask_534_1)
PrefabManage.showBlackGuoDu(() => {
PrefabManage.loadPrefabByType(GameType.DH_28)
this.node.removeFromParent()
this.node.destroy()
})
}
}