Exemplo n.º 1
0
    public static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
    {
        Log("MobTypeImporter called");

        foreach (string assetPath in importedAssets)
        {
            Log("MobTypeImporter: " + assetPath);
            if (assetPath.EndsWith("MobTypes.prefab"))
            {
                Log("Found MobTypes Asset: " + assetPath);
                GameObject     assetGameObject = Resources.Load <GameObject>("MobTypes");
                MobTypeManager mobTypeManager  = assetGameObject.GetComponent <MobTypeManager>();

                if (mobTypeManager != null)
                {
                    if (MobTypeImporter.ParseMobTypes(mobTypeManager))
                    {
                        Log("MobTypeImporter: has RoomTemplateManager component!");
                    }
                    else
                    {
                        Debug.LogError("MobTypeImporter: Failed to import room templates");
                    }
                }
                else
                {
                    Debug.LogError("MobTypeImporter: Asset missing RoomTemplateManager component!");
                }

                AssetDatabase.Refresh(ImportAssetOptions.Default);
            }
        }
    }
Exemplo n.º 2
0
        public void InitalizeTables(
            AsyncRPGDataContext dbContext,
            Logger logger)
        {
            // Save the server constants into the DB
            ConfigQueries.InitializeConfig(
                dbContext,
                m_config.APPLICATION_VERSION,
                m_config.APPLICATION_WEB_URL,
                m_config.APPLICATION_DEBUG_WEB_URL,
                m_config.ACCOUNT_CLIENT_URL,
                m_config.WEB_SERVICE_EMAIL_ADDRESS,
                m_config.WEB_SERVICE_EMAIL_HOST,
                m_config.WEB_SERVICE_EMAIL_PORT,
                m_config.WEB_SERVICE_EMAIL_USERNAME,
                m_config.WEB_SERVICE_EMAIL_PASSWORD,
                m_config.DEFAULT_IRC_SERVER,
                m_config.DEFAULT_IRC_PORT);

            // Create test accounts
            AccountQueries.CreateAccountNoEmailVerify(
                dbContext,
                "test",
                AccountQueries.ClientPasswordHash("password"),
                "*****@*****.**",
                DatabaseConstants.OpsLevel.player);
            AccountQueries.CreateAccountNoEmailVerify(
                dbContext,
                "test2",
                AccountQueries.ClientPasswordHash("password"),
                "*****@*****.**",
                DatabaseConstants.OpsLevel.player);

            // Re-import the mob type JSON data into the DB
            {
                MobTypeImporter importer = new MobTypeImporter(logger);

                importer.ParseMobTypes(dbContext, m_config.MOBS_DIRECTORY + "/mob_types.json");
            }

            // Re-import the mob spawn tables JSON data into the DB (dependent on mob types)
            {
                MobSpawnTableImporter importer = new MobSpawnTableImporter(logger);

                importer.ParseMobSpawnTables(dbContext, m_config.MOBS_DIRECTORY + "/mob_spawn_tables.json");
            }

            // Re-import the room template XML into the DB (dependent on mob types and spawn tables)
            // This also does some import processing on the room templates (visibility, nav-mesh, etc).
            {
                RoomTemplateImporter importer = new RoomTemplateImporter(logger);

                importer.ParseRoomTemplates(dbContext, m_config.MAPS_DIRECTORY);
            }
        }