コード例 #1
0
ファイル: RPGGameView.cs プロジェクト: napatsawan/RPGExample
        public RPGGameView()
        {
            InitializeComponent();
            pb = new PictureBox[12, 13];
            for (int i = 0; i != 12; i++)
            {
                for (int j = 0; j != 13; j++)
                {
                    pb[i, j] = new PictureBox();
                    pb[i, j].Width = 30;
                    pb[i, j].Height = 30;
                    pb[i, j].Left = i * 30;
                    pb[i, j].Top = j * 30;
                    pb[i, j].Visible = true;
                    this.Controls.Add(pb[i, j]);
                }
            }

            tree = Image.FromFile("../../tree.png");
            wall = Image.FromFile("../../wall.png");
            empty = Image.FromFile("../../empty.png");
            hero = Image.FromFile("../../hero.png");
            monster = Image.FromFile("../../monster.png");
            start = Image.FromFile("../../start.png");
            end = Image.FromFile("../../end.png");

            gameController = new RPGGameController();
            gameModel = new RPGGameModel();
            gameController.AddModel(gameModel);
            gameModel.AttachObserver(this);
            this.setController(gameController);
        }
コード例 #2
0
ファイル: RPGGameView.cs プロジェクト: napatsawan/RPGExample
 public void setController(RPGGameController c)
 {
     gameController = c;
 }