Code cleanup.

This commit is contained in:
2023-01-27 17:30:10 +08:00
parent 130896df1f
commit c4b139c7a4
4 changed files with 6 additions and 6 deletions

View File

@@ -194,7 +194,7 @@ namespace Cryville.Crtr {
public virtual EventList GetEventsOfType(string type) {
switch (type) {
case "motions": return new EventList<Chart.Motion>(motions);
default: throw new ArgumentException(string.Format("Unknown event type {0}", type));
default: throw new ArgumentException(string.Format("Unknown event type \"{0}\"", type));
}
}
}

View File

@@ -104,6 +104,8 @@ namespace Cryville.Crtr.Event {
CachedValues = new Dictionary<Identifier, MotionCache>(ChartPlayer.motionRegistry.Count);
foreach (var m in ChartPlayer.motionRegistry)
Values.Add(m.Key, new RealtimeMotionValue().Init(Parent == null ? m.Value.GlobalInitValue : m.Value.InitValue));
rootPrototype = this;
}
static void AddChild(EventContainer c, ContainerState s, ContainerState target) {
@@ -148,8 +150,6 @@ namespace Cryville.Crtr.Event {
else if (ct >= 16) Handler.ps = r;
else throw new InvalidOperationException("Invalid clone type");
r.prototype = this;
if (prototype == null) r.rootPrototype = this;
else r.rootPrototype = rootPrototype;
r.CloneType = ct;
return r;
}

View File

@@ -103,7 +103,7 @@ namespace Cryville.Crtr {
static Type GetComponentByName(string name) {
Type result;
if (GenericResources.Components.TryGetValue(name, out result)) return result;
throw new ArgumentException(string.Format("Component type {0} not found", name));
throw new ArgumentException(string.Format("Component type \"{0}\" not found", name));
}
}
}

View File

@@ -49,13 +49,13 @@ namespace Cryville.Crtr {
var ctype = Component;
var comp = (SkinComponent)obj.GetComponent(ctype);
if (comp == null) throw new InvalidOperationException(string.Format(
"Trying to set property {0} but the component is not found",
"Trying to set property \"{0}\" but the component is not found",
IdentifierManager.SharedInstance.Retrieve(Name)
));
SkinProperty result;
if (!comp.Properties.TryGetValue(Name, out result))
throw new InvalidOperationException(string.Format(
"Property {0} not found on component",
"Property \"{0}\" not found on component",
IdentifierManager.SharedInstance.Retrieve(Name)
));
return result;