예제 #1
0
        //-----------------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------------
        public EditorForm()
        {
            InitializeComponent();

            editorControl				= new EditorControl();
            editorControl.EditorForm	= this;

            // Create the level display.
            levelDisplay				= new LevelDisplay();
            levelDisplay.EditorControl	= editorControl;
            levelDisplay.Name			= "levelDisplay";
            levelDisplay.Dock			= DockStyle.Fill;
            levelDisplay.EditorForm		= this;
            panelWorld.Controls.Add(this.levelDisplay);

            tileDisplay					= new TileDisplay();
            tileDisplay.EditorControl	= editorControl;
            tileDisplay.Name			= "tileDisplay";
            tileDisplay.Dock			= DockStyle.Fill;
            tileDisplay.EditorForm		= this;
            panelTiles2.Controls.Add(tileDisplay);

            /*treeViewLevels.AfterLabelEdit += delegate(object sender, NodeLabelEditEventArgs e) {
                Console.WriteLine("Renamed level to " + e.Label);
                int levelIndex = e.Node.Index;
                Level level = editorControl.World.GetLevel(levelIndex);
                level.Name = e.Label;
            };*/

            treeViewWorld.NodeMouseDoubleClick += delegate(object sender, TreeNodeMouseClickEventArgs e) {
                if (e.Node.Name == "level") {
                    editorControl.OpenLevel(e.Node.Index);
                }
                else if (e.Node.Name == "world") {
                    editorControl.OpenObjectProperties(editorControl.World);
                }
            };

            this.comboBoxWorldLayer.Items.Add("Layer 1");
            this.comboBoxWorldLayer.Items.Add("Layer 2");
            this.comboBoxWorldLayer.Items.Add("Layer 3");
            this.comboBoxWorldLayer.Items.Add("Events");
            this.comboBoxWorldLayer.SelectedIndex = 0;

            // Create tools.
            this.toolButtons	= new ToolStripButton[] {
                buttonToolPointer,
                buttonToolPlace,
                buttonToolSelection,
                buttonToolEyedropper
            };

            this.hotKeyCommands = new Dictionary<Keys, HotKeyAction>();
            this.hotKeyCommands.Add(Keys.PageUp, delegate() { cycleLayerUpToolStripMenuItem_Click(null, null); });
            this.hotKeyCommands.Add(Keys.PageDown, delegate() { cycleLayerUpToolStripMenuItem1_Click(null, null); });
            this.hotKeyCommands.Add(Keys.M, delegate() { buttonTool_Click(this.buttonToolPointer, null); });
            this.hotKeyCommands.Add(Keys.P, delegate() { buttonTool_Click(this.buttonToolPlace, null); });
            this.hotKeyCommands.Add(Keys.S, delegate() { buttonTool_Click(this.buttonToolSelection, null); });
            this.hotKeyCommands.Add(Keys.K, delegate() { buttonTool_Click(this.buttonToolEyedropper, null); });
        }
예제 #2
0
 public override void Duplicate(EditorControl editorControl, string suffix)
 {
     Dungeon duplicate = new Dungeon(dungeon);
     duplicate.Name += suffix;
     editorControl.World.AddDungeon(dungeon);
     editorControl.RefreshWorldTreeView();
 }
        //-----------------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------------
        public PropertyGridControl(EditorControl editorControl, PropertyGrid propertyGrid)
        {
            this.editorControl	= editorControl;
            this.propertyGrid	= propertyGrid;

            propertiesContainer = new PropertiesContainer(null);
            propertyGrid.SelectedObject = propertiesContainer;

            // Create property editor types.
            typeEditors = new Dictionary<string, CustomPropertyEditor>();
            typeEditors["sprite"]			= new ResourcePropertyEditor<Sprite>();
            typeEditors["animation"]		= new ResourcePropertyEditor<Animation>();
            typeEditors["collision_model"]	= new ResourcePropertyEditor<CollisionModel>();
            typeEditors["song"]				= new ResourcePropertyEditor<Song>();
            typeEditors["sound"]			= new ResourcePropertyEditor<Sound>();
            typeEditors["zone"]				= new ResourcePropertyEditor<Zone>();
            typeEditors["reward"]			= new RewardPropertyEditor(editorControl.RewardManager);
            typeEditors["text_message"]		= new TextMessagePropertyEditor();
            typeEditors["script"]			= new ScriptPropertyEditor();
            typeEditors["sprite_index"]		= new SpriteIndexComboBox();
            typeEditors["direction"]		= new DirectionPropertyEditor();
            typeEditors["angle"]			= null;
            typeEditors["enum"]				= new EnumComboBox();
            typeEditors["enum_flags"]		= null;
            typeEditors["dungeon"]			= new DungeonPropertyEditor();
            typeEditors["level"]			= new LevelPropertyEditor();
            /*
            // Initialize property type editors.
            foreach (KeyValuePair<string, CustomPropertyEditor> entry in typeEditors) {
                if (entry.Value != null)
                    entry.Value.Initialize(this);
            }*/
        }
