public Client(Gs2.Unity.Util.Profile profile) { _profile = profile; _client = new Gs2ExperienceWebSocketClient(profile.Gs2Session); if (profile.checkRevokeCertificate) { _restClient = new Gs2ExperienceRestClient(profile.Gs2RestSession); } else { _restClient = new Gs2ExperienceRestClient(profile.Gs2RestSession, new DisabledCertificateHandler()); } }
public static IEnumerator IncreaseExperience( GameSession session, string identifierIncreaseExperienceClientId, string identifierIncreaseExperienceClientSecret, string experienceNamespaceName, EzExperienceModel experienceModel, string propertyId, int value, IncreaseExperienceEvent onIncreaseExperience, ErrorEvent onError ) { // このコードは実際にアプリケーションで使用するべきではありません。 // アプリ内から課金通貨の残高を加算できるようにすることは、事業に多大な悪い影響を及ぼす可能性があります。 var restSession = new Gs2RestSession( new BasicGs2Credential( identifierIncreaseExperienceClientId, identifierIncreaseExperienceClientSecret ) ); var error = false; yield return(restSession.Open( r => { if (r.Error != null) { onError.Invoke(r.Error); error = true; } } )); if (error) { yield return(restSession.Close(() => { })); yield break; } var restClient = new Gs2ExperienceRestClient( restSession ); yield return(restClient.AddExperienceByUserId( new AddExperienceByUserIdRequest() .WithNamespaceName(experienceNamespaceName) .WithUserId(session.AccessToken.userId) .WithExperienceName(experienceModel.Name) .WithPropertyId(propertyId) .WithExperienceValue(value), r => { if (r.Error != null) { onError.Invoke(r.Error); error = true; } else { onIncreaseExperience.Invoke( experienceModel, new EzStatus(r.Result.item), value ); } } )); yield return(restSession.Close(() => { })); }