Ejemplo n.º 1
0
        public ScrollBackground(LevelEditor _editor)
        {
            this.Z = -10;

            this.Interfacial = true;
            this.Editor      = _editor;
            this.Preview     = _editor.LevelPreview;
        }
Ejemplo n.º 2
0
        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;
        }