Exemplo n.º 1
0
        /// <summary>
        /// Constructs a MinimapSpriteBuffer instance.
        /// </summary>
        /// <param name="minimapView">Reference to the view that is used to collect the informations for the initialization.</param>
        /// <param name="tileSpriteGroup">Reference to the sprite group of the isometric tiles.</param>
        /// <param name="terrainObjectSpriteGroup">Reference to the sprite group of the terrain objects.</param>
        public MinimapSpriteBuffer(IMinimapView minimapView, ISpriteGroup tileSpriteGroup, ISpriteGroup terrainObjectSpriteGroup)
        {
            if (minimapView == null)
            {
                throw new ArgumentNullException("minimapView");
            }
            if (tileSpriteGroup == null)
            {
                throw new ArgumentNullException("tileSpriteGroup");
            }
            if (terrainObjectSpriteGroup == null)
            {
                throw new ArgumentNullException("terrainObjectSpriteGroup");
            }

            this.terrainRenderer = new MinimapTerrainRenderJob(minimapView, tileSpriteGroup, terrainObjectSpriteGroup);
            this.bufferSize      = minimapView.MinimapPosition.Size;

            this.terrainPrimaryBuffer         = null;
            this.terrainSecondaryBuffer       = null;
            this.fowPrimaryBuffer             = null;
            this.fowSecondaryBuffer           = null;
            this.entitiesPrimaryBuffer        = null;
            this.entitiesSecondaryBuffer      = null;
            this.attackSignalsPrimaryBuffer   = null;
            this.attackSignalsSecondaryBuffer = null;
        }
