public void SwapShortcuts(ShortcutBarEnum barType, int slot, int newSlot) { if (IsSlotFree(slot, barType)) { return; } var shortcutToSwitch = GetShortcut(barType, slot); var shortcutDestination = GetShortcut(barType, newSlot); RemoveInternal(shortcutToSwitch); RemoveInternal(shortcutDestination); if (shortcutDestination != null) { shortcutDestination.Slot = slot; AddInternal(shortcutDestination); ShortcutHandler.SendShortcutBarRefreshMessage(Owner.Client, barType, shortcutDestination); } else { ShortcutHandler.SendShortcutBarRemovedMessage(Owner.Client, barType, slot); } shortcutToSwitch.Slot = newSlot; AddInternal(shortcutToSwitch); ShortcutHandler.SendShortcutBarRefreshMessage(Owner.Client, barType, shortcutToSwitch); }
private void SetShortcuts(string cmdId, ShortcutHandler shortcuts) { if (shortcuts != null) { this.SharedProps.Shortcut = shortcuts.GetShortcut(cmdId); } }
protected override void OnShown(EventArgs e) { base.OnShown(e); EmuApi.InitDll(); ConfigManager.Config.Video.ApplyConfig(); EmuApi.InitializeEmu(ConfigManager.HomeFolder, Handle, ctrlRenderer.Handle, false, false, false); ConfigManager.Config.InitializeDefaults(); ConfigManager.Config.ApplyConfig(); _displayManager = new DisplayManager(this, ctrlRenderer, pnlRenderer, mnuMain, ctrlRecentGames); _displayManager.UpdateViewerSize(); _shortcuts = new ShortcutHandler(_displayManager); _notifListener = new NotificationListener(); _notifListener.OnNotification += OnNotificationReceived; SaveStateManager.InitializeStateMenu(mnuSaveState, true, _shortcuts); SaveStateManager.InitializeStateMenu(mnuLoadState, false, _shortcuts); BindShortcuts(); ctrlRecentGames.Initialize(); ResizeRecentGames(); _commandLine.LoadGameFromCommandLine(); if (!EmuRunner.IsRunning()) { ctrlRecentGames.Visible = true; } this.Resize += frmMain_Resize; }
public void RemoveShortcut(ShortcutBarEnum barType, int slot) { var shortcut = GetShortcut(barType, slot); if (shortcut == null) { return; } switch (barType) { case ShortcutBarEnum.SPELL_SHORTCUT_BAR: m_spellShortcuts.Remove(slot); break; case ShortcutBarEnum.GENERAL_SHORTCUT_BAR: { if (shortcut is ItemShortcut) { m_itemShortcuts.Remove(slot); } else if (shortcut is PresetShortcut) { m_presetShortcuts.Remove(slot); } } break; } m_shortcutsToDelete.Enqueue(shortcut); ShortcutHandler.SendShortcutBarRemovedMessage(Owner.Client, barType, slot); }
public void AddShortcut(ShortcutBarEnum barType, DofusProtocol.Types.Shortcut shortcut) { // do not ask me why i use a sbyte, they are f*****g idiots if (shortcut is ShortcutSpell && barType == ShortcutBarEnum.SPELL_SHORTCUT_BAR) { AddSpellShortcut(shortcut.slot, ((ShortcutSpell)shortcut).spellId); } else if (shortcut is ShortcutObjectItem && barType == ShortcutBarEnum.GENERAL_SHORTCUT_BAR) { var item = Owner.Inventory.TryGetItem(((ShortcutObjectItem)shortcut).itemUID); if (item != null) { AddItemShortcut(shortcut.slot, item); } else { ShortcutHandler.SendShortcutBarAddErrorMessage(Owner.Client); } } else if (shortcut is ShortcutObjectPreset && barType == ShortcutBarEnum.GENERAL_SHORTCUT_BAR) { AddPresetShortcut(shortcut.slot, ((ShortcutObjectPreset)shortcut).presetId); } else { ShortcutHandler.SendShortcutBarAddErrorMessage(Owner.Client); } }
private void SetShortcuts(string cmdId, ShortcutHandler shortcuts) { if (shortcuts != null) { this.Shortcut = shortcuts.GetShortcut(cmdId); this.ShowShortcut = shortcuts.IsShortcutDisplayed(cmdId); } }
public static void ApplySuicideBuff(TriggerBuff buff, BuffTriggerType trigger, object token) { var target = buff.Target as SummonedMonster; InventoryHandler.SendSpellListMessage(target.Summoner.CharacterContainer.Clients.FirstOrDefault(), true); ShortcutHandler.SendShortcutBarContentMessage(target.Summoner.CharacterContainer.Clients.FirstOrDefault(), ShortcutBarEnum.SPELL_SHORTCUT_BAR); //ContextHandler.SendSlaveSwitchContextMessage(buff.Target.s); target.Die(); }
public void AddSpellShortcut(int slot, short spellId) { if (!this.IsSlotFree(slot, ShortcutBarEnum.SPELL_SHORTCUT_BAR)) { this.RemoveShortcut(ShortcutBarEnum.SPELL_SHORTCUT_BAR, slot); } SpellShortcut spellShortcut = new SpellShortcut(this.Owner.Record, slot, spellId); this.m_spellShortcuts.Add(slot, spellShortcut); ShortcutHandler.SendShortcutBarRefreshMessage(this.Owner.Client, ShortcutBarEnum.SPELL_SHORTCUT_BAR, spellShortcut); }
public void AddItemShortcut(int slot, BasePlayerItem item) { if (!this.IsSlotFree(slot, ShortcutBarEnum.GENERAL_SHORTCUT_BAR)) { this.RemoveShortcut(ShortcutBarEnum.GENERAL_SHORTCUT_BAR, slot); } ItemShortcut itemShortcut = new ItemShortcut(this.Owner.Record, slot, item.Template.Id, item.Guid); this.m_itemShortcuts.Add(slot, itemShortcut); ShortcutHandler.SendShortcutBarRefreshMessage(this.Owner.Client, ShortcutBarEnum.GENERAL_SHORTCUT_BAR, itemShortcut); }
public void AddPresetShortcut(int slot, int presetId) { if (!IsSlotFree(slot, ShortcutBarEnum.GENERAL_SHORTCUT_BAR)) { RemoveShortcut(ShortcutBarEnum.GENERAL_SHORTCUT_BAR, slot); } var shortcut = new PresetShortcut(Owner.Record, slot, presetId); m_presetShortcuts.Add(slot, shortcut); ShortcutHandler.SendShortcutBarRefreshMessage(Owner.Client, ShortcutBarEnum.GENERAL_SHORTCUT_BAR, shortcut); }
protected override void OnShown(EventArgs e) { base.OnShown(e); EmuApi.InitDll(); bool showUpgradeMessage = UpdateHelper.PerformUpgrade(); ConfigManager.Config.Video.ApplyConfig(); EmuApi.InitializeEmu(ConfigManager.HomeFolder, Handle, ctrlRenderer.Handle, false, false, false); ConfigManager.Config.InitializeDefaults(); ConfigManager.Config.ApplyConfig(); _displayManager = new DisplayManager(this, ctrlRenderer, pnlRenderer, mnuMain, ctrlRecentGames); _displayManager.SetScaleBasedOnWindowSize(); _shortcuts = new ShortcutHandler(_displayManager); _notifListener = new NotificationListener(); _notifListener.OnNotification += OnNotificationReceived; _commandLine.LoadGameFromCommandLine(); SaveStateManager.InitializeStateMenu(mnuSaveState, true, _shortcuts); SaveStateManager.InitializeStateMenu(mnuLoadState, false, _shortcuts); BindShortcuts(); Task.Run(() => { Thread.Sleep(25); this.BeginInvoke((Action)(() => { ResizeRecentGames(); ctrlRecentGames.Initialize(); if (!EmuRunner.IsRunning()) { ctrlRecentGames.Visible = true; } })); }); if (showUpgradeMessage) { MesenMsgBox.Show("UpgradeSuccess", MessageBoxButtons.OK, MessageBoxIcon.Information); } if (ConfigManager.Config.Preferences.AutomaticallyCheckForUpdates) { UpdateHelper.CheckForUpdates(true); } InBackgroundHelper.StartBackgroundTimer(); this.Resize += frmMain_Resize; }
public void AddShortcut(ShortcutBarEnum barType, Stump.DofusProtocol.Types.Shortcut shortcut) { if (shortcut is ShortcutSpell && barType == ShortcutBarEnum.SPELL_SHORTCUT_BAR) { this.AddSpellShortcut(shortcut.slot, (short)(shortcut as ShortcutSpell).spellId); } else { if (shortcut is ShortcutObjectItem && barType == ShortcutBarEnum.GENERAL_SHORTCUT_BAR) { this.AddItemShortcut(shortcut.slot, this.Owner.Inventory.TryGetItem((shortcut as ShortcutObjectItem).itemUID)); } else { ShortcutHandler.SendShortcutBarAddErrorMessage(this.Owner.Client); } } }
public static void CommonCharacterBasicInformations(WorldClient client) { CharacterHandler.SendCharacterSelectedSuccessMessage(client); ContextHandler.SendNotificationListMessage(client, new int[] { 2147483647 }); InventoryHandler.SendInventoryContentMessage(client); ShortcutHandler.SendShortcutBarContentMessage(client, ShortcutBarEnum.GENERAL_SHORTCUT_BAR); ShortcutHandler.SendShortcutBarContentMessage(client, ShortcutBarEnum.SPELL_SHORTCUT_BAR); ContextRoleplayHandler.SendEmoteListMessage(client, ( from entry in Enumerable.Range(0, 21) select(byte) entry).ToList <byte>()); PvPHandler.SendAlignmentRankUpdateMessage(client); if (client.Character.Guild != null) { GuildHandler.SendGuildMembershipMessage(client, client.Character.GuildMember); GuildHandler.SendGuildInformationsGeneralMessage(client, client.Character.Guild); GuildHandler.SendGuildInformationsMembersMessage(client, client.Character.Guild); if (client.Character.Guild.Alliance != null) { AllianceHandler.SendAllianceMembershipMessage(client, client.Character.Guild.Alliance); AllianceHandler.SendAllianceInsiderInfoMessage(client, client.Character.Guild.Alliance); } } ChatHandler.SendEnabledChannelsMessage(client, new sbyte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13 }, new sbyte[0]); InventoryHandler.SendSpellListMessage(client, true); InitializationHandler.SendSetCharacterRestrictionsMessage(client); InventoryHandler.SendInventoryWeightMessage(client); FriendHandler.SendFriendWarnOnConnectionStateMessage(client, client.Character.FriendsBook.WarnOnConnection); FriendHandler.SendFriendWarnOnLevelGainStateMessage(client, client.Character.FriendsBook.WarnOnLevel); GuildHandler.SendGuildMemberWarnOnConnectionStateMessage(client, client.Character.WarnOnGuildConnection); AchievementHandler.SendAchievementListMessage(client, client.Character.Record.FinishedAchievements, client.Character.Achievement.GetRewardableAchievements()); client.Character.SendConnectionMessages(); ContextRoleplayHandler.SendGameRolePlayArenaUpdatePlayerInfosMessage(client); CharacterHandler.SendCharacterCapabilitiesMessage(client); client.WorldAccount.LastConnection = new System.DateTime?(System.DateTime.Now); client.WorldAccount.LastIp = client.IP; client.WorldAccount.ConnectedCharacter = new int?(client.Character.Id); client.Character.Record.LastUsage = new System.DateTime?(System.DateTime.Now); ServerBase <WorldServer> .Instance.DBAccessor.Database.Update(client.WorldAccount); ServerBase <WorldServer> .Instance.DBAccessor.Database.Update(client.Character.Record); }
protected void SetupFramingShortcutHandler(VFXView view) { m_ShortcutHandler = new ShortcutHandler( new Dictionary <Event, ShortcutDelegate> { { Event.KeyboardEvent("a"), view.FrameAll }, { Event.KeyboardEvent("f"), view.FrameSelection }, { Event.KeyboardEvent("o"), view.FrameOrigin }, { Event.KeyboardEvent("^#>"), view.FramePrev }, { Event.KeyboardEvent("^>"), view.FrameNext }, { Event.KeyboardEvent("#^r"), view.Resync }, { Event.KeyboardEvent("F7"), view.Compile }, { Event.KeyboardEvent("#d"), view.OutputToDot }, { Event.KeyboardEvent("^#d"), view.OutputToDotReduced }, { Event.KeyboardEvent("#c"), view.OutputToDotConstantFolding }, { Event.KeyboardEvent("^r"), view.ReinitComponents }, { Event.KeyboardEvent("F5"), view.ReinitComponents }, }); }
public void RemoveShortcut(ShortcutBarEnum barType, int slot) { Stump.Server.WorldServer.Database.Shortcuts.Shortcut shortcut = this.GetShortcut(barType, slot); if (shortcut != null) { if (barType == ShortcutBarEnum.SPELL_SHORTCUT_BAR) { this.m_spellShortcuts.Remove(slot); } else { if (barType == ShortcutBarEnum.GENERAL_SHORTCUT_BAR) { this.m_itemShortcuts.Remove(slot); } } this.m_shortcutsToDelete.Enqueue(shortcut); ShortcutHandler.SendShortcutBarRemovedMessage(this.Owner.Client, barType, slot); } }
public Form1() { InitializeComponent(); //Initiate worker worker = new BackgroundWorker(); //Worker Event Handlers worker.DoWork += new DoWorkEventHandler(worker_DoWork); worker.ProgressChanged += new ProgressChangedEventHandler(worker_ProgressChanged); worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted); //Enable Progress Reorting worker.WorkerReportsProgress = true; tabControl1.KeyUp += new KeyEventHandler(KeyUpReporter); tabControl1.KeyDown += new KeyEventHandler(KeyDownReporter); tabControl1.KeyDown += new KeyEventHandler(ShortcutChecker); shortcutHandler = new ShortcutHandler(); }
public override void OnReleased() { base.OnReleased(); if (UI != null) { UnityEngine.Object.Destroy(UI.gameObject); UI = null; } if (UIShortcutHandler != null) { UnityEngine.Object.Destroy(UI.gameObject); UIShortcutHandler = null; } if (StationContainer != null) { UnityEngine.Object.Destroy(StationContainer.gameObject); StationContainer = null; } if (ContentContainer != null) { UnityEngine.Object.Destroy(ContentContainer.gameObject); ContentContainer = null; } if (MethodDetours != null) { UnityEngine.Object.Destroy(MethodDetours.gameObject); MethodDetours = null; } if (UserRadioContainer != null) { UnityEngine.Object.Destroy(UserRadioContainer.gameObject); UserRadioContainer = null; } if (DisabledContentContainer != null) { UnityEngine.Object.Destroy(DisabledContentContainer.gameObject); UserRadioContainer = null; } }
public override void OnLevelLoaded(LoadMode mode) { base.OnLevelLoaded(mode); CSLMusicMod.Log("Got OnLevelLoaded: " + mode); if (mode == LoadMode.LoadGame || mode == LoadMode.NewGame || mode == LoadMode.NewGameFromScenario) { CSLMusicMod.Log("Level loaded. Loading mod components."); RemoveUnsupportedContent(); UserRadioContainer.CollectPostLoadingData(); ExtendVanillaContent(); // Build UI and other post loadtime if (UI == null && ModOptions.Instance.EnableCustomUI) { UI = new GameObject("CSLMusicMod_UI").AddComponent <MusicUI>(); } if (UIShortcutHandler == null && ModOptions.Instance.EnableShortcuts) { UIShortcutHandler = new GameObject("CSLMusicMod_UIShortcutHandler").AddComponent <ShortcutHandler>(); } if (DisabledContentContainer == null) { DisabledContentContainer = new GameObject("CSLMusicMod_DisabledContent").AddComponent <RadioContentWatcher>(); } try { DebugOutput(); } catch (Exception ex) { Debug.LogError("[CSLMusic] DebugOutput Error: " + ex); } } }
public void SwapShortcuts(ShortcutBarEnum barType, int slot, int newSlot) { if (!this.IsSlotFree(slot, barType)) { Stump.Server.WorldServer.Database.Shortcuts.Shortcut shortcut = this.GetShortcut(barType, slot); Stump.Server.WorldServer.Database.Shortcuts.Shortcut shortcut2 = this.GetShortcut(barType, newSlot); this.RemoveInternal(shortcut); this.RemoveInternal(shortcut2); if (shortcut2 != null) { shortcut2.Slot = slot; this.AddInternal(shortcut2); ShortcutHandler.SendShortcutBarRefreshMessage(this.Owner.Client, barType, shortcut2); } else { ShortcutHandler.SendShortcutBarRemovedMessage(this.Owner.Client, barType, slot); } shortcut.Slot = newSlot; this.AddInternal(shortcut); ShortcutHandler.SendShortcutBarRefreshMessage(this.Owner.Client, barType, shortcut); } }
// Add Menu Items private void AddMenuItems(string[] array) { try { // Disabler bool isShortcut = false; bool isExeDllFile = false; foreach (string path in array) { try { if (Path.GetExtension(path) == ".lnk") { isShortcut = true; } if (Path.GetExtension(path) != ".exe" && Path.GetExtension(path) != ".dll") { isExeDllFile = false; } if (Path.GetExtension(path) == ".exe" || Path.GetExtension(path) == ".dll") { isExeDllFile = true; } if (Directory.Exists(ShortcutHandler.GetShortcutTarget(path))) { } } catch (Exception ex) { EasyLogger.Error(ex.Message + " Error at ShortcutHandler.GetShortcutTarget(path)"); continue; } } object OpenNotepadFiles = xMenuToolsSettings.GetValue("OpenNotepadFiles"); if (OpenNotepadFiles != null) { if (OpenNotepadFiles.ToString() == "1") { xMenuToolsMenu.DropDownItems.Add(OpenNotepad); } } object BlockWithFirewallFiles = xMenuToolsSettings.GetValue("BlockWithFirewallFiles"); if (BlockWithFirewallFiles != null) { if (BlockWithFirewallFiles.ToString() == "1") { xMenuToolsMenu.DropDownItems.Add(BlockFirewall); } } object CopyPathFiles = xMenuToolsSettings.GetValue("CopyPathFiles"); if (CopyPathFiles != null && !isShortcut) { if (CopyPathFiles.ToString() == "1") { xMenuToolsMenu.DropDownItems.Add(CopyPath); } } object CopyNameFiles = xMenuToolsSettings.GetValue("CopyNameFiles"); if (CopyNameFiles != null && !isShortcut) { if (CopyNameFiles.ToString() == "1") { xMenuToolsMenu.DropDownItems.Add(CopyName); } } object AttributesFiles = xMenuToolsSettings.GetValue("AttributesFiles"); if (AttributesFiles != null) { if (AttributesFiles.ToString() == "1") { xMenuToolsMenu.DropDownItems.Add(Attributes); Attributes.DropDownItems.Add(AttributesMenu); Attributes.DropDownItems.Add(new ToolStripSeparator()); Attributes.DropDownItems.Add(HiddenAttributes); Attributes.DropDownItems.Add(SystemAttributes); Attributes.DropDownItems.Add(ReadOnlyAttributes); } } object SymlinkFiles = xMenuToolsSettings.GetValue("SymlinkFiles"); if (SymlinkFiles != null) { if (SymlinkFiles.ToString() == "1") { xMenuToolsMenu.DropDownItems.Add(SymLink); } } object TakeOwnershipFiles = xMenuToolsSettings.GetValue("TakeOwnershipFiles"); if (TakeOwnershipFiles != null) { if (TakeOwnershipFiles.ToString() == "1") { xMenuToolsMenu.DropDownItems.Add(TakeOwnership); } } object AttributesShortcuts = xMenuToolsSettings.GetValue("AttributesShortcuts"); if (AttributesShortcuts != null && isShortcut) { if (AttributesShortcuts.ToString() == "1") { xMenuToolsMenu.DropDownItems.Add(Attributes); } else { Attributes.Dispose(); } } object OpenNotepadShort = xMenuToolsSettings.GetValue("OpenNotepadShort"); if (OpenNotepadShort != null && isShortcut) { if (OpenNotepadShort.ToString() == "1") { xMenuToolsMenu.DropDownItems.Add(OpenNotepad); } else { OpenNotepad.Dispose(); } } object CopyPathShortFiles = xMenuToolsSettings.GetValue("CopyPathShortFiles"); if (CopyPathShortFiles != null && isShortcut) { if (CopyPathShortFiles.ToString() == "1") { xMenuToolsMenu.DropDownItems.Add(CopyPath); } } object CopyNameShortFiles = xMenuToolsSettings.GetValue("CopyNameShortFiles"); if (CopyNameShortFiles != null && isShortcut) { if (CopyNameShortFiles.ToString() == "1") { xMenuToolsMenu.DropDownItems.Add(CopyName); } } MenuItemDisabler(isShortcut, isExeDllFile); } catch (System.ComponentModel.Win32Exception ex) { StartProcess.StartInfo(AttributesInfo.GetAssembly.AssemblyInformation("directory") + @"\xMenuTools.exe", "\"" + ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + ex.Source + Environment.NewLine + ex.GetBaseException() + Environment.NewLine + ex.TargetSite + "\"" + " -catchhandler"); } }
public void RegisterShortcut(KeyCode shortcut, ShortcutHandler handler) { throw new NotImplementedException(); }
private static void SuckInCreatureHK(On.ShortcutHandler.orig_SuckInCreature orig, ShortcutHandler self, Creature creature, Room room, ShortcutData shortCut) { if (creature is Player) { room.PlaySound(SoundID.Player_Enter_Shortcut, creature.mainBodyChunk.pos); if (shortCut.shortCutType == ShortcutData.Type.RoomExit) { int cnt = room.abstractRoom.connections[shortCut.destNode]; if (cnt > -1 && !AbstractPhysicalObjectHK.GetField(creature.abstractPhysicalObject).networkObject) { room.world.ActivateRoom(room.world.GetAbstractRoom(cnt)); } } if (shortCut.shortCutType == ShortcutData.Type.NPCTransportation && Array.IndexOf <IntVector2>(room.shortcutsIndex, creature.NPCTransportationDestination.Tile) > -1) { self.transportVessels.Add(new ShortcutHandler.ShortCutVessel(creature.NPCTransportationDestination.Tile, creature, room.abstractRoom, (int)Vector2.Distance(IntVector2.ToVector2(shortCut.DestTile), IntVector2.ToVector2(creature.NPCTransportationDestination.Tile)))); } else { self.transportVessels.Add(new ShortcutHandler.ShortCutVessel(shortCut.StartTile, creature, room.abstractRoom, 0)); } return; } orig(self, creature, room, shortCut); }
// Add Menu Items private void AddMenuItems(string[] array) { try { // Disabler bool isShortcut = false; bool isExeDllFile = false; bool isFile = true; foreach (string path in array) { try { if (Path.GetExtension(path) == ".lnk") { isShortcut = true; } if (Path.GetExtension(path) != ".exe" && Path.GetExtension(path) != ".dll") { isExeDllFile = false; } if (Path.GetExtension(path) == ".exe" || Path.GetExtension(path) == ".dll") { isExeDllFile = true; } if (Directory.Exists(ShortcutHandler.GetShortcutTarget(path))) { isFile = false; } } catch (Exception ex) { Console.WriteLine(ex.Message + " Error at ShortcutHandler.GetShortcutTarget(path)"); continue; } } object OpenNotepadFiles = MenuToolsSettings.GetValue("OpenNotepadFiles"); if (OpenNotepadFiles != null) { if (OpenNotepadFiles.ToString() == "1") { MenuToolsMenu.DropDownItems.Add(OpenNotepad); } } object BlockWithFirewallFiles = MenuToolsSettings.GetValue("BlockWithFirewallFiles"); if (BlockWithFirewallFiles != null) { if (BlockWithFirewallFiles.ToString() == "1") { MenuToolsMenu.DropDownItems.Add(BlockFirewall); } } object CopyPathFiles = MenuToolsSettings.GetValue("CopyPathFiles"); if (CopyPathFiles != null && !isShortcut) { if (CopyPathFiles.ToString() == "1") { MenuToolsMenu.DropDownItems.Add(CopyPath); } } object CopyNameFiles = MenuToolsSettings.GetValue("CopyNameFiles"); if (CopyNameFiles != null && !isShortcut) { if (CopyNameFiles.ToString() == "1") { MenuToolsMenu.DropDownItems.Add(CopyName); } } object AttributesFiles = MenuToolsSettings.GetValue("AttributesFiles"); if (AttributesFiles != null) { if (AttributesFiles.ToString() == "1") { MenuToolsMenu.DropDownItems.Add(Attributes); Attributes.DropDownItems.Add(AttributesMenu); Attributes.DropDownItems.Add(new ToolStripSeparator()); Attributes.DropDownItems.Add(HiddenAttributes); Attributes.DropDownItems.Add(SystemAttributes); Attributes.DropDownItems.Add(ReadOnlyAttributes); } } object SymlinkFiles = MenuToolsSettings.GetValue("SymlinkFiles"); if (SymlinkFiles != null) { if (SymlinkFiles.ToString() == "1") { MenuToolsMenu.DropDownItems.Add(SymLink); } } object TakeOwnershipFiles = MenuToolsSettings.GetValue("TakeOwnershipFiles"); if (TakeOwnershipFiles != null) { if (TakeOwnershipFiles.ToString() == "1") { MenuToolsMenu.DropDownItems.Add(TakeOwnership); } } object OpenNotepadShort = MenuToolsSettings.GetValue("OpenNotepadShort"); if (OpenNotepadShort != null && isShortcut) { MenuToolsMenu.DropDownItems.Add(OpenNotepad); } object CopyPathShortFiles = MenuToolsSettings.GetValue("CopyPathShortFiles"); if (CopyPathShortFiles != null && isShortcut) { if (CopyPathShortFiles.ToString() == "1") { MenuToolsMenu.DropDownItems.Add(CopyPath); } } object CopyNameShortFiles = MenuToolsSettings.GetValue("CopyNameShortFiles"); if (CopyNameShortFiles != null && isShortcut) { if (CopyNameShortFiles.ToString() == "1") { MenuToolsMenu.DropDownItems.Add(CopyName); } } MenuItemDisabler(isShortcut, isExeDllFile); } catch (System.ComponentModel.Win32Exception ex) { MessageBox.Show(ex.Message); } }
public AppContextMenuCommand(string cmdId, CommandMediator mediator, string caption, string description, int imageIndex, ShortcutHandler shortcuts) : this(cmdId, mediator, caption, description, shortcuts) { this.imageIndex = imageIndex; }
public AppContextMenuCommand(string cmdId, CommandMediator mediator, string caption, string description, ShortcutHandler shortcuts) : this(cmdId, mediator, null, caption, description) { SetShortcuts(cmdId, shortcuts); }
//-------------------------------------------------------------------------------------------------- void LoadShortcuts() { ShortcutHandler.AddShortcut(ShortcutScope.Application, new(Key.F1, ApplicationCommands.Help)); ShortcutHandler.AddShortcut(ShortcutScope.Application, new(Key.S, ModifierKeys.Control, DocumentCommands.SaveAll)); }
protected virtual void OnEnable() { if (m_PreviousGraphModels == null) { m_PreviousGraphModels = new List <OpenedGraph>(); } if (m_BlackboardExpandedRowStates == null) { m_BlackboardExpandedRowStates = new List <string>(); } if (m_ElementModelsToSelectUponCreation == null) { m_ElementModelsToSelectUponCreation = new List <string>(); } if (m_ElementModelsToExpandUponCreation == null) { m_ElementModelsToExpandUponCreation = new List <string>(); } rootVisualElement.RegisterCallback <ValidateCommandEvent>(OnValidateCommand); rootVisualElement.RegisterCallback <ExecuteCommandEvent>(OnExecuteCommand); rootVisualElement.RegisterCallback <MouseMoveEvent>(_ => _compilationTimer.Restart(m_Store.GetState().EditorDataModel)); rootVisualElement.styleSheets.Add(AssetDatabase.LoadAssetAtPath <StyleSheet>(k_StyleSheetPath + "VSEditor.uss")); rootVisualElement.Clear(); rootVisualElement.style.overflow = Overflow.Hidden; rootVisualElement.pickingMode = PickingMode.Ignore; rootVisualElement.style.flexDirection = FlexDirection.Column; rootVisualElement.name = "vseRoot"; // Create the store. DataModel = CreateDataModel(); State initialState = CreateInitialState(); m_Store = new Store(initialState, Store.Options.TrackUndoRedo); VseUtility.SetupLogStickyCallback(); m_GraphContainer = new VisualElement { name = "graphContainer" }; m_GraphView = CreateGraphView(); m_Menu = CreateMenu(); m_ErrorToolbar = CreateErrorToolbar(); m_BlankPage = CreateBlankPage(); SetupWindow(); m_CompilationPendingLabel = new Label("Compilation Pending") { name = "compilationPendingLabel" }; m_SidePanel = new VisualElement() { name = "sidePanel" }; m_SidePanelTitle = new Label(); m_SidePanel.Add(m_SidePanelTitle); m_SidePanelPropertyElement = new Unity.Properties.UI.PropertyElement { name = "sidePanelInspector" }; m_SidePanelPropertyElement.OnChanged += (element, path) => { if (m_ElementShownInSidePanel is IHasGraphElementModel hasGraphElementModel && hasGraphElementModel.GraphElementModel is IPropertyVisitorNodeTarget nodeTarget2) { nodeTarget2.Target = element.GetTarget <object>(); } (m_ElementShownInSidePanel as Node)?.NodeModel.DefineNode(); (m_ElementShownInSidePanel as Node)?.UpdateFromModel(); }; m_SidePanel.Add(m_SidePanelPropertyElement); ShowNodeInSidePanel(null, false); m_GraphContainer.Add(m_GraphView); m_GraphContainer.Add(m_SidePanel); Dictionary <Event, ShortcutDelegate> dictionaryShortcuts = GetShortcutDictionary(); m_ShortcutHandler = new ShortcutHandler(GetShortcutDictionary()); rootVisualElement.parent.AddManipulator(m_ShortcutHandler); m_Store.StateChanged += StoreOnStateChanged; Undo.undoRedoPerformed += UndoRedoPerformed; rootVisualElement.RegisterCallback <AttachToPanelEvent>(OnEnterPanel); rootVisualElement.RegisterCallback <DetachFromPanelEvent>(OnLeavePanel); // that will be true when the window is restored during the editor startup, so OnEnterPanel won't be called later if (rootVisualElement.panel != null) { OnEnterPanel(null); } titleContent = new GUIContent("Visual Script"); // After a domain reload, all loaded objects will get reloaded and their OnEnable() called again // It looks like all loaded objects are put in a deserialization/OnEnable() queue // the previous graph's nodes/edges/... might be queued AFTER this window's OnEnable // so relying on objects to be loaded/initialized is not safe // hence, we need to defer the loading action rootVisualElement.schedule.Execute(() => { if (!String.IsNullOrEmpty(LastGraphFilePath)) { try { m_Store.Dispatch(new LoadGraphAssetAction(LastGraphFilePath, boundObject: m_BoundObject, loadType: LoadGraphAssetAction.Type.KeepHistory)); } catch (Exception e) { Debug.LogError(e); } } else // will display the blank page. not needed otherwise as the LoadGraphAsset reducer will refresh { m_Store.Dispatch(new RefreshUIAction(UpdateFlags.All)); } }).ExecuteLater(0); m_LockTracker.lockStateChanged.AddListener(OnLockStateChanged); m_PluginRepository = new PluginRepository(m_Store, this); EditorApplication.playModeStateChanged += OnEditorPlayModeStateChanged; EditorApplication.pauseStateChanged += OnEditorPauseStateChanged; if (DataModel is VSEditorDataModel vsDataModel) { vsDataModel.PluginRepository = m_PluginRepository; vsDataModel.OnCompilationRequest = OnCompilationRequest; } }
public static void CommonCharacterSelection(WorldClient client, CharacterRecord character) { if (character.IsDeleted) { return; } // Check if we also have a world account if (client.WorldAccount == null) { var account = AccountManager.Instance.FindById(client.Account.Id) ?? AccountManager.Instance.CreateWorldAccount(client); client.WorldAccount = account; } // update tokens if (client.WorldAccount.Tokens + client.WorldAccount.NewTokens <= 0) { client.WorldAccount.Tokens = 0; } else { client.WorldAccount.Tokens += client.WorldAccount.NewTokens; } client.WorldAccount.NewTokens = 0; client.Character = new Character(character, client); client.Character.LoadRecord(); ContextHandler.SendNotificationListMessage(client, new[] { 0x7FFFFFFF }); BasicHandler.SendBasicTimeMessage(client); SendCharacterSelectedSuccessMessage(client); if (client.Character.Inventory.Presets.Any()) { InventoryHandler.SendInventoryContentAndPresetMessage(client); } else { InventoryHandler.SendInventoryContentMessage(client); } ShortcutHandler.SendShortcutBarContentMessage(client, ShortcutBarEnum.GENERAL_SHORTCUT_BAR); ContextRoleplayHandler.SendEmoteListMessage(client, client.Character.Emotes.Select(x => (byte)x)); // Jobs ContextRoleplayHandler.SendJobDescriptionMessage(client, client.Character); ContextRoleplayHandler.SendJobExperienceMultiUpdateMessage(client, client.Character); ContextRoleplayHandler.SendJobCrafterDirectorySettingsMessage(client, client.Character); PvPHandler.SendAlignmentRankUpdateMessage(client, client.Character); ChatHandler.SendEnabledChannelsMessage(client, new sbyte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13 }, new sbyte[] { }); ChatHandler.SendChatSmileyExtraPackListMessage(client, client.Character.SmileyPacks.ToArray()); InventoryHandler.SendSpellListMessage(client, true); ShortcutHandler.SendShortcutBarContentMessage(client, ShortcutBarEnum.SPELL_SHORTCUT_BAR); InitializationHandler.SendSetCharacterRestrictionsMessage(client, client.Character); InventoryHandler.SendInventoryWeightMessage(client); FriendHandler.SendFriendWarnOnConnectionStateMessage(client, client.Character.FriendsBook.WarnOnConnection); FriendHandler.SendFriendWarnOnLevelGainStateMessage(client, client.Character.FriendsBook.WarnOnLevel); GuildHandler.SendGuildMemberWarnOnConnectionStateMessage(client, client.Character.WarnOnGuildConnection); //Guild if (client.Character.GuildMember != null) { GuildHandler.SendGuildMembershipMessage(client, client.Character.GuildMember); } //Mount if (client.Character.EquippedMount != null) { MountHandler.SendMountSetMessage(client, client.Character.EquippedMount.GetMountClientData()); MountHandler.SendMountXpRatioMessage(client, client.Character.EquippedMount.GivenExperience); if (client.Character.IsRiding) { MountHandler.SendMountRidingMessage(client, client.Character.IsRiding); } } client.Character.SendConnectionMessages(); //Don't know why ? ActionsHandler.SendSequenceNumberRequestMessage(client); //Start Cinematic if ((DateTime.Now - client.Character.Record.CreationDate).TotalSeconds <= 30) { BasicHandler.SendCinematicMessage(client, 10); } ContextRoleplayHandler.SendGameRolePlayArenaUpdatePlayerInfosMessage(client, client.Character); SendCharacterCapabilitiesMessage(client); ContextRoleplayHandler.SendAlmanachCalendarDateMessage(client); //Loading complete SendCharacterLoadingCompleteMessage(client); BasicHandler.SendServerExperienceModificatorMessage(client); // Update LastConnection and Last Ip client.WorldAccount.LastConnection = DateTime.Now; client.WorldAccount.LastIp = client.IP; client.WorldAccount.ConnectedCharacter = character.Id; WorldServer.Instance.DBAccessor.Database.Execute(string.Format(WorldAccountRelator.UpdateNewTokens, 0)); WorldServer.Instance.DBAccessor.Database.Update(client.WorldAccount); }
public AppContextMenuCommand(string cmdId, CommandMediator mediator, ExecuteCommandHandler executor, string caption, string description, int imageIndex, ShortcutHandler shortcuts) : this(cmdId, mediator, executor, caption, description, imageIndex) { SetShortcuts(cmdId, shortcuts); }
protected virtual void OnEnable() { if (m_PreviousGraphModels == null) { m_PreviousGraphModels = new List <GraphModel>(); } if (m_BlackboardExpandedRowStates == null) { m_BlackboardExpandedRowStates = new List <string>(); } if (m_ElementModelsToSelectUponCreation == null) { m_ElementModelsToSelectUponCreation = new List <string>(); } if (m_ElementModelsToExpandUponCreation == null) { m_ElementModelsToExpandUponCreation = new List <string>(); } rootVisualElement.RegisterCallback <ValidateCommandEvent>(OnValidateCommand); rootVisualElement.RegisterCallback <ExecuteCommandEvent>(OnExecuteCommand); rootVisualElement.RegisterCallback <MouseMoveEvent>(_ => m_IdleTimer?.Restart()); rootVisualElement.styleSheets.Add(AssetDatabase.LoadAssetAtPath <StyleSheet>(k_StyleSheetPath + "VSEditor.uss")); rootVisualElement.Clear(); rootVisualElement.style.overflow = Overflow.Hidden; rootVisualElement.pickingMode = PickingMode.Ignore; rootVisualElement.style.flexDirection = FlexDirection.Column; rootVisualElement.name = "vseRoot"; // Create the store. DataModel = CreateDataModel(); State initialState = CreateInitialState(); m_Store = new Store(initialState, Store.Options.TrackUndoRedo); VseUtility.SetupLogStickyCallback(); m_GraphContainer = new VisualElement { name = "graphContainer" }; m_GraphView = CreateGraphView(); m_Menu = CreateMenu(); m_BlankPage = CreateBlankPage(); IMGUIContainer imguiContainer = null; imguiContainer = new IMGUIContainer(() => { var timeRect = new Rect(0, 0, rootVisualElement.layout.width, imguiContainer.layout.height); m_TracingTimeline.OnGUI(timeRect); }); m_TracingTimeline = new TracingTimeline(m_Store.GetState(), imguiContainer); m_TracingTimeline.SyncVisible(); rootVisualElement.Add(m_Menu); rootVisualElement.Add(imguiContainer); rootVisualElement.Add(m_GraphContainer); m_CompilationPendingLabel = new Label("Compilation Pending") { name = "compilationPendingLabel" }; m_GraphContainer.Add(m_GraphView); m_ShortcutHandler = new ShortcutHandler( new Dictionary <Event, ShortcutDelegate> { { Event.KeyboardEvent("F2"), () => Application.platform != RuntimePlatform.OSXEditor ? RenameElement() : EventPropagation.Continue }, { Event.KeyboardEvent("F5"), () => { RefreshUI(UpdateFlags.All); return(EventPropagation.Continue); } }, { Event.KeyboardEvent("return"), () => Application.platform == RuntimePlatform.OSXEditor ? RenameElement() : EventPropagation.Continue }, { Event.KeyboardEvent("[enter]"), () => Application.platform == RuntimePlatform.OSXEditor ? RenameElement() : EventPropagation.Continue }, { Event.KeyboardEvent("backspace"), OnBackspaceKeyDown }, { Event.KeyboardEvent("space"), OnSpaceKeyDown }, { Event.KeyboardEvent("C"), () => { IGraphElementModel[] selectedModels = m_GraphView.selection .OfType <IHasGraphElementModel>() .Select(x => x.GraphElementModel) .ToArray(); // Convert variable -> constant if selection contains at least one item that satisfies conditions IVariableModel[] variableModels = selectedModels.OfType <VariableNodeModel>().Cast <IVariableModel>().ToArray(); if (variableModels.Any()) { m_Store.Dispatch(new ConvertVariableNodesToConstantNodesAction(variableModels)); return(EventPropagation.Stop); } IConstantNodeModel[] constantModels = selectedModels.OfType <IConstantNodeModel>().ToArray(); if (constantModels.Any()) { m_Store.Dispatch(new ConvertConstantNodesToVariableNodesAction(constantModels)); } return(EventPropagation.Stop); } }, { Event.KeyboardEvent("Q"), () => m_GraphView.AlignSelection(false) }, { Event.KeyboardEvent("#Q"), () => m_GraphView.AlignSelection(true) }, // DEBUG { Event.KeyboardEvent("1"), () => OnCreateLogNode(LogNodeModel.LogTypes.Message) }, { Event.KeyboardEvent("2"), () => OnCreateLogNode(LogNodeModel.LogTypes.Warning) }, { Event.KeyboardEvent("3"), () => OnCreateLogNode(LogNodeModel.LogTypes.Error) }, { Event.KeyboardEvent("`"), () => OnCreateStickyNote(new Rect(m_GraphView.ChangeCoordinatesTo(m_GraphView.contentViewContainer, m_GraphView.WorldToLocal(Event.current.mousePosition)), StickyNote.defaultSize)) }, }); rootVisualElement.parent.AddManipulator(m_ShortcutHandler); Selection.selectionChanged += OnGlobalSelectionChange; m_Store.StateChanged += StoreOnStateChanged; Undo.undoRedoPerformed += UndoRedoPerformed; rootVisualElement.RegisterCallback <AttachToPanelEvent>(OnEnterPanel); rootVisualElement.RegisterCallback <DetachFromPanelEvent>(OnLeavePanel); titleContent = new GUIContent("Visual Script"); // After a domain reload, all loaded objects will get reloaded and their OnEnable() called again // It looks like all loaded objects are put in a deserialization/OnEnable() queue // the previous graph's nodes/edges/... might be queued AFTER this window's OnEnable // so relying on objects to be loaded/initialized is not safe // hence, we need to defer the loading action rootVisualElement.schedule.Execute(() => { if (!String.IsNullOrEmpty(LastGraphFilePath)) { try { m_Store.Dispatch(new LoadGraphAssetAction(LastGraphFilePath, loadType: LoadGraphAssetAction.Type.KeepHistory)); } catch (Exception e) { Debug.LogError(e); } } else // will display the blank page. not needed otherwise as the LoadGraphAsset reducer will refresh { m_Store.Dispatch(new RefreshUIAction(UpdateFlags.All)); } }).ExecuteLater(0); m_LockTracker.lockStateChanged.AddListener(OnLockStateChanged); m_PluginRepository = new PluginRepository(m_Store, m_GraphView); EditorApplication.playModeStateChanged += OnEditorPlayModeStateChanged; EditorApplication.pauseStateChanged += OnEditorPauseStateChanged; if (DataModel is VSEditorDataModel vsDataModel) { vsDataModel.PluginRepository = m_PluginRepository; vsDataModel.OnCompilationRequest = OnCompilationRequest; } }
public ShortcutEventTarget(ShortcutHandler callback) : base(EventNames.ExecuteShortcut) { _callback = callback; }