/// <summary> /// 刷新数据 /// </summary> public async void Update() { IsLoading = true; StartImage s = await _api.GetStartImage(); await Task.Delay(1000); if (s != null) { SplashImage = s.ImageURL; string image_text = (s.ImageText == null || s.ImageText.Equals("")) ? "好像是广告" : s.ImageText; SplashText = "by " + image_text; } IsLoading = false; }
/// <summary> /// Rescales the start/end image from the originals to the keep performance at preview-time high. /// Then recreates the output image with appropriate size corresponding to scaled StartImage and EndImage /// </summary> private void AdaptInputOutputImages() { if (_originalStartImage == null || _originalEndImage == null) { return; } StartImage.Source = _originalStartImage; StartImage.UpdateLayout(); StartImage.Source = ImageUtilities.CreateResizedImage(_originalStartImage, (int)(StartImage.ActualWidth), (int)(StartImage.ActualHeight)); EndImage.Source = _originalEndImage; EndImage.UpdateLayout(); EndImage.Source = ImageUtilities.CreateResizedImage(_originalEndImage, (int)(EndImage.ActualWidth), (int)(EndImage.ActualHeight)); // create output image int width = (int)Math.Max(StartImage.ActualWidth, EndImage.ActualWidth); int height = (int)Math.Max(StartImage.ActualHeight, EndImage.ActualHeight); OutputImage.Source = new WriteableBitmap(width, height, 0.0f, 0.0f, PixelFormats.Bgra32, null); OutputImage.UpdateLayout(); StartImage.UpdateLayout(); EndImage.UpdateLayout(); // setup for morphing _morphingAlgorithm.SetStartImage(StartImage.Source as BitmapSource); _morphingAlgorithm.SetEndImage(EndImage.Source as BitmapSource); // upate output if (!_animationPlayer.IsEnabled) { UpdateOutputImageContent(); } // update marker view UpdateMarkerCanvases(); }
/// <summary> /// Update HUD according to argGameState-Properties. /// </summary> /// <param name="argGameState"></param> public void Update(GameState argGameState) { //set current lap Lap.text = "Lap " + argGameState.Lap.ToString() + "/3"; //start countdown when game starts if (argGameState.State == GameStatus.STARTING) { //get the Script from the actual ImageObject StartScript s = StartImage.GetComponent <StartScript>(); s.Run = true; } //show currently held item, if there is one if (argGameState.Item == Item.NONE) { ItemImage.enabled = false; } else { ItemImage.texture = ItemTextures[argGameState.Item]; ItemImage.enabled = true; } //show current status, if there is one if (argGameState.Status1 == Status.NORMAL) { StatusImage1.enabled = false; } else { //only play animation if it's a new status if (StatusImage1.texture != StatusTextures[argGameState.Status1] || !StatusImage1.enabled) { StatusImage1.texture = StatusTextures[argGameState.Status1]; StatusImage1.enabled = true; //start animation always at pulse StatusImage1Controller.Play("Pulse", -1, 0f); } } if (argGameState.Status2 == Status.NORMAL) { StatusImage2.enabled = false; } else { //only play animation if it's a new status if (StatusImage2.texture != StatusTextures[argGameState.Status2] || !StatusImage1.enabled) { StatusImage2.texture = StatusTextures[argGameState.Status2]; StatusImage2.enabled = true; //start animation StatusImage2Controller.Play("Pulse", -1, 0f); } } //enables/disables blinking warning triangle InTrackImage.enabled = !argGameState.InTrack; //sets the players position PositionImage.texture = PositionTextures[argGameState.Position]; //shows Winner/Loser when the race is over for the respective player if (argGameState.State == GameStatus.FINISHED) { ResultImage.enabled = true; ResultImage.texture = ResultTextures[argGameState.Position]; } else { ResultImage.enabled = false; } }
public void Histoire() { StartImage.SetActive(false); StoryImage.SetActive(true); }