public Decorator(UserInterfaceElement element) : base(element.Game) { this.element = element; this.element.ShowItemHandler += this.OnShow; this.element.HideItemHandler += this.OnHide; }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { this.gameFont = this.Content.Load<SpriteFont>("Arial"); this.waterMapTexture = this.Content.Load<Texture2D>("waterMap"); this.watermapRect = new Rectangle(0, 0, GlobalConstants.WINDOW_WIDTH, GlobalConstants.WINDOW_HEIGHT); this.continent1 = new Continent(this.Content,"con1",500,100,250,250); this.continent2 = new Continent(this.Content, "con2", 40, 40, 300, 300); this.continent3 = new Continent(this.Content, "con3", 40, 300, 300, 300); this.playerShip = new PlayerShip(this.Content, "pirate_ship", GlobalConstants.WINDOW_WIDTH / 2, GlobalConstants.WINDOW_HEIGHT / 2); this.npcs = new List<NpcShip> { new NpcShip(this.Content,"pirate_ship_npc1",300,200,new Vector2(500,100)), new NpcShip(this.Content,"pirate_ship_npc1",500,300), new NpcShip(this.Content,"pirate_ship_npc1",400,400,new Vector2(240,520)), new NpcShip(this.Content,"big_ship",570,490,100,100) }; // add fishing village this.fishingVillage1 = new FishingVillage(2, 200, 10, 10000, 150, 1000, 30, Coutries.Tanzania, this.Content, "fishing_village", 500, 100, 100, 100); // add trade center this.tradeCenter1 = new TradeCenter(5000, 50, 100000, 800, 6000, 50, Coutries.Yemen, this.Content, "trade_center", 100, 470, 128, 128); // add military settlement this.militaryPort1 = new MilitaryPort(0, 200, 150, 500, 800, 300, Coutries.Yemen, this.Content, "military_settlement", 180, 310, 128, 128); this.continents = new List<PirateGame.Interfaces.IDrawableCustom> { this.continent1, this.continent2, this.continent3, }; this.shipMessages = new List<string> { string.Format("Hull:{0}", this.playerShip.Hull), string.Format("Weapons:{0}", this.playerShip.Weapons), string.Format("Hit Points:{0}", this.playerShip.Hitpoints), string.Format("Damage:{0}", this.playerShip.Damage) }; this.fishingMessages = new List<string> { "Fishing Village", string.Format("Population:{0}", this.fishingVillage1.Population), string.Format("Wealth:{0}", this.fishingVillage1.Wealth), string.Format("Defense Power:{0}", this.fishingVillage1.DefencePower) }; this.tradeMessages = new List<string> { "Trade Center", string.Format("Population:{0}", this.tradeCenter1.Population), string.Format("Wealth:{0}", this.tradeCenter1.Wealth), string.Format("Defense Power:{0}", this.tradeCenter1.DefencePower) }; this.militaryMessages = new List<string> { "Military Port", string.Format("Population:{0}", this.militaryPort1.Population), string.Format("Wealth:{0}", this.militaryPort1.Wealth), string.Format("Defense Power:{0}", this.militaryPort1.DefencePower) }; this.shipPopup = new Popup(this.Content, "popup_background", "Arial", this.shipMessages, this.playerShip); this.fishingPopup = new Popup(this.Content, "popup_background", "Arial", this.fishingMessages, this.fishingVillage1); this.tradePopup = new Popup(this.Content, "popup_background", "Arial", this.tradeMessages, this.tradeCenter1); this.militaryPopup = new Popup(this.Content, "popup_background", "Arial", this.militaryMessages, this.militaryPort1); this.UIFrameTexture = this.Content.Load<Texture2D>("InventoryHighlight.png"); Menu main = new Menu(this, "Pirate Menu", menus.OnOpen, menus.OnClose); main.Initialize(); main.LoadContent(); main.Items.Add(new SelectableItem<string>("Play", this.OnPlay)); main.Items.Add(new SelectableItem<string>("Test Inventory", this.OnInventoryTest)); main.Items.Add(new SelectableItem<string>("Test Health Bar", this.OnHealthBarTest)); main.Items.Add(new SelectableItem<string>("Quit", this.OnExit)); this.mainMenu = new Frame(main, this.UIFrameTexture, Color.Gray); this.UIElements.Add(this.mainMenu); }
public Frame(UserInterfaceElement element, Texture2D frameTexture, Color frameColor) : base(element) { this.FrameTexture = frameTexture; this.FrameColor = frameColor; }