Esempio n. 1
0
    public override void SetPressed(bool value)
    {
        if (value)
        {
            if (!isPressed)
            {
                if (ParentMenu != null)
                {
                    ParentMenu.LastFocused = this;
                    ParentMenu.LastPressed = this;
                }
                SoundManager.instance.PlayUiEfx(pressSound);

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

                isPressed = true;
                front.gameObject.SetActive(true);
                front.SetColor(pressColor);
                mark.SetColor(lightColor);
                textName.SetColor(lightColor);
                sliderBar.Activate();
                pointer.SetPress();
                StartCoroutine(ChangeWidth(normalWidth, pressWidth));
            }
        }
        else
        {
            if (isPressed)
            {
                if (ParentMenu != null && ParentMenu.LastPressed == this)
                {
                    ParentMenu.LastPressed = null;
                }

                if (IsControlPressedInGroup())
                {
                    currentPressed.Remove(controlGroup);
                    SetFocused(true);
                }

                isPressed             = false;
                sliderBar.IsActivated = false;
                StartCoroutine(ChangeWidth(pressWidth, normalWidth));
            }
        }
    }