public void add(BoardPiece piece)
 {
     streetlist.Add (piece.name);
 }
 /*	public void add(BoardPiece piece)
 {
     streetlist.Add (piece);
 }
 */
 public void updatelist(Player player, BoardPiece[] piece)
 {
     player.streetlist = new List<BoardPiece> ();
     for(int i=0; i<piece.Length;i++)
     {
         if(player.ID == piece[i].owner.ID)
         {
             player.add (piece [i]);
         }
     }
 }
 public void listnames(Player player, Rectangle rect)
 {
     this.X = rect.X;
     this.Y = rect.Y;
     this.sizeX = rect.Width;
     this.sizeY = rect.Height;
     mouseState_ = Mouse.GetState();
     mousePosition_ = new Point(mouseState_.X, mouseState_.Y);
     if (bigPic)
     {
         ShowStreet (currentPiece);
     }
     for (int i = 0; i < player.streetlist.Count; i++) {
         if (Y + i * 12 < Y+sizeY) {
             streetRect[i] = new Rectangle (X, Y + 3 + (i * 12), 100, 12);
             if (streetRect[i].Contains (mousePosition_)) {
                 if (mouseState_.LeftButton == ButtonState.Pressed )
                 {
                     bigPic = true;
                     currentPiece = player.streetlist[i];
                     ShowStreet (player.streetlist [i]);
                 }
             }
             Z = (i + 1) * 12;
         }
     else {
             streetRect[i] = new Rectangle (X + 100, Y + 3 + (i * 12) - Z, 100, 12);
         if (streetRect[i].Contains (mousePosition_)) {
                 if (mouseState_.LeftButton == ButtonState.Pressed && prevMouseState_.LeftButton == ButtonState.Released) {
                     bigPic = true;
                     currentPiece = player.streetlist[i];
                     ShowStreet (player.streetlist [i]);
                 }
             }
         }
     }
     prevMouseState_ = mouseState_;
 }
        public void ShowStreet(BoardPiece piece)
        {
            mouseState_ = Mouse.GetState();
            mousePosition_ = mouseState_.Position;
            if (piece.owner.currentplayer) {

                if (piece.mortgaged) {
                    CMortgaged = Color.Gray;
                    if (buttonrect [0].Contains (mousePosition_) && mouseState_.LeftButton == ButtonState.Pressed && prevMouseState_.LeftButton == ButtonState.Released && clickdelay > 10) {
                        piece.mortgaged = false;
                        GE.mortageAction (piece.owner.ID, piece.name);
                    } else if (buttonrect [1].Contains (mousePosition_) && mouseState_.LeftButton == ButtonState.Pressed && prevMouseState_.LeftButton == ButtonState.Released && clickdelay > 10) {
                        //TODO  inactive button, show it
                    } else if (buttonrect [2].Contains (mousePosition_) && mouseState_.LeftButton == ButtonState.Pressed && prevMouseState_.LeftButton == ButtonState.Released && clickdelay > 10) {
                        //TODO  inactive button, show it
                    } else if (buttonrect [3].Contains (mousePosition_) && mouseState_.LeftButton == ButtonState.Pressed && prevMouseState_.LeftButton == ButtonState.Released && clickdelay > 10) {
                        //TODO  inactive button, show it
                    } else if (mouseState_.LeftButton == ButtonState.Pressed && prevMouseState_.LeftButton == ButtonState.Released && clickdelay > 10) {
                        clickdelay = 0;
                        bigPic = false;
                    }

                } else {
                    CMortgaged = Color.White;
                    if (buttonrect [0].Contains (mousePosition_) && mouseState_.LeftButton == ButtonState.Pressed && prevMouseState_.LeftButton == ButtonState.Released && clickdelay > 10) {
                        piece.mortgaged = true;
                        GE.mortageAction (piece.owner.ID, piece.name);
                    } else if (buttonrect [1].Contains (mousePosition_) && mouseState_.LeftButton == ButtonState.Pressed && prevMouseState_.LeftButton == ButtonState.Released && clickdelay > 10) {
                        //TODO Build a house on property
                        GE.buyHouse (piece.owner.ID, piece.name);
                    } else if (buttonrect [2].Contains (mousePosition_) && mouseState_.LeftButton == ButtonState.Pressed && prevMouseState_.LeftButton == ButtonState.Released && clickdelay > 10) {
                        //TODO sell a house on property
                        GE.sellHouse (piece.owner.ID, piece.name);
                    } else if (buttonrect [3].Contains (mousePosition_) && mouseState_.LeftButton == ButtonState.Pressed && prevMouseState_.LeftButton == ButtonState.Released && clickdelay > 10) {
                        //TODO something visual to let people know they sold
                        GE.sellSection (piece.owner.ID, piece.name);
                    } else if (mouseState_.LeftButton == ButtonState.Pressed && prevMouseState_.LeftButton == ButtonState.Released && clickdelay > 10) {
                        clickdelay = 0;
                        bigPic = false;
                    }
                }
            }
            else if (mouseState_.LeftButton == ButtonState.Pressed && prevMouseState_.LeftButton == ButtonState.Released && clickdelay > 10) {
                clickdelay = 0;
                bigPic = false;

            }
            else
            {
                if(piece.mortgaged)
                {
                    CMortgaged = Color.Gray;
                }
                else
                {
                    CMortgaged = Color.White;
                }
            }
            prevMouseState_ = mouseState_;
            clickdelay++;
        }
        public void ShowStreetDraw(BoardPiece piece)
        {
            if(piece.mortgaged)
            {
                spriteBatch_.Draw (button[1], buttonrect[0], Color.White);
                //spriteBatch_.Draw (button[3], buttonrect[1], Color.White);
                spriteBatch_.Draw (button[4], buttonrect[3], Color.White);
            }
            else
            {
                spriteBatch_.Draw (button[0], buttonrect[0], Color.White);
                spriteBatch_.Draw (button[2], buttonrect[1], Color.White);
                spriteBatch_.Draw (button[3], buttonrect[2], Color.White);
                spriteBatch_.Draw (button[4], buttonrect[3], Color.White);
            }

            switch(piece.name)
            {
            case("Galaxen"):
                spriteBatch_.Draw (imgs [0], new Rectangle (450, 250, 250, 350), CMortgaged);
                break;
            case("MAI"):
                spriteBatch_.Draw (imgs [1], new Rectangle (450, 250, 250, 350), CMortgaged);
                break;
            case("KeyHuset"):
                spriteBatch_.Draw (imgs [2], new Rectangle (450, 250, 250, 350), CMortgaged);
                break;
            case("DHuset"):
                spriteBatch_.Draw (imgs [3], new Rectangle (450, 250, 250, 350), CMortgaged);
                break;
            case("HG"):
                spriteBatch_.Draw (imgs [4], new Rectangle (450, 250, 250, 350), CMortgaged);
                break;
            case("Campushallen"):
                spriteBatch_.Draw (imgs [5], new Rectangle (450, 250, 250, 350), CMortgaged);
                break;
            case("Zenit"):
                spriteBatch_.Draw (imgs [6], new Rectangle (450, 250, 250, 350), CMortgaged);
                break;
            case("KK"):
                spriteBatch_.Draw (imgs [7], new Rectangle (450, 250, 250, 350), CMortgaged);
                break;
            case("Bengts soffa"):
                spriteBatch_.Draw (imgs [8], new Rectangle (450, 250, 250, 350), CMortgaged);
                break;
            case("Valfarten"):
                spriteBatch_.Draw (imgs [9], new Rectangle (450, 250, 250, 350), CMortgaged);
                break;
            case("Skytte-C"):
                spriteBatch_.Draw (imgs [10], new Rectangle (450, 250, 250, 350), CMortgaged);
                break;
            case("Pressbyran"):
                spriteBatch_.Draw (imgs [11], new Rectangle (450, 250, 250, 350), CMortgaged);
                break;
            case("Zodiaken"):
                spriteBatch_.Draw (imgs [12], new Rectangle (450, 250, 250, 350), CMortgaged);
                break;
            case("Pastavagnen"):
                spriteBatch_.Draw (imgs [13], new Rectangle (450, 250, 250, 350), CMortgaged);
                break;
            case("Alten"):
                spriteBatch_.Draw (imgs [14], new Rectangle (450, 250, 250, 350), CMortgaged);
                break;
            case("Karallen"):
                spriteBatch_.Draw (imgs [15], new Rectangle (450, 250, 250, 350), CMortgaged);
                break;
            case("Hemkop"):
                spriteBatch_.Draw (imgs [16], new Rectangle (450, 250, 250, 350), CMortgaged);
                break;
            case("ISYtan"):
                spriteBatch_.Draw (imgs [17], new Rectangle (450, 250, 250, 350), CMortgaged);
                break;
            case("Johankens Place"):
                spriteBatch_.Draw (imgs [18], new Rectangle (450, 250, 250, 350), CMortgaged);
                break;
            case("Donken"):
                spriteBatch_.Draw (imgs [19], new Rectangle (450, 250, 250, 350), CMortgaged);
                break;
            case("CafeJava"):
                spriteBatch_.Draw (imgs [20], new Rectangle (450, 250, 250, 350), CMortgaged);
                break;
            case("Systembolaget"):
                spriteBatch_.Draw (imgs [21], new Rectangle (450, 250, 250, 350), CMortgaged);
                break;

            }
        }
