public static Texture2D RequestDownload(string strAssetPath, PostProcPerItem callbackDelegate, object obj)
    {
        Texture2D texture2D = null;
        WWWItem   wWWItem   = Holder.TryGetOrCreateBundle(strAssetPath + Option.extAsset, null);

        if (wWWItem != null && (wWWItem.isCanceled || !wWWItem.canAccessAssetBundle))
        {
            wWWItem.SetItemType(ItemType.TEXTURE2D);
            wWWItem.SetCallback(callbackDelegate, obj);
            TsImmortal.bundleService.RequestDownloadCoroutine(wWWItem, DownGroup.RUNTIME, true);
        }
        if (!(wWWItem.mainAsset == null))
        {
            texture2D = (wWWItem.mainAsset as Texture2D);
            DrawTexture drawTexture = obj as DrawTexture;
            if (drawTexture != null)
            {
                CharChangeMainDlg.SetTexture(drawTexture, texture2D);
            }
            else
            {
                GameObject gameObject = obj as GameObject;
                if (gameObject != null)
                {
                    CharChangeMainDlg.SetCharFaceTexture(gameObject, texture2D);
                }
            }
        }
        return(texture2D);
    }
Example #2
0
    public Texture2D RequestDownloads(string strAssetPath, PostProcPerItem callbackDelegate, object objs)
    {
        Texture2D texture2D = null;
        WWWItem   wWWItem   = Holder.TryGetOrCreateBundle(strAssetPath + Option.extAsset, null);

        if (wWWItem != null && (wWWItem.isCanceled || !wWWItem.canAccessAssetBundle))
        {
            wWWItem.SetItemType(ItemType.TEXTURE2D);
            wWWItem.SetCallback(callbackDelegate, objs);
            TsImmortal.bundleService.RequestDownloadCoroutine(wWWItem, DownGroup.RUNTIME, true);
        }
        if (wWWItem.mainAsset == null)
        {
            TsLog.LogWarning("wItem.mainAsset is null -> Path = {0}", new object[]
            {
                wWWItem.assetPath
            });
        }
        else
        {
            texture2D = (wWWItem.mainAsset as Texture2D);
            DrawTexture[] array  = objs as DrawTexture[];
            DrawTexture[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                DrawTexture drawTexture = array2[i];
                if (drawTexture != null)
                {
                    drawTexture.SetTexture(texture2D);
                }
            }
        }
        return(texture2D);
    }
        public static void REQ_ASSETBUNDLE(string resPath, PostProcPerItem callback, object obj)
        {
            WWWItem wWWItem = Holder.TryGetOrCreateBundle(resPath, null);

            wWWItem.SetItemType(ItemType.USER_ASSETB);
            wWWItem.SetCallback(callback, obj);
            TsImmortal.bundleService.RequestDownloadCoroutine(wWWItem, DownGroup.RUNTIME, false);
        }
    private void EffectLoad(string effect, PostProcPerItem callback, object callbackParam)
    {
        string  str     = string.Format("{0}", "UI/Soldier/" + effect + NrTSingleton <UIDataManager> .Instance.AddFilePath);
        WWWItem wWWItem = Holder.TryGetOrCreateBundle(str + Option.extAsset, NkBundleCallBack.UIBundleStackName);

        wWWItem.SetItemType(ItemType.USER_ASSETB);
        wWWItem.SetCallback(callback, callbackParam);
        TsImmortal.bundleService.RequestDownloadCoroutine(wWWItem, DownGroup.RUNTIME, true);
    }
    public void RequestBundleImage(string bundlepath, PostProcPerItem callbackDelegate, object callBackParam, bool unloadAfterPostProcess = true)
    {
        string  str     = string.Format("{0}{1}", bundlepath, NrTSingleton <UIDataManager> .Instance.AddFilePath);
        WWWItem wWWItem = Holder.TryGetOrCreateBundle(str + Option.extAsset, MsgHandler.HandleReturn <string>("UIBundleStackName", new object[0]));

        wWWItem.SetItemType(ItemType.USER_ASSETB);
        wWWItem.SetCallback(callbackDelegate, callBackParam);
        TsImmortal.bundleService.RequestDownloadCoroutine(wWWItem, DownGroup.RUNTIME, unloadAfterPostProcess);
    }
    public void RequestCharImage(string imageKey, eCharImageType type, PostProcPerItem callbackDelegate)
    {
        string  arg     = this._ImagePath(type);
        string  str     = string.Format("{0}/{1}", arg, imageKey + NrTSingleton <UIDataManager> .Instance.AddFilePath);
        WWWItem wWWItem = Holder.TryGetOrCreateBundle(str + Option.extAsset, MsgHandler.HandleReturn <string>("UIBundleStackName", new object[0]));

        wWWItem.SetItemType(ItemType.USER_ASSETB);
        wWWItem.SetCallback(callbackDelegate, imageKey);
        TsImmortal.bundleService.RequestDownloadCoroutine(wWWItem, DownGroup.RUNTIME, true);
    }
