Example #1
0
 private static void HandleShowResult()
 {
     PrintResult();
     Console.WriteLine("press any key continue");
     Console.ReadKey();
     m_level = MenuLevel.SelectCommand;
 }
Example #2
0
 private static void HandleTerm()
 {
     PrintHeadLine();
     Console.WriteLine("please type term:");
     m_term  = Console.ReadLine();
     m_level = MenuLevel.RunCommand;
 }
Example #3
0
        private static void HandleSelectCommand()
        {
            PrintMainManu();
            m_option = Console.ReadKey().KeyChar;
            if (m_option == '1' || m_option == '2' || m_option == '3')
            {
                m_level = MenuLevel.UseCache;
                switch (m_option)
                {
                case '1':
                    m_command = Command.TF;
                    break;

                case '2':
                    m_command = Command.IDF;
                    break;

                case '3':
                    m_command = Command.TFIDF;
                    break;

                default:
                    break;
                }
            }
            else
            {
                if (m_option == 'q')
                {
                    m_level = MenuLevel.Exit;
                }
            }
        }
Example #4
0
 private void BackToRoot()
 {
     Debug.Log("Back to Root Level");
     _battleSubMenuView.CleanUp();
     _battleSubMenuView.Hide();
     _menuLevel = MenuLevel.Root;
 }
Example #5
0
        public string[][] getGuilds()
        {
            if (!loggedIn)
            {
                throw new NotLoggedInException();
            }
            menuLevel = MenuLevel.GUILDS;
            var client  = new RestClient("https://discordapp.com/api/users/@me/guilds");
            var request = new RestRequest(Method.GET);

            request.AddHeader("cache-control", "no-cache");
            request.AddHeader("cookie", "locale=en-US;");
            request.AddHeader("accept-encoding", "gzip, deflate, br");
            request.AddHeader("referer", "https://discordapp.com");
            request.AddHeader("accept", "*/*");
            request.AddHeader("user-agent", useragent);
            request.AddHeader("accept-language", "en-US");
            request.AddHeader("x-fingerprint", fingerprint);
            request.AddHeader("authorization", authToken);
            IRestResponse response = client.Execute(request);

            string  res       = response.Content.ToString();
            dynamic guildList = JsonConvert.DeserializeObject(res);

            string[][] guilds = new string[0xFF][];
            int        i      = 0;

            foreach (var guild in guildList)
            {
                guilds[i] = new string[] { guild.name, guild.id };
                i++;
            }
            return(guilds);
        }
Example #6
0
        private static void HandleRunCommand()
        {
            try
            {
                switch (m_useCache)
                {
                case true:
                    switch (m_command)
                    {
                    case Command.TF:
                        m_result = m_tfidf.CacheCalculateTF(m_fileName, m_term);
                        break;

                    case Command.IDF:
                        m_result = m_tfidf.CacheCalculateIDF(m_term);
                        break;

                    case Command.TFIDF:
                        m_result = m_tfidf.CacheCalculateTFIDF(m_fileName, m_term);
                        break;

                    default:
                        break;
                    }
                    break;

                case false:
                    switch (m_command)
                    {
                    case Command.TF:
                        m_result = TFIDF.CalculateTF(m_path, m_fileName, m_term);
                        break;

                    case Command.IDF:
                        m_result = TFIDF.CalculateIDF(m_path, m_term);
                        break;

                    case Command.TFIDF:
                        m_result = TFIDF.CalculateTFIDF(m_path, m_fileName, m_term);
                        break;

                    default:
                        break;
                    }
                    break;

                default:
                    break;
                }

                m_level = MenuLevel.ShowResult;
            }
            catch (Exception e)
            {
                Console.WriteLine("error: {0}", e.Message);
                Console.WriteLine("press any key to try again");
                Console.ReadKey();
                m_level = MenuLevel.SelectCommand;
            }
        }
Example #7
0
        /// <summary>
        /// Moves the menu forward based on userInput
        /// </summary>
        /// <param name="userInput">User input.</param>
        /// <returns>Response to the user input.</returns>
        private string MoveForward(string userInput)
        {
            string response = Menu.UnableToUnderstand;

            lock (syncRoot)
            {
                switch (this.level)
                {
                case MenuLevel.None:
                    this.level = MenuLevel.TopLevel;
                    this.RaiseEvent(MenuLevel.None, MenuLevel.TopLevel);
                    response = this.GetMessageAtCurrentLevel();
                    break;

                case MenuLevel.TopLevel:
                    if (this.xmlParser.ValidateInput(userInput, (int)this.Level, null /* menu name*/))
                    {
                        this.topLevelMenuName = userInput;
                        this.level            = MenuLevel.SubLevel;
                        this.RaiseEvent(MenuLevel.TopLevel, MenuLevel.SubLevel);
                        response = this.GetMessageAtCurrentLevel();
                    }
                    break;

                case MenuLevel.SubLevel:
                    if (this.xmlParser.ValidateInput(userInput, (int)this.Level, this.topLevelMenuName))
                    {
                        this.level = MenuLevel.HelpDeskRequested;
                        var helpdeskNumber = this.xmlParser.HelpdeskNumber(this.topLevelMenuName, userInput);
                        this.RaiseEvent(MenuLevel.SubLevel, MenuLevel.HelpDeskRequested, helpdeskNumber);
                        response = "Calling help desk";
                    }
                    break;

                case MenuLevel.HelpDeskRequested:

                    if (this.level == MenuLevel.HelpDeskRequested)
                    {
                        this.level = MenuLevel.SubLevel;
                    }

                    if (this.xmlParser.ValidateInput(userInput, (int)this.Level, this.topLevelMenuName))
                    {
                        this.level = MenuLevel.HelpDeskRequested;
                        var helpdeskNumber = this.xmlParser.HelpdeskNumber(this.topLevelMenuName, userInput);
                        this.RaiseEvent(MenuLevel.SubLevel, MenuLevel.HelpDeskRequested, helpdeskNumber);
                        response = "Calling help desk";
                    }
                    break;

                default:
                    break;
                }
            }

            return(response);
        }
        private void InsertOrUpdateMenu(IMenuRepository menuRepository, int index, Menu menu, MenuLevel level, Guid? parentId)
        {
            // sort start with 1

            // a1, check the paramters
            //  1, check the level and parentId
            //      1a, when level = parent, the parentId = null
            //      2a, when level != parent and the parentId = null, throw exception.
            // a2, check the index
            //  1, index > 0

            // a1, when level = parent
            //  1, find all menus that level = parent
            //      1a, if the index > menus count, set the sort = (countOfMenu + 1)
            //      1b, if the index <= menus count, set the sort = (countOfMenu + 1), then set the sort that large then index add one
            // a2, when level = child
            //  1, find all menus that parentId = input parentId
            //      1a, when the index > menus count, set the sort = (countOfMenu + 1)
            //      1b, when the index <= menus count, set the sort = (countOfMenu + 1), then set the sort that large then index add one

            ISpecification<Menu> spec = null;
            var existMenu = menuRepository.Exist(Specification<Menu>.Eval(m => m.ID == menu.ID));

            if (level == MenuLevel.Parent)
            {
                spec = Specification<Menu>.Eval(m => m.Level == MenuLevel.Parent);
            }

            if (level == MenuLevel.Children)
            {
                if (!parentId.HasValue)
                    throw new ArgumentNullException("parentId", "When menuLevel is children, the parentId must be not null.");

                spec = Specification<Menu>.Eval(m => m.Level == MenuLevel.Children && m.ParentId == parentId);
            }

            var menus = this.GetMenus(menuRepository, spec, menu.ID, existMenu);
            
            // if the menu not exist, add the menu (the menu has been atteched).
            if (!existMenu)
            {
                var sort = this.InsertSortMenu(menus, index);
                menu.SetSort(sort);
                menuRepository.Add(menu);
            }
            else
            {
                var sort = this.MoveSortMenu(menus, menu.Sort, index);
                menu.SetSort(sort);
                menuRepository.Update(menu);
                foreach (var item in menus)
                    menuRepository.Update(item);
            }
        }
Example #9
0
        /// <summary>
        /// Raise menu level changed event.
        /// </summary>
        /// <param name="previous"></param>
        /// <param name="current"></param>
        private void RaiseEvent(MenuLevel previous, MenuLevel current, string helpdeskNumber = null)
        {
            var eventHandler = this.MenuLevelChanged;

            if (eventHandler != null)
            {
                MenuLevelChangedEventArgs eventArgs = new MenuLevelChangedEventArgs(previous, current);
                eventArgs.HelpdeskNumber = helpdeskNumber;
                eventHandler(this, eventArgs);
            }
        }
Example #10
0
        private static void HandleFileName()
        {
            PrintHeadLine();
            PrintSubMenuHeadLine();
            if (m_command != Command.IDF)
            {
                Console.WriteLine("please type File name:");
                m_fileName = Console.ReadLine();
            }

            m_level = MenuLevel.Term;
        }
Example #11
0
        /// <param name="displayName">菜单显示名</param>
        /// <param name="description">菜单描述</param>
        /// <param name="parentId">父菜单 ID</param>
        /// <param name="level">菜单目录级别, 0 级表示根目录, 1-m 级必须有 parentId</param>
        /// <param name="sort">菜单排序</param>
        /// <param name="actionsId">功能行为 ID</param>
        /// <param name="updatedBy">创建人</param>
        public void Update(string displayName, string description, Guid?parentId, MenuLevel level, int sort, Guid?actionsId, string updatedBy)
        {
            this.DisplayName = displayName;
            this.Description = description;
            this.ParentId    = parentId;
            this.Level       = level;
            this.Sort        = sort;
            this.ActionsId   = actionsId;

            this.SetUpdatedBy(updatedBy);
            this.AdjustParentViaLevel();
        }
