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.
335 lines
14 KiB
335 lines
14 KiB
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 TouZiXieYiShu from "../../GameMethodRes/TouZiXieYiShu/TouZiXieYiShu";
|
|
import JuQingManager from "../../JuQingChat/JuQingManager";
|
|
import TaskManager, { MainTaskIdEnum } from "../../JuQingChat/TaskManager";
|
|
import JuQingQiPao from "../../JuQingGuanQia/JuQingQiPao";
|
|
import BagManager from "../../Manager/BagManager";
|
|
import InterfaceManager from "../../Manager/InterfaceManager";
|
|
import UserManager from "../../Manager/UserManager";
|
|
import NewGuideScript from "../../NewGuide/NewGuideScript";
|
|
import PrefabManage, { GameType } from "../../PrefabManager/PrefabManage";
|
|
import GetAward from "../../SCommon/GetAward";
|
|
import GameBaseScript from "../GameBaseScript";
|
|
import RoomBase from "../RoomBase";
|
|
let needIDs = [
|
|
{
|
|
goodids: [3004, 3005, 3006],
|
|
tiaoZhuanGameType: GameType.KuaiDiZhan,
|
|
}
|
|
]
|
|
const { ccclass, property } = cc._decorator;
|
|
@ccclass
|
|
export default class Room4 extends RoomBase {
|
|
chatConfig = {
|
|
chatConfig_1: [
|
|
{ effectUrl: 'GameRoomRes/sound/Room4/病人需要做骨髓移植,只有至亲才可以匹配。', delayTime: 4.1, str: '病人需要做骨髓移植,只有至亲才可以匹配。', posi: 'qipao2' },
|
|
{ effectUrl: 'GameRoomRes/sound/Room4/医生,移植我的!', delayTime: 2.12, str: '医生,移植我的!', posi: '-1' },
|
|
{ effectUrl: 'GameRoomRes/sound/Room4/好,我先做配型验证,你要筹备100万医疗费。', delayTime: 4.7, str: '好,我先做配型验证,你要筹备100万医疗费。', posi: 'qipao2' },
|
|
],
|
|
|
|
chatConfig_2: [
|
|
{ effectUrl: 'GameRoomRes/sound/Room4/辰哥,配型失败了,你和阿姨没血缘关系。', delayTime: 6.1, str: '辰哥,配型失败了,你和阿姨没血缘关系。', posi: 'qipao1' },
|
|
// { effectUrl: 'GameRoomRes/sound/Room4/DNA鉴定,你们没有血缘关系。', delayTime: 3, str: 'DNA鉴定,你们没有血缘关系。', posi: 'qipao2' },
|
|
{ effectUrl: 'GameRoomRes/sound/Room4/不可能,一定是搞错了!', delayTime: 2.8, str: '不可能,一定是搞错了!', posi: '-1' },
|
|
{ effectUrl: 'GameRoomRes/sound/Room4/不会错的,暂时只能先维持她的生命了。', delayTime: 3.9, str: '不会错的,暂时只能先维持她的生命了。', posi: 'qipao2' },
|
|
],
|
|
}
|
|
|
|
|
|
|
|
@property(cc.Node)
|
|
layerNode: cc.Node[] = [];
|
|
|
|
@property(cc.Node)
|
|
needLayer: cc.Node = null;
|
|
|
|
@property(cc.Node)
|
|
singleItem: cc.Node = null;
|
|
@property(cc.ScrollView)
|
|
m_ScrollView: cc.ScrollView = null;
|
|
|
|
// finishTaskStep = 0
|
|
// maskGuideNode: cc.Node = null
|
|
|
|
curLayerIndex: number = 0;
|
|
curNeedID: number = -1;
|
|
|
|
onLoad() {
|
|
// this.finishTaskStep = 0
|
|
|
|
|
|
}
|
|
|
|
start() {
|
|
// InterfaceManager.setDaoyeList("慈善抽奖", 1)
|
|
// User.addBagGoodsList({ goodId: 3012, goodNum: 1 })
|
|
// User.addBagGoodsList({ goodId: 3014, goodNum: 1 })
|
|
// User.addBagGoodsList({ goodId: 3015, goodNum: 1 })
|
|
// User.addBagGoodsList({ goodId: 3013, goodNum: 1 })
|
|
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_404)
|
|
// let a = User.getBaDaCaiXiUnlockStatus()
|
|
// a.YaoShan = true
|
|
// User.setBaDaCaiXiUnlockStatus(a)
|
|
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_505)
|
|
// User.setRoomBtnIndex(2)
|
|
|
|
GameBaseScript.preLoadRemoteAudio(this.chatConfig);
|
|
super.start();
|
|
this.refreshLayer()
|
|
|
|
this.refreshNeedLayer()
|
|
EventMgr.onEvent_custom(ryw_Event.refreshNeedLayer, () => {
|
|
this.refreshNeedLayer()
|
|
}, this)
|
|
}
|
|
refreshNeedLayer() {
|
|
// let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
|
|
// let mainId = mainTaskInfo.Id
|
|
// if (mainId == MainTaskIdEnum.MainTask_303) {
|
|
// this.curNeedID = 0
|
|
// }
|
|
// if (this.curNeedID >= 0) {
|
|
// this.needLayer.active = true
|
|
// this.initItemContent()
|
|
// } else {
|
|
// this.needLayer.active = false
|
|
// }
|
|
}
|
|
// 刷新场景
|
|
refreshLayer() {
|
|
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
|
|
let mainId = mainTaskInfo.Id
|
|
if (mainId == MainTaskIdEnum.MainTask_402) {
|
|
this.curLayerIndex = 0
|
|
this["continueStory" + this.curLayerIndex]();
|
|
this.node.getChildByName("nameplate").active = true
|
|
} else if (mainId == MainTaskIdEnum.MainTask_405) {
|
|
this.curLayerIndex = 1
|
|
this["continueStory" + this.curLayerIndex]();
|
|
Common5.playRemoteAudioMusic('CommonSound/悲伤')
|
|
}
|
|
// if (mainId == MainTaskIdEnum.MainTask_304) {
|
|
// //播放合成动画
|
|
// //播放完再显示投资协议书
|
|
// PrefabManage.loadPrefabByType(GameType.TouZiXieYiShu, null, (prefab) => {
|
|
// let money = 500000
|
|
// prefab.getComponent(TouZiXieYiShu).initView(0, money, () => {
|
|
// UserManager.addMoney(money)
|
|
// PrefabManage.showTextTips(`恭喜获得投资${Common5.getNumberChangeHanzi(money, '1')}`)
|
|
|
|
// this.curLayerIndex = 1
|
|
// this["continueStory" + this.curLayerIndex]();
|
|
// })
|
|
// })
|
|
|
|
// } else if (mainId == MainTaskIdEnum.MainTask_314) {
|
|
// this.curLayerIndex = 2
|
|
// this["continueStory" + this.curLayerIndex]();
|
|
// }
|
|
for (const node of this.layerNode) {
|
|
node.active = false;
|
|
}
|
|
this.layerNode[this.curLayerIndex].active = true;
|
|
//Common5.playMusicCustom('GameRes', 'GameStory10/sound/背景bgm');
|
|
|
|
|
|
}
|
|
// 继续剧情
|
|
continueStory0() {
|
|
let yisheng = this.layerNode[this.curLayerIndex].getChildByName("医生")
|
|
let yishengyinying = this.layerNode[this.curLayerIndex].getChildByName("医生阴影")
|
|
let yishengSpine = yisheng.getComponent(sp.Skeleton)
|
|
yishengSpine.setAnimation(0, "待机", true)
|
|
|
|
let anruoruo = this.layerNode[this.curLayerIndex].getChildByName("安若若")
|
|
let anruoruoSpine = anruoruo.getComponent(sp.Skeleton)
|
|
anruoruoSpine.setAnimation(0, "待机", true)
|
|
|
|
const dialogEvents = [
|
|
(func) => {
|
|
this.showQiPao(this.chatConfig.chatConfig_1[this.dialogIndex++], func, () => {
|
|
yishengSpine.setAnimation(0, "说话", true)
|
|
});
|
|
},
|
|
(func) => {
|
|
yishengSpine.setAnimation(0, "待机", true)
|
|
this.showClickDialog(this.chatConfig.chatConfig_1[this.dialogIndex++], func);
|
|
},
|
|
(func) => {
|
|
this.showQiPao(this.chatConfig.chatConfig_1[this.dialogIndex++], func, () => {
|
|
yishengSpine.setAnimation(0, "说话", true)
|
|
});
|
|
},
|
|
(func) => {
|
|
yishengSpine.setAnimation(0, "待机", true)
|
|
yishengSpine.node.setScale(-1, 1, 1)
|
|
cc.tween(yishengSpine.node)
|
|
.sequence(
|
|
cc.tween().by(1, { position: cc.v3(-1000, 0, 0) }),
|
|
cc.tween().call(() => {
|
|
func()
|
|
})
|
|
)
|
|
.start()
|
|
cc.tween(yishengyinying)
|
|
.sequence(
|
|
cc.tween().by(1, { position: cc.v3(-1000, 0, 0) }),
|
|
cc.tween().call(() => {
|
|
// func()
|
|
})
|
|
)
|
|
.start()
|
|
// this.showClickDialog(this.chatConfig.chatConfig_1[this.dialogIndex++], func);
|
|
},
|
|
]
|
|
const dialogCallFunc = (logEvents: any[]) => {
|
|
logEvents.shift()(() => {
|
|
if (logEvents.length > 0) {
|
|
dialogCallFunc(logEvents);
|
|
} else {
|
|
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_402)
|
|
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_403)
|
|
}
|
|
});
|
|
}
|
|
dialogCallFunc(dialogEvents);
|
|
}
|
|
|
|
// 继续剧情
|
|
continueStory1() {
|
|
let yisheng = this.layerNode[this.curLayerIndex].getChildByName("医生")
|
|
let yishengyinying = this.layerNode[this.curLayerIndex].getChildByName("医生阴影")
|
|
let yishengSpine = yisheng.getComponent(sp.Skeleton)
|
|
yishengSpine.setAnimation(0, "待机", true)
|
|
|
|
let anruoruo = this.layerNode[this.curLayerIndex].getChildByName("安若若")
|
|
let anruoruoSpine = anruoruo.getComponent(sp.Skeleton)
|
|
anruoruoSpine.setAnimation(0, "待机", true)
|
|
|
|
const dialogEvents = [
|
|
(func) => {
|
|
this.showQiPao(this.chatConfig.chatConfig_2[this.dialogIndex++], func, () => {
|
|
anruoruoSpine.setAnimation(0, "说话", true)
|
|
});
|
|
},
|
|
// (func) => {
|
|
// anruoruoSpine.setAnimation(0, "待机", true)
|
|
// this.showQiPao(this.chatConfig.chatConfig_2[this.dialogIndex++], func, () => {
|
|
// yishengSpine.setAnimation(0, "说话", true)
|
|
// });
|
|
// },
|
|
(func) => {
|
|
anruoruoSpine.setAnimation(0, "待机", true)
|
|
// yishengSpine.setAnimation(0, "待机", true)
|
|
this.showClickDialog(this.chatConfig.chatConfig_2[this.dialogIndex++], func);
|
|
},
|
|
(func) => {
|
|
this.showQiPao(this.chatConfig.chatConfig_2[this.dialogIndex++], func, () => {
|
|
yishengSpine.setAnimation(0, "说话", true)
|
|
});
|
|
},
|
|
(func) => {
|
|
yishengSpine.setAnimation(0, "待机", true)
|
|
yishengSpine.node.setScale(-1, 1, 1)
|
|
cc.tween(yishengSpine.node)
|
|
.sequence(
|
|
cc.tween().by(1, { position: cc.v3(-1000, 0, 0) }),
|
|
cc.tween().call(() => {
|
|
func()
|
|
})
|
|
)
|
|
.start()
|
|
cc.tween(yishengyinying)
|
|
.sequence(
|
|
cc.tween().by(1, { position: cc.v3(-1000, 0, 0) }),
|
|
cc.tween().call(() => {
|
|
// func()
|
|
})
|
|
)
|
|
.start()
|
|
},
|
|
]
|
|
const dialogCallFunc = (logEvents: any[]) => {
|
|
logEvents.shift()(() => {
|
|
if (logEvents.length > 0) {
|
|
dialogCallFunc(logEvents);
|
|
} else {
|
|
PrefabManage.showTextTips("扣除医疗费100万")
|
|
UserManager.subMoney(1000000)
|
|
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_405)
|
|
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_501)
|
|
//只升章数不进room
|
|
EventMgr.emitEvent_custom(ryw_Event.EnterNextGame, true)
|
|
}
|
|
});
|
|
}
|
|
dialogCallFunc(dialogEvents);
|
|
}
|
|
|
|
initItemContent() {
|
|
this.m_ScrollView.content.removeAllChildren()
|
|
let isAllFind = true
|
|
let propIdArr = needIDs[this.curNeedID].goodids
|
|
for (let i = 0; i < propIdArr.length; i++) {
|
|
let item = cc.instantiate(this.singleItem)
|
|
item.active = true
|
|
item.parent = this.m_ScrollView.content
|
|
|
|
let spFrame_hui = item.getChildByName('spFrame_hui')
|
|
let spFrame_liang = item.getChildByName('spFrame_liang')
|
|
Common5.setRemoteSpriteFrame(spFrame_hui.getComponent(cc.Sprite), 'GoodIcon/' + propIdArr[i])
|
|
Common5.setRemoteSpriteFrame(spFrame_liang.getComponent(cc.Sprite), 'GoodIcon/' + propIdArr[i])
|
|
let _pro = BagManager.getGoodsProperty(propIdArr[i])
|
|
item.getChildByName('nameStr').getComponent(cc.Label).string = _pro.goodName
|
|
|
|
if (BagManager.getBagGoodNums(propIdArr[i]) > 0) {
|
|
spFrame_liang.active = true
|
|
spFrame_hui.active = false
|
|
} else {
|
|
isAllFind = false
|
|
spFrame_liang.active = false
|
|
spFrame_hui.active = true
|
|
}
|
|
}
|
|
|
|
if (isAllFind) {
|
|
//乾镜合并
|
|
let goodArray = [{ goodId: 3007, goodNum: 1 }]
|
|
PrefabManage.loadPrefabByType(GameType.GetAward, null, (prefabNode) => {
|
|
prefabNode.getComponent('GetAward').initView(goodArray, () => {
|
|
|
|
});
|
|
})
|
|
}
|
|
}
|
|
|
|
onBtnHuoYuanTiaoZhuan() {
|
|
// this.node.removeFromParent()
|
|
// this.node.destroy()
|
|
PrefabManage.loadPrefabByType(needIDs[this.curNeedID].tiaoZhuanGameType)
|
|
}
|
|
|
|
// onDoTask201() {
|
|
// this.dialogIndex = 0
|
|
// //查看爷爷的信
|
|
// this.layerNode[this.curLayerIndex].getChildByName("信封").active = true
|
|
// }
|
|
// onTouchXinFeng() {
|
|
// this.layerNode[this.curLayerIndex].getChildByName("信封").active = false
|
|
// this.layerNode[this.curLayerIndex].getChildByName("信").active = true
|
|
// }
|
|
// onTouchXin() {
|
|
// this.layerNode[this.curLayerIndex].getChildByName("信").active = false
|
|
// this.showClickDialog(this.chatConfig.chatConfig_201[this.dialogIndex++], () => {
|
|
// TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_202)
|
|
// });
|
|
// }
|
|
onTouchChuMen() {
|
|
PrefabManage.loadPrefabByType(GameType.CityPrefab)
|
|
this.node.removeFromParent()
|
|
this.node.destroy()
|
|
}
|
|
}
|
|
|