コード例 #1
0
        private static async Task Set10Tick()
        {
            await Delay(10);

            TimerBarPool = new TimerBarPool();
            TimerBarPool.Add(new TextTimerBar("Status", User.GetStatusTypeLabel()));

            if (User.LobbyInfo.Active)
            {
                TimerBarPool.Add(new TextTimerBar("Players", $"{User.LobbyInfo.CountPlayers}"));
                TimerBarPool.Add(new TextTimerBar("Third person", $"{User.LobbyInfo.Cam2} votes"));
                TimerBarPool.Add(new TextTimerBar("First person", $"{User.LobbyInfo.Cam1} votes"));

                if (User.LobbyInfo.Timer < 120)
                {
                    var t = TimeSpan.FromSeconds(User.LobbyInfo.Timer);
                    if (User.LobbyInfo.Timer < 10)
                    {
                        TimerBarPool.Add(new TextTimerBar("Time to start", $"~r~{t.Minutes}:{t.Seconds:d2}"));
                    }
                    else if (User.LobbyInfo.Timer < 30)
                    {
                        TimerBarPool.Add(new TextTimerBar("Time to start", $"~y~{t.Minutes}:{t.Seconds:d2}"));
                    }
                    else
                    {
                        TimerBarPool.Add(new TextTimerBar("Time to start", $"{t.Minutes}:{t.Seconds:d2}"));
                    }
                }
            }

            if (User.GameInfo.Active)
            {
                if (User.GameInfo.PlayerType == PlayerTypes.Innocent)
                {
                    TimerBarPool.Add(new TextTimerBar("Role", "~g~Innocent"));
                }
                else if (User.GameInfo.PlayerType == PlayerTypes.Traitor)
                {
                    TimerBarPool.Add(new TextTimerBar("Role", "~r~Traitor"));
                }
                else if (User.GameInfo.PlayerType == PlayerTypes.Detective)
                {
                    TimerBarPool.Add(new TextTimerBar("Role", "~b~Detective"));
                }
                else
                {
                    TimerBarPool.Add(new TextTimerBar("Role", "Unknown"));
                }

                var t = TimeSpan.FromSeconds(User.GameInfo.Timer);
                if (User.GameInfo.Timer < 60)
                {
                    TimerBarPool.Add(new TextTimerBar("Timer", $"~r~{t.Minutes}:{t.Seconds:d2}"));
                }
                else if (User.GameInfo.Timer < 90)
                {
                    TimerBarPool.Add(new TextTimerBar("Timer", $"~y~{t.Minutes}:{t.Seconds:d2}"));
                }
                else
                {
                    TimerBarPool.Add(new TextTimerBar("Timer", $"{t.Minutes}:{t.Seconds:d2}"));
                }
            }
            else if (User.MapInfo.Briefing > 0)
            {
                TimerBarPool.Add(new TextTimerBar("Role", "Unknown"));
                TimerBarPool.Add(new TextTimerBar("Briefing", $"{User.MapInfo.Briefing:d2}"));
            }

            foreach (var p in new PlayerList())
            {
                if (!NetworkIsPlayerTalking(p.Handle))
                {
                    continue;
                }
                TimerBarPool.Add(new TextTimerBar("", $"{p.Name} ~b~Talking"));
            }
        }