예제 #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);
        }
예제 #2
0
파일: AObjectBase.cs 프로젝트: 404Lcc/Lcc
        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);
        }
예제 #3
0
 private void Destroy()
 {
     lccView    = null;
     gameObject = null;
     OnDestroy();
 }
예제 #4
0
        public static T GetView <T>(GameObject gameObject) where T : AObjectBase
        {
            LccView lccView = gameObject.GetChildComponent <LccView>(typeof(T).FullName);

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