/// <summary>
 /// Populates the <see cref="_playerTwo"/> and <see cref="_playerOne"/> fields with individual controller mappings.
 /// </summary>
 public void GetControllers()
 {
     _playerOne   = ControllerMapping.FromFile($"{_sourceFolder}\\{PlayerOneFileName}");
     _playerTwo   = ControllerMapping.FromFile($"{_sourceFolder}\\{PlayerTwoFileName}");
     _playerThree = ControllerMapping.FromFile($"{_sourceFolder}\\{PlayerThreeFileName}");
     _playerFour  = ControllerMapping.FromFile($"{_sourceFolder}\\{PlayerFourFileName}");
 }
예제 #2
0
        /// <summary>
        /// Builds mapping of <see cref="ControllerMapping"/> buttons to functions which retrieve
        /// the relevant buttons from a Reloaded <see cref="JoystickButtons"/>.
        /// </summary>
        /// <returns></returns>
        public static Dictionary <ButtonFlags, Func <JoystickButtons, bool> > GetDictionary(ControllerMapping controllerMapping)
        {
            var buttonDictionary = new Dictionary <ButtonFlags, Func <JoystickButtons, bool> >(32);

            buttonDictionary[ButtonFlags.Jump]       = FromControllerButtons(controllerMapping.Jump);
            buttonDictionary[ButtonFlags.Action]     = FromControllerButtons(controllerMapping.Action);
            buttonDictionary[ButtonFlags.FormationR] = FromControllerButtons(controllerMapping.FormationR);
            buttonDictionary[ButtonFlags.FormationL] = FromControllerButtons(controllerMapping.FormationL);

            buttonDictionary[ButtonFlags.DpadUp]    = FromControllerButtons(controllerMapping.DpadUp);
            buttonDictionary[ButtonFlags.DpadDown]  = FromControllerButtons(controllerMapping.DpadDown);
            buttonDictionary[ButtonFlags.DpadLeft]  = FromControllerButtons(controllerMapping.DpadLeft);
            buttonDictionary[ButtonFlags.DpadRight] = FromControllerButtons(controllerMapping.DpadRight);

            buttonDictionary[ButtonFlags.CameraL]   = FromControllerButtons(controllerMapping.CameraL);
            buttonDictionary[ButtonFlags.CameraR]   = FromControllerButtons(controllerMapping.CameraR);
            buttonDictionary[ButtonFlags.TeamBlast] = FromControllerButtons(controllerMapping.TeamBlast);
            buttonDictionary[ButtonFlags.Start]     = FromControllerButtons(controllerMapping.Start);
            return(buttonDictionary);
        }