/// <summary> /// Constructs a details panel. /// </summary> /// <param name="productIconSprites">The product icon sprite group.</param> /// <param name="backgroundRect">The area of the background of the panel in workspace coordinates.</param> /// <param name="contentRect">The area of the content of the panel relative to the background rectangle.</param> /// <param name="backgroundSprite">Name of the sprite resource that will be the background of this panel or null if there is no background.</param> public RCDetailsPanel(ISpriteGroup productIconSprites, RCIntRectangle backgroundRect, RCIntRectangle contentRect, string backgroundSprite) : base(backgroundRect, contentRect, ShowMode.Appear, HideMode.Disappear, 0, 0, backgroundSprite) { if (productIconSprites == null) { throw new ArgumentNullException("productIconSprites"); } this.textFont = UIResourceManager.GetResource <UIFont>("RC.App.Fonts.Font5"); this.objectTypeTexts = new Dictionary <int, UIString>(); this.isConnected = false; this.backgroundTask = null; this.hpIndicatorSprites = new Dictionary <MapObjectConditionEnum, SpriteGroup>(); this.productIconSprites = productIconSprites; this.currentCustomContent = null; this.buttonArray = new RCSelectionButton[MAX_SELECTION_SIZE]; this.productionLineDisplay = null; this.constructionProgressDisplay = null; this.supplyDetailsDisplay = null; this.resourceAmountDisplay = null; this.weaponDetailsDisplay = null; this.multiplayerService = null; this.selectionDetailsView = null; this.mapObjectDetailsView = null; this.productionDetailsView = null; this.selectionButtonsAdded = false; this.hpTexts = new Dictionary <MapObjectConditionEnum, UIString>(); this.energyText = null; }
/// <summary> /// Constructs a minimap display control at the given position with the given size. /// </summary> /// <param name="isoTileSpriteGroup">Reference to the sprites of the isometric tile types.</param> /// <param name="terrainObjectSpriteGroup">Reference to the sprites of the terrain object types.</param> /// <param name="position">The position of the minimap display control.</param> /// <param name="size">The size of the minimap display control.</param> public RCMinimapDisplay(ISpriteGroup isoTileSpriteGroup, ISpriteGroup terrainObjectSpriteGroup, RCIntVector position, RCIntVector size) : base(position, size) { if (isoTileSpriteGroup == null) { throw new ArgumentNullException("isoTileSpriteGroup"); } if (terrainObjectSpriteGroup == null) { throw new ArgumentNullException("terrainObjectSpriteGroup"); } this.minimapView = null; this.minimapScanner = null; this.scannerStatus = ScannerStatusEnum.Inactive; this.mouseHandler = null; this.showAttackSignalsFlag = false; this.timeSinceAttackSignalFlagChanged = 0; this.spriteBuffer = null; this.isoTileSpriteGroup = isoTileSpriteGroup; this.terrainObjectSpriteGroup = terrainObjectSpriteGroup; this.connectionStatus = ConnectionStatusEnum.Offline; this.backgroundTask = null; this.stopBackgroundTaskEvent = null; this.newJobEvent = null; this.jobQueue = new Fifo <IMinimapBackgroundJob>(); this.crosshairsPointer = UIResourceManager.GetResource <UIPointer>("RC.App.Pointers.CrosshairsPointer"); this.windowLocationBrush = UIRoot.Instance.GraphicsPlatform.SpriteManager.CreateSprite(RCColor.WhiteHigh, new RCIntVector(1, 1), UIWorkspace.Instance.PixelScaling); this.windowLocationBrush.Upload(); }
/// <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; }
/// <summary> /// Creates an RCMapEditorPanel instance. /// </summary> /// <param name="isoTileSpriteGroup">Reference to the sprites of the isometric tile types.</param> /// <param name="terrainObjectSpriteGroup">Reference to the sprites of the terrain object types.</param> /// <param name="backgroundRect">The area of the background of the panel in workspace coordinates.</param> /// <param name="contentRect">The area of the content of the panel relative to the background rectangle.</param> /// <param name="backgroundSprite"> /// Name of the sprite resource that will be the background of this panel or null if there is no background. /// </param> public RCMapEditorPanel(ISpriteGroup isoTileSpriteGroup, ISpriteGroup terrainObjectSpriteGroup, RCIntRectangle backgroundRect, RCIntRectangle contentRect, ShowMode showMode, HideMode hideMode, int appearDuration, int disappearDuration, string backgroundSprite) : base(backgroundRect, contentRect, showMode, hideMode, appearDuration, disappearDuration, backgroundSprite) { this.tilesetView = ComponentManager.GetInterface <IViewService>().CreateView <ITileSetView>(); /// Create the controls. this.editModeSelector = new RCDropdownSelector(new RCIntVector(6, 6), 85, new string[4] { "Draw terrain", "Place terrain object", "Place start location", "Place resource" }); this.paletteListbox = new RCListBox(new RCIntVector(6, 24), 85, 11, 100); this.saveButton = new RCMenuButton("Save", new RCIntRectangle(6, 180, 41, 15)); this.exitButton = new RCMenuButton("Exit", new RCIntRectangle(50, 180, 41, 15)); this.minimapDisplay = new RCMinimapDisplay(isoTileSpriteGroup, terrainObjectSpriteGroup, new RCIntVector(16, 209), new RCIntVector(64, 64)); this.editModeSelector.SelectedIndexChanged += this.OnEditModeSelectionChanged; this.paletteListbox.SelectedIndexChanged += this.OnPaletteListboxSelectionChanged; this.AddControl(this.editModeSelector); this.AddControl(this.paletteListbox); this.AddControl(this.saveButton); this.AddControl(this.exitButton); this.AddControl(this.minimapDisplay); this.ResetControls(); }
/// <summary> /// Constructs an ObjectPlacementInfo instance. /// </summary> /// <param name="view">The view to be used.</param> /// <param name="sprites">The sprite group to be used.</param> public ObjectPlacementInfo(IObjectPlacementView view, ISpriteGroup sprites) { if (view == null) { throw new ArgumentNullException("view"); } if (sprites == null) { throw new ArgumentNullException("sprites"); } this.view = view; this.sprites = sprites; }
/// <summary> /// Constructs a map display control at the given position with the given size. /// </summary> /// <param name="isoTileSpriteGroup">Reference to the sprites of the isometric tile types.</param> /// <param name="terrainObjectSpriteGroup">Reference to the sprites of the terrain object types.</param> /// <param name="position">The position of the map display control.</param> /// <param name="size">The size of the map display control.</param> public RCMapDisplayBasic(ISpriteGroup isoTileSpriteGroup, ISpriteGroup terrainObjectSpriteGroup, RCIntVector position, RCIntVector size) : base(position, size) { if (isoTileSpriteGroup == null) { throw new ArgumentNullException("isoTileSpriteGroup"); } if (terrainObjectSpriteGroup == null) { throw new ArgumentNullException("terrainObjectSpriteGroup"); } this.mapTerrainView = null; this.isoTileSpriteGroup = isoTileSpriteGroup; this.terrainObjectSpriteGroup = terrainObjectSpriteGroup; }
/// <summary> /// Constructs a production button at the given layout index inside the production display. /// </summary> /// <param name="productIconSprites">The product icon sprite group.</param> /// <param name="layoutIndex">The index in the layout of this button on the production display.</param> public RCProductionButton(ISpriteGroup productIconSprites, int layoutIndex) : base(BUTTON_POSITIONS[layoutIndex].Location, BUTTON_POSITIONS[layoutIndex].Size) { if (layoutIndex < 0) { throw new ArgumentOutOfRangeException("layoutIndex", "Production button layout index must be non-negative!"); } if (productIconSprites == null) { throw new ArgumentNullException("productIconSprites"); } IViewService viewService = ComponentManager.GetInterface <IViewService>(); this.productionDetailsView = viewService.CreateView <IProductionDetailsView>(); this.commandService = ComponentManager.GetInterface <ICommandService>(); this.productionButtonSprite = UIResourceManager.GetResource <UISprite>("RC.App.Sprites.ProductionButton"); this.layoutIndex = layoutIndex; this.productIconSprites = productIconSprites; this.Pressed += this.OnButtonPressed; }
/// <summary> /// Constructs a production line display control at the given position with the given size. /// </summary> /// <param name="productIconSprites">The product icon sprite group.</param> /// <param name="position">The position of the production line display control.</param> /// <param name="size">The size of the production line display control.</param> public RCProductionLineDisplay(ISpriteGroup productIconSprites, RCIntVector position, RCIntVector size) : base(position, size) { if (productIconSprites == null) { throw new ArgumentNullException("productIconSprites"); } IViewService viewService = ComponentManager.GetInterface <IViewService>(); this.productionDetailsView = viewService.CreateView <IProductionDetailsView>(); this.progressBarSprite = UIResourceManager.GetResource <UISprite>("RC.App.Sprites.ProductionProgressBar"); this.progressBarBrush = UIRoot.Instance.GraphicsPlatform.SpriteManager.CreateSprite(RCColor.Green, new RCIntVector(1, 1), UIWorkspace.Instance.PixelScaling); this.progressBarBrush.Upload(); for (int buttonIndex = 0; buttonIndex < PRODUCTION_BUTTON_COUNT; buttonIndex++) { RCProductionButton prodButton = new RCProductionButton(productIconSprites, buttonIndex); this.Attach(prodButton); this.AttachSensitive(prodButton); } }
/// <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; }
/// <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) { }
/// <summary> /// Starts placing object with the given view & sprite group. If another object placement is currently in progress then /// it will be stopped automatically. /// </summary> /// <param name="view">The view to be used.</param> /// <param name="sprites">The sprite group to be used.</param> public void StartPlacingObject(IObjectPlacementView view, ISpriteGroup sprites) { this.StopPlacingObject(); this.objectPlacementInfo = new ObjectPlacementInfo(view, sprites); this.mapEditorService.AnimationsUpdated += this.objectPlacementInfo.View.StepPreviewAnimation; }
/// <summary> /// Constructs a minimap panel. /// </summary> /// <param name="isoTileSpriteGroup">Reference to the sprites of the isometric tile types.</param> /// <param name="terrainObjectSpriteGroup">Reference to the sprites of the terrain object types.</param> /// <param name="backgroundRect">The area of the background of the panel in workspace coordinates.</param> /// <param name="contentRect">The area of the content of the panel relative to the background rectangle.</param> /// <param name="backgroundSprite">Name of the sprite resource that will be the background of this panel or null if there is no background.</param> public RCMinimapPanel(ISpriteGroup isoTileSpriteGroup, ISpriteGroup terrainObjectSpriteGroup, RCIntRectangle backgroundRect, RCIntRectangle contentRect, string backgroundSprite) : base(backgroundRect, contentRect, ShowMode.Appear, HideMode.Disappear, 0, 0, backgroundSprite) { this.minimapDisplay = new RCMinimapDisplay(isoTileSpriteGroup, terrainObjectSpriteGroup, new RCIntVector(3, 3), new RCIntVector(64, 64)); this.minimapDisplay.ConnectorOperationFinished += this.OnMinimapConnectorOperationFinished; }