public void Draw(Game1 game, SpriteBatch spriteBatch, SpaceShip myShip) { ship = myShip; int k = 0; for (int x = 0; x < NumberofTilesWidth; x++) { spriteBatch.Draw(tiles.ElementAt(k).getTexture(), new Rectangle(50 + (x * Tile.TileWidth), 50 + (0 * Tile.TileHeight), Tile.TileWidth, Tile.TileHeight), Color.White); k++; } for (int y = 1; y < NumberofTilesHeight; y++) { spriteBatch.Draw(tiles.ElementAt(k).getTexture(), new Rectangle(50 + (10 * Tile.TileWidth), 50 + (y * Tile.TileHeight), Tile.TileWidth, Tile.TileHeight), Color.White); k++; } for (int x = 9; x >= 0; x--) { spriteBatch.Draw(tiles.ElementAt(k).getTexture(), new Rectangle(50 + (x * Tile.TileWidth), 50 + (10 * Tile.TileHeight), Tile.TileWidth, Tile.TileHeight), Color.White); k++; } for (int y = 9; y > 0; y--) { spriteBatch.Draw(tiles.ElementAt(k).getTexture(), new Rectangle(50 + (0 * Tile.TileWidth), 50 + (y * Tile.TileHeight), Tile.TileWidth, Tile.TileHeight), Color.White); k++; } string ourLocation = "We are at " + tiles.ElementAt(boardLocationToListLocation(ship.getShipLocation())).getPlanet().getName(); Vector2 FontOrigin = font1.MeasureString(ourLocation) / 2; fontPosition = new Vector2(230, 125); spriteBatch.DrawString(font1, ourLocation, fontPosition, Color.White, 0, FontOrigin, 1.0f, SpriteEffects.None, 0.5f); List <Resource> resource = new List <Resource>(); resource = tiles.ElementAt(boardLocationToListLocation(ship.getShipLocation())).getPlanet().getResourceList(); int l = 0; for (int i = 0; i < resource.Count; i++) { string myResource = "Available Resources: " + resource[i].amount + " , " + resource[i].name + " for " + resource[i].getPrice() + " each!"; fontPosition = new Vector2(230, 150 + l); spriteBatch.DrawString(font1, myResource, fontPosition, Color.Red, 0, FontOrigin, 1.0f, SpriteEffects.None, 0.5f); l = l + 25; } /* * foreach (List<Resource> m in resource) * { * string myResource = "Available Resources: "+ m.Value+" " + m.Key.getName() + " for " + m.Key.getPrice()+" each"; * fontPosition = new Vector2(230, 150 + l); * spriteBatch.DrawString(font1, myResource, fontPosition, Color.Red, 0, FontOrigin, 1.0f, SpriteEffects.None, 0.5f); * l = l + 25; * } */ //printDiceRolled = "Move remaining is: " + diceRemaining.ToString(); //fontPosition = new Vector2(100, 35); //spriteBatch.DrawString(font1, printDiceRolled, fontPosition, Color.Red, 0, FontOrigin, 1.0f, SpriteEffects.None, 0.5f); }
/// <summary> /// this will go through the different tiles and then sellect the different planets then each planets resources and update their entry on the database /// </summary> public void saveSession(List <Tile> board, SpaceShip ship) { Console.WriteLine("Save Session"); List <Tile> gameBoard = board; // Saveing planet resource information for (int i = 0; i < gameBoard.Count; i++) { Planet p = gameBoard[i].getPlanet(); List <Resource> resource = new List <Resource>(); resource = p.getResourceList(); for (int r = 0; r < resource.Count; r++) { dbs.PlanetResourceUpdate(p.planetid, resource[r].resourceid, resource[r].amount, resource[r].price); } } //Adds all the resources to the ship List <Resource> shipres = ship.getResource(); for (int i = 0; i < shipres.Count; i++) { dbs.AddResourceToShip(ship.getShipId(), shipres[i].resourceid, shipres[i].amount, shipres[i].InitialPrice); } // updates all the ship spec dbs.ShipAdd(ship.getShipId(), 0, 100, ship.getCargoCapacity(), ship.getNumberOfTurn()); // adds the user's money to the high score dbs.SetHightscore(ship.getOwner(), ship.getMoney()); // saveing the spaceship and user information // // /// Need to add the space ship section here, but need to change the spaceship class to do this. // // }