private static void exportSignedResponse(SignedResponse <T> obj, JsonWriter writer) { writer.WriteObjectStart(); writer.WritePropertyName("goodUntil"); writer.Write(obj.goodUntil); writer.WritePropertyName("signature"); writer.Write(obj.signature); writer.WritePropertyName("swid"); writer.Write(obj.swid); writer.WritePropertyName("data"); ICommonGameSettings commonGameSettings = Service.Get <ICommonGameSettings>(); if (commonGameSettings.OfflineMode && !string.IsNullOrEmpty(commonGameSettings.GameServerHost)) { writer.WriteRaw(JsonMapper.ToJson(obj.Data)); } else if (obj._rawJson != null) { writer.WriteRaw(obj._rawJson.ToJson()); } else { writer.Write(""); } writer.WriteObjectEnd(); }
public FeatureToggleService() { gameSettings = Service.Get <ICommonGameSettings>(); dispatcher = Service.Get <EventDispatcher>(); features = Service.Get <IGameData>().Get <Dictionary <string, FeatureDefinition> >(); featureSettings = new Dictionary <string, DevCacheableType <bool> >(); foreach (FeatureDefinition value in features.Values) { init(value); } }
public ClubPenguinClient(MonoBehaviour monoBehaviour, string apiURL, string clientToken, string clientApiVersion, string gameZone, bool gameEncryption, bool gameDebugging, bool lagMonitoring, int gameServerLatencyWindowSize, int webServiceLatencyWindowSize, string cpMonitoringURL, string websiteApiURL, bool offlineMode) { OfflineMode = offlineMode; SyncContext = new UnitySynchronizationContext(monoBehaviour); ICommonGameSettings commonGameSettings = Service.Get <ICommonGameSettings>(); if (offlineMode && string.IsNullOrEmpty(commonGameSettings.GameServerHost) && string.IsNullOrEmpty(commonGameSettings.CPAPIServicehost)) { GameServer = new OfflineGameServerClient(this); } else { GameServer = new SmartFoxGameServerClient(this, gameZone, gameEncryption, gameDebugging, lagMonitoring); } BreadcrumbApi = new BreadcrumbApi(this); ChatApi = new ChatApi(this); ConsumableApi = new ConsumableApi(this); DurableApi = new DurableApi(this); EncryptionApi = new EncryptionApi(this); GameApi = new GameApi(this); IglooApi = new IglooApi(this); InventoryApi = new InventoryApi(this); MinigameApi = new MinigameApi(this); PlayerApi = new PlayerApi(this); QuestApi = new QuestApi(this); RewardApi = new RewardApi(this); SavedOutfitApi = new SavedOutfitApi(this); TaskApi = new TaskApi(this); IAPApi = new IAPApi(this); TutorialApi = new TutorialApi(this); ModerationApi = new ModerationApi(this); TubeApi = new TubeApi(this); DisneyStoreApi = new DisneyStoreApi(this); NewsfeedApi = new NewsfeedApi(this); CatalogApi = new CatalogApi(this); ScheduledEventApi = new ScheduledEventApi(this); DiagnosticsApi = new DiagnosticsApi(this); CaptchaApi = new CaptchaApi(this); initWAK(apiURL, clientToken, clientApiVersion); Configuration.SetBaseUri("cp-monitoring-base-uri", cpMonitoringURL); Configuration.SetBaseUri("cp-website-api-base-uri", websiteApiURL); initCPKeyValueDatabase(Service.Get <IKeychain>()); initEncryption(); RecoverableOperationService = new QueuableRecoverableOperationService(this); if (lagMonitoring) { GameServerLatency = new RollingStatistics(gameServerLatencyWindowSize); WebServiceLatency = new RollingStatistics(webServiceLatencyWindowSize); } }
public void Execute() { ICommonGameSettings commonGameSettings = Service.Get <ICommonGameSettings>(); if (clubPenguinClient.OfflineMode && string.IsNullOrEmpty(commonGameSettings.CPAPIServicehost)) { CoroutineRunner.StartPersistent(runOffline(), this, "execute"); return; } if (string.IsNullOrEmpty(commonGameSettings.CPAPIServicehost)) { OnResponse += delegate { operation.UpdateOfflineData(); }; } clubPenguinClient.RecoverableOperationService.SendOperation(operation, this.OnResponse, this.OnError, this.OnComplete); }
public void Execute() { ICommonGameSettings commonGameSettings = Service.Get <ICommonGameSettings>(); if (commonGameSettings.OfflineMode && string.IsNullOrEmpty(commonGameSettings.CDN)) { onInitializeComplete(contentManifest_loadEmbedded()); return; } try { timeoutCheck = CoroutineRunner.Start(timeout_loadManifestSequence(), this, "timeoutLoadPatchManifest"); timeoutCoroutines.Add(timeoutCheck); manifestCoroutines.StartAndAddPersistent(loadContentManifest(), this, "loadContentManifest"); } catch (Exception ex) { Log.LogException(this, ex); handleFailure(); } }
public static string GetCdnUrl() { if (!ConfigHelper.TryGetEnvironmentProperty <string>("CDN", out var value)) { throw new Exception("Configurator did not contain a value for the CDN URL"); } ICommonGameSettings commonGameSettings = Service.Get <ICommonGameSettings>(); if (commonGameSettings.OfflineMode && !string.IsNullOrEmpty(commonGameSettings.CDN)) { value = commonGameSettings.CDN; } string text = ((!string.IsNullOrEmpty(CDNUrl)) ? CDNUrl : value); text = text.Trim(); if (text.EndsWith("/")) { return(text); } return(text + "/"); }