Prune code.
This commit is contained in:
@@ -14,9 +14,9 @@ namespace Cryville.Crtr.Event {
|
||||
|
||||
public Dictionary<EventContainer, ContainerState> Children
|
||||
= new Dictionary<EventContainer, ContainerState>();
|
||||
HashSet<EventContainer> WorkingChildren
|
||||
readonly HashSet<EventContainer> WorkingChildren
|
||||
= new HashSet<EventContainer>();
|
||||
HashSet<EventContainer> InvalidatedChildren
|
||||
readonly HashSet<EventContainer> InvalidatedChildren
|
||||
= new HashSet<EventContainer>();
|
||||
public Dictionary<Type, List<ContainerState>> TypedChildren
|
||||
= new Dictionary<Type, List<ContainerState>>();
|
||||
@@ -25,14 +25,8 @@ namespace Cryville.Crtr.Event {
|
||||
return TypedChildren[handlerType][index];
|
||||
}
|
||||
public ContainerState GetChild(EventContainer ev) {
|
||||
/*if (!Children.ContainsKey(ev)) {
|
||||
Children[ev] = prototype.FetchChildClone(ev, CloneType);
|
||||
}*/
|
||||
return Children[ev];
|
||||
}
|
||||
/*ContainerState FetchChildClone(EventContainer ev, byte ct) {
|
||||
return Children[ev].Clone(ct);
|
||||
}*/
|
||||
|
||||
void NotifyWorkingChanged(EventContainer key) {
|
||||
InvalidatedChildren.Add(key);
|
||||
@@ -56,7 +50,6 @@ namespace Cryville.Crtr.Event {
|
||||
public byte CloneType;
|
||||
private ContainerState rootPrototype = null;
|
||||
private ContainerState prototype = null;
|
||||
// public SkinManager skinManager;
|
||||
public SkinContainer skinContainer;
|
||||
public Judge judge;
|
||||
|
||||
@@ -97,7 +90,6 @@ namespace Cryville.Crtr.Event {
|
||||
}
|
||||
|
||||
void InvalidateMotion(MotionName name) {
|
||||
// if (CachedValues.ContainsKey(name))
|
||||
CachedValueStates[name] = false;
|
||||
foreach (var c in Children)
|
||||
c.Value.InvalidateMotion(name);
|
||||
@@ -113,10 +105,6 @@ namespace Cryville.Crtr.Event {
|
||||
|
||||
foreach (var m in ChartPlayer.motionRegistry)
|
||||
Values.Add(new MotionName(m.Key), new RealtimeMotionValue().Init(Parent == null ? m.Value.GlobalInitValue : m.Value.InitValue));
|
||||
|
||||
//skinManager = new SkinManager(skin, this);
|
||||
|
||||
//events.Sort((a, b) => a.Time.CompareTo(b.Time));
|
||||
}
|
||||
|
||||
static void AddChild(EventContainer c, ContainerState s, ContainerState target) {
|
||||
@@ -127,9 +115,6 @@ namespace Cryville.Crtr.Event {
|
||||
}
|
||||
|
||||
public ContainerState Clone(byte ct) {
|
||||
/*if (prototype != null)
|
||||
throw new InvalidOperationException();*/
|
||||
|
||||
var r = (ContainerState)MemberwiseClone();
|
||||
|
||||
var mvs = new Dictionary<MotionName, RealtimeMotionValue>(Values.Count);
|
||||
@@ -152,7 +137,6 @@ namespace Cryville.Crtr.Event {
|
||||
|
||||
r.Children = new Dictionary<EventContainer, ContainerState>();
|
||||
foreach (var child in Children) {
|
||||
// if (!child.Value.Working && ct != 1) continue;
|
||||
var cc = child.Value.Clone(ct);
|
||||
cc.Parent = r;
|
||||
AddChild(child.Key, cc, r);
|
||||
@@ -184,7 +168,6 @@ namespace Cryville.Crtr.Event {
|
||||
else dest.Values.Add(mv.Key, mv.Value.Clone());
|
||||
}
|
||||
|
||||
// dest.CachedValues.Clear();
|
||||
foreach (var cv in CachedValues) {
|
||||
Vector dv;
|
||||
if(dest.CachedValues.TryGetValue(cv.Key, out dv)) cv.Value.CopyTo(dv);
|
||||
@@ -224,7 +207,6 @@ namespace Cryville.Crtr.Event {
|
||||
}
|
||||
|
||||
public void AttachSystems(PdtSkin skin, Judge judge) {
|
||||
// skinManager = new SkinManager(skin);
|
||||
skinContainer = new SkinContainer(skin);
|
||||
this.judge = judge;
|
||||
}
|
||||
@@ -337,20 +319,15 @@ namespace Cryville.Crtr.Event {
|
||||
}
|
||||
|
||||
public void Handle(StampedEvent ev, Action<StampedEvent> callback = null) {
|
||||
if (breakflag) {
|
||||
// Time = toTime;
|
||||
return;
|
||||
}
|
||||
if (breakflag) return;
|
||||
if (ev != null) {
|
||||
bool flag = false;
|
||||
if (ev.Unstamped is Chart.Motion) {
|
||||
var tev = (Chart.Motion)ev.Unstamped;
|
||||
// tev._apply(Values);
|
||||
var mv = RMVPool.Rent(tev.Name);
|
||||
GetMotionValue(tev.Name).CopyTo(mv);
|
||||
PlayingMotions.Add(ev, mv);
|
||||
Callback(ev, callback);
|
||||
// UpdateMotions();
|
||||
if (!ev.Unstamped.IsLong)
|
||||
PlayingMotions.Remove(ev);
|
||||
}
|
||||
@@ -371,9 +348,7 @@ namespace Cryville.Crtr.Event {
|
||||
if (tev.IsRelease) {
|
||||
var nev = tev.Original;
|
||||
if (nev is Chart.Motion) {
|
||||
// var tnev = (Chart.Motion)nev;
|
||||
Callback(ev, callback);
|
||||
// UpdateMotions();
|
||||
PlayingMotions.Remove(ev.Origin);
|
||||
}
|
||||
else if (nev is EventContainer) {
|
||||
@@ -397,7 +372,6 @@ namespace Cryville.Crtr.Event {
|
||||
if (!flag) Callback(null, callback);
|
||||
return;
|
||||
}
|
||||
// Time = toTime;
|
||||
Callback(null, callback);
|
||||
}
|
||||
|
||||
@@ -407,21 +381,6 @@ namespace Cryville.Crtr.Event {
|
||||
callback(ev);
|
||||
if (ev == null || ev.Unstamped != null) Handler.Update(this, ev);
|
||||
else Handler.ExUpdate(this, ev);
|
||||
/*if (CloneType == 1) {
|
||||
if (ev == null || ev.Event != null) Handler.Forward(ev);
|
||||
else Handler.ExUpdate(CloneType, ev);
|
||||
}
|
||||
else if (CloneType == 0) {
|
||||
if (ev == null || ev.Event != null) Handler.Update(ev);
|
||||
else Handler.ExUpdate(CloneType, ev);
|
||||
}
|
||||
else if (CloneType == 2) {
|
||||
// TODO Do nothing atm
|
||||
}
|
||||
else if (CloneType >= 16) {
|
||||
if (ev == null || ev.Event != null) Handler.PreUpdate(CloneType, ev);
|
||||
else Handler.ExUpdate(CloneType, ev);
|
||||
}*/
|
||||
foreach (var m in PlayingMotions)
|
||||
Handler.MotionUpdate(CloneType, (Chart.Motion)m.Key.Unstamped);
|
||||
}
|
||||
|
@@ -48,9 +48,6 @@ namespace Cryville.Crtr.Event {
|
||||
if (ev.IsLong) {
|
||||
events.Add(ev.ReleaseEvent);
|
||||
table.Add(ev.ReleaseEvent, cs);
|
||||
/*if (ev is Chart.Note) {
|
||||
events.Add(ev.AttackEvent);
|
||||
}*/
|
||||
}
|
||||
events.Add(ev);
|
||||
table.Add(ev, cs);
|
||||
@@ -101,7 +98,6 @@ namespace Cryville.Crtr.Event {
|
||||
return_ahead:
|
||||
Time = toTime;
|
||||
beat = toBeat;
|
||||
// foreach (var c in Children) c.ForwardToTime(Time);
|
||||
if (callback != null) callback(null);
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cryville.Crtr.Event {
|
||||
public class EventBus : StateBase<EventBatch>, IDisposable {
|
||||
@@ -45,11 +44,9 @@ namespace Cryville.Crtr.Event {
|
||||
|
||||
public void CopyTo(byte ct, EventBus dest) {
|
||||
base.CopyTo(dest);
|
||||
// dest.states.Clear();
|
||||
dest.workingStates.Clear();
|
||||
dest.invalidatedStates.Clear();
|
||||
RootState.CopyTo(ct, dest.RootState);
|
||||
// foreach (var s in dest.states) dest.invalidatedStates.Add(s.Value);
|
||||
dest.ValidateStates();
|
||||
|
||||
if (ct >= 2) {
|
||||
@@ -86,13 +83,6 @@ namespace Cryville.Crtr.Event {
|
||||
s.Bus = this;
|
||||
}
|
||||
|
||||
/*
|
||||
public void AddChildState(EventContainer p, EventContainer c) {
|
||||
if (!states.ContainsKey(p)) AddChildState(prototype.states[p].Parent.Container, p);
|
||||
if (!states.ContainsKey(c)) AddState(states[p].GetChild(c));
|
||||
// if (prototype != null) prototype.states[c].CopyTo(RootState.CloneType, states[c]);
|
||||
}*/
|
||||
|
||||
void EnsureActivity(EventContainer c) {
|
||||
if (activeContainers.Contains(c)) return;
|
||||
if (RootState.CloneType >= 2) prototype.states[c].CopyTo(RootState.CloneType, states[c]);
|
||||
@@ -133,16 +123,11 @@ namespace Cryville.Crtr.Event {
|
||||
for (var i = 0; i < batch.Count; i++) {
|
||||
var ev = batch[i];
|
||||
if (ev.Container != null) {
|
||||
/* if (prototype != null && !states.ContainsKey(ev.Container))
|
||||
AddChildState(prototype.states[ev.Container].Parent.Container, ev.Container); */
|
||||
// TODO
|
||||
// if (prototype != null) prototype.states[ev.Container].CopyTo(RootState.CloneType, states[ev.Container]);
|
||||
EnsureActivity(ev.Container);
|
||||
states[ev.Container].Handle(ev);
|
||||
}
|
||||
if (ev.Unstamped is EventContainer) {
|
||||
if (ev.Container != null) EnsureActivity((EventContainer)ev.Unstamped);
|
||||
// AddChildState(ev.Container, (EventContainer)ev.Unstamped);
|
||||
}
|
||||
}
|
||||
ValidateStates();
|
||||
|
Reference in New Issue
Block a user