觉醒时刻
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.
 
 
 

114 lines
3.9 KiB

import Common5 from "../../Platform/th/Common5";
import TaskManager, { MainTaskIdEnum } from "../JuQingChat/TaskManager";
import UserManager from "../Manager/UserManager";
import NewGuideScript from "../NewGuide/NewGuideScript";
import PrefabManage, { GameType } from "../PrefabManager/PrefabManage";
import GameBase from "../SCommon/GameBase";
let CaiGuanConfig = [
{caiGuanName:'叶氏药膳',desc:'开始建造叶氏药膳',guanMing:'叶氏药膳',money:300000},
{caiGuanName:'叶氏食品厂',desc:'开始建造叶氏食品厂',guanMing:'叶氏食品厂',money:1000000},
{caiGuanName:'叶氏医药',desc:'开始建造叶氏医药',guanMing:'叶氏医药',money:5000000},
{caiGuanName:'叶氏文娱',desc:'开始建造叶氏文娱',guanMing:'叶氏文娱',money:20000000},
{caiGuanName:'叶氏电子',desc:'开始将钱氏电子改造成',guanMing:'叶氏电子',money:100000000},
{caiGuanName:'叶氏网络',desc:'开始将傅氏集团改造成',guanMing:'叶氏网络',money:100000000},
{caiGuanName:'叶氏金融',desc:'开始将安氏金融改造成',guanMing:'叶氏金融',money:100000000},
{caiGuanName:'叶氏未来',desc:'开始将龙氏集团改造成',guanMing:'叶氏未来',money:5000000000},
// {caiGuanName:'满汉全席',desc:'开始将陈氏米奇淋改造成',guanMing:'满汉全席',money:100000000000},
// {caiGuanName:'食品回收站',desc:'开始改建',guanMing:'食品回收站',money:100000000},
// {caiGuanName:'烧毁重建菜馆',desc:'开始重建被',guanMing:'烧毁的菜馆',money:2200000000},
]
const {ccclass, property} = cc._decorator;
@ccclass
export default class JianLouBox extends GameBase {
@property(cc.Label)
descStr:cc.Label = null
@property(cc.Label)
guanMingStr:cc.Label = null
@property(cc.Label)
moneyStr:cc.Label = null
@property(cc.Node)
tipStr:cc.Node = null
@property(cc.Node)
btnJianZao:cc.Node = null
@property(cc.Node)
spineNode:cc.Node = null
@property(cc.Node)
diKuangNode:cc.Node = null
callFunc = null
buildMoney = 0
onDestroy(){
super.onDestroy()
}
onLoad () {
super.onLoad()
}
initView(index,isCanBuild,callFunc){
this.callFunc = callFunc
let config = CaiGuanConfig[index]
this.descStr.string = config.desc
this.guanMingStr.string = config.guanMing
this.buildMoney = config.money
this.moneyStr.string = `建造费用:${Common5.getNumberChangeHanzi(this.buildMoney,'1')}`
if(isCanBuild){
this.btnJianZao.active = true
this.tipStr.active = false
}else{
this.btnJianZao.active = false
this.tipStr.active = true
}
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
let mainId = mainTaskInfo.Id
if (mainId == MainTaskIdEnum.MainTask_310) {
let node = this.node.getChildByName("底框").getChildByName("黄色按钮")
this.guideView([node]);
}
}
guideView(nodeArray) {
PrefabManage.loadPrefabByType(GameType.GuideMskNode, this.node, (prefab) => {
let guideNodeArray = nodeArray
let firstNode = guideNodeArray.shift()
prefab.getComponent(NewGuideScript).setBindNode(firstNode, guideNodeArray)
})
}
onBtnBuild(){
if(this.buildMoney > UserManager.getCurMoney()){
PrefabManage.showTextTips("余额不足");
return false
}
Common5.playEffectCustom('XianCheng','sound/奠基欢呼')
this.diKuangNode.active = false
this.spineNode.active = true
this.scheduleOnce(()=>{
UserManager.subMoney(this.buildMoney)
this.callFunc && this.callFunc()
this.node.removeFromParent()
this.node.destroy()
},3)
}
onBtnClose(){
this.node.removeFromParent()
this.node.destroy()
}
}