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

@@ -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) {

View File

@@ -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();

View File

@@ -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 });
}
}

View File

@@ -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;

View File

@@ -97,7 +97,7 @@ namespace Cryville.Crtr {
pwp = Vector3.zero;
ptime = s.Time;
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