コード例 #1
0
        /// <summary>
        /// Draw the tile info panel
        /// </summary>
        private void DrawTileInfo()
        {
            if (!this.HasWorld)
            {
                return;
            }

            var position = new Position(
                this._overviewView.Position.X,
                this._overviewView.Position.Y + this._overviewView.Dimensions.Height + 1);

            if (!this._world.DetailedMap.IsDiscovered(this._detailedView.CursorPosition) && this._detailedView.DrawFogOfWar)
            {
                this._surface.DrawString(position, "Unknown",
                                         UiColors.ActiveText, DefaultColors.Black);

                return;
            }

            this._surface.DrawString(position, TerrainTypeData.GetInfo(this._world.DetailedMap.GetTerrainType(this._detailedView.CursorPosition)).Name,
                                     DefaultColors.White, DefaultColors.Black);

            if (this._detailedView.ShowResources &&
                this._world.DetailedMap.Resources.ContainsKey(this._detailedView.CursorPosition))
            {
                var resourceType = this._world.DetailedMap.Resources[this._detailedView.CursorPosition];
                this._surface.DrawString(position + new Position(0, 1), resourceType.DisplayName,
                                         DefaultColors.White, DefaultColors.Black);
            }
        }
コード例 #2
0
ファイル: Map.cs プロジェクト: nshcat/asciikingdom
        /// <summary>
        /// Build new tile array from terrain array
        /// </summary>
        public virtual void UpdateTiles()
        {
            var random = new Random(this.Seed);

            for (var ix = 0; ix < Dimensions.Width; ++ix)
            {
                for (var iy = 0; iy < Dimensions.Height; ++iy)
                {
                    var terrainType = this.GetTerrainType(new Position(ix, iy));

                    var info = TerrainTypeData.GetInfo(terrainType);
                    var tile = info.PickTile(random);
                    this.Tiles[ix, iy] = tile;
                }
            }
        }
コード例 #3
0
ファイル: MapViewerScene.cs プロジェクト: nshcat/asciikingdom
        private void DrawTileInfo()
        {
            if (this._state == null)
            {
                return;
            }

            var position = new Position(
                this._overviewView.Position.X,
                this._overviewView.Position.Y + this._overviewView.Dimensions.Height + 1);

            if (this._currentCity != null)
            {
                this._surface.DrawString(position, $"In Territory: {this._currentCity.Name}",
                                         DefaultColors.White, DefaultColors.Black);

                position += new Position(0, 1);
            }

            if (this._cursorSite != null)
            {
                this._surface.DrawString(position, $"{this._cursorSite.TypeDescriptor}: {this._cursorSite.Name}",
                                         DefaultColors.White, DefaultColors.Black);

                position += new Position(0, 1);
            }

            this._surface.DrawString(position, TerrainTypeData.GetInfo(this._state.World.DetailedMap.GetTerrainType(this._detailedView.CursorPosition)).Name,
                                     DefaultColors.White, DefaultColors.Black);

            if (this._detailedView.ShowResources &&
                this._state.World.DetailedMap.Resources.ContainsKey(this._detailedView.CursorPosition))
            {
                var resourceType = this._state.World.DetailedMap.Resources[this._detailedView.CursorPosition];
                this._surface.DrawString(position + new Position(0, 1), resourceType.DisplayName,
                                         DefaultColors.White, DefaultColors.Black);
            }
        }
コード例 #4
0
ファイル: Map.cs プロジェクト: nshcat/asciikingdom
 /// <summary>
 /// Retrieves the terrain type info at given position
 /// </summary>
 public TerrainTypeInfo GetTerrainInfo(Position position)
 {
     return(TerrainTypeData.GetInfo(this.GetTerrainType(position)));
 }