Esempio n. 1
0
 public GameObjectBase GetFromDatabaseByID(int resourceID, GameObjectTypeEnum gameResourceType)
 {
     if (gameResourceType == GameObjectTypeEnum.Area)
     {
         using (AreaRepository repo = new AreaRepository())
         {
             return repo.GetByID(resourceID);
         }
     }
     else if (gameResourceType == GameObjectTypeEnum.Conversation)
     {
         using (ConversationRepository repo = new ConversationRepository())
         {
             return repo.GetByID(resourceID);
         }
     }
     else if (gameResourceType == GameObjectTypeEnum.Creature)
     {
         using (CreatureRepository repo = new CreatureRepository())
         {
             return repo.GetByID(resourceID);
         }
     }
     else if (gameResourceType == GameObjectTypeEnum.Item)
     {
         using (ItemRepository repo = new ItemRepository())
         {
             return repo.GetByID(resourceID);
         }
     }
     else if (gameResourceType == GameObjectTypeEnum.Placeable)
     {
         using (PlaceableRepository repo = new PlaceableRepository())
         {
             return repo.GetByID(resourceID);
         }
     }
     else if (gameResourceType == GameObjectTypeEnum.Script)
     {
         using (ScriptRepository repo = new ScriptRepository())
         {
             return repo.GetByID(resourceID);
         }
     }
     else if (gameResourceType == GameObjectTypeEnum.Tileset)
     {
         using (TilesetRepository repo = new TilesetRepository())
         {
             return repo.GetByID(resourceID);
         }
     }
     else
     {
         throw new NotSupportedException();
     }
 }