Exemple #6
0
        public BoardPiece getsectionbysection(BoardPiece piece)
        {
            int pos = piece.position;
            int Xtemp = piece.X;
            int Ytemp = piece.Y;

            XElement xelement = getXELE();
            var data = from d in xelement.Elements("Section")
                    where (string)d.Element("position") == pos.ToString()
                select d;
            Player p = new Player (50,"-1",0,0,0,false,false,false,0);
            BoardPiece b = new BoardPiece (0, 0, "", p, 0, 0, 0, 0, 0, new int[]{ 0, 0, 0, 0, 0, 0 }, false, 0, 0);
            foreach (XElement d in data)
                b = new BoardPiece (Int32.Parse (d.Element ("ID").Value),
                    Int32.Parse (d.Element ("type").Value),
                    d.Element ("name").Value,
                    getplayerbyID(Int32.Parse (d.Element ("owner").Value)),
                    Int32.Parse (d.Element ("position").Value),
                    Int32.Parse (d.Element ("price").Value),
                    Int32.Parse (d.Element ("housenr").Value),
                    Int32.Parse (d.Element ("houseprice").Value),
                    Int32.Parse (d.Element ("income").Value),
                    new int[] {
                        Int32.Parse (d.Element("houseincome").Element ("h0").Value),
                        Int32.Parse (d.Element("houseincome").Element ("h1").Value),
                        Int32.Parse (d.Element("houseincome").Element ("h2").Value),
                        Int32.Parse (d.Element("houseincome").Element ("h3").Value),
                        Int32.Parse (d.Element("houseincome").Element ("h4").Value),
                        Int32.Parse (d.Element("houseincome").Element ("h5").Value)
                    },
                    Convert.ToBoolean (d.Element ("mortage").Value),
                    Int32.Parse (d.Element ("mortageprice").Value),
                    Int32.Parse (d.Element ("umortageprice").Value));
            b.Y = Ytemp;
            b.X = Xtemp;
            return b;
        }
