Beispiel #1
0
 public void PostConfig_ThrowsArgumentExceptionOnBadArgs()
 {
     try
     {
         RemoteConfigWebApiClient.PostConfig(null, null, null);
     }
     catch (ArgumentException ex)
     {
         Assert.That(ex.GetType() == typeof(ArgumentException));
     }
 }
        private void OnEnvironmentCreated(string responce)
        {
            RemoteConfigWebApiClient.environmentCreated -= OnEnvironmentCreated;
            _data.environmentId = responce;

            RemoteConfigWebApiClient.SetDefaultEnvironment(Application.cloudProjectId, _data.environmentId);

            JArray ja = new JArray();

            foreach (var configItem in _model.configItems)
            {
                ja.Add(new JObject {
                    ["key"] = configItem.name, ["value"] = configItem.value, ["type"] = configItem.type
                });
            }

            RemoteConfigWebApiClient.postConfigRequestFinished += OnConfigPosted;
            RemoteConfigWebApiClient.PostConfig(Application.cloudProjectId, _data.environmentId, ja);
        }
Beispiel #3
0
        private void RemoteConfigWebApiClient_fetchConfigsFinished(JObject config)
        {
            RemoteConfigWebApiClient.fetchConfigsFinished -= RemoteConfigWebApiClient_fetchConfigsFinished;
            if (config.HasValues)
            {
                configId = config["id"].Value <string>();
                settings = AddMetadataToSettings((JArray)config["value"]);
                UpdateSettingsTreeview(settings);

                if (_simulationParametersTreeview != null)
                {
                    var items = new List <GameSimParametersTreeElement>();

                    foreach (var setting in settings)
                    {
                        var element = new GameSimParametersTreeElement
                        {
                            Key          = (string)setting["rs"]["key"],
                            Type         = (string)setting["rs"]["type"],
                            DefaultValue = (string)setting["rs"]["value"],
                            Values       = ""
                        };

                        items.Add(element);
                    }

                    _simulationParametersTreeview?.Setup(items.ToArray());
                }
            }
            else
            {
                RemoteConfigWebApiClient.postConfigRequestFinished += RemoteConfigWebApiClient_postConfigRequestFinished;
                RemoteConfigWebApiClient.PostConfig(Application.cloudProjectId, environmentId, new JArray());
            }
            isMakingHttpCall = false;
        }