using System; using System.Collections.Generic; using System.Linq; using GameCult.Caching; using GameCult.Eve.Surface; using MessagePack; namespace GameCult.Aetheria.State.Verse { [MessagePackObject] public sealed class AetheriaRuntimeInputGestureDocument { [Key(0)] public string Kind { get; set; } = "direct"; [Key(1)] public string[] Controls { get; set; } = Array.Empty(); [Key(2)] public int MaxStepIntervalMs { get; set; } = 650; [Key(3)] public string CompletionControl { get; set; } = ""; } [MessagePackObject] public sealed class AetheriaRuntimeInputBindingDocument { [Key(0)] public string BindingId { get; set; } = ""; [Key(1)] public string ActionId { get; set; } = ""; [Key(2)] public AetheriaRuntimeInputGestureDocument Gesture { get; set; } = new AetheriaRuntimeInputGestureDocument(); [Key(3)] public bool ActionBar { get; set; } } [MessagePackObject] public sealed class AetheriaRuntimeInputActionDocument { [Key(0)] public string ActionId { get; set; } = ""; [Key(1)] public string Label { get; set; } = ""; [Key(2)] public string Operation { get; set; } = ""; [Key(3)] public string Context { get; set; } = "pilot"; [Key(4)] public string Category { get; set; } = "ship"; [Key(5)] public string Availability { get; set; } = "available"; [Key(6)] public string SourceRef { get; set; } = ""; [Key(7)] public Dictionary Payload { get; set; } = new Dictionary(StringComparer.Ordinal); [Key(8)] public AetheriaRuntimeInputValueDocument? InputValue { get; set; } [Key(9)] public string IconRef { get; set; } = ""; [Key(10)] public bool ActionBar { get; set; } } [MessagePackObject] public sealed class AetheriaRuntimeInputValueDocument { [Key(0)] public string Model { get; set; } = ""; [Key(1)] public string PayloadKey { get; set; } = ""; [Key(2)] public string[] PayloadKeys { get; set; } = Array.Empty(); [Key(3)] public double? CurrentValue { get; set; } [Key(4)] public double? MinimumValue { get; set; } [Key(5)] public double? MaximumValue { get; set; } [Key(6)] public double? StepValue { get; set; } [Key(7)] public string Unit { get; set; } = ""; } [MessagePackObject] public sealed class AetheriaRuntimeInputProfileDocument { [Key(0)] public string ProfileId { get; set; } = ""; [Key(1)] public string DeviceClass { get; set; } = ""; [Key(2)] public AetheriaRuntimeInputBindingDocument[] Bindings { get; set; } = Array.Empty(); } [MessagePackObject] public sealed class AetheriaRuntimeInputCapabilityDocument { public const string SchemaId = "gamecult.eve.input_capability.v1"; [Key(0)] public string Schema { get; set; } = SchemaId; [Key(1)] public string ProviderId { get; set; } = AetheriaRuntimeProviderIdentity.ProviderId; [Key(2)] public string CapabilityId { get; set; } = "aetheria.pilot.input"; [Key(3)] public long Version { get; set; } [Key(4)] public AetheriaRuntimeInputActionDocument[] Actions { get; set; } = Array.Empty(); [Key(5)] public AetheriaRuntimeInputProfileDocument[] DefaultProfiles { get; set; } = Array.Empty(); public static AetheriaRuntimeInputCapabilityDocument FromFrame( AetheriaRuntimeDaemonFrameDocument frame, bool includeSimulationClock = false, AetheriaRuntimeCatalogSnapshot? catalog = null) { var run = frame?.Run ?? new AetheriaRuntimeRunCheckpointCommit(); var entity = run.Zones.SelectMany(zone => zone.Entities).FirstOrDefault(candidate => string.Equals(run.EntityRecordKey(run.CurrentZoneIndex, candidate.EntityIndex), run.CurrentEntityKey, StringComparison.Ordinal)); var actions = CoreActions(entity).ToList(); if (includeSimulationClock) { actions.Add(Action("simulation.pause", "Pause", "SetSimulationRate", "simulation", "terminus-clock", ("scalarValue", "0"))); actions.Add(Action("simulation.step", "Advance One Step", "AdvanceSimulationStep", "simulation", "terminus-clock")); actions.Add(Action("simulation.rate.quarter", "Quarter Speed", "SetSimulationRate", "simulation", "terminus-clock", ("scalarValue", "0.25"))); actions.Add(Action("simulation.rate.half", "Half Speed", "SetSimulationRate", "simulation", "terminus-clock", ("scalarValue", "0.5"))); actions.Add(Action("simulation.rate.realtime", "Real Time", "SetSimulationRate", "simulation", "terminus-clock", ("scalarValue", "1"))); actions.Add(Action("simulation.rate.double", "2x Speed", "SetSimulationRate", "simulation", "terminus-clock", ("scalarValue", "2"))); actions.Add(Action("simulation.rate.quadruple", "4x Speed", "SetSimulationRate", "simulation", "terminus-clock", ("scalarValue", "4"))); actions.Add(Action("simulation.rate.eight", "8x Speed", "SetSimulationRate", "simulation", "terminus-clock", ("scalarValue", "8"))); actions.Add(Action("simulation.rate.sixteen", "16x Speed", "SetSimulationRate", "simulation", "terminus-clock", ("scalarValue", "16"))); actions.Add(Action("simulation.rate.thirty-two", "32x Speed", "SetSimulationRate", "simulation", "terminus-clock", ("scalarValue", "32"))); actions.Add(Action("simulation.rate.sixty-four", "64x Speed", "SetSimulationRate", "simulation", "terminus-clock", ("scalarValue", "64"))); actions.Add(Action("simulation.rate.one-twenty-eight", "128x Speed", "SetSimulationRate", "simulation", "terminus-clock", ("scalarValue", "128"))); } if (entity != null) { actions.AddRange((entity.WeaponGroups ?? Array.Empty>()).Select((_, index) => WeaponGroupAction(run, entity, index, catalog))); actions.AddRange(EquipmentBehaviorActions(run, entity, catalog)); actions.AddRange(ConsumableActions(run, entity, catalog)); actions.AddRange(TradeActions(run, entity, catalog)); } return new AetheriaRuntimeInputCapabilityDocument { Version = frame?.FrameId ?? 0, Actions = actions.ToArray(), DefaultProfiles = BuildDefaultProfiles(actions) }; } private static IEnumerable ConsumableActions( AetheriaRuntimeRunCheckpointCommit run, AetheriaRuntimeEntitySnapshotCommit entity, AetheriaRuntimeCatalogSnapshot? catalog) { if (catalog == null) yield break; var cargoItems = (entity.CargoContents ?? Array.Empty()) .SelectMany(bay => bay?.Items ?? Array.Empty()) .Where(slot => slot?.Item != null) .Select(slot => slot.Item) .ToArray(); var activeEffects = (entity.ActiveConsumables ?? Array.Empty()) .Where(effect => effect != null) .ToArray(); var itemKeys = cargoItems.Select(item => item.ItemKey) .Concat(activeEffects.Select(effect => effect.ItemKey)) .Where(itemKey => !string.IsNullOrWhiteSpace(itemKey)) .Distinct(StringComparer.Ordinal); foreach (var itemKey in itemKeys) { var item = catalog.FindItem(itemKey); if (item == null || !string.Equals(item.Category, AetheriaRuntimeItemCategories.Consumable, StringComparison.Ordinal)) continue; var quantity = cargoItems .Where(candidate => string.Equals(candidate.ItemKey, itemKey, StringComparison.Ordinal)) .Sum(candidate => Math.Max(1, candidate.Quantity)); var matchingEffects = activeEffects .Where(effect => string.Equals(effect.ItemKey, itemKey, StringComparison.Ordinal)) .ToArray(); var active = matchingEffects.FirstOrDefault(); var remainingRatio = active == null || active.Duration <= 0 ? 0 : Math.Max(0, Math.Min(1, active.RemainingDuration / active.Duration)); var action = Action( $"cargo.{itemKey}.use", $"Use {item.Name ?? itemKey}", "ActivateConsumable", "consumable", $"{run.CurrentEntityKey}#consumable/{itemKey}", ("itemKey", itemKey), ("quantityRemaining", quantity.ToString(System.Globalization.CultureInfo.InvariantCulture)), ("activeEffectCount", matchingEffects.Length.ToString(System.Globalization.CultureInfo.InvariantCulture)), ("remainingDurationSeconds", (active?.RemainingDuration ?? 0).ToString("R", System.Globalization.CultureInfo.InvariantCulture)), ("durationSeconds", (active?.Duration ?? item.Duration).ToString("R", System.Globalization.CultureInfo.InvariantCulture)), ("fillValue", remainingRatio.ToString("R", System.Globalization.CultureInfo.InvariantCulture)), ("fillModel", "remaining-ratio.v1")); action.Availability = AetheriaRuntimeConsumableSimulation.CanActivate(entity, catalog, itemKey) ? "available" : "unavailable"; action.ActionBar = true; action.IconRef = ActionBarIconRef(item); yield return action; } } private static IEnumerable EquipmentBehaviorActions( AetheriaRuntimeRunCheckpointCommit run, AetheriaRuntimeEntitySnapshotCommit entity, AetheriaRuntimeCatalogSnapshot? catalog) { if (catalog == null) yield break; var states = (entity.BehaviorStates ?? Array.Empty()) .Where(value => value != null && string.Equals(value.OwnerKind, AetheriaRuntimeBehaviorStateProjector.EquipmentOwnerKind, StringComparison.Ordinal)) .ToDictionary(value => (value.OwnerIndex, value.BehaviorIndex)); var online = (entity.EquipmentStates ?? Array.Empty()) .Where(value => value != null).ToDictionary(value => value.EquipmentIndex); var equipment = entity.Equipment ?? Array.Empty(); for (var equipmentIndex = 0; equipmentIndex < equipment.Count; equipmentIndex++) { var installed = equipment[equipmentIndex]?.Item; var item = catalog.FindItem(installed?.ItemKey ?? ""); if (installed == null || item == null) continue; var available = installed.Enabled && installed.Durability > 0.01 && (!online.TryGetValue(equipmentIndex, out var equipmentState) || equipmentState.Online); var payloads = item.BehaviorPayloads ?? Array.Empty(); for (var behaviorIndex = 0; behaviorIndex < payloads.Count; behaviorIndex++) { var payload = payloads[behaviorIndex]; if (payload == null || !states.TryGetValue((equipmentIndex, behaviorIndex), out var state)) continue; var source = $"{run.CurrentEntityKey}#equipment/{equipmentIndex}/behavior/{behaviorIndex}"; var actionId = $"equipment.{equipmentIndex}.behavior.{behaviorIndex}"; if (string.Equals(payload.Kind, "Switch", StringComparison.Ordinal) || string.Equals(payload.Kind, "Trigger", StringComparison.Ordinal)) { var action = Action( actionId, $"{(payload.Kind == "Trigger" ? "Trigger" : "Activate")} {item.Name}", "SetBehaviorActive", "equipment", source, ("equipmentIndex", equipmentIndex.ToString()), ("behaviorIndex", behaviorIndex.ToString()), ("active", "0"), ("currentValue", state.SwitchActivated ? "1" : "0")); action.Availability = available ? "available" : "unavailable"; action.ActionBar = true; action.IconRef = ActionBarIconRef(item); action.InputValue = new AetheriaRuntimeInputValueDocument { Model = "button-hold.v1", PayloadKey = "active" }; yield return action; continue; } if (!string.Equals(payload.Kind, "Thermotoggle", StringComparison.Ordinal) || !ReadBool(payload, 3)) continue; var thermostat = Action( actionId, $"Set {item.Name} Target Temperature", "SetThermotoggleTargetTemperature", "equipment", source, ("targetEntityKey", run.CurrentEntityKey), ("equipmentIndex", equipmentIndex.ToString()), ("behaviorIndex", behaviorIndex.ToString()), ("scalarValue", state.ThermotoggleTargetTemperature.ToString("R", System.Globalization.CultureInfo.InvariantCulture))); thermostat.Availability = available ? "available" : "unavailable"; thermostat.ActionBar = true; thermostat.IconRef = ActionBarIconRef(item); thermostat.InputValue = new AetheriaRuntimeInputValueDocument { Model = "scalar.v1", PayloadKey = "scalarValue", CurrentValue = state.ThermotoggleTargetTemperature, Unit = "kelvin" }; yield return thermostat; } } } private static AetheriaRuntimeInputActionDocument WeaponGroupAction( AetheriaRuntimeRunCheckpointCommit run, AetheriaRuntimeEntitySnapshotCommit entity, int weaponGroup, AetheriaRuntimeCatalogSnapshot? catalog) { var activeGroups = entity.ActiveWeaponGroups ?? Array.Empty(); var active = weaponGroup < activeGroups.Count && activeGroups[weaponGroup]; var action = Action( $"weapon-group.{weaponGroup}.fire", $"Fire Weapon Group {weaponGroup + 1}", "SetWeaponGroupActive", "weapon-group", $"{run.CurrentEntityKey}#weapon-group/{weaponGroup}", ("weaponGroup", weaponGroup.ToString()), ("active", "0"), ("currentValue", active ? "1" : "0")); action.InputValue = new AetheriaRuntimeInputValueDocument { Model = "button-hold.v1", PayloadKey = "active" }; action.ActionBar = true; var equipmentIndex = (entity.WeaponGroups ?? Array.Empty>()) .ElementAtOrDefault(weaponGroup)?.Where(index => index >= 0).DefaultIfEmpty(-1).First() ?? -1; var equipment = entity.Equipment ?? Array.Empty(); if (equipmentIndex >= 0 && equipmentIndex < equipment.Count) action.IconRef = ActionBarIconRef(catalog?.FindItem(equipment[equipmentIndex]?.Item?.ItemKey ?? "")); return action; } private static string ActionBarIconRef(AetheriaRuntimeCatalogItem? item) => item != null && !string.IsNullOrWhiteSpace(item.ActionBarIcon) ? $"item.{item.ItemKey}.icon" : ""; private static bool ReadBool(AetheriaRuntimeBehaviorPayload payload, int key) => (payload.Fields ?? Array.Empty()) .FirstOrDefault(field => field != null && field.Key == key)?.Value?.BoolValue ?? false; private static IEnumerable TradeActions( AetheriaRuntimeRunCheckpointCommit run, AetheriaRuntimeEntitySnapshotCommit entity, AetheriaRuntimeCatalogSnapshot? catalog) { if (catalog == null) yield break; var zone = (run.Zones ?? Array.Empty()) .FirstOrDefault(candidate => candidate != null && candidate.ZoneIndex == run.CurrentZoneIndex); var parent = (zone?.Entities ?? Array.Empty()) .FirstOrDefault(candidate => candidate != null && (candidate.DockingBayAssignments ?? Array.Empty()).Contains(entity.EntityIndex)); if (parent == null) yield break; var stationKey = AetheriaRuntimeRunCheckpointCommit.EntityRecordKey( run.RunId, run.CurrentZoneIndex, parent.EntityIndex); var cargo = parent.CargoContents ?? Array.Empty(); for (var bayIndex = 0; bayIndex < cargo.Count; bayIndex++) { foreach (var slot in cargo[bayIndex]?.Items ?? Array.Empty()) { var itemKey = slot?.Item?.ItemKey ?? ""; var typedItem = catalog.FindItem(itemKey); if (typedItem == null || slot?.Item == null || slot.Item.Quantity <= 0) continue; var value = AetheriaRuntimeDaemonTradeItemQueries.TradeItemValue( typedItem, slot.Item, catalog.TradeValueSettings).Price; var createsShip = !string.IsNullOrWhiteSpace(typedItem.HullType); var canReceive = createsShip ? (parent.DockingBayAssignments ?? Array.Empty()).Any(index => index < 0) : AetheriaRuntimeCargoCapacityQueries.UnitsThatFit(entity, catalog, itemKey, 0) > 0; var action = Action( $"trade.buy.{StableToken(itemKey)}.{bayIndex}.{slot.X}.{slot.Y}", $"Buy {typedItem.Name} ({value})", "TradePurchase", "trade", $"{stationKey}#cargo/{bayIndex}/{slot.X}/{slot.Y}", ("itemKey", itemKey), ("quantity", "1"), ("stationEntityKey", stationKey), ("stationCargoIndex", bayIndex.ToString()), ("targetEntityKey", run.CurrentEntityKey), ("targetCargoIndex", "0"), ("sourceX", slot.X.ToString()), ("sourceY", slot.Y.ToString())); action.Availability = value >= 0 && run.Credits >= value && canReceive ? "available" : "unavailable"; yield return action; } } var sellerCargo = entity.CargoContents ?? Array.Empty(); for (var bayIndex = 0; bayIndex < sellerCargo.Count; bayIndex++) { foreach (var slot in sellerCargo[bayIndex]?.Items ?? Array.Empty()) { var itemKey = slot?.Item?.ItemKey ?? ""; var typedItem = catalog.FindItem(itemKey); if (typedItem == null || slot?.Item == null || slot.Item.Quantity <= 0) continue; var value = AetheriaRuntimeDaemonTradeItemQueries.TradeItemValue( typedItem, slot.Item, catalog.TradeValueSettings).Price; var stationCanReceive = Enumerable.Range(0, parent.CargoBays?.Count ?? 0) .Any(stationBayIndex => stationBayIndex < (parent.CargoContents?.Count ?? 0) && AetheriaRuntimeCargoCapacityQueries.UnitsThatFit( parent, catalog, itemKey, stationBayIndex) > 0); var action = Action( $"trade.sell.{StableToken(itemKey)}.{bayIndex}.{slot.X}.{slot.Y}", $"Sell {typedItem.Name} (+{value})", "TradeSale", "trade", $"{run.CurrentEntityKey}#cargo/{bayIndex}/{slot.X}/{slot.Y}", ("itemKey", itemKey), ("quantity", "1"), ("sourceCargoIndex", bayIndex.ToString()), ("sourceX", slot.X.ToString()), ("sourceY", slot.Y.ToString())); action.Availability = value >= 0 && stationCanReceive ? "available" : "unavailable"; yield return action; } } } private static string StableToken(string value) => new string((value ?? "").Select(character => char.IsLetterOrDigit(character) ? char.ToLowerInvariant(character) : '-').ToArray()).Trim('-'); private static IEnumerable CoreActions( AetheriaRuntimeEntitySnapshotCommit? entity) { var scoop = Action("pilot.scoop", "Scoop", "SetTractorPower", "ship", "pilot", ("scalarValue", "0")); scoop.InputValue = new AetheriaRuntimeInputValueDocument { Model = "button-hold.v1", PayloadKey = "scalarValue" }; yield return scoop; yield return Action("pilot.interact", "Interact", "Interact", "ship", "pilot"); yield return Action("pilot.dock", "Dock", "DockNearest", "ship", "pilot"); yield return Action("pilot.undock", "Undock", "Undock", "ship", "pilot"); var visibleHostileCount = (entity?.Contacts ?? Array.Empty()) .Count(contact => contact != null && contact.Visible && contact.Hostile); var currentTarget = entity?.TargetEntityIndex ?? -1; yield return TargetAction("pilot.target-nearest", "Target Nearest", "TargetNearest", visibleHostileCount > 0, currentTarget, visibleHostileCount); yield return TargetAction("pilot.target-previous", "Target Previous", "TargetPrevious", visibleHostileCount > 0, currentTarget, visibleHostileCount); yield return TargetAction("pilot.target-next", "Target Next", "TargetNext", visibleHostileCount > 0, currentTarget, visibleHostileCount); var reticle = TargetAction("pilot.target-reticle", "Target Reticle", "TargetReticle", visibleHostileCount > 0, currentTarget, visibleHostileCount); reticle.InputValue = new AetheriaRuntimeInputValueDocument { Model = "view-direction.v1", PayloadKeys = new[] { "directionX", "directionY", "directionZ" } }; yield return reticle; yield return TargetAction("pilot.target-clear", "Clear Target", "ClearTarget", currentTarget >= 0, currentTarget, visibleHostileCount); } private static AetheriaRuntimeInputActionDocument TargetAction( string id, string label, string operation, bool available, int currentTarget, int visibleHostileCount) { var action = Action( id, label, operation, "targeting", "pilot", ("currentTargetEntityIndex", currentTarget.ToString(System.Globalization.CultureInfo.InvariantCulture)), ("visibleHostileCount", visibleHostileCount.ToString(System.Globalization.CultureInfo.InvariantCulture))); action.Availability = available ? "available" : "unavailable"; return action; } private static AetheriaRuntimeInputActionDocument Action(string id, string label, string operation, string category, string source, params (string Key, string Value)[] payload) => new AetheriaRuntimeInputActionDocument { ActionId = id, Label = label, Operation = "aetheria.daemon.commands." + operation, Category = category, SourceRef = source, Payload = payload.ToDictionary(entry => entry.Key, entry => entry.Value, StringComparer.Ordinal) }; private static AetheriaRuntimeInputProfileDocument[] BuildDefaultProfiles(IReadOnlyCollection actions) { return new[] { Profile("keyboard-mouse", "keyboard-mouse", DefaultBindings(actions, "mouse.primary", "gamepad.rightTrigger", keyboard: true)), Profile("gamepad", "gamepad", DefaultBindings(actions, "mouse.primary", "gamepad.rightTrigger", keyboard: false)) }; } private static AetheriaRuntimeInputBindingDocument[] DefaultBindings( IReadOnlyCollection actions, string keyboardFireControl, string gamepadFireControl, bool keyboard) { var bindings = new List(); var fire = actions.FirstOrDefault(action => string.Equals(action.Category, "weapon-group", StringComparison.Ordinal)); if (fire != null) bindings.Add(ActionBarBinding("fire.default", fire.ActionId, "direct", keyboard ? keyboardFireControl : gamepadFireControl)); bindings.Add(keyboard ? Binding("scoop.shift", "pilot.scoop", "direct", "keyboard.leftShift") : Binding("scoop.sequence", "pilot.scoop", "sequence", "gamepad.dpad.down", "gamepad.dpad.right")); bindings.Add(keyboard ? Binding("interact.f", "pilot.interact", "direct", "keyboard.f") : Binding("interact.sequence", "pilot.interact", "sequence", "gamepad.dpad.down", "gamepad.dpad.up")); if (keyboard) { bindings.Add(Binding("target.nearest.t", "pilot.target-nearest", "direct", "keyboard.t")); bindings.Add(Binding("target.previous.y", "pilot.target-previous", "direct", "keyboard.y")); bindings.Add(Binding("target.next.u", "pilot.target-next", "direct", "keyboard.u")); bindings.Add(Binding("target.reticle.r", "pilot.target-reticle", "direct", "keyboard.r")); } if (actions.Any(action => string.Equals(action.ActionId, "simulation.pause", StringComparison.Ordinal))) bindings.Add(keyboard ? Binding("simulation.pause", "simulation.pause", "direct", "keyboard.pause") : Binding("simulation.pause.sequence", "simulation.pause", "sequence", "gamepad.dpad.left", "gamepad.dpad.left")); return bindings.ToArray(); } public EveInputCapabilityDocument ToEveDocument() => new EveInputCapabilityDocument { ProviderId = ProviderId, CapabilityId = CapabilityId, Version = Version, Actions = Actions.Select(action => new EveInputActionDocument { ActionId = action.ActionId, Label = action.Label, Operation = action.Operation, Context = action.Context, Category = action.Category, Availability = action.Availability, SourceRef = action.SourceRef, IconRef = action.IconRef, ActionBar = action.ActionBar, Payload = new Dictionary(action.Payload, StringComparer.Ordinal), InputValue = action.InputValue == null ? null : new EveInputValueDocument { Model = action.InputValue.Model, PayloadKey = action.InputValue.PayloadKey, PayloadKeys = action.InputValue.PayloadKeys ?? Array.Empty(), CurrentValue = action.InputValue.CurrentValue, MinimumValue = action.InputValue.MinimumValue, MaximumValue = action.InputValue.MaximumValue, StepValue = action.InputValue.StepValue, Unit = action.InputValue.Unit } }).ToArray(), DefaultProfiles = DefaultProfiles.Select(profile => new EveInputProfileDocument { ProfileId = profile.ProfileId, DeviceClass = profile.DeviceClass, Bindings = profile.Bindings.Select(binding => new EveInputBindingDocument { BindingId = binding.BindingId, ActionId = binding.ActionId, ActionBar = binding.ActionBar, Gesture = new EveInputGestureDocument { Kind = binding.Gesture.Kind, Controls = binding.Gesture.Controls, MaxStepIntervalMs = binding.Gesture.MaxStepIntervalMs, CompletionControl = binding.Gesture.CompletionControl } }).ToArray() }).ToArray() }; private static AetheriaRuntimeInputProfileDocument Profile(string id, string device, params AetheriaRuntimeInputBindingDocument[] bindings) => new AetheriaRuntimeInputProfileDocument { ProfileId = id, DeviceClass = device, Bindings = bindings }; private static AetheriaRuntimeInputBindingDocument Binding(string id, string action, string kind, params string[] controls) => new AetheriaRuntimeInputBindingDocument { BindingId = id, ActionId = action, Gesture = new AetheriaRuntimeInputGestureDocument { Kind = kind, Controls = controls } }; private static AetheriaRuntimeInputBindingDocument ActionBarBinding(string id, string action, string kind, params string[] controls) => new AetheriaRuntimeInputBindingDocument { BindingId = id, ActionId = action, Gesture = new AetheriaRuntimeInputGestureDocument { Kind = kind, Controls = controls }, ActionBar = true }; } }