コード例 #1
0
ファイル: EntityGroup.cs プロジェクト: TodesBrot/Mekanik
        public EntityGroup(Bunch <EntityTile> _types, TileEditor _tileeditor, EntityEditor _entityeditor, Point _size)
        {
            this.Interfacial = true;

            this.Types        = _types;
            this.TileEditor   = _tileeditor;
            this.EntityEditor = _entityeditor;
            this.Size         = _size;
        }
コード例 #2
0
        public TileGroup(ImageSource _overlay, Areaset _areaset, TileEditor _tileeditor, Point _size)
        {
            this.Interfacial = true;

            this.Areaset    = _areaset;
            this.TileEditor = _tileeditor;
            this.Size       = _size;

            this.Graphics.Add(this.Overlay = new Image(_overlay)
            {
                Scale = 2, Z = 1
            });
        }
コード例 #3
0
        public LayerList(TileEditor _editor)
            : base()
        {
            this.Editor = _editor;

            this.MaxHeight = 10000;

            this.OnOrderChange = () =>
            {
                Layer l = this.Editor.Layer;
                this.Editor.Layers = this.Items.OrderBy(item => item._ListIndex).Select(item => item.Layer);

                if (this.NewLayer == null)
                {
                    this.Editor.CurLayer = this.Editor.Layers.IndexOf(l);
                }
                else
                {
                    this.Editor.SwitchToLayer(this.Editor.Layers.IndexOf(this.NewLayer));
                    this.NewLayer = null;
                }

                this.Editor.UpdateOnionSkin();
                this.Changed = true;
            };

            this.OnItemAdd = pos =>
            {
                Layer l = new Layer(_editor.Areasets, this.Parent.TileSize, _editor.DefaultTile)
                {
                    Size = _editor.Size
                };
                this.NewLayer = l;

                this.Editor.Editor.EntityEditor.NeedsToDeselect = true;

                return(new LayerItem(_editor, l));
            };
        }
コード例 #4
0
        public LayerItem(TileEditor _editor, Layer _layer)
        {
            this.Interfacial = true;

            this.Editor = _editor;
            this.Layer  = _layer;

            this.Images[0] = new Image(new ImageSource(1, 1));
            this.Images[1] = new Image(new ImageSource(1, 1));

            this.Highlight = new Rectangle(0, new Vector(this.Editor.Editor.TabListRight.InnerSize.X, 100))
            {
                Color = Color.White * 0.8
            };

            this.Frame = new VertexArray(VertexArrayType.LinesStrip)
            {
                Color = Color.Black
            };
            this.Frame.Add(0, new Vector(1, 0), 1, new Vector(0, 1), 0);

            this._UpdateEntities();
        }
コード例 #5
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;
        }