Exemplo n.º 1
0
        public void InitObject(GameObject gameObject, object data = null)
        {
            this.gameObject = gameObject;
            AutoReference();
            GameObject childGameObject = new GameObject(GetType().FullName);

            childGameObject.transform.SetParent(gameObject.transform);
            childGameObject.transform.localPosition = Vector3.zero;
            childGameObject.transform.localRotation = Quaternion.identity;
            childGameObject.transform.localScale    = Vector3.one;
            lccView              = childGameObject.AddComponent <LccView>();
            lccView.className    = GetType().FullName;
            lccView.type         = this;
            lccView.awake       += Awake;
            lccView.onEnable    += OnEnable;
            lccView.start       += Start;
            lccView.fixedUpdate += FixedUpdate;
            lccView.update      += Update;
            lccView.lateUpdate  += LateUpdate;
            lccView.onDisable   += OnDisable;
            lccView.onDestroy   += Destroy;
            if (gameObject.activeSelf)
            {
                Awake();
            }
            InitData(data);
        }
Exemplo n.º 2
0
        public void InitObject(GameObject gameObject, object data = null)
        {
            this.gameObject = gameObject;
            id = IdUtil.Generate();
            AutoReference();
            GameObject childGameObject = new GameObject(GetType().FullName);

            childGameObject.transform.SetParent(gameObject.transform);
            childGameObject.transform.localPosition = Vector3.zero;
            childGameObject.transform.localRotation = Quaternion.identity;
            childGameObject.transform.localScale    = Vector3.one;
            lccView           = childGameObject.AddComponent <LccView>();
            lccView.className = GetType().Name;
            lccView.type      = this;
            InitData(data);
            ObjectBaseEventSystem.Instance.Register(this);
        }
Exemplo n.º 3
0
 private void Destroy()
 {
     lccView    = null;
     gameObject = null;
     OnDestroy();
 }
Exemplo n.º 4
0
        public static T GetView <T>(GameObject gameObject) where T : AObjectBase
        {
            LccView lccView = gameObject.GetChildComponent <LccView>(typeof(T).FullName);

            return(lccView.GetType <T>());
        }