public void Initialize() { var hashSets = HashSetManagementService.HashSets; if (hashSets == null) { return; } foreach (var hashSet in hashSets) { HashSetModels.Add(new HashSetModel(hashSet)); } //加入列出表功能; var listHashCmi = CommandItemFactory.CreateNew(ListHashValuesCommand); listHashCmi.Name = LanguageService.FindResourceString(Constants.ContextCommandName_ListHashValue); ContextCommands.Add(listHashCmi); //加入删除哈希集命令; var delCmi = CommandItemFactory.CreateNew(DeleteHashSetCommand); delCmi.Name = LanguageService.FindResourceString(Constants.ContextCommandName_DeleteHashSet); ContextCommands.Add(delCmi); //加入导入哈希命令; var importCmi = CommandItemFactory.CreateNew(ImportHashCommand); importCmi.Name = LanguageService.FindResourceString(Constants.ContextCommandName_ImportHash); ContextCommands.Add(importCmi); }
/// <summary> /// Called when the PlayState is entered from the state manager. /// </summary> public override void OnEnter() { // Just toss out any pending input. DwarfGame.GumInputMapper.GetInputQueue(); if (!IsInitialized) { EnterTime = DateTime.Now; DiscoverPlayerTools(); VoxSelector.Selected += (voxels, button) => CurrentTool.OnVoxelsSelected(voxels, button); VoxSelector.Dragged += (voxels, button) => CurrentTool.OnVoxelsDragged(voxels, button); BodySelector.Selected += (bodies, button) => { CurrentTool.OnBodiesSelected(bodies, button); if (CurrentToolMode == "SelectUnits") { SelectedObjects = bodies; } }; BodySelector.MouseOver += (bodies) => CurrentTool.OnMouseOver(bodies); // Ensure game is not paused. World.Paused = false; DwarfTime.LastTime.Speed = 1.0f; // Setup new gui. Double rendering the mouse? Gui = new Gui.Root(DwarfGame.GuiSkin); Gui.MousePointer = new Gui.MousePointer("mouse", 4, 0); World.UserInterface = this; CreateGUIComponents(); IsInitialized = true; SoundManager.PlayMusic("main_theme_day"); World.Time.Dawn += time => { SoundManager.PlaySound(ContentPaths.Audio.Oscar.sfx_gui_daytime, 0.15f); SoundManager.PlayMusic("main_theme_day"); }; World.Time.NewNight += time => { SoundManager.PlaySound(ContentPaths.Audio.Oscar.sfx_gui_nighttime, 0.15f); SoundManager.PlayMusic("main_theme_night"); }; World.UnpauseThreads(); AutoSaveTimer = new Timer(GameSettings.Current.AutoSaveTimeMinutes * 60.0f, false, Timer.TimerMode.Real); foreach (var contextCommandFactory in AssetManager.EnumerateModHooks(typeof(ContextCommandAttribute), typeof(ContextCommands.ContextCommand), new Type[] { })) { ContextCommands.Add(contextCommandFactory.Invoke(null, new Object[] { }) as ContextCommands.ContextCommand); } World.LogEvent(String.Format("We have arrived at {0}", World.Overworld.Name)); } base.OnEnter(); }
public void addCommandButton1(object sender, EventArgs e) { // ToolStripMenuItem cms = sender as ToolStripMenuItem; ContextCommands cmd = new ContextCommands(); //MessageBox.Show(cms.Name); serverControl serv = contextMenuStrip1.SourceControl as serverControl; cmd = commands.Find(x => x.commTS == cms); //cmd = sender as ContextCommands; MessageBox.Show(cmd.commName); if (cmd.Multi) { sendCommand(serv.objectAddress, cmd.commProgramm, cmd.commLines); } else { sendCommand(serv.objectAddress, cmd.commProgramm, cmd.commParams); } }
public void addCommandButton1(object sender, EventArgs e) { // ToolStripMenuItem cms = sender as ToolStripMenuItem; ContextCommands cmd = new ContextCommands(); //MessageBox.Show(cms.Name); serverControl serv = contextMenuStrip1.SourceControl as serverControl; cmd = commands.Find(x => x.commTS == cms); //cmd = sender as ContextCommands; MessageBox.Show(cmd.commName); if (cmd.Multi) sendCommand(serv.objectAddress, cmd.commProgramm, cmd.commLines); else sendCommand(serv.objectAddress, cmd.commProgramm, cmd.commParams); }