public static UI_Sprite CreateDebugButton(Vector2 anchoredPosition, Vector2 size, Action ClickFunc, Color color) { UI_Sprite uiSprite = new UI_Sprite(GetCanvasTransform(), Assets.i.s_White, anchoredPosition, size, color); uiSprite.AddButton(ClickFunc, null, null); return(uiSprite); }
public static UI_Sprite CreateDebugButton(Vector2 anchoredPosition, string text, Action ClickFunc, Color color, Vector2 padding) { UI_TextComplex uiTextComplex; UI_Sprite uiSprite = CreateDebugButton(anchoredPosition, Vector2.zero, ClickFunc, color, text, out uiTextComplex); uiSprite.SetSize(new Vector2(uiTextComplex.GetTotalWidth(), uiTextComplex.GetTotalHeight()) + padding); return(uiSprite); }
public static UI_Sprite CreateDebugButton(Vector2 anchoredPosition, Vector2 size, Action ClickFunc, Color color, string text, out UI_TextComplex uiTextComplex) { if (color.r >= 1f) { color.r = .9f; } if (color.g >= 1f) { color.g = .9f; } if (color.b >= 1f) { color.b = .9f; } Color colorOver = color * 1.1f; UI_Sprite uiSprite = new UI_Sprite(GetCanvasTransform(), Assets.i.s_White, anchoredPosition, size, color); uiSprite.AddButton(ClickFunc, () => uiSprite.SetColor(colorOver), () => uiSprite.SetColor(color)); uiTextComplex = new UI_TextComplex(uiSprite.gameObject.transform, Vector2.zero, 12, '#', text, null, null); uiTextComplex.SetTextColor(Color.black); uiTextComplex.SetAnchorMiddle(); uiTextComplex.CenterOnPosition(Vector2.zero); return(uiSprite); }