Prune code.
This commit is contained in:
@@ -22,9 +22,6 @@ namespace Cryville.Common {
|
||||
}
|
||||
|
||||
public class EmptyBinder : Binder {
|
||||
/*static readonly Type[] emptyTypeArray = {};
|
||||
static readonly object[] emptyObjectArray = {};*/
|
||||
|
||||
public override FieldInfo BindToField(BindingFlags bindingAttr, FieldInfo[] match, object value, CultureInfo culture) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Cryville.Common.Buffers {
|
||||
public class WStringPool {
|
||||
public WStringPool() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 704270b37917aa1458db9d14bab07073
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
7
Assets/Cryville/Common/Pdt/PdtAttributes.cs
Normal file
7
Assets/Cryville/Common/Pdt/PdtAttributes.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using System;
|
||||
|
||||
namespace Cryville.Common.Pdt {
|
||||
public class ElementListAttribute : Attribute { }
|
||||
public class ComponentListAttribute : Attribute { }
|
||||
public class PropertyListAttribute : Attribute { }
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,120 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Cryville.Common.Unity.Input {
|
||||
/*public class InputManager {
|
||||
int newId = 0;
|
||||
int GetNewId() {
|
||||
newId++;
|
||||
return newId;
|
||||
}
|
||||
PointerHandler ptrHandler;
|
||||
readonly Queue<PointerInfo> ptrEv = new Queue<PointerInfo>();
|
||||
readonly Dictionary<int, PointerInfo> ptr
|
||||
= new Dictionary<int, PointerInfo>();
|
||||
double originTime;
|
||||
void Callback(int id, PointerInfo info) {
|
||||
/*if (info.Phase != PointerPhase.Update)
|
||||
Logger.Log(
|
||||
"main", 0, "Input",
|
||||
"[{0}, p{1}] {2} {3} {4} at {5} (cs:{6}, ori:{7}, prs:{8})",
|
||||
info.EventTime, info.ProcessTime, info.Type,
|
||||
id, info.Phase, info.Position,
|
||||
info.ContactSize, info.Orientation, info.Pressure
|
||||
);*
|
||||
lock (ptrEv) {
|
||||
ptrEv.Enqueue(info);
|
||||
ptr[id] = info;
|
||||
}
|
||||
}
|
||||
public void Init() {
|
||||
try {
|
||||
if (Environment.OSVersion.Platform == PlatformID.Win32NT) {
|
||||
if (WindowsPointerHandler.IsSupported()) {
|
||||
ptrHandler = new WindowsPointerHandler(true, GetNewId, Callback);
|
||||
Logger.Log("main", 1, "Input", "Initialized windows pointer handler");
|
||||
}
|
||||
else if (UnityTouchHandler.IsSupported()) {
|
||||
ptrHandler = new UnityTouchHandler(GetNewId, Callback);
|
||||
Logger.Log("main", 1, "Input", "Initialized multi-platform pointer handler");
|
||||
}
|
||||
}
|
||||
else if (Application.platform == RuntimePlatform.Android) {
|
||||
/*if (AndroidTouchHandler.IsSupported()) {
|
||||
|
||||
}
|
||||
else*
|
||||
if (UnityTouchHandler.IsSupported()) {
|
||||
ptrHandler = new UnityTouchHandler(GetNewId, Callback);
|
||||
Logger.Log("main", 1, "Input", "Initialized multi-platform pointer handler");
|
||||
}
|
||||
}
|
||||
else {
|
||||
/*if (UnityPointerHandler.IsSupported()) {
|
||||
enableUnityTouch();
|
||||
}*
|
||||
}
|
||||
}
|
||||
catch (Exception ex) {
|
||||
Logger.Log("main", 4, "Input", "An error occured while initializing pointer handler:\n{0}", ex);
|
||||
}
|
||||
if (ptrHandler == null) Logger.Log("main", 3, "Input", "Pointer input is not supported on this device");
|
||||
}
|
||||
public void Activate() {
|
||||
if (ptrHandler != null) ptrHandler.Activate();
|
||||
}
|
||||
public void Deactivate() {
|
||||
if (ptrHandler != null) ptrHandler.Deactivate();
|
||||
ptr.Clear(); ptrEv.Clear();
|
||||
}
|
||||
public void Dispose() {
|
||||
ptrHandler.Dispose();
|
||||
}
|
||||
public void EnumeratePtrEvents(Action<PointerInfo> callback) {
|
||||
lock (ptrEv) {
|
||||
while (ptrEv.Count > 0) {
|
||||
var raw = ptrEv.Dequeue();
|
||||
raw.OffsetTime(originTime);
|
||||
callback(raw);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void EnumeratePointers(Action<PointerInfo> callback) {
|
||||
lock (ptrEv) {
|
||||
var upid = new List<int>();
|
||||
var rmid = new List<int>();
|
||||
foreach (var p in ptr) {
|
||||
var raw = p.Value;
|
||||
if (raw.Phase == PointerPhase.Stationary)
|
||||
raw.EventTime = raw.ProcessTime = Time;
|
||||
else raw.OffsetTime(originTime);
|
||||
callback(raw);
|
||||
if (raw.Phase == PointerPhase.Begin || raw.Phase == PointerPhase.Update)
|
||||
upid.Add(p.Key);
|
||||
if (raw.Phase == PointerPhase.End || raw.Phase == PointerPhase.Cancel)
|
||||
rmid.Add(p.Key);
|
||||
}
|
||||
foreach (var i in upid) {
|
||||
var p = ptr[i];
|
||||
p.Phase = PointerPhase.Stationary;
|
||||
ptr[i] = p;
|
||||
}
|
||||
foreach (var i in rmid) ptr.Remove(i);
|
||||
// Logger.Log("main", 0, "Input", "Ptr count {0}", ptr.Count);
|
||||
}
|
||||
}
|
||||
public double Time {
|
||||
get {
|
||||
if (ptrHandler != null) return ptrHandler.GetCurrentTimestamp() - originTime;
|
||||
else return 0;
|
||||
}
|
||||
}
|
||||
public void SyncTime(double t) {
|
||||
if (ptrHandler != null) {
|
||||
originTime = ptrHandler.GetCurrentTimestamp() - t;
|
||||
Logger.Log("main", 0, "Input", "Sync time {0}", originTime);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
public class InputManager {
|
||||
static readonly List<Type> HandlerRegistries = new List<Type> {
|
||||
typeof(WindowsPointerHandler),
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cryville.Common.Unity.Input {
|
||||
#if false
|
||||
[Obsolete]
|
||||
public abstract class PointerHandler {
|
||||
protected Func<int> newIdCallback;
|
||||
protected Action<int, PointerInfo> callback;
|
||||
|
||||
public PointerHandler(Func<int> newIdCallback, Action<int, PointerInfo> callback) {
|
||||
this.newIdCallback = newIdCallback;
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
public abstract void Activate();
|
||||
public abstract void Deactivate();
|
||||
|
||||
public abstract void Dispose();
|
||||
|
||||
public abstract double GetCurrentTimestamp();
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
public struct PointerInfo {
|
||||
public int Id;
|
||||
public double EventTime;
|
||||
public double ProcessTime;
|
||||
public PointerPhase Phase;
|
||||
public PointerType Type;
|
||||
public Vector2 Position;
|
||||
public Vector2? ContactSize;
|
||||
public uint? Orientation;
|
||||
public uint? Pressure;
|
||||
public double Time {
|
||||
// get { return EventTime == 0 ? ProcessTime : EventTime; }
|
||||
get { return ProcessTime; }
|
||||
}
|
||||
public void OffsetTime(double originTime) {
|
||||
if (EventTime != 0) EventTime -= originTime;
|
||||
if (ProcessTime != 0) ProcessTime -= originTime;
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
public enum PointerPhase {
|
||||
Begin = 0,
|
||||
Update = 2, Stationary = 3,
|
||||
End = 4, Cancel = 5
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
public enum PointerType {
|
||||
Unknown, Mouse, Touch, Pen, TouchPad
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6f0a4eae2ebff4d4d93e2f9fe31c1383
|
||||
timeCreated: 1611272693
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -4,8 +4,6 @@ using UnityEngine;
|
||||
#if UNITY_5_4_OR_NEWER
|
||||
using UnityEngine.Networking;
|
||||
using UnityEngine.Rendering;
|
||||
using static UnityEngine.Networking.UnityWebRequest;
|
||||
|
||||
#endif
|
||||
|
||||
namespace Cryville.Common.Unity {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -80,9 +80,6 @@ namespace Cryville.Crtr {
|
||||
return (ChartEvent)MemberwiseClone();
|
||||
}
|
||||
|
||||
/*[DefaultValue(0.0f)][Obsolete]
|
||||
public float duration = 0.0f;*/
|
||||
|
||||
[JsonIgnore]
|
||||
public float Duration {
|
||||
get {
|
||||
@@ -96,13 +93,6 @@ namespace Cryville.Crtr {
|
||||
get { return Duration > 0; }
|
||||
}
|
||||
|
||||
/*[JsonIgnore]
|
||||
public float EndBeatPosition {
|
||||
get {
|
||||
return BeatPosition + duration;
|
||||
}
|
||||
}*/
|
||||
|
||||
private InstantEvent attev = null;
|
||||
[JsonIgnore]
|
||||
public InstantEvent AttackEvent {
|
||||
@@ -121,14 +111,6 @@ namespace Cryville.Crtr {
|
||||
}
|
||||
}
|
||||
|
||||
/*[JsonIgnore]
|
||||
[Obsolete]
|
||||
public Dictionary<string, Func<object>> Properties { get; private set; }
|
||||
[Obsolete]
|
||||
protected void SubmitProperty(string name, Func<object> property) {
|
||||
Properties.Add(name, property);
|
||||
}*/
|
||||
|
||||
[JsonIgnore]
|
||||
public Dictionary<string, PropSrc> PropSrcs { get; private set; }
|
||||
protected void SubmitPropSrc(string name, PropSrc property) {
|
||||
@@ -141,10 +123,6 @@ namespace Cryville.Crtr {
|
||||
}
|
||||
|
||||
protected ChartEvent() {
|
||||
/*
|
||||
Properties = new Dictionary<string, Func<object>>();
|
||||
SubmitProperty("long", () => @long);
|
||||
*/
|
||||
PropSrcs = new Dictionary<string, PropSrc>();
|
||||
SubmitPropSrc("long", new PropSrc.Boolean(() => IsLong));
|
||||
PropOps = new Dictionary<string, PropOp>();
|
||||
@@ -350,26 +328,6 @@ namespace Cryville.Crtr {
|
||||
public Vector AbsoluteValue;
|
||||
[JsonIgnore]
|
||||
public MotionNode RelativeNode;
|
||||
/*public struct Node {
|
||||
public ushort Id;
|
||||
public Vec1 Time;
|
||||
public TransitionType? Transition;
|
||||
public Vec1 Rate;
|
||||
public Vector Value;
|
||||
|
||||
public Node LerpWith(MotionNode start, float lerpedTime) {
|
||||
Vec1 time = Time == null ? null : (Vec1)Time.LerpWith(start.Time, lerpedTime);
|
||||
Vec1 rate = Rate == null ? null : (Vec1)Rate.LerpWith(start.Rate, lerpedTime);
|
||||
Vector value = Value == null ? null : Value.LerpWith(start.Value, lerpedTime);
|
||||
return new Node() {
|
||||
Id = Id,
|
||||
Time = time,
|
||||
Transition = Transition,
|
||||
Rate = rate,
|
||||
Value = value
|
||||
};
|
||||
}
|
||||
}*/
|
||||
|
||||
[DefaultValue(TransitionType.Ease)]
|
||||
public TransitionType transition = TransitionType.Ease;
|
||||
@@ -406,19 +364,6 @@ namespace Cryville.Crtr {
|
||||
|
||||
public class Note : EventContainer {
|
||||
public Note() : base() {
|
||||
/*
|
||||
SubmitProperty("judge", () => judge);
|
||||
SubmitProperty("endjudge", () => endjudge);
|
||||
SubmitProperty("track", () => {
|
||||
if (_track == null) {
|
||||
var i = motions.FirstOrDefault(m => m.RelativeNode == null && m.Name.MainName == "track");
|
||||
if (i == null) _track = ((Vec1)ChartPlayer.motionRegistry["track"].InitValue).Value;
|
||||
else _track = ((Vec1)i.AbsoluteValue).Value;
|
||||
}
|
||||
return _track.Value;
|
||||
});
|
||||
*/
|
||||
|
||||
SubmitPropSrc("judge", new PropSrc.String(() => judge));
|
||||
SubmitPropSrc("endjudge", new PropSrc.String(() => endjudge));
|
||||
SubmitPropSrc("track", new PropSrc.Float(() => {
|
||||
@@ -430,9 +375,6 @@ namespace Cryville.Crtr {
|
||||
SubmitPropOp("endjudge", new PropOp.String(v => endjudge = v));
|
||||
}
|
||||
|
||||
/*[DefaultValue(false)][Obsolete]
|
||||
public bool wipe = false;*/
|
||||
|
||||
public string judge;
|
||||
public string endjudge;
|
||||
|
||||
@@ -440,17 +382,8 @@ namespace Cryville.Crtr {
|
||||
get { return 2; }
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public class InternalJudgement : ChartEvent {
|
||||
public Note Parent;
|
||||
|
||||
public override int Priority {
|
||||
get { return 0; }
|
||||
}
|
||||
}*/
|
||||
|
||||
// TODO will likely be deprecated in the future
|
||||
// TODO [Obsolete]
|
||||
public List<Signature> sigs; // Signatures
|
||||
// TODO [Obsolete]
|
||||
public class Signature : ChartEvent {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
//#define NO_SOUND
|
||||
|
||||
using Cryville.Audio.Source;
|
||||
using Cryville.Crtr.Event;
|
||||
using System;
|
||||
@@ -8,23 +6,12 @@ using System.IO;
|
||||
|
||||
namespace Cryville.Crtr {
|
||||
public class ChartHandler : ContainerHandler {
|
||||
//private StampedState cs;
|
||||
|
||||
public Chart chart;
|
||||
//readonly Dictionary<string, Sound> sounds = new Dictionary<string, Sound>();
|
||||
readonly List<LibavFileAudioSource> sounds = new List<LibavFileAudioSource>();
|
||||
|
||||
public ChartHandler(Chart _chart, DirectoryInfo dir) : base() {
|
||||
if (dir == null) throw new ArgumentNullException("dir");
|
||||
|
||||
chart = _chart;
|
||||
|
||||
/*foreach (Chart.Group g in chart.groups) {
|
||||
var gh = new GroupHandler(g, this);
|
||||
// cs.AddChild(new StampedState(new StampedState(chart, sevs)));
|
||||
}*/
|
||||
|
||||
//PrehandleEvents();
|
||||
}
|
||||
|
||||
public override string TypeName {
|
||||
@@ -37,49 +24,11 @@ namespace Cryville.Crtr {
|
||||
base.PreInit();
|
||||
}
|
||||
|
||||
public override void Init() {
|
||||
base.Init();
|
||||
#if !NO_SOUND
|
||||
/*foreach (Chart.Sound ev in chart.sounds) {
|
||||
sounds.Add(ev, new LibavFileAudioSource(
|
||||
Game.GameDataPath + "/songs/" + ev.id + "/.ogg"
|
||||
));
|
||||
Logger.Log("main", 0, "Load", "Loading song: {0}", ev.id);
|
||||
}*/
|
||||
#endif
|
||||
}
|
||||
|
||||
public override void Dispose() {
|
||||
if (Disposed) return;
|
||||
base.Dispose();
|
||||
// foreach (var h in handlers) h.Dispose();
|
||||
foreach (var s in sounds) s.Dispose();
|
||||
}
|
||||
|
||||
/*List<StampedEvent> sevs = new List<StampedEvent>();
|
||||
public void PrehandleEvents() {
|
||||
EventPrehandler ph = new EventPrehandler(
|
||||
chart,
|
||||
chart.motions.Cast<Chart.Event>()
|
||||
.Concat<Chart.Event>(chart.signs.Cast<Chart.Event>())
|
||||
.Concat<Chart.Event>(chart.sounds.Cast<Chart.Event>())
|
||||
);
|
||||
// foreach (var h in handlers) h.StartPrehandler(ph);
|
||||
ph.Forward(ev => {
|
||||
if (ev is Chart.Sound) {
|
||||
Chart.Sound tev = (Chart.Sound)ev;
|
||||
sevs.Add(new StampedEvent.PlaySound() {
|
||||
Time = ph.Time - tev.offset + Settings.Default.SoundOffset,
|
||||
Event = tev
|
||||
});
|
||||
}
|
||||
// foreach (var h in handlers) h.PrehandleToTime(ph.Time);
|
||||
});
|
||||
|
||||
sevs = sevs.Concat(ph.Result).ToList();
|
||||
cs = new StampedState(chart, sevs);
|
||||
// foreach (var h in handlers) h.EndPrehandler(cs);
|
||||
}*/
|
||||
|
||||
public override void Update(ContainerState s, StampedEvent ev) {
|
||||
base.Update(s, ev);
|
||||
@@ -97,68 +46,13 @@ namespace Cryville.Crtr {
|
||||
s.Time - tev.offset + ChartPlayer.soundOffset,
|
||||
source
|
||||
);
|
||||
/*var l = new List<StampedEvent> {
|
||||
new StampedEvent.PlaySound() {
|
||||
Time = s.Time - tev.offset + ChartPlayer.soundOffset,
|
||||
Container = chart,
|
||||
Unstamped = tev
|
||||
}
|
||||
};
|
||||
cs.Bus.IssuePatch(l);*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void ExUpdate(ContainerState s, StampedEvent ev) {
|
||||
base.ExUpdate(s, ev);
|
||||
if (s.CloneType == 0) {
|
||||
/*#if !NO_SOUND
|
||||
if (ev is StampedEvent.PlaySound) {
|
||||
StampedEvent.PlaySound tev = (StampedEvent.PlaySound)ev;
|
||||
// sounds[tev.Event.file.ToLower()].audioSource.time = toTime - cs.Time;
|
||||
sounds[tev.Unstamped.id].audioSource.Play();
|
||||
}
|
||||
#endif*/
|
||||
}
|
||||
}
|
||||
|
||||
public override void EndUpdate(ContainerState s) {
|
||||
base.EndUpdate(s);
|
||||
// TODO End of chart
|
||||
}
|
||||
|
||||
/*public void SendInput(int id, TouchPhase phase, Vector2 pos) {
|
||||
// Vector2 jpos = Camera.main.ScreenToWorldPoint(new Vector3(pos.x, pos.y, -cameraZ));
|
||||
/*foreach (var h in handlers) {
|
||||
h.SendInput(id, phase, jpos);
|
||||
}*
|
||||
}
|
||||
|
||||
int hits = 0;
|
||||
int misses = 0;
|
||||
public void ReportJudge(bool hit) {
|
||||
if (hit) hits++;
|
||||
else misses++;
|
||||
GameObject.Find("Status").GetComponent<Text>().text = string.Format("Hits: {0}\nMisses: {1}", hits, misses);
|
||||
}*/
|
||||
}
|
||||
|
||||
/*public class ChartState : ChartEventStateBase {
|
||||
public ChartState(Chart c) : base(
|
||||
c,
|
||||
c.motions.Cast<Chart.Event>()
|
||||
.Concat<Chart.Event>(c.signs.Cast<Chart.Event>())
|
||||
.Concat<Chart.Event>(c.sounds.Cast<Chart.Event>())
|
||||
) { }
|
||||
|
||||
protected override void Handle(Chart.Event ev) {
|
||||
/*if (ev is Chart.Signature) {
|
||||
Chart.Signature tev = (Chart.Signature)ev;
|
||||
float tempo = tev.tempo;
|
||||
if (tempo != 0)
|
||||
Tempo = tempo;
|
||||
}*
|
||||
base.Handle(ev);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -139,17 +139,6 @@ namespace Cryville.Crtr {
|
||||
}
|
||||
}
|
||||
|
||||
/*public class RectConverter : TypeConverter {
|
||||
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) {
|
||||
if (sourceType == typeof(string))
|
||||
return true;
|
||||
return base.CanConvertFrom(context, sourceType);
|
||||
}
|
||||
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) {
|
||||
return base.ConvertFrom(context, culture, value);
|
||||
}
|
||||
}*/
|
||||
|
||||
public class Cocos2dFramesBinder : EmptyBinder {
|
||||
public override object ChangeType(object value, Type type, CultureInfo culture) {
|
||||
if (value is string) {
|
||||
|
||||
@@ -50,16 +50,7 @@ namespace Cryville.Crtr.Components {
|
||||
static readonly ListPool<Vector2> _uvPool = new ListPool<Vector2>();
|
||||
static readonly ArrayPool<Vector2> _shapePool = new ArrayPool<Vector2>(0x100, 0x10000);
|
||||
|
||||
public PolygonSGO()
|
||||
: base() {
|
||||
/*
|
||||
SubmitProperty("head", new Property(typeof(string), () => head.frame, v => head.frame = (string)v));
|
||||
SubmitProperty("body", new Property(typeof(string), () => body.frame, v => body.frame = (string)v));
|
||||
SubmitProperty("tail", new Property(typeof(string), () => tail.frame, v => tail.frame = (string)v));
|
||||
SubmitProperty("transparent", new Property(typeof(bool), () => transparent, v => transparent = (bool)v));
|
||||
SubmitProperty("shape", new Property(typeof(Vector2[]), () => _shape, v => _shape = (Vector2[])v));
|
||||
*/
|
||||
|
||||
public PolygonSGO() {
|
||||
SubmitProperty("head", new PropOp.String(v => head.FrameName = v));
|
||||
SubmitProperty("body", new PropOp.String(v => body.FrameName = v));
|
||||
SubmitProperty("tail", new PropOp.String(v => tail.FrameName = v));
|
||||
@@ -146,17 +137,9 @@ namespace Cryville.Crtr.Components {
|
||||
lengths = _lPool.Rent();
|
||||
}
|
||||
|
||||
/*
|
||||
r = new Vector3(0, 0, 0);
|
||||
|
||||
Quaternion rotq = Quaternion.Euler(r);
|
||||
p = prevp + rotq * (p - prevpt);
|
||||
prevp = p;*/
|
||||
|
||||
for (int i = 0; i < _shapeLength; i++) {
|
||||
Vector2 sp = r * _shape[i];
|
||||
vertices.Add(p + (Vector3)sp);
|
||||
// uv.Add(new Vector2(i / (shape.Length - 1), vertCount));
|
||||
}
|
||||
|
||||
if (headGenerated) {
|
||||
|
||||
@@ -1,54 +1,9 @@
|
||||
using Cryville.Common.Pdt;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cryville.Crtr.Components {
|
||||
public abstract class SkinComponent : MonoBehaviour {
|
||||
#if false
|
||||
/// <summary>
|
||||
/// The properties of the component.
|
||||
/// </summary>
|
||||
[Obsolete]
|
||||
public Dictionary<string, Property> Properties { get; private set; }
|
||||
/// <summary>
|
||||
/// Submits a property.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the property.</param>
|
||||
/// <param name="property">The property itself.</param>
|
||||
[Obsolete]
|
||||
protected void SubmitProperty(string name, Property property) {
|
||||
Properties.Add(name, property);
|
||||
}
|
||||
/// <summary>
|
||||
/// The property of a skin component.
|
||||
/// </summary>
|
||||
[Obsolete]
|
||||
public struct Property {
|
||||
/// <summary>
|
||||
/// The type of the property.
|
||||
/// </summary>
|
||||
public readonly Type Type;
|
||||
/// <summary>
|
||||
/// The callback that gets the property value.
|
||||
/// </summary>
|
||||
public readonly Func<object> Get;
|
||||
/// <summary>
|
||||
/// The callback that sets the property value.
|
||||
/// </summary>
|
||||
public readonly Action<object> Set;
|
||||
/// <summary>
|
||||
/// Creates a property.
|
||||
/// </summary>
|
||||
/// <param name="type">The type of the property.</param>
|
||||
/// <param name="get">The callback that gets the property value.</param>
|
||||
/// <param name="set">The callback that sets the property value.</param>
|
||||
public Property(Type type, Func<object> get, Action<object> set) {
|
||||
Type = type; Get = get; Set = set;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// The property operators of the component.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,21 +1,9 @@
|
||||
using Cryville.Common.Pdt;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cryville.Crtr.Components {
|
||||
public abstract class SpriteBase : SkinComponent {
|
||||
public SpriteBase()
|
||||
: base() {
|
||||
/*
|
||||
SubmitProperty("bound", new Property(typeof(BoundInfo), null, v => Bound = (BoundInfo)v));
|
||||
SubmitProperty("transparent", new Property(typeof(bool), () => transparent, v => transparent = (bool)v));
|
||||
SubmitProperty("pivot", new Property(typeof(Vector2), () => Pivot, v => Pivot = (Vector2)v));
|
||||
SubmitProperty("scale", new Property(typeof(Vector2), () => Scale, v => Scale = (Vector2)v));
|
||||
SubmitProperty("ui", new Property(typeof(bool), () => UI, v => UI = (bool)v));
|
||||
SubmitProperty("zindex", new Property(typeof(short), () => ZIndex, v => ZIndex = (short)v));
|
||||
*/
|
||||
|
||||
public SpriteBase() {
|
||||
SubmitProperty("bound", new op_set_bound(this));
|
||||
SubmitProperty("transparent", new PropOp.Boolean(v => transparent = v));
|
||||
SubmitProperty("pivot", new PropOp.Vector2(v => Pivot = v));
|
||||
@@ -87,28 +75,6 @@ namespace Cryville.Crtr.Components {
|
||||
get { return Vector2.zero; }
|
||||
}
|
||||
|
||||
#if false
|
||||
[Obsolete]
|
||||
public struct BoundInfo : IConstructable {
|
||||
public Vector2 Pivot;
|
||||
public Vector3 Position;
|
||||
public void Load(object data, IEvaluator etor) {
|
||||
var d = (IList)data;
|
||||
Pivot = (Vector2)etor.Cast(typeof(Vector2), d[0]);
|
||||
Position = (Vector3)etor.Cast(typeof(Vector3), d[1]);
|
||||
}
|
||||
}
|
||||
[Obsolete]
|
||||
public BoundInfo Bound {
|
||||
set {
|
||||
var r = Quaternion.Inverse(transform.rotation);
|
||||
var da = value.Pivot - Pivot;
|
||||
var dp = r * (value.Position - transform.localPosition);
|
||||
if (da.x != 0) _scale.x = dp.x / da.x;
|
||||
if (da.y != 0) _scale.y = dp.z / da.y;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
public void SetBound(Vector2 piv, Vector3 pos) {
|
||||
var r = Quaternion.Inverse(transform.rotation);
|
||||
var da = piv - Pivot;
|
||||
|
||||
@@ -33,14 +33,7 @@ namespace Cryville.Crtr.Components {
|
||||
}
|
||||
|
||||
public class SpritePlane : SpriteBase {
|
||||
public SpritePlane()
|
||||
: base() {
|
||||
/*
|
||||
SubmitProperty("frame", new Property(typeof(string), () => Frame, v => Frame = (string)v));
|
||||
SubmitProperty("fit", new Property(typeof(FitMode), () => Fit, v => Fit = (FitMode)v));
|
||||
SubmitProperty("opacity", new Property(typeof(float), () => Opacity, v => Opacity = (float)v));
|
||||
*/
|
||||
|
||||
public SpritePlane() {
|
||||
SubmitProperty("frame", new PropOp.String(v => Frame = v));
|
||||
SubmitProperty("fit", new PropOp.Enum<FitMode>(v => Fit = v));
|
||||
SubmitProperty("opacity", new PropOp.Float(v => Opacity = v));
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cryville.Crtr.Components {
|
||||
public class SpriteRect : SpriteBase {
|
||||
public SpriteRect()
|
||||
: base() {
|
||||
/*
|
||||
SubmitProperty("color", new Property(typeof(Color), () => Color, v => Color = (Color)v));
|
||||
*/
|
||||
|
||||
public SpriteRect() {
|
||||
SubmitProperty("color", new PropOp.Color(v => Color = v));
|
||||
|
||||
transparent = true;
|
||||
|
||||
@@ -4,12 +4,7 @@ using UnityEngine;
|
||||
|
||||
namespace Cryville.Crtr.Components {
|
||||
public class SpriteScale3 : SpritePlane {
|
||||
public SpriteScale3()
|
||||
: base() {
|
||||
/*
|
||||
SubmitProperty("border", new Property(typeof(Vector2), () => Border, v => Border = (Vector2)v));
|
||||
*/
|
||||
|
||||
public SpriteScale3() {
|
||||
SubmitProperty("border", new PropOp.Vector2(v => Border = v));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,22 +1,11 @@
|
||||
using Cryville.Common.Pdt;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cryville.Crtr.Components {
|
||||
public class SpriteText : SpriteBase {
|
||||
public SpriteText() {
|
||||
/*
|
||||
SubmitProperty("frames", new Property(typeof(TextFrames), () => Frames, v => Frames = (TextFrames)v));
|
||||
SubmitProperty("value", new Property(typeof(string), () => Value, v => Value = (string)v));
|
||||
SubmitProperty("size", new Property(typeof(float), () => Size, v => Size = (float)v));
|
||||
SubmitProperty("spacing", new Property(typeof(float), () => Spacing, v => Spacing = (float)v));
|
||||
SubmitProperty("opacity", new Property(typeof(float), () => Opacity, v => Opacity = (float)v));
|
||||
*/
|
||||
|
||||
SubmitProperty("frames", new op_set_frames(this));
|
||||
SubmitProperty("value", new PropOp.String(v => Value = v));
|
||||
SubmitProperty("size", new PropOp.Float(v => Size = v));
|
||||
@@ -42,7 +31,7 @@ namespace Cryville.Crtr.Components {
|
||||
o += v.Length * sizeof(char) + sizeof(int);
|
||||
result.Add(keys[i], new SpriteInfo { FrameName = v });
|
||||
}
|
||||
_self.Frames = new TextFrames { Frames = result };
|
||||
_self.Frames = result;
|
||||
}
|
||||
}
|
||||
#pragma warning restore IDE1006
|
||||
@@ -53,19 +42,8 @@ namespace Cryville.Crtr.Components {
|
||||
}
|
||||
|
||||
readonly Dictionary<Texture2D, MeshWrapper> meshes = new Dictionary<Texture2D, MeshWrapper>();
|
||||
public struct TextFrames /*: IConstructable*/ {
|
||||
public Dictionary<char, SpriteInfo> Frames;
|
||||
/*public void Load(object data, IEvaluator etor) {
|
||||
var d = (IList)data;
|
||||
var keys = (string)d[0];
|
||||
var values = (List<object>)d[1];
|
||||
Frames = new Dictionary<char, SpriteInfo>(keys.Length);
|
||||
for (int i = 0; i < keys.Length; i++)
|
||||
Frames.Add(keys[i], new SpriteInfo() { FrameName = (string)values[i] });
|
||||
}*/
|
||||
}
|
||||
TextFrames m_frames;
|
||||
public TextFrames Frames {
|
||||
Dictionary<char, SpriteInfo> m_frames;
|
||||
public Dictionary<char, SpriteInfo> Frames {
|
||||
get { return m_frames; }
|
||||
set { m_frames = value; UpdateFrames(); UpdateScale(); }
|
||||
}
|
||||
@@ -102,7 +80,7 @@ namespace Cryville.Crtr.Components {
|
||||
float frameHeight = 0;
|
||||
foreach (var m in meshes) m.Value.Destroy();
|
||||
meshes.Clear();
|
||||
foreach (var f in m_frames.Frames) {
|
||||
foreach (var f in m_frames) {
|
||||
f.Value.Load();
|
||||
if (frameHeight == 0) frameHeight = f.Value.Rect.height;
|
||||
else if (frameHeight != f.Value.Rect.height) throw new Exception("Inconsistent frame height");
|
||||
@@ -128,7 +106,7 @@ namespace Cryville.Crtr.Components {
|
||||
uvs.Add(t, new List<Vector2>(vc));
|
||||
}
|
||||
foreach (var c in m_value) {
|
||||
var f = m_frames.Frames[c];
|
||||
var f = m_frames[c];
|
||||
var t = f.Frame.Texture;
|
||||
float w = f.Ratio * m_size;
|
||||
verts[t].Add(new Vector3(sum_x , 0, 0));
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1d956cad385858849a2681bed8031a77
|
||||
timeCreated: 1617844741
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -14,9 +14,9 @@ namespace Cryville.Crtr.Event {
|
||||
|
||||
public Dictionary<EventContainer, ContainerState> Children
|
||||
= new Dictionary<EventContainer, ContainerState>();
|
||||
HashSet<EventContainer> WorkingChildren
|
||||
readonly HashSet<EventContainer> WorkingChildren
|
||||
= new HashSet<EventContainer>();
|
||||
HashSet<EventContainer> InvalidatedChildren
|
||||
readonly HashSet<EventContainer> InvalidatedChildren
|
||||
= new HashSet<EventContainer>();
|
||||
public Dictionary<Type, List<ContainerState>> TypedChildren
|
||||
= new Dictionary<Type, List<ContainerState>>();
|
||||
@@ -25,14 +25,8 @@ namespace Cryville.Crtr.Event {
|
||||
return TypedChildren[handlerType][index];
|
||||
}
|
||||
public ContainerState GetChild(EventContainer ev) {
|
||||
/*if (!Children.ContainsKey(ev)) {
|
||||
Children[ev] = prototype.FetchChildClone(ev, CloneType);
|
||||
}*/
|
||||
return Children[ev];
|
||||
}
|
||||
/*ContainerState FetchChildClone(EventContainer ev, byte ct) {
|
||||
return Children[ev].Clone(ct);
|
||||
}*/
|
||||
|
||||
void NotifyWorkingChanged(EventContainer key) {
|
||||
InvalidatedChildren.Add(key);
|
||||
@@ -56,7 +50,6 @@ namespace Cryville.Crtr.Event {
|
||||
public byte CloneType;
|
||||
private ContainerState rootPrototype = null;
|
||||
private ContainerState prototype = null;
|
||||
// public SkinManager skinManager;
|
||||
public SkinContainer skinContainer;
|
||||
public Judge judge;
|
||||
|
||||
@@ -97,7 +90,6 @@ namespace Cryville.Crtr.Event {
|
||||
}
|
||||
|
||||
void InvalidateMotion(MotionName name) {
|
||||
// if (CachedValues.ContainsKey(name))
|
||||
CachedValueStates[name] = false;
|
||||
foreach (var c in Children)
|
||||
c.Value.InvalidateMotion(name);
|
||||
@@ -113,10 +105,6 @@ namespace Cryville.Crtr.Event {
|
||||
|
||||
foreach (var m in ChartPlayer.motionRegistry)
|
||||
Values.Add(new MotionName(m.Key), new RealtimeMotionValue().Init(Parent == null ? m.Value.GlobalInitValue : m.Value.InitValue));
|
||||
|
||||
//skinManager = new SkinManager(skin, this);
|
||||
|
||||
//events.Sort((a, b) => a.Time.CompareTo(b.Time));
|
||||
}
|
||||
|
||||
static void AddChild(EventContainer c, ContainerState s, ContainerState target) {
|
||||
@@ -127,9 +115,6 @@ namespace Cryville.Crtr.Event {
|
||||
}
|
||||
|
||||
public ContainerState Clone(byte ct) {
|
||||
/*if (prototype != null)
|
||||
throw new InvalidOperationException();*/
|
||||
|
||||
var r = (ContainerState)MemberwiseClone();
|
||||
|
||||
var mvs = new Dictionary<MotionName, RealtimeMotionValue>(Values.Count);
|
||||
@@ -152,7 +137,6 @@ namespace Cryville.Crtr.Event {
|
||||
|
||||
r.Children = new Dictionary<EventContainer, ContainerState>();
|
||||
foreach (var child in Children) {
|
||||
// if (!child.Value.Working && ct != 1) continue;
|
||||
var cc = child.Value.Clone(ct);
|
||||
cc.Parent = r;
|
||||
AddChild(child.Key, cc, r);
|
||||
@@ -184,7 +168,6 @@ namespace Cryville.Crtr.Event {
|
||||
else dest.Values.Add(mv.Key, mv.Value.Clone());
|
||||
}
|
||||
|
||||
// dest.CachedValues.Clear();
|
||||
foreach (var cv in CachedValues) {
|
||||
Vector dv;
|
||||
if(dest.CachedValues.TryGetValue(cv.Key, out dv)) cv.Value.CopyTo(dv);
|
||||
@@ -224,7 +207,6 @@ namespace Cryville.Crtr.Event {
|
||||
}
|
||||
|
||||
public void AttachSystems(PdtSkin skin, Judge judge) {
|
||||
// skinManager = new SkinManager(skin);
|
||||
skinContainer = new SkinContainer(skin);
|
||||
this.judge = judge;
|
||||
}
|
||||
@@ -337,20 +319,15 @@ namespace Cryville.Crtr.Event {
|
||||
}
|
||||
|
||||
public void Handle(StampedEvent ev, Action<StampedEvent> callback = null) {
|
||||
if (breakflag) {
|
||||
// Time = toTime;
|
||||
return;
|
||||
}
|
||||
if (breakflag) return;
|
||||
if (ev != null) {
|
||||
bool flag = false;
|
||||
if (ev.Unstamped is Chart.Motion) {
|
||||
var tev = (Chart.Motion)ev.Unstamped;
|
||||
// tev._apply(Values);
|
||||
var mv = RMVPool.Rent(tev.Name);
|
||||
GetMotionValue(tev.Name).CopyTo(mv);
|
||||
PlayingMotions.Add(ev, mv);
|
||||
Callback(ev, callback);
|
||||
// UpdateMotions();
|
||||
if (!ev.Unstamped.IsLong)
|
||||
PlayingMotions.Remove(ev);
|
||||
}
|
||||
@@ -371,9 +348,7 @@ namespace Cryville.Crtr.Event {
|
||||
if (tev.IsRelease) {
|
||||
var nev = tev.Original;
|
||||
if (nev is Chart.Motion) {
|
||||
// var tnev = (Chart.Motion)nev;
|
||||
Callback(ev, callback);
|
||||
// UpdateMotions();
|
||||
PlayingMotions.Remove(ev.Origin);
|
||||
}
|
||||
else if (nev is EventContainer) {
|
||||
@@ -397,7 +372,6 @@ namespace Cryville.Crtr.Event {
|
||||
if (!flag) Callback(null, callback);
|
||||
return;
|
||||
}
|
||||
// Time = toTime;
|
||||
Callback(null, callback);
|
||||
}
|
||||
|
||||
@@ -407,21 +381,6 @@ namespace Cryville.Crtr.Event {
|
||||
callback(ev);
|
||||
if (ev == null || ev.Unstamped != null) Handler.Update(this, ev);
|
||||
else Handler.ExUpdate(this, ev);
|
||||
/*if (CloneType == 1) {
|
||||
if (ev == null || ev.Event != null) Handler.Forward(ev);
|
||||
else Handler.ExUpdate(CloneType, ev);
|
||||
}
|
||||
else if (CloneType == 0) {
|
||||
if (ev == null || ev.Event != null) Handler.Update(ev);
|
||||
else Handler.ExUpdate(CloneType, ev);
|
||||
}
|
||||
else if (CloneType == 2) {
|
||||
// TODO Do nothing atm
|
||||
}
|
||||
else if (CloneType >= 16) {
|
||||
if (ev == null || ev.Event != null) Handler.PreUpdate(CloneType, ev);
|
||||
else Handler.ExUpdate(CloneType, ev);
|
||||
}*/
|
||||
foreach (var m in PlayingMotions)
|
||||
Handler.MotionUpdate(CloneType, (Chart.Motion)m.Key.Unstamped);
|
||||
}
|
||||
|
||||
@@ -48,9 +48,6 @@ namespace Cryville.Crtr.Event {
|
||||
if (ev.IsLong) {
|
||||
events.Add(ev.ReleaseEvent);
|
||||
table.Add(ev.ReleaseEvent, cs);
|
||||
/*if (ev is Chart.Note) {
|
||||
events.Add(ev.AttackEvent);
|
||||
}*/
|
||||
}
|
||||
events.Add(ev);
|
||||
table.Add(ev, cs);
|
||||
@@ -101,7 +98,6 @@ namespace Cryville.Crtr.Event {
|
||||
return_ahead:
|
||||
Time = toTime;
|
||||
beat = toBeat;
|
||||
// foreach (var c in Children) c.ForwardToTime(Time);
|
||||
if (callback != null) callback(null);
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -115,28 +115,9 @@ namespace Cryville.Crtr {
|
||||
Settings.Default.LastRunVersion = Application.version;
|
||||
Settings.Default.Save();
|
||||
|
||||
// TODO Remove test log
|
||||
/*Logger.Log("main", 0, "Game", "Installed fonts:");
|
||||
foreach (var f in Font.GetOSInstalledFontNames()) {
|
||||
Logger.Log("main", 0, "Game", " {0}", f);
|
||||
}*/
|
||||
|
||||
Logger.Log("main", 1, "Game", "Initialized");
|
||||
|
||||
/*ServicePointManager.SecurityProtocol
|
||||
= SecurityProtocolType.Ssl3
|
||||
| SecurityProtocolType.Tls
|
||||
| SecurityProtocolTypeExtensions.Tls11
|
||||
| SecurityProtocolTypeExtensions.Tls12
|
||||
| SecurityProtocolTypeExtensions.Tls13
|
||||
;
|
||||
ServicePointManager.ServerCertificateValidationCallback = certValidCallback;*/
|
||||
}
|
||||
|
||||
/*static bool certValidCallback(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) {
|
||||
return true;
|
||||
}*/
|
||||
|
||||
#if UNITY_ANDROID
|
||||
[MonoPInvokeCallback(typeof(OpenSL.Native.slBufferQueueCallback))]
|
||||
static void audioCallback(IntPtr caller, IntPtr context) {
|
||||
|
||||
@@ -7,21 +7,13 @@ using UnityEngine;
|
||||
|
||||
namespace Cryville.Crtr {
|
||||
class GroupHandler : ContainerHandler {
|
||||
// private StampedState cs;
|
||||
|
||||
public ChartHandler ch;
|
||||
// Chart.Group group;
|
||||
// Dictionary<StampedEvent, GameObject> notePool = new Dictionary<StampedEvent, GameObject>();
|
||||
|
||||
SquareMatrix matFrame;
|
||||
List<ContainerState> tracks;
|
||||
|
||||
public GroupHandler(Chart.Group tg, ChartHandler ch) : base() {
|
||||
//group = tg;
|
||||
this.ch = ch;
|
||||
/*foreach (Chart.Track t in group.tracks) {
|
||||
handlers.Add(new TrackHandler(t, this));
|
||||
}*/
|
||||
}
|
||||
|
||||
public override string TypeName {
|
||||
@@ -40,117 +32,6 @@ namespace Cryville.Crtr {
|
||||
matFrame = SquareMatrix.WithPolynomialCoefficients(tracks.Count);
|
||||
}
|
||||
|
||||
/*EventPrehandler ph;
|
||||
List<StampedEvent> sevs = new List<StampedEvent>();
|
||||
public void StartPrehandler(EventPrehandler parent) {
|
||||
/*List<Chart.Event> appevs = new List<Chart.Event>();
|
||||
foreach (Chart.Note ev in group.notes) {
|
||||
if (ev.duration > 0) {
|
||||
for (float b = 0f; b < ev.duration; b += ev.jdg_interval) {
|
||||
appevs.Add(new Chart.InternalJudgement() { beat = ev.beat, BeatOffset = b, Parent = ev });
|
||||
}
|
||||
}
|
||||
}
|
||||
ph = new EventPrehandler(
|
||||
parent.chart,
|
||||
group.motions.Cast<Chart.Event>()
|
||||
.Concat<Chart.Event>(group.notes.Cast<Chart.Event>()),
|
||||
parent
|
||||
);
|
||||
foreach (TrackHandler h in handlers)
|
||||
h.StartPrehandler(ph);
|
||||
}
|
||||
|
||||
public void PrehandleToTime(float toTime) {
|
||||
ph.ForwardToTime(toTime, ev => {
|
||||
foreach (var h in handlers) h.PrehandleToTime(ph.Time);
|
||||
/*
|
||||
if (ev is Chart.Note) {
|
||||
var tev = (Chart.Note)ev;
|
||||
sevs.Add(new StampedEvent.Judge() {
|
||||
Time = phs.Time - Main.judge * tev.tol,
|
||||
EndTime = phs.Time + Main.judge * tev.tol,
|
||||
Event = tev,
|
||||
Type = tev.wipe ? JudgementType.Held : JudgementType.Attack,
|
||||
JudgeArea = new Area() {
|
||||
Point1 = phs.Point,
|
||||
Point2 = phs.Point + new Chart.Point(0f, 0.1f, 0f, 0.1f).ToRelative(Main.hitRect),
|
||||
Type = AreaType.Circle
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (ev is Chart.InternalJudgement) {
|
||||
var tev = (Chart.InternalJudgement)ev;
|
||||
sevs.Add(new StampedEvent.Judge() {
|
||||
Time = phs.Time - Main.judge * tev.Parent.tol,
|
||||
EndTime = phs.Time + Main.judge * tev.Parent.tol,
|
||||
Event = tev,
|
||||
Type = JudgementType.Held,
|
||||
JudgeArea = new Area() {
|
||||
Point1 = phs.Point,
|
||||
Point2 = phs.Point + new Chart.Point(0f, 0.1f, 0f, 0.1f).ToRelative(Main.hitRect),
|
||||
Type = AreaType.Circle
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void EndPrehandler(StampedState parent) {
|
||||
sevs = ph.Result;
|
||||
cs = new StampedState(ch.chart, sevs, parent);
|
||||
foreach (var h in handlers) h.EndPrehandler(cs);
|
||||
}*/
|
||||
|
||||
/*List<StampedEvent.Judge> judgements = new List<StampedEvent.Judge>();
|
||||
public void SendInput(int id, TouchPhase phase, Vector2 jpos) {
|
||||
for (int i = judgements.Count - 1; i >= 0; i--) {
|
||||
if (judgements[i].JudgeArea.Contains(jpos)) {
|
||||
if (phase == TouchPhase.Began && judgements[i].Type == JudgementType.Attack) {
|
||||
ch.ReportJudge(true);
|
||||
judgements.RemoveAt(i);
|
||||
}
|
||||
else if ((phase == TouchPhase.Stationary || phase == TouchPhase.Moved) && judgements[i].Type == JudgementType.Held) {
|
||||
ch.ReportJudge(true);
|
||||
judgements.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
/*Vector3 cpoint;
|
||||
Vector3 cpoint2;
|
||||
Vector3 prevp = Vector3.zero;
|
||||
Vector3 prevwp = Vector3.zero;
|
||||
Vector3 prevp2 = Vector3.zero;
|
||||
Vector3 prevwp2 = Vector3.zero;*/
|
||||
|
||||
public override void Update(ContainerState s, StampedEvent ev) {
|
||||
base.Update(s, ev);
|
||||
/*cs.ForwardToTime(toTime);
|
||||
foreach (var handler in handlers) handler.Update(cs.Time);*/
|
||||
//cs.ForwardToTime(toTime);
|
||||
|
||||
/*ss.ForwardToTime(toTime, ev => {
|
||||
if (ev is StampedEvent.Judge) {
|
||||
var tev = (StampedEvent.Judge)ev;
|
||||
judgements.Add(tev);
|
||||
}
|
||||
});
|
||||
|
||||
for (int i = judgements.Count - 1; i >= 0; i--) {
|
||||
if (judgements[i].EndTime < cs.Time) {
|
||||
ch.ReportJudge(false);
|
||||
judgements.RemoveAt(i);
|
||||
}
|
||||
}*/
|
||||
// gogroup.rotation = Quaternion.Euler(cs.Direction);
|
||||
}
|
||||
|
||||
public override void EndUpdate(ContainerState s) {
|
||||
base.EndUpdate(s);
|
||||
}
|
||||
|
||||
public ColumnVector<Vector3> GetCurrentFrame(Func<ContainerState, Vector3> func) {
|
||||
var vl = from t in tracks select func(t);
|
||||
return matFrame.Eliminate(
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user