예제 #1
0
    IEnumerator Start()
    {
        if (!Caching.enabled)
        {
            Debug.LogError("対応端末ではありません。");
            yield break;
        }

        while (!Caching.ready)
        {
            yield return(null);
        }

        Caching.maximumAvailableDiskSpace = RequiredDiskSpaceByte;
        DownloadProgresSlider.maxValue    = 1;

        ObservableAssetBundle.Initialize()
        .Subscribe(_ => ObservableAssetBundle.LoadAssetBundle <AudioClip>(AssetBundlePath, AssetName, this)
                   .Subscribe(clip =>
        {
            DownloadProgresSlider.value = 1;
            DonwloadStatusText.text     = "BGMダウンロード完了";

            BgmAudioSource.clip = clip;
            BgmAudioSource.outputAudioMixerGroup = Mixer.FindMatchingGroups("BGM").FirstOrDefault();
            BgmAudioSource.Play();

            AssetBundleManager.UnloadAssetBundle(AssetBundlePath);
        }));
    }
예제 #2
0
    void Start()
    {
        InitializeSourceURL();

        ObservableAssetBundle.Initialize()
        .Subscribe(_ => ObservableAssetBundle.LoadAssetBundle <GameObject> (assetBundlePath, assetName)
                   .Subscribe(assetGameObject => {
            GameObject obj         = Instantiate(assetGameObject) as GameObject;
            obj.transform.position = new Vector3(0.0f, 0.0f, 0.0f);

            AssetBundleManager.UnloadAssetBundle(assetBundlePath);
        }));
    }
예제 #3
0
 // Use this for initialization
 void Start()
 {
     ObservableAssetBundle.Initialize().Subscribe(_ =>
     {
         foreach (var monster in Monsters)
         {
             var obj                = new GameObject("monster" + monster);
             var script             = obj.AddComponent <AssetBundleSpriteImage>();
             script.AssetBundlePath = "monsters";
             script.AssetName       = monster.ToString();
             obj.transform.SetParent(ParentTransform, false);
         }
     });
 }
예제 #4
0
    IEnumerator Start()
    {
        if (!Caching.enabled)
        {
            yield break;
        }

        while (!Caching.ready)
        {
            yield return(null);
        }

        if (string.IsNullOrEmpty(AssetBundlePath))
        {
            yield return(null);
        }

        Sprite sprite;
        var    key = Tuple.Create(AssetBundlePath, AssetName);

        if (Loaded.TryGetValue(key, out sprite))
        {
            _targetImage.sprite  = sprite;
            _targetImage.enabled = true;
            IsDone = true;
            yield break;
        }

        ObservableAssetBundle.Initialize()
        .Subscribe(_ => ObservableAssetBundle.LoadAssetBundle <Sprite>(AssetBundlePath, AssetName)
                   .Subscribe(x =>
        {
            _targetImage.sprite  = x;
            _targetImage.enabled = true;
            IsDone      = true;
            Loaded[key] = x;
        }));
    }