refactor: Update Unity to 2022.3.62
This commit is contained in:
@@ -45,10 +45,8 @@ namespace Cryville.Crtr.Ruleset {
|
||||
internal readonly PdtEvaluator _etor;
|
||||
readonly PdtRuleset _rs;
|
||||
internal Dictionary<Identifier, PdtExpression> _areaFuncs;
|
||||
readonly Dictionary<Identifier, List<JudgeEvent>> evs
|
||||
= new Dictionary<Identifier, List<JudgeEvent>>();
|
||||
readonly Dictionary<Identifier, List<JudgeEvent>> activeEvs
|
||||
= new Dictionary<Identifier, List<JudgeEvent>>();
|
||||
readonly Dictionary<Identifier, List<JudgeEvent>> evs = new();
|
||||
readonly Dictionary<Identifier, List<JudgeEvent>> activeEvs = new();
|
||||
static readonly int _var_pause = IdentifierManager.Shared.Request("pause");
|
||||
readonly JudgeDefinition _judgePause;
|
||||
static readonly IComparer<JudgeEvent> _stcmp = new JudgeEventStartTimeComparer();
|
||||
@@ -59,8 +57,9 @@ namespace Cryville.Crtr.Ruleset {
|
||||
}
|
||||
public Judge(ChartPlayer sys, PdtRuleset rs) {
|
||||
_sys = sys;
|
||||
_etor = new PdtEvaluator();
|
||||
_etor.ContextJudge = this;
|
||||
_etor = new PdtEvaluator {
|
||||
ContextJudge = this
|
||||
};
|
||||
_rs = rs;
|
||||
_areaFuncs = rs.areas;
|
||||
_identop = new PropOp.Identifier(v => _identbuf = new Identifier(v));
|
||||
@@ -88,10 +87,9 @@ namespace Cryville.Crtr.Ruleset {
|
||||
var tev = (Chart.Judge)sev.Unstamped;
|
||||
InsertEvent(tev, new Clip((float)sev.Time, (float)(sev.Time + sev.Duration)), tev.Id, handler);
|
||||
}
|
||||
void InsertEvent(Chart.Judge ev, Clip clip, Identifier id, NoteHandler handler, JudgeCallContext call = default(JudgeCallContext)) {
|
||||
void InsertEvent(Chart.Judge ev, Clip clip, Identifier id, NoteHandler handler, JudgeCallContext call = default) {
|
||||
if (id.Key == _var_pause) throw new InvalidOperationException("Cannot assign the special judge \"pause\" to notes");
|
||||
JudgeDefinition def;
|
||||
if (!_rs.judges.TryGetValue(id, out def)) {
|
||||
if (!_rs.judges.TryGetValue(id, out JudgeDefinition def)) {
|
||||
throw new ArgumentException(string.Format("The chart uses a judge named \"{0}\" that is undefined in the ruleset.", id));
|
||||
}
|
||||
_etor.Evaluate(_identop, def.input);
|
||||
@@ -113,7 +111,7 @@ namespace Cryville.Crtr.Ruleset {
|
||||
}
|
||||
#endregion
|
||||
#region Judge
|
||||
internal readonly IntKeyedDictionary<int> judgeMap = new IntKeyedDictionary<int>();
|
||||
internal readonly IntKeyedDictionary<int> judgeMap = new();
|
||||
void InitJudges() {
|
||||
foreach (var i in _rs.judges) {
|
||||
var id = i.Key;
|
||||
@@ -121,8 +119,8 @@ namespace Cryville.Crtr.Ruleset {
|
||||
}
|
||||
}
|
||||
static bool _flag;
|
||||
static readonly PropOp.Boolean _flagop = new PropOp.Boolean(v => _flag = v);
|
||||
static readonly HitOp _hitop = new HitOp();
|
||||
static readonly PropOp.Boolean _flagop = new(v => _flag = v);
|
||||
static readonly HitOp _hitop = new();
|
||||
class HitOp : PdtOperator {
|
||||
const int MAX_SORTS = 16;
|
||||
readonly float[] _buf = new float[MAX_SORTS];
|
||||
@@ -171,18 +169,18 @@ namespace Cryville.Crtr.Ruleset {
|
||||
static readonly int _var_ft = IdentifierManager.Shared.Request("input_time_from");
|
||||
static readonly int _var_tt = IdentifierManager.Shared.Request("input_time_to");
|
||||
readonly PropStores.Float
|
||||
_numst1 = new PropStores.Float(),
|
||||
_numst2 = new PropStores.Float(),
|
||||
_numst3 = new PropStores.Float(),
|
||||
_numst4 = new PropStores.Float();
|
||||
_numst1 = new(),
|
||||
_numst2 = new(),
|
||||
_numst3 = new(),
|
||||
_numst4 = new();
|
||||
|
||||
static readonly int _var_jt = IdentifierManager.Shared.Request("hit_time");
|
||||
static readonly int _var_jdt = IdentifierManager.Shared.Request("hit_delta_time");
|
||||
static readonly int _var_jv = IdentifierManager.Shared.Request("hit_vec");
|
||||
readonly PropStores.Float
|
||||
_jnumst = new PropStores.Float(),
|
||||
_jdnumst = new PropStores.Float();
|
||||
readonly PropStores.Vector4 _jvecst = new PropStores.Vector4();
|
||||
_jnumst = new(),
|
||||
_jdnumst = new();
|
||||
readonly PropStores.Vector4 _jvecst = new();
|
||||
|
||||
// Adopted from System.Collections.Generic.ArraySortHelper<T>.InternalBinarySearch(T[] array, int index, int length, T value, IComparer<T> comparer)
|
||||
int BinarySearch(List<JudgeEvent> list, float time, int stack) {
|
||||
@@ -370,17 +368,16 @@ namespace Cryville.Crtr.Ruleset {
|
||||
}
|
||||
#endregion
|
||||
#region Score
|
||||
readonly IntKeyedDictionary<int> scoreStringKeys = new IntKeyedDictionary<int>();
|
||||
readonly IntKeyedDictionary<int> scoreStringKeysRev = new IntKeyedDictionary<int>();
|
||||
readonly IntKeyedDictionary<PropSrc> scoreSrcs = new IntKeyedDictionary<PropSrc>();
|
||||
readonly IntKeyedDictionary<PropOp> scoreOps = new IntKeyedDictionary<PropOp>();
|
||||
readonly IntKeyedDictionary<ScoreDefinition> scoreDefs = new IntKeyedDictionary<ScoreDefinition>();
|
||||
readonly IntKeyedDictionary<float> scores = new IntKeyedDictionary<float>();
|
||||
readonly IntKeyedDictionary<string> scoreStringCache = new IntKeyedDictionary<string>();
|
||||
readonly ArrayPool<byte> scoreStringPool = new ArrayPool<byte>();
|
||||
readonly IntKeyedDictionary<string> scoreFormatCache = new IntKeyedDictionary<string>();
|
||||
readonly TargetString scoreFullStr = new TargetString();
|
||||
readonly StringBuffer scoreFullBuf = new StringBuffer();
|
||||
readonly IntKeyedDictionary<int> scoreStringKeys = new();
|
||||
readonly IntKeyedDictionary<int> scoreStringKeysRev = new();
|
||||
readonly IntKeyedDictionary<PropSrc> scoreSrcs = new();
|
||||
readonly IntKeyedDictionary<PropOp> scoreOps = new();
|
||||
readonly IntKeyedDictionary<ScoreDefinition> scoreDefs = new();
|
||||
readonly IntKeyedDictionary<float> scores = new();
|
||||
readonly IntKeyedDictionary<string> scoreStringCache = new();
|
||||
readonly ArrayPool<byte> scoreStringPool = new();
|
||||
readonly IntKeyedDictionary<string> scoreFormatCache = new();
|
||||
readonly StringBuffer scoreFullBuf = new();
|
||||
void InitScores() {
|
||||
foreach (var s in _rs.scores) {
|
||||
var key = s.Key.Key;
|
||||
@@ -404,7 +401,7 @@ namespace Cryville.Crtr.Ruleset {
|
||||
public bool TryGetScoreSrc(int key, out PropSrc value) {
|
||||
return scoreSrcs.TryGetValue(key, out value);
|
||||
}
|
||||
public TargetString GetFullFormattedScoreString() {
|
||||
public int GetFullFormattedScoreString(ArrayPool<char> bufferPool, out char[] result) {
|
||||
lock (_etor) {
|
||||
bool flag = false;
|
||||
scoreFullBuf.Clear();
|
||||
@@ -414,17 +411,16 @@ namespace Cryville.Crtr.Ruleset {
|
||||
scoreFullBuf.AppendFormat(scoreFormatCache[id], scores[id]);
|
||||
flag = true;
|
||||
}
|
||||
scoreFullStr.Length = scoreFullBuf.Count;
|
||||
var arr = scoreFullStr.TrustedAsArray();
|
||||
scoreFullBuf.CopyTo(0, arr, 0, scoreFullBuf.Count);
|
||||
return scoreFullStr;
|
||||
result = bufferPool.Rent(scoreFullBuf.Count);
|
||||
scoreFullBuf.CopyTo(0, result, 0, scoreFullBuf.Count);
|
||||
return scoreFullBuf.Count;
|
||||
}
|
||||
}
|
||||
class ScoreStringSrc : PropSrc {
|
||||
readonly Func<float> _cb;
|
||||
readonly string _format;
|
||||
readonly ArrayPool<byte> _pool;
|
||||
readonly StringBuffer _buf = new StringBuffer() { Culture = CultureInfo.InvariantCulture };
|
||||
readonly StringBuffer _buf = new() { Culture = CultureInfo.InvariantCulture };
|
||||
public ScoreStringSrc(ArrayPool<byte> pool, Func<float> cb, string format)
|
||||
: base(PdtInternalType.String) {
|
||||
_pool = pool;
|
||||
|
Reference in New Issue
Block a user