예제 #1
0
        public static IEnumerator ListForms(
            Client client,
            GameSession session,
            string formationNamespaceName,
            EzMoldModel moldModel,
            GetFormEvent onGetForm,
            ErrorEvent onError
            )
        {
            var    forms     = new List <EzForm>();
            string pageToken = null;

            while (true)
            {
                AsyncResult <EzListFormsResult> result = null;
                yield return(client.Formation.ListForms(
                                 r =>
                {
                    result = r;
                },
                                 session,
                                 formationNamespaceName,
                                 moldModel.Name,
                                 pageToken
                                 ));

                if (result.Error != null)
                {
                    onError.Invoke(
                        result.Error
                        );
                    yield break;
                }

                forms.AddRange(result.Result.Items);
                pageToken = result.Result.NextPageToken;

                if (pageToken == null)
                {
                    break;
                }
            }

            for (var i = 0; i < forms.Count; i++)
            {
                onGetForm.Invoke(moldModel, i, forms[i]);
            }
        }
예제 #2
0
        public static IEnumerator SetForm(
            Client client,
            GameSession session,
            string formationNamespaceName,
            EzMoldModel moldModel,
            int index,
            List <EzSlotWithSignature> slots,
            string signatureKeyId,
            GetFormEvent onGetForm,
            UpdateFormEvent onUpdateForm,
            ErrorEvent onError
            )
        {
            AsyncResult <EzSetFormResult> result = null;

            yield return(client.Formation.SetForm(
                             r =>
            {
                result = r;
            },
                             session,
                             formationNamespaceName,
                             moldModel.Name,
                             index,
                             slots,
                             signatureKeyId
                             ));

            if (result.Error != null)
            {
                onError.Invoke(
                    result.Error
                    );
                yield break;
            }

            var form = result.Result.Item;

            onUpdateForm.Invoke(moldModel, index, form);
            onGetForm.Invoke(moldModel, index, form);
        }