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