Пример #1
0
        public GamePage BindData()
        {
            App.SlowWriter.Target = StoryBlock;
            /* LOCATION NAME */
            Binding BindingName = new Binding("CurrentLocationName")
            {
                Source = App.LocationViewModel
            };

            StoryHeader.SetBinding(ContentControl.ContentProperty, BindingName);

            /* LOCATION IMAGE */
            Binding BindingImage = new Binding("CurrentLocationImage")
            {
                Source = App.LocationViewModel
            };

            StoryImage.SetBinding(Image.SourceProperty, BindingImage);

            /* LOCATION FILTER */
            Binding BindingSliderFilter = new Binding("BackgroundOptionsIntTransparent")
            {
                Source = App.PlayerViewModel.Player
            };

            FilterSlider.SetBinding(Slider.ValueProperty, BindingSliderFilter);
            Binding BindingSliderColor = new Binding("BackgroundOptionsIntBlue")
            {
                Source = App.PlayerViewModel.Player
            };

            ColorSlider.SetBinding(Slider.ValueProperty, BindingSliderColor);

            /* PLAYER'S HEALTH BAR */
            Binding BindingHealth = new Binding("HealthBarValue")
            {
                Source = App.PlayerViewModel
            };                                                                                      // value bind
            Binding BindingBarsWidth = new Binding("HealthThirstHungerBarWidth")
            {
                Source = App.PlayerViewModel
            };                                                                                                     // bar width bind
            Binding BindingHealthText = new Binding("HealthBarString")
            {
                Source = App.PlayerViewModel
            };                                                                             // text value bind

            HealthBar.SetBinding(ProgressBar.ValueProperty, BindingHealth);                // value bind
            HealthBar.SetBinding(ProgressBar.WidthProperty, BindingBarsWidth);             // bar width bind - same for health, thirst and hunger
            HealthBarString.SetBinding(ContentControl.ContentProperty, BindingHealthText); // text value bind

            /* PLAYER'S ENERGY BAR */
            Binding BindingEnergy = new Binding("EnergyBarValue")
            {
                Source = App.PlayerViewModel
            };                                                                                      // value bind
            Binding BindingEneryWidth = new Binding("EnergyBarWidth")
            {
                Source = App.PlayerViewModel
            };                                                                                           // bar width bind
            Binding BindingEnergyText = new Binding("EnergyBarString")
            {
                Source = App.PlayerViewModel
            };                                                                             // text value bind

            EnergyBar.SetBinding(ProgressBar.ValueProperty, BindingEnergy);                // value bind
            EnergyBar.SetBinding(ProgressBar.WidthProperty, BindingEneryWidth);            // bar width bind
            EnergyBarString.SetBinding(ContentControl.ContentProperty, BindingEnergyText); // text value bind

            /* PLAYER'S HUNGER BAR */
            Binding BindingHunger = new Binding("HungerBarValue")
            {
                Source = App.PlayerViewModel
            };                                                                                      // value bind
            Binding BindingHungerText = new Binding("HungerBarString")
            {
                Source = App.PlayerViewModel
            };                                                                             // text value bind

            HungerBar.SetBinding(ProgressBar.ValueProperty, BindingHunger);                // value bind
            HungerBar.SetBinding(ProgressBar.WidthProperty, BindingBarsWidth);             // bar width bind - same for health, thirst and hunger
            HungerBarString.SetBinding(ContentControl.ContentProperty, BindingHungerText); // text value bind

            /* PLAYER'S THIRST BAR */
            Binding BindingThirst = new Binding("ThirstBarValue")
            {
                Source = App.PlayerViewModel
            };                                                                                      // value bind
            Binding BindingThirstText = new Binding("ThirstBarString")
            {
                Source = App.PlayerViewModel
            };                                                                             // text value bind

            ThirstBar.SetBinding(ProgressBar.ValueProperty, BindingThirst);                // value bind
            ThirstBar.SetBinding(ProgressBar.WidthProperty, BindingBarsWidth);             // bar width bind - same for health, thirst and hunger
            ThirstBarString.SetBinding(ContentControl.ContentProperty, BindingThirstText); // text value bind

            /* CHECK ALIVE */
            timer.Interval = new TimeSpan(0, 0, 0, 0, 333);
            timer.Tick    += (sender, args) => { CheckAlive(); };
            timer.Start();
            return(this);
        }