Пример #1
0
    public int UpdateTestPattern(float deltaTime)

    /**
     * Return -1 if pattern is complete
     * Return 1...N for active block
     * 0 if no block is highlighted
     */
    {
        if (currentPatternState == PatternState.ActiveDisplay)
        {
            if (displayOn.IsComplete(deltaTime))
            {
                displayOff.Reset();
                currentPatternState = PatternState.PatternInterval;
                return(0);
            }
            else
            {
                return(testPattern.GetActivePatternListItem());
            }
        }
        else
        {
            if (displayOff.IsComplete(deltaTime))
            {
                testPattern.StepPattern();

                if (testPattern.IsComplete(testIterationCounter))
                {
                    return(-1);
                }
                else
                {
                    displayOn.Reset();
                    currentPatternState = PatternState.ActiveDisplay;
                    return(0);
                }
            }
            else
            {
                return(0);
            }
        }
    }
    private void InitLaunchBallCounter()
    {
        if (countDownTimer == null)
        {
            countDownTimer = new CountDownTimer(3);
            countDownTimer.Init();
        }

        countDownTimer.Reset();
    }
Пример #3
0
 /// <summary>
 /// 消失后重置预设
 /// </summary>
 private void OnDisable()
 {
     material.SetFloat("_BurnAmount", 0.0f);
     delayTimer.Reset(delayTime, true);
     dissloveTimer.Reset(dissloveTime, true);
 }
Пример #4
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");
            });
        }