private void ShowMessage(string message) { trainerMessageText.text = message; AnimationOperation scaleOperation = new AnimationOperation(messagePanel, UIAnimationType.Scale, EaseType.SmoothStepSmoother, 0, 1f) { scaleSettings = new AnimationOperation.ScaleSettings { startScale = Vector3.zero, targetScale = Vector3.one } }; AnimationOperation fadeOperation = new AnimationOperation(messagePanel, UIAnimationType.Fade, EaseType.SmoothStepSmoother, 0, 1f) { fadeSettings = new AnimationOperation.FadeSettings { startAlpha = 0, targetAlpha = 1 } }; AnimationOperation flipOperation = new AnimationOperation(messagePanel, UIAnimationType.Rotate, EaseType.SmoothStepSmoother, 0, 0.5f) { rotateSettings = new AnimationOperation.RotateSettings { startEuler = Vector3.zero, targetEuler = new Vector3(90, 0, 0) } }; AnimationSequence showMessageAnimation = new AnimationSequence(e => StartCoroutine(e)); showMessageAnimation.AddOperation(scaleOperation, fadeOperation, new AnimationOperation { targetObject = messagePanel, type = UIAnimationType.Activate, activate = true }); showMessageAnimation.AddDelay(2f); showMessageAnimation.AddOperation(new AnimationOperation(fadeOperation.Reversed()) { duration = 0.5f }, flipOperation, new AnimationOperation { targetObject = messagePanel, type = UIAnimationType.Activate, activate = false, delay = 0.5f }, new AnimationOperation { targetObject = messagePanel, type = UIAnimationType.Rotate, rotateSettings = new AnimationOperation.RotateSettings { targetEuler = Vector3.zero }, delay = 0.5f }); showMessageAnimation.Play(); }
private void ShowResults(TrainingProgramData programData) { sessionNameText.text = $"{programData.programName} - Results"; int programTotalScore = programData.GetTotalScore(); int programMaximumScore = programData.GetMaximumScore(); totalScoreText.text = $"{programTotalScore}/{programMaximumScore}"; float ratingValue = (float)programTotalScore / programMaximumScore * 100f; float f = 100f / ratingScaleImageNumber; float colourDuration = (float)ratingScaleImages.Count / (ratingScaleImages.Count * ratingScaleImages.Count); float delay = colourDuration * 1.5f; AnimationSequence ratingAnimation = new AnimationSequence(applicationEventRelay.RequestStartingCoroutine); ratingAnimation.AddDelay(1f); spinningAnimations.Clear(); AnimationOperation spinningOperation1 = new AnimationOperation(null, UIAnimationType.Rotate, EaseType.Linear, 0, 4f) { rotateSettings = new AnimationOperation.RotateSettings { startEuler = new Vector3(0, 0, 0), targetEuler = new Vector3(0, 0, 180) } }; AnimationOperation spinningOperation2 = new AnimationOperation(null, UIAnimationType.Rotate, EaseType.Linear, 3.95f, 4f) { rotateSettings = new AnimationOperation.RotateSettings { startEuler = new Vector3(0, 0, 180), targetEuler = new Vector3(0, 0, 360) } }; for (int i = 0; i < ratingScaleImages.Count; i++) { if (i * f >= ratingValue) { break; } AnimationOperation colourOperation = new AnimationOperation(ratingScaleImages[i].gameObject, UIAnimationType.Colour, EaseType.CubicIn, delay, colourDuration) { colourSettings = new AnimationOperation.ColourSettings { startColour = ratingScaleImages[i].color, targetColour = Color.white } }; ratingAnimation.AddOperation(colourOperation); AnimationSequence spinningAnim = new AnimationSequence(applicationEventRelay.RequestStartingCoroutine); spinningAnim.AddOperation( new AnimationOperation(spinningOperation1) { targetObject = ratingScaleImages[i].gameObject }, new AnimationOperation(spinningOperation2) { targetObject = ratingScaleImages[i].gameObject }); spinningAnim.Loop(); spinningAnimations.Add(spinningAnim); } foreach (TrainingSessionData session in programData.trainingSessions) { GameObject sessionResultRow = Instantiate(sessionResultRowPrefab, sessionScrollRect.content); if (!sessionResultRow.TryGetComponent(out SessionResultRow sessionResult)) { continue; } sessionResult.Setup(session.sessionName, $"{session.Score}/{session.MaximumScore}", null); // TODO hook session row buttons to show respective session results => set action } ShowWindow(true, true); ratingAnimation.Play(); foreach (AnimationSequence animationSequence in spinningAnimations) { animationSequence.Play(); } }