Exemplo n.º 1
0
        public override void LoadMemberControl(AutoTileBase obj, TableLayoutPanel control, string name, Type type, object[] attributes, object member, bool isWindow)
        {
            if (type == typeof(List <TileLayer>))
            {
                List <TileLayer> anims = (List <TileLayer>)member;
                DataEditor.LoadLabelControl(control, name);

                Dev.TilePreview preview = new Dev.TilePreview();
                preview.Size = new Size(GraphicsManager.TileSize, GraphicsManager.TileSize);
                preview.SetChosenAnim(anims.Count > 0 ? anims[0] : new TileLayer());
                preview.Tag = member;
                control.Controls.Add(preview);
                preview.TileClick += (object sender, EventArgs e) =>
                {
                    Dev.ElementForm frmData = new Dev.ElementForm();
                    frmData.Text = "Edit Tile";
                    Rectangle boxRect = new Rectangle(new Point(), frmData.Size);
                    DataEditor.StaticLoadMemberControl(frmData.ControlPanel, name, type, attributes, preview.Tag, true);

                    if (frmData.ShowDialog() == DialogResult.OK)
                    {
                        object element = preview.Tag;
                        DataEditor.StaticSaveMemberControl(frmData.ControlPanel, name, type, attributes, ref element, true);
                        List <TileLayer> new_anims = (List <TileLayer>)element;
                        preview.SetChosenAnim(new_anims.Count > 0 ? new_anims[0] : new TileLayer());
                        preview.Tag = element;
                    }
                };
            }
            else
            {
                base.LoadMemberControl(obj, control, name, type, attributes, member, isWindow);
            }
        }
Exemplo n.º 2
0
 public override void LoadMemberControl(ItemData obj, TableLayoutPanel control, string name, Type type, object[] attributes, object member, bool isWindow)
 {
     if (name == "Sprite")
     {
         DataEditor.LoadLabelControl(control, name);
         //for strings, use an edit textbox
         Dev.SpriteBrowser browser = new Dev.SpriteBrowser();
         browser.Size      = new Size(210, 256);
         browser.ChosenPic = (int)member;
         control.Controls.Add(browser);
     }
     else
     {
         base.LoadMemberControl(obj, control, name, type, attributes, member, isWindow);
     }
 }