using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Logging;
using HG.Coroutines;
using HG.Reflection;
using Microsoft.CodeAnalysis;
using R2API.AutoVersionGen;
using RoR2;
using RoR2.ExpansionManagement;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.ResourceManagement.ResourceLocations;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("R2API.Addressables")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.3.0")]
[assembly: AssemblyInformationalVersion("1.1.3+e89de2d3d141dc6d17d0f2e916a8eaceee984e93")]
[assembly: AssemblyProduct("R2API.Addressables")]
[assembly: AssemblyTitle("R2API.Addressables")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.3.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace System.Diagnostics.CodeAnalysis
{
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
[ExcludeFromCodeCoverage]
[DebuggerNonUserCode]
internal sealed class MemberNotNullAttribute : Attribute
{
public string[] Members { get; }
public MemberNotNullAttribute(string member)
{
Members = new string[1] { member };
}
public MemberNotNullAttribute(params string[] members)
{
Members = members;
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
[ExcludeFromCodeCoverage]
[DebuggerNonUserCode]
internal sealed class MemberNotNullWhenAttribute : Attribute
{
public bool ReturnValue { get; }
public string[] Members { get; }
public MemberNotNullWhenAttribute(bool returnValue, string member)
{
ReturnValue = returnValue;
Members = new string[1] { member };
}
public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
{
ReturnValue = returnValue;
Members = members;
}
}
}
namespace R2API
{
[AutoVersion]
[BepInPlugin("com.bepis.r2api.addressables", "R2API.Addressables", "1.1.3")]
public sealed class AddressablesPlugin : BaseUnityPlugin
{
public const string PluginGUID = "com.bepis.r2api.addressables";
public const string PluginName = "R2API.Addressables";
public const string PluginVersion = "1.1.3";
internal static ManualLogSource Logger { get; set; }
public static AddressablesPlugin Instance { get; private set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Instance = this;
}
}
}
namespace R2API.AutoVersionGen
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
internal class AutoVersionAttribute : Attribute
{
}
}
namespace R2API.AddressReferencedAssets
{
public class AddressableComponentRequirementAttribute : Attribute
{
public Type requiredComponentType { get; }
public bool searchInChildren { get; set; }
public AddressableComponentRequirementAttribute(Type requiredComponentType)
{
this.requiredComponentType = requiredComponentType;
}
}
[Serializable]
public class AddressReferencedAsset<T> : AddressReferencedAsset where T : Object
{
[CompilerGenerated]
private sealed class <IsAdressValidAsync>d__38 : IEnumerator<bool?>, IEnumerator, IDisposable
{
private int <>1__state;
private bool? <>2__current;
public AddressReferencedAsset<T> <>4__this;
private AsyncOperationHandle<IList<IResourceLocation>> <locationTask>5__2;
bool? IEnumerator<bool?>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <IsAdressValidAsync>d__38(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
<locationTask>5__2 = default(AsyncOperationHandle<IList<IResourceLocation>>);
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
int num = <>1__state;
AddressReferencedAsset<T> addressReferencedAsset = <>4__this;
IList<IResourceLocation> result;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
<locationTask>5__2 = Addressables.LoadResourceLocationsAsync((object)addressReferencedAsset._address, (Type)null);
goto IL_0059;
case 1:
<>1__state = -1;
goto IL_0059;
case 2:
{
<>1__state = -1;
return false;
}
IL_0059:
if (!<locationTask>5__2.IsDone)
{
<>2__current = null;
<>1__state = 1;
return true;
}
result = <locationTask>5__2.Result;
<>2__current = result.Any();
<>1__state = 2;
return true;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <LoadAssetAsyncCoroutine>d__28 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public AddressReferencedAsset<T> <>4__this;
private IEnumerator <coroutine>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LoadAssetAsyncCoroutine>d__28(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<coroutine>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
int num = <>1__state;
AddressReferencedAsset<T> addressReferencedAsset = <>4__this;
if (num != 0)
{
if (num != 1)
{
return false;
}
<>1__state = -1;
}
else
{
<>1__state = -1;
if (!addressReferencedAsset.IsValidForLoadingWithAddress())
{
goto IL_005f;
}
<coroutine>5__2 = addressReferencedAsset.LoadAsyncCoroutine();
}
if (<coroutine>5__2.MoveNext())
{
<>2__current = null;
<>1__state = 1;
return true;
}
<coroutine>5__2 = null;
goto IL_005f;
IL_005f:
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <LoadAssetNowCoroutine>d__30 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public AddressReferencedAsset<T> <>4__this;
public Action<T> onLoaded;
private IEnumerator <loadCoroutine>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LoadAssetNowCoroutine>d__30(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<loadCoroutine>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
int num = <>1__state;
AddressReferencedAsset<T> addressReferencedAsset = <>4__this;
if (num != 0)
{
if (num != 1)
{
return false;
}
<>1__state = -1;
}
else
{
<>1__state = -1;
if (addressReferencedAsset.AssetExists)
{
goto IL_005f;
}
<loadCoroutine>5__2 = addressReferencedAsset.LoadAsyncCoroutine();
}
if (<loadCoroutine>5__2.MoveNext())
{
<>2__current = null;
<>1__state = 1;
return true;
}
<loadCoroutine>5__2 = null;
goto IL_005f;
IL_005f:
onLoaded?.Invoke(addressReferencedAsset.Asset);
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <LoadAsyncCoroutine>d__32 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public AddressReferencedAsset<T> <>4__this;
private IEnumerator <loadCoroutine>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LoadAsyncCoroutine>d__32(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<loadCoroutine>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
int num = <>1__state;
AddressReferencedAsset<T> addressReferencedAsset = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
<loadCoroutine>5__2 = addressReferencedAsset.LoadFromAddressAsyncCoroutine();
break;
case 1:
<>1__state = -1;
break;
}
if (<loadCoroutine>5__2.MoveNext())
{
<>2__current = null;
<>1__state = 1;
return true;
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <LoadFromAddressAsyncCoroutine>d__34 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public AddressReferencedAsset<T> <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LoadFromAddressAsyncCoroutine>d__34(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
int num = <>1__state;
AddressReferencedAsset<T> addressReferencedAsset = <>4__this;
switch (num)
{
default:
return false;
case 0:
{
<>1__state = -1;
if (AddressReferencedAsset.addressesThatFailedToBeValidated.Contains(addressReferencedAsset._address))
{
return false;
}
bool? flag = null;
IEnumerator<bool?> enumerator = addressReferencedAsset.IsAdressValidAsync();
while (flag.HasValue && enumerator.MoveNext())
{
flag = enumerator.Current;
}
bool valueOrDefault = flag.GetValueOrDefault();
if (!flag.HasValue)
{
valueOrDefault = false;
flag = valueOrDefault;
}
if (flag == false)
{
AddressablesPlugin.Logger.LogWarning((object)$"{addressReferencedAsset} failed to load from it's address because the address is either invalid, or malformed.");
AddressReferencedAsset.addressesThatFailedToBeValidated.Add(addressReferencedAsset._address);
addressReferencedAsset._AddressFailedToLoad = true;
return false;
}
addressReferencedAsset.AsyncOperationHandle = Addressables.LoadAssetAsync<T>((object)addressReferencedAsset._address);
break;
}
case 1:
<>1__state = -1;
break;
}
if (!addressReferencedAsset.AsyncOperationHandle.IsDone)
{
<>2__current = null;
<>1__state = 1;
return true;
}
addressReferencedAsset._asset = addressReferencedAsset.AsyncOperationHandle.Result;
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private AsyncOperationHandle<T> _asyncOperationHandle;
[SerializeField]
private T _asset;
[SerializeField]
private string _address;
[SerializeField]
[HideInInspector]
private bool _useDirectReference;
private bool _AddressFailedToLoad;
public T Asset
{
get
{
if (Object.op_Implicit((Object)(object)_asset))
{
return _asset;
}
if (!AddressReferencedAsset.Initialized && CanLoadFromCatalog)
{
string name = GetType().Name;
MethodBase method = new StackTrace().GetFrame(1).GetMethod();
AddressablesPlugin.Logger.LogWarning((object)($"Assembly {Assembly.GetCallingAssembly()} is trying to access an {name} before AddressReferencedAssets have initialized! This can cause issues as {name} can load the asset from Catalogs within the game." + "\n Consider using AddressReferencedAssets.OnAddressReferencedAssetsLoaded for running code that depends on AddressableAssets! (Method: " + method.DeclaringType.FullName + "." + method.Name + "()"));
Load();
}
else if (IsValidForLoadingWithAddress())
{
if (!_AddressFailedToLoad)
{
if (_asyncOperationHandle.IsValid())
{
_asset = _asyncOperationHandle.WaitForCompletion();
return _asset;
}
Load();
return _asset;
}
AddressablesPlugin.Logger.LogWarning((object)$"Not trying to load {this} because it's address has already failed to load beforehand. Null will be returned.");
}
return _asset;
}
set
{
_asset = value;
_address = (Object.op_Implicit((Object)(object)_asset) ? string.Empty : _address);
_useDirectReference = Object.op_Implicit((Object)(object)_asset);
}
}
public override Object BoxedAsset => (Object)(object)_asset;
public new AsyncOperationHandle<T> AsyncOperationHandle
{
get
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
return _asyncOperationHandle;
}
protected set
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
_asyncOperationHandle = value;
base.AsyncOperationHandle = AsyncOperationHandle<T>.op_Implicit(value);
}
}
public bool AssetExists => Object.op_Implicit((Object)(object)_asset);
public string Address
{
get
{
return _address;
}
set
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
_address = value;
_asset = default(T);
_useDirectReference = false;
_AddressFailedToLoad = false;
if (_asyncOperationHandle.IsValid())
{
Addressables.Release<T>(_asyncOperationHandle);
}
if (RoR2Application.loadFinished)
{
Load();
}
}
}
public bool IsInvalid
{
get
{
if (!Object.op_Implicit((Object)(object)_asset))
{
if (!string.IsNullOrEmpty(_address))
{
return string.IsNullOrWhiteSpace(_address);
}
return true;
}
return false;
}
}
public bool UseDirectReference => _useDirectReference;
public virtual bool CanLoadFromCatalog { get; protected set; }
private bool IsValidForLoadingWithAddress()
{
if (!Object.op_Implicit((Object)(object)_asset))
{
return !string.IsNullOrEmpty(_address);
}
return false;
}
[Obsolete("Call \"LoadAssetAsyncCoroutine()\" instead.")]
protected sealed override async Task LoadAssetAsync()
{
if (IsValidForLoadingWithAddress())
{
await LoadAsync();
}
}
[IteratorStateMachine(typeof(AddressReferencedAsset<>.<LoadAssetAsyncCoroutine>d__28))]
protected sealed override IEnumerator LoadAssetAsyncCoroutine()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LoadAssetAsyncCoroutine>d__28(0)
{
<>4__this = this
};
}
public T LoadAssetNow()
{
if (!AssetExists)
{
Load();
}
return Asset;
}
[IteratorStateMachine(typeof(AddressReferencedAsset<>.<LoadAssetNowCoroutine>d__30))]
public virtual IEnumerator LoadAssetNowCoroutine(Action<T> onLoaded)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LoadAssetNowCoroutine>d__30(0)
{
<>4__this = this,
onLoaded = onLoaded
};
}
protected virtual void Load()
{
LoadFromAddress();
}
[IteratorStateMachine(typeof(AddressReferencedAsset<>.<LoadAsyncCoroutine>d__32))]
protected virtual IEnumerator LoadAsyncCoroutine()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LoadAsyncCoroutine>d__32(0)
{
<>4__this = this
};
}
[Obsolete("Use \"LoadAsyncCoroutine()\" Instead")]
protected virtual async Task LoadAsync()
{
await LoadFromAddressAsync();
}
[IteratorStateMachine(typeof(AddressReferencedAsset<>.<LoadFromAddressAsyncCoroutine>d__34))]
protected IEnumerator LoadFromAddressAsyncCoroutine()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LoadFromAddressAsyncCoroutine>d__34(0)
{
<>4__this = this
};
}
[Obsolete("Use \"LoadFromAdressAsyncCoroutine\" Instead")]
protected async Task LoadFromAddressAsync()
{
bool? flag = null;
IEnumerator<bool?> enumerator = IsAdressValidAsync();
if (flag.HasValue && enumerator.MoveNext())
{
flag = enumerator.Current;
}
if (flag == false)
{
AddressablesPlugin.Logger.LogWarning((object)$"{this} failed to load from it's address because the address is either invalid, or malformed.");
AddressReferencedAsset.addressesThatFailedToBeValidated.Add(_address);
_AddressFailedToLoad = true;
}
else
{
AsyncOperationHandle = Addressables.LoadAssetAsync<T>((object)_address);
_asset = await AsyncOperationHandle.Task;
}
}
protected void LoadFromAddress()
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
if (!IsAddressValid())
{
AddressablesPlugin.Logger.LogWarning((object)$"{this} failed to load from it's address because the address is either invalid, or malformed.");
_AddressFailedToLoad = true;
AddressReferencedAsset.addressesThatFailedToBeValidated.Add(_address);
}
else
{
AsyncOperationHandle = Addressables.LoadAssetAsync<T>((object)_address);
_asset = AsyncOperationHandle.WaitForCompletion();
}
}
private bool IsAddressValid()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
return Addressables.LoadResourceLocationsAsync((object)_address, (Type)null).WaitForCompletion().Any();
}
[IteratorStateMachine(typeof(AddressReferencedAsset<>.<IsAdressValidAsync>d__38))]
private IEnumerator<bool?> IsAdressValidAsync()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <IsAdressValidAsync>d__38(0)
{
<>4__this = this
};
}
public override string ToString()
{
return string.Format("{0}(Asset={1}.Address={2}", GetType().Name, Object.op_Implicit((Object)(object)_asset) ? ((object)_asset) : "null", Address);
}
public override void Dispose()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
if (AsyncOperationHandle.IsValid())
{
Addressables.Release<T>(AsyncOperationHandle);
}
}
public static implicit operator bool(AddressReferencedAsset<T> addressReferencedAsset)
{
return Object.op_Implicit((Object)(object)((addressReferencedAsset != null) ? addressReferencedAsset.Asset : default(T)));
}
public static implicit operator T(AddressReferencedAsset<T> addressReferencedAsset)
{
if (addressReferencedAsset == null)
{
return default(T);
}
return addressReferencedAsset.Asset;
}
public static implicit operator AddressReferencedAsset<T>(string address)
{
return new AddressReferencedAsset<T>(address);
}
public static implicit operator AddressReferencedAsset<T>(T asset)
{
return new AddressReferencedAsset<T>(asset);
}
public AddressReferencedAsset(T asset)
{
SetHooks();
_asset = asset;
_useDirectReference = true;
AddressReferencedAsset.instances.Add(this);
}
public AddressReferencedAsset(string address)
{
SetHooks();
_address = address;
_useDirectReference = false;
AddressReferencedAsset.instances.Add(this);
}
public AddressReferencedAsset()
{
SetHooks();
AddressReferencedAsset.instances.Add(this);
}
~AddressReferencedAsset()
{
AddressReferencedAsset.instances.Remove(this);
if (AddressReferencedAsset.instances.Count == 0)
{
UnsetHooks();
}
}
}
public abstract class AddressReferencedAsset : IDisposable
{
[CompilerGenerated]
private sealed class <LoadReferencesAsync>d__18 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
private ParallelCoroutine <parallelCoroutine>5__2;
private Task <supertask>5__3;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LoadReferencesAsync>d__18(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<parallelCoroutine>5__2 = null;
<supertask>5__3 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Expected O, but got Unknown
List<Task> list;
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<parallelCoroutine>5__2 = new ParallelCoroutine();
foreach (AddressReferencedAsset instance in instances)
{
if (!Object.op_Implicit(instance.BoxedAsset))
{
<parallelCoroutine>5__2.Add(instance.LoadAssetAsyncCoroutine());
}
}
goto IL_0090;
case 1:
<>1__state = -1;
goto IL_0090;
case 2:
{
<>1__state = -1;
break;
}
IL_0090:
if (<parallelCoroutine>5__2.MoveNext())
{
<>2__current = null;
<>1__state = 1;
return true;
}
list = new List<Task>();
foreach (AddressReferencedAsset instance2 in instances)
{
if (!Object.op_Implicit(instance2.BoxedAsset))
{
list.Add(instance2.LoadAssetAsync());
}
}
<supertask>5__3 = Task.WhenAll(list);
break;
}
if (!<supertask>5__3.IsCompleted)
{
<>2__current = null;
<>1__state = 2;
return true;
}
_initialized = true;
AddressReferencedAsset.OnAddressReferencedAssetsLoaded?.Invoke();
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
protected static readonly HashSet<string> addressesThatFailedToBeValidated = new HashSet<string>();
protected static readonly HashSet<AddressReferencedAsset> instances = new HashSet<AddressReferencedAsset>();
private static bool _initialized;
public abstract Object BoxedAsset { get; }
public static bool Initialized => _initialized;
public AsyncOperationHandle AsyncOperationHandle { get; protected set; }
[Obsolete("This event no longer runs after anything in particular, it gets invoked on RoR2Application.onLoad for backwards compatibility.")]
public static event Action OnAddressReferencedAssetsLoaded;
protected void SetHooks()
{
if (RoR2Application.loadFinished)
{
CallInitialized();
return;
}
RoR2Application.onLoad = (Action)Delegate.Remove(RoR2Application.onLoad, new Action(CallInitialized));
RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(CallInitialized));
}
protected void UnsetHooks()
{
if (!RoR2Application.loadFinished)
{
RoR2Application.onLoad = (Action)Delegate.Remove(RoR2Application.onLoad, new Action(CallInitialized));
}
}
private void CallInitialized()
{
if (!_initialized)
{
AddressablesPlugin.Logger.LogMessage((object)"AddressReferencedAssets initialized");
_initialized = true;
AddressReferencedAsset.OnAddressReferencedAssetsLoaded?.Invoke();
}
}
private void StartCoroutineOnLoad()
{
((MonoBehaviour)AddressablesPlugin.Instance).StartCoroutine(LoadReferencesAsync());
}
[IteratorStateMachine(typeof(<LoadReferencesAsync>d__18))]
private static IEnumerator LoadReferencesAsync()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LoadReferencesAsync>d__18(0);
}
[Obsolete("If you need to implement this, implement a method that just returns Task.CompeltedTask, loading is now done via LoadAssetAsyncCoroutine instead.")]
protected abstract Task LoadAssetAsync();
protected abstract IEnumerator LoadAssetAsyncCoroutine();
public virtual void Dispose()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
AsyncOperationHandle asyncOperationHandle = AsyncOperationHandle;
if (((AsyncOperationHandle)(ref asyncOperationHandle)).IsValid())
{
Addressables.Release(AsyncOperationHandle);
}
}
}
[Serializable]
public class AddressReferencedBuffDef : AddressReferencedAsset<BuffDef>
{
[CompilerGenerated]
private sealed class <LoadAsyncCoroutine>d__4 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public AddressReferencedBuffDef <>4__this;
private IEnumerator <subroutine>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LoadAsyncCoroutine>d__4(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<subroutine>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Invalid comparison between Unknown and I4
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
int num = <>1__state;
AddressReferencedBuffDef addressReferencedBuffDef = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
if (addressReferencedBuffDef.CanLoadFromCatalog)
{
BuffIndex val = BuffCatalog.FindBuffIndex(addressReferencedBuffDef.Address);
if ((int)val != -1)
{
addressReferencedBuffDef.Asset = BuffCatalog.GetBuffDef(val);
return false;
}
}
<subroutine>5__2 = addressReferencedBuffDef.LoadFromAddressAsyncCoroutine();
break;
case 1:
<>1__state = -1;
break;
}
if (<subroutine>5__2.MoveNext())
{
<>2__current = null;
<>1__state = 1;
return true;
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[SerializeField]
[HideInInspector]
private bool _canLoadFromCatalog = true;
public override bool CanLoadFromCatalog
{
get
{
return _canLoadFromCatalog;
}
protected set
{
_canLoadFromCatalog = value;
}
}
[IteratorStateMachine(typeof(<LoadAsyncCoroutine>d__4))]
protected override IEnumerator LoadAsyncCoroutine()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LoadAsyncCoroutine>d__4(0)
{
<>4__this = this
};
}
[Obsolete("Call LoadAsyncCoroutine instead")]
protected override async Task LoadAsync()
{
if (CanLoadFromCatalog)
{
BuffIndex val = BuffCatalog.FindBuffIndex(base.Address);
if ((int)val != -1)
{
base.Asset = BuffCatalog.GetBuffDef(val);
return;
}
}
await LoadFromAddressAsync();
}
protected override void Load()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Invalid comparison between Unknown and I4
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
if (CanLoadFromCatalog)
{
BuffIndex val = BuffCatalog.FindBuffIndex(base.Address);
if ((int)val != -1)
{
base.Asset = BuffCatalog.GetBuffDef(val);
return;
}
}
LoadFromAddress();
}
public static implicit operator bool(AddressReferencedBuffDef addressReferencedAsset)
{
return Object.op_Implicit((Object)(object)addressReferencedAsset?.Asset);
}
public static implicit operator BuffDef(AddressReferencedBuffDef addressReferencedAsset)
{
return addressReferencedAsset?.Asset;
}
public static implicit operator AddressReferencedBuffDef(string address)
{
return new AddressReferencedBuffDef(address);
}
public static implicit operator AddressReferencedBuffDef(BuffDef asset)
{
return new AddressReferencedBuffDef(asset);
}
public AddressReferencedBuffDef()
{
}
public AddressReferencedBuffDef(BuffDef def)
: base(def)
{
}
public AddressReferencedBuffDef(string addressOrName)
: base(addressOrName)
{
}
}
[Serializable]
public class AddressReferencedEliteDef : AddressReferencedAsset<EliteDef>
{
[CompilerGenerated]
private sealed class <LoadAsyncCoroutine>d__4 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public AddressReferencedEliteDef <>4__this;
private IEnumerator <subroutine>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LoadAsyncCoroutine>d__4(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<subroutine>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
int num = <>1__state;
AddressReferencedEliteDef CS$<>8__locals0 = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
if (CS$<>8__locals0.CanLoadFromCatalog)
{
EliteDef val = ((IEnumerable<EliteDef>)EliteCatalog.eliteDefs).FirstOrDefault((Func<EliteDef, bool>)((EliteDef x) => ((Object)x).name.Equals(CS$<>8__locals0.Address, StringComparison.OrdinalIgnoreCase)));
if ((Object)(object)val != (Object)null)
{
CS$<>8__locals0.Asset = val;
return false;
}
}
<subroutine>5__2 = CS$<>8__locals0.LoadFromAddressAsyncCoroutine();
break;
case 1:
<>1__state = -1;
break;
}
if (<subroutine>5__2.MoveNext())
{
<>2__current = null;
<>1__state = 1;
return true;
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[SerializeField]
[HideInInspector]
private bool _canLoadFromCatalog = true;
public override bool CanLoadFromCatalog
{
get
{
return _canLoadFromCatalog;
}
protected set
{
_canLoadFromCatalog = value;
}
}
[IteratorStateMachine(typeof(<LoadAsyncCoroutine>d__4))]
protected override IEnumerator LoadAsyncCoroutine()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LoadAsyncCoroutine>d__4(0)
{
<>4__this = this
};
}
[Obsolete("Call LoadAsyncCoroutine instead")]
protected override async Task LoadAsync()
{
if (CanLoadFromCatalog)
{
EliteDef val = ((IEnumerable<EliteDef>)EliteCatalog.eliteDefs).FirstOrDefault((Func<EliteDef, bool>)((EliteDef x) => ((Object)x).name.Equals(base.Address, StringComparison.OrdinalIgnoreCase)));
if ((Object)(object)val != (Object)null)
{
base.Asset = val;
return;
}
}
await LoadFromAddressAsync();
}
protected override void Load()
{
if (CanLoadFromCatalog)
{
EliteDef val = ((IEnumerable<EliteDef>)EliteCatalog.eliteDefs).FirstOrDefault((Func<EliteDef, bool>)((EliteDef x) => ((Object)x).name.Equals(base.Address, StringComparison.OrdinalIgnoreCase)));
if ((Object)(object)val != (Object)null)
{
base.Asset = val;
return;
}
}
LoadFromAddress();
}
public static implicit operator bool(AddressReferencedEliteDef addressReferencedAsset)
{
return Object.op_Implicit((Object)(object)addressReferencedAsset?.Asset);
}
public static implicit operator EliteDef(AddressReferencedEliteDef addressReferencedAsset)
{
return addressReferencedAsset?.Asset;
}
public static implicit operator AddressReferencedEliteDef(string address)
{
return new AddressReferencedEliteDef(address);
}
public static implicit operator AddressReferencedEliteDef(EliteDef asset)
{
return new AddressReferencedEliteDef(asset);
}
public AddressReferencedEliteDef()
{
}
public AddressReferencedEliteDef(EliteDef def)
: base(def)
{
}
public AddressReferencedEliteDef(string addressOrName)
: base(addressOrName)
{
}
}
[Serializable]
public class AddressReferencedEquipmentDef : AddressReferencedAsset<EquipmentDef>
{
[CompilerGenerated]
private sealed class <LoadAsyncCoroutine>d__4 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public AddressReferencedEquipmentDef <>4__this;
private IEnumerator <subroutine>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LoadAsyncCoroutine>d__4(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<subroutine>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Invalid comparison between Unknown and I4
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
int num = <>1__state;
AddressReferencedEquipmentDef addressReferencedEquipmentDef = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
if (addressReferencedEquipmentDef.CanLoadFromCatalog)
{
EquipmentIndex val = EquipmentCatalog.FindEquipmentIndex(addressReferencedEquipmentDef.Address);
if ((int)val != -1)
{
addressReferencedEquipmentDef.Asset = EquipmentCatalog.GetEquipmentDef(val);
return false;
}
}
<subroutine>5__2 = addressReferencedEquipmentDef.LoadFromAddressAsyncCoroutine();
break;
case 1:
<>1__state = -1;
break;
}
if (<subroutine>5__2.MoveNext())
{
<>2__current = null;
<>1__state = 1;
return true;
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[SerializeField]
[HideInInspector]
private bool _canLoadFromCatalog = true;
public override bool CanLoadFromCatalog
{
get
{
return _canLoadFromCatalog;
}
protected set
{
_canLoadFromCatalog = value;
}
}
[IteratorStateMachine(typeof(<LoadAsyncCoroutine>d__4))]
protected override IEnumerator LoadAsyncCoroutine()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LoadAsyncCoroutine>d__4(0)
{
<>4__this = this
};
}
[Obsolete("Call LoadAsyncCoroutine instead.")]
protected override async Task LoadAsync()
{
if (CanLoadFromCatalog)
{
EquipmentIndex val = EquipmentCatalog.FindEquipmentIndex(base.Address);
if ((int)val != -1)
{
base.Asset = EquipmentCatalog.GetEquipmentDef(val);
return;
}
}
await LoadFromAddressAsync();
}
protected override void Load()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Invalid comparison between Unknown and I4
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
if (CanLoadFromCatalog)
{
EquipmentIndex val = EquipmentCatalog.FindEquipmentIndex(base.Address);
if ((int)val != -1)
{
base.Asset = EquipmentCatalog.GetEquipmentDef(val);
return;
}
}
LoadFromAddress();
}
public static implicit operator bool(AddressReferencedEquipmentDef addressReferencedAsset)
{
return Object.op_Implicit((Object)(object)addressReferencedAsset?.Asset);
}
public static implicit operator EquipmentDef(AddressReferencedEquipmentDef addressReferencedAsset)
{
return addressReferencedAsset?.Asset;
}
public static implicit operator AddressReferencedEquipmentDef(string address)
{
return new AddressReferencedEquipmentDef(address);
}
public static implicit operator AddressReferencedEquipmentDef(EquipmentDef asset)
{
return new AddressReferencedEquipmentDef(asset);
}
public AddressReferencedEquipmentDef()
{
}
public AddressReferencedEquipmentDef(EquipmentDef def)
: base(def)
{
}
public AddressReferencedEquipmentDef(string addressOrName)
: base(addressOrName)
{
}
}
[Serializable]
public class AddressReferencedExpansionDef : AddressReferencedAsset<ExpansionDef>
{
[CompilerGenerated]
private sealed class <LoadAsyncCoroutine>d__4 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public AddressReferencedExpansionDef <>4__this;
private IEnumerator <subroutine>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LoadAsyncCoroutine>d__4(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<subroutine>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
int num = <>1__state;
AddressReferencedExpansionDef CS$<>8__locals0 = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
if (CS$<>8__locals0.CanLoadFromCatalog)
{
ExpansionDef val = ((IEnumerable<ExpansionDef>)(object)ExpansionCatalog.expansionDefs).FirstOrDefault((Func<ExpansionDef, bool>)((ExpansionDef ed) => ((Object)ed).name.Equals(CS$<>8__locals0.Address, StringComparison.OrdinalIgnoreCase)));
if ((Object)(object)val != (Object)null)
{
CS$<>8__locals0.Asset = val;
return false;
}
}
<subroutine>5__2 = CS$<>8__locals0.LoadFromAddressAsyncCoroutine();
break;
case 1:
<>1__state = -1;
break;
}
if (<subroutine>5__2.MoveNext())
{
<>2__current = null;
<>1__state = 1;
return true;
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[SerializeField]
[HideInInspector]
private bool _canLoadFromCatalog = true;
public override bool CanLoadFromCatalog
{
get
{
return _canLoadFromCatalog;
}
protected set
{
_canLoadFromCatalog = value;
}
}
[IteratorStateMachine(typeof(<LoadAsyncCoroutine>d__4))]
protected override IEnumerator LoadAsyncCoroutine()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LoadAsyncCoroutine>d__4(0)
{
<>4__this = this
};
}
[Obsolete("Call LoadAsyncCoroutine instead")]
protected override async Task LoadAsync()
{
if (CanLoadFromCatalog)
{
ExpansionDef val = ((IEnumerable<ExpansionDef>)(object)ExpansionCatalog.expansionDefs).FirstOrDefault((Func<ExpansionDef, bool>)((ExpansionDef ed) => ((Object)ed).name.Equals(base.Address, StringComparison.OrdinalIgnoreCase)));
if ((Object)(object)val != (Object)null)
{
base.Asset = val;
return;
}
}
await LoadFromAddressAsync();
}
protected override void Load()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
if (CanLoadFromCatalog)
{
ExpansionDef val = ((IEnumerable<ExpansionDef>)(object)ExpansionCatalog.expansionDefs).FirstOrDefault((Func<ExpansionDef, bool>)((ExpansionDef ed) => ((Object)ed).name.Equals(base.Address, StringComparison.OrdinalIgnoreCase)));
if ((Object)(object)val != (Object)null)
{
base.Asset = val;
return;
}
}
LoadFromAddress();
}
public static implicit operator bool(AddressReferencedExpansionDef addressReferencedAsset)
{
return Object.op_Implicit((Object)(object)addressReferencedAsset?.Asset);
}
public static implicit operator ExpansionDef(AddressReferencedExpansionDef addressReferencedAsset)
{
return addressReferencedAsset?.Asset;
}
public static implicit operator AddressReferencedExpansionDef(string address)
{
return new AddressReferencedExpansionDef(address);
}
public static implicit operator AddressReferencedExpansionDef(ExpansionDef asset)
{
return new AddressReferencedExpansionDef(asset);
}
public AddressReferencedExpansionDef()
{
}
public AddressReferencedExpansionDef(ExpansionDef def)
: base(def)
{
}
public AddressReferencedExpansionDef(string addressOrName)
: base(addressOrName)
{
}
}
[Serializable]
public class AddressReferencedItemDef : AddressReferencedAsset<ItemDef>
{
[CompilerGenerated]
private sealed class <LoadAsyncCoroutine>d__4 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public AddressReferencedItemDef <>4__this;
private IEnumerator <subroutine>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LoadAsyncCoroutine>d__4(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<subroutine>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Invalid comparison between Unknown and I4
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
int num = <>1__state;
AddressReferencedItemDef addressReferencedItemDef = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
if (addressReferencedItemDef.CanLoadFromCatalog)
{
ItemIndex val = ItemCatalog.FindItemIndex(addressReferencedItemDef.Address);
if ((int)val != -1)
{
addressReferencedItemDef.Asset = ItemCatalog.GetItemDef(val);
return false;
}
}
<subroutine>5__2 = addressReferencedItemDef.LoadFromAddressAsyncCoroutine();
break;
case 1:
<>1__state = -1;
break;
}
if (<subroutine>5__2.MoveNext())
{
<>2__current = null;
<>1__state = 1;
return true;
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[SerializeField]
[HideInInspector]
private bool _canLoadFromCatalog = true;
public override bool CanLoadFromCatalog
{
get
{
return _canLoadFromCatalog;
}
protected set
{
_canLoadFromCatalog = value;
}
}
[IteratorStateMachine(typeof(<LoadAsyncCoroutine>d__4))]
protected override IEnumerator LoadAsyncCoroutine()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LoadAsyncCoroutine>d__4(0)
{
<>4__this = this
};
}
[Obsolete("Call LoadAsyncCoroutine instead")]
protected override async Task LoadAsync()
{
if (CanLoadFromCatalog)
{
ItemIndex val = ItemCatalog.FindItemIndex(base.Address);
if ((int)val != -1)
{
base.Asset = ItemCatalog.GetItemDef(val);
return;
}
}
await LoadFromAddressAsync();
}
protected override void Load()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Invalid comparison between Unknown and I4
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
if (CanLoadFromCatalog)
{
ItemIndex val = ItemCatalog.FindItemIndex(base.Address);
if ((int)val != -1)
{
base.Asset = ItemCatalog.GetItemDef(val);
return;
}
}
LoadFromAddress();
}
public static implicit operator bool(AddressReferencedItemDef addressReferencedAsset)
{
return Object.op_Implicit((Object)(object)addressReferencedAsset?.Asset);
}
public static implicit operator ItemDef(AddressReferencedItemDef addressReferencedAsset)
{
return addressReferencedAsset?.Asset;
}
public static implicit operator AddressReferencedItemDef(string address)
{
return new AddressReferencedItemDef(address);
}
public static implicit operator AddressReferencedItemDef(ItemDef asset)
{
return new AddressReferencedItemDef(asset);
}
public AddressReferencedItemDef()
{
}
public AddressReferencedItemDef(ItemDef def)
: base(def)
{
}
public AddressReferencedItemDef(string addressOrName)
: base(addressOrName)
{
}
}
[Serializable]
public class AddressReferencedPrefab : AddressReferencedAsset<GameObject>
{
public static implicit operator bool(AddressReferencedPrefab addressReferencedAsset)
{
return Object.op_Implicit((Object)(object)addressReferencedAsset?.Asset);
}
public static implicit operator GameObject(AddressReferencedPrefab addressReferencedAsset)
{
return addressReferencedAsset?.Asset;
}
public static implicit operator AddressReferencedPrefab(string address)
{
return new AddressReferencedPrefab(address);
}
public static implicit operator AddressReferencedPrefab(GameObject asset)
{
return new AddressReferencedPrefab(asset);
}
public AddressReferencedPrefab()
{
}
public AddressReferencedPrefab(GameObject gameObject)
: base(gameObject)
{
}
public AddressReferencedPrefab(string address)
: base(address)
{
}
}
[Serializable]
public class AddressReferencedSpawnCard : AddressReferencedAsset<SpawnCard>
{
public static implicit operator bool(AddressReferencedSpawnCard addressReferencedAsset)
{
return Object.op_Implicit((Object)(object)addressReferencedAsset?.Asset);
}
public static implicit operator SpawnCard(AddressReferencedSpawnCard addressReferencedAsset)
{
return addressReferencedAsset?.Asset;
}
public static implicit operator AddressReferencedSpawnCard(string address)
{
return new AddressReferencedSpawnCard(address);
}
public static implicit operator AddressReferencedSpawnCard(SpawnCard asset)
{
return new AddressReferencedSpawnCard(asset);
}
public AddressReferencedSpawnCard()
{
}
public AddressReferencedSpawnCard(SpawnCard spawnCard)
: base(spawnCard)
{
}
public AddressReferencedSpawnCard(string address)
: base(address)
{
}
}
[Serializable]
public class AddressReferencedUnlockableDef : AddressReferencedAsset<UnlockableDef>
{
[CompilerGenerated]
private sealed class <LoadAsyncCoroutine>d__4 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public AddressReferencedUnlockableDef <>4__this;
private IEnumerator <subroutine>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LoadAsyncCoroutine>d__4(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<subroutine>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
int num = <>1__state;
AddressReferencedUnlockableDef addressReferencedUnlockableDef = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
if (addressReferencedUnlockableDef.CanLoadFromCatalog)
{
UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef(addressReferencedUnlockableDef.Address);
if (Object.op_Implicit((Object)(object)unlockableDef))
{
addressReferencedUnlockableDef.Asset = unlockableDef;
return false;
}
}
<subroutine>5__2 = addressReferencedUnlockableDef.LoadFromAddressAsyncCoroutine();
break;
case 1:
<>1__state = -1;
break;
}
if (<subroutine>5__2.MoveNext())
{
<>2__current = null;
<>1__state = 1;
return true;
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[SerializeField]
[HideInInspector]
private bool _canLoadFromCatalog = true;
public override bool CanLoadFromCatalog
{
get
{
return _canLoadFromCatalog;
}
protected set
{
_canLoadFromCatalog = value;
}
}
[IteratorStateMachine(typeof(<LoadAsyncCoroutine>d__4))]
protected override IEnumerator LoadAsyncCoroutine()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LoadAsyncCoroutine>d__4(0)
{
<>4__this = this
};
}
[Obsolete("Call LoadAsyncCoroutine instead")]
protected override async Task LoadAsync()
{
if (CanLoadFromCatalog)
{
UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef(base.Address);
if (Object.op_Implicit((Object)(object)unlockableDef))
{
base.Asset = unlockableDef;
return;
}
}
await LoadFromAddressAsync();
}
protected override void Load()
{
if (CanLoadFromCatalog)
{
UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef(base.Address);
if (Object.op_Implicit((Object)(object)unlockableDef))
{
base.Asset = unlockableDef;
return;
}
}
LoadFromAddress();
}
public static implicit operator bool(AddressReferencedUnlockableDef addressReferencedAsset)
{
return Object.op_Implicit((Object)(object)addressReferencedAsset?.Asset);
}
public static implicit operator UnlockableDef(AddressReferencedUnlockableDef addressReferencedAsset)
{
return addressReferencedAsset?.Asset;
}
public static implicit operator AddressReferencedUnlockableDef(string address)
{
return new AddressReferencedUnlockableDef(address);
}
public static implicit operator AddressReferencedUnlockableDef(UnlockableDef asset)
{
return new AddressReferencedUnlockableDef(asset);
}
public AddressReferencedUnlockableDef()
{
}
public AddressReferencedUnlockableDef(UnlockableDef def)
: base(def)
{
}
public AddressReferencedUnlockableDef(string addressOrName)
: base(addressOrName)
{
}
}
public class NoCatalogLoadAttribute : Attribute
{
}
}