Exemple #7
0
 //Decides if the player is AI or human
 public void run(Player player, BoardPiece piece)
 {
     if(player.isAI)
     {
         AI_.run (player, piece);
     }
     else
     {
         GUIStateHandler_.checkState (player, piece);
     }
 }
Exemple #8
0
 //Graphical position for every streetposition
 public void streetpositions(BoardPiece[] boardpieces)
 {
     for(int i=0; i <boardpieces.Length; i++)
     {
         boardpieces [i] = DB.getsectionbyPos (i);
         if (i < 11)
             boardpieces [i].Y = 690;//650
         else if (i < 21)
             boardpieces [i].X = 260;//286
         else if (i < 31)
             boardpieces [i].Y = 100;//110
         else
             boardpieces [i].X = 1030;//1000
     }
     boardpieces [0].X = boardpieces[30].X = 1030;//1000
     boardpieces [1].X = boardpieces[29].X = 930;//910;
     boardpieces [2].X = boardpieces[28].X = 850;//844;
     boardpieces [3].X = boardpieces[27].X = 780;//778;
     boardpieces [4].X = boardpieces[26].X = 710;//712;
     boardpieces [5].X = boardpieces[25].X = 640;//646;
     boardpieces [6].X = boardpieces[24].X = 570;//580;
     boardpieces [7].X = boardpieces[23].X = 500;//514;
     boardpieces [8].X = boardpieces[22].X = 420;//448;
     boardpieces [9].X = boardpieces[21].X = 350;//382;
     boardpieces[10].X = 260;//286;
     boardpieces [20].Y = 100;
     boardpieces [11].Y = boardpieces[39].Y = 610;//595;
     boardpieces [12].Y = boardpieces[38].Y = 560;//545;
     boardpieces [13].Y = boardpieces[37].Y = 500;//490;
     boardpieces [14].Y = boardpieces[36].Y = 454;//438;
     boardpieces [15].Y = boardpieces[35].Y = 395;//384;
     boardpieces [16].Y = boardpieces[34].Y = 337;//334;
     boardpieces [17].Y = boardpieces[33].Y = 288;//280;
     boardpieces [18].Y = boardpieces[32].Y = 230;//232;
     boardpieces [19].Y = boardpieces[31].Y = 175;//178;
 }
Exemple #9
0
 public void remove(BoardPiece piece)
 {
     streetlistval.Remove(piece);
 }
Exemple #10
0
 public void add(BoardPiece piece)
 {
     streetlistval.Add (piece);
 }