Esempio n. 1
0
        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; // button over color lighter
            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);
        }
Esempio n. 2
0
 public static UI_Sprite CreateDebugButton(Vector2 anchoredPosition, Vector2 size, Action ClickFunc, Color color, string text, out UI_TextComplex uiTextComplex)
 {
     return(CreateDebugButton(GetCanvasTransform(), anchoredPosition, size, ClickFunc, color, text, out uiTextComplex));
 }