示例#1
0
文件: Game.cs 项目: i2um1/VolleyBall
        public Game(Canvas canvas, Fence fence, Ball ball, Player[] players, TextBlock result)
        {
            this.canvas = canvas;
            this.fence = fence;
            this.ball = ball;
            this.players = players;
            this.result = result;

            timer = new DispatcherTimer();
            timer.Interval = new System.TimeSpan(speed);
            timer.Tick += new System.EventHandler(timer_Tick);

            wait = new DispatcherTimer();
            wait.Tick += new System.EventHandler(wait_Tick);
            wait.Interval = new TimeSpan(0, 0, 0, 0, timeWait);

            fence.SetLeft((canvas.RealWidth() - fence.Width) / 2.0);
            fence.SetTop(canvas.RealHeight() - fence.Height);

            Reset();
        }