Exemple #1
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);
        }
Exemple #2
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();
        }