Postpone skin static matching.

This commit is contained in:
2022-11-20 16:09:34 +08:00
parent ce30b5427b
commit d08eea5c1e
4 changed files with 29 additions and 17 deletions

View File

@@ -380,7 +380,7 @@ namespace Cryville.Crtr {
try {
diag::Stopwatch timer = new diag::Stopwatch();
timer.Reset(); timer.Start();
Logger.Log("main", 0, "Load/Prehandle", "Prehandling (iteration 3)");
Logger.Log("main", 0, "Load/Prehandle", "Initializing textures");
foreach (var t in texs) {
if (frames.ContainsKey(t.Key)) {
Logger.Log("main", 3, "Load/Prehandle", "Duplicated texture name: {0}", t.Key);
@@ -390,8 +390,14 @@ namespace Cryville.Crtr {
f.Init();
frames.Add(t.Key, f);
}
Logger.Log("main", 0, "Load/Prehandle", "Initializing states");
cbus.BroadcastInit();
Logger.Log("main", 0, "Load/Prehandle", "Prehandling (iteration 2)");
cbus.BroadcastPreInit();
Logger.Log("main", 0, "Load/WorkerThread", "Prehandling (iteration 3)");
using (var pbus = cbus.Clone(17)) {
pbus.Forward();
}
Logger.Log("main", 0, "Load/Prehandle", "Prehandling (iteration 4)");
cbus.BroadcastPostInit();
inputProxy.Activate();
if (logEnabled) ToggleLogs();
Logger.Log("main", 0, "Load/Prehandle", "Cleaning up");
@@ -533,10 +539,6 @@ namespace Cryville.Crtr {
}
Logger.Log("main", 0, "Load/WorkerThread", "Patching events");
cbus.DoPatch();
Logger.Log("main", 0, "Load/WorkerThread", "Prehandling (iteration 2)");
using (var pbus = cbus.Clone(17)) {
pbus.Forward();
}
Logger.Log("main", 0, "Load/WorkerThread", "Cloning states (type 1)");
bbus = cbus.Clone(1, -clippingDist);

View File

@@ -86,10 +86,10 @@ namespace Cryville.Crtr.Event {
Anchors.Add("tail", new Anchor() { Transform = a_tail });
}
/// <summary>
/// Called upon initialization of <see cref="cs" />.
/// Called upon StartUpdate of ps 17.
/// </summary>
public virtual void Init() {
skinContainer.MatchStatic(cs);
skinContainer.MatchStatic(ps);
foreach (var i in gogroup.GetComponentsInChildren<SkinComponent>())
i.Init();
}
@@ -118,6 +118,9 @@ namespace Cryville.Crtr.Event {
PreAwake(s);
Awake(s);
}
else if (s.CloneType == 17) {
Init();
}
}
public virtual void Update(ContainerState s, StampedEvent ev) {
bool flag = !Awoken && s.CloneType >= 2 && s.CloneType < 16;

View File

@@ -404,13 +404,17 @@ namespace Cryville.Crtr.Event {
}
}
public void BroadcastInit() {
public void BroadcastPreInit() {
Handler.PreInit();
Handler.Init();
foreach (var s in Children) {
s.Value.BroadcastInit();
foreach (var c in Children.Values) {
c.BroadcastPreInit();
}
}
public void BroadcastPostInit() {
Handler.PostInit();
foreach (var c in Children.Values) {
c.BroadcastPostInit();
}
}
public void StartUpdate() {

View File

@@ -146,11 +146,14 @@ namespace Cryville.Crtr.Event {
else if (!s.Working && workingStates.Contains(s)) workingStates.Remove(s);
invalidatedStates.Clear();
}
public void BroadcastInit() {
RootState.BroadcastInit();
}
public void BroadcastPreInit() {
RootState.BroadcastPreInit();
}
public void BroadcastPostInit() {
RootState.BroadcastPostInit();
}
public void BroadcastEndUpdate() {
RootState.BroadcastEndUpdate();
}