コード例 #1
0
        internal TimerManager(TimerConfiguration config)
        {
            _config = config;

            _whiteTimer              = new PlayerTimer(config);
            _whiteTimer.TimeChanged += (sender, e) => { WhiteTimerChanged?.Invoke(this, e); };
            _whiteTimer.TimesUp     += (sender, e) => { WhiteTimesUp?.Invoke(this, e); };
            _blackTimer              = new PlayerTimer(config);
            _blackTimer.TimeChanged += (sender, e) => { BlackTimerChanged?.Invoke(this, e); };
            _blackTimer.TimesUp     += (sender, e) => { BlackTimesUp?.Invoke(this, e); };
        }
コード例 #2
0
ファイル: Board.cs プロジェクト: Fabernaz/Chess
        private TimerManager InitTimeManager()
        {
            var ret = new TimerManager(new TimerConfiguration
            {
                Hours   = 0,
                Minutes = 1,
                AfterMoveNumSecondsIncrement = new Dictionary <int, int> {
                    { 5, 20 }
                },
                AfterMoveSecondsIncrement = 3
            });

            ret.WhiteTimerChanged += (sender, e) => { WhiteTimerChanged?.Invoke(this, new EventArgs()); };
            ret.BlackTimerChanged += (sender, e) => { BlackTimerChanged?.Invoke(this, new EventArgs()); };

            return(ret);
        }