Example #1
0
        // Overriden to ensure continuous poping all the way back to the PickCharacter page
        protected override void OnAppearing()
        {
            base.OnAppearing();

            // Continue poping till the PickCharacter page is at the top
            if (BattleSystemViewModel.Instance.GetState() == "To Root")
            {
                Navigation.PopModalAsync();
            }

            // If the state is valid, meaing the user just returned from the character equip or item view pages
            else
            {
                BindingContext                = null;
                PartyListView.ItemsSource     = null;
                InventoryListView.ItemsSource = null;

                InitializeComponent();

                // Update the display
                _viewModel                    = new BattleRestViewModel("Battle Count: " + Battles);
                BindingContext                = _viewModel;
                PartyListView.ItemsSource     = PartyListCopy;
                InventoryListView.ItemsSource = DropListCopy;
            }
        }
Example #2
0
        private BattleRestViewModel _viewModel; // Displays a string that is the current number of battles

        // Constructor that requires the survivors list, items dropped list, updated score, and the current battle count.
        public BattleRest(List <Character> pList, List <Item> iList, Score score, int bCount)
        {
            // Initialize everything
            InitializeComponent();
            PartyListCopy = new List <Character>(pList);
            DropListCopy  = new List <Item>(iList);
            ScoreItem     = score;
            Battles       = bCount;

            // Initialize the display
            _viewModel                    = new BattleRestViewModel("Battle Count: " + bCount);
            BindingContext                = _viewModel;
            PartyListView.ItemsSource     = PartyListCopy;
            InventoryListView.ItemsSource = DropListCopy;
        }