Exemple #1
0
 public StampSheetStateMachine(
     string stampSheet,
     Gs2.Unity.Client client,
     string stampSheetEncryptKeyId
     )
 {
     _stampSheet             = new EzStampSheet(stampSheet);
     _client                 = client;
     _stampSheetEncryptKeyId = stampSheetEncryptKeyId;
     _running                = false;
 }
Exemple #2
0
 public StampSheetStateMachine(
     EzStampSheet stampSheet,
     Gs2.Unity.Client client,
     string distributorNamespaceName,
     string stampSheetEncryptKeyId
     )
 {
     _stampSheet = stampSheet;
     _client     = client;
     _distributorNamespaceName = distributorNamespaceName;
     _stampSheetEncryptKeyId   = stampSheetEncryptKeyId;
     _running = false;
 }
 public IEnumerator Execute(
     UnityAction <AsyncResult <EzRunStampTaskResult> > callback,
     string stackContext,
     Gs2.Unity.Client client,
     string distributorNamespaceName,
     string stampSheetEncryptKeyId
     )
 {
     if (distributorNamespaceName == null)
     {
         yield return(client.Distributor.RunStampTaskWithoutNamespace(
                          r =>
         {
             callback.Invoke(
                 new AsyncResult <EzRunStampTaskResult>(
                     r.Result != null ? new EzRunStampTaskResult(
                         new RunStampTaskResult
             {
                 result = r.Result.Result,
                 contextStack = r.Result.ContextStack,
             }
                         ) : null,
                     r.Error
                     )
                 );
         },
                          _stampTaskStr,
                          stampSheetEncryptKeyId,
                          stackContext
                          ));
     }
     else
     {
         yield return(client.Distributor.RunStampTask(
                          callback,
                          distributorNamespaceName,
                          _stampTaskStr,
                          stampSheetEncryptKeyId,
                          stackContext
                          ));
     }
 }
 public IEnumerator ExpressExecute(
     UnityAction <AsyncResult <EzRunStampSheetExpressResult> > callback,
     Gs2.Unity.Client client,
     string distributorNamespaceName,
     string stampSheetEncryptKeyId
     )
 {
     if (distributorNamespaceName == null)
     {
         yield return(client.Distributor.RunStampSheetExpressWithoutNamespace(
                          r =>
         {
             callback.Invoke(
                 new AsyncResult <EzRunStampSheetExpressResult>(
                     r.Result != null ? new EzRunStampSheetExpressResult(
                         new RunStampSheetExpressResult
             {
                 taskResults = r.Result.TaskResults,
                 sheetResult = r.Result.SheetResult,
             }
                         ) : null,
                     r.Error
                     )
                 );
         },
                          _stampSheetStr,
                          stampSheetEncryptKeyId
                          ));
     }
     else
     {
         yield return(client.Distributor.RunStampSheetExpress(
                          callback,
                          distributorNamespaceName,
                          _stampSheetStr,
                          stampSheetEncryptKeyId
                          ));
     }
 }
Exemple #5
0
        public static IEnumerator InitializeGs2(
            string clientId,
            string clientSecret,
            InitializeGs2AccountEvent onInitializeGs2,
            ErrorEvent onError
            )
        {
            Assert.IsFalse(string.IsNullOrEmpty(clientId), "string.IsNullOrEmpty(clientId)");
            Assert.IsFalse(string.IsNullOrEmpty(clientSecret), "string.IsNullOrEmpty(clientSecret)");
            Assert.IsNotNull(onInitializeGs2, "onInitializeGs2 != null");
            Assert.IsNotNull(onError, "onError != null");

            var profile = new Profile(
                clientId,
                clientSecret,
                new Gs2BasicReopener()
                );

            AsyncResult <object> result = null;

            yield return(profile.Initialize(
                             r => { result = r; }
                             ));

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

            var client = new Gs2.Unity.Client(profile);

            onInitializeGs2.Invoke(profile, client);
        }