public EditorForm() { InitializeComponent(); logic = new EditorLogic(this, drawingSurface); constructEditor += logic.Construct; startEditor += logic.Start; loadEditor += logic.LoadContent; updateEditor += logic.Update; drawEditor += logic.Draw; ComponentContextMenu = new ContextMenu(new[] { new MenuItem("Сopy", (s, e) => { clipboardObject = ComponentPropertyGrid.SelectedGridItem.Value; }), new MenuItem("Paste", (s, e) => { if (ComponentPropertyGrid.SelectedGridItem.PropertyDescriptor.PropertyType.Equals(clipboardObject.GetType())) { ComponentPropertyGrid.SelectedGridItem.PropertyDescriptor.SetValue(ComponentPropertyGrid.SelectedObject, clipboardObject); ComponentPropertyGrid.SelectedObject = (ComponentBox.SelectedItem as ComponentCell).Component; } }) }); /*MaterialReferenceContextMenu = new ContextMenu(new[] { new MenuItem("Сopy", (s, e) => { clipboardObject = MaterialBox.SelectedItem; }), * new MenuItem("Remove", * (s, e) => * { * var r = MaterialBox.SelectedItem as MaterialReference; * r.IsValid = false; * activeScene.Materials.Remove(r); * })});*/ SetupGrid(gridCount, gridSize); }
public GameEx(ConstructEditorDelegate ced, StartEditorDelegate sed, LoadEditorDelegate led, UpdateEditorDelegate ued, DrawEditorDelegate ded) : this() { this.startEditor = sed; this.updateEditor = ued; this.drawEditor = ded; this.loadEditor = led; editorEnabled = true; ced?.Invoke(this); }