コード例 #1
0
        public Departement getDepartement()
        {
            // choper colone "Revenu fiscal de référence par tranche" (1ere colone cherchée)
            List <CellWrapper> rowHeaders = this.listCells.find(cell => cell.rowNumber == this.depTitlesTableRowNum);

            foreach (CellWrapper ccw in rowHeaders)
            {
                this.setHeaderColumns(ccw);
            }

            // descendre du titre jusqu'à "Total"
            if (this.trancheColumn != null)
            {
                CellWrapper cellTotal = this.listCells.find(cell => cell.colNumber == this.trancheColumn && cell.cellContent.Contains("Total")).First();
                if (cellTotal != null)
                {
                    this.lastTableRow = cellTotal.rowNumber;
                    Departement dep = this.getDepartementInfos();
                    return(dep);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                throw new Exception("trancheColumn not found...");
            }
        }
コード例 #2
0
ファイル: CellLoader.cs プロジェクト: gotenxds/Redrook
 private void RegisterCell(CellWrapper cell)
 {
     if (cell != null)
     {
         cellsByName.Add(cell.Name, cell);
     }
 }
コード例 #3
0
        public DepartementParser(RangeWrapper _rw)
        {
            this.listCells = _rw;
            CellWrapper cw = this.listCells.find("Département");

            this.depColumn            = cw.colNumber;
            this.depTitlesTableRowNum = cw.rowNumber;
        }
コード例 #4
0
        private string getCellText(int rowNumber, int colNumber)
        {
            CellWrapper cw = null;

            cw = this.listCells.find(cell => cell.rowNumber == rowNumber && cell.colNumber == colNumber).First();
            if (cw != null && !String.IsNullOrEmpty(cw.cellContent))
            {
                return(cw.cellContent);
            }
            else
            {
                return(String.Empty);
            }
        }
コード例 #5
0
    public GameSave(PlayerHandler ph, WaveHandler wh)
    {
        level = wh.level;

        waveNumber = wh.currentWave;
        spawnDelay = wh.spawnDelay;

        money  = ph.money;
        health = ph.health;

        cells = new CellWrapper[ph.cells.Count];

        for (int i = 0; i < ph.cells.Count; i++)
        {
            cells[i] = new CellWrapper(ph.cells[i]);
        }
    }
コード例 #6
0
        private long getCellNumber(int rowNumber, int colNumber)
        {
            CellWrapper cw = null;

            cw = this.listCells.find(cell => cell.rowNumber == rowNumber && cell.colNumber == colNumber).First();
            if (cw != null && !String.IsNullOrEmpty(cw.cellContent))
            {
                if (cw.cellContent.Contains("n.d."))
                {
                    return(-1);
                }
                else
                {
                    return(Convert.ToInt64(cw.cellContent));
                }
            }
            else
            {
                return(-1);
            }
        }
コード例 #7
0
        private void setHeaderColumns(CellWrapper ccw)
        {
            string cellcontent = ccw.cellContent;

            if (cellcontent.Contains(DepartementTableHeaders.TRANCHE))
            {
                this.trancheColumn = ccw.colNumber;
            }
            else if (cellcontent.Contains(DepartementTableHeaders.NB_FOYERS_IMPOSABLES_TRANCHE))
            {
                this.nbFoyersImposColumn = ccw.colNumber;
            }
            else if (cellcontent.Contains(DepartementTableHeaders.REV_FOYERS_IMPOSABLES_TRANCHE))
            {
                this.revFoyersImposColumn = ccw.colNumber;
            }
            else if (cellcontent.Contains(DepartementTableHeaders.NB_FOYERS_TRANCHE))
            {
                this.nbFoyersColumn = ccw.colNumber;
            }
            else if (cellcontent.Contains(DepartementTableHeaders.REV_FOYERS))
            {
                this.revFoyersColumn = ccw.colNumber;
            }
            else if (cellcontent.Contains(DepartementTableHeaders.IMPOT))
            {
                this.impotColumn = ccw.colNumber;
            }
            else if (cellcontent.Contains(DepartementTableHeaders.SALAIRES))
            {
                this.salairesColumn = ccw.colNumber;
            }
            else if (cellcontent.Contains(DepartementTableHeaders.RETRAITES))
            {
                this.retraitesColumns = ccw.colNumber;
            }
        }
コード例 #8
0
ファイル: BoardComponent.cs プロジェクト: Bakkes/Karo
        private void DrawPieceAt(CellWrapper cell, int x, int y)
        {
            // Nothing to draw if this cell is empty.
            if (cell.IsEmpty()) { return; }

            // Define the model of the piece we have to use (max/min).
            Model pieceModel = cell.IsMaxPiece() ? _maxModel : _minModel;
            Vector3 color = cell.IsMaxPiece() ? Color.Red.ToVector3() : Color.Green.ToVector3();
            ICamera camera = (ICamera)Game.Services.GetService(typeof(ICamera));
            Matrix[] transforms = new Matrix[_tileModel.Bones.Count];
            _tileModel.CopyAbsoluteBoneTransformsTo(transforms);
            bool marked = false;
            if (KaroGameManager.CurrentMove != null)
            {
                marked = KaroGameManager.CurrentMove.GetFromCell() ==
                    cell.GetRelativePosition();
            }

            // Flip the piece if neccesary
            Matrix world = Matrix.CreateRotationX(MathHelper.ToRadians(-270));
            if (cell.IsFlipped())
            {
                world *= Matrix.CreateRotationX(MathHelper.ToRadians(180));
            }

            BoundingBox pieceBox = Utilities.CreateBoundingBox(pieceModel, world);
            BoundingBox tileBox = Utilities.CreateBoundingBox(pieceModel, world);
            float extraHeight = pieceBox.Max.Y / 2 + tileBox.Max.Y;

            // Draw the piece on the cell.
            foreach (ModelMesh mesh in pieceModel.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.LightingEnabled = true;
                    effect.DirectionalLight0.Enabled = true;
                    effect.DirectionalLight0.DiffuseColor = new Vector3(0.5f, 0.2f, 0f);
                    effect.DirectionalLight0.Direction = new Vector3(1f, -1f, 1f);
                    effect.DirectionalLight0.SpecularColor = new Vector3(0f, 1f, 0f);
                    effect.DirectionalLight1.Enabled = true;
                    effect.DirectionalLight1.DiffuseColor = new Vector3(0.7f, 0.7f, 0.7f);
                    effect.DirectionalLight1.Direction = new Vector3(1f, -1f, 1f);
                    effect.DirectionalLight1.SpecularColor = new Vector3(0f, 1f, 0f);
                    effect.World = world * Matrix.CreateTranslation(new Vector3(x * (SIZE + GAP), extraHeight, y * (SIZE + GAP)));
                    effect.View = camera.View;
                    effect.Projection = camera.Projection;
                    if (marked)
                    {
                        effect.DiffuseColor = new Vector3(1f, 1f, 0f);
                    }
                    else
                    {
                        effect.DiffuseColor = color;
                    }
                }
                mesh.Draw();
            }
        }