Example #12
0
 //activer et desactiver menu level
 public void EnableDisableMenuLevel()
 {
     if (booMenuLevel)
     {
         MenuLevel.SetActive(false);
         booMenuLevel = false;
     }
     else
     {
         MenuLevel.SetActive(true);
         booMenuLevel = true;
     }
 }
Example #13
0
 protected override void PostInitialize()
 {
   if (!Fez.PublicDemo && this.GameState.SaveSlot == -1)
   {
     this.SaveSlotMenuLevel = new SaveSlotSelectionLevel();
     this.MenuLevels.Add((MenuLevel) this.SaveSlotMenuLevel);
     this.SaveSlotMenuLevel.Parent = this.MenuRoot;
     this.nextMenuLevel = (MenuLevel) this.SaveSlotMenuLevel;
     this.SaveSlotMenuLevel.RecoverMainMenu = new Func<bool>(this.RecoverMenuRoot);
     this.RealMenuRoot = this.MenuRoot;
     this.MenuRoot = (MenuLevel) this.SaveSlotMenuLevel;
   }
   else
     this.AddTopElements();
 }
Example #14
0
    private void Magic()
    {
        var activeFighter = _battleActionProcessor.ActiveFighter;

        if (activeFighter != null && activeFighter.spells.Count > 0)
        {
            _menuLevel = MenuLevel.Sub;
            _battleSubMenuModel.SetSubMenu(SubMenu.Magic);
            SetSubPanel(activeFighter.spells.ToList <SubMenuItem>());
            Debug.Log("Magic Sub Menu");
        }
        else
        {
            Debug.Log("Fighter has no spells");
        }
    }
Example #15
0
    private void Bestia()
    {
        var activeFighter = _battleActionProcessor.ActiveFighter;

        if (activeFighter != null && activeFighter.bestias.Count > 0)
        {
            _menuLevel = MenuLevel.Sub;
            _battleSubMenuModel.SetSubMenu(SubMenu.Bestia);
            SetSubPanel(activeFighter.bestias.ToList <SubMenuItem>());
            Debug.Log("Bestia Sub Menu");
        }
        else
        {
            Debug.Log("Fighter has no bestias");
        }
    }
Example #16
0
    void Start()
    {
        _menuLevel   = MenuLevel.Root;
        _battleState = BattleState.OnGoing;
        var battleParties = new BattleParties(battleField, _battleMenuView.GetPartyMemberViews());

        _battleMenuModel       = new BattleMenuModel(_battleMenuView.GetPartyMemberViews(), _battleMenuView.gridNavigationMenu);
        _battleActionProcessor = new BattleActionProcessor(battleParties);
        _battleSubMenuModel    = new BattleSubMenuModel(_battleActionProcessor, _battleSubMenuView.gridNavigationMenu);

        _battleMenuView.InitPartyMemberView(_battleActionProcessor);
        _battleActionProcessor.StartCoroutines(this);

        SetRootMenuEvents();
        SetSubMenuEvents();
        SetBattleActionProcessorEvents();
    }
Example #17
0
 protected override void PostInitialize()
 {
     if (!Fez.PublicDemo && this.GameState.SaveSlot == -1)
     {
         this.SaveSlotMenuLevel = new SaveSlotSelectionLevel();
         this.MenuLevels.Add((MenuLevel)this.SaveSlotMenuLevel);
         this.SaveSlotMenuLevel.Parent          = this.MenuRoot;
         this.nextMenuLevel                     = (MenuLevel)this.SaveSlotMenuLevel;
         this.SaveSlotMenuLevel.RecoverMainMenu = new Func <bool>(this.RecoverMenuRoot);
         this.RealMenuRoot = this.MenuRoot;
         this.MenuRoot     = (MenuLevel)this.SaveSlotMenuLevel;
     }
     else
     {
         this.AddTopElements();
     }
 }
Example #18
0
        private static void HandlePath()
        {
            PrintHeadLine();
            Console.WriteLine("Please enter your directory path:");
            m_path = Console.ReadLine();
            bool dirExists = Directory.Exists(m_path);

            if (dirExists)
            {
                m_tfidf = new TFIDF(m_path);
                m_level = MenuLevel.SelectCommand;
            }
            else
            {
                Console.WriteLine("Invalid path: Directory not found");
                Console.WriteLine("Press any key to continue");
                Console.ReadKey();
            }
        }
Example #19
0
        private void AddTopElements()
        {
            MenuLevel menuLevel1 = this.MenuRoot;
            int       num1       = 0;
            string    text1      = "ContinueGame";
            Action    onSelect1  = new Action(((MenuBase)this).ContinueGame);
            int       at1        = num1;
            MenuItem  menuItem   = menuLevel1.AddItem(text1, onSelect1, at1);

            menuItem.Disabled   = this.GameState.SaveData.IsNew || this.GameState.SaveData.Level == null || this.GameState.SaveData.CanNewGamePlus;
            menuItem.Selectable = !menuItem.Disabled;
            if (this.GameState.IsTrialMode || this.GameState.SaveData.IsNew)
            {
                MenuLevel menuLevel2 = this.MenuRoot;
                int       num2       = 1;
                string    text2      = "StartNewGame";
                Action    onSelect2  = new Action(((MenuBase)this).StartNewGame);
                int       num3       = menuItem.Disabled ? 1 : 0;
                int       at2        = num2;
                menuLevel2.AddItem(text2, onSelect2, num3 != 0, at2);
            }
            else
            {
                MenuLevel menuLevel2 = this.MenuRoot;
                int       num2       = 1;
                string    text2      = "StartNewGame";
                Action    onSelect2  = (Action)(() => this.ChangeMenuLevel(this.StartNewGameMenu, false));
                int       num3       = menuItem.Disabled ? 1 : 0;
                int       at2        = num2;
                menuLevel2.AddItem(text2, onSelect2, num3 != 0, at2);
            }
            if (this.GameState.SaveData.CanNewGamePlus)
            {
                MenuLevel menuLevel2 = this.MenuRoot;
                int       num2       = 2;
                string    text2      = "StartNewGamePlus";
                Action    onSelect2  = new Action(this.NewGamePlus);
                int       at2        = num2;
                menuLevel2.AddItem(text2, onSelect2, at2);
            }
            this.MenuRoot.SelectedIndex = this.GameState.SaveData.CanNewGamePlus ? 2 : (this.MenuRoot.Items[0].Selectable ? 0 : 1);
        }
Example #20
0
        /// <summary>
        /// Moves the menu backward based on userInput
        /// </summary>
        /// <param name="userInput">User input.</param>
        /// <returns>Response to the user input.</returns>
        private string MoveBackward(string userInput)
        {
            string response = " ";

            lock (syncRoot)
            {
                switch (this.level)
                {
                case MenuLevel.None:
                    // Nothing to do since we are at the first level and there
                    // no more back levels.
                    break;

                case MenuLevel.TopLevel:
                    // Stay in top level.
                    response = this.GetMessageAtCurrentLevel();
                    break;

                case MenuLevel.SubLevel:
                    this.level = MenuLevel.TopLevel;
                    this.RaiseEvent(MenuLevel.SubLevel, MenuLevel.TopLevel);
                    response = this.GetMessageAtCurrentLevel();
                    break;

                case MenuLevel.HelpDeskRequested:

                    this.level = MenuLevel.TopLevel;
                    this.RaiseEvent(MenuLevel.SubLevel, MenuLevel.TopLevel);
                    response = this.GetMessageAtCurrentLevel();
                    break;

                default:
                    break;
                }
            }

            return(response);
        }
Example #21
0
 private static void HandleUseCache()
 {
     PrintSubMenuHeadLine();
     PrinCacheQuestion();
     m_option = Char.ToLower(Console.ReadKey().KeyChar);
     if (m_option == 'y')
     {
         m_useCache = true;
         m_level    = MenuLevel.FileName;
     }
     else
     {
         if (m_option == 'n')
         {
             m_useCache = false;
             m_level    = MenuLevel.FileName;
         }
         else
         {
             PrinCacheQuestion();
         }
     }
 }
Example #22
0
        public string[][] getChannels(string guildId)
        {
            if (!loggedIn)
            {
                throw new NotLoggedInException();
            }
            menuLevel = MenuLevel.CHANNELS;
            var client  = new RestClient("https://discordapp.com/api/guilds/" + guildId + "/channels");
            var request = new RestRequest(Method.GET);

            request.AddHeader("cache-control", "no-cache");
            request.AddHeader("cookie", "locale=en-US;");
            request.AddHeader("accept-encoding", "gzip, deflate, br");
            request.AddHeader("referer", "https://discordapp.com");
            request.AddHeader("accept", "*/*");
            request.AddHeader("user-agent", useragent);
            request.AddHeader("accept-language", "en-US");
            request.AddHeader("x-fingerprint", fingerprint);
            request.AddHeader("authorization", authToken);
            IRestResponse response = client.Execute(request);

            string  res         = response.Content.ToString();
            dynamic channelList = JsonConvert.DeserializeObject(res);

            string[][] channels = new string[0xFF][];
            int        i        = 0;

            foreach (var channel in channelList)
            {
                if (channel.type == 0)
                {
                    channels[i] = new string[] { "#" + channel.name, channel.id };
                    i++;
                }
            }
            return(channels);
        }
Example #23
0
        protected override void PostInitialize()
        {
            if (PauseMenu.Starfield == null)
            {
                ServiceHelper.AddComponent((IGameComponent)(PauseMenu.Starfield = new StarField(this.Game)));
            }
            MenuLevel menuLevel1 = this.MenuRoot;
            int       num1       = 0;
            string    text1      = "ResumeGame";
            Action    onSelect1  = new Action(((MenuBase)this).ResumeGame);
            int       at1        = num1;

            menuLevel1.AddItem(text1, onSelect1, at1);
            MenuLevel menuLevel2 = this.MenuRoot;
            int       num2       = 1;
            string    text2      = "StartNewGame";
            Action    onSelect2  = (Action)(() => this.ChangeMenuLevel(this.StartNewGameMenu, false));
            int       at2        = num2;

            menuLevel2.AddItem(text2, onSelect2, at2);
            this.wasStrict = this.InputManager.StrictRotation;
            this.InputManager.StrictRotation = false;
            this.GameState.SaveToCloud(false);
        }
