Inheritance: MonoBehaviour
示例#1
0
        /// <summary>
        /// Provides the key portion of the menu loop where the user is asked for the document type
        /// </summary>
        /// <returns>selected document type</returns>
        public DocumentType? DocumentSelectionLoop()
        {
            var options = new MenuOptions<DocumentType>();

            Console.WriteLine("\n\n -------- Main Menu ------------");
            Console.WriteLine(" ------------------------------");
            foreach (var item in options.Options)
                Console.WriteLine("  {0}", item.Value.Text);
            Console.WriteLine("\nEnter value or any other value to exit");

            var input = Console.ReadLine().ToUpper();
            MenuItemInfo<DocumentType> menuItem;

            if (options.Options.TryGetValue(input, out menuItem))
                return menuItem.Value;

            return null;
        }
 private void DoAction(MenuOptions odabir)
 {
     switch (odabir)
     {
         case MenuOptions.NewGame:
             StartNewGame();
             break;
         case MenuOptions.NewPlayer:
             CreateNewPlayer();
             break;
         case MenuOptions.PlayerList:
             ShowPlayerList();
             break;
         case MenuOptions.RemovePlayer:
             RemovePlayer();
             break;
         default:
             break;
     }
 }
示例#3
0
        /// <summary>
        /// performs the action loop according to trigger values available fromt the state engine
        /// </summary>
        /// <param name="stateEngine">state engine containinig workflow definitions</param>
        public void ActionLoop(StateEngine stateEngine)
        {
            IEnumerable<WorkflowTrigger> activeTriggers;

            while( (activeTriggers = stateEngine.Actions).Count() > 0)
            {
                var optionSet = new MenuOptions<WorkflowTrigger>(activeTriggers);

                foreach(var option in optionSet.Options)
                    Console.WriteLine("  {0}", option.Value.Text);

                var input = Console.ReadLine().ToUpper();
                MenuItemInfo<WorkflowTrigger> menuItem;
                if(! optionSet.Options.TryGetValue(input, out menuItem))
                {
                    Console.WriteLine(" ** Option {0} was not understood, try again", input);
                    continue;
                }

                stateEngine.Fire(menuItem.Value);
            }
        }
示例#4
0
文件: StateMenu.cs 项目: izacus/Kreen
        private void SelectPreviousOption()
        {
            switch (selectedOption)
            {
            case MenuOptions.Start:
                selectedOption = MenuOptions.Exit;
                exitSubmenu    = true;
                exitSubmenuYes = false;
                break;

            case MenuOptions.Car:
                selectedOption = MenuOptions.Start;
                break;

            case MenuOptions.Track:
                selectedOption = MenuOptions.Car;
                break;

            case MenuOptions.Exit:
                selectedOption = MenuOptions.Track;
                exitSubmenu    = false;
                break;
            }
        }
示例#5
0
        private void DoAction(MenuOptions odabir)
        {
            switch (odabir)
            {
            case MenuOptions.NewGame:
                StartNewGame();
                break;

            case MenuOptions.NewPlayer:
                CreateNewPlayer();
                break;

            case MenuOptions.PlayerList:
                ShowPlayerList();
                break;

            case MenuOptions.RemovePlayer:
                RemovePlayer();
                break;

            default:
                break;
            }
        }
示例#6
0
 // Use this for initialization
 void Start()
 {
     mySkillTree   = GameObject.FindGameObjectWithTag("SkillTree");
     myMenuOptions = mySkillTree.GetComponent <MenuOptions>();
 }
        async public Task<List<MenuItem>> getMenu(string city, string state, string country, string phone)
        {
            try
            {
                menuOptions = await getMenuOptions(city, state, country, phone);
            }
            catch { }

            string url = String.Format("http://mealaroni.com/api_roni.aspx?biz_city={0}&biz_state={1}&biz_country={2}&biz_phone={3}&cmd=menus_all", city, state, country, phone.Replace(" ", ""));
            string result = await getRequest(url);
            XmlDocument xmlDoc = new XmlDocument();

            try
            {
                xmlDoc.LoadXml(result);
                menus.Clear();
                IXmlNode hours = xmlDoc.DocumentElement.SelectSingleNode("hours");
                xmlDoc.DocumentElement.SelectNodes("//Menu").All(fd => {
                    try {
                        Menu s = new Menu();
                        s.storehours = hours;
                        s.menu = fd.Attributes.GetNamedItem("name").NodeValue.ToString().ToString().Replace("_", " ");
                        s.days = fd.SelectSingleNode("ActiveDays");
                        s.items = fd.SelectNodes("MenuItem");
                        List<MenuItem> keyedMenuItems = new System.Collections.Generic.List<MenuItem>();
                        List<MenuItem> menuItemsX = new System.Collections.Generic.List<MenuItem>();
                        foreach (IXmlNode node in s.items)
                        {
                            IXmlNode options = node.SelectSingleNode("ItemOptions");
                            MenuItem newItem = new MenuItem();
                            newItem.menu = node.ParentNode.Attributes.GetNamedItem("name").NodeValue.ToString().Replace("_", " ");
                            newItem.name = node.SelectSingleNode("ItemName").InnerText;
                            newItem.decription = node.SelectSingleNode("ItemDescript").InnerText;
                            newItem.price = node.SelectSingleNode("ItemPrice").InnerText;
                            newItem.options = options;
                            menuItems.Add(newItem);  
                            menuItemsX.Add(newItem);
                        }
                        KeyValuePair<string, List<MenuItem>> keyedMenuItem = new System.Collections.Generic.KeyValuePair<string, List<MenuItem>>(s.menu, menuItemsX);
                        s.keyMenus.Add(keyedMenuItem);                    
                        menus.Add(s);
                    }
                    catch{}
                    return true;
                });


                XmlNodeList menuNodes = xmlDoc.DocumentElement.SelectNodes("//MenuItem");
                
                menuItems.Clear();
                
                foreach (IXmlNode node in menuNodes)
                {
                    IXmlNode options = node.SelectSingleNode("ItemOptions");
                   
                    MenuItem newItem = new MenuItem();                                       
                    newItem.menu = node.ParentNode.Attributes.GetNamedItem("name").NodeValue.ToString().Replace("_", " ");
                    newItem.name = node.SelectSingleNode("ItemName").InnerText;
                    newItem.decription = node.SelectSingleNode("ItemDescript").InnerText;
                    newItem.price = node.SelectSingleNode("ItemPrice").InnerText;
                    newItem.options = options;
                    menuItems.Add(newItem);                    
                }

            }
            catch
            {

            }
            return menuItems;
        }
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            random = new Random ();

            player = new Player();
            boss = new Boss ();

            bgLayer1 = new ParallaxingBackground ();
            bgLayer2 = new ParallaxingBackground ();

            enemies = new List<Enemy> ();
            explosions = new List<Explosion> ();
            lasers = new List<Laser> ();

            enemySpawnTime = TimeSpan.FromSeconds (1.0f);
            prevEnemySpawnTime = TimeSpan.Zero;
            laserSpawnTime = TimeSpan.FromSeconds (0.5f);

            healthBarVal = Constants.PLAYER_HEALTH;
            maxEnemyCount = Constants.ENEMY_COUNT;
            score = 0;
            bossFight = false;

            GameState = GameStates.Start;
            menuCursor = MenuOptions.Start;
            base.Initialize ();
        }
 public void ContinueDrag(MenuOptions selectedOption)
 {
     playerInteraction_UI.SetDraggableElementPosition(Input.mousePosition);
 }
