Ejemplo n.º 1
0
        public void Init(RuntimeVO vo)
        {
            _vo = vo;
            //日志控制
            Log.isActive = vo.logEnable;

            switch (Application.platform)
            {
            case RuntimePlatform.Android:
                //Android真机环境
                platform            = "android";
                streamingAssetsPath = Application.streamingAssetsPath + "/";
                netResDir           = FileSystem.CombineDirs(true, _vo.netRoot, platform);
                localResDir         = FileSystem.CombineDirs(true, Application.persistentDataPath);
                break;

            case RuntimePlatform.IPhonePlayer:
                //IOS真机环境
                platform            = "ios";
                streamingAssetsPath = string.Format("file://{0}/Raw/", Application.dataPath);
                netResDir           = FileSystem.CombineDirs(true, _vo.netRoot, platform);
                localResDir         = FileSystem.CombineDirs(true, Application.persistentDataPath);
                break;

            case RuntimePlatform.WindowsEditor:
            case RuntimePlatform.LinuxEditor:
            case RuntimePlatform.OSXEditor:
                //Editor开发环境
                platform            = "pc";
                streamingAssetsPath = string.Format("file://{0}/StreamingAssets/", Application.dataPath);
                if (_vo.resMode == RuntimeVO.EResMode.NET_LOCAL_DEBUG || _vo.resMode == RuntimeVO.EResMode.NET_LOCAL_AND_RESOURCES_DEBUG)
                {
                    netResDir   = FileSystem.CombineDirs(true, _vo.developResRoot, platform);
                    localResDir = netResDir;
                }
                else
                {
                    netResDir   = FileSystem.CombineDirs(true, _vo.netRoot, platform);
                    localResDir = FileSystem.CombineDirs(true, Directory.GetParent(Application.dataPath).FullName, "Caches");
                }
                break;

            default:
                //其它真机环境
                platform            = "pc";
                streamingAssetsPath = string.Format("file://{0}/StreamingAssets/", Application.dataPath);
                netResDir           = FileSystem.CombineDirs(true, _vo.netRoot, platform);
                localResDir         = FileSystem.CombineDirs(true, Application.dataPath, "StreamingAssets");
                break;
            }

            //确保本地资源目录存在
            if (false == Directory.Exists(localResDir))
            {
                Directory.CreateDirectory(localResDir);
            }

            localData   = new LocalDataModel();
            localResVer = new LocalResVerModel(localData);
        }
Ejemplo n.º 2
0
        public void Init(RuntimeVO vo)
        {
            this.VO = vo;

            //日志控制
            Log.IsActive = vo.isLogEnable;

            switch (Application.platform)
            {
            case RuntimePlatform.Android:
            case RuntimePlatform.IPhonePlayer:
            case RuntimePlatform.WindowsPlayer:
            case RuntimePlatform.WindowsEditor:
            case RuntimePlatform.LinuxEditor:
            case RuntimePlatform.OSXEditor:
                netResDir = FileUtility.CombineDirs(false, VO.netRoot, ZeroConst.PLATFORM_DIR_NAME);
                //开发环境
                if (IsLoadAssetsFromNet)
                {
                    localResDir = ZeroConst.WWW_RES_PERSISTENT_DATA_PATH;
                }
                else
                {
                    localResDir = ZeroConst.PUBLISH_RES_ROOT_DIR;
                }
                break;

            default:
                throw new System.Exception(string.Format("抱歉!Zero暂时不支持平台:{0}", Application.platform));
            }

            generateFilesDir = ZeroConst.GENERATES_PERSISTENT_DATA_PATH;

            //确保本地资源目录存在
            if (false == Directory.Exists(localResDir))
            {
                Directory.CreateDirectory(localResDir);
            }

            if (false == Directory.Exists(generateFilesDir))
            {
                Directory.CreateDirectory(generateFilesDir);
            }

            localData   = new LocalDataModel();
            localResVer = new LocalResVerModel();

            Debug.Log(Log.Zero1("Streaming Assets Dir: {0}", ZeroConst.STREAMING_ASSETS_PATH));
            Debug.Log(Log.Zero1("Net Res Root        : {0}", netResDir));
            Debug.Log(Log.Zero1("Persistent Data Dir : {0}", ZeroConst.PERSISTENT_DATA_PATH));
            Debug.Log(Log.Zero1("Local Res Dir       : {0}", localResDir));
            Debug.Log(Log.Zero1("Generate Files Dir  : {0}", generateFilesDir));
        }
