Ejemplo n.º 1
0
    public void OnDestroy()
    {
        isOnGameRuning      = false;
        OnDeviceStateChage -= OnDeviceStateChange;
        OnDeviceStateChage  = null;
        mainCam             = null;
        Effect.EffectNode.ClearTargetCache();
        ViewConfigManager.Destroy();
        RenderViewAPI.Stop();
        GameLogicAPI.Stop();

        SceneManager.UnRegisterSceneLoadFinishEvent(SceneLoadFinish);

        MouseCursorManager.Instance.DestroyMouseCursroManager();
        FuntionShortCutCtrl.Destroy();
        GUIDE.GuideManager.Destroy();
        SceneEffectManager.Destroy();
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 创建通用逻辑模块,主场景和战斗场景均使用,依赖配置表,通常情况下需要更新资源后再执行
    /// </summary>
    public IEnumerator CreateEnumerator()
    {
        bCreated = false;

        Type[] types = new Type[]
        {
            typeof(AssetSystem),
            typeof(ShaderLib),
            typeof(SceneManager),
            typeof(NatureManager),
            typeof(WarFogManager),
        };

        CreateModulesAsyn(types);

        //wait another coroutine finish
        while (true)
        {
            yield return(new WaitForEndOfFrame());

            bool bOK = (CreatingModules.Count == 0);
            if (bOK)
            {
                break;
            }
        }

        yield return(new WaitForSeconds(0.1f));

        if (!Application.isEditor && System.IO.File.Exists("BreakPoint.txt"))
        {
            GameUtil.MsgBox(m_WindowHwnd, "挂断点", "调试", 0);
        }

        if (!RenderViewAPI.Start())
        {
            Trace.LogError("Game Start Service failure");
            yield break;
        }
        Trace.Log("Game Start Service successed");
        // 初始化
        gameObject.AddComponent <GameViewCommandHandler>();

        OnDeviceStateChage += OnDeviceStateChange;

        // 初始化游戏接口
        IntPtrHelper helper = new IntPtrHelper();

        //GameLogicAPI.Start(ASpeedGame.Data.GameSettingsXml.GameSettingsXmlManager.Instance.GameSettingsModel.enableMultiThread.AValue,
        //    helper.toPtr(ref RenderViewAPI.g_RenderView));
        GameLogicAPI.Start(helper.toPtr(ref RenderViewAPI.g_RenderView));
        yield return(new WaitForSeconds(1.0f));

        PrintTickCheck("初始化逻辑层API,至少等了1秒", CostThreshold_Lv1, _bStart: true);

        // 显示层配置价值
        ViewConfigManager.Init();
        PrintTickCheck("ViewConfigManager.Init");


        //资源是要配置初始化
        AssetBundleManager.Init();
        PrintTickCheck("AssetBundleManager.Init");



        LogicDataCenter.Init();
        PrintTickCheck("LogicDataCenter.Init");



        ImageSetting.Init();
        PrintTickCheck("ImageSetting.Init");

        ImageEffectManager.API_GameStart();
        PrintTickCheck("ImageEffectManager.Init");

        //GameViewCommandHandler.Instance.Start();
        MouseCursorManager.Instance.InitMouseCursorManager();
        PrintTickCheck("MouseCursorManager.Init");

        // 初始化实体接口,依赖上面的物件管理器所以顺序不能换
        EntityFactory.Init();
        PrintTickCheck("EntityFactory.Init");


        PrefabManager.Init();
        PrintTickCheck("PrefabManager.Init");


        SkinManager.Init();
        PrintTickCheck("SkinManager.Init");



        SoundManager.Init();
        PrintTickCheck("SoundManager.Init");

        UISystem.Init();
        PrintTickCheck("UISystem.Init");

        UTopNameManager.Init();
        PrintTickCheck("UTopNameManager.Init");

        USpeedUI.Blood.UBloodManager.Init();
        PrintTickCheck("UBloodManager.Init");



        InputManager.Init();
        PrintTickCheck("InputManager.Init");



        Effect.EffectNode.InitTargetCache();
        PrintTickCheck("Effect.EffectNode.InitTargetCache.Init");

        GUIDE.GuideManager.Init();
        PrintTickCheck(" GUIDE.GuideManager.Init");

        SceneEffectManager.Init();
        PrintTickCheck("SceneEffectManager.Init");
        if (LightingEffectFactory.Instance)
        {
            LightingEffectFactory.Instance.InitWhenGameStart();
        }
        PrintTickCheck("LightingEffectFactory.Init");

        SafeZoneEffectManager.Init();
        PrintTickCheck("SafeZoneEffectManager.Init");

        ImageSetting.TraceSettings();

        bCreated = true;

        List <string> argList = new List <string>();

        argList.AddRange(System.Environment.GetCommandLineArgs());

        CkeckUpdateOk(ref argList);
        PrintTickCheck("CkeckUpdateOk");

        CheckMultclient();
        PrintTickCheck("CheckMultclient");

        StageManager.Init();
        AssetBundleManager.DeleteAssets(ref LoadingWaitngResNode, true);
    }