From e5d6e549bd9744840ec1ea9850b9dac79513180c Mon Sep 17 00:00:00 2001 From: PopSlime Date: Mon, 21 Nov 2022 18:16:12 +0800 Subject: [PATCH] Code cleanup. --- Assets/Cryville/Common/Network/HttpResponseStream.cs | 4 +--- Assets/Cryville/Common/Network/TlsClient.cs | 4 +--- Assets/Cryville/Common/Unity/Input/InputManager.cs | 3 +-- Assets/Cryville/Crtr/Chart.cs | 2 +- Assets/Cryville/Crtr/Components/SectionalGameObject.cs | 1 - Assets/Cryville/Crtr/Motion.cs | 4 ++-- Assets/Cryville/Crtr/SpriteFrame.cs | 4 ++-- Assets/Cryville/Crtr/TrackHandler.cs | 2 +- 8 files changed, 9 insertions(+), 15 deletions(-) diff --git a/Assets/Cryville/Common/Network/HttpResponseStream.cs b/Assets/Cryville/Common/Network/HttpResponseStream.cs index 767e944..8c9a96a 100644 --- a/Assets/Cryville/Common/Network/HttpResponseStream.cs +++ b/Assets/Cryville/Common/Network/HttpResponseStream.cs @@ -19,9 +19,7 @@ namespace Cryville.Common.Network { set { throw new NotSupportedException(); } } - public override void Flush() { - // Do nothing - } + public override void Flush() { } public abstract byte[] ReadToEnd(); diff --git a/Assets/Cryville/Common/Network/TlsClient.cs b/Assets/Cryville/Common/Network/TlsClient.cs index a6b1fca..90743bf 100644 --- a/Assets/Cryville/Common/Network/TlsClient.cs +++ b/Assets/Cryville/Common/Network/TlsClient.cs @@ -92,9 +92,7 @@ namespace Cryville.Common.Network { return null; } - public void NotifyServerCertificate(TlsServerCertificate serverCertificate) { - // Do nothing - } + public void NotifyServerCertificate(TlsServerCertificate serverCertificate) { } } } } diff --git a/Assets/Cryville/Common/Unity/Input/InputManager.cs b/Assets/Cryville/Common/Unity/Input/InputManager.cs index 1e03c0b..7a9f88d 100644 --- a/Assets/Cryville/Common/Unity/Input/InputManager.cs +++ b/Assets/Cryville/Common/Unity/Input/InputManager.cs @@ -11,8 +11,7 @@ namespace Cryville.Common.Unity.Input { typeof(UnityMouseHandler), typeof(UnityTouchHandler), }; - // TODO set private - public readonly List _handlers = new List(); + readonly List _handlers = new List(); readonly Dictionary _typemap = new Dictionary(); readonly Dictionary _timeOrigins = new Dictionary(); readonly object _lock = new object(); diff --git a/Assets/Cryville/Crtr/Chart.cs b/Assets/Cryville/Crtr/Chart.cs index 57fc3d2..4f316cf 100644 --- a/Assets/Cryville/Crtr/Chart.cs +++ b/Assets/Cryville/Crtr/Chart.cs @@ -275,7 +275,7 @@ namespace Cryville.Crtr { private void LoadFromString(string s) { Match m = Regex.Match(s, @"^(.+?)(#(\d+))?(@(.+?))?(\^(.+?))?(\*(.+?))?(:(.+))?$"); - if (!m.Success) throw new ArgumentException(); // TODO + if (!m.Success) throw new ArgumentException("Invalid motion string format"); name = new Identifier(m.Groups[1].Value); var registry = ChartPlayer.motionRegistry[name]; if (m.Groups[3].Success) { diff --git a/Assets/Cryville/Crtr/Components/SectionalGameObject.cs b/Assets/Cryville/Crtr/Components/SectionalGameObject.cs index c78636c..82b9b9f 100644 --- a/Assets/Cryville/Crtr/Components/SectionalGameObject.cs +++ b/Assets/Cryville/Crtr/Components/SectionalGameObject.cs @@ -129,7 +129,6 @@ namespace Cryville.Crtr.Components { } } - // Vector3 prevp = Vector3.zero; protected override void AppendPointInternal(Vector3 p, Quaternion r) { if (vertices == null) { vertices = _ptPool.Rent(); diff --git a/Assets/Cryville/Crtr/Motion.cs b/Assets/Cryville/Crtr/Motion.cs index 0f911d2..78457e7 100644 --- a/Assets/Cryville/Crtr/Motion.cs +++ b/Assets/Cryville/Crtr/Motion.cs @@ -367,11 +367,11 @@ namespace Cryville.Crtr { static readonly Type[] stringTypeArray = new Type[] { typeof(string) }; static readonly Type[] floatArrayTypeArray = new Type[] { typeof(float[]) }; public static Vector Construct(Type type, string s) { - if (!typeof(Vector).IsAssignableFrom(type)) throw new ArgumentException(); // TODO + if (!typeof(Vector).IsAssignableFrom(type)) throw new ArgumentException("Type is not vector"); return (Vector)type.GetConstructor(stringTypeArray).Invoke(new object[] { s }); } public static Vector Construct(Type type, float[] values) { - if (!typeof(Vector).IsAssignableFrom(type)) throw new ArgumentException(); // TODO + if (!typeof(Vector).IsAssignableFrom(type)) throw new ArgumentException("Type is not vector"); return (Vector)type.GetConstructor(floatArrayTypeArray).Invoke(new object[] { values }); } } diff --git a/Assets/Cryville/Crtr/SpriteFrame.cs b/Assets/Cryville/Crtr/SpriteFrame.cs index 1455edb..e02a35b 100644 --- a/Assets/Cryville/Crtr/SpriteFrame.cs +++ b/Assets/Cryville/Crtr/SpriteFrame.cs @@ -78,7 +78,7 @@ namespace Cryville.Crtr { public void Init() { if (Texture == null) - throw new InvalidOperationException(); // TODO + throw new InvalidOperationException("Missing texture"); _frame = new Rect(Vector2.zero, Size); var w = _frame.width; var h = _frame.height; @@ -92,7 +92,7 @@ namespace Cryville.Crtr { public void Init(int w, int h, Texture2D _base) { if (Texture != null) - throw new InvalidOperationException(); // TODO + throw new InvalidOperationException("Missing texture"); Texture = _base; float x = _frame.x / w; float y = 1 - _frame.y / h; diff --git a/Assets/Cryville/Crtr/TrackHandler.cs b/Assets/Cryville/Crtr/TrackHandler.cs index c437eb8..a84c55e 100644 --- a/Assets/Cryville/Crtr/TrackHandler.cs +++ b/Assets/Cryville/Crtr/TrackHandler.cs @@ -97,7 +97,7 @@ namespace Cryville.Crtr { pwp = Vector3.zero; ptime = s.Time; length = 0; - //Logger.LogFormat("main", 0, "Debug", "SV: {0}", cs.GetRawValue("svm").Value); + // Logger.LogFormat("main", 0, "Debug", "SV: {0}", cs.GetRawValue("svm").Value); } // TODO Fix anchor rotation