示例#1
0
        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);
        }
示例#2
0
        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();
        }
示例#3
0
 public bool Create(int id)
 {
     if (FunctionBlockModule.GetFunctionBlockByBlockID(id) == null)
     {
         return(false);
     }
     _id = id;
     return(true);
 }
示例#4
0
 public void InitMainTabElement(FunctionBlockTypeData data)
 {
     typedata    = data;
     Icon.sprite = FunctionBlockModule.GetMainTypeSprite(data);
     toggle.onValueChanged.AddListener((bool isOn) =>
     {
         OnTabClick(isOn);
     });
 }
示例#5
0
        //获取所有解锁的区块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);
        }
示例#6
0
        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;
            }
        }
示例#7
0
        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);
        }
示例#8
0
        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);
        }
示例#9
0
        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);
        }
示例#10
0
        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);
        }
示例#11
0
        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;
        }
示例#12
0
 public BlockNormalInfoData(int blockID)
 {
     blockModifierList = FunctionBlockModule.GetBlockEffectList(blockID);
 }
示例#13
0
 public FunctionBlockLevelInfo(FunctionBlock block)
 {
     BlockEXPMap        = FunctionBlockModule.GetBlockEXPMapData(block.FunctionBlockID);
     CurrentBlockMaxEXP = FunctionBlockModule.GetCurrentLevelEXP(BlockEXPMap, currentBlockLevel);
 }
示例#14
0
 /// <summary>
 /// 获取区块
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public FunctionBlock GetBuildFunctionBlock(BuildingPanelData data)
 {
     return(FunctionBlockModule.GetFunctionBlockByBlockID(data.FunctionBlockID));
 }