Exemplo n.º 1
0
        /// <summary>
        /// 检查是否区划处于未解锁的格子内
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="block"></param>
        /// <param name="initCheck"></param>
        /// <returns></returns>
        public bool CheckTargetDistrictNoLock(int districtID, Vector2 placePos)
        {
            List <Vector2> lockedList = DistrictModule.GetRealDistrictTypeArea(districtID, placePos);

            if (lockedList.Count == 0)
            {
                return(false);
            }
            if (currentDistrictDataDic == null)
            {
                return(false);
            }

            for (int i = 0; i < lockedList.Count; i++)
            {
                if (currentDistrictDataDic.ContainsKey(lockedList[i]))
                {
                    if (currentDistrictDataDic[lockedList[i]].Locked == true)
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 检测区划是否重叠  或超出范围  True= out of range
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="block"></param>
        /// <param name="initCheck"></param>
        /// <returns></returns>
        public bool CheckDistrictDataOutofRange(int districtID, Vector2 placePos)
        {
            List <Vector2> checkList = DistrictModule.GetRealDistrictTypeArea(districtID, placePos);

            if (checkList.Count == 0)
            {
                return(true);
            }
            if (currentDistrictDataDic == null)
            {
                return(true);
            }

            for (int i = 0; i < checkList.Count; i++)
            {
                if (!currentDistrictDataDic.ContainsKey(checkList[i]))
                {
                    ///Out of Range
                    return(true);
                }
                else
                {
                    /// Repeat
                    if (currentDistrictDataDic[checkList[i]].districtID != 0)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Exemplo n.º 3
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);
        }