Exemple #1
0
        /// <summary>
        /// Loads data from files.
        /// </summary>
        protected void LoadData(DataToLoad toLoad, bool reload)
        {
            Log.Info("Loading data...");

            try
            {
                if ((toLoad & DataToLoad.Items) != 0)
                {
                    this.LoadDb(this.Data.ItemDb, "db/items.txt", reload);
                }

                if ((toLoad & DataToLoad.Jobs) != 0)
                {
                    this.LoadDb(this.Data.JobDb, "db/jobs.txt", reload);
                }

                if ((toLoad & DataToLoad.Maps) != 0)
                {
                    this.LoadDb(this.Data.MapDb, "db/maps.txt", reload);
                }

                if ((toLoad & DataToLoad.Monsters) != 0)
                {
                    this.LoadDb(this.Data.MonsterDb, "db/monsters.txt", reload);
                }

                if ((toLoad & DataToLoad.Servers) != 0)
                {
                    this.LoadDb(this.Data.ServerDb, "db/servers.txt", reload);
                }

                if ((toLoad & DataToLoad.Barracks) != 0)
                {
                    this.LoadDb(this.Data.BarrackDb, "db/barracks.txt", reload);
                }

                if ((toLoad & DataToLoad.Skills) != 0)
                {
                    this.LoadDb(this.Data.SkillDb, "db/skills.txt", reload);
                }
            }
            catch (DatabaseErrorException ex)
            {
                Log.Error(ex.ToString());
                CliUtil.Exit(1);
            }
            catch (FileNotFoundException ex)
            {
                Log.Error(ex.Message);
                CliUtil.Exit(1);
            }
            catch (Exception ex)
            {
                Log.Exception(ex, "Error while loading data.");
                CliUtil.Exit(1);
            }
        }
Exemple #2
0
    private void Awake()
    {
        dl  = ServiceLocator.Get <DataLoader>();
        dtl = ServiceLocator.Get <DataToLoad>();


        iSource  = dl.LoadedDataSources[dtl.GetLevelToLoad()];
        jSonData = iSource as JsonDataSource;

        InitializeValues();
    }
Exemple #3
0
    // Use this for initialization
    void Awake()
    {
        dl  = ServiceLocator.Get <DataLoader>();
        dtl = ServiceLocator.Get <DataToLoad>();

        iSource  = dl.LoadedDataSources[dtl.GetLevelToLoad()];
        jSonData = iSource as JsonDataSource;

        InitializeValues();

        source = GetComponent <AudioSource>();

        piecePrefabDict = new Dictionary <PieceType, GameObject>();

        for (int i = 0; i < piecePrefabs.Length; ++i)
        {
            if (!piecePrefabDict.ContainsKey(piecePrefabs[i].type))
            {
                piecePrefabDict.Add(piecePrefabs[i].type, piecePrefabs[i].prefab);
            }
        }

        for (int x = 0; x < xDim; ++x)
        {
            for (int y = 0; y < yDim; ++y)
            {
                GameObject backgroung = Instantiate(backGroundPrefab, GetWorldPosition(x, y) * 9.5f, Quaternion.identity);
                backgroung.transform.parent = transform;
            }
        }

        pieces = new GamePiece [xDim, yDim];

        for (int i = 0; i < initialPieces.Length; i++)
        {
            if (initialPieces[i].x >= 0 && initialPieces[i].x < xDim && initialPieces[i].y >= 0 && initialPieces[i].y < yDim)
            {
                SpawnNewPiece(initialPieces[i].x, initialPieces[i].y, initialPieces[i].type);
            }
        }


        for (int x = 0; x < xDim; ++x)
        {
            for (int y = 0; y < yDim; ++y)
            {
                if (pieces[x, y] == null)
                {
                    SpawnNewPiece(x, y, PieceType.EMPTY);
                }
            }
        }
    }
Exemple #4
0
    private void Awake()
    {
        dl  = ServiceLocator.Get <DataLoader>();
        dtl = ServiceLocator.Get <DataToLoad>();


        iSource  = dl.LoadedDataSources[dtl.GetLevelToLoad()];
        jSonData = iSource as JsonDataSource;

        InitializeValues();

        levelAS    = GetComponent <AudioSource>();
        gamePlayAS = GameObject.Find("GameplayMusic").GetComponent <AudioSource>();
    }
