public override void OnInitialization() { FileMenu m = (FileMenu)this.Parents[0]; this.Children.Add(this.Label = new Label(this.Selectable.Name) { Position = new Vector(0.5, 0.5), TextColor = m.TextColor }); //VertexArray v = new VertexArray(VertexArrayType.LinesStrip) { Color = this.Color }; Bunch <Vector> vs = new Bunch <Vector>(); vs.Add(new Vector(0, 0)); vs.Add(new Vector(0, this.Label.Height / 4 * 3)); vs.Add(new Vector(this.Label.Height / 4, this.Label.Height)); vs.Add(new Vector(this.Label.Width - this.Label.Height / 4, this.Label.Height)); vs.Add(new Vector(this.Label.Width, this.Label.Height / 4 * 3)); vs.Add(new Vector(this.Label.Width, 0)); VertexArray v; this.Graphics.Add(v = new VertexArray(VertexArrayType.Polygon) { Vertices = vs.Select(item => (Vertex)item), Color = m.BackgroundColor }); this.Graphics.Add(new VertexArray(VertexArrayType.LinesStrip) { Vertices = vs.Select(item => (Vertex)item), Color = m.EdgeColor }); this.AddMouseArea(this.MouseArea = new MouseArea(v) { OnClick = key => { if (this.Selectable.IsEnabled()) { this.Parent.ReleaseKey(key); this.Selectable.Action(); } } }); this.Progress = this.Selectable.IsEnabled() ? 0 : -1; }
public override void OnInitialization() { this.Parent._LevelEditor = this; this.EntityTypes = this.Parent.EntityTypes.Select(item => new EntityType(item)); this.Children.Add(this.Menu = new FileMenu ( new Selectable("Exit", () => this.Exit()), new Selectable("Save", () => this.Parent.Save(this._Export(), "meka")), new Selectable("Save As", () => this.Parent.SaveAs(this._Export(), "meka")), new Selectable("Open", () => { File f = this.Parent.Open("meka"); if (f != null) { byte[] bs = f.Bytes; this.TileEditor._Load(bs); this.LevelInfoEditor.Load(bs); this.LevelPropertiesEditor.Load(bs); this.EntityEditor.Select(null); } }), new Selectable("Onion Skin", () => this.OnionSkin = !this.OnionSkin), new Selectable("Grid", () => this.TileEditor.Grid.Visible = !this.TileEditor.Grid.Visible) ) { Z = 8 }); this.Children.Add(this.TileEditor = new TileEditor(this.Parent.Areasets, this.DefaultTile, this.Parent.TileSize) { Parent = this.Parent }); this.Children.Add(this.TabListLeft = new TabList ( new TabInfo("Info", this.LevelInfoEditor = new LevelInfoEditor(this)), new TabInfo("Properties", this.LevelPropertiesEditor = new LevelPropertiesEditor(this, this.LevelProperties)), new TabInfo("Resources", new Alignment(new AnimationEditor(), new AreasetEditor()) { Vertical = true }) ) { InnerSize = new Vector(32 * 12, 32 * 16), Position = new Vector(0, 22), Z = 8 }); //this.Parent.Clock.Add(1, () => this.TabListLeft.SelectTab(1)); //this.Parent.Clock.Add(3, () => this.TabListLeft.SelectTab(0)); this.Children.Add(this.TabListRight = new TabList ( new TabInfo("Tiles", this.TileSelector = new TileSelector(this.Parent.Areasets)), new TabInfo("Entities", this.EntitySelector = new EntitySelector(this.EntityTypes, this)), new TabInfo("Layers", this.LayerList = new LayerList(this.TileEditor)) ) { InnerSize = new Vector(32 * 12, 32 * 16), AlignRight = true, Z = 8 }); this.Children.Add(this.LevelPreview = new LevelPreview(this) { Z = 8 }); this.Children.Add(new ScrollBackground(this)); this.StartFixedResolution = this.Parent.FixedResolution; this.StartScaleMode = this.Parent.ScaleMode; this.StartMouseLimitedToScreen = this.Parent.MouseLimitedToScreen; this.StartUseMultipleRenderers = this.Parent.UseMultipleRenderers; //this.StartIgnoreMouseWithoutFocus = this.Parent.IgnoreMouseWithoutFocus; this.Parent.FixedResolution = false; this.Parent.ScaleMode = ScaleMode.None; this.Parent.MouseLimitedToScreen = false; this.Parent.UseMultipleRenderers = false; //this.Parent.IgnoreMouseWithoutFocus = false; }