public static BehaviorCommand SetCecInputSwitch(this BehaviorCommand behavior, HdmiSource?hdmiSource, bool enable) { if (behavior == null) { throw new ArgumentNullException(nameof(behavior)); } if (hdmiSource == null || hdmiSource == HdmiSource.Input1) { behavior.Input1 = EnsureExists(behavior.Input1); behavior.Input1.CecInputSwitch = enable ? 1 : 0; } if (hdmiSource == null || hdmiSource == HdmiSource.Input2) { behavior.Input2 = EnsureExists(behavior.Input2); behavior.Input2.CecInputSwitch = enable ? 1 : 0; } if (hdmiSource == null || hdmiSource == HdmiSource.Input3) { behavior.Input3 = EnsureExists(behavior.Input2); behavior.Input3.CecInputSwitch = enable ? 1 : 0; } if (hdmiSource == null || hdmiSource == HdmiSource.Input4) { behavior.Input4 = EnsureExists(behavior.Input4); behavior.Input4.CecInputSwitch = enable ? 1 : 0; } return(behavior); }
public static BehaviorCommand SetInactivePowerSave(this BehaviorCommand behavior, TimeSpan threshold) { if (behavior == null) { throw new ArgumentNullException(nameof(behavior)); } behavior.InactivePowerSave = Convert.ToInt32(threshold.TotalMinutes); return(behavior); }
public static BehaviorCommand SetArcBypass(this BehaviorCommand behavior, bool enable) { if (behavior == null) { throw new ArgumentNullException(nameof(behavior)); } behavior.ArcBypassMode = enable ? 1 : 0; return(behavior); }
public static BehaviorCommand SetDoviNative(this BehaviorCommand behavior, bool enable) { if (behavior == null) { throw new ArgumentNullException(nameof(behavior)); } behavior.ForceDoviNative = enable ? 1 : 0; return(behavior); }
public static BehaviorCommand SetHpdInputSwitch(this BehaviorCommand behavior, bool enable) { if (behavior == null) { throw new ArgumentNullException(nameof(behavior)); } behavior.HpdInputSwitch = enable ? 1 : 0; return(behavior); }
/// <summary> /// Register a behavior command with the event listener /// </summary> /// <param name="command">command string</param> /// <param name="handler">Event handler method</param> public void RegisterCommand(string command, BehaviorCommand handler) { try { // Add the command to the handler list m_commands.Add(command, handler); } catch (Exception e) { Console.WriteLine(e); } }
public async Task ApplyBehaviourCommandAsync(BehaviorCommand command) { if (command == null) { throw new ArgumentNullException(nameof(command)); } CheckInitialized(); var client = await GetHttpClient().ConfigureAwait(false); var response = await client.PutAsync(new Uri($"{_apiBase}/api/v1/behavior"), SerializeRequest(command)).ConfigureAwait(false); await HandleResponseAsync(response); }
private void _ToInjury(BehaviorCommand.Injury injury) { _ChangeStage(() => { var ability = _Entity.FindAbility<IActorPropertyAbility>(); if (ability != null && ability.Injury(injury.Value, Regulus.Utility.Random.Next(20, 40))) { _EntityAct(new Serializable.ActionCommand() { Command = ActionStatue.Injury, Turn = false, Direction = injury.Direction , Speed = 7 , Absolutely = true , Time = LocalTime.Instance.Ticks }); } else _EntityAct(new Serializable.ActionCommand() { Command = ActionStatue.Injury, Turn = true }); var idle = new InjuryToIdleBehaviorHandler(1); var knockout = new KnockoutBehaviorHandler(_Entity); idle.DoneEvent += _ToIdle; knockout.DoneEvent += _ToKnockout; return new IBehaviorHandler[] { knockout, idle }; }); }