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