public override void _Ready() { GetPopup().AddCheckItem("Show Inspector"); GetPopup().AddCheckItem("Show Binder"); GetPopup().AddCheckItem("Show Dock"); GetPopup().AddCheckItem("Big Icons"); Array inspectorActionList = InputMap.GetActionList("inspector_toggle"); InputEventKey inspectorKey = (InputEventKey)inspectorActionList[0]; GetPopup().SetItemAccelerator(0, inspectorKey.GetScancodeWithModifiers()); Array binderActionList = InputMap.GetActionList("binder_toggle"); InputEventKey binderKey = (InputEventKey)binderActionList[0]; GetPopup().SetItemAccelerator(1, binderKey.GetScancodeWithModifiers()); Array dockActionList = InputMap.GetActionList("dock_toggle"); InputEventKey dockKey = (InputEventKey)dockActionList[0]; GetPopup().SetItemAccelerator(2, dockKey.GetScancodeWithModifiers()); GetPopup().Connect("index_pressed", this, nameof(OnItemPressed)); CallDeferred(nameof(SetValues)); }
public override void _Ready() { EditIcon = GD.Load <Texture>("res://res/icons/edit.png"); AddIcon = GD.Load <Texture>("res://res/icons/add.png"); RemoveIcon = GD.Load <Texture>("res://res/icons/remove.png"); ProjectEditor = GD.Load <PackedScene>("res://ProjectEditor.tscn"); DependencyEditor = GD.Load <PackedScene>("res://DependencyEditor.tscn"); UpdateKeyEditor = GD.Load <PackedScene>("res://UpdateKeyEditor.tscn"); fileMenu = GetNode <MenuButton>("MenuSeparator/MenuPanel/Menu/File"); var filePopup = fileMenu.GetPopup(); filePopup.Connect("index_pressed", this, nameof(Signal_FileMenuActivated)); filePopup.AddItem("New project..."); newModMenu = new PopupMenu() { Name = "NewMod" }; newModMenu.Connect("index_pressed", this, nameof(Signal_NewModMenuActivated)); foreach (var controllerId in ContentPackController.GetRegisteredControllerTypes()) { var controller = ContentPackController.GetControllerForMod(controllerId); newModMenu.AddItem(controller.ModName); } filePopup.AddChild(newModMenu); filePopup.AddSubmenuItem("New content pack...", "NewMod"); filePopup.SetItemDisabled(1, true); filePopup.AddSeparator(); filePopup.AddItem("Save"); var keyHelper = new InputEventKey() { Scancode = (uint)KeyList.S, Control = true, }; filePopup.SetItemAccelerator(3, keyHelper.GetScancodeWithModifiers()); filePopup.SetItemDisabled(3, true); filePopup.AddItem("Open"); keyHelper.Scancode = (uint)KeyList.O; filePopup.SetItemAccelerator(4, keyHelper.GetScancodeWithModifiers()); filePopup.AddSeparator(); filePopup.AddItem("Export"); keyHelper.Scancode = (uint)KeyList.E; filePopup.SetItemAccelerator(6, keyHelper.GetScancodeWithModifiers()); filePopup.SetItemDisabled(6, true); filePopup.AddItem("Import"); keyHelper.Scancode = (uint)KeyList.I; filePopup.SetItemAccelerator(7, keyHelper.GetScancodeWithModifiers()); filePopup.SetItemDisabled(7, true); ProjectTree = GetNode <Tree>("MenuSeparator/Splitter/Left/ProjectTree"); ProjectTree.Connect("button_pressed", this, nameof(Signal_TreeButtonPressed)); ProjectTree.Connect("item_activated", this, nameof(Signal_TreeCellActivated)); ProjectTree.Connect("item_edited", this, nameof(Signal_TreeItemEdited)); MainEditingArea = GetNode <Container>("MenuSeparator/Splitter/Main/PanelContainer"); var confirm = GetNode <ConfirmationDialog>("ConfirmNewProjectDialog"); confirm.Connect("confirmed", this, nameof(Signal_CreateNewProject_Pre)); var confirm2 = GetNode <ConfirmationDialog>("ConfirmOpenProjectDialog"); confirm2.Connect("confirmed", this, nameof(Signal_OpenProject_Pre)); var removal = GetNode <ConfirmationDialog>("PendingRemovalDialog"); removal.Connect("confirmed", this, nameof(Signal_PendingRemovalConfirm)); var createDir = GetNode <FileDialog>("NewProjectDirectoryDialog"); createDir.Connect("dir_selected", this, nameof(Signal_CreateNewProject_SelectedDirectory)); var open = GetNode <FileDialog>("OpenProjectDialog"); open.Connect("file_selected", this, nameof(Signal_OpenProject)); var import = GetNode <FileDialog>("ResourceImportDialog"); import.Connect("files_selected", this, nameof(Signal_ResourceImport_Multiple)); var export = GetNode <FileDialog>("ExportProjectDialog"); export.Connect("dir_selected", this, nameof(Signal_ExportProject)); var importPack = GetNode <FileDialog>("ImportPackDialog"); importPack.Connect("file_selected", this, nameof(Signal_ImportPack)); }