コード例 #9
0
ファイル: BoardComponent.cs プロジェクト: Bakkes/Karo
 private void DrawCordsAt(CellWrapper cell, int x, int y, string cord)
 {
     ICamera camera = (ICamera)Game.Services.GetService(typeof(ICamera));
     Matrix world = Matrix.CreateRotationX(MathHelper.ToRadians(-90));
     foreach (ModelMesh mesh in _cordModel.Meshes)
     {
         foreach (BasicEffect effect in mesh.Effects)
         {
             effect.TextureEnabled = true;
             effect.Texture = Game.Content.Load<Texture2D>("cords/" + cord);
             effect.EnableDefaultLighting();
             effect.World = world * Matrix.CreateRotationX(MathHelper.ToRadians(90)) * Matrix.CreateScale(0.5f) * Matrix.CreateRotationY(MathHelper.ToRadians(180)) * Matrix.CreateTranslation(new Vector3(x * (SIZE + GAP), 0, y * (SIZE + GAP)));
             effect.View = camera.View;
             effect.Projection = camera.Projection;
             effect.Alpha = 1f;
             effect.DiffuseColor = new Vector3(0.8f, 0.8f, 0.8f);
         }
         mesh.Draw();
     }
 }
コード例 #10
0
ファイル: BoardComponent.cs プロジェクト: Bakkes/Karo
        /// <summary>
        /// Draws a tile with the specified relative position.
        /// </summary>
        private void DrawCellAt(CellWrapper cell, int x, int y, bool marked = false)
        {
            ICamera camera = (ICamera)Game.Services.GetService(typeof(ICamera));
            Matrix world = Matrix.CreateRotationX(MathHelper.ToRadians(-90));
            bool clickableTile = IsMarkedCell(new Vector2((float)x, (float)y));
            foreach (ModelMesh mesh in _tileModel.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.LightingEnabled = true;
                    effect.DirectionalLight0.Enabled = true;
                    effect.DirectionalLight0.DiffuseColor = new Vector3(0.5f, 0.2f, 0f);
                    effect.DirectionalLight0.Direction = new Vector3(1f, -1f, 1f);
                    effect.DirectionalLight0.SpecularColor = new Vector3(0f, 1f, 0f);
                    effect.DirectionalLight1.Enabled = true;
                    effect.DirectionalLight1.DiffuseColor = new Vector3(0.7f, 0.7f, 0.7f);
                    effect.DirectionalLight1.Direction = new Vector3(1f, -1f, 1f);
                    effect.DirectionalLight1.SpecularColor = new Vector3(0f, 1f, 0f);
                    effect.World = world * Matrix.CreateTranslation(new Vector3(x * (SIZE + GAP), 0, y * (SIZE + GAP)));
                    effect.View = camera.View;
                    effect.Projection = camera.Projection;
                    if (marked)
                    {
                        effect.Alpha = 0.2f;
                    }
                    else
                    {
                        effect.Alpha = 1f;
                    }
                    if (_lastMoveHighlight[0] != null && _lastMoveHighlight[0] == cell.GetRelativePosition())
                    {
                        effect.DiffuseColor = new Vector3(1f, 1f, 0f);
                    }
                    else if (_lastMoveHighlight[1] != null && _lastMoveHighlight[1] == cell.GetRelativePosition())
                    {
                        effect.DiffuseColor = new Vector3(1f, 1f, 0f);
                    }
                    else if (clickableTile || marked)
                    {
                        effect.DiffuseColor = new Vector3(1f, 1f, 1f);
                    }
                    else
                    {
                        effect.DiffuseColor = new Vector3(0.5f, 0.5f, 0.5f);
                    }
                }
                mesh.Draw();
            }

            if (!cell.IsEmpty())
            {
                DrawPieceAt(cell, x, y);
            }
        }
