整理Attribute CodeStype

This commit is contained in:
Alex-Rachel
2025-03-10 00:20:22 +08:00
parent dd471eed08
commit 106d90da4d
13 changed files with 106 additions and 56 deletions

View File

@@ -0,0 +1,5 @@
[*]
# ReSharper properties
resharper_csharp_max_line_length = 180
resharper_place_attribute_on_same_line = false

View File

@@ -8,11 +8,20 @@ namespace Launcher
/// </summary>
public class UILoadUpdate : UIBase
{
[SerializeField] public Button _btn_clear;
[SerializeField] public Scrollbar _obj_progress;
[SerializeField] public Text _label_desc;
[SerializeField] public Text _label_appid;
[SerializeField] public Text _label_resid;
[SerializeField]
public Button _btn_clear;
[SerializeField]
public Scrollbar _obj_progress;
[SerializeField]
public Text _label_desc;
[SerializeField]
public Text _label_appid;
[SerializeField]
public Text _label_resid;
public virtual void Start()
{

View File

@@ -18,7 +18,7 @@ namespace TEngine
GroupLogic,
}
[System.AttributeUsage(System.AttributeTargets.Interface)]
[AttributeUsage(AttributeTargets.Interface)]
public class EventInterfaceAttribute : Attribute
{
public EEventGroup EventGroup { get; }

View File

@@ -34,7 +34,8 @@ namespace TEngine
[DisallowMultipleComponent]
public sealed class MemoryPoolSetting : MonoBehaviour
{
[SerializeField] private MemoryStrictCheckType m_EnableStrictCheck = MemoryStrictCheckType.OnlyEnableWhenDevelopment;
[SerializeField]
private MemoryStrictCheckType m_EnableStrictCheck = MemoryStrictCheckType.OnlyEnableWhenDevelopment;
/// <summary>
/// 获取或设置是否开启强制检查。
@@ -72,7 +73,8 @@ namespace TEngine
EnableStrictCheck = false;
break;
}
UnityEngine.Object.Destroy(gameObject);
Destroy(gameObject);
}
}
}

View File

@@ -14,7 +14,7 @@ namespace TEngine
/// 强制更新(不更新无法进入游戏。)
/// </summary>
Force = 1,
/// <summary>
/// 非强制(不更新可以进入游戏。)
/// </summary>
@@ -30,20 +30,21 @@ namespace TEngine
/// 更新存在提示。
/// </summary>
Notice = 1,
/// <summary>
/// 更新非提示。
/// </summary>
NoNotice = 2,
}
[CreateAssetMenu(menuName = "TEngine/UpdateSetting", fileName = "UpdateSetting")]
public class UpdateSetting : ScriptableObject
{
/// <summary>
/// 项目名称。
/// </summary>
[SerializeField] private string projectName = "Demo";
[SerializeField]
private string projectName = "Demo";
public bool Enable
{
@@ -60,7 +61,8 @@ namespace TEngine
[Header("Auto sync with [HybridCLRGlobalSettings]")]
public List<string> HotUpdateAssemblies = new List<string>() { "GameBase.dll", "GameProto.dll", "GameLogic.dll" };
[Header("Need manual setting!")] public List<string> AOTMetaAssemblies = new List<string>() { "mscorlib.dll", "System.dll", "System.Core.dll", "TEngine.Runtime.dll" };
[Header("Need manual setting!")]
public List<string> AOTMetaAssemblies = new List<string>() { "mscorlib.dll", "System.dll", "System.Core.dll", "TEngine.Runtime.dll" };
/// <summary>
/// Dll of main business logic assembly
@@ -79,19 +81,21 @@ namespace TEngine
[Header("更新设置")]
public UpdateStyle UpdateStyle = UpdateStyle.Force;
public UpdateNotice UpdateNotice = UpdateNotice.Notice;
/// <summary>
/// 资源服务器地址。
/// </summary>
[SerializeField] private string ResDownLoadPath = "http://127.0.0.1:8081";
[SerializeField]
private string ResDownLoadPath = "http://127.0.0.1:8081";
/// <summary>
/// 资源服务备用地址。
/// </summary>
[SerializeField] private string FallbackResDownLoadPath = "http://127.0.0.1:8082";
[SerializeField]
private string FallbackResDownLoadPath = "http://127.0.0.1:8082";
/// <summary>
/// 获取资源下载路径。
/// </summary>

View File

@@ -11,7 +11,9 @@ namespace TEngine
[Serializable]
public class AudioCategory
{
[SerializeField] private AudioMixer audioMixer = null;
[SerializeField]
private AudioMixer audioMixer = null;
public List<AudioAgent> AudioAgents;
private readonly AudioMixerGroup _audioMixerGroup;
private AudioGroupConfig _audioGroupConfig;
@@ -72,7 +74,7 @@ namespace TEngine
public AudioCategory(int maxChannel, AudioMixer audioMixer, AudioGroupConfig audioGroupConfig)
{
var audioModule = ModuleSystem.GetModule<IAudioModule>();
this.audioMixer = audioMixer;
_maxChannel = maxChannel;
_audioGroupConfig = audioGroupConfig;

View File

@@ -10,13 +10,17 @@ namespace TEngine
[Serializable]
public sealed class AudioGroupConfig
{
[SerializeField] private string name = null;
[SerializeField]
private string name = null;
[SerializeField] private bool mute = false;
[SerializeField]
private bool mute = false;
[SerializeField, Range(0f, 1f)] private float volume = 1f;
[SerializeField, Range(0f, 1f)]
private float volume = 1f;
[SerializeField] private int agentHelperCount = 1;
[SerializeField]
private int agentHelperCount = 1;
/// <summary>
/// 音效分类,可分别关闭/开启对应分类音效。

View File

@@ -107,6 +107,7 @@ namespace TEngine
{
_eventSystem.SetActive(!value);
}
_showFullWindow = value;
}
}
@@ -139,6 +140,7 @@ namespace TEngine
}
private GameObject _eventSystem;
/// <summary>
/// 游戏框架模块初始化。
/// </summary>
@@ -165,9 +167,9 @@ namespace TEngine
}
_fpsCounter = new FpsCounter(0.5f);
var lastIconX = PlayerPrefs.GetFloat("Debugger.Icon.X", DefaultIconRect.x);
var lastIconY = PlayerPrefs.GetFloat("Debugger.Icon.Y", DefaultIconRect.y);
var lastIconY = PlayerPrefs.GetFloat("Debugger.Icon.Y", DefaultIconRect.y);
var lastWindowX = PlayerPrefs.GetFloat("Debugger.Window.X", DefaultWindowRect.x);
var lastWindowY = PlayerPrefs.GetFloat("Debugger.Window.Y", DefaultWindowRect.y);
var lastWindowWidth = PlayerPrefs.GetFloat("Debugger.Window.Width", DefaultWindowRect.width);
@@ -422,4 +424,4 @@ namespace TEngine
s_TextEditor.text = string.Empty;
}
}
}
}

