Example #1
0
        public SecondPageViewModel()
        {
            _musicPlayer = DependencyService.Get <IMusicPlayer>();

            _timer                 = new CountDownTimer(TimeSpan.FromSeconds(300));
            _timer.Interval        = TimeSpan.FromSeconds(1);
            _timer.IntervalPassed += _timer_IntervalPassed;

            Plus1MinCommand = new DelegateCommand(() => {
                _timer.CurrentTime.Add(TimeSpan.FromMinutes(1));
                UpdateTimer();
            });

            Plus10SecCommand = new DelegateCommand(() => {
                _timer.CurrentTime.Add(TimeSpan.FromSeconds(10));
                UpdateTimer();
            });

            Minus10SecCommand = new DelegateCommand(() => {
                _timer.CurrentTime.Subtract(TimeSpan.FromSeconds(10));
                UpdateTimer();
            });


            Minus1MinCommand = new DelegateCommand(() => {
                _timer.CurrentTime.Subtract(TimeSpan.FromMinutes(1));
                UpdateTimer();
            });


            StartTimerCommand = new DelegateCommand(() => {
                _timer.Start();
                UpdateTimer();
            });


            StopTimerCommand = new DelegateCommand(() => {
                _timer.Stop();
                UpdateTimer();
            });


            ResetTimerCommand = new DelegateCommand(() => {
                _timer.Reset();
                UpdateTimer();
            });

            BGMStopCommand = new DelegateCommand(() => {
                _musicPlayer.Stop();
            });

            BGMOpeningCommand = new DelegateCommand(() => {
                _musicPlayer.Stop();
                _musicPlayer.PlayAsync("openingBGM");
            });

            BGMRoleCommand = new DelegateCommand(() => {
                _musicPlayer.Stop();
                _musicPlayer.PlayAsync("confirmBGM");
            });

            BGMMorningCommand = new DelegateCommand(() => {
                _musicPlayer.Stop();
                _musicPlayer.PlayAsync("morningBGM");
            });
            BGMDayTimeCommand = new DelegateCommand(() => {
                _musicPlayer.Stop();
                _musicPlayer.PlayAsync("discussionBGM");
            });

            BGMVoteCommand = new DelegateCommand(() => {
                _musicPlayer.Stop();
                _musicPlayer.PlayAsync("voteBGM");
            });

            BGMExecuteCommand = new DelegateCommand(() => {
                _musicPlayer.Stop();
                _musicPlayer.PlayAsync("executionBGM");
            });

            BGMNightCommand = new DelegateCommand(() => {
                _musicPlayer.Stop();
                _musicPlayer.PlayAsync("nightBGM");
            });


            BGMVillagerWinCommand = new DelegateCommand(() => {
                _musicPlayer.Stop();
                _musicPlayer.PlayAsync("victoryBGM_villagers");
            });

            BGMWerewolfWinCommand = new DelegateCommand(() => {
                _musicPlayer.Stop();
                _musicPlayer.PlayAsync("victoryBGM_werewolf");
            });

            BGMThirdPartyWinCommand = new DelegateCommand(() => {
                _musicPlayer.Stop();
                _musicPlayer.PlayAsync("victoryBGM_3rdParty");
            });
        }