refactor: Update Unity to 2022.3.62

This commit is contained in:
2025-06-21 01:22:02 +08:00
parent d71bf7d4a5
commit 283783954f
112 changed files with 778 additions and 907 deletions

View File

@@ -38,10 +38,10 @@ namespace Cryville.Crtr.Ruleset {
}
}
#region Settings
readonly Dictionary<Identifier, InputProxyEntry> _tproxies = new Dictionary<Identifier, InputProxyEntry>();
readonly Dictionary<InputSource, InputProxyEntry> _sproxies = new Dictionary<InputSource, InputProxyEntry>();
readonly Dictionary<Identifier, int> _use = new Dictionary<Identifier, int>();
readonly Dictionary<Identifier, List<Identifier>> _rev = new Dictionary<Identifier, List<Identifier>>();
readonly Dictionary<Identifier, InputProxyEntry> _tproxies = new();
readonly Dictionary<InputSource, InputProxyEntry> _sproxies = new();
readonly Dictionary<Identifier, int> _use = new();
readonly Dictionary<Identifier, List<Identifier>> _rev = new();
public event EventHandler<ProxyChangedEventArgs> ProxyChanged;
public void LoadFrom(Dictionary<string, RulesetConfig.InputEntry> config) {
foreach (var cfg in config) {
@@ -140,8 +140,7 @@ namespace Cryville.Crtr.Ruleset {
}
}
void BroadcastProxyChanged(Identifier name) {
var del = ProxyChanged;
if (del != null) del(this, this[name]);
ProxyChanged?.Invoke(this, this[name]);
}
public ProxyChangedEventArgs this[Identifier name] {
get {
@@ -230,8 +229,8 @@ namespace Cryville.Crtr.Ruleset {
int dim;
if (op.Type == PdtInternalType.Number) dim = 1;
else if (op.Type == PdtInternalType.Vector) {
int arrtype, _;
op.GetArraySuffix(out arrtype, out _);
int _;
op.GetArraySuffix(out int arrtype, out _);
if (arrtype != PdtInternalType.Number)
throw new InvalidCastException("Not a vector of numbers");
dim = Math.Min(3, (op.Length - sizeof(int)) / sizeof(float));
@@ -245,10 +244,10 @@ namespace Cryville.Crtr.Ruleset {
}
}
}
readonly Dictionary<InputHandler, double> _timeOrigins = new Dictionary<InputHandler, double>();
readonly Dictionary<Identifier, int> _targetActiveCount = new Dictionary<Identifier, int>();
readonly Dictionary<InputIdentifier, float> _vect = new Dictionary<InputIdentifier, float>();
readonly Dictionary<ProxiedInputIdentifier, Vector4> _vecs = new Dictionary<ProxiedInputIdentifier, Vector4>();
readonly Dictionary<InputHandler, double> _timeOrigins = new();
readonly Dictionary<Identifier, int> _targetActiveCount = new();
readonly Dictionary<InputIdentifier, float> _vect = new();
readonly Dictionary<ProxiedInputIdentifier, Vector4> _vecs = new();
double? _lockTime = null;
unsafe void OnInput(InputIdentifier id, InputFrame frame) {
var rc = id.Source.Handler.ReferenceCue;
@@ -264,10 +263,9 @@ namespace Cryville.Crtr.Ruleset {
Monitor.Enter(_etor);
try {
Profiler.BeginSample("InputProxy.OnInput");
InputProxyEntry proxy;
if (_sproxies.TryGetValue(id.Source, out proxy)) {
float ft, tt = (float)GetSyncedTime(frame.Time, id.Source.Handler);
if (!_vect.TryGetValue(id, out ft)) ft = tt;
if (_sproxies.TryGetValue(id.Source, out InputProxyEntry proxy)) {
float tt = (float)GetSyncedTime(frame.Time, id.Source.Handler);
if (!_vect.TryGetValue(id, out float ft)) ft = tt;
_etor.ContextCascadeInsert();
try {
if (frame.IsNull) {
@@ -293,7 +291,7 @@ namespace Cryville.Crtr.Ruleset {
}
static readonly int _var_fv = IdentifierManager.Shared.Request("input_vec_from");
static readonly int _var_tv = IdentifierManager.Shared.Request("input_vec_to");
readonly InputVectorSrc _vecsrc = new InputVectorSrc();
readonly InputVectorSrc _vecsrc = new();
unsafe void OnInput(InputIdentifier id, Identifier target, float ft, float tt, bool nullFlag, int depth = 0) {
if (depth >= MAX_DEPTH) throw new InputProxyException("Input propagation limit reached\nThe ruleset has invalid input definitions");
var def = _ruleset.inputs[target];
@@ -318,8 +316,8 @@ namespace Cryville.Crtr.Ruleset {
else {
var pid = new ProxiedInputIdentifier { Source = id, Target = target };
PropSrc fv, tv = _etor.ContextCascadeLookup(_var_input_vec);
bool hfv; Vector4 ifv;
if (hfv = _vecs.TryGetValue(pid, out ifv)) {
bool hfv;
if (hfv = _vecs.TryGetValue(pid, out RVector4 ifv)) {
_vecsrc.Set(ifv);
fv = _vecsrc;
}
@@ -352,11 +350,10 @@ namespace Cryville.Crtr.Ruleset {
lock (_etor) {
foreach (var vec in _vecs) {
if (vec.Key.Source.Source.Handler != handler) continue;
InputProxyEntry proxy;
if (!_sproxies.TryGetValue(vec.Key.Source.Source, out proxy)) continue;
if (!_sproxies.TryGetValue(vec.Key.Source.Source, out InputProxyEntry proxy)) continue;
float ft, tt = (float)GetSyncedTime(time, handler);
if (_vect.TryGetValue(vec.Key.Source, out ft) && ft < tt) {
float tt = (float)GetSyncedTime(time, handler);
if (_vect.TryGetValue(vec.Key.Source, out float ft) && ft < tt) {
_etor.ContextCascadeInsert();
_vecsrcs[0].Set(vec.Value);
_etor.ContextCascadeUpdate(_var_input_vec, _vecsrcs[0]);
@@ -434,17 +431,17 @@ namespace Cryville.Crtr.Ruleset {
public struct ProxiedInputIdentifier : IEquatable<ProxiedInputIdentifier> {
public InputIdentifier Source { get; set; }
public Identifier Target { get; set; }
public override bool Equals(object obj) {
if (obj == null || !(obj is ProxiedInputIdentifier)) return false;
return Equals((ProxiedInputIdentifier)obj);
public override readonly bool Equals(object obj) {
if (obj == null || obj is not ProxiedInputIdentifier other) return false;
return Equals(other);
}
public bool Equals(ProxiedInputIdentifier other) {
public readonly bool Equals(ProxiedInputIdentifier other) {
return Source == other.Source && Target == other.Target;
}
public override int GetHashCode() {
public override readonly int GetHashCode() {
return Source.GetHashCode() ^ Target.GetHashCode();
}
public override string ToString() {
public override readonly string ToString() {
return string.Format("{0}->{1}", Source, Target);
}
public static bool operator ==(ProxiedInputIdentifier lhs, ProxiedInputIdentifier rhs) {