Пример #1
0
    private void Start()
    {
        Cursor.lockState = CursorLockMode.None;
        Cursor.visible   = true;

        if (GameSaveLoad.IsPlayerDead)
        {
            this.Image.color     = Color.black;
            this.FinalText.color = Color.white;
            this.FinalText.text  = Resources.Various.PlayerDeadText;
        }
        else
        {
            this.Image.color     = Color.white;
            this.FinalText.color = Color.black;
            this.FinalText.text  = Resources.Various.FinalText;
        }

        this.gameObject.FindChildrenByName("EndGameMenu")[0].SetActive(GameSaveLoad.IsPlayerDead == false);
        this.gameObject.FindChildrenByName("PlayerDeadMenu")[0].SetActive(GameSaveLoad.IsPlayerDead);

        if (this.LoadSaveButton)
        {
            this.LoadSaveButton.gameObject.SetActive(GameSaveLoad.IsPlayerDead == true);
            this.LoadSaveButton.GetComponent <Button>().interactable = GameSaveLoad.HasSave();
        }
    }
Пример #2
0
    // Use this for initialization
    void Start()
    {
//		#if UNITY_EDITOR
//		if (workSpace == null) {
//			Debug.LogWarning ("Falta que");
//			Debug.Break ();
//		}
//		#endif

        dataForRead                  = new InfoPartida();
        dataForRead                  = GameSaveLoad.Load(GameSaveLoad._FileLocation + "\\" + GameSaveLoad._PacienteName + "_DataSandwich.xml");
        _nombrePaciente              = dataForRead.nombre;
        _noPartidasJugadasNivel1     = dataForRead.HistorialPartidasNivel1.Count;
        _noPartidasJugadasNivel2     = dataForRead.HistorialPartidasNivel2.Count;
        _noPartidasJugadasNivel3     = dataForRead.HistorialPartidasNivel3.Count;
        nombrePaciente.text          = "Nombre:  " + _nombrePaciente.ToString();
        noPartidasJugadasNivel1.text = "Partidas jugadas del nivel 1:  " + _noPartidasJugadasNivel1.ToString();
        noPartidasJugadasNivel2.text = "Partidas jugadas del nivel 2:  " + _noPartidasJugadasNivel2.ToString();
        noPartidasJugadasNivel3.text = "Partidas jugadas del nivel 3:  " + _noPartidasJugadasNivel3.ToString();
        _fechaPartidaNivel1          = dataForRead.HistorialPartidasNivel1 [_noPartidasJugadasNivel1 - 1].fecha.ToString();
        _fechaPartidaNivel2          = dataForRead.HistorialPartidasNivel2 [_noPartidasJugadasNivel2 - 1].fecha.ToString();
        _fechaPartidaNivel3          = dataForRead.HistorialPartidasNivel3 [_noPartidasJugadasNivel3 - 1].fecha.ToString();
        ComparaFechasEntrePartidas(_fechaPartidaNivel1, _fechaPartidaNivel2, _fechaPartidaNivel3);
        MuestraDatosUltimaPartida();
    }
Пример #3
0
    private void Start()
    {
        this.ProgressInGame.IsPlayerDead = false;

        this.RegisterEvents();

        this.player     = GameObject.FindGameObjectWithTag(Resources.Tags.Player);
        this.shipEngine = GameObject.FindGameObjectWithTag(Resources.Tags.Ship).GetComponent <ShipEngineScript>();
        this.tasks      = GameObject.FindGameObjectWithTag(Resources.Tags.Tasks);
        this.infoText   = GameObject.FindGameObjectWithTag(Resources.Tags.InfoText);
        this.pauseMenu  = GameObject.FindGameObjectWithTag(Resources.Tags.PauseMenu);
        this.pauseMenu.SetActive(false);
        this.repairSlider = GameObject.FindGameObjectWithTag(Resources.Tags.RepairSlider).GetComponent <Slider>();
        this.repairSlider.gameObject.SetActive(false);

        Transform[] baseCommandersSpawnPoints = Array.ConvertAll(GameObject.FindGameObjectsWithTag(Resources.Tags.BaseCommanderSpawnPoint), item => item.transform);
        Transform[] commandersSpawnPoints     = Array.ConvertAll(GameObject.FindGameObjectsWithTag(Resources.Tags.CommanderSpawnPoint), item => item.transform);
        Transform[] soldiersSpawnPoints       = Array.ConvertAll(GameObject.FindGameObjectsWithTag(Resources.Tags.SoldierSpawnPoint), item => item.transform);
        Transform[] workersSpawnPoints        = Array.ConvertAll(GameObject.FindGameObjectsWithTag(Resources.Tags.WorkerSpawnPoint), item => item.transform);
        this.ManageEnemies.SetSpawnPoints(baseCommandersSpawnPoints, commandersSpawnPoints, soldiersSpawnPoints, workersSpawnPoints);

        // load saved game or start new...
        this.ProgressInGame = (GameSaveLoad.LoadSavedGame ? GameSaveLoad.Load() : new GameProgress());

        this.ReadGameProgress(GameSaveLoad.LoadSavedGame);
    }
