Пример #1
0
 public virtual void SetNetworkConfig(NetworkServicesConfig config)
 {
     this.config       = config;
     IOSProvisioningId = config.iOSProvisioningId;
     GcmSenderId       = config.GcmSenderId;
     accountValidator  = new NewAccountValidator(keychainData, logger, storageDir, config.GuestControllerHostUrl, null, config.DisneyIdClientId, coroutineManager);
 }
Пример #2
0
 public void Configure(NetworkServicesConfig config)
 {
     if (clubPenguinClient != null)
     {
         clubPenguinClient.Destroy();
     }
     clubPenguinClient = new ClubPenguinClient(monoBehaviour, config.CPAPIServicehost, config.CPAPIClientToken, config.ClientApiVersion, config.CPGameServerZone, !offlineMode && config.CPGameServerEncrypted, config.CPGameServerDebug, config.CPLagMonitoring, config.CPGameServerLatencyWindowSize, config.CPWebServiceLatencyWindowSize, config.CPMonitoringServicehost, config.CPWebsiteAPIServicehost, offlineMode);
     currentConfig     = config;
     worldService      = new WorldService();
     worldService.Initialize(clubPenguinClient);
     playerStateService = new PlayerStateService();
     playerStateService.Initialize(clubPenguinClient);
     chatService = new ChatService();
     chatService.Initialize(clubPenguinClient);
     playerActionService = new PlayerActionService();
     playerActionService.Initialize(clubPenguinClient);
     iglooService = new IglooService();
     iglooService.Initialize(clubPenguinClient);
     inventoryService = new InventoryService();
     inventoryService.Initialize(clubPenguinClient);
     breadcrumbService = new BreadcrumbService();
     breadcrumbService.Initialize(clubPenguinClient);
     savedOutfitService = new SavedOutfitService();
     savedOutfitService.Initialize(clubPenguinClient);
     prototypeService = new PrototypeService();
     prototypeService.Initialize(clubPenguinClient);
     questService = new QuestService();
     questService.Initialize(clubPenguinClient);
     consumableService = new ConsumableService();
     consumableService.Initialize(clubPenguinClient);
     friendsService = new FriendsService();
     friendsService.Initialize(clubPenguinClient);
     rewardService = new RewardService();
     rewardService.Initialize(clubPenguinClient);
     taskService = new TaskNetworkService();
     taskService.Initialize(clubPenguinClient);
     minigameService = new MinigameService();
     minigameService.Initialize(clubPenguinClient);
     iapService = new IAPService();
     iapService.Initialize(clubPenguinClient);
     tutorialService = new TutorialService();
     tutorialService.Initialize(clubPenguinClient);
     moderationService = new ModerationService();
     moderationService.Initialize(clubPenguinClient);
     disneyStoreService = new DisneyStoreService();
     disneyStoreService.Initialize(clubPenguinClient);
     newsfeedService = new NewsfeedService();
     newsfeedService.Initialize(clubPenguinClient);
     catalogService = new CatalogService();
     catalogService.Initialize(clubPenguinClient);
     partyGameService = new PartyGameService();
     partyGameService.Initialize(clubPenguinClient);
     scheduledEventService = new ScheduledEventService();
     scheduledEventService.Initialize(clubPenguinClient);
     diagnosticsService = new DiagnosticsService();
     diagnosticsService.Initialize(clubPenguinClient);
     captchaService = new CaptchaService();
     captchaService.Initialize(clubPenguinClient);
 }
