protected override void LoadContent() { Assets.Load(GraphicsDevice, Content); if (!Settings.IsValid()) { PushScreen(new ErrorScreen()); } else { Jolt = new GameJoltApi(Settings.GameId, Settings.PrivateKey); PushScreen(new LoginScreen()); } }
public void Setup() { var file = Path.Combine(TestContext.CurrentContext.TestDirectory, "settings.json"); if (!File.Exists(file)) { File.WriteAllText(file, @"{ ""gameId"" : 0, ""privateKey"" : null, ""user"" : [""<username>"", ""<token>""], ""secondUser"" : [""<username>"", ""<token>""], ""uniqueTable"" : 0, ""nonUniqueTable"" : 0, ""tables"" : [0, 0], ""trophies"" : [ {""id"":""0"",""difficulty"":""Bronze""}, {""id"":""0"",""difficulty"":""Silver""}, ] } " ); } var json = JSONNode.Parse(File.ReadAllText(file)); var id = json["gameId"].AsInt; var key = json["privateKey"].Value; Credentials = GetCredentials(json["user"]); SecondCredentials = GetCredentials(json["secondUser"]); UniqueTable = json["uniqueTable"].AsInt; NonUniqueTable = json["nonUniqueTable"].AsInt; Tables = json["tables"].ArraySelect(x => new Table(x)); Trophies = json["trophies"].ArraySelect(x => new Trophy(x)); Assert.That(id != 0, "Invalid game id"); Assert.That(!string.IsNullOrEmpty(key), "Invalid private key"); Assert.That(UniqueTable != 0, "Invalid test table id"); Assert.That(NonUniqueTable != 0, "Invalid test table id"); Assert.That(Tables != null, "Invalid table array"); Assert.That(Tables.Count >= 2, "Table array must contain at least two table ids"); Assert.That(Tables.Any(t => t.Id == UniqueTable), "Table array does not contain the test table"); Assert.That(Tables.Any(t => t.Id == NonUniqueTable), "Table array does not contain the test table"); Assert.That(Trophies.Count >= 2, "Trophy array must contain at least two trophies"); Api = new GameJoltApi(id, key); }
internal Users([NotNull] GameJoltApi api) : base(api) { }
/// <summary> /// Constructs a new service by using the provided API instance. /// </summary> /// <param name="api">The API instance which shall be used for the http requests.</param> protected Service([NotNull] GameJoltApi api) { api.ThrowIfNull(); Api = api; }
internal Sessions([NotNull] GameJoltApi api) : base(api) { }
internal Time([NotNull] GameJoltApi api) : base(api) { }
internal Scores([NotNull] GameJoltApi api) : base(api) { }
/// <summary> /// Constructeur /// </summary> /// <param name="machine"></param> public Leaderboard(Machine machine) { this.machine = machine; this.gameJolt = new GameJoltApi(501513, "64c8855b6c591e8fadd8dc4589fb531e"); }
internal Datastore([NotNull] GameJoltApi api) : base(api) { }
internal Friends([NotNull] GameJoltApi api) : base(api) { }
internal Trophies([NotNull] GameJoltApi api) : base(api) { }