Пример #1
0
        internal void Reset()
        {
            state = null;
            OnStateChanged();

            accepted    = null;
            queueStart  = afkCheckEnd = default(DateTime);
            lastGameDto = null;

            draftData = null;
        }
Пример #2
0
        private bool OnSearchingForMatch(SearchingForMatchNotification search)
        {
            if (search.JoinedQueues.Count > 0)
            {
                queueStart = DateTime.Now;
                state      = new Model.MatchmakingState {
                    Estimate = search.JoinedQueues.First().WaitTime,
                    Actual   = state?.Actual ?? 0,
                };
                OnStateChanged();
            }

            return(true);
        }
Пример #3
0
        private bool OnGameData(GameDataObject lcds)
        {
            if (lcds != null)
            {
                draftData = lcds.Content;
            }

            switch (lcds.Content.CurrentPhase)
            {
            case Phase.DRAFT_PREMADE:
                if (state != null)
                {
                    state = null;
                    OnStateChanged();
                    OnAdvancedToLobby();
                }
                break;

            case Phase.MATCHMAKING:
                state = new Model.MatchmakingState {
                    Actual   = draftData.MatchmakingState.TimeInMatchmaking,
                    Estimate = draftData.MatchmakingState.EstimatedMatchmakingTime
                };
                OnStateChanged();
                break;

            case Phase.AFK_CHECK:
                state.AfkCheck = new AfkCheck {
                    Accepted  = draftData.AfkCheckState.IsReady ? new bool?(true) : null,
                    Duration  = draftData.AfkCheckState.MaxDuration,
                    Remaining = draftData.AfkCheckState.RemainingDuration
                };
                OnStateChanged();
                break;

            case Phase.CHAMPION_SELECT:
                OnAdvancedToChampSelect();
                break;
            }

            return(true);
        }