refactor: Update Unity to 2022.3.62
This commit is contained in:
@@ -12,8 +12,7 @@ namespace Cryville.Crtr.Config {
|
||||
readonly object _target;
|
||||
|
||||
public DefaultPropertyMasterAdapter(object target) {
|
||||
if (target == null) throw new ArgumentNullException("target");
|
||||
_target = target;
|
||||
_target = target ?? throw new ArgumentNullException("target");
|
||||
}
|
||||
|
||||
public string DefaultCategory { get { return "miscellaneous"; } }
|
||||
|
@@ -6,7 +6,7 @@ using System.ComponentModel;
|
||||
|
||||
namespace Cryville.Crtr.Config {
|
||||
public class RulesetConfig {
|
||||
public Generic generic = new Generic();
|
||||
public Generic generic = new();
|
||||
public class Generic {
|
||||
[Category("basic")]
|
||||
[JsonProperty("skin")]
|
||||
@@ -30,9 +30,9 @@ namespace Cryville.Crtr.Config {
|
||||
}
|
||||
}
|
||||
public Dictionary<string, object> configs
|
||||
= new Dictionary<string, object>();
|
||||
= new();
|
||||
public Dictionary<string, InputEntry> inputs
|
||||
= new Dictionary<string, InputEntry>();
|
||||
= new();
|
||||
public class InputEntry {
|
||||
public string handler;
|
||||
public int type;
|
||||
|
@@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Cryville.Crtr.Config {
|
||||
internal class RulesetConfigPropertyMasterAdapter : IPropertyMasterAdapter {
|
||||
readonly List<RulesetConfigPropertyAdapter> _props = new List<RulesetConfigPropertyAdapter>();
|
||||
readonly List<RulesetConfigPropertyAdapter> _props = new();
|
||||
readonly RulesetConfigStore _store;
|
||||
public PdtEvaluator Evaluator { get; private set; }
|
||||
|
||||
@@ -43,11 +43,11 @@ namespace Cryville.Crtr.Config {
|
||||
_master = master;
|
||||
_def = def;
|
||||
Name = (string)key.Name;
|
||||
switch (_def.type) {
|
||||
case ConfigType.number: Type = PropertyType.Number; break;
|
||||
case ConfigType.number_stepped: Type = PropertyType.NumberStepped; break;
|
||||
default: Type = PropertyType.Unknown; break;
|
||||
}
|
||||
Type = _def.type switch {
|
||||
ConfigType.number => PropertyType.Number,
|
||||
ConfigType.number_stepped => PropertyType.NumberStepped,
|
||||
_ => PropertyType.Unknown,
|
||||
};
|
||||
_rangeOp = new PropOp.Clip(v => {
|
||||
m_range[0] = (double)v.Behind;
|
||||
m_range[1] = (double)v.Ahead;
|
||||
@@ -85,7 +85,7 @@ namespace Cryville.Crtr.Config {
|
||||
|
||||
public bool SetMapped { get { return false; } }
|
||||
|
||||
readonly PropStores.Float _numst = new PropStores.Float();
|
||||
readonly PropStores.Float _numst = new();
|
||||
public object MapValue(object value) {
|
||||
_numst.Value = (float)(double)value;
|
||||
if (_def.value == null) return _numst.Value;
|
||||
|
@@ -6,8 +6,8 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Cryville.Crtr.Config {
|
||||
public class RulesetConfigStore {
|
||||
readonly IntKeyedDictionary<PropSrc> _srcs = new IntKeyedDictionary<PropSrc>();
|
||||
readonly Dictionary<string, int> _revMap = new Dictionary<string, int>();
|
||||
readonly IntKeyedDictionary<PropSrc> _srcs = new();
|
||||
readonly Dictionary<string, int> _revMap = new();
|
||||
readonly Dictionary<string, object> _values;
|
||||
public RulesetConfigStore(Dictionary<Identifier, ConfigDefinition> defs, Dictionary<string, object> values) {
|
||||
_values = values;
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user