Skip to content

Commit

Permalink
add support for only copying locked ships from fleet view
Browse files Browse the repository at this point in the history
  • Loading branch information
myangelkamikaze committed Nov 11, 2023
1 parent 5e3397d commit b7eea9d
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 76 deletions.
24 changes: 12 additions & 12 deletions ElectronicObserver/Properties/Window/FleetResources.en.resx
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,11 @@
<data name="ContextMenuFleet_CopyKanmusuList" xml:space="preserve">
<value>Copy Ship &amp;List (kancolle-calc)</value>
</data>
<data name="ContextMenuFleet_CopyFleetAnalysis" xml:space="preserve">
<value>Copy Ship List (kancolle-&amp;fleetanalysis)</value>
<data name="ContextMenuFleet_CopyFleetAnalysisShips" xml:space="preserve">
<value>Copy Ship List (kancolle-fleetanalysis)</value>
</data>
<data name="ContextMenuFleet_CopyFleetAnalysisLockedEquip" xml:space="preserve">
<value>Copy Locked Equip (kancolle-fleetanalysis)</value>
</data>
<data name="ContextMenuFleet_CopyFleetAnalysisAllEquip" xml:space="preserve">
<value>Copy All Equip (kancolle-fleetanalysis)</value>
<data name="ContextMenuFleet_CopyFleetAnalysisEquipment" xml:space="preserve">
<value>Copy Equipment List (kancolle-fleetanalysis)</value>
</data>
<data name="ContextMenuFleet_AntiAirDetails" xml:space="preserve">
<value>&amp;AA Defense</value>
Expand Down Expand Up @@ -243,11 +240,8 @@ Range: {20} / Speed: {21}
<data name="CopyToFleetAnalysisSpreadsheetShips" xml:space="preserve">
<value>Copy Ship List (fleet analysis spreadsheet)</value>
</data>
<data name="CopyToFleetAnalysisSpreadsheetLockedEquipment" xml:space="preserve">
<value>Copy Locked Equip (fleet analysis spreadsheet)</value>
</data>
<data name="CopyToFleetAnalysisSpreadsheetAllEquipment" xml:space="preserve">
<value>Copy All Equip (fleet analysis spreadsheet)</value>
<data name="CopyToFleetAnalysisSpreadsheetEquipment" xml:space="preserve">
<value>Copy Equipment List (fleet analysis spreadsheet)</value>
</data>
<data name="RightClickToOpenEncyclopedia" xml:space="preserve">
<value>(right click to open encyclopedia)</value>
Expand Down Expand Up @@ -276,4 +270,10 @@ Range: {20} / Speed: {21}
<data name="Flare" xml:space="preserve">
<value>Flare</value>
</data>
<data name="All" xml:space="preserve">
<value>All</value>
</data>
<data name="Locked" xml:space="preserve">
<value>Locked</value>
</data>
</root>
24 changes: 12 additions & 12 deletions ElectronicObserver/Properties/Window/FleetResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,11 @@
<data name="ContextMenuFleet_CopyKanmusuList" xml:space="preserve">
<value>艦隊晒しページへコピー(&amp;R)</value>
</data>
<data name="ContextMenuFleet_CopyFleetAnalysis" xml:space="preserve">
<value>艦隊分析ページへコピー(&amp;F)</value>
<data name="ContextMenuFleet_CopyFleetAnalysisShips" xml:space="preserve">
<value>艦隊分析艦娘へコピー</value>
</data>
<data name="ContextMenuFleet_CopyFleetAnalysisLockedEquip" xml:space="preserve">
<value>艦隊分析ロックされた装備コピー</value>
</data>
<data name="ContextMenuFleet_CopyFleetAnalysisAllEquip" xml:space="preserve">
<value>艦隊分析全装備コピー</value>
<data name="ContextMenuFleet_CopyFleetAnalysisEquipment" xml:space="preserve">
<value>艦隊分析装備へコピー</value>
</data>
<data name="ContextMenuFleet_AntiAirDetails" xml:space="preserve">
<value>対空砲火の詳細表示(&amp;A)</value>
Expand Down Expand Up @@ -243,11 +240,8 @@
<data name="CopyToFleetAnalysisSpreadsheetShips" xml:space="preserve">
<value>艦隊分析スプレッドシート艦娘へコピー</value>
</data>
<data name="CopyToFleetAnalysisSpreadsheetLockedEquipment" xml:space="preserve">
<value>艦隊分析スプレッドシートロックされた装備コピー</value>
</data>
<data name="CopyToFleetAnalysisSpreadsheetAllEquipment" xml:space="preserve">
<value>艦隊分析スプレッドシート全装備コピー</value>
<data name="CopyToFleetAnalysisSpreadsheetEquipment" xml:space="preserve">
<value>艦隊分析スプレッドシート装備へコピー</value>
</data>
<data name="RightClickToOpenEncyclopedia" xml:space="preserve">
<value>(右クリックで図鑑)</value>
Expand Down Expand Up @@ -276,4 +270,10 @@
<data name="Flare" xml:space="preserve">
<value>照明弾</value>
</data>
<data name="All" xml:space="preserve">
<value>全</value>
</data>
<data name="Locked" xml:space="preserve">
<value>ロックされた</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,18 @@ public class FormFleetTranslationViewModel : TranslationBaseViewModel
public string ContextMenuFleet_CopyFleet => FleetResources.ContextMenuFleet_CopyFleet.Replace("_", "__").Replace("&", "_");
public string ContextMenuFleet_CopyFleetDeckBuilder => FleetResources.ContextMenuFleet_CopyFleetDeckBuilder.Replace("_", "__").Replace("&", "_");
public string ContextMenuFleet_CopyKanmusuList => FleetResources.ContextMenuFleet_CopyKanmusuList.Replace("_", "__").Replace("&", "_");
public string ContextMenuFleet_CopyFleetAnalysis => FleetResources.ContextMenuFleet_CopyFleetAnalysis.Replace("_", "__").Replace("&", "_");
public string ContextMenuFleet_CopyFleetAnalysisLockedEquip => FleetResources.ContextMenuFleet_CopyFleetAnalysisLockedEquip.Replace("_", "__").Replace("&", "_");
public string ContextMenuFleet_CopyFleetAnalysisAllEquip => FleetResources.ContextMenuFleet_CopyFleetAnalysisAllEquip.Replace("_", "__").Replace("&", "_");