예제 #4
0
 public override void Duplicate(EditorControl editorControl, string suffix)
 {
     Script duplicate = new Script(script);
     duplicate.Name += suffix;
     editorControl.World.AddScript(duplicate);
     editorControl.RefreshWorldTreeView();
 }
예제 #5
0
 public override void Open(EditorControl editorControl)
 {
     using (ScriptEditor form = new ScriptEditor(script, editorControl)) {
         if (form.ShowDialog(editorControl.EditorForm) == DialogResult.OK) {
             editorControl.RefreshWorldTreeView();
         }
     }
 }
        //-----------------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------------
        public ZeldaPropertyGrid()
        {
            editorControl		= null;
            propertyObject		= null;
            propertiesContainer	= new PropertiesContainer(this);
            typeEditors			= new Dictionary<string, CustomPropertyEditor>();

            this.SelectedObject			= propertiesContainer;
            this.PropertyValueChanged	+= OnPropertyChange;
        }
예제 #7
0
        public override void Delete(EditorControl editorControl)
        {
            DialogResult result = MessageBox.Show(editorControl.EditorForm,
                "You are about to delete the script '" + script.Name + "'. This will be permanent. Continue?", "Confirm",
                MessageBoxButtons.YesNo, MessageBoxIcon.Information,
                MessageBoxDefaultButton.Button2);

            if (result == DialogResult.Yes) {
                editorControl.World.RemoveScript(script);
                editorControl.RefreshWorldTreeView();
            }
        }
        //-----------------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------------
        public PropertyRefactorForm(EditorControl editorControl)
        {
            InitializeComponent();
            this.editorControl = editorControl;

            // Add items to the "Look In" combo box.
            comboBoxLookIn.Items.Add("Entire World");
            comboBoxLookIn.Items.Add("Current Level");
            comboBoxLookIn.Items.Add("Current Selection");
            comboBoxLookIn.SelectedIndex = 0;

            // Set the button to be pressed with the Enter key.
            AcceptButton = buttonFindAll;

            KeyPreview = true;
        }
예제 #9
0
        //-----------------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------------
        public PropertyGridControl(EditorControl editorControl, PropertyGrid propertyGrid)
        {
            this.editorControl	= editorControl;
            this.propertyGrid	= propertyGrid;

            propertiesContainer = new PropertiesContainer(this);
            propertyGrid.SelectedObject = propertiesContainer;

            // Setup property editor types.
            typeEditors = new Dictionary<string,UITypeEditor>();
            typeEditors["sprite"]			= new ResourcePropertyEditor<Sprite>();
            typeEditors["animation"]		= new ResourcePropertyEditor<Animation>();
            typeEditors["collision_model"]	= new ResourcePropertyEditor<CollisionModel>();
            typeEditors["song"]				= new ResourcePropertyEditor<Song>();
            typeEditors["sound"]			= new ResourcePropertyEditor<Sound>();
            typeEditors["zone"]				= new ResourcePropertyEditor<Zone>();
            typeEditors["reward"]			= new RewardPropertyEditor(editorControl.RewardManager);
            typeEditors["text_message"]		= new TextMessagePropertyEditor();
            typeEditors["script"]			= null;
            typeEditors["sprite_index"]		= new SpriteIndexComboBox(this);
        }
