示例#1
0
    public override void gaxb_complete()
    {
        base.gaxb_complete();

        button = gameObject.AddComponent <Button> ();

        if (onTouchUp != null)
        {
            PlanetUnityButtonHelper.SetOnTouchUp(this, button, onTouchUp);
        }
    }
示例#2
0
    public override void gaxb_init()
    {
        base.gaxb_init();

        if (title == null)
        {
            gameObject.name = "<TextButton/>";
        }

        button = gameObject.AddComponent <Button> ();

        PlanetUnityButtonHelper.SetOnTouchUp(this, button, onTouchUp);
        PlanetUnityButtonHelper.SetOnTouchDown(this, button, null);
    }
示例#3
0
    public override void gaxb_init()
    {
        gameObject = new GameObject("<ClearButton/>", typeof(RectTransform));

        canvasRenderer = gameObject.AddComponent <CanvasRenderer> ();
        graphic        = gameObject.AddComponent <InvisibleHitGraphic> ();

#if !UNITY_4_6
        graphic.color = Color.clear;
#endif

        button = gameObject.AddComponent <Button> ();

        PlanetUnityButtonHelper.SetOnTouchUp(this, button, onTouchUp);
        PlanetUnityButtonHelper.SetOnTouchDown(this, button, null);
    }
示例#4
0
    public override void gaxb_init()
    {
        base.gaxb_init();

        if (title == null)
        {
            gameObject.name = "<ColorButton/>";
        }

        button = gameObject.AddComponent <Button> ();

        if (pressedColor != null)
        {
            PlanetUnityButtonHelper.SetPressedColor(button, pressedColor.Value);
        }

        PlanetUnityButtonHelper.SetOnTouchUp(this, button, onTouchUp);
        PlanetUnityButtonHelper.SetOnTouchDown(this, button, null);
    }
示例#5
0
    public override void gaxb_init()
    {
        base.gaxb_init();

        if (title == null)
        {
            gameObject.name = "<ImageButton/>";
        }

        button = gameObject.AddComponent <Button> ();

        if (pressedResourcePath != null || highlightedResourcePath != null || disabledResourcePath != null)
        {
            button.transition = Selectable.Transition.SpriteSwap;

            SpriteState states = button.spriteState;

            if (pressedResourcePath != null)
            {
                states.pressedSprite = PlanetUnityResourceCache.GetSprite(pressedResourcePath, PlanetUnityOverride.ForceActualSprites);
            }
            if (highlightedResourcePath != null)
            {
                states.highlightedSprite = PlanetUnityResourceCache.GetSprite(highlightedResourcePath, PlanetUnityOverride.ForceActualSprites);
            }
            if (disabledResourcePath != null)
            {
                states.disabledSprite = PlanetUnityResourceCache.GetSprite(disabledResourcePath, PlanetUnityOverride.ForceActualSprites);
            }

            button.spriteState = states;
        }

        if (onTouchUp != null)
        {
            PlanetUnityButtonHelper.SetOnTouchUp(this, button, onTouchUp);
        }

        if (onTouchDown != null)
        {
            PlanetUnityButtonHelper.SetOnTouchDown(this, button, onTouchDown);
        }
    }