public int TotalArchPoint() { return((int)PMath.Sum(ArchList.ConvertAll((string ArchName) => (double)PObject.ListInstance <PArchInfo>().Find((PArchInfo ArchInfo) => ArchInfo.Name.Equals(ArchName)).ArchPoint))); }
public void Read() { string dataDirectory = PPath.GetPath("Data\\User\\user.ric"); StreamReader ArcFileReader = new StreamReader(dataDirectory, Encoding.UTF8); string Line = string.Empty; while ((Line = ArcFileReader.ReadLine()) != null) { if (Line.Length > 0) { string[] LineData = Line.Split(' '); if (LineData.Length > 1) { string Key = LineData[0]; if (Key.Equals("Nickname")) { Nickname = LineData[1]; } else if (Key.Equals("Money")) { Money = Convert.ToInt32(LineData[1]); } else if (Key.Equals("ArchPoint")) { ArchPoint = Convert.ToInt32(LineData[1]); } else if (Key.Equals("ChooseGeneral")) { ChooseGeneral = Convert.ToInt32(LineData[1]); } else if (Key.Equals("Lucky")) { Lucky = Convert.ToInt32(LineData[1]); } else if (Key.Equals("General")) { GeneralList.Add(LineData[1]); } else if (Key.Equals("Record")) { /* * 记录格式: * Record <使用的武将> Win/Lose <模式> <从1号位起的每名武将> */ if (LineData[1].Contains("|")) { RecordList.Add(LineData[1]); } } } } else { break; } } ArcFileReader.Close(); if (ArchPoint < 0) { // 初始化文件 ArchPoint = (int)PMath.Sum(PSystem.ArchManager.ArchList.ConvertAll((string ArchName) => (double)PObject.ListInstance <PArchInfo>().Find((PArchInfo ArchInfo) => ArchInfo.Name.Equals(ArchName)).ArchPoint)); GeneralList = new List <string>() { "廉颇", "潘岳", "杨玉环", "陈圆圆", "王诩", "赵云", "时迁", "张三丰" }; Write(); } }