|
- using System;
- using System.Collections;
- using SUISSEngine;
- using UnityEngine;
- using UnityEngine.UI;
-
- namespace SUISS.Promo
- {
- public class SingleItemLoadingScreenController : MonoBehaviour
- {
- protected void Start()
- {
- this.Hide();
- }
-
- public void Initialise(string sparksocGameId, string localizedMoreGamesText)
- {
- this.moreGames.GetMoreGamesList(true, delegate(SparkSocGame[] items)
- {
- this.LoadedGames(items);
- }, false);
- this.MoreGamesText.text = localizedMoreGamesText;
- }
-
- public void Show(TextAnchor? preferredAnchor = null)
- {
- if (this._item != null && this._item.AppIcon != null)
- {
- this.root.SetActive(true);
- this.InitAnotherGameIcon(this._item);
- if (preferredAnchor != null)
- {
- this.thisGroup.childAlignment = preferredAnchor.Value;
- }
- else
- {
- int num = UnityEngine.Random.Range(0, 3);
- if (num != 0)
- {
- if (num != 1)
- {
- if (num == 2)
- {
- this.thisGroup.childAlignment = TextAnchor.LowerLeft;
- }
- }
- else
- {
- this.thisGroup.childAlignment = TextAnchor.MiddleLeft;
- }
- }
- else
- {
- this.thisGroup.childAlignment = TextAnchor.UpperLeft;
- }
- }
- }
- else
- {
- base.StartCoroutine(this.WaitForIconDownload(preferredAnchor));
- }
- }
-
- private void LoadedGames(SparkSocGame[] items)
- {
- foreach (SparkSocGame sparkSocGame in items)
- {
- if (!sparkSocGame.IsInstalled)
- {
- this.moreGames.DownloadGameIcon(sparkSocGame, delegate(SparkSocGame i)
- {
- this._item = i;
- });
- return;
- }
- }
- if (items.Length > 0)
- {
- this.moreGames.DownloadGameIcon(items[0], delegate(SparkSocGame i)
- {
- this._item = i;
- });
- }
- }
-
- private IEnumerator WaitForIconDownload(TextAnchor? preferredAnchor)
- {
- yield return this._item != null && this._item.AppIcon != null;
- this.Show(preferredAnchor);
- yield break;
- }
-
- private void Hide()
- {
- this.root.SetActive(false);
- }
-
- private void InitAnotherGameIcon(SparkSocGame item)
- {
- this.anotherGame.Init(item);
- }
-
- [SerializeField]
- protected GameObject root;
-
- [SerializeField]
- private RectTransform rootTransform;
-
- [SerializeField]
- private Text MoreGamesText;
-
- [SerializeField]
- private MoreGamesIcon anotherGame;
-
- [SerializeField]
- private VerticalLayoutGroup thisGroup;
-
- [SerializeField]
- protected SparkSocGames moreGames;
-
- private SparkSocGame _item;
- }
- }
|