54 lines
1.5 KiB
C#
54 lines
1.5 KiB
C#
using System.Collections.Generic;
|
|
using BitStrap;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class CreditsList : MonoBehaviour
|
|
{
|
|
[HideInInspector]
|
|
public CreditsManager creditsManager;
|
|
|
|
public Transform listParent;
|
|
|
|
public List<CreditsManager.JobGroup> jobGroups = new List<CreditsManager.JobGroup>();
|
|
|
|
[Button]
|
|
public void Refresh()
|
|
{
|
|
Text[] componentsInChildren = GetComponentsInChildren<Text>();
|
|
Text[] array = componentsInChildren;
|
|
foreach (Text text in array)
|
|
{
|
|
Object.Destroy(text.gameObject);
|
|
}
|
|
Vector3 zero = Vector3.zero;
|
|
for (int j = 0; j < jobGroups.Count; j++)
|
|
{
|
|
CreditsManager.JobGroup jobGroup = jobGroups[j];
|
|
Text text2 = Object.Instantiate(creditsManager.jobTextPrefab);
|
|
text2.transform.parent = listParent;
|
|
text2.transform.localScale = Vector3.one;
|
|
text2.transform.localPosition = zero;
|
|
for (int k = 0; k < jobGroup.jobNames.Count; k++)
|
|
{
|
|
text2.text += Utilities.GetTranslation(jobGroup.jobNames[k]);
|
|
if (k < jobGroup.jobNames.Count - 1)
|
|
{
|
|
text2.text += ", ";
|
|
}
|
|
}
|
|
zero.y -= creditsManager.jobNameDistance;
|
|
for (int l = 0; l < jobGroup.jobPeople.Count; l++)
|
|
{
|
|
Text text3 = Object.Instantiate(creditsManager.nameTextPrefab);
|
|
text3.transform.parent = listParent;
|
|
text3.transform.localScale = Vector3.one;
|
|
text3.transform.localPosition = zero;
|
|
text3.text = Utilities.GetTranslation(jobGroup.jobPeople[l]);
|
|
zero.y -= creditsManager.namesDistance;
|
|
}
|
|
zero.y -= creditsManager.jobsDistance;
|
|
}
|
|
}
|
|
}
|