/// <summary>
 /// Initializes a new instance of the <see cref="SpreadsheetItemContainer"/> class.
 /// </summary>
 /// <param name="spreadsheetView">The spreadsheet view.</param>
 public SpreadsheetItemContainer(SpreadsheetView spreadsheetView)
 {
     IsTabStop = false;
     _owner = spreadsheetView;
     if (_owner != null)
         _topLevelSpreadsheet = _owner.GetTopLevelSpreadsheet();
     Cells = new CellCollection();
 }
Esempio n. 2
0
 public RowTemplate()
 {
     this.m_CellTemplates = new CellCollection(this);
     this.m_BackColor = SystemColors.ControlLightLight;
     this.m_ForeColor = SystemColors.ControlText;
     this.m_gradientBackColor = new GradientColor();
     this.m_gradientBackColor.PropertyChanged += new EventHandler(this.m_gradientBackColor_PropertyChanged);
     this.m_iHeight = 0x10;
 }
        public CellCollection GetNeighbours(Point location, CAEnvironment environment)
        {
            Cell c = environment.GetCell(location);
            CellCollection neighbours = new CellCollection();
            Point newPoint = location;

            for (int i = 0; i < _neighboursDelta.Length / 2; i++)
            {
                newPoint.Offset(_neighboursDelta[i, 0], _neighboursDelta[i, 1]);
                neighbours.Add(environment.GetCell(newPoint));
                newPoint = location;
            }

            return neighbours;
        }
        public bool CanBeActivated(Cell currentCell, CellCollection neighbours)
        {
            IEnumerator<Cell> enumerator = neighbours.GetEnumerator();

            byte currentCase = 0;
            int index = neighbours.Count - 1;
            while (enumerator.MoveNext())
            {
                if (enumerator.Current.State)
                {
                    currentCase += (byte) Math.Pow(2, index);
                }
                index--;
            }
            return _rule[currentCase];
        }
		/// <summary>
		/// Edits the value of the specified object using the specified 
		/// service provider and context
		/// </summary>
		/// <param name="context">An ITypeDescriptorContext that can be 
		/// used to gain additional context information</param>
		/// <param name="isp">A service provider object through which 
		/// editing services can be obtained</param>
		/// <param name="value">The object to edit the value of</param>
		/// <returns>The new value of the object. If the value of the 
		/// object has not changed, this should return the same object 
		/// it was passed</returns>
		public override object EditValue(ITypeDescriptorContext context, IServiceProvider isp, object value)
		{
			this.cells = (CellCollection) value;

			object returnObject = base.EditValue(context, isp, value);

			Row row = (Row) context.Instance;

			if (row.TableModel != null && row.TableModel.Table != null)
			{
				row.TableModel.Table.PerformLayout();
				row.TableModel.Table.Refresh();
			}
			
			return returnObject;
		}
Esempio n. 6
0
        public MainViewModel()
        {
            Cells = new CellCollection(Click);

            _waysToWin = new[,]
            {
                { Cells[0,0], Cells[0,1], Cells[0,2] },
                { Cells[1,0], Cells[1,1], Cells[1,2] },
                { Cells[2,0], Cells[2,1], Cells[2,2] },

                { Cells[0,0], Cells[1,0], Cells[2,0] },
                { Cells[0,1], Cells[1,1], Cells[2,1] },
                { Cells[0,2], Cells[1,2], Cells[2,2] },

                { Cells[0,0], Cells[1,1], Cells[2,2] },
                { Cells[0,2], Cells[1,1], Cells[2,0] }
            };
        }
Esempio n. 7
0
        public void IsValid_GivenCollectionWithWithoutAllCellsWithValues1to9_ReturnFalse()
        {
            var sut = new CellCollection("");

            sut.Cells.Add(TestUtilities.CreateCell(1));
            sut.Cells.Add(TestUtilities.CreateCell(2));
            sut.Cells.Add(TestUtilities.CreateCell(3));
            sut.Cells.Add(TestUtilities.CreateCell(4));

            sut.Cells.Add(TestUtilities.CreateCell(6));
            sut.Cells.Add(TestUtilities.CreateCell(7));

            sut.Cells.Add(TestUtilities.CreateCell(9));

            var result = sut.IsValid();

            Assert.IsFalse(result);
        }
Esempio n. 8
0
        public void IsWin_ShouldReturnTrueForWin()
        {
            //Arrange
            ICell[] cells =
            {
                new UnselectedCell(new Glyph('?')), new UnselectedCell(new Glyph('1')), new UnselectedCell(new Glyph('2')),
                new UnselectedCell(new Glyph('?')), new UnselectedCell(new Glyph('4')), new UnselectedCell(new Glyph('5')),
                new UnselectedCell(new Glyph('?')), new UnselectedCell(new Glyph('7')), new UnselectedCell(new Glyph('8'))
            };
            CellCollection cellCollection = new CellCollection(cells);
            LeftColumnWin  subject        = new LeftColumnWin(cellCollection);

            //Act
            Bool actual = subject.IsWin();

            //Assert
            ((bool)actual).Should().BeTrue();
        }
Esempio n. 9
0
        public void IsWin_ShouldReturnFalseForNotWin()
        {
            //Arrange
            ICell[] cells =
            {
                new UnselectedCell(new Glyph('0')), new UnselectedCell(new Glyph('1')), new UnselectedCell(new Glyph('?')),
                new UnselectedCell(new Glyph('3')), new UnselectedCell(new Glyph('4')), new UnselectedCell(new Glyph('?')),
                new UnselectedCell(new Glyph('6')), new UnselectedCell(new Glyph('7')), new UnselectedCell(new Glyph('8'))
            };
            CellCollection cellCollection = new CellCollection(cells);
            RightColumnWin subject        = new RightColumnWin(cellCollection);

            //Act
            Bool actual = subject.IsWin();

            //Assert
            ((bool)actual).Should().BeFalse();
        }
