namespace Superlazy.UI { public abstract class SLUIObjectOnOff : SLUIComponent { public bool inherit = false; public string bind; protected abstract bool ActiveSelf { get; } public bool Active => (bindParent == null || bindParent.Active) && ActiveSelf; private string finalPath = null; private string oldBind; private string oldParentBind; public virtual string BindPath { get { // bind 개체가 유니티에서 시리얼되기때문에 다른지 체크하는 형태로 우회적용 // 원래는 바인드 객체가 셋될때 finalPath = null 하면 됨 if (bind != oldBind) { oldBind = bind; finalPath = null; } if (bindParent != null && oldParentBind != bindParent.BindPath) { oldParentBind = bindParent.BindPath; finalPath = null; } if (finalPath != null) return finalPath; if (inherit && bindParent != null) { if (string.IsNullOrEmpty(bind) == false) { finalPath = bindParent.BindPath.CombinePath(bind); } else { finalPath = bindParent.BindPath; } } else { finalPath = bind; } return finalPath; } } } }