Пример #3
0
    protected override IEnumerator setup()
    {
        GcsAccessTokenService gcsAccessTokenService = new GcsAccessTokenService(ConfigHelper.GetEnvironmentProperty <string>("GcsServiceAccountName"), new GcsP12AssetFileLoader(ConfigHelper.GetEnvironmentProperty <string>("GcsServiceAccountFile")));

        Service.Set((IGcsAccessTokenService)gcsAccessTokenService);
        string cdnUrl = ContentHelper.GetCdnUrl();
        string cpipeMappingFilename = ContentHelper.GetCpipeMappingFilename();
        CPipeManifestService cpipeManifestService = new CPipeManifestService(cdnUrl, cpipeMappingFilename, gcsAccessTokenService);

        Service.Set((ICPipeManifestService)cpipeManifestService);
        base.gameObject.AddComponent <KeyChainManager>();
        GameSettings gameSettings = new GameSettings();

        Service.Set(gameSettings);
        ContentManifest definition = ContentManifestUtility.FromDefinitionFile("Configuration/embedded_content_manifest");

        Service.Set(new Content(definition));
        Localizer localizer = Localizer.Instance;

        Service.Set(localizer);
        NullCPSwrveService cpSwrveService = new NullCPSwrveService();

        Service.Set((ICPSwrveService)cpSwrveService);
        NetworkServicesConfig networkConfig = NetworkController.GenerateNetworkServiceConfig(TestEnvironment);

        Service.Set((INetworkServicesManager) new NetworkServicesManager(this, networkConfig, offlineMode: false));
        CommerceService commerceService = new CommerceService();

        commerceService.Setup();
        Service.Set(commerceService);
        Service.Set(new MembershipService(null));
        ConnectionManager connectionManager = base.gameObject.AddComponent <ConnectionManager>();

        Service.Set(connectionManager);
        Service.Set(new SessionManager());
        Service.Set(new MixLoginCreateService());
        Service.Set((CPDataEntityCollection) new CPDataEntityCollectionImpl());
        LocalPlayerData localPlayerData = new LocalPlayerData
        {
            name         = "TestPlayer",
            tutorialData = new List <sbyte>()
        };
        PlayerId playerId = localPlayerData.id = new PlayerId
        {
            id   = "999999999999999",
            type = PlayerId.PlayerIdType.SESSION_ID
        };

        Service.Get <CPDataEntityCollection>().ResetLocalPlayerHandle();
        PlayerDataEntityFactory.AddLocalPlayerProfileDataComponents(Service.Get <CPDataEntityCollection>(), localPlayerData);
        LoginController loginController = new LoginController();

        Service.Set(loginController);
        loginController.SetNetworkConfig(networkConfig);
        IntegrationTestEx.FailIf(Service.Get <MixLoginCreateService>().NetworkConfigIsNotSet);
        yield return(null);
    }
Пример #4
0
        protected override IEnumerator setup()
        {
            base.gameObject.AddComponent <KeyChainManager>();
            GameSettings gameSettings = new GameSettings();

            Service.Set(gameSettings);
            ContentManifest       definition            = ContentManifestUtility.FromDefinitionFile("Configuration/embedded_content_manifest");
            GcsAccessTokenService gcsAccessTokenService = new GcsAccessTokenService(ConfigHelper.GetEnvironmentProperty <string>("GcsServiceAccountName"), new GcsP12AssetFileLoader(ConfigHelper.GetEnvironmentProperty <string>("GcsServiceAccountFile")));

            Service.Set((IGcsAccessTokenService)gcsAccessTokenService);
            string cdnUrl = ContentHelper.GetCdnUrl();
            string cpipeMappingFilename = ContentHelper.GetCpipeMappingFilename();
            CPipeManifestService cpipeManifestService = new CPipeManifestService(cdnUrl, cpipeMappingFilename, gcsAccessTokenService);

            Service.Set((ICPipeManifestService)cpipeManifestService);
            NullCPSwrveService cpSwrveService = new NullCPSwrveService();

            Service.Set((ICPSwrveService)cpSwrveService);
            Content content = new Content(definition);

            Service.Set(content);
            networkServicesConfig = NetworkController.GenerateNetworkServiceConfig(Disney.Kelowna.Common.Environment.Environment.LOCAL);
            ConnectionManager connectionManager = base.gameObject.AddComponent <ConnectionManager>();

            Service.Set(connectionManager);
            initEnvironmentManager();
            sessionManager = new SessionManager();
            Service.Set(sessionManager);
            Localizer localizer = Localizer.Instance;

            Service.Set(localizer);
            Language language = LocalizationLanguage.GetLanguage();

            localizer.Language       = language;
            localizer.LanguageString = LocalizationLanguage.GetLanguageString(language);
            AppTokensFilePath tokensFilePath = new AppTokensFilePath(Localizer.DEFAULT_TOKEN_LOCATION, Platform.global);
            bool tokensLoaded = false;

            Service.Get <Localizer>().LoadTokensFromLocalJSON(tokensFilePath, delegate
            {
                Debug.Log("Tokens for " + localizer.LanguageString + " have been loaded.");
                tokensLoaded = true;
            });
            while (!tokensLoaded)
            {
                yield return(null);
            }
            mixLoginCreateService = new MixLoginCreateService();
            Service.Set(mixLoginCreateService);
            IntegrationTestEx.FailIf(!mixLoginCreateService.NetworkConfigIsNotSet);
            mixLoginCreateService.SetNetworkConfig(networkServicesConfig);
            IntegrationTestEx.FailIf(mixLoginCreateService.NetworkConfigIsNotSet);
            yield return(null);
        }
