Add "cur" anchor.
This commit is contained in:
@@ -38,6 +38,7 @@ namespace Cryville.Crtr.Event {
|
|||||||
public Transform gogroup;
|
public Transform gogroup;
|
||||||
|
|
||||||
public readonly Dictionary<int, Anchor> Anchors = new Dictionary<int, Anchor>();
|
public readonly Dictionary<int, Anchor> Anchors = new Dictionary<int, Anchor>();
|
||||||
|
protected Transform a_cur;
|
||||||
protected Transform a_head;
|
protected Transform a_head;
|
||||||
protected Transform a_tail;
|
protected Transform a_tail;
|
||||||
public Vector3 Position {
|
public Vector3 Position {
|
||||||
@@ -76,12 +77,14 @@ namespace Cryville.Crtr.Event {
|
|||||||
public abstract string TypeName {
|
public abstract string TypeName {
|
||||||
get;
|
get;
|
||||||
}
|
}
|
||||||
|
protected readonly static int _a_cur = IdentifierManager.SharedInstance.Request("cur");
|
||||||
protected readonly static int _a_head = IdentifierManager.SharedInstance.Request("head");
|
protected readonly static int _a_head = IdentifierManager.SharedInstance.Request("head");
|
||||||
protected readonly static int _a_tail = IdentifierManager.SharedInstance.Request("tail");
|
protected readonly static int _a_tail = IdentifierManager.SharedInstance.Request("tail");
|
||||||
public virtual void PreInit() {
|
public virtual void PreInit() {
|
||||||
gogroup = new GameObject(TypeName + ":" + Container.GetHashCode().ToString(CultureInfo.InvariantCulture)).transform;
|
gogroup = new GameObject(TypeName + ":" + Container.GetHashCode().ToString(CultureInfo.InvariantCulture)).transform;
|
||||||
if (cs.Parent != null)
|
if (cs.Parent != null)
|
||||||
gogroup.SetParent(cs.Parent.Handler.gogroup, false);
|
gogroup.SetParent(cs.Parent.Handler.gogroup, false);
|
||||||
|
a_cur = RegisterAnchor(_a_cur);
|
||||||
a_head = RegisterAnchor(_a_head);
|
a_head = RegisterAnchor(_a_head);
|
||||||
a_tail = RegisterAnchor(_a_tail);
|
a_tail = RegisterAnchor(_a_tail);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,33 +60,44 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(ContainerState s, StampedEvent ev) {
|
public override void Update(ContainerState s, StampedEvent ev) {
|
||||||
base.Update(s, ev);
|
if (s.CloneType == 0) {
|
||||||
if (s.CloneType == 1) {
|
#if UNITY_5_6_OR_NEWER
|
||||||
Position = GetFramePoint(bs.Parent, bs.Track);
|
a_cur.SetPositionAndRotation(GetFramePoint(s.Parent, s.Track), GetFrameRotation(s.Parent, s.Track));
|
||||||
Rotation = GetFrameRotation(bs.Parent, bs.Track);
|
#else
|
||||||
|
a_cur.position = GetFramePoint(s.Parent, s.Track);
|
||||||
|
a_cur.rotation = GetFrameRotation(s.Parent, s.Track);
|
||||||
|
#endif
|
||||||
|
OpenAnchor(_a_cur);
|
||||||
|
base.Update(s, ev);
|
||||||
|
CloseAnchor(_a_cur);
|
||||||
}
|
}
|
||||||
else if (s.CloneType == 2) {
|
else {
|
||||||
Position = GetFramePoint(ts.Parent, ts.Track);
|
base.Update(s, ev);
|
||||||
Rotation = GetFrameRotation(ts.Parent, ts.Track);
|
if (s.CloneType <= 2) {
|
||||||
if (!gogroup) return;
|
Position = GetFramePoint(s.Parent, s.Track);
|
||||||
Chart.Note tev = Event;
|
Rotation = GetFrameRotation(s.Parent, s.Track);
|
||||||
if (tev.IsLong) {
|
|
||||||
foreach (var i in sgos)
|
|
||||||
i.AppendPoint(Position, Rotation);
|
|
||||||
}
|
}
|
||||||
}
|
if (s.CloneType == 2) {
|
||||||
else if (s.CloneType == 16) {
|
if (!gogroup) return;
|
||||||
if (ev == null) { }
|
Chart.Note tev = Event;
|
||||||
else if (ev.Unstamped == null) { }
|
if (tev.IsLong) {
|
||||||
else if (ev.Unstamped is Chart.Judge) {
|
foreach (var i in sgos)
|
||||||
var tev = (Chart.Judge)ev.Unstamped;
|
i.AppendPoint(Position, Rotation);
|
||||||
Identifier name = default(Identifier);
|
}
|
||||||
ChartPlayer.etor.ContextEvent = tev;
|
}
|
||||||
ChartPlayer.etor.ContextState = s;
|
else if (s.CloneType == 16) {
|
||||||
ChartPlayer.etor.Evaluate(new PropOp.Identifier(v => name = new Identifier(v)), ruleset.judges[tev.Id].input);
|
if (ev == null) { }
|
||||||
judge.Prepare(ev.Time, ev.Time + ev.Duration, name, ruleset.judges[tev.Id], cs);
|
else if (ev.Unstamped == null) { }
|
||||||
ChartPlayer.etor.ContextState = null;
|
else if (ev.Unstamped is Chart.Judge) {
|
||||||
ChartPlayer.etor.ContextEvent = null;
|
var tev = (Chart.Judge)ev.Unstamped;
|
||||||
|
Identifier name = default(Identifier);
|
||||||
|
ChartPlayer.etor.ContextEvent = tev;
|
||||||
|
ChartPlayer.etor.ContextState = s;
|
||||||
|
ChartPlayer.etor.Evaluate(new PropOp.Identifier(v => name = new Identifier(v)), ruleset.judges[tev.Id].input);
|
||||||
|
judge.Prepare(ev.Time, ev.Time + ev.Duration, name, ruleset.judges[tev.Id], cs);
|
||||||
|
ChartPlayer.etor.ContextState = null;
|
||||||
|
ChartPlayer.etor.ContextEvent = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ namespace Cryville.Crtr {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (s.CloneType == 3) {
|
else if (s.CloneType == 3) {
|
||||||
spos = Vector3.zero;
|
|
||||||
bpos = cpt;
|
bpos = cpt;
|
||||||
brot = Quaternion.Euler(s.Direction);
|
brot = Quaternion.Euler(s.Direction);
|
||||||
}
|
}
|
||||||
@@ -61,34 +60,50 @@ namespace Cryville.Crtr {
|
|||||||
float length;
|
float length;
|
||||||
|
|
||||||
public override void Update(ContainerState s, StampedEvent ev) {
|
public override void Update(ContainerState s, StampedEvent ev) {
|
||||||
base.Update(s, ev);
|
if (s.CloneType == 0) {
|
||||||
if (s.CloneType == 2 || s.CloneType == 3) {
|
pwp = Vector3.zero;
|
||||||
var tpt = s.ScreenPoint;
|
cpt = s.ScreenPoint;
|
||||||
var tsv = s.ScrollVelocity;
|
spos = Vector3.zero;
|
||||||
|
#if UNITY_5_6_OR_NEWER
|
||||||
Vector3 dpt = (Vector3)tpt - ppt; // Delta 2D point
|
a_cur.SetPositionAndRotation(s.ScreenPoint, Quaternion.Euler(s.Direction));
|
||||||
dpt.z = (float)((s.Time - ptime) * ChartPlayer.sv * tsv); // Delta Z
|
#else
|
||||||
Quaternion rotq = Quaternion.Euler(s.Direction); // Rotation
|
a_cur.position = s.ScreenPoint;
|
||||||
var dwp = rotq * dpt; // Delta world point
|
a_cur.rotation = Quaternion.Euler(s.Direction);
|
||||||
var nl = length + dwp.magnitude; // New length
|
#endif
|
||||||
var tdist = s.Distance;
|
OpenAnchor(_a_cur);
|
||||||
if (nl >= tdist) {
|
base.Update(s, ev);
|
||||||
s.Break();
|
CloseAnchor(_a_cur);
|
||||||
return;
|
}
|
||||||
}
|
else {
|
||||||
length = nl;
|
base.Update(s, ev);
|
||||||
var wp = pwp + dwp; // World point
|
if (s.CloneType == 2 || s.CloneType == 3) {
|
||||||
pwp = wp;
|
var tpt = s.ScreenPoint;
|
||||||
ppt += dpt;
|
var tsv = s.ScrollVelocity;
|
||||||
|
|
||||||
ptime = s.Time;
|
Vector3 dpt = (Vector3)tpt - ppt; // Delta 2D point
|
||||||
|
dpt.z = (float)((s.Time - ptime) * ChartPlayer.sv * tsv); // Delta Z
|
||||||
if (!gogroup || s.CloneType == 3) return;
|
Quaternion rotq = Quaternion.Euler(s.Direction); // Rotation
|
||||||
var p = GetCurrentWorldPoint();
|
var dwp = rotq * dpt; // Delta world point
|
||||||
foreach (var i in sgos)
|
var nl = length + dwp.magnitude; // New length
|
||||||
i.AppendPoint(p, s.QuatDir);
|
var tdist = s.Distance;
|
||||||
|
if (nl >= tdist) {
|
||||||
|
s.Break();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
length = nl;
|
||||||
|
var wp = pwp + dwp; // World point
|
||||||
|
pwp = wp;
|
||||||
|
ppt += dpt;
|
||||||
|
|
||||||
|
ptime = s.Time;
|
||||||
|
|
||||||
|
if (!gogroup || s.CloneType == 3) return;
|
||||||
|
var p = GetCurrentWorldPoint();
|
||||||
|
foreach (var i in sgos)
|
||||||
|
i.AppendPoint(p, s.QuatDir);
|
||||||
|
}
|
||||||
|
else UpdatePosition(s);
|
||||||
}
|
}
|
||||||
else UpdatePosition(s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdatePosition(ContainerState s) {
|
void UpdatePosition(ContainerState s) {
|
||||||
|
|||||||
Reference in New Issue
Block a user