Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
andanteyk committed Jun 7, 2020
2 parents 9ea53a3 + a5b368c commit e6aac40
Show file tree
Hide file tree
Showing 49 changed files with 1,558 additions and 649 deletions.
10 changes: 5 additions & 5 deletions ElectronicObserver/App.config
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.0.8.0" newVersion="2.0.8.0"/>
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.8.0" newVersion="2.0.8.0" />
</dependentAssembly>
</assemblyBinding>
<enforceFIPSPolicy enabled="false"/>
<enforceFIPSPolicy enabled="false" />
</runtime>
</configuration>
Binary file modified ElectronicObserver/Assets.zip
Binary file not shown.
Binary file added ElectronicObserver/Assets/Form/FleetPreset.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions ElectronicObserver/Data/Battle/Phase/PhaseBaseAirRaid.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using DynaJson;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
Expand Down Expand Up @@ -27,7 +28,7 @@ private IEnumerable<BattleBaseAirCorpsSquadron> GetSquadrons()

foreach (KeyValuePair<string, dynamic> p in AirBattleData.api_map_squadron_plane)
{
if (!(p.Value is Codeplex.Data.DynamicJson))
if (!(p.Value is JsonObject))
continue;
if (!p.Value.IsArray)
continue;
Expand Down
5 changes: 3 additions & 2 deletions ElectronicObserver/Data/DevelopmentData.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using DynaJson;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
Expand Down Expand Up @@ -92,7 +93,7 @@ public override void LoadFromResponse(string apiname, dynamic data)
void AddToDatabase(dynamic equipmentData)
{
var eq = new EquipmentData();
eq.LoadFromResponse(apiname, Codeplex.Data.DynamicJson.Parse(equipmentData.ToString()));
eq.LoadFromResponse(apiname, JsonObject.Parse(equipmentData.ToString()));
KCDatabase.Instance.Equipments.Add(eq);
}

Expand Down
4 changes: 2 additions & 2 deletions ElectronicObserver/Data/EquipmentData.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Codeplex.Data;
using DynaJson;
using System;
using System.Collections.Generic;
using System.Diagnostics;
Expand Down Expand Up @@ -113,7 +113,7 @@ public override void LoadFromResponse(string apiname, dynamic data)
case "api_get_member/ship3": //存在しないアイテムを追加…すると処理に不都合があるので、ID:1で我慢 一瞬だし無問題(?)
{
int id = data;
data = new DynamicJson();
data = new JsonObject();
data.api_id = id;
data.api_slotitem_id = 1;
data.api_locked = 0;
Expand Down
12 changes: 8 additions & 4 deletions ElectronicObserver/Data/EquipmentDataMaster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,10 @@ public bool IsAntiSubmarineAircraft
EquipmentID == 226 || // 九五式爆雷
EquipmentID == 227; // 二式爆雷

/// <summary> 爆雷投射機かどうか(爆雷は含まない) </summary>
public bool IsDepthChargeProjector => CategoryType == EquipmentTypes.DepthCharge && !IsDepthCharge;
/// <summary> 爆雷投射機かどうか(爆雷/対潜迫撃砲は含まない) </summary>
public bool IsDepthChargeProjector =>
EquipmentID == 44 || // 九四式爆雷投射機
EquipmentID == 45; // 三式爆雷投射機


/// <summary> 夜間作戦航空要員かどうか </summary>
Expand All @@ -357,9 +359,11 @@ public bool IsAntiSubmarineAircraft
public bool IsHightAltitudeFighter =>
EquipmentID == 350 || // Me163B
EquipmentID == 351 || // 試製 秋水
EquipmentID == 352; // 秋水

EquipmentID == 352; // 秋水

/// <summary> 対空噴進弾幕が発動可能なロケットランチャーかどうか </summary>
public bool IsAARocketLauncher =>
EquipmentID == 274;



Expand Down
20 changes: 12 additions & 8 deletions ElectronicObserver/Data/FleetData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -530,17 +530,21 @@ public bool CanAnchorageRepair
get
{
// 流石に資源チェックまではしない
var flagship = KCDatabase.Instance.Ships[_members[0]];

return IsFlagshipRepairShip &&
flagship.HPRate > 0.5 &&
flagship.RepairingDockID == -1 &&
ExpeditionState == 0 &&
MembersInstance.Take(2 + flagship.SlotInstance.Count(eq => eq != null && eq.MasterEquipment.CategoryType == EquipmentTypes.RepairFacility))
.Any(ship => ship != null && 0.5 < ship.HPRate && ship.HPRate < 1.0 && ship.RepairingDockID == -1);
return CanAnchorageRepairWithMember(MembersInstance);
}
}

public static bool CanAnchorageRepairWithMember(IEnumerable<ShipData> membersInstance)
{
var flagship = membersInstance.FirstOrDefault();
return flagship?.MasterShip?.ShipType == ShipTypes.RepairShip &&
flagship.HPRate > 0.5 &&
flagship.RepairingDockID == -1 &&
membersInstance.All(s => s == null || (KCDatabase.Instance.Fleet[s.Fleet]?.ExpeditionState ?? 0) == 0) &&
membersInstance.Take(2 + flagship.SlotInstance.Count(eq => eq?.MasterEquipment?.CategoryType == EquipmentTypes.RepairFacility))
.Any(ship => ship?.RepairingDockID == -1 && 0.5 < ship.HPRate && ship.HPRate < 1.0);
}


/// <summary>
/// 疲労が回復すると予測される日時 (疲労していない場合は null)
Expand Down
31 changes: 31 additions & 0 deletions ElectronicObserver/Data/FleetPresetData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ElectronicObserver.Data
{
public class FleetPresetData : APIWrapper, IIdentifiable
{
public int PresetID => (int)RawData.api_preset_no;

public string Name => RawData.api_name;

private int[] _members;
public ReadOnlyCollection<int> Members => Array.AsReadOnly(_members);

public IEnumerable<ShipData> MembersInstance => Members.Select(id => KCDatabase.Instance.Ships[id]);


public override void LoadFromResponse(string apiname, dynamic data)
{
_members = (int[])data.api_ship;
base.LoadFromResponse(apiname, (object)data);
}


public int ID => PresetID;
}
}
81 changes: 81 additions & 0 deletions ElectronicObserver/Data/FleetPresetManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ElectronicObserver.Data
{
public class FleetPresetManager : APIWrapper
{
public IDDictionary<FleetPresetData> Presets { get; private set; }

public int MaximumCount { get; private set; }


public event Action PresetChanged;


public FleetPresetManager()
{
Presets = new IDDictionary<FleetPresetData>();
}


public override void LoadFromRequest(string apiname, Dictionary<string, string> data)
{
switch (apiname)
{
case "api_req_hensei/preset_delete":
Presets.Remove(int.Parse(data["api_preset_no"]));
PresetChanged();
break;
}
}

public override void LoadFromResponse(string apiname, dynamic data)
{
switch (apiname)
{
case "api_get_member/preset_deck":
{
MaximumCount = (int)data.api_max_num;

Presets.Clear();

foreach (KeyValuePair<string, dynamic> elem in data.api_deck)
{
var preset = new FleetPresetData();
preset.LoadFromResponse(apiname, elem.Value);
Presets.Add(preset);
}
PresetChanged();
}
break;

case "api_req_hensei/preset_register":
{
int id = (int)data.api_preset_no;
if (Presets.ContainsKey(id))
{
Presets[id].LoadFromResponse(apiname, data);
}
else
{
var preset = new FleetPresetData();
preset.LoadFromResponse(apiname, data);
Presets.Add(preset);
}
PresetChanged();
}
break;
}

base.LoadFromResponse(apiname, (object)data);
}


public FleetPresetData this[int index] => Presets[index];

}
}
8 changes: 7 additions & 1 deletion ElectronicObserver/Data/KCDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ public sealed class KCDatabase
/// </summary>
public IDDictionary<RelocationData> RelocatedEquipments { get; private set; }

/// <summary>
/// 艦隊編成プリセットデータ
/// </summary>
public FleetPresetManager FleetPreset { get; private set; }


private KCDatabase()
{

Expand Down Expand Up @@ -186,12 +192,12 @@ private KCDatabase()
ShipGroup = new ShipGroupManager();
BaseAirCorps = new IDDictionary<BaseAirCorpsData>();
RelocatedEquipments = new IDDictionary<RelocationData>();
FleetPreset = new FleetPresetManager();
}


public void Load()
{

{
var temp = (ShipGroupManager)ShipGroup.Load();
if (temp != null)
Expand Down
Loading

0 comments on commit e6aac40

Please sign in to comment.