Code cleanup.

This commit is contained in:
2022-11-21 18:16:12 +08:00
parent 145c0ce6c8
commit e5d6e549bd
8 changed files with 9 additions and 15 deletions

View File

@@ -19,9 +19,7 @@ namespace Cryville.Common.Network {
set { throw new NotSupportedException(); } set { throw new NotSupportedException(); }
} }
public override void Flush() { public override void Flush() { }
// Do nothing
}
public abstract byte[] ReadToEnd(); public abstract byte[] ReadToEnd();

View File

@@ -92,9 +92,7 @@ namespace Cryville.Common.Network {
return null; return null;
} }
public void NotifyServerCertificate(TlsServerCertificate serverCertificate) { public void NotifyServerCertificate(TlsServerCertificate serverCertificate) { }
// Do nothing
}
} }
} }
} }

View File

@@ -11,8 +11,7 @@ namespace Cryville.Common.Unity.Input {
typeof(UnityMouseHandler), typeof(UnityMouseHandler),
typeof(UnityTouchHandler), typeof(UnityTouchHandler),
}; };
// TODO set private readonly List<InputHandler> _handlers = new List<InputHandler>();
public readonly List<InputHandler> _handlers = new List<InputHandler>();
readonly Dictionary<Type, InputHandler> _typemap = new Dictionary<Type, InputHandler>(); readonly Dictionary<Type, InputHandler> _typemap = new Dictionary<Type, InputHandler>();
readonly Dictionary<InputHandler, double> _timeOrigins = new Dictionary<InputHandler, double>(); readonly Dictionary<InputHandler, double> _timeOrigins = new Dictionary<InputHandler, double>();
readonly object _lock = new object(); readonly object _lock = new object();

View File

@@ -275,7 +275,7 @@ namespace Cryville.Crtr {
private void LoadFromString(string s) { private void LoadFromString(string s) {
Match m = Regex.Match(s, @"^(.+?)(#(\d+))?(@(.+?))?(\^(.+?))?(\*(.+?))?(:(.+))?$"); 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); name = new Identifier(m.Groups[1].Value);
var registry = ChartPlayer.motionRegistry[name]; var registry = ChartPlayer.motionRegistry[name];
if (m.Groups[3].Success) { if (m.Groups[3].Success) {

View File

@@ -129,7 +129,6 @@ namespace Cryville.Crtr.Components {
} }
} }
// Vector3 prevp = Vector3.zero;
protected override void AppendPointInternal(Vector3 p, Quaternion r) { protected override void AppendPointInternal(Vector3 p, Quaternion r) {
if (vertices == null) { if (vertices == null) {
vertices = _ptPool.Rent(); vertices = _ptPool.Rent();

View File

@@ -367,11 +367,11 @@ namespace Cryville.Crtr {
static readonly Type[] stringTypeArray = new Type[] { typeof(string) }; static readonly Type[] stringTypeArray = new Type[] { typeof(string) };
static readonly Type[] floatArrayTypeArray = new Type[] { typeof(float[]) }; static readonly Type[] floatArrayTypeArray = new Type[] { typeof(float[]) };
public static Vector Construct(Type type, string s) { 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 }); return (Vector)type.GetConstructor(stringTypeArray).Invoke(new object[] { s });
} }
public static Vector Construct(Type type, float[] values) { 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 }); return (Vector)type.GetConstructor(floatArrayTypeArray).Invoke(new object[] { values });
} }
} }

View File

@@ -78,7 +78,7 @@ namespace Cryville.Crtr {
public void Init() { public void Init() {
if (Texture == null) if (Texture == null)
throw new InvalidOperationException(); // TODO throw new InvalidOperationException("Missing texture");
_frame = new Rect(Vector2.zero, Size); _frame = new Rect(Vector2.zero, Size);
var w = _frame.width; var w = _frame.width;
var h = _frame.height; var h = _frame.height;
@@ -92,7 +92,7 @@ namespace Cryville.Crtr {
public void Init(int w, int h, Texture2D _base) { public void Init(int w, int h, Texture2D _base) {
if (Texture != null) if (Texture != null)
throw new InvalidOperationException(); // TODO throw new InvalidOperationException("Missing texture");
Texture = _base; Texture = _base;
float x = _frame.x / w; float x = _frame.x / w;
float y = 1 - _frame.y / h; float y = 1 - _frame.y / h;

View File

@@ -97,7 +97,7 @@ namespace Cryville.Crtr {
pwp = Vector3.zero; pwp = Vector3.zero;
ptime = s.Time; ptime = s.Time;
length = 0; length = 0;
//Logger.LogFormat("main", 0, "Debug", "SV: {0}", cs.GetRawValue<Vec1m>("svm").Value); // Logger.LogFormat("main", 0, "Debug", "SV: {0}", cs.GetRawValue<Vec1m>("svm").Value);
} }
// TODO Fix anchor rotation // TODO Fix anchor rotation