Logic cleanup.

This commit is contained in:
2022-11-01 11:28:48 +08:00
parent 6aa8ba6190
commit 3bfc7eb643
2 changed files with 19 additions and 29 deletions

View File

@@ -328,23 +328,6 @@ namespace Cryville.Crtr {
FileInfo skinFile = new FileInfo(
Game.GameDataPath + "/skins/" + Settings.Default.LoadSkin
);
Logger.Log("main", 0, "Load/MainThread", "Loading textures...");
texloadtimer = new diag::Stopwatch();
texloadtimer.Start();
texs = new Dictionary<string, Texture2D>();
var flist = skinFile.Directory.GetFiles("*.png");
foreach (FileInfo f in flist) {
#if NO_THREAD
using (WWW w = new WWW("file:///" + f.FullName)) {
string name = StringUtils.TrimExt(f.Name);
while (!w.isDone);
texs.Add(name, w.texture);
}
#else
texLoadQueue.Enqueue(f.FullName);
#endif
}
#if NO_THREAD
texloadtimer.Stop();
Logger.LogFormat("main", 0, "Load/MainThread", "Textures loaded successfully ({0}ms)", texloadtimer.Elapsed.TotalMilliseconds);
@@ -362,6 +345,23 @@ namespace Cryville.Crtr {
skinFile = skinFile,
});
#endif
Logger.Log("main", 0, "Load/MainThread", "Loading textures...");
texloadtimer = new diag::Stopwatch();
texloadtimer.Start();
texs = new Dictionary<string, Texture2D>();
var flist = skinFile.Directory.GetFiles("*.png");
foreach (FileInfo f in flist) {
#if NO_THREAD
using (WWW w = new WWW("file:///" + f.FullName)) {
string name = StringUtils.TrimExt(f.Name);
while (!w.isDone);
texs.Add(name, w.texture);
}
#else
texLoadQueue.Enqueue(f.FullName);
#endif
}
}
void Prehandle() {

View File

@@ -314,7 +314,6 @@ namespace Cryville.Crtr.Event {
public void Handle(StampedEvent ev, Action<StampedEvent> callback = null) {
if (breakflag) return;
if (ev != null) {
bool flag = false;
if (ev.Unstamped is Chart.Motion) {
var tev = (Chart.Motion)ev.Unstamped;
var mv = RMVPool.Rent(tev.Name);
@@ -354,18 +353,9 @@ namespace Cryville.Crtr.Event {
}
}
}
if (ev.Unstamped == null) {
Callback(ev, callback);
flag = true;
}
else if (ev.Unstamped.Priority >= 0) {
Callback(ev, callback);
flag = true;
}
if (!flag) Callback(null, callback);
return;
Callback(ev.Unstamped == null || ev.Unstamped.Priority >= 0 ? ev : null, callback);
}
Callback(null, callback);
else Callback(null, callback);
}
void Callback(StampedEvent ev, Action<StampedEvent> callback) {