示例#10
0
        /// <summary>
        /// Searches the class for all fields marked with <see cref="InputField"/>,
        /// and adds them to the internal dictionary for use in other methods.
        /// </summary>
        /// <remarks>
        /// Important to note:
        /// Be careful with how you arrange these fields.
        /// If a field is in a spot that is already occupied,
        /// It will throw an error.
        /// </remarks>
        /// -C
        protected void RegisterMenuFields()
        {
            bool arrows = false;

            foreach (FieldInfo f in GetType().GetFields())
            {
                if (Attribute.IsDefined(f, typeof(InputField)))
                {
                    // if it's an input field var
                    InputField info = f.GetCustomAttribute(typeof(InputField)) as InputField; // get it's attribute

                    int page = info.Page;
                    int pos  = info.Position;

                    if (!InputFields.ContainsKey(page))
                    {
                        InputFields[page] = new Dictionary <int, MessageFieldNode>();
                    }

                    if (InputFields[page].ContainsKey(pos))
                    {
                        // If there is already an input field here
                        throw new ConflictingFieldException(InputFields[page][pos].Name, info.Name, page, pos); // Throw an error.
                    }

                    // Otherwise, if everything is fine,
                    // Add the field.
                    MessageFieldNode node = new MessageFieldNode(info.Name, info.Page, info.Position, info.Value, info.Type); // create the node
                    node.ClassPtr = this;                                                                                     // give it a pointer to this class, so it can modify the variable it's attached to
                    node.SetValue(info.Value);
                    InputFields[info.Page][info.Position] = node;                                                             // And add the appropriate node to the dict where it belongs
                }
            }

            int FieldCount = 0;

            foreach (int i in InputFields.Keys)
            {
                foreach (int j in InputFields[i].Keys)
                {
                    FieldCount++;
                    if (FieldCount > 1)
                    {
                        arrows = true;
                    }
                }

                FieldCount = 0;
            }

            if (MenuOptions == null)
            {
                MenuOptions = new List <MenuOptionNode>();
            }

            if (arrows)
            {
                // if there is more than one field, add up and down buttons
                if (!MenuOptions.Contains(ReactionHandler.UP))
                {
                    AddMenuOptions(ReactionHandler.UP);
                }

                if (!MenuOptions.Contains(ReactionHandler.DOWN))
                {
                    AddMenuOptions(ReactionHandler.DOWN);
                }
            }

            PageCount = InputFields.Values.Count; // set the number of pages
        }
示例#11
0
    void DrawLeftMenu()
    {
        if (attributesWindow.Button(windowArea))
        {
            if (menuOption != MenuOptions.ATTRIBUTES)
            {
                rightWindow.selected = false;
            }
            menuOption = MenuOptions.ATTRIBUTES;
        }

        if (tagWindow.Button(windowArea))
        {
            if (menuOption != MenuOptions.TAGS)
            {
                rightWindow.selected = false;
            }
            menuOption = MenuOptions.TAGS;
        }
        if (slotTypeWindow.Button(windowArea))
        {
            if (menuOption != MenuOptions.SLOT_TYPE)
            {
                rightWindow.selected = false;
            }
            menuOption = MenuOptions.SLOT_TYPE;
        }
        if (itemWindow.Button(windowArea))
        {
            if (menuOption != MenuOptions.ITEMS)
            {
                rightWindow.selected = false;
            }
            menuOption = MenuOptions.ITEMS;
        }
        if (skillsWindow.Button(windowArea))
        {
            if (menuOption != MenuOptions.SKILLS)
            {
                rightWindow.selected = false;
            }
            menuOption = MenuOptions.SKILLS;
        }
        if (specilizedWindow.Button(windowArea))
        {
            if (menuOption != MenuOptions.SPECIALIZED_CLASS)
            {
                rightWindow.selected = false;
            }
            menuOption = MenuOptions.SPECIALIZED_CLASS;
        }
        if (characterWindow.Button(windowArea))
        {
            if (menuOption != MenuOptions.CHARACTERS)
            {
                rightWindow.selected = false;
            }
            menuOption = MenuOptions.CHARACTERS;
        }
        if (teamsWindow.Button(windowArea))
        {
            if (menuOption != MenuOptions.TEAMS)
            {
                rightWindow.selected = false;
            }
            menuOption = MenuOptions.TEAMS;
        }
    }
示例#12
0
 public IEnumerator <MenuOption> GetEnumerator() => MenuOptions.GetEnumerator();
示例#13
0
 private void CreateBattleShipGame(GameMode mode)
 {
     gameBS      = new BattleShips(mode);
     currentMenu = MenuOptions.HandleBSGameMode;
 }
示例#14
0
        // -------- End of show menu methods ----------
        // -------- Start of Other/Uncategorised ----------

        private void CreateTTTGame(GameMode mode)
        {
            gameTTT     = new TicTacToe(mode);
            currentMenu = MenuOptions.HandleTTTGameMode;
        }
示例#15
0
 public GameMenu()               // Vores Constructor, som sørger for at initialisere vores start variabler
 {
     isGameRunning = false;
     currentMenu   = MenuOptions.ChooseGame;
 }
示例#16
0
 public void SetOptions()
 {
     MenuOptions.Add("1. Start New Order");
     MenuOptions.Add("2. View Order History");
     MenuOptions.Add("3. Exit");
 }
 private void Awake()
 {
     instance = this;
     gameObject.SetActive(false);
 }
示例#18
0
 public Menu(MenuOptions value)
 {
     this.value = value;
 }
 public void AddBank(Bank bank)
 {
     BanksList.Add(bank);
     MenuOptions.Add(bank.Id, bank.Name);
 }
示例#20
0
 private void PressKeyToContinue()
 {
     Console.WriteLine("Press any key to continue");
     Console.ReadKey();
     currentMenu = MenuOptions.ChooseTTTGameMode;
 }
    void Start()
    {
        speechManager = GameObject.FindWithTag("kinect-speech").GetComponent<SpeechManager>();
        worldIndex = GameObject.Find("levelProperties").GetComponent<LevelProperties>().worldIndex;
        intManager = GameObject.FindWithTag("kinect-interaction").GetComponent<InteractionManager>();

        pMenu = GetComponent<MenuPause>();
        opMenu = GetComponent<MenuOptions>();
        hMenu = GetComponent<MenuHelp>();
    }
