Ejemplo n.º 1
0
    public void Save()
    {
        var player = GameObject.FindGameObjectWithTag("Player");

        if (player != null)
        {
            PlayerData.Position = player.transform.position;
            PlayerData.Rotation = player.transform.rotation;
        }
        saveLoadService.Save(PlayerData);
    }
        public virtual void Init(ModManager modManager, GameManager gameManager)
        {
            this.gameManager = gameManager;
            this.modManager  = modManager;
            modInstallPath   = Path.Combine(Application.persistentDataPath, "Mods");
            Directory.CreateDirectory(modInstallPath);
            modDirectory         = new ModDirectory(modInstallPath, true, false);
            Mod.DefaultDirectory = modDirectory;
            inited = true;
            gameManager.ConsoleWindow.WriteLine($"ModLoader initialized. Path: {modInstallPath}");
            UpdateModList();
            List <string> loadedMods = SaveLoadService.Load <List <string> >("");

            if (loadedMods == null)
            {
                loadedMods = new List <string>();
            }
            List <string> unloadedMods = LoadMods(loadedMods);

            foreach (string um in unloadedMods)
            {
                loadedMods.Remove(um);
            }
            SaveLoadService.Save(modsLoadedFileName, JsonUtility.ToJson(loadedMods));
        }
        public void LoadTest()
        {
            string tmpFilename = Path.GetTempFileName();

            MysteryCreator mysteryCreator1 = new MysteryCreator();

            mysteryCreator1.NumberOfColumns = 7;
            mysteryCreator1.NumberOfRows    = 7;
            mysteryCreator1.NumberOfShips   = 12;
            Mystery mystery1 = mysteryCreator1.Create();

            SaveLoadService.Save(mystery1, tmpFilename);

            MysteryCreator mysteryCreator2 = new MysteryCreator();

            mysteryCreator2.NumberOfColumns = 2;
            mysteryCreator2.NumberOfRows    = 2;
            mysteryCreator2.NumberOfShips   = 1;
            Mystery mystery2 = mysteryCreator2.Create();

            mystery2 = SaveLoadService.Load(mystery2, tmpFilename);
            Assert.IsTrue(mystery2.FieldList.Count == mystery1.FieldList.Count && mystery1.ShipList.Count == mystery2.ShipList.Count);
            if (File.Exists(tmpFilename))
            {
                File.Delete(tmpFilename);
            }
        }
Ejemplo n.º 4
0
 public GuildsDefinition()
 {
     settings   = SaveLoadService.Load <Dictionary <ulong, GuildSettings> >(FILE_NAME);
     reactRoles = SaveLoadService.Load <Dictionary <ulong, Dictionary <string, List <ReactRolesDefinition> > > >(REACTROLES_FILENAME);
     if (settings == null)
     {
         settings = new Dictionary <ulong, GuildSettings>();
         SaveLoadService.Save(FILE_NAME, settings);
     }
     if (reactRoles == null)
     {
         reactRoles = new Dictionary <ulong, Dictionary <string, List <ReactRolesDefinition> > >();
         SaveLoadService.Save(REACTROLES_FILENAME, reactRoles);
     }
 }
        private void SaveVirtualMystery(object parameter)
        {
            try
            {
                SaveFileDialog saveFileDialog = new SaveFileDialog();
                saveFileDialog.FileName   = "export.txt";
                saveFileDialog.DefaultExt = "txt";
                saveFileDialog.Filter     = "txt files (*.txt) | *.txt";

                if (saveFileDialog.ShowDialog() == true)
                {
                    SaveLoadService.Save(Mystery, saveFileDialog.FileName);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Fehler beim Speichern", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        public void SaveTest()
        {
            string tmpFilename = Path.GetTempFileName();

            MysteryCreator mysteryCreator = new MysteryCreator();

            mysteryCreator.NumberOfColumns = 7;
            mysteryCreator.NumberOfRows    = 7;
            mysteryCreator.NumberOfShips   = 12;
            Mystery mystery = mysteryCreator.Create();

            SaveLoadService.Save(mystery, tmpFilename);

            if (File.Exists(tmpFilename))
            {
                Assert.IsTrue(true);
                File.Delete(tmpFilename);
            }
            else
            {
                Assert.IsTrue(false);
            }
        }
Ejemplo n.º 7
0
        public void OnButtonClicked(ConsoleKeyInfo button)
        {
            _hasMoved = true;
            if (IsError)
            {
                StopGameFunctionalities();
                return;
            }
            switch (button.Key)
            {
            case ConsoleKey.Escape:
                Console.Clear();
                SaveLoadService.Save(PlayerRef);
                GameStop();
                break;

            case ConsoleKey.A:
            case ConsoleKey.LeftArrow:
                if (isAttacking)
                {
                    movement.Attack(-1, 0);
                    isAttacking = false;
                    break;
                }
                movement.Move(-1, 0);
                break;

            case ConsoleKey.D:
            case ConsoleKey.RightArrow:
                if (isAttacking)
                {
                    movement.Attack(1, 0);
                    isAttacking = false;
                    break;
                }
                movement.Move(1, 0);
                break;

            case ConsoleKey.W:
            case ConsoleKey.UpArrow:
                if (isAttacking)
                {
                    movement.Attack(0, -1);
                    isAttacking = false;
                    break;
                }
                movement.Move(0, -1);
                break;

            case ConsoleKey.S:
            case ConsoleKey.DownArrow:
                if (isAttacking)
                {
                    movement.Attack(0, 1);
                    isAttacking = false;
                    break;
                }
                movement.Move(0, 1);
                break;

            case ConsoleKey.Spacebar:
                isAttacking = true;
                Console.Write("\b");
                break;

            case ConsoleKey.O:
                QuestControlActivated?.Invoke(true);
                break;

            case ConsoleKey.P:
                QuestControlActivated?.Invoke(false);
                break;

            default:
                Console.Write("\b");
                break;
            }
        }
Ejemplo n.º 8
0
 public void SaveReactRoles()
 {
     SaveLoadService.Save(REACTROLES_FILENAME, reactRoles, Formatting.Indented);
 }
Ejemplo n.º 9
0
 public void SaveSettings()
 {
     SaveLoadService.Save(FILE_NAME, settings);
 }
 /// <summary>
 /// Saves the choosen character and name in the database
 /// </summary>
 public void SaveIntialInformations()
 {
     saveLoadService.Save(new PlayerData(GetChoosenCharacterID(), playerName.text, true));
 }