Esempio n. 1
0
 public BigCellViewModel(State state, bool isFocus, CellViewModel[,] cells, CoordServiceModel position)
 {
     this.Cells    = cells;
     this.State    = state;
     this.IsFocus  = isFocus;
     this.Position = position;
 }
Esempio n. 2
0
        internal void OnMouseClickCrunch(WorldViewModel world, CoordServiceModel bigCellCoord, CoordServiceModel cellCoord)
        {
            BigCellViewModel bigcell = world.BigCells[bigCellCoord.X, bigCellCoord.Y];
            CellViewModel    cell    = world.BigCells[bigCellCoord.X, bigCellCoord.Y].Cells[cellCoord.X, cellCoord.Y];

            if (bigcell.IsFocus)
            {
                if (cell.State == State.None)
                {
                    world.SetAllBigCellsToState(false);
                    world.BigCells[cellCoord.X, cellCoord.Y].IsFocus = true;

                    if (turn)
                    {
                        cell.State = State.Client;
                    }
                    else
                    {
                        cell.State = State.Enemy;
                    }

                    turn = !turn;

                    if (bigcell.IsFilled())
                    {
                        world.SetAllBigCellsToState(true);
                    }
                }
            }
        }
Esempio n. 3
0
        public bool Equals(CoordServiceModel obj)
        {
            if ((object)obj == null)
            {
                return(false);
            }

            return(this == obj);
        }
Esempio n. 4
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            CoordServiceModel p = obj as CoordServiceModel;

            if ((object)p == null)
            {
                return(false);
            }

            return(this.Equals(p));
        }
Esempio n. 5
0
        internal void SetCellsCoords(WorldViewModel world)
        {
            CoordServiceModel bigCellCoord = new CoordServiceModel();

            for (int i = 0; i < world.BigCells.GetLength(0); i++)
            {
                for (int j = 0; j < world.BigCells.GetLength(1); j++)
                {
                    world.BigCells[i, j] = new BigCellViewModel(State.None,
                                                                true,
                                                                new CellViewModel[Configuration.CellRowCount, Configuration.CellColumnCount],
                                                                bigCellCoord);

                    CoordServiceModel cellCoord = new CoordServiceModel(bigCellCoord.X + Configuration.BIGCELLSPRITEOFFSET,
                                                                        bigCellCoord.Y + Configuration.BIGCELLSPRITEOFFSET);

                    for (int e = 0; e < world.BigCells[i, j].Cells.GetLength(0); e++)
                    {
                        for (int k = 0; k < world.BigCells[i, j].Cells.GetLength(1); k++)
                        {
                            world.BigCells[i, j].Cells[e, k] = new CellViewModel(State.None, world.BigCells[i, j].Position, 0, 0);

                            cellCoord.X += Configuration.CELLWIDTH;

                            if (cellCoord.X + Configuration.CELLWIDTH > bigCellCoord.X + Configuration.BIGCELLWIDTH)
                            {
                                cellCoord.X  = bigCellCoord.X + Configuration.BIGCELLSPRITEOFFSET;
                                cellCoord.Y += Configuration.CELLHEIGHT;
                            }
                        }
                    }

                    bigCellCoord.X += Configuration.BIGCELLWIDTH;

                    if (bigCellCoord.X + Configuration.BIGCELLWIDTH > Configuration.WORLDWIDTH)
                    {
                        bigCellCoord.X  = 0;
                        bigCellCoord.Y += Configuration.BIGCELLHEIGHT;
                    }
                }
            }
        }
Esempio n. 6
0
 public CellViewModel(State state, CoordServiceModel position, int width, int height, string buttonText = "") : base(new Vector2(position.X, position.Y), width, height, buttonText)
 {
     this.State = state;
 }