Пример #1
0
 public Cell(int id)
 {
     this.id = id;
     joints  = new CellList();
     walls   = new CellList();
     links   = new CellList();
 }
Пример #2
0
 public void Clear()
 {
     Text = String.Empty;
     CellList.Clear();
     ContextTag   = null;
     ContextNames = String.Empty;
 }
Пример #3
0
 private void ImportFiles_Click(object sender, RoutedEventArgs e)
 {
     ImportedFileInfo[] validLteFiles  = _lteImporter.Query().ToArray();
     ImportedFileInfo[] validCdmaFiles = _cdmaImporter.Query().ToArray();
     ImportedFileInfo[] validMmlFiles  = _mmlImporter.Query().ToArray();
     if (validCdmaFiles.Length + validLteFiles.Length + validMmlFiles.Length == 0)
     {
         MessageBox.Show("未选择任何有效的数据文件。请先导入或选择!");
         return;
     }
     if (validLteFiles.Any())
     {
         _lteImporter.Import(validLteFiles);
         ENodebList.SetDataSource(_lteImporter.BtsExcelList);
         CellList.SetDataSource(_lteImporter.CellExcelList);
     }
     if (validCdmaFiles.Any())
     {
         _cdmaImporter.Import(validCdmaFiles);
         BtsList.SetDataSource(_cdmaImporter.BtsExcelList);
         CdmaCellList.SetDataSource(_cdmaImporter.CellExcelList);
     }
     if (validMmlFiles.Any())
     {
         _mmlImporter.Import(validMmlFiles);
     }
     FileList.SetDataSource(_fileInfoList);
 }
Пример #4
0
    public void Config(int width, int height, float cellSize, Vector3 origin, bool drawLines, Axis axis, Func <Vector3, GridCell> GridPointAdded)
    {
        if (lines != null)
        {
            foreach (LineRenderer line in lines)
            {
                if (line != null)
                {
                    GameObject.Destroy(line.gameObject);
                }
            }
        }
        lines = new List <LineRenderer>();

        this.width    = width;
        this.height   = height;
        this.cellSize = cellSize;
        this.origin   = origin;
        this.axis     = axis;

        gridArray = new int[width, height];
        cells     = new CellList();

        for (int x = 0; x < gridArray.GetLength(0); x++)
        {
            cells.row.Add(new RowContainer());
            for (int y = 0; y < gridArray.GetLength(1); y++)
            {
                if (GridPointAdded != null)
                {
                    cells.row[x].ContainedList.Add(GridPointAdded(GetWorldPos(x, y)));
                }
            }
        }
    }
Пример #5
0
        public void TestBloatPattern()
        {
            seed = new CellList(3);
            seed.addCell(0, 0, CellState.ALIVE);
            seed.addCell(0, 1, CellState.ALIVE);
            seed.addCell(0, 2, CellState.DEAD);
            seed.addCell(1, 0, CellState.ALIVE);
            seed.addCell(1, 1, CellState.DEAD);
            seed.addCell(1, 2, CellState.ALIVE);
            seed.addCell(2, 0, CellState.DEAD);
            seed.addCell(2, 1, CellState.ALIVE);
            seed.addCell(2, 2, CellState.DEAD);

            CellList firstGeneration = performTick();

            Assert.AreEqual(firstGeneration.getCellState(0, 0), CellState.ALIVE);
            Assert.AreEqual(firstGeneration.getCellState(0, 1), CellState.ALIVE);
            Assert.AreEqual(firstGeneration.getCellState(0, 2), CellState.DEAD);
            Assert.AreEqual(firstGeneration.getCellState(1, 0), CellState.ALIVE);
            Assert.AreEqual(firstGeneration.getCellState(1, 1), CellState.DEAD);
            Assert.AreEqual(firstGeneration.getCellState(1, 2), CellState.ALIVE);
            Assert.AreEqual(firstGeneration.getCellState(2, 0), CellState.DEAD);
            Assert.AreEqual(firstGeneration.getCellState(2, 1), CellState.ALIVE);
            Assert.AreEqual(firstGeneration.getCellState(2, 2), CellState.DEAD);
        }
