Exemple #1
0
 private void CreateContextMenu()
 {
     GUIContextMenu.CreateContextMenu
     (
         new ContextMenuOption("subeditor.editbackgroundcolor", true, CreateBackgroundColorPicker),
         new ContextMenuOption("editor.togglereferencecharacter", true, delegate { sizeRefEnabled = !sizeRefEnabled; })
     );
 }
        private void CreateContextMenu(EditorNode node, NodeConnection?connection = null)
        {
            if (GUIContextMenu.CurrentContextMenu != null)
            {
                return;
            }

            GUIContextMenu.CreateContextMenu(
                new ContextMenuOption("EventEditor.Edit", isEnabled: node is ValueNode || connection?.Type == NodeConnectionType.Value || connection?.Type == NodeConnectionType.Option, onSelected: delegate
            {
                CreateEditMenu(node as ValueNode, connection);
            }),
                new ContextMenuOption("EventEditor.MarkEnding", isEnabled: connection != null && connection.Type == NodeConnectionType.Option, onSelected: delegate
            {
                if (connection == null)
                {
                    return;
                }

                connection.EndConversation = !connection.EndConversation;
            }),
                new ContextMenuOption("EventEditor.RemoveConnection", isEnabled: connection != null, onSelected: delegate
            {
                if (connection == null)
                {
                    return;
                }

                connection.ClearConnections();
                connection.OverrideValue = null;
                connection.OptionText    = connection.OptionText;
            }),
                new ContextMenuOption("EventEditor.AddOption", isEnabled: node.CanAddConnections, onSelected: node.AddOption),
                new ContextMenuOption("EventEditor.RemoveOption", isEnabled: connection != null && node.RemovableTypes.Contains(connection.Type), onSelected: delegate
            {
                connection?.Parent.RemoveOption(connection);
            }),
                new ContextMenuOption("EventEditor.Delete", isEnabled: true, onSelected: delegate
            {
                nodeList.Remove(node);
                node.ClearConnections();
            }));
        }