Example #1
0
        // Create a Sprite in the World with Button_Sprite
        public static Button_Sprite CreateWorldSpriteButton(Transform parent, string name, Sprite sprite, Vector3 localPosition, Vector3 localScale, int sortingOrder, Color color)
        {
            GameObject gameObject = CreateWorldSprite(parent, name, sprite, localPosition, localScale, sortingOrder, color);

            gameObject.AddComponent <BoxCollider2D>();
            Button_Sprite buttonSprite = gameObject.AddComponent <Button_Sprite>();

            return(buttonSprite);
        }
Example #2
0
        public Button_Sprite AddButton(System.Action ClickFunc, System.Action MouseOverOnceFunc, System.Action MouseOutOnceFunc)
        {
            Button_Sprite buttonSprite = gameObject.AddComponent <Button_Sprite>();

            if (ClickFunc != null)
            {
                buttonSprite.ClickFunc = ClickFunc;
            }
            if (MouseOverOnceFunc != null)
            {
                buttonSprite.MouseOverOnceFunc = MouseOverOnceFunc;
            }
            if (MouseOutOnceFunc != null)
            {
                buttonSprite.MouseOutOnceFunc = MouseOutOnceFunc;
            }
            return(buttonSprite);
        }