Пример #1
0
        //-------∽-★-∽------∽-★-∽--------∽-★-∽gameobject管理∽-★-∽--------∽-★-∽------∽-★-∽--------//

        public GameObject CreateGo(string url_, CALLBACK_GO onComplete_)
        {
            url_ = url_.ToLower();

            GameObject prefab = m_assetCache.GetAsset(url_) as GameObject;

            if (prefab == null)
            {
                Log.Assert("gameobject未加载:" + url_);
                return(null);
            }

            GameObject go = GameObjUtil.CreateGameObj(prefab);

            GameObjUtil.DontDestroyOnLoad(go);  //所有加载出来的go都是默认不销毁

            AddGo(url_, go);

            if (onComplete_ != null)
            {
                onComplete_(go);
            }

            return(go);
        }
Пример #2
0
 //public bool ignoreRestart = false;
 void Awake()
 {
     //if (!ignoreRestart)
     //{
     //    ResMgr.AddImmortalObject(gameObject);
     //}
     GameObjUtil.DontDestroyOnLoad(gameObject);
     Destroy(this);
 }
Пример #3
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);
        }
Пример #4
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();
        }