public override void Tween(BaseStyleElement p_sender, bool p_canAnimate, float p_animationDuration) { TweenManager.EndTween(_tweenId); var v_graphic = GetTarget <Graphic>(); if (v_graphic != null) { var v_endColor = m_color; if (p_canAnimate && Application.isPlaying) { _tweenId = TweenManager.TweenColor( (color) => { if (v_graphic != null) { v_graphic.color = color; } }, v_graphic.color, v_endColor, p_animationDuration ); } else { v_graphic.color = v_endColor; } } }
protected virtual void InvalidateWithoutCallEvents(BaseStyleElement p_behaviour) { if (p_behaviour != null && _registeredBehaviours.Contains(p_behaviour)) { _behavioursToReapplyStyle.Add(p_behaviour); } }
public override void Tween(BaseStyleElement p_sender, bool p_canAnimate, float p_animationDuration) { TweenManager.EndTween(_tweenId); var v_graphic = GetTarget <Graphic>(); if (v_graphic != null) { var v_slider = p_sender as MaterialSlider; var v_isInteractable = v_slider != null ? v_slider.m_Interactable : true; var v_endColor = !v_isInteractable ? m_colorDisabled : m_colorEnabled; if (p_canAnimate && Application.isPlaying) { _tweenId = TweenManager.TweenColor( (color) => { if (v_graphic != null) { v_graphic.color = color; } }, v_graphic.color, v_endColor, p_animationDuration ); } else { v_graphic.color = v_endColor; } } }
protected internal bool UnregisterStyleBehaviour(BaseStyleElement p_styleBehavior) { if (p_styleBehavior != null && _registeredBehaviours.Contains(p_styleBehavior)) { return(_registeredBehaviours.Remove(p_styleBehavior)); } return(false); }
protected internal bool IsSupportedStyleElement(BaseStyleElement p_styleElement) { if (p_styleElement != null) { var v_supportedType = GetSupportedStyleAssetType(); var v_templateType = p_styleElement.GetType(); if (v_supportedType == v_templateType || v_templateType.IsSubclassOf(v_supportedType)) { return(true); } } return(false); }
protected internal bool RegisterStyleBehaviour(BaseStyleElement p_styleBehavior) { if (p_styleBehavior != null && p_styleBehavior.SupportStyleGroup) { //Unregister from previous group if (p_styleBehavior.StyleGroup != null && p_styleBehavior.StyleGroup != this) { p_styleBehavior.UnregisterFromStyleGroup(); } if (!_registeredBehaviours.Contains(p_styleBehavior)) { var v_sucess = _registeredBehaviours.Add(p_styleBehavior); Invalidate(p_styleBehavior); return(v_sucess); } } return(false); }
public override void Tween(BaseStyleElement p_sender, bool p_canAnimate, float p_animationDuration) { TweenManager.EndTween(_tweenId); var v_graphic = GetTarget <Graphic>(); if (v_graphic != null) { var v_toggleBase = p_sender as ToggleBase; var v_isActive = v_toggleBase != null ? v_toggleBase.toggle.isOn : true; var v_isInteractable = v_toggleBase != null? v_toggleBase.m_Interactable : true; var v_endColor = !v_isInteractable ? m_colorDisabled : (v_isActive ? m_colorOn : m_colorOff); if (p_canAnimate && Application.isPlaying) { _tweenId = TweenManager.TweenColor( (color) => { if (v_graphic != null) { v_graphic.color = color; } }, v_graphic.color, v_endColor, p_animationDuration, 0, null, false, MaterialUI.Tween.TweenType.SoftEaseOutQuint ); } else { v_graphic.color = v_endColor; } } }
protected virtual void Invalidate(BaseStyleElement p_behaviour) { InvalidateWithoutCallEvents(p_behaviour); CancelInvoke("TryReapplyStyles"); Invoke("TryReapplyStyles", 0.1f); }
public abstract void Tween(BaseStyleElement p_sender, bool p_canAnimate, float p_animationDuration);
public override void Tween(BaseStyleElement p_sender, bool p_canAnimate, float p_animationDuration) { TweenManager.EndTween(_tweenId); }
public StyleData(string p_name, BaseStyleElement p_asset) { m_name = p_name; m_assetPrefab = p_asset != null? p_asset.gameObject : null; }