//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;
        //}
    }
    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();
    }