示例#1
0
        public override void _Ready()
        {
            //Setup Singleton
            singleton = this;

            //Set root node
            root = GetTree().CurrentScene;
            //Log.Message($"root={root.Name}");

            //Info
            Log.Message("Running directory: " + FileSystem.GameDirectory);

            //Load languages
            Log.Message("Loading languages from: " + LanguageDatabase.LanguageDirectory);
            LanguageDatabase.ReloadLanguages();
            foreach (Language language in LanguageDatabase.Languages)
            {
                Log.Message($"Found language: {language.name} with '{language.keyed.Count}' keyed strings.");
            }

            //Load data bindings
            DataBindingDatabase.ReloadDataBindings();

            Log.Message($"Type converters: {XMLTools.TypeConverters.ToString()}");

            //Load settings
            Settings.ReloadSettings();

            //Load scenes
            playScene         = (PackedScene)ResourceLoader.Load("res://Scenes/Play.tscn");
            mainMenuScene     = (PackedScene)ResourceLoader.Load("res://Scenes/MainMenu.tscn");
            settingsMenuScene = (PackedScene)ResourceLoader.Load("res://Scenes/SettingsMenu.tscn");

            //Setup factions
            playerFaction = new Faction()
            {
                name = "Player"
            };
            enemyFaction = new Faction()
            {
                name = "Enemy"
            };
            animalFaction = new Faction()
            {
                name = "Animal"
            };

            enemyFaction.AddEnemy(playerFaction);
            enemyFaction.AddEnemy(animalFaction);

            OpenMainMenu();
        }