public void SaveSoundSettings()
 {
     GameDataReferences.Instance.backgroundVolume = backgroundSlider.value;
     GameDataReferences.Instance.effectsVolume    = effectsSlider.value;
     GameDataReferences.Instance.qualityIndex     = qualityDropdown.value;
     SaveBinary.SaveGameData(GameDataReferences.Instance);
 }
Ejemplo n.º 2
0
        public void LoadFromFile(string fileName)
        {
            IFormatter formatter  = new BinaryFormatter();
            FileStream fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read);
            SaveBinary sb         = (SaveBinary)formatter.Deserialize(fileStream);

            CopyFrom(sb);
            fileStream.Close();
        }
Ejemplo n.º 3
0
        public void SaveToFile(string fileName)
        {
            IFormatter formatter  = new BinaryFormatter();
            FileStream fileStream = new FileStream(fileName, FileMode.Create, FileAccess.Write);
            SaveBinary sb         = new SaveBinary(this);

            formatter.Serialize(fileStream, sb);
            fileStream.Close();
        }
Ejemplo n.º 4
0
 public void SelectButton()
 {
     GameDataReferences.Instance.carIndex = current;
     GameDataReferences.Instance.player   = cars.cars[current];
     SaveBinary.SaveGameData(GameDataReferences.Instance);
     DestroySequence();
     menu.SetActive(true);
     carSelect.SetActive(false);
 }
    void Start()
    {
        backgroundSource.volume = GameDataReferences.Instance.backgroundVolume;
        foreach (AudioSource auido in effectsSources)
        {
            auido.volume = GameDataReferences.Instance.backgroundVolume;
        }

        backgroundSlider.value = GameDataReferences.Instance.backgroundVolume;
        effectsSlider.value    = GameDataReferences.Instance.effectsVolume;
        qualityDropdown.value  = GameDataReferences.Instance.qualityIndex;

        SaveBinary.LoadGameData(GameDataReferences.Instance);

        /*Debug.Log("Data: \nName:"+ GameDataReferences.Instance.playerName+ "\nQualityIndex:"+GameDataReferences.Instance.qualityIndex+
         *  "\nPlayerIndex:"+GameDataReferences.Instance.carIndex+"\n"+GameDataReferences.Instance.backgroundVolume+"---"+GameDataReferences.Instance.effectsVolume);*/
    }
Ejemplo n.º 6
0
 void CopyFrom(SaveBinary binary)
 {
     foreach (ValueBinary vb in binary.Values)
     {
         if (vb.Type == TValue.Boolean)
         {
             ConversationAPI.SetSaveValue(ImplementPtr, vb.Name, vb.bValue);
         }
         else if (vb.Type == TValue.Int)
         {
             ConversationAPI.SetSaveValue(ImplementPtr, vb.Name, vb.iValue);
         }
         else if (vb.Type == TValue.Float)
         {
             ConversationAPI.SetSaveValue(ImplementPtr, vb.Name, vb.fValue);
         }
     }
 }