Пример #6
0
        /// <summary>
        /// 將指定的 BrailleWord 內容完整複製給自己。
        /// </summary>
        /// <param name="brWord"></param>
        public void Copy(BrailleWord brWord)
        {
            if (brWord == null)
            {
                throw new ArgumentNullException("參數 brWord 不可為 null!");
            }

            Text     = brWord.Text;
            Language = brWord.Language;

            CellList.Clear();
            foreach (BrailleCell brCell in brWord.CellList.Items)
            {
                CellList.Add(brCell);
            }

            PhoneticCode       = brWord.PhoneticCode;
            IsPolyphonic       = brWord.IsPolyphonic;
            IsContextTag       = brWord.IsContextTag;
            IsConvertedFromTag = brWord.IsConvertedFromTag;
            ContextTag         = brWord.ContextTag;
            ContextNames       = brWord.ContextNames;

/*
 *          // 複製所有注音字根與點字串列, for 向下相容.
 *          if (brWord.PhoneticCodes != null)
 *          {
 *              m_PhoneticCodes.Clear();
 *              m_PhoneticCodes.AddRange(brWord.PhoneticCodes);
 *              m_ActivePhoneticIndex = brWord.ActivePhoneticIndex;
 *          }
 */
        }
Пример #7
0
 public override void SetUp()
 {
     List = new CellList<string>();
     var collection = List as ICollection<string>;
     collection.Add("a");
     collection.Add("b");
 }
Пример #8
0
 public override void SetUp()
 {
     List = new CellList<string>();
     List.Enqueue("a");
     List.Enqueue("b");
     List.Clear();
 }
Пример #9
0
        /// <summary>
        /// スタート台の位置をリストで取得する
        /// </summary>
        /// <returns>スタート台の位置のリスト</returns>
        public List <Position> GetStartList()
        {
            // インデックス
            int index = -1;

            // スタート台の位置のリスト
            var ret = new List <Position>();

            while (index + 1 < CellList.Count)
            {
                // スタート台の位置
                index = CellList.IndexOf(ECellType.START, index + 1);

                // 見つからなかった場合
                if (index < 0)
                {
                    break;
                }

                // リストに追加
                ret.Add(ConvertPosition(index));
            }

            // 結果を返す
            return(ret);
        }
Пример #10
0
        public void Load(string sFileName)
        {
            if (!File.Exists(sFileName))
            {
                return;
            }

            CellList.Clear();
            // считать из файла
            string[] arLine = File.ReadAllLines(sFileName, Encoding.UTF8);
            // ---
            int iLineNum = 0;

            if (arLine[iLineNum++] != FileSignature)
            {
                return;
            }

            Width  = Int32.Parse(arLine[iLineNum++]);
            Height = Int32.Parse(arLine[iLineNum++]);
            for (int ii = iLineNum; ii < arLine.Length; ii++)
            {
                ChessCell chessCell = new ChessCell(arLine[ii]);
                CellList.Add(chessCell);
            }
        }
Пример #11
0
    void Start()
    {
        CellList.CheckEmpty();

        var levelSource = new Level1();

        Map      = levelSource.CreateMap(Game.Ksids);
        Game.Map = Map;

        foreach (var pair in levelSource.Placeables(PrefabsStore))
        {
            pair.Item1.Instantiate(Map, transform, pair.Item2);
        }

        if (PlaceablesRoots != null)
        {
            foreach (var root in PlaceablesRoots)
            {
                if (root.gameObject.activeInHierarchy)
                {
                    foreach (var p in root.GetComponentsInChildren <Placeable>())
                    {
                        p.PlaceToMap(Map);
                    }
                }
            }
        }

        mapCreated = true;
    }
