Prune code.

This commit is contained in:
2022-09-30 18:19:19 +08:00
parent e8e36b83bd
commit cd4ea557c3
41 changed files with 22 additions and 3592 deletions

View File

@@ -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();