diff --git a/Assets/Cryville/Common/Buffers/ArrayPool.cs b/Assets/Cryville/Common/Buffers/ArrayPool.cs index 20bef71..b39ef70 100644 --- a/Assets/Cryville/Common/Buffers/ArrayPool.cs +++ b/Assets/Cryville/Common/Buffers/ArrayPool.cs @@ -13,7 +13,7 @@ return new T[_size]; } } - Bucket[] _buckets; + readonly Bucket[] _buckets; /// /// Creates an instance of the class with the default maximum list size and bucket capacity. /// diff --git a/Assets/Cryville/Common/Buffers/ListPool.cs b/Assets/Cryville/Common/Buffers/ListPool.cs index 90b9e9e..2afa8d3 100644 --- a/Assets/Cryville/Common/Buffers/ListPool.cs +++ b/Assets/Cryville/Common/Buffers/ListPool.cs @@ -15,7 +15,7 @@ namespace Cryville.Common.Buffers { return new List(_size); } } - Bucket[] _buckets; + readonly Bucket[] _buckets; /// /// Creates an instance of the class with the default maximum list size and bucket capacity. /// diff --git a/Assets/Cryville/Common/Logger.cs b/Assets/Cryville/Common/Logger.cs index 8686222..f251881 100644 --- a/Assets/Cryville/Common/Logger.cs +++ b/Assets/Cryville/Common/Logger.cs @@ -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() { diff --git a/Assets/Cryville/Common/Pdt/PdtEvaluatorBase.cs b/Assets/Cryville/Common/Pdt/PdtEvaluatorBase.cs index 2af293a..9d5fabe 100644 --- a/Assets/Cryville/Common/Pdt/PdtEvaluatorBase.cs +++ b/Assets/Cryville/Common/Pdt/PdtEvaluatorBase.cs @@ -127,7 +127,6 @@ namespace Cryville.Common.Pdt { /// An operator of the specific name. /// The parameter count of the returned operator does not necessarily equal to . 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); diff --git a/Assets/Cryville/Common/Pdt/PdtVariableMemory.cs b/Assets/Cryville/Common/Pdt/PdtVariableMemory.cs index a8b6360..8eacff3 100644 --- a/Assets/Cryville/Common/Pdt/PdtVariableMemory.cs +++ b/Assets/Cryville/Common/Pdt/PdtVariableMemory.cs @@ -1,13 +1,11 @@ using System; -using System.Text; -using UnityEditor; namespace Cryville.Common.Pdt { /// /// Span on the memory of a . /// public unsafe struct PdtVariableMemory { - byte* _ptr; + readonly byte* _ptr; /// /// The length of the span. /// diff --git a/Assets/Cryville/Common/Unity/UI/ProgressBar.cs b/Assets/Cryville/Common/Unity/UI/ProgressBar.cs index e6b85e5..d94c66e 100644 --- a/Assets/Cryville/Common/Unity/UI/ProgressBar.cs +++ b/Assets/Cryville/Common/Unity/UI/ProgressBar.cs @@ -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 } } diff --git a/Assets/Cryville/Crtr/Browsing/DetailPanel.cs b/Assets/Cryville/Crtr/Browsing/DetailPanel.cs index 2cf9ae7..72c0724 100644 --- a/Assets/Cryville/Crtr/Browsing/DetailPanel.cs +++ b/Assets/Cryville/Crtr/Browsing/DetailPanel.cs @@ -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); diff --git a/Assets/Cryville/Crtr/Browsing/ResourceBrowser.cs b/Assets/Cryville/Crtr/Browsing/ResourceBrowser.cs index 97e54f4..3e59dce 100644 --- a/Assets/Cryville/Crtr/Browsing/ResourceBrowser.cs +++ b/Assets/Cryville/Crtr/Browsing/ResourceBrowser.cs @@ -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("Common/FileDialog")).GetComponent(); _dialog.gameObject.SetActive(false); } -#pragma warning restore IDE0051 private bool LoadPathPart(int id, GameObject obj) { var item = ResourceManager.CurrentDirectory[id]; diff --git a/Assets/Cryville/Crtr/Browsing/ResourceBrowserUnit.cs b/Assets/Cryville/Crtr/Browsing/ResourceBrowserUnit.cs index b4fe879..4a8dd31 100644 --- a/Assets/Cryville/Crtr/Browsing/ResourceBrowserUnit.cs +++ b/Assets/Cryville/Crtr/Browsing/ResourceBrowserUnit.cs @@ -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(); } -#pragma warning restore IDE0051 public virtual void SlideToLeft() { } public virtual void SlideToRight() { } } diff --git a/Assets/Cryville/Crtr/CastedList.cs b/Assets/Cryville/Crtr/CastedList.cs index 0a2f5c0..1d8f587 100644 --- a/Assets/Cryville/Crtr/CastedList.cs +++ b/Assets/Cryville/Crtr/CastedList.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; namespace Cryville.Crtr { public class CastedList : IList, IList, IReadOnlyList { - IList _list; + readonly IList _list; public CastedList(IList list) { _list = list; } diff --git a/Assets/Cryville/Crtr/Cocos2dFrames.cs b/Assets/Cryville/Crtr/Cocos2dFrames.cs index 5779db2..873f5e8 100644 --- a/Assets/Cryville/Crtr/Cocos2dFrames.cs +++ b/Assets/Cryville/Crtr/Cocos2dFrames.cs @@ -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 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; diff --git a/Assets/Cryville/Crtr/Event/RMVPool.cs b/Assets/Cryville/Crtr/Event/RMVPool.cs index 156eefa..bf56319 100644 --- a/Assets/Cryville/Crtr/Event/RMVPool.cs +++ b/Assets/Cryville/Crtr/Event/RMVPool.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; namespace Cryville.Crtr.Event { internal class RMVPool { private class Bucket : ObjectPool { - 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 _rented = new Dictionary(); + readonly Dictionary _rented = new Dictionary(); public RealtimeMotionValue Rent(MotionName name) { var n = name.MainName; var obj = _buckets[n].Rent(); diff --git a/Assets/Cryville/Crtr/InputProxy.cs b/Assets/Cryville/Crtr/InputProxy.cs index 4c93c3b..cb88a91 100644 --- a/Assets/Cryville/Crtr/InputProxy.cs +++ b/Assets/Cryville/Crtr/InputProxy.cs @@ -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; diff --git a/Assets/Cryville/Crtr/Ruleset.cs b/Assets/Cryville/Crtr/Ruleset.cs index 9e6d746..83f4370 100644 --- a/Assets/Cryville/Crtr/Ruleset.cs +++ b/Assets/Cryville/Crtr/Ruleset.cs @@ -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 Elements = new Dictionary(); [PropertyList] diff --git a/Assets/Cryville/Crtr/Settings.cs b/Assets/Cryville/Crtr/Settings.cs index 15f7854..dd21876 100644 --- a/Assets/Cryville/Crtr/Settings.cs +++ b/Assets/Cryville/Crtr/Settings.cs @@ -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 { diff --git a/Assets/Cryville/Crtr/TrackHandler.cs b/Assets/Cryville/Crtr/TrackHandler.cs index 4584fb4..6abeb34 100644 --- a/Assets/Cryville/Crtr/TrackHandler.cs +++ b/Assets/Cryville/Crtr/TrackHandler.cs @@ -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);