Пример #5
0
        public NetworkController(MonoBehaviour ctx, bool offlineMode)
        {
            loginController = Service.Get <LoginController>();
            NetworkServicesConfig networkServicesConfig = GenerateNetworkServiceConfig(developmentEnvironment);

            Service.Set((INetworkServicesManager) new NetworkServicesManager(ctx, networkServicesConfig, offlineMode));
            dataEntityCollection   = Service.Get <CPDataEntityCollection>();
            mixCriticalAlertLevel  = networkServicesConfig.MixCritialAlertLevel;
            eventDispatcher        = Service.Get <EventDispatcher>();
            networkServicesManager = Service.Get <INetworkServicesManager>();
            sessionManager         = Service.Get <SessionManager>();
            loginController.SetNetworkConfig(networkServicesConfig);
            Service.Get <MixLoginCreateService>().SetNetworkConfig(networkServicesConfig);
            dataEntityCollection.ResetLocalPlayerHandle();
            addListeners();
        }
Пример #6
0
    public override IEnumerator PerformSecondPass()
    {
        NetworkServicesConfig networkConfig = NetworkController.GenerateNetworkServiceConfig(Config.ServerEnvironment);

        Service.Get <INetworkServicesManager>().Configure(networkConfig);
        Service.Get <LoginController>().SetNetworkConfig(networkConfig);
        mixLoginCreateService = Service.Get <MixLoginCreateService>();
        mixLoginCreateService.SetNetworkConfig(networkConfig);
        sessionManager = Service.Get <SessionManager>();
        mixLoginCreateService.OnLoginSuccess += HandleOnLoginSuccess;
        mixLoginCreateService.OnLoginFailed  += HandleOnLoginFailed;
        login();
        while (!sessionManager.HasSession)
        {
            yield return(null);
        }
        mixLoginCreateService.OnLoginSuccess -= HandleOnLoginSuccess;
        mixLoginCreateService.OnLoginFailed  -= HandleOnLoginFailed;
        while (!localPlayerDataReady)
        {
            yield return(null);
        }
    }
Пример #7
0
 public NetworkServicesManager(MonoBehaviour monoBehaviour, NetworkServicesConfig config, bool offlineMode)
 {
     this.monoBehaviour = monoBehaviour;
     this.offlineMode   = offlineMode;
     Configure(config);
 }