public string ContextMenuFleet_CopyFleetAnalysisShips => FleetResources.ContextMenuFleet_CopyFleetAnalysisShips;
public string ContextMenuFleet_CopyFleetAnalysisEquipment => FleetResources.ContextMenuFleet_CopyFleetAnalysisEquipment;
public string All => FleetResources.All;
public string Locked => FleetResources.Locked;

public string ContextMenuFleetShipLevel_OpenExpChecker => FleetResources.ContextMenuFleetShipLevel_OpenExpChecker;
public string ContextMenuFleetShipLevel_CreateTrainingPlan => FleetResources.ContextMenuFleetShipLevel_CreateTrainingPlan;
public string ContextMenuFleetShipLevel_EditTrainingPlan => FleetResources.ContextMenuFleetShipLevel_EditTrainingPlan;
public string ContextMenuFleetShipLevel_RemoveTrainingPlan => FleetResources.ContextMenuFleetShipLevel_RemoveTrainingPlan;

public string CopyToFleetAnalysisSpreadsheetShips => FleetResources.CopyToFleetAnalysisSpreadsheetShips;
public string CopyToFleetAnalysisSpreadsheetLockedEquipment => FleetResources.CopyToFleetAnalysisSpreadsheetLockedEquipment;
public string CopyToFleetAnalysisSpreadsheetAllEquipment => FleetResources.CopyToFleetAnalysisSpreadsheetAllEquipment;
public string CopyToFleetAnalysisSpreadsheetEquipment => FleetResources.CopyToFleetAnalysisSpreadsheetEquipment;

