Beispiel #1
0
 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);
        }
Beispiel #3
0
 internal Users([NotNull] GameJoltApi api) : base(api)
 {
 }
Beispiel #4
0
 /// <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;
 }
Beispiel #5
0
 internal Sessions([NotNull] GameJoltApi api) : base(api)
 {
 }
Beispiel #6
0
 internal Time([NotNull] GameJoltApi api) : base(api)
 {
 }
Beispiel #7
0
 internal Scores([NotNull] GameJoltApi api) : base(api)
 {
 }
Beispiel #8
0
        /// <summary>
        /// Constructeur
        /// </summary>
        /// <param name="machine"></param>

        public Leaderboard(Machine machine)
        {
            this.machine  = machine;
            this.gameJolt = new GameJoltApi(501513, "64c8855b6c591e8fadd8dc4589fb531e");
        }
Beispiel #9
0
 internal Datastore([NotNull] GameJoltApi api) : base(api)
 {
 }
Beispiel #10
0
 internal Friends([NotNull] GameJoltApi api) : base(api)
 {
 }
Beispiel #11
0
 internal Trophies([NotNull] GameJoltApi api) : base(api)
 {
 }