Exemplo n.º 1
0
    //Methods for displaying

    public override void Init()
    {
        base.Init();

        distort   = transform.Find("Distort").GetComponent <Distort>();
        underline = transform.Find("Underline").GetComponent <Image>();

        distort.TurnOff();
        currentWidth = widthNormal;
        underline.GetComponent <RectTransform>().sizeDelta = new Vector2(currentWidth, height);
        underline.gameObject.SetActive(false);
        textName.text = string.Empty;
    }
Exemplo n.º 2
0
    public override void SetFocused(bool value)
    {
        if (value)
        {
            if (!isFocused)
            {
                if (ParentMenu != null)
                {
                    if (ParentMenu.LastFocused != this)
                    {
                        ParentMenu.LastFocused = this;
                        SoundManager.instance.PlayUiEfx(focusSound);
                    }
                }
                else
                {
                    SoundManager.instance.PlayUiEfx(focusSound);
                }

                if (controlGroup != null)
                {
                    if (currentFocused.ContainsKey(controlGroup))
                    {
                        currentFocused[controlGroup].SetFocused(false);
                    }
                    currentFocused.Add(controlGroup, this);
                }

                isFocused = true;
                distort.TurnOn();
                underline.gameObject.SetActive(true);
            }
        }
        else
        {
            if (isFocused)
            {
                if (IsControlFocusedInGroup())
                {
                    currentFocused.Remove(controlGroup);
                }

                isFocused = false;
                distort.TurnOff();
            }
        }
    }