示例#1
0
 public static void DownloadBonusRoundImage(BonusRound bonusRound)
 {
     if (bonusRound != null)
     {
         DownloadBonusRoundImage(bonusRound.BonusQuestions);
     }
 }
示例#2
0
    public void SetController(BonusRound controller)
    {
        _controller = controller;

        _nextRoundButton.onClick.AddListener(_controller.NextRound);
        _nextRoundButton.interactable = false;
        _addTimeButton.onClick.AddListener(AddTime);
        _addTimeButton.interactable = true;
    }
示例#3
0
    private void StartGame(IEnumerable<Round> questions, BonusRound bonusRound, bool includeBonusRound, bool isBonusRoundAtEnd)
    {
      EventHandler onClosed;
      
      gameWindow?.Close();

      currentGame = new Game(questions, bonusRound)
      {
        BonusRoundLocation = !includeBonusRound || bonusRound == null || bonusRound.BonusQuestions.Count == 0 ? 
                              BonusRoundLocation.None :
                             isBonusRoundAtEnd ?                                                                
                              BonusRoundLocation.End :
                             BonusRoundLocation.Middle    
      };

      onClosed = null;
      onClosed = (object sender, EventArgs args) =>
      {
        gameWindow.Closed -= onClosed;
        gameWindow.PropertyChanged -= OnPropertyChanged;
        ChangeButtonState(ButtonState.NoGame);
        CurrentRoundAnswers = new ObservableCollection<Answer>();
        currentGame = null;
      };
      gameWindow = new GameWindow(currentGame);
      gameWindow.PropertyChanged += OnPropertyChanged;
      gameWindow.Closed += onClosed;
      ChangeButtonState(ButtonState.NewGame);
      gameWindow.PropertyChanged += (sender, args) =>
      {
        if(args.PropertyName == nameof(GameWindow.IsQuestionShown))
        {
          if(gameWindow.IsQuestionShown != IsActiveQuestionShown)
          {
            ShowCurrentQuestionOverlay_Click(null, null);
          }
        }
      };
      if(includeBonusRound)
      {
        StartBonusTimer.IsEnabled = true;
        StartBonusTimer.Content = "Start Countdown";
        bonusTimerCounting = false;
        gameWindow.OnTimerFinished += (sender, args) =>
        {
          this.Dispatcher.Invoke(() => { StartBonusTimer.IsEnabled = false; });
        };
      }

      TeamScoreTracker.SetColumnCount((int)currentGame.NumRounds, currentGame.BonusRoundLocation);
      gameWindow.Show();
    }
示例#4
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));
    }
        public BonusRoundControl(BonusRound bRound)
        {
            mNextEnabled = true;
            mPrevEnabled = true;

            InitializeComponent();

            mBonusData = bRound != null ? bRound : new BonusRound();

            ShownAnswers = new bool[bRound.BonusQuestions.Count];

            DataContext = this;

            mDingMediaPlayer         = new MediaPlayer();
            mDingMediaPlayer.IsMuted = true;
            mDingMediaPlayer.Open(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"/Sounds/Bing-sound.mp3", UriKind.RelativeOrAbsolute));
            mDingMediaPlayer.MediaEnded += (obj, e) =>
            {
                mDingMediaPlayer.Position = new TimeSpan(0, 0, 0);
                mDingMediaPlayer.Pause();
            };

            mXMediaPlayer         = new MediaPlayer();
            mXMediaPlayer.IsMuted = true;
            mXMediaPlayer.Open(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"/Sounds/Wrong_Buzzer.wav", UriKind.RelativeOrAbsolute));
            mXMediaPlayer.MediaEnded += (obj, e) =>
            {
                mXMediaPlayer.Position = new TimeSpan(0, 0, 0);
                mXMediaPlayer.Pause();
            };

            currTick       = TimerSeconds;
            countDownTimer = InitNewTimer();

            RoutedEventHandler loadedEvent = null;

            loadedEvent = (s, e) =>
            {
                Loaded -= loadedEvent;
                int numQuestions = BonusData.BonusQuestions.Count;
                for (int i = 1; i <= numQuestions; i++)
                {
                    (FindName("tbQ" + i) as TextBlock).Text = BonusData.BonusQuestions[i - 1].Question.QuestionText;
                }

                showXStory = Resources["sbShowX"] as Storyboard;
            };
            Loaded += loadedEvent;
        }
示例#6
0
    private void GameBuildingCompleted(object sender, GameBuildingCompletedEventArgs args)
    {
      ObservableCollection<Round> rounds = new ObservableCollection<Round>();
      BonusRound bonusRound = new BonusRound();

      // Create a deep copy to prevent editing of rounds and Bonus Questions from messing up existing games.
      // If you disable editing while a game is occurring, you can remove this.
      foreach(Round round in args.SelectedRounds)
      {
        rounds.Add(round.Copy());
      }

      foreach(BonusQuestion bonusQuestion in args.SelectedBonusQuestions)
      {
        bonusRound.BonusQuestions.Add(bonusQuestion.Copy());
      }

      foreach(Round round in args.NewRounds)
      {
        var matchingQuestion = mQuestions.FirstOrDefault(b => b.Question.Equals(round.Question));
        if(matchingQuestion != null)
        {
          mQuestions.Remove(matchingQuestion);
        }
        mQuestions.Insert(0, round.Copy());
      }

      foreach(BonusQuestion bonusQuestion in args.NewBonusQuestions)
      {
        var matchingQuestion = mBonusQuestions.FirstOrDefault(b => b.Question.Equals(bonusQuestion.Question));
        if(matchingQuestion != null)
        {
          mBonusQuestions.Remove(matchingQuestion);
        }
        mBonusQuestions.Insert(0, bonusQuestion.Copy());
      }

      StartGame(rounds, bonusRound, args.HasBonusRound, args.BonusAtEnd);
    }