Example #1
0
        private static async Task ProcessMenuPool()
        {
            MenuPool.ProcessMenus();

            if (MenuPool.ToList().Count == 0 && Camera != null)
            {
                Camera = null;
                ShowShopMenu();
            }

            if (Game.IsControlJustPressed(0, (Control)244) || Game.IsDisabledControlJustPressed(0, (Control)244))   //M
            {
                ShowInGameMenu();
            }

            if (Game.IsControlJustPressed(0, (Control)174) || Game.IsDisabledControlJustPressed(0, (Control)174))   // left
            {
                if (User.GetStatusType() != StatusTypes.Spectator)
                {
                    return;
                }

                var list = new NavigationList <Player>();
                list.AddRange(new PlayerList().Where(p => !p.IsDead).Where(p => !p.IsInvincible));
                try
                {
                    User.StartSpec(list.MovePrevious);
                }
                catch (Exception e)
                {
                    Debug.WriteLine($"{list.Count} | {e}");
                    User.StartSpec(list.First());
                }
            }
            else if (Game.IsControlJustPressed(0, (Control)175) || Game.IsDisabledControlJustPressed(0, (Control)175))   // right
            {
                if (User.GetStatusType() != StatusTypes.Spectator)
                {
                    return;
                }
                var list = new NavigationList <Player>();
                list.AddRange(new PlayerList().Where(p => !p.IsDead).Where(p => !p.IsInvincible));
                try
                {
                    User.StartSpec(list.MoveNext);
                }
                catch (Exception e)
                {
                    Debug.WriteLine($"{list.Count} | {e}");
                    User.StartSpec(list.Last());
                }
            }
        }