Exemplo n.º 1
0
    void ChangePanel(UserPanelButton previousButton, UserPanelButton currentButton)
    {
        previousActiveButton = previousButton;  activeButton = currentButton;
        canswitch            = false;

        if (previousActiveButton != null && previousActiveButton.linkedPanel)
        {
            if (previousActiveButton.linkedPanel)
            {
                previousActiveButton.HidePanel();
                previousActiveButton.linkedPanel.panelDeactivatedEvent += Deactivated;
            }
            else
            {
                canswitch = true;
            }
        }
        else
        {
            if (activeButton.linkedPanel)
            {
                activeButton.ShowPanel();
                activeButton.linkedPanel.panelActivatedEvent += ActiveButtonShown;
            }
            else
            {
                canswitch = true;
            }
        }
    }
Exemplo n.º 2
0
    //public override void DeactivatePanel(bool animate = true)
    //{
    //    base.DeactivatePanel(animate);
    //
    //}
    //protected override IEnumerator StartActivationAnimations(bool animate = true)
    //{
    //    return base.StartActivationAnimations(animate);
    //}
    protected override IEnumerator StartDeactivationAnimations(bool animate = true)
    {
        if (activeButton)
        {
            activeButton.AnimateSizeDelta(null);
            if (activeButton.linkedPanel)
            {
                if (activeButton.linkedPanel.IsActive())
                {
                    activeButton.linkedPanel.DeactivatePanel(true);
                    while (activeButton.linkedPanel.IsActive())
                    {
                        yield return(null);
                    }
                }
            }
        }
        if (previousActiveButton)
        {
            previousActiveButton.AnimateSizeDelta(null);
            if (previousActiveButton.linkedPanel)
            {
                if (previousActiveButton.linkedPanel.IsActive())
                {
                    previousActiveButton.linkedPanel.DeactivatePanel(true);
                    while (previousActiveButton.linkedPanel.IsActive())
                    {
                        yield return(null);
                    }
                }
            }
        }
        activeButton         = null;
        previousActiveButton = null;


        //StartCoroutine(base.StartDeactivationAnimations(animate));
        IEnumerator enumerator;

        enumerator = base.StartDeactivationAnimations(animate);
        while (true)
        {
            yield return(enumerator.Current);

            if (enumerator.MoveNext() == false)
            {
                yield break;
            }
        }
        //yield break;
        //while (true)
        //{
        //    yield return enumerator.Current;
        //    if (enumerator.MoveNext() == false)
        //        yield break;
        //}
    }
Exemplo n.º 3
0
    protected void ButtonPressed(DOW_Button button)
    {
        if (!activeButton)
        {
            canswitch = true;
        }

        if (canswitch)
        {
            Debug.Log("Active button: " + activeButton + "BUtton: " + button + "Previous active buttons: " + previousActiveButton);
            if (activeButton != button)
            {
                if (activeButton)
                {
                    activeButton.AnimateSizeDelta(null);
                    //activeButton.EnableButton();

                    button.AnimateSizeDelta(new Vector2(250, 190));
                    //button.DisableButton();
                    activeButton = button as UserPanelButton;
                }
                else
                {
                    activeButton = button as UserPanelButton;
                    activeButton.AnimateSizeDelta(new Vector2(250, 190));

                    //Disable the button so that no clicking is no more possible on this button
                    //activeButton.DisableButton();
                }
                Debug.Log("SDFSDFGSHDH#$Q%$%#$%@#^@%^@#$^@#4");
                ChangePanel();
            }
            else
            {
                //If the button is enabled, disable the button, or else disable the button
                if (button.IsEnabled())
                {
                    button.AnimateSizeDelta(null);
                    DisablePanel();
                }
                else
                {
                    activeButton.AnimateSizeDelta(new Vector2(250, 190));
                    //ActivatePanel();
                }
            }
            previousActiveButton = activeButton;
        }

        //if (previousActiveButton)
        //    previousActiveButton.HidePanel();
        //activeButton.ShowPanel();
    }
Exemplo n.º 4
0
    // Start is called before the first frame update
    protected override void Start()
    {
        base.Start();

        //ActivatePanel(true);

        foreach (DOW_Button button in DOW_Buttons)
        {
            button.ButtonPressEvent += ButtonPressed;
        }

        if (defaultButton)
        {
            panelActivatedEvent += (Panel_Base panel) => {
                defaultButton.ForceButtonPress();
                activeButton = defaultButton;
            }
        }
        ;
    }