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.
306 lines
13 KiB
306 lines
13 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 GameBaseScript from "../GameRoomRes/GameBaseScript";
|
|
import huyin from "../GameRoomRes/SuiPian/huyin";
|
|
import TaskManager, { MainTaskIdEnum } from "../JuQingChat/TaskManager";
|
|
import BagManager from "../Manager/BagManager";
|
|
import InterfaceManager from "../Manager/InterfaceManager";
|
|
import UserManager from "../Manager/UserManager";
|
|
import PrefabManage, { GameType } from "../PrefabManager/PrefabManage";
|
|
import GetAward from "../SCommon/GetAward";
|
|
import DHBase from "./DHBase";
|
|
const { ccclass, property } = cc._decorator;
|
|
|
|
let needIDs = [
|
|
{
|
|
goodids: [3048, 3049, 3050, 3764, 3765],
|
|
tiaoZhuanGameType: GameType.KuaiDiZhan,
|
|
huoYuan: "盲盒站",
|
|
},
|
|
]
|
|
|
|
@ccclass
|
|
export default class DH_16 extends DHBase {
|
|
chatConfig = [
|
|
{ effectUrl: 'DH/DH_16/sound/叶辰!你什么意思!居然带个狐狸精来我这!', delayTime: 4.4, str: '叶辰!你什么意思!居然带个狐狸精来我这!', posi: 'qipao2' },
|
|
{ effectUrl: 'DH/DH_16/sound/诗诗帮了我两次,这次我该兑现承诺了。', delayTime: 4.1, str: '诗诗帮了我两次,这次我该兑现承诺了。', posi: '-1' },
|
|
{ effectUrl: 'DH/DH_16/sound/哼!这个女人你把握不住,早晚会吃亏。', delayTime: 4, str: '哼!这个女人你把握不住,早晚会吃亏。', posi: 'qipao2' },
|
|
{ effectUrl: 'DH/DH_16/sound/那个..这样说不太好吧。', delayTime: 3, str: '那个..这样说不太好吧。', posi: '-1' },
|
|
{ effectUrl: 'DH/DH_16/sound/你爱信不信,反正投资款按规矩来办。', delayTime: 4, str: '你爱信不信,反正投资款按规矩来办。', posi: 'qipao2' },
|
|
]
|
|
|
|
@property(cc.Node)
|
|
touziren: cc.Node = null;
|
|
@property(cc.Node)
|
|
baishishi: cc.Node = null;
|
|
|
|
@property(cc.Node)
|
|
needLayer: cc.Node = null;
|
|
@property(cc.Node)
|
|
singleItem: cc.Node = null;
|
|
@property(cc.ScrollView)
|
|
m_ScrollView: cc.ScrollView = null;
|
|
|
|
curNeedID: number = -1;
|
|
|
|
start() {
|
|
this.scheduleOnce(() => {
|
|
PrefabManage.preloadPrefabByType(GameType.DH_17)
|
|
})
|
|
GameBaseScript.preLoadRemoteAudioByChatConfig(this.chatConfig);
|
|
super.start();
|
|
|
|
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
|
|
let mainId = mainTaskInfo.Id
|
|
if (mainId == MainTaskIdEnum.MainTask_1004) {
|
|
//点击提交播放合成动画
|
|
|
|
} else if (mainId >= MainTaskIdEnum.MainTask_1005) {
|
|
let touzirenSpine = this.touziren.getComponent(sp.Skeleton)
|
|
touzirenSpine.setAnimation(0, "投资人", true)
|
|
let baishishiSpine = this.baishishi.getComponent(sp.Skeleton)
|
|
baishishiSpine.setAnimation(0, "白诗诗", true)
|
|
} else {
|
|
this.continueStory();
|
|
}
|
|
// this.scheduleOnce(() => {
|
|
// PrefabManage.preloadPrefabByType(GameType.DH_59)
|
|
// })
|
|
|
|
// EventMgr.onEvent_custom(ryw_Event.RefreshJuQingDuiHua, () => {
|
|
// this.RefreshJuQingDuiHua();
|
|
// }, this);
|
|
|
|
this.refreshNeedLayer()
|
|
EventMgr.onEvent_custom(ryw_Event.refreshNeedLayer, () => {
|
|
this.refreshNeedLayer()
|
|
}, this)
|
|
|
|
EventMgr.onEvent_custom(ryw_Event.ZhuiJiaTouZi, () => {
|
|
// PrefabManage.showBlackGuoDu(() => {
|
|
// PrefabManage.loadPrefabByType(GameType.CityPrefab)
|
|
// this.node.destroy()
|
|
// })
|
|
}, this)
|
|
}
|
|
|
|
refreshNeedLayer() {
|
|
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
|
|
let mainId = mainTaskInfo.Id
|
|
if (mainId == MainTaskIdEnum.MainTask_1003 || mainId == MainTaskIdEnum.MainTask_1004) {
|
|
this.curNeedID = 0
|
|
}
|
|
if (this.curNeedID >= 0) {
|
|
this.needLayer.active = true
|
|
this.needLayer.getChildByName("huanYuanNode").getChildByName("huoYuan").getComponent(cc.Label).string = needIDs[this.curNeedID].huoYuan
|
|
this.initItemContent()
|
|
} else {
|
|
this.needLayer.active = false
|
|
}
|
|
}
|
|
|
|
// 继续剧情
|
|
continueStory() {
|
|
let touzirenSpine = this.touziren.getComponent(sp.Skeleton)
|
|
touzirenSpine.setAnimation(0, "投资人", true)
|
|
let baishishiSpine = this.baishishi.getComponent(sp.Skeleton)
|
|
baishishiSpine.setAnimation(0, "白诗诗", true)
|
|
const dialogEvents = [
|
|
(func) => {
|
|
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
|
|
touzirenSpine.setAnimation(0, "投资人说话", true)
|
|
});
|
|
},
|
|
(func) => {
|
|
touzirenSpine.setAnimation(0, "投资人", true)
|
|
this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => {
|
|
|
|
})
|
|
},
|
|
(func) => {
|
|
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
|
|
touzirenSpine.setAnimation(0, "投资人斜看说话", true)
|
|
});
|
|
},
|
|
(func) => {
|
|
touzirenSpine.setAnimation(0, "投资人斜看", true)
|
|
this.showClickDialog(this.chatConfig[this.dialogIndex++], func, () => {
|
|
|
|
})
|
|
},
|
|
(func) => {
|
|
this.showQiPao(this.chatConfig[this.dialogIndex++], func, () => {
|
|
touzirenSpine.setAnimation(0, "投资人说话", true)
|
|
});
|
|
},
|
|
]
|
|
const dialogCallFunc = (logEvents: any[]) => {
|
|
logEvents.shift()(() => {
|
|
if (logEvents.length > 0) {
|
|
dialogCallFunc(logEvents);
|
|
} else {
|
|
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_1002)
|
|
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_1003)
|
|
this.refreshNeedLayer()
|
|
// PrefabManage.showBlackGuoDu(() => {
|
|
// PrefabManage.loadPrefabByType(GameType.CityPrefab)
|
|
// this.node.destroy()
|
|
// })
|
|
}
|
|
});
|
|
}
|
|
dialogCallFunc(dialogEvents);
|
|
}
|
|
|
|
// 继续剧情
|
|
continueStory1() {
|
|
let touzirenSpine = this.touziren.getComponent(sp.Skeleton)
|
|
touzirenSpine.setAnimation(0, "投资人", true)
|
|
let baishishiSpine = this.baishishi.getComponent(sp.Skeleton)
|
|
baishishiSpine.setAnimation(0, "白诗诗", true)
|
|
const dialogEvents = [
|
|
(func) => {
|
|
func()
|
|
},
|
|
]
|
|
const dialogCallFunc = (logEvents: any[]) => {
|
|
logEvents.shift()(() => {
|
|
if (logEvents.length > 0) {
|
|
dialogCallFunc(logEvents);
|
|
} else {
|
|
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_1004)
|
|
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_1005, false)
|
|
Common5.playRemoteAudioEffect("ZhuiJiaTouZi/留下来陪我一起学习吧");
|
|
this.scheduleOnce(() => {
|
|
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_1005)
|
|
}, 3)
|
|
// PrefabManage.showBlackGuoDu(() => {
|
|
// PrefabManage.loadPrefabByType(GameType.CityPrefab)
|
|
// this.node.destroy()
|
|
// })
|
|
}
|
|
});
|
|
}
|
|
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) {
|
|
this.needLayer.getChildByName("按钮").active = true
|
|
this.needLayer.getChildByName("huanYuanNode").active = false
|
|
}
|
|
}
|
|
|
|
onTouchSubmit() {
|
|
//碎片合并
|
|
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
|
|
let mainId = mainTaskInfo.Id
|
|
let goodArray = []
|
|
if (mainId == MainTaskIdEnum.MainTask_1004) {//虎印
|
|
goodArray = [{ goodId: 3051, goodNum: 1 }]
|
|
}
|
|
this.needLayer.active = false
|
|
//播放合成动画
|
|
PrefabManage.loadPrefabByType(GameType.huyin, this.node, (node) => {
|
|
node.getComponent(huyin).run(this.m_ScrollView.content.children, () => {
|
|
this.scheduleOnce(() => {
|
|
PrefabManage.loadPrefabByType(GameType.GetAward, null, (prefabNode) => {
|
|
prefabNode.getComponent('GetAward').initView(goodArray, () => {
|
|
//播放完再显示投资协议书
|
|
PrefabManage.loadPrefabByType(GameType.TouZiXieYiShu, null, (prefab) => {
|
|
let money = 15000000
|
|
prefab.getComponent(TouZiXieYiShu).initView("叶氏文娱", money, () => {
|
|
UserManager.addMoney(money)
|
|
PrefabManage.showTextTips(`恭喜获得投资${Common5.getNumberChangeHanzi(money, '1')}`)
|
|
this.continueStory1();
|
|
})
|
|
})
|
|
});
|
|
})
|
|
}, 1)
|
|
})
|
|
})
|
|
// PrefabManage.loadPrefabByType(GameType.GetAward, null, (prefabNode) => {
|
|
// prefabNode.getComponent('GetAward').initView(goodArray, () => {
|
|
// //播放完再显示投资协议书
|
|
// PrefabManage.loadPrefabByType(GameType.TouZiXieYiShu, null, (prefab) => {
|
|
// let money = 500000
|
|
// prefab.getComponent(TouZiXieYiShu).initView("叶氏文娱", money, () => {
|
|
// UserManager.addMoney(money)
|
|
// PrefabManage.showTextTips(`恭喜获得投资${Common5.getNumberChangeHanzi(money, '1')}`)
|
|
// this.continueStory1();
|
|
// })
|
|
// })
|
|
// });
|
|
// })
|
|
}
|
|
|
|
onBtnHuoYuanTiaoZhuan() {
|
|
// this.node.removeFromParent()
|
|
// this.node.destroy()
|
|
PrefabManage.loadPrefabByType(needIDs[this.curNeedID].tiaoZhuanGameType)
|
|
}
|
|
|
|
// 震屏效果
|
|
// 参数:duration 震屏时间
|
|
shakeEffect(duration) {
|
|
this.node.runAction(
|
|
cc.repeatForever(
|
|
cc.sequence(
|
|
// cc.moveTo(0.02, cc.v2(5, 7)),
|
|
// cc.moveTo(0.02, cc.v2(-6, 7)),
|
|
// cc.moveTo(0.02, cc.v2(-13, 3)),
|
|
// cc.moveTo(0.02, cc.v2(3, -6)),
|
|
// cc.moveTo(0.02, cc.v2(-5, 5)),
|
|
// cc.moveTo(0.02, cc.v2(2, -8)),
|
|
// cc.moveTo(0.02, cc.v2(-8, -10)),
|
|
// cc.moveTo(0.02, cc.v2(3, 10)),
|
|
// cc.moveTo(0.02, cc.v2(0, 0))
|
|
|
|
cc.moveTo(0.2, cc.v2(5, 7)),
|
|
// cc.moveTo(0.2, cc.v2(-6, 7)),
|
|
cc.moveTo(0.2, cc.v2(-13, 3)),
|
|
// cc.moveTo(0.2, cc.v2(3, -6)),
|
|
cc.moveTo(0.2, cc.v2(-5, 5)),
|
|
// cc.moveTo(0.2, cc.v2(2, -8)),
|
|
cc.moveTo(0.2, cc.v2(-8, -10)),
|
|
// cc.moveTo(0.2, cc.v2(3, 10)),
|
|
cc.moveTo(0.2, cc.v2(0, 0))
|
|
)
|
|
)
|
|
);
|
|
|
|
setTimeout(() => {
|
|
this.node.stopAllActions();
|
|
this.node.setPosition(0, 0);
|
|
}, duration * 1000);
|
|
}
|
|
}
|
|
|