public void SetupSpellTab() { KnownSpellTab = new MagicTab { Tab = SpellsTab }; CreateMagicTab(KnownSpellTab); //BuildItemTab.BuildButton.OnClicked += BuildItemButton_OnClicked; List <Spell> spells = Master.Spells.GetKnownSpells(); int numItems = spells.Count(); int numColumns = 1; GridLayout layout = new GridLayout(GUI, KnownSpellTab.Scroller, numItems, numColumns) { LocalBounds = new Rectangle(0, 0, 720, 40 * numItems), EdgePadding = 0, WidthSizeMode = SizeMode.Fit, HeightSizeMode = SizeMode.Fixed }; int i = 0; foreach (Spell spell in spells) { Spell currSpell = spell; GridLayout itemLayout = new GridLayout(GUI, layout, 1, 3) { WidthSizeMode = SizeMode.Fixed, HeightSizeMode = SizeMode.Fixed, EdgePadding = 0 }; itemLayout.OnClicked += () => ItemTabOnClicked(currSpell); int i1 = i; itemLayout.OnHover += () => HoverItem(layout, i1); layout.SetComponentPosition(itemLayout, 0, i, 1, 1); ImagePanel icon = new ImagePanel(GUI, itemLayout, spell.Image) { KeepAspectRatio = true, ConstrainSize = true, MinWidth = 32, MinHeight = 32 }; itemLayout.SetComponentPosition(icon, 0, 0, 1, 1); Label description = new Label(GUI, itemLayout, spell.Name, GUI.SmallFont) { ToolTip = spell.Description }; itemLayout.SetComponentPosition(description, 1, 0, 1, 1); i++; } layout.UpdateSizes(); }
public void CreateMagicTab(MagicTab tab) { GridLayout tabLayout = new GridLayout(GUI, tab.Tab, 1, 3) { EdgePadding = 0 }; GridLayout infoLayout = new GridLayout(GUI, tabLayout, 4, 2); tabLayout.SetComponentPosition(infoLayout, 1, 0, 1, 1); tab.InfoImage = new ImagePanel(GUI, infoLayout, (Texture2D)null) { KeepAspectRatio = true }; infoLayout.SetComponentPosition(tab.InfoImage, 1, 0, 1, 1); tab.InfoTitle = new Label(GUI, infoLayout, "", GUI.DefaultFont); infoLayout.SetComponentPosition(tab.InfoTitle, 0, 0, 1, 1); tab.InfoDescription = new Label(GUI, infoLayout, "", GUI.SmallFont) { WordWrap = true }; infoLayout.SetComponentPosition(tab.InfoDescription, 0, 1, 1, 1); tab.InfoRequirements = new Label(GUI, infoLayout, "", GUI.SmallFont); infoLayout.SetComponentPosition(tab.InfoRequirements, 0, 2, 2, 1); tab.CastButton = new Button(GUI, infoLayout, "Cast", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetMouseFrame(GUI.Skin.MouseFrames[GUISkin.MousePointer.Magic])); tab.CastButton.OnClicked += CastButton_OnClicked; infoLayout.SetComponentPosition(tab.CastButton, 0, 3, 1, 1); tab.CastButton.IsVisible = false; tab.Scroller = new ScrollView(GUI, tabLayout) { DrawBorder = true }; tabLayout.SetComponentPosition(tab.Scroller, 0, 0, 1, 1); tabLayout.UpdateSizes(); }
public void SetupSpellTab() { KnownSpellTab = new MagicTab { Tab = SpellsTab }; CreateMagicTab(KnownSpellTab); //BuildItemTab.BuildButton.OnClicked += BuildItemButton_OnClicked; List<Spell> spells = Master.Spells.GetKnownSpells(); int numItems = spells.Count(); int numColumns = 1; GridLayout layout = new GridLayout(GUI, KnownSpellTab.Scroller, numItems, numColumns) { LocalBounds = new Rectangle(0, 0, 720, 40 * numItems), EdgePadding = 0, WidthSizeMode = SizeMode.Fit, HeightSizeMode = SizeMode.Fixed }; int i = 0; foreach (Spell spell in spells) { Spell currSpell = spell; GridLayout itemLayout = new GridLayout(GUI, layout, 1, 3) { WidthSizeMode = SizeMode.Fixed, HeightSizeMode = SizeMode.Fixed, EdgePadding = 0 }; itemLayout.OnClicked += () => ItemTabOnClicked(currSpell); int i1 = i; itemLayout.OnHover += () => HoverItem(layout, i1); layout.SetComponentPosition(itemLayout, 0, i, 1, 1); ImagePanel icon = new ImagePanel(GUI, itemLayout, spell.Image) { KeepAspectRatio = true, ConstrainSize = true, MinWidth = 32, MinHeight = 32 }; itemLayout.SetComponentPosition(icon, 0, 0, 1, 1); Label description = new Label(GUI, itemLayout, spell.Name, GUI.SmallFont) { ToolTip = spell.Description }; itemLayout.SetComponentPosition(description, 1, 0, 1, 1); i++; } layout.UpdateSizes(); }