Code cleanup.
This commit is contained in:
@@ -14,11 +14,7 @@ namespace Cryville.Crtr {
|
|||||||
chart = _chart;
|
chart = _chart;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string TypeName {
|
public override string TypeName { get { return "chart"; } }
|
||||||
get {
|
|
||||||
return "chart";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void PreInit() {
|
public override void PreInit() {
|
||||||
base.PreInit();
|
base.PreInit();
|
||||||
|
@@ -19,6 +19,7 @@ using Logger = Cryville.Common.Logger;
|
|||||||
|
|
||||||
namespace Cryville.Crtr {
|
namespace Cryville.Crtr {
|
||||||
public class ChartPlayer : MonoBehaviour {
|
public class ChartPlayer : MonoBehaviour {
|
||||||
|
#region Fields
|
||||||
Chart chart;
|
Chart chart;
|
||||||
Skin skin;
|
Skin skin;
|
||||||
PdtSkin pskin;
|
PdtSkin pskin;
|
||||||
@@ -66,6 +67,7 @@ namespace Cryville.Crtr {
|
|||||||
public static PdtEvaluator etor;
|
public static PdtEvaluator etor;
|
||||||
|
|
||||||
InputProxy inputProxy;
|
InputProxy inputProxy;
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region MonoBehaviour
|
#region MonoBehaviour
|
||||||
void Start() {
|
void Start() {
|
||||||
@@ -437,10 +439,10 @@ namespace Cryville.Crtr {
|
|||||||
Logger.Log("main", 1, "Game", "Stopping");
|
Logger.Log("main", 1, "Game", "Stopping");
|
||||||
Game.AudioSession = Game.AudioSequencer.NewSession();
|
Game.AudioSession = Game.AudioSequencer.NewSession();
|
||||||
inputProxy.Deactivate();
|
inputProxy.Deactivate();
|
||||||
if (cbus != null) { cbus.Dispose(); cbus = null; }
|
|
||||||
if (bbus != null) { bbus.Dispose(); bbus = null; }
|
|
||||||
if (tbus != null) { tbus.Dispose(); tbus = null; }
|
|
||||||
if (nbus != null) { nbus.Dispose(); nbus = null; }
|
if (nbus != null) { nbus.Dispose(); nbus = null; }
|
||||||
|
if (tbus != null) { tbus.Dispose(); tbus = null; }
|
||||||
|
if (bbus != null) { bbus.Dispose(); bbus = null; }
|
||||||
|
if (cbus != null) { cbus.Dispose(); cbus = null; }
|
||||||
Logger.Log("main", 1, "Game", "Stopped");
|
Logger.Log("main", 1, "Game", "Stopped");
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
|
@@ -7,7 +7,10 @@ using System.Globalization;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Cryville.Crtr.Event {
|
namespace Cryville.Crtr.Event {
|
||||||
public abstract class ContainerHandler : IDisposable {
|
public abstract class ContainerHandler {
|
||||||
|
public ContainerHandler() { }
|
||||||
|
public abstract string TypeName { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Prehandling <see cref="ContainerState"/>, prehandling the events.
|
/// Prehandling <see cref="ContainerState"/>, prehandling the events.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -56,10 +59,6 @@ namespace Cryville.Crtr.Event {
|
|||||||
this.judge = judge;
|
this.judge = judge;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContainerHandler() { }
|
|
||||||
public abstract string TypeName {
|
|
||||||
get;
|
|
||||||
}
|
|
||||||
public readonly Dictionary<int, List<Anchor>> Anchors = new Dictionary<int, List<Anchor>>();
|
public readonly Dictionary<int, List<Anchor>> Anchors = new Dictionary<int, List<Anchor>>();
|
||||||
public Anchor OpenedAnchor;
|
public Anchor OpenedAnchor;
|
||||||
protected Anchor a_cur;
|
protected Anchor a_cur;
|
||||||
|
@@ -64,35 +64,7 @@ namespace Cryville.Crtr.Event {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly RMVPool RMVPool = new RMVPool();
|
public ContainerState(EventContainer _ev, ContainerState parent = null) {
|
||||||
readonly MotionCachePool MCPool = new MotionCachePool();
|
|
||||||
Dictionary<StampedEvent, RealtimeMotionValue> PlayingMotions = new Dictionary<StampedEvent, RealtimeMotionValue>(4);
|
|
||||||
Dictionary<Identifier, RealtimeMotionValue> Values;
|
|
||||||
Dictionary<Identifier, MotionCache> CachedValues;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a motion value.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="name">The motion name.</param>
|
|
||||||
/// <param name="clone">Returns a cloned motion value instead.</param>
|
|
||||||
/// <returns>A motion value.</returns>
|
|
||||||
RealtimeMotionValue GetMotionValue(Identifier name, bool clone = false) {
|
|
||||||
RealtimeMotionValue value = Values[name];
|
|
||||||
if (clone) return value.Clone();
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void InvalidateMotion(Identifier name) {
|
|
||||||
MotionCache cache;
|
|
||||||
if (!CachedValues.TryGetValue(name, out cache))
|
|
||||||
CachedValues.Add(name, cache = MCPool.Rent(name));
|
|
||||||
cache.Valid = false;
|
|
||||||
ValidateChildren();
|
|
||||||
foreach (var c in WorkingChildren)
|
|
||||||
Children[c].InvalidateMotion(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ContainerState(Chart c, EventContainer _ev, ContainerState parent = null) {
|
|
||||||
Container = _ev;
|
Container = _ev;
|
||||||
|
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
@@ -189,7 +161,7 @@ namespace Cryville.Crtr.Event {
|
|||||||
public void Dispose() {
|
public void Dispose() {
|
||||||
if (Disposed) return;
|
if (Disposed) return;
|
||||||
Disposed = true;
|
Disposed = true;
|
||||||
if (CloneType < 16 && Handler != null) Handler.Dispose();
|
if (CloneType == 1) Handler.Dispose();
|
||||||
foreach (var s in Children)
|
foreach (var s in Children)
|
||||||
s.Value.Dispose();
|
s.Value.Dispose();
|
||||||
RMVPool.ReturnAll();
|
RMVPool.ReturnAll();
|
||||||
@@ -206,6 +178,35 @@ namespace Cryville.Crtr.Event {
|
|||||||
public void AttachSystems(PdtSkin skin, Judge judge) {
|
public void AttachSystems(PdtSkin skin, Judge judge) {
|
||||||
Handler.AttachSystems(skin, judge);
|
Handler.AttachSystems(skin, judge);
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Motion
|
||||||
|
readonly RMVPool RMVPool = new RMVPool();
|
||||||
|
readonly MotionCachePool MCPool = new MotionCachePool();
|
||||||
|
Dictionary<StampedEvent, RealtimeMotionValue> PlayingMotions = new Dictionary<StampedEvent, RealtimeMotionValue>(4);
|
||||||
|
Dictionary<Identifier, RealtimeMotionValue> Values;
|
||||||
|
Dictionary<Identifier, MotionCache> CachedValues;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a motion value.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">The motion name.</param>
|
||||||
|
/// <param name="clone">Returns a cloned motion value instead.</param>
|
||||||
|
/// <returns>A motion value.</returns>
|
||||||
|
RealtimeMotionValue GetMotionValue(Identifier name, bool clone = false) {
|
||||||
|
RealtimeMotionValue value = Values[name];
|
||||||
|
if (clone) return value.Clone();
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void InvalidateMotion(Identifier name) {
|
||||||
|
MotionCache cache;
|
||||||
|
if (!CachedValues.TryGetValue(name, out cache))
|
||||||
|
CachedValues.Add(name, cache = MCPool.Rent(name));
|
||||||
|
cache.Valid = false;
|
||||||
|
foreach (var c in ActiveChildren)
|
||||||
|
Children[c].InvalidateMotion(name);
|
||||||
|
}
|
||||||
|
|
||||||
public Vector GetRawValue(Identifier key) {
|
public Vector GetRawValue(Identifier key) {
|
||||||
MotionCache tr;
|
MotionCache tr;
|
||||||
@@ -299,7 +300,9 @@ namespace Cryville.Crtr.Event {
|
|||||||
return GetRawValue<Vec1>(n_track).Value;
|
return GetRawValue<Vec1>(n_track).Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Update
|
||||||
bool breakflag = false;
|
bool breakflag = false;
|
||||||
|
|
||||||
public void Break() {
|
public void Break() {
|
||||||
@@ -431,5 +434,6 @@ namespace Cryville.Crtr.Event {
|
|||||||
if (ls.Handler.Alive) ls.Anchor();
|
if (ls.Handler.Alive) ls.Anchor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -37,7 +37,7 @@ namespace Cryville.Crtr.Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AddEventContainer(EventContainer c, ContainerState parent = null) {
|
void AddEventContainer(EventContainer c, ContainerState parent = null) {
|
||||||
var cs = new ContainerState(chart, c, parent);
|
var cs = new ContainerState(c, parent);
|
||||||
stateMap.Add(c, cs);
|
stateMap.Add(c, cs);
|
||||||
if (parent == null) {
|
if (parent == null) {
|
||||||
cs.Depth = 0;
|
cs.Depth = 0;
|
||||||
|
@@ -191,7 +191,7 @@ namespace Cryville.Crtr.Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Anchor() {
|
public void Anchor() {
|
||||||
RootState.Anchor();
|
if (RootState.Handler.Alive) RootState.Anchor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -15,11 +15,7 @@ namespace Cryville.Crtr {
|
|||||||
this.ch = ch;
|
this.ch = ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string TypeName {
|
public override string TypeName { get { return "group"; } }
|
||||||
get {
|
|
||||||
return "group";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void PreInit() {
|
public override void PreInit() {
|
||||||
base.PreInit();
|
base.PreInit();
|
||||||
|
@@ -15,11 +15,7 @@ namespace Cryville.Crtr {
|
|||||||
this.gh = gh;
|
this.gh = gh;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string TypeName {
|
public override string TypeName { get { return "note"; } }
|
||||||
get {
|
|
||||||
return "note";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SectionalGameObject[] sgos;
|
SectionalGameObject[] sgos;
|
||||||
readonly Dictionary<Chart.Judge, JudgeState> judges = new Dictionary<Chart.Judge, JudgeState>();
|
readonly Dictionary<Chart.Judge, JudgeState> judges = new Dictionary<Chart.Judge, JudgeState>();
|
||||||
|
@@ -12,11 +12,7 @@ namespace Cryville.Crtr {
|
|||||||
this.gh = gh;
|
this.gh = gh;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string TypeName {
|
public override string TypeName { get { return "track"; } }
|
||||||
get {
|
|
||||||
return "track";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Init() {
|
public override void Init() {
|
||||||
base.Init();
|
base.Init();
|
||||||
|
Reference in New Issue
Block a user