Пример #12
0
        private static void FillTree(List <CellList> cavernList, ref KDTree <Vector2> tree)
        {
            CellList biggestCavern = cavernList[cavernList.Count - 1];

            for (int i = 0; i < biggestCavern.cells.Count; i++)
            {
                tree.AddPoint(new double[] { biggestCavern.cells[i].x, biggestCavern.cells[i].y }, biggestCavern.cells[i]);
            }
        }
Пример #13
0
        public void RemoveCell(string cellName)
        {
            EvaluationOutdoorCell cell = _service.QueryByName(cellName);

            if (cell == null)
            {
                return;
            }
            CellList.Remove(cell);
        }
Пример #14
0
        private void StartGame(object obj)
        {
            IGameService      instance = Interfaces.ServiceFactory.CreateInstanceRandomPlayer();
            IGameplaySettings settings = new GameplaySettingsProvider();

            Session = new GameService(instance, settings);
            CellList.NewGame();
            WinStateCoordinates = new ObservableCollection <LineDisplay>();
            this.RaisePropertyChanged(nameof(IsGameOver));
            Session.Start();
            UpdateCells();
        }
Пример #15
0
 private void AddCell(CellClass cell)
 {
     if (cell != null)                                       // Is input a valid object?
     {                                                       // Yes.
         CellList.Add(cell);                                 // Add the cell to the main list.
         _regionList[cell.Region].Add(cell);                 // Add the cell the corresponding region list.
     }
     else
     {
         throw new Exception("Cell cannot be null.");        // TODO: Maybe add this to the event log instead?
     }
 }
Пример #16
0
        internal void PopulateDesignTime()
        {
            CellList.DesignGame();
            WinStateCoordinates = new ObservableCollection <LineDisplay>();
            var lines = new LineDisplay[]
            {
                LineDisplay.CreateLineDisplay(EndCondition.DiagonalMajor, Player.X),
                LineDisplay.CreateLineDisplay(EndCondition.Column1, Player.O)
            };

            UpdateWinCoordinates(lines);
            this.RaisePropertyChanged(nameof(IsGameOver));
        }
Пример #17
0
        public void AddCellsFromPositionNumbers(string positionNumberString)
        {
            if (String.IsNullOrEmpty(positionNumberString))
            {
                return;
            }
            var numbers = positionNumberString.Split(' ');

            foreach (string num in numbers)
            {
                var cell = BrailleCell.GetInstanceFromPositionNumberString(num);
                CellList.Add(cell);
            }
        }
Пример #18
0
        public void Add(Placeable p, Ksids ksids)
        {
            int size = listInfo.Size;

            if (size == 0)
            {
                first         = p;
                listInfo.Size = 1;
                Blocking      = p.CellBlocking;
            }
            else
            {
                if (p == first)
                {
                    Debug.LogError("Duplikujes pridavani " + p.name);
                    return;
                }
                if (size == 1)
                {
                    var arr = CellList.ReserveData(2, out listInfo, out int offset);
                    arr[offset] = p;
                    Blocking    = first.CellBlocking | p.CellBlocking;
                    TriggerAddTest(p, first, ksids);
                }
                else if (size == CellListInfo.SizeMask)
                {
                    // Throw Helper
                    throw new InvalidOperationException("Prekrocena maximalni kapacita bunky");
                }
                else
                {
                    CellList.IncSize(ref listInfo, size + 1);
                    var arr = CellList.GetData(listInfo, out int offset);
                    size--;
                    arr[offset + size] = p;
                    Blocking           = first.CellBlocking | p.CellBlocking;
                    TriggerAddTest(p, first, ksids);

                    for (int f = offset; f < offset + size; f++)
                    {
                        Blocking |= arr[f].CellBlocking;
                        TriggerAddTest(p, arr[f], ksids);
                        if (arr[f] == p)
                        {
                            Debug.LogError("Duplikujes pridavani !" + p.name);
                        }
                    }
                }
            }
        }
