123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295 |
- //------------------------------------------------------------
- // Game Framework
- // Copyright © 2013-2021 loyalsoft. All rights reserved.
- // Homepage: http://www.game7000.com/
- // Feedback: http://www.game7000.com/
- //------------------------------------------------------------
- using GameFramework;
- using GameFramework.Download;
- using GameFramework.FileSystem;
- using GameFramework.ObjectPool;
- using GameFramework.Resource;
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Runtime.InteropServices;
- using UnityEngine;
- using UnityEngine.SceneManagement;
- namespace UnityGameFramework.Runtime
- {
- /// <summary>
- /// 编辑器资源组件。
- /// </summary>
- [DisallowMultipleComponent]
- public sealed class EditorResourceComponent : MonoBehaviour, IResourceManager
- {
- private const int DefaultPriority = 0;
- private static readonly int AssetsStringLength = "Assets".Length;
- [SerializeField]
- private bool m_EnableCachedAssets = true;
- [SerializeField]
- private int m_LoadAssetCountPerFrame = 1;
- [SerializeField]
- private float m_MinLoadAssetRandomDelaySeconds = 0f;
- [SerializeField]
- private float m_MaxLoadAssetRandomDelaySeconds = 0f;
- private string m_ReadOnlyPath = null;
- private string m_ReadWritePath = null;
- private Dictionary<string, UnityEngine.Object> m_CachedAssets = null;
- private GameFrameworkLinkedList<LoadAssetInfo> m_LoadAssetInfos = null;
- private GameFrameworkLinkedList<LoadSceneInfo> m_LoadSceneInfos = null;
- private GameFrameworkLinkedList<UnloadSceneInfo> m_UnloadSceneInfos = null;
- /// <summary>
- /// 获取资源只读区路径。
- /// </summary>
- public string ReadOnlyPath
- {
- get
- {
- return m_ReadOnlyPath;
- }
- }
- /// <summary>
- /// 获取资源读写区路径。
- /// </summary>
- public string ReadWritePath
- {
- get
- {
- return m_ReadWritePath;
- }
- }
- /// <summary>
- /// 获取资源模式。
- /// </summary>
- public ResourceMode ResourceMode
- {
- get
- {
- return ResourceMode.Unspecified;
- }
- }
- /// <summary>
- /// 获取当前变体。
- /// </summary>
- public string CurrentVariant
- {
- get
- {
- return null;
- }
- }
- /// <summary>
- /// 获取单机模式版本资源列表序列化器。
- /// </summary>
- public PackageVersionListSerializer PackageVersionListSerializer
- {
- get
- {
- throw new NotSupportedException("ReadWriteVersionListSerializer");
- }
- }
- /// <summary>
- /// 获取可更新模式版本资源列表序列化器。
- /// </summary>
- public UpdatableVersionListSerializer UpdatableVersionListSerializer
- {
- get
- {
- throw new NotSupportedException("ReadWriteVersionListSerializer");
- }
- }
- /// <summary>
- /// 获取本地只读区版本资源列表序列化器。
- /// </summary>
- public ReadOnlyVersionListSerializer ReadOnlyVersionListSerializer
- {
- get
- {
- throw new NotSupportedException("ReadWriteVersionListSerializer");
- }
- }
- /// <summary>
- /// 获取本地读写区版本资源列表序列化器。
- /// </summary>
- public ReadWriteVersionListSerializer ReadWriteVersionListSerializer
- {
- get
- {
- throw new NotSupportedException("ReadWriteVersionListSerializer");
- }
- }
- /// <summary>
- /// 获取资源包版本资源列表序列化器。
- /// </summary>
- public ResourcePackVersionListSerializer ResourcePackVersionListSerializer
- {
- get
- {
- throw new NotSupportedException("ResourcePackVersionListSerializer");
- }
- }
- /// <summary>
- /// 获取当前资源适用的游戏版本号。
- /// </summary>
- public string ApplicableGameVersion
- {
- get
- {
- throw new NotSupportedException("ApplicableGameVersion");
- }
- }
- /// <summary>
- /// 获取当前内部资源版本号。
- /// </summary>
- public int InternalResourceVersion
- {
- get
- {
- throw new NotSupportedException("InternalResourceVersion");
- }
- }
- /// <summary>
- /// 获取已准备完毕资源数量。
- /// </summary>
- public int AssetCount
- {
- get
- {
- throw new NotSupportedException("AssetCount");
- }
- }
- /// <summary>
- /// 获取已准备完毕资源数量。
- /// </summary>
- public int ResourceCount
- {
- get
- {
- throw new NotSupportedException("ResourceCount");
- }
- }
- /// <summary>
- /// 获取资源组个数。
- /// </summary>
- public int ResourceGroupCount
- {
- get
- {
- throw new NotSupportedException("ResourceGroupCount");
- }
- }
- /// <summary>
- /// 获取或设置资源更新下载地址。
- /// </summary>
- public string UpdatePrefixUri
- {
- get
- {
- throw new NotSupportedException("UpdatePrefixUri");
- }
- set
- {
- throw new NotSupportedException("UpdatePrefixUri");
- }
- }
- /// <summary>
- /// 获取或设置每更新多少字节的资源,重新生成一次版本资源列表。
- /// </summary>
- public int GenerateReadWriteVersionListLength
- {
- get
- {
- throw new NotSupportedException("GenerateReadWriteVersionListLength");
- }
- set
- {
- throw new NotSupportedException("GenerateReadWriteVersionListLength");
- }
- }
- /// <summary>
- /// 获取正在应用的资源包路径。
- /// </summary>
- public string ApplyingResourcePackPath
- {
- get
- {
- throw new NotSupportedException("ApplyingResourcePackPath");
- }
- }
- /// <summary>
- /// 获取等待应用资源数量。
- /// </summary>
- public int ApplyWaitingCount
- {
- get
- {
- throw new NotSupportedException("ApplyWaitingCount");
- }
- }
- /// <summary>
- /// 获取或设置资源更新重试次数。
- /// </summary>
- public int UpdateRetryCount
- {
- get
- {
- throw new NotSupportedException("UpdateRetryCount");
- }
- set
- {
- throw new NotSupportedException("UpdateRetryCount");
- }
- }
- /// <summary>
- /// 获取正在更新的资源组。
- /// </summary>
- public IResourceGroup UpdatingResourceGroup
- {
- get
- {
- throw new NotSupportedException("UpdatingResourceGroup");
- }
- }
- /// <summary>
- /// 获取等待更新资源个数。
- /// </summary>
- public int UpdateWaitingCount
- {
- get
- {
- throw new NotSupportedException("UpdateWaitingCount");
- }
- }
- /// <summary>
- /// 获取使用时下载的等待更新资源数量。
- /// </summary>
- public int UpdateWaitingWhilePlayingCount
- {
- get
- {
- throw new NotSupportedException("UpdateWaitingWhilePlayingCount");
- }
- }
- /// <summary>
- /// 获取候选更新资源数量。
- /// </summary>
- public int UpdateCandidateCount
- {
- get
- {
- throw new NotSupportedException("UpdateCandidateCount");
- }
- }
- /// <summary>
- /// 获取加载资源代理总个数。
- /// </summary>
- public int LoadTotalAgentCount
- {
- get
- {
- throw new NotSupportedException("LoadTotalAgentCount");
- }
- }
- /// <summary>
- /// 获取可用加载资源代理个数。
- /// </summary>
- public int LoadFreeAgentCount
- {
- get
- {
- throw new NotSupportedException("LoadFreeAgentCount");
- }
- }
- /// <summary>
- /// 获取工作中加载资源代理个数。
- /// </summary>
- public int LoadWorkingAgentCount
- {
- get
- {
- throw new NotSupportedException("LoadWorkingAgentCount");
- }
- }
- /// <summary>
- /// 获取等待加载资源任务个数。
- /// </summary>
- public int LoadWaitingTaskCount
- {
- get
- {
- throw new NotSupportedException("LoadWaitingTaskCount");
- }
- }
- /// <summary>
- /// 获取或设置资源对象池自动释放可释放对象的间隔秒数。
- /// </summary>
- public float AssetAutoReleaseInterval
- {
- get
- {
- throw new NotSupportedException("AssetAutoReleaseInterval");
- }
- set
- {
- throw new NotSupportedException("AssetAutoReleaseInterval");
- }
- }
- /// <summary>
- /// 获取或设置资源对象池的容量。
- /// </summary>
- public int AssetCapacity
- {
- get
- {
- throw new NotSupportedException("AssetCapacity");
- }
- set
- {
- throw new NotSupportedException("AssetCapacity");
- }
- }
- /// <summary>
- /// 获取或设置资源对象池对象过期秒数。
- /// </summary>
- public float AssetExpireTime
- {
- get
- {
- throw new NotSupportedException("AssetExpireTime");
- }
- set
- {
- throw new NotSupportedException("AssetExpireTime");
- }
- }
- /// <summary>
- /// 获取或设置资源对象池的优先级。
- /// </summary>
- public int AssetPriority
- {
- get
- {
- throw new NotSupportedException("AssetPriority");
- }
- set
- {
- throw new NotSupportedException("AssetPriority");
- }
- }
- /// <summary>
- /// 获取或设置资源对象池自动释放可释放对象的间隔秒数。
- /// </summary>
- public float ResourceAutoReleaseInterval
- {
- get
- {
- throw new NotSupportedException("ResourceAutoReleaseInterval");
- }
- set
- {
- throw new NotSupportedException("ResourceAutoReleaseInterval");
- }
- }
- /// <summary>
- /// 获取或设置资源对象池的容量。
- /// </summary>
- public int ResourceCapacity
- {
- get
- {
- throw new NotSupportedException("ResourceCapacity");
- }
- set
- {
- throw new NotSupportedException("ResourceCapacity");
- }
- }
- /// <summary>
- /// 获取或设置资源对象池对象过期秒数。
- /// </summary>
- public float ResourceExpireTime
- {
- get
- {
- throw new NotSupportedException("ResourceExpireTime");
- }
- set
- {
- throw new NotSupportedException("ResourceExpireTime");
- }
- }
- /// <summary>
- /// 获取或设置资源对象池的优先级。
- /// </summary>
- public int ResourcePriority
- {
- get
- {
- throw new NotSupportedException("ResourcePriority");
- }
- set
- {
- throw new NotSupportedException("ResourcePriority");
- }
- }
- /// <summary>
- /// 获取等待编辑器加载的资源数量。
- /// </summary>
- public int LoadWaitingAssetCount
- {
- get
- {
- return m_LoadAssetInfos.Count;
- }
- }
- string IResourceManager.ReadOnlyPath => throw new NotImplementedException();
- string IResourceManager.ReadWritePath => throw new NotImplementedException();
- ResourceMode IResourceManager.ResourceMode => throw new NotImplementedException();
- string IResourceManager.CurrentVariant => throw new NotImplementedException();
- PackageVersionListSerializer IResourceManager.PackageVersionListSerializer => throw new NotImplementedException();
- UpdatableVersionListSerializer IResourceManager.UpdatableVersionListSerializer => throw new NotImplementedException();
- ReadOnlyVersionListSerializer IResourceManager.ReadOnlyVersionListSerializer => throw new NotImplementedException();
- ReadWriteVersionListSerializer IResourceManager.ReadWriteVersionListSerializer => throw new NotImplementedException();
- ResourcePackVersionListSerializer IResourceManager.ResourcePackVersionListSerializer => throw new NotImplementedException();
- string IResourceManager.ApplicableGameVersion => throw new NotImplementedException();
- int IResourceManager.InternalResourceVersion => throw new NotImplementedException();
- int IResourceManager.AssetCount => throw new NotImplementedException();
- int IResourceManager.ResourceCount => throw new NotImplementedException();
- int IResourceManager.ResourceGroupCount => throw new NotImplementedException();
- string IResourceManager.UpdatePrefixUri { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- int IResourceManager.GenerateReadWriteVersionListLength { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- string IResourceManager.ApplyingResourcePackPath => throw new NotImplementedException();
- int IResourceManager.ApplyWaitingCount => throw new NotImplementedException();
- int IResourceManager.UpdateRetryCount { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- IResourceGroup IResourceManager.UpdatingResourceGroup => throw new NotImplementedException();
- int IResourceManager.UpdateWaitingCount => throw new NotImplementedException();
- int IResourceManager.UpdateWaitingWhilePlayingCount => throw new NotImplementedException();
- int IResourceManager.UpdateCandidateCount => throw new NotImplementedException();
- int IResourceManager.LoadTotalAgentCount => throw new NotImplementedException();
- int IResourceManager.LoadFreeAgentCount => throw new NotImplementedException();
- int IResourceManager.LoadWorkingAgentCount => throw new NotImplementedException();
- int IResourceManager.LoadWaitingTaskCount => throw new NotImplementedException();
- float IResourceManager.AssetAutoReleaseInterval { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- int IResourceManager.AssetCapacity { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- float IResourceManager.AssetExpireTime { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- int IResourceManager.AssetPriority { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- float IResourceManager.ResourceAutoReleaseInterval { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- int IResourceManager.ResourceCapacity { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- float IResourceManager.ResourceExpireTime { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- int IResourceManager.ResourcePriority { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- #pragma warning disable 0067, 0414
- /// <summary>
- /// 资源应用成功事件。
- /// </summary>
- public event EventHandler<GameFramework.Resource.ResourceApplySuccessEventArgs> ResourceApplySuccess = null;
- /// <summary>
- /// 资源应用失败事件。
- /// </summary>
- public event EventHandler<GameFramework.Resource.ResourceApplyFailureEventArgs> ResourceApplyFailure = null;
- /// <summary>
- /// 资源更新开始事件。
- /// </summary>
- public event EventHandler<GameFramework.Resource.ResourceUpdateStartEventArgs> ResourceUpdateStart = null;
- /// <summary>
- /// 资源更新改变事件。
- /// </summary>
- public event EventHandler<GameFramework.Resource.ResourceUpdateChangedEventArgs> ResourceUpdateChanged = null;
- /// <summary>
- /// 资源更新成功事件。
- /// </summary>
- public event EventHandler<GameFramework.Resource.ResourceUpdateSuccessEventArgs> ResourceUpdateSuccess = null;
- /// <summary>
- /// 资源更新失败事件。
- /// </summary>
- public event EventHandler<GameFramework.Resource.ResourceUpdateFailureEventArgs> ResourceUpdateFailure = null;
- /// <summary>
- /// 资源更新全部完成事件。
- /// </summary>
- public event EventHandler<GameFramework.Resource.ResourceUpdateAllCompleteEventArgs> ResourceUpdateAllComplete = null;
- event EventHandler<GameFramework.Resource.ResourceApplySuccessEventArgs> IResourceManager.ResourceApplySuccess
- {
- add
- {
- // throw new NotImplementedException();
- }
- remove
- {
- // throw new NotImplementedException();
- }
- }
- event EventHandler<GameFramework.Resource.ResourceApplyFailureEventArgs> IResourceManager.ResourceApplyFailure
- {
- add
- {
- throw new NotImplementedException();
- }
- remove
- {
- throw new NotImplementedException();
- }
- }
- event EventHandler<GameFramework.Resource.ResourceUpdateStartEventArgs> IResourceManager.ResourceUpdateStart
- {
- add
- {
- throw new NotImplementedException();
- }
- remove
- {
- throw new NotImplementedException();
- }
- }
- event EventHandler<GameFramework.Resource.ResourceUpdateChangedEventArgs> IResourceManager.ResourceUpdateChanged
- {
- add
- {
- throw new NotImplementedException();
- }
- remove
- {
- throw new NotImplementedException();
- }
- }
- event EventHandler<GameFramework.Resource.ResourceUpdateSuccessEventArgs> IResourceManager.ResourceUpdateSuccess
- {
- add
- {
- throw new NotImplementedException();
- }
- remove
- {
- throw new NotImplementedException();
- }
- }
- event EventHandler<GameFramework.Resource.ResourceUpdateFailureEventArgs> IResourceManager.ResourceUpdateFailure
- {
- add
- {
- throw new NotImplementedException();
- }
- remove
- {
- throw new NotImplementedException();
- }
- }
- event EventHandler<GameFramework.Resource.ResourceUpdateAllCompleteEventArgs> IResourceManager.ResourceUpdateAllComplete
- {
- add
- {
- throw new NotImplementedException();
- }
- remove
- {
- throw new NotImplementedException();
- }
- }
- #pragma warning restore 0067, 0414
- private void Awake()
- {
- m_ReadOnlyPath = null;
- m_ReadWritePath = null;
- m_CachedAssets = new Dictionary<string, UnityEngine.Object>(StringComparer.Ordinal);
- m_LoadAssetInfos = new GameFrameworkLinkedList<LoadAssetInfo>();
- m_LoadSceneInfos = new GameFrameworkLinkedList<LoadSceneInfo>();
- m_UnloadSceneInfos = new GameFrameworkLinkedList<UnloadSceneInfo>();
- BaseComponent baseComponent = GetComponent<BaseComponent>();
- if (baseComponent == null)
- {
- Log.Error("Can not find base component.");
- return;
- }
- if (baseComponent.EditorResourceMode)
- {
- baseComponent.EditorResourceHelper = this;
- enabled = true;
- }
- else
- {
- enabled = false;
- }
- }
- private void Update()
- {
- if (m_LoadAssetInfos.Count > 0)
- {
- int count = 0;
- LinkedListNode<LoadAssetInfo> current = m_LoadAssetInfos.First;
- while (current != null && count < m_LoadAssetCountPerFrame)
- {
- LoadAssetInfo loadAssetInfo = current.Value;
- float elapseSeconds = (float)(DateTime.UtcNow - loadAssetInfo.StartTime).TotalSeconds;
- if (elapseSeconds >= loadAssetInfo.DelaySeconds)
- {
- UnityEngine.Object asset = GetCachedAsset(loadAssetInfo.AssetName);
- if (asset == null)
- {
- #if UNITY_EDITOR
- if (loadAssetInfo.AssetType != null)
- {
- asset = UnityEditor.AssetDatabase.LoadAssetAtPath(loadAssetInfo.AssetName, loadAssetInfo.AssetType);
- }
- else
- {
- asset = UnityEditor.AssetDatabase.LoadMainAssetAtPath(loadAssetInfo.AssetName);
- }
- if (m_EnableCachedAssets && asset != null)
- {
- m_CachedAssets.Add(loadAssetInfo.AssetName, asset);
- }
- #endif
- }
- if (asset != null)
- {
- if (loadAssetInfo.LoadAssetCallbacks.LoadAssetSuccessCallback != null)
- {
- loadAssetInfo.LoadAssetCallbacks.LoadAssetSuccessCallback(loadAssetInfo.AssetName, asset, elapseSeconds, loadAssetInfo.UserData);
- }
- }
- else
- {
- if (loadAssetInfo.LoadAssetCallbacks.LoadAssetFailureCallback != null)
- {
- loadAssetInfo.LoadAssetCallbacks.LoadAssetFailureCallback(loadAssetInfo.AssetName, LoadResourceStatus.AssetError, "Can not load this asset from asset database.", loadAssetInfo.UserData);
- }
- }
- LinkedListNode<LoadAssetInfo> next = current.Next;
- m_LoadAssetInfos.Remove(loadAssetInfo);
- current = next;
- count++;
- }
- else
- {
- if (loadAssetInfo.LoadAssetCallbacks.LoadAssetUpdateCallback != null)
- {
- loadAssetInfo.LoadAssetCallbacks.LoadAssetUpdateCallback(loadAssetInfo.AssetName, elapseSeconds / loadAssetInfo.DelaySeconds, loadAssetInfo.UserData);
- }
- current = current.Next;
- }
- }
- }
- if (m_LoadSceneInfos.Count > 0)
- {
- LinkedListNode<LoadSceneInfo> current = m_LoadSceneInfos.First;
- while (current != null)
- {
- LoadSceneInfo loadSceneInfo = current.Value;
- if (loadSceneInfo.AsyncOperation.isDone)
- {
- if (loadSceneInfo.AsyncOperation.allowSceneActivation)
- {
- if (loadSceneInfo.LoadSceneCallbacks.LoadSceneSuccessCallback != null)
- {
- loadSceneInfo.LoadSceneCallbacks.LoadSceneSuccessCallback(loadSceneInfo.SceneAssetName, (float)(DateTime.UtcNow - loadSceneInfo.StartTime).TotalSeconds, loadSceneInfo.UserData);
- }
- }
- else
- {
- if (loadSceneInfo.LoadSceneCallbacks.LoadSceneFailureCallback != null)
- {
- loadSceneInfo.LoadSceneCallbacks.LoadSceneFailureCallback(loadSceneInfo.SceneAssetName, LoadResourceStatus.AssetError, "Can not load this scene from asset database.", loadSceneInfo.UserData);
- }
- }
- LinkedListNode<LoadSceneInfo> next = current.Next;
- m_LoadSceneInfos.Remove(loadSceneInfo);
- current = next;
- }
- else
- {
- if (loadSceneInfo.LoadSceneCallbacks.LoadSceneUpdateCallback != null)
- {
- loadSceneInfo.LoadSceneCallbacks.LoadSceneUpdateCallback(loadSceneInfo.SceneAssetName, loadSceneInfo.AsyncOperation.progress, loadSceneInfo.UserData);
- }
- current = current.Next;
- }
- }
- }
- if (m_UnloadSceneInfos.Count > 0)
- {
- LinkedListNode<UnloadSceneInfo> current = m_UnloadSceneInfos.First;
- while (current != null)
- {
- UnloadSceneInfo unloadSceneInfo = current.Value;
- if (unloadSceneInfo.AsyncOperation.isDone)
- {
- if (unloadSceneInfo.AsyncOperation.allowSceneActivation)
- {
- if (unloadSceneInfo.UnloadSceneCallbacks.UnloadSceneSuccessCallback != null)
- {
- unloadSceneInfo.UnloadSceneCallbacks.UnloadSceneSuccessCallback(unloadSceneInfo.SceneAssetName, unloadSceneInfo.UserData);
- }
- }
- else
- {
- if (unloadSceneInfo.UnloadSceneCallbacks.UnloadSceneFailureCallback != null)
- {
- unloadSceneInfo.UnloadSceneCallbacks.UnloadSceneFailureCallback(unloadSceneInfo.SceneAssetName, unloadSceneInfo.UserData);
- }
- }
- LinkedListNode<UnloadSceneInfo> next = current.Next;
- m_UnloadSceneInfos.Remove(unloadSceneInfo);
- current = next;
- }
- else
- {
- current = current.Next;
- }
- }
- }
- }
- /// <summary>
- /// 设置资源只读区路径。
- /// </summary>
- /// <param name="readOnlyPath">资源只读区路径。</param>
- public void SetReadOnlyPath(string readOnlyPath)
- {
- if (string.IsNullOrEmpty(readOnlyPath))
- {
- Log.Error("Read-only path is invalid.");
- return;
- }
- m_ReadOnlyPath = readOnlyPath;
- }
- /// <summary>
- /// 设置资源读写区路径。
- /// </summary>
- /// <param name="readWritePath">资源读写区路径。</param>
- public void SetReadWritePath(string readWritePath)
- {
- if (string.IsNullOrEmpty(readWritePath))
- {
- Log.Error("Read-write path is invalid.");
- return;
- }
- m_ReadWritePath = readWritePath;
- }
- /// <summary>
- /// 设置资源模式。
- /// </summary>
- /// <param name="resourceMode">资源模式。</param>
- public void SetResourceMode(ResourceMode resourceMode)
- {
- throw new NotSupportedException("SetResourceMode");
- }
- /// <summary>
- /// 设置当前变体。
- /// </summary>
- /// <param name="currentVariant">当前变体。</param>
- public void SetCurrentVariant(string currentVariant)
- {
- throw new NotSupportedException("SetCurrentVariant");
- }
- /// <summary>
- /// 设置对象池管理器。
- /// </summary>
- /// <param name="objectPoolManager">对象池管理器。</param>
- public void SetObjectPoolManager(IObjectPoolManager objectPoolManager)
- {
- throw new NotSupportedException("SetObjectPoolManager");
- }
- /// <summary>
- /// 设置文件系统管理器。
- /// </summary>
- /// <param name="fileSystemManager">文件系统管理器。</param>
- public void SetFileSystemManager(IFileSystemManager fileSystemManager)
- {
- throw new NotSupportedException("SetFileSystemManager");
- }
- /// <summary>
- /// 设置下载管理器。
- /// </summary>
- /// <param name="downloadManager">下载管理器。</param>
- public void SetDownloadManager(IDownloadManager downloadManager)
- {
- throw new NotSupportedException("SetDownloadManager");
- }
- /// <summary>
- /// 设置解密资源回调函数。
- /// </summary>
- /// <param name="decryptResourceCallback">要设置的解密资源回调函数。</param>
- /// <remarks>如果不设置,将使用默认的解密资源回调函数。</remarks>
- public void SetDecryptResourceCallback(DecryptResourceCallback decryptResourceCallback)
- {
- throw new NotSupportedException("SetDecryptResourceCallback");
- }
- /// <summary>
- /// 设置资源辅助器。
- /// </summary>
- /// <param name="resourceHelper">资源辅助器。</param>
- public void SetResourceHelper(IResourceHelper resourceHelper)
- {
- throw new NotSupportedException("SetResourceHelper");
- }
- /// <summary>
- /// 增加加载资源代理辅助器。
- /// </summary>
- /// <param name="loadResourceAgentHelper">要增加的加载资源代理辅助器。</param>
- public void AddLoadResourceAgentHelper(ILoadResourceAgentHelper loadResourceAgentHelper)
- {
- throw new NotSupportedException("AddLoadResourceAgentHelper");
- }
- /// <summary>
- /// 使用单机模式并初始化资源。
- /// </summary>
- /// <param name="initResourcesCompleteCallback">使用单机模式并初始化资源完成时的回调函数。</param>
- public void InitResources(InitResourcesCompleteCallback initResourcesCompleteCallback)
- {
- throw new NotSupportedException("InitResources");
- }
- /// <summary>
- /// 检查版本资源列表。
- /// </summary>
- /// <param name="latestInternalResourceVersion">最新的内部资源版本号。</param>
- /// <returns>检查版本资源列表结果。</returns>
- public CheckVersionListResult CheckVersionList(int latestInternalResourceVersion)
- {
- throw new NotSupportedException("CheckVersionList");
- }
- /// <summary>
- /// 使用可更新模式并更新版本资源列表。
- /// </summary>
- /// <param name="versionListLength">版本资源列表大小。</param>
- /// <param name="versionListHashCode">版本资源列表哈希值。</param>
- /// <param name="versionListCompressedLength">版本资源列表压缩后大小。</param>
- /// <param name="versionListCompressedHashCode">版本资源列表压缩后哈希值。</param>
- /// <param name="updateVersionListCallbacks">版本资源列表更新回调函数集。</param>
- public void UpdateVersionList(int versionListLength, int versionListHashCode, int versionListCompressedLength, int versionListCompressedHashCode, UpdateVersionListCallbacks updateVersionListCallbacks)
- {
- throw new NotSupportedException("UpdateVersionList");
- }
- /// <summary>
- /// 使用可更新模式并检查资源。
- /// </summary>
- /// <param name="ignoreOtherVariant">是否忽略处理其它变体的资源,若不忽略,将会移除其它变体的资源。</param>
- /// <param name="checkResourcesCompleteCallback">使用可更新模式并检查资源完成时的回调函数。</param>
- public void CheckResources(bool ignoreOtherVariant, CheckResourcesCompleteCallback checkResourcesCompleteCallback)
- {
- throw new NotSupportedException("CheckResources");
- }
- /// <summary>
- /// 使用可更新模式并应用资源包资源。
- /// </summary>
- /// <param name="resourcePackPath">要应用的资源包路径。</param>
- /// <param name="applyResourcesCompleteCallback">使用可更新模式并应用资源包资源完成时的回调函数。</param>
- public void ApplyResources(string resourcePackPath, ApplyResourcesCompleteCallback applyResourcesCompleteCallback)
- {
- throw new NotSupportedException("ApplyResources");
- }
- /// <summary>
- /// 使用可更新模式并更新所有资源。
- /// </summary>
- /// <param name="updateResourcesCompleteCallback">使用可更新模式并更新默认资源组完成时的回调函数。</param>
- public void UpdateResources(UpdateResourcesCompleteCallback updateResourcesCompleteCallback)
- {
- throw new NotSupportedException("UpdateResources");
- }
- /// <summary>
- /// 使用可更新模式并更新指定资源组的资源。
- /// </summary>
- /// <param name="resourceGroupName">要更新的资源组名称。</param>
- /// <param name="updateResourcesCompleteCallback">使用可更新模式并更新指定资源组完成时的回调函数。</param>
- public void UpdateResources(string resourceGroupName, UpdateResourcesCompleteCallback updateResourcesCompleteCallback)
- {
- throw new NotSupportedException("UpdateResources");
- }
- /// <summary>
- /// 停止更新资源。
- /// </summary>
- public void StopUpdateResources()
- {
- throw new NotSupportedException("StopUpdateResources");
- }
- /// <summary>
- /// 校验资源包。
- /// </summary>
- /// <param name="resourcePackPath">要校验的资源包路径。</param>
- /// <returns>是否校验资源包成功。</returns>
- public bool VerifyResourcePack(string resourcePackPath)
- {
- throw new NotSupportedException("VerifyResourcePack");
- }
- /// <summary>
- /// 获取所有加载资源任务的信息。
- /// </summary>
- /// <returns>所有加载资源任务的信息。</returns>
- public TaskInfo[] GetAllLoadAssetInfos()
- {
- throw new NotSupportedException("GetAllLoadAssetInfos");
- }
- /// <summary>
- /// 获取所有加载资源任务的信息。
- /// </summary>
- /// <param name="results">所有加载资源任务的信息。</param>
- public void GetAllLoadAssetInfos(List<TaskInfo> results)
- {
- throw new NotSupportedException("GetAllLoadAssetInfos");
- }
- /// <summary>
- /// 检查资源是否存在。
- /// </summary>
- /// <param name="assetName">要检查资源的名称。</param>
- /// <returns>检查资源是否存在的结果。</returns>
- public HasAssetResult HasAsset(string assetName)
- {
- #if UNITY_EDITOR
- UnityEngine.Object obj = UnityEditor.AssetDatabase.LoadMainAssetAtPath(assetName);
- if (obj == null)
- {
- return HasAssetResult.NotExist;
- }
- HasAssetResult result = obj.GetType() == typeof(UnityEditor.DefaultAsset) ? HasAssetResult.BinaryOnDisk : HasAssetResult.AssetOnDisk;
- obj = null;
- UnityEditor.EditorUtility.UnloadUnusedAssetsImmediate();
- return result;
- #else
- return HasAssetResult.NotExist;
- #endif
- }
- /// <summary>
- /// 异步加载资源。
- /// </summary>
- /// <param name="assetName">要加载资源的名称。</param>
- /// <param name="loadAssetCallbacks">加载资源回调函数集。</param>
- public void LoadAsset(string assetName, LoadAssetCallbacks loadAssetCallbacks)
- {
- LoadAsset(assetName, null, DefaultPriority, loadAssetCallbacks, null);
- }
- /// <summary>
- /// 异步加载资源。
- /// </summary>
- /// <param name="assetName">要加载资源的名称。</param>
- /// <param name="assetType">要加载资源的类型。</param>
- /// <param name="loadAssetCallbacks">加载资源回调函数集。</param>
- public void LoadAsset(string assetName, Type assetType, LoadAssetCallbacks loadAssetCallbacks)
- {
- LoadAsset(assetName, assetType, DefaultPriority, loadAssetCallbacks, null);
- }
- /// <summary>
- /// 异步加载资源。
- /// </summary>
- /// <param name="assetName">要加载资源的名称。</param>
- /// <param name="priority">加载资源的优先级。</param>
- /// <param name="loadAssetCallbacks">加载资源回调函数集。</param>
- public void LoadAsset(string assetName, int priority, LoadAssetCallbacks loadAssetCallbacks)
- {
- LoadAsset(assetName, null, priority, loadAssetCallbacks, null);
- }
- /// <summary>
- /// 异步加载资源。
- /// </summary>
- /// <param name="assetName">要加载资源的名称。</param>
- /// <param name="loadAssetCallbacks">加载资源回调函数集。</param>
- /// <param name="userData">用户自定义数据。</param>
- public void LoadAsset(string assetName, LoadAssetCallbacks loadAssetCallbacks, object userData)
- {
- LoadAsset(assetName, null, DefaultPriority, loadAssetCallbacks, userData);
- }
- /// <summary>
- /// 异步加载资源。
- /// </summary>
- /// <param name="assetName">要加载资源的名称。</param>
- /// <param name="assetType">要加载资源的类型。</param>
- /// <param name="priority">加载资源的优先级。</param>
- /// <param name="loadAssetCallbacks">加载资源回调函数集。</param>
- public void LoadAsset(string assetName, Type assetType, int priority, LoadAssetCallbacks loadAssetCallbacks)
- {
- LoadAsset(assetName, assetType, priority, loadAssetCallbacks, null);
- }
- /// <summary>
- /// 异步加载资源。
- /// </summary>
- /// <param name="assetName">要加载资源的名称。</param>
- /// <param name="assetType">要加载资源的类型。</param>
- /// <param name="loadAssetCallbacks">加载资源回调函数集。</param>
- /// <param name="userData">用户自定义数据。</param>
- public void LoadAsset(string assetName, Type assetType, LoadAssetCallbacks loadAssetCallbacks, object userData)
- {
- LoadAsset(assetName, assetType, DefaultPriority, loadAssetCallbacks, userData);
- }
- /// <summary>
- /// 异步加载资源。
- /// </summary>
- /// <param name="assetName">要加载资源的名称。</param>
- /// <param name="priority">加载资源的优先级。</param>
- /// <param name="loadAssetCallbacks">加载资源回调函数集。</param>
- /// <param name="userData">用户自定义数据。</param>
- public void LoadAsset(string assetName, int priority, LoadAssetCallbacks loadAssetCallbacks, object userData)
- {
- LoadAsset(assetName, null, priority, loadAssetCallbacks, userData);
- }
- /// <summary>
- /// 异步加载资源。
- /// </summary>
- /// <param name="assetName">要加载资源的名称。</param>
- /// <param name="assetType">要加载资源的类型。</param>
- /// <param name="priority">加载资源的优先级。</param>
- /// <param name="loadAssetCallbacks">加载资源回调函数集。</param>
- /// <param name="userData">用户自定义数据。</param>
- public void LoadAsset(string assetName, Type assetType, int priority, LoadAssetCallbacks loadAssetCallbacks, object userData)
- {
- if (loadAssetCallbacks == null)
- {
- Log.Error("Load asset callbacks is invalid.");
- return;
- }
- if (string.IsNullOrEmpty(assetName))
- {
- if (loadAssetCallbacks.LoadAssetFailureCallback != null)
- {
- loadAssetCallbacks.LoadAssetFailureCallback(assetName, LoadResourceStatus.NotExist, "Asset name is invalid.", userData);
- }
- return;
- }
- if (!assetName.StartsWith("Assets/", StringComparison.Ordinal))
- {
- if (loadAssetCallbacks.LoadAssetFailureCallback != null)
- {
- loadAssetCallbacks.LoadAssetFailureCallback(assetName, LoadResourceStatus.NotExist, Utility.Text.Format("Asset name '{0}' is invalid.", assetName), userData);
- }
- return;
- }
- if (!HasFile(assetName))
- {
- if (loadAssetCallbacks.LoadAssetFailureCallback != null)
- {
- loadAssetCallbacks.LoadAssetFailureCallback(assetName, LoadResourceStatus.NotExist, Utility.Text.Format("Asset '{0}' is not exist.", assetName), userData);
- }
- return;
- }
- m_LoadAssetInfos.AddLast(new LoadAssetInfo(assetName, assetType, priority, DateTime.UtcNow, m_MinLoadAssetRandomDelaySeconds + (float)Utility.Random.GetRandomDouble() * (m_MaxLoadAssetRandomDelaySeconds - m_MinLoadAssetRandomDelaySeconds), loadAssetCallbacks, userData));
- }
- /// <summary>
- /// 卸载资源。
- /// </summary>
- /// <param name="asset">要卸载的资源。</param>
- public void UnloadAsset(object asset)
- {
- // Do nothing in editor resource mode.
- }
- /// <summary>
- /// 异步加载场景。
- /// </summary>
- /// <param name="sceneAssetName">要加载场景资源的名称。</param>
- /// <param name="loadSceneCallbacks">加载场景回调函数集。</param>
- public void LoadScene(string sceneAssetName, LoadSceneCallbacks loadSceneCallbacks)
- {
- LoadScene(sceneAssetName, DefaultPriority, loadSceneCallbacks, null);
- }
- /// <summary>
- /// 异步加载场景。
- /// </summary>
- /// <param name="sceneAssetName">要加载场景资源的名称。</param>
- /// <param name="priority">加载场景资源的优先级。</param>
- /// <param name="loadSceneCallbacks">加载场景回调函数集。</param>
- public void LoadScene(string sceneAssetName, int priority, LoadSceneCallbacks loadSceneCallbacks)
- {
- LoadScene(sceneAssetName, priority, loadSceneCallbacks, null);
- }
- /// <summary>
- /// 异步加载场景。
- /// </summary>
- /// <param name="sceneAssetName">要加载场景资源的名称。</param>
- /// <param name="loadSceneCallbacks">加载场景回调函数集。</param>
- /// <param name="userData">用户自定义数据。</param>
- public void LoadScene(string sceneAssetName, LoadSceneCallbacks loadSceneCallbacks, object userData)
- {
- LoadScene(sceneAssetName, DefaultPriority, loadSceneCallbacks, userData);
- }
- /// <summary>
- /// 异步加载场景。
- /// </summary>
- /// <param name="sceneAssetName">要加载场景资源的名称。</param>
- /// <param name="priority">加载场景资源的优先级。</param>
- /// <param name="loadSceneCallbacks">加载场景回调函数集。</param>
- /// <param name="userData">用户自定义数据。</param>
- public void LoadScene(string sceneAssetName, int priority, LoadSceneCallbacks loadSceneCallbacks, object userData)
- {
- if (loadSceneCallbacks == null)
- {
- Log.Error("Load scene callbacks is invalid.");
- return;
- }
- if (string.IsNullOrEmpty(sceneAssetName))
- {
- if (loadSceneCallbacks.LoadSceneFailureCallback != null)
- {
- loadSceneCallbacks.LoadSceneFailureCallback(sceneAssetName, LoadResourceStatus.NotExist, "Scene asset name is invalid.", userData);
- }
- return;
- }
- if (!sceneAssetName.StartsWith("Assets/", StringComparison.Ordinal) || !sceneAssetName.EndsWith(".unity", StringComparison.Ordinal))
- {
- if (loadSceneCallbacks.LoadSceneFailureCallback != null)
- {
- loadSceneCallbacks.LoadSceneFailureCallback(sceneAssetName, LoadResourceStatus.NotExist, Utility.Text.Format("Scene asset name '{0}' is invalid.", sceneAssetName), userData);
- }
- return;
- }
- if (!HasFile(sceneAssetName))
- {
- if (loadSceneCallbacks.LoadSceneFailureCallback != null)
- {
- loadSceneCallbacks.LoadSceneFailureCallback(sceneAssetName, LoadResourceStatus.NotExist, Utility.Text.Format("Scene '{0}' is not exist.", sceneAssetName), userData);
- }
- return;
- }
- #if UNITY_5_5_OR_NEWER
- AsyncOperation asyncOperation = SceneManager.LoadSceneAsync(sceneAssetName, LoadSceneMode.Additive);
- #else
- AsyncOperation asyncOperation = SceneManager.LoadSceneAsync(SceneComponent.GetSceneName(sceneAssetName), LoadSceneMode.Additive);
- #endif
- if (asyncOperation == null)
- {
- return;
- }
- m_LoadSceneInfos.AddLast(new LoadSceneInfo(asyncOperation, sceneAssetName, priority, DateTime.UtcNow, loadSceneCallbacks, userData));
- }
- /// <summary>
- /// 异步卸载场景。
- /// </summary>
- /// <param name="sceneAssetName">要卸载场景资源的名称。</param>
- /// <param name="unloadSceneCallbacks">卸载场景回调函数集。</param>
- public void UnloadScene(string sceneAssetName, UnloadSceneCallbacks unloadSceneCallbacks)
- {
- UnloadScene(sceneAssetName, unloadSceneCallbacks, null);
- }
- /// <summary>
- /// 异步卸载场景。
- /// </summary>
- /// <param name="sceneAssetName">要卸载场景资源的名称。</param>
- /// <param name="unloadSceneCallbacks">卸载场景回调函数集。</param>
- /// <param name="userData">用户自定义数据。</param>
- public void UnloadScene(string sceneAssetName, UnloadSceneCallbacks unloadSceneCallbacks, object userData)
- {
- if (string.IsNullOrEmpty(sceneAssetName))
- {
- Log.Error("Scene asset name is invalid.");
- return;
- }
- if (!sceneAssetName.StartsWith("Assets/", StringComparison.Ordinal) || !sceneAssetName.EndsWith(".unity", StringComparison.Ordinal))
- {
- Log.Error("Scene asset name '{0}' is invalid.", sceneAssetName);
- return;
- }
- if (unloadSceneCallbacks == null)
- {
- Log.Error("Unload scene callbacks is invalid.");
- return;
- }
- if (!HasFile(sceneAssetName))
- {
- Log.Error("Scene '{0}' is not exist.", sceneAssetName);
- return;
- }
- #if UNITY_5_5_OR_NEWER
- AsyncOperation asyncOperation = SceneManager.UnloadSceneAsync(sceneAssetName);
- if (asyncOperation == null)
- {
- return;
- }
- m_UnloadSceneInfos.AddLast(new UnloadSceneInfo(asyncOperation, sceneAssetName, unloadSceneCallbacks, userData));
- #else
- if (SceneManager.UnloadScene(SceneComponent.GetSceneName(sceneAssetName)))
- {
- if (unloadSceneCallbacks.UnloadSceneSuccessCallback != null)
- {
- unloadSceneCallbacks.UnloadSceneSuccessCallback(sceneAssetName, userData);
- }
- }
- else
- {
- if (unloadSceneCallbacks.UnloadSceneFailureCallback != null)
- {
- unloadSceneCallbacks.UnloadSceneFailureCallback(sceneAssetName, userData);
- }
- }
- #endif
- }
- /// <summary>
- /// 获取二进制资源的实际路径。
- /// </summary>
- /// <param name="binaryAssetName">要获取实际路径的二进制资源的名称。</param>
- /// <returns>二进制资源的实际路径。</returns>
- /// <remarks>此方法仅适用于二进制资源存储在磁盘(而非文件系统)中的情况。若二进制资源存储在文件系统中时,返回值将始终为空。</remarks>
- public string GetBinaryPath(string binaryAssetName)
- {
- if (!HasFile(binaryAssetName))
- {
- return null;
- }
- return Application.dataPath.Substring(0, Application.dataPath.Length - AssetsStringLength) + binaryAssetName;
- }
- /// <summary>
- /// 获取二进制资源的实际路径。
- /// </summary>
- /// <param name="binaryAssetName">要获取实际路径的二进制资源的名称。</param>
- /// <param name="storageInReadOnly">二进制资源是否存储在只读区中。</param>
- /// <param name="storageInFileSystem">二进制资源是否存储在文件系统中。</param>
- /// <param name="relativePath">二进制资源或存储二进制资源的文件系统,相对于只读区或者读写区的相对路径。</param>
- /// <param name="fileName">若二进制资源存储在文件系统中,则指示二进制资源在文件系统中的名称,否则此参数返回空。</param>
- /// <returns>是否获取二进制资源的实际路径成功。</returns>
- public bool GetBinaryPath(string binaryAssetName, out bool storageInReadOnly, out bool storageInFileSystem, out string relativePath, out string fileName)
- {
- throw new NotSupportedException("GetBinaryPath");
- }
- /// <summary>
- /// 获取二进制资源的长度。
- /// </summary>
- /// <param name="binaryAssetName">要获取长度的二进制资源的名称。</param>
- /// <returns>二进制资源的长度。</returns>
- public int GetBinaryLength(string binaryAssetName)
- {
- string binaryPath = GetBinaryPath(binaryAssetName);
- if (string.IsNullOrEmpty(binaryPath))
- {
- return -1;
- }
- return (int)new System.IO.FileInfo(binaryPath).Length;
- }
- /// <summary>
- /// 异步加载二进制资源。
- /// </summary>
- /// <param name="binaryAssetName">要加载二进制资源的名称。</param>
- /// <param name="loadBinaryCallbacks">加载二进制资源回调函数集。</param>
- public void LoadBinary(string binaryAssetName, LoadBinaryCallbacks loadBinaryCallbacks)
- {
- LoadBinary(binaryAssetName, loadBinaryCallbacks, null);
- }
- /// <summary>
- /// 异步加载二进制资源。
- /// </summary>
- /// <param name="binaryAssetName">要加载二进制资源的名称。</param>
- /// <param name="loadBinaryCallbacks">加载二进制资源回调函数集。</param>
- /// <param name="userData">用户自定义数据。</param>
- public void LoadBinary(string binaryAssetName, LoadBinaryCallbacks loadBinaryCallbacks, object userData)
- {
- if (loadBinaryCallbacks == null)
- {
- Log.Error("Load binary callbacks is invalid.");
- return;
- }
- if (string.IsNullOrEmpty(binaryAssetName))
- {
- if (loadBinaryCallbacks.LoadBinaryFailureCallback != null)
- {
- loadBinaryCallbacks.LoadBinaryFailureCallback(binaryAssetName, LoadResourceStatus.NotExist, "Binary asset name is invalid.", userData);
- }
- return;
- }
- if (!binaryAssetName.StartsWith("Assets/", StringComparison.Ordinal))
- {
- if (loadBinaryCallbacks.LoadBinaryFailureCallback != null)
- {
- loadBinaryCallbacks.LoadBinaryFailureCallback(binaryAssetName, LoadResourceStatus.NotExist, Utility.Text.Format("Binary asset name '{0}' is invalid.", binaryAssetName), userData);
- }
- return;
- }
- string binaryPath = GetBinaryPath(binaryAssetName);
- if (binaryPath == null)
- {
- if (loadBinaryCallbacks.LoadBinaryFailureCallback != null)
- {
- loadBinaryCallbacks.LoadBinaryFailureCallback(binaryAssetName, LoadResourceStatus.NotExist, Utility.Text.Format("Binary asset '{0}' is not exist.", binaryAssetName), userData);
- }
- return;
- }
- try
- {
- byte[] binaryBytes = File.ReadAllBytes(binaryPath);
- loadBinaryCallbacks.LoadBinarySuccessCallback(binaryAssetName, binaryBytes, 0f, userData);
- }
- catch (Exception exception)
- {
- if (loadBinaryCallbacks.LoadBinaryFailureCallback != null)
- {
- loadBinaryCallbacks.LoadBinaryFailureCallback(binaryAssetName, LoadResourceStatus.AssetError, exception.ToString(), userData);
- }
- }
- }
- /// <summary>
- /// 从文件系统中加载二进制资源。
- /// </summary>
- /// <param name="binaryAssetName">要加载二进制资源的名称。</param>
- /// <returns>存储加载二进制资源的二进制流。</returns>
- public byte[] LoadBinaryFromFileSystem(string binaryAssetName)
- {
- throw new NotSupportedException("LoadBinaryFromFileSystem");
- }
- /// <summary>
- /// 从文件系统中加载二进制资源。
- /// </summary>
- /// <param name="binaryAssetName">要加载二进制资源的名称。</param>
- /// <param name="buffer">存储加载二进制资源的二进制流。</param>
- /// <returns>实际加载了多少字节。</returns>
- public int LoadBinaryFromFileSystem(string binaryAssetName, byte[] buffer)
- {
- throw new NotSupportedException("LoadBinaryFromFileSystem");
- }
- /// <summary>
- /// 从文件系统中加载二进制资源。
- /// </summary>
- /// <param name="binaryAssetName">要加载二进制资源的名称。</param>
- /// <param name="buffer">存储加载二进制资源的二进制流。</param>
- /// <param name="startIndex">存储加载二进制资源的二进制流的起始位置。</param>
- /// <returns>实际加载了多少字节。</returns>
- public int LoadBinaryFromFileSystem(string binaryAssetName, byte[] buffer, int startIndex)
- {
- throw new NotSupportedException("LoadBinaryFromFileSystem");
- }
- /// <summary>
- /// 从文件系统中加载二进制资源。
- /// </summary>
- /// <param name="binaryAssetName">要加载二进制资源的名称。</param>
- /// <param name="buffer">存储加载二进制资源的二进制流。</param>
- /// <param name="startIndex">存储加载二进制资源的二进制流的起始位置。</param>
- /// <param name="length">存储加载二进制资源的二进制流的长度。</param>
- /// <returns>实际加载了多少字节。</returns>
- public int LoadBinaryFromFileSystem(string binaryAssetName, byte[] buffer, int startIndex, int length)
- {
- throw new NotSupportedException("LoadBinaryFromFileSystem");
- }
- /// <summary>
- /// 从文件系统中加载二进制资源的片段。
- /// </summary>
- /// <param name="binaryAssetName">要加载片段的二进制资源的名称。</param>
- /// <param name="length">要加载片段的长度。</param>
- /// <returns>存储加载二进制资源片段内容的二进制流。</returns>
- public byte[] LoadBinarySegmentFromFileSystem(string binaryAssetName, int length)
- {
- throw new NotSupportedException("LoadBinarySegmentFromFileSystem");
- }
- /// <summary>
- /// 从文件系统中加载二进制资源的片段。
- /// </summary>
- /// <param name="binaryAssetName">要加载片段的二进制资源的名称。</param>
- /// <param name="offset">要加载片段的偏移。</param>
- /// <param name="length">要加载片段的长度。</param>
- /// <returns>存储加载二进制资源片段内容的二进制流。</returns>
- public byte[] LoadBinarySegmentFromFileSystem(string binaryAssetName, int offset, int length)
- {
- throw new NotSupportedException("LoadBinarySegmentFromFileSystem");
- }
- /// <summary>
- /// 从文件系统中加载二进制资源的片段。
- /// </summary>
- /// <param name="binaryAssetName">要加载片段的二进制资源的名称。</param>
- /// <param name="buffer">存储加载二进制资源片段内容的二进制流。</param>
- /// <returns>实际加载了多少字节。</returns>
- public int LoadBinarySegmentFromFileSystem(string binaryAssetName, byte[] buffer)
- {
- throw new NotSupportedException("LoadBinarySegmentFromFileSystem");
- }
- /// <summary>
- /// 从文件系统中加载二进制资源的片段。
- /// </summary>
- /// <param name="binaryAssetName">要加载片段的二进制资源的名称。</param>
- /// <param name="buffer">存储加载二进制资源片段内容的二进制流。</param>
- /// <param name="length">要加载片段的长度。</param>
- /// <returns>实际加载了多少字节。</returns>
- public int LoadBinarySegmentFromFileSystem(string binaryAssetName, byte[] buffer, int length)
- {
- throw new NotSupportedException("LoadBinarySegmentFromFileSystem");
- }
- /// <summary>
- /// 从文件系统中加载二进制资源的片段。
- /// </summary>
- /// <param name="binaryAssetName">要加载片段的二进制资源的名称。</param>
- /// <param name="buffer">存储加载二进制资源片段内容的二进制流。</param>
- /// <param name="startIndex">存储加载二进制资源片段内容的二进制流的起始位置。</param>
- /// <param name="length">要加载片段的长度。</param>
- /// <returns>实际加载了多少字节。</returns>
- public int LoadBinarySegmentFromFileSystem(string binaryAssetName, byte[] buffer, int startIndex, int length)
- {
- throw new NotSupportedException("LoadBinarySegmentFromFileSystem");
- }
- /// <summary>
- /// 从文件系统中加载二进制资源的片段。
- /// </summary>
- /// <param name="binaryAssetName">要加载片段的二进制资源的名称。</param>
- /// <param name="offset">要加载片段的偏移。</param>
- /// <param name="buffer">存储加载二进制资源片段内容的二进制流。</param>
- /// <returns>实际加载了多少字节。</returns>
- public int LoadBinarySegmentFromFileSystem(string binaryAssetName, int offset, byte[] buffer)
- {
- throw new NotSupportedException("LoadBinarySegmentFromFileSystem");
- }
- /// <summary>
- /// 从文件系统中加载二进制资源的片段。
- /// </summary>
- /// <param name="binaryAssetName">要加载片段的二进制资源的名称。</param>
- /// <param name="offset">要加载片段的偏移。</param>
- /// <param name="buffer">存储加载二进制资源片段内容的二进制流。</param>
- /// <param name="length">要加载片段的长度。</param>
- /// <returns>实际加载了多少字节。</returns>
- public int LoadBinarySegmentFromFileSystem(string binaryAssetName, int offset, byte[] buffer, int length)
- {
- throw new NotSupportedException("LoadBinarySegmentFromFileSystem");
- }
- /// <summary>
- /// 从文件系统中加载二进制资源的片段。
- /// </summary>
- /// <param name="binaryAssetName">要加载片段的二进制资源的名称。</param>
- /// <param name="offset">要加载片段的偏移。</param>
- /// <param name="buffer">存储加载二进制资源片段内容的二进制流。</param>
- /// <param name="startIndex">存储加载二进制资源片段内容的二进制流的起始位置。</param>
- /// <param name="length">要加载片段的长度。</param>
- /// <returns>实际加载了多少字节。</returns>
- public int LoadBinarySegmentFromFileSystem(string binaryAssetName, int offset, byte[] buffer, int startIndex, int length)
- {
- throw new NotSupportedException("LoadBinarySegmentFromFileSystem");
- }
- /// <summary>
- /// 检查资源组是否存在。
- /// </summary>
- /// <param name="resourceGroupName">要检查资源组的名称。</param>
- /// <returns>资源组是否存在。</returns>
- public bool HasResourceGroup(string resourceGroupName)
- {
- throw new NotSupportedException("HasResourceGroup");
- }
- /// <summary>
- /// 获取默认资源组。
- /// </summary>
- /// <returns>默认资源组。</returns>
- public IResourceGroup GetResourceGroup()
- {
- throw new NotSupportedException("GetResourceGroup");
- }
- /// <summary>
- /// 获取资源组。
- /// </summary>
- /// <param name="resourceGroupName">要获取的资源组名称。</param>
- /// <returns>要获取的资源组。</returns>
- public IResourceGroup GetResourceGroup(string resourceGroupName)
- {
- throw new NotSupportedException("GetResourceGroup");
- }
- /// <summary>
- /// 获取所有资源组。
- /// </summary>
- /// <returns>所有资源组。</returns>
- public IResourceGroup[] GetAllResourceGroups()
- {
- throw new NotSupportedException("GetAllResourceGroups");
- }
- /// <summary>
- /// 获取所有资源组。
- /// </summary>
- /// <param name="results">所有资源组。</param>
- public void GetAllResourceGroups(List<IResourceGroup> results)
- {
- throw new NotSupportedException("GetAllResourceGroups");
- }
- /// <summary>
- /// 获取资源组集合。
- /// </summary>
- /// <param name="resourceGroupNames">要获取的资源组名称的集合。</param>
- /// <returns>要获取的资源组集合。</returns>
- public IResourceGroupCollection GetResourceGroupCollection(params string[] resourceGroupNames)
- {
- throw new NotSupportedException("GetResourceGroupCollection");
- }
- /// <summary>
- /// 获取资源组集合。
- /// </summary>
- /// <param name="resourceGroupNames">要获取的资源组名称的集合。</param>
- /// <returns>要获取的资源组集合。</returns>
- public IResourceGroupCollection GetResourceGroupCollection(List<string> resourceGroupNames)
- {
- throw new NotSupportedException("GetResourceGroupCollection");
- }
- private bool HasFile(string assetName)
- {
- if (string.IsNullOrEmpty(assetName))
- {
- return false;
- }
- if (HasCachedAsset(assetName))
- {
- return true;
- }
- string assetFullName = Application.dataPath.Substring(0, Application.dataPath.Length - AssetsStringLength) + assetName;
- if (string.IsNullOrEmpty(assetFullName))
- {
- return false;
- }
- string[] splitedAssetFullName = assetFullName.Split('/');
- string currentPath = Path.GetPathRoot(assetFullName);
- for (int i = 1; i < splitedAssetFullName.Length - 1; i++)
- {
- string[] directoryNames = Directory.GetDirectories(currentPath, splitedAssetFullName[i]);
- if (directoryNames.Length != 1)
- {
- return false;
- }
- currentPath = directoryNames[0];
- }
- string[] fileNames = Directory.GetFiles(currentPath, splitedAssetFullName[splitedAssetFullName.Length - 1]);
- if (fileNames.Length != 1)
- {
- return false;
- }
- string fileFullName = Utility.Path.GetRegularPath(fileNames[0]);
- if (fileFullName == null)
- {
- return false;
- }
- if (assetFullName != fileFullName)
- {
- if (assetFullName.ToLowerInvariant() == fileFullName.ToLowerInvariant())
- {
- Log.Warning("The real path of the specific asset '{0}' is '{1}'. Check the case of letters in the path.", assetName, "Assets" + fileFullName.Substring(Application.dataPath.Length));
- }
- return false;
- }
- return true;
- }
- private bool HasCachedAsset(string assetName)
- {
- if (!m_EnableCachedAssets)
- {
- return false;
- }
- if (string.IsNullOrEmpty(assetName))
- {
- return false;
- }
- return m_CachedAssets.ContainsKey(assetName);
- }
- private UnityEngine.Object GetCachedAsset(string assetName)
- {
- if (!m_EnableCachedAssets)
- {
- return null;
- }
- if (string.IsNullOrEmpty(assetName))
- {
- return null;
- }
- UnityEngine.Object asset = null;
- if (m_CachedAssets.TryGetValue(assetName, out asset))
- {
- return asset;
- }
- return null;
- }
- void IResourceManager.SetReadOnlyPath(string readOnlyPath)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.SetReadWritePath(string readWritePath)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.SetResourceMode(ResourceMode resourceMode)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.SetCurrentVariant(string currentVariant)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.SetObjectPoolManager(IObjectPoolManager objectPoolManager)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.SetFileSystemManager(IFileSystemManager fileSystemManager)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.SetDownloadManager(IDownloadManager downloadManager)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.SetDecryptResourceCallback(DecryptResourceCallback decryptResourceCallback)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.SetResourceHelper(IResourceHelper resourceHelper)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.AddLoadResourceAgentHelper(ILoadResourceAgentHelper loadResourceAgentHelper)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.InitResources(InitResourcesCompleteCallback initResourcesCompleteCallback)
- {
- throw new NotImplementedException();
- }
- CheckVersionListResult IResourceManager.CheckVersionList(int latestInternalResourceVersion)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.UpdateVersionList(int versionListLength, int versionListHashCode, int versionListCompressedLength, int versionListCompressedHashCode, UpdateVersionListCallbacks updateVersionListCallbacks)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.CheckResources(bool ignoreOtherVariant, CheckResourcesCompleteCallback checkResourcesCompleteCallback)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.ApplyResources(string resourcePackPath, ApplyResourcesCompleteCallback applyResourcesCompleteCallback)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.UpdateResources(UpdateResourcesCompleteCallback updateResourcesCompleteCallback)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.UpdateResources(string resourceGroupName, UpdateResourcesCompleteCallback updateResourcesCompleteCallback)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.StopUpdateResources()
- {
- throw new NotImplementedException();
- }
- bool IResourceManager.VerifyResourcePack(string resourcePackPath)
- {
- throw new NotImplementedException();
- }
- GameFramework.TaskInfo[] IResourceManager.GetAllLoadAssetInfos()
- {
- throw new NotImplementedException();
- }
- void IResourceManager.GetAllLoadAssetInfos(List<GameFramework.TaskInfo> results)
- {
- throw new NotImplementedException();
- }
- HasAssetResult IResourceManager.HasAsset(string assetName)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.LoadAsset(string assetName, LoadAssetCallbacks loadAssetCallbacks)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.LoadAsset(string assetName, Type assetType, LoadAssetCallbacks loadAssetCallbacks)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.LoadAsset(string assetName, int priority, LoadAssetCallbacks loadAssetCallbacks)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.LoadAsset(string assetName, LoadAssetCallbacks loadAssetCallbacks, object userData)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.LoadAsset(string assetName, Type assetType, int priority, LoadAssetCallbacks loadAssetCallbacks)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.LoadAsset(string assetName, Type assetType, LoadAssetCallbacks loadAssetCallbacks, object userData)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.LoadAsset(string assetName, int priority, LoadAssetCallbacks loadAssetCallbacks, object userData)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.LoadAsset(string assetName, Type assetType, int priority, LoadAssetCallbacks loadAssetCallbacks, object userData)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.UnloadAsset(object asset)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.LoadScene(string sceneAssetName, LoadSceneCallbacks loadSceneCallbacks)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.LoadScene(string sceneAssetName, int priority, LoadSceneCallbacks loadSceneCallbacks)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.LoadScene(string sceneAssetName, LoadSceneCallbacks loadSceneCallbacks, object userData)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.LoadScene(string sceneAssetName, int priority, LoadSceneCallbacks loadSceneCallbacks, object userData)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.UnloadScene(string sceneAssetName, UnloadSceneCallbacks unloadSceneCallbacks)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.UnloadScene(string sceneAssetName, UnloadSceneCallbacks unloadSceneCallbacks, object userData)
- {
- throw new NotImplementedException();
- }
- string IResourceManager.GetBinaryPath(string binaryAssetName)
- {
- throw new NotImplementedException();
- }
- bool IResourceManager.GetBinaryPath(string binaryAssetName, out bool storageInReadOnly, out bool storageInFileSystem, out string relativePath, out string fileName)
- {
- throw new NotImplementedException();
- }
- int IResourceManager.GetBinaryLength(string binaryAssetName)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.LoadBinary(string binaryAssetName, LoadBinaryCallbacks loadBinaryCallbacks)
- {
- throw new NotImplementedException();
- }
- void IResourceManager.LoadBinary(string binaryAssetName, LoadBinaryCallbacks loadBinaryCallbacks, object userData)
- {
- throw new NotImplementedException();
- }
- byte[] IResourceManager.LoadBinaryFromFileSystem(string binaryAssetName)
- {
- throw new NotImplementedException();
- }
- int IResourceManager.LoadBinaryFromFileSystem(string binaryAssetName, byte[] buffer)
- {
- throw new NotImplementedException();
- }
- int IResourceManager.LoadBinaryFromFileSystem(string binaryAssetName, byte[] buffer, int startIndex)
- {
- throw new NotImplementedException();
- }
- int IResourceManager.LoadBinaryFromFileSystem(string binaryAssetName, byte[] buffer, int startIndex, int length)
- {
- throw new NotImplementedException();
- }
- byte[] IResourceManager.LoadBinarySegmentFromFileSystem(string binaryAssetName, int length)
- {
- throw new NotImplementedException();
- }
- byte[] IResourceManager.LoadBinarySegmentFromFileSystem(string binaryAssetName, int offset, int length)
- {
- throw new NotImplementedException();
- }
- int IResourceManager.LoadBinarySegmentFromFileSystem(string binaryAssetName, byte[] buffer)
- {
- throw new NotImplementedException();
- }
- int IResourceManager.LoadBinarySegmentFromFileSystem(string binaryAssetName, byte[] buffer, int length)
- {
- throw new NotImplementedException();
- }
- int IResourceManager.LoadBinarySegmentFromFileSystem(string binaryAssetName, byte[] buffer, int startIndex, int length)
- {
- throw new NotImplementedException();
- }
- int IResourceManager.LoadBinarySegmentFromFileSystem(string binaryAssetName, int offset, byte[] buffer)
- {
- throw new NotImplementedException();
- }
- int IResourceManager.LoadBinarySegmentFromFileSystem(string binaryAssetName, int offset, byte[] buffer, int length)
- {
- throw new NotImplementedException();
- }
- int IResourceManager.LoadBinarySegmentFromFileSystem(string binaryAssetName, int offset, byte[] buffer, int startIndex, int length)
- {
- throw new NotImplementedException();
- }
- bool IResourceManager.HasResourceGroup(string resourceGroupName)
- {
- throw new NotImplementedException();
- }
- IResourceGroup IResourceManager.GetResourceGroup()
- {
- throw new NotImplementedException();
- }
- IResourceGroup IResourceManager.GetResourceGroup(string resourceGroupName)
- {
- throw new NotImplementedException();
- }
- IResourceGroup[] IResourceManager.GetAllResourceGroups()
- {
- throw new NotImplementedException();
- }
- void IResourceManager.GetAllResourceGroups(List<IResourceGroup> results)
- {
- throw new NotImplementedException();
- }
- IResourceGroupCollection IResourceManager.GetResourceGroupCollection(params string[] resourceGroupNames)
- {
- throw new NotImplementedException();
- }
- IResourceGroupCollection IResourceManager.GetResourceGroupCollection(List<string> resourceGroupNames)
- {
- throw new NotImplementedException();
- }
- [StructLayout(LayoutKind.Auto)]
- private struct LoadAssetInfo
- {
- private readonly string m_AssetName;
- private readonly Type m_AssetType;
- private readonly int m_Priority;
- private readonly DateTime m_StartTime;
- private readonly float m_DelaySeconds;
- private readonly LoadAssetCallbacks m_LoadAssetCallbacks;
- private readonly object m_UserData;
- public LoadAssetInfo(string assetName, Type assetType, int priority, DateTime startTime, float delaySeconds, LoadAssetCallbacks loadAssetCallbacks, object userData)
- {
- m_AssetName = assetName;
- m_AssetType = assetType;
- m_Priority = priority;
- m_StartTime = startTime;
- m_DelaySeconds = delaySeconds;
- m_LoadAssetCallbacks = loadAssetCallbacks;
- m_UserData = userData;
- }
- public string AssetName
- {
- get
- {
- return m_AssetName;
- }
- }
- public Type AssetType
- {
- get
- {
- return m_AssetType;
- }
- }
- public int Priority
- {
- get
- {
- return m_Priority;
- }
- }
- public DateTime StartTime
- {
- get
- {
- return m_StartTime;
- }
- }
- public float DelaySeconds
- {
- get
- {
- return m_DelaySeconds;
- }
- }
- public LoadAssetCallbacks LoadAssetCallbacks
- {
- get
- {
- return m_LoadAssetCallbacks;
- }
- }
- public object UserData
- {
- get
- {
- return m_UserData;
- }
- }
- }
- [StructLayout(LayoutKind.Auto)]
- private struct LoadSceneInfo
- {
- private readonly AsyncOperation m_AsyncOperation;
- private readonly string m_SceneAssetName;
- private readonly int m_Priority;
- private readonly DateTime m_StartTime;
- private readonly LoadSceneCallbacks m_LoadSceneCallbacks;
- private readonly object m_UserData;
- public LoadSceneInfo(AsyncOperation asyncOperation, string sceneAssetName, int priority, DateTime startTime, LoadSceneCallbacks loadSceneCallbacks, object userData)
- {
- m_AsyncOperation = asyncOperation;
- m_SceneAssetName = sceneAssetName;
- m_Priority = priority;
- m_StartTime = startTime;
- m_LoadSceneCallbacks = loadSceneCallbacks;
- m_UserData = userData;
- }
- public AsyncOperation AsyncOperation
- {
- get
- {
- return m_AsyncOperation;
- }
- }
- public string SceneAssetName
- {
- get
- {
- return m_SceneAssetName;
- }
- }
- public int Priority
- {
- get
- {
- return m_Priority;
- }
- }
- public DateTime StartTime
- {
- get
- {
- return m_StartTime;
- }
- }
- public LoadSceneCallbacks LoadSceneCallbacks
- {
- get
- {
- return m_LoadSceneCallbacks;
- }
- }
- public object UserData
- {
- get
- {
- return m_UserData;
- }
- }
- }
- [StructLayout(LayoutKind.Auto)]
- private struct UnloadSceneInfo
- {
- private readonly AsyncOperation m_AsyncOperation;
- private readonly string m_SceneAssetName;
- private readonly UnloadSceneCallbacks m_UnloadSceneCallbacks;
- private readonly object m_UserData;
- public UnloadSceneInfo(AsyncOperation asyncOperation, string sceneAssetName, UnloadSceneCallbacks unloadSceneCallbacks, object userData)
- {
- m_AsyncOperation = asyncOperation;
- m_SceneAssetName = sceneAssetName;
- m_UnloadSceneCallbacks = unloadSceneCallbacks;
- m_UserData = userData;
- }
- public AsyncOperation AsyncOperation
- {
- get
- {
- return m_AsyncOperation;
- }
- }
- public string SceneAssetName
- {
- get
- {
- return m_SceneAssetName;
- }
- }
- public UnloadSceneCallbacks UnloadSceneCallbacks
- {
- get
- {
- return m_UnloadSceneCallbacks;
- }
- }
- public object UserData
- {
- get
- {
- return m_UserData;
- }
- }
- }
- }
- }
|