本文整理汇总了C#中ControllerType类的典型用法代码示例。如果您正苦于以下问题:C# ControllerType类的具体用法?C# ControllerType怎么用?C# ControllerType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ControllerType类属于命名空间,在下文中一共展示了ControllerType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveControllerData
/// <summary>
/// Save all data for a specific controller. Does not save Player data.
/// </summary>
/// <param name="controllerType">Controller type</param>
/// <param name="controllerId">Controller id</param>
public override void SaveControllerData(ControllerType controllerType, int controllerId) {
if(!isEnabled) {
Debug.LogWarning("UserDataStore_PlayerPrefs is disabled and will not save any data.", this);
return;
}
SaveControllerDataNow(controllerType, controllerId);
}
示例2: GameSettings
// Construct new GameSettings instance using values loaded from file
public GameSettings(XElement data)
{
_screenWidth = Loader.loadInt(data.Element("ScreenWidth"), 800);
_screenHeight = Loader.loadInt(data.Element("ScreenHeight"), 600);
_fullscreen = Loader.loadBool(data.Element("Fullscreen"), false);
_controllerType = (ControllerType)Loader.loadEnum(typeof(ControllerType), data.Element("ControllerType"), (int)ControllerType.KeyboardAndMouse);
}
示例3:
Boolean IInputManager.actionTapped(InputAction action)
{
if(keyInput.actionTapped(action))
{
lastControllerTapped = ControllerType.Keyboard;
return true;
}
if(padOneInput.actionTapped(action))
{
lastControllerTapped = ControllerType.PadOne;
return true;
}
if(padTwoInput.actionTapped(action))
{
lastControllerTapped = ControllerType.PadTwo;
return true;
}
if(padThreeInput.actionTapped(action))
{
lastControllerTapped = ControllerType.PadThree;
return true;
}
if(padFourInput.actionTapped(action))
{
lastControllerTapped = ControllerType.PadFour;
return true;
}
return false;
}
示例4: controller_types_are_mapped_correctly_in_collection
public void controller_types_are_mapped_correctly_in_collection(Type type, ControllerType controllerType)
{
_sut.Collection
.Single(x => x.Name == type.FullName)
.ControllerType
.ShouldEqual(controllerType);
}
示例5: SetControllerType
public void SetControllerType(string type)
{
if (type == "local") {
controllerType = ControllerType.Local;
} else {
controllerType = ControllerType.Remote;
}
}
示例6: AddPlayer
public void AddPlayer(int number, PlayerIndex playerIndex, ControllerType controllerType)
{
Debug.Log("Add player : " + number + ", controller: " + playerIndex);
players.Add(new PlayerList(number, playerIndex, controllerType));
uiPlayers[number-1].sprite = GameManager.instance.playerSkins[number-1].ui;
UIManager.instance.Shake(50f, 10f, Vector2.zero);
}
示例7: LoadControllerData
public override void LoadControllerData(int playerId, ControllerType controllerType, int controllerId)
{
if (!this.isEnabled)
{
Debug.LogWarning("UserDataStore_PlayerPrefs is disabled and will not load any data.", this);
return;
}
this.LoadControllerDataNow(playerId, controllerType, controllerId);
}
示例8: selectType
public static void selectType(ControllerType type)
{
if (type == ControllerType.GAMEPAD)
{
instance = new KeyboardControl();
}
else if (type == ControllerType.KEYBOARD)
{
instance = new GamepadControl();
}
}
示例9: SaveControllerData
/// <summary>
/// Save all data for a specific controller. Does not save Player data.
/// </summary>
/// <param name="controllerType">Controller type</param>
/// <param name="controllerId">Controller id</param>
public override void SaveControllerData(ControllerType controllerType, int controllerId) {
if(!isEnabled) {
Debug.LogWarning(thisScriptName + " is disabled and will not save any data.", this);
return;
}
SaveControllerDataNow(controllerType, controllerId);
#if UNITY_EDITOR
Debug.Log("Rewired: " + thisScriptName + " saved " + controllerType + " " + controllerId + " data to XML.");
#endif
}
示例10: Controller
public Controller(string name, ControllerType controllerType, string definition, Csrf csrfProtection, bool authorise)
{
if (name == null) throw new ArgumentNullException("name");
if (definition == null) throw new ArgumentNullException("definition");
Name = name;
ControllerType = controllerType;
Definition = definition;
CsrfProtection = csrfProtection;
Authorise = authorise;
}
示例11: Keybind
public Keybind(Keybinds keys, ControllerType portOne, ControllerType portTwo, ControllerType expansion, bool fourScore, bool filterIllegalInput, string inputMode)
{
this.keys = keys;
this.fourScore = fourScore;
this.portOne = portOne;
this.portTwo = portTwo;
this.expansion = expansion;
this.inputMode = inputMode;
InitializeComponent();
chkFourScore.Checked = fourScore;
chkFilter.Checked = filterIllegalInput;
switch (portOne)
{
case ControllerType.Controller:
cboPortOne.SelectedIndex = 0;
break;
case ControllerType.Zapper:
cboPortOne.SelectedIndex = 1;
break;
case ControllerType.Paddle:
cboPortOne.SelectedIndex = 2;
break;
default:
case ControllerType.Empty:
cboPortOne.SelectedIndex = 3;
break;
}
switch (portTwo)
{
case ControllerType.Controller:
cboPortTwo.SelectedIndex = 0;
break;
case ControllerType.Zapper:
cboPortTwo.SelectedIndex = 1;
break;
case ControllerType.Paddle:
cboPortTwo.SelectedIndex = 2;
break;
default:
case ControllerType.Empty:
cboPortTwo.SelectedIndex = 3;
break;
}
switch (expansion)
{
case ControllerType.FamiPaddle:
cboExpansion.SelectedIndex = 0;
break;
default:
case ControllerType.Empty:
cboExpansion.SelectedIndex = 1;
break;
}
}
示例12: ResetData
/// <inheritdoc/>
public override void ResetData()
{
m_initialized = false;
m_type = ControllerType.None;
m_rawValue = 0;
m_value = 0.0;
m_periodScale = 0;
m_zeroLatch = false;
base.ResetData();
}
示例13: createController
public AAngularController createController(ControllerType controllerType)
{
switch (controllerType)
{
case ControllerType.NoHttp:
return new AngularController(angularView);
case ControllerType.GetHttp:
return new AngularController(angularView);
default:
return new AngularController(angularView);
}
}
示例14: GetInputDirection
/// <summary>
/// Get input for local player controller
/// </summary>
/// <returns>Raw input direction</returns>
Vector3 GetInputDirection(ControllerType controller = ControllerType.Keyboard)
{
Vector3 inputDirection = Vector3.zero;
switch (controller)
{
case ControllerType.Keyboard:
// keyboard
bool inputRegistered = false;
if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.Q))
{
inputRegistered = true;
inputDirection += Vector3.left;
}
if (Input.GetKey(KeyCode.D))
{
inputRegistered = true;
inputDirection += Vector3.right;
}
if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.Z))
{
inputRegistered = true;
inputDirection += Vector3.forward;
}
if (Input.GetKey(KeyCode.S))
{
inputRegistered = true;
inputDirection += Vector3.back;
}
if (inputRegistered)
inputDirection.Normalize();
break;
case ControllerType.Gamepad:
Debug.LogWarning("Controller: Assigned to gamepad but no code has been written.");
break;
case ControllerType.SteamController:
Debug.LogWarning("Controller: Assigned to SteamController but no code has been written.");
break;
default:
break;
}
// controller
return inputDirection;
}
示例15: InputManager
/// <summary>
/// Constructor
/// </summary>
private InputManager()
{
if (GamePad.GetState(PlayerIndex.One).IsConnected)
{
controllerType = ControllerType.GamePad;
gamePadMapping = new Dictionary<string, Buttons[]>();
}
else
{
controllerType = ControllerType.Keyboard;
keyboardMapping = new Dictionary<string, Keys[]>();
}
#region Button Mappings
// Assign the various actions to the mapping dictionaries
// ex: gamePadMapping.Add("MenuSelection", new Buttons[2] {Buttons.A, Buttons.Start});
switch (controllerType)
{
case ControllerType.GamePad:
gamePadMapping.Add("MenuSelection", new Buttons[2] { Buttons.A, Buttons.Start });
gamePadMapping.Add("Pause", new Buttons[1] { Buttons.Start });
gamePadMapping.Add("MenuBack", new Buttons[1] { Buttons.B });
gamePadMapping.Add("Down", new Buttons[2] { Buttons.DPadDown, Buttons.LeftThumbstickDown });
gamePadMapping.Add("Up", new Buttons[2] { Buttons.DPadUp, Buttons.LeftThumbstickUp });
gamePadMapping.Add("Right", new Buttons[2] { Buttons.DPadRight, Buttons.LeftThumbstickRight });
gamePadMapping.Add("Left", new Buttons[2] { Buttons.DPadLeft, Buttons.LeftThumbstickLeft });
gamePadMapping.Add("Dance", new Buttons[1] { Buttons.A });
gamePadMapping.Add("Superflash", new Buttons[1] { Buttons.X });
break;
case ControllerType.Keyboard:
keyboardMapping.Add("MenuSelection", new Keys[2] { Keys.Enter, Keys.Space });
keyboardMapping.Add("Pause", new Keys[2] { Keys.Pause, Keys.P });
keyboardMapping.Add("MenuBack", new Keys[1] { Keys.Escape });
keyboardMapping.Add("Down", new Keys[1] { Keys.Down });
keyboardMapping.Add("Up", new Keys[1] { Keys.Up });
keyboardMapping.Add("Right", new Keys[1] { Keys.Right });
keyboardMapping.Add("Left", new Keys[1] { Keys.Left });
keyboardMapping.Add("Dance", new Keys[1] { Keys.D });
keyboardMapping.Add("Superflash", new Keys[1] { Keys.S });
break;
}
#endregion
}