コード例 #1
0
        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();
            }
        }
コード例 #2
0
ファイル: InputHandler.cs プロジェクト: ChadJessup/MICE
        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);
        }
コード例 #3
0
ファイル: InputHandler.cs プロジェクト: ChadJessup/MICE
 public ControllerChangedArgs(INESInput controller, bool wasInserted, ControllerId controllerId)
 {
     this.Controller   = controller;
     this.WasInserted  = wasInserted;
     this.ControllerId = controllerId;
 }
コード例 #4
0
ファイル: InputHandler.cs プロジェクト: ChadJessup/MICE
 public void SetController2(INESInput input) => this.SetController(input, ControllerId.Controller2);