Ejemplo n.º 1
0
        public static AssetsInitRequest Initialize()
        {
            var instance = FindObjectOfType <Assets>();

            if (instance == null)
            {
                instance = new GameObject("Assets").AddComponent <Assets>();
                DontDestroyOnLoad(instance.gameObject);
            }

            Log(string.Format("Initialize->assetBundleMode {0}", Assets.assetBundleMode));

            var protocal = string.Empty;

            if (Application.platform == RuntimePlatform.IPhonePlayer ||
                Application.platform == RuntimePlatform.OSXEditor ||
                Application.platform == RuntimePlatform.WindowsEditor)
            {
                protocal = "file://";
            }
            else if (Application.platform == RuntimePlatform.OSXPlayer ||
                     Application.platform == RuntimePlatform.WindowsPlayer)
            {
                protocal = "file:///";
            }

            if (string.IsNullOrEmpty(dataPath))
            {
                dataPath = Application.streamingAssetsPath;
            }

            platform = getPlatformDelegate != null?getPlatformDelegate() : GetPlatformForAssetBundles(Application.platform);

            var assetBundlePlatform = Path.Combine(AssetBundles, platform);

            assetBundleDataPath         = Path.Combine(dataPath, assetBundlePlatform) + Path.DirectorySeparatorChar;
            assetBundleDataPathURL      = protocal + assetBundleDataPath;
            updatePath                  = Path.Combine(Application.persistentDataPath, assetBundlePlatform) + Path.DirectorySeparatorChar;
            OverrideBaseDownloadingUrl += Bundles_overrideBaseDownloadingURL;

            Versions.Load();

            var request = new AssetsInitRequest();

            request.url = "AssetsInitRequest";
            AddAssetRequest(request);
            return(request);
        }
Ejemplo n.º 2
0
 private void Start()
 {
     state = State.Wait;
     Versions.Load();
     Check();
 }