示例#22
0
        /// <summary>
        /// method to manage the application setup and game loop
        /// </summary>
        private void ManageGameLoop()
        {
            MenuOptions playerMenuChoice = MenuOptions.None;
            Menu        currentMenu      = ActiveMenu.NoMenu;
            bool        devMode          = false;

            if (!devMode)
            {
                //
                // display splash screen
                //
                _playingGame = _gameConsoleView.DisplayIntroScreen();
                //_gameConsoleView.DisplayAnimation();


                //
                // player chooses to quit
                //
                if (!_playingGame)
                {
                    /// TODO animate outro-------------------------------------------------------------------------------------------------------------
                    Environment.Exit(1);
                }
                //
                // Display introductory message
                //
                //_gameConsoleView.DisplayGamePlayScreen("Part One", Text.IntroductionP1(),ActiveMenu.NoMenu);
                //_gameConsoleView.GetContinueKey();

                //
                // Initialize the player's stats
                //
                InitializePlayerStats();

                //
                // Display introductory message
                //
                _gameConsoleView.DisplayGamePlayScreen("Part Two", Text.IntroductionP2(), ActiveMenu.NoMenu);
                _gameConsoleView.GetContinueKey();

                //
                // Initialize the player's spells
                //
                _gameConsoleView.DisplayGamePlayScreen("Book of Necromancy", "This is where you will choose your starting spells", ActiveMenu.NoMenu);
                _gameConsoleView.GetContinueKey();
                //InitializePlayerSpells();

                //
                // Display introductory message
                //
                _gameConsoleView.DisplayGamePlayScreen("Part Three", Text.IntroductionP3(), ActiveMenu.NoMenu);
                _gameConsoleView.GetContinueKey();

                //
                // Prepare game play screen
                //
                _gameConsoleView.DisplayWorldMap(true);
            }
            else
            {
                _gameConsoleView.DisplayWorldMap();
            }

            //
            // Game loop
            //
            while (_playingGame)
            {
                UpdateGameStatus();

                _currentLocation = _world.GetLocationByCoords(_player.xPos, _player.yPos);
                _locationsVisited.Add(_currentLocation);

                playerMenuChoice = _gameConsoleView.GetMenuEscape(_gameConsoleView.CurrentMenu);
                if (playerMenuChoice == MenuOptions.None)
                {
                    playerMenuChoice = _gameConsoleView.GetMenuChoice(_gameConsoleView.CurrentMenu, back);
                }
                back = false;
                _gameConsoleView.MenuEscape = 0;
                if (playerMenuChoice != MenuOptions.None)
                {
                    _gameConsoleView.CurrentMenuChoice = playerMenuChoice;
                }
                //
                // choose an action based on the user's menu choice
                //
                switch (playerMenuChoice)
                {
                case MenuOptions.None:
                    break;

                // Main Menu
                case MenuOptions.WorldMap:
                    _gameConsoleView.DisplayWorldMap();
                    break;

                case MenuOptions.Explore:
                    _gameConsoleView.DisplayCurrentLocationInfo();
                    break;

                case MenuOptions.Character:
                    _gameConsoleView.DisplayPlayerInfo();
                    break;

                case MenuOptions.Inventory:
                    _gameConsoleView.DisplayInventory(_player.Inventory, true);
                    break;

                case MenuOptions.Settings:
                    _gameConsoleView.DisplaySettings();
                    break;



                // World Map
                case MenuOptions.North:
                    _gameConsoleView.UpdateWorldMap(ConsoleKey.W);
                    _gameConsoleView.CurrentMenuChoice = MenuOptions.WorldMap;
                    break;

                case MenuOptions.East:
                    _gameConsoleView.UpdateWorldMap(ConsoleKey.D);
                    _gameConsoleView.CurrentMenuChoice = MenuOptions.WorldMap;
                    break;

                case MenuOptions.South:
                    _gameConsoleView.UpdateWorldMap(ConsoleKey.S);
                    _gameConsoleView.CurrentMenuChoice = MenuOptions.WorldMap;
                    break;

                case MenuOptions.West:
                    _gameConsoleView.UpdateWorldMap(ConsoleKey.A);
                    _gameConsoleView.CurrentMenuChoice = MenuOptions.WorldMap;
                    break;



                // Settings
                case MenuOptions.DevMenu:
                    _gameConsoleView.DisplayDevMenu();
                    break;

                case MenuOptions.Back:
                    back = true;
                    break;



                // Player Actions
                case MenuOptions.LookAt:
                    _gameConsoleView.DisplayLookAt();
                    break;

                case MenuOptions.LookAround:
                    _gameConsoleView.DisplayLookAround();
                    break;



                // Developer Actions
                case MenuOptions.ListLocations:
                    _gameConsoleView.DisplayListOfAllLocations();
                    break;

                case MenuOptions.ListObjects:
                    _gameConsoleView.DisplayListOfAllGameObjects();
                    break;

                case MenuOptions.ListNpcs:
                    _gameConsoleView.DisplayListOfAllNpcs();
                    break;

                default:
                    break;
                }
            }

            //
            // close the application
            //
            Outro();
        }
示例#23
0
 IEnumerator IEnumerable.GetEnumerator() => MenuOptions.GetEnumerator();
示例#24
0
		public override void onUpdate()
		{
			if (Input.GetKeyDown (KeyCode.Backspace)) 
			{
				onExitState ();
				base_state.onExitState();
			}
			else if(Input.GetKeyDown(KeyCode.RightArrow))
			{
				selected = (selected < MenuOptions.Stats ? MenuOptions.Maps : MenuOptions.Options);
				SFXManager.instance.playSingleSFX(inputSFX, context.GetComponent<AudioSource>());

			}else if(Input.GetKeyDown(KeyCode.LeftArrow))
			{
				selected = (selected < MenuOptions.Stats ? MenuOptions.Items : MenuOptions.Stats);
				SFXManager.instance.playSingleSFX(inputSFX, context.GetComponent<AudioSource>());

			}else if(Input.GetKeyDown(KeyCode.UpArrow))
			{
				if(selected >= MenuOptions.Stats )selected = selected - 2;
				SFXManager.instance.playSingleSFX(inputSFX, context.GetComponent<AudioSource>());

			}else if(Input.GetKeyDown(KeyCode.DownArrow))
			{
				if(selected < MenuOptions.Stats)selected = selected + 2;
				SFXManager.instance.playSingleSFX(inputSFX, context.GetComponent<AudioSource>());

			}else if(Input.GetKeyDown(KeyCode.Space))
			{
				//open sub menu
				base_state.setCurrentState( base_state.sub_state );
				SFXManager.instance.playSingleSFX(inputSFX, context.GetComponent<AudioSource>());
			}

			if(!options[(int)selected].gameObject.activeInHierarchy )
			{
				//Debug.Log("selected = "+(int)selected);
				lastSelect.gameObject.SetActive(false);
				options[(int)selected].gameObject.SetActive(true);
				lastSelect = options[(int)selected];
			}
		}
