-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
49 changed files
with
1,558 additions
and
649 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.