Ejemplo n.º 1
0
 /// <summary>
 /// Adds an item to a player's inventory in the database.
 /// </summary>
 /// <param name="playerID"></param>
 /// <param name="item"></param>
 public void addPlayerInventoryItem(int playerID, DomainClasses.SceneComponent item)
 {
     connection.Insert(new PlayerInventory {
         playerID = playerID, componentID = item.identifier
     });
     connection.Close();
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Removes a scene component from a scene's inventory in the database.
 /// </summary>
 /// <param name="gameID"></param>
 /// <param name="scene"></param>
 /// <param name="item"></param>
 public void removeSceneComponent(int gameID, DomainClasses.Scene scene, DomainClasses.SceneComponent item)
 {
     DTO.SceneInventory itemToRemove = connection.Table <DTO.SceneInventory>().Where(x => x.gameID == gameID && x.sceneID == scene.identifier && x.componentID == item.identifier).ToArray().FirstOrDefault();
     if (itemToRemove != null)
     {
         connection.Delete <SceneInventory>(itemToRemove.identifier);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Removes an item from the player's inventory in the database.
        /// </summary>
        /// <param name="playerID"></param>
        /// <param name="item"></param>
        public void removePlayerInventoryItem(int playerID, DomainClasses.SceneComponent item)
        {
            PlayerInventory itemToRemove = connection.Table <PlayerInventory>().Where(x => x.playerID == playerID && x.componentID == item.identifier).ToArray().FirstOrDefault();

            if (itemToRemove != null)
            {
                connection.Delete <PlayerInventory>(itemToRemove.identifier);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Adds a scene component to a scene's inventory in the database.
 /// </summary>
 /// <param name="gameID"></param>
 /// <param name="scene"></param>
 /// <param name="item"></param>
 public void addSceneComponent(int gameID, DomainClasses.Scene scene, DomainClasses.SceneComponent item)
 {
     connection.Insert(new DTO.SceneInventory {
         gameID = gameID, sceneID = scene.identifier, componentID = item.identifier
     });
 }