Ejemplo n.º 3
0
        public void Init(RuntimeVO vo)
        {
            _vo = vo;
            //日志控制
            Log.IsActive = vo.isLogEnable;

            switch (Application.platform)
            {
            case RuntimePlatform.Android:
            case RuntimePlatform.IPhonePlayer:
            case RuntimePlatform.WindowsPlayer:
            case RuntimePlatform.WindowsEditor:
            case RuntimePlatform.LinuxEditor:
            case RuntimePlatform.OSXEditor:
                netResDir = FileSystem.CombineDirs(false, _vo.netRoot, ZeroConst.PLATFORM_DIR_NAME);
                //开发环境
                if (IsLoadAssetsFromNet)
                {
                    localResDir = FileSystem.CombineDirs(false, ZeroConst.PERSISTENT_DATA_PATH, "zero", "res");
                }
                else
                {
                    localResDir = FileSystem.CombineDirs(false, Directory.GetParent(Application.dataPath).FullName, "Res", ZeroConst.PLATFORM_DIR_NAME);
                }
                break;

            default:
                throw new System.Exception(string.Format("抱歉!Zero暂时不支持平台:{0}", Application.platform));
            }

            generateFilesDir = FileSystem.CombineDirs(false, ZeroConst.PERSISTENT_DATA_PATH, "zero", "generated");

            //确保本地资源目录存在
            if (false == Directory.Exists(localResDir))
            {
                Directory.CreateDirectory(localResDir);
            }

            if (false == Directory.Exists(generateFilesDir))
            {
                Directory.CreateDirectory(generateFilesDir);
            }

            localData   = new LocalDataModel();
            localResVer = new LocalResVerModel();

            Log.CI(Log.COLOR_ORANGE, "Streaming Assets Dir: {0}", ZeroConst.STREAMING_ASSETS_PATH);
            Log.CI(Log.COLOR_ORANGE, "Net Res Dir         : {0}", netResDir);
            Log.CI(Log.COLOR_ORANGE, "Persistent Data Dir : {0}", ZeroConst.PERSISTENT_DATA_PATH);
            Log.CI(Log.COLOR_ORANGE, "Local Res Dir       : {0}", localResDir);
            Log.CI(Log.COLOR_ORANGE, "Generate Files Dir  : {0}", generateFilesDir);
        }
Ejemplo n.º 4
0
        public void Init(RuntimeVO vo)
        {
            _vo = vo;
            //日志控制
            Log.IsActive = vo.isLogEnable;

            switch (Application.platform)
            {
            case RuntimePlatform.Android:
                //Android真机环境
                platform            = "android";
                streamingAssetsPath = Application.streamingAssetsPath + "/";
                netResDir           = FileSystem.CombineDirs(true, _vo.netRoot, platform);
                persistentDir       = FileSystem.CombineDirs(true, Application.persistentDataPath);
                break;

            case RuntimePlatform.IPhonePlayer:
                //IOS真机环境
                platform            = "ios";
                streamingAssetsPath = string.Format("file://{0}/Raw/", Application.dataPath);
                netResDir           = FileSystem.CombineDirs(true, _vo.netRoot, platform);
                persistentDir       = FileSystem.CombineDirs(true, Application.persistentDataPath);
                break;

            case RuntimePlatform.WindowsEditor:
            case RuntimePlatform.LinuxEditor:
            case RuntimePlatform.OSXEditor:
                //Editor开发环境
#if UNITY_ANDROID
                platform = "android";
#elif UNITY_IPHONE
                platform = "ios";
#else
                platform = "pc";
#endif
                streamingAssetsPath = string.Format("file://{0}/StreamingAssets/", Application.dataPath);
                if (IsLoadAssetsFromNet)
                {
                    netResDir     = FileSystem.CombineDirs(true, _vo.netRoot, platform);
                    persistentDir = FileSystem.CombineDirs(true, Directory.GetParent(Application.dataPath).FullName, "Caches");
                }
                else
                {
                    netResDir     = FileSystem.CombineDirs(true, _vo.localResRoot, platform);
                    persistentDir = FileSystem.CombineDirs(true, Directory.GetParent(Application.dataPath).FullName, "Caches");
                }

                break;

            default:
                //其它真机环境
                platform            = "pc";
                streamingAssetsPath = string.Format("file://{0}/StreamingAssets/", Application.dataPath);
                netResDir           = FileSystem.CombineDirs(true, _vo.netRoot, platform);
                persistentDir       = FileSystem.CombineDirs(true, Application.dataPath, "Caches");
                break;
            }

            localResDir      = FileSystem.CombineDirs(true, persistentDir, "res");
            generateFilesDir = FileSystem.CombineDirs(true, persistentDir, "zero_generated");

            //确保本地资源目录存在
            if (false == Directory.Exists(localResDir))
            {
                Directory.CreateDirectory(localResDir);
            }

            if (false == Directory.Exists(generateFilesDir))
            {
                Directory.CreateDirectory(generateFilesDir);
            }

            localData   = new LocalDataModel();
            localResVer = new LocalResVerModel();
        }