示例#25
0
 // Start is called before the first frame update
 void Start()
 {
     MenuOptions.Reset();
 }
示例#26
0
		public override void onEnterState(StateMachine prevState)
		{
			//close dialog if neeeded
			if( uiManager.getViewComponent<Image>("Dialog").IsActive() )
			{
				uiManager.getViewComponent<Image>("Dialog").enabled = false;
				uiManager.getViewComponent<Image>("Dialog").transform.GetChild(0).GetComponent<Text>().enabled = false;
			}
			menu.gameObject.SetActive(true);
			selected = MenuOptions.Items;
		}
 public void Update()
 {
     if (!FirstLoad)
     {
         if (SkMainStatus == SkUtilities.Status.Loading && NeedLoadModules && !NeedRetry)
         {
             foreach (SkBaseModule menuOption in MenuOptions)
             {
                 SkUtilities.Logz(new string[3] {
                     "TOOLBOX", "MODULE", "NOTIFY"
                 }, new string[2]
                 {
                     "NAME: " + menuOption.ModuleName.ToUpper(),
                     "STATUS: " + menuOption.ModuleStatus.ToString().ToUpper()
                 });
                 if (menuOption.ModuleStatus != SkUtilities.Status.Ready)
                 {
                     NeedRetry = true;
                     RetryModule.Add(menuOption);
                 }
             }
             if (!NeedRetry)
             {
                 SkMainStatus = SkUtilities.Status.Ready;
                 ErrorMonitor = true;
                 RetryCount   = 1;
             }
             if (SkMainStatus == SkUtilities.Status.Ready && MenuOptions.Count > 0)
             {
                 NeedLoadModules = false;
                 SkUtilities.Logz(new string[2] {
                     "TOOLBOX", "NOTIFY"
                 }, new string[2]
                 {
                     MenuOptions.Count + " MODULES LOADED",
                     "TOOLBOX READY."
                 });
             }
             else if (SkMainStatus == SkUtilities.Status.Error || MenuOptions.Count <= 0)
             {
                 SkUtilities.Logz(new string[2] {
                     "TOOLBOX", "NOTIFY"
                 }, new string[2]
                 {
                     MenuOptions.Count + " MODULES LOADED",
                     "TOOLBOX FAILED TO LOAD MODULES."
                 }, LogType.Error);
             }
         }
         else if (SkMainStatus == SkUtilities.Status.Loading && NeedRetry)
         {
             if (RetryCount < RetryCountMax + 1)
             {
                 for (int i = 0; i < RetryModule?.Count; i++)
                 {
                     SkUtilities.Logz(new string[4]
                     {
                         "TOOLBOX",
                         "MODULE",
                         "NOTIFY",
                         "RECHECK " + RetryCount
                     }, new string[2]
                     {
                         "NAME: " + RetryModule[i].ModuleName.ToUpper(),
                         "STATUS: " + RetryModule[i].ModuleStatus.ToString().ToUpper()
                     });
                     if (RetryModule[i].ModuleStatus != SkUtilities.Status.Ready)
                     {
                         SkMainStatus = SkUtilities.Status.Loading;
                         NeedRetry    = true;
                     }
                     else if (RetryModule[i].ModuleStatus == SkUtilities.Status.Ready)
                     {
                         RetryModule.Remove(RetryModule[i]);
                         if (RetryModule.Count == 0)
                         {
                             SkMainStatus = SkUtilities.Status.Ready;
                             break;
                         }
                     }
                 }
                 RetryCount++;
             }
             if (MenuOptions.Count <= 0)
             {
                 SkMainStatus = SkUtilities.Status.Error;
             }
             if (SkMainStatus == SkUtilities.Status.Ready)
             {
                 ErrorMonitor = true;
                 RetryCount   = 1;
                 SkUtilities.Logz(new string[2] {
                     "TOOLBOX", "NOTIFY"
                 }, new string[2]
                 {
                     MenuOptions.Count + " MODULES LOADED",
                     "TOOLBOX READY."
                 });
             }
             else if (RetryCount >= RetryCountMax + 1)
             {
                 SkUtilities.Logz(new string[2] {
                     "TOOLBOX", "NOTIFY"
                 }, new string[2] {
                     "MODULE NOT MOVING TO READY STATUS.", "UNLOADING THE MODULE(S)."
                 }, LogType.Warning);
                 foreach (SkBaseModule item in RetryModule)
                 {
                     if (item.ModuleStatus != SkUtilities.Status.Ready)
                     {
                         item.RemoveModule();
                         MenuOptions.Remove(item);
                     }
                 }
                 RetryModule.Clear();
                 NeedRetry    = false;
                 SkMainStatus = SkUtilities.Status.Loading;
                 menuController.UpdateMenuOptions(MenuOptions);
             }
         }
     }
     else
     {
         FirstLoad = false;
     }
     if (ErrorMonitor)
     {
         for (int j = 0; j < MenuOptions?.Count; j++)
         {
             SkBaseModule skBaseModule = MenuOptions[j];
             if ((object)skBaseModule != null && skBaseModule.ModuleStatus == SkUtilities.Status.Error && !RetryModule.Contains(MenuOptions[j]))
             {
                 SkUtilities.Logz(new string[2] {
                     "TOOLBOX", "NOTIFY"
                 }, new string[2]
                 {
                     "MODULE IN ERROR STATUS.",
                     "CHECKING MODULE: " + MenuOptions[j].ModuleName.ToUpper()
                 }, LogType.Warning);
                 RetryModule.Add(MenuOptions[j]);
                 continue;
             }
             SkBaseModule skBaseModule2 = MenuOptions[j];
             if ((object)skBaseModule2 != null && skBaseModule2.ModuleStatus == SkUtilities.Status.Unload)
             {
                 SkUtilities.Logz(new string[2] {
                     "TOOLBOX", "NOTIFY"
                 }, new string[1] {
                     "MODULE READY TO UNLOAD. UNLOADING MODULE: " + MenuOptions[j].ModuleName.ToUpper()
                 }, LogType.Warning);
                 MenuOptions[j].RemoveModule();
                 MenuOptions.Remove(MenuOptions[j]);
                 menuController.UpdateMenuOptions(MenuOptions);
             }
         }
         List <SkBaseModule> retryModule = RetryModule;
         if (retryModule != null && retryModule.Count > 0 && RetryCount < RetryCountMax + 1)
         {
             for (int k = 0; k < RetryModule.Count; k++)
             {
                 if (RetryModule[k].ModuleStatus == SkUtilities.Status.Ready)
                 {
                     RetryModule.Remove(RetryModule[k]);
                     SkUtilities.Logz(new string[2] {
                         "TOOLBOX", "NOTIFY"
                     }, new string[2]
                     {
                         "MODULE READY.",
                         "MODULE: " + MenuOptions[k].ModuleName.ToUpper()
                     });
                     if (RetryModule.Count == 0)
                     {
                         break;
                     }
                 }
             }
             RetryCount++;
         }
         else
         {
             List <SkBaseModule> retryModule2 = RetryModule;
             if (retryModule2 != null && retryModule2.Count > 0 && RetryCount >= RetryCountMax + 1)
             {
                 foreach (SkBaseModule item2 in RetryModule)
                 {
                     if (item2.ModuleStatus != SkUtilities.Status.Ready)
                     {
                         SkUtilities.Logz(new string[2] {
                             "TOOLBOX", "NOTIFY"
                         }, new string[2]
                         {
                             "COULD NOT RESOLVE ERROR.",
                             "UNLOADING THE MODULE: " + item2.ModuleName.ToUpper()
                         }, LogType.Warning);
                         item2.RemoveModule();
                         MenuOptions.Remove(item2);
                     }
                 }
                 RetryModule.Clear();
                 RetryCount = 1;
                 menuController.UpdateMenuOptions(MenuOptions);
                 if (MenuOptions.Count == 0)
                 {
                     SkMainStatus = SkUtilities.Status.Error;
                     SkUtilities.Logz(new string[2] {
                         "TOOLBOX", "NOTIFY"
                     }, new string[2] {
                         "NO MODULES LOADED.", "TOOLBOX ENTERING ERROR STATE."
                     }, LogType.Error);
                 }
             }
         }
     }
     OnUpdate();
 }