View File

@@ -11,9 +11,11 @@ namespace TEngine
private IProcedureModule _procedureModule = null;
private ProcedureBase _entranceProcedure = null;
[SerializeField] private string[] availableProcedureTypeNames = null;
[SerializeField]
private string[] availableProcedureTypeNames = null;
[SerializeField] private string entranceProcedureTypeName = null;
[SerializeField]
private string entranceProcedureTypeName = null;
/// <summary>
/// 获取当前流程。

View File

@@ -18,25 +18,27 @@ namespace TEngine
internal partial class ResourceExtComponent : MonoBehaviour
{
public static ResourceExtComponent Instance { private set; get; }
private readonly TimeoutController _timeoutController = new TimeoutController();
/// <summary>
/// 正在加载的资源列表。
/// </summary>
private readonly HashSet<string> _assetLoadingList = new HashSet<string>();
/// <summary>
/// 检查是否可以释放间隔
/// </summary>
[SerializeField] private float checkCanReleaseInterval = 30f;
[SerializeField]
private float checkCanReleaseInterval = 30f;
private float _checkCanReleaseTime = 0.0f;
/// <summary>
/// 对象池自动释放时间间隔
/// </summary>
[SerializeField] private float autoReleaseInterval = 60f;
[SerializeField]
private float autoReleaseInterval = 60f;
/// <summary>
/// 保存加载的图片对象
@@ -68,7 +70,7 @@ namespace TEngine
"SetAssetPool",
autoReleaseInterval, 16, 60, 0);
_loadAssetObjectsLinkedList = new LinkedList<LoadAssetObject>();
InitializedResources();
}
@@ -118,7 +120,7 @@ namespace TEngine
_loadAssetObjectsLinkedList.AddLast(new LoadAssetObject(setAssetObject, assetObject));
setAssetObject.SetAsset(assetObject);
}
private async UniTask TryWaitingLoading(string assetObjectKey)
{
if (_assetLoadingList.Contains(assetObjectKey))
@@ -133,7 +135,6 @@ namespace TEngine
#else
;
#endif
}
catch (OperationCanceledException ex)
{

View File

@@ -22,9 +22,11 @@ namespace TEngine
public sealed class AssetsReference : MonoBehaviour
{
[SerializeField] private GameObject sourceGameObject;
[SerializeField]
private GameObject sourceGameObject;
[SerializeField] private List<AssetsRefInfo> refAssetInfoList;
[SerializeField]
private List<AssetsRefInfo> refAssetInfoList;
private IResourceModule _resourceModule;
@@ -90,6 +92,7 @@ namespace TEngine
{
refAssetInfoList = new List<AssetsRefInfo>();
}
refAssetInfoList.Add(new AssetsRefInfo(source));
return this;
}

View File

@@ -27,11 +27,14 @@ namespace TEngine
private float _lastUnloadUnusedAssetsOperationElapseSeconds = 0f;
[SerializeField] private float minUnloadUnusedAssetsInterval = 60f;
[SerializeField]
private float minUnloadUnusedAssetsInterval = 60f;
[SerializeField] private float maxUnloadUnusedAssetsInterval = 300f;
[SerializeField]
private float maxUnloadUnusedAssetsInterval = 300f;
[SerializeField] private bool useSystemUnloadUnusedAssets = true;
[SerializeField]
private bool useSystemUnloadUnusedAssets = true;
/// <summary>
/// 当前最新的包裹版本。
@@ -41,7 +44,8 @@ namespace TEngine
/// <summary>
/// 资源包名称。
/// </summary>
[SerializeField] private string packageName = "DefaultPackage";
[SerializeField]
private string packageName = "DefaultPackage";
/// <summary>
/// 资源包名称。
@@ -55,7 +59,8 @@ namespace TEngine
/// <summary>
/// 资源系统运行模式。
/// </summary>
[SerializeField] private EPlayMode playMode = EPlayMode.EditorSimulateMode;
[SerializeField]
private EPlayMode playMode = EPlayMode.EditorSimulateMode;
/// <summary>
/// 资源系统运行模式。
@@ -88,7 +93,8 @@ namespace TEngine
/// <summary>
/// 是否支持边玩边下载。
/// </summary>
[SerializeField] private bool updatableWhilePlaying = false;
[SerializeField]
private bool updatableWhilePlaying = false;
/// <summary>
/// 是否支持边玩边下载。
@@ -98,7 +104,8 @@ namespace TEngine
/// <summary>
/// 设置异步系统参数,每帧执行消耗的最大时间切片(单位:毫秒)
/// </summary>
[SerializeField] public long milliseconds = 30;
[SerializeField]
public long milliseconds = 30;
public int downloadingMaxNum = 10;
@@ -111,7 +118,8 @@ namespace TEngine
set => downloadingMaxNum = value;
}
[SerializeField] public int failedTryAgain = 3;
[SerializeField]
public int failedTryAgain = 3;
public int FailedTryAgain
{
@@ -161,13 +169,17 @@ namespace TEngine
/// </summary>
public float LastUnloadUnusedAssetsOperationElapseSeconds => _lastUnloadUnusedAssetsOperationElapseSeconds;
[SerializeField] private float assetAutoReleaseInterval = 60f;
[SerializeField]
private float assetAutoReleaseInterval = 60f;
[SerializeField] private int assetCapacity = 64;
[SerializeField]
private int assetCapacity = 64;
[SerializeField] private float assetExpireTime = 60f;
[SerializeField]
private float assetExpireTime = 60f;
[SerializeField] private int assetPriority = 0;
[SerializeField]
private int assetPriority = 0;
/// <summary>
/// 获取或设置资源对象池自动释放可释放对象的间隔秒数。
@@ -261,7 +273,7 @@ namespace TEngine
{
_lastUnloadUnusedAssetsOperationElapseSeconds += Time.unscaledDeltaTime;
if (_asyncOperation == null && (_forceUnloadUnusedAssets || _lastUnloadUnusedAssetsOperationElapseSeconds >= maxUnloadUnusedAssetsInterval ||
_preorderUnloadUnusedAssets && _lastUnloadUnusedAssetsOperationElapseSeconds >= minUnloadUnusedAssetsInterval))
_preorderUnloadUnusedAssets && _lastUnloadUnusedAssetsOperationElapseSeconds >= minUnloadUnusedAssetsInterval))
{
Log.Info("Unload unused assets...");
_forceUnloadUnusedAssets = false;

View File

@@ -19,16 +19,20 @@ namespace TEngine
return _instance;
}
}
return _instance;
}
}
[SerializeField] private AudioSetting audioSetting;
[SerializeField]
private AudioSetting audioSetting;
[SerializeField] private ProcedureSetting procedureSetting;
[SerializeField]
private ProcedureSetting procedureSetting;
[SerializeField]
private UpdateSetting updateSetting;
[SerializeField] private UpdateSetting updateSetting;
public static AudioSetting AudioSetting => Instance.audioSetting;
public static ProcedureSetting ProcedureSetting => Instance.procedureSetting;