/// <summary> /// 数据处理 /// </summary> HandlerResult IHandler.HandlerData(string openId, DataTypes intputType, object rawData) { //参数检查 if (rawData == null) { throw new ArgumentNullException("rawData"); } string text = rawData.ToString(); if (MenuItems.ContainsKey(text)) { TextMenuItem meunItem = MenuItems[text]; HandlerResult ret = ((IHandler)meunItem.TextFullMatch).HandlerData(openId, intputType, text); if (ret == HandlerResult.Success) { this.SuccessResponseResult = meunItem.JumpResult; } return(ret); } else { return(HandlerResult.Fail); } }
private void ServerDiscovered(ServerNameMessage message) { lock (this) { Controller.GetInstance().SupressUpdate(); rooms.Add(message); menuItems.Clear(); for (int i = 0; i < rooms.Count; i++) { TextMenuItem textItem = new TextMenuItem(rooms[i].PlayerName); textItem.Position = new Vector2(DEFAULT_MENUITEM_X - 40, DEFAULT_MENUITEM_Y + (i + 2) * DEFAULT_MENUITEM_SPACING + 10); textItem.RenderPosition = new Vector2(-40, 51); menuItems.Add(textItem); } menuItems.Add(new ImageMenuItem("update", ROOMS_ROOT_DIRECTORY)); menuItems.Add(new ImageMenuItem("back", ROOMS_ROOT_DIRECTORY)); menuItems[menuItems.Count - 2].Position = new Vector2(DEFAULT_MENUITEM_X - 100, 650); menuItems[menuItems.Count - 1].Position = new Vector2(DEFAULT_MENUITEM_X + 100, 650); pointer.Selection = menuItems.Count - 2; Controller.GetInstance().ReleaseUpdate(); } }
public void CreatePostBattleOption() { if (PostBattleOption != null && Resident.Health < 1) { Program.theWorld[this.ID].AddMenuItem(PostBattleOption); this.PostBattleOption = null; } }
public void AddMenuItem(TextMenuItem <Player> menuItem) { if (menuItem == null) { throw new ArgumentException("Menu Item cannot be null"); } MenuItems.Add(menuItem); }
public ConsoleOptionPageItem(string caption, string id) { Caption = caption; textMenuItem = new TextMenuItem { Id = id, Text = caption }; }
protected override void InitMenuItems() { TextMenuItem screenOptionsItem = new TextMenuItem("Screen Options", this, new MethodKey() { MethodToRun = openScreenOptionsScreen, ActivateKey = Keys.Enter }); ToggleMenuItem playersItem = new ToggleMenuItem( "Players:", this, m_MultiPlayerConfiguration.NumberOfPlayers.ToString(), new List<string>() { "One", "Two" }, Keys.Enter, new MethodKey() { MethodToRun = m_MultiPlayerConfiguration.ChangeToTwoPlayers, ActivateKey = Keys.PageDown }, new MethodKey() { MethodToRun = m_MultiPlayerConfiguration.ChangeToOnePlayer, ActivateKey = Keys.PageUp }); TextMenuItem soundOptionsItem = new TextMenuItem("Sound Options", this, new MethodKey() { MethodToRun = openSoundOptionsScreen, ActivateKey = Keys.Enter }); TextMenuItem playItem = new TextMenuItem("Play", this, new MethodKey() { MethodToRun = startPlay, ActivateKey = Keys.Enter }); TextMenuItem quitItem = new TextMenuItem("Quit", this, new MethodKey() { MethodToRun = quitGame, ActivateKey = Keys.Enter }); AddMenuItems(screenOptionsItem, playersItem, soundOptionsItem, playItem, quitItem); TextServices.CenterTextsOnScreen(this, null, new List<GameMenuItem>() { screenOptionsItem, playersItem, soundOptionsItem, playItem, quitItem }); }
protected override void InitMenuItems() { ToggleMenuItem mouseVisabilityItem = new ToggleMenuItem( "Mouse Visability:", this, m_ScreenOptionsMng.MouseVisibleStatus, new List<string>() { "Visible", "Invisible" }, Keys.Enter, new MethodKey() { MethodToRun = m_ScreenOptionsMng.MouseVisibilityOff, ActivateKey = Keys.PageDown }, new MethodKey() { MethodToRun = m_ScreenOptionsMng.MouseVisibilityOn, ActivateKey = Keys.PageUp }); ToggleMenuItem fullScreenItem = new ToggleMenuItem( "Full Screen Mode:", this, m_ScreenOptionsMng.FullScreenMode, new List<string>() { "On", "Off" }, Keys.Enter, new MethodKey() { MethodToRun = m_ScreenOptionsMng.FullScreenOff, ActivateKey = Keys.PageDown }, new MethodKey() { MethodToRun = m_ScreenOptionsMng.FullScreenOn, ActivateKey = Keys.PageUp }); ToggleMenuItem allowResizingItem = new ToggleMenuItem( "Allow Window Resizing:", this, m_ScreenOptionsMng.AllowWindowResizingMode, new List<string>() { "On", "Off" }, Keys.Enter, new MethodKey() { MethodToRun = m_ScreenOptionsMng.DisallowWindowResizing, ActivateKey = Keys.PageDown }, new MethodKey() { MethodToRun = m_ScreenOptionsMng.AllowWindowResizing, ActivateKey = Keys.PageUp }); TextMenuItem doneItem = new TextMenuItem( "Done", this, new MethodKey() { MethodToRun = this.done, ActivateKey = Keys.Enter }); AddMenuItems(mouseVisabilityItem, fullScreenItem, allowResizingItem, doneItem); }
protected override void InitMenuItems() { ToggleMenuItem toggleSoundItem = new ToggleMenuItem( "Toggle Sound:", this, m_SpaceInvadersSoundsManager.SoundStatus, new List<string>() { "On", "Off" }, Keys.Enter, new MethodKey() { MethodToRun = m_SpaceInvadersSoundsManager.Mute, ActivateKey = Microsoft.Xna.Framework.Input.Keys.PageDown }, new MethodKey() { MethodToRun = m_SpaceInvadersSoundsManager.Play, ActivateKey = Microsoft.Xna.Framework.Input.Keys.PageUp }); RangeMenuItem backgroundVolumeItem = new RangeMenuItem( "Background Music Vol:", this, (int)(m_SpaceInvadersSoundsManager.BackgroundSound.Volume * 100), 0, 100, 10, new MethodKey() { MethodToRun = m_SpaceInvadersSoundsManager.DecreaseBackgroundMusic, ActivateKey = Keys.PageDown }, new MethodKey() { MethodToRun = m_SpaceInvadersSoundsManager.IncreaseBackgroundMusic, ActivateKey = Keys.PageUp }); RangeMenuItem soundsEffectsVolumeItem = new RangeMenuItem( "Sounds Effects Vol:", this, (int)(m_SpaceInvadersSoundsManager.SoundEffect.Volume * 100), 0, 100, 10, new MethodKey() { MethodToRun = m_SpaceInvadersSoundsManager.DecreaseSoundEffect, ActivateKey = Keys.PageDown }, new MethodKey() { MethodToRun = m_SpaceInvadersSoundsManager.IncreaseSoundEffect, ActivateKey = Keys.PageUp }); TextMenuItem doneItem = new TextMenuItem( "Done", this, new MethodKey() { MethodToRun = done, ActivateKey = Keys.Enter }); AddMenuItems(toggleSoundItem, backgroundVolumeItem, soundsEffectsVolumeItem, doneItem); }
public void AddTextItem(bool heading, string columnOne, string columnTwo, string id) { if (heading) // some spacing before headings AddTextItem(false, " ", null, "spacing"+id); MenuItem item = new TextMenuItem(columnOne, columnTwo, id); item.Bounds = Bounds; item.Font = heading ? MenuHeaderFont : MenuFont; item.Background = OptionSelected; item.FontColor = ItemColor; item.FontColorSelected = ItemColor; MenuItems.Add(item); }
public void InsertTextItem(int index, bool heading, string columnOne, string columnTwo, string id) { if (heading) // some spacing before headings InsertTextItem(index++, false, " ", null, id+"spacing"); MenuItem item = new TextMenuItem(columnOne, columnTwo, id); item.Bounds = Bounds; item.Font = heading ? MenuHeaderFont : MenuFont; item.Background = OptionSelected; item.FontColor = ItemColor; item.FontColorSelected = ItemColor; MenuItems.Insert(index, item); }
/// <summary> /// 创建 /// </summary> /// <param name="targetNodeID"></param> /// <param name="matchText"></param> /// <param name="IgnoreCase"></param> /// <returns></returns> public static TextMenuItem CreateItem(string targetNodeID, string matchText, bool IgnoreCase = true) { //参数检查 if (NodeIdValidator.IsValid(targetNodeID) == false) { throw new ArgumentException("节点ID格式不正确", "nodeId"); } TextMenuItem result = new TextMenuItem(); result.JumpResult = new ResponseJumpNode(targetNodeID); result.TextFullMatch = new TextFullMatchHandler(matchText, IgnoreCase); return(result); }
public void BuildMenuBar(MenuBarDefinition menuBarDefinition, MenuModel result) { var menus = _menus .Where(x => x.MenuBar == menuBarDefinition) .OrderBy(x => x.SortOrder); foreach (var menu in menus) { var menuModel = new TextMenuItem(menu); AddGroupsRecursive(menu, menuModel); if (menuModel.Children.Any()) { result.Add(menuModel); } } }
public override void InitMenu() { base.InitMenu(); circularImage.gameObject.SetActive(false); titleTextUI.gameObject.SetActive(false); itemList = new List <TextMenuItem> (); for (int i = 0; i < itemData.Count; i++) { GameObject g = Instantiate(textMenuItemPrefab); g.transform.SetParent(itemGroup); g.transform.localPosition = Vector3.zero; g.transform.localScale = Vector3.one; TextMenuItem t = g.GetComponent <TextMenuItem>().InitMenuItem(itemData[i]); itemList.Add(t); } SetItemAction(); }
protected override void InitMenuItems() { ToggleMenuItem mouseVisabilityItem = new ToggleMenuItem( "Mouse Visability:", this, m_ScreenOptionsMng.MouseVisibleStatus, new List <string>() { "Visible", "Invisible" }, Keys.Enter, new MethodKey() { MethodToRun = m_ScreenOptionsMng.MouseVisibilityOff, ActivateKey = Keys.PageDown }, new MethodKey() { MethodToRun = m_ScreenOptionsMng.MouseVisibilityOn, ActivateKey = Keys.PageUp }); ToggleMenuItem fullScreenItem = new ToggleMenuItem( "Full Screen Mode:", this, m_ScreenOptionsMng.FullScreenMode, new List <string>() { "On", "Off" }, Keys.Enter, new MethodKey() { MethodToRun = m_ScreenOptionsMng.FullScreenOff, ActivateKey = Keys.PageDown }, new MethodKey() { MethodToRun = m_ScreenOptionsMng.FullScreenOn, ActivateKey = Keys.PageUp }); ToggleMenuItem allowResizingItem = new ToggleMenuItem( "Allow Window Resizing:", this, m_ScreenOptionsMng.AllowWindowResizingMode, new List <string>() { "On", "Off" }, Keys.Enter, new MethodKey() { MethodToRun = m_ScreenOptionsMng.DisallowWindowResizing, ActivateKey = Keys.PageDown }, new MethodKey() { MethodToRun = m_ScreenOptionsMng.AllowWindowResizing, ActivateKey = Keys.PageUp }); TextMenuItem doneItem = new TextMenuItem( "Done", this, new MethodKey() { MethodToRun = this.done, ActivateKey = Keys.Enter }); AddMenuItems(mouseVisabilityItem, fullScreenItem, allowResizingItem, doneItem); }
public Location(Locale locale, String description) { if (description == null) { throw new ArgumentNullException("Description cannot be null"); } if (description == "") { throw new ArgumentException("Description cannot be blank"); } this.ID = locale; this.Description = description; this.Resident = null; this.Pathways = new Dictionary <Direction, Locale>(); this.MenuItems = new List <TextMenuItem <Player> >(); this.PreAction = null; this.PostBattleOption = null; }
protected override void InitMenuItems() { ToggleMenuItem toggleSoundItem = new ToggleMenuItem( "Toggle Sound:", this, m_SpaceInvadersSoundsManager.SoundStatus, new List <string>() { "On", "Off" }, Keys.Enter, new MethodKey() { MethodToRun = m_SpaceInvadersSoundsManager.Mute, ActivateKey = Microsoft.Xna.Framework.Input.Keys.PageDown }, new MethodKey() { MethodToRun = m_SpaceInvadersSoundsManager.Play, ActivateKey = Microsoft.Xna.Framework.Input.Keys.PageUp }); RangeMenuItem backgroundVolumeItem = new RangeMenuItem( "Background Music Vol:", this, (int)(m_SpaceInvadersSoundsManager.BackgroundSound.Volume * 100), 0, 100, 10, new MethodKey() { MethodToRun = m_SpaceInvadersSoundsManager.DecreaseBackgroundMusic, ActivateKey = Keys.PageDown }, new MethodKey() { MethodToRun = m_SpaceInvadersSoundsManager.IncreaseBackgroundMusic, ActivateKey = Keys.PageUp }); RangeMenuItem soundsEffectsVolumeItem = new RangeMenuItem( "Sounds Effects Vol:", this, (int)(m_SpaceInvadersSoundsManager.SoundEffect.Volume * 100), 0, 100, 10, new MethodKey() { MethodToRun = m_SpaceInvadersSoundsManager.DecreaseSoundEffect, ActivateKey = Keys.PageDown }, new MethodKey() { MethodToRun = m_SpaceInvadersSoundsManager.IncreaseSoundEffect, ActivateKey = Keys.PageUp }); TextMenuItem doneItem = new TextMenuItem( "Done", this, new MethodKey() { MethodToRun = done, ActivateKey = Keys.Enter }); AddMenuItems(toggleSoundItem, backgroundVolumeItem, soundsEffectsVolumeItem, doneItem); }
protected override void InitMenuItems() { TextMenuItem screenOptionsItem = new TextMenuItem("Screen Options", this, new MethodKey() { MethodToRun = openScreenOptionsScreen, ActivateKey = Keys.Enter }); ToggleMenuItem playersItem = new ToggleMenuItem( "Players:", this, m_MultiPlayerConfiguration.NumberOfPlayers.ToString(), new List <string>() { "One", "Two" }, Keys.Enter, new MethodKey() { MethodToRun = m_MultiPlayerConfiguration.ChangeToTwoPlayers, ActivateKey = Keys.PageDown }, new MethodKey() { MethodToRun = m_MultiPlayerConfiguration.ChangeToOnePlayer, ActivateKey = Keys.PageUp }); TextMenuItem soundOptionsItem = new TextMenuItem("Sound Options", this, new MethodKey() { MethodToRun = openSoundOptionsScreen, ActivateKey = Keys.Enter }); TextMenuItem playItem = new TextMenuItem("Play", this, new MethodKey() { MethodToRun = startPlay, ActivateKey = Keys.Enter }); TextMenuItem quitItem = new TextMenuItem("Quit", this, new MethodKey() { MethodToRun = quitGame, ActivateKey = Keys.Enter }); AddMenuItems(screenOptionsItem, playersItem, soundOptionsItem, playItem, quitItem); TextServices.CenterTextsOnScreen(this, null, new List <GameMenuItem>() { screenOptionsItem, playersItem, soundOptionsItem, playItem, quitItem }); }
public override GameState UpdateState(GameTime gameTime) { int indexFromBack = MenuItems.Count - selectedIndex; var serverClient = gameInstance.GetService<ServerClient>(); // prepare lobby (once) if (state == State.Unconnected && serverClient.connected) { state = State.Connected; MenuItem startButton = GetMenuItem("start"); startButton.Text = "Play"; Vector2 size = GetScreenPosition(new Vector2(1f, 1.6f)); Bounds = new Rectangle(0, 0, (int)size.X, (int)size.Y); MenuItems.Remove(serverInput); MenuItem item = new TextMenuItem("Players", null, "playerHeading"); item.Background = OptionSelected; item.Font = MenuHeaderFont; item.FontColor = ItemColor; item.FontColorSelected = ItemColor; MenuItems.Insert(0, item); lobbyItems.Add(item); foreach (var menuItem in MenuItems) { menuItem.SetWidth(Bounds.Width); } startButton.Enabled = true; } else if (state == State.Connected && !serverClient.connected) { state = State.Unconnected; Vector2 size = GetScreenPosition(new Vector2(1f, 0.625f)); Bounds = new Rectangle(0, 0, (int)size.X, (int)size.Y); MenuItems.RemoveAll(i => lobbyItems.Exists(i2 => i == i2)); lobbyItems.Clear(); MenuItems.Insert(0, serverInput); } // update lobby if connected if (state == State.Connected) { var fullPlayerList = new List<Player>(serverClient.Players.Values); fullPlayerList.Add(serverClient.LocalPlayer); fullPlayerList.OrderBy(p => p.ID); int playerNumbering = 1; foreach (var player in fullPlayerList) { if (!lobbyItems.Exists(item => item.Identifier == player.PlayerName + player.ID)) { string stateText = player.State == PlayerState.Lobby ? "In Lobby" : "In Game"; MenuItem item = new TextMenuItem((playerNumbering++) + ". " + player.PlayerName, stateText, player.PlayerName + player.ID); item.Background = OptionSelected; item.Font = MenuFont; item.FontColor = ItemColor; item.FontColorSelected = ItemColor; item.SetWidth(Bounds.Width); lobbyItems.Add(item); MenuItems.Insert(MenuItems.Count - 2, item); } } } selectedIndex = MenuItems.Count - indexFromBack; return base.UpdateState(gameTime); }
public void AddMenuItems(TextMenuItem <Player> menuitem) { MenuItems.Add(menuitem); }
protected override void OnViewLoaded(object view) { foreach (var module in _modules) { foreach (var globalResourceDictionary in module.GlobalResourceDictionaries) { Application.Current.Resources.MergedDictionaries.Add(globalResourceDictionary); } } foreach (var module in _modules) { module.PreInitialize(); } foreach (var module in _modules) { module.Initialize(); } // Populate our view menu with Tools var viewMenu = MainMenu.FirstOrDefault(x => (x as MainMenu.Models.TextMenuItem).Text == "_View"); if (viewMenu == null && AvailableTools.Any()) { var def = new TextMenuItemDefinition(null, 2, "_View"); viewMenu = new TextMenuItem(def); MainMenu.Insert(2, viewMenu); } foreach (var exportedTool in AvailableTools.OrderBy(t => t.Metadata.SortOrder)) { var localExport = exportedTool; viewMenu.Add(new ActionMenuItem(localExport.Metadata.DisplayName, argument => { // by using Lazy we can avoid instantiating the tool until when it is actually displayed! Caliburn.Micro.IoC.Get <IShell>().ShowTool(localExport.Value); })); } // If after initialization no theme was loaded, load the default one if (_themeManager.CurrentTheme == null) { _themeManager.SetCurrentTheme(Properties.Settings.Default.ThemeName); } _shellView = (IShellView)view; if (!HasPersistedState) { foreach (var defaultDocument in _modules.SelectMany(x => x.DefaultDocuments)) { OpenDocument(defaultDocument); } foreach (var defaultTool in _modules.SelectMany(x => x.DefaultTools)) { ShowTool((ITool)IoC.GetInstance(defaultTool, null)); } } else { _layoutItemStatePersister.LoadState(this, _shellView, StateFile); } foreach (var module in _modules) { module.PostInitialize(); } base.OnViewLoaded(view); }
public void AddMenuItemPostBattle(TextMenuItem <Player> postoption) { this.PostBattleOption = postoption; }