示例#28
0
 public List <SkMenuItem> FlushMenu()
 {
     return(MenuOptions.FlushMenu());
 }
        private void UpdateGameOverScreen()
        {
            if (Input.Start()) {
                if (menuCursor == MenuOptions.Quit)
                    Exit ();

                player.Health = healthBarVal = Constants.PLAYER_HEALTH;
                score = 0;
                GameState = GameStates.Playing;
                player.Active = true;
                player.Position.X = GraphicsDevice.Viewport.TitleSafeArea.X;
                player.Position.Y = GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2;
                healthBarRec.Width = Graphics.HealthBar.Width;
                enemies.Clear ();
                bossFight = false;
                boss.Initialize(Graphics.Boss, new Vector2(GraphicsDevice.Viewport.Width + Graphics.Boss.Width, GraphicsDevice.Viewport.Height / 2 - Graphics.Boss.Height / 2), -2f, 0f, false);
                maxEnemyCount = Constants.ENEMY_COUNT;
            }

            if (Input.Down()) menuCursor = MenuOptions.Quit;
            if (Input.Up())   menuCursor = MenuOptions.Restart;
        }
示例#30
0
    private static void DrawVideo()
    {
        MenuOptions.DrawParamInt(new Rect(MenuOptions.rBack.x + GUIM.YRES(32f), MenuOptions.rBack.y + GUIM.YRES(48f) + GUIM.YRES(28f) * 0f, MenuOptions.rBack.width - GUIM.YRES(64f), GUIM.YRES(24f)), Lang.Get("_DISPLAY_RESOLUTION"), ref Options.resolution, MenuOptions.restring);
        if (MenuOptions.DrawParamInt(new Rect(MenuOptions.rBack.x + GUIM.YRES(32f), MenuOptions.rBack.y + GUIM.YRES(48f) + GUIM.YRES(28f) * 1f, MenuOptions.rBack.width - GUIM.YRES(64f), GUIM.YRES(24f)), Lang.Get("_PRESET"), ref Options.preset, MenuOptions.presetname))
        {
            if (Options.preset == 3)
            {
                Options.preset = 2;
            }
            if (Options.preset == 0)
            {
                Options.shadows         = 0;
                Options.antialiasing    = 0;
                Options.colorcorrection = 1;
                Options.posteffects     = 0;
                Options.ssao            = 0;
                Options.sharpness       = 0;
                Options.noise           = 0;
                Options.tone            = 0;
                Options.vig             = 0;
                Options.vsync           = 0;
            }
            if (Options.preset == 1)
            {
                Options.shadows         = 1;
                Options.antialiasing    = 0;
                Options.colorcorrection = 1;
                Options.posteffects     = 0;
                Options.ssao            = 0;
                Options.sharpness       = 0;
                Options.noise           = 0;
                Options.tone            = 0;
                Options.vig             = 0;
                Options.vsync           = 0;
            }
            if (Options.preset == 2)
            {
                Options.shadows         = 2;
                Options.antialiasing    = 1;
                Options.colorcorrection = 1;
                Options.posteffects     = 1;
                Options.ssao            = 1;
                Options.sharpness       = 1;
                Options.noise           = 1;
                Options.tone            = 1;
                Options.vig             = 1;
                Options.vsync           = 1;
            }
        }
        bool flag = false;

        if (MenuOptions.DrawParamFloat(new Rect(MenuOptions.rBack.x + GUIM.YRES(32f), MenuOptions.rBack.y + GUIM.YRES(48f) + GUIM.YRES(28f) * 2f, MenuOptions.rBack.width - GUIM.YRES(64f), GUIM.YRES(24f)), Lang.Get("_BRIGHTNESS"), ref Options.brightness, 0.5f, 2f))
        {
            flag = true;
        }
        if (MenuOptions.DrawParamFloat(new Rect(MenuOptions.rBack.x + GUIM.YRES(32f), MenuOptions.rBack.y + GUIM.YRES(48f) + GUIM.YRES(28f) * 3f, MenuOptions.rBack.width - GUIM.YRES(64f), GUIM.YRES(24f)), Lang.Get("_GAMMA"), ref Options.gamma, 0.5f, 2f))
        {
            flag = true;
        }
        if (flag)
        {
            Options.ApplyBrightness();
        }
        if (MenuOptions.DrawParamInt(new Rect(MenuOptions.rBack.x + GUIM.YRES(32f), MenuOptions.rBack.y + GUIM.YRES(64f) + GUIM.YRES(28f) * 5f, MenuOptions.rBack.width - GUIM.YRES(64f), GUIM.YRES(24f)), Lang.Get("_SHADOWS_QUALITY"), ref Options.shadows, MenuOptions.sname))
        {
            Options.preset = 3;
        }
        if (MenuOptions.DrawParamInt(new Rect(MenuOptions.rBack.x + GUIM.YRES(32f), MenuOptions.rBack.y + GUIM.YRES(64f) + GUIM.YRES(28f) * 6f, MenuOptions.rBack.width - GUIM.YRES(64f), GUIM.YRES(24f)), Lang.Get("_ANTI_ALIASING"), ref Options.antialiasing, MenuOptions.aaname))
        {
            Options.preset = 3;
        }
        if (MenuOptions.DrawParamInt(new Rect(MenuOptions.rBack.x + GUIM.YRES(32f), MenuOptions.rBack.y + GUIM.YRES(64f) + GUIM.YRES(28f) * 7f, MenuOptions.rBack.width - GUIM.YRES(64f), GUIM.YRES(24f)), Lang.Get("_VSYNC"), ref Options.vsync, null))
        {
            Options.preset = 3;
        }
        if (MenuOptions.DrawParamInt(new Rect(MenuOptions.rBack.x + GUIM.YRES(32f), MenuOptions.rBack.y + GUIM.YRES(64f) + GUIM.YRES(28f) * 8f, MenuOptions.rBack.width - GUIM.YRES(64f), GUIM.YRES(24f)), Lang.Get("_COLOR_CORRECTION"), ref Options.colorcorrection, null))
        {
            Options.preset = 3;
        }
        if (MenuOptions.DrawParamInt(new Rect(MenuOptions.rBack.x + GUIM.YRES(32f), MenuOptions.rBack.y + GUIM.YRES(64f) + GUIM.YRES(28f) * 9f, MenuOptions.rBack.width - GUIM.YRES(64f), GUIM.YRES(24f)), Lang.Get("_POSTEFFECTS"), ref Options.posteffects, null))
        {
            Options.preset = 3;
        }
        if (Options.posteffects == 1)
        {
            if (MenuOptions.DrawParamInt(new Rect(MenuOptions.rBack.x + GUIM.YRES(32f), MenuOptions.rBack.y + GUIM.YRES(64f) + GUIM.YRES(28f) * 10f, MenuOptions.rBack.width - GUIM.YRES(64f), GUIM.YRES(24f)), Lang.Get("_SSAO"), ref Options.ssao, null))
            {
                Options.preset = 3;
            }
            if (MenuOptions.DrawParamInt(new Rect(MenuOptions.rBack.x + GUIM.YRES(32f), MenuOptions.rBack.y + GUIM.YRES(64f) + GUIM.YRES(28f) * 11f, MenuOptions.rBack.width - GUIM.YRES(64f), GUIM.YRES(24f)), Lang.Get("_SHARPNESS"), ref Options.sharpness, null))
            {
                Options.preset = 3;
            }
            if (MenuOptions.DrawParamInt(new Rect(MenuOptions.rBack.x + GUIM.YRES(32f), MenuOptions.rBack.y + GUIM.YRES(64f) + GUIM.YRES(28f) * 12f, MenuOptions.rBack.width - GUIM.YRES(64f), GUIM.YRES(24f)), Lang.Get("_NOISE"), ref Options.noise, null))
            {
                Options.preset = 3;
            }
            if (MenuOptions.DrawParamInt(new Rect(MenuOptions.rBack.x + GUIM.YRES(32f), MenuOptions.rBack.y + GUIM.YRES(64f) + GUIM.YRES(28f) * 13f, MenuOptions.rBack.width - GUIM.YRES(64f), GUIM.YRES(24f)), Lang.Get("_TONE"), ref Options.tone, null))
            {
                Options.preset = 3;
            }
            if (MenuOptions.DrawParamInt(new Rect(MenuOptions.rBack.x + GUIM.YRES(32f), MenuOptions.rBack.y + GUIM.YRES(64f) + GUIM.YRES(28f) * 14f, MenuOptions.rBack.width - GUIM.YRES(64f), GUIM.YRES(24f)), Lang.Get("_VIG"), ref Options.vig, null))
            {
                Options.preset = 3;
            }
        }
    }