Exemple #5
0
    /// <summary>
    /// Populate the Context from the save file
    /// </summary>
    /// <param name="desiredData">The type of data to load from the save file</param>
    private static void LoadDataFromSaveFile(DataToLoad desiredData)
    {
        // Retrieve all data from the save file
        PlayerData tmpPlayerData = GameStateUtilities.Load();

        // If the curriculum should be loaded...
        if (desiredData == DataToLoad.Curriculum || desiredData == DataToLoad.Everything)
        {
            // Copy the lessons to the Context
            _curriculum = tmpPlayerData.Curriculum;
            // If the user has not created any lessons, create a sample lesson to work with
            if (_curriculum.Lessons.Count == 0)
            {
                _curriculum.CreateSampleLessons();
            }
        }

        // If the game state should be loaded (ie the user is loading a saved game)...
        if (desiredData == DataToLoad.GameState || desiredData == DataToLoad.Everything)
        {
            // PLACEHOLDER: This code has not yet been implimented
        }
    }
Exemple #6
0
        /// <summary>
        /// Loads data from files.
        /// </summary>
        protected void LoadData(DataToLoad toLoad, bool reload)
        {
            Log.Info("Loading data...");

            try
            {
                if ((toLoad & DataToLoad.Items) != 0)
                {
                    this.LoadDb(this.Data.ItemDb, "db/items.txt", reload);
                }

                if ((toLoad & DataToLoad.Jobs) != 0)
                {
                    this.LoadDb(this.Data.JobDb, "db/jobs.txt", reload);
                    this.LoadDb(this.Data.StanceConditionDb, "db/stanceconditions.txt", reload);
                }

                if ((toLoad & DataToLoad.Maps) != 0)
                {
                    this.LoadDb(this.Data.MapDb, "db/maps.txt", reload);
                }

                if ((toLoad & DataToLoad.Monsters) != 0)
                {
                    this.LoadDb(this.Data.MonsterDb, "db/monsters.txt", reload);
                }

                if ((toLoad & DataToLoad.Servers) != 0)
                {
                    this.LoadDb(this.Data.ServerDb, "db/servers.txt", reload);
                }

                if ((toLoad & DataToLoad.Barracks) != 0)
                {
                    this.LoadDb(this.Data.BarrackDb, "db/barracks.txt", reload);
                }

                if ((toLoad & DataToLoad.Shops) != 0)
                {
                    this.LoadDb(this.Data.ShopDb, "db/shops.txt", reload);
                }

                if ((toLoad & DataToLoad.Skills) != 0)
                {
                    this.LoadDb(this.Data.SkillDb, "db/skills.txt", reload);
                    this.LoadDb(this.Data.SkillTreeDb, "db/skilltree.txt", reload);
                    this.LoadDb(this.Data.AbilityDb, "db/abilities.txt", reload);
                    this.LoadDb(this.Data.AbilityTreeDb, "db/abilitytree.txt", reload);
                }

                if ((toLoad & DataToLoad.Exp) != 0)
                {
                    this.LoadDb(this.Data.ExpDb, "db/exp.txt", reload);
                }

                if ((toLoad & DataToLoad.Dialogues) != 0)
                {
                    this.LoadDb(this.Data.DialogDb, "db/dialogues.txt", reload);
                }

                if ((toLoad & DataToLoad.Help) != 0)
                {
                    this.LoadDb(this.Data.HelpDb, "db/help.txt", reload);
                }

                if ((toLoad & DataToLoad.CustomCommands) != 0)
                {
                    this.LoadDb(this.Data.CustomCommandDb, "db/customcommands.txt", reload);
                }

                if ((toLoad & DataToLoad.ChatMacros) != 0)
                {
                    this.LoadDb(this.Data.ChatMacroDb, "db/chatmacros.txt", reload);
                }
            }
            catch (DatabaseErrorException ex)
            {
                Log.Error(ex.ToString());
                CliUtil.Exit(1);
            }
            catch (FileNotFoundException ex)
            {
                Log.Error(ex.Message);
                CliUtil.Exit(1);
            }
            catch (Exception ex)
            {
                Log.Exception(ex, "Error while loading data.");
                CliUtil.Exit(1);
            }
        }
