public override void Initialize() { base.Initialize(); ptree = new PropertyTree(panel); tagStrip = new MenuStrip(panel); var root = tagStrip.AddItem("Add tag"); root.Position(Gwen.Pos.Top, 0, 100); root.Menu.Position(Gwen.Pos.Top, 0, 20); root.Clicked += (sender, arguments) => { var menu = sender as MenuItem; menu.Menu.Show(); }; foreach (var tag in TagsContainer.allTags) { root.Menu.AddItem(tag); } root.Menu.AddDivider(); root.Menu.AddItem("Create new tag").SetAction((Base sender, EventArgs arguments) => Console.WriteLine()); //root.Menu.; tagStrip.Hide(); ptree.ShouldDrawBackground = false; Selection.OnSelectionChange += (sender, args) => { var entity = (sender as Func <object>)() as Entity; if (entity != null) { var comps = entity.GetAllComponents(); ptree.RemoveAll(); var prop = ptree.Add("Transform"); prop.Add("Position:", new Gwen.Control.Property.Vector3(prop), entity.Position).ValueChanged += (o, arg) => { var tmpObj = o as PropertyRow <Vector3>; entity.Position = tmpObj.Value; }; prop.Add("Rotation:", new Gwen.Control.Property.Vector3(prop), entity.Rotation).ValueChanged += (o, arg) => { var tmpObj = o as PropertyRow <Vector3>; entity.Rotation = tmpObj.Value; }; prop.Add("Scale:", new Gwen.Control.Property.Vector3(prop), entity.Scale).ValueChanged += (o, arg) => { var tmpObj = o as PropertyRow <Vector3>; entity.Scale = tmpObj.Value; }; foreach (var component in comps) { prop = ptree.Add(component.GetType().Name); var inspector = new DefaultInspector(); inspector.properties = prop; inspector.getTarget = () => component; inspector.OnInitializeGUI(); } ptree.Show(); ptree.SetBounds(0, 25, 200, 200); ptree.ExpandAll(); tagStrip.Show(); } //else //props=Selection.assets [0].GetType ().GetProperties ().Where (p=>p.CanRead && p.CanWrite); }; }
public override void Initialize() { base.Initialize(); ptree = new PropertyTree(panel); tagStrip = new MenuStrip(panel); var root = tagStrip.AddItem("Add tag"); root.Position(Gwen.Pos.Top, 0, 100); root.Menu.Position(Gwen.Pos.Top, 0, 20); root.Clicked += (sender, arguments) => { var menu = sender as MenuItem; menu.Menu.Show(); }; foreach (var tag in TagsContainer.allTags) { root.Menu.AddItem(tag); } root.Menu.AddDivider(); root.Menu.AddItem("Create new tag").SetAction((Base sender, EventArgs arguments) => Console.WriteLine()); //root.Menu.; tagStrip.Hide(); ptree.ShouldDrawBackground = false; Selection.OnSelectionChange += (sender, args) => { Console.WriteLine("SelectionChange"); ptree.RemoveAll(); if (sender is Entity entity) { RenderComponents(entity); } //else //props=Selection.assets [0].GetType ().GetProperties ().Where (p=>p.CanRead && p.CanWrite); tagStrip.Show(); ptree.Show(); ptree.SetBounds(0, 25, panel.Width, 200); ptree.ExpandAll(); }; Selection.OnSelectionDirty += (sender, args) => { if (sender is Entity entity) { RenderComponents(entity); } }; }