internal void Init(ILoadOperator loadOperator, string name, string hash, uint crc, ABLoaderInstance owner) { m_LoadOperator = loadOperator; Name = name; Hash = hash; CRC = crc; m_Owner = owner; }
public CustomYieldInstruction Initialize(ILoadOperator loadOperator, int maxDownloadCount, int maxLoadCount, Action onSuccess, Action <Exception> onFail) { Log.Debug("[ilib-abloader] Initialize {0}.", loadOperator); bool complete = false; var wait = new WaitUntil(() => complete); //起動済みの際はリセットを先にする必要がある if (State != ABLoaderState.None) { complete = true; Log.Error("[ilib-abloader] already initialized. use ABLoader.Stop()"); onFail?.Invoke(new InvalidOperationException("already initialized. use ABLoader.Stop()")); return(wait); } State = ABLoaderState.Initialize; Cache.Init(loadOperator); m_LoadOperator = loadOperator; m_Downloader = new RequestHander <DownloadRequest>(maxDownloadCount); m_Loader = new RequestHander <LoadOperation>(maxLoadCount); #if UNITY_EDITOR if (ABLoader.UseEditorAsset) { Log.Debug("[ilib-abloader] use editor asset mode."); State = ABLoaderState.Active; onSuccess?.Invoke(); complete = true; return(wait); } #endif var initializer = m_LoadOperator.Init(); initializer.AddCompleteEvent((data, ex) => { complete = true; if (ex != null) { State = ABLoaderState.Error; onFail(ex); } else if (data != null) { State = ABLoaderState.Active; m_BundleData = data; onSuccess?.Invoke(); } }); initializer.DoStart(); return(wait); }
public static void Reset() { Log.Debug("[ilib-abloader] cache reset."); s_LoadOperator = null; s_Exsits.Clear(); }
public static void Init(ILoadOperator loadOperator) { s_LoadOperator = loadOperator; s_Exsits = new HashSet <string>(); }