コード例 #1
0
    //
#if UNITY_ANDROID && (!UNITY_EDITOR)
    /// <summary>
    /// 复制StreamingAsset资源
    /// </summary>
    private void CopyAssetDirectory()
    {
        if (GloablDefine.resbasePathList.Count > 0 && resbaseIndex < GloablDefine.resbasePathList.Count)
        {
            var           resbasePath     = GloablDefine.resbasePathList[resbaseIndex];
            var           fullresbasePath = Path.Combine(StreamingAssetHelper.AssetPathDir, resbasePath);
            DirectoryInfo directoryInfo   = new DirectoryInfo(fullresbasePath);
            resbaseIndex++;
            //Debug.LogWarning("------------------------>resbasePath" + fullresbasePath);
            //Debug.LogWarning("------------------------>resbasePath Is Exist" + directoryInfo.Exists);
            if (!directoryInfo.Exists)
            {
                UICopyingAssetHelper.Instance().UpdateUI(resbaseIndex, GloablDefine.resbasePathList.Count, "首次运行游戏正在解压资源...");
                StreamingAssetHelper.CopyAssetDirectoryInThread(resbasePath, resbasePath, OnCopyAssetDirectoryNext);
            }
            else
            {
                OnCopyAssetDirectoryNext(true);
            }
        }
        else
        {
            OnCopyAssetDirectoryFinished();
        }
    }
コード例 #2
0
    void Awake()
    {
        instance    = this;
        gameManager = GameManager.Instance;
        DOTween.Init();
        Screen.sleepTimeout = SleepTimeout.NeverSleep;
#if UNITY_STANDALONE_WIN
        Screen.SetResolution(1280, 720, false);
#endif
        Application.targetFrameRate = AppConst.GameFrameRate;

        DontDestroyOnLoad(gameObject);

        //加入输入输出管理器
        inputMgr = gameObject.AddComponent <InputMgr>();

#if SHOW_FPS
        fpsHelperObj = new GameObject("FpsHelperObj");
        fpsHelper    = fpsHelperObj.AddComponent <FPSHelper>();
        GameObject.DontDestroyOnLoad(fpsHelperObj);
#endif

        if (AppConst.isLocalGameServer)
        {
            var ServerObj = new GameObject("SimulateServer");
            ServerObj.AddComponent <ColaFramework.NetWork.SimulateServer>();
            GameObject.DontDestroyOnLoad(ServerObj);
        }

#if BUILD_DEBUG_LOG || UNITY_EDITOR
#if UNITY_2017_1_OR_NEWER
        Debug.unityLogger.logEnabled = true;
#else
        Debug.unityLogger.logEnabled = true;
#endif
#else
#if UNITY_2017_1_OR_NEWER
        Debug.unityLogger.logEnabled = false;
#else
        Debug.logger.logEnabled = false;
#endif
#endif

#if WETEST_SDK
        gameObject.AddComponent <WeTest.U3DAutomation.U3DAutomationBehaviour>();
#endif

#if OUTPUT_LOG
        GameObject logHelperObj = new GameObject("LogHelperObj");
        logHelper = logHelperObj.AddComponent <LogHelper>();
        GameObject.DontDestroyOnLoad(logHelperObj);

        Application.logMessageReceived += logHelper.LogCallback;
#endif
        //初始化多线程工具
        ColaLoom.Initialize();
        StreamingAssetHelper.SetAssetPathDir(assetPath);
    }
コード例 #3
0
    void Awake()
    {
        instance = this;
        InitPath();
        gameManager         = GameManager.GetInstance();
        Screen.sleepTimeout = SleepTimeout.NeverSleep;
#if UNITY_STANDALONE_WIN
        Screen.SetResolution(1280, 720, false);
#endif

        DontDestroyOnLoad(gameObject);
        //加入输入输出管理器
        inputMgr = gameObject.AddComponent <InputMgr>();

#if SHOW_FPS
        fpsHelperObj = new GameObject("FpsHelperObj");
        fpsHelper    = fpsHelperObj.AddComponent <FPSHelper>();
        GameObject.DontDestroyOnLoad(fpsHelperObj);
#endif

#if BUILD_DEBUG_LOG || UNITY_EDITOR
#if UNITY_2017
        Debug.unityLogger.logEnabled = true;
#else
        Debug.unityLogger.logEnabled = true;
#endif
#else
#if UNITY_2017
        Debug.unityLogger.logEnabled = false;
#else
        Debug.logger.logEnabled = false;
#endif
#endif

#if WETEST_SDK
        gameObject.AddComponent <WeTest.U3DAutomation.U3DAutomationBehaviour>();
#endif

#if OUTPUT_LOG
        GameObject logHelperObj = new GameObject("LogHelperObj");
        logHelper = logHelperObj.AddComponent <LogHelper>();
        GameObject.DontDestroyOnLoad(logHelperObj);

        Application.logMessageReceived += logHelper.LogCallback;
#endif
        //初始化多线程工具
        ColaLoom.Initialize();
        StreamingAssetHelper.SetAssetPathDir(AssetPath);
    }
コード例 #4
0
 /// <summary>
 /// 复制StreamingAsset资源
 /// </summary>
 private void CopyAssetDirectory()
 {
     if (GloablDefine.resbasePathList.Count > 0 && resbaseIndex < GloablDefine.resbasePathList.Count)
     {
         resbaseIndex++;
         var           resbasePath     = GloablDefine.resbasePathList[resbaseIndex];
         var           fullresbasePath = Path.Combine(StreamingAssetHelper.AssetPathDir, resbasePath);
         DirectoryInfo directoryInfo   = new DirectoryInfo(fullresbasePath);
         Debug.LogWarning("------------------------>resbasePath" + fullresbasePath);
         Debug.LogWarning("------------------------>resbasePath Is Exist" + directoryInfo.Exists);
         if (!directoryInfo.Exists)
         {
             StreamingAssetHelper.CopyAssetDirectoryInThread(resbasePath, resbasePath, OnCopyAssetDirectoryFinished);
         }
     }
 }