private void initGui() { DrawableUIElemts = new List<IEnumDrawableUIElemt>(); renderer = new XNARenderer(); panel = new StackPanel() { Orientation = Orientation.Veritical, ActualWidth = 240, ActualHeight = 440, X = 990, Y = 200 }; DrawableUIElemts.Add(panel); panel.UpdateLayout(); const int PanelRaw = 2; tilesPanel = new MultiScrollStackPanel(PanelRaw) { ActualWidth = 960, ActualHeight = PanelRaw * 32, X = 0, Y = 0, }; DrawableUIElemts.Add(tilesPanel); tilesPanel.UpdateLayout(); var button = new SampleButton(10, 220) { Content = "Add", }; panel.AddChild(button, () => { Status = S_Add; }); var button2 = new SampleButton(10, 350) { Content = "Remove", }; panel.AddChild(button2, () => { Status = S_Remove; }); var button3 = new SampleButton(10, 450) { Content = "Clear", }; panel.AddChild(button3, new Action(OnClear)); var button4 = new SampleButton(10, 10) { Content = "Load", }; panel.AddChild(button4, new Action(OnLoad)); var button5 = new SampleButton(10, 10) { Content = "Save", }; panel.AddChild(button5, new Action(OnSave)); ShowAllTiles(); }
private void ShowAllTiles() { foreach(var obj in CozyTiledFactory.GetTiles()) { ContentControl control = null; if(obj.Value is CozyColorTile) { var ColorTile = obj.Value as CozyColorTile; var color = ColorTile.ColorProperty; control = new SampleButton(0, 0) { PreferredHeight = 32, PreferredWidth = 32, Background = new Starbound.UI.SBColor(color.R, color.G, color.B), Foreground = new Starbound.UI.SBColor(color.R, color.G, color.B), }; } else if(obj.Value is CozySpriteTiled) { var SpriteTile = obj.Value as CozySpriteTiled; control = new TileButton(SpriteTile.Texture, SpriteTile.Rect); } if(control != null) { tilesPanel.AddChild(control, () => { CurrentTiledId = obj.Key; }); } } }