Пример #19
0
        protected void RemoveCell()
        {
            var index = CellList.Count - 1;
            var cell  = CellList[index];

            CellList.RemoveLast();
            Children.Remove(cell);

            if (Drawing != null)
            {
                cell.OnRemovingFromCanvas(Drawing.Canvas);
            }
            //foreach (IPoint p in cell.Dependencies)
            //    this.Dependencies.Remove(p);
        }
Пример #20
0
        public GameViewModel(ArtificialIntelligence ai, Tetris game)
        {
            AI             = ai;
            Game           = game;
            Game.GameSpeed = 10;

            for (int x = 0; x < 10; x++)
            {
                CellList.Add(new ObservableCollection <Cell>());
                for (int y = 21; y >= 0; y--)
                {
                    CellList[x].Add(Game.Matrix[x, y]);
                }
            }
        }
Пример #21
0
        /// <summary>
        /// 把指定的點字字串(16進位)轉成 BrailleCell 物件,並加入點字串列中。
        /// </summary>
        /// <param name="brCodes">欲加入串列的點字碼 16 進位字串。</param>
        public void AddCells(string brCodes)
        {
            if (String.IsNullOrEmpty(brCodes))
            {
                return;
            }

            for (int i = 0; i < brCodes.Length; i += 2)
            {
                string      s     = brCodes.Substring(i, 2);
                byte        aByte = StrHelper.HexStrToByte(s);
                BrailleCell cell  = BrailleCell.GetInstance(aByte);
                CellList.Add(cell);
            }
        }
Пример #22
0
        public void AddCell(EvaluationOutdoorCell cell)
        {
            IOutdoorCell existedCell = _service.QueryCell(cell);

            if (existedCell == null)
            {
                existedCell = _service.QueryCell(cell);
                CellList.Add(cell);
                if (existedCell == null)
                {
                    Region = new EvaluationRegion(CellList,
                                                  EvaluationSettings.DistanceInMeter, EvaluationSettings.DegreeSpan);
                }
                Region.InitializeParameters(CellList, EvaluationSettings.DegreeSpan);
            }
        }
Пример #23
0
 public void newfield()
 {
     CellList.Clear();
     for (int i = 0; i <= Height; i++)
     {
         for (int j = 0; j <= Width; j++)
         {
             CCell Cell = new CCell()
             {
                 xcoord  = i,
                 ycoord  = j,
                 bborder = false,
                 lborder = false,
                 rborder = false,
                 tborder = false,
                 type    = EType.Ordinary
             };
             //создание внешних границ
             if ((i == 0) || (i == Height))
             {
                 Cell.tborder = true;
             }
             if ((j == 0) || (j == Width))
             {
                 Cell.lborder = true;
             }
             if (i == (Height - 1))
             {
                 Cell.bborder = true;
             }
             if (j == (Width - 1))
             {
                 Cell.rborder = true;
             }
             CellList.Add(Cell);
         }
     }
     CellList[0].type = EType.Entry;
     CellList[CellList.Count - Width - 3].type = EType.Exit;
     borders();           //создание случайных границ
     bholes();            //создание "черных дыр"
     DrawingField();      //рисование поля
     DrawingBlackHoles(); //рисование черных дыр
 }
Пример #24
0
        private void AdjustCells(NumberOfCells newCellValue)
        {
            //int currentCellsNumber = CellList.Count;
            int newValue = NumberOfCellsToInt(newCellValue);

            if (newValue == CellList.Count)
            {
                return;
            }
            if (newValue > CellList.Count)
            {
                // Thêm cells
                for (int i = CellList.Count; i < newValue; i++)
                {
                    var cell = Factory.CreatePolyline(Drawing, GetCellDependencies(i));
                    cell.Name  = "Cell" + (i + 1);
                    cell.Style = DefaultStyles.StructureLineStyle;
                    CellList.Add(cell);
                    this.Children.Add(cell);
                    this.Dependencies.Add(cell);
                    cell.OnAddingToCanvas(Drawing.Canvas);
                    cell.Selected = this.Selected;
                }
            }
            else
            {
                // Remove cell
                for (int i = CellList.Count; i > newValue; i--)
                {
                    RemoveCell();
                }
            }

            if (CellList == null)
            {
                return;
            }
            for (int i = 0; i < CellList.Count; i++)
            {
                CellList[i].Dependencies = GetCellDependencies(i);
                CellList[i].RecalculateAndUpdateVisual();
            }
        }
