Example #1
0
        internal override void OnCreateDestroyClicked()
        {
            if (SubIValue == null)
            {
                var value = UnderlyingValue ?? Activator.CreateInstance(ElementType);

                SubIValue       = Create(value, ElementType);
                SubIValue.Owner = this.Owner;
                SubIValue.m_mainContentParent = this.m_mainContentParent;
                SubIValue.m_subContentParent  = this.m_subContentParent;

                SubIValue.ConstructUI(m_valueContent, m_uiSubGroupParent);
                m_createDestroyBtn.transform.SetAsLastSibling();
            }
            else
            {
                SubIValue.OnDestroy();
                SubIValue = null;
                if (m_subContentParent.gameObject.activeSelf)
                {
                    m_subContentParent.gameObject.SetActive(false);
                }
            }

            this.Owner.SetValue();
            this.OnValueUpdated();
            RefreshElementsAfterUpdate();
            UpdateCreateDestroyBtnState();
        }
Example #2
0
 public override void CreateIValue(object value, Type fallbackType)
 {
     IValue       = InteractiveValue.Create(value, fallbackType, true);
     IValue.Owner = this;
     IValue.m_mainContentParent = this.m_rightGroup;
     IValue.m_subContentParent  = this.m_subContent;
 }
 public override void CreateIValue(object value, Type fallbackType)
 {
     IValue       = InteractiveValue.Create(value, fallbackType);
     IValue.Owner = this;
     if (m_rowObj)
     {
         IValue.m_mainContentParent = m_rowObj;
     }
 }
        public virtual void UpdateValue()
        {
            var value = IValue.Value;

            // if the type has changed fundamentally, make a new interactivevalue for it
            var type = value == null
                ? FallbackType
                : value.GetType();

            var ivalueType = InteractiveValue.GetIValueForType(type);

            if (ivalueType != IValue?.GetType())
            {
                IValue.OnDestroy();
                CreateIValue(value, FallbackType);
                m_subContent?.SetActive(false);
            }

            IValue.OnValueUpdated();
        }
Example #5
0
        public override void OnValueUpdated()
        {
            base.OnValueUpdated();

            if (UnderlyingValue == null && SubIValue != null)
            {
                SubIValue = null;
            }
            else if (UnderlyingValue != null && SubIValue == null)
            {
                SubIValue       = Create(UnderlyingValue, ElementType);
                SubIValue.Owner = this.Owner;
                SubIValue.m_mainContentParent = this.m_mainContentParent;
                SubIValue.m_subContentParent  = this.m_subContentParent;
                SubIValue.ConstructUI(m_valueContent, m_uiSubGroupParent);
                m_createDestroyBtn.transform.SetAsLastSibling();
            }

            SubIValue?.OnValueUpdated();
            RefreshUIForValue();
        }