コード例 #1
0
ファイル: TextMenuHandler.cs プロジェクト: zero1036/TGNet
        /// <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);
            }
        }
コード例 #2
0
        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();
            }
        }
コード例 #3
0
 public void CreatePostBattleOption()
 {
     if (PostBattleOption != null && Resident.Health < 1)
     {
         Program.theWorld[this.ID].AddMenuItem(PostBattleOption);
         this.PostBattleOption = null;
     }
 }
コード例 #4
0
 public void AddMenuItem(TextMenuItem <Player> menuItem)
 {
     if (menuItem == null)
     {
         throw new ArgumentException("Menu Item cannot be null");
     }
     MenuItems.Add(menuItem);
 }
コード例 #5
0
        public ConsoleOptionPageItem(string caption, string id)
        {
            Caption = caption;

            textMenuItem = new TextMenuItem
            {
                Id   = id,
                Text = caption
            };
        }
コード例 #6
0
 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 });
 }
コード例 #7
0
 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);
 }
コード例 #8
0
 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);
 }
コード例 #9
0
ファイル: GameOverMenu.cs プロジェクト: MintL/datx02-rally
 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);
 }
コード例 #10
0
ファイル: GameOverMenu.cs プロジェクト: MintL/datx02-rally
 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);
 }
コード例 #11
0
ファイル: TextMenuHandler.cs プロジェクト: zero1036/TGNet
            /// <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);
            }
コード例 #12
0
        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);
                }
            }
        }
コード例 #13
0
 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();
 }
コード例 #14
0
        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);
        }
コード例 #15
0
        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;
        }
コード例 #16
0
        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);
        }
コード例 #17
0
        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
            });
        }
コード例 #18
0
ファイル: MultiplayerMenu.cs プロジェクト: MintL/datx02-rally
        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);
        }
コード例 #19
0
 public void AddMenuItems(TextMenuItem <Player> menuitem)
 {
     MenuItems.Add(menuitem);
 }
コード例 #20
0
ファイル: ShellViewModel.cs プロジェクト: jazzay/gemini
        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);
        }
コード例 #21
0
 public void AddMenuItemPostBattle(TextMenuItem <Player> postoption)
 {
     this.PostBattleOption = postoption;
 }