Code cleanup.
This commit is contained in:
@@ -5,8 +5,8 @@ using System.Collections.Generic;
|
|||||||
namespace Cryville.Common.Collections.Generic {
|
namespace Cryville.Common.Collections.Generic {
|
||||||
public struct PairCollection : IDisposable {
|
public struct PairCollection : IDisposable {
|
||||||
public void Dispose() { }
|
public void Dispose() { }
|
||||||
IPairList _pairList;
|
readonly IPairList _pairList;
|
||||||
IDictionary _dictionary;
|
readonly IDictionary _dictionary;
|
||||||
public PairCollection(object collection) : this() {
|
public PairCollection(object collection) : this() {
|
||||||
var type = collection.GetType();
|
var type = collection.GetType();
|
||||||
if (typeof(IPairList).IsAssignableFrom(type)) _pairList = (IPairList)collection;
|
if (typeof(IPairList).IsAssignableFrom(type)) _pairList = (IPairList)collection;
|
||||||
@@ -20,8 +20,8 @@ namespace Cryville.Common.Collections.Generic {
|
|||||||
}
|
}
|
||||||
public struct PairCollection<TKey, TValue> : IDisposable {
|
public struct PairCollection<TKey, TValue> : IDisposable {
|
||||||
public void Dispose() { }
|
public void Dispose() { }
|
||||||
IPairList<TKey, TValue> _pairList;
|
readonly IPairList<TKey, TValue> _pairList;
|
||||||
IDictionary<TKey, TValue> _dictionary;
|
readonly IDictionary<TKey, TValue> _dictionary;
|
||||||
public PairCollection(object collection) : this() {
|
public PairCollection(object collection) : this() {
|
||||||
var type = collection.GetType();
|
var type = collection.GetType();
|
||||||
if (typeof(IPairList<TKey, TValue>).IsAssignableFrom(type)) _pairList = (IPairList<TKey, TValue>)collection;
|
if (typeof(IPairList<TKey, TValue>).IsAssignableFrom(type)) _pairList = (IPairList<TKey, TValue>)collection;
|
||||||
|
@@ -45,7 +45,7 @@ namespace Cryville.Common.Font {
|
|||||||
return tableDirectoryOffsets;
|
return tableDirectoryOffsets;
|
||||||
}
|
}
|
||||||
public override TableDirectory GetSubTable(UInt32 item) {
|
public override TableDirectory GetSubTable(UInt32 item) {
|
||||||
var i = (UInt32)item;
|
var i = item;
|
||||||
return new TableDirectory(Reader, i);
|
return new TableDirectory(Reader, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -92,7 +92,7 @@ namespace Cryville.Common.Pdt {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public partial class PdtInterpreter {
|
public partial class PdtInterpreter {
|
||||||
readonly static Dictionary<char, int> OP_PRIORITY = new Dictionary<char, int> {
|
static readonly Dictionary<char, int> OP_PRIORITY = new Dictionary<char, int> {
|
||||||
{ '@', 7 },
|
{ '@', 7 },
|
||||||
{ '*', 6 }, { '/', 6 }, { '%', 6 },
|
{ '*', 6 }, { '/', 6 }, { '%', 6 },
|
||||||
{ '+', 5 }, { '-', 5 },
|
{ '+', 5 }, { '-', 5 },
|
||||||
@@ -103,7 +103,7 @@ namespace Cryville.Common.Pdt {
|
|||||||
{ ',', 0 },
|
{ ',', 0 },
|
||||||
{ '$', -1 },
|
{ '$', -1 },
|
||||||
};
|
};
|
||||||
readonly static Dictionary<char, int> OP_TYPE = new Dictionary<char, int> {
|
static readonly Dictionary<char, int> OP_TYPE = new Dictionary<char, int> {
|
||||||
{ '@', 0 },
|
{ '@', 0 },
|
||||||
{ '*', 0 }, { '/', 0 }, { '%', 0 },
|
{ '*', 0 }, { '/', 0 }, { '%', 0 },
|
||||||
{ '+', 0 }, { '-', 0 },
|
{ '+', 0 }, { '-', 0 },
|
||||||
@@ -115,7 +115,7 @@ namespace Cryville.Common.Pdt {
|
|||||||
{ '$', -1 },
|
{ '$', -1 },
|
||||||
};
|
};
|
||||||
|
|
||||||
readonly static PdtExpression _emptyexp;
|
static readonly PdtExpression _emptyexp;
|
||||||
static PdtInterpreter() {
|
static PdtInterpreter() {
|
||||||
var ins = new LinkedList<PdtInstruction>();
|
var ins = new LinkedList<PdtInstruction>();
|
||||||
ins.AddLast(new PdtInstruction.PushConstant(
|
ins.AddLast(new PdtInstruction.PushConstant(
|
||||||
@@ -143,7 +143,7 @@ namespace Cryville.Common.Pdt {
|
|||||||
public override string ToString() {
|
public override string ToString() {
|
||||||
return string.Format("0x{0:x4}: {1}", Type, Value);
|
return string.Format("0x{0:x4}: {1}", Type, Value);
|
||||||
}
|
}
|
||||||
public readonly static PdtExpToken EmptyOperator = new PdtExpToken {
|
public static readonly PdtExpToken EmptyOperator = new PdtExpToken {
|
||||||
Type = 0x0080,
|
Type = 0x0080,
|
||||||
Value = "$",
|
Value = "$",
|
||||||
};
|
};
|
||||||
|
@@ -28,7 +28,7 @@ namespace Cryville.Common.Pdt {
|
|||||||
/// <item><term><c>0x1000</c></term><description>End of Key</description></item>
|
/// <item><term><c>0x1000</c></term><description>End of Key</description></item>
|
||||||
/// </list>
|
/// </list>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
readonly static int[] cm = new int[] {
|
static readonly int[] cm = new int[] {
|
||||||
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
||||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0001, 0x0000, 0x0000, 0x0001, 0x0000, 0x0000,
|
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0001, 0x0000, 0x0000, 0x0001, 0x0000, 0x0000,
|
||||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||||
|
@@ -4,7 +4,7 @@ namespace Cryville.Common.Pdt {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// PDT operator.
|
/// PDT operator.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public unsafe abstract class PdtOperator {
|
public abstract unsafe class PdtOperator {
|
||||||
byte* _prmem;
|
byte* _prmem;
|
||||||
int _loadindex;
|
int _loadindex;
|
||||||
readonly PdtVariableMemory[] _operands;
|
readonly PdtVariableMemory[] _operands;
|
||||||
|
@@ -3,6 +3,6 @@ using UnityEngine;
|
|||||||
namespace Cryville.Common.Unity.UI {
|
namespace Cryville.Common.Unity.UI {
|
||||||
public abstract class SetParameterBehaviour : StateMachineBehaviour {
|
public abstract class SetParameterBehaviour : StateMachineBehaviour {
|
||||||
[SerializeField] protected string m_name;
|
[SerializeField] protected string m_name;
|
||||||
public override abstract void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex);
|
public abstract override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -9,11 +9,11 @@ namespace Cryville.Crtr.Browsing {
|
|||||||
public override object Value {
|
public override object Value {
|
||||||
get {
|
get {
|
||||||
float s_value = GetDisplayValue();
|
float s_value = GetDisplayValue();
|
||||||
return IntegerMode ? (object)(int)s_value : (object)s_value;
|
return IntegerMode ? (int)s_value : (object)s_value;
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
if (value is double) m_value = (double)value;
|
if (value is double) m_value = (double)value;
|
||||||
else m_value = IntegerMode ? (double)(int)value : (double)(float)value;
|
else m_value = IntegerMode ? (int)value : (double)(float)value;
|
||||||
float s_value = GetDisplayValue();
|
float s_value = GetDisplayValue();
|
||||||
m_text.text = s_value.ToString();
|
m_text.text = s_value.ToString();
|
||||||
if (Range != null && MaxStep == 0) {
|
if (Range != null && MaxStep == 0) {
|
||||||
|
@@ -72,7 +72,7 @@ namespace Cryville.Crtr.Components {
|
|||||||
public op_set_shape(PolygonSGO self) : base(1) {
|
public op_set_shape(PolygonSGO self) : base(1) {
|
||||||
_self = self;
|
_self = self;
|
||||||
}
|
}
|
||||||
protected unsafe override void Execute() {
|
protected override unsafe void Execute() {
|
||||||
var o = GetOperand(0);
|
var o = GetOperand(0);
|
||||||
if (o.Type != PdtInternalType.Vector) throw new ArgumentException("Not a vector");
|
if (o.Type != PdtInternalType.Vector) throw new ArgumentException("Not a vector");
|
||||||
_self._shapeLength = (o.Length - sizeof(int)) / sizeof(Vector2);
|
_self._shapeLength = (o.Length - sizeof(int)) / sizeof(Vector2);
|
||||||
|
@@ -8,12 +8,12 @@ namespace Cryville.Crtr.Components {
|
|||||||
SubmitProperty("border", new PropOp.Vector2(v => Border = v));
|
SubmitProperty("border", new PropOp.Vector2(v => Border = v));
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly static Dictionary<float, int> uvrefl
|
static readonly Dictionary<float, int> uvrefl
|
||||||
= new Dictionary<float, int>() {
|
= new Dictionary<float, int>() {
|
||||||
{-0.5f, 0}, {-0.4f, 1}, {0.4f, 2}, {0.5f, 3},
|
{-0.5f, 0}, {-0.4f, 1}, {0.4f, 2}, {0.5f, 3},
|
||||||
};
|
};
|
||||||
static Vector2[] _origuv;
|
static Vector2[] _origuv;
|
||||||
protected new static Vector2[] OriginalUV {
|
protected static new Vector2[] OriginalUV {
|
||||||
get {
|
get {
|
||||||
if (_origuv == null) {
|
if (_origuv == null) {
|
||||||
var m = GenericResources.Meshes["quad_scale3h"];
|
var m = GenericResources.Meshes["quad_scale3h"];
|
||||||
|
@@ -19,7 +19,7 @@ namespace Cryville.Crtr.Components {
|
|||||||
public op_set_frames(SpriteText self) : base(2) {
|
public op_set_frames(SpriteText self) : base(2) {
|
||||||
_self = self;
|
_self = self;
|
||||||
}
|
}
|
||||||
protected unsafe override void Execute() {
|
protected override unsafe void Execute() {
|
||||||
var keys = GetOperand(0).AsString();
|
var keys = GetOperand(0).AsString();
|
||||||
var values = GetOperand(1);
|
var values = GetOperand(1);
|
||||||
int arrtype; int len;
|
int arrtype; int len;
|
||||||
|
@@ -82,9 +82,9 @@ namespace Cryville.Crtr.Event {
|
|||||||
Anchor a_cur;
|
Anchor a_cur;
|
||||||
Anchor a_head;
|
Anchor a_head;
|
||||||
Anchor a_tail;
|
Anchor a_tail;
|
||||||
readonly static int _a_cur = IdentifierManager.SharedInstance.Request("cur");
|
static readonly int _a_cur = IdentifierManager.SharedInstance.Request("cur");
|
||||||
readonly static int _a_head = IdentifierManager.SharedInstance.Request("head");
|
static readonly int _a_head = IdentifierManager.SharedInstance.Request("head");
|
||||||
readonly static int _a_tail = IdentifierManager.SharedInstance.Request("tail");
|
static readonly int _a_tail = IdentifierManager.SharedInstance.Request("tail");
|
||||||
double atime_head;
|
double atime_head;
|
||||||
double atime_tail;
|
double atime_tail;
|
||||||
public Anchor RegisterAnchor(int name, bool dyn = false, int propSrcCount = 0) {
|
public Anchor RegisterAnchor(int name, bool dyn = false, int propSrcCount = 0) {
|
||||||
|
@@ -24,7 +24,7 @@ namespace Cryville.Crtr {
|
|||||||
get;
|
get;
|
||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
public readonly static string FileProtocolPrefix
|
public static readonly string FileProtocolPrefix
|
||||||
#if UNITY_STANDALONE_WIN
|
#if UNITY_STANDALONE_WIN
|
||||||
= "file:///";
|
= "file:///";
|
||||||
#elif UNITY_ANDROID
|
#elif UNITY_ANDROID
|
||||||
@@ -37,9 +37,9 @@ namespace Cryville.Crtr {
|
|||||||
public static SimpleSequencerSource AudioSequencer;
|
public static SimpleSequencerSource AudioSequencer;
|
||||||
public static SimpleSequencerSession AudioSession;
|
public static SimpleSequencerSession AudioSession;
|
||||||
public static InputManager InputManager;
|
public static InputManager InputManager;
|
||||||
public readonly static NetworkTaskWorker NetworkTaskWorker = new NetworkTaskWorker();
|
public static readonly NetworkTaskWorker NetworkTaskWorker = new NetworkTaskWorker();
|
||||||
|
|
||||||
public readonly static JsonSerializerSettings GlobalJsonSerializerSettings
|
public static readonly JsonSerializerSettings GlobalJsonSerializerSettings
|
||||||
= new JsonSerializerSettings() {
|
= new JsonSerializerSettings() {
|
||||||
DefaultValueHandling = DefaultValueHandling.Ignore,
|
DefaultValueHandling = DefaultValueHandling.Ignore,
|
||||||
};
|
};
|
||||||
|
@@ -360,7 +360,7 @@ namespace Cryville.Crtr {
|
|||||||
public abstract void LerpWith(Vector start, float lerpedTime, ref Vector result);
|
public abstract void LerpWith(Vector start, float lerpedTime, ref Vector result);
|
||||||
public abstract float DelerpWith(Vector start, Vector value);
|
public abstract float DelerpWith(Vector start, Vector value);
|
||||||
public abstract bool IsZero();
|
public abstract bool IsZero();
|
||||||
public override abstract string ToString();
|
public abstract override string ToString();
|
||||||
public abstract unsafe void ToArray(float* arr);
|
public abstract unsafe void ToArray(float* arr);
|
||||||
|
|
||||||
public Vector Clone() {
|
public Vector Clone() {
|
||||||
@@ -610,8 +610,8 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
w = aw ? rw : (float?)null;
|
w = aw ? rw : null;
|
||||||
h = ah ? rh : (float?)null;
|
h = ah ? rh : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static VecPtComp Parse(string s) {
|
public static VecPtComp Parse(string s) {
|
||||||
@@ -968,7 +968,7 @@ namespace Cryville.Crtr {
|
|||||||
public class VectorOp : PropOp {
|
public class VectorOp : PropOp {
|
||||||
readonly Action<float[]> _cb;
|
readonly Action<float[]> _cb;
|
||||||
public VectorOp(Action<float[]> cb) { _cb = cb; }
|
public VectorOp(Action<float[]> cb) { _cb = cb; }
|
||||||
protected unsafe override void Execute() {
|
protected override unsafe void Execute() {
|
||||||
var op = GetOperand(0);
|
var op = GetOperand(0);
|
||||||
float[] values;
|
float[] values;
|
||||||
if (op.Type == PdtInternalType.Number) {
|
if (op.Type == PdtInternalType.Number) {
|
||||||
|
@@ -644,7 +644,7 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
unsafe static class oputil {
|
static unsafe class oputil {
|
||||||
public static float AsNumber(PropSrc src) {
|
public static float AsNumber(PropSrc src) {
|
||||||
if (src == null) throw new ArgumentNullException("src");
|
if (src == null) throw new ArgumentNullException("src");
|
||||||
int type; byte[] value;
|
int type; byte[] value;
|
||||||
|
@@ -63,7 +63,7 @@ namespace Cryville.Crtr {
|
|||||||
public class StringArray : PropOp {
|
public class StringArray : PropOp {
|
||||||
readonly Action<string[]> _cb;
|
readonly Action<string[]> _cb;
|
||||||
public StringArray(Action<string[]> cb) { _cb = cb; }
|
public StringArray(Action<string[]> cb) { _cb = cb; }
|
||||||
protected unsafe override void Execute() {
|
protected override unsafe void Execute() {
|
||||||
var op = GetOperand(0);
|
var op = GetOperand(0);
|
||||||
int arrtype; int len;
|
int arrtype; int len;
|
||||||
op.GetArraySuffix(out arrtype, out len);
|
op.GetArraySuffix(out arrtype, out len);
|
||||||
@@ -100,7 +100,7 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class Enum<T> : PropOp {
|
public class Enum<T> : PropOp {
|
||||||
readonly static Dictionary<int, int> _cache = new Dictionary<int, int>();
|
static readonly Dictionary<int, int> _cache = new Dictionary<int, int>();
|
||||||
readonly Action<T> _cb;
|
readonly Action<T> _cb;
|
||||||
readonly Func<int, T> _caster;
|
readonly Func<int, T> _caster;
|
||||||
static Enum() {
|
static Enum() {
|
||||||
|
Reference in New Issue
Block a user