修訂 | fc61c6082feceddd4e23ab85fb3cfcbddb909b59 (tree) |
---|---|
時間 | 2019-12-09 21:13:15 |
作者 | Kazuhiro Fujieda <fujieda@user...> |
Commiter | Kazuhiro Fujieda |
ShipInfoから出撃中の艦隊番号を取れるようにする
@@ -673,15 +673,14 @@ namespace KancolleSniffer | ||
673 | 673 | |
674 | 674 | private void SetCurrentFleet() |
675 | 675 | { |
676 | - var states = Sniffer.Fleets.Select(fleet => fleet.State).ToArray(); | |
677 | - var inSortie = states.Any(state => state >= FleetState.Sortie); | |
678 | - if (_inSortie || !inSortie) | |
676 | + var inSortie = Sniffer.InSortie; | |
677 | + if (_inSortie || inSortie == -1) | |
679 | 678 | { |
680 | - _inSortie = inSortie; | |
679 | + _inSortie = inSortie == -1; | |
681 | 680 | return; |
682 | 681 | } |
683 | 682 | _inSortie = true; |
684 | - if (states[0] == FleetState.Sortie && states[1] == FleetState.Sortie) | |
683 | + if (inSortie == 10) | |
685 | 684 | { |
686 | 685 | _combinedFleet = true; |
687 | 686 | _currentFleet = 0; |
@@ -689,7 +688,7 @@ namespace KancolleSniffer | ||
689 | 688 | else |
690 | 689 | { |
691 | 690 | _combinedFleet = false; |
692 | - _currentFleet = Array.FindIndex(states, state => state >= FleetState.Sortie); | |
691 | + _currentFleet = inSortie; | |
693 | 692 | } |
694 | 693 | } |
695 | 694 |
@@ -12,6 +12,7 @@ | ||
12 | 12 | // See the License for the specific language governing permissions and |
13 | 13 | // limitations under the License. |
14 | 14 | |
15 | +using System; | |
15 | 16 | using System.Collections.Generic; |
16 | 17 | using System.Linq; |
17 | 18 | using KancolleSniffer.Util; |
@@ -383,6 +384,18 @@ namespace KancolleSniffer.Model | ||
383 | 384 | |
384 | 385 | public IReadOnlyList<Fleet> Fleets => _fleets; |
385 | 386 | |
387 | + public int InSortie | |
388 | + { | |
389 | + get | |
390 | + { | |
391 | + var sorties = _fleets.Select(f => f.State >= FleetState.Sortie).ToArray(); | |
392 | + if (sorties[0] && sorties[1]) | |
393 | + return 10; | |
394 | + var idx = Array.FindIndex(sorties, s => s); | |
395 | + return idx; | |
396 | + } | |
397 | + } | |
398 | + | |
386 | 399 | public ShipStatus GetShip(int id) => _shipInventory[id]; |
387 | 400 | |
388 | 401 | public void SetItemHolder() |
@@ -634,6 +634,8 @@ namespace KancolleSniffer | ||
634 | 634 | |
635 | 635 | public IReadOnlyList<Fleet> Fleets => _shipInfo.Fleets; |
636 | 636 | |
637 | + public int InSortie => _shipInfo.InSortie; | |
638 | + | |
637 | 639 | public ShipInfo.ShipStatusPair[] BattleResultStatusDiff => _shipInfo.BattleResultDiff; |
638 | 640 | |
639 | 641 | public bool IsBattleResultError => _shipInfo.IsBattleResultError || _battleInfo.DisplayedResultRank.IsError; |