Exemplo n.º 2
0
        private void CreateAndSubscribeToMinimapWindow()
        {
            minimapView = UICreator
                          .GetInstance()
                          .Create <MinimapWindow>();

            if (minimapView != null)
            {
                minimapView.MarkSelectionChanged += OnMarkSelectionChanged;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Constructs a MinimapScanner instance.
        /// </summary>
        /// <param name="minimapView">Reference to the view that is used to collect the data for the rendering.</param>
        public MinimapScanner(IMinimapView minimapView)
        {
            if (minimapView == null)
            {
                throw new ArgumentNullException("minimapView");
            }

            this.fowBuffer           = null;
            this.entitiesBuffer      = null;
            this.attackSignalsBuffer = null;
            this.minimapView         = minimapView;
            this.currentRow          = -1;
            this.isDisposed          = false;

            this.blackBrush          = new CachedValue <UISprite>(() => this.CreateBrush(RCColor.Black));
            this.grayBrush           = new CachedValue <UISprite>(() => this.CreateBrush(RCColor.Gray));
            this.transparentBrush    = new CachedValue <UISprite>(() => this.CreateBrush(PresLogicConstants.DEFAULT_TRANSPARENT_COLOR));
            this.friendlyEntityBrush = new CachedValue <UISprite>(() => this.CreateBrush(RCColor.LightGreen));
            this.attackSignalBrush   = new CachedValue <UISprite>(() => this.CreateBrush(RCColor.LightRed));
            this.entityBrushes       = new Dictionary <PlayerEnum, CachedValue <UISprite> >
            {
                { PlayerEnum.Neutral, new CachedValue <UISprite>(() => this.CreateBrush(RCColor.LightCyan)) },
                { PlayerEnum.Player0, new CachedValue <UISprite>(() => this.CreateBrush(PresLogicConstants.PLAYER_COLOR_MAPPINGS[PlayerEnum.Player0])) },
                { PlayerEnum.Player1, new CachedValue <UISprite>(() => this.CreateBrush(PresLogicConstants.PLAYER_COLOR_MAPPINGS[PlayerEnum.Player1])) },
                { PlayerEnum.Player2, new CachedValue <UISprite>(() => this.CreateBrush(PresLogicConstants.PLAYER_COLOR_MAPPINGS[PlayerEnum.Player2])) },
                { PlayerEnum.Player3, new CachedValue <UISprite>(() => this.CreateBrush(PresLogicConstants.PLAYER_COLOR_MAPPINGS[PlayerEnum.Player3])) },
                { PlayerEnum.Player4, new CachedValue <UISprite>(() => this.CreateBrush(PresLogicConstants.PLAYER_COLOR_MAPPINGS[PlayerEnum.Player4])) },
                { PlayerEnum.Player5, new CachedValue <UISprite>(() => this.CreateBrush(PresLogicConstants.PLAYER_COLOR_MAPPINGS[PlayerEnum.Player5])) },
                { PlayerEnum.Player6, new CachedValue <UISprite>(() => this.CreateBrush(PresLogicConstants.PLAYER_COLOR_MAPPINGS[PlayerEnum.Player6])) },
                { PlayerEnum.Player7, new CachedValue <UISprite>(() => this.CreateBrush(PresLogicConstants.PLAYER_COLOR_MAPPINGS[PlayerEnum.Player7])) },
            };

            this.pixelInfoArray = new MinimapPixelInfo[this.minimapView.MinimapPosition.Width, this.minimapView.MinimapPosition.Height];
            for (int row = 0; row < this.minimapView.MinimapPosition.Height; row++)
            {
                for (int col = 0; col < this.minimapView.MinimapPosition.Width; col++)
                {
                    this.pixelInfoArray[col, row] = new MinimapPixelInfo
                    {
                        FOWStatus           = FOWTypeEnum.None,
                        EntityIndicatorType = MinimapPixelInfo.EntityIndicatorTypeEnum.None,
                        EntityOwner         = PlayerEnum.Neutral
                    };
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Constructs a MinimapTerrainRenderJob instance.
        /// </summary>
        /// <param name="oldTerrainSprite">Reference to an old terrain sprite that needs to be replaced or null if there was no old terrain sprite.</param>
        /// <param name="minimapView">Reference to the view that is used to collect the informations for the rendering.</param>
        /// <param name="tileSpriteGroup">Reference to the sprite group of the isometric tiles.</param>
        /// <param name="terrainObjectSpriteGroup">Reference to the sprite group of the terrain objects.</param>
        public MinimapTerrainRenderJob(UISprite oldTerrainSprite, IMinimapView minimapView, ISpriteGroup tileSpriteGroup, ISpriteGroup terrainObjectSpriteGroup)
        {
            if (minimapView == null)
            {
                throw new ArgumentNullException("minimapView");
            }
            if (tileSpriteGroup == null)
            {
                throw new ArgumentNullException("tileSpriteGroup");
            }
            if (terrainObjectSpriteGroup == null)
            {
                throw new ArgumentNullException("terrainObjectSpriteGroup");
            }

            this.result = oldTerrainSprite;

            this.terrainSpriteRenderInfos = new List <SpriteRenderInfo>(minimapView.GetTerrainSprites());
            this.mapPixelSize             = minimapView.MapPixelSize;
            this.minimapPixelSize         = minimapView.MinimapPosition.Size;

            this.tileSpriteGroup          = tileSpriteGroup;
            this.terrainObjectSpriteGroup = terrainObjectSpriteGroup;
        }
Exemplo n.º 5
0
 /// <summary>
 /// Constructs a MinimapTerrainRenderJob instance.
 /// </summary>
 /// <param name="minimapView">Reference to the view that is used to collect the informations for the rendering.</param>
 /// <param name="tileSpriteGroup">Reference to the sprite group of the isometric tiles.</param>
 /// <param name="terrainObjectSpriteGroup">Reference to the sprite group of the terrain objects.</param>
 public MinimapTerrainRenderJob(IMinimapView minimapView, ISpriteGroup tileSpriteGroup, ISpriteGroup terrainObjectSpriteGroup)
     : this(null, minimapView, tileSpriteGroup, terrainObjectSpriteGroup)
 {
 }