Пример #4
0
    //Load en Jugador_Interfaz al comenzar el juego
    private void OnTriggerEnter(Collider other) //Guardar
    {
        int n = PartidasControl.Instance.NPartida;

        GameSaveLoad.Save(n, player);
        player.HablarMensaje("Partida ha sido guardada");
    }
Пример #5
0
 /// <summary>
 /// executed when the game is saved
 /// </summary>
 private void OnSaveGame()
 {
     // save current game progress
     GameSaveLoad.Save(this.ProgressInGame);
     // go to main menu
     EventManager.Emit(Resources.Events.GoToMenu);
 }
Пример #6
0
    // Here we deserialize it back into its original form
    public object DeserializeObject(string pXmlizedString)
    {
        XmlSerializer xs            = new XmlSerializer(typeof(RutinaData));
        MemoryStream  memoryStream  = new MemoryStream(GameSaveLoad.StringToUTF8ByteArray(pXmlizedString));
        XmlTextWriter xmlTextWriter = new XmlTextWriter(memoryStream, Encoding.UTF8);

        return(xs.Deserialize(memoryStream));
    }
Пример #7
0
 void Awake()
 {
     EntregaResultado();
     RedondeaSegundos();
     Admin_level0.datos.HistorialPartidasNivel1.Add(AdminMenu.datosNivel1);
     GameSaveLoad.Save(Admin_level0.datos);
     StartCoroutine(GameSaveLoad.IfNewUploadXMLToServer());
 }
Пример #8
0
 void Start()
 {
     numeroDeRepeticiones.text = "No. Repeticiones: " + Admin_level0.datosNivel2.numeroDeRepeticiones;
     numeroDeIngredientes.text = "No. Ingredientes por repetición: " + Admin_level0.datosNivel2.Rutina.Count;
     Admin_level0.datos.HistorialPartidasNivel2.Add(Admin_level0.datosNivel2);
     GameSaveLoad.Save(Admin_level0.datos);
     StartCoroutine(GameSaveLoad.IfNewUploadXMLToServer());
     Admin_level0.datosNivel2.nombreDeRutina = Admin_level0.NombreRutinaTemp;
 }
Пример #9
0
 private void Start()
 {
     foreach (string name in GameSaveLoad.GetNames())
     {
         if (name == GameManager.instance.playerName)
         {
             return;
         }
     }
 }
Пример #10
0
    void EndGameCalculations()
    {
        assessmentCanvas.SetActive(true);
        GameSaveLoad.SaveGame();
        highscoreNames.Add(playerName);
        highscoreTimes.Add(timeTaken);
        highscoreScores.Add(ScoreAssessment.instance.GetTotalScore());

        Invoke("DisplayHighScore", 10.0f);
    }
Пример #11
0
    public static void Load(string dataPath)
    {
        stuffContainer = LoadStuff(dataPath);

        foreach (StuffData data in stuffContainer.stuff)
        {
            GameSaveLoad.CreateStuff(data, GameSaveLoad.stuffPath[data.name], data.pos, Quaternion.identity);
        }

        OnLoaded();
        ClearStuffList();
    }
Пример #12
0
    public void Load()
    {
        GameData data = GameSaveLoad.Load(PartidasControl.Instance.NPartida);

        vida = data.vida;
        baulMateriales.listaObjetos = data.baulObjetos;
        Vector3 pos = new Vector3();

        pos.x = data.playerPos[0];
        pos.y = data.playerPos[1];
        pos.z = data.playerPos[2];
        transform.SetPositionAndRotation(pos, Quaternion.identity);
    }
Пример #13
0
    private void SetupButtonsForLoadingSaves()
    {
        // enable buttons if there is a save
        if (this.LoadSaveButton != null)
        {
            this.LoadSaveButton.GetComponent <Button>().interactable = GameSaveLoad.HasSave();
        }

        if (this.DeleteSaveButton)
        {
            this.DeleteSaveButton.GetComponent <Button>().interactable = GameSaveLoad.HasSave();
        }
    }
