Esempio n. 1
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);
    }
Esempio n. 2
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);
        }
Esempio n. 3
0
    private IEnumerator initSwrve()
    {
        DateTime        dateTime = new DateTime(2018, 12, 21, 0, 0, 0);
        ICPSwrveService instance;

        if (EnableAnalyticsLogging && dateTime.Date > DateTime.Now.Date && !Service.Get <GameSettings>().OfflineMode)
        {
            SwrveLog.OnLog += delegate(SwrveLog.LogLevel level, object message, string tag)
            {
                switch (level)
                {
                case SwrveLog.LogLevel.Verbose:
                    break;

                case SwrveLog.LogLevel.Info:
                    break;

                case SwrveLog.LogLevel.Warning:
                    break;

                case SwrveLog.LogLevel.Error:
                    Log.LogNetworkError("Swrve", message.ToString());
                    break;
                }
            };
            GameObject     gameObject     = Service.Get <GameObject>();
            SwrveComponent swrveComponent = gameObject.AddComponent <SwrveComponent>();
            Configurator   configurator   = Service.Get <Configurator>();
            IDictionary <string, object> dictionaryForSystem = configurator.GetDictionaryForSystem("SwrveConfig");
            string key = "PROD";
            IDictionary <string, object> dictionary = (IDictionary <string, object>)dictionaryForSystem[key];
            string key2 = "windows";
            IDictionary <string, object> dictionary2 = (IDictionary <string, object>)dictionary[key2];
            SwrveConfig swrveConfig = new SwrveConfig();
            swrveConfig.AppVersion = ClientInfo.Instance.BuildVersion;
            swrveConfig.AutomaticSessionManagement        = true;
            swrveConfig.AutoDownloadCampaignsAndResources = true;
            swrveConfig.NewSessionInterval              = 1;
            swrveConfig.UseHttpsForEventsServer         = true;
            swrveConfig.UseHttpsForContentServer        = true;
            swrveConfig.MessagingEnabled                = false;
            swrveConfig.ConversationsEnabled            = false;
            swrveComponent.SDK.PushNotificationListener = new CPSwrvePushNotificationListener();
            swrveComponent.Init((int)dictionary2["AppId"], (string)dictionary2["APIKey"], swrveConfig);
            Dictionary <string, string> deviceInfo = swrveComponent.SDK.GetDeviceInfo();
            string text   = deviceInfo["swrve.device_name"];
            string value  = deviceInfo["swrve.os"];
            string value2 = deviceInfo["swrve.device_dpi"];
            string value3 = deviceInfo["swrve.device_width"];
            string value4 = deviceInfo["swrve.device_height"];
            Dictionary <string, string> dictionary3 = new Dictionary <string, string>();
            dictionary3.Add("device_name", text);
            dictionary3.Add("os", value);
            dictionary3.Add("device_dpi", value2);
            dictionary3.Add("device_width", value3);
            dictionary3.Add("device_height", value4);
            if (!string.IsNullOrEmpty(swrveComponent.SDK.UserId))
            {
                dictionary3.Add("swrve_user_id", swrveComponent.SDK.UserId);
            }
            dictionary3.Add("jailbroken.is_jailbroken", SwrveManagerUtils.GetIsJailBroken());
            dictionary3.Add("lat.is_lat", SwrveManagerUtils.GetIsLat().ToString());
            string key3 = string.Empty;
            if (Application.platform == RuntimePlatform.Android)
            {
                key3 = "gida";
            }
            else if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                key3 = "idfa";
            }
            string value5 = SwrveManagerUtils.AESEncrypt(text, SwrveManagerUtils.GetAdvertiserID());
            dictionary3.Add(key3, value5);
            string rSAEncryptedKey = SwrveManagerUtils.GetRSAEncryptedKey();
            dictionary3.Add("esk", rSAEncryptedKey);
            swrveComponent.SDK.UserUpdate(dictionary3);
            instance = new CPSwrveService(swrveComponent);
        }
        else
        {
            instance = new NullCPSwrveService();
        }
        Service.Set(instance);
        yield break;
    }