예제 #10
0
        public override void Delete(EditorControl editorControl)
        {
            DialogResult result = MessageBox.Show(editorControl.EditorForm,
                "You are about to delete the level '" + level.Id + "'. This will be permanent. Continue?", "Confirm",
                MessageBoxButtons.YesNo, MessageBoxIcon.Information,
                MessageBoxDefaultButton.Button2);

            if (result == DialogResult.Yes) {
                int levelIndex = editorControl.World.Levels.IndexOf(level);
                editorControl.World.RemoveLevel(level);
                editorControl.RefreshWorldTreeView();

                if (editorControl.World.LevelCount == 0) {
                    editorControl.CloseLevel();
                    //worldTreeView.SelectedNode = worldTreeView.Nodes[0].Nodes[0];
                    //treeViewLevels_AfterSelect(null, new TreeViewEventArgs(worldTreeView.SelectedNode));
                }
                else {
                    editorControl.OpenLevel(Math.Max(0, levelIndex - 1));
                    //worldTreeView.SelectedNode = worldTreeView.Nodes[0].Nodes[0].Nodes[GMath.Max(0, index - 1)];
                }
            }
        }
예제 #11
0
        //-----------------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------------
        public WorldTreeView()
        {
            editorControl = null;
            worldNode = null;

            // Open nodes on double click.
            NodeMouseDoubleClick += delegate(object sender, TreeNodeMouseClickEventArgs e) {
                OpenNode(e.Node);
            };

            /*LabelEdit = true; // Allows the editing of labels.

            // Only allow label editing with object nodes.
            BeforeLabelEdit += delegate(object sender, NodeLabelEditEventArgs e) {
                if (!(e.Node is IWorldTreeViewNode))
                    e.CancelEdit = true;
            };

            // Update node names after label editing.
            AfterLabelEdit += delegate(object sender, NodeLabelEditEventArgs e) {
                if (e.CancelEdit)
                    Console.WriteLine("CANCEL EDIT!!");
                TreeNode node = e.Node;
                if (node is IWorldTreeViewNode)
                    ((IWorldTreeViewNode) node).Rename(e.Label);
                node.Text = e.Label;
            };*/

            // Make sure the right clicked node doesn't change back after selecting an item in the content menu.
            MouseClick += delegate(object sender, MouseEventArgs e) {
                // Only check with right click so pressing the pluses and minuses don't change the selection.
                if (e.Button == MouseButtons.Right)
                    SelectedNode = GetNodeAt(e.X, e.Y);
                if (SelectedNode.IsEditing)
                    SelectedNode.EndEdit(true);
            };
        }
예제 #12
0
 public override void Open(EditorControl editorControl)
 {
     editorControl.OpenObjectProperties(world);
 }
예제 #13
0
 public override void Open(EditorControl editorControl)
 {
     editorControl.OpenLevel(level);
     editorControl.OpenObjectProperties(level);
 }
예제 #14
0
 public override void Duplicate(EditorControl editorControl, string suffix)
 {
 }
예제 #15
0
        public void Initialize(EditorControl editorControl)
        {
            this.editorControl = editorControl;

            // Create custom property editor types.
            typeEditors["sprite"]			= new ResourcePropertyEditor<Sprite>();
            typeEditors["animation"]		= new ResourcePropertyEditor<Animation>();
            typeEditors["collision_model"]	= new ResourcePropertyEditor<CollisionModel>();
            typeEditors["song"]				= new ResourcePropertyEditor<Song>();
            typeEditors["sound"]			= new ResourcePropertyEditor<Sound>();
            typeEditors["zone"]				= new ResourcePropertyEditor<Zone>();
            typeEditors["reward"]			= new RewardPropertyEditor(editorControl.RewardManager);
            typeEditors["text_message"]		= new TextMessagePropertyEditor();
            typeEditors["script"]			= new ScriptPropertyEditor();
            typeEditors["sprite_index"]		= new SpriteIndexComboBox();
            typeEditors["direction"]		= new DirectionPropertyEditor();
            typeEditors["angle"]			= null;
            typeEditors["enum"]				= new EnumComboBox();
            typeEditors["enum_flags"]		= null;
            typeEditors["dungeon"]			= new DungeonPropertyEditor();
            typeEditors["level"]			= new LevelPropertyEditor();

            // Initialize the property editors.
            foreach (CustomPropertyEditor editor in typeEditors.Values.Where(e => e != null)) {
                editor.Initialize(this);
            }
        }
