public static void StoreGame() { //Following is a set up for testing //currentPlayer.ID = 1; //currentPlayer.Name = "Hayden"; //currentPlayer.Room = roomNavigation.currentRoom.roomName; //currentPlayer.Password = "******"; //currentPlayer.Score = 0 //End of test code //↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓!!!!!!!!!!!!!!!!!!!!!!!!IMPORTANT!!!!!!!!!!!!!!!!!!!!!!!!↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ //This sets the players location to whatever the current room name is. The text on screen DOES NOT update just yet //It DOES update in the database, by using DB Browser for SQLite you can see the tables update //In future I will store the game log so when the player logs in, it will repeat the log currentPlayer.Room = GameModel.roomNavigation.currentRoom.roomName; //↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑!!!!!!!!!!!!!!!!!!!!!!!!IMPORTANT!!!!!!!!!!!!!!!!!!!!!!!!↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ ds.storeInventory(currentPlayer.Name, nounsInInventory); ds.StoreLocation(currentLocaleDTO); Score = Score + 1; ds.storePlayer(currentPlayer); var PlayerList = new List <Player>(); PlayerList.Add(currentPlayer); jsDrop.Store <Player, JsnReceiver>(PlayerList, ds.jsnReceiverDel); }
// Update the user level in the database and then move them to the next scene. public void FinishLevel() { JSON.Store <Account, JsnReceiver> (new List <Account> { new Account { ID = ID, Username = Username, Password = Password, Level = Level + 1 }, }, LoadNextLevelSuccess); }
// Start is called before the first frame update void Start() { #region Test jsn drop JSONDropService jsDrop = new JSONDropService { Token = "6af89c87-4bff-4941-aa38-d306bf9b5690" }; //Create table person jsDrop.Create <Player, JsnReceiver>(new Player { Room = "UUUUUUUUUUUUUUUUUUUUUUUUUUU", Password = "******", Name = "UUUUUUUUUUUUUUUUUUUUUUUUUUU", Score = 111111 }, jsnReceiverDel); // Store people records jsDrop.Store <Player, JsnReceiver>(new List <Player> { new Player { Room = "Starting Room", Password = "******", Name = "John", Score = 1 }, new Player { Room = "Starting Room", Password = "******", Name = "Joe", Score = 1 }, new Player { Room = "Starting Room", Password = "******", Name = "Jim", Score = 1 } }, jsnReceiverDel); // Retreive all people records jsDrop.All <Player, JsnReceiver>(jsnListReceiverDel, jsnReceiverDel); jsDrop.Select <Player, JsnReceiver>("ID > 20", jsnListReceiverDel, jsnReceiverDel); jsDrop.Delete <Player, JsnReceiver>("ID = 1", jsnReceiverDel); jsDrop.Drop <Player, JsnReceiver>(jsnReceiverDel); #endregion }
public static void MakeGame() { GameModel.ds.CreateDB(); Location forest, cave, cave2, beach, river, house, ocean; currentLocale = new Location { Name = "Forest", Story = " This area seems rather pleasant. Who's that strange looking figure on that hill?" }; // forest forest = currentLocale; GameModel.ds.storeLocation(forest); forest.addLocation("North", "Cave", "Where's the entrance gone! It looks like I'll need to cross that lava lake!", 0f, -1.6f, 15.76392f, -0.8335584f, 0f, -1.6f, 0f, -1.6f); forest.addLocation("East", "Beach", "Huh, is that someone way over on the far side? I may or not not be able to reach them from here", 0f, 0.49f, 0f, 0f, 6.7f, -4.3f, 6.7f, -4.3f); forest.addLocation("West", "House", "Well. This is a boring looking area", 0f, 0f, 0f, 0f, -3.58f, -1f, 0f, 0f); // cave cave = forest.getLocation("North"); cave.addLocation("South", forest); cave.addLocation("East", "Cave2", "Another lava lake... I think I can see light coming from the tunnel on the other side though!", 0f, 0f, 0f, 0f, 24.2f, 1.06f, 0f, -1.6f); // cave 2 cave2 = cave.getLocation("East"); cave2.addLocation("West", cave); cave2.addLocation("East", "River", "This is much nicer, I wonder what that sign says though?", 0f, 0f, 0f, -1.6f, 0f, -1.6f, 24.36617f, 1.045399f); // river = cave2.getLocation("East"); // beach beach = forest.getLocation("East"); beach.addLocation("West", forest); beach.addLocation("North", "Ocean", "I guess you're amphibious! Surely there must be treasure hidden around here, but then how are you going to get out!", 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f); ocean = beach.getLocation("North"); // river river.addLocation("West", cave2); river.addLocation("South", ocean); // ocean ocean.addLocation("North", river); ocean.addLocation("South", beach); //House house = forest.getLocation("West"); house.addLocation("East", forest); //currentLocale = forest; nextLocale = currentLocale; jsDrop.Store <Location, JsnReceiver>(new List <Location> { forest, cave, cave2, beach, river, ocean, house }, ds.jsnReceiverDel); }