Пример #25
0
    private void AssemblyReloadEvents_afterAssemblyReload()
    {
        if (mapContentToserialize != null)
        {
            if (Map != null)
            {
                throw new InvalidOperationException("Divnost, cekal jsem ze Map bude null!");
            }
            CellList.CheckEmpty();
            Map      = new Map(mapSettings, Game.Ksids);
            Game.Map = Map;

            foreach (var p in mapContentToserialize)
            {
                Map.Add(p, true);
            }
            mapContentToserialize = null;
        }
    }
Пример #26
0
 private void h_FillCell3()
 {
     CellList.Clear();
     for (int xx = 0; xx < Width; xx++)
     {
         for (int yy = 0; yy < Height; yy++)
         {
             Cell pCell = new Cell()
             {
                 PositionX = xx,
                 PositionY = yy,
                 Value     = EValue.Empty
             };
             //if (xx == 1 && yy == 1) {
             //  pCell.Value = EValue.X;
             //}
             CellList.Add(pCell);
         }
     }
 }
Пример #27
0
            public Enumerator(CellListInfo info, Placeable first)
            {
                Current = first;
                var size = info.Size;

                if (size > 1)
                {
                    arr   = CellList.GetData(info, out var i);
                    start = i - 1;
                    index = i - 2;
                    end   = i + size - 1;
                }
                else
                {
                    arr   = null;
                    start = 0;
                    index = -1;
                    end   = size;
                }
            }
Пример #28
0
    public static CellList LoadJsonFile(string path)
    {
        string jsonText;

        try
        {
            jsonText = File.ReadAllText(path, Encoding.UTF8);
        }
        catch (Exception)
        {
            Debug.Log("打开文件错误");
            return(null);
        }
        CellList objJson = JsonConvert.DeserializeObject <CellList>(jsonText);

        FileStream fs  = new FileStream(path, FileMode.Open);
        string     md5 = GenerateMD5(fs);

        objJson.md5 = md5;
        return(objJson);
    }
Пример #29
0
        public void Setup()
        {
            var target = Engine.Object.Construct(Arguments.Empty);

            Engine.Global.FastAddProperty("Excel", target, true, false, true);

            Workbook.Setup(target);
            Sheet.Setup(target);
            SheetList.Setup(target);
            Row.Setup(target);
            RowList.Setup(target);
            Cell.Setup(target);
            CellList.Setup(target);
            Comment.Setup(target);
            Color.Setup(target);
            Font.Setup(target);
            MergeRegionList.Setup(target);
            MergeRegion.Setup(target);
            CellStyleList.Setup(target);
            CellStyle.Setup(target);
        }
Пример #30
0
        public static string Load(List <CellMap> CellList, string ReadPath)
        {
            try
            {
                using (StreamReader SR = new StreamReader(ReadPath, System.Text.Encoding.Default))
                {
                    if (CellList != null)
                    {
                        CellList.Clear();
                    }
                    else
                    {
                        CellList = new List <CellMap>();
                    }

                    string Line;
                    int    Index = 0;

                    ReadPath = SR.ReadLine();

                    while ((Line = SR.ReadLine()) != null)
                    {
                        string[] Words = Line.Split(new char[] { ';' });
                        string[] Prop  = new string[] { Words[2], Words[3], Words[4] };

                        CellList.Add(new CellMap(new AxialCoord(int.Parse(Words[0]), int.Parse(Words[1])), Prop));

                        Index++;
                    }

                    SR.Close();
                }
            }
            catch (Exception er)
            {
                Console.WriteLine(er.Message);
            }

            return(ReadPath);
        }
