Exemplo n.º 1
0
 public ManifestEntry(DirectoryInfo directoryInfo, FileInfo fileInfo, GameObjectTypeEnum gameObjectType,
                      string id, ManifestEntryGroup manifestEntryGroup, string assetBundleName)
 {
     DirectoryInfo      = directoryInfo;
     FileInfo           = fileInfo;
     GameObjectType     = gameObjectType;
     Id                 = id;
     ManifestEntryGroup = manifestEntryGroup;
     AssetBundleName    = assetBundleName;
 }
Exemplo n.º 2
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();
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Returns all objects from the database that have a matching resource category.
        /// </summary>
        /// <param name="resourceCategory">The resource category all return values must match</param>
        /// <param name="resourceType">The type of resource to look for.</param>
        /// <param name="connectionString">If you need to connect to a specific database, use this to pass the connection string. Otherwise, the default connection string will be used (WinterConnectionInformation.ActiveConnectionString)</param>
        /// <returns></returns>
        public List<GameObjectBase> GetAllFromDatabaseByResourceCategory(Category resourceCategory, GameObjectTypeEnum resourceType, string connectionString = "")
        {
            List<GameObjectBase> retList = new List<GameObjectBase>();

            if (resourceType == GameObjectTypeEnum.Area)
            {
                using (AreaRepository repo = new AreaRepository(connectionString))
                {
                    return repo.GetAllByResourceCategory(resourceCategory).ConvertAll(x => (GameObjectBase)x);
                }
            }
            else if (resourceType == GameObjectTypeEnum.Conversation)
            {
                using (ConversationRepository repo = new ConversationRepository(connectionString))
                {
                    return repo.GetAllByResourceCategory(resourceCategory).ConvertAll(x => (GameObjectBase)x);
                }
            }
            else if (resourceType == GameObjectTypeEnum.Creature)
            {
                using (CreatureRepository repo = new CreatureRepository(connectionString))
                {
                    return repo.GetAllByResourceCategory(resourceCategory).ConvertAll(x => (GameObjectBase)x);
                }
            }
            else if (resourceType == GameObjectTypeEnum.Item)
            {
                using (ItemRepository repo = new ItemRepository(connectionString))
                {
                    return repo.GetAllByResourceCategory(resourceCategory).ConvertAll(x => (GameObjectBase)x);
                }
            }
            else if (resourceType == GameObjectTypeEnum.Placeable)
            {
                using (PlaceableRepository repo = new PlaceableRepository(connectionString))
                {
                    return repo.GetAllByResourceCategory(resourceCategory).ConvertAll(x => (GameObjectBase)x);
                }
            }
            else if (resourceType == GameObjectTypeEnum.Script)
            {
                using (ScriptRepository repo = new ScriptRepository(connectionString))
                {
                    return repo.GetAllByResourceCategory(resourceCategory).ConvertAll(x => (GameObjectBase)x);
                }
            }
            else if (resourceType == GameObjectTypeEnum.Tileset)
            {
                using (TilesetRepository repo = new TilesetRepository(connectionString))
                {
                    return repo.GetAllByResourceCategory(resourceCategory).ConvertAll(x => (GameObjectBase)x);
                }
            }
            else
            {
                throw new NotSupportedException();
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Returns True if an object exists in the database.
 /// Returns False if an object does not exist in the database.
 /// </summary>
 /// <param name="resref">The resource reference to search for.</param>
 /// <param name="resourceType">The resource type to look for.</param>
 /// <param name="connectionString">If you need to connect to a specific database, use this to pass the connection string. Otherwise, the default connection string will be used (WinterConnectionInformation.ActiveConnectionString)</param>
 /// <returns></returns>
 public bool DoesObjectExistInDatabase(string resref, GameObjectTypeEnum resourceType, string connectionString = "")
 {
     if (resourceType == GameObjectTypeEnum.Area)
     {
         using (AreaRepository repo = new AreaRepository(connectionString))
         {
             return repo.Exists(resref);
         }
     }
     else if (resourceType == GameObjectTypeEnum.Conversation)
     {
         using (ConversationRepository repo = new ConversationRepository(connectionString))
         {
             return repo.Exists(resref);
         }
     }
     else if (resourceType == GameObjectTypeEnum.Creature)
     {
         using (CreatureRepository repo = new CreatureRepository(connectionString))
         {
             return repo.Exists(resref);
         }
     }
     else if (resourceType == GameObjectTypeEnum.Item)
     {
         using (ItemRepository repo = new ItemRepository(connectionString))
         {
             return repo.Exists(resref);
         }
     }
     else if (resourceType == GameObjectTypeEnum.Placeable)
     {
         using (PlaceableRepository repo = new PlaceableRepository(connectionString))
         {
             return repo.Exists(resref);
         }
     }
     else if (resourceType == GameObjectTypeEnum.Script)
     {
         using (ScriptRepository repo = new ScriptRepository(connectionString))
         {
             return repo.Exists(resref);
         }
     }
     else if (resourceType == GameObjectTypeEnum.Tileset)
     {
         using (TilesetRepository repo = new TilesetRepository(connectionString))
         {
             return repo.Exists(resref);
         }
     }
     else
     {
         throw new NotSupportedException();
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// Delete all objects from database that match a specified resource category.
        /// </summary>
        /// <param name="resourceCategory">The resource category to remove all objects from.</param>
        /// <param name="resourceType">The type of resource to look for.</param>
        /// <param name="connectionString">If you need to connect to a specific database, use this to pass the connection string. Otherwise, the default connection string will be used (WinterConnectionInformation.ActiveConnectionString)</param>
        public void DeleteFromDatabaseByCategory(Category resourceCategory, GameObjectTypeEnum resourceType, string connectionString = "")
        {
            if (resourceType == GameObjectTypeEnum.Area)
            {
                using (AreaRepository repo = new AreaRepository(connectionString))
                {
                    repo.DeleteAllByCategory(resourceCategory);
                }
            }
            else if (resourceType == GameObjectTypeEnum.Conversation)
            {
                using (ConversationRepository repo = new ConversationRepository(connectionString))
                {
                    repo.DeleteAllByCategory(resourceCategory);
                }
            }
            else if (resourceType == GameObjectTypeEnum.Creature)
            {
                using (CreatureRepository repo = new CreatureRepository(connectionString))
                {
                    repo.DeleteAllByCategory(resourceCategory);
                }
            }
            else if (resourceType == GameObjectTypeEnum.Item)
            {
                using (ItemRepository repo = new ItemRepository(connectionString))
                {
                    repo.DeleteAllByCategory(resourceCategory);
                }
            }
            else if (resourceType == GameObjectTypeEnum.Placeable)
            {
                using (PlaceableRepository repo = new PlaceableRepository(connectionString))
                {
                    repo.DeleteAllByCategory(resourceCategory);
                }
            }
            else if (resourceType == GameObjectTypeEnum.Script)
            {
                using (ScriptRepository repo = new ScriptRepository(connectionString))
                {
                    repo.DeleteAllByCategory(resourceCategory);
                }
            }
            else if (resourceType == GameObjectTypeEnum.Tileset)
            {
                using (TilesetRepository repo = new TilesetRepository(connectionString))
                {
                    repo.DeleteAllByCategory(resourceCategory);
                }
            }
            else
            {
                throw new NotSupportedException();
            }

            // Now remove the category itself.
            using (CategoryRepository repo = new CategoryRepository())
            {
                Category dbCategory = repo.GetByID(resourceCategory.ResourceID);
                repo.Delete(dbCategory);
            }
        }
Exemplo n.º 6
0
 /// <summary>
 /// Deletes an object with the specified resref from the database.
 /// </summary>
 /// <param name="resref">The resource reference to search for.</param>
 /// <param name="resourceType">The type of resource to remove.</param>
 /// <param name="connectionString">If you need to connect to a specific database, use this to pass the connection string. Otherwise, the default connection string will be used (WinterConnectionInformation.ActiveConnectionString)</param>
 public void DeleteFromDatabase(int resourceID, GameObjectTypeEnum resourceType, string connectionString = "")
 {
     if (resourceType == GameObjectTypeEnum.Area)
     {
         using (AreaRepository repo = new AreaRepository(connectionString))
         {
             repo.Delete(resourceID);
         }
     }
     else if (resourceType == GameObjectTypeEnum.Conversation)
     {
         using (ConversationRepository repo = new ConversationRepository(connectionString))
         {
             repo.Delete(resourceID);
         }
     }
     else if (resourceType == GameObjectTypeEnum.Creature)
     {
         using (CreatureRepository repo = new CreatureRepository(connectionString))
         {
             repo.Delete(resourceID);
         }
     }
     else if (resourceType == GameObjectTypeEnum.Item)
     {
         using (ItemRepository repo = new ItemRepository(connectionString))
         {
             repo.Delete(resourceID);
         }
     }
     else if (resourceType == GameObjectTypeEnum.Placeable)
     {
         using (PlaceableRepository repo = new PlaceableRepository(connectionString))
         {
             repo.Delete(resourceID);
         }
     }
     else if (resourceType == GameObjectTypeEnum.Script)
     {
         using (ScriptRepository repo = new ScriptRepository(connectionString))
         {
             repo.Delete(resourceID);
         }
     }
     else if (resourceType == GameObjectTypeEnum.Tileset)
     {
         using (TilesetRepository repo = new TilesetRepository(connectionString))
         {
             repo.Delete(resourceID);
         }
     }
     else if (resourceType == GameObjectTypeEnum.GameModule)
     {
         using (GameModuleRepository repo = new GameModuleRepository())
         {
             repo.Delete(resourceID);
         }
     }
     else
     {
         throw new NotSupportedException();
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// Creates and returns a new object of the specified type.
        /// </summary>
        /// <param name="resourceType"></param>
        /// <returns></returns>
        public GameObjectBase CreateObject(GameObjectTypeEnum resourceType, string name, string tag, string resref)
        {
            DefaultObjectIDs defaultIDs;

            using (DefaultObjectRepository repo = new DefaultObjectRepository())
            {
                defaultIDs = repo.GetDefaultObjectIDs();
            }

            switch (resourceType)
            {
                case GameObjectTypeEnum.Area:
                    {
                        return new Area
                        {
                            Name = name,
                            Tag = tag,
                            Resref = resref,
                            GameObjectType = resourceType,
                            ResourceCategoryID = defaultIDs.CategoryAreaID,
                            OnEnterEventScriptID = defaultIDs.ScriptID,
                            OnExitEventScriptID = defaultIDs.ScriptID,
                            OnHeartbeatEventScriptID = defaultIDs.ScriptID,
                            OnUserDefinedEventScriptID = defaultIDs.ScriptID,
                            IsInTreeView = true,
                            GraphicResourceID = defaultIDs.ContentPackageResourceNoneID,
                            TilesetID = defaultIDs.TilesetID
                        };
                    }
                case GameObjectTypeEnum.Conversation:
                    {
                        return new Conversation
                        {
                            Name = name,
                            Tag = tag,
                            Resref = resref,
                            GameObjectType = resourceType,
                            ResourceCategoryID = defaultIDs.CategoryConversationID,
                            IsInTreeView = true,
                            GraphicResourceID = defaultIDs.ContentPackageResourceNoneID

                        };
                    }
                case GameObjectTypeEnum.Creature:
                    {
                        return new Creature
                        {
                            Name = name,
                            Tag = tag,
                            Resref = resref,
                            GameObjectType = resourceType,
                            Constitution = 1,
                            Dexterity = 1,
                            HitPoints = 1,
                            Intelligence = 1,
                            Level = 1,
                            MaxHitPoints = 1,
                            MaxMana = 1,
                            Strength = 1,
                            Wisdom = 1,
                            IsInvulnerable = false,
                            BackItemID = defaultIDs.ItemID,
                            BodyItemID = defaultIDs.ItemID,
                            ConversationID = defaultIDs.ConversationID,
                            EarLeftItemID = defaultIDs.ItemID,
                            EarRightItemID = defaultIDs.ItemID,
                            FactionID = defaultIDs.FactionID,
                            FeetItemID = defaultIDs.ItemID,
                            GenderID = defaultIDs.GenderID,
                            HandsItemID = defaultIDs.ItemID,
                            HeadItemID = defaultIDs.ItemID,
                            LegsItemID = defaultIDs.ItemID,
                            MainHandItemID = defaultIDs.ItemID,
                            NeckItemID = defaultIDs.ItemID,
                            OffHandItemID = defaultIDs.ItemID,
                            OnConversationEventScriptID = defaultIDs.ScriptID,
                            OnDamagedEventScriptID = defaultIDs.ScriptID,
                            OnDeathEventScriptID = defaultIDs.ScriptID,
                            OnHeartbeatEventScriptID = defaultIDs.ScriptID,
                            OnSpawnEventScriptID = defaultIDs.ScriptID,
                            RaceID = defaultIDs.RaceID,
                            ResourceCategoryID = defaultIDs.CategoryCreatureID,
                            RingLeftItemID = defaultIDs.ItemID,
                            RingRightItemID = defaultIDs.ItemID,
                            WaistItemID = defaultIDs.ItemID,
                            IsInTreeView = true,
                            GraphicResourceID = defaultIDs.ContentPackageResourceCharacterID
                        };
                    }
                case GameObjectTypeEnum.Item:
                    {
                        return new Item
                        {
                            Name = name,
                            Tag = tag,
                            Resref = resref,
                            GameObjectType = resourceType,
                            GraphicResourceID = defaultIDs.ContentPackageResourceItemID,
                            OnSpawnEventScriptID = defaultIDs.ScriptID,
                            ResourceCategoryID = defaultIDs.CategoryItemID,
                            IsInTreeView = true
                        };
                    }
                case GameObjectTypeEnum.Placeable:
                    {
                        return new Placeable
                        {
                            Name = name,
                            Tag = tag,
                            Resref = resref,
                            GameObjectType = resourceType,
                            OnCloseEventScriptID = defaultIDs.ScriptID,
                            OnDamagedEventScriptID = defaultIDs.ScriptID,
                            OnDeathEventScriptID = defaultIDs.ScriptID,
                            OnHeartbeatEventScriptID = defaultIDs.ScriptID,
                            OnOpenEventScriptID = defaultIDs.ScriptID,
                            OnSpawnEventScriptID = defaultIDs.ScriptID,
                            OnUsedEventScriptID = defaultIDs.ScriptID,
                            ResourceCategoryID = defaultIDs.CategoryPlaceableID,
                            IsInTreeView = true,
                            GraphicResourceID = defaultIDs.ContentPackageResourcePlaceableID
                        };
                    }
                case GameObjectTypeEnum.Script:
                    {
                        return new Script
                        {
                            Name = name,
                            Tag = tag,
                            Resref = resref,
                            GameObjectType = resourceType,
                            ResourceCategoryID = defaultIDs.CategoryScriptID,
                            IsInTreeView = true,
                            GraphicResourceID = defaultIDs.ContentPackageResourceNoneID
                        };
                    }
                case GameObjectTypeEnum.Tileset:
                    {
                        return new Tileset
                        {
                            Name = name,
                            Tag = tag,
                            Resref = resref,
                            GameObjectType = resourceType,
                            ResourceCategoryID = defaultIDs.CategoryTilesetID,
                            IsInTreeView = true,
                            GraphicResourceID = defaultIDs.ContentPackageResourceTilesetID
                        };
                    }
                case GameObjectTypeEnum.GameModule:
                    {
                        return new GameModule
                        {
                            Name = name,
                            Tag = tag,
                            Resref = resref,
                            GameObjectType = resourceType,
                            GraphicResourceID = defaultIDs.ContentPackageResourceNoneID,
                            IsDefault = true,
                            IsInTreeView = false,
                            IsSystemResource = true,
                            MaxLevel = 99,
                            ResourceCategoryID = defaultIDs.CategoryGameModuleID,
                            OnHeartbeatEventScriptID = defaultIDs.ScriptID,
                            OnModuleLoadEventScriptID = defaultIDs.ScriptID,
                            OnPlayerDeathEventScriptID = defaultIDs.ScriptID,
                            OnPlayerDyingEventScriptID = defaultIDs.ScriptID,
                            OnPlayerEnterEventScriptID = defaultIDs.ScriptID,
                            OnPlayerLeavingEventScriptID = defaultIDs.ScriptID,
                            OnPlayerLeftEventScriptID = defaultIDs.ScriptID,
                            OnPlayerRespawnEventScriptID = defaultIDs.ScriptID
                        };
                    }
                default:
                    throw new Exception("Game object type not supported.");
            }
        }
 public ObjectModeChangedEventArgs(GameObjectTypeEnum gameObjectType)
 {
     this.GameObjectType = gameObjectType;
 }
Exemplo n.º 9
0
        private static void ScrapeStreamingAssetDataSubDirectory(DirectoryInfo directoryInfo,
                                                                 List <ManifestEntry> manifestEntries, GameObjectTypeEnum gameObjectType)
        {
            directoryInfo.GetFiles()
            .ToList().ForEach(fileInfo =>
            {
                manifestEntries.Add(new ManifestEntry(directoryInfo, fileInfo, gameObjectType,
                                                      Path.GetFileNameWithoutExtension(fileInfo.Name), null, null));
            });

            directoryInfo.GetDirectories()
            .ToList().ForEach(info => ScrapeStreamingAssetDataSubDirectory(info, manifestEntries, gameObjectType));
        }