public StockTicker(DwarfGUI gui, GUIComponent parent, Economy economy) : base(gui, parent) { Icons = new List<StockIcon>(); Economy = economy; Window = 30; TickColor = Color.Brown; Layout = new GridLayout(gui, this, 10, 4); Label displayLabel = new Label(gui, Layout, "Display: ", GUI.DefaultFont); Layout.SetComponentPosition(displayLabel, 0, 0, 1, 1); IndustryBox = new ComboBox(gui, Layout); IndustryBox.AddValue("Our Company"); IndustryBox.AddValue("All"); IndustryBox.AddValue("Average"); IndustryBox.AddValue("Exploration"); IndustryBox.AddValue("Military"); IndustryBox.AddValue("Manufacturing"); IndustryBox.AddValue("Magic"); IndustryBox.AddValue("Finance"); IndustryBox.CurrentIndex = 0; IndustryBox.CurrentValue = "Our Company"; IndustryBox.OnSelectionModified += IndustryBox_OnSelectionModified; Layout.SetComponentPosition(IndustryBox, 1, 0, 1, 1); DrawSurface = new GUIComponent(gui, Layout); Layout.SetComponentPosition(DrawSurface, 0, 1, 4, 9); IndustryBox_OnSelectionModified("Our Company"); }
public AIDebugger(DwarfGUI gui, GameMaster master) { MainPanel = new Panel(gui, gui.RootComponent); Layout = new GridLayout(gui, MainPanel, 13, 1); DwarfSelector = new ComboBox(gui, Layout); DwarfSelector.OnSelectionModified += DwarfSelector_OnSelectionModified; GoalLabel = new Label(gui, Layout, "Script: null", gui.DefaultFont); PlanLabel = new Label(gui, Layout, "Plan: null", gui.DefaultFont); AStarPathLabel = new Label(gui, Layout, "Astar Path: null", gui.DefaultFont); LastMessages = new Label(gui, Layout, "Messages: ", gui.DefaultFont); ScrollView btDisplayHolder = new ScrollView(gui, Layout); BTDisplay = new ActDisplay(gui, btDisplayHolder); Layout.SetComponentPosition(DwarfSelector, 0, 0, 1, 1); Layout.SetComponentPosition(GoalLabel, 0, 1, 1, 1); Layout.SetComponentPosition(PlanLabel, 0, 2, 1, 1); Layout.SetComponentPosition(AStarPathLabel, 0, 3, 1, 1); Layout.SetComponentPosition(LastMessages, 0, 4, 1, 2); Layout.SetComponentPosition(btDisplayHolder, 0, 6, 1, 6); Visible = false; int i = 0; foreach(CreatureAI component in master.Faction.Minions) { DwarfSelector.AddValue("Minion " + i); i++; } Master = master; MainPanel.LocalBounds = new Rectangle(100, 120, 500, 600); }
public ComboBoxSelector(DwarfGUI gui, ComboBox parent, List<string> values, string currentValue) : base(gui, parent) { Columns = new List<List<string>>(); Values = values; CurrentValue = currentValue; int height = 0; Columns.Add(new List<string>()); int currentColumn = 0; int columnWidth = parent.GlobalBounds.Width - 37; ColumnWidth = columnWidth; int bestHeight = 0; foreach(string s in values) { List<string> column = Columns[currentColumn]; Vector2 measure = Datastructures.SafeMeasure(GUI.DefaultFont, s); height += (int) measure.Y; column.Add(s); if(height > bestHeight) { bestHeight = height; } if(height >= MaxHeight) { height = 0; Columns.Add(new List<string>()); currentColumn++; columnWidth += ColumnWidth; } } List<List<string>> removals = new List<List<string>>(); foreach(List<string> column in Columns) { if(column.Count == 0) { removals.Add(column); } } foreach(List<string> column in removals) { Columns.Remove(column); columnWidth -= ColumnWidth; } bestHeight += 15; LocalBounds = new Rectangle(0, parent.GlobalBounds.Height / 2 + GUI.Skin.TileHeight / 2, columnWidth, bestHeight); Box = parent; ClickTimer = new Timer(0.1f, true, Timer.TimerMode.Real); InputManager.MouseClickedCallback += InputManager_MouseClickedCallback; Drawn = true; }
public GodModeTool(DwarfGUI gui, GameMaster master) { GUI = gui; Player = master; SelectorPanel = new Window(GUI, gui.RootComponent) { LocalBounds = new Rectangle(200, 100, 300, 100) }; Label label = new Label(GUI, SelectorPanel, "Cheat Mode!", GUI.DefaultFont) { LocalBounds = new Rectangle(10, 10, 250, 32) }; SelectorBox = new ComboBox(GUI, SelectorPanel) { LocalBounds = new Rectangle(10, 64, 250, 32), WidthSizeMode = GUIComponent.SizeMode.Fit }; IsActive = false; Chunks = PlayState.ChunkManager; foreach(string s in RoomLibrary.GetRoomTypes()) { SelectorBox.AddValue("Build " + s); } List<string> strings = EntityFactory.EntityFuncs.Keys.ToList(); strings.Sort(); foreach (string s in strings) { SelectorBox.AddValue(s); } foreach(VoxelType type in VoxelLibrary.PrimitiveMap.Keys.Where(type => type.Name != "empty" && type.Name != "water")) { SelectorBox.AddValue("Place " + type.Name); } SelectorBox.AddValue("Delete Block"); SelectorBox.AddValue("Kill Block"); SelectorBox.AddValue("Kill Things"); SelectorBox.AddValue("Fill Water"); SelectorBox.AddValue("Fill Lava"); SelectorBox.AddValue("Fire"); SelectorBox.OnSelectionModified += SelectorBox_OnSelectionModified; SelectorPanel.IsVisible = false; }
ComboBox CreateOptionsBox(string label, string tooltip, FormLayout layout) { ComboBox box = new ComboBox(GUI, layout) { ToolTip = tooltip }; box.AddValue(VeryLow); box.AddValue(Low); box.AddValue(Medium); box.AddValue(High); box.AddValue(VeryHigh); box.CurrentIndex = 2; box.CurrentValue = Medium; layout.AddItem(label, box); return box; }
public ComboBoxSelector(DwarfGUI gui, ComboBox parent, List <Entry> values, int posX = -1, int posY = -1) : base(gui, parent) { MaxHeight = 500; Font = gui.DefaultFont; Columns = new List <List <Entry> >(); Values = values; CurrentValue = values.FirstOrDefault(); int height = 0; Columns.Add(new List <Entry>()); int currentColumn = 0; int columnWidth = parent.GlobalBounds.Width - 37; ColumnWidth = columnWidth; int bestHeight = 0; int x = posX > 0 ? posX : 0; Box = parent; int y = posY > 0 ? posY : parent.GlobalBounds.Height / 2 + GUI.Skin.TileHeight / 2; foreach (Entry s in values) { List <Entry> column = Columns[currentColumn]; Vector2 measure = Datastructures.SafeMeasure(Font, s.LocalName); height += (int)measure.Y; if (height > bestHeight) { bestHeight = height; } if (height >= MaxHeight || height + y + Box.GlobalBounds.Y + 32 > GameSettings.Default.ResolutionY) { height = 0; Columns.Add(new List <Entry>() { s }); currentColumn++; columnWidth += ColumnWidth; } else { column.Add(s); } } List <List <Entry> > removals = new List <List <Entry> >(); foreach (List <Entry> column in Columns) { if (column.Count == 0) { removals.Add(column); } } foreach (List <Entry> column in removals) { Columns.Remove(column); columnWidth -= ColumnWidth; } bestHeight += 32; LocalBounds = new Rectangle(x, y, columnWidth, bestHeight); ClickTimer = new Timer(0.1f, true, Timer.TimerMode.Real); InputManager.MouseClickedCallback += InputManager_MouseClickedCallback; Drawn = true; }