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

@@ -15,7 +15,7 @@ namespace Cryville.Crtr.Config.UI {
PdtRuleset _ruleset;
InputProxy _proxy;
readonly Dictionary<Identifier, InputConfigPanelEntry> _entries = new Dictionary<Identifier, InputConfigPanelEntry>();
readonly Dictionary<Identifier, InputConfigPanelEntry> _entries = new();
public void Load(PdtRuleset ruleset, RulesetConfig rulesetConfig) {
_ruleset = ruleset;

View File

@@ -29,7 +29,7 @@ namespace Cryville.Crtr.Config.UI {
int _targetDim;
PhysicalDimension? _targetPDim;
bool _targetNotNull;
readonly Dictionary<InputSource, InputDialogEntry> _recvsrcs = new Dictionary<InputSource, InputDialogEntry>();
readonly Dictionary<InputSource, InputDialogEntry> _recvsrcs = new();
void ShowInternal(Action<InputSource?> callback, string message, InputDefinition def, InputProxy proxy) {
_active = true;
_callback = callback;
@@ -56,7 +56,7 @@ namespace Cryville.Crtr.Config.UI {
var result = new PhysicalDimension();
foreach (var comp in comps) {
int dim = 1;
if (comp.Length > 1) dim = int.Parse(comp.Substring(1));
if (comp.Length > 1) dim = int.Parse(comp[1..]);
switch (comp[0]) {
case 'T': result.Time += dim; break;
case 'L': result.Length += dim; break;
@@ -98,8 +98,7 @@ namespace Cryville.Crtr.Config.UI {
Action<InputEvent> _d_HandleInputEvent;
void HandleInputEvent(InputEvent ev) {
InputSource src = ev.Identifier.Source;
InputDialogEntry entry;
if (!_recvsrcs.TryGetValue(src, out entry)) {
if (!_recvsrcs.TryGetValue(src, out InputDialogEntry entry)) {
_recvsrcs.Add(src, entry = AddSourceItem(src));
if (_proxy.IsUsed(src)) {
entry.Status |= InputDeviceStatus.Used;

View File

@@ -74,8 +74,7 @@ namespace Cryville.Crtr.Config.UI {
Dictionary<int, InputVector> _activeInputs;
public void OnInputEvent(InputEvent ev) {
var id = ev.Identifier.Id;
InputVector lastVec;
if (!_activeInputs.TryGetValue(id, out lastVec)) {
if (!_activeInputs.TryGetValue(id, out InputVector lastVec)) {
if (ev.To.IsNull) return;
_activeInputs.Add(id, lastVec = ev.To.Vector);
}

View File

@@ -111,9 +111,8 @@ namespace Cryville.Crtr.Config.UI {
}
float GetRatioFromPos(Vector2 pos) {
Vector2 lp;
RectTransform handleArea = parent.m_handleArea;
if (RectTransformUtility.ScreenPointToLocalPointInRectangle(handleArea, pos, cam, out lp)) {
if (RectTransformUtility.ScreenPointToLocalPointInRectangle(handleArea, pos, cam, out Vector2 lp)) {
lp -= handleArea.rect.position;
return Mathf.Clamp01(lp.x / handleArea.rect.width);
}
@@ -121,8 +120,7 @@ namespace Cryville.Crtr.Config.UI {
}
void SetValueFromPos(Vector2 pos) {
double min, max;
parent.GetRange(out min, out max);
parent.GetRange(out double min, out double max);
double ratio = GetRatioFromPos(pos);
double result = parent.GetValue(ratio, Time.deltaTime, min, max);
if (result < min) result = min;

View File

@@ -34,14 +34,13 @@ namespace Cryville.Crtr.Config.UI {
}
}
readonly Dictionary<string, List<IPropertyAdapter>> _categories = new Dictionary<string, List<IPropertyAdapter>>();
readonly Dictionary<string, List<IPropertyAdapter>> _categories = new();
public void LoadProperties() {
_categories.Clear();
_invalidated = false;
if (Adapter == null) return;
foreach (var p in Adapter.GetProperties()) {
string category = p.Category;
if (category == null) category = Adapter.DefaultCategory;
string category = p.Category ?? Adapter.DefaultCategory;
if (!_categories.ContainsKey(category))
_categories.Add(category, new List<IPropertyAdapter>());
_categories[category].Add(p);