Пример #1
0
        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;
        }
Пример #2
0
        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);
        }
Пример #3
0
 public virtual bool CheckElementModel(ViewModelBinding binding)
 {
     return(true);
 }
Пример #4
0
 protected void BacktoCache(ViewModelBinding binding)
 {
     binding.gameObject.SetActive(false);
     unusedChildList.Add(binding);
 }
Пример #5
0
 void RemoveChildViewmodelBinding(ViewModelBinding binding)
 {
     childModelBinding.Remove(binding);
 }
Пример #6
0
 void AddChildViewModelBinding(ViewModelBinding binding)
 {
     childModelBinding.Add(binding);
 }