Example #24
0
 public Menu(MenuLevel level, bool initDefaultReturnToMain = true, bool initDefaultReturnToPrevious = true)
 {
     _menuLevel = level;
     _initDefaultReturnToMAin     = initDefaultReturnToMain;
     _initDefaultReturnToPrevious = initDefaultReturnToPrevious;
 }
Example #25
0
 private void DrawLevel(MenuLevel level, bool toTexture)
 {
   float viewScale = SettingsManager.GetViewScale(this.GraphicsDevice);
   float num = toTexture ? 512f * viewScale : (float) this.GraphicsDevice.Viewport.Height;
   bool flag = false;
   switch (Culture.Language)
   {
     case Language.English:
     case Language.Chinese:
     case Language.Japanese:
     case Language.Korean:
       lock (level)
       {
         SpriteFont local_3 = !Culture.IsCJK || (double) viewScale <= 1.5 ? this.Fonts.Small : this.Fonts.Big;
         int local_4 = 0;
         for (int local_5 = 0; local_5 < level.Items.Count; ++local_5)
         {
           if (!level.Items[local_5].Hidden)
             ++local_4;
         }
         float local_6 = (level.Oversized ? 512f : 256f) * viewScale;
         for (int local_7 = 0; local_7 < level.Items.Count; ++local_7)
         {
           MenuItem local_8 = level.Items[local_7];
           if (!local_8.Hidden)
           {
             bool local_9 = false;
             string local_10 = local_8.ToString();
             Vector2 local_11 = this.Fonts.Big.MeasureString(local_10) * viewScale;
             if (string.IsNullOrEmpty(local_8.Text))
               local_11 = this.Fonts.Big.MeasureString("A");
             local_8.Size = local_11;
             float local_12 = level.Items.Count == 0 ? 0.0f : (local_8.Size.Y + this.Fonts.TopSpacing) * this.Fonts.BigFactor;
             float local_13 = this.Fonts.BigFactor * viewScale;
             if (Culture.IsCJK && (double) viewScale <= 1.5)
               local_13 *= 2f;
             int local_14 = local_7;
             Vector3 local_15;
             if (local_4 > 10)
             {
               for (int local_16 = 0; local_16 <= local_7; ++local_16)
               {
                 if (level.Items[local_16].Hidden)
                   --local_14;
               }
               local_9 = local_4 > 10 && local_14 != local_4 - 1;
               if (flag)
                 local_13 = (local_8.IsGamerCard || local_9 ? this.Fonts.SmallFactor : this.Fonts.BigFactor) * viewScale;
               float local_17 = 5f;
               if (local_14 == local_4 - 1)
                 local_15 = new Vector3(0.0f, (float) (((double) local_17 - 9.0) * (double) local_12 - (double) local_12 / 2.0), 0.0f);
               else if (local_14 < 8)
               {
                 local_15 = new Vector3((float) (-(double) local_6 / 2.0), (float) (((double) local_17 - (double) local_14) * (double) local_12 - (double) local_12 / 2.0), 0.0f);
               }
               else
               {
                 int local_14_1 = local_14 - 8;
                 local_15 = new Vector3(local_6 / 2f, (float) (((double) local_17 - (double) local_14_1) * (double) local_12 - (double) local_12 / 2.0), 0.0f);
               }
               if (local_9)
               {
                 float local_18 = (float) this.Game.GraphicsDevice.Viewport.Width * 0.45f;
                 local_10 = WordWrap.Split(local_10, local_3, (local_18 - local_15.X / 2f) / local_13);
                 int local_19 = 0;
                 foreach (int item_0 in local_10)
                 {
                   if (item_0 == 10)
                     ++local_19;
                 }
                 if (local_19 > 0)
                 {
                   local_11 = this.Fonts.Small.MeasureString(local_10) * viewScale;
                   local_12 = (local_11.Y + this.Fonts.TopSpacing) * this.Fonts.SmallFactor;
                   local_8.Size = new Vector2(local_11.X, local_8.Size.Y);
                 }
                 else if (flag)
                 {
                   local_12 = level.Items.Count == 0 ? 0.0f : (local_8.Size.Y + this.Fonts.TopSpacing) * this.Fonts.SmallFactor;
                   local_11.X *= this.Fonts.SmallFactor / this.Fonts.BigFactor;
                 }
               }
             }
             else
             {
               float local_21 = (float) local_4 / 2f;
               for (int local_22 = 0; local_22 <= local_7; ++local_22)
               {
                 if (level.Items[local_22].Hidden)
                   --local_14;
               }
               local_15 = new Vector3(0.0f, (float) (((double) local_21 - (double) local_14) * (double) local_12 - (double) local_12 / 2.0), 0.0f);
             }
             local_15.Y *= -1f;
             local_15.Y += num / 2f;
             local_15.Y -= local_12 / 2f;
             if (Culture.IsCJK)
               local_15.Y += viewScale * 4f;
             SpriteFont local_23 = !local_8.IsGamerCard && !local_9 || Culture.IsCJK ? local_3 : this.Fonts.Small;
             Color local_24 = local_8.Disabled ? new Color(0.2f, 0.2f, 0.2f, 1f) : new Color(1f, 1f, 1f, 1f);
             if (local_8.IsGamerCard)
               local_24 = new Color(0.5f, 1f, 0.5f, 1f);
             this.tr.DrawCenteredString(this.SpriteBatch, local_23, local_10, local_24, FezMath.XY(local_15), local_13);
             Vector2 local_25 = local_23.MeasureString(local_10) * local_13;
             Point local_26;
             local_26.X = (int) ((double) this.GraphicsDevice.PresentationParameters.BackBufferWidth / 2.0 + (double) local_15.X - (double) local_25.X / 2.0);
             local_26.Y = (int) ((double) local_15.Y + (double) this.GraphicsDevice.PresentationParameters.BackBufferHeight / 2.0 - (double) num / 2.0);
             local_8.HoverArea = new Rectangle(local_26.X, local_26.Y, (int) local_25.X, (int) local_25.Y);
             if (local_8.IsSlider && level.SelectedItem == local_8)
             {
               local_15.Y += 7f * local_13;
               if (local_9 && flag && (double) local_13 / (double) viewScale < 2.0)
                 local_15.Y -= 4f * viewScale;
               float local_27 = (float) ((double) viewScale * 30.0 * (double) local_13 / ((double) this.Fonts.BigFactor * (double) viewScale));
               if (Culture.IsCJK)
               {
                 local_27 *= 0.475f * viewScale;
                 local_15.Y += viewScale * 5f;
               }
               this.tr.DrawCenteredString(this.SpriteBatch, this.Fonts.Big, "{LA}", new Color(1f, 1f, 1f, 1f), new Vector2(local_15.X - local_11.X / 2f * this.Fonts.BigFactor - local_27, local_15.Y), (Culture.IsCJK ? 0.2f : 1f) * viewScale);
               this.tr.DrawCenteredString(this.SpriteBatch, this.Fonts.Big, "{RA}", new Color(1f, 1f, 1f, 1f), new Vector2((float) ((double) local_15.X + (double) local_11.X / 2.0 * (double) this.Fonts.BigFactor + (double) local_27 * 2.0), local_15.Y), (Culture.IsCJK ? 0.2f : 1f) * viewScale);
             }
           }
         }
         level.PostDraw(this.SpriteBatch, local_3, this.tr, 1f);
         break;
       }
     default:
       flag = true;
       goto case Language.English;
   }
 }
