void CheckBoxEvent(GameObject go, bool isActive)
 {
     if (!isActive)
     {
         mBtnTween.Play(false);
     }
     mCollider.enabled = false;
     if (null != m_CheckBoxEvent)
     {
         m_CheckBoxEvent(go, isActive);
     }
 }
예제 #2
0
        public void UpdateBtnTweenState()
        {
            if (mBtnTween == null || mWnd == null || mChcekedBox == null || mCollider == null)
            {
                return;
            }

            if (!mChcekedBox.isChecked && mWnd.activeSelf && mTweenState == true)
            {
                mBtnTween.Play(false);
                mTweenState       = false;
                mCollider.enabled = false;
            }
            else if (!mWnd.activeSelf)
            {
                mTweenState       = true;
                mCollider.enabled = true;
            }
        }
예제 #3
0
    // Update is called once per frame
    void Update()
    {
        // Calc bExpanded
        if (m_ParentMenuItem != null)
        {
            ParentExpandFactor = (m_ParentMenuItem.m_PopupTween.tweenTarget.transform.localScale - m_ParentMenuItem.m_PopupTween.tweenTarget.GetComponent <TweenScale>().from).magnitude;
        }
        else
        {
            ParentExpandFactor = 1;
        }
        if (m_PopupTween.tweenTarget.transform.localScale == m_PopupTween.tweenTarget.GetComponent <TweenScale>().from)
        {
            ExpandState = 0;
        }
        else if (m_PopupTween.tweenTarget.transform.localScale == m_PopupTween.tweenTarget.GetComponent <TweenScale>().to)
        {
            ExpandState = 1;
        }
        else
        {
            ExpandState = -1;
        }
        if (ExpandingTime < 0.1f)
        {
            ExpandState = -1;
        }
        notExpandTime += Time.deltaTime;
        ExpandingTime += Time.deltaTime;

        // Calc bShouldExpand
        if (UICamera.selectedObject == null)
        {
            bShouldExpand = false;
        }
        else if (notExpandTime < 0.3f)
        {
            bShouldExpand           = false;
            UICamera.selectedObject = null;
        }
        else if (ExpandState == -1)
        {
            // No change
        }
        else
        {
            if (this.m_PopupTween.gameObject == UICamera.selectedObject)
            {
                bShouldExpand = true;
            }
            else
            {
                bShouldExpand = false;
            }
            VCEUISceneMenuItem[] child_items = GetComponentsInChildren <VCEUISceneMenuItem>(true);
            foreach (VCEUISceneMenuItem item in child_items)
            {
                if (item.m_PopupTween.gameObject == UICamera.selectedObject)
                {
                    bShouldExpand = true;
                }
            }
        }

        // Handle expanding
        if (bShouldExpand && ExpandState == 0)
        {
            m_PopupTween.Play(true);
            ExpandingTime = 0;
        }
        if (!bShouldExpand && ExpandState == 1)
        {
            m_PopupTween.Play(false);
            ExpandingTime = 0;
        }

        // Color changing
        if (m_PopupMenuSpriteTriangle != null)
        {
            if (bShouldExpand)
            {
                m_PopupMenuSpriteTriangle.GetComponent <UISprite>().color = Color.yellow;
                m_Label.color = new Color(1.0f, 1.0f, 0.0f, ParentExpandFactor);
            }
            else
            {
                m_PopupMenuSpriteTriangle.GetComponent <UISprite>().color = Color.white;
                m_Label.color = new Color(1.0f, 1.0f, 1.0f, ParentExpandFactor);
            }
        }
    }
예제 #4
0
 void DoChangeExpand()
 {
     mBtnTween.Play(true);
 }