public GameUpgrade(string name, int level, GameData myGame, int index) { Name = name; Level = level; MyGame = myGame; Index = index; }
public TutorialScreen(GameData game) : base() { this.game = game; // Allow the user to tap EnabledGestures = GestureType.Tap; }
private void GenerateUpgradeStore(GameData gd) { gameSelected = true; ClearItem(); itemView.RemoveAllElements(); // remove any elements from the last category itemViewLabel.Text = gd.Name + " Upgrades"; int startY = leftYTop + 150; // generate the store items and buttons for the game upgrades foreach (GameUpgrade gu in gd.GameUpgrades) { GameUpgradeStoreItem gusi = new GameUpgradeStoreItem(gu); Button upgrade = new LongButton(gu.Name); upgrade.Position = new Vector2(leftXMiddle, startY); upgrade.TappedArgs.ObjectArg = gusi; upgrade.Tapped += StoreItem_Tapped; Label level = new Label("Level: " + gu.Level + "/5", new Vector2(leftXMiddle, startY + 115)); startY += 275; itemView.AddElement(upgrade, level); } }
// Method callback when we press on a game icon button to vote for void selectGame(object sender, UIElementTappedArgs e) { if (voted) { // already pressed the vote button. dont do anything return; } // go through the list and unhighlight any previous selected buttons foreach (Button b in buttons) { b.Highlight = false; } ((Button)e.Element).Highlight = true; // highlight the button we pressed selectedGame = (GameData)e.ObjectArg; // our selected game is the button we pressed voteButton.Disabled = false; // enable the vote button for people to vote }
// Method callback when we press on a game icon button to vote for void SelectGame(object sender, UIElementTappedArgs e) { if (selectedButton != null) { selectedButton.Highlight = false; } selectedButton = (Button)e.Element; selectedButton.Highlight = true; // highlight the button we pressed selectedGame = (GameData)e.ObjectArg; // our selected game is the button we pressed gameName.Text = selectedGame.Name; // Get high score data if(!PermanentStorage.Get(selectedGame.ServerName + "_score", out highScore.Text)) { highScore.Text = "0"; } // Show proper star rating for(int i = 0; i < 5; i++) { if(selectedGame.StarMap[i] < int.Parse(highScore.Text)) { stars[i].TextureIndex = 1; } else { stars[i].TextureIndex = 0; } } }