public OpponentMatchupNode(string pTitle, PlayerCharacterNode parent) { this.Title = pTitle; this.Parent = parent; Notes = ""; Wins = 0; Losses = 0; }
public ScrollView GetAddNewLayout(MenuItemType type, BaseMenuItem item = null) { var scrollView = new ScrollView(this); var layout = new LinearLayout(this); layout.Orientation = Orientation.Vertical; var aLabel = new TextView(this); aLabel.Text = string.Format("What is the name of the {0}?", type.ToString()); layout.AddView(aLabel); var textField = new EditText(this); layout.AddView(textField); var saveButton = new Button(this); saveButton.Text = "Create"; saveButton.Click += (sender, e) => { switch (type) { case MenuItemType.Game: menu.Games.Add(new GameNode(textField.Text)); UpdateMenu(); SetContentView(GetHomeLayout()); break; case MenuItemType.PlayerCharacter: var newCharacter = new PlayerCharacterNode(textField.Text, (GameNode)item); ((GameNode)item).Characters.Add(newCharacter); var gameItem = (GameNode)UpdateMenu(type, newCharacter); SetContentView(GetGameLayout(gameItem)); break; case MenuItemType.Opponent: var newOpponent = new OpponentMatchupNode(textField.Text, (PlayerCharacterNode)item); ((PlayerCharacterNode)item).Opponents.Add(newOpponent); var newItem = (PlayerCharacterNode)UpdateMenu(type, newOpponent); SetContentView(GetCharacterLayout(newItem)); break; default: break; } }; layout.AddView(saveButton); scrollView.AddView(layout); return scrollView; }
public ScrollView GetCharacterLayout(PlayerCharacterNode pCharacter) { var scrollView = new ScrollView(this); var layout = new LinearLayout(this); layout.Orientation = Orientation.Vertical; var aLabel = new TextView(this); aLabel.Text = pCharacter.Title; layout.AddView(aLabel); foreach (var opponent in pCharacter.Opponents) { var button = new Button(this); button.Text = opponent.Title; button.Click += (sender, e) => { SetContentView(GetOpponentLayout(opponent)); }; layout.AddView(button); } var createButton = new Button(this); createButton.Text = "Add new Opponent Matchup"; createButton.Click += (sender, e) => { SetContentView(GetAddNewLayout(MenuItemType.Opponent, pCharacter)); }; layout.AddView(createButton); var backButton = new Button(this); backButton.Text = "Back"; backButton.Click += (sender, e) => { SetContentView(GetGameLayout(pCharacter.Parent)); }; layout.AddView(backButton); scrollView.AddView(layout); return scrollView; }