public virtual void EndTween() { TweenManager.EndTween(_tweenId); }
public override void AnimateHide(Action callback) { base.AnimateHide(callback); TweenManager.TweenVector2(v2 => m_Dialog.rectTransform.anchoredPosition = v2, m_Dialog.rectTransform.anchoredPosition, GetSlidePosition(m_SlideOutDirection), m_AnimationDuration, 0, callback, false, m_SlideOutTweenType); }
protected override void Awake() { TweenManager.ForceInitialize(); base.Awake(); }
public override void Tween(BaseStyleElement p_sender, bool p_canAnimate, float p_animationDuration) { TweenManager.EndTween(_tweenId); }
public virtual void TabItemPointerDown(int id) { TweenManager.EndTween(m_TabsContainerTweener); }
void OnEnable() { m_TweenManager = (TweenManager)serializedObject.targetObject; }
private void CancelActivelineTweeners() { TweenManager.EndTween(m_ActiveLineSizeTweener); TweenManager.EndTween(m_ActiveLinePosTweener); TweenManager.EndTween(m_ActiveLineAlphaTweener); }
public void Hide() { m_Shadow = m_PanelShadowCanvasGroup != null; if (m_FinalExpandMode != ExpandMode.Rectangular) { m_MaskRect = rippleMask; m_MaskRect.SetParentAndScale(m_PanelRootRectTransform.parent, Vector3.one); RippleData rippleData = new RippleData { RippleParent = m_MaskRect, Shadow = m_RippleHasShadow }; m_Ripple = RippleManager.instance.GetRipple(); m_Ripple.Setup(rippleData, m_MaskRect.position, null); m_Ripple.rectTransform.localScale = Vector3.one; m_Ripple.rectTransform.sizeDelta = m_BaseRectTransform.sizeDelta; m_Ripple.color = Color.white; m_Ripple.canvasGroup.alpha = 1f; m_Ripple.SubmitSizeForSoftening(); m_CircleExpandedSize = Mathf.Sqrt(Mathf.Pow(Tween.QuintOut(0f, m_ExpandedSize.x, 1f, 0.5f), 2) + Mathf.Pow(Tween.QuintOut(0f, m_ExpandedSize.y, 1f, 0.5f), 2)); } if (m_FinalExpandMode != ExpandMode.Radial) { m_WidthDuration = 1f; m_HeightDuration = 1f; if (m_ExpandedSize.x > m_ExpandedSize.y) { m_HeightDuration = (2 * (m_ExpandedSize.y / m_ExpandedSize.x) + 1f) / 3f; } else if (m_ExpandedSize.x < m_ExpandedSize.y) { m_WidthDuration = (2 * (m_ExpandedSize.x / m_ExpandedSize.y) + 1f) / 3f; } } if (m_FinalExpandMode == ExpandMode.Radial) { m_PanelRootRectTransform.SetPositionRegardlessOfPivot(expandedPosition); m_PanelRootRectTransform.sizeDelta = expandedSize; TweenManager.TweenFloat(f => { m_MaskRect.sizeDelta = m_PanelRootRectTransform.sizeDelta; m_MaskRect.position = m_PanelRootRectTransform.GetPositionRegardlessOfPivot(); m_Ripple.rectTransform.sizeDelta = Tween.QuintSoftOut(new Vector2(m_CircleExpandedSize, m_CircleExpandedSize), m_BaseRectTransform.sizeDelta, f, 1f); m_Ripple.rectTransform.position = Tween.QuintSoftOut(m_PanelRootRectTransform.GetPositionRegardlessOfPivot(), m_BaseRectTransform.GetPositionRegardlessOfPivot(), f, 1f); m_Ripple.SubmitSizeForSoftening(); if (m_Shadow) { m_PanelShadowCanvasGroup.alpha = Tween.QuintOut(1f, 0f, f, 0.5f); } m_PanelContentCanvasGroup.alpha = Tween.QuintOut(1f, 0f, f, 0.5f); m_Ripple.color = m_Ripple.color.WithAlpha(Tween.QuintSoftOut(1f, 0f, f - 0.8f, 0.2f)); }, 0f, 1f, m_AnimationDuration, tweenType: Tween.TweenType.Linear); TweenManager.TimedCallback(m_AnimationDuration, m_Ripple.InstantContract); TweenManager.TimedCallback(m_AnimationDuration * 0.5f, () => m_BaseRectTransform.gameObject.SetActive(true)); } else if (m_FinalExpandMode == ExpandMode.Rectangular) { TweenManager.TweenFloat(f => { if (m_ExpandedPosition.y > m_BaseRectTransform.position.y) { m_PanelRootRectTransform.sizeDelta = new Vector2( Tween.QuintInOut(expandedSize.x, m_BaseRectTransform.sizeDelta.x, f, m_WidthDuration), Tween.QuintSoftOut(expandedSize.y, m_BaseRectTransform.sizeDelta.y, f, m_HeightDuration)); m_PanelRootRectTransform.SetPositionRegardlessOfPivot(new Vector2( Tween.QuintInOut(expandedPosition.x, m_BaseRectTransform.GetPositionRegardlessOfPivot().x, f, m_WidthDuration), Tween.QuintSoftOut(expandedPosition.y, m_BaseRectTransform.GetPositionRegardlessOfPivot().y, f, m_HeightDuration))); } else { m_PanelRootRectTransform.sizeDelta = new Vector2( Tween.QuintSoftOut(expandedSize.x, m_BaseRectTransform.sizeDelta.x, f, m_WidthDuration), Tween.QuintInOut(expandedSize.y, m_BaseRectTransform.sizeDelta.y, f, m_HeightDuration)); m_PanelRootRectTransform.SetPositionRegardlessOfPivot(new Vector2( Tween.QuintSoftOut(expandedPosition.x, m_BaseRectTransform.GetPositionRegardlessOfPivot().x, f, m_WidthDuration), Tween.QuintInOut(expandedPosition.y, m_BaseRectTransform.GetPositionRegardlessOfPivot().y, f, m_HeightDuration))); } if (m_Shadow) { m_PanelShadowCanvasGroup.alpha = Tween.QuintOut(1f, 0f, f - 0.75f, 0.25f); } m_PanelContentCanvasGroup.alpha = Tween.QuintSoftOut(1f, 0f, f, 0.25f); }, 0f, 1f, m_AnimationDuration, tweenType: Tween.TweenType.Linear); TweenManager.TimedCallback(m_AnimationDuration * 0.7f, () => m_BaseRectTransform.gameObject.SetActive(true)); } else if (m_FinalExpandMode == ExpandMode.Hybrid) { Vector2 endPos = m_BaseRectTransform.GetPositionRegardlessOfPivot(); TweenManager.TweenFloat(f => { if (m_ExpandedPosition.y > m_BaseRectTransform.position.y) { m_PanelRootRectTransform.sizeDelta = new Vector2( Tween.QuintInOut(expandedSize.x, m_BaseRectTransform.sizeDelta.x, f, m_WidthDuration), Tween.QuintSoftOut(expandedSize.y, m_BaseRectTransform.sizeDelta.y, f, m_HeightDuration)); m_PanelRootRectTransform.SetPositionRegardlessOfPivot(new Vector2( Tween.QuintInOut(expandedPosition.x, endPos.x, f, m_WidthDuration), Tween.QuintSoftOut(expandedPosition.y, endPos.y, f, m_HeightDuration))); } else { m_PanelRootRectTransform.sizeDelta = new Vector2( Tween.QuintSoftOut(expandedSize.x, m_BaseRectTransform.sizeDelta.x, f, m_WidthDuration), Tween.QuintInOut(expandedSize.y, m_BaseRectTransform.sizeDelta.y, f, m_HeightDuration)); m_PanelRootRectTransform.SetPositionRegardlessOfPivot(new Vector2( Tween.QuintSoftOut(expandedPosition.x, endPos.x, f, m_WidthDuration), Tween.QuintInOut(expandedPosition.y, endPos.y, f, m_HeightDuration))); } m_MaskRect.sizeDelta = m_PanelRootRectTransform.sizeDelta; m_MaskRect.position = m_PanelRootRectTransform.GetPositionRegardlessOfPivot(); m_Ripple.rectTransform.sizeDelta = Tween.QuintSoftOut(new Vector2(m_CircleExpandedSize, m_CircleExpandedSize), m_BaseRectTransform.sizeDelta, f, Mathf.Min(m_WidthDuration, m_HeightDuration)); m_Ripple.rectTransform.anchoredPosition = Vector2.zero; m_Ripple.SubmitSizeForSoftening(); if (m_Shadow) { m_PanelShadowCanvasGroup.alpha = Tween.QuintOut(1f, 0f, f, 0.15f); } m_PanelContentCanvasGroup.alpha = Tween.QuintOut(1f, 0f, f, 0.15f); m_Ripple.color = m_Ripple.color.WithAlpha(Tween.QuintSoftOut(1f, 0f, f - 0.8f, 0.2f)); }, 0f, 1f, m_AnimationDuration, tweenType: Tween.TweenType.Linear); TweenManager.TimedCallback(m_AnimationDuration, m_Ripple.InstantContract); TweenManager.TimedCallback(m_AnimationDuration * 0.8f, () => m_BaseRectTransform.gameObject.SetActive(true)); } if (m_DarkenBackground) { TweenManager.TweenColor(color => m_BackgroundImage.color = color, m_BackgroundImage.color, Color.clear, m_AnimationDuration * 0.5f, m_AnimationDuration * 0.5f, () => m_ClickableBackground.gameObject.SetActive(false), tweenType: Tween.TweenType.EaseInOutCubed); } TweenManager.TimedCallback(m_AnimationDuration, () => m_PanelRootRectTransform.gameObject.SetActive(false)); }
private void UpdateSelectionState() { if (m_Interactable) { m_CurrentSelectionState = inputField.isFocused ? ColorSelectionState.EnabledSelected : ColorSelectionState.EnabledDeselected; if (lineImage != null) { lineImage.sprite = null; } } else { m_CurrentSelectionState = inputField.isFocused ? ColorSelectionState.DisabledSelected : ColorSelectionState.DisabledDeselected; if (lineImage != null) { lineImage.sprite = lineDisabledSprite; lineImage.type = Image.Type.Tiled; } } if (m_CurrentSelectionState != m_LastSelectionState) { m_LastSelectionState = m_CurrentSelectionState; TweenManager.EndTween(m_LeftContentTweener); if (Application.isPlaying) { if (m_LeftContentGraphic) { m_LeftContentTweener = TweenManager.TweenColor(color => m_LeftContentGraphic.color = color, m_LeftContentGraphic.color, IsSelected() ? m_LeftContentActiveColor : m_LeftContentInactiveColor, m_AnimationDuration); } } else { if (m_LeftContentGraphic) { m_LeftContentGraphic.color = IsSelected() ? m_LeftContentActiveColor : m_LeftContentInactiveColor; } } TweenManager.EndTween(m_RightContentTweener); if (Application.isPlaying) { if (m_RightContentGraphic) { m_RightContentTweener = TweenManager.TweenColor(color => m_RightContentGraphic.color = color, m_RightContentGraphic.color, IsSelected() ? m_RightContentActiveColor : m_RightContentInactiveColor, m_AnimationDuration); } } else { if (m_RightContentGraphic) { m_RightContentGraphic.color = IsSelected() ? m_RightContentActiveColor : m_RightContentInactiveColor; } } TweenManager.EndTween(m_HintTextTweener); if (Application.isPlaying) { m_HintTextTweener = TweenManager.TweenColor(color => m_HintTextObject.color = color, m_HintTextObject.color, IsSelected() ? m_HintTextActiveColor : m_HintTextInactiveColor, m_AnimationDuration); } else { m_HintTextObject.color = IsSelected() ? m_HintTextActiveColor : m_HintTextInactiveColor; } TweenManager.EndTween(m_CounterTweener); if (Application.isPlaying) { m_CounterTweener = TweenManager.TweenColor(color => m_CounterText.color = color, m_CounterText.color, IsSelected() ? m_CounterActiveColor : m_CounterInactiveColor, m_AnimationDuration); } else { try { m_CounterText.color = IsSelected() ? m_CounterActiveColor : m_CounterInactiveColor; } catch { Debug.LogWarning("MaterialInputField:1127"); } } TweenManager.EndTween(m_ValidationColorTweener); if (Application.isPlaying) { m_ValidationColorTweener = TweenManager.TweenColor(color => m_ValidationText.color = color, m_ValidationText.color, IsSelected() ? m_ValidationActiveColor : m_ValidationInactiveColor, m_AnimationDuration); } else { m_ValidationText.color = IsSelected() ? m_ValidationActiveColor : m_ValidationInactiveColor; } m_LineTransform.GetComponent <Graphic>().color = m_LineInactiveColor; m_ActiveLineTransform.GetComponent <Graphic>().color = m_LineActiveColor; canvasGroup.alpha = m_Interactable ? 1 : 0.5f; canvasGroup.interactable = m_Interactable; canvasGroup.blocksRaycasts = m_Interactable; } }
private void CancelHintTextTweeners() { TweenManager.EndTween(m_HintTextFloatingValueTweener); m_AnimateHintText = false; }
protected virtual void OnEnable() { m_TweenManager = (TweenManager)serializedObject.targetObject; }
/// <summary> /// Instantiates the dropdown object and expands it. /// </summary> public void Show() { Canvas rootCanvas = m_BaseTransform.GetRootCanvas(); rootCanvas.CopySettingsToOtherCanvas(m_DropdownCanvas); m_DropdownCanvas.pixelPerfect = true; m_DropdownCanvas.sortingOrder = 30000; m_DropdownPanel = PrefabManager.InstantiateGameObject(PrefabManager.ResourcePrefabs.dropdownPanel, m_DropdownCanvas.transform).GetComponent <RectTransform>(); m_PanelLayer = m_DropdownPanel.GetChildByName <RectTransform>("PanelLayer"); m_DropdownCanvasGroup = m_DropdownPanel.GetComponent <CanvasGroup>(); m_ShadowCanvasGroup = m_DropdownPanel.GetChildByName <CanvasGroup>("Shadow"); m_DropdownPanel.GetRootCanvas().scaleFactor = rootCanvas.scaleFactor; m_CancelPanel = m_DropdownPanel.GetChildByName <RectTransform>("Cancel Panel"); m_CancelPanel.sizeDelta = scaler.canvas.pixelRect.size * 2; DropdownTrigger trigger = m_DropdownPanel.gameObject.GetChildByName <DropdownTrigger>("Cancel Panel"); trigger.index = -1; trigger.dropdown = this; m_DropdownPanel.gameObject.GetChildByName <Image>("ScrollRect").color = m_PanelColor; m_ListItemTemplate = new DropdownListItem(); m_ListItemTemplate.rectTransform = m_DropdownPanel.GetChildByName <RectTransform>("Item"); m_ListItemTemplate.canvasGroup = m_ListItemTemplate.rectTransform.GetComponent <CanvasGroup>(); m_ListItemTemplate.text = m_ListItemTemplate.rectTransform.GetChildByName <Text>("Text"); if (m_OptionDataList.imageType == ImageDataType.Sprite) { m_ListItemTemplate.image = m_ListItemTemplate.rectTransform.GetChildByName <Image>("Icon"); Destroy(m_ListItemTemplate.rectTransform.GetChildByName <VectorImage>("Icon").gameObject); } else { m_ListItemTemplate.image = m_ListItemTemplate.rectTransform.GetChildByName <VectorImage>("Icon"); Destroy(m_ListItemTemplate.rectTransform.GetChildByName <Image>("Icon").gameObject); } m_ListItems = new List <DropdownListItem>(); for (int i = 0; i < m_OptionDataList.options.Count; i++) { m_ListItems.Add(CreateItem(m_OptionDataList.options[i], i)); } for (int i = 0; i < m_ListItems.Count; i++) { Selectable selectable = m_ListItems[i].rectTransform.GetComponent <Selectable>(); Navigation navigation = new Navigation(); navigation.mode = Navigation.Mode.Explicit; if (i > 0) { navigation.selectOnUp = m_ListItems[i - 1].rectTransform.GetComponent <Selectable>(); } if (i < m_ListItems.Count - 1) { navigation.selectOnDown = m_ListItems[i + 1].rectTransform.GetComponent <Selectable>(); } selectable.navigation = navigation; } if (m_BaseSelectable != null) { if (m_ListItems.Count > 0) { Navigation navigation = Navigation.defaultNavigation; navigation.selectOnDown = m_ListItems[0].rectTransform.GetComponent <Selectable>(); m_BaseSelectable.navigation = navigation; } } float maxWidth = CalculateMaxItemWidth(); float buttonWidth = m_BaseTransform.rect.width; m_FullHeight = m_OptionDataList.options.Count * LayoutUtility.GetPreferredHeight(m_ListItemTemplate.rectTransform) + 16; m_ExpandedSize = new Vector2(Mathf.Max(maxWidth, buttonWidth), m_FullHeight); m_TempMaxHeight = m_MaxHeight; if (m_TempMaxHeight == 0) { m_TempMaxHeight = MaterialUIScaler.GetRootScaler(m_DropdownPanel).canvas.GetComponent <RectTransform>().rect.height - 32; } if (m_ExpandedSize.y > m_TempMaxHeight) { m_ExpandedSize.y = m_TempMaxHeight; } else { m_DropdownPanel.GetChildByName <Image>("Handle").gameObject.SetActive(false); } Destroy(m_ListItemTemplate.rectTransform.gameObject); m_DropdownPanel.position = m_BaseTransform.GetPositionRegardlessOfPivot(); if (m_ExpandStartType == ExpandStartType.ExpandFromBaseTransformWidth) { if (m_VerticalPivotType == VerticalPivotType.BelowBase) { m_DropdownPanel.position = new Vector3(m_DropdownPanel.position.x, m_DropdownPanel.position.y - m_BaseTransform.GetProperSize().y / 2, m_DropdownPanel.position.z); } else if (m_VerticalPivotType == VerticalPivotType.AboveBase) { m_DropdownPanel.position = new Vector3(m_DropdownPanel.position.x, m_DropdownPanel.position.y + m_BaseTransform.GetProperSize().y / 2, m_DropdownPanel.position.z); } } m_ExpandedPosition = CalculatedPosition(); m_ExpandedPosition.z = m_BaseTransform.position.z; m_DropdownCanvasGroup.alpha = 0f; m_ShadowCanvasGroup.alpha = 0f; if (m_ExpandStartType == ExpandStartType.ExpandFromBaseTransformWidth) { m_DropdownPanel.sizeDelta = new Vector2(m_BaseTransform.rect.size.x, 0f); } else if (m_ExpandStartType == ExpandStartType.ExpandFromBaseTransformHeight) { m_DropdownPanel.sizeDelta = new Vector2(0f, m_BaseTransform.rect.size.y); } else if (m_ExpandStartType == ExpandStartType.ExpandFromBaseTransformSize) { m_DropdownPanel.sizeDelta = m_BaseTransform.rect.size; } else { m_DropdownPanel.sizeDelta = Vector2.zero; } m_DropdownPanel.gameObject.SetActive(true); for (int i = 0; i < m_ListItemAutoTweeners.Count; i++) { TweenManager.EndTween(m_ListItemAutoTweeners[i]); } m_AutoTweeners = new List <int>(); m_ListItemAutoTweeners = new List <int>(); m_AutoTweeners.Add(TweenManager.TweenFloat(f => m_DropdownCanvasGroup.alpha = f, m_DropdownCanvasGroup.alpha, 1f, m_AnimationDuration * 0.66f, 0, null, false, Tween.TweenType.Linear)); m_AutoTweeners.Add(TweenManager.TweenFloat(f => m_ShadowCanvasGroup.alpha = f, m_ShadowCanvasGroup.alpha, 1f, m_AnimationDuration * 0.66f, 0, null, false, Tween.TweenType.Linear)); m_AutoTweeners.Add(TweenManager.TweenVector2(vector2 => m_DropdownPanel.sizeDelta = vector2, m_DropdownPanel.sizeDelta, m_ExpandedSize, m_AnimationDuration, m_AnimationDuration / 3, null, false, Tween.TweenType.EaseInOutQuint)); m_AutoTweeners.Add(TweenManager.TweenVector3(UpdateDropdownPos, m_DropdownPanel.position, m_ExpandedPosition, m_AnimationDuration, m_AnimationDuration / 3, () => { if (m_BaseSelectable != null && m_IsExapanded) { m_BaseSelectable.interactable = false; } Vector2 tempVector2 = m_PanelLayer.anchoredPosition; tempVector2.x = Mathf.RoundToInt(tempVector2.x); tempVector2.y = Mathf.RoundToInt(tempVector2.y); m_PanelLayer.anchoredPosition = tempVector2; }, false, Tween.TweenType.EaseInOutQuint)); for (int i = 0; i < m_ListItems.Count; i++) { int i1 = i; CanvasGroup canvasGroup = m_ListItems[i].canvasGroup; m_ListItemAutoTweeners.Add(TweenManager.TweenFloat(f => canvasGroup.alpha = f, canvasGroup.alpha, 1f, m_AnimationDuration * 1.66f, (i1 * (m_AnimationDuration / 6) + m_AnimationDuration) - m_ScrollPosOffset / 800, null, false, Tween.TweenType.Linear)); } if (m_FullHeight > m_TempMaxHeight) { m_DropdownPanel.GetChildByName <ScrollRect>("ScrollRect").gameObject.AddComponent <RectMask2D>(); } m_IsExapanded = true; m_TimeShown = Time.unscaledTime; }
public virtual void StopTransition() { TweenManager.EndTween(tweenId); tweenId = -1; }
public virtual void AnimateShowBackground() { background.blocksRaycasts = true; TweenManager.TweenFloat(f => background.alpha = f, background.alpha, m_BackgroundAlpha, m_AnimationDuration); }
private void ValidateText() { if (validationText == null) { return; } if (!m_ValidateOnStart && !m_HasBeenSelected) { return; } m_ValidationText.color = IsSelected() ? m_ValidationActiveColor : m_ValidationInactiveColor; ITextValidator validator = null; if (m_TextValidator != null && m_TextValidator.GetComponent <ITextValidator>() != null) { validator = m_TextValidator.GetComponent <ITextValidator>(); validator.Init(this); } if (m_CustomTextValidator != null) { validator = customTextValidator; m_HasValidation = true; } if (validator != null && m_HasValidation) { TweenManager.EndTween(m_ValidationTweener); if (!validator.IsTextValid()) { if (Application.isPlaying) { validationCanvasGroup.gameObject.SetActive(true); validationCanvasGroup.interactable = true; validationCanvasGroup.blocksRaycasts = true; m_ValidationTweener = TweenManager.TweenFloat(f => validationCanvasGroup.alpha = f, validationCanvasGroup.alpha, 1f, m_AnimationDuration / 2, tweenType: Tween.TweenType.Linear); return; } } else { if (Application.isPlaying) { m_ValidationTweener = TweenManager.TweenFloat(f => validationCanvasGroup.alpha = f, validationCanvasGroup.alpha, 0f, m_AnimationDuration / 2, 0, () => { validationCanvasGroup.interactable = false; validationCanvasGroup.blocksRaycasts = false; validationCanvasGroup.gameObject.SetActive(false); }, false, Tween.TweenType.Linear); return; } } } validationCanvasGroup.alpha = 0; validationCanvasGroup.interactable = false; validationCanvasGroup.blocksRaycasts = false; validationCanvasGroup.gameObject.SetActive(false); }
public virtual void AnimateHideBackground() { background.blocksRaycasts = false; TweenManager.TweenFloat(f => background.alpha = f, background.alpha, 0f, m_AnimationDuration, 0f, () => UnityEngine.Object.Destroy(background.gameObject), false, Tween.TweenType.Linear); }
public void Show() { m_PanelRootRectTransform.gameObject.SetActive(true); if (!m_HasExpandedInfo) { if (m_AutoExpandedPosition) { m_ExpandedPosition = m_PanelRootRectTransform.GetPositionRegardlessOfPivot(); } if (m_AutoExpandedSize) { m_ExpandedSize = m_PanelRootRectTransform.sizeDelta; } CalculateExpandMode(); m_HasExpandedInfo = true; } if (m_DarkenBackground || m_ClickBackgroundToClose) { if (m_ClickableBackground == null) { m_ClickableBackground = PrefabManager.InstantiateGameObject(PrefabManager.ResourcePrefabs.clickableBackground, m_PanelRootRectTransform.parent).GetAddComponent <RectTransform>(); m_ClickableBackground.SetSiblingIndex(m_PanelRootRectTransform.GetSiblingIndex()); m_BackgroundImage = m_ClickableBackground.gameObject.GetComponent <Image>(); m_BackgroundTrigger = m_ClickableBackground.gameObject.GetComponent <EventTrigger>(); EventTrigger.Entry entry = new EventTrigger.Entry(); entry.callback.AddListener(baseEventData => OnBackgroundClick()); m_BackgroundTrigger.triggers.Add(entry); } m_ClickableBackground.sizeDelta = new Vector2(10000, 10000); m_ClickableBackground.anchoredPosition = m_ExpandedPosition; m_BackgroundImage.color = Color.clear; m_ClickableBackground.gameObject.SetActive(true); } m_PanelContentCanvasGroup.alpha = 0f; if (m_RippleHasShadow && m_PanelShadowCanvasGroup != null) { m_PanelShadowCanvasGroup.alpha = 0f; } if (m_FinalExpandMode != ExpandMode.Rectangular) { m_MaskRect = rippleMask; m_MaskRect.SetParentAndScale(m_PanelRootRectTransform.parent, Vector3.one); RippleData rippleData = new RippleData { RippleParent = m_MaskRect, Shadow = m_RippleHasShadow }; m_Ripple = RippleManager.instance.GetRipple(); m_Ripple.Setup(rippleData, m_MaskRect.position, null); m_Ripple.rectTransform.localScale = Vector3.one; m_Ripple.rectTransform.sizeDelta = m_BaseRectTransform.sizeDelta; m_Ripple.color = Color.white; m_Ripple.canvasGroup.alpha = 1f; m_Ripple.SubmitSizeForSoftening(); m_CircleExpandedSize = Mathf.Sqrt(Mathf.Pow(Tween.QuintOut(0f, m_ExpandedSize.x, 1f, 0.5f), 2) + Mathf.Pow(Tween.QuintOut(0f, m_ExpandedSize.y, 1f, 0.5f), 2)); } if (m_FinalExpandMode != ExpandMode.Radial) { m_WidthDuration = 1f; m_HeightDuration = 1f; if (m_ExpandedSize.x > m_ExpandedSize.y) { m_HeightDuration = (2 * (m_ExpandedSize.y / m_ExpandedSize.x) + 1f) / 3f; } else if (m_ExpandedSize.x < m_ExpandedSize.y) { m_WidthDuration = (2 * (m_ExpandedSize.x / m_ExpandedSize.y) + 1f) / 3f; } } m_BaseRectTransform.gameObject.SetActive(false); m_Shadow = m_PanelShadowCanvasGroup != null; if (m_FinalExpandMode == ExpandMode.Radial) { m_PanelRootRectTransform.SetPositionRegardlessOfPivot(expandedPosition); m_PanelRootRectTransform.sizeDelta = expandedSize; TweenManager.TweenFloat(f => { m_MaskRect.sizeDelta = m_PanelRootRectTransform.sizeDelta; m_MaskRect.position = m_PanelRootRectTransform.GetPositionRegardlessOfPivot(); m_Ripple.rectTransform.sizeDelta = Tween.CubeSoftOut(m_Ripple.rectTransform.sizeDelta, new Vector2(m_CircleExpandedSize, m_CircleExpandedSize), f, 1f); m_Ripple.rectTransform.position = Tween.CubeSoftOut(m_BaseRectTransform.GetPositionRegardlessOfPivot(), m_PanelRootRectTransform.GetPositionRegardlessOfPivot(), f, 1f); m_Ripple.SubmitSizeForSoftening(); if (m_Shadow) { m_PanelShadowCanvasGroup.alpha = Tween.CubeInOut(0f, 1f, f - 0.5f, 0.5f); } m_PanelContentCanvasGroup.alpha = Tween.CubeInOut(0f, 1f, f - 0.5f, 0.25f); m_Ripple.color = m_Ripple.color.WithAlpha(Tween.CubeInOut(1f, 0f, f - 0.5f, 0.5f)); }, 0f, 1f, m_AnimationDuration, tweenType: Tween.TweenType.Linear); TweenManager.TimedCallback(m_AnimationDuration, m_Ripple.InstantContract); } else if (m_FinalExpandMode == ExpandMode.Rectangular) { TweenManager.TweenFloat(f => { if (m_ExpandedPosition.y > m_BaseRectTransform.position.y) { m_PanelRootRectTransform.sizeDelta = new Vector2( Tween.QuintOut(m_BaseRectTransform.sizeDelta.x, expandedSize.x, f, m_WidthDuration), Tween.QuintSoftOut(m_BaseRectTransform.sizeDelta.y, expandedSize.y, f, m_HeightDuration)); m_PanelRootRectTransform.SetPositionRegardlessOfPivot(new Vector2( Tween.QuintOut(m_BaseRectTransform.GetPositionRegardlessOfPivot().x, expandedPosition.x, f, m_WidthDuration), Tween.QuintSoftOut(m_BaseRectTransform.GetPositionRegardlessOfPivot().y, expandedPosition.y, f, m_HeightDuration))); } else { m_PanelRootRectTransform.sizeDelta = new Vector2( Tween.QuintSoftOut(m_BaseRectTransform.sizeDelta.x, expandedSize.x, f, m_WidthDuration), Tween.QuintOut(m_BaseRectTransform.sizeDelta.y, expandedSize.y, f, m_HeightDuration)); m_PanelRootRectTransform.SetPositionRegardlessOfPivot(new Vector2( Tween.QuintSoftOut(m_BaseRectTransform.GetPositionRegardlessOfPivot().x, expandedPosition.x, f, m_WidthDuration), Tween.QuintOut(m_BaseRectTransform.GetPositionRegardlessOfPivot().y, expandedPosition.y, f, m_HeightDuration))); } if (m_Shadow) { m_PanelShadowCanvasGroup.alpha = Tween.QuintOut(0f, 1f, f, 0.25f); } m_PanelContentCanvasGroup.alpha = Tween.QuintInOut(0f, 1f, f - 0.5f, 0.5f); }, 0f, 1f, m_AnimationDuration, tweenType: Tween.TweenType.Linear); } else if (m_FinalExpandMode == ExpandMode.Hybrid) { Vector2 startPos = m_BaseRectTransform.GetPositionRegardlessOfPivot(); m_PanelRootRectTransform.sizeDelta = m_BaseRectTransform.sizeDelta; m_PanelRootRectTransform.SetPositionRegardlessOfPivot(m_BaseRectTransform.GetPositionRegardlessOfPivot()); TweenManager.TweenFloat(f => { if (m_ExpandedPosition.y > m_BaseRectTransform.position.y) { m_PanelRootRectTransform.sizeDelta = new Vector2( Tween.QuintOut(m_BaseRectTransform.sizeDelta.x, expandedSize.x, f, m_WidthDuration), Tween.QuintSoftOut(m_BaseRectTransform.sizeDelta.y, expandedSize.y, f, m_HeightDuration)); m_PanelRootRectTransform.SetPositionRegardlessOfPivot(new Vector2( Tween.QuintOut(startPos.x, expandedPosition.x, f, m_WidthDuration), Tween.QuintSoftOut(startPos.y, expandedPosition.y, f, m_HeightDuration))); } else { m_PanelRootRectTransform.sizeDelta = new Vector2( Tween.QuintSoftOut(m_BaseRectTransform.sizeDelta.x, expandedSize.x, f, m_WidthDuration), Tween.QuintOut(m_BaseRectTransform.sizeDelta.y, expandedSize.y, f, m_HeightDuration)); m_PanelRootRectTransform.SetPositionRegardlessOfPivot(new Vector2( Tween.QuintSoftOut(startPos.x, expandedPosition.x, f, m_WidthDuration), Tween.QuintOut(startPos.y, expandedPosition.y, f, m_HeightDuration))); } m_MaskRect.sizeDelta = m_PanelRootRectTransform.sizeDelta; m_MaskRect.position = m_PanelRootRectTransform.GetPositionRegardlessOfPivot(); m_Ripple.rectTransform.sizeDelta = Tween.CubeSoftOut(m_Ripple.rectTransform.sizeDelta, new Vector2(m_CircleExpandedSize, m_CircleExpandedSize), f - 0.2f, 1f); m_Ripple.rectTransform.anchoredPosition = Vector2.zero; m_Ripple.SubmitSizeForSoftening(); if (m_Shadow) { m_PanelShadowCanvasGroup.alpha = Tween.CubeInOut(0f, 1f, f - 0.4f, 0.6f); } m_PanelContentCanvasGroup.alpha = Tween.CubeInOut(0f, 1f, f - 0.4f, 0.3f); m_Ripple.color = m_Ripple.color.WithAlpha(Tween.CubeInOut(1f, 0f, f - 0.5f, 0.5f)); }, 0f, 1f, m_AnimationDuration, tweenType: Tween.TweenType.Linear); if (m_DarkenBackground) { TweenManager.TweenColor(color => m_BackgroundImage.color = color, m_BackgroundImage.color, MaterialColor.disabledDark, m_AnimationDuration * 0.5f, m_AnimationDuration * 0.5f, tweenType: Tween.TweenType.EaseInOutCubed); } TweenManager.TimedCallback(m_AnimationDuration * 0.7f, m_Ripple.InstantContract); } }