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

View File

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

View File

@@ -147,8 +147,11 @@ namespace Cryville.Crtr.Event {
invalidatedStates.Clear(); invalidatedStates.Clear();
} }
public void BroadcastInit() { public void BroadcastPreInit() {
RootState.BroadcastInit(); RootState.BroadcastPreInit();
}
public void BroadcastPostInit() {
RootState.BroadcastPostInit();
} }
public void BroadcastEndUpdate() { public void BroadcastEndUpdate() {