protected string GetSelectedSlotFileName()
 {
     if (this.m_SlotIdx >= 0 && this.m_SlotIdx < this.m_Slots.Count)
     {
         SaveGameMenuSlot saveGameMenuSlot = this.m_Slots[this.m_SlotIdx];
         return(((saveGameMenuSlot != null) ? saveGameMenuSlot.m_SaveInfo.file_name : null) ?? this.GetSlotSaveName(this.m_SlotIdx));
     }
     DebugUtils.Assert("Invalid slot idex to load", true, DebugUtils.AssertType.Info);
     return(string.Empty);
 }
 private void FillSlots()
 {
     this.m_Slots.Clear();
     for (int i = 0; i < LoadSaveGameMenuCommon.s_MaxSlots; i++)
     {
         SaveGameMenuSlot component = base.transform.FindDeepChild("Slot" + i.ToString()).GetComponent <SaveGameMenuSlot>();
         DebugUtils.Assert(component, true);
         this.m_Slots.Add(component);
     }
     for (int j = 0; j < LoadSaveGameMenuCommon.s_MaxSlots; j++)
     {
         this.m_Slots[j].SetSaveInfo(SaveGameInfo.ReadSaveSlot(j));
     }
 }
Esempio n. 3
0
 private void FillSlots()
 {
     this.m_Slots.Clear();
     for (int i = 0; i < MenuSaveLoadCommon.s_MaxSlots; i++)
     {
         SaveGameMenuSlot component = base.transform.FindDeepChild("Slot" + i.ToString()).GetComponent <SaveGameMenuSlot>();
         DebugUtils.Assert(component, true);
         this.m_Slots.Add(component);
     }
     for (int j = 0; j < MenuSaveLoadCommon.s_MaxSlots; j++)
     {
         string str  = "Slot" + j.ToString() + ".sav";
         bool   flag = File.Exists(Application.persistentDataPath + "/" + str);
         if (flag)
         {
             BinaryFormatter binaryFormatter = new BinaryFormatter();
             FileStream      fileStream      = File.Open(Application.persistentDataPath + "/" + str, FileMode.Open);
             GameVersion     gameVersion     = new GameVersion((GameVersion)binaryFormatter.Deserialize(fileStream));
             GameMode        gameMode        = (GameMode)binaryFormatter.Deserialize(fileStream);
             long            dateData        = (long)binaryFormatter.Deserialize(fileStream);
             int             num             = (int)binaryFormatter.Deserialize(fileStream) + 1;
             int             num2            = (int)binaryFormatter.Deserialize(fileStream);
             fileStream.Close();
             Localization localization = GreenHellGame.Instance.GetLocalization();
             this.m_Slots[j].m_Header.enabled = true;
             this.m_Slots[j].m_Text.enabled   = true;
             this.m_Slots[j].m_Header.text    = string.Empty;
             this.m_Slots[j].m_Text.text      = string.Empty;
             if (gameMode == GameMode.Story)
             {
                 this.m_Slots[j].m_Header.text = localization.Get("GameMode_Story") + " ";
             }
             else if (gameMode == GameMode.Survival)
             {
                 this.m_Slots[j].m_Header.text = localization.Get("GameMode_Survival") + " ";
             }
             GameDifficulty gameDifficulty = (GameDifficulty)num2;
             if (gameDifficulty != GameDifficulty.Easy)
             {
                 if (gameDifficulty != GameDifficulty.Normal)
                 {
                     if (gameDifficulty == GameDifficulty.Hard)
                     {
                         Text header = this.m_Slots[j].m_Header;
                         header.text += localization.Get("DifficultyLevel_Hard");
                     }
                 }
                 else
                 {
                     Text header2 = this.m_Slots[j].m_Header;
                     header2.text += localization.Get("DifficultyLevel_Normal");
                 }
             }
             else
             {
                 Text header3 = this.m_Slots[j].m_Header;
                 header3.text += localization.Get("DifficultyLevel_Easy");
             }
             Text header4 = this.m_Slots[j].m_Header;
             header4.text += " ";
             Text header5 = this.m_Slots[j].m_Header;
             header5.text += localization.Get("SaveGame_Day");
             Text header6 = this.m_Slots[j].m_Header;
             header6.text += ": ";
             Text header7 = this.m_Slots[j].m_Header;
             header7.text += num.ToString();
             DateTime dateTime = DateTime.FromBinary(dateData);
             this.m_Slots[j].m_Text.text = dateTime.ToString();
             this.m_Slots[j].m_GameMode  = gameMode;
             this.m_Slots[j].m_Empty     = false;
         }
         else
         {
             this.m_Slots[j].m_Header.enabled = true;
             this.m_Slots[j].m_Text.enabled   = false;
             this.m_Slots[j].m_Header.text    = GreenHellGame.Instance.GetLocalization().Get("MenuSaveGameSlotEmpty");
             this.m_Slots[j].m_Empty          = true;
         }
     }
 }