protected override void AwakeInit() { //Debug.Log("StoryTeller.AwakeInit"); registrator.Add( new MessageRegistrationTuple { type = InstantMessageType.GUIWhiteCurtainFaded, handler = OnGUIWhiteCurtainFaded }, new MessageRegistrationTuple { type = InstantMessageType.GUIFullScreenButtonPressed, handler = OnGUIFullScreenButtonPressed } ); normalStoryImage = new StoryImage(normalImage); stressedStoryImage = new StoryImage(stressedImage); frameId = -1; }
void SetImageSize(StoryImage storyImage) { float xyRatio = GlobalManager.MLevel.GetDescriptor(storyMessages[frameId].pictureId).init.finalXYScale; float imageWidth = storyImage.originalRect.width; float imageHeight = storyImage.originalRect.height; float originalXYRatio = imageWidth / imageHeight; //Debug.Log("Original rect size: " + imageWidth.ToString() + " x " + imageHeight.ToString()); if (xyRatio < originalXYRatio) { imageWidth = imageHeight * xyRatio; } else { imageHeight = imageWidth / xyRatio; } //Debug.Log("Set " + storyImage.fader.gameObject.name + " size to " + imageWidth.ToString() + " x " + imageHeight.ToString() + " (" + xyRatio + ")"); storyImage.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, imageWidth); storyImage.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, imageHeight); //storyImage.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, storyImage.originalRect.width); //storyImage.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, storyImage.originalRect.height); }
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); }
public void Histoire() { StartImage.SetActive(false); StoryImage.SetActive(true); }