// AirsListをLeaveAirsListに記録する private static void MemoLeaveList(Fleet friendFleet, AirsList airsList, KammusuList kammusuList, LeaveAirsList leaveAirsList) { for (int i = 0; i < airsList.Count; ++i) { for (int j = 0; j < airsList[i].Count; ++j) { bool allBrokenFlg = true; bool hasPAPBWB = false; for (int k = 0; k < friendFleet.Unit[i].Kammusu[j].SlotCount; ++k) { if (friendFleet.Unit[i].Kammusu[j].Weapon[k].IsStage2) { hasPAPBWB = true; if (airsList[i][j][k] != 0) { allBrokenFlg = false; } } ++leaveAirsList[i][j][k][airsList[i][j][k]]; } if (allBrokenFlg && hasPAPBWB) { ++kammusuList[i][j]; } } } }
// KammusuListとLeaveAirsListをAirsListから作成する private static void MakeLists(AirsList airsList, out KammusuList kammusuList, out LeaveAirsList leaveAirsList) { kammusuList = new KammusuList(); leaveAirsList = new LeaveAirsList(); for (int i = 0; i < airsList.Count; ++i) { var tempList = new List <List <List <int> > >(); kammusuList.Add(Enumerable.Repeat(0, airsList[i].Count).ToList()); for (int j = 0; j < airsList[i].Count; ++j) { var tempList2 = new List <List <int> >(); for (int k = 0; k < airsList[i][j].Count; ++k) { var tempList3 = Enumerable.Repeat(0, airsList[i][j][k] + 1).ToList(); tempList2.Add(tempList3); } tempList.Add(tempList2); } leaveAirsList.Add(tempList); } }
/// <summary> /// コンストラクタ /// </summary> /// <param name="jsonString">JSON文字列</param> public Fleet(string jsonString) { // JSONをパース var obj = DynamicJson.Parse(jsonString); // パース結果を翻訳する var database = DataBaseService.Instance; foreach (var kammusuList in obj) { if (!kammusuList.IsDefined("kammusu")) { continue; } var list = new List <Kammusu>(); foreach (int id in kammusuList.kammusu) { list.Add(database.FindByKammusuId(id, false)); } KammusuList.Add(list); } }