Code cleanup.
This commit is contained in:
@@ -5,7 +5,7 @@ using System.Linq;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Cryville.Crtr {
|
namespace Cryville.Crtr {
|
||||||
class GroupHandler : ContainerHandler {
|
public class GroupHandler : ContainerHandler {
|
||||||
public ChartHandler ch;
|
public ChartHandler ch;
|
||||||
|
|
||||||
SquareMatrix matFrame;
|
SquareMatrix matFrame;
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
using Cryville.Common;
|
using Cryville.Common;
|
||||||
using Cryville.Common.Buffers;
|
using Cryville.Common.Buffers;
|
||||||
using Cryville.Common.Pdt;
|
using Cryville.Common.Pdt;
|
||||||
using Cryville.Crtr.Event;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
|
||||||
namespace Cryville.Crtr {
|
namespace Cryville.Crtr {
|
||||||
public class Judge {
|
public class Judge {
|
||||||
|
#region Data
|
||||||
readonly PdtEvaluator _etor;
|
readonly PdtEvaluator _etor;
|
||||||
readonly PdtRuleset _rs;
|
readonly PdtRuleset _rs;
|
||||||
readonly Dictionary<Identifier, float> ct
|
readonly Dictionary<Identifier, float> ct
|
||||||
@@ -22,7 +22,7 @@ namespace Cryville.Crtr {
|
|||||||
public double StartClip { get; set; }
|
public double StartClip { get; set; }
|
||||||
public double EndClip { get; set; }
|
public double EndClip { get; set; }
|
||||||
public JudgeDefinition Definition { get; set; }
|
public JudgeDefinition Definition { get; set; }
|
||||||
public ContainerState State { get; set; }
|
public NoteHandler Handler { get; set; }
|
||||||
}
|
}
|
||||||
static readonly IComparer<JudgeEvent> _stcmp = new JudgeEventStartTimeComparer();
|
static readonly IComparer<JudgeEvent> _stcmp = new JudgeEventStartTimeComparer();
|
||||||
class JudgeEventStartTimeComparer : IComparer<JudgeEvent> {
|
class JudgeEventStartTimeComparer : IComparer<JudgeEvent> {
|
||||||
@@ -35,7 +35,7 @@ namespace Cryville.Crtr {
|
|||||||
_rs = rs;
|
_rs = rs;
|
||||||
InitScores();
|
InitScores();
|
||||||
}
|
}
|
||||||
public void Prepare(double st, double et, Identifier input, JudgeDefinition def, ContainerState container) {
|
public void Prepare(double st, double et, Identifier input, JudgeDefinition def, NoteHandler handler) {
|
||||||
List<JudgeEvent> list;
|
List<JudgeEvent> list;
|
||||||
if (!evs.TryGetValue(input, out list)) {
|
if (!evs.TryGetValue(input, out list)) {
|
||||||
ct.Add(input, 0);
|
ct.Add(input, 0);
|
||||||
@@ -48,12 +48,14 @@ namespace Cryville.Crtr {
|
|||||||
StartClip = st + def.clip[0],
|
StartClip = st + def.clip[0],
|
||||||
EndClip = et + def.clip[1],
|
EndClip = et + def.clip[1],
|
||||||
Definition = def,
|
Definition = def,
|
||||||
State = container,
|
Handler = handler,
|
||||||
};
|
};
|
||||||
var index = list.BinarySearch(ev, _stcmp);
|
var index = list.BinarySearch(ev, _stcmp);
|
||||||
if (index < 0) index = ~index;
|
if (index < 0) index = ~index;
|
||||||
list.Insert(index, ev);
|
list.Insert(index, ev);
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
#region Judge
|
||||||
static bool _flag;
|
static bool _flag;
|
||||||
static readonly PropOp.Boolean _flagop = new PropOp.Boolean(v => _flag = v);
|
static readonly PropOp.Boolean _flagop = new PropOp.Boolean(v => _flag = v);
|
||||||
static readonly int _var_fn = IdentifierManager.SharedInstance.Request("fn");
|
static readonly int _var_fn = IdentifierManager.SharedInstance.Request("fn");
|
||||||
@@ -174,6 +176,8 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
#region Score
|
||||||
readonly Dictionary<int, int> scoreStringKeys = new Dictionary<int, int>();
|
readonly Dictionary<int, int> scoreStringKeys = new Dictionary<int, int>();
|
||||||
readonly Dictionary<int, int> scoreStringKeysRev = new Dictionary<int, int>();
|
readonly Dictionary<int, int> scoreStringKeysRev = new Dictionary<int, int>();
|
||||||
readonly Dictionary<int, PropSrc> scoreSrcs = new Dictionary<int, PropSrc>();
|
readonly Dictionary<int, PropSrc> scoreSrcs = new Dictionary<int, PropSrc>();
|
||||||
@@ -253,7 +257,9 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
#region Definitions
|
||||||
public class InputDefinition {
|
public class InputDefinition {
|
||||||
public int dim;
|
public int dim;
|
||||||
public bool notnull;
|
public bool notnull;
|
||||||
@@ -282,4 +288,5 @@ namespace Cryville.Crtr {
|
|||||||
public float init = 0;
|
public float init = 0;
|
||||||
public string format = "";
|
public string format = "";
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ using System.Collections.Generic;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Cryville.Crtr {
|
namespace Cryville.Crtr {
|
||||||
class NoteHandler : ContainerHandler {
|
public class NoteHandler : ContainerHandler {
|
||||||
readonly GroupHandler gh;
|
readonly GroupHandler gh;
|
||||||
public readonly Chart.Note Event;
|
public readonly Chart.Note Event;
|
||||||
readonly PdtRuleset ruleset;
|
readonly PdtRuleset ruleset;
|
||||||
@@ -90,7 +90,7 @@ namespace Cryville.Crtr {
|
|||||||
ChartPlayer.etor.ContextEvent = tev;
|
ChartPlayer.etor.ContextEvent = tev;
|
||||||
ChartPlayer.etor.ContextState = s;
|
ChartPlayer.etor.ContextState = s;
|
||||||
ChartPlayer.etor.Evaluate(new PropOp.Identifier(v => name = new Identifier(v)), ruleset.judges[tev.Id].input);
|
ChartPlayer.etor.Evaluate(new PropOp.Identifier(v => name = new Identifier(v)), ruleset.judges[tev.Id].input);
|
||||||
judge.Prepare(ev.Time, ev.Time + ev.Duration, name, ruleset.judges[tev.Id], cs);
|
judge.Prepare(ev.Time, ev.Time + ev.Duration, name, ruleset.judges[tev.Id], this);
|
||||||
ChartPlayer.etor.ContextState = null;
|
ChartPlayer.etor.ContextState = null;
|
||||||
ChartPlayer.etor.ContextEvent = null;
|
ChartPlayer.etor.ContextEvent = null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user