Example #26
0
 /// <summary>
 /// Change the menu to the given menu level. Also set CurrentMenuLevel appropriately.
 /// </summary>
 /// <param name="menu">The MenuLevel enum to change the menu level to.</param>
 public void ChangeMenu(MenuLevel menu)
 {
     CurrentMenuLevel = menu;
     switch (CurrentMenuLevel) {
         case MenuLevel.Base:
             if (MainMenuErrorFetchScoresPanel.enabled) UITools.SetActiveState(MainMenuErrorFetchScoresPanel,false);
             if (MainMenuQuitPanel.enabled) UITools.SetActiveState(MainMenuQuitPanel, false);
             if (MainMenuModePanel.enabled) UITools.SetActiveState(MainMenuModePanel, false);
             if (MainMenuOptionsPanel.enabled) UITools.SetActiveState(MainMenuOptionsPanel, false);
             if (MainMenuScoresPanel.enabled) UITools.SetActiveState(MainMenuScoresPanel, false);
             if (MainMenuScoresOfflinePanel.enabled) UITools.SetActiveState(MainMenuScoresOfflinePanel, false);
             if (MainMenuLoggedInBoxPanel.enabled) UITools.SetActiveState(MainMenuLoggedInBoxPanel, false);
             if (MainMenuLogInPanel.enabled) UITools.SetActiveState(MainMenuLogInPanel, false);
             if (MainMenuFileBrowserPanel.enabled) UITools.SetActiveState(MainMenuFileBrowserPanel, false);
             if (MainMenuChoicePanel.enabled) UITools.SetActiveState(MainMenuChoicePanel, false);
             if (MainMenuCreatePanel.enabled) UITools.SetActiveState(MainMenuCreatePanel, false);
             if (MainMenuCreditsPanel.enabled) UITools.SetActiveState(MainMenuCreditsPanel, false);
             if (MainMenuCredits3DPanel.enabled) UITools.SetActiveState(MainMenuCredits3DPanel, false);
             if (MainMenuForgotPanel.enabled) UITools.SetActiveState(MainMenuForgotPanel, false);
             if (MainMenuForgotMessagePanel.enabled) UITools.SetActiveState(MainMenuForgotMessagePanel, false);
             if (MainMenuAnalysisNotePanel.enabled) UITools.SetActiveState(MainMenuAnalysisNotePanel, false);
             if (MainMenuFirstPlayPanel.enabled) UITools.SetActiveState(MainMenuFirstPlayPanel, false);
             if (MainMenuGoOnlinePanel.enabled) UITools.SetActiveState(MainMenuGoOnlinePanel, false);
             if (MainMenuRedeemCodePanel.enabled) UITools.SetActiveState(MainMenuRedeemCodePanel, false);
             if (MainMenuRedeemCodeButtonPanel.enabled) UITools.SetActiveState(MainMenuRedeemCodeButtonPanel, false);
             OptionsButton.isEnabled = true;
             CreditsButton.isEnabled = true;
             UITools.SetActiveState(MainMenuExtrasPanel, true);
             UITools.SetActiveState(MainMenuBasePanel, true);
             UITools.SetActiveState(MainMenuPlayPanel, true);
             break;
         case MenuLevel.Mode:
             if (PlayerPrefs.HasKey("FirstPlay")) {
                 if (PlayerPrefs.GetInt("FirstPlay") == 1)
                     UITools.SetActiveState(MainMenuFirstPlayPanel, true);
             }
             if (MainMenuErrorFetchScoresPanel.enabled) UITools.SetActiveState(MainMenuErrorFetchScoresPanel,false);
             if (MainMenuFileBrowserPanel.enabled) UITools.SetActiveState(MainMenuFileBrowserPanel, false);
             if (MainMenuPlayPanel.enabled) UITools.SetActiveState(MainMenuPlayPanel, false);
             if (MainMenuChoicePanel.enabled) UITools.SetActiveState(MainMenuChoicePanel, false);
             UITools.SetActiveState(MainMenuExtrasPanel, true);
             UITools.SetActiveState(MainMenuBasePanel, true);
             UITools.SetActiveState(MainMenuModePanel, true);
             break;
         case MenuLevel.Options:
             OptionsBackButton.isEnabled = true;
             RedeemCodeButton.isEnabled = true;
             UITools.SetActiveState(MainMenuPlayPanel, false);
             UITools.SetActiveState(MainMenuRedeemCodePanel, false);
             UITools.SetActiveState(MainMenuOptionsPanel, true);
             UITools.SetActiveState(MainMenuExtrasPanel, true);
             if (Game.IsLoggedIn && Game.OnlineMode) UITools.SetActiveState(MainMenuLoggedInBoxPanel, true);
             if (!Game.isUnlockedVersion) UITools.SetActiveState(MainMenuRedeemCodeButtonPanel, true);
             UsernameLabel.text = Game.PlayerName;
             break;
         case MenuLevel.Quit:
             UITools.SetActiveState(MainMenuPlayPanel, false);
             UITools.SetActiveState(MainMenuQuitPanel, true);
             break;
         case MenuLevel.Scores:
             if (MainMenuErrorFetchScoresPanel.enabled) UITools.SetActiveState(MainMenuErrorFetchScoresPanel,false);
             UITools.SetActiveState(MainMenuPlayPanel, false);
             UITools.SetActiveState(MainMenuBasePanel, false);
             UITools.SetActiveState(MainMenuLogInPanel, false);
             UITools.SetActiveState(MainMenuGoOnlinePanel, false);
             UITools.SetActiveState(MainMenuScoresPanel, true);
             HSController.InitHSDisplay();
             break;
         case MenuLevel.ScoresOffline:
             if (MainMenuErrorFetchScoresPanel.enabled) UITools.SetActiveState(MainMenuErrorFetchScoresPanel,false);
             UITools.SetActiveState(MainMenuPlayPanel, false);
             UITools.SetActiveState(MainMenuBasePanel, false);
             UITools.SetActiveState(MainMenuGoOnlinePanel, false);
             UITools.SetActiveState(MainMenuScoresOfflinePanel, true);
             HSController.InitHSDisplay();
             break;
         case MenuLevel.FileBrowser:
             if (MainMenuErrorFetchScoresPanel.enabled) UITools.SetActiveState(MainMenuErrorFetchScoresPanel,false);
             if (MainMenuChoicePanel.enabled) UITools.SetActiveState(MainMenuChoicePanel, false);
             if (MainMenuSongNotFoundPanel.enabled) UITools.SetActiveState(MainMenuSongNotFoundPanel, false);
             if (MainMenuExtrasPanel.enabled) UITools.SetActiveState(MainMenuExtrasPanel, false);
             UITools.SetActiveState(MainMenuModePanel, false);
             UITools.SetActiveState(MainMenuBasePanel, false);
             UITools.SetActiveState(MainMenuFileBrowserPanel, true);
             break;
         case MenuLevel.LogIn:
             if (MainMenuErrorFetchScoresPanel.enabled) UITools.SetActiveState(MainMenuErrorFetchScoresPanel,false);
             UITools.SetActiveState(MainMenuCreatePanel, false);
             UITools.SetActiveState(MainMenuPlayPanel, false);
             UITools.SetActiveState(MainMenuBasePanel, false);
             UITools.SetActiveState(MainMenuForgotPanel, false);
             UITools.SetActiveState(MainMenuGoOnlinePanel, false);
             UITools.SetActiveState(MainMenuLogInPanel, true);
             if (PlayerPrefs.GetString("playername") != null)
                 UserNameInput.text = PlayerPrefs.GetString("playername");
             RememberMeCheckbox.isChecked = Game.RememberLogin;
             if (ErrorLabel.text != "[44DD44]User created, please log in!") ErrorLabel.text = ""; // Clear error text if any
             LoginPassInput.text = ""; // Clear password field
             break;
         case MenuLevel.ConfirmChoice:
             if (MainMenuBasePanel.enabled) UITools.SetActiveState(MainMenuBasePanel, false);
             if (MainMenuFileBrowserPanel.enabled) UITools.SetActiveState(MainMenuFileBrowserPanel, false);
             if (MainMenuModePanel.enabled) UITools.SetActiveState(MainMenuModePanel, false);
             if (MainMenuExtrasPanel.enabled) UITools.SetActiveState(MainMenuExtrasPanel, false);
             SongNameLabel.text = GetSongTitleFromFile();
             CalculateSongLabelSize();
             UITools.SetActiveState(MainMenuChoicePanel, true);
             UITools.SetActiveState(MainMenuExtrasPanel, true);
             foreach (UIButton c in MainMenuChoicePanel.GetComponentsInChildren<UIButton>()) StartCoroutine(DelayButton(c, 0.1f));
             break;
         case MenuLevel.SongNotFound:
             if (MainMenuBasePanel.enabled) UITools.SetActiveState(MainMenuBasePanel, false);
             if (MainMenuFileBrowserPanel.enabled) UITools.SetActiveState(MainMenuFileBrowserPanel, false);
             if (MainMenuModePanel.enabled) UITools.SetActiveState(MainMenuModePanel, false);
             if (MainMenuExtrasPanel.enabled) UITools.SetActiveState(MainMenuExtrasPanel, false);
             UITools.SetActiveState(MainMenuSongNotFoundPanel, true);
             UITools.SetActiveState(MainMenuExtrasPanel, true);
             foreach (UIButton c in MainMenuChoicePanel.GetComponentsInChildren<UIButton>()) StartCoroutine(DelayButton(c, 0.1f));
             break;
         case MenuLevel.Create:
             UITools.SetActiveState(MainMenuLogInPanel, false);
             UITools.SetActiveState(MainMenuCreatePanel, true);
             CreateErrorLabel.text = "";
             break;
         case MenuLevel.Credits:
             UITools.SetActiveState(MainMenuPlayPanel, false);
             UITools.SetActiveState(MainMenuCreditsPanel, true);
             UITools.SetActiveState(MainMenuCredits3DPanel, true);
             StartCredits();
             break;
         case MenuLevel.Forgot:
             UITools.SetActiveState(MainMenuLogInPanel, false);
             UITools.SetActiveState(MainMenuForgotPanel, true);
             ForgotErrorLabel.text = "";
             break;
         case MenuLevel.ForgotMessage:
             UITools.SetActiveState(MainMenuForgotPanel, false);
             UITools.SetActiveState(MainMenuForgotMessagePanel, true);
             ForgotMessageLabel.text = "An email was sent to [44CCBB]" + globalEmail + " [FFFFFF]with instructions on how to reset your password!";
             break;
         case MenuLevel.GoOnlineWindow:
             if (MainMenuErrorFetchScoresPanel.enabled) UITools.SetActiveState(MainMenuErrorFetchScoresPanel,false);
             OptionsButton.isEnabled = false;
             CreditsButton.isEnabled = false;
             UITools.SetActiveState(MainMenuGoOnlinePanel, true);
             break;
         case MenuLevel.RedeemCodeWindow:
             OptionsBackButton.isEnabled = false;
             RedeemCodeButton.isEnabled = false;
             RedeemCodeInputBG.color = Color.white;
             RedeemCodeInput.enabled = true;
             RedeemSubmitButton.isEnabled = true;
             RedeemSubmitLabel.text = "Submit";
             RedeemErrorLabel.text = "";
             UITools.SetActiveState(MainMenuExtrasPanel, false);
             UITools.SetActiveState(MainMenuRedeemCodePanel, true);
             break;
         case MenuLevel.ErrorFetchScores:
             if (MainMenuScoresPanel.enabled) UITools.SetActiveState(MainMenuScoresPanel, false);
             UITools.SetActiveState(MainMenuErrorFetchScoresPanel,true);
             UITools.SetActiveState(MainMenuBasePanel, true);
             break;
     }
 }
