WEB开发网
开发学院软件开发C语言 游戏人生Silverlight(3) - 打苍蝇[Silverlight 2.... 阅读

游戏人生Silverlight(3) - 打苍蝇[Silverlight 2.0(c#)]

 2009-06-22 08:33:13 来源:WEB开发网   
核心提示: 3、苍蝇控件的PresenterFlyPresenter.csusing System;using System.Net;using System.Windows;using System.Windows.Controls;using System.Windows.Documents;us

3、苍蝇控件的Presenter

FlyPresenter.cs


using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

using YYFly.Model;
using YYFly.View;

namespace YYFly.Presenter
{
    /**//// <summary>
    /// Model - View - Presenter 模式中的 Presenter
    /// </summary>
    public class FlyPresenter
    {
        public FlyPresenter(IFlyView flyView, IFlyModel flyModel)
        {
            FlyView = flyView;
            FlyModel = flyModel;

            FlyView.Start += new EventHandler(FlyView_Start);
            FlyView.Stop += new EventHandler(FlyView_Stop);
            flyView.Score += new EventHandler(flyView_Score);

            FlyModel.FlyChanging += new EventHandler<FlyEventArgs>(FlyModel_FlyChanging);
        }

        void FlyView_Start(object sender, EventArgs e)
        {
            FlyModel.Start();
        }

        void FlyView_Stop(object sender, EventArgs e)
        {
            FlyModel.Stop();
        }

        void flyView_Score(object sender, EventArgs e)
        {
            FlyModel.Score();
        }

        void FlyModel_FlyChanging(object sender, FlyEventArgs e)
        {
            FlyView.Update(e.X, e.Y, e.Z);
        }

        public IFlyView FlyView { get; set; }
        public IFlyModel FlyModel { get; set; }
    }
}

OK

系列文章:

游戏人生Silverlight(1) - 七彩俄罗斯方块[Silverlight 2.0]

游戏人生Silverlight(2) - 趣味钢琴[Silverlight 2.0(c#)]

游戏人生Silverlight(4) - 连连看[Silverlight 2.0(c#)]

游戏人生Silverlight(5) - 星际竞技场[Silverlight 2.0(c#, Farseer Physics Engine)]

上一页  1 2 3 

Tags:游戏 人生 Silverlight

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接