private void OnControllerChanged(object sender, ControllerChangedArgs e) { var args = e; switch (args.ControllerId) { case ControllerId.Controller1: this.Controller1 = args.Controller; break; case ControllerId.Controller2: this.Controller2 = args.Controller; break; case ControllerId.Unknown: default: throw new InvalidOperationException(); } }
public void SetController(INESInput input, ControllerId controllerId) { ControllerChangedArgs args; switch (controllerId) { case ControllerId.Controller1: this.Controller1 = input; break; case ControllerId.Controller2: this.Controller2 = input; break; } args = input == null ? new ControllerChangedArgs(null, wasInserted: false, controllerId: controllerId) : new ControllerChangedArgs(input, wasInserted: true, controllerId: controllerId); this.ControllerChanged?.Invoke(this, args); }
public ControllerChangedArgs(INESInput controller, bool wasInserted, ControllerId controllerId) { this.Controller = controller; this.WasInserted = wasInserted; this.ControllerId = controllerId; }
public void SetController2(INESInput input) => this.SetController(input, ControllerId.Controller2);