Compare commits
8 Commits
c5571e7d17
...
ff5928b556
Author | SHA1 | Date | |
---|---|---|---|
ff5928b556 | |||
1f0ac2a2e9 | |||
95628f07d1 | |||
3bead4f1b3 | |||
ec9b23f797 | |||
8175ca7e82 | |||
451ebbe91a | |||
da2313ab57 |
@@ -529,7 +529,7 @@ namespace Cryville.Crtr {
|
|||||||
foreach (var ts in gs.Value.Children) {
|
foreach (var ts in gs.Value.Children) {
|
||||||
ContainerHandler th;
|
ContainerHandler th;
|
||||||
if (ts.Key is Chart.Note) {
|
if (ts.Key is Chart.Note) {
|
||||||
th = new NoteHandler(gh, (Chart.Note)ts.Key, pruleset, judge);
|
th = new NoteHandler(gh, (Chart.Note)ts.Key, pruleset);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
th = new TrackHandler(gh, (Chart.Track)ts.Key);
|
th = new TrackHandler(gh, (Chart.Track)ts.Key);
|
||||||
|
@@ -9,6 +9,11 @@ namespace Cryville.Crtr.Components {
|
|||||||
protected Vector3? prevpt;
|
protected Vector3? prevpt;
|
||||||
protected Quaternion? prevrot;
|
protected Quaternion? prevrot;
|
||||||
protected int vertCount = 0;
|
protected int vertCount = 0;
|
||||||
|
bool suppressed;
|
||||||
|
|
||||||
|
public SectionalGameObject() {
|
||||||
|
SubmitProperty("suppressed", new PropOp.Boolean(v => suppressed = v), 2);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnDestroy() {
|
protected override void OnDestroy() {
|
||||||
mesh.Destroy();
|
mesh.Destroy();
|
||||||
@@ -23,7 +28,7 @@ namespace Cryville.Crtr.Components {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void AppendPoint(Vector3 p, Quaternion r) {
|
public void AppendPoint(Vector3 p, Quaternion r) {
|
||||||
if (prevpt == p && prevrot == r) return;
|
if (prevpt == p && prevrot == r || suppressed) return;
|
||||||
AppendPointInternal(p, r);
|
AppendPointInternal(p, r);
|
||||||
// if (!headGenerated) Logger.Log("main", 0, "Skin/Polysec", "{0}", r);
|
// if (!headGenerated) Logger.Log("main", 0, "Skin/Polysec", "{0}", r);
|
||||||
prevpt = p;
|
prevpt = p;
|
||||||
@@ -52,9 +57,9 @@ namespace Cryville.Crtr.Components {
|
|||||||
static readonly ArrayPool<Vector2> _shapePool = new ArrayPool<Vector2>(0x100, 0x10000);
|
static readonly ArrayPool<Vector2> _shapePool = new ArrayPool<Vector2>(0x100, 0x10000);
|
||||||
|
|
||||||
public PolygonSGO() {
|
public PolygonSGO() {
|
||||||
SubmitProperty("head", new PropOp.String(v => head.FrameName = v), 2);
|
SubmitProperty("head", new PropOp.String(v => head.FrameName = v));
|
||||||
SubmitProperty("body", new PropOp.String(v => body.FrameName = v), 2);
|
SubmitProperty("body", new PropOp.String(v => body.FrameName = v));
|
||||||
SubmitProperty("tail", new PropOp.String(v => tail.FrameName = v), 2);
|
SubmitProperty("tail", new PropOp.String(v => tail.FrameName = v));
|
||||||
SubmitProperty("shape", new op_set_shape(this), 2);
|
SubmitProperty("shape", new op_set_shape(this), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,12 +113,6 @@ namespace Cryville.Crtr.Components {
|
|||||||
UpdateZIndex();
|
UpdateZIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddMat(List<Material> list, string frame) {
|
|
||||||
var mat = mesh.NewMaterial;
|
|
||||||
mat.mainTexture = ChartPlayer.frames[frame].Texture;
|
|
||||||
list.Add(mat);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnDestroy() {
|
protected override void OnDestroy() {
|
||||||
base.OnDestroy();
|
base.OnDestroy();
|
||||||
Reset();
|
Reset();
|
||||||
|
@@ -60,7 +60,7 @@ namespace Cryville.Crtr.Components {
|
|||||||
|
|
||||||
public class SpritePlane : SpriteBase {
|
public class SpritePlane : SpriteBase {
|
||||||
public SpritePlane() {
|
public SpritePlane() {
|
||||||
SubmitProperty("frame", new PropOp.String(v => Frame = v), 2);
|
SubmitProperty("frame", new PropOp.String(v => Frame = v));
|
||||||
SubmitProperty("fit", new PropOp.Enum<FitMode>(v => Fit = v));
|
SubmitProperty("fit", new PropOp.Enum<FitMode>(v => Fit = v));
|
||||||
SubmitProperty("opacity", new PropOp.Float(v => Opacity = v));
|
SubmitProperty("opacity", new PropOp.Float(v => Opacity = v));
|
||||||
}
|
}
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
using Cryville.Common;
|
||||||
using Cryville.Crtr.Components;
|
using Cryville.Crtr.Components;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -36,9 +37,10 @@ namespace Cryville.Crtr.Event {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Transform gogroup;
|
public Transform gogroup;
|
||||||
|
|
||||||
public readonly Dictionary<string, Anchor> Anchors = new Dictionary<string, Anchor>();
|
public readonly Dictionary<int, Anchor> Anchors = new Dictionary<int, Anchor>();
|
||||||
public Transform a_head;
|
protected Transform a_cur;
|
||||||
public Transform a_tail;
|
protected Transform a_head;
|
||||||
|
protected Transform a_tail;
|
||||||
public Vector3 Position {
|
public Vector3 Position {
|
||||||
get;
|
get;
|
||||||
protected set;
|
protected set;
|
||||||
@@ -64,8 +66,8 @@ namespace Cryville.Crtr.Event {
|
|||||||
get { return cs.Container; }
|
get { return cs.Container; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public SkinContainer skinContainer;
|
SkinContainer skinContainer;
|
||||||
public Judge judge;
|
protected Judge judge;
|
||||||
public void AttachSystems(PdtSkin skin, Judge judge) {
|
public void AttachSystems(PdtSkin skin, Judge judge) {
|
||||||
skinContainer = new SkinContainer(skin);
|
skinContainer = new SkinContainer(skin);
|
||||||
this.judge = judge;
|
this.judge = judge;
|
||||||
@@ -75,17 +77,24 @@ 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_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_head = new GameObject("::head").transform;
|
a_cur = RegisterAnchor(_a_cur);
|
||||||
a_head.SetParent(gogroup, false);
|
a_head = RegisterAnchor(_a_head);
|
||||||
Anchors.Add("head", new Anchor() { Transform = a_head });
|
a_tail = RegisterAnchor(_a_tail);
|
||||||
a_tail = new GameObject("::tail").transform;
|
|
||||||
a_tail.SetParent(gogroup, false);
|
|
||||||
Anchors.Add("tail", new Anchor() { Transform = a_tail });
|
|
||||||
}
|
}
|
||||||
|
protected Transform RegisterAnchor(int name) {
|
||||||
|
var go = new GameObject("." + IdentifierManager.SharedInstance.Retrieve(name)).transform;
|
||||||
|
go.SetParent(gogroup, false);
|
||||||
|
Anchors.Add(name, new Anchor() { Transform = go });
|
||||||
|
return go;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called upon StartUpdate of ps 17.
|
/// Called upon StartUpdate of ps 17.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -108,10 +117,10 @@ namespace Cryville.Crtr.Event {
|
|||||||
protected virtual void PreAwake(ContainerState s) {
|
protected virtual void PreAwake(ContainerState s) {
|
||||||
if (gogroup) gogroup.gameObject.SetActive(true);
|
if (gogroup) gogroup.gameObject.SetActive(true);
|
||||||
Awoken = true; Alive = true;
|
Awoken = true; Alive = true;
|
||||||
OpenAnchor("head");
|
OpenAnchor(_a_head);
|
||||||
}
|
}
|
||||||
protected virtual void Awake(ContainerState s) {
|
protected virtual void Awake(ContainerState s) {
|
||||||
CloseAnchor("head");
|
CloseAnchor(_a_head);
|
||||||
}
|
}
|
||||||
protected virtual void GetPosition(ContainerState s) { }
|
protected virtual void GetPosition(ContainerState s) { }
|
||||||
public virtual void StartUpdate(ContainerState s) {
|
public virtual void StartUpdate(ContainerState s) {
|
||||||
@@ -138,10 +147,10 @@ namespace Cryville.Crtr.Event {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public virtual void Anchor() { }
|
public virtual void Anchor() { }
|
||||||
protected void OpenAnchor(string name) {
|
protected void OpenAnchor(int name) {
|
||||||
if (Anchors.ContainsKey(name)) Anchors[name].Open();
|
if (Anchors.ContainsKey(name)) Anchors[name].Open();
|
||||||
}
|
}
|
||||||
protected void CloseAnchor(string name) {
|
protected void CloseAnchor(int name) {
|
||||||
if (Anchors.ContainsKey(name)) Anchors[name].Close();
|
if (Anchors.ContainsKey(name)) Anchors[name].Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -11,11 +11,10 @@ namespace Cryville.Crtr {
|
|||||||
readonly GroupHandler gh;
|
readonly GroupHandler gh;
|
||||||
public readonly Chart.Note Event;
|
public readonly Chart.Note Event;
|
||||||
readonly PdtRuleset ruleset;
|
readonly PdtRuleset ruleset;
|
||||||
public NoteHandler(GroupHandler gh, Chart.Note ev, PdtRuleset rs, Judge j) : base() {
|
public NoteHandler(GroupHandler gh, Chart.Note ev, PdtRuleset rs) : base() {
|
||||||
this.gh = gh;
|
this.gh = gh;
|
||||||
Event = ev;
|
Event = ev;
|
||||||
ruleset = rs;
|
ruleset = rs;
|
||||||
judge = j;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string TypeName {
|
public override string TypeName {
|
||||||
@@ -43,8 +42,7 @@ namespace Cryville.Crtr {
|
|||||||
base.Awake(s);
|
base.Awake(s);
|
||||||
if (s.CloneType == 2) {
|
if (s.CloneType == 2) {
|
||||||
if (!gogroup) return;
|
if (!gogroup) return;
|
||||||
Chart.Note tev = Event;
|
if (Event.IsLong) {
|
||||||
if (tev.IsLong) {
|
|
||||||
foreach (var i in sgos) {
|
foreach (var i in sgos) {
|
||||||
i.Reset();
|
i.Reset();
|
||||||
i.AppendPoint(Position, Rotation);
|
i.AppendPoint(Position, Rotation);
|
||||||
@@ -54,8 +52,8 @@ namespace Cryville.Crtr {
|
|||||||
#if UNITY_5_6_OR_NEWER
|
#if UNITY_5_6_OR_NEWER
|
||||||
gogroup.SetPositionAndRotation(Position, Rotation);
|
gogroup.SetPositionAndRotation(Position, Rotation);
|
||||||
#else
|
#else
|
||||||
gogroup.position = Position;
|
gogroup.position = Position;
|
||||||
gogroup.rotation = Rotation;
|
gogroup.rotation = Rotation;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -63,13 +61,19 @@ namespace Cryville.Crtr {
|
|||||||
|
|
||||||
public override void Update(ContainerState s, StampedEvent ev) {
|
public override void Update(ContainerState s, StampedEvent ev) {
|
||||||
base.Update(s, ev);
|
base.Update(s, ev);
|
||||||
if (s.CloneType == 1) {
|
if (s.CloneType <= 2) {
|
||||||
Position = GetFramePoint(bs.Parent, bs.Track);
|
Position = GetFramePoint(s.Parent, s.Track);
|
||||||
Rotation = GetFrameRotation(bs.Parent, bs.Track);
|
Rotation = GetFrameRotation(s.Parent, s.Track);
|
||||||
|
}
|
||||||
|
if (s.CloneType == 0) {
|
||||||
|
#if UNITY_5_6_OR_NEWER
|
||||||
|
a_cur.SetPositionAndRotation(Position, Rotation);
|
||||||
|
#else
|
||||||
|
a_cur.position = Position;
|
||||||
|
a_cur.rotation = Rotation;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if (s.CloneType == 2) {
|
else if (s.CloneType == 2) {
|
||||||
Position = GetFramePoint(ts.Parent, ts.Track);
|
|
||||||
Rotation = GetFrameRotation(ts.Parent, ts.Track);
|
|
||||||
if (!gogroup) return;
|
if (!gogroup) return;
|
||||||
Chart.Note tev = Event;
|
Chart.Note tev = Event;
|
||||||
if (tev.IsLong) {
|
if (tev.IsLong) {
|
||||||
@@ -103,9 +107,9 @@ namespace Cryville.Crtr {
|
|||||||
a_tail.rotation = Quaternion.Euler(ts.Direction);
|
a_tail.rotation = Quaternion.Euler(ts.Direction);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
OpenAnchor("tail");
|
OpenAnchor(_a_tail);
|
||||||
base.EndUpdate(s);
|
base.EndUpdate(s);
|
||||||
CloseAnchor("tail");
|
CloseAnchor(_a_tail);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 GetFramePoint(ContainerState state, float track) {
|
Vector3 GetFramePoint(ContainerState state, float track) {
|
||||||
@@ -117,7 +121,7 @@ namespace Cryville.Crtr {
|
|||||||
return Quaternion.LookRotation(r, state.Normal);
|
return Quaternion.LookRotation(r, state.Normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Vector3> ctrl = new List<Vector3>(2);
|
readonly List<Vector3> ctrl = new List<Vector3>(2);
|
||||||
Vector3 GetFrame(ContainerState state, float track, Func<ContainerState, Vector3> func) {
|
Vector3 GetFrame(ContainerState state, float track, Func<ContainerState, Vector3> func) {
|
||||||
// TODO
|
// TODO
|
||||||
int id = Mathf.FloorToInt(track);
|
int id = Mathf.FloorToInt(track);
|
||||||
|
@@ -28,7 +28,7 @@ namespace Cryville.Crtr {
|
|||||||
GetChar();
|
GetChar();
|
||||||
if (cc == '.') {
|
if (cc == '.') {
|
||||||
GetChar();
|
GetChar();
|
||||||
s.Add(new SkinSelector.State(GetIdentifier()));
|
s.Add(new SkinSelector.AtAnchor(GetIdentifier()));
|
||||||
key = null;
|
key = null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
using Cryville.Common;
|
||||||
using Cryville.Common.Pdt;
|
using Cryville.Common.Pdt;
|
||||||
using Cryville.Crtr.Components;
|
using Cryville.Crtr.Components;
|
||||||
using Cryville.Crtr.Event;
|
using Cryville.Crtr.Event;
|
||||||
@@ -88,9 +89,9 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class Anchor : SkinSelector {
|
public class Anchor : SkinSelector {
|
||||||
public string Name { get; private set; }
|
public int Name { get; private set; }
|
||||||
public Anchor(string name) {
|
public Anchor(string name) {
|
||||||
Name = name;
|
Name = IdentifierManager.SharedInstance.Request(name);
|
||||||
}
|
}
|
||||||
public override bool IsStatic {
|
public override bool IsStatic {
|
||||||
get { return true; }
|
get { return true; }
|
||||||
@@ -103,6 +104,23 @@ namespace Cryville.Crtr {
|
|||||||
return h.Handler.Anchors[Name].Opened;
|
return h.Handler.Anchors[Name].Opened;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public class AtAnchor : SkinSelector {
|
||||||
|
public int Name { get; private set; }
|
||||||
|
public AtAnchor(string name) {
|
||||||
|
Name = IdentifierManager.SharedInstance.Request(name);
|
||||||
|
}
|
||||||
|
public override bool IsStatic {
|
||||||
|
get { return false; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Transform Match(ContainerState h, Transform a, bool dyn = false) {
|
||||||
|
if (!dyn) throw new SelectorNotStaticException();
|
||||||
|
return IsUpdatable(h) ? a : null;
|
||||||
|
}
|
||||||
|
public override bool IsUpdatable(ContainerState h) {
|
||||||
|
return h.Handler.Anchors[Name].Opened;
|
||||||
|
}
|
||||||
|
}
|
||||||
public class Property : SkinSelector {
|
public class Property : SkinSelector {
|
||||||
readonly PdtExpression _exp;
|
readonly PdtExpression _exp;
|
||||||
readonly PdtOperator _op;
|
readonly PdtOperator _op;
|
||||||
@@ -137,7 +155,8 @@ namespace Cryville.Crtr {
|
|||||||
get { return false; }
|
get { return false; }
|
||||||
}
|
}
|
||||||
public override Transform Match(ContainerState h, Transform a, bool dyn = false) {
|
public override Transform Match(ContainerState h, Transform a, bool dyn = false) {
|
||||||
return null; // TODO
|
if (!dyn) throw new SelectorNotStaticException();
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class ElementType : SkinSelector {
|
public class ElementType : SkinSelector {
|
||||||
|
@@ -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);
|
||||||
}
|
}
|
||||||
@@ -62,7 +61,18 @@ namespace Cryville.Crtr {
|
|||||||
|
|
||||||
public override void Update(ContainerState s, StampedEvent ev) {
|
public override void Update(ContainerState s, StampedEvent ev) {
|
||||||
base.Update(s, ev);
|
base.Update(s, ev);
|
||||||
if (s.CloneType == 2 || s.CloneType == 3) {
|
if (s.CloneType == 0) {
|
||||||
|
pwp = Vector3.zero;
|
||||||
|
cpt = s.ScreenPoint;
|
||||||
|
spos = Vector3.zero;
|
||||||
|
#if UNITY_5_6_OR_NEWER
|
||||||
|
a_cur.SetPositionAndRotation(s.ScreenPoint, Quaternion.Euler(s.Direction));
|
||||||
|
#else
|
||||||
|
a_cur.position = s.ScreenPoint;
|
||||||
|
a_cur.rotation = Quaternion.Euler(s.Direction);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else if (s.CloneType == 2 || s.CloneType == 3) {
|
||||||
var tpt = s.ScreenPoint;
|
var tpt = s.ScreenPoint;
|
||||||
var tsv = s.ScrollVelocity;
|
var tsv = s.ScrollVelocity;
|
||||||
|
|
||||||
@@ -107,9 +117,9 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void EndUpdate(ContainerState s) {
|
public override void EndUpdate(ContainerState s) {
|
||||||
OpenAnchor("tail");
|
OpenAnchor(_a_tail);
|
||||||
base.EndUpdate(s);
|
base.EndUpdate(s);
|
||||||
CloseAnchor("tail");
|
CloseAnchor(_a_tail);
|
||||||
if (s.CloneType == 0 || s.CloneType == 2) {
|
if (s.CloneType == 0 || s.CloneType == 2) {
|
||||||
EndUpdatePosition(ts);
|
EndUpdatePosition(ts);
|
||||||
var p = GetCurrentWorldPoint();
|
var p = GetCurrentWorldPoint();
|
||||||
|
Reference in New Issue
Block a user