示例#31
0
 async public Task<MenuOptions> getMenuOptions(string city, string state, string country, string phone)
 {
     MenuOptions options = new MenuOptions();
     string url = String.Format("http://mealaroni.com/api_roni.aspx?biz_city={0}&biz_state={1}&biz_country={2}&biz_phone={3}&cmd=menus_options", city, state, country, phone.Replace(" ", ""));
     string result = await getRequest(url);
     XmlDocument xmldoc = new XmlDocument();
     try
     {
         xmldoc.LoadXml(result);
     }
     catch { }
     options.OptionGroups = xmldoc;
    
     return options;
 }
 void Start()
 {
     speechManager = GameObject.FindWithTag("kinect-speech").GetComponent<SpeechManager>();
     intManager = GameObject.FindWithTag("kinect-interaction").GetComponent<InteractionManager>();
     pMenu = GetComponent<MenuPause>();
     opMenu = GetComponent<MenuOptions>();
 }
示例#33
0
        public static string RenderMenu(KeyMap menu, int selected, MenuOptions options = MenuOptions.Default)
        {
            stringBuilder.Clear();
            var count    = menu.Count;
            var txtItems = new string[count];
            var valItems = new string[count];
            var txtWidth = 0;
            var valWidth = 0;
            var txt      = string.Empty;
            var val      = string.Empty;

            for (var i = 0; i < count; i++)
            {
                var line = menu[i].value;
                if (line is MenuLine)
                {
                    var item = line as MenuLine;
                    txt = item.Text;
                    val = item.Shorcut;
                }

                if (txt != null)
                {
                    txtWidth = Math.Max(txtWidth, txt.Length);
                }
                if (val != null)
                {
                    valWidth = Math.Max(valWidth, val.Length);
                }

                txtItems[i] = txt;
                valItems[i] = val;
            }
            var itemWidth = txtWidth + valWidth + SPACE.Length;
            var lineWidth = itemWidth + SUFFIX.Length + PREFIX.Length;

            string spaceLine  = null;
            string dashedLine = null;
            string singleLine = null;
            string justLine   = new string(CHAR_LIGHT_HORIZONTAL, lineWidth);

            stringBuilder.AppendLine(string.Format(upperLineFormat, justLine));

            string itemFormat1 = $"{{0}}{{1,-{itemWidth}}}{{2}}";
            string itemFormat2 = $"{{0}}{{1,-{txtWidth}}}{SPACE}{{2,-{valWidth}}}{{3}}";


            for (var i = 0; i < count; i++)
            {
                var line       = menu[i].value;
                var isSelected = i == selected;


                if (line is MenuSeparator)
                {
                    var item = line as MenuSeparator;
                    switch (item.type)
                    {
                    case MenuSeparator.Type.NoLine:
                        break;

                    case MenuSeparator.Type.Space:
                        if (spaceLine == null)
                        {
                            spaceLine = string.Format(menuLineFormat, new string(' ', lineWidth));
                        }
                        stringBuilder.AppendLine(spaceLine);
                        break;

                    case MenuSeparator.Type.SingleLine:
                        if (singleLine == null)
                        {
                            singleLine = string.Format(middleLineFormat, justLine);
                        }
                        stringBuilder.AppendLine(singleLine);
                        break;

                    case MenuSeparator.Type.DashedLine:
                        if (dashedLine == null)
                        {
                            dashedLine = string.Format(middleLineFormat, new string(CHAR_DASHED_LINE, lineWidth));
                        }
                        stringBuilder.AppendLine(dashedLine);
                        break;

                    default:
                        throw new Exception();
                    }
                }
                else
                {
                    var    prefix = isSelected ? PREFIX_SELECTED : PREFIX;
                    string item;
                    if (valItems[i] == null)
                    {
                        item = string.Format(itemFormat1, prefix, txtItems[i], SUFFIX);
                    }
                    else if (txtItems[i] != null)
                    {
                        item = string.Format(itemFormat2, prefix, txtItems[i], valItems[i], SUFFIX);
                    }
                    else
                    {
                        throw new ArgumentOutOfRangeException();
                    }
                    stringBuilder.AppendLine(string.Format(menuLineFormat, item));
                }
            }
            stringBuilder.AppendLine(string.Format(bottomLineFormat, justLine));
            return(stringBuilder.ToString());
        }
 void EndAction()
 {
     MenuOptions.Hide(options);
     clicked = false;
 }
