JD2022-TU1/main/phone_apps/JDCompanionApp/Assets/Scripts/ResourceLoading/Resource.cs

57 lines
No EOL
1.6 KiB
C#

namespace ResourceLoading
{
public class Resource
{
public enum EState
{
Idle,
Loading,
Unloading,
Error
}
public enum EType
{
Texture
//Sound
}
#region private variables
private string _uri;
private EType _type;
private int _refCount = 1;
private int _loadCount = 0;
private bool _hasPendingOps = false;
private EState _state = EState.Idle;
private UnityEngine.Object _unityResource = null;
#endregion
internal Resource(string uri, EType type)
{
_uri = uri;
_type = type;
}
public EState State { get { return _state; } internal set { _state = value; } }
public string URI { get { return _uri; } }
public EType Type { get { return _type; } }
internal void incRefCount() { ++_refCount; }
internal void decRefCount() { --_refCount; }
internal int RefCount { get { return _refCount; } }
internal void incLoadCount() { ++_loadCount; }
internal void decLoadCount() { --_loadCount; }
internal int LoadCount { get { return _loadCount; } }
internal bool HasPendingOps { get { return _hasPendingOps; } set { _hasPendingOps = value; } }
public UnityEngine.Object UnityResource
{
get { return _unityResource; }
internal set { _unityResource = value; }
}
}
} // namespace JDCompanionApp.Resources