Setup() public method

Sets up the essential elements of a sprite.
public Setup ( float w, float h, Vector2 lowerleftPixel, Vector2 pixeldimensions ) : void
w float The width, in local space, of the sprite.
h float The height, in local space, of the sprite.
lowerleftPixel Vector2 The coordinate of the lower-left pixel of the desired sprite on the sprite atlas.
pixeldimensions Vector2 The X and Y dimensions, in pixels, of the sprite.
return void
Beispiel #1
0
    public void SetPlaneKey(string imageKey, ref float addY)
    {
        Transform transform = base.transform.FindChild("ChatPlane");

        if (transform != null)
        {
            SimpleSprite component = transform.GetComponent <SimpleSprite>();
            if (component != null)
            {
                Transform transform2 = base.transform.FindChild("ChatText");
                if (transform2 != null)
                {
                    UIListItemContainer component2 = transform2.GetComponent <UIListItemContainer>();
                    if (null != component2)
                    {
                        Vector2 vector = (Vector2)component2.Data;
                        float   num    = vector.x + 20f;
                        float   h      = vector.y + 10f;
                        component.Setup(num, h, imageKey);
                        component.SetColor(new Color(1f, 1f, 1f, 0.8f));
                        component.transform.rotation       = base.transform.rotation;
                        component.transform.localScale     = new Vector3(this.fBackImageScaleX, this.fBackImageScaleY, 1f);
                        component2.transform.localPosition = new Vector3(-(num * this.fEmoticonScale) / 2f + 20f * this.fEmoticonScale / 2f, vector.y * this.fEmoticonScale / 2f, 0f);
                    }
                }
                else
                {
                    component.Hide(true);
                }
            }
        }
    }
Beispiel #2
0
    public void SetPlaneKey(string imageKey)
    {
        Transform transform = base.transform.FindChild("NamePlane");

        if (transform != null)
        {
            SimpleSprite component = transform.GetComponent <SimpleSprite>();
            if (component != null)
            {
                float     num        = 1.5f;
                float     num2       = 8f;
                Transform transform2 = base.transform.FindChild("NameText");
                if (transform2 != null)
                {
                    SpriteText component2 = transform2.GetComponent <SpriteText>();
                    if (component2)
                    {
                        float num3 = Math.Abs(component2.BottomRight.x - component2.TopLeft.x);
                        float num4 = Math.Abs(component2.BottomRight.y - component2.TopLeft.y);
                        component.Setup(num3 + num2 * 2f, num4 * num, imageKey);
                        component.Hide(false);
                        return;
                    }
                }
                component.Hide(true);
            }
        }
    }