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

@@ -37,8 +37,6 @@ namespace Cryville.Crtr {
WWW texLoader = null;
#endif
// ChartHandler handler;
// StampedState cs;
EventBus cbus;
EventBus bbus;
EventBus tbus;
@@ -49,8 +47,6 @@ namespace Cryville.Crtr {
static bool initialized;
static Text logs;
Text status;
// static EventSystem eventSystem;
// static MetaDatabase metadb;
public static Rect hitRect;
public static Vector2 screenSize;
@@ -69,8 +65,6 @@ namespace Cryville.Crtr {
public static Dictionary<string, MotionRegistry> motionRegistry = new Dictionary<string, MotionRegistry>();
// public static AudioMixerGroup mixer;
public static PdtEvaluator etor;
~ChartPlayer() {
@@ -90,10 +84,7 @@ namespace Cryville.Crtr {
logs = logobj.GetComponent<Text>();
if (!initialized) {
Game.Init();
// mixer = Resources.Load<AudioMixerGroup>("GameAudioMixer");
GenericResources.LoadDefault();
// eventSystem = GameObject.Find("EventSystem").GetComponent<EventSystem>();
// metadb = new MetaDatabase(new DirectoryInfo(persistentDataPath + "/db/cryville.github.io"));
initialized = true;
}
OnSettingsUpdate();
@@ -108,18 +99,15 @@ namespace Cryville.Crtr {
Play();
#endif
// metadb.GetObject(new Guid(""));
// Camera.main.RenderToCubemap();
}
void Update() {
if (Input.GetKeyDown(KeyCode.Return)) TogglePlay();
// if (Input.GetKeyDown(KeyCode.Escape)) ReturnToConsole();
if (started) {
try {
if (Screen.width != screenSize.x || Screen.height != screenSize.y)
throw new InvalidOperationException("Window resized while playing");
//cs.ForwardByTime(Time.deltaTime);
float dt = firstFrame
? 1f / Application.targetFrameRate
: Time.deltaTime;
@@ -134,9 +122,6 @@ namespace Cryville.Crtr {
});
judge.EndFrame();
UnityEngine.Profiling.Profiler.EndSample();
/*StampedState ts = (StampedState)cs.Clone();
ts.ForwardStepToTime(cs.Time + fogDist, renderStep);
ts.BroadcastEndUpdate();*/
UnityEngine.Profiling.Profiler.BeginSample("ChartPlayer.Forward");
UnityEngine.Profiling.Profiler.BeginSample("EventBus.Copy");
bbus.CopyTo(2, tbus);
@@ -265,10 +250,6 @@ namespace Cryville.Crtr {
}
}
/*public void ReturnToConsole() {
Application.LoadLevel("Console");
}*/
private void ReturnToMenu() {
#if UNITY_EDITOR
Invoke(nameof(_returnToMenu), 4);
@@ -392,9 +373,6 @@ namespace Cryville.Crtr {
f.Init();
frames.Add(t.Key, f);
}
// etor.Context = new EvaluatorContext() { Reservations = cruleset.scores.Keys.ToList() };
// pskin.PreEval(etor);
//cs.BroadcastInit();
Logger.Log("main", 0, "Load/Prehandle", "Initializing states");
cbus.BroadcastInit();
Game.InputManager.Activate();
@@ -408,8 +386,6 @@ namespace Cryville.Crtr {
Thread.Sleep((int)(Game.AudioClient.BufferPosition - Game.AudioClient.Position));
Game.InputManager.SyncTime(cbus.Time);
started = true;
// cs.ForwardByTime(startOffset);
// bus.ForwardByTime(startOffset);
}
catch (Exception ex) {
Game.LogException("Load/Prehandle", "An error occured while prehandling the data", ex);
@@ -465,7 +441,6 @@ namespace Cryville.Crtr {
Logger.Log("main", 0, "Load/WorkerThread", "Batching events");
var batcher = new EventBatcher(chart);
batcher.Forward();
// cruleset.PatchChart(batcher);
cbus = batcher.Batch();
Logger.Log("main", 0, "Load/WorkerThread", "Batched {0} event batches", cbus.events.Count);
@@ -475,46 +450,6 @@ namespace Cryville.Crtr {
LoadSkin(info.skinFile);
cbus.AttachSystems(pskin, judge);
// handler = new ChartHandler(chart, dir);
// cs = new StampedState(chart);
/*var cph = new EventPrehandler(chart, chart, chart.Events);
foreach (var g in chart.groups) {
var gph = new EventPrehandler(chart, g, g.Events, cph);
foreach (var i in g.Children) {
new EventPrehandler(chart, i, i.Events, gph);
}
}
cph.Forward(ev => {
if (ev is Chart.Sound) {
Chart.Sound tev = (Chart.Sound)ev;
cph.Result.Add(new StampedEvent.PlaySound() {
Time = cph.Time/* - tev.offset* + soundOffset,
Event = tev
});
}
});*/
/*var ch = new ChartHandler(chart, dir);
cs = new StampedState(chart, cph.Result, cskin, cph.StampedEvent);
cs.AttachHandler(ch);
foreach (var gph in cph.Children) {
var gh = new GroupHandler((Chart.Group)gph.Container, ch);
var gs = new StampedState(chart, gph.Result, cskin, gph.StampedEvent, cs);
gs.AttachHandler(gh);
foreach (var tph in gph.Children) {
StampedEventHandler th;
if (tph.Container is Chart.Note) {
th = new NoteHandler(gh, tph.StampedEvent);
}
else {
th = new TrackHandler(gh, (Chart.Track)tph.Container);
}
StampedState ts;
ts = new StampedState(chart, tph.Result, cskin, tph.StampedEvent, gs);
ts.AttachHandler(th);
}
}*/
Logger.Log("main", 0, "Load/WorkerThread", "Attaching handlers");
var ch = new ChartHandler(chart, dir);
cbus.RootState.AttachHandler(ch);
@@ -592,7 +527,6 @@ namespace Cryville.Crtr {
if (bbus != null) bbus.Dispose();
if (tbus != null) tbus.Dispose();
if (nbus != null) nbus.Dispose();
//cs.Dispose();
Game.InputManager.Deactivate();
foreach (var t in texs) Texture.Destroy(t.Value);
Logger.Log("main", 1, "Game", "Stopped");
@@ -614,14 +548,6 @@ namespace Cryville.Crtr {
#endif
}
/*public void ShowSettings() {
var editor = GameObject.Instantiate<GameObject>(UnityEngine.Resources.Load<GameObject>("Common/PropertyEditor")).GetComponent<PropertyEditor>();
editor.Callback = () => {
Settings.Default.Save();
OnSettingsUpdate();
};
editor.TargetObject = Settings.Default;
}*/
void OnSettingsUpdate() {
Application.targetFrameRate = Settings.Default.TargetFrameRate;
QualitySettings.vSyncCount = Settings.Default.VSync ? 1 : 0;