Code cleanup.
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
return new T[_size];
|
return new T[_size];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Bucket[] _buckets;
|
readonly Bucket[] _buckets;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates an instance of the <see cref="ArrayPool{T}" /> class with the default maximum list size and bucket capacity.
|
/// Creates an instance of the <see cref="ArrayPool{T}" /> class with the default maximum list size and bucket capacity.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@@ -15,7 +15,7 @@ namespace Cryville.Common.Buffers {
|
|||||||
return new List<T>(_size);
|
return new List<T>(_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Bucket[] _buckets;
|
readonly Bucket[] _buckets;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates an instance of the <see cref="ListPool{T}" /> class with the default maximum list size and bucket capacity.
|
/// Creates an instance of the <see cref="ListPool{T}" /> class with the default maximum list size and bucket capacity.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@@ -21,8 +21,9 @@ namespace Cryville.Common {
|
|||||||
public static void Create(string key, Logger logger) {
|
public static void Create(string key, Logger logger) {
|
||||||
Instances[key] = logger;
|
Instances[key] = logger;
|
||||||
if (logPath != null) {
|
if (logPath != null) {
|
||||||
Files[key] = new StreamWriter(logPath + "/" + ((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds).ToString() + "-" + key + ".log");
|
Files[key] = new StreamWriter(logPath + "/" + ((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds).ToString() + "-" + key + ".log") {
|
||||||
Files[key].AutoFlush = true;
|
AutoFlush = true
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void Close() {
|
public static void Close() {
|
||||||
|
@@ -127,7 +127,6 @@ namespace Cryville.Common.Pdt {
|
|||||||
/// <returns>An operator of the specific name.</returns>
|
/// <returns>An operator of the specific name.</returns>
|
||||||
/// <remarks>The parameter count of the returned operator does not necessarily equal to <paramref name="pc" />.</remarks>
|
/// <remarks>The parameter count of the returned operator does not necessarily equal to <paramref name="pc" />.</remarks>
|
||||||
protected abstract PdtOperator GetOperator(string name, int pc);
|
protected abstract PdtOperator GetOperator(string name, int pc);
|
||||||
bool _failure;
|
|
||||||
unsafe void Operate(PdtOperator op, int pc, bool noset = false) {
|
unsafe void Operate(PdtOperator op, int pc, bool noset = false) {
|
||||||
fixed (byte* pmem = _mem) {
|
fixed (byte* pmem = _mem) {
|
||||||
op.Begin(this);
|
op.Begin(this);
|
||||||
|
@@ -1,13 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Text;
|
|
||||||
using UnityEditor;
|
|
||||||
|
|
||||||
namespace Cryville.Common.Pdt {
|
namespace Cryville.Common.Pdt {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Span on the memory of a <see cref="PdtEvaluatorBase" />.
|
/// Span on the memory of a <see cref="PdtEvaluatorBase" />.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public unsafe struct PdtVariableMemory {
|
public unsafe struct PdtVariableMemory {
|
||||||
byte* _ptr;
|
readonly byte* _ptr;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The length of the span.
|
/// The length of the span.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@@ -17,11 +17,9 @@ namespace Cryville.Common.Unity.UI {
|
|||||||
set { m_targetValue = value; }
|
set { m_targetValue = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma warning disable IDE0051
|
|
||||||
protected override void Update() {
|
protected override void Update() {
|
||||||
base.value = (base.value - m_targetValue) * m_smooth + m_targetValue;
|
base.value = (base.value - m_targetValue) * m_smooth + m_targetValue;
|
||||||
base.Update();
|
base.Update();
|
||||||
}
|
}
|
||||||
#pragma warning restore IDE0051
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -21,7 +21,6 @@ namespace Cryville.Crtr.Browsing {
|
|||||||
Text _title;
|
Text _title;
|
||||||
Text _desc;
|
Text _desc;
|
||||||
|
|
||||||
#pragma warning disable IDE0051
|
|
||||||
protected override void Awake() {
|
protected override void Awake() {
|
||||||
base.Awake();
|
base.Awake();
|
||||||
_placeholder = transform.Find("__placeholder__").gameObject;
|
_placeholder = transform.Find("__placeholder__").gameObject;
|
||||||
@@ -39,7 +38,6 @@ namespace Cryville.Crtr.Browsing {
|
|||||||
Sprite.Destroy(_cover.sprite);
|
Sprite.Destroy(_cover.sprite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#pragma warning restore IDE0051
|
|
||||||
public void Load(int id, ChartDetail data) {
|
public void Load(int id, ChartDetail data) {
|
||||||
_id = id;
|
_id = id;
|
||||||
_placeholder.SetActive(false);
|
_placeholder.SetActive(false);
|
||||||
|
@@ -11,7 +11,6 @@ namespace Cryville.Crtr.Browsing {
|
|||||||
|
|
||||||
FileDialog _dialog;
|
FileDialog _dialog;
|
||||||
|
|
||||||
#pragma warning disable IDE0051
|
|
||||||
protected void Start() {
|
protected void Start() {
|
||||||
PathContainer.LoadItem = LoadPathPart;
|
PathContainer.LoadItem = LoadPathPart;
|
||||||
ItemContainer.LoadItem = LoadItem;
|
ItemContainer.LoadItem = LoadItem;
|
||||||
@@ -21,7 +20,6 @@ namespace Cryville.Crtr.Browsing {
|
|||||||
_dialog = GameObject.Instantiate(Resources.Load<GameObject>("Common/FileDialog")).GetComponent<FileDialog>();
|
_dialog = GameObject.Instantiate(Resources.Load<GameObject>("Common/FileDialog")).GetComponent<FileDialog>();
|
||||||
_dialog.gameObject.SetActive(false);
|
_dialog.gameObject.SetActive(false);
|
||||||
}
|
}
|
||||||
#pragma warning restore IDE0051
|
|
||||||
|
|
||||||
private bool LoadPathPart(int id, GameObject obj) {
|
private bool LoadPathPart(int id, GameObject obj) {
|
||||||
var item = ResourceManager.CurrentDirectory[id];
|
var item = ResourceManager.CurrentDirectory[id];
|
||||||
|
@@ -3,11 +3,9 @@
|
|||||||
namespace Cryville.Crtr.Browsing {
|
namespace Cryville.Crtr.Browsing {
|
||||||
public abstract class ResourceBrowserUnit : MonoBehaviour {
|
public abstract class ResourceBrowserUnit : MonoBehaviour {
|
||||||
protected ResourceBrowserMaster Master { get; private set; }
|
protected ResourceBrowserMaster Master { get; private set; }
|
||||||
#pragma warning disable IDE0051
|
|
||||||
protected virtual void Awake() {
|
protected virtual void Awake() {
|
||||||
Master = GetComponentInParent<ResourceBrowserMaster>();
|
Master = GetComponentInParent<ResourceBrowserMaster>();
|
||||||
}
|
}
|
||||||
#pragma warning restore IDE0051
|
|
||||||
public virtual void SlideToLeft() { }
|
public virtual void SlideToLeft() { }
|
||||||
public virtual void SlideToRight() { }
|
public virtual void SlideToRight() { }
|
||||||
}
|
}
|
||||||
|
@@ -4,7 +4,7 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
namespace Cryville.Crtr {
|
namespace Cryville.Crtr {
|
||||||
public class CastedList<T> : IList<T>, IList, IReadOnlyList<T> {
|
public class CastedList<T> : IList<T>, IList, IReadOnlyList<T> {
|
||||||
IList _list;
|
readonly IList _list;
|
||||||
public CastedList(IList list) {
|
public CastedList(IList list) {
|
||||||
_list = list;
|
_list = list;
|
||||||
}
|
}
|
||||||
|
@@ -1,13 +1,10 @@
|
|||||||
using System;
|
using Cryville.Common;
|
||||||
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Reflection;
|
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Cryville.Common;
|
|
||||||
using Cryville.Common.Plist;
|
|
||||||
|
|
||||||
namespace Cryville.Crtr {
|
namespace Cryville.Crtr {
|
||||||
[BinderAttribute(typeof(Cocos2dFramesBinder))]
|
[BinderAttribute(typeof(Cocos2dFramesBinder))]
|
||||||
@@ -21,6 +18,7 @@ namespace Cryville.Crtr {
|
|||||||
|
|
||||||
public Dictionary<string, Frame> frames;
|
public Dictionary<string, Frame> frames;
|
||||||
public class Frame {
|
public class Frame {
|
||||||
|
#pragma warning disable IDE1006
|
||||||
Rect _frame;
|
Rect _frame;
|
||||||
public Rect frame {
|
public Rect frame {
|
||||||
get { return _frame; }
|
get { return _frame; }
|
||||||
@@ -31,8 +29,6 @@ namespace Cryville.Crtr {
|
|||||||
set { _frame = value; }
|
set { _frame = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector2 offset;
|
|
||||||
|
|
||||||
bool _rotated = false;
|
bool _rotated = false;
|
||||||
public bool rotated {
|
public bool rotated {
|
||||||
get { return _rotated; }
|
get { return _rotated; }
|
||||||
@@ -42,6 +38,9 @@ namespace Cryville.Crtr {
|
|||||||
get { return _rotated; }
|
get { return _rotated; }
|
||||||
set { _rotated = value; }
|
set { _rotated = value; }
|
||||||
}
|
}
|
||||||
|
#pragma warning restore IDE1006
|
||||||
|
|
||||||
|
public Vector2 offset;
|
||||||
|
|
||||||
public Rect sourceColorRect;
|
public Rect sourceColorRect;
|
||||||
public Vector2 sourceSize;
|
public Vector2 sourceSize;
|
||||||
|
@@ -4,7 +4,7 @@ using System.Collections.Generic;
|
|||||||
namespace Cryville.Crtr.Event {
|
namespace Cryville.Crtr.Event {
|
||||||
internal class RMVPool {
|
internal class RMVPool {
|
||||||
private class Bucket : ObjectPool<RealtimeMotionValue> {
|
private class Bucket : ObjectPool<RealtimeMotionValue> {
|
||||||
MotionRegistry _reg;
|
readonly MotionRegistry _reg;
|
||||||
public Bucket(string name, int capacity) : base(capacity) {
|
public Bucket(string name, int capacity) : base(capacity) {
|
||||||
_reg = ChartPlayer.motionRegistry[name];
|
_reg = ChartPlayer.motionRegistry[name];
|
||||||
}
|
}
|
||||||
@@ -19,7 +19,7 @@ namespace Cryville.Crtr.Event {
|
|||||||
_buckets.Add(reg.Key, new Bucket(reg.Key, 4096));
|
_buckets.Add(reg.Key, new Bucket(reg.Key, 4096));
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary<RealtimeMotionValue, string> _rented = new Dictionary<RealtimeMotionValue, string>();
|
readonly Dictionary<RealtimeMotionValue, string> _rented = new Dictionary<RealtimeMotionValue, string>();
|
||||||
public RealtimeMotionValue Rent(MotionName name) {
|
public RealtimeMotionValue Rent(MotionName name) {
|
||||||
var n = name.MainName;
|
var n = name.MainName;
|
||||||
var obj = _buckets[n].Rent();
|
var obj = _buckets[n].Rent();
|
||||||
|
@@ -93,7 +93,7 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public sealed class InputProxyHandler : InputHandler {
|
public sealed class InputProxyHandler : InputHandler {
|
||||||
InputDefinition _def;
|
readonly InputDefinition _def;
|
||||||
|
|
||||||
public InputProxyHandler(InputDefinition def, InputHandler src) : base() {
|
public InputProxyHandler(InputDefinition def, InputHandler src) : base() {
|
||||||
_def = def;
|
_def = def;
|
||||||
|
@@ -49,7 +49,7 @@ namespace Cryville.Crtr {
|
|||||||
ChartPlayer.etor.ContextCascadeUpdate(name, new PropSrc.Arbitrary(op.Type, value));
|
ChartPlayer.etor.ContextCascadeUpdate(name, new PropSrc.Arbitrary(op.Type, value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static ArbitraryOp _arbop = new ArbitraryOp();
|
static readonly ArbitraryOp _arbop = new ArbitraryOp();
|
||||||
[ElementList]
|
[ElementList]
|
||||||
public Dictionary<RulesetSelectors, Constraint> Elements = new Dictionary<RulesetSelectors, Constraint>();
|
public Dictionary<RulesetSelectors, Constraint> Elements = new Dictionary<RulesetSelectors, Constraint>();
|
||||||
[PropertyList]
|
[PropertyList]
|
||||||
|
@@ -16,7 +16,7 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Settings _default = new Settings();
|
static readonly Settings _default = new Settings();
|
||||||
[Browsable(false)]
|
[Browsable(false)]
|
||||||
public static Settings Default {
|
public static Settings Default {
|
||||||
get {
|
get {
|
||||||
|
@@ -32,8 +32,12 @@ namespace Cryville.Crtr {
|
|||||||
cpt = s.ScreenPoint;
|
cpt = s.ScreenPoint;
|
||||||
ptime = s.Time;
|
ptime = s.Time;
|
||||||
if (s.CloneType == 2) {
|
if (s.CloneType == 2) {
|
||||||
|
#if UNITY_5_6_OR_NEWER
|
||||||
|
a_head.SetPositionAndRotation(GetCurrentWorldPoint(), Quaternion.Euler(s.Direction));
|
||||||
|
#else
|
||||||
a_head.position = GetCurrentWorldPoint();
|
a_head.position = GetCurrentWorldPoint();
|
||||||
a_head.rotation = Quaternion.Euler(s.Direction);
|
a_head.rotation = Quaternion.Euler(s.Direction);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if (s.CloneType == 3) {
|
else if (s.CloneType == 3) {
|
||||||
spos = Vector3.zero;
|
spos = Vector3.zero;
|
||||||
@@ -114,8 +118,12 @@ namespace Cryville.Crtr {
|
|||||||
i.AppendPoint(p, s.QuatDir);
|
i.AppendPoint(p, s.QuatDir);
|
||||||
i.Seal();
|
i.Seal();
|
||||||
}
|
}
|
||||||
|
#if UNITY_5_6_OR_NEWER
|
||||||
|
a_tail.SetPositionAndRotation(GetCurrentWorldPoint(), Quaternion.Euler(ts.Direction));
|
||||||
|
#else
|
||||||
a_tail.position = GetCurrentWorldPoint();
|
a_tail.position = GetCurrentWorldPoint();
|
||||||
a_tail.rotation = Quaternion.Euler(ts.Direction);
|
a_tail.rotation = Quaternion.Euler(ts.Direction);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if (s.CloneType == 3) EndUpdatePosition(ns);
|
else if (s.CloneType == 3) EndUpdatePosition(ns);
|
||||||
else if (s.CloneType >= 16) EndUpdatePosition(ps);
|
else if (s.CloneType >= 16) EndUpdatePosition(ps);
|
||||||
|
Reference in New Issue
Block a user