예제 #1
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;
        }
예제 #2
0
        public ScrollView GetOpponentLayout(OpponentMatchupNode pOpponent)
        {
            var scrollView = new ScrollView(this);
            var layout = new LinearLayout(this);
            layout.Orientation = Orientation.Vertical;

            var aLabel = new TextView(this);
            aLabel.Text = pOpponent.Parent.Title + " VS " + pOpponent.Title;

            layout.AddView(aLabel);

            var winButton = new Button(this);
            winButton.Text = "Wins: " + pOpponent.Wins;
            winButton.Click += (sender, e) =>
            {
                pOpponent.Wins++;
                UpdateMenu();
                SetContentView(GetOpponentLayout(pOpponent));
            };
            layout.AddView(winButton);

            var lossButton = new Button(this);
            lossButton.Text = "Losses: " + pOpponent.Losses;
            lossButton.Click += (sender, e) =>
            {
                pOpponent.Losses++;
                UpdateMenu();
                SetContentView(GetOpponentLayout(pOpponent));
            };
            layout.AddView(lossButton);

            var notesLabel = new TextView(this);
            notesLabel.Text = pOpponent.Notes;
            layout.AddView(notesLabel);

            var editButton = new Button(this);
            editButton.Text = "Edit";
            editButton.Click += (sender, e) =>
            {
                SetContentView(GetEditLayout(pOpponent));
            };
            layout.AddView(editButton);

            var backButton = new Button(this);
            backButton.Text = "Back";
            backButton.Click += (sender, e) =>
            {
                SetContentView(GetCharacterLayout(pOpponent.Parent));
            };
            layout.AddView(backButton);
            scrollView.AddView(layout);

            return scrollView;
        }
예제 #3
0
        public ScrollView GetEditLayout(OpponentMatchupNode item)
        {
            var scrollView = new ScrollView(this);
            var layout = new LinearLayout(this);
            layout.Orientation = Orientation.Vertical;

            var aLabel = new TextView(this);
            aLabel.Text = string.Format("{0} VS {1} Notes:", item.Parent.Title, item.Title);
            layout.AddView(aLabel);

            var textField = new EditText(this);
            textField.Text = item.Notes;
            layout.AddView(textField);

            var saveButton = new Button(this);
            saveButton.Text = "Save";
            saveButton.Click += (sender, e) =>
            {
                item.Notes = textField.Text;
                UpdateMenu();
                SetContentView(GetOpponentLayout(item));
            };
            layout.AddView(saveButton);
            scrollView.AddView(layout);

            return scrollView;
        }