Пример #1
0
        public static void Run()
        {
            RegisteredParticipants = new ThreadSafeSortedList <long, ClientSession>();
            RegisteredGroups       = new ThreadSafeSortedList <long, Group>();
            PlayingGroups          = new ThreadSafeSortedList <long, List <Group> >();

            ServerManager.Shout(Language.Instance.GetMessageFromKey("TALENTARENA_OPEN"), true);

            GroupingThread groupingThread = new GroupingThread();

            Observable.Timer(TimeSpan.FromSeconds(0)).Subscribe(observer => groupingThread.Run());

            MatchmakingThread matchmakingThread = new MatchmakingThread();

            Observable.Timer(TimeSpan.FromSeconds(3)).Subscribe(observer => matchmakingThread.Run());

            IsRunning = true;

            Observable.Timer(TimeSpan.FromMinutes(30)).Subscribe(observer =>
            {
                groupingThread.RequestStop();
                matchmakingThread.RequestStop();
                RegisteredParticipants.ClearAll();
                RegisteredGroups.ClearAll();
                IsRunning = false;
                ServerManager.Instance.StartedEvents.Remove(EventType.TALENTARENA);
            });
        }