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

View File

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

View File

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