Example #27
0
 public override void Initialize()
 {
   this.KeyboardState.IgnoreMapping = true;
   MenuBase menuBase1 = this;
   CreditsMenuLevel creditsMenuLevel1 = new CreditsMenuLevel();
   creditsMenuLevel1.Title = "Credits";
   creditsMenuLevel1.Oversized = true;
   creditsMenuLevel1.IsDynamic = true;
   CreditsMenuLevel creditsMenuLevel2 = creditsMenuLevel1;
   menuBase1.CreditsMenu = creditsMenuLevel2;
   this.StartNewGameMenu = new MenuLevel()
   {
     Title = "StartNewGameTitle",
     AButtonStarts = true,
     AButtonString = "StartNewGameWithGlyph",
     AButtonAction = new Action(this.StartNewGame)
   };
   this.StartNewGameMenu.AddItem("StartNewGameTextLine", new Action(Util.NullAction), -1);
   this.ExitToArcadeMenu = new MenuLevel()
   {
     Title = "ExitConfirmationTitle",
     AButtonString = "ExitChoiceYes",
     AButtonAction = new Action(this.ReturnToArcade)
   };
   this.ExitToArcadeMenu.AddItem("ReturnToArcadeTextLine", new Action(Util.NullAction), -1);
   MenuBase menuBase2 = this;
   LeaderboardsMenuLevel leaderboardsMenuLevel1 = new LeaderboardsMenuLevel(this);
   leaderboardsMenuLevel1.Title = "LeaderboardsTitle";
   leaderboardsMenuLevel1.Oversized = true;
   LeaderboardsMenuLevel leaderboardsMenuLevel2 = leaderboardsMenuLevel1;
   menuBase2.LeaderboardsMenu = leaderboardsMenuLevel2;
   MenuBase menuBase3 = this;
   ControlsMenuLevel controlsMenuLevel1 = new ControlsMenuLevel(this);
   controlsMenuLevel1.Title = "Controls";
   controlsMenuLevel1.Oversized = true;
   ControlsMenuLevel controlsMenuLevel2 = controlsMenuLevel1;
   menuBase3.ControlsMenu = controlsMenuLevel2;
   this.GameSettingsMenu = new MenuLevel()
   {
     Title = "GameSettings",
     BButtonString = "MenuSaveWithGlyph",
     IsDynamic = true,
     Oversized = true
   };
   this.AudioSettingsMenu = new MenuLevel()
   {
     Title = "AudioSettings",
     BButtonString = "MenuSaveWithGlyph",
     IsDynamic = true,
     Oversized = true
   };
   this.VideoSettingsMenu = new MenuLevel()
   {
     Title = "VideoSettings",
     AButtonString = "MenuApplyWithGlyph",
     IsDynamic = true,
     Oversized = true
   };
   this.VideoSettingsMenu.AddItem<string>("Resolution", new Action(this.ApplyVideo), false, (Func<string>) (() =>
   {
     DisplayMode local_0 = SettingsManager.Resolutions[this.currentResolution];
     float wD = (float) (local_0.Width / 1280);
     float hD = (float) (local_0.Height / 720);
     bool local_1 = local_0.Width % 1280 == 0 && (double) local_0.Height >= (double) wD * 720.0 && ((double) local_0.Height == (double) wD * 720.0 || !Enumerable.Any<DisplayMode>((IEnumerable<DisplayMode>) SettingsManager.Resolutions, (Func<DisplayMode, bool>) (x =>
     {
       if ((double) x.Width == (double) wD * 1280.0)
         return (double) x.Height == (double) wD * 720.0;
       else
         return false;
     }))) || local_0.Height % 720 == 0 && (double) local_0.Width >= (double) hD * 1280.0 && ((double) local_0.Width == (double) hD * 1280.0 || !Enumerable.Any<DisplayMode>((IEnumerable<DisplayMode>) SettingsManager.Resolutions, (Func<DisplayMode, bool>) (x =>
     {
       if ((double) x.Width == (double) hD * 1280.0)
         return (double) x.Height == (double) hD * 720.0;
       else
         return false;
     }))) || local_0.Width == 1920 && local_0.Height == 1080 && !Enumerable.Any<DisplayMode>((IEnumerable<DisplayMode>) SettingsManager.Resolutions, (Func<DisplayMode, bool>) (x =>
     {
       if (x.Width >= 2560)
         return x.Height >= 1440;
       else
         return false;
     })) || local_0 == SettingsManager.NativeResolution;
     return string.Concat(new object[4]
     {
       (object) local_0.Width,
       (object) "x",
       (object) local_0.Height,
       local_1 ? (object) " *" : (object) ""
     });
   }), (Action<string, int>) ((lastValue, change) =>
   {
     this.currentResolution += change;
     if (this.currentResolution == SettingsManager.Resolutions.Count)
       this.currentResolution = 0;
     if (this.currentResolution != -1)
       return;
     this.currentResolution = SettingsManager.Resolutions.Count - 1;
   }), -1).UpperCase = true;
   this.VideoSettingsMenu.AddItem<string>("ScreenMode", new Action(this.ApplyVideo), false, (Func<string>) (() =>
   {
     if (!this.isFullscreen)
       return StaticText.GetString("Windowed");
     else
       return StaticText.GetString("Fullscreen");
   }), (Action<string, int>) ((_, __) => this.isFullscreen = !this.isFullscreen), -1).UpperCase = true;
   this.VideoSettingsMenu.AddItem("ResetToDefault", new Action(this.ReturnToVideoDefault), -1);
   this.VideoSettingsMenu.OnPostDraw += (Action<SpriteBatch, SpriteFont, GlyphTextRenderer, float>) ((batch, font, tr, alpha) =>
   {
     float local_0 = this.Fonts.SmallFactor * SettingsManager.GetViewScale(batch.GraphicsDevice);
     float local_1 = (float) batch.GraphicsDevice.Viewport.Height / 2f;
     if (this.VideoSettingsMenu.SelectedIndex != 0)
       return;
     tr.DrawCenteredString(batch, this.Fonts.Small, StaticText.GetString("RecommendedResolution"), new Color(1f, 1f, 1f, alpha), new Vector2(0.0f, local_1 * 1.5f), local_0);
   });
   this.AudioSettingsMenu.AddItem<float>("SoundVolume", MenuBase.SliderAction, false, (Func<float>) (() => SettingsManager.Settings.SoundVolume), (Action<float, int>) ((lastValue, change) =>
   {
     float local_0 = (double) lastValue > 0.0500000007450581 || change >= 0 ? ((double) lastValue < 0.949999988079071 || change <= 0 ? lastValue + (float) change * 0.05f : 1f) : 0.0f;
     this.SoundManager.SoundEffectVolume = SettingsManager.Settings.SoundVolume = local_0;
   }), -1).UpperCase = true;
   this.AudioSettingsMenu.AddItem<float>("MusicVolume", MenuBase.SliderAction, false, (Func<float>) (() => SettingsManager.Settings.MusicVolume), (Action<float, int>) ((lastValue, change) =>
   {
     float local_0 = (double) lastValue > 0.0500000007450581 || change >= 0 ? ((double) lastValue < 0.949999988079071 || change <= 0 ? lastValue + (float) change * 0.05f : 1f) : 0.0f;
     this.SoundManager.MusicVolume = SettingsManager.Settings.MusicVolume = local_0;
   }), -1).UpperCase = true;
   this.AudioSettingsMenu.AddItem("ResetToDefault", new Action(this.ReturnToAudioDefault), -1);
   Language toSet = Culture.Language;
   MenuItem<Language> menuItem1 = this.GameSettingsMenu.AddItem<Language>("Language", MenuBase.SliderAction, false, (Func<Language>) (() => toSet), (Action<Language, int>) ((lastValue, change) =>
   {
     if (change < 0 && toSet == Language.English)
       toSet = Language.Korean;
     else if (change > 0 && toSet == Language.Korean)
       toSet = Language.English;
     else
       toSet += (Language) change;
   }), -1);
   this.GameSettingsMenu.AButtonString = "MenuApplyWithGlyph";
   menuItem1.Selected = (Action) (() => Culture.Language = SettingsManager.Settings.Language = toSet);
   this.GameSettingsMenu.OnReset = (Action) (() => toSet = Culture.Language);
   menuItem1.UpperCase = true;
   menuItem1.LocalizeSliderValue = true;
   menuItem1.LocalizationTagFormat = "Language{0}";
   if (this.GameState.SaveData.HasStereo3D)
     this.StereoMenuItem = this.GameSettingsMenu.AddItem(this.GameState.StereoMode ? "Stereo3DOn" : "Stereo3DOff", new Action(this.ToggleStereo), -1);
   this.VibrationMenuItem = this.GameSettingsMenu.AddItem(SettingsManager.Settings.Vibration ? "VibrationOn" : "VibrationOff", new Action(this.ToggleVibration), -1);
   this.GameSettingsMenu.AddItem("ResetToDefault", (Action) (() =>
   {
     this.ReturnToGameDefault();
     toSet = Culture.Language;
   }), -1);
   this.SaveManagementMenu = new SaveManagementLevel(this);
   this.HelpOptionsMenu = new MenuLevel()
   {
     Title = "HelpOptions"
   };
   this.HelpOptionsMenu.AddItem("Controls", (Action) (() => this.ChangeMenuLevel((MenuLevel) this.ControlsMenu, false)), -1);
   this.HelpOptionsMenu.AddItem("GameSettings", (Action) (() => this.ChangeMenuLevel(this.GameSettingsMenu, false)), -1);
   this.HelpOptionsMenu.AddItem("VideoSettings", (Action) (() =>
   {
     FezEngine.Tools.Settings s = SettingsManager.Settings;
     DisplayMode local_0 = Enumerable.FirstOrDefault<DisplayMode>((IEnumerable<DisplayMode>) SettingsManager.Resolutions, (Func<DisplayMode, bool>) (x =>
     {
       if (x.Width == s.Width)
         return x.Height == s.Height;
       else
         return false;
     })) ?? GraphicsAdapter.DefaultAdapter.CurrentDisplayMode;
     this.currentResolution = SettingsManager.Resolutions.IndexOf(local_0);
     if (this.currentResolution == -1 || this.currentResolution >= SettingsManager.Resolutions.Count)
       this.currentResolution = 0;
     this.isFullscreen = SettingsManager.Settings.ScreenMode == ScreenMode.Fullscreen;
     this.ChangeMenuLevel(this.VideoSettingsMenu, false);
   }), -1).UpperCase = true;
   this.HelpOptionsMenu.AddItem("AudioSettings", (Action) (() => this.ChangeMenuLevel(this.AudioSettingsMenu, false)), -1);
   if (!Fez.PublicDemo)
     this.HelpOptionsMenu.AddItem("SaveManagementTitle", (Action) (() => this.ChangeMenuLevel((MenuLevel) this.SaveManagementMenu, false)), -1);
   this.SaveManagementMenu.Parent = this.HelpOptionsMenu;
   this.GameSettingsMenu.Parent = this.HelpOptionsMenu;
   this.AudioSettingsMenu.Parent = this.HelpOptionsMenu;
   this.VideoSettingsMenu.Parent = this.HelpOptionsMenu;
   this.ControlsMenu.Parent = this.HelpOptionsMenu;
   this.UnlockNeedsLIVEMenu = new MenuLevel();
   this.UnlockNeedsLIVEMenu.AddItem("UnlockNeedsLIVE", MenuBase.SliderAction, -1).Selectable = false;
   this.MenuRoot = new MenuLevel();
   this.MenuRoot.AddItem("HelpOptions", (Action) (() => this.ChangeMenuLevel(this.HelpOptionsMenu, false)), -1);
   MenuItem menuItem2 = this.MenuRoot.AddItem("Leaderboards", (Action) (() => this.ChangeMenuLevel((MenuLevel) this.LeaderboardsMenu, false)), -1);
   this.MenuRoot.AddItem("Credits", (Action) (() => this.ChangeMenuLevel((MenuLevel) this.CreditsMenu, false)), -1);
   this.CreditsMenu.Parent = this.MenuRoot;
   MenuItem menuItem3 = (MenuItem) null;
   if (this.GameState.IsTrialMode)
     menuItem3 = this.MenuRoot.AddItem("UnlockFullGame", new Action(this.UnlockFullGame), -1);
   MenuItem menuItem4 = this.MenuRoot.AddItem("ReturnToArcade", (Action) (() => this.ChangeMenuLevel(this.ExitToArcadeMenu, false)), -1);
   if (Fez.PublicDemo)
   {
     menuItem4.Disabled = true;
     menuItem2.Disabled = true;
     if (menuItem3 != null)
       menuItem3.Disabled = true;
     menuItem4.Selectable = false;
     menuItem2.Selectable = false;
     if (menuItem3 != null)
       menuItem3.Selectable = false;
   }
   this.MenuLevels = new List<MenuLevel>()
   {
     this.MenuRoot,
     this.UnlockNeedsLIVEMenu,
     this.StartNewGameMenu,
     this.HelpOptionsMenu,
     this.AudioSettingsMenu,
     this.VideoSettingsMenu,
     this.GameSettingsMenu,
     this.ExitToArcadeMenu,
     (MenuLevel) this.LeaderboardsMenu,
     (MenuLevel) this.ControlsMenu,
     (MenuLevel) this.CreditsMenu,
     (MenuLevel) this.SaveManagementMenu
   };
   foreach (MenuLevel menuLevel in this.MenuLevels)
   {
     if (menuLevel != this.MenuRoot && menuLevel.Parent == null)
       menuLevel.Parent = this.MenuRoot;
   }
   this.nextMenuLevel = this.EndGameMenu ? (MenuLevel) this.CreditsMenu : this.MenuRoot;
   this.GameState.DynamicUpgrade += new Action(this.DynamicUpgrade);
   this.PostInitialize();
   base.Initialize();
 }
