public void OnPointerDown(PointerEventData eventData) { if (isClickDisabled) { return; } fadeOut = false; var shapeImage = shape.ShapeImage; UiThemeUtil.AddChild(ref ripple, "Ripple", shapeImage.transform, uiSo); ripple.transform.SetSiblingIndex(0); ripple.gameObject.SetActive(true); var rippleRect = ripple.rectTransform; var shapeRect = shapeImage.rectTransform; ripple.sprite = uiTheme.GetShape(UiThemeShapeType.Circle).sprite; ripple.preserveAspect = true; ripple.type = Image.Type.Simple; ripple.color = uiTheme.GetColor(UiThemeUtil.ToLightColor[shape.colorType]).color; if (!RectTransformUtility.ScreenPointToLocalPointInRectangle( shapeImage.rectTransform, eventData.position, eventData.pressEventCamera, out var localPoint )) { return; } rippleRect.anchorMax = Vector2.one * .5f; rippleRect.anchorMin = Vector2.one * .5f; rippleRect.anchoredPosition = localPoint; var shapeSize = shapeRect.rect.size; var shapeMid = shapeSize * 0.5f; var size = Mathf.Max( shapeMid.x + Mathf.Abs(localPoint.x), shapeMid.y + Mathf.Abs(localPoint.y) ) * 2.0f; if (rippleRoutine != null) { StopCoroutine(rippleRoutine); } rippleRoutine = StartCoroutine(OnRipple(size)); }
public void SetColorType(UIThemeColorType aColorType) { colorType = aColorType; shapeImage.color = theme.GetColor(colorType).color; }
public void SetColor(UIThemeColorType color) { colorType = color; text.color = theme.GetColor(color).color; }