Example #7
0
        public static void LoadAsyncFromWWW(string strKey, PostProcPerItem callback, object param, string bundleStackName)
        {
            string  key     = strKey.ToLower();
            WWWItem wWWItem = Holder.TryGetOrCreateBundle(key, bundleStackName);

            wWWItem.SetItemType(ItemType.TEXTURE2D);
            ResourceCache.WWWDownloader wWWDownloader = ObjectPoolManager.Acquire <ResourceCache.WWWDownloader>(callback);
            wWWDownloader.SetParam(param);
            wWWItem.SetCallback(new PostProcPerItem(wWWDownloader.OnCompleteDonwload), wWWDownloader);
            TsImmortal.bundleService.RequestDownloadCoroutine(wWWItem, DownGroup.RUNTIME, true);
        }
 public void SetCallback(PostProcPerItem callbackDelegate, object callbackParam)
 {
     if (callbackDelegate != null)
     {
         if (this.callbackList == null)
         {
             this.callbackList = new List <WWWItem.CbParamObj>();
         }
         this.callbackList.Add(new WWWItem.CbParamObj(callbackDelegate, callbackParam));
     }
 }
Example #9
0
        public bool RequestUIBundleDownLoad(string path, PostProcPerItem callbackDelegate, object callbackParam)
        {
            WWWItem wWWItem = Holder.TryGetOrCreateBundle(path + Option.extAsset, MsgHandler.HandleReturn <string>("UIBundleStackName", new object[0]));

            wWWItem.SetItemType(ItemType.USER_ASSETB);
            wWWItem.SetCallback(callbackDelegate, callbackParam);
            if (wWWItem != null)
            {
                TsImmortal.bundleService.RequestDownloadCoroutine(wWWItem, DownGroup.RUNTIME, true);
                return(true);
            }
            return(false);
        }
 public static bool RequestDownloadWebFile(string url, bool unloadAfterPostProcess, PostProcPerItem downlaodCompleteCallbak)
 {
     return(Helper.RequestDownloadWebFile(url, unloadAfterPostProcess, downlaodCompleteCallbak, null));
 }
        public static bool RequestDownloadWebFile(string url, bool unloadAfterPostProcess, PostProcPerItem downlaodCompleteCallbak, object callbackParam)
        {
            if (!Helper._CheckUrl(url))
            {
                return(false);
            }
            WWWItem wWWItem = Holder.TryGetOrCreateBundle(url, Helper.WebFileBundleStackName, true);

            if (wWWItem == null)
            {
                return(false);
            }
            wWWItem.SetItemType(ItemType.USER_BYTESA);
            wWWItem.SetCallback(downlaodCompleteCallbak, callbackParam);
            TsImmortal.bundleService.RequestDownloadCoroutine(wWWItem, DownGroup.RUNTIME, unloadAfterPostProcess);
            return(true);
        }
Example #12
0
 public void OnCreate(object param)
 {
     this.callback = (param as PostProcPerItem);
     TsLog.Assert(param != null, "WWWDownloader.OnCreate(param) param is null!", new object[0]);
 }
 public CbParamObj(PostProcPerItem callbackDelegate, object callbackParam)
 {
     this.callbackDelegate = callbackDelegate;
     this.callbackParam    = callbackParam;
 }
    public bool _RequestDownload(TsAudio.RequestData requestData, PostProcPerItem onEvent)
    {
        if (string.IsNullOrEmpty(this.m_assetBundleName))
        {
            return(false);
        }
        if (onEvent == null)
        {
            return(false);
        }
        if (TsAudio.IsDisableDownloadAudio(requestData.baseData.AudioType))
        {
            return(true);
        }
        if (TsAudio.IsDisableDownloadByTag(requestData.baseData.Tag))
        {
            return(true);
        }
        bool   unloadAfterPostProcess = false;
        string stackName;

        if (requestData.baseData.IsDontDestroyOnLoad)
        {
            stackName = Option.IndependentFromStageStackName;
            unloadAfterPostProcess = true;
        }
        else
        {
            stackName = TsAudio.AssetBundleStackName;
            if (requestData.baseData.AudioType == EAudioType.BGM || requestData.baseData.AudioType == EAudioType.AMBIENT || requestData.baseData.AudioType == EAudioType.ENVIRONMENT)
            {
                unloadAfterPostProcess = true;
            }
        }
        if (!this.m_bMuteAudio)
        {
            string text = string.Empty;
            if (requestData.baseData.AudioType == EAudioType.BGM_STREAM)
            {
                text = this.m_assetPathOfAudioClip.Replace("Assets/", string.Empty);
                text = text.Replace("wav", "mp3");
            }
            else
            {
                text = string.Format("{0}_mobile{1}", this.DownloadPath.Replace(TsAudioBundleInfo.Ext, string.Empty), TsAudioBundleInfo.Ext);
            }
            WWWItem wWWItem = Holder.TryGetOrCreateBundle(text, stackName);
            if (requestData.baseData.AudioType == EAudioType.BGM_STREAM)
            {
                wWWItem.SetItemType(ItemType.USER_AUDIO);
            }
            else
            {
                wWWItem.SetItemType(ItemType.AUDIO);
            }
            wWWItem.SetCallback(onEvent, requestData);
            wWWItem.SetLoadAll(true);
            TsImmortal.bundleService.RequestDownloadCoroutine(wWWItem, DownGroup.RUNTIME, unloadAfterPostProcess);
            this.IsRequestDownloaded = true;
        }
        return(true);
    }