Example #28
0
 public Menu(MenuLevel level)
 {
     _menuLevel = level;
     AddPredefinedMenuItemsToDict();
 }
Example #29
0
        /// <summary>
        /// 初始化一个新的<c>Menu</c>实例
        /// </summary>
        /// <param name="menuName">菜单名</param>
        /// <param name="displayName">菜单显示名</param>
        /// <param name="description">菜单描述</param>
        /// <param name="parentId">父菜单 ID</param>
        /// <param name="level">菜单目录级别</param>
        /// <param name="sort">菜单排序</param>
        /// <param name="actionsId">功能行为 ID</param>
        /// <param name="createdBy">创建人</param>
        public Menu(string menuName, string displayName, string description, Guid? parentId, MenuLevel level, int sort, Guid? actionsId, string createdBy)
        {
            this.MenuName = menuName;
            this.DisplayName = displayName;
            this.Description = description;
            this.ParentId = parentId;
            this.Level = level;
            this.Sort = sort;
            this.ActionsId = actionsId;
            this.CreatedBy = createdBy;
            this.CreatedDate = DateTime.Now;

            this.GenerateNewIdentity();
            this.Enable();
            this.AdjustParentViaLevel();
        }
Example #30
0
 private void UpdateSelector(float elapsedSeconds)
 {
   Vector3 vector3_1 = Vector3.Zero;
   Vector3 vector3_2 = Vector3.Zero;
   float viewScale = SettingsManager.GetViewScale(this.GraphicsDevice);
   if (this.CurrentMenuLevel != null && this.CurrentMenuLevel.SelectedItem != null)
   {
     float num1 = (this.CurrentMenuLevel.Oversized ? 512f : 256f) * viewScale;
     int num2 = Enumerable.Count<MenuItem>((IEnumerable<MenuItem>) this.CurrentMenuLevel.Items, (Func<MenuItem, bool>) (x => !x.Hidden));
     float num3 = this.CurrentMenuLevel.Items.Count == 0 ? 0.0f : (this.CurrentMenuLevel.SelectedItem.Size.Y + this.Fonts.TopSpacing) * this.Fonts.BigFactor;
     int selectedIndex = this.CurrentMenuLevel.SelectedIndex;
     MenuItem menuItem = this.CurrentMenuLevel.Items[selectedIndex];
     vector3_1 = new Vector3((menuItem.Size + new Vector2(this.Fonts.SideSpacing * 2f, this.Fonts.TopSpacing)) * this.Fonts.BigFactor / 2f, 1f);
     if (num2 > 10)
     {
       bool flag = false;
       switch (Culture.Language)
       {
         case Language.English:
         case Language.Chinese:
         case Language.Japanese:
         case Language.Korean:
           for (int index = 0; index <= this.CurrentMenuLevel.SelectedIndex; ++index)
           {
             if (this.CurrentMenuLevel.Items[index].Hidden)
               --selectedIndex;
           }
           float num4 = 5f;
           if (selectedIndex == num2 - 1)
             vector3_2 = new Vector3(0.0f, (float) (((double) num4 - 9.0) * (double) num3 - (double) num3 / 2.0), 0.0f);
           else if (selectedIndex < 8)
           {
             vector3_2 = new Vector3(num1 / 2f, (float) (((double) num4 - (double) selectedIndex) * (double) num3 - (double) num3 / 2.0), 0.0f);
           }
           else
           {
             selectedIndex -= 8;
             vector3_2 = new Vector3((float) (-(double) num1 / 2.0), (float) (((double) num4 - (double) selectedIndex) * (double) num3 - (double) num3 / 2.0), 0.0f);
           }
           if (flag && selectedIndex != num2 - 1)
             vector3_1 = vector3_1 * this.Fonts.SmallFactor / this.Fonts.BigFactor;
           string str = WordWrap.Split(menuItem.ToString(), this.Fonts.Small, (float) (((double) ((float) this.Game.GraphicsDevice.Viewport.Width * 0.45f) + (double) vector3_2.X / 2.0) / ((double) this.Fonts.SmallFactor * (double) viewScale)));
           int num5 = 0;
           foreach (int num6 in str)
           {
             if (num6 == 10)
               ++num5;
           }
           if (num5 > 0)
           {
             vector3_1.Y *= (float) (1 + num5);
             break;
           }
           else
             break;
         default:
           flag = true;
           goto case Language.English;
       }
     }
     else
     {
       float num4 = (float) num2 / 2f;
       for (int index = 0; index <= this.CurrentMenuLevel.SelectedIndex; ++index)
       {
         if (this.CurrentMenuLevel.Items[index].Hidden)
           --selectedIndex;
       }
       vector3_2 = new Vector3(0.0f, (float) (((double) num4 - (double) selectedIndex) * (double) num3 - (double) num3 / 2.0), 0.0f);
     }
   }
   this.sinceSelectorPhaseStarted += elapsedSeconds;
   switch (this.selectorPhase)
   {
     case SelectorPhase.Appear:
     case SelectorPhase.Disappear:
       Group group1 = this.Selector.Groups[0];
       Group group2 = this.Selector.Groups[1];
       Group group3 = this.Selector.Groups[2];
       this.Frame.Enabled = false;
       this.Selector.Material.Opacity = 1f;
       this.Selector.Enabled = true;
       this.Selector.Position = Vector3.Zero;
       this.Selector.Scale = Vector3.One;
       float num7 = Easing.EaseInOut((double) FezMath.Saturate(this.sinceSelectorPhaseStarted / 0.75f), EasingType.Sine, EasingType.Cubic);
       if (this.selectorPhase == SelectorPhase.Disappear)
         num7 = 1f - num7;
       group2.Enabled = group3.Enabled = (double) num7 > 0.5;
       float x1 = (this.nextMenuLevel.Oversized ? 512f : 352f) * viewScale;
       float num8 = FezMath.Saturate((float) (((double) num7 - 0.5) * 2.0));
       float num9 = FezMath.Saturate(num7 * 2f);
       group1.Scale = new Vector3(x1, 256f * num9 * viewScale, 1f);
       group2.Scale = new Vector3(x1 * num8, 256f * viewScale, 1f);
       group2.Position = new Vector3((float) (-(double) x1 * (1.0 - (double) num8)), 0.0f, 1f);
       group3.Scale = new Vector3(x1 * num8, 256f * viewScale, 1f);
       group3.Position = new Vector3(x1 * (1f - num8), 0.0f, 1f);
       if ((double) num7 <= 0.0 && this.selectorPhase == SelectorPhase.Disappear && !this.StartedNewGame)
         this.DestroyMenu();
       if ((double) num7 < 1.0 || this.selectorPhase != SelectorPhase.Appear)
         break;
       this.selectorPhase = SelectorPhase.Shrink;
       group1.Scale = group2.Scale = group3.Scale = Vector3.One;
       group2.Position = group3.Position = Vector3.Zero;
       this.Frame.Scale = this.Selector.Scale = new Vector3(x1, 256f * viewScale, 1f);
       this.Frame.Enabled = true;
       this.sinceSelectorPhaseStarted = 0.0f;
       this.CurrentMenuLevel = this.nextMenuLevel;
       this.CurrentMenuLevelTexture = this.NextMenuLevelTexture;
       break;
     case SelectorPhase.Shrink:
       float amount1 = Easing.EaseInOut((double) FezMath.Saturate(this.sinceSelectorPhaseStarted * 2.5f), EasingType.Sine, EasingType.Cubic);
       if (this.CurrentMenuLevel.SelectedItem == null || !this.CurrentMenuLevel.SelectedItem.Selectable)
       {
         this.Selector.Material.Opacity = 0.0f;
       }
       else
       {
         this.Selector.Material.Opacity = 1f;
         this.Selector.Scale = Vector3.Lerp(new Vector3((this.lastMenuLevel ?? this.CurrentMenuLevel).Oversized ? 512f : 352f, 256f, 1f) * viewScale, vector3_1, amount1);
         this.Selector.Position = Vector3.Lerp(Vector3.Zero, vector3_2, amount1);
       }
       this.Frame.Scale = Vector3.Lerp(new Vector3((this.lastMenuLevel ?? this.CurrentMenuLevel).Oversized ? 512f : 352f, 256f, 1f) * viewScale, new Vector3(this.CurrentMenuLevel.Oversized ? 512f : 352f, 256f, 1f) * viewScale, amount1);
       if ((double) amount1 < 1.0)
         break;
       this.selectorPhase = SelectorPhase.Select;
       break;
     case SelectorPhase.Grow:
       float amount2 = 1f - Easing.EaseInOut((double) FezMath.Saturate(this.sinceSelectorPhaseStarted / 0.3f), EasingType.Sine, EasingType.Quadratic);
       if (this.CurrentMenuLevel.SelectedItem == null || !this.CurrentMenuLevel.SelectedItem.Selectable)
       {
         this.Selector.Material.Opacity = 0.0f;
       }
       else
       {
         this.Selector.Material.Opacity = 1f;
         this.Selector.Scale = Vector3.Lerp(new Vector3(this.nextMenuLevel.Oversized ? 512f : 352f, 256f, 1f) * viewScale, vector3_1, amount2);
         this.Selector.Position = Vector3.Lerp(Vector3.Zero, vector3_2, amount2);
       }
       this.Frame.Scale = Vector3.Lerp(new Vector3(this.CurrentMenuLevel.Oversized ? 512f : 352f, 256f, 1f) * viewScale, new Vector3(this.nextMenuLevel.Oversized ? 512f : 352f, 256f, 1f) * viewScale, 1f - amount2);
       if ((double) amount2 > 0.0)
         break;
       this.lastMenuLevel = this.CurrentMenuLevel;
       this.CurrentMenuLevel = this.nextMenuLevel;
       this.CurrentMenuLevelTexture = this.NextMenuLevelTexture;
       if (this.CurrentMenuLevel.SelectedItem == null || !this.CurrentMenuLevel.SelectedItem.Selectable)
       {
         this.CurrentMenuLevel.Reset();
         this.selectorPhase = SelectorPhase.Select;
       }
       else
       {
         this.CurrentMenuLevel.Reset();
         this.selectorPhase = SelectorPhase.FadeIn;
       }
       this.sinceSelectorPhaseStarted = 0.0f;
       break;
     case SelectorPhase.Select:
       if (this.CurrentMenuLevel.SelectedItem == null || !this.CurrentMenuLevel.SelectedItem.Selectable)
       {
         this.Selector.Material.Opacity = 0.0f;
         break;
       }
       else
       {
         this.Selector.Material.Opacity = 1f;
         this.Selector.Scale = Vector3.Lerp(this.Selector.Scale, vector3_1, 0.3f);
         this.Selector.Position = Vector3.Lerp(this.Selector.Position, vector3_2, 0.3f);
         break;
       }
     case SelectorPhase.FadeIn:
       float amount3 = Easing.EaseInOut((double) FezMath.Saturate(this.sinceSelectorPhaseStarted / 0.25f), EasingType.Sine, EasingType.Cubic);
       this.Selector.Material.Opacity = amount3;
       this.Selector.Scale = Vector3.Lerp(this.Selector.Scale, vector3_1, 0.3f);
       this.Selector.Position = Vector3.Lerp(this.Selector.Position, vector3_2, 0.3f);
       float x2 = (this.CurrentMenuLevel.Oversized ? 512f : 352f) * viewScale;
       if ((double) this.Frame.Scale.X != (double) x2)
         this.Frame.Scale = Vector3.Lerp(new Vector3((this.lastMenuLevel ?? this.CurrentMenuLevel).Oversized ? 512f : 352f, 256f, 1f) * viewScale, new Vector3(x2, 256f * viewScale, 1f), amount3);
       if ((double) amount3 < 1.0)
         break;
       this.selectorPhase = SelectorPhase.Select;
       this.sinceSelectorPhaseStarted = 0.0f;
       break;
   }
 }
