コード例 #1
0
        public static IEnumerator List(UnityAction <List <Package> > callback)
        {
            PackageSubsets packageSubsets = null;
            {
                var request = UnityWebRequest.Get(RegistryHome);
                yield return(request.SendWebRequest());

                if (request.isHttpError)
                {
                    Debug.LogError(request.error);
                    yield break;
                }
                var text = request.downloadHandler.text;
                var data = JsonMapper.ToObject(text);
                packageSubsets = PackageSubsets.FromDict(data);
            }

            var sequence = new CoroutineSequence();

            var packages = new List <Package>();

            foreach (var package in packageSubsets.packages)
            {
                sequence.Insert(0f, GetPackageInformation(package, packages));
            }

            new CoroutineSequence()
            .Append(sequence)
            .OnCompleted(() =>
            {
                packages.Sort((package1, package2) => string.CompareOrdinal(package1.name, package2.name));
                callback.Invoke(packages);
            })
            .Play();
        }
コード例 #2
0
 /// <summary>
 /// CoroutineSequenceをAppendする
 /// </summary>
 public CoroutineSequence Append(CoroutineSequence sequence)
 {
     _appendedEnumerators.Add(sequence.GetEnumerator());
     _sequences.Add(sequence);
     return(this);
 }
コード例 #3
0
 /// <summary>
 /// CoroutineSequenceをatPositionにInsertする
 /// </summary>
 public CoroutineSequence Insert(float atPosition, CoroutineSequence sequence)
 {
     _insertedEnumerators.Add(new InsertedEnumerator(atPosition, sequence.GetEnumerator()));
     _sequences.Add(sequence);
     return(this);
 }