public Listbox(int dropDownLength, int width, IResourceCache resourceCache, List <string> initialOptions = null) { _resourceCache = resourceCache; _width = width; _listboxLeft = _resourceCache.GetSprite("button_left"); _listboxMain = _resourceCache.GetSprite("button_middle"); _listboxRight = _resourceCache.GetSprite("button_right"); _selectedLabel = new TextSprite("ListboxLabel", "", _resourceCache.GetResource <FontResource>(@"Fonts/CALIBRI.TTF").Font) { Color = Color4.Black }; _dropDown = new ScrollableContainer("ListboxContents", new Vector2i(width, dropDownLength), _resourceCache); _dropDown.SetVisible(false); if (initialOptions != null) { _contentStrings = initialOptions; RebuildList(); } Update(0); }
public PlayerListTab(string uniqueName, Vector2i size, IResourceCache resourceCache) : base(uniqueName, size, resourceCache) { DrawBorder = false; _scPlayerList = new ScrollableContainer("scplayerlist", new Vector2i(784, 346), resourceCache); _scPlayerList.Position = new Vector2i(5, 10); components.Add(_scPlayerList); }
public override void Dispose() { _contentStrings.Clear(); _dropDown.Dispose(); _dropDown = null; _selectedLabel = null; _listboxLeft = null; _listboxMain = null; _listboxRight = null; ItemSelected = null; base.Dispose(); GC.SuppressFinalize(this); }
public TileSpawnPanel(Vector2i size, IResourceManager resourceManager, IPlacementManager placementManager) : base("Tile Spawn Panel", size, resourceManager) { _placementManager = placementManager; _tileList = new ScrollableContainer("tilespawnlist", new Vector2i(200, 400), _resourceManager) { Position = new Vector2i(5, 5) }; components.Add(_tileList); var searchLabel = new Label("Tile Search:", "CALIBRI", _resourceManager) { Position = new Vector2i(210, 0) }; components.Add(searchLabel); _tileSearchTextbox = new Textbox(125, _resourceManager) { Position = new Vector2i(210, 20) }; _tileSearchTextbox.OnSubmit += tileSearchTextbox_OnSubmit; components.Add(_tileSearchTextbox); _clearLabel = new Label("[Clear Filter]", "CALIBRI", _resourceManager) { DrawBackground = true, DrawBorder = true, Position = new Vector2i(210, 55) }; _clearLabel.Clicked += ClearLabelClicked; _clearLabel.BackgroundColor = new SFML.Graphics.Color(128, 128, 128); components.Add(_clearLabel); BuildTileList(); Position = new Vector2i((int)(CluwneLib.CurrentRenderTarget.Size.X / 2f) - (int)(ClientArea.Width / 2f), (int)(CluwneLib.CurrentRenderTarget.Size.Y / 2f) - (int)(ClientArea.Height / 2f)); _placementManager.PlacementCanceled += PlacementManagerPlacementCanceled; }
public EntitySpawnPanel(Vector2i size, IResourceCache resourceCache, IPlacementManager placementManager) : base("Entity Spawn Panel", size, resourceCache) { _placementManager = placementManager; _entityList = new ScrollableContainer("entspawnlist", new Vector2i(200, 400), _resourceCache) { Position = new Vector2i(5, 5) }; components.Add(_entityList); var searchLabel = new Label("Entity Search:", "CALIBRI", _resourceCache) { Position = new Vector2i(210, 0) }; components.Add(searchLabel); _entSearchTextbox = new Textbox(125, _resourceCache) { Position = new Vector2i(210, 20) }; _entSearchTextbox.OnSubmit += entSearchTextbox_OnSubmit; components.Add(_entSearchTextbox); _clearLabel = new Label("[Clear Filter]", "CALIBRI", _resourceCache) { DrawBackground = true, DrawBorder = true, Position = new Vector2i(210, 55) }; _overLabel = new Label("Override Placement:", "CALIBRI", _resourceCache) { Position = _clearLabel.Position + new Vector2i(0, _clearLabel.ClientArea.Height + 15) }; components.Add(_overLabel); var initOpts = new List <string>(); initOpts.AddRange(new[] { "None", "AlignNone", "AlignFree", "AlignSimilar", "AlignTileAny", "AlignTileEmpty", "AlignTileNonSolid", "AlignTileSolid", "AlignWall", "AlignWallTops" }); _lstOverride = new Listbox(150, 125, resourceCache, initOpts); _lstOverride.SelectItem("AlignFree"); _lstOverride.ItemSelected += _lstOverride_ItemSelected; _lstOverride.Position = _overLabel.Position + new Vector2i(0, _overLabel.ClientArea.Height); components.Add(_lstOverride); _clearLabel.Clicked += ClearLabelClicked; _clearLabel.BackgroundColor = new SFML.Graphics.Color(128, 128, 128); components.Add(_clearLabel); _eraserButton = new ImageButton { ImageNormal = "erasericon", Position = new Vector2i(_clearLabel.Position.X + _clearLabel.ClientArea.Width + 5, _clearLabel.Position.Y) }; //eraserButton.Position = new Vector2i(clearLabel.ClientArea.Right + 5, clearLabel.ClientArea.Top); Clientarea not updating properly. FIX THIS _eraserButton.Clicked += EraserButtonClicked; components.Add(_eraserButton); BuildEntityList(); Position = new Vector2i((int)(CluwneLib.CurrentRenderTarget.Size.X / 2f) - (int)(ClientArea.Width / 2f), (int)(CluwneLib.CurrentRenderTarget.Size.Y / 2f) - (int)(ClientArea.Height / 2f)); _placementManager.PlacementCanceled += PlacementManagerPlacementCanceled; }