Example #31
0
 private void Attack()
 {
     Debug.Log("Attack Sub Menu");
     _menuLevel = MenuLevel.Sub;
     _battleSubMenuModel.SetSubMenu(SubMenu.Attack);
 }
Example #32
0
        private void InsertOrUpdateMenu(IMenuRepository menuRepository, int index, Menu menu, MenuLevel level, Guid?parentId)
        {
            // sort start with 1

            // a1, check the paramters
            //  1, check the level and parentId
            //      1a, when level = parent, the parentId = null
            //      2a, when level != parent and the parentId = null, throw exception.
            // a2, check the index
            //  1, index > 0

            // a1, when level = parent
            //  1, find all menus that level = parent
            //      1a, if the index > menus count, set the sort = (countOfMenu + 1)
            //      1b, if the index <= menus count, set the sort = (countOfMenu + 1), then set the sort that large then index add one
            // a2, when level = child
            //  1, find all menus that parentId = input parentId
            //      1a, when the index > menus count, set the sort = (countOfMenu + 1)
            //      1b, when the index <= menus count, set the sort = (countOfMenu + 1), then set the sort that large then index add one

            ISpecification <Menu> spec = null;
            var existMenu = menuRepository.Exist(Specification <Menu> .Eval(m => m.ID == menu.ID));

            if (level == MenuLevel.Parent)
            {
                spec = Specification <Menu> .Eval(m => m.Level == MenuLevel.Parent);
            }

            if (level == MenuLevel.Children)
            {
                if (!parentId.HasValue)
                {
                    throw new ArgumentNullException("parentId", "When menuLevel is children, the parentId must be not null.");
                }

                spec = Specification <Menu> .Eval(m => m.Level == MenuLevel.Children && m.ParentId == parentId);
            }

            var menus = this.GetMenus(menuRepository, spec, menu.ID, existMenu);

            // if the menu not exist, add the menu (the menu has been atteched).
            if (!existMenu)
            {
                var sort = this.InsertSortMenu(menus, index);
                menu.SetSort(sort);
                menuRepository.Add(menu);
            }
            else
            {
                var sort = this.MoveSortMenu(menus, menu.Sort, index);
                menu.SetSort(sort);
                menuRepository.Update(menu);
                foreach (var item in menus)
                {
                    menuRepository.Update(item);
                }
            }
        }
Example #33
0
 private void DestroyMenu()
 {
   ServiceHelper.RemoveComponent<MenuBase>(this);
   this.nextMenuLevel = this.CurrentMenuLevel = (MenuLevel) null;
 }
Example #34
0
        /// <summary>
        /// 初始化一个新的<c>Menu</c>实例
        /// </summary>
        /// <param name="menuName">菜单名</param>
        /// <param name="displayName">菜单显示名</param>
        /// <param name="description">菜单描述</param>
        /// <param name="parentId">父菜单 ID</param>
        /// <param name="level">菜单目录级别</param>
        /// <param name="sort">菜单排序</param>
        /// <param name="actionsId">功能行为 ID</param>
        /// <param name="createdBy">创建人</param>
        public Menu(string menuName, string displayName, string description, Guid?parentId, MenuLevel level, int sort, Guid?actionsId, string createdBy)
        {
            this.MenuName    = menuName;
            this.DisplayName = displayName;
            this.Description = description;
            this.ParentId    = parentId;
            this.Level       = level;
            this.Sort        = sort;
            this.ActionsId   = actionsId;
            this.CreatedBy   = createdBy;
            this.CreatedDate = DateTime.Now;

            this.GenerateNewIdentity();
            this.Enable();
            this.AdjustParentViaLevel();
        }
