Beispiel #1
0
 /// <summary>
 /// 显示默认go, 子类重写
 /// </summary>
 virtual protected void ShowGameObject()
 {
     if (m_gameObject == null)
     {
         //如果没有, 则创建一个空容器
         ShowGameObject(GameObjUtil.CreateGameobj(TypeName), false);
     }
 }
Beispiel #2
0
        //-------∽-★-∽------∽-★-∽--------∽-★-∽CreateChild∽-★-∽--------∽-★-∽------∽-★-∽--------//

        static public GameObject CreateChildByName(GameObject parent_, string name_)
        {
            GameObject go = GameObjUtil.FindChild(parent_, name_);

            if (go == null)
            {
                //还没创建
                go = GameObjUtil.CreateGameobj(name_);
                GameObjUtil.ChangeParent(go, parent_);
            }

            return(go);
        }
Beispiel #3
0
        static public T CreateChildByName <T>(GameObject parent_, string name_) where T : Component
        {
            GameObject go = GameObjUtil.FindChild(parent_, name_);

            if (go == null)
            {
                //还没创建
                go = GameObjUtil.CreateGameobj(name_);
                GameObjUtil.ChangeParent(go, parent_);
            }

            T cmpt = ComponentUtil.EnsureComponent <T>(go);

            return(cmpt);
        }
Beispiel #4
0
        //初始化容器
        protected void InitGameObject(string name_)
        {
            if (m_gameObject)
            {
                return;
            }

            string name = string.IsNullOrEmpty(name_) ? this.GetType().Name : name_;    //容器名称

            m_gameObject          = GameObjUtil.CreateGameobj(name);
            m_gameObject.isStatic = true;   //设置为静态对象
            m_transform           = m_gameObject.transform;

            GameObjUtil.DontDestroyOnLoad(m_gameObject);

            AllocPoolPos(m_gameObject);
        }
Beispiel #5
0
        static void __Setup()
        {
            m_appBhv = ComponentUtil.EnsureComponent <CCAppBhv>(m_gRoot);

            if (!m_trash)
            {
                m_trash = GameObjUtil.CreateGameobj("Trash");
                GameObjUtil.DontDestroyOnLoad(m_trash);
                m_trash.transform.position = new Vector3(-1000, -1000, -1000);
                m_trash.isStatic           = true; //设置为静态对象
            }


            m_resMgr = m_resMgr ?? new ResMgr();
            m_resMgr.Setup();

            m_soundMgr = m_soundMgr ?? new SoundMgr(m_gRoot);
            m_soundMgr.Setup();

            m_keyboard.Setup();

            m_classPools = ClassPools.me;

            //
            TimerMgr.inst.Setup();
            //
            ActionMgr.inst.Setup();
            //
            UserPrefs.Setup();

            if (CCDefine.DEBUG)
            {
                //显示帧频
                ComponentUtil.EnsureComponent <FpsTicker>(m_gRoot);
            }


            LogFile.Run();
        }