Exemplo n.º 1
0
    private IEnumerator GenerateSkinsToShow()
    {
        var AllSkinsIntList = new List <int>();

        if (!_ownsNothing)
        {
            var OwnedSkinsIntList = PlayerVariables.OwnedSkinsJson.Select(t => int.Parse(t.ToString())).ToList();

            AllSkinsIntList.AddRange(PlayerVariables.AllSkinsJson.Select(t => int.Parse(t.ToString())));
            var SkinsToGetInfo = AllSkinsIntList.Except(OwnedSkinsIntList).ToList();
            foreach (var t in SkinsToGetInfo)
            {
                _isDone = false;
                StartCoroutine(PopulateSkins(t.ToString()));
                StartCoroutine(CreateSprites(t.ToString()));
                yield return(new WaitUntil(() => _isDone = true));

                yield return(new WaitUntil(() => _imageRetrieved = true));

                Skins.PopulateSkinScroller(_name, _price);
            }
        }
        else
        {
            AllSkinsIntList.AddRange(PlayerVariables.AllSkinsJson.Select(t => int.Parse(t.ToString())));
            var SkinsToGetInfo = AllSkinsIntList;
            foreach (var t in SkinsToGetInfo)
            {
                _isDone         = false;
                _imageRetrieved = false;
                StartCoroutine(PopulateSkins(t.ToString()));
                StartCoroutine(CreateSprites(t.ToString()));
                yield return(new WaitUntil(() => _isDone = true));

                yield return(new WaitUntil(() => _imageRetrieved = true));

                Skins.PopulateSkinScroller(_name, _price);
            }
        }

        yield return(null);
    }