using System; using SUISSEngine; using UnityEngine; using UnityEngine.UI; namespace SUISS.Promo { public class LoadingScreenController : MonoBehaviour { protected void Start() { this.Hide(); } public void Initialise(string sparksocGameId) { this.moreGames.GetMoreGamesList(true, delegate(SparkSocGame[] items) { this.Show(items); }, true); } protected virtual void Show(SparkSocGame[] items) { if (items.Length > 0) { this.root.SetActive(true); foreach (SparkSocGame item in items) { this.CreateMoreGameItem(item); } this.scrollView.verticalNormalizedPosition = 1f; } else { this.Hide(); } } protected void Hide() { this.root.SetActive(false); } protected virtual void CreateMoreGameItem(SparkSocGame item) { GameObject gameObject = UnityEngine.Object.Instantiate(this.otherGamePrefab); gameObject.transform.SetParent(this.grid.transform); gameObject.transform.localScale = Vector3.one; gameObject.name = item.DisplayName; gameObject.GetComponent().Init(item); } [SerializeField] protected GameObject root; [SerializeField] private GridLayoutGroup grid; [SerializeField] private ScrollRect scrollView; [SerializeField] protected GameObject otherGamePrefab; [SerializeField] protected SparkSocGames moreGames; } }