Esempio n. 10
0
        public void ClaimEndsGame_ShouldClaimCellForPlayer()
        {
            //Arrange
            FakePrinter     fakePrinter      = new FakePrinter.Builder().Build();
            FakeCell        fakeCellBoard    = new FakeCell.Builder().IsSelected(Bool.False).Value("1").Build();
            FakeCell        fakeCellSelected = new FakeCell.Builder().IsSelected(Bool.False).Value("1").Build();
            FakeCell        fakeCellPlayer   = new FakeCell.Builder().AsSelected(fakeCellSelected).Value("1").Build();
            ICellCollection cellCollection   = new CellCollection(new ICell[] { fakeCellBoard });
            FakeGameState   fakeGameState    = new FakeGameState.Builder().IsGameOver(Bool.False).Build();
            FakePlayer      fakePlayer       = new FakePlayer.Builder().Cell(fakeCellPlayer).Build();
            Board           subject          = new Board(cellCollection, fakeGameState, fakePrinter);

            //Act
            subject.ClaimEndsGame(fakeCellBoard, fakePlayer);

            //Assert
            cellCollection.At(new IntOf(0)).Should().NotBe(fakeCellBoard);
        }
Esempio n. 11
0
    protected CellCollection GetCellCollection()
    {
        DataCell       dataCell;
        CellCollection CellCol = new CellCollection();

        #region Code Cell
        dataCell             = new DataCell();
        dataCell.CaptionName = "Code";
        dataCell.IsKey       = true;
        dataCell.DisplayMode = DisplayModes.Hidden;
        dataCell.Align       = AlignTypes.Right;
        dataCell.FieldName   = "Code";
        dataCell.Width       = 50;
        CellCol.Add(dataCell);
        #endregion
        #region Data Cells
        dataCell             = new DataCell("BanFile", "فایل", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("TargetUrl", "آدرس", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("BannerType", "نوع", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("BannerPosition", "محل", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("ViewNum", "تعداد نمایش", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("ClickNum", "تعداد کلیک", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);

        #endregion
        return(CellCol);
    }
Esempio n. 12
0
    protected CellCollection GetCellCollection()
    {
        DataCell       dataCell;
        CellCollection CellCol = new CellCollection();

        #region Code Cell
        dataCell             = new DataCell();
        dataCell.CaptionName = "Code";
        dataCell.IsKey       = true;
        dataCell.DisplayMode = DisplayModes.Hidden;
        dataCell.Align       = AlignTypes.Right;
        dataCell.FieldName   = "Code";
        dataCell.Width       = 50;
        CellCol.Add(dataCell);
        #endregion
        #region Data Cells
        dataCell             = new DataCell("FirstName", "نام", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("LastName", "نام خانوادگی", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("Email", "ایمیل", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("StudyFieldName", "رشته تحصیلی", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("GenderName", "جنسیت", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("ContactNumber", "شماره تماس", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);

        #endregion
        return(CellCol);
    }
Esempio n. 13
0
    protected CellCollection GetCellCollection()
    {
        DataCell       dataCell;
        CellCollection CellCol = new CellCollection();

        #region Code Cell
        dataCell             = new DataCell();
        dataCell.CaptionName = "Code";
        dataCell.IsKey       = true;
        dataCell.DisplayMode = DisplayModes.Hidden;
        dataCell.Align       = AlignTypes.Right;
        dataCell.FieldName   = "Code";
        dataCell.Width       = 50;
        CellCol.Add(dataCell);
        #endregion
        #region Data Cells
        dataCell             = new DataCell("Name", "نام پرداخت کننده", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("FishNo", "شماره فیش", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("Bank", "بانک", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("FirstName", "نام", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("LastName", "نام حانوادگی", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("UserCode", "کد کاربر", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);

        #endregion
        return(CellCol);
    }
        public void ShouldSelectBlock()
        {
            //Arrange
            CellCollection cellCollection        = new CellCollection();
            ComputerPlayer playerOne             = new ComputerPlayer(new Glyph('@'), new HardComputerSelectMoveAction());
            ComputerPlayer playerTwo             = new ComputerPlayer(new Glyph('&'), new HardComputerSelectMoveAction());
            Board          board                 = new Board(cellCollection, new GameState(cellCollection), new FakePrinter.Builder().Print().Build());
            HardComputerSelectMoveAction subject = new HardComputerSelectMoveAction();

            board.ClaimEndsGame(BoardPosition.TopRight, playerTwo);
            board.ClaimEndsGame(BoardPosition.TopLeft, playerTwo);
            board.ClaimEndsGame(BoardPosition.MiddleCenter, playerOne);

            //Act
            ICell cell = subject.Act(board, playerOne, playerTwo);

            //Assert
            cell.Value().Should().Be(BoardPosition.TopCenter.Value());
        }
Esempio n. 15
0
        public static void readExcel()
        {
            //"C:\\Users\\pantonio\\Documents\\rcl\\in\\essa_cuenta 3 noviembre 2012.xlsx"
            Workbook         wb  = Workbook.Open("C:\\Users\\pantonio\\Documents\\rcl\\in\\essa_cuenta 3 noviembre 2012.xlsx");
            List <Worksheet> lws = wb.Worksheets;

            foreach (Worksheet ws in lws)
            {
                CellCollection cells = ws.Cells;
                for (int i = cells.FirstRowIndex; i < cells.LastRowIndex; i++)
                {
                    Row lrow = cells.GetRow(i);
                    for (int j = lrow.FirstColIndex; j < lrow.LastColIndex; j++)
                    {
                        System.Windows.Forms.MessageBox.Show(cells[i, j].ToString());
                    }
                }
            }
        }
Esempio n. 16
0
        private void GetDic()
        {
            Workbook       book  = Workbook.Load(@"Data\DataStore\1945 kanji.xls");
            Worksheet      sheet = book.Worksheets[0];
            CellCollection cells = new CellCollection();

            cells = sheet.Cells;
            for (int i = 1, len = cells.Rows.Count; i < len; i++)
            {
                string japanese  = cells[i, 1].StringValue;
                string chinaViet = cells[i, 2].StringValue;
                string mean      = cells[i, 3].StringValue;
                string Pronounce = cells[i, 4].StringValue;
                _listDic.Add(new DataStoreModel()
                {
                    Japanese = japanese, Mean = chinaViet, Example = mean, Pronounce = Pronounce
                });
            }
        }
Esempio n. 17
0
        public SensorCollection Sniff(List <string> serials, CellCollection cells)
        {
            SensorCollection sensors = new SensorCollection();
            string           longSerial;
            string           path;
            bool             folderExists;

            //Search SN in every Folder
            foreach (string sn in serials)
            {
                folderExists = false;
                Sensor sensor = new Sensor();
                longSerial = string.Format("SN{0}", sn);

                foreach (Cell cell in cells)
                {
                    path = string.Format("{0}\\{1}\\", cell.Location, longSerial);

                    if (Directory.Exists(path))
                    {
                        //read sensor model
                        Reader reader = new Reader();
                        sensor = reader.ReadLastTask(path, longSerial);                        //read SN00XXXXX.xml

                        folderExists = true;

                        break;
                    }
                }

                if (!folderExists)
                {
                    sensor.Sn       = longSerial;
                    sensor.Location = "In all locations";
                    sensor.Model    = "No Folder";
                }

                sensors.Add(sensor);
            }

            return(sensors);
        }
Esempio n. 18
0
    CellCollection IBaseBOL.GetListCellCollection()
    {
        DataCell       dataCell;
        CellCollection CellCol = new CellCollection();

        #region Code Cell
        dataCell             = new DataCell();
        dataCell.CaptionName = "Code";
        dataCell.IsKey       = true;
        dataCell.DisplayMode = DisplayModes.Hidden;
        dataCell.Align       = AlignTypes.Right;
        dataCell.FieldName   = "Code";
        dataCell.MaxLength   = 100;
        dataCell.Width       = 50;
        CellCol.Add(dataCell);
        #endregion

        #region Data Cells
        dataCell             = new DataCell("UserCode", "UserCode", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Hidden;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("Email", "Email", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("GenKey", "GenKey", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("GenTime", "GenTime", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("Used", "Used", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);

        #endregion
        return(CellCol);
    }
Esempio n. 19
0
        public static List <Cell> NeighborCellsInRegion(this Cell cell)
        {
            var result = new List <Cell>();

            if (cell.regionId == "")
            {
                return(result);
            }

            foreach (var direction in Directionf.Directions())
            {
                if (CellCollection.HasCellAt(cell.Step(direction)) &&
                    CellCollection.cells[cell.Step(direction)].regionId == cell.regionId)
                {
                    result.Add(CellCollection.cells[cell.Step(direction)]);
                }
            }

            return(result);
        }
Esempio n. 20
0
        public void Solve(CellCollection cellCollection)
        {
            if (cellCollection.Hints.Count != 1)
            {
                return;
            }

            var cellCount  = cellCollection.Cells.Count;
            var hint       = cellCollection.Hints.First();
            var difference = cellCount - hint;

            if (difference >= hint)
            {
                return;
            }

            var guaranteed = cellCollection.Cells.Skip(difference).Take(hint - difference).ToList();

            guaranteed.ForEach(c => c.UpdateNodeState(CellState.Yes));
        }
Esempio n. 21
0
    CellCollection IBaseBOL.GetListCellCollection()
    {
        DataCell       dataCell;
        CellCollection CellCol = new CellCollection();

        #region Code Cell
        dataCell             = new DataCell();
        dataCell.CaptionName = "Code";
        dataCell.IsKey       = true;
        dataCell.DisplayMode = DisplayModes.Hidden;
        dataCell.Align       = AlignTypes.Right;
        dataCell.FieldName   = "Code";
        dataCell.MaxLength   = 100;
        dataCell.Width       = 50;
        CellCol.Add(dataCell);
        #endregion
        #region Data Cells
        dataCell             = new DataCell("ItemCode", "کد آیتم", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("Name", "نام", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("CommentStatus", "وضعیت", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("SectionName", "قسمت", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("SDate", "تاریخ ارسال", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);

        #endregion
        return(CellCol);
    }
Esempio n. 22
0
    public CellCollection GetListCellCollection()
    {
        DataCell       dataCell;
        CellCollection CellCol = new CellCollection();

        #region Code Cell
        dataCell             = new DataCell();
        dataCell.CaptionName = "Code";
        dataCell.IsKey       = true;
        dataCell.DisplayMode = DisplayModes.Hidden;
        dataCell.Align       = AlignTypes.Right;
        dataCell.FieldName   = "Code";
        dataCell.MaxLength   = 100;
        dataCell.Width       = 50;
        CellCol.Add(dataCell);
        #endregion
        #region Data Cells
        dataCell             = new DataCell("FaTitle", "عنوان", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("CatTitle", "گروه", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("Price", "قیمت", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("ViewNum", "تعداد مشاهده", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("BuyNum", "تعداد خرید", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);

        #endregion
        return(CellCol);
    }
Esempio n. 23
0
    CellCollection IBaseBOL.GetListCellCollection()
    {
        DataCell       dataCell;
        CellCollection CellCol = new CellCollection();

        #region Code Cell
        dataCell             = new DataCell();
        dataCell.CaptionName = "Code";
        dataCell.IsKey       = true;
        dataCell.DisplayMode = DisplayModes.Hidden;
        dataCell.Align       = AlignTypes.Right;
        dataCell.FieldName   = "Code";
        dataCell.MaxLength   = 100;
        dataCell.Width       = 50;
        CellCol.Add(dataCell);
        #endregion
        #region Data Cells
        dataCell             = new DataCell("NewsNumber", "شماره خبر ", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("NDate", "تاریخ", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("Title", "عنوان", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("NewsType", "نوع خبر", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("ContentType", "نوع مطلب", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);

        #endregion
        return(CellCol);
    }
Esempio n. 24
0
        private static void ProcessCell(Cell cell)
        {
            var neighbors = new CellCollection();

            if (cell.North != null)
            {
                neighbors.Add(cell.North);
            }

            if (cell.East != null)
            {
                neighbors.Add(cell.East);
            }

            if (neighbors.IsEmpty())
            {
                return;
            }

            cell.Link(neighbors.Sample());
        }
        void InitWorkbook()
        {
            book.Unit = Office.DocumentUnit.Point;

            book.Styles.DefaultStyle.Font.Name = "Segoe UI";
            book.Styles.DefaultStyle.Font.Size = 8;

            sheet   = book.Worksheets[0];
            columns = sheet.Columns;
            rows    = sheet.Rows;
            cells   = sheet.Cells;

            sheet.DefaultRowHeight = 9.5;
            sheet.Name             = "Expense report";

            sheet.ActiveView.ShowGridlines = false;
            sheet.ActiveView.Orientation   = PageOrientation.Portrait;
            sheet.PrintOptions.FitToPage   = true;

            sheet.DefinedNames.Add("_xlnm.Print_Area", "'Expense report'!B2:O30");
        }
Esempio n. 26
0
 internal void method_41()
 {
     base.method_36();
     if (this.characterFormat_1 != null)
     {
         this.characterFormat_1.Close();
     }
     if ((this.cellCollection_1 != null) && (this.cellCollection_1.Count > 0))
     {
         int       count = this.cellCollection_1.Count;
         TableCell cell  = null;
         for (int i = 0; i < count; i++)
         {
             cell = this.cellCollection_1[i];
             cell.method_62();
             cell = null;
         }
         this.cellCollection_1.Clear();
         this.cellCollection_1 = null;
     }
 }
Esempio n. 27
0
        public void Visit(IGrid g)
        {
            Dictionary <int, ICellContent> contents = new Dictionary <int, ICellContent>(g.Rows[this.row].Count);
            CellCollection row = g.Rows[this.row];

            for (int i = 0; i < row.Count; i++)
            {
                contents.Add(i, row[i].Content);
            }

            for (int i = row.Count - 1; i >= 0; i--)
            {
                int newIndex = i - shiftAmount;
                if (newIndex < 0)
                {
                    newIndex = row.Count - Mathf.Abs(newIndex) % row.Count;
                }

                row[newIndex].Content = contents[i];
            }
        }
Esempio n. 28
0
 private static void Wall_ParseMain(Room room, ref Scaffold scaffold)
 {
     foreach (var cell in room.GetCells())
     {
         foreach (var direction in Directionf.Directions())
         {
             if (CellCollection.HasCellAt(cell.Step(direction)))
             {
                 var neighbor = CellCollection.cells[cell.Step(direction)];
                 if (neighbor.roomId != cell.roomId)
                 {
                     RenderWallNode(cell, direction, ref scaffold);
                 }
             }
             else
             {
                 RenderWallNode(cell, direction, ref scaffold);
             }
         }
     }
 }
Esempio n. 29
0
        protected void LoadData()
        {
            CreateWaitDialog("正在查询...", "请稍等");
            //加载模板
            string filename = Path.Combine(Application.StartupPath, "ReportTemplates\\MonthlySalaryDetail.tab");

            spreadsheetControl1.LoadDocument(filename);

            sheet   = spreadsheetControl1.ActiveWorksheet;
            columns = sheet.Columns;
            rows    = sheet.Rows;
            cells   = sheet.Cells;

            SetWaitDialogCaption("正在加载数据...");

            FillTable();

            sheet.ScrollToRow(3);//焦点切回开始位置

            CloseWaitDialog();
        }
Esempio n. 30
0
        public void Visit(IGrid g)
        {
            Dictionary <int, ICellContent> contents = new Dictionary <int, ICellContent>(g.Columns[this.column].Count);
            CellCollection column = g.Columns[this.column];

            for (int i = 0; i < column.Count; i++)
            {
                contents.Add(i, column[i].Content);
            }

            for (int i = column.Count - 1; i >= 0; i--)
            {
                int newIndex = i - shiftAmount;
                if (newIndex < 0)
                {
                    newIndex = column.Count - Mathf.Abs(newIndex) % column.Count;
                }

                column[newIndex].Content = contents[i];
            }
        }
Esempio n. 31
0
    protected CellCollection GetCellCollection()
    {
        DataCell       dataCell;
        CellCollection CellCol = new CellCollection();

        #region Code Cell
        dataCell             = new DataCell();
        dataCell.CaptionName = "Code";
        dataCell.IsKey       = true;
        dataCell.DisplayMode = DisplayModes.Hidden;
        dataCell.Align       = AlignTypes.Right;
        dataCell.FieldName   = "Code";
        dataCell.Width       = 50;
        CellCol.Add(dataCell);
        #endregion
        #region Data Cells
        dataCell             = new DataCell("ItemCode", "کد موجودیت", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("Name", "ارسال کننده", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("CommentStatus", "وضعیت", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("SectionName", "بخش", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("SDate", "تاریخ", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);

        #endregion
        return(CellCol);
    }
Esempio n. 32
0
    CellCollection IBaseBOL.GetListCellCollection()
    {
        DataCell       dataCell;
        CellCollection CellCol = new CellCollection();

        dataCell             = new DataCell();
        dataCell.CaptionName = "کد";
        dataCell.IsKey       = true;
        dataCell.DisplayMode = DisplayModes.Hidden;
        dataCell.Align       = AlignTypes.Right;
        dataCell.FieldName   = "Code";
        dataCell.MaxLength   = 100;
        dataCell.Width       = 50;
        CellCol.Add(dataCell);

        dataCell             = new DataCell("Code", "کد", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("Entity", "موجودیت", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("Action", "عملیات", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("ActDate", "تاریخ", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("ActTime", "زمان", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);


        return(CellCol);
    }
Esempio n. 33
0
    CellCollection IBaseBOL.GetListCellCollection()
    {
        DataCell       dataCell;
        CellCollection CellCol = new CellCollection();

        dataCell             = new DataCell();
        dataCell.CaptionName = "کد";
        dataCell.IsKey       = true;
        dataCell.DisplayMode = DisplayModes.Hidden;
        dataCell.Align       = AlignTypes.Right;
        dataCell.FieldName   = "Code";
        dataCell.MaxLength   = 100;
        dataCell.Width       = 50;
        CellCol.Add(dataCell);

        dataCell             = new DataCell("Name", "کلید واژه", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Visible;
        CellCol.Add(dataCell);

        return(CellCol);
    }
Esempio n. 34
0
        private void OnCellsChanged(CellCollection newValue, CellCollection oldValue)
        {
            if (oldValue != null)
            {
                oldValue.CollectionChanged -= OnCellsChanged;
                foreach (Cell cell in oldValue)
                {
                    RemoveCell(cell, -1);
                }
            }

            //Add new cells
            if (newValue != null)
            {
                newValue.CollectionChanged += OnCellsChanged;
                foreach (Cell cell in newValue)
                {
                    AddCell(cell, -1);
                }
            }
            _isUpdated = false;
        }
Esempio n. 35
0
    CellCollection IBaseBOL.GetListCellCollection()
    {
        DataCell       dataCell;
        CellCollection CellCol = new CellCollection();

        dataCell             = new DataCell();
        dataCell.CaptionName = "کد";
        dataCell.IsKey       = true;
        dataCell.DisplayMode = DisplayModes.Hidden;
        dataCell.Align       = AlignTypes.Right;
        dataCell.FieldName   = "Code";
        dataCell.MaxLength   = 100;
        dataCell.Width       = 50;
        CellCol.Add(dataCell);

        dataCell             = new DataCell("Code", "کد", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;
        dataCell.DisplayMode = DisplayModes.Hidden;
        CellCol.Add(dataCell);
        dataCell             = new DataCell("GroupCode", "کد پدر", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;

        CellCol.Add(dataCell);
        dataCell             = new DataCell("ResourceName", "نام منبع", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;

        CellCol.Add(dataCell);
        dataCell             = new DataCell("ResourceCode", "کد منبع", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;

        CellCol.Add(dataCell);
        dataCell             = new DataCell("AccessType", "نوع دسترسی", AlignTypes.Right, 200);
        dataCell.IsListTitle = true;

        CellCol.Add(dataCell);


        return(CellCol);
    }
Esempio n. 36
0
        private static void Print(this CellCollection state, Cell topLeft, Cell size)
        {
            const char alive = '#';
            const char dead  = ' ';

            Console.WriteLine("Generation {0} [({1}, {2}), ({3}, {4})] ({5} live cells)",
                              state.Generation,
                              topLeft.X, topLeft.Y,
                              topLeft.X + size.X, topLeft.Y + size.Y,
                              state.Count);

            for (int i = topLeft.Y; i <= topLeft.Y + size.Y; i++)
            {
                for (int o = topLeft.X; o <= topLeft.X + size.X; o++)
                {
                    Console.Write(state.Contains(o, i) ? alive : dead);
                }
                Console.WriteLine();
            }

            Console.WriteLine("Generated in {0} ms.", state.MillisecondsToGenerate);
        }
Esempio n. 37
0
        public bool CanBeActivated(Cell currentCell, CellCollection neighbours)
        {
            short count = 0;
            IEnumerator<Cell> enumerator = neighbours.GetEnumerator();

            while (enumerator.MoveNext())
            {
                if (enumerator.Current.State)
                {
                    count++;
                }
            }

            if (count == 3)
            {
                return true;
            }
            if (count == 2 && currentCell.State)
            {
                return true;
            }
            return false;
        }
		/// <summary>
		/// Initializes a new instance of the CellCollectionEditor class 
		/// using the specified collection type
		/// </summary>
		/// <param name="type">The type of the collection for this editor to edit</param>
		public CellCollectionEditor(Type type) : base(type)
		{
			this.cells = null;
		}
Esempio n. 39
0
 public Worksheet(string name)
 {
     this.Name = name;
     this.Cells = new CellCollection();
 }
Esempio n. 40
0
        private CellCollection GetNeighbors(Cell[,] cells, int rowIndex, int columnIndex)
        {
            CellCollection cellCollection = new CellCollection();
            int previousRowIndex = rowIndex - 1;
            int previousColumnIndex = columnIndex - 1;

            int nextRowIndex = rowIndex + 1;
            int nextColumnIndex = columnIndex + 1;

            if (previousRowIndex >= 0)
            {
                if (previousColumnIndex >= 0)
                    cellCollection.Add(cells[previousRowIndex, previousColumnIndex]);

                cellCollection.Add(cells[previousRowIndex, columnIndex]);

                if (nextColumnIndex < this.Size.Width)
                    cellCollection.Add(cells[previousRowIndex, nextColumnIndex]);
            }

            if (nextRowIndex < this.Size.Height)
            {
                if (previousColumnIndex >= 0)
                    cellCollection.Add(cells[nextRowIndex, previousColumnIndex]);

                cellCollection.Add(cells[nextRowIndex, columnIndex]);

                if (nextColumnIndex < this.Size.Width)
                    cellCollection.Add(cells[nextRowIndex, nextColumnIndex]);
            }

            if (previousColumnIndex >= 0)
                cellCollection.Add(cells[rowIndex, previousColumnIndex]);
            if (nextColumnIndex < this.Size.Width)
                cellCollection.Add(cells[rowIndex, nextColumnIndex]);

            return cellCollection;
        }
Esempio n. 41
0
 public HSDPA_CommonParam(SnapshotContext context)
 {
     m_Context = context;
     m_UMTSUIParam = context.Lookup<UMTSUIParam>(ContextKeys.UMTSUIParam);
     m_UMTSServiceProvide = new UMTSServiceProvider(context);
     m_CellCol = new CellCollection();
     m_UserCol = new UserCollection();
     m_HSDPABearerList = m_UMTSServiceProvide.TrafficMgr.HSDPABearerList;
     m_SingleModeUserList = new List<UMTSSimUser>();
 }        
Esempio n. 42
0
 /// <summary>
 /// Initializes the cells with values.
 /// </summary>
 private void InitializeCellsWithValues()
 {
     Cells = new CellCollection();
     foreach (var column in _owner.Columns)
     {
         var cell = column.CreateCell(this);
         Cells.Add(cell);
     }
 }
Esempio n. 43
0
        public HSUPA_CommonParam(SnapshotContext context)
        {
            //IApplicationContext appContext = context.Lookup<IApplicationContext>(ContextKeys.AppContext);
            //ITrafficService trafficSvc = ServiceHelper.Lookup<ITrafficService>(appContext);
            //m_R99Mgr = (UMTSR99BearerManagement)trafficSvc.LookupManager(typeof(UMTSR99BearerManagement));
            //m_DpaMgr = (HSDPABearerManagement)trafficSvc.LookupManager(typeof(HSDPABearerManagement));

            m_SnapshotContext = context;
            m_UMTSUIParam = context.Lookup<UMTSUIParam>(ContextKeys.UMTSUIParam);
            m_UMTSServiceProvide = new UMTSServiceProvider(context);
            m_CellCol = new CellCollection();
            m_UserCol = new UserCollection();
            InitUIParam();
        }
Esempio n. 44
0
        public void LateUpdateState(CellCollection activeCells)
        {
            //tipArrow.UpdateState();
            if (_isReturning)
            {
                foreach (Chuzzle selectedChuzzle in SelectedChuzzles)
                {
                    Vector3 change = selectedChuzzle.Velocity*Time.deltaTime;
                    Vector3 currentPos = selectedChuzzle.transform.position;
                    Vector3 nextPos = currentPos + change;
                    Vector3 moveToPos = selectedChuzzle.MoveTo.Position;
                    switch (CurrentDirection)
                    {
                        case Direction.Right:
                            if (currentPos.x < moveToPos.x && nextPos.x > moveToPos.x)
                            {
                                selectedChuzzle.transform.position = selectedChuzzle.MoveTo.Position;
                                selectedChuzzle.Velocity = Vector3.zero;
                                continue;
                            }
                            break;
                        case Direction.Left:
                            if (currentPos.x > moveToPos.x && nextPos.x < moveToPos.x)
                            {
                                selectedChuzzle.transform.position = selectedChuzzle.MoveTo.Position;
                                selectedChuzzle.Velocity = Vector3.zero;
                                continue;
                            }
                            break;
                        case Direction.Top:
                            if (currentPos.y < moveToPos.y && nextPos.y > moveToPos.y)
                            {
                                selectedChuzzle.transform.position = selectedChuzzle.MoveTo.Position;
                                selectedChuzzle.Velocity = Vector3.zero;
                                continue;
                            }
                            break;
                        case Direction.Bottom:
                            if (currentPos.y > moveToPos.y && nextPos.y < moveToPos.y)
                            {
                                selectedChuzzle.transform.position = selectedChuzzle.MoveTo.Position;
                                selectedChuzzle.Velocity = Vector3.zero;
                                continue;
                            }
                            break;
                        default:
                            throw new ArgumentOutOfRangeException();
                    }
                    selectedChuzzle.transform.position = nextPos;
                }

                MoveChuzzles(activeCells);

                if (SelectedChuzzles.All(x => x.Velocity == Vector3.zero))
                {
                    Reset();
                }
                return;
            }
        }
Esempio n. 45
0
 internal Row(Workbook wb, RowRecord row)
     : base(wb)
 {
     _cells = new CellCollection(wb);
 }
Esempio n. 46
0
 public Row(Sheet sheet)
 {
         this.ParentSheet = sheet;
         this.Cells = new CellCollection(this); 
 }
Esempio n. 47
0
		internal void restoreStructure(TableStructure str)
		{
			resetCoveredCells();

			cells = str.cells.Clone();
			colsList = str.cols.Clone();
			rowsList = str.rows.Clone();

			rowsCount = str.rowsCount;
			columnsCount = str.columnsCount;

			hasHeaderRows = str.hasHeaderRows;

			layoutText();
			layoutCellText();
		}
Esempio n. 48
0
        public void EmptyCellCollection_AccessUninitializedCell_ImplicitlyCreatesCell()
        {
            var cc = new CellCollection();

            cc[0, 0].Bold = true;
        }
Esempio n. 49
0
		internal void redimTable(int cols, int rows, bool copy,
			int cpCol, int cpRow, bool cpInserted,
			int colsAffected, int rowsAffected, bool undo)
		{
			resetCoveredCells();
			hasHeaderRows = false;

			if (undo) flowChart.UndoManager.onRedimTable(this);

			// remove arrows attached to deleted rows
			if (!cpInserted && (rowsAffected != 0) && (rowsList != null))
			{
				ArrayList arrowsToRemove = new ArrayList();
				for (int i = cpRow; i < cpRow + rowsAffected && i < this.rowsCount; ++i)
				{
					Row r = (Row)this.rowsList[i];
					for (int k = 0; k < r.IncomingArrows.Count; ++k)
						arrowsToRemove.Add(r.IncomingArrows[k]);
					for (int k = 0; k < r.OutgoingArrows.Count; ++k)
						arrowsToRemove.Add(r.OutgoingArrows[k]);
				}
				for (int j = 0; j < arrowsToRemove.Count; ++j)
					flowChart.DeleteObject((ChartObject)arrowsToRemove[j]);
				arrowsToRemove.Clear();
			}

			if (undo) flowChart.UndoManager.onRedimArrowsDeleted(this);

			CellCollection oldData = cells;
			RowCollection oldRowsDsc = rowsList;
			ColumnCollection oldColsDsc = colsList;
			int oldCols = this.columnsCount;
			int oldRows = this.rowsCount;
			bool copyC, copyR;
			copyC = copyR = copy;

			// resize the table
			this.columnsCount = cols;
			this.rowsCount = rows;

			// resize the columns array
			colsList = new ColumnCollection();
			if (this.columnsCount > 0)
			{
				for (int c = 0; c < this.columnsCount; ++c)
				{
					Column col = new Column(this);
					col.width = columnWidth;
					colsList.Add(col);
				}
			}
			else
			{
				copyC = false;
			}

			// resize the rows array
			rowsList = new RowCollection();
			if (this.rowsCount > 0)
			{
				for (int rr = 0; rr < this.rowsCount; ++rr)
				{
					Row row = new Row(this);
					row.Height = rowHeight;
					rowsList.Add(row);
				}
			}
			else
			{
				copyR = false;
			}

			// resize the cells array
			cells = new CellCollection();
			if (this.columnsCount > 0 && this.rowsCount > 0)
			{
				for (int i = 0; i < this.columnsCount * this.rowsCount; ++i)
					cells.Add(new Cell(this));
			}
			else
			{
				copy = false;
			}

			// copy data from the old cells array to the new one
			if (copy && (cells != null) && (oldData != null))
			{
				for (int rr = 0; rr < this.rowsCount; ++rr)
				{
					for (int c = 0; c < this.columnsCount; ++c)
					{
						int cr = rr;
						int cc = c;
						bool cp = true;
						if (cpInserted)
						{
							if (c >= cpCol && c < cpCol + colsAffected) cp = false;
							if (rr >= cpRow && rr < cpRow + rowsAffected) cp = false;
							if (c >= cpCol + colsAffected) cc -= colsAffected;
							if (rr >= cpRow + rowsAffected) cr -= rowsAffected;
						}
						else
						{
							if (c >= cpCol) cc += colsAffected;
							if (rr >= cpRow) cr += rowsAffected;
						}
						if (cp)
						{
							cells[rr * this.columnsCount + c] = oldData[cr * oldCols + cc];
							oldData[cr * oldCols + cc] = null;
						}
						else
							cells[rr * this.columnsCount + c] = new Cell(this);
					}
				}
			}

			if (oldData != null)
			{
				for (int oc = 0; oc < oldData.Count; ++oc)
				{
					if (oldData[oc] != null)
						oldData[oc].freeResources();
				}
			}

			// copy data from the old rows array to the new one
			if (copyR && (rowsList != null) && (oldRowsDsc != null))
			{
				for (int rr = 0; rr < this.rowsCount; ++rr)
				{
					int cr = rr;
					bool cp = true;
					if (cpInserted)
					{
						if (rr >= cpRow && rr < cpRow + rowsAffected) cp = false;
						if (rr >= cpRow + rowsAffected) cr -= rowsAffected;
					}
					else
					{
						if (rr >= cpRow) cr += rowsAffected;
					}
					if (cp)
						rowsList[rr] = oldRowsDsc[cr];
				}
			}

			// copy data from the old columns array to the new one
			if (copyC && (colsList != null) && (oldColsDsc != null))
			{
				for (int c = 0; c < this.columnsCount; ++c)
				{
					int cc = c;
					bool cp = true;
					if (cpInserted)
					{
						if (c >= cpCol && c < cpCol + colsAffected) cp = false;
						if (c >= cpCol + colsAffected) cc -= colsAffected;
					}
					else
					{
						if (c >= cpCol) cc += colsAffected;
					}
					if (cp)
						colsList[c] = oldColsDsc[cc];
				}
			}

			if (rowsAffected > 0)
			{
				updateLinksIndices();
				updateArrowsPos(cpRow);
			}

			if (copy && rowsAffected != 0)
				checkForHeaderRows();

			if (undo) flowChart.UndoManager.onCompleteRedim();
		}
Esempio n. 50
0
		public override void setReference(int refId, IPersists obj)
		{
			base.setReference(refId, obj);

			switch (refId)
			{
			case 1:
				cells = (CellCollection)obj;
				break;
			case 2:
				rowsList = (RowCollection)obj;
				break;
			case 3:
				colsList = (ColumnCollection)obj;
				break;
			case 4:
				brush.Release();
				brush = (Brush)obj;
				brush.AddRef();
				break;
			case 5:
				incomingArrows = (ArrowCollection)obj;
				break;
			case 6:
				outgoingArrows = (ArrowCollection)obj;
				break;
			case 7:
				if (captionBackBrush != null)
					captionBackBrush.Release();
				captionBackBrush = (Brush)obj;
				if (captionBackBrush != null)
					captionBackBrush.AddRef();
				break;
			}
		}
Esempio n. 51
0
        private void MoveChuzzles(CellCollection activeCells)
        {
            foreach (Chuzzle c in SelectedChuzzles)
            {
                Vector3 copyPosition = c.transform.position;

                IntVector2 real = GamefieldUtility.ToRealCoordinates(c);
                Cell targetCell = GamefieldUtility.CellAt(activeCells, real.x, real.y);

                Vector3 difference = c.transform.position -
                                     GamefieldUtility.ConvertXYToPosition(real.x, real.y, Chuzzle.Scale);

                bool isNeedCopy = false;

                if (targetCell != null && !targetCell.IsTemporary)
                {
                    if (!_isVerticalDrag)
                    {
                        if (difference.x > 0)
                        {
                            isNeedCopy = targetCell.Right == null ||
                                         (targetCell.Right != null && targetCell.Right.Type != CellTypes.Usual);
                            if (isNeedCopy)
                            {
                                Cell rightCell = GetRightCell(activeCells, targetCell.Right, c);
                                copyPosition = rightCell.Position + difference - new Vector3(Chuzzle.Scale.x, 0, 0);
                            }
                        }
                        else
                        {
                            isNeedCopy = targetCell.Left == null ||
                                         (targetCell.Left != null && targetCell.Left.Type != CellTypes.Usual);
                            if (isNeedCopy)
                            {
                                Cell leftCell = GetLeftCell(activeCells, targetCell.Left, c);
                                copyPosition = leftCell.Position + difference + new Vector3(Chuzzle.Scale.x, 0, 0);
                            }
                        }
                    }
                    else
                    {
                        if (difference.y > 0)
                        {
                            isNeedCopy = targetCell.Top == null ||
                                         (targetCell.Top != null &&
                                          (targetCell.Top.Type == CellTypes.Block || targetCell.Top.IsTemporary));
                            if (isNeedCopy)
                            {
                                Cell topCell = GetTopCell(activeCells, targetCell.Top, c);
                                copyPosition = topCell.Position + difference - new Vector3(0, Chuzzle.Scale.y, 0);
                            }
                        }
                        else
                        {
                            isNeedCopy = targetCell.Bottom == null ||
                                         (targetCell.Bottom != null && targetCell.Bottom.Type == CellTypes.Block);
                            if (isNeedCopy)
                            {
                                Cell bottomCell = GetBottomCell(activeCells, targetCell.Bottom, c);
                                copyPosition = bottomCell.Position + difference + new Vector3(0, Chuzzle.Scale.y, 0);
                            }
                        }
                    }
                }
                else
                {
                    isNeedCopy = true;
                }

                if (targetCell == null || targetCell.Type == CellTypes.Block || targetCell.IsTemporary)
                {
                    switch (CurrentDirection)
                    {
                        case Direction.Left:
                            //if border
                            targetCell = GetLeftCell(activeCells, targetCell, c);
                            break;
                        case Direction.Right:
                            targetCell = GetRightCell(activeCells, targetCell, c);
                            break;
                        case Direction.Top:
                            //if border
                            targetCell = GetTopCell(activeCells, targetCell, c);
                            break;
                        case Direction.Bottom:
                            targetCell = GetBottomCell(activeCells, targetCell, c);
                            break;
                        default:
                            throw new ArgumentOutOfRangeException("Current direction can not be shit");
                    }

                    c.transform.position = targetCell.Position + difference;

                    // Debug.Log("New coord: "+GamefieldUtility.ToRealCoordinates(c)+" for "+c.gameObject.name + " pos: "+c.transform.position);
                }

                if (difference.magnitude < (Chuzzle.Scale.x/25))
                {
                    isNeedCopy = false;
                }

                if (isNeedCopy)
                {
                    c.Teleportable.Show();
                    c.Teleportable.Copy.transform.position = copyPosition;
                }
                else
                {
                    c.Teleportable.Hide();
                }
            }
        }
Esempio n. 52
0
			public CellCollection Clone()
			{
				CellCollection cc = new CellCollection();
				foreach (Cell c in this)
					cc.Add(c.Clone());
				return cc;
			}
Esempio n. 53
0
 public Row()
 {
         this.Cells = new CellCollection(this);
 }