public string CheckButtons() { try { foreach (var button in playerButtons) { if (button.ButtonClicked()) { exceptionLabel.Text = ""; shop.SelectedPlayer = party.Players.Find(x => x.Name == button.Text); } } foreach (var button in placeButtons) { if (button.ButtonClicked()) { exceptionLabel.Text = ""; shop.GenerateOffer(button.Text); offerLabel.Text = "Offer:\r\n" + shop.Offer.ToString(1); currentLabel.Text = "Currently wearing:\r\n" + shop.SelectedPlayer.Items[placeButtons.IndexOf(button) + 2]; } } if (okButton.ButtonClicked()) { party = shop.PurcasheItem(); var converter = new PlayerConverter(); var dalParty = converter.GameToDAO(party); shop.SaveChanges(dalParty); moneyLabel.Text = party.Money.ToString(); return("reload"); } if (menuButton.ButtonClicked()) { return("MainMenu"); } return("Shop"); } catch (Exception ex) { exceptionLabel.Text = ex.Message; return("Shop"); } }
public Shop(CharacterClassLibrary.Party party, DAL.DAO dao, Texture2D backGround, Texture2D buttonTexture, SpriteFont font) { this.backGround = backGround; this.party = party; shop = new ShopClassLibrary.Shop(party, dao); offerLabel = new Label("offerLabel", font, "", 440, 40, 300, 300); exceptionLabel = new Label("exceptionLabel", font, "", 320, 240, 400, 30); moneyLabel = new Label("moneyLabel", font, "Your money: " + shop.Party.Money, 20, 350, 150, 30); currentLabel = new Label("currentLabel", font, "", 200, 40, 300, 300); okButton = new Button(buttonTexture, 700, 340, "Go for it!", 80, 30); menuButton = new Button(buttonTexture, 700, 400, "Menu", 80, 30); player1Button = new Button(buttonTexture, 20, 50, party.Players[0].Name, 100, 30); player2Button = new Button(buttonTexture, 20, 130, party.Players[1].Name, 100, 30); player3Button = new Button(buttonTexture, 20, 210, party.Players[2].Name, 100, 30); player4Button = new Button(buttonTexture, 20, 290, party.Players[3].Name, 100, 30); helmetButton = new Button(buttonTexture, 20, 400, "Helmet", 60, 30); chestButton = new Button(buttonTexture, 100, 400, "Chest", 60, 30); handButton = new Button(buttonTexture, 180, 400, "Hands", 60, 30); legButton = new Button(buttonTexture, 260, 400, "Legs", 60, 30); feetButton = new Button(buttonTexture, 340, 400, "Feet", 60, 30); allButtons = new List <Button>() { okButton, menuButton, player1Button, player2Button, player3Button, player4Button, helmetButton, chestButton, handButton, legButton, feetButton }; playerButtons = new List <Button>() { player1Button, player2Button, player3Button, player4Button }; placeButtons = new List <Button>() { helmetButton, chestButton, handButton, legButton, feetButton }; }
public NewParty(Texture2D backGround, Texture2D buttonTexture, SpriteFont font) { selectedParty = 1; selectedClass = 0; dao = new DAL.DAO(selectedParty); dao.Read(); this.backGround = backGround; protectorButton = new Button(buttonTexture, 30, 30, "Protector", 100, 40); templarButton = new Button(buttonTexture, 30, 80, "Templar", 100, 40); warriorButton = new Button(buttonTexture, 30, 130, "Warrior", 100, 40); mageButton = new Button(buttonTexture, 30, 180, "Mage", 100, 40); shamanButton = new Button(buttonTexture, 30, 230, "Shaman", 100, 40); rogueButton = new Button(buttonTexture, 30, 280, "Rogue", 100, 40); bloodButton = new Button(buttonTexture, 30, 330, "Blood Priest", 100, 40); fairyButton = new Button(buttonTexture, 30, 380, "Fairy", 100, 40); p1Button = new Button(buttonTexture, 300, 15, "Party 1", 100, 40); p2Button = new Button(buttonTexture, 420, 15, "Party 2", 100, 40); p3Button = new Button(buttonTexture, 540, 15, "Party 3", 100, 40); p4Button = new Button(buttonTexture, 660, 15, "Party 4", 100, 40); cancelButton = new Button(buttonTexture, 680, 250, "Clear", 100, 40); okButton = new Button(buttonTexture, 680, 300, "Next", 100, 40); finishButton = new Button(buttonTexture, 680, 350, "Done", 100, 40); menuButton = new Button(buttonTexture, 680, 400, "Main Menu", 100, 40); allButtons = new List <Button>() { protectorButton, templarButton, warriorButton, mageButton, shamanButton, rogueButton, bloodButton, fairyButton, p1Button, p2Button, p3Button, p4Button, cancelButton, okButton, finishButton, menuButton }; partyLabel = new Label("party", font, "", 200, 130, 400, 200); infoLabel = new Label("info", font, "Enter name: ", 200, 400, 100, 50); nameBox = new TextBox(font, 290, 400, 150, 50); party = new CharacterClassLibrary.Party(); }