public string ContextMenuFleet_AntiAirDetails => FleetResources.ContextMenuFleet_AntiAirDetails.Replace("_", "__").Replace("&", "_");
public string ContextMenuFleet_Capture => FleetResources.ContextMenuFleet_Capture.Replace("_", "__").Replace("&", "_");
Expand Down
50 changes: 32 additions & 18 deletions ElectronicObserver/Window/Wpf/Fleet/FleetView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,25 +91,39 @@
Command="{Binding CopyKanmusuListCommand}"
Header="{Binding FormFleet.ContextMenuFleet_CopyKanmusuList}"
/>
<MenuItem
d:Header="Copy Ship List (kancolle-fleetanalysis)"
Command="{Binding CopyFleetAnalysisCommand}"
Header="{Binding FormFleet.ContextMenuFleet_CopyFleetAnalysis}"
/>
<MenuItem
d:Header="Copy Locked Equip (kancolle-fleetanalysis)"
Command="{Binding CopyFleetAnalysisEquipCommand}"
Header="{Binding FormFleet.ContextMenuFleet_CopyFleetAnalysisLockedEquip}"
/>
<MenuItem
d:Header="Copy All Equip (kancolle-fleetanalysis)"
Command="{Binding CopyFleetAnalysisAllEquipCommand}"
Header="{Binding FormFleet.ContextMenuFleet_CopyFleetAnalysisAllEquip}"
/>
<MenuItem d:Header="Copy Ship List (kancolle-fleetanalysis)" Header="{Binding FormFleet.ContextMenuFleet_CopyFleetAnalysisShips}">
<MenuItem
d:Header="All"
Command="{Binding CopyFleetAnalysisAllShipsCommand}"
Header="{Binding FormFleet.All}"
/>
<MenuItem
d:Header="Locked"
Command="{Binding CopyFleetAnalysisLockedShipsCommand}"
Header="{Binding FormFleet.Locked}"
/>
</MenuItem>
<MenuItem d:Header="Copy Equipment List (kancolle-fleetanalysis)" Header="{Binding FormFleet.ContextMenuFleet_CopyFleetAnalysisEquipment}">
<MenuItem
d:Header="All"
Command="{Binding CopyFleetAnalysisAllEquipCommand}"
Header="{Binding FormFleet.All}"
/>
<MenuItem
d:Header="Locked"
Command="{Binding CopyFleetAnalysisLockedEquipCommand}"
Header="{Binding FormFleet.Locked}"
/>
</MenuItem>
<Separator />
<MenuItem Command="{Binding CopyFleetAnalysisShipsShortCommand}" Header="{Binding FormFleet.CopyToFleetAnalysisSpreadsheetShips}" />
<MenuItem Command="{Binding CopyFleetAnalysisLockedEquipShortCommand}" Header="{Binding FormFleet.CopyToFleetAnalysisSpreadsheetLockedEquipment}" />
<MenuItem Command="{Binding CopyFleetAnalysisAllEquipShortCommand}" Header="{Binding FormFleet.CopyToFleetAnalysisSpreadsheetAllEquipment}" />
<MenuItem Header="{Binding FormFleet.CopyToFleetAnalysisSpreadsheetShips}">
<MenuItem Command="{Binding CopyFleetAnalysisAllShipsShortCommand}" Header="{Binding FormFleet.All}" />
<MenuItem Command="{Binding CopyFleetAnalysisLockedShipsShortCommand}" Header="{Binding FormFleet.Locked}" />
</MenuItem>
<MenuItem Header="{Binding FormFleet.CopyToFleetAnalysisSpreadsheetEquipment}">
<MenuItem Command="{Binding CopyFleetAnalysisAllEquipShortCommand}" Header="{Binding FormFleet.All}" />
<MenuItem Command="{Binding CopyFleetAnalysisLockedEquipShortCommand}" Header="{Binding FormFleet.Locked}" />
</MenuItem>
<Separator />
<MenuItem
d:Header="AA Defense"
Expand Down
68 changes: 40 additions & 28 deletions ElectronicObserver/Window/Wpf/Fleet/FleetViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -492,25 +492,18 @@ private static void CopyKanmusuList()
Clipboard.SetDataObject(sb.ToString());
}

