public virtual void SetViewAsset(GameObject gameObject) { gameObject.name = config.name; this.transform = gameObject.transform; ViewModelBinding binding = gameObject.GetComponent <ViewModelBinding>(); binding.view = this; MonoBehaviourEvent objectEvent = gameObject.AddComponent <MonoBehaviourEvent>(); objectEvent.onStartEvent += OnCreated; objectEvent.onEnableEvent += OnShow; objectEvent.onDisableEvent += OnHide; objectEvent.onDestroyEvent += OnDestroyed; }
protected Transform CreateChild(IModel model, int index) { Transform child; if (index < componentList.childCount) { child = componentList.GetChild(index); } else { child = Object.Instantiate(componentElement.transform, Vector3.zero, Quaternion.identity, componentList); } child.gameObject.SetActive(true); ViewModelBinding binding = child.GetComponent <ViewModelBinding>(); binding.SetModel(model); return(child); }
public virtual bool CheckElementModel(ViewModelBinding binding) { return(true); }
protected void BacktoCache(ViewModelBinding binding) { binding.gameObject.SetActive(false); unusedChildList.Add(binding); }
void RemoveChildViewmodelBinding(ViewModelBinding binding) { childModelBinding.Remove(binding); }
void AddChildViewModelBinding(ViewModelBinding binding) { childModelBinding.Add(binding); }