/** * Shows the view by playing animations. */ void ShowWithAnimations() { var imageBehindIcon_tf = this.imageBehindIcon.GetComponent <RectTransform> (); Vector3[] corners = new Vector3[4]; imageBehindIcon_tf.GetLocalCorners(corners); var imageContainerSz = corners[2] - corners[0]; float diffx = 0f; if (this.clickedIconContainerTF != null) { this.clickedIconContainerTF.GetLocalCorners(corners); var clickedContainerSz = corners[2] - corners[0]; diffx = clickedContainerSz.x / (imageContainerSz.x > 0f ? imageContainerSz.x : 0.001f); //float diffy = clickedContainerSz.y / ( imageContainerSz.y > 0f ? imageContainerSz.y : 0.001f ); } this.backgroundImage.GetComponent <RectTransform>().localScale = Vector2.zero; //Vector3 tmp_pos = this.imageBehindIcon.transform.localPosition; this.backgroundImage.transform.position = imageBehindIcon_tf.position; this.textCaption.gameObject.SetActive(false); this.textDesc.gameObject.SetActive(false); this.textPrice.gameObject.SetActive(false); //Debug.Break(); this.buttonOkay.gameObject.SetActive(false); this.buttonCancel.gameObject.SetActive(false); UITween.StartAnimateValue(dialogBG, 0.0f, 1f, 0.5f, Tween.TweenTypes.Linear, () => { var c = dialogBG.color; c.a = 0.0f; dialogBG.color = c; }, ( float value) => { var c = dialogBG.color; c.a = value; dialogBG.color = c; }, () => { var c = dialogBG.color; c.a = 1f; dialogBG.color = c; }); UITween.startAlphaAnimation(this.imageBehindIcon, 0f, 1f, 0.05f, 0f, Tween.TweenTypes.easeInExpo, () => { }); UITween.startScaleAnimation(this.imageBehindIcon, diffx, 1f, 0.5f, 0f, Tween.TweenTypes.Linear); UITween.startScaleAnimation(this.backgroundImage, 0.0001f, 1f, 0.75f, 0.15f, Tween.TweenTypes.easeInExpo, () => { textCaption.gameObject.SetActive(true); UITween.startAlphaAnimation(textCaption, 0f, 1f, 0.5f, 0f, Tween.TweenTypes.easeInOutExpo); textDesc.gameObject.SetActive(true); UITween.startAlphaAnimation(textDesc, 0f, 1f, 0.5f, 0.2f, Tween.TweenTypes.easeInOutExpo); textPrice.gameObject.SetActive(true); UITween.startAlphaAnimation(textPrice, 0f, 1f, 0.5f, 0.4f, Tween.TweenTypes.easeInOutExpo); buttonOkay.gameObject.SetActive(true); UITween.startAlphaAnimation(buttonOkay.GetComponent <UnityEngine.UI.MobyShop.AdvImage>(), 0f, 1f, 0.5f, 0.6f, Tween.TweenTypes.easeInOutExpo); buttonCancel.gameObject.SetActive(true); UITween.startAlphaAnimation(buttonCancel.gameObject, 0f, 1f, 0.5f, 0.8f, Tween.TweenTypes.easeInOutExpo); }); UITween.StartAnimateValue(dialogBG, 0.0f, 0f, 0.32f, Tween.TweenTypes.Linear, () => { this.backgroundImage.gameObject.AddMissingComponent <CanvasGroup>().alpha = 0f; }, ( float value) => { this.backgroundImage.gameObject.AddMissingComponent <CanvasGroup>().alpha = 0f; }, () => { this.backgroundImage.gameObject.AddMissingComponent <CanvasGroup>().alpha = 1f; }); if (this.clickedIconContainerTF != null) { UITween.startBezierAnimation(this.imageBehindIcon, imageBehindIcon_tf, this.clickedIconContainerTF, iconPivot, 0.5f, () => { }, Tween.TweenTypes.easeOutExpo); } else { var img_tf = this.imageBehindIcon.GetComponent <RectTransform> (); UITween.startScaleAnimation(img_tf, 0f, 1f, 0.5f, Tween.TweenTypes.easeOutBounce, () => { }); } }