Ejemplo n.º 1
0
    public static void NextRound()
    {
        ++_currentRoundIndex;

        Question[] questions        = null;
        GameRound  currentGameRound = null;

        switch (CurrentRound)
        {
        case Round.ThreeSixNine:
            currentGameRound = new ThreeSixNineRound();
            questions        = GetCurrentRoundQuestions <ThreeSixNineQuestion>();
            break;

        case Round.OpenDoor:
            currentGameRound = new OpenDoorRound();
            questions        = GetCurrentRoundQuestions <OpenDoorQuestion>();
            break;

        case Round.Puzzle:
            currentGameRound = new PuzzleRound();
            questions        = GetCurrentRoundQuestions <PuzzleQuestion>();
            break;

        case Round.Gallery:
            currentGameRound = new GalleryRound();
            questions        = GetCurrentRoundQuestions <GalleryQuestion>();
            break;

        case Round.CollectiveMemory:
            currentGameRound = new CollectiveMemoryRound();
            questions        = GetCurrentRoundQuestions <CollectiveMemoryQuestion>();
            break;

        case Round.Finale:
            currentGameRound = new FinaleRound();
            questions        = GetCurrentRoundQuestions <FinaleQuestion>();
            break;

        case Round.Bonus:
            currentGameRound = new BonusRound();
            break;

        case Round.Done:
            currentGameRound = new DoneRound();
            break;
        }

        SceneManager.Instance.Load(currentGameRound.SceneName, () => currentGameRound.Start(_teams, questions));
    }
Ejemplo n.º 2
0
    private void OnDestroy()
    {
        if (_controller != null)
        {
            for (int i = 0; i < _answerButtons.Length; i++)
            {
                _answerButtons[i].onClick.RemoveAllListeners();
            }

            _nextPlayerButton.onClick.RemoveAllListeners();

            _controller.OnWaitingForNextQuestionPrompt -= SetStateToWaitingForNextQuestion;
            _controller.OnWaitingForNextPlayer         -= SetStateWaitingForNextPlayer;

            _controller = null;
        }
    }
Ejemplo n.º 3
0
    public void SetController(PuzzleRound controller)
    {
        _controller = controller;

        for (int i = 0; i < _answerButtons.Length; i++)
        {
            int index = i;
            _answerButtons[i].onClick.RemoveAllListeners();
            _answerButtons[i].onClick.AddListener(() => { Debug.LogFormat("Trying to show answer {0}", index); _answerButtons[index].interactable = false; _controller.CorrectAnswer(index); });
            _answerButtons[i].interactable = false;
        }

        _nextPlayerButton.onClick.AddListener(_controller.StartTimer);
        _nextPlayerButton.onClick.AddListener(SetStateToWaitingForAnswer);
        _playerPassedButton.onClick.AddListener(_controller.TeamPassed);
        _nextPuzzleButton.onClick.AddListener(_controller.NextQuestion);
        _nextPuzzleButton.onClick.AddListener(SetStateToWaitingForAnswer);

        _controller.OnWaitingForNextQuestionPrompt += SetStateToWaitingForNextQuestion;
        _controller.OnWaitingForNextPlayer         += SetStateWaitingForNextPlayer;
    }
Ejemplo n.º 4
0
        public static string ToUrlEncode(
            PuzzleRound round,
            SolveCalculations calculations,
            PersonalBest currentPb)
        {
            if (round == null)
            {
                return("");
            }

            var builder = new StringBuilder();

            builder.Append(round.Puzzle);
            if (!string.IsNullOrEmpty(round.Name))
            {
                builder.Append("%20");
                builder.Append(round.Name.Replace(" ", "%20"));
            }
            builder.Append("%0a");

            builder.Append("-----%0a");

            foreach (var solve in round.Solves)
            {
                builder.Append(solve.Number);
                builder.Append("%20-%20");
                builder.Append(solve.Result);
                builder.Append("%0a");
            }

            builder.Append("-----%0a");

            var hasCurrentAverage = calculations.CurrentAverage != NA;
            var hasNeededForNewPB = calculations.NeededForNewPB != NA;
            var hasBPA            = calculations.BestPossibleAverage != NA;

            if (hasCurrentAverage)
            {
                builder.Append("Live%20");
                builder.Append(calculations.CurrentAverage);

                if (hasNeededForNewPB || hasBPA)
                {
                    builder.Append(",%20");
                }
            }

            if (hasNeededForNewPB)
            {
                builder.Append("For%20PB%20");
                builder.Append(calculations.NeededForNewPB);

                if (hasBPA)
                {
                    builder.Append(",%20");
                }
            }

            if (hasBPA)
            {
                builder.Append("BPA%20");
                builder.Append(calculations.BestPossibleAverage);
            }

            if (currentPb != null)
            {
                builder.Append("%0a-----%0a");
                builder.Append("PBs:%20Single%20");
                builder.Append(currentPb.Single);
                builder.Append("%20Avg%20");
                builder.Append(currentPb.Average);
            }

            return(builder.ToString());
        }