Exemple #7
0
        /// <summary>
        /// Loads data from files.
        /// </summary>
        public void LoadData(DataToLoad toLoad, bool reload)
        {
            Log.Info("Loading data...");

            try
            {
                if ((toLoad & DataToLoad.Items) != 0)
                {
                    this.LoadDb(this.Data.InvBaseIdDb, "db/invbaseids.txt", reload);
                    this.LoadDb(this.Data.ItemDb, "db/items.txt", reload);
                }

                if ((toLoad & DataToLoad.Jobs) != 0)
                {
                    this.LoadDb(this.Data.JobDb, "db/jobs.txt", reload);
                    this.LoadDb(this.Data.StanceConditionDb, "db/stanceconditions.txt", reload);
                }

                if ((toLoad & DataToLoad.Maps) != 0)
                {
                    this.LoadDb(this.Data.MapDb, "db/maps.txt", reload);
                }

                if ((toLoad & DataToLoad.Ground) != 0)
                {
                    this.LoadDb(this.Data.GroundDb, "db/ground.dat", reload);
                }

                if ((toLoad & DataToLoad.Monsters) != 0)
                {
                    this.LoadDb(this.Data.MonsterDb, "db/monsters.txt", reload);
                    this.LoadDb(this.Data.ItemMonsterDb, "db/itemmonsters.txt", reload);
                    this.LoadDb(this.Data.FactionDb, "db/factions.txt", reload);
                }

                if ((toLoad & DataToLoad.Servers) != 0)
                {
                    this.LoadDb(this.Data.ServerDb, "db/servers.txt", reload);
                }

                if ((toLoad & DataToLoad.Barracks) != 0)
                {
                    this.LoadDb(this.Data.BarrackDb, "db/barracks.txt", reload);
                }

                if ((toLoad & DataToLoad.Shops) != 0)
                {
                    this.LoadDb(this.Data.ShopDb, "db/shops.txt", reload);
                }

                if ((toLoad & DataToLoad.Skills) != 0)
                {
                    this.LoadDb(this.Data.SkillDb, "db/skills.txt", reload);
                    this.LoadDb(this.Data.SkillTreeDb, "db/skilltree.txt", reload);
                    this.LoadDb(this.Data.AbilityDb, "db/abilities.txt", reload);
                    this.LoadDb(this.Data.AbilityTreeDb, "db/abilitytree.txt", reload);
                }

                if ((toLoad & DataToLoad.Exp) != 0)
                {
                    this.LoadDb(this.Data.ExpDb, "db/exp.txt", reload);
                }

                if ((toLoad & DataToLoad.Dialogues) != 0)
                {
                    this.LoadDb(this.Data.DialogDb, "db/dialogues.txt", reload);
                }

                if ((toLoad & DataToLoad.Help) != 0)
                {
                    this.LoadDb(this.Data.HelpDb, "db/help.txt", reload);
                }

                if ((toLoad & DataToLoad.CustomCommands) != 0)
                {
                    this.LoadDb(this.Data.CustomCommandDb, "db/customcommands.txt", reload);
                }

                if ((toLoad & DataToLoad.ChatMacros) != 0)
                {
                    this.LoadDb(this.Data.ChatMacroDb, "db/chatmacros.txt", reload);
                }

                if ((toLoad & DataToLoad.Buffs) != 0)
                {
                    this.LoadDb(this.Data.BuffDb, "db/buffs.txt", reload);
                }

                if ((toLoad & DataToLoad.SessionObjects) != 0)
                {
                    this.LoadDb(this.Data.SessionObjectDb, "db/sessionobjects.txt", reload);
                }

                if ((toLoad & DataToLoad.Achievements) != 0)
                {
                    this.LoadDb(this.Data.AchievementDb, "db/achievements.txt", reload);
                    this.LoadDb(this.Data.AchievementPointDb, "db/achievement_points.txt", reload);
                }

                if ((toLoad & DataToLoad.Cooldowns) != 0)
                {
                    this.LoadDb(this.Data.CooldownDb, "db/cooldowns.txt", reload);
                }

                if ((toLoad & DataToLoad.PacketStrings) != 0)
                {
                    this.LoadDb(this.Data.PacketStringDb, "db/packetstrings.txt", reload);
                }
            }
            catch (DatabaseErrorException ex)
            {
                Log.Error(ex.ToString());
                CliUtil.Exit(1);
            }
            catch (FileNotFoundException ex)
            {
                Log.Error(ex.Message);
                CliUtil.Exit(1);
            }
            catch (Exception ex)
            {
                Log.Exception(ex, "Error while loading data.");
                CliUtil.Exit(1);
            }
        }
Exemple #8
0
 private void Awake()
 {
     dl  = ServiceLocator.Get <DataLoader>();
     dtl = ServiceLocator.Get <DataToLoad>();
 }