/// <summary>
///
/// <see cref="https://kancolle-fleetanalysis.firebaseapp.com"/>
/// </summary>
[RelayCommand]
private void CopyFleetAnalysis()
private void CopyFleetAnalysisAllShips()
{
string json = DataSerializationService.FleetAnalysisShips(true);

Clipboard.SetDataObject(json);
}

/// <summary>
/// <see cref="https://kancolle-fleetanalysis.firebaseapp.com"/>
/// </summary>
[RelayCommand]
private void CopyFleetAnalysisEquip()
private void CopyFleetAnalysisLockedShips()
{
string json = DataSerializationService.FleetAnalysisEquipment(false);
string json = DataSerializationService.FleetAnalysisShips(false);

Clipboard.SetDataObject(json);
}
Expand All @@ -523,17 +516,48 @@ private void CopyFleetAnalysisAllEquip()
Clipboard.SetDataObject(json);
}

[RelayCommand]
private void CopyFleetAnalysisLockedEquip()
{
string json = DataSerializationService.FleetAnalysisEquipment(false);

Clipboard.SetDataObject(json);
}

[RelayCommand]
private void CopyFleetAnalysisAllShipsShort()
{
GenerateShipListShort(true);
}

[RelayCommand]
private void CopyFleetAnalysisLockedShipsShort()
{
GenerateShipListShort(false);
}

[RelayCommand]
private void CopyFleetAnalysisAllEquipShort()
{
GenerateEquipListShort(true);
}

[RelayCommand]
private void CopyFleetAnalysisLockedEquipShort()
{
GenerateEquipListShort(false);
}

/// <summary>
/// Short versions are for the fleet analysis spreadsheet
/// <see cref="https://docs.google.com/spreadsheets/d/1NuLlff6EXM0XQ_qNHP9lEOosbwHXamaVNJb72M7ZLoY"/>
/// <see cref="https://docs.google.com/spreadsheets/d/1ppbOl9MR_8g_CPDpgMVDdRnhEMRTjg4x78bCg8uLzdg"/>
/// </summary>
[RelayCommand]
private void CopyFleetAnalysisShipsShort()
/// <param name="allShips"></param>
private void GenerateShipListShort(bool allShips)
{
KCDatabase db = KCDatabase.Instance;
List<string> ships = new List<string>();

foreach (ShipData ship in db.Ships.Values.Where(s => s.IsLocked))
foreach (ShipData ship in db.Ships.Values.Where(s => allShips || s.IsLocked))
{
int[] apiKyouka =
{
Expand All @@ -543,7 +567,7 @@ private void CopyFleetAnalysisShipsShort()
ship.ArmorModernized,
ship.LuckModernized,
ship.HPMaxModernized,
ship.ASWModernized
ship.ASWModernized,
};

int expProgress = 0;
Expand All @@ -569,18 +593,6 @@ private void CopyFleetAnalysisShipsShort()
Clipboard.SetDataObject(json);
}

[RelayCommand]
private void CopyFleetAnalysisLockedEquipShort()
{
GenerateEquipListShort(false);
}

[RelayCommand]
private void CopyFleetAnalysisAllEquipShort()
{
GenerateEquipListShort(true);
}

/// <summary>
/// <see cref="https://docs.google.com/spreadsheets/d/1ppbOl9MR_8g_CPDpgMVDdRnhEMRTjg4x78bCg8uLzdg"/>
/// </summary>
Expand Down

0 comments on commit b7eea9d

Please sign in to comment.