Пример #8
0
        public static NetworkServicesConfig GenerateNetworkServiceConfig(Environment developmentEnvironment)
        {
            GameSettings                 gameSettings      = Service.Get <GameSettings>();
            NetworkServicesConfig        result            = default(NetworkServicesConfig);
            IDictionary <string, object> environmentConfig = ConfigHelper.GetEnvironmentConfig(developmentEnvironment);
            IDictionary <string, object> buildPhaseConfig  = ConfigHelper.GetBuildPhaseConfig();

            if (environmentConfig == null)
            {
                Log.LogError(typeof(NetworkController), "Falling back to QA environment config. ApplicationConfig did not contain an environment dictionary for " + developmentEnvironment);
                developmentEnvironment = Environment.QA;
                environmentConfig      = ConfigHelper.GetEnvironmentConfig(developmentEnvironment);
            }
            IDictionary <string, object> dictionary = (IDictionary <string, object>)environmentConfig["DisneyIdClientId"];
            string text = "";

            text = "windows";
            if (string.IsNullOrEmpty(text) || !text.Contains(text))
            {
                Log.LogErrorFormatted(typeof(NetworkController), "ClientIdKey={0} not valid", text);
            }
            else
            {
                result.DisneyIdClientId = (string)dictionary[text];
            }
            result.GuestControllerHostUrl         = (string)environmentConfig["GuestControllerHostUrl"];
            result.GuestControllerCDNUrl          = (string)environmentConfig["GuestControllerCDNUrl"];
            result.MixAPIHostUrl                  = (string)environmentConfig["MixAPIHostUrl"];
            result.MixClientToken                 = (string)environmentConfig["MixClientToken"];
            result.iOSProvisioningId              = (string)buildPhaseConfig["iOSProvisioningId"];
            result.GcmSenderId                    = (string)buildPhaseConfig["GcmSenderId"];
            result.MixCritialAlertLevel           = (int)environmentConfig["MixCritialAlertLevel"];
            result.CPAPIServicehost               = (string)environmentConfig["CPAPIServicehost"];
            result.CPAPIClientToken               = (string)environmentConfig["CPAPIClientToken"];
            result.CPGameServerZone               = (string)environmentConfig["CPGameServerZone"];
            result.CPGameServerEncrypted          = environmentConfig.ContainsKey("CPGameServerEncrypted") && (bool)environmentConfig["CPGameServerEncrypted"];
            result.CPGameServerDebug              = environmentConfig.ContainsKey("CPGameServerDebug") && (bool)environmentConfig["CPGameServerDebug"];
            result.CPLagMonitoring                = environmentConfig.ContainsKey("CPLagMonitoring") && (bool)environmentConfig["CPLagMonitoring"];
            result.CPGameServerLatencyWindowSize  = (environmentConfig.ContainsKey("CPGameServerLatencyWindowSize") ? ((int)environmentConfig["CPGameServerLatencyWindowSize"]) : 100);
            result.CPWebServiceLatencyWindowSize  = (environmentConfig.ContainsKey("CPWebServiceLatencyWindowSize") ? ((int)environmentConfig["CPWebServiceLatencyWindowSize"]) : 100);
            result.CPMonitoringServicehost        = (string)environmentConfig["CPMonitoringServicehost"];
            result.CPWebsiteAPIServicehost        = (string)environmentConfig["CPWebsiteAPIServicehost"];
            result.CommerceResourceURLsDefinition = (string)environmentConfig["CommerceResourceURLsDefinition"];
            if (gameSettings.OfflineMode)
            {
                if (!string.IsNullOrEmpty(gameSettings.CPAPIServicehost))
                {
                    result.CPAPIServicehost = gameSettings.CPAPIServicehost;
                }
                if (!string.IsNullOrEmpty(gameSettings.GuestControllerHostUrl))
                {
                    result.GuestControllerHostUrl = gameSettings.GuestControllerHostUrl;
                }
                if (!string.IsNullOrEmpty(gameSettings.GuestControllerCDNUrl))
                {
                    result.GuestControllerCDNUrl = gameSettings.GuestControllerCDNUrl;
                }
                if (!string.IsNullOrEmpty(gameSettings.MixAPIHostUrl))
                {
                    result.MixAPIHostUrl = gameSettings.MixAPIHostUrl;
                }
                if (!string.IsNullOrEmpty(gameSettings.CPWebsiteAPIServicehost))
                {
                    result.CPWebsiteAPIServicehost = gameSettings.CPWebsiteAPIServicehost;
                }
            }
            result.ClientVersion    = null;
            result.ClientApiVersion = EnvironmentManager.ClientVersion.ToString();
            if (environmentConfig.ContainsKey("ClientApiVersion"))
            {
                result.ClientApiVersion = (string)environmentConfig["ClientApiVersion"];
            }
            return(result);
        }
Пример #9
0
 public void SetNetworkConfig(NetworkServicesConfig config)
 {
     loginService.SetNetworkConfig(config);
     loginService.GetRegistrationConfig();
 }
Пример #10
0
 public override void SetNetworkConfig(NetworkServicesConfig config)
 {
     this.config            = config;
     base.IOSProvisioningId = config.iOSProvisioningId;
     base.GcmSenderId       = config.GcmSenderId;
 }
 public void Configure(NetworkServicesConfig networkServicesConfig)
 {
     NetworkServicesManager.Configure(networkServicesConfig);
 }