Пример #31
0
        /// <summary>
        /// Заполнение поля (создание клеток) заданного размера
        /// </summary>
        /// <param name="iW"></param>
        /// <param name="iH"></param>
        private void h_Fill(int iW, int iH)
        {
            EColor color = EColor.Black;

            for (int iX = 0; iX < iW; iX++)
            {
                for (int iY = 0; iY < iH; iY++)
                {
                    if (color == EColor.Black)
                    {
                        color = EColor.White;
                    }
                    else
                    {
                        color = EColor.Black;
                    }

                    ChessCell pC = new ChessCell(iX, iY, color);
                    CellList.Add(pC);
                }
            }
        }
Пример #32
0
        public void SetMap(Burning.DofusProtocol.Data.D2P.Map map, bool useDiagonal)
        {
            currentMap   = map;
            useDiagonals = useDiagonal;
            matrix       = new CellMatrix();
            openList     = new CellList();
            find         = false;
            Burning.DofusProtocol.Data.D2P.CellData cell;
            int id   = 0;
            int loc1 = 0;
            int loc2 = 0;
            int loc3 = 0;

            for (int line = 0; line < 20; line++)
            {
                for (int column = 0; column < 14; column++)
                {
                    cell = currentMap.Cells[id];
                    bool isUsedCell = usedCells.FirstOrDefault(x => x == id) == 0 ? false : true;

                    matrix.Add(id, new Cell(cell.MapChangeData != 0, cell.Mov && !isUsedCell, true, column, loc3, id, new Point(loc1 + column, loc2 + column)));
                    id++;
                }
                loc1++;
                loc3++;
                for (int column = 0; column < 14; column++)
                {
                    cell = currentMap.Cells[id];

                    bool isUsedCell = usedCells.FirstOrDefault(x => x == id) == 0 ? false : true;
                    matrix.Add(id, new Cell(cell.MapChangeData != 0, cell.Mov && !isUsedCell, true, column, loc3, id, new Point(loc1 + column, loc2 + column)));

                    id++;
                }
                loc3++;
                loc2--;
            }
        }
Пример #33
0
    void InitCells()
    {
        mCells = new CellList();

        for (var i = 0; i < Options.CellCount; i++)
        {
            var cell = mCells.Get(i);
            cell.Layout = Instantiate(m_CellPrefab, m_TableRoot.transform);
            cell.Layout.Init(mInfoCenter, i);
            cell.Index = i;

            // link cells - checked
            var x = i % Options.BoardSize;
            var y = i / Options.BoardSize;
            LinkCell(cell, LinkDirection.Up, x + 0, y - 1);
            LinkCell(cell, LinkDirection.Right, x + 1, y + 0);
            LinkCell(cell, LinkDirection.Bottom, x + 0, y + 1);
            LinkCell(cell, LinkDirection.Left, x - 1, y + 0);

            // debug
            cell.Layout.Info = i.ToString();
        }
    }
Пример #34
0
 public virtual void SetUp()
 {
     List = new CellList<string>();
 }
Пример #35
0
 public override void SetUp()
 {
     string item;
     List = new CellList<string>();
     List.Enqueue("a");
     List.Enqueue("b");
     List.TryTake(out item);
     List.TryTake(out item);
 }
Пример #36
0
 public override void SetUp()
 {
     List = new CellList<string>();
     List.Push("a");
     List.Push("b");
 }
Пример #37
0
 protected ProjectionAssemblyFactory(ProjectionOptions options)
 {
     this.options = options;
     this.unsaved = new CellList<ProjectionAssembly>();
 }
Пример #38
0
        public void Init()
        {
            universe = new Universe();

            seed = null;
        }