private void SetupBuildItemTab() { BuildItemTab = new BuildTab { Tab = Selector.AddTab("Objects") }; BuildItemTab.SelectedResourceBoxes = new List <ComboBox>(); CreateBuildTab(BuildItemTab, BuildType.Item); BuildItemTab.BuildButton.OnClicked += BuildItemButton_OnClicked; List <CraftItem> items = CraftLibrary.CraftItems.Values.Where(item => item.Type == CraftItem.CraftType.Object).ToList(); int numItems = items.Count(); int numColumns = 1; GridLayout layout = new GridLayout(GUI, BuildItemTab.Scroller, numItems, numColumns) { LocalBounds = new Rectangle(0, 0, 720, 40 * numItems), EdgePadding = 0, WidthSizeMode = SizeMode.Fit, HeightSizeMode = SizeMode.Fixed }; int i = 0; foreach (CraftItem itemType in items) { CraftItem item = itemType; GridLayout itemLayout = new GridLayout(GUI, layout, 1, 3) { WidthSizeMode = SizeMode.Fixed, HeightSizeMode = SizeMode.Fixed, EdgePadding = 0 }; if (i == 0) { ItemTabOnClicked(item); } itemLayout.OnClicked += () => ItemTabOnClicked(item); int i1 = i; itemLayout.OnHover += () => HoverItem(layout, i1); layout.SetComponentPosition(itemLayout, 0, i, 1, 1); ImagePanel icon = new ImagePanel(GUI, itemLayout, item.Image) { KeepAspectRatio = true, MinWidth = 32, MinHeight = 32 }; itemLayout.SetComponentPosition(icon, 0, 0, 1, 1); Label description = new Label(GUI, itemLayout, item.Name, GUI.SmallFont) { ToolTip = item.Description }; itemLayout.SetComponentPosition(description, 1, 0, 1, 1); i++; } layout.UpdateSizes(); }
public void CreateResearchTab() { ResearchTab = Selector.AddTab("Research Spells"); SpellTree = new SpellTreeDisplay(GUI, ResearchTab, Master.Spells, Master) { WidthSizeMode = SizeMode.Fit, HeightSizeMode = SizeMode.Fit }; }
public void SetupBuildRoomTab() { BuildRoomTab = new BuildTab() { Tab = Selector.AddTab("Rooms") }; CreateBuildTab(BuildRoomTab); BuildRoomTab.BuildButton.OnClicked += BuildRoomButton_OnClicked; List <string> roomTypes = RoomLibrary.GetRoomTypes().ToList(); int numRooms = roomTypes.Count(); int numColumns = 1; GridLayout layout = new GridLayout(GUI, BuildRoomTab.Scroller, numRooms, numColumns) { LocalBounds = new Rectangle(0, 0, 720, 40 * numRooms), EdgePadding = 0, WidthSizeMode = SizeMode.Fit, HeightSizeMode = SizeMode.Fixed }; int i = 0; foreach (string roomType in roomTypes) { RoomData room = RoomLibrary.GetData(roomType); GridLayout roomLayout = new GridLayout(GUI, layout, 1, 3) { WidthSizeMode = SizeMode.Fixed, HeightSizeMode = SizeMode.Fixed, EdgePadding = 0 }; roomLayout.OnClicked += () => RoomTabOnClicked(room); int i1 = i; roomLayout.OnHover += () => HoverItem(layout, i1); layout.SetComponentPosition(roomLayout, 0, i, 1, 1); ImagePanel icon = new ImagePanel(GUI, roomLayout, room.Icon) { KeepAspectRatio = true }; roomLayout.SetComponentPosition(icon, 0, 0, 1, 1); Label description = new Label(GUI, roomLayout, room.Name, GUI.SmallFont) { ToolTip = room.Description }; roomLayout.SetComponentPosition(description, 1, 0, 1, 1); i++; } layout.UpdateSizes(); }
private void SetupBuildWallTab() { BuildWallTab = new BuildTab { Tab = Selector.AddTab("Walls") }; CreateBuildTab(BuildWallTab, BuildType.Wall); BuildWallTab.BuildButton.OnClicked += WallButton_OnClicked; List <VoxelType> wallTypes = VoxelLibrary.GetTypes().Where(voxel => voxel.IsBuildable).ToList(); int numItems = wallTypes.Count(); int numColumns = 1; GridLayout layout = new GridLayout(GUI, BuildWallTab.Scroller, numItems, numColumns) { LocalBounds = new Rectangle(0, 0, 720, 40 * numItems), EdgePadding = 0, WidthSizeMode = SizeMode.Fit, HeightSizeMode = SizeMode.Fixed }; int i = 0; foreach (VoxelType wallType in wallTypes) { VoxelType wall = wallType; GridLayout itemLayout = new GridLayout(GUI, layout, 1, 3) { WidthSizeMode = SizeMode.Fixed, HeightSizeMode = SizeMode.Fixed, EdgePadding = 0 }; itemLayout.OnClicked += () => WallTabOnClicked(wall); int i1 = i; itemLayout.OnHover += () => HoverItem(layout, i1); layout.SetComponentPosition(itemLayout, 0, i, 1, 1); Label description = new Label(GUI, itemLayout, wall.Name + " Wall", GUI.SmallFont); itemLayout.SetComponentPosition(description, 1, 0, 1, 1); i++; } layout.UpdateSizes(); }
private void SetupBuildResourceTab() { bool hasCook = Build.HasFlag(BuildType.Cook); string name = Build.HasFlag(BuildType.Cook) ? "Food" : "Crafts"; BuildResourceTab = new BuildTab { Tab = Selector.AddTab(name), SelectedResourceBoxes = new List <ComboBox>() }; CreateBuildTab(BuildResourceTab, hasCook ? BuildType.Cook : BuildType.Craft); BuildResourceTab.BuildButton.OnClicked += BuildResource_OnClicked; List <CraftItem> items = CraftLibrary.CraftItems.Values.Where(item => item.Type == CraftItem.CraftType.Resource).ToList(); int numItems = items.Count(); int numColumns = 1; GridLayout layout = new GridLayout(GUI, BuildResourceTab.Scroller, numItems, numColumns) { LocalBounds = new Rectangle(0, 0, 720, 40 * numItems), EdgePadding = 0, WidthSizeMode = SizeMode.Fit, HeightSizeMode = SizeMode.Fixed }; int i = 0; foreach (CraftItem itemType in items) { CraftItem item = itemType; bool isEdible = ResourceLibrary.Resources.ContainsKey(item.ResourceCreated) && ResourceLibrary.Resources[item.ResourceCreated].Tags.Contains(Resource.ResourceTags.Edible); if (!hasCook && isEdible) { continue; } else if (hasCook && !isEdible) { continue; } GridLayout itemLayout = new GridLayout(GUI, layout, 1, 3) { WidthSizeMode = SizeMode.Fixed, HeightSizeMode = SizeMode.Fixed, EdgePadding = 0 }; if (i == 0) { ResourceTabOnClicked(item); } itemLayout.OnClicked += () => ResourceTabOnClicked(item); int i1 = i; itemLayout.OnHover += () => HoverItem(layout, i1); layout.SetComponentPosition(itemLayout, 0, i, 1, 1); ImagePanel icon = new ImagePanel(GUI, itemLayout, item.Image) { KeepAspectRatio = true, MinWidth = 32, MinHeight = 32 }; itemLayout.SetComponentPosition(icon, 0, 0, 1, 1); Label description = new Label(GUI, itemLayout, item.Name, GUI.SmallFont) { ToolTip = item.Description }; itemLayout.SetComponentPosition(description, 1, 0, 1, 1); i++; } layout.UpdateSizes(); }
public void CreateSpellsTab() { SpellsTab = Selector.AddTab("Known Spells"); SpellsTab.OnSelected += SpellsTab_OnClicked; InitializeSpells(); }