protected void OnMenuSelection() { int item = CtxMenu.current.selectedItem; MenuCommands cmd = (MenuCommands)item; switch (cmd) { case MenuCommands.Small: transform.localScale = new Vector3(0.7f, 0.7f, 0.7f); break; case MenuCommands.Medium: transform.localScale = Vector3.one; break; case MenuCommands.Large: transform.localScale = new Vector3(1.3f, 1.3f, 1.3f); break; case MenuCommands.ColorScheme1: case MenuCommands.ColorScheme2: case MenuCommands.ColorScheme3: case MenuCommands.ColorScheme4: case MenuCommands.ColorScheme5: { int cs = item - (int)MenuCommands.ColorScheme1; SaucerScene saucerScene = SaucerScene.Instance; SetColorScheme(saucerScene.hullMaterials[cs], saucerScene.glowMaterials[cs]); break; } } }
public HelpCommandsComponent(GUIController guiController, AGSEditor agsEditor) : base(guiController, agsEditor) { _guiController.RegisterIcon("MenuIconAbout", Resources.ResourceManager.GetIcon("menu_help_about-ags.ico")); _guiController.RegisterIcon("MenuIconHelpContents", Resources.ResourceManager.GetIcon("menu_help_content.ico")); _guiController.RegisterIcon("MenuIconDynamicHelp", Resources.ResourceManager.GetIcon("menu_help_dynamic-help.ico")); _guiController.RegisterIcon("MenuIconHelpIndex", Resources.ResourceManager.GetIcon("menu_help_index.ico")); _guiController.RegisterIcon("MenuIconCheckForUpdate", Resources.ResourceManager.GetIcon("menu_help_update.ico")); _guiController.RegisterIcon("MenuIconVisitForums", Resources.ResourceManager.GetIcon("menu_help_visit-forums.ico")); _guiController.RegisterIcon("MenuIconVisitWebsite", Resources.ResourceManager.GetIcon("menu_help_visit-site.ico")); _guiController.AddMenu(this, GUIController.HELP_MENU_ID, "&Help"); _guiController.OnLaunchHelp += new GUIController.LaunchHelpHandler(_guiController_OnLaunchHelp); MenuCommands commands = new MenuCommands(GUIController.HELP_MENU_ID, null); commands.Commands.Add(new MenuCommand(LAUNCH_HELP_COMMAND, "&Dynamic Help", Keys.F1, "MenuIconDynamicHelp")); commands.Commands.Add(new MenuCommand(HELP_CONTENTS_COMMAND, "&Contents", "MenuIconHelpContents")); commands.Commands.Add(new MenuCommand(HELP_INDEX_COMMAND, "&Index", "MenuIconHelpIndex")); commands.Commands.Add(MenuCommand.Separator); commands.Commands.Add(new MenuCommand(VISIT_AGS_WEBSITE, "Visit the AGS &Website", "MenuIconVisitWebsite")); commands.Commands.Add(new MenuCommand(VISIT_AGS_FORUMS, "Visit the AGS &Forums", "MenuIconVisitForums")); commands.Commands.Add(MenuCommand.Separator); commands.Commands.Add(new MenuCommand(CHECK_FOR_UPDATES, "Chec&k for Updates", "MenuIconCheckForUpdate")); _guiController.AddMenuItems(this, commands); commands = new MenuCommands(GUIController.HELP_MENU_ID, 1000); #if DEBUG commands.Commands.Add(new MenuCommand(CRASH_EDITOR_COMMAND, "Crash editor DEBUG ONLY")); #endif commands.Commands.Add(new MenuCommand(ABOUT_AGS_COMMAND, "&About AGS...", "MenuIconAbout")); _guiController.AddMenuItems(this, commands); _helpFileName = Path.Combine(_agsEditor.EditorDirectory, "ags-help.chm"); }
public RoomsComponent(GUIController guiController, AGSEditor agsEditor) : base(guiController, agsEditor) { _guiController.RegisterIcon("RoomsIcon", Resources.ResourceManager.GetIcon("room.ico")); _guiController.RegisterIcon(ROOM_ICON_UNLOADED, Resources.ResourceManager.GetIcon("room-item.ico")); _guiController.RegisterIcon(ROOM_ICON_LOADED, Resources.ResourceManager.GetIcon("roomsareas.ico")); _guiController.RegisterIcon("MenuIconSaveRoom", Resources.ResourceManager.GetIcon("menu_file_save-room.ico")); MenuCommands commands = new MenuCommands(GUIController.FILE_MENU_ID, 50); commands.Commands.Add(new MenuCommand(COMMAND_SAVE_ROOM, "Save Room", Keys.Control | Keys.R, "MenuIconSaveRoom")); _guiController.AddMenuItems(this, commands); _nativeProxy = Factory.NativeProxy; _guiController.ProjectTree.AddTreeRoot(this, TOP_LEVEL_COMMAND_ID, "Rooms", "RoomsIcon"); _guiController.OnZoomToFile += new GUIController.ZoomToFileHandler(GUIController_OnZoomToFile); _guiController.OnGetScript += new GUIController.GetScriptHandler(GUIController_OnGetScript); _guiController.OnScriptChanged += new GUIController.ScriptChangedHandler(GUIController_OnScriptChanged); _guiController.OnGetScriptEditorControl += new GUIController.GetScriptEditorControlHandler(_guiController_OnGetScriptEditorControl); _agsEditor.PreCompileGame += new AGSEditor.PreCompileGameHandler(AGSEditor_PreCompileGame); _agsEditor.PreSaveGame += new AGSEditor.PreSaveGameHandler(AGSEditor_PreSaveGame); _agsEditor.ProcessAllGameTexts += new AGSEditor.ProcessAllGameTextsHandler(AGSEditor_ProcessAllGameTexts); _agsEditor.PreDeleteSprite += new AGSEditor.PreDeleteSpriteHandler(AGSEditor_PreDeleteSprite); _modifiedChangedHandler = new Room.RoomModifiedChangedHandler(_loadedRoom_RoomModifiedChanged); RePopulateTreeView(); }
private void HandleFileMenuOption(object arg) { int option = (int)arg; switch (option) { case 0: EditorToolbox.OverwriteInputSettings(); break; case 1: EditorToolbox.CreateSnapshot(_inputManager); break; case 2: EditorToolbox.LoadSnapshot(_inputManager); break; case 3: MenuCommands.OpenForumPage(); break; case 4: MenuCommands.OpenAboutDialog(); break; } }
public BuildCommandsComponent(GUIController guiController, AGSEditor agsEditor) : base(guiController, agsEditor) { ScriptEditor.AttemptToEditScript += new ScriptEditor.AttemptToEditScriptHandler(ScriptEditor_AttemptToEditScript); _guiController.QueryEditorShutdown += new GUIController.QueryEditorShutdownHandler(guiController_QueryEditorShutdown); _guiController.InteractiveTasks.TestGameStarting += new InteractiveTasks.TestGameStartingHandler(AGSEditor_TestGameStarting); _guiController.InteractiveTasks.TestGameFinished += new InteractiveTasks.TestGameFinishedHandler(AGSEditor_TestGameFinished); _guiController.RegisterIcon("BuildIcon", Resources.ResourceManager.GetIcon("build.ico")); _guiController.RegisterIcon("RunIcon", Resources.ResourceManager.GetIcon("run.ico")); _guiController.RegisterIcon("StepIcon", Resources.ResourceManager.GetIcon("step.ico")); _guiController.RegisterIcon("StopIcon", Resources.ResourceManager.GetIcon("stop.ico")); _guiController.RegisterIcon("PauseIcon", Resources.ResourceManager.GetIcon("pause.ico")); _guiController.RegisterIcon("RunMenuIcon", Resources.ResourceManager.GetIcon("menu_build_run.ico")); _guiController.RegisterIcon("StepMenuIcon", Resources.ResourceManager.GetIcon("menu_build_step-into.ico")); _guiController.RegisterIcon("StopMenuIcon", Resources.ResourceManager.GetIcon("menu_build_stop.ico")); _guiController.RegisterIcon("PauseMenuIcon", Resources.ResourceManager.GetIcon("menu_build_pause.ico")); _guiController.RegisterIcon("RebuildAllMenuIcon", Resources.ResourceManager.GetIcon("menu_build_rebuild-files.ico")); _guiController.RegisterIcon("SetupGameMenuIcon", Resources.ResourceManager.GetIcon("menu_build_gamesetup.ico")); _guiController.RegisterIcon("MenuIconBuildEXE", Resources.ResourceManager.GetIcon("menu_file_built-exe.ico")); _guiController.RegisterIcon("MenuIconTest", Resources.ResourceManager.GetIcon("menu_build_runwithout.ico")); _guiController.AddMenu(this, DEBUG_MENU_ID, "&Build"); MenuCommands debugCommands = new MenuCommands(DEBUG_MENU_ID, GUIController.FILE_MENU_ID); debugCommands.Commands.Add(new MenuCommand(RUN_COMMAND, "&Run", Keys.F5, "RunMenuIcon")); debugCommands.Commands.Add(new MenuCommand(TEST_GAME_COMMAND, "Run without &debugger", Keys.Control | Keys.F5, "MenuIconTest")); debugCommands.Commands.Add(new MenuCommand(STEP_INTO_COMMAND, "S&tep into", Keys.F11, "StepMenuIcon")); debugCommands.Commands.Add(new MenuCommand(PAUSE_COMMAND, "&Pause", "PauseMenuIcon")); debugCommands.Commands.Add(new MenuCommand(STOP_COMMAND, "&Stop", Keys.Shift | Keys.F5, "StopMenuIcon")); debugCommands.Commands.Add(MenuCommand.Separator); debugCommands.Commands.Add(new MenuCommand(COMPILE_GAME_COMMAND, "&Build EXE", Keys.F7, "MenuIconBuildEXE")); debugCommands.Commands.Add(new MenuCommand(REBUILD_GAME_COMMAND, "Rebuild &all files", "RebuildAllMenuIcon")); debugCommands.Commands.Add(new MenuCommand(SETUP_GAME_COMMAND, "Run game setu&p...", "SetupGameMenuIcon")); _guiController.AddMenuItems(this, debugCommands); _guiController.SetMenuItemEnabled(this, STEP_INTO_COMMAND, false); _guiController.SetMenuItemEnabled(this, PAUSE_COMMAND, false); _guiController.SetMenuItemEnabled(this, STOP_COMMAND, false); MenuCommand buildIcon = new MenuCommand(COMPILE_GAME_COMMAND, "Build game EXE (F7)", "BuildIcon"); MenuCommand runIcon = new MenuCommand(RUN_COMMAND, "Run (F5)", "RunIcon"); MenuCommand stopIcon = new MenuCommand(STOP_COMMAND, "Stop", "StopIcon"); MenuCommand stepIcon = new MenuCommand(STEP_INTO_COMMAND, "Step into (F11)", "StepIcon"); MenuCommand pauseIcon = new MenuCommand(PAUSE_COMMAND, "Pause", "PauseIcon"); stepIcon.Enabled = false; stopIcon.Enabled = false; pauseIcon.Enabled = false; _debugToolbarCommands.Add(buildIcon); _debugToolbarCommands.Add(runIcon); _debugToolbarCommands.Add(pauseIcon); _debugToolbarCommands.Add(stepIcon); _debugToolbarCommands.Add(stopIcon); Factory.ToolBarManager.AddGlobalItems(this, _debugToolbarCommands); Factory.ToolBarManager.UpdateItemEnabledStates(_debugToolbarCommands); _agsEditor.Debugger.DebugStateChanged += new DebugController.DebugStateChangedHandler(Debugger_DebugStateChanged); _agsEditor.AttemptToSaveGame += new AGSEditor.AttemptToSaveGameHandler(_agsEditor_AttemptToSaveGame); }
/// <summary> /// Command-Type Menu click handler /// </summary> /// <param name="command"></param> void mainMenu1_MenuCommand(MenuCommands command) { switch (command) { case MenuCommands.ProgramRestart: this.Close(); Application.Exit(); break; case MenuCommands.ProgramEnd: this.Close(); Application.Exit(); break; case MenuCommands.POSRestart: break; case MenuCommands.POSEnd: break; case MenuCommands.PreviousMenu: if (mainMenu1.ModeSingleMenu) { this.Close(); } break; default: break; } }
/// <summary> /// Command-Type Menu click handler /// </summary> /// <param name="command"></param> void mainMenu1_MenuCommand(MenuCommands command) { switch (command) { case MenuCommands.ProgramRestart: OnProgramRestart(); this.Close(); break; case MenuCommands.ProgramEnd: this.Close(); break; case MenuCommands.POSRestart: //시스템 재시작 InitiateSystemShutdown("\\\\127.0.0.1", null, 0, false, true); break; case MenuCommands.POSEnd: //시스템 종료 InitiateSystemShutdown("\\\\127.0.0.1", null, 0, false, false); break; case MenuCommands.PreviousMenu: if (mainMenu1.ModeSingleMenu) { ShowLastHiddenForm(); GotoTopMenu(); } break; default: break; } }
/// <summary> /// Adds the command. /// </summary> /// <param name="commandName">Name of the command.</param> /// <param name="displayName">The display name.</param> /// <param name="description">The description.</param> /// <returns></returns> public VSMenuCommand AddCommand(string commandName, string displayName, string description) { VSMenuCommand vsCmd = new VSMenuCommand(this, commandName, displayName, description); MenuCommands.Add(vsCmd); return(vsCmd); }
public BuildCommandsComponent(GUIController guiController, AGSEditor agsEditor) : base(guiController, agsEditor) { ScriptEditor.AttemptToEditScript += new ScriptEditor.AttemptToEditScriptHandler(ScriptEditor_AttemptToEditScript); _guiController.QueryEditorShutdown += new GUIController.QueryEditorShutdownHandler(guiController_QueryEditorShutdown); _guiController.InteractiveTasks.TestGameStarting += new InteractiveTasks.TestGameStartingHandler(AGSEditor_TestGameStarting); _guiController.InteractiveTasks.TestGameFinished += new InteractiveTasks.TestGameFinishedHandler(AGSEditor_TestGameFinished); _guiController.RegisterIcon("BuildIcon", Resources.ResourceManager.GetIcon("build.ico")); _guiController.RegisterIcon("RunIcon", Resources.ResourceManager.GetIcon("run.ico")); _guiController.RegisterIcon("StepIcon", Resources.ResourceManager.GetIcon("step.ico")); _guiController.RegisterIcon("StopIcon", Resources.ResourceManager.GetIcon("stop.ico")); _guiController.RegisterIcon("PauseIcon", Resources.ResourceManager.GetIcon("pause.ico")); _guiController.RegisterIcon("RunMenuIcon", Resources.ResourceManager.GetIcon("menu_build_run.ico")); _guiController.RegisterIcon("StepMenuIcon", Resources.ResourceManager.GetIcon("menu_build_step-into.ico")); _guiController.RegisterIcon("StopMenuIcon", Resources.ResourceManager.GetIcon("menu_build_stop.ico")); _guiController.RegisterIcon("PauseMenuIcon", Resources.ResourceManager.GetIcon("menu_build_pause.ico")); _guiController.RegisterIcon("RebuildAllMenuIcon", Resources.ResourceManager.GetIcon("menu_build_rebuild-files.ico")); _guiController.RegisterIcon("SetupGameMenuIcon", Resources.ResourceManager.GetIcon("menu_build_gamesetup.ico")); _guiController.RegisterIcon("MenuIconBuildEXE", Resources.ResourceManager.GetIcon("menu_file_built-exe.ico")); _guiController.RegisterIcon("MenuIconTest", Resources.ResourceManager.GetIcon("menu_build_runwithout.ico")); _guiController.AddMenu(this, DEBUG_MENU_ID, "&Build"); MenuCommands debugCommands = new MenuCommands(DEBUG_MENU_ID, GUIController.FILE_MENU_ID); debugCommands.Commands.Add(new MenuCommand(RUN_COMMAND, "&Run", Keys.F5, "RunMenuIcon")); debugCommands.Commands.Add(new MenuCommand(TEST_GAME_COMMAND, "Run without &debugger", Keys.Control | Keys.F5, "MenuIconTest")); debugCommands.Commands.Add(new MenuCommand(STEP_INTO_COMMAND, "S&tep into", Keys.F11, "StepMenuIcon")); debugCommands.Commands.Add(new MenuCommand(PAUSE_COMMAND, "&Pause", "PauseMenuIcon")); debugCommands.Commands.Add(new MenuCommand(STOP_COMMAND, "&Stop", "StopMenuIcon")); debugCommands.Commands.Add(MenuCommand.Separator); debugCommands.Commands.Add(new MenuCommand(COMPILE_GAME_COMMAND, "&Build EXE", Keys.F7, "MenuIconBuildEXE")); debugCommands.Commands.Add(new MenuCommand(REBUILD_GAME_COMMAND, "Rebuild &all files", "RebuildAllMenuIcon")); debugCommands.Commands.Add(new MenuCommand(SETUP_GAME_COMMAND, "Run game setu&p...", "SetupGameMenuIcon")); _guiController.AddMenuItems(this, debugCommands); _guiController.SetMenuItemEnabled(this, STEP_INTO_COMMAND, false); _guiController.SetMenuItemEnabled(this, PAUSE_COMMAND, false); _guiController.SetMenuItemEnabled(this, STOP_COMMAND, false); MenuCommand buildIcon = new MenuCommand(COMPILE_GAME_COMMAND, "Build game EXE (F7)", "BuildIcon"); MenuCommand runIcon = new MenuCommand(RUN_COMMAND, "Run (F5)", "RunIcon"); MenuCommand stopIcon = new MenuCommand(STOP_COMMAND, "Stop", "StopIcon"); MenuCommand stepIcon = new MenuCommand(STEP_INTO_COMMAND, "Step into (F11)", "StepIcon"); MenuCommand pauseIcon = new MenuCommand(PAUSE_COMMAND, "Pause", "PauseIcon"); stepIcon.Enabled = false; stopIcon.Enabled = false; pauseIcon.Enabled = false; _debugToolbarCommands.Add(buildIcon); _debugToolbarCommands.Add(runIcon); _debugToolbarCommands.Add(pauseIcon); _debugToolbarCommands.Add(stepIcon); _debugToolbarCommands.Add(stopIcon); Factory.ToolBarManager.AddGlobalItems(this, _debugToolbarCommands); Factory.ToolBarManager.UpdateItemEnabledStates(_debugToolbarCommands); _agsEditor.Debugger.DebugStateChanged += new DebugController.DebugStateChangedHandler(Debugger_DebugStateChanged); _agsEditor.AttemptToSaveGame += new AGSEditor.AttemptToSaveGameHandler(_agsEditor_AttemptToSaveGame); }
public void RemoveMenuCommandGroup(MenuCommands commands) { if (_menuCommandGroups.ContainsKey(commands.MenuName)) { if (_menuCommandGroups[commands.MenuName].Contains(commands)) { _menuCommandGroups[commands.MenuName].Remove(commands); RefreshMenu(commands.MenuName); } } }
public void AddMenuCommandGroup(MenuCommands commands) { if (!_menuCommandGroups.ContainsKey(commands.MenuName)) { _menuCommandGroups.Add(commands.MenuName, new List <MenuCommands>()); } _menuCommandGroups[commands.MenuName].Add(commands); _menuCommandGroups[commands.MenuName].Sort(); RefreshMenu(commands.MenuName); }
public void AddMenuCommandGroup(MenuCommands commands) { if (!_menuCommandGroups.ContainsKey(commands.MenuName)) { _menuCommandGroups.Add(commands.MenuName, new List<MenuCommands>()); } _menuCommandGroups[commands.MenuName].Add(commands); _menuCommandGroups[commands.MenuName].Sort(); RefreshMenu(commands.MenuName); }
/// <summary> /// Is called by Visual Studio on demand. /// </summary> protected override void Initialize() { XLog.Init(); XContextMonitor.Init(this); Ide.Init(this); Persistence.Init(this); ServerManager.Init(this); MenuCommands.Initialize(this); ServerManager.Update(); base.Initialize(); }
//Словарь комманд открытия дилогов, ключи - имена свойств, вторые ключи - названия пунктов меню protected override void AddMenuCommands() { var m = new Dictionary <string, IMenuCommand>(); m.Add("Выбрать файл", new DialogCommand(DialogType.OpenFile) { DialogTitle = "Выбрать файл архива программы \"Пролог\"", ErrorMessage = "Указан недопустимый файл архива программы \"Пролог\"", FileTables = new[] { "NODES", "ABONENTS" } }); MenuCommands.Add("Db", m); }
public void OnMenuSelection(int item) { MenuCommands cmd = (MenuCommands)item; switch (cmd) { case MenuCommands.Small: transform.localScale = new Vector3(0.7f, 0.7f, 0.7f); break; case MenuCommands.Medium: transform.localScale = Vector3.one; break; case MenuCommands.Large: transform.localScale = new Vector3(1.3f, 1.3f, 1.3f); break; case MenuCommands.ColorSchemeMirage: case MenuCommands.ColorSchemeVineyard: case MenuCommands.ColorSchemeSunset: case MenuCommands.ColorSchemeHolly: case MenuCommands.ColorSchemeEmbers: { int cs = item - (int)MenuCommands.ColorSchemeMirage; SetColorScheme(hullMaterials[cs], glowMaterials[cs]); currentColorScheme = cmd; break; } case MenuCommands.ScoutBuzzAirliners: case MenuCommands.ScoutFlyInCircles: case MenuCommands.ScoutHoverAimlessly: case MenuCommands.AbductorAbductSpecimens: case MenuCommands.AbductorEraseMemory: case MenuCommands.AbductorUseProbeDevice: case MenuCommands.EnforcerAttackMilitary: case MenuCommands.EnforcerAttackCivilians: case MenuCommands.EnforcerDeployUltimateWeapon: case MenuCommands.TransportLandAtWhiteHouse: case MenuCommands.TransportDeployGrays: case MenuCommands.TransportRecoverGrays: case MenuCommands.SpyFakeAutopsy: case MenuCommands.SpyMakeCropCircles: case MenuCommands.SpyBuzzRadarTowers: Debug.Log("Saucer Command " + cmd.ToString()); break; } }
protected override void AddMenuCommands() { var m = new Dictionary <string, IMenuCommand>(); m.Add("Выбрать файл", new DialogCommand(DialogType.OpenFile) { DialogTitle = "Файл имитационных данных", ErrorMessage = "Указан недопустимый файл имитационных данных", FileTables = new[] { "SignalsValues", "SignalsBehavior" } }); MenuCommands.Add("ImitDataFile", m); }
//Задание комманд, вызываемых из меню protected override void AddMenuCommands() { var m = new Dictionary <string, IMenuCommand>(); m.Add("Выбрать файл", new DialogCommand(DialogType.OpenFile) { DialogTitle = "Файл архива результатов расчета", ErrorMessage = "Указан недопустимый файл архива", FileTables = new[] { "Projects", "Reports", "Params", "ReportParams", "Ranges", "SingleValues", "BaseValues", "HourValues", "DayValues" } }); MenuCommands.Add("DatabaseFile", m); }
protected void Update(MenuCommands cmd) { CurrentActionId = cmd; Action action = null; _actions.TryGetValue(cmd, out action); if (action != null) { action.Invoke(); } }
private void Attach() { // Cleanup previous menus MenuCommands.Clear(); foreach (ToolBarItem item in m_items) { string text = item.Text; if (text == string.Empty || text == null) { text = item.ToolTip; } if (item.Style == ToolBarItemStyle.Separator) { text = "-"; } // If this is a combobox if (item.ComboBox != null) { MenuCommands.Add(new MenuCommand(item.ComboBox)); item.ComboBox.Visible = true; // I know where this combobox comes from ComboBoxBase cbb = ( ComboBoxBase )item.ComboBox; cbb.ToolBarUse = false; continue; } Bitmap bmp = (item.Image != null) ? (Bitmap)item.Image : ((item.ImageIndex > -1) ? (Bitmap)item.ToolBar.ImageList.Images[item.ImageIndex] : null); EventHandler hndl = new EventHandler(RaiseItemClick); MenuCommand currentMenuCommand = new MenuCommand(text, bmp, (Shortcut)item.Shortcut, hndl, item); currentMenuCommand.Checked = item.Checked; currentMenuCommand.Enabled = item.Enabled; MenuCommands.Add(currentMenuCommand); // If we have a menubar if (item.MenuItems != null) { AddSubMenu(currentMenuCommand, item.MenuItems); } } }
/// <summary> /// init menu event /// </summary> /// <param name="command"></param> private static void InitMenu(MenuCommands command) { switch (command) { case MenuCommands.Undo: Undo(); break; case MenuCommands.Redo: Redo(); break; } }
public FileCommandsComponent(GUIController guiController, AGSEditor agsEditor) : base(guiController, agsEditor) { _guiController.InteractiveTasks.TestGameStarting += new InteractiveTasks.TestGameStartingHandler(AGSEditor_TestGameStarting); _guiController.InteractiveTasks.TestGameFinished += new InteractiveTasks.TestGameFinishedHandler(AGSEditor_TestGameFinished); _guiController.RegisterIcon("OpenIcon", Resources.ResourceManager.GetIcon("open.ico")); _guiController.RegisterIcon("SaveIcon", Resources.ResourceManager.GetIcon("save.ico")); _guiController.RegisterIcon("MenuIconAutoNumber", Resources.ResourceManager.GetIcon("menu_file_auto-number.ico")); _guiController.RegisterIcon("MenuIconExit", Resources.ResourceManager.GetIcon("menu_file_exit.ico")); _guiController.RegisterIcon("MenuIconMakeTemplate", Resources.ResourceManager.GetIcon("menu_file_make-template.ico")); _guiController.RegisterIcon("MenuIconOpen", Resources.ResourceManager.GetIcon("menu_file_open.ico")); _guiController.RegisterIcon("MenuIconPreferences", Resources.ResourceManager.GetIcon("menu_file_preferences.ico")); _guiController.RegisterIcon("MenuIconSave", Resources.ResourceManager.GetIcon("menu_file_save.ico")); _guiController.RegisterIcon("MenuIconStatistics", Resources.ResourceManager.GetIcon("menu_file_stats.ico")); _guiController.RegisterIcon("MenuIconVoiceActingScript", Resources.ResourceManager.GetIcon("menu_file_voicescript.ico")); _guiController.RegisterIcon("MenuIconGoToEventsGrid", Resources.ResourceManager.GetIcon("menu_file_eventsgrid.ico")); MenuCommands commands = new MenuCommands(GUIController.FILE_MENU_ID, 0); commands.Commands.Add(new MenuCommand(OPEN_GAME_COMMAND, "&Open...", Keys.Control | Keys.L, "MenuIconOpen")); commands.Commands.Add(new MenuCommand(SAVE_GAME_COMMAND, "&Save", Keys.Control | Keys.S, "MenuIconSave")); commands.Commands.Add(new MenuCommand(GAME_STATS_COMMAND, "&Game statistics", Keys.F2, "MenuIconStatistics")); commands.Commands.Add(new MenuCommand(JUMP_TO_EVENTS_TAB_COMMAND, "&Go to Events grid", Keys.F4, "MenuIconGoToEventsGrid")); _guiController.AddMenuItems(this, commands); commands = new MenuCommands(GUIController.FILE_MENU_ID, 100); commands.Commands.Add(new MenuCommand(MAKE_TEMPLATE_COMMAND, "&Make template from this game...", "MenuIconMakeTemplate")); commands.Commands.Add(new MenuCommand(AUTO_NUMBER_SPEECH_COMMAND, "&Auto-number speech lines...", "MenuIconAutoNumber")); commands.Commands.Add(new MenuCommand(CREATE_VOICE_ACTING_SCRIPT_COMMAND, "Create &voice acting script...", "MenuIconVoiceActingScript")); commands.Commands.Add(new MenuCommand(REMOVE_GLOBAL_MESSAGES_COMMAND, "&Remove Global Messages")); commands.Commands.Add(new MenuCommand(RECREATE_SPRITEFILE_COMMAND, "Restore all sprites from sources")); _guiController.AddMenuItems(this, commands); commands = new MenuCommands(GUIController.FILE_MENU_ID, 400); commands.Commands.Add(new MenuCommand(SHOW_PREFERENCES_COMMAND, "&Preferences...", "MenuIconPreferences")); _guiController.AddMenuItems(this, commands); commands = new MenuCommands(GUIController.FILE_MENU_ID, 9999); commands.Commands.Add(new MenuCommand(EXIT_COMMAND, "E&xit", Keys.Control | Keys.Q, "MenuIconExit")); _guiController.AddMenuItems(this, commands); MenuCommand openIcon = new MenuCommand(OPEN_GAME_COMMAND, "Open game (Ctrl+L)", "OpenIcon"); MenuCommand saveIcon = new MenuCommand(SAVE_GAME_COMMAND, "Save game (Ctrl+S)", "SaveIcon"); _toolbarCommands.Add(openIcon); _toolbarCommands.Add(saveIcon); Factory.ToolBarManager.AddGlobalItems(this, _toolbarCommands); }
/// <summary> /// Gets the next state if a given command/transition is run /// </summary> /// <param name="command">The command (or transition) to run</param> /// <returns></returns> MenuStates GetNext(MenuCommands command) { //Construct the new transition based on the machines current state, and the supplied transition/command MenuTransitions newTransition = new MenuTransitions(CurrentState, command); //Location to store the new state for the machine to go into MenuStates newState; //Make sure that the transition is valid, using the dictionary lookup if (!allTransitions.TryGetValue(newTransition, out newState)) { throw new UnityException("Invalid transition " + CurrentState + " -> " + command); } //If at this point we have not broken anything, return the new state return(newState); }
public FileCommandsComponent(GUIController guiController, AGSEditor agsEditor) : base(guiController, agsEditor) { _guiController.InteractiveTasks.TestGameStarting += new InteractiveTasks.TestGameStartingHandler(AGSEditor_TestGameStarting); _guiController.InteractiveTasks.TestGameFinished += new InteractiveTasks.TestGameFinishedHandler(AGSEditor_TestGameFinished); _guiController.RegisterIcon("OpenIcon", Resources.ResourceManager.GetIcon("open.ico")); _guiController.RegisterIcon("SaveIcon", Resources.ResourceManager.GetIcon("save.ico")); _guiController.RegisterIcon("MenuIconAutoNumber", Resources.ResourceManager.GetIcon("menu_file_auto-number.ico")); _guiController.RegisterIcon("MenuIconExit", Resources.ResourceManager.GetIcon("menu_file_exit.ico")); _guiController.RegisterIcon("MenuIconMakeTemplate", Resources.ResourceManager.GetIcon("menu_file_make-template.ico")); _guiController.RegisterIcon("MenuIconOpen", Resources.ResourceManager.GetIcon("menu_file_open.ico")); _guiController.RegisterIcon("MenuIconPreferences", Resources.ResourceManager.GetIcon("menu_file_preferences.ico")); _guiController.RegisterIcon("MenuIconSave", Resources.ResourceManager.GetIcon("menu_file_save.ico")); _guiController.RegisterIcon("MenuIconStatistics", Resources.ResourceManager.GetIcon("menu_file_stats.ico")); _guiController.RegisterIcon("MenuIconVoiceActingScript", Resources.ResourceManager.GetIcon("menu_file_voicescript.ico")); _guiController.RegisterIcon("MenuIconGoToEventsGrid", Resources.ResourceManager.GetIcon("menu_file_eventsgrid.ico")); MenuCommands commands = new MenuCommands(GUIController.FILE_MENU_ID, 0); commands.Commands.Add(new MenuCommand(OPEN_GAME_COMMAND, "&Open...", Keys.Control | Keys.L, "MenuIconOpen")); commands.Commands.Add(new MenuCommand(SAVE_GAME_COMMAND, "&Save", Keys.Control | Keys.S, "MenuIconSave")); commands.Commands.Add(new MenuCommand(GAME_STATS_COMMAND, "&Game statistics", Keys.F2, "MenuIconStatistics")); commands.Commands.Add(new MenuCommand(JUMP_TO_EVENTS_TAB_COMMAND, "&Go to Events grid", Keys.F4, "MenuIconGoToEventsGrid")); _guiController.AddMenuItems(this, commands); commands = new MenuCommands(GUIController.FILE_MENU_ID, 100); commands.Commands.Add(new MenuCommand(MAKE_TEMPLATE_COMMAND, "&Make template from this game...", "MenuIconMakeTemplate")); commands.Commands.Add(new MenuCommand(AUTO_NUMBER_SPEECH_COMMAND, "&Auto-number speech lines...", "MenuIconAutoNumber")); commands.Commands.Add(new MenuCommand(CREATE_VOICE_ACTING_SCRIPT_COMMAND, "Create &voice acting script...", "MenuIconVoiceActingScript")); commands.Commands.Add(new MenuCommand(REMOVE_GLOBAL_MESSAGES_COMMAND, "&Remove Global Messages")); _guiController.AddMenuItems(this, commands); commands = new MenuCommands(GUIController.FILE_MENU_ID, 400); commands.Commands.Add(new MenuCommand(SHOW_PREFERENCES_COMMAND, "&Preferences...", "MenuIconPreferences")); _guiController.AddMenuItems(this, commands); commands = new MenuCommands(GUIController.FILE_MENU_ID, 9999); commands.Commands.Add(new MenuCommand(EXIT_COMMAND, "E&xit", Keys.Control | Keys.Q, "MenuIconExit")); _guiController.AddMenuItems(this, commands); MenuCommand openIcon = new MenuCommand(OPEN_GAME_COMMAND, "Open game (Ctrl+L)", "OpenIcon"); MenuCommand saveIcon = new MenuCommand(SAVE_GAME_COMMAND, "Save game (Ctrl+S)", "SaveIcon"); _toolbarCommands.Add(openIcon); _toolbarCommands.Add(saveIcon); Factory.ToolBarManager.AddGlobalItems(this, _toolbarCommands); }
private void Navigate(MenuCommands command) { // Implement your view switching logic here, like: switch (command) { case MenuCommands.NEXT_PAGE: // CurrentView = new SomeOtherViewModel ( ); break; case MenuCommands.PREVIOUS_PAGE: // CurrentView = new SomeOtherViewModel ( ); break; default: break; } }
private void AllowPluginsToModifyContextMenu(string nodeID, IList <MenuCommand> commands, IEditorComponent component) { if (BeforeShowContextMenu != null) { MenuCommands menuCommands = new MenuCommands(commands); BeforeShowContextMenu(new BeforeShowContextMenuEventArgs(nodeID, component, menuCommands)); foreach (MenuCommand command in commands) { if (!command.IsSeparator) { if (!Factory.GUIController.CanFindComponentFromMenuItemID(command.ID)) { throw new AGSEditorException("A plugin or event handler has not used GUIController.CreateMenuCommand to create its menu command (ID '" + command.ID + "')"); } } } } }
/// <summary> /// Constructor /// </summary> /// <param name="position">The position of the item on the screen.</param> /// <param name="text">The text of this item.</param> /// <param name="hasSubmenu">Whether or not this item has a menu below it to navigate to.</param> /// <param name="textBuffer">An amount to displace the text past the start of the item (to center with backgrounds)</param> /// <param name="centerItem">Whether or not to center the item around the position.</param> /// <param name="highlightable">Whether or not this item is highlightable</param> /// <param name="command">The command to have this item return</param> /// <param name="americaText">Makes the text great again</param> /// <param name="deferAudio">Whther or not to play the audio of the MenuItem above this one</param> public MenuItem(WorldUnit position, string text, bool hasSubmenu, WorldUnit textBuffer, bool highlightable, bool centerItem = false, MenuCommands command = MenuCommands.Nothing, bool americaText = false, bool deferAudio = true) { Position = position; Text = text; HasSubmenu = hasSubmenu; TextBuffer = textBuffer; Highlightable = highlightable; CenterItem = centerItem; Command = command; Texture = null; AmericanPositions = new List <Vector2>(); ContainedItems = new List <MenuItem>(); DrawDown = -1; AmericaText = americaText; AmericanCounter = 0; DeferAudio = deferAudio; }
public ScriptsComponent(GUIController guiController, AGSEditor agsEditor) : base(guiController, agsEditor, SCRIPTS_COMMAND_ID) { _panelClosedHandler = new EventHandler(Script_PanelClosed); _timer = new Timer(); _timer.Interval = 10; _timer.Tick += new EventHandler(timer_Tick); _editors = new Dictionary <Script, ContentDocument>(); _guiController.RegisterIcon(ICON_KEY, Resources.ResourceManager.GetIcon("script.ico")); _guiController.RegisterIcon("ScriptsIcon", Resources.ResourceManager.GetIcon("scripts.ico")); _guiController.RegisterIcon("CutIcon", Resources.ResourceManager.GetIcon("cut.ico")); _guiController.RegisterIcon("CopyIcon", Resources.ResourceManager.GetIcon("copy.ico")); _guiController.RegisterIcon("PasteIcon", Resources.ResourceManager.GetIcon("paste.ico")); _guiController.RegisterIcon("UndoIcon", Resources.ResourceManager.GetIcon("undo.ico")); _guiController.RegisterIcon("RedoIcon", Resources.ResourceManager.GetIcon("redo.ico")); _guiController.RegisterIcon("CutMenuIcon", Resources.ResourceManager.GetIcon("menu_edit_cut.ico")); _guiController.RegisterIcon("CopyMenuIcon", Resources.ResourceManager.GetIcon("menu_edit_copy.ico")); _guiController.RegisterIcon("PasteMenuIcon", Resources.ResourceManager.GetIcon("menu_edit_paste.ico")); _guiController.RegisterIcon("UndoMenuIcon", Resources.ResourceManager.GetIcon("menu_edit_undo.ico")); _guiController.RegisterIcon("RedoMenuIcon", Resources.ResourceManager.GetIcon("menu_edit_redo.ico")); _guiController.RegisterIcon("FindMenuIcon", Resources.ResourceManager.GetIcon("find.ico")); _guiController.RegisterIcon("FindNextMenuIcon", Resources.ResourceManager.GetIcon("findnext.ico")); _guiController.RegisterIcon("ShowAutocompleteMenuIcon", Resources.ResourceManager.GetIcon("showautocomplete.ico")); _guiController.RegisterIcon("ToggleBreakpointMenuIcon", Resources.ResourceManager.GetIcon("togglebreakpoint.ico")); _guiController.RegisterIcon("MenuIconGlobalScript", Resources.ResourceManager.GetIcon("menu_file_glscript-asc.ico")); _guiController.RegisterIcon("MenuIconGlobalHeader", Resources.ResourceManager.GetIcon("menu_file_glscript-ash.ico")); MenuCommands commands = new MenuCommands(GUIController.FILE_MENU_ID, 250); commands.Commands.Add(new MenuCommand(COMMAND_OPEN_GLOBAL_HEADER, "Open GlobalS&cript.ash", Keys.Control | Keys.Shift | Keys.H, "MenuIconGlobalHeader")); commands.Commands.Add(new MenuCommand(COMMAND_OPEN_GLOBAL_SCRIPT, "Open Glo&balScript.asc", Keys.Control | Keys.Shift | Keys.G, "MenuIconGlobalScript")); _guiController.AddMenuItems(this, commands); _guiController.ProjectTree.AddTreeRoot(this, TOP_LEVEL_COMMAND_ID, "Scripts", "ScriptsIcon"); RePopulateTreeView(null); _guiController.OnZoomToFile += new GUIController.ZoomToFileHandler(GUIController_OnZoomToFile); _guiController.OnGetScript += new GUIController.GetScriptHandler(GUIController_OnGetScript); _guiController.OnScriptChanged += new GUIController.ScriptChangedHandler(GUIController_OnScriptChanged); _guiController.OnGetScriptEditorControl += new GUIController.GetScriptEditorControlHandler(_guiController_OnGetScriptEditorControl); _guiController.ProjectTree.OnAfterLabelEdit += new ProjectTree.AfterLabelEditHandler(ProjectTree_OnAfterLabelEdit); }
//Словарь комманд открытия дилогов, ключи - имена свойств, вторые ключи - названия пунктов меню protected override void AddMenuCommands() { var m = new Dictionary <string, IMenuCommand>(); m.Add("Выбрать файл", new DialogCommand(DialogType.OpenFile) { DialogTitle = "Выбрать" + _cloneFileType, ErrorMessage = "Указан недопустимый" + _cloneFileType, FileTables = new[] { "Objects", "Signals", "MomentsValues" } }); if (IsHandInput) { m.Add("Создать файл", new DialogCommand(DialogType.CreateFile) { DialogTitle = "Создание файла значений ручного ввода", TemplateFile = General.GeneralDir + "CloneTemplate.accdb" }); } MenuCommands.Add("CloneFile", m); }
public ScriptsComponent(GUIController guiController, AGSEditor agsEditor) : base(guiController, agsEditor) { _panelClosedHandler = new EventHandler(Script_PanelClosed); _timer = new Timer(); _timer.Interval = 10; _timer.Tick += new EventHandler(timer_Tick); _editors = new Dictionary<Script, ContentDocument>(); _guiController.RegisterIcon("ScriptIcon", Resources.ResourceManager.GetIcon("script.ico")); _guiController.RegisterIcon("ScriptsIcon", Resources.ResourceManager.GetIcon("scripts.ico")); _guiController.RegisterIcon("CutIcon", Resources.ResourceManager.GetIcon("cut.ico")); _guiController.RegisterIcon("CopyIcon", Resources.ResourceManager.GetIcon("copy.ico")); _guiController.RegisterIcon("PasteIcon", Resources.ResourceManager.GetIcon("paste.ico")); _guiController.RegisterIcon("UndoIcon", Resources.ResourceManager.GetIcon("undo.ico")); _guiController.RegisterIcon("RedoIcon", Resources.ResourceManager.GetIcon("redo.ico")); _guiController.RegisterIcon("CutMenuIcon", Resources.ResourceManager.GetIcon("menu_edit_cut.ico")); _guiController.RegisterIcon("CopyMenuIcon", Resources.ResourceManager.GetIcon("menu_edit_copy.ico")); _guiController.RegisterIcon("PasteMenuIcon", Resources.ResourceManager.GetIcon("menu_edit_paste.ico")); _guiController.RegisterIcon("UndoMenuIcon", Resources.ResourceManager.GetIcon("menu_edit_undo.ico")); _guiController.RegisterIcon("RedoMenuIcon", Resources.ResourceManager.GetIcon("menu_edit_redo.ico")); _guiController.RegisterIcon("FindMenuIcon", Resources.ResourceManager.GetIcon("find.ico")); _guiController.RegisterIcon("FindNextMenuIcon", Resources.ResourceManager.GetIcon("findnext.ico")); _guiController.RegisterIcon("ShowAutocompleteMenuIcon", Resources.ResourceManager.GetIcon("showautocomplete.ico")); _guiController.RegisterIcon("ToggleBreakpointMenuIcon", Resources.ResourceManager.GetIcon("togglebreakpoint.ico")); _guiController.RegisterIcon("MenuIconGlobalScript", Resources.ResourceManager.GetIcon("menu_file_glscript-asc.ico")); _guiController.RegisterIcon("MenuIconGlobalHeader", Resources.ResourceManager.GetIcon("menu_file_glscript-ash.ico")); MenuCommands commands = new MenuCommands(GUIController.FILE_MENU_ID, 250); commands.Commands.Add(new MenuCommand(COMMAND_OPEN_GLOBAL_HEADER, "Open GlobalS&cript.ash", Keys.Control | Keys.H, "MenuIconGlobalHeader")); commands.Commands.Add(new MenuCommand(COMMAND_OPEN_GLOBAL_SCRIPT, "Open Glo&balScript.asc", Keys.Control | Keys.G, "MenuIconGlobalScript")); _guiController.AddMenuItems(this, commands); _guiController.ProjectTree.AddTreeRoot(this, ROOT_COMMAND, "Scripts", "ScriptsIcon"); RePopulateTreeView(null); _guiController.OnZoomToFile += new GUIController.ZoomToFileHandler(GUIController_OnZoomToFile); _guiController.OnGetScript += new GUIController.GetScriptHandler(GUIController_OnGetScript); _guiController.OnScriptChanged += new GUIController.ScriptChangedHandler(GUIController_OnScriptChanged); _guiController.OnGetScriptEditorControl += new GUIController.GetScriptEditorControlHandler(_guiController_OnGetScriptEditorControl); _guiController.ProjectTree.OnAfterLabelEdit += new ProjectTree.AfterLabelEditHandler(ProjectTree_OnAfterLabelEdit); }
private MenuCommands GetExtraMenu() { MenuCommands menu; menu = new MenuCommands("&Edit", "fileToolStripMenuItem"); menu.Commands.Add(CreateMenuCommand(ID_MENU_EDIT_UNDO, "&Undo", Keys.Control | Keys.Z, "UndoMenuIcon")); /* * menu.Commands.Add(new MenuCommand(ID_MENU_EDIT_UNDO, "&Undo", Keys.Control | Keys.Z, "UndoMenuIcon")); * menu.Commands.Add(new MenuCommand(ID_MENU_EDIT_REDO, "&Redo", Keys.Control | Keys.Y, "RedoMenuIcon")); * menu.Commands.Add(MenuCommand.Separator); * menu.Commands.Add(new MenuCommand(ID_MENU_EDIT_CUT, "Cu&t", Keys.Control | Keys.X, "CutMenuIcon")); * menu.Commands.Add(new MenuCommand(ID_MENU_EDIT_COPY, "&Copy", Keys.Control | Keys.C, "CopyMenuIcon")); * menu.Commands.Add(new MenuCommand(ID_MENU_EDIT_PASTE, "&Paste", Keys.Control | Keys.V, "PasteMenuIcon")); * menu.Commands.Add(MenuCommand.Separator); * menu.Commands.Add(new MenuCommand(ID_MENU_EDIT_FIND, "&Find...", Keys.Control | Keys.F, "FindMenuIcon")); */ return(menu); }
static void Main(string[] args) { //Test Data - Hard coded Create New Data SeedCommands.CreateSeedData(); //Menu bool exitMainMenu = false; while (exitMainMenu == false) { Console.WriteLine("Main Menu: c (create record), r (read record), u (update record), d (delete record), or e (exit menu): "); string choice = Console.ReadLine(); switch (choice) { case "c": MenuCommands.CreateRecord(); break; case "r": MenuCommands.ReadRecord(); break; case "u": MenuCommands.UpdateRecord(); break; case "d": MenuCommands.DeleteRecord(); break; case "e": exitMainMenu = true; break; default: Console.WriteLine("Invalid choice. Try again."); break; } } }
void Attach() { // Cleanup previous menus MenuCommands.Clear(); foreach (ToolBarItem item in items) { string text = item.Text; if (text == string.Empty || text == null) { text = item.ToolTip; } if (item.Style == ToolBarItemStyle.Separator) { text = "-"; } // If this is a combobox if (item.ComboBox != null) { MenuCommands.Add(new MenuCommand(item.ComboBox)); item.ComboBox.Visible = true; // I know where this combobox comes from ComboBoxBase cbb = (ComboBoxBase)item.ComboBox; cbb.ToolBarUse = false; continue; } MenuCommand currentMenuCommand = new MenuCommand(text, (Bitmap)item.Image, (Shortcut)item.Shortcut, item.ClickHandler, item); MenuCommands.Add(currentMenuCommand); // If we have a menubar if (item.MenuItems != null) { AddSubMenu(currentMenuCommand, item.MenuItems); } } }
private void SelectMenu(MenuData data) { if (data.MenuType == MenuType.Menu) { var menus = GotoMenu(data); if (menus == null || menus.Length == 0) { return; } RenderSubMenus(data, menus); return; } else if (data.MenuType == MenuType.MenuCommand) { MenuCommands command = (MenuCommands)Enum.Parse(typeof(MenuCommands), data.MenuClass); if (!this.ModeSingleMenu && command == MenuCommands.PreviousMenu) { MenuData parentMenu = null; var menus = NavigateBack(data, out parentMenu); RenderSubMenus(parentMenu, menus); } else { if (MenuCommand != null) { this.MenuCommand(command); } } } else { if (MenuClicked != null) { this.MenuClicked(data); } } }
//Задание комманд, вызываемых из меню protected override void AddMenuCommands() { var m = new Dictionary <string, IMenuCommand>(); m.Add("Выбрать файл", new DialogCommand(DialogType.OpenFile) { DialogTitle = "Файл архива результатов расчета", ErrorMessage = "Указан недопустимый файл архива", FileTables = new[] { "Projects", "Reports", "Params", "ReportParams", "Ranges", "SingleValues", "BaseValues" } }); m.Add("Создать архив", new DialogCommand(DialogType.CreateFile) { DialogTitle = "Создание нового файла архива результатов", TemplateFile = Different.GetInfoTaskDir() + @"Providers\Archives\CalcArchiveTemplate.accdb" }); MenuCommands.Add("DatabaseFile", m); m = new Dictionary <string, IMenuCommand>(); m.Add("Выбрать каталог", new DialogCommand(DialogType.OpenDir) { DialogTitle = "Каталог для резервных копий архива" }); MenuCommands.Add("ReserveDir", m); }
/// <summary> /// Gets the next state if a given command/transition is run /// </summary> /// <param name="command">The command (or transition) to run</param> /// <returns></returns> MenuStates GetNext(MenuCommands command) { //Construct the new transition based on the machines current state, and the supplied transition/command MenuTransitions newTransition = new MenuTransitions (CurrentState, command); //Location to store the new state for the machine to go into MenuStates newState; //Make sure that the transition is valid, using the dictionary lookup if (!allTransitions.TryGetValue(newTransition, out newState)) throw new UnityException("Invalid transition " + CurrentState + " -> " + command); //If at this point we have not broken anything, return the new state return newState; }
public LuaForAGSEditorComponent(IAGSEditor editor) { main_L = InvokeLua.luaL_newstate(); InvokeLua.lua_atpanic(main_L, InvokeLua.ExceptionPanicHandler); this.editor = editor; editor.GUIController.RegisterIcon("LuaIcon", GetIcon("lua.ico")); editor.GUIController.RegisterIcon("LuaGreyIcon", GetIcon("luagrey.ico")); editor.GUIController.RegisterIcon("CogIcon", GetIcon("cog.ico")); editor.GUIController.RegisterIcon("EmptyIcon", GetIcon("empty.ico")); editor.GUIController.RegisterIcon("silk:table", GetIcon("table.ico")); editor.GUIController.RegisterIcon("silk:world", GetIcon("world.ico")); editor.GUIController.RegisterIcon("silk:wrench", GetIcon("wrench.ico")); editor.GUIController.RegisterIcon("silk:textfield", GetIcon("textfield.ico")); editor.GUIController.RegisterIcon("silk:contrast", GetIcon("contrast.ico")); editor.GUIController.RegisterIcon("silk:page_white_lightning", GetIcon("page_white_lightning.ico")); editor.GUIController.ProjectTree.AddTreeRoot(this, CONTROL_ID_LUA, "Lua", "LuaIcon"); editor.GUIController.AddMenu(this, LUA_MENU, "Lua", editor.GUIController.FileMenuID); MenuCommands newCommands = new MenuCommands(LUA_MENU); newCommands.Commands.Add(new MenuCommand(LUA_CONVERT_MENUOPTION, "Open Code Converter...")); editor.GUIController.AddMenuItems(this, newCommands); IsPluginEnabled = false; globalsTable = new VisualLuaTableValue(this, VISUAL_ROOT); globalsTable.Name = "_G"; globalsTable.IsGlobalScope = true; codeConvertPane = new CodeConvertPane(editor); codeConvertContentDoc = new ContentDocument(codeConvertPane, "Convert AGS->Lua Script", this); }
/// <summary> /// Gets the next state if a given command/transition is run /// </summary> /// <param name="command">The command (or transition) to run</param> /// <returns></returns> MenuStates GetNext(MenuCommands command) { MenuTransitions newTransition = new MenuTransitions(CurrentState, command); MenuStates newState; if (!allTransitions.TryGetValue(newTransition, out newState)) { throw new UnityException("Invalid Transition" + CurrentState + "-->" + command); } return newState; }
/// <summary> /// Gets the next state if a given command/transition is run /// </summary> /// <param name="command">The command (or transition) to run</param> /// <returns></returns> MenuStates GetNext(MenuCommands command) { //Construct the new transition based on the machines current state, and the supplied transition/command //Location to store the new state for the machine to go into //Make sure that the transition is valid, using the dictionary lookup //If at this point we have not broken anything, return the new state }
public MenuTransitions(MenuStates thisState, MenuCommands thisCommand) { currentState = thisState; command = thisCommand; }
private void AllowPluginsToModifyContextMenu(string nodeID, IList<MenuCommand> commands, IEditorComponent component) { if (BeforeShowContextMenu != null) { MenuCommands menuCommands = new MenuCommands(commands); BeforeShowContextMenu(new BeforeShowContextMenuEventArgs(nodeID, component, menuCommands)); foreach (MenuCommand command in commands) { if (!command.IsSeparator) { if (!Factory.GUIController.CanFindComponentFromMenuItemID(command.ID)) { throw new AGSEditorException("A plugin or event handler has not used GUIController.CreateMenuCommand to create its menu command (ID '" + command.ID + "')"); } } } } }
public void RemoveMenuItems(MenuCommands commands) { _menuManager.RemoveMenuCommandGroup(commands); }
public void AddMenuItems(IEditorComponent plugin, MenuCommands commands) { if (commands.Commands.Count > 0) { foreach (MenuCommand command in commands.Commands) { if (command.ID != null) { RegisterMenuCommand(command.ID, plugin); } command.IDPrefix = plugin.ComponentID + CONTROL_ID_SPLIT; } _menuManager.AddMenuCommandGroup(commands); } }
public BeforeShowContextMenuEventArgs(string nodeId, IEditorComponent component, MenuCommands menuCommands) { _component = component; _menuCommands = menuCommands; _nodeId = nodeId; }
void OnGUI() { //-----------------GET PLAYER COMMAND AND THE POSITION OF THE BUTTON CLICKED-----------// if (isColonyButton) { boxStartLeftCoordinate = 130; command = MenuCommands.Colony; } else if (isBuildingButton) { boxStartLeftCoordinate = 170; command = MenuCommands.Building; } else if (isMachinesButton) { boxStartLeftCoordinate = 210; command = MenuCommands.Machines; } else if (isResourcesButton) { boxStartLeftCoordinate = 250; command = MenuCommands.Resources; } else if (isBudgetButton) { boxStartLeftCoordinate = 290; command = MenuCommands.Budget; } else if (isEconomyButton) { boxStartLeftCoordinate = 330; command = MenuCommands.Economy; } else if (isEarthButton) { boxStartLeftCoordinate = 370; command = MenuCommands.Earth; } else if (isSettingsButton) { boxStartLeftCoordinate = 460; command = MenuCommands.Settings; } else if (isHelpButton) { boxStartLeftCoordinate = 500; command = MenuCommands.Help; } else if (isCloseButton) { boxStartLeftCoordinate = 540; command = MenuCommands.Close; } //-------------------SET TOP BUTTONS IN IN-GAME MENU FRAME AND MARK/UNMARK THE BUTTON------------------// GUIStyle buttonStyle = new GUIStyle(); buttonStyle.normal.background = null; if (GUI.Button(new Rect(boxStartLeftCoordinate, 25, 30, 30), buildTexture,buttonStyle)) { this.audio.Play(); if (command == MenuCommands.Colony) { if (showColonySubMenu) { showColonySubMenu = false; } else { showColonySubMenu = true; } } if (command == MenuCommands.Building) { if (showBuildingSubMenu) { showBuildingSubMenu = false; } else { showBuildingSubMenu = true; } } if (command == MenuCommands.Machines) { if (showMachinesSubMenu) { showMachinesSubMenu = false; } else { showMachinesSubMenu = true; } } if (command == MenuCommands.Resources) { if (showResourcesSubMenu) { showResourcesSubMenu = false; } else { showResourcesSubMenu = true; } } if (command == MenuCommands.Budget) { if (showBudgetSubMenu) { showBudgetSubMenu = false; } else { showBudgetSubMenu = true; } } if (command == MenuCommands.Economy) { if (showEconomySubMenu) { showEconomySubMenu = false; } else { showEconomySubMenu = true; } } if (command == MenuCommands.Earth) { if (showEarthSubMenu) { showEarthSubMenu = false; } else { showEarthSubMenu = true; } } if (command == MenuCommands.Settings) { if (showSettingsSubMenu) { showSettingsSubMenu = false; } else { showSettingsSubMenu = true; } } if (command == MenuCommands.Help) { if (showHelpSubMenu) { showHelpSubMenu = false; } else { showHelpSubMenu = true; } } if (command == MenuCommands.Close) { if (showCloseSubMenu) { showCloseSubMenu = false; } else { showCloseSubMenu = true; } } } //--------------------GET THE BOX BELOW CLICKED BUTTON--------------------// GUIStyle removeBackground = new GUIStyle(); removeBackground.normal.background = null; string loremIpsum = @"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nam cursus. Morbi ut mi. Nullam enim leo, egestas id, condimentum at,laoreet mattis, massa. Sed eleifend nonummy diam. Praesent mauris ante,elementum et, bibendum at, posuere sit amet, nibh. Duis tincidunt lectus quis dui viverra vestibulum. Suspendisse vulputate aliquam dui. Nullaelementum dui ut augue. Aliquam vehicula mi at mauris. Maecenas placerat,nisl at consequat rhoncus, sem nunc gravida justo, quis eleifend arcu velitquis lacus. Morbi magna magna, tincidunt a, mattis non, imperdiet vitae, tellus.Sed odio est, auctor ac, sollicitudin in, consequat vitae, orci. Fusce idfelis. Vivamus sollicitudin metus eget eros."; if (showColonySubMenu) // TODO when open one submenu close others && !showBuildingSubMenu && !showMachinesSubMenu && !showResourcesSubMenu && !showBudgetSubMenu && !showEconomySubMenu && !showEarthSubMenu && !showSettingsSubMenu && !showHelpSubMenu && !showCloseSubMenu) //does not work...else if doesn not work too wtf!? { //showBuildingSubMenu = false; GUI.Box(new Rect(65, 100, 845, 585), string.Empty); GUI.Box(new Rect(97, 65, topBoxTexture.width - 250, topBoxTexture.height - 200), topBoxTexture, removeBackground); scrollViewVector = GUI.BeginScrollView(new Rect(65, 130, 840, 555), scrollViewVector, new Rect(0, 0, 800, 1500)); GUI.Box(new Rect(30, 0, 200, 200), CommandCenterTexture, removeBackground); GUI.Box(new Rect(30, 210, 200, 200), RafineryTexture, removeBackground); GUI.Box(new Rect(30, 420, 200, 200), HangarTexture, removeBackground); GUI.Box(new Rect(30, 630, 200, 200), SiloTexture, removeBackground); GUI.Box(new Rect(30, 840, 200, 200), MineTexture, removeBackground); GUI.Box(new Rect(30, 1050, 200, 200), UnitsFactoryTexture, removeBackground); GUI.Box(new Rect(30, 1260, 200, 200), PowerPlantTexture, removeBackground); GUIStyle boxStyle = new GUIStyle(); boxStyle.wordWrap = true; boxStyle.normal.textColor = Color.white; boxStyle.normal.background = BackgroundUnitInfo; boxStyle.padding = new RectOffset(10, 10, 10, 10); boxStyle.alignment = new TextAnchor(); GUI.Box(new Rect(240, 0, 580, 200), loremIpsum, boxStyle); GUI.Box(new Rect(240, 210, 580, 200), loremIpsum, boxStyle); GUI.Box(new Rect(240, 420, 580, 200), loremIpsum, boxStyle); GUI.Box(new Rect(240, 630, 580, 200), loremIpsum, boxStyle); GUI.Box(new Rect(240, 840, 580, 200), loremIpsum, boxStyle); GUI.Box(new Rect(240, 1050, 580, 200), loremIpsum, boxStyle); GUI.Box(new Rect(240, 1260, 580, 200), loremIpsum, boxStyle); GUI.EndScrollView(); } else if (showBuildingSubMenu) { GUI.Box(new Rect(65, 100, 845, 585), string.Empty); GUI.Box(new Rect(137, 65, topBoxTexture.width - 250, topBoxTexture.height - 200), topBoxTexture, removeBackground); } else if (showMachinesSubMenu) { GUI.Box(new Rect(65, 100, 845, 585), string.Empty); GUI.Box(new Rect(177, 65, topBoxTexture.width - 250, topBoxTexture.height - 200), topBoxTexture, removeBackground); } else if (showResourcesSubMenu) { GUI.Box(new Rect(65, 100, 845, 585), string.Empty); GUI.Box(new Rect(217, 65, topBoxTexture.width - 250, topBoxTexture.height - 200), topBoxTexture, removeBackground); } else if (showBudgetSubMenu) { GUI.Box(new Rect(65, 100, 845, 585), string.Empty); GUI.Box(new Rect(257, 65, topBoxTexture.width - 250, topBoxTexture.height - 200), topBoxTexture, removeBackground); } else if (showEconomySubMenu) { GUI.Box(new Rect(65, 100, 845, 585), string.Empty); GUI.Box(new Rect(297, 65, topBoxTexture.width - 250, topBoxTexture.height - 200), topBoxTexture, removeBackground); } else if (showEarthSubMenu) { GUI.Box(new Rect(65, 100, 845, 585), string.Empty); GUI.Box(new Rect(337, 65, topBoxTexture.width - 250, topBoxTexture.height - 200), topBoxTexture, removeBackground); } else if (showSettingsSubMenu) { GUI.Box(new Rect(65, 100, 845, 585), string.Empty); GUI.Box(new Rect(427, 65, topBoxTexture.width - 250, topBoxTexture.height - 200), topBoxTexture, removeBackground); } else if (showHelpSubMenu) { GUI.Box(new Rect(65, 100, 845, 585), string.Empty); GUI.Box(new Rect(467, 65, topBoxTexture.width - 250, topBoxTexture.height - 200), topBoxTexture, removeBackground); } else if (showCloseSubMenu) { GUI.Box(new Rect(65, 100, 845, 585), string.Empty); GUI.Box(new Rect(507, 65, topBoxTexture.width - 250, topBoxTexture.height - 200), topBoxTexture, removeBackground); } }