示例#1
0
        public void OnValueChanged(bool state)
        {
            if (this.m_LayoutElement == null)
            {
                return;
            }

            UIAccordion.Transition transition = (this.m_Accordion != null) ? this.m_Accordion.transition : UIAccordion.Transition.Instant;

            if (transition == UIAccordion.Transition.Instant)
            {
                if (state)
                {
                    this.m_LayoutElement.preferredHeight = -1f;
                }
                else
                {
                    this.m_LayoutElement.preferredHeight = this.m_MinHeight;
                }
            }
            else if (transition == UIAccordion.Transition.Tween)
            {
                if (state)
                {
                    this.StartTween(this.m_MinHeight, this.GetExpandedHeight());
                }
                else
                {
                    this.StartTween(this.m_RectTransform.rect.height, this.m_MinHeight);
                }
            }
        }
示例#2
0
        public void OnValueChanged(bool state)
        {
            string objName = this.gameObject.name;

            if (state)
            {
                AnimationController cc = GameObject.FindObjectOfType(typeof(AnimationController)) as AnimationController;
                cc.getScriptName(objName);
            }

            /*
             * AnimationController ac = GameObject.FindObjectOfType(typeof(AnimationController)) as AnimationController;
             * ac.getScriptName(objName);*/

            if (this.m_LayoutElement == null)
            {
                return;
            }

            UIAccordion.Transition transition = (this.m_Accordion != null) ? this.m_Accordion.transition : UIAccordion.Transition.Instant;

            if (transition == UIAccordion.Transition.Instant)
            {
                if (state)
                {
                    this.m_LayoutElement.preferredHeight = -1f;
                }
                else
                {
                    this.m_LayoutElement.preferredHeight = this.m_MinHeight;
                }
            }
            else if (transition == UIAccordion.Transition.Tween)
            {
                if (state)
                {
                    this.StartTween(this.m_MinHeight, this.GetExpandedHeight());
                }
                else
                {
                    this.StartTween(this.m_RectTransform.rect.height, this.m_MinHeight);
                }
            }
        }
        public void OnValueChanged(bool state)
        {
            if (this.m_LayoutElement == null)
            {
                return;
            }

            UIAccordion.Transition transition = (this.m_Accordion != null) ? this.m_Accordion.transition : UIAccordion.Transition.Instant;
            bool allowSwitchOff = this.group.allowSwitchOff;

            if (transition == UIAccordion.Transition.Instant)
            {
                if (state)
                {
                    if (!allowSwitchOff)
                    {
                        if (isSelected)
                        {
                            this.m_LayoutElement.preferredHeight = this.m_MinHeight;
                        }
                        else
                        {
                            this.m_LayoutElement.preferredHeight = -1f;
                        }
                        isSelected = !isSelected;
                    }
                    else
                    {
                        isSelected = true;
                        this.m_LayoutElement.preferredHeight = -1f;
                    }
                }
                else
                {
                    isSelected = false;
                    this.m_LayoutElement.preferredHeight = this.m_MinHeight;
                }
            }
            else if (transition == UIAccordion.Transition.Tween)
            {
                if (state)
                {
                    if (!allowSwitchOff)
                    {
                        if (isSelected)
                        {
                            this.StartTween(this.m_RectTransform.rect.height, this.m_MinHeight);
                        }
                        else
                        {
                            this.StartTween(this.m_MinHeight, this.GetExpandedHeight());
                        }
                        isSelected = !isSelected;
                    }
                    else
                    {
                        isSelected = true;
                        this.StartTween(this.m_MinHeight, this.GetExpandedHeight());
                    }
                }
                else
                {
                    isSelected = false;
                    this.StartTween(this.m_RectTransform.rect.height, this.m_MinHeight);
                }
            }
            if (state)
            {
                m_Accordion.SetIndex(this);
            }
            else
            {
                m_Accordion.SetIndex(null);
            }
        }