示例#35
0
 public void RequestMenu()
 {
     SkMC.RequestSubMenu(MenuOptions.FlushMenu());
 }
        private void UpdateStartMenu()
        {
            if ( MediaPlayer.State != MediaState.Playing )
                MediaPlayer.Play (Sound.MenuMusic);

            if (Input.Start()) {
                if (menuCursor == MenuOptions.Quit)
                    Exit ();

                GameState = GameStates.Playing;
                MediaPlayer.Stop ();
            }

            if (Input.Down()) menuCursor = MenuOptions.Quit;
            if (Input.Up())   menuCursor = MenuOptions.Start;
        }
示例#37
0
 private static void DrawAudio()
 {
     MenuOptions.DrawParamFloat(new Rect(MenuOptions.rBack.x + GUIM.YRES(32f), MenuOptions.rBack.y + GUIM.YRES(48f) + GUIM.YRES(28f) * 0f, MenuOptions.rBack.width - GUIM.YRES(64f), GUIM.YRES(24f)), Lang.Get("_GAME_VOLUME"), ref Options.gamevol, 0f, 1f);
     MenuOptions.DrawParamFloat(new Rect(MenuOptions.rBack.x + GUIM.YRES(32f), MenuOptions.rBack.y + GUIM.YRES(48f) + GUIM.YRES(28f) * 1f, MenuOptions.rBack.width - GUIM.YRES(64f), GUIM.YRES(24f)), Lang.Get("_MENU_VOLUME"), ref Options.menuvol, 0f, 1f);
 }
        static void Main(string[] args)
        {
            #region //Variables used in Main()

            var         allOptions   = Enum.GetValues(typeof(MenuOptions));
            string      choiceString = string.Empty;
            MenuOptions selectedOption;
            MenuOptions quitOption = MenuOptions.Quit;
            int         quitVal    = (int)quitOption;
            populateCities();
            #endregion

            #region //Capture user's menu-choice and then call appropriate method
            try
            {
                while (!string.Equals(choiceString, quitVal.ToString()))
                {
                    //Present user with options:
                    Console.ForegroundColor = ConsoleColor.Magenta;
                    Console.WriteLine("Please chose from the following menu options: ");

                    //Print out all menu options
                    foreach (var optionIem in allOptions)
                    {
                        Console.WriteLine($"[{optionIem:D}]  {optionIem:G}");
                    }

                    //Capture selection; change color of output:
                    Console.Write("Your choice: ");
                    Console.ForegroundColor = ConsoleColor.Green;
                    choiceString            = Console.ReadLine();

                    #region //Verify selected menu-option and call respective method via switch statement
                    //Check once more to ensure that the user has not selected 'Quit'
                    //Then Convert choiceString into a 'MenOptions' type via a variable called 'selectedOption'
                    if ((!string.Equals(choiceString, quitVal.ToString())) && Enum.TryParse(choiceString, true, out selectedOption))
                    {
                        //Make sure that the next output is in 'correct' color
                        Console.ForegroundColor = ConsoleColor.Magenta;


                        switch (selectedOption)
                        {
                            #region //case MenuOptions.DisplayCities:
                        case MenuOptions.DisplayCities:
                            Console.Write($"\n");
                            City.PrintHeader();
                            foreach (City element in cities)
                            {
                                element.Print();
                            }
                            Console.Write($"\n");
                            choiceString = string.Empty;
                            continue;
                            #endregion //MenuOptions.DisplayCities:

                            #region    //case MenuOptions.CityDistances:
                        case MenuOptions.CityDistances:

                            int           count      = 0;
                            StringBuilder cityOption = new StringBuilder();

                            Console.WriteLine("City List: ");
                            foreach (City element in cities)
                            {
                                cityOption.Append($"{count}. {element.Name.ToString()}");
                                Console.WriteLine($"   {cityOption}");
                                count++;
                                cityOption.Clear();
                            }
                            captureSelectedCitiesAndReturnDistance();
                            choiceString = string.Empty;
                            continue;
                            #endregion  //case MenuOptions.CityDistances:
                        }
                    }
                    #endregion //End of: Verify menu-option and call respective method via switch statement
                }
                #endregion     //End of: Capture user's menu-choice and then call appropriate method
            }
            #region            //Catch
            catch (Exception ex)
            {
                //Print all the 'inner' exceptions which where sent to Main() by subsequently called methods
                string padding = " ";
                do
                {
                    Console.WriteLine($"{padding}{ex.Message} thrown from {ex.TargetSite}");
                }while (ex != null);
            }
            #endregion //Catch
        }
