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.
236 lines
10 KiB
236 lines
10 KiB
2 months 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 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_5')
|
||
|
export default class DH_5 extends DHBase {
|
||
|
chatConfig = [
|
||
|
{ effectUrl: 'DH/DH_5/sound/汉升哥哥,你太厉害了,我这伤一下就好了。', delayTime: 3.91, str: '汉升哥哥,你太厉害了,我这伤一下就好了。', posi: 'qipao1' },
|
||
|
]
|
||
|
|
||
|
@property(sp.Skeleton)
|
||
|
nanzhu: sp.Skeleton = null
|
||
|
|
||
|
|
||
|
@property(sp.Skeleton)
|
||
|
suyao: sp.Skeleton = null
|
||
|
@property(sp.Skeleton)
|
||
|
suyao_zhiliao: sp.Skeleton = null
|
||
|
@property(sp.Skeleton)
|
||
|
suyao_haixiu: sp.Skeleton = null
|
||
|
|
||
|
@property(cc.Node)
|
||
|
m_bg: cc.Node = null
|
||
|
@property(cc.Node)
|
||
|
MoveNodes: cc.Node = null
|
||
|
// @property(cc.Node)
|
||
|
// buttons: cc.Node = null
|
||
|
taskGoodStep: any = 0;
|
||
|
isPengYao: boolean;
|
||
|
|
||
|
start() {
|
||
|
Common5.playRemoteAudioMusic('remotesound/effect/暧昧-10秒', true)
|
||
|
Common5.preLoadRemoteAudioByChatConfig(this.chatConfig);
|
||
|
super.start();
|
||
|
this.nanzhu.node.active = false
|
||
|
this.suyao.node.active = false
|
||
|
this.suyao_haixiu.node.active = false
|
||
|
this.suyao_zhiliao.node.active = true
|
||
|
this.suyao_zhiliao.setAnimation(0, "待机1", true)
|
||
|
this.scheduleOnce(() => {
|
||
|
PrefabManage.preloadPrefabByType(GameType.DH_6)
|
||
|
})
|
||
|
|
||
|
EventMgr.onEvent_custom(ryw_Event.goodTouchMoveCheck, (targetNode) => {
|
||
|
this.checkTaskGoodStep(targetNode);
|
||
|
}, this);
|
||
|
}
|
||
|
|
||
|
checkTaskGoodStep(targetNode) {
|
||
|
let rightStepTab = ['碘酒', '药水', '毛巾']
|
||
|
|
||
|
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
|
||
|
let mainId = mainTaskInfo.Id
|
||
|
let callFunc = (typeStr) => {
|
||
|
if (typeStr == 0) {
|
||
|
let zhiliao = this.m_bg.getChildByName('治疗').getComponent(sp.Skeleton)
|
||
|
if (targetNode.parent.name == '碘酒') {
|
||
|
zhiliao.setAnimation(0, "碘酒", false)
|
||
|
Common5.playRemoteAudioEffect('remotesound/effect/擦药声')
|
||
|
} else if (targetNode.parent.name == '药水') {
|
||
|
zhiliao.setAnimation(0, "喷药", false)
|
||
|
Common5.playRemoteAudioEffect('remotesound/effect/喷药声')
|
||
|
this.isPengYao = true
|
||
|
zhiliao.setCompleteListener(() => {
|
||
|
Common5.playRemoteAudioEffect('remotesound/effect/女啊声_1')
|
||
|
// this.scheduleOnce(() => {
|
||
|
// Common5.playRemoteAudioEffect('remotesound/effect/女啊声')
|
||
|
// }, 0.5)
|
||
|
zhiliao.setCompleteListener(null)
|
||
|
zhiliao.setAnimation(0, "按摩", false)
|
||
|
zhiliao.setCompleteListener(() => {
|
||
|
zhiliao.setCompleteListener(null)
|
||
|
zhiliao.setAnimation(0, "按摩", false)
|
||
|
zhiliao.setCompleteListener(() => {
|
||
|
zhiliao.setCompleteListener(null)
|
||
|
// this.buttons.active = true
|
||
|
PrefabManage.loadPrefabByType(GameType.selectButtons, this.node, (node) => {
|
||
|
let strs = ['按久一点', '不用了']
|
||
|
let actives = [true, true]
|
||
|
let funcs = [
|
||
|
() => {
|
||
|
let anmoindex = 0
|
||
|
Common5.playRemoteAudioEffect('remotesound/effect/女啊声_1')
|
||
|
this.scheduleOnce(()=>{
|
||
|
Common5.playRemoteAudioEffect('remotesound/effect/女啊声_1')
|
||
|
},1)
|
||
|
this.suyao_zhiliao.setAnimation(0, "按摩", true)
|
||
|
this.suyao_zhiliao.setCompleteListener(() => {
|
||
|
anmoindex++
|
||
|
// this.scheduleOnce(() => {
|
||
|
// Common5.playRemoteAudioEffect('remotesound/effect/女呻吟-大')
|
||
|
// }, 1)
|
||
|
if (anmoindex >= 3) {
|
||
|
this.suyao_zhiliao.setCompleteListener(null)
|
||
|
this.suyao_zhiliao.setAnimation(0, "按摩", false)
|
||
|
this.suyao_zhiliao.setCompleteListener(() => {
|
||
|
this.suyao_zhiliao.setCompleteListener(null)
|
||
|
this.isPengYao = false
|
||
|
this.suyao_zhiliao.setAnimation(0, "待机1", true)
|
||
|
})
|
||
|
}
|
||
|
})
|
||
|
},
|
||
|
() => {
|
||
|
this.isPengYao = false
|
||
|
this.suyao_zhiliao.setAnimation(0, "待机1", true)
|
||
|
},
|
||
|
]
|
||
|
let isvideo = [true, false]
|
||
|
node.getComponent(selectButtons).init(strs, actives, funcs, isvideo)
|
||
|
})
|
||
|
})
|
||
|
})
|
||
|
})
|
||
|
} else if (targetNode.parent.name == '毛巾') {
|
||
|
zhiliao.setAnimation(0, "毛巾", false)
|
||
|
zhiliao.setCompleteListener(() => {
|
||
|
zhiliao.setCompleteListener(null)
|
||
|
zhiliao.setAnimation(0, "待机2", true)
|
||
|
this.suyao_zhiliao.node.active = false
|
||
|
this.suyao_haixiu.node.active = true
|
||
|
this.node.getChildByName("nodex").active = false
|
||
|
this.showQiPao(this.chatConfig[this.dialogIndex++], () => {
|
||
|
this.suyao_haixiu.node.active = false
|
||
|
this.nanzhu.node.active = true
|
||
|
this.suyao.node.active = true
|
||
|
this.goTask()
|
||
|
});
|
||
|
})
|
||
|
}
|
||
|
} else if (typeStr == 1) {
|
||
|
PrefabManage.showTextTips("选错啦")
|
||
|
// let wrongTip = this.m_bg.getChildByName('wrongTip')
|
||
|
// wrongTip.stopAllActions()
|
||
|
// cc.tween(wrongTip)
|
||
|
// .set({ active: true, scale: 0 })
|
||
|
// .to(0.2, { scale: 1 })
|
||
|
// .delay(2)
|
||
|
// .to(0.2, { scale: 0 })
|
||
|
// .set({ active: false })
|
||
|
// .start()
|
||
|
}
|
||
|
}
|
||
|
//结束操作后弹框成功或失败
|
||
|
if (targetNode.parent.name == rightStepTab[this.taskGoodStep]) {
|
||
|
if (targetNode.parent.name == "毛巾" && this.isPengYao) {
|
||
|
//先按摩
|
||
|
console.log('物品错误', targetNode.parent.name)
|
||
|
callFunc(1)
|
||
|
} else {
|
||
|
console.log('物品正确', targetNode.parent.name)
|
||
|
this.taskGoodStep++
|
||
|
// if (this.taskGoodStep >= rightStepTab.length) {
|
||
|
// this.scheduleOnce(() => {
|
||
|
// this.goTask()
|
||
|
// }, 2)
|
||
|
// }
|
||
|
callFunc(0)
|
||
|
}
|
||
|
|
||
|
} else {
|
||
|
console.log('物品错误', targetNode.parent.name)
|
||
|
callFunc(1)
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
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()
|
||
|
}
|
||
|
|
||
|
// onTouchSelect1() {
|
||
|
// this.buttons.active = false
|
||
|
// this.suyao_zhiliao.setAnimation(0, "按摩", false)
|
||
|
// this.suyao_zhiliao.setCompleteListener(() => {
|
||
|
// this.suyao_zhiliao.setCompleteListener(null)
|
||
|
// this.suyao_zhiliao.setAnimation(0, "按摩", false)
|
||
|
// this.suyao_zhiliao.setCompleteListener(() => {
|
||
|
// this.suyao_zhiliao.setCompleteListener(null)
|
||
|
// this.isPengYao = false
|
||
|
// this.suyao_zhiliao.setAnimation(0, "待机1", true)
|
||
|
// })
|
||
|
// })
|
||
|
// }
|
||
|
|
||
|
// onTouchSelect2() {
|
||
|
// this.buttons.active = false
|
||
|
// this.isPengYao = false
|
||
|
// this.suyao_zhiliao.setAnimation(0, "待机1", true)
|
||
|
// }
|
||
|
|
||
|
|
||
|
goTask() {
|
||
|
User.setFirstStepIndex(5)
|
||
|
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_502)
|
||
|
TaskManager.setCurTask(MainTaskIdEnum.MainTask_503)
|
||
|
PrefabManage.loadPrefabByType(GameType.DH_6)
|
||
|
this.node.removeFromParent()
|
||
|
this.node.destroy()
|
||
|
}
|
||
|
}
|