diff --git a/UnityProject/.editorconfig b/UnityProject/.editorconfig new file mode 100644 index 00000000..30cb77d3 --- /dev/null +++ b/UnityProject/.editorconfig @@ -0,0 +1,5 @@ +[*] + +# ReSharper properties +resharper_csharp_max_line_length = 180 +resharper_place_attribute_on_same_line = false diff --git a/UnityProject/Assets/Launcher/Scripts/UILoadUpdate.cs b/UnityProject/Assets/Launcher/Scripts/UILoadUpdate.cs index a5f42b0c..0136d7de 100644 --- a/UnityProject/Assets/Launcher/Scripts/UILoadUpdate.cs +++ b/UnityProject/Assets/Launcher/Scripts/UILoadUpdate.cs @@ -8,11 +8,20 @@ namespace Launcher /// 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() { diff --git a/UnityProject/Assets/TEngine/Runtime/Core/GameEvent/EventInterfaceAttribute.cs b/UnityProject/Assets/TEngine/Runtime/Core/GameEvent/EventInterfaceAttribute.cs index a853585a..abdda857 100644 --- a/UnityProject/Assets/TEngine/Runtime/Core/GameEvent/EventInterfaceAttribute.cs +++ b/UnityProject/Assets/TEngine/Runtime/Core/GameEvent/EventInterfaceAttribute.cs @@ -18,7 +18,7 @@ namespace TEngine GroupLogic, } - [System.AttributeUsage(System.AttributeTargets.Interface)] + [AttributeUsage(AttributeTargets.Interface)] public class EventInterfaceAttribute : Attribute { public EEventGroup EventGroup { get; } diff --git a/UnityProject/Assets/TEngine/Runtime/Core/MemoryPool/MemoryPoolSetting.cs b/UnityProject/Assets/TEngine/Runtime/Core/MemoryPool/MemoryPoolSetting.cs index cddbbf49..2afe74c8 100644 --- a/UnityProject/Assets/TEngine/Runtime/Core/MemoryPool/MemoryPoolSetting.cs +++ b/UnityProject/Assets/TEngine/Runtime/Core/MemoryPool/MemoryPoolSetting.cs @@ -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; /// /// 获取或设置是否开启强制检查。 @@ -72,7 +73,8 @@ namespace TEngine EnableStrictCheck = false; break; } - UnityEngine.Object.Destroy(gameObject); + + Destroy(gameObject); } } } \ No newline at end of file diff --git a/UnityProject/Assets/TEngine/Runtime/Core/UpdateSetting.cs b/UnityProject/Assets/TEngine/Runtime/Core/UpdateSetting.cs index 2671799c..0ab323be 100644 --- a/UnityProject/Assets/TEngine/Runtime/Core/UpdateSetting.cs +++ b/UnityProject/Assets/TEngine/Runtime/Core/UpdateSetting.cs @@ -14,7 +14,7 @@ namespace TEngine /// 强制更新(不更新无法进入游戏。) /// Force = 1, - + /// /// 非强制(不更新可以进入游戏。) /// @@ -30,20 +30,21 @@ namespace TEngine /// 更新存在提示。 /// Notice = 1, - + /// /// 更新非提示。 /// NoNotice = 2, } - + [CreateAssetMenu(menuName = "TEngine/UpdateSetting", fileName = "UpdateSetting")] public class UpdateSetting : ScriptableObject { /// /// 项目名称。 /// - [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 HotUpdateAssemblies = new List() { "GameBase.dll", "GameProto.dll", "GameLogic.dll" }; - [Header("Need manual setting!")] public List AOTMetaAssemblies = new List() { "mscorlib.dll", "System.dll", "System.Core.dll", "TEngine.Runtime.dll" }; + [Header("Need manual setting!")] + public List AOTMetaAssemblies = new List() { "mscorlib.dll", "System.dll", "System.Core.dll", "TEngine.Runtime.dll" }; /// /// Dll of main business logic assembly @@ -79,19 +81,21 @@ namespace TEngine [Header("更新设置")] public UpdateStyle UpdateStyle = UpdateStyle.Force; - + public UpdateNotice UpdateNotice = UpdateNotice.Notice; - + /// /// 资源服务器地址。 /// - [SerializeField] private string ResDownLoadPath = "http://127.0.0.1:8081"; + [SerializeField] + private string ResDownLoadPath = "http://127.0.0.1:8081"; /// /// 资源服务备用地址。 /// - [SerializeField] private string FallbackResDownLoadPath = "http://127.0.0.1:8082"; - + [SerializeField] + private string FallbackResDownLoadPath = "http://127.0.0.1:8082"; + /// /// 获取资源下载路径。 /// diff --git a/UnityProject/Assets/TEngine/Runtime/Module/AudioModule/AudioCategory.cs b/UnityProject/Assets/TEngine/Runtime/Module/AudioModule/AudioCategory.cs index ace64120..e2f158a1 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/AudioModule/AudioCategory.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/AudioModule/AudioCategory.cs @@ -11,7 +11,9 @@ namespace TEngine [Serializable] public class AudioCategory { - [SerializeField] private AudioMixer audioMixer = null; + [SerializeField] + private AudioMixer audioMixer = null; + public List 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(); - + this.audioMixer = audioMixer; _maxChannel = maxChannel; _audioGroupConfig = audioGroupConfig; diff --git a/UnityProject/Assets/TEngine/Runtime/Module/AudioModule/AudioGroupConfig.cs b/UnityProject/Assets/TEngine/Runtime/Module/AudioModule/AudioGroupConfig.cs index 6a903931..0cada029 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/AudioModule/AudioGroupConfig.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/AudioModule/AudioGroupConfig.cs @@ -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; /// /// 音效分类,可分别关闭/开启对应分类音效。 diff --git a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Debugger.cs b/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Debugger.cs index 8587da58..74fd0d20 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Debugger.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Debugger.cs @@ -107,6 +107,7 @@ namespace TEngine { _eventSystem.SetActive(!value); } + _showFullWindow = value; } } @@ -139,6 +140,7 @@ namespace TEngine } private GameObject _eventSystem; + /// /// 游戏框架模块初始化。 /// @@ -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; } } -} +} \ No newline at end of file diff --git a/UnityProject/Assets/TEngine/Runtime/Module/ProcedureModule/ProcedureSetting.cs b/UnityProject/Assets/TEngine/Runtime/Module/ProcedureModule/ProcedureSetting.cs index c1cf0593..4fb86db0 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/ProcedureModule/ProcedureSetting.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/ProcedureModule/ProcedureSetting.cs @@ -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; /// /// 获取当前流程。 diff --git a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Extension/ResourceExtComponent.cs b/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Extension/ResourceExtComponent.cs index 3383795c..a77336dd 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Extension/ResourceExtComponent.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Extension/ResourceExtComponent.cs @@ -18,25 +18,27 @@ namespace TEngine internal partial class ResourceExtComponent : MonoBehaviour { public static ResourceExtComponent Instance { private set; get; } - + private readonly TimeoutController _timeoutController = new TimeoutController(); - + /// /// 正在加载的资源列表。 /// private readonly HashSet _assetLoadingList = new HashSet(); - + /// /// 检查是否可以释放间隔 /// - [SerializeField] private float checkCanReleaseInterval = 30f; + [SerializeField] + private float checkCanReleaseInterval = 30f; private float _checkCanReleaseTime = 0.0f; /// /// 对象池自动释放时间间隔 /// - [SerializeField] private float autoReleaseInterval = 60f; + [SerializeField] + private float autoReleaseInterval = 60f; /// /// 保存加载的图片对象 @@ -68,7 +70,7 @@ namespace TEngine "SetAssetPool", autoReleaseInterval, 16, 60, 0); _loadAssetObjectsLinkedList = new LinkedList(); - + 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) { diff --git a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Reference/AssetsReference.cs b/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Reference/AssetsReference.cs index 67725baa..8cd2895d 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Reference/AssetsReference.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Reference/AssetsReference.cs @@ -22,9 +22,11 @@ namespace TEngine public sealed class AssetsReference : MonoBehaviour { - [SerializeField] private GameObject sourceGameObject; + [SerializeField] + private GameObject sourceGameObject; - [SerializeField] private List refAssetInfoList; + [SerializeField] + private List refAssetInfoList; private IResourceModule _resourceModule; @@ -90,6 +92,7 @@ namespace TEngine { refAssetInfoList = new List(); } + refAssetInfoList.Add(new AssetsRefInfo(source)); return this; } diff --git a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/ResourceModuleDriver.cs b/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/ResourceModuleDriver.cs index 38f37691..1b9cd83b 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/ResourceModuleDriver.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/ResourceModuleDriver.cs @@ -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; /// /// 当前最新的包裹版本。 @@ -41,7 +44,8 @@ namespace TEngine /// /// 资源包名称。 /// - [SerializeField] private string packageName = "DefaultPackage"; + [SerializeField] + private string packageName = "DefaultPackage"; /// /// 资源包名称。 @@ -55,7 +59,8 @@ namespace TEngine /// /// 资源系统运行模式。 /// - [SerializeField] private EPlayMode playMode = EPlayMode.EditorSimulateMode; + [SerializeField] + private EPlayMode playMode = EPlayMode.EditorSimulateMode; /// /// 资源系统运行模式。 @@ -88,7 +93,8 @@ namespace TEngine /// /// 是否支持边玩边下载。 /// - [SerializeField] private bool updatableWhilePlaying = false; + [SerializeField] + private bool updatableWhilePlaying = false; /// /// 是否支持边玩边下载。 @@ -98,7 +104,8 @@ namespace TEngine /// /// 设置异步系统参数,每帧执行消耗的最大时间切片(单位:毫秒) /// - [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 /// 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; /// /// 获取或设置资源对象池自动释放可释放对象的间隔秒数。 @@ -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; diff --git a/UnityProject/Assets/TEngine/Runtime/Module/Settings/Settings.cs b/UnityProject/Assets/TEngine/Runtime/Module/Settings/Settings.cs index 4e575938..e65713fb 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/Settings/Settings.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/Settings/Settings.cs @@ -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;