Code cleanup.
This commit is contained in:
@@ -134,9 +134,13 @@ namespace Cryville.Common.Unity.UI {
|
|||||||
|
|
||||||
private void OnFrameUpdate() {
|
private void OnFrameUpdate() {
|
||||||
if (!initialized) return;
|
if (!initialized) return;
|
||||||
if (lines != null) for (int i = 0; i < lines.Length; i++)
|
if (lines != null) {
|
||||||
if (lines[i] != null) foreach (GameObject c in lines[i])
|
for (int i = 0; i < lines.Length; i++) {
|
||||||
GameObject.Destroy(c);
|
if (lines[i] != null) {
|
||||||
|
foreach (GameObject c in lines[i]) Destroy(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
lines = new GameObject[VisibleLines][];
|
lines = new GameObject[VisibleLines][];
|
||||||
refl = new int[VisibleLines];
|
refl = new int[VisibleLines];
|
||||||
for (int i = 0; i < refl.Length; i++) refl[i] = i;
|
for (int i = 0; i < refl.Length; i++) refl[i] = i;
|
||||||
@@ -153,8 +157,9 @@ namespace Cryville.Common.Unity.UI {
|
|||||||
|
|
||||||
private void ResetLines() {
|
private void ResetLines() {
|
||||||
for (int i = 0; i < lines.Length; i++) {
|
for (int i = 0; i < lines.Length; i++) {
|
||||||
if (lines[i] != null) foreach (GameObject c in lines[i])
|
if (lines[i] != null) {
|
||||||
GameObject.Destroy(c);
|
foreach (GameObject c in lines[i]) Destroy(c);
|
||||||
|
}
|
||||||
lines[i] = new GameObject[LineItemCount];
|
lines[i] = new GameObject[LineItemCount];
|
||||||
GenerateLine(i, refl[i]);
|
GenerateLine(i, refl[i]);
|
||||||
}
|
}
|
||||||
@@ -200,7 +205,7 @@ namespace Cryville.Common.Unity.UI {
|
|||||||
|
|
||||||
void GenerateLine(int index, int line) {
|
void GenerateLine(int index, int line) {
|
||||||
for (int j = 0; j < LineItemCount; j++) {
|
for (int j = 0; j < LineItemCount; j++) {
|
||||||
var child = GameObject.Instantiate(m_itemTemplate, transform, false);
|
var child = Instantiate(m_itemTemplate, transform, false);
|
||||||
lines[index][j] = child;
|
lines[index][j] = child;
|
||||||
}
|
}
|
||||||
LoadLine(index, line);
|
LoadLine(index, line);
|
||||||
|
|||||||
Reference in New Issue
Block a user