public bool HasChapterSave(int slot) { if (currentTeamRecord == null) { currentTeamRecord = new ChapterRecordCollection(); } currentTeamRecord.SetIndex(slot); return(currentTeamRecord.Exists()); }
public void NewGameData(int slot) { Clear(); ChapterRecordCollection collect = new ChapterRecordCollection(); collect.Slot = slot; ChapterDef = ResourceManager.GetChapterDef(0); SaveChapterData(slot); LoadChapterData(slot); }
public void LoadChapterData(int slot) { Clear(); players.PlayersLogic.Clear(); ChapterRecordCollection collect = record.LoadChapterFromDisk(slot); LoadChapterDef(collect.CurrentTeam.Chapter); foreach (var v in collect.CurrentTeamPlayerInfo) { players.PlayersLogic.Add(new CharacterLogic(v)); } }
/// <summary> /// 从磁盘载入章节,返回章节数,并实例化ChapterRecord文件,如果没有则返回-1,并让ChapterRecord为null /// </summary> /// <param name="slot">第几个存档</param> /// <returns>当前存档的章节数</returns> public ChapterRecordCollection LoadChapterFromDisk(int slot) { ChapterRecordCollection v = new ChapterRecordCollection(); v.SetIndex(slot); if (HasChapterSave(slot)) { v = v.Load <ChapterRecordCollection>(); } else { Debug.LogError("没有发现可以被载入的存储文件"); OnSaveFileNotExist(); } return(v); }
/// <summary> /// 章节结束保存下数据缓存 /// </summary> /// <param name="AfterStartSequence">是否是开始剧情播放完记录的</param> public void SaveChapter(int slot, int teamIndex, bool AfterStartSequence, int chapterId, Warehouse ware, List <CharacterInfo> infos) { //设置存储位置,存储队伍的信息 currentTeamRecord = new ChapterRecordCollection(); currentTeamRecord.Slot = slot; currentTeamRecord.CurrentTeamIndex = teamIndex; //设置队伍数据 ChapterRecordCollection.TeamCollection teamData = new ChapterRecordCollection.TeamCollection(); teamData.AfterStartSequence = AfterStartSequence; teamData.Chapter = chapterId; teamData.Ware = ware; teamData.PlayersInfo = new PlayerInfoCollection(); foreach (var v in infos) { teamData.PlayersInfo.AddContent(v); } currentTeamRecord.team[teamIndex] = teamData; currentTeamRecord.Save(); }
private void InitData() { AlreadyHadSave = new bool[Buttons.Length]; //设置按钮显示的文字 ChapterRecordDatas = new ChapterRecordCollection[Buttons.Length]; for (int i = 0; i < Buttons.Length; i++) { ChapterRecordDatas[i] = new ChapterRecordCollection(); ChapterRecordDatas[i].SetIndex(i); if (ChapterRecordDatas[i].Exists()) { ChapterRecordDatas[i] = gameMode.ChapterManager.Record.LoadChapterFromDisk(i); Buttons[i].GetComponentInChildren <Text>().text = ResourceManager.GetChapterName(ChapterRecordDatas[i].CurrentTeam.Chapter) + "\n" + ChapterRecordDatas[i].Now; AlreadyHadSave[i] = true; } else { Buttons[i].GetComponentInChildren <Text>().text = "无存档"; AlreadyHadSave[i] = false; } } }