示例#39
0
        private void UpdateMenuOptions()
        {
            if (SelectedItems.Count == 1)
            {
                navigateMenuItem.IsEnabled = true;
            }
            else
            {
                navigateMenuItem.IsEnabled = false;
            }

            bool bCanFilter   = false;
            bool bCanUnfilter = false;

            foreach (BaseErrorListItemViewModel v in SelectedItems)
            {
                if (!(v is FilterableErrorListItemViewModel))
                {
                    bCanFilter   = false;
                    bCanUnfilter = false;
                    break;
                }
                else
                {
                    FilterableErrorListItemViewModel filterable = v as FilterableErrorListItemViewModel;
                    if (filteredErrorListData.Contains(filterable))
                    {
                        bCanUnfilter = true;
                    }
                    else
                    {
                        bCanFilter = true;
                    }
                }

                if (bCanFilter && bCanUnfilter)
                {
                    bCanFilter   = false;
                    bCanUnfilter = false;
                    break;
                }
            }

            if (bCanFilter || bCanUnfilter)
            {
                if (!MenuOptions.Contains(separatorBeforeFilterItem))
                {
                    MenuOptions.Add(separatorBeforeFilterItem);
                }
            }
            else
            if (MenuOptions.Contains(separatorBeforeFilterItem))
            {
                MenuOptions.Remove(separatorBeforeFilterItem);
            }

            if (bCanFilter)
            {
                if (!MenuOptions.Contains(filterMenuItem))
                {
                    MenuOptions.Add(filterMenuItem);
                }
            }
            else
            {
                if (MenuOptions.Contains(filterMenuItem))
                {
                    MenuOptions.Remove(filterMenuItem);
                }
            }

            if (bCanUnfilter)
            {
                if (!MenuOptions.Contains(unFilterMenuItem))
                {
                    MenuOptions.Add(unFilterMenuItem);
                }
            }
            else
            {
                if (MenuOptions.Contains(unFilterMenuItem))
                {
                    MenuOptions.Remove(unFilterMenuItem);
                }
            }
        }
        public void CreatePlayer(GameContext gameContext)
        {
            gameContext.Player.Name = this.GetPlayerName();

            // Gender selection
            var menuMax = MenuOptions.ListOptions(gameContext.List.GenderList);

            Console.WriteLine($"\nWhat is your gender? ");
            var tempUserInput = Console.ReadLine();

            var enteredGender = new InteractionService().GetUserInputForNumberedOptionMenu(tempUserInput, menuMax);

            if (enteredGender == 0)
            {
                gameContext.Player.Gender = "Male";
                Console.WriteLine($"\n{ gameContext.Player.Name} is {gameContext.Player.Gender}\n");
            }
            else if (enteredGender == 1)
            {
                gameContext.Player.Gender = "Female";
                Console.WriteLine($"\n{ gameContext.Player.Name} is {gameContext.Player.Gender}\n");
            }
            else if (enteredGender == 2)
            {
                gameContext.Player.Gender = "NonBinary";
                Console.WriteLine($"\n{ gameContext.Player.Name} is {gameContext.Player.Gender}\n");
            }

            // Race Selection
            menuMax = MenuOptions.ListOptions(gameContext.List.RaceList);

            Console.WriteLine("\nWhat is your race?");
            tempUserInput = Console.ReadLine();

            var enteredRace = new InteractionService().GetUserInputForNumberedOptionMenu(tempUserInput, menuMax);

            if (enteredRace == 0)
            {
                gameContext.Player.Race = "Lizarian";
                Console.WriteLine($"\n{ gameContext.Player.Name} is a {gameContext.Player.Gender} {gameContext.Player.Race}\n");
            }
            else if (enteredRace == 1)
            {
                gameContext.Player.Race = "Cepholarian";
                Console.WriteLine($"\n{ gameContext.Player.Name} is a {gameContext.Player.Gender} {gameContext.Player.Race}\n");
            }
            else if (enteredRace == 2)
            {
                gameContext.Player.Race = "Fuzzarian";
                Console.WriteLine($"\n{ gameContext.Player.Name} is a {gameContext.Player.Gender} {gameContext.Player.Race}\n");
            }

            // Job Selection
            menuMax = MenuOptions.ListOptions(gameContext.List.JobList);

            Console.WriteLine("\nWhat is your job?");
            tempUserInput = Console.ReadLine();

            var enteredJob = new InteractionService().GetUserInputForNumberedOptionMenu(tempUserInput, menuMax);

            if (enteredJob == 0)
            {
                gameContext.Player.Job = "Navigator";
                Console.WriteLine($"\n{ gameContext.Player.Name} is a {gameContext.Player.Gender} {gameContext.Player.Race} {gameContext.Player.Job}\n");
                gameContext.Player.NavigationSkill += 5;
                if (gameContext.Player.Race == "Lizarian")
                {
                    Console.WriteLine($"{gameContext.Player.Name} the Navi >*^,^,^~~~");
                }

                Console.WriteLine("NavigationSkill +5\n");
                gameContext.PlayerStats.PrintPlayerStats(gameContext);
                StandardMessages.ReturnToContinue();
            }
            else if (enteredJob == 1)
            {
                gameContext.Player.Job = "Gunslinger";
                Console.WriteLine($"\n{ gameContext.Player.Name} is a {gameContext.Player.Gender} {gameContext.Player.Race} {gameContext.Player.Job}\n");
                gameContext.Player.WeaponSkill += 5;
                Console.WriteLine("WeaponSkill +5\n");
                gameContext.PlayerStats.PrintPlayerStats(gameContext);
                StandardMessages.ReturnToContinue();
            }
            else if (enteredJob == 2)
            {
                gameContext.Player.Job = "Timebender";
                Console.WriteLine($"\n{ gameContext.Player.Name} is a {gameContext.Player.Gender} {gameContext.Player.Race} {gameContext.Player.Job}\n");
                gameContext.Player.TimeSkill += 5;
                Console.WriteLine("TimeSkill +5\n");
                gameContext.PlayerStats.PrintPlayerStats(gameContext);
                StandardMessages.ReturnToContinue();
            }
        }
        // Reads the user input from console and executes specified commands based on the input.
        private void ReadChoice(ref ConsoleKey choice1, ref ConsoleKey choice2, MenuOptions option, int accountNumber = 0)
        {
            do
            {
                choice2 = Console.ReadKey().Key;
                switch (choice2)
                {
                case ConsoleKey.Y:
                    if (option == MenuOptions.LoginMenu)
                    {
                        LoginMenu(ref choice2);
                    }
                    else if (option == MenuOptions.CreateAccount)
                    {
                        CreateAccount(ref choice1, ref choice2);
                    }
                    else if (option == MenuOptions.SearchAccount)
                    {
                        SearchAccount(ref choice2);
                    }
                    else if (option == MenuOptions.Deposit)
                    {
                        Deposit(ref choice2);
                    }
                    else if (option == MenuOptions.Withdraw)
                    {
                        Withdraw(ref choice2);
                    }
                    else if (option == MenuOptions.ViewStatement)
                    {
                        choice2 = ConsoleKey.N;
                        Account(accountNumber).SendEmail(EmailOptions.Statement);
                        Console.WriteLine("\n Email has been sent.");
                    }
                    else if (option == MenuOptions.ViewStatement2)
                    {
                        ViewStatement(ref choice2);
                    }
                    else if (option == MenuOptions.DeleteAccount)
                    {
                        accounts.Remove(Account(accountNumber));
                        File.Delete($"{accountNumber}.txt");
                        Console.WriteLine("\n Account deleted successfully.");
                        Console.Write("\n Delete another account (Y/N)? ");
                        ReadChoice(ref choice1, ref choice2, MenuOptions.DeleteAccount2);
                    }
                    else if (option == MenuOptions.DeleteAccount2)
                    {
                        DeleteAccount(ref choice2);
                    }
                    break;

                case ConsoleKey.N:
                    break;

                default:
                    Console.Write("\b \b");
                    break;
                }
            } while (choice2 != ConsoleKey.N);
        }
示例#42
0
/*
 *      static int Calculate (MenuOptions choice, int num) {
 *          switch (choice) {
 *              case MenuOptions.Inc: return ++num; break;
 *              case MenuOptions.Dec: return --num; break;
 *              default: throw new Exception (message: "Invalid choice"); break;
 *          };
 *      }
 */

        static int Calculate(MenuOptions choice, int num) =>
        choice switch
        {