Beispiel #1
0
 public LocalResVerModel(LocalDataModel localDataModel)
 {
     _localDataModel = localDataModel;
     _vo             = _localDataModel.LocalResVO;
     if (_vo.items == null)
     {
         _vo.items = new ResVerVO.Item[0];
     }
     else
     {
         ConformingLocalRes();
     }
 }
Beispiel #2
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);
                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开发环境
#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);
                    localResDir = FileSystem.CombineDirs(true, Directory.GetParent(Application.dataPath).FullName, "Caches");
                }
                else
                {
                    netResDir   = FileSystem.CombineDirs(true, _vo.localResRoot, platform);
                    localResDir = netResDir;
                }
                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);
        }