Newer
Older
using UnityEngine;
John Schihada
committed
public string preferredStartScrollName;
static public List<REST_JSON_API.Scroll> AllowedScrolls;
while (GlobalBehaviour.InitiateScrolls.MoveNext()) ; // active wait for server, should be rare
AllowedScrolls = StageStatic.stage?.AllowedScrolls == null
? GlobalBehaviour.AvailableScrolls
: GlobalBehaviour.AvailableScrolls
.Where(s => StageStatic.stage.AllowedScrolls.Contains(s.ScrollReference))
.ToList();
for (int i = 0; i < AllowedScrolls.Count; i++)
{
var obj = Instantiate(ScrollPrefab, scrollscreenContent);
obj.GetComponent<ScrollClickedScript>().scroll = AllowedScrolls[i];
obj.GetComponent<ScrollClickedScript>().DetailScreen = this.DetailScreen;
obj.transform.GetChild(0).gameObject.GetComponent<TextMeshProUGUI>().text = AllowedScrolls[i].label;
REST_JSON_API.Scroll preferredStartScroll = AllowedScrolls.Find(x => x.label.Equals(preferredStartScrollName));
if (preferredStartScroll != null)
ScrollDetails.Instance?.SetScroll(preferredStartScroll);