/// <summary> /// マスターデータを静的変数にセットします /// </summary> /// <param name="exMasterShipCollection"></param> /// <param name="masterStypes"></param> /// <param name="exMasterSlotitems"></param> /// <param name="masterSlotitemEquiptypes"></param> public static void SetMasterData(ExMasterShipCollection exMasterShipCollection, Dictionary<int, ApiMstStype> masterStypes, ExMasterSlotitemCollection exMasterSlotitems, List<ApiMstSlotitemEquiptype> masterSlotitemEquiptypes) { HoppoAlpha.DataLibrary.RawApi.ApiPort.ApiShip.MasterShips = exMasterShipCollection; HoppoAlpha.DataLibrary.RawApi.ApiPort.ApiShip.MasterSTypes = masterStypes; HoppoAlpha.DataLibrary.RawApi.ApiPort.ApiShip.MasterSlotitems = exMasterSlotitems; HoppoAlpha.DataLibrary.RawApi.ApiPort.ApiShip.MasterSlotitemEquipTypes = masterSlotitemEquiptypes; HoppoAlpha.DataLibrary.RawApi.ApiGetMember.SlotItem.MasterSlotitems = exMasterSlotitems; HoppoAlpha.DataLibrary.RawApi.ApiGetMember.SlotItem.MasterSlotitemEquipTypes = masterSlotitemEquiptypes; }
//編成一覧の作成 private static string DisplayFleet(SortieReportShipHashIntegrateMode viewmode, SortieReportFleetHash fleet, ExMasterShipCollection mstship, Dictionary<int, ApiMstStype> mststype, ExMasterSlotitemCollection mstslotitem) { //艦種で表示する場合 if(viewmode.HasFlag(SortieReportShipHashIntegrateMode._ShipType)) { //艦種で集計 Dictionary<int, int> num_stype = new Dictionary<int, int>(); AppendDictionary(num_stype, fleet.Ship1.MasterShipTypeID); AppendDictionary(num_stype, fleet.Ship2.MasterShipTypeID); AppendDictionary(num_stype, fleet.Ship3.MasterShipTypeID); AppendDictionary(num_stype, fleet.Ship4.MasterShipTypeID); AppendDictionary(num_stype, fleet.Ship5.MasterShipTypeID); AppendDictionary(num_stype, fleet.Ship6.MasterShipTypeID); //艦種IDを降順でソートして文字列化したクエリ List<string> query = new List<string>(); foreach(var val in num_stype.OrderByDescending(x => x.Key)) { ApiMstStype dstype; if (val.Key != 0 && mststype.TryGetValue(val.Key, out dstype)) { query.Add(dstype.api_name + val.Value);//例:潜水空母4 } } //返り値 string result = string.Join(" ", query); if (viewmode.HasFlag(SortieReportShipHashIntegrateMode._Descending)) result = result + " (※順不同)"; return result; } //艦で表示する場合 else if(viewmode.HasFlag(SortieReportShipHashIntegrateMode._ShipId)) { int[] mstshipid = new int[] { fleet.Ship1.MasterShipID, fleet.Ship2.MasterShipID, fleet.Ship3.MasterShipID, fleet.Ship4.MasterShipID, fleet.Ship5.MasterShipID, fleet.Ship6.MasterShipID }; List<string> shipnames = new List<string>(); foreach(var x in mstshipid) { ExMasterShip dship; if (mstship.TryGetValue(x, out dship)) shipnames.Add(dship.api_name); } //返り値 string result = string.Join(" ", shipnames); if (viewmode.HasFlag(SortieReportShipHashIntegrateMode._Descending)) result = result + " (※順不同)"; return result; } //装備込みで表示する場合 else if(viewmode.HasFlag(SortieReportShipHashIntegrateMode._Slotitem)) { SortieReportShipHash[] shiphash = new SortieReportShipHash[] { fleet.Ship1, fleet.Ship2, fleet.Ship3, fleet.Ship4, fleet.Ship5, fleet.Ship6 }; StringBuilder sb = new StringBuilder(); foreach(var ship in shiphash) { if(ship.MasterShipID == 0) continue; //装備リスト List<string> slots = new List<string>(); ExMasterSlotitem dslot; if (ship.SlotitemMasterID1 != 0 && mstslotitem.TryGetValue(ship.SlotitemMasterID1, out dslot)) slots.Add(dslot.api_name); if (ship.SlotitemMasterID2 != 0 && mstslotitem.TryGetValue(ship.SlotitemMasterID2, out dslot)) slots.Add(dslot.api_name); if (ship.SlotitemMasterID3 != 0 && mstslotitem.TryGetValue(ship.SlotitemMasterID3, out dslot)) slots.Add(dslot.api_name); if (ship.SlotitemMasterID4 != 0 && mstslotitem.TryGetValue(ship.SlotitemMasterID4, out dslot)) slots.Add(dslot.api_name); if (ship.SlotitemMasterID5 != 0 && mstslotitem.TryGetValue(ship.SlotitemMasterID5, out dslot)) slots.Add(dslot.api_name); if (ship.SlotitemMasterIDEx > 0 && mstslotitem.TryGetValue(ship.SlotitemMasterIDEx, out dslot)) slots.Add(dslot.api_name); //キャラ名 string charaname = "ID" + ship.MasterShipID; ExMasterShip dship; if(mstship.TryGetValue(ship.MasterShipID, out dship)) charaname = dship.api_name; //キャラ名 装備 / 装備 / … string slotstr; if (slots.Count == 0) slotstr = "なし"; else slotstr = string.Join(" / ", slots); sb.AppendLine(charaname + " " + slotstr); } if (viewmode.HasFlag(SortieReportShipHashIntegrateMode._Descending)) sb.AppendLine("(※順不同)"); //返り値 return sb.ToString(); } //どれでもない場合 return null; }
/// <summary> /// UI用のテキスト表示メソッド /// </summary> /// <param name="viewmode">データを統合するモード</param> /// <param name="mstship">艦船マスターデータ</param> /// <param name="mststype">艦種マスターデータ</param> /// <param name="mstslotitem">装備マスターデータ</param> /// <param name="maphash">マップハッシュ</param> /// <returns>UI用の表示テキスト</returns> public string Display(SortieReportShipHashIntegrateMode viewmode, ExMasterShipCollection mstship, Dictionary<int, ApiMstStype> mststype, ExMasterSlotitemCollection mstslotitem, SortieReportMapHash maphash) { //連合艦隊フラグ bool isCombined = this.Deck.FleetCombined.Ship1.MasterShipTypeID != 0; StringBuilder sb = new StringBuilder(); //--マップ sb.AppendFormat("【{0}】", maphash.Display()).AppendLine(); //--編成 sb.AppendLine("☆編成"); //通常艦隊 string fleet = DisplayFleet(viewmode, Deck.Fleet, mstship, mststype, mstslotitem); if (fleet != null) sb.AppendLine(fleet); //連合艦隊 if(isCombined) { fleet = DisplayFleet(viewmode, Deck.FleetCombined, mstship, mststype, mstslotitem); if(fleet != null) { sb.AppendLine(fleet); } } sb.AppendLine(); //--カウンター sb.AppendLine("☆カウンター"); sb.AppendFormat("出撃回数 : {0}", NumSortie).AppendLine(); double bossapproach = (double)NumBossApproached / (double)NumSortie; double bosswin = (double)NumBossDefeated / (double)NumSortie; double boss_s = (double)NumBossSWin / (double)NumSortie; sb.AppendFormat("ボス到達 : {0}({1})\tボス勝利 : {2}({3})", NumBossApproached, bossapproach.ToString("P1"), NumBossDefeated, bosswin.ToString("P1")).AppendLine(); sb.AppendFormat("ボスS勝利 : {0}({1})", NumBossSWin, boss_s.ToString("P1")).AppendLine(); sb.AppendLine(); //--経験値 sb.AppendLine("☆経験値"); sb.AppendLine("旗艦Exp合計 : " + FlagshipExp); sb.AppendLine("艦隊Exp合計 : " + TotalExp); sb.AppendLine("提督Exp合計 : " + PlayerExp); if(isCombined) { sb.AppendLine("連合旗艦Exp合計 : " + CombinedFlagshipExp); sb.AppendLine("連合艦隊Exp合計 : " + CombinedTotalExp); } sb.AppendLine(); //--MVP回数 sb.AppendLine("☆MVP回数"); sb.AppendLine(DisplayMVP(MVPCount)); if(isCombined) sb.AppendLine(DisplayMVP(CombinedMVPCount)); sb.AppendLine(); //--資源 //合計資材 int[] materialTotal = new int[8]; foreach (int i in Enumerable.Range(0, 8)) materialTotal[i] = MaterialEarn[i] + MaterialRepair[i] + MaterialSupply[i]; sb.AppendLine("☆資材"); sb.Append(DisplayMaterial(MaterialEarn, NumSortie, "獲得資材")); sb.Append(DisplayMaterial(MaterialSupply, NumSortie, "補給資材")); sb.Append(DisplayMaterial(MaterialRepair, NumSortie, "入渠資材")); sb.Append(DisplayMaterial(materialTotal, NumSortie, "合計")); sb.AppendLine(); //--時間 sb.AppendLine("☆時間"); sb.AppendLine("【総合】 " + DisplayTime(TimeSortie)); sb.AppendLine("【ボス到達時】 " + DisplayTime(TimeBossApproached)); sb.AppendLine("【ボス勝利時】 " + DisplayTime(TimeBossDefeated)); sb.AppendLine("【ボスS勝利時】" + DisplayTime(TimeBossSWin)); sb.AppendLine("※[最小値, 25%タイル, 中央値, 75%タイル, 最大値 | 平均値]"); return sb.ToString(); }