Пример #14
0
    public static void Save()
    {
        _saveData = new GameSaveLoad.SaveData();

        foreach (var item in _pathNames)
        {
            var data = StageData[item];
            _saveData.SetData(item + "_Score", data.Score);
            _saveData.SetData(item + "_Accuracy", data.Accuracy);
            _saveData.SetData(item + "_MaxCombo", data.MaxCombo);
        }

        GameSaveLoad.SaveGameFile(SaveDataKey, 0, _saveData);
        Load(_pathNames);
    }
    public void OnClick_SiGuardarCambios()
    {
        BotonesInferior.SetActive(false);
        int n = PartidasControl.Instance.NPartida;

        GameSaveLoad.Save(n, Jugador.GetComponent <Jugador>());
        switch (menuOSalir)
        {
        case 1:
            SceneManager.LoadScene(nombreSceneMenu);
            break;

        case 2:
            Application.Quit();
            break;
        }
    }
Пример #16
0
        public void SaveAndLoad_CorrectGame_SavedAndLoaded()
        {
            Game game = new Game();

            for (int i = 0; i < 1200; i++)
            {
                game.NextTurn();
            }

            string path = @"C:\Users\Tom\Desktop\test save.dat";

            GameSaveLoad.Save(game, path);

            Game loadedGame = GameSaveLoad.Load(path);

            Assert.AreEqual(game.Player.OwnedPlanets, loadedGame.Player.OwnedPlanets);
        }
Пример #17
0
    private void Awake()
    {
        dataPath = System.IO.Path.Combine(Application.dataPath, "stuff.json");

        stuffPath.Add("Box1", "Prefabs/Box1");
        stuffPath.Add("Box2", "Prefabs/Box2");
        stuffPath.Add("Box3", "Prefabs/Box3");
        stuffPath.Add("Platform3x1", "Prefabs/Platform3x1");
        stuffPath.Add("Platform4x1", "Prefabs/Platform4x1");
        stuffPath.Add("Platform5x1", "Prefabs/Platform5x1");
        stuffPath.Add("Platform6x1", "Prefabs/Platform6x1");
        stuffPath.Add("Platform7x1", "Prefabs/Platform7x1");

        if (instance == null)
        {
            instance = this;
        }

        platformGen = platformGen.GetComponent <PlatformGenerator>();
    }
Пример #18
0
 void Awake()
 {
     _repeticiones       = AdminMenu.datosNivel3.numeroDeRepeticiones;
     _cantidadDePan      = 0;
     _cantidadDeJamon    = 0;
     _cantidadDeQueso    = 0;
     _cantidadDeJitomate = 0;
     _erroresPan         = 0;
     _erroresJamon       = 0;
     _erroresQueso       = 0;
     _erroresJitomate    = 0;
     CuentaIngredientesAleatorios();
     CuentaErrores();
     EntregaInformacion();
     EntregaPorcentajeError();
     RedondeoTiempos();
     Admin_level0.datos.HistorialPartidasNivel3.Add(AdminMenu.datosNivel3);
     GameSaveLoad.Save(Admin_level0.datos);
     StartCoroutine(GameSaveLoad.IfNewUploadXMLToServer());
 }
Пример #19
0
    public static void Load(string[] pathNames)
    {
        StageData  = new Dictionary <string, StageData>();
        _saveData  = GameSaveLoad.LoadGameFile(SaveDataKey, 0);
        _pathNames = pathNames;

        foreach (var item in pathNames)
        {
            if (StageData.ContainsKey(item))
            {
                continue;
            }

            var data = new StageData {
                Score    = _saveData.GetIntData(item + "_Score", 0),
                Accuracy = _saveData.GetFloatData(item + "_Accuracy", 0.0f),
                MaxCombo = _saveData.GetIntData(item + "_MaxCombo", 0)
            };

            StageData.Add(item, data);
        }
    }
Пример #20
0
    public void UpdateState(GameState newState)
    {
        state = newState;
        switch (state)
        {
        case GameState.Loading:
            GameSaveLoad.LoadScore();
            break;

        case GameState.Title:
            break;

        case GameState.Test:
            isInitializing = true;
            Invoke("StartTestMode", 2.0f);
            break;

        case GameState.Guided:
            Invoke("StartGuidedMode", 2.0f);
            break;
        }
    }
Пример #21
0
        private static void LoadGameWithIncorrectPath()
        {
            string path = @"C:\test.dat";

            Game loadedGame = GameSaveLoad.Load(path);
        }
Пример #22
0
 public void DeleteSavedGame()
 {
     GameSaveLoad.DeleteSave();
     this.SetupButtonsForLoadingSaves();
 }