public bool CreateBaseInfo(Vector3 blockPos, FunctionBlock blockBase, FunctionBlockModifier modifier) { BlockID = blockBase.FunctionBlockID; block = blockBase; blockType = FunctionBlockModule.GetFunctionBlockType(BlockID); dataModel = new FunctionBlockDataModel(); dataModel.Create(BlockID); BlockPos = blockPos; blockModifier = modifier; modifierRootType = FunctionBlockModule.FetchBlockModifierRootType(blockType); districtUnlockDataList = FunctionBlockModule.GetBlockDistrictUnlockData(blockBase.FunctionBlockID); levelInfo = new FunctionBlockLevelInfo(blockBase); //District //Set active district build for (int i = 0; i < districtUnlockDataList.Count; i++) { if (districtUnlockDataList[i].UnlockDefault == true) { ActiveDistrictBuildList.Add(DistrictModule.GetDistrictDataByKey(districtUnlockDataList[i].DistrictID)); } } //TODO return(true); }
public void InitData(int blockID, int posX, int posZ) { functionBlock = FunctionBlockModule.GetFunctionBlockByBlockID(blockID); UIinfo = UIUtility.SafeGetComponent <BlockUIScriptInfo>(transform); UIinfo.SetData(this); ModelRoot = UIUtility.FindTransfrom(transform, "Root/ModelRoot").gameObject; gameObject.name = instanceID + "[Block]"; SetPosition(new Vector3(posX, transform.localScale.y / 2, posZ)); info = new FunctionBlockInfoData(); info.CreateBaseInfo(transform.position, functionBlock, new FunctionBlockModifier(ModifierTarget.FunctionBlock, instanceID)); var blockType = info.dataModel.BlockType; if (blockType == FunctionBlockType.ElementCapsule) { var manuBase = transform.SafeAddCmpt <ManufactoryBase>(); manuBase.SetData(); } else if (blockType == FunctionBlockType.EnergyStorageUnit) { var normalBase = transform.SafeAddCmpt <BlockNormalBase>(); normalBase.SetData(); } InitBase(); }
public bool Create(int id) { if (FunctionBlockModule.GetFunctionBlockByBlockID(id) == null) { return(false); } _id = id; return(true); }
public void InitMainTabElement(FunctionBlockTypeData data) { typedata = data; Icon.sprite = FunctionBlockModule.GetMainTypeSprite(data); toggle.onValueChanged.AddListener((bool isOn) => { OnTabClick(isOn); }); }
//获取所有解锁的区块ID public static List <FunctionBlock> GetUnLockBuildBlockID() { List <FunctionBlock> result = new List <FunctionBlock>(); List <BuildingPanelData> unlockList = GetUnLockBuildData(); for (int i = 0; i < unlockList.Count; i++) { result.Add(FunctionBlockModule.GetFunctionBlockByBlockID(unlockList[i].FunctionBlockID)); } return(result); }
public void AddCurrentBlockEXP(int value) { _currentBlockExp += (int)(value * _baseEXPRatio); int currentMaxEXP = FunctionBlockModule.GetCurrentLevelEXP(BlockEXPMap, currentBlockLevel); if (_currentBlockExp > currentMaxEXP) { currentBlockLevel++; CurrentBlockMaxEXP = FunctionBlockModule.GetCurrentLevelEXP(BlockEXPMap, currentBlockLevel); _currentBlockExp -= currentMaxEXP; } }
public List <BuildingPanelData> GetBuildDataByMainType(FunctionBlockType type) { List <BuildingPanelData> result = new List <BuildingPanelData>(); for (int i = 0; i < playerData.UnLockBuildingPanelDataList.Count; i++) { var blockType = FunctionBlockModule.GetFunctionBlockType(playerData.UnLockBuildingPanelDataList[i].FunctionBlockID); if (blockType == type) { result.Add(playerData.UnLockBuildingPanelDataList[i]); } } return(result); }
public FunctionBlockDistrictInfo InitInfo(int blockID) { FunctionBlockDistrictInfo info = new FunctionBlockDistrictInfo(); var config = FunctionBlockModule.GetBlockDistrictConfig(blockID); if (config != null) { info.BlockID = blockID; info.size = new Vector2(config.areaX, config.areaY); info.realityRatio = (float)config.realityRatio; info.currentDistrictDataDic = FunctionBlockModule.GetBlockDistictInfo(config); } return(info); }
public static List <int> ParseTechParam_Unlock_Block(string content) { List <int> result = new List <int>(); var list = Utility.TryParseIntList(content, ','); for (int i = 0; i < list.Count; i++) { if (FunctionBlockModule.GetFunctionBlockByBlockID(list[i]) != null) { result.Add(list[i]); } } return(result); }
public List <BaseDataModel> GetBuildPanelModelData(FunctionBlockType type) { List <BaseDataModel> result = new List <BaseDataModel>(); for (int i = 0; i < playerData.UnLockBuildingPanelDataList.Count; i++) { if (FunctionBlockModule.GetFunctionBlockType(playerData.UnLockBuildingPanelDataList[i].FunctionBlockID) == type) { BuildPanelModel model = new BuildPanelModel(); if (model.Create(playerData.UnLockBuildingPanelDataList[i].BuildID)) { result.Add(model); } } } return(result); }
public ManufactFormulaInfo(int currentFormulaID, FunctionBlock block) { CurrentFormulaID = currentFormulaID; FormulaChooseList = FunctionBlockModule.GetBlockFormulaList(block.FunctionBlockID); currentFormulaData = FormulaModule.GetFormulaDataByID(currentFormulaID); currentInputItem = FormulaModule.GetFormulaItemList(currentFormulaID, FormulaModule.MaterialProductType.Input); currentOutputItem = FormulaModule.GetFormulaOutputMaterial(currentFormulaID); currentEnhanceItem = FormulaModule.GetFormulaEnhanceMaterial(currentFormulaID); MaxNeedTime = currentFormulaData.ProductSpeed; for (int i = 0; i < currentInputItem.Count; i++) { realInputItem.Add(new FormulaItem(currentInputItem[i].model, 0)); } realOutputItem = new FormulaItem(currentOutputItem.model, 0); realEnhanceItem = new FormulaItem(currentEnhanceItem.model, 0); NotChoose = false; }
public BlockNormalInfoData(int blockID) { blockModifierList = FunctionBlockModule.GetBlockEffectList(blockID); }
public FunctionBlockLevelInfo(FunctionBlock block) { BlockEXPMap = FunctionBlockModule.GetBlockEXPMapData(block.FunctionBlockID); CurrentBlockMaxEXP = FunctionBlockModule.GetCurrentLevelEXP(BlockEXPMap, currentBlockLevel); }
/// <summary> /// 获取区块 /// </summary> /// <param name="data"></param> /// <returns></returns> public FunctionBlock GetBuildFunctionBlock(BuildingPanelData data) { return(FunctionBlockModule.GetFunctionBlockByBlockID(data.FunctionBlockID)); }