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

174 lines
7.5 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_13')
export default class DH_13 extends DHBase {
chatConfig = [
{ effectUrl: 'DH/DH_13/sound/汉升哥哥,我们是不是要到镇中心去开店了呀。', delayTime: 3.46, str: '汉升哥哥,我们是不是要到镇中心去开店了呀。', posi: 'qipao2' },
{ effectUrl: 'DH/DH_13/sound/是要到镇中心去开店,还得买个房子,不然来回不方便。', delayTime: 4.77, str: '是要到镇中心去开店,还得买个房子,不然来回不方便。', posi: '-1' },
{ effectUrl: 'DH/DH_13/sound/汉升哥哥,那你会带我一起去吗?', delayTime: 3.36, str: '汉升哥哥,那你会带我一起去吗?', posi: 'qipao2' },
{ effectUrl: 'DH/DH_13/sound/当然,我怎么会丢下你呢?', delayTime: 2.81, str: '当然,我怎么会丢下你呢?', posi: '-1' },
]
@property(sp.Skeleton)
nanzhu: sp.Skeleton = null
@property(sp.Skeleton)
nvzhu: sp.Skeleton = null
@property(sp.Skeleton)
texie: sp.Skeleton = null
@property(cc.Node)
m_bg: cc.Node = null
@property(cc.Node)
MoveNodes: cc.Node = null
selectButtonIndex: number;
start() {
Common5.playRemoteAudioMusic("remotesound/effect/轻快-10秒", true)
Common5.preLoadRemoteAudioByChatConfig(this.chatConfig);
super.start();
this.continueStory();
// this.scheduleOnce(() => {
// PrefabManage.preloadPrefabByType(GameType.DH_139)
// })
}
// 继续剧情
continueStory() {
this.scheduleOnce(() => {
PrefabManage.preloadPrefabByType(GameType.DH_14)
})
this.nanzhu.setAnimation(0, "男主待机", true)
this.nvzhu.setAnimation(0, "女主待机", true)
const dialogEvents = [
(func) => {
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
this.nvzhu.setAnimation(0, "女主说话", true)
});
},
(func) => {
this.nvzhu.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.nvzhu.setAnimation(0, "女主皱眉说话", true)
});
},
(func) => {
this.nvzhu.setAnimation(0, "女主待机", true)
this.selectButtonIndex = 0
PrefabManage.loadPrefabByType(GameType.selectButtons, this.node, (node) => {
let strs = ['答应并上前摸摸头安慰', '我是直男,不搞暧昧']
let actives = [true, true]
let funcs = [
() => {
this.selectButtonIndex = 1
func()
},
() => {
this.selectButtonIndex = 2
func()
},
]
let isvideo = [true, false]
node.getComponent(selectButtons).init(strs, actives, funcs, isvideo)
})
},
(func) => {
if (this.selectButtonIndex == 1) {
// this.nvzhu.setAnimation(0, "女主皱眉待机", true)
this.runBg(1, 2, this.MoveNodes.getChildByName("女主"), () => {
})
this.nvzhu.node.active = false
this.nanzhu.setAnimation(0, "摸头", false)
this.nanzhu.setCompleteListener(() => {
this.nanzhu.setCompleteListener(null)
this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => {
this.nanzhu.setAnimation(0, "摸头男主说话", true)
});
})
} else {
this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => {
this.nanzhu.setAnimation(0, "男主说话", true)
});
}
},
(func) => {
if (this.selectButtonIndex == 1) {
this.nanzhu.setAnimation(0, "摸头待机", true)
}
func()
},
]
const dialogCallFunc = (logEvents: any[]) => {
logEvents.shift()(() => {
if (logEvents.length > 0) {
dialogCallFunc(logEvents);
} else {
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_514_1)
TaskManager.setCurTask(MainTaskIdEnum.MainTask_514_2)
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_139")
// // 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()
}
}