Esempio n. 1
0
        public async Task <PlayLoopState> GetCurrentQueue()
        {
            var queue = (await availableQueues).SingleOrDefault(q => q.Id == CurrentQueueId);
            var state = new PlayLoopState(CurrentType != PlayLoopType.NONE, CurrentQueueId, queue?.Config ?? 0);

            if (state.InPlayLoop && state.QueueId == 0)
            {
                state.QueueConfigId = custom.CurrentConfig;
            }
            return(state);
        }
Esempio n. 2
0
    public void SwitchState(PlayLoopState state)
    {
        object pastStateResult = null;

        if (currentLoopState != null)
        {
            pastStateResult = currentLoopState.End();
        }

        switch (state)
        {
        case PlayLoopState.MainMenu:
            currentLoopState = mainMenuLoop;
            break;

        case PlayLoopState.StartGame:
            currentLoopState = startGameLoop;
            break;

        case PlayLoopState.Preparation:
            currentLoopState = preparationLoop;
            break;

        case PlayLoopState.PlayerAction:
            currentLoopState = playerActionLoop;
            break;

        case PlayLoopState.ActionResolution:
            currentLoopState = actionResolutionLoop;
            break;

        case PlayLoopState.Scoring:
            currentLoopState = scoringLoop;
            break;

        case PlayLoopState.NewRound:
            currentLoopState = newRoundLoop;
            break;
        }

        currentLoopState.Begin(pastStateResult);
    }