public override void Enter() { _targetSystem = InputSystem.Game.GetSystem <TargetSystem>(); _targetAttribute = InputSystem.ActiveCard.Card.GetAttribute <ManualTarget>(); _targets = new List <CardView>(); _targetAttribute.Selected = new List <Card>(); var candidates = _targetSystem.GetTargetCandidates(InputSystem.ActiveCard.Card, _targetAttribute.Allowed); _candidateViews = InputSystem.GameView.FindCardViews(candidates); InputSystem.ActiveCard.Highlight(_targetAttribute.RequiredAmount == 0 ? Colors.HasTargets : Colors.NeedsTargets); _candidateViews.Highlight(Colors.IsTargetCandidate); if (_targetAttribute.Allowed.Zones.HasZone(Zones.Deck | Zones.Discard | Zones.Hand)) { // NOTE: We only expect one of the above zones to be targetable at once, bad assumption? var player = _candidateViews.Select(c => c.Card.Owner).Distinct().Single(); var zoneToPreview = _candidateViews.Select(c => c.Card.Zone).Distinct().Single(); if (player.Index != MatchData.LOCAL_PLAYER_INDEX || zoneToPreview != Zones.Hand) { var zoneView = InputSystem.GameView.FindZoneView(player, zoneToPreview); zoneView.GetPreviewSequence(sortOrder: PreviewSortOrder.ByType); _zoneInPreview = zoneView; } } }
public override void Exit() { _targets = null; _candidateViews = null; _targetAttribute = null; _targetSystem = null; if (_zoneInPreview != null) { _zoneInPreview.GetZoneLayoutSequence(); _zoneInPreview = null; } }