Implement judge event preparation.
This commit is contained in:
@@ -1,11 +1,20 @@
|
||||
using Cryville.Common;
|
||||
using Cryville.Common.Pdt;
|
||||
using Cryville.Common.Unity.Input;
|
||||
using Cryville.Crtr.Event;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Cryville.Crtr {
|
||||
public class Judge {
|
||||
readonly PdtRuleset _rs;
|
||||
readonly Dictionary<Identifier, float> ct
|
||||
= new Dictionary<Identifier, float>();
|
||||
readonly Dictionary<Identifier, Dictionary<float, JudgeEvent>> evs
|
||||
= new Dictionary<Identifier, Dictionary<float, JudgeEvent>>();
|
||||
struct JudgeEvent {
|
||||
public float EndTime;
|
||||
public JudgeDefinition Definition { get; set; }
|
||||
public ContainerState State { get; set; }
|
||||
}
|
||||
public Judge(PdtRuleset rs) {
|
||||
_rs = rs;
|
||||
foreach (var s in rs.scores) {
|
||||
@@ -14,7 +23,13 @@ namespace Cryville.Crtr {
|
||||
scores.Add(name, s.Value.init);
|
||||
}
|
||||
}
|
||||
public void Feed(string target) {
|
||||
public void Prepare(float time, Identifier input, JudgeDefinition def, ContainerState container) {
|
||||
Dictionary<float, JudgeEvent> list;
|
||||
if (!evs.TryGetValue(input, out list)) {
|
||||
ct.Add(input, 0);
|
||||
evs.Add(input, list = new Dictionary<float, JudgeEvent>());
|
||||
}
|
||||
list.Add(time + def.clip[0], new JudgeEvent { EndTime = time + def.clip[1], Definition = def, State = container });
|
||||
}
|
||||
public void Feed(InputEvent ev) {
|
||||
|
||||
|
Reference in New Issue
Block a user