示例#1
0
        //, int X, int Y, int sizeX, int sizeY
        public StreetHandler(Game Game1,Texture2D[] imgs)
        {
            this.spriteBatch_ = (SpriteBatch)Game1.Services.GetService(typeof(SpriteBatch));
            this.graphics_ = (GraphicsDeviceManager)Game1.Services.GetService(typeof(GraphicsDeviceManager));
            font = (SpriteFont)Game1.Services.GetService (typeof(SpriteFont));
            street = new BoardPiece[40];
            //this.X = X;
            //this.Y = Y;
            //this.sizeX = sizeX;
            //this.sizeY = sizeY;
            this.imgs = imgs;
            button = new Texture2D[5];
            button[0] = Game1.Content.Load<Texture2D> ("Buttons/Mortgage");
            button[1] = Game1.Content.Load<Texture2D> ("Buttons/Unmortgage");
            button[2] = Game1.Content.Load<Texture2D> ("Buttons/BuyHouse");
            button[3] = Game1.Content.Load<Texture2D> ("Buttons/SellHouse");
            button[4] = Game1.Content.Load<Texture2D> ("Buttons/SellStreet");

            buttonrect = new Rectangle[4];
            buttonrect[0] = new Rectangle (450, 600, 90, 30); //Mortgage
            buttonrect[1] = new Rectangle (630, 600, 90, 30); //Buy House
            buttonrect[2] = new Rectangle (720, 600, 90, 30); //Sell House
            buttonrect[3] = new Rectangle (540, 600, 90, 30); //SellStreet
            DB = (Database)Game1.Services.GetService (typeof(Database));
            GE = (GameEngine)Game1.Services.GetService (typeof(GameEngine));

            streetRect = new Rectangle[40];
            streetColor = Color.Black;
        }
示例#2
0
        public override void Initialize()
        {
            //TODO ladda errything graphics etc

            spriteBatch_ = (SpriteBatch)Game.Services.GetService(typeof(SpriteBatch));
            graphics_ = (GraphicsDeviceManager)Game.Services.GetService(typeof(GraphicsDeviceManager));
            DB = (Database)Game.Services.GetService (typeof(Database));
            GE = (GameEngine)Game.Services.GetService (typeof(GameEngine));
            font = Game.Content.Load<SpriteFont>("Koot");
            blackRectangle1 = new Texture2D(GraphicsDevice, 1, 1);
            blackRectangle1.SetData(new[] { Color.Black });
            blackRectangle2 = new Texture2D(GraphicsDevice, 1, 1);
            blackRectangle2.SetData(new[] { Color.Black });
            blackRectangle3 = new Texture2D(GraphicsDevice, 1, 1);
            blackRectangle3.SetData(new[] { Color.Black });
            blackRectangle4 = new Texture2D(GraphicsDevice, 1, 1);
            blackRectangle4.SetData(new[] { Color.Black });
            blackRectangle5 = new Texture2D(GraphicsDevice, 1, 1);
            blackRectangle5.SetData(new[] { Color.Black });
            option1 = new Rectangle(185,100,100,30);
            option2 = new Rectangle(385,100,100,30);
            option3 = new Rectangle(185,200,100,30);
            option4 = new Rectangle(385,200,100,30);
            option5 = new Rectangle(285,300,100,30);
            base.Initialize ();
            optionHighight = 1;
        }
示例#3
0
 public Game1()
 {
     graphics_ = new GraphicsDeviceManager (this);
     GE = new GameEngine ();
     DB = new Database ();
     Content.RootDirectory = "Content";
     graphics_.IsFullScreen = true;
     graphics_.PreferredBackBufferHeight = 720;
     graphics_.PreferredBackBufferWidth = 1280;
     menu = new Menu(this);
     Components.Add(menu);
     //variable step, a draw() call after each update()
     IsFixedTimeStep = false;
 }
示例#4
0
        public override void Initialize()
        {
            ChangeInDB = 0;
            //TODO ladda errything graphics etc
            spriteBatch_ = (SpriteBatch)Game.Services.GetService(typeof(SpriteBatch));
            graphics_ = (GraphicsDeviceManager)Game.Services.GetService(typeof(GraphicsDeviceManager));
            font = (SpriteFont)Game.Services.GetService(typeof(SpriteFont));
            DB = (Database)Game.Services.GetService (typeof(Database));
            GE = (GameEngine)Game.Services.GetService (typeof(GameEngine));

            GameBoard = Game.Content.Load<Texture2D> ("Images/Monopol");

            //load movement-positions of boardpieces
            boardPiece = new BoardPiece[40];
            streetpositions (boardPiece);
            streetimgs = new Texture2D[40];
            setStreetImages (streetimgs);

            Boardcolor = new Color[40];

            //Initialize players
            player = new Player[4];
            for(int i=0; i < player.Length;i++)
            {
                player[i] = DB.getplayerbyID(i);
            }

            //namepositions
            pNamePos = new Vector2[player.Length];
            pNamePos[0] = new Vector2(50,100);
            pNamePos[1] = new Vector2(1100,100);
            pNamePos[2] = new Vector2(50,400);
            pNamePos[3] = new Vector2(1100,400);

            //images for each player
            P1 = Game.Content.Load<Texture2D> ("Player1");
            P2 = Game.Content.Load<Texture2D> ("Player2");
            P3 = Game.Content.Load<Texture2D> ("Player3");
            P4 = Game.Content.Load<Texture2D> ("Player4");

            //Gameboard size
            GameBoardR = new Rectangle (200, 50, 900, 700);
            PPos = new Rectangle[4];

            //Colors of the player nametags
            activeColor = Color.Green;
            inactiveColor = Color.Red;
            deadColor = Color.Black;

            //Streethandler need 1 Rectangle for each player
            StreetHandler_ = new StreetHandler (Game, streetimgs);
            streetrect = new Rectangle[4];
            streetrect [0] = new Rectangle (50, 120, 200, 250);
            streetrect [1] = new Rectangle (1100, 120, 200, 250);
            streetrect [2] = new Rectangle (50, 420, 200, 250);
            streetrect [3] = new Rectangle (1100, 420, 200, 250);

            GG = false;
            stateimgs = new Texture2D[10];
            stateimgs[0] = Game.Content.Load<Texture2D> ("Statebackground");
            stateimgs[1] = Game.Content.Load<Texture2D> ("Buttons/Roll");
            stateimgs[2] = Game.Content.Load<Texture2D> ("Buttons/Buy");
            stateimgs[3] = Game.Content.Load<Texture2D> ("Buttons/Draw");
            stateimgs [4] = Game.Content.Load<Texture2D> ("dice");
            stateimgs [5] = Game.Content.Load<Texture2D> ("Buttons/Pay");
            stateimgs [6] = Game.Content.Load<Texture2D> ("Buttons/Done");
            stateimgs [7] = Game.Content.Load<Texture2D> ("Buttons/Abort");
            stateimgs [8] = Game.Content.Load<Texture2D> ("Buttons/Move");

            AI_ = new AI(Game);
            GUIStateHandler_ = new GUIStateHandler(Game, stateimgs,400,200,500,350);
            Game.Services.AddService(typeof(GUIStateHandler), GUIStateHandler_);
            Game.Services.AddService(typeof(AI), AI_);
            PlC = new PlayerControl (Game);
            WatcherConfig ();
            base.Initialize();
        }