public virtual void Init(ToggleGroup togglegroup) { Toggle = GetComponent <Toggle>(); Toggle.group = togglegroup; Toggle.onValueChanged.AddListener(ValueChangedCallback); RectTransform = GetComponent <RectTransform>(); CanvasGroup = GetComponent <CanvasGroup>(); RateTransition = new RateTransition(this, 0.5f); RateTransition.OnValueChanged += RateTransitionValueCallback; RateTransition.Speed = 15f; RateTransition.To(0f); }
protected virtual void ValueChangedCallback(bool isOn) { if (isOn) { if (OnSelect != null) { OnSelect(Context); } RateTransition.To(1f); } else { RateTransition.To(0f); } }