public IEnumerator Run( Client client, GameSession session, string jobQueueNamespaceName, RunJobEvent onRunJob, ErrorEvent onError ) { if (_watching) { throw new InvalidOperationException("already started"); } _watching = true; _client = client; _session = session; _jobQueueNamespaceName = jobQueueNamespaceName; _onRunJob = onRunJob; _onError = onError; _onRunJob.AddListener(OnRunJob); _onError.AddListener(OnError); yield return(Execute()); }
void Awake() { m_buf = new byte[m_apiGatewayClientBufSize]; if (m_listener != null) { m_fCompleteDispatcher.AddListener(m_listener.CompleteHandler); m_fErrorDispatcher.AddListener(m_listener.ErrorHandler); m_fProgressDispatcher.AddListener(m_listener.ProgressHandler); } }
public static IEnumerator AutoLogin( Client client, IAccountRepository repository, string accountNamespaceName, string accountEncryptionKeyId, CreateAccountEvent onCreateAccount, LoginEvent onLogin, ErrorEvent onError ) { var error = false; void OnCreateAccount(EzAccount account) { repository.SaveAccount( new PersistAccount { UserId = account.UserId, Password = account.Password, } ); } void OnError(Gs2Exception e) { error = true; } onCreateAccount.AddListener(OnCreateAccount); onError.AddListener(OnError); try { if (!repository.IsExistsAccount()) { yield return(CreateAccount( client, accountNamespaceName, onCreateAccount, onError )); } if (error) { yield break; } var account = repository.LoadAccount(); yield return(Login( client, account?.UserId, account?.Password, accountNamespaceName, accountEncryptionKeyId, onLogin, onError )); } finally { onError.RemoveListener(OnError); onCreateAccount.RemoveListener(OnCreateAccount); } }