コード例 #1
0
        public static void CoreInit()
        {
            //设置横屏显示
            Screen.orientation = ScreenOrientation.AutoRotation;
            Screen.autorotateToLandscapeLeft      = true;
            Screen.autorotateToLandscapeRight     = true;
            Screen.autorotateToPortrait           = false;
            Screen.autorotateToPortraitUpsideDown = false;

            //所有全局组件挂在CoreRoot对象下,CoreRoot对象被设为加载场景时不被删除,保证它的全局存在
            //GameObject go = new GameObject("CoreRoot");



            if (m_baseTool == null)
            {
                m_baseTool = CoreRootObj.AddComponent <BaseTool>();
            }

            //    if (    m_teamMgr   ==null )
            //m_teamMgr = CoreRootObj.AddComponent<TeamMgr>();

            //         if (m_challengeTeamManager == null)
            //         m_challengeTeamManager = CoreRootObj.AddComponent<ChallengeTeamManager>();

            if (m_skillMgr == null)
            {
                m_skillMgr = CoreRootObj.AddComponent <SkillMgr>();
            }

            //if (m_skillComboMgr == null)
            //    m_skillComboMgr = CoreRootObj.AddComponent<SkillComboMgr>();

            if (m_gameDBMgr == null)
            {
                m_gameDBMgr = CoreRootObj.AddComponent <GameDBMgr>();
            }


            if (m_objPoolMgr == null)
            {
                m_objPoolMgr = CoreRootObj.AddComponent <ObjectPoolManager>();
            }

            if (m_GameObjPoolMgr == null)
            {
                m_GameObjPoolMgr = CoreRootObj.AddComponent <GameObjPoolMgr>();
            }

            if (m_behaviacSys == null)
            {
                m_behaviacSys = CoreRootObj.AddComponent <BehaviacSystem>();
            }

            if (m_gameMgr == null)
            {
                m_gameMgr = CoreRootObj.AddComponent <GameLogicMgr>();
            }

            if (eventTouchMono == null)
            {
                eventTouchMono = CoreRootObj.AddComponent <EventTouchMono>();
            }

            //        TaskMgr task = TaskMgr.Instance;
            //        NpcMgr npc = NpcMgr.Instance;
            //        DungeonMgr dungeon = DungeonMgr.Instance;
            if (null == m_sceneObjMgr)
            {
                m_sceneObjMgr = CoreRootObj.AddComponent <SceneObjMgr>();
            }
            MoveDispatcher.Instance.Init();

            if (null == m_morphMgr)
            {
                m_morphMgr = CoreRootObj.AddComponent <MorphMgr>();
            }
        }
コード例 #2
0
        public override void Init()
        {
            //避免多次初始化
            //DontDestroyOnLoad(CoreRootObj);

            Shader.DisableKeyword("_FOG_ON");
            Shader.DisableKeyword("DISTORT_OFF");


            //byte[] byteConfig = NGUITools.Load("SoundConfig");
            //if (null != byteConfig)
            //{
            //    string configs = System.Text.Encoding.UTF8.GetString(byteConfig);
            //    string[] userInfo = configs.Split('|');
            //    //启动游戏时读取配置信息进行初始化
            //    CoreEntry.cfg_bMusicToggle = userInfo.Length > 0 ? bool.Parse(userInfo[0]) : true;
            //    CoreEntry.cfg_bEaxToggle = userInfo.Length > 1 ? bool.Parse(userInfo[1]) : true;
            //    CoreEntry.cfg_bQualityToggle = userInfo.Length > 2 ? bool.Parse(userInfo[2]) : true;
            //}

            //byteConfig = NGUITools.Load("PushConfig");
            //if (null != byteConfig)
            //{
            //    string configs = System.Text.Encoding.UTF8.GetString(byteConfig);
            //    LitJson.JsonData data = LitJson.JsonMapper.ToObject(configs);
            //    for (int i = 0; i < data.Count; i++)
            //    {
            //        cfg_bPushToggles[(int)data[i]["id"]] = (bool)data[i]["value"];
            //    }
            //}
            //else
            //{
            //    CsvTable tbl = CsvMgr.Instance.getTable("Push");
            //    foreach (int id in tbl.mIntMap.Keys)
            //    {
            //        cfg_bPushToggles[id] = true;
            //    }
            //}


            //(GameObject.FindObjectOfType(typeof(AudioSource)) as AudioSource).mute = !CoreEntry.cfg_bMusicToggle;


            gEventMgr.enabled  = true;
            netMgr.enabled     = true;
            gLogMgr.enabled    = true;
            gResLoader.enabled = true;



            ApplicationFunction af = CoreRootObj.GetComponent <ApplicationFunction>();

            //增加应用响应对象
            if (af == null)
            {
                af = CoreRootObj.AddComponent <ApplicationFunction>();
                //UI限制帧数只在一开始处理,防止重复被调用
                SetUIFrameRate();
            }
            af.netMgr = netMgr;

            //MsgPush push = CoreRootObj.GetComponent<MsgPush>();
            //if( push == null)
            //{
            //    push = CoreRootObj.AddComponent<MsgPush>();
            //}

            ActorDisplayMgr.Instance.Init();
        }