Example #35
0
 public bool ChangeMenuLevel(MenuLevel next, bool silent = false)
 {
   if (this.CurrentMenuLevel == null)
     return false;
   bool flag1 = this.CurrentMenuLevel.SelectedItem == null || !this.CurrentMenuLevel.SelectedItem.Selectable;
   this.selectorPhase = flag1 ? SelectorPhase.FadeIn : SelectorPhase.Grow;
   bool flag2 = next == this.CurrentMenuLevel.Parent;
   if (this.CurrentMenuLevel.OnClose != null)
     this.CurrentMenuLevel.OnClose();
   if (next == null)
   {
     this.ResumeGame();
     return true;
   }
   else
   {
     this.nextMenuLevel = next;
     this.nextMenuLevel.Reset();
     this.RenderToTexture();
     this.sinceSelectorPhaseStarted = 0.0f;
     this.lastMenuLevel = this.CurrentMenuLevel;
     if (flag1)
     {
       this.CurrentMenuLevel = this.nextMenuLevel;
       this.CurrentMenuLevelTexture = this.NextMenuLevelTexture;
       if (this.CurrentMenuLevel == null)
         this.DestroyMenu();
     }
     else if (!silent)
     {
       if (flag2)
         SoundEffectExtensions.Emit(this.sReturnLevel);
       else
         SoundEffectExtensions.Emit(this.sAdvanceLevel);
       if (this.lastMenuLevel.Oversized && !this.CurrentMenuLevel.Oversized)
         SoundEffectExtensions.Emit(this.sScreenNarrowen);
     }
     if (!this.lastMenuLevel.Oversized && this.CurrentMenuLevel.Oversized)
       SoundEffectExtensions.Emit(this.sScreenWiden);
     return true;
   }
 }
Example #36
0
 public override void Initialize()
 {
   // ISSUE: object of a compiler-generated type is created
   // ISSUE: variable of a compiler-generated type
   SaveManagementLevel.\u003C\u003Ec__DisplayClassd cDisplayClassd = new SaveManagementLevel.\u003C\u003Ec__DisplayClassd();
   // ISSUE: reference to a compiler-generated field
   cDisplayClassd.\u003C\u003E4__this = this;
   base.Initialize();
   this.FontManager = ServiceHelper.Get<IFontManager>();
   this.GameState = ServiceHelper.Get<IGameStateManager>();
   this.ReloadSlots();
   this.Title = "SaveManagementTitle";
   // ISSUE: reference to a compiler-generated field
   cDisplayClassd.sf = this.FontManager.Small;
   // ISSUE: reference to a compiler-generated field
   cDisplayClassd.changeLevel = new MenuLevel()
   {
     Title = "SaveChangeSlot",
     AButtonString = "ChangeWithGlyph"
   };
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated method
   cDisplayClassd.changeLevel.OnPostDraw = new Action<SpriteBatch, SpriteFont, GlyphTextRenderer, float>(cDisplayClassd.\u003CInitialize\u003Eb__4);
   // ISSUE: reference to a compiler-generated field
   cDisplayClassd.changeLevel.Parent = (MenuLevel) this;
   // ISSUE: reference to a compiler-generated field
   cDisplayClassd.changeLevel.Initialize();
   // ISSUE: reference to a compiler-generated field
   cDisplayClassd.copySrcLevel = new MenuLevel()
   {
     Title = "SaveCopySourceTitle",
     AButtonString = "ChooseWithGlyph"
   };
   // ISSUE: reference to a compiler-generated field
   cDisplayClassd.copySrcLevel.Parent = (MenuLevel) this;
   // ISSUE: reference to a compiler-generated field
   cDisplayClassd.copySrcLevel.Initialize();
   this.CopyDestLevel = new MenuLevel()
   {
     Title = "SaveCopyDestTitle",
     AButtonString = "ChooseWithGlyph"
   };
   // ISSUE: reference to a compiler-generated method
   this.CopyDestLevel.OnPostDraw = new Action<SpriteBatch, SpriteFont, GlyphTextRenderer, float>(cDisplayClassd.\u003CInitialize\u003Eb__5);
   // ISSUE: reference to a compiler-generated field
   this.CopyDestLevel.Parent = cDisplayClassd.copySrcLevel;
   this.CopyDestLevel.Initialize();
   // ISSUE: reference to a compiler-generated field
   cDisplayClassd.clearLevel = new MenuLevel()
   {
     Title = "SaveClearTitle",
     AButtonString = "ChooseWithGlyph"
   };
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated method
   cDisplayClassd.clearLevel.OnPostDraw = new Action<SpriteBatch, SpriteFont, GlyphTextRenderer, float>(cDisplayClassd.\u003CInitialize\u003Eb__6);
   // ISSUE: reference to a compiler-generated field
   cDisplayClassd.clearLevel.Parent = (MenuLevel) this;
   // ISSUE: reference to a compiler-generated field
   cDisplayClassd.clearLevel.Initialize();
   // ISSUE: reference to a compiler-generated method
   this.AddItem("SaveChangeSlot", new Action(cDisplayClassd.\u003CInitialize\u003Eb__7), -1);
   // ISSUE: reference to a compiler-generated method
   this.AddItem("SaveCopyTitle", new Action(cDisplayClassd.\u003CInitialize\u003Eb__9), -1);
   // ISSUE: reference to a compiler-generated method
   this.AddItem("SaveClearTitle", new Action(cDisplayClassd.\u003CInitialize\u003Eb__b), -1);
 }
Example #37
0
        /// <param name="displayName">菜单显示名</param>
        /// <param name="description">菜单描述</param>
        /// <param name="parentId">父菜单 ID</param>
        /// <param name="level">菜单目录级别, 0 级表示根目录, 1-m 级必须有 parentId</param>
        /// <param name="sort">菜单排序</param>
        /// <param name="actionsId">功能行为 ID</param>
        /// <param name="updatedBy">创建人</param>
        public void Update(string displayName, string description, Guid? parentId, MenuLevel level, int sort, Guid? actionsId, string updatedBy)
        {
            this.DisplayName = displayName;
            this.Description = description;
            this.ParentId = parentId;
            this.Level = level;
            this.Sort = sort;
            this.ActionsId = actionsId;

            this.SetUpdatedBy(updatedBy);
            this.AdjustParentViaLevel();
        }
Example #38
0
 private void Select(MenuLevel activeLevel)
 {
   if (activeLevel.AButtonAction == new Action(this.StartNewGame) || activeLevel.SelectedItem != null && (activeLevel.SelectedItem.Selected == new Action(this.ContinueGame) || activeLevel.SelectedItem.Selected == new Action(this.StartNewGame)))
     SoundEffectExtensions.Emit(this.sStartGame).Persistent = true;
   else if (activeLevel.AButtonAction == new Action(this.ReturnToArcade) && !this.GameState.IsTrialMode)
   {
     this.SoundManager.KillSounds();
     SoundEffectExtensions.Emit(this.sExitGame).Persistent = true;
   }
   else if ((activeLevel.AButtonAction != null || activeLevel.SelectedItem != null) && activeLevel.SelectedItem.Selected != MenuBase.SliderAction)
     SoundEffectExtensions.Emit(this.sConfirm);
   if (activeLevel.AButtonAction != null)
     activeLevel.AButtonAction();
   else
     activeLevel.Select();
 }
Example #39
0
 private void UpOneLevel(MenuLevel activeLevel)
 {
   SoundEffectExtensions.Emit(this.sCancel);
   activeLevel.ForceCancel = false;
   if (this.EndGameMenu)
   {
     this.GameState.EndGame = true;
     this.GameState.Restart();
     this.Enabled = false;
     Waiters.Wait(0.400000005960464, (Action) (() => ServiceHelper.RemoveComponent<MenuBase>(this)));
   }
   else if (activeLevel is SaveSlotSelectionLevel)
   {
     this.sinceSelectorPhaseStarted = 0.0f;
     this.selectorPhase = SelectorPhase.Disappear;
     this.GameState.ReturnToArcade();
   }
   else
   {
     if (activeLevel.Parent == this.HelpOptionsMenu)
       SettingsManager.Save();
     this.ChangeMenuLevel(activeLevel.Parent, false);
   }
 }
Example #40
0
 void Start()
 {
     MainMenu.SetActive(true);
     MenuOptions.SetActive(false);
     MenuLevel.SetActive(false);
 }
Example #41
0
        public List <string> GetItemsList(MenuLevel level)
        {
            var xpath = $"//*[@class='scPopup'][{(int) level}]/table/tbody/tr/td[@class='scMenuItemCaption']";

            return(Root.GetElements(By.XPath(xpath)).GetElemetsText());
        }
Example #42
0
 public MenuLevelChangedEventArgs(MenuLevel previous, MenuLevel current)
 {
     this.previous = previous;
     this.current  = current;
 }
Example #43
0
 public void SwitchParametersToPreviousMenu(MenuLevel level)
 {
     level.LevelTitle = level.PreviousMenu[^ 1];
Example #44
0
 private void RefreshSlotsFor(MenuLevel level, SaveManagementLevel.SMOperation operation, Func<SaveSlotInfo, bool> condition)
 {
   level.Items.Clear();
   foreach (SaveSlotInfo saveSlotInfo in this.Slots)
   {
     SaveSlotInfo s = saveSlotInfo;
     MenuItem menuItem;
     if (saveSlotInfo.Empty)
       (menuItem = level.AddItem((string) null, (Action) (() => this.ChooseSaveSlot(s, operation)), -1)).SuffixText = (Func<string>) (() => StaticText.GetString("NewSlot"));
     else
       (menuItem = level.AddItem("SaveSlotPrefix", (Action) (() => this.ChooseSaveSlot(s, operation)), -1)).SuffixText = (Func<string>) (() => string.Format((IFormatProvider) CultureInfo.InvariantCulture, " {0} ({1:P1} - {2:dd\\.hh\\:mm})", (object) (s.Index + 1), (object) s.Percentage, (object) s.PlayTime));
     menuItem.Disabled = !condition(saveSlotInfo);
     menuItem.Selectable = condition(saveSlotInfo);
   }
   for (int index = 0; index < this.Items.Count; ++index)
   {
     if (level.Items[index].Selectable)
     {
       level.SelectedIndex = index;
       break;
     }
   }
 }