예제 #16
0
        //-----------------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------------

        public EditorWorld(EditorControl editorControl)
        {
            this.editorControl = editorControl;
        }
예제 #17
0
        //-----------------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------------
        public EditorForm()
        {
            InitializeComponent();

            // Create the editor control instance.
            editorControl = new EditorControl(this);

            // Initialize world tree view.
            worldTreeView.EditorControl = editorControl;

            // Initialize property grid.
            propertyGrid.Initialize(editorControl);

            // Create the level display.
            levelDisplay				= new LevelDisplay();
            levelDisplay.EditorControl	= editorControl;
            levelDisplay.Name			= "levelDisplay";
            levelDisplay.Dock			= DockStyle.Fill;
            levelDisplay.EditorForm		= this;
            panelWorld.Controls.Add(this.levelDisplay);

            // Create the tileset display.
            tileDisplay					= new TileDisplay();
            tileDisplay.EditorControl	= editorControl;
            tileDisplay.Name			= "tileDisplay";
            tileDisplay.Dock			= DockStyle.Fill;
            tileDisplay.EditorForm		= this;
            panelTiles2.Controls.Add(tileDisplay);

            activeControl = null;
            objectEditorForm = null;

            statusLabelTask.Text = null;

            // Setup layer combo-box.
            this.comboBoxWorldLayer.Items.Add("Layer 1");
            this.comboBoxWorldLayer.Items.Add("Layer 2");
            this.comboBoxWorldLayer.Items.Add("Layer 3");
            this.comboBoxWorldLayer.Items.Add("Events");
            this.comboBoxWorldLayer.SelectedIndex = 0;

            // Create tools.
            this.toolButtons = new ToolStripButton[] {
                buttonToolPointer,
                buttonToolPlace,
                buttonToolSquare,
                buttonToolFill,
                buttonToolSelection,
                buttonToolEyedropper
            };

            // Add hotkeys.
            hotKeyCommands = new Dictionary<Keys, HotKeyAction>();
            hotKeyCommands.Add(Keys.PageUp, delegate() { cycleLayerUpToolStripMenuItem_Click(null, null); });
            hotKeyCommands.Add(Keys.PageDown, delegate() { cycleLayerUpToolStripMenuItem1_Click(null, null); });
            hotKeyCommands.Add(Keys.M, delegate() { buttonTool_Click(this.buttonToolPointer, null); });
            hotKeyCommands.Add(Keys.P, delegate() { buttonTool_Click(this.buttonToolPlace, null); });
            hotKeyCommands.Add(Keys.O, delegate() { buttonTool_Click(this.buttonToolSquare, null); });
            hotKeyCommands.Add(Keys.F, delegate() { buttonTool_Click(this.buttonToolFill, null); });
            hotKeyCommands.Add(Keys.S, delegate() { buttonTool_Click(this.buttonToolSelection, null); });
            hotKeyCommands.Add(Keys.K, delegate() { buttonTool_Click(this.buttonToolEyedropper, null); });
        }
예제 #18
0
 //-----------------------------------------------------------------------------
 // Methods
 //-----------------------------------------------------------------------------
 public void Initialize(EditorControl editorControl)
 {
     this.editorControl = editorControl;
     this.mouseCursor = Cursors.Default;
     Initialize();
 }
예제 #19
0
 //-----------------------------------------------------------------------------
 // Constructor
 //-----------------------------------------------------------------------------
 public EditorWorld(EditorControl editorControl)
 {
     this.editorControl = editorControl;
 }
예제 #20
0
 //-----------------------------------------------------------------------------
 // Overridden Methods
 //-----------------------------------------------------------------------------
 public override void Open(EditorControl editorControl)
 {
     // Open the dungeon's properties.
     editorControl.OpenObjectProperties(dungeon);
 }
 public virtual void Delete(EditorControl editorControl)
 {
 }
 public virtual void Duplicate(EditorControl editorControl, string suffix)
 {
 }
 public virtual void Open(EditorControl editorControl)
 {
 }