public virtual void RegisterCallback(TexSerWebReturnTypeEnum p_returnType, FunctionAndParams p_function) { if (p_function != null && (p_function.DelegatePointer != null || (p_function.Target != null && !string.IsNullOrEmpty(p_function.StringFunctionName)))) { ReturnTypePerCallbackDict.Add(p_returnType, p_function); } }
private static ExternImgFile DeserializeFromWebInternal(string p_url, System.Delegate p_callback, object p_target, string p_callBackFunctionName, TexSerWebReturnTypeEnum p_returnType) { //Try pick previous downloader TextureDownloader v_component = TextureDownloader.GetDownloader(p_url); //Create new Downloader (If not downloading yet) bool v_needStartRequest = false; if (v_component == null) { GameObject v_dummyObject = new GameObject("RequestImageFromWWW(Dummy)"); v_component = v_dummyObject.AddComponent <TextureDownloader>(); v_component.Url = p_url; v_needStartRequest = true; } //Register new Callback if (p_callback != null || (p_target != null && !string.IsNullOrEmpty(p_callBackFunctionName))) { var v_function = new Kyub.FunctionAndParams(); v_function.DelegatePointer = p_callback; v_function.Target = p_target; v_function.StringFunctionName = p_callBackFunctionName; v_component.RegisterCallback(p_returnType, v_function); } //Start Request (if not downloading) if (v_needStartRequest) { v_component.StartRequest(); } return(v_component.AsyncRequestOperation); }
public static ExternImgFile DeserializeFromWeb(string p_url, object p_target, string p_callBackFunctionName, TexSerWebReturnTypeEnum p_returnType = TexSerWebReturnTypeEnum.Texture) { return(DeserializeFromWebInternal(p_url, null, p_target, p_callBackFunctionName, p_returnType)); }