コード例 #11
0
ファイル: KaroPanel.cs プロジェクト: Bakkes/Karo
 private void PaintTile(CellWrapper tile, Graphics g, int x, int y)
 {
     int tileData = tile.GetData();
     if ((tileData & (int)CellValue.HasCell) == 0)
     {
         // No cel, return.
         return;
     }
     Point paintPos = CellToPixel(x, y);
     g.FillRectangle(_tileBackColor, paintPos.X, paintPos.Y,
         ScaledCellSize, ScaledCellSize);
     if ((tileData & (int)CellValue.IsEmpty) == 0)
     {
         Brush brush;
         if ((tileData & (int)CellValue.IsMax) != 0)
         {
             brush = _pieceMaxColor;
         }
         else
         {
             brush = _pieceMinColor;
         }
         g.FillEllipse(
             brush,
             paintPos.X + (ScaledCellSize - ScaledPieceSize) / 2,
             paintPos.Y + (ScaledCellSize - ScaledPieceSize) / 2,
             ScaledPieceSize, ScaledPieceSize
         );
         if ((tileData & (int)CellValue.IsFlipped) != 0)
         {
             g.DrawEllipse(
                 _pieceAccentColor,
                 paintPos.X + (ScaledCellSize - ScaledAccentSize) / 2,
                 paintPos.Y + (ScaledCellSize - ScaledAccentSize) / 2,
                 ScaledAccentSize, ScaledAccentSize
             );
         }
     }
 }