public void Select(EntityIcon _entity) { if (this.Icon != _entity) { if (this.Icon != null) { this.UpdateValues(); this.Icon.Selected = false; } this.Icon = _entity; if (this.Icon != null) { this.Icon.Selected = true; } foreach (Entity c in this.Children) { c.Kill(); } //this.Properties = new Dictionary<string, Func<string>>(); Bunch <Alignable> als = new Bunch <Alignable>(); if (_entity != null) { als.Add(new Alignment(new Label("X:"), this.XBox = new NumBox(Meth.Down(_entity.X)))); als.Add(new Alignment(new Label("Y:"), this.YBox = new NumBox(Meth.Down(_entity.Y)))); als.Add(new Alignment(new Label("Z:"), this.ZBox = new NumBox(Meth.Down(_entity.EntityZ)) { MinValue = -9999 })); } if (_entity == null) { this.PropertyEditor = new PropertyEditor(new Dictionary <string, Type>()); } else if (_entity.Type.Name != "Decoration") { als.Add(this.PropertyEditor = new PropertyEditor(this.Icon.Properties.ToDictionary(item => item.Name, item => item.Type), this.Icon.Properties.ToDictionary(item => item.Name, item => (object)item.Value))); } this.Children.Add(new Alignment(als) { Vertical = true }); if (_entity != null) { Button b = new Button("Delete", () => this.Icon.RemoveFromLevel()); b.Position = new Vector(((TabList)this.Parents[2]).InnerSize.X - b.RectSize.X, 0); this.Children.Add(b); } } }
public override void OnInitialization() { Bunch <Alignable> als = new Bunch <Alignable>(); als.Add(new Alignment(new Label("Title:"), this.BoxTitle = new TextBox("untitled"))); als.Add(new Alignment(new Label("Author:"), this.BoxAuthor = new TextBox("unknown"))); als.Add(new Alignment(new Label("Width:"), this.BoxWidth = new NumBox(this.Editor.TileEditor.Size.X))); als.Add(new Alignment(new Label("Height:"), this.BoxHeight = new NumBox(this.Editor.TileEditor.Size.Y))); als.Add(new Alignment(new Label("OnLoad:"), this.BoxOnLoad = new ScriptBox(Zero.Script.Store("")))); als.Add(new Alignment(new Label("OnEnter:"), this.BoxOnEnter = new ScriptBox(Zero.Script.Store("")))); als.Add(new Alignment(new Label("OnExit:"), this.BoxOnExit = new ScriptBox(Zero.Script.Store("")))); this.Children.Add(new Alignment(als) { Vertical = true }); }
public override void OnInitialization() { this.Children.Add(this.Zooms = new Alignment(new Button("-", () => this.SetZoom(this.Zoom - 1)), new Button("+", () => this.SetZoom(this.Zoom + 1))) { Vertical = true }); Bunch <Alignable> als = new Bunch <Alignable>(); als.Add(new Alignment(new Label("Sprites:"), this.BoxSprites = new NumBox(4) { MinValue = 1, Digits = 2, MaxValue = 99 })); als.Add(new Alignment(new Label("Speed:"), this.BoxSpeed = new NumBox(10) { MinValue = 1, Digits = 3, MaxValue = 999 })); als.Add(new Alignment(this.BoxRepeated = new Checkbox(true) { Content = "Repeated" }, new Button("►", () => this.Animation.ForcePlay("Start")))); als.Add(new Alignment ( new Button("Add", () => { }), new Button("Export", () => { this.Parent.ReleaseKey(Key.MouseLeft); File f = this.Parent.SaveFile(this.GetAnimationFile().ToBytesEncrypted(), "meka"); if (f != null) { ((AnimationEditor)this.Parents[0]).AnimationShown = false; } }), new Button("Cancel", () => ((AnimationEditor)this.Parents[0]).AnimationShown = false) ) { Spacing = 3 }); this.Children.Add(this.Bottom = new Alignment(als) { Vertical = true }); }