Cleanup variable name.

This commit is contained in:
2023-03-09 11:41:25 +08:00
parent 76df4929a7
commit a11ccbd39c
3 changed files with 22 additions and 25 deletions

View File

@@ -37,10 +37,7 @@ namespace Cryville.Crtr.Event {
/// </summary>
public ContainerState ts;
/// <summary>
/// <see cref="GameObject"/> group, the <see cref="Transform"/> containing all the generated elements in the <see cref="ContainerHandler"/>.
/// </summary>
protected Transform gogroup;
protected Transform RootTransform;
SkinComponent[] _comps;
@@ -90,7 +87,7 @@ namespace Cryville.Crtr.Event {
public Anchor RegisterAnchor(int name, bool dyn = false, int propSrcCount = 0) {
var strname = IdentifierManager.SharedInstance.Retrieve(name);
var go = new GameObject("." + strname).transform;
go.SetParent(gogroup, false);
go.SetParent(RootTransform, false);
var result = new Anchor(name, go, propSrcCount);
if (dyn) {
if (DynamicAnchors.ContainsKey(name))
@@ -117,10 +114,10 @@ namespace Cryville.Crtr.Event {
#region Logic
#region Init methods: Called on prehandle
public virtual void PreInit() {
gogroup = new GameObject(TypeName + ":" + Container.GetHashCode().ToString(CultureInfo.InvariantCulture)).transform;
SkinContext = new SkinContext(gogroup);
RootTransform = new GameObject(TypeName + ":" + Container.GetHashCode().ToString(CultureInfo.InvariantCulture)).transform;
SkinContext = new SkinContext(RootTransform);
if (cs.Parent != null)
gogroup.SetParent(cs.Parent.Handler.gogroup, false);
RootTransform.SetParent(cs.Parent.Handler.RootTransform, false);
a_cur = RegisterAnchor(_a_cur);
a_head = RegisterAnchor(_a_head, true);
a_tail = RegisterAnchor(_a_tail, true);
@@ -131,13 +128,13 @@ namespace Cryville.Crtr.Event {
skinContainer.MatchStatic();
ChartPlayer.etor.ContextEvent = null;
ChartPlayer.etor.ContextState = null;
_comps = gogroup.GetComponentsInChildren<SkinComponent>();
_comps = RootTransform.GetComponentsInChildren<SkinComponent>();
foreach (var i in _comps) i.Init();
}
public virtual void PostInit() {
PropSrcs.Add(_var_current_time, new PropSrc.Float(() => (float)cs.rootPrototype.Time));
PropSrcs.Add(_var_invisible_bounds, new PropSrc.Boolean(() => atime_head > atime_tail));
gogroup.gameObject.SetActive(false);
RootTransform.gameObject.SetActive(false);
}
#endregion
#region Start methods
@@ -148,14 +145,14 @@ namespace Cryville.Crtr.Event {
public virtual void StartLogicalUpdate(ContainerState s) { }
protected virtual void StartPreGraphicalUpdate(ContainerState s) { }
protected virtual void StartGraphicalUpdate(ContainerState s) {
if (gogroup) gogroup.gameObject.SetActive(true);
if (RootTransform) RootTransform.gameObject.SetActive(true);
}
#endregion
public virtual void Update(ContainerState s, StampedEvent ev) {
if (s.CloneType == 3) SetPreGraphicalActive(true, s);
else if (ev is StampedEvent.Anchor) {
var tev = (StampedEvent.Anchor)ev;
if (gogroup) {
if (RootTransform) {
OpenAnchor(tev.Target);
#if UNITY_5_6_OR_NEWER
tev.Target.Transform.SetPositionAndRotation(Position, Rotation);
@@ -174,7 +171,7 @@ namespace Cryville.Crtr.Event {
}
anchorEvPool.Return(tev);
}
else if (gogroup && s.CloneType == 2) MatchDynamic(s, 1);
else if (RootTransform && s.CloneType == 2) MatchDynamic(s, 1);
}
#region End methods
protected virtual void EndGraphicalUpdate(ContainerState s) { }
@@ -182,8 +179,8 @@ namespace Cryville.Crtr.Event {
public virtual void EndLogicalUpdate(ContainerState s) { }
public virtual void EndPhysicalUpdate(ContainerState s) { }
public virtual void Dispose() {
if (gogroup)
GameObject.Destroy(gogroup.gameObject);
if (RootTransform)
GameObject.Destroy(RootTransform.gameObject);
Alive = false;
}
public virtual void DisposeAll() { }

View File

@@ -57,7 +57,7 @@ namespace Cryville.Crtr {
}
public override void Init() {
base.Init();
sgos = gogroup.GetComponentsInChildren<SectionalGameObject>();
sgos = RootTransform.GetComponentsInChildren<SectionalGameObject>();
foreach (var judge in judges) judge.Value.InitPropSrcs();
}
@@ -70,7 +70,7 @@ namespace Cryville.Crtr {
protected override void StartGraphicalUpdate(ContainerState s) {
base.StartGraphicalUpdate(s);
TransformAwake(s);
if (gogroup) {
if (RootTransform) {
if (Event.IsLong) {
foreach (var i in sgos) {
i.Reset();
@@ -79,10 +79,10 @@ namespace Cryville.Crtr {
}
else {
#if UNITY_5_6_OR_NEWER
gogroup.SetPositionAndRotation(Position, Rotation);
RootTransform.SetPositionAndRotation(Position, Rotation);
#else
gogroup.position = Position;
gogroup.rotation = Rotation;
RootTransform.position = Position;
RootTransform.rotation = Rotation;
#endif
}
}
@@ -96,7 +96,7 @@ namespace Cryville.Crtr {
if (s.CloneType <= 2) {
Position = GetFramePoint(s.Parent, s.Track);
Rotation = GetFrameRotation(s.Parent, s.Track);
if (s.CloneType == 2 && gogroup && Event.IsLong) {
if (s.CloneType == 2 && RootTransform && Event.IsLong) {
foreach (var i in sgos)
i.AppendPoint(Position, Rotation);
}
@@ -128,7 +128,7 @@ namespace Cryville.Crtr {
}
protected override void EndGraphicalUpdate(ContainerState s) {
if (gogroup) {
if (RootTransform) {
foreach (var i in sgos) i.Seal();
}
base.EndGraphicalUpdate(s);

View File

@@ -16,7 +16,7 @@ namespace Cryville.Crtr {
public override void Init() {
base.Init();
sgos = gogroup.GetComponentsInChildren<SectionalGameObject>();
sgos = RootTransform.GetComponentsInChildren<SectionalGameObject>();
}
SectionalGameObject[] sgos;
Vector3 bpos; Quaternion brot;
@@ -33,7 +33,7 @@ namespace Cryville.Crtr {
}
protected override void StartGraphicalUpdate(ContainerState s) {
base.StartGraphicalUpdate(s);
if (gogroup) {
if (RootTransform) {
TransformAwake(s);
var p = GetCurrentWorldPoint();
foreach (var i in sgos) {
@@ -82,7 +82,7 @@ namespace Cryville.Crtr {
ptime = s.Time;
if (!gogroup || s.CloneType == 3) return;
if (!RootTransform || s.CloneType == 3) return;
var p = GetCurrentWorldPoint();
foreach (var i in sgos)
i.AppendPoint(p, s.QuatDir);