コード例 #1
0
 protected AbstractBundle(IBundleData bundledata, Framework framework)
 {
     resolveState    = ResolveState.Unresolved;
     state           = BundleState.Installed;
     this.bundledata = (BaseData)bundledata;
     this.bundledata.SetBundle(this);
     this.framework  = framework;
     statechangeLock = new AutoResetEvent(true);
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        /// <summary>
        /// 根据插件数据对象创建插件对象
        /// </summary>
        /// <param name="bundledata"></param>
        /// <param name="framework"></param>
        /// <param name="isSetBundle"></param>
        /// <returns></returns>
        internal static AbstractBundle CreateBundle(IBundleData bundledata, Framework framework, bool isSetBundle)
        {
            AbstractBundle result;

            if (bundledata.BundleType == BundleType.Fragment)
            {
                result = new BundleFragment(bundledata, framework);
            }
            else
            {
                result = new BundleHost(bundledata, framework);
            }
            if (isSetBundle)
            {
                bundledata.SetBundle(result);
            }
            return(result);
        }
コード例 #4
0
ファイル: BundleFragment.cs プロジェクト: zhaoyin/officeOBA
 public BundleFragment(IBundleData bundledata, Framework framework)
     : base(bundledata, framework)
 {
     hosts = null;
 }
コード例 #5
0
 protected void Success(IBundleData data)
 {
     m_onComplete(data, null);
 }
コード例 #6
0
 public ProductionService(IBundleData bundleData, IPolicyData policyData, IProductData productData)
 {
     bundleDataAccess = bundleData;
     policyDataAccess = policyData;
     productDataAccess = productData;
 }
コード例 #7
0
ファイル: BundleHost.cs プロジェクト: zhaoyin/officeOBA
 public BundleHost(IBundleData bundledata, Framework framework)
     : base(bundledata, framework)
 {
     context   = null;
     fragments = null;
 }