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) {
|
||||
ContainerHandler th;
|
||||
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 {
|
||||
th = new TrackHandler(gh, (Chart.Track)ts.Key);
|
||||
|
@@ -9,6 +9,11 @@ namespace Cryville.Crtr.Components {
|
||||
protected Vector3? prevpt;
|
||||
protected Quaternion? prevrot;
|
||||
protected int vertCount = 0;
|
||||
bool suppressed;
|
||||
|
||||
public SectionalGameObject() {
|
||||
SubmitProperty("suppressed", new PropOp.Boolean(v => suppressed = v), 2);
|
||||
}
|
||||
|
||||
protected override void OnDestroy() {
|
||||
mesh.Destroy();
|
||||
@@ -23,7 +28,7 @@ namespace Cryville.Crtr.Components {
|
||||
}
|
||||
|
||||
public void AppendPoint(Vector3 p, Quaternion r) {
|
||||
if (prevpt == p && prevrot == r) return;
|
||||
if (prevpt == p && prevrot == r || suppressed) return;
|
||||
AppendPointInternal(p, r);
|
||||
// if (!headGenerated) Logger.Log("main", 0, "Skin/Polysec", "{0}", r);
|
||||
prevpt = p;
|
||||
@@ -52,9 +57,9 @@ namespace Cryville.Crtr.Components {
|
||||
static readonly ArrayPool<Vector2> _shapePool = new ArrayPool<Vector2>(0x100, 0x10000);
|
||||
|
||||
public PolygonSGO() {
|
||||
SubmitProperty("head", new PropOp.String(v => head.FrameName = v), 2);
|
||||
SubmitProperty("body", new PropOp.String(v => body.FrameName = v), 2);
|
||||
SubmitProperty("tail", new PropOp.String(v => tail.FrameName = v), 2);
|
||||
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));
|
||||
SubmitProperty("shape", new op_set_shape(this), 2);
|
||||
}
|
||||
|
||||
@@ -108,12 +113,6 @@ namespace Cryville.Crtr.Components {
|
||||
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() {
|
||||
base.OnDestroy();
|
||||
Reset();
|
||||
|
@@ -60,7 +60,7 @@ namespace Cryville.Crtr.Components {
|
||||
|
||||
public class SpritePlane : SpriteBase {
|
||||
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("opacity", new PropOp.Float(v => Opacity = v));
|
||||
}
|
||||
|
@@ -1,3 +1,4 @@
|
||||
using Cryville.Common;
|
||||
using Cryville.Crtr.Components;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -36,9 +37,10 @@ namespace Cryville.Crtr.Event {
|
||||
/// </summary>
|
||||
public Transform gogroup;
|
||||
|
||||
public readonly Dictionary<string, Anchor> Anchors = new Dictionary<string, Anchor>();
|
||||
public Transform a_head;
|
||||
public Transform a_tail;
|
||||
public readonly Dictionary<int, Anchor> Anchors = new Dictionary<int, Anchor>();
|
||||
protected Transform a_cur;
|
||||
protected Transform a_head;
|
||||
protected Transform a_tail;
|
||||
public Vector3 Position {
|
||||
get;
|
||||
protected set;
|
||||
@@ -64,8 +66,8 @@ namespace Cryville.Crtr.Event {
|
||||
get { return cs.Container; }
|
||||
}
|
||||
|
||||
public SkinContainer skinContainer;
|
||||
public Judge judge;
|
||||
SkinContainer skinContainer;
|
||||
protected Judge judge;
|
||||
public void AttachSystems(PdtSkin skin, Judge judge) {
|
||||
skinContainer = new SkinContainer(skin);
|
||||
this.judge = judge;
|
||||
@@ -75,17 +77,24 @@ namespace Cryville.Crtr.Event {
|
||||
public abstract string TypeName {
|
||||
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() {
|
||||
gogroup = new GameObject(TypeName + ":" + Container.GetHashCode().ToString(CultureInfo.InvariantCulture)).transform;
|
||||
if (cs.Parent != null)
|
||||
gogroup.SetParent(cs.Parent.Handler.gogroup, false);
|
||||
a_head = new GameObject("::head").transform;
|
||||
a_head.SetParent(gogroup, false);
|
||||
Anchors.Add("head", new Anchor() { Transform = a_head });
|
||||
a_tail = new GameObject("::tail").transform;
|
||||
a_tail.SetParent(gogroup, false);
|
||||
Anchors.Add("tail", new Anchor() { Transform = a_tail });
|
||||
a_cur = RegisterAnchor(_a_cur);
|
||||
a_head = RegisterAnchor(_a_head);
|
||||
a_tail = RegisterAnchor(_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>
|
||||
/// Called upon StartUpdate of ps 17.
|
||||
/// </summary>
|
||||
@@ -108,10 +117,10 @@ namespace Cryville.Crtr.Event {
|
||||
protected virtual void PreAwake(ContainerState s) {
|
||||
if (gogroup) gogroup.gameObject.SetActive(true);
|
||||
Awoken = true; Alive = true;
|
||||
OpenAnchor("head");
|
||||
OpenAnchor(_a_head);
|
||||
}
|
||||
protected virtual void Awake(ContainerState s) {
|
||||
CloseAnchor("head");
|
||||
CloseAnchor(_a_head);
|
||||
}
|
||||
protected virtual void GetPosition(ContainerState s) { }
|
||||
public virtual void StartUpdate(ContainerState s) {
|
||||
@@ -138,10 +147,10 @@ namespace Cryville.Crtr.Event {
|
||||
}
|
||||
}
|
||||
public virtual void Anchor() { }
|
||||
protected void OpenAnchor(string name) {
|
||||
protected void OpenAnchor(int name) {
|
||||
if (Anchors.ContainsKey(name)) Anchors[name].Open();
|
||||
}
|
||||
protected void CloseAnchor(string name) {
|
||||
protected void CloseAnchor(int name) {
|
||||
if (Anchors.ContainsKey(name)) Anchors[name].Close();
|
||||
}
|
||||
}
|
||||
|
@@ -11,11 +11,10 @@ namespace Cryville.Crtr {
|
||||
readonly GroupHandler gh;
|
||||
public readonly Chart.Note Event;
|
||||
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;
|
||||
Event = ev;
|
||||
ruleset = rs;
|
||||
judge = j;
|
||||
}
|
||||
|
||||
public override string TypeName {
|
||||
@@ -43,8 +42,7 @@ namespace Cryville.Crtr {
|
||||
base.Awake(s);
|
||||
if (s.CloneType == 2) {
|
||||
if (!gogroup) return;
|
||||
Chart.Note tev = Event;
|
||||
if (tev.IsLong) {
|
||||
if (Event.IsLong) {
|
||||
foreach (var i in sgos) {
|
||||
i.Reset();
|
||||
i.AppendPoint(Position, Rotation);
|
||||
@@ -54,8 +52,8 @@ namespace Cryville.Crtr {
|
||||
#if UNITY_5_6_OR_NEWER
|
||||
gogroup.SetPositionAndRotation(Position, Rotation);
|
||||
#else
|
||||
gogroup.position = Position;
|
||||
gogroup.rotation = Rotation;
|
||||
gogroup.position = Position;
|
||||
gogroup.rotation = Rotation;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -63,13 +61,19 @@ namespace Cryville.Crtr {
|
||||
|
||||
public override void Update(ContainerState s, StampedEvent ev) {
|
||||
base.Update(s, ev);
|
||||
if (s.CloneType == 1) {
|
||||
Position = GetFramePoint(bs.Parent, bs.Track);
|
||||
Rotation = GetFrameRotation(bs.Parent, bs.Track);
|
||||
if (s.CloneType <= 2) {
|
||||
Position = GetFramePoint(s.Parent, s.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) {
|
||||
Position = GetFramePoint(ts.Parent, ts.Track);
|
||||
Rotation = GetFrameRotation(ts.Parent, ts.Track);
|
||||
if (!gogroup) return;
|
||||
Chart.Note tev = Event;
|
||||
if (tev.IsLong) {
|
||||
@@ -103,9 +107,9 @@ namespace Cryville.Crtr {
|
||||
a_tail.rotation = Quaternion.Euler(ts.Direction);
|
||||
#endif
|
||||
}
|
||||
OpenAnchor("tail");
|
||||
OpenAnchor(_a_tail);
|
||||
base.EndUpdate(s);
|
||||
CloseAnchor("tail");
|
||||
CloseAnchor(_a_tail);
|
||||
}
|
||||
|
||||
Vector3 GetFramePoint(ContainerState state, float track) {
|
||||
@@ -117,7 +121,7 @@ namespace Cryville.Crtr {
|
||||
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) {
|
||||
// TODO
|
||||
int id = Mathf.FloorToInt(track);
|
||||
|
@@ -28,7 +28,7 @@ namespace Cryville.Crtr {
|
||||
GetChar();
|
||||
if (cc == '.') {
|
||||
GetChar();
|
||||
s.Add(new SkinSelector.State(GetIdentifier()));
|
||||
s.Add(new SkinSelector.AtAnchor(GetIdentifier()));
|
||||
key = null;
|
||||
}
|
||||
else {
|
||||
|
@@ -1,3 +1,4 @@
|
||||
using Cryville.Common;
|
||||
using Cryville.Common.Pdt;
|
||||
using Cryville.Crtr.Components;
|
||||
using Cryville.Crtr.Event;
|
||||
@@ -88,9 +89,9 @@ namespace Cryville.Crtr {
|
||||
}
|
||||
}
|
||||
public class Anchor : SkinSelector {
|
||||
public string Name { get; private set; }
|
||||
public int Name { get; private set; }
|
||||
public Anchor(string name) {
|
||||
Name = name;
|
||||
Name = IdentifierManager.SharedInstance.Request(name);
|
||||
}
|
||||
public override bool IsStatic {
|
||||
get { return true; }
|
||||
@@ -103,6 +104,23 @@ namespace Cryville.Crtr {
|
||||
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 {
|
||||
readonly PdtExpression _exp;
|
||||
readonly PdtOperator _op;
|
||||
@@ -137,7 +155,8 @@ namespace Cryville.Crtr {
|
||||
get { return 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 {
|
||||
|
@@ -39,7 +39,6 @@ namespace Cryville.Crtr {
|
||||
#endif
|
||||
}
|
||||
else if (s.CloneType == 3) {
|
||||
spos = Vector3.zero;
|
||||
bpos = cpt;
|
||||
brot = Quaternion.Euler(s.Direction);
|
||||
}
|
||||
@@ -62,7 +61,18 @@ namespace Cryville.Crtr {
|
||||
|
||||
public override void Update(ContainerState s, StampedEvent 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 tsv = s.ScrollVelocity;
|
||||
|
||||
@@ -107,9 +117,9 @@ namespace Cryville.Crtr {
|
||||
}
|
||||
|
||||
public override void EndUpdate(ContainerState s) {
|
||||
OpenAnchor("tail");
|
||||
OpenAnchor(_a_tail);
|
||||
base.EndUpdate(s);
|
||||
CloseAnchor("tail");
|
||||
CloseAnchor(_a_tail);
|
||||
if (s.CloneType == 0 || s.CloneType == 2) {
|
||||
EndUpdatePosition(ts);
|
||||
var p = GetCurrentWorldPoint();
|
||||
|
Reference in New Issue
Block a user