本文整理汇总了C#中InputMode类的典型用法代码示例。如果您正苦于以下问题:C# InputMode类的具体用法?C# InputMode怎么用?C# InputMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InputMode类属于命名空间,在下文中一共展示了InputMode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RawStylusInputReport
internal RawStylusInputReport(
InputMode mode,
int timestamp,
PresentationSource inputSource,
PenContext penContext,
RawStylusActions actions,
int tabletDeviceId,
int stylusDeviceId,
int[] data)
: base(inputSource, InputType.Stylus, mode, timestamp)
{
// Validate parameters
if (!RawStylusActionsHelper.IsValid(actions))
{
throw new InvalidEnumArgumentException(SR.Get(SRID.Enum_Invalid, "actions"));
}
if (data == null && actions != RawStylusActions.InRange)
{
throw new ArgumentNullException("data");
}
_penContext = new SecurityCriticalDataClass<PenContext>(penContext);
_actions = actions;
_tabletDeviceId = tabletDeviceId;
_stylusDeviceId = stylusDeviceId;
_data = data;
_isSynchronize = false;
}
示例2: getMove
void getMove()
{
move = false;
if (Input.GetKeyDown(KeyCode.M)){
input = "M";
move = true;
mode = InputMode.getRoom;
}
if (Input.GetKeyDown(KeyCode.S)){
input = "S";
move = true;
mode = InputMode.getArrowPath;
}
if (Input.GetKeyDown(KeyCode.Q)){
input = "Q";
move = true;
}
//clear everything
if (move){
selectedRoom = null;
arrowPath = null;
tempPath.Clear();
move = false;
}
}
示例3: CharacterMapKeysAttribute
public CharacterMapKeysAttribute(InputMode mode, string charList, int width, params Key[] keys)
{
_mode = mode;
_charList = charList;
_width = width;
_keys = keys;
}
示例4: SetInputMode
/// <summary>
/// Specifies the input mode on a Smartphone.
/// </summary>
public static void SetInputMode(Control control, InputMode mode)
{
int msg;
//only certain controls are supported
if(control is TextBox)
{
msg = EM_SETINPUTMODE;
}
else if(control is ComboBox)
{
msg = LB_SETINPUTMODE;
}
else
{
return;
}
//get the handle to the child (native) control
control.Capture = true;
IntPtr hwnd = Win32Window.GetWindow(Win32Window.GetCapture(), GW.CHILD);
control.Capture = false;
//send message
IntPtr result = Win32Window.SendMessage(hwnd, msg, IntPtr.Zero, (int)mode);
}
示例5: ChangeMode
public void ChangeMode(InputMode mode)
{
var member = GetType().GetField(string.Format("_{0}Dict", mode.ToString().ToLower()), BindingFlags.NonPublic | BindingFlags.Instance);
if (member == null) throw new Exception(mode + " does not have a dictionary set up");
_currentDict = (SequencedDictionary<Key, Message>)member.GetValue(this);
InputMode = mode;
}
示例6: InputHelper
public InputHelper(InputMode inputDevice = InputMode.KeyMouse)
{
this.inputDevice = inputDevice;
currentControlerState = GamePad.GetState(PlayerIndex.One);
currentKeyboardState = Keyboard.GetState();
currentMouseState = Mouse.GetState();
}
示例7: UIMapControlInputHandler
protected UIMapControlInputHandler(InputMode setInputMode, UIMapControl setUIMapControl)
{
mapUnitOrder = MapUnitOrder.None;
IsSpanningRectangle = false;
selectionRectangle = RectangleF.Empty;
MapControl = setUIMapControl;
InputMode = setInputMode;
}
示例8: ActivateAttackModifier
public void ActivateAttackModifier()
{
Debug.Log("attc md activated");
m_InputMode = InputMode.attack;
attackModifier = true;
Cursor.SetCursor(attackCursorTexture, Vector2.zero, CursorMode.Auto);
Input.ResetInputAxes();
}
示例9: Update
void Update()
{
if (Input.GetButtonDown ("Fire1")) {
RaycastManager.RaycastControl ();
}
if (GameManager.CellControlled == null)
{
mode = InputMode.Default;
return;
}
if (GameManager.CellControlled.GetComponent<AgentLife> ().isInfected)
{
DeselectAll();
return;
}
if (Input.GetButtonDown ("Fire2")) {
playerTarget = RaycastManager.RaycastAttackEnemy ();
GameManager.CellControlled.GetComponent<AgentMovement> ().enabled = false;
GameManager.CellControlled.GetComponent<MoveToPoint> ().DefineNewDestination (Camera.main.ScreenToWorldPoint (Input.mousePosition));
if (playerTarget != null) {
mode = InputMode.Attacking;
}
else
{
mode = InputMode.Controlling;
}
}
switch (mode) {
case (InputMode.Attacking):
if(playerTarget == null)
{
//GameManager.CellControlled.GetComponent<AgentMovement> ().enabled = true;
mode = InputMode.Controlling;
break;
}
GameManager.CellControlled.GetComponent<MoveToPoint> ().DefineNewDestination (playerTarget.transform.position);
if (Vector2.Distance (GameManager.CellControlled.transform.position, playerTarget.transform.position) < 10) {
GameManager.CellControlled.GetComponent<AgentMovement> ().enabled = true;
GameManager.CellControlled.GetComponent<MoveToPoint> ().enabled = false;
}
break;
//case (InputMode.Attacking)
}
}
示例10: InputController
public InputController(InputMode mode)
{
m_Mode = mode;
m_oldState = new KeyboardState();
m_newState = new KeyboardState();
m_oldControllerState = new GamePadState[NUM_SUPPORTED_PLAYERS];
m_newControllerState = new GamePadState[NUM_SUPPORTED_PLAYERS];
}
示例11: HexagonyEnv
public HexagonyEnv(string source, string input, HexagonySettings settings)
{
if (source.StartsWith("❢"))
_linearCode = source.Substring(1);
else
{
_grid = Grid.Parse(source);
_ips = Ut.NewArray(
new PointAxial(0, -_grid.Size + 1),
new PointAxial(_grid.Size - 1, -_grid.Size + 1),
new PointAxial(_grid.Size - 1, 0),
new PointAxial(0, _grid.Size - 1),
new PointAxial(-_grid.Size + 1, _grid.Size - 1),
new PointAxial(-_grid.Size + 1, 0));
_ipDirs = Ut.NewArray(
Direction.East,
Direction.SouthEast,
Direction.SouthWest,
Direction.West,
Direction.NorthWest,
Direction.NorthEast);
}
switch (_inputMode = settings.InputMode)
{
case InputMode.Utf8:
_input = input.ToUtf8();
break;
case InputMode.Utf16:
_input = input.ToUtf16();
break;
case InputMode.Numbers:
var m = Regex.Match(input, @"\A(\s*\d+\s*)*\Z", RegexOptions.Singleline);
if (!m.Success)
throw new InvalidOperationException("The input provided is not a whitespace-separated list of numbers.");
_input = m.Groups[1].Captures.Cast<Capture>().Select(c =>
{
byte b;
if (!byte.TryParse(c.Value.Trim(), out b))
throw new InvalidOperationException("The number {0} in the input string does not fit in a byte.".Fmt(c.Value.Trim()));
return b;
}).ToArray();
break;
default:
throw new InvalidOperationException("Please choose an input mode from the “Input semantics” menu.");
}
_inputIndex = 0;
_settings = settings;
if (!settings.MemoryAnnotations.ContainsKey(settings.LastMemoryAnnotationSet))
settings.MemoryAnnotations[settings.LastMemoryAnnotationSet] = new Dictionary<Direction, Dictionary<PointAxial, string>>();
_memory = new Memory(settings.MemoryAnnotations[settings.LastMemoryAnnotationSet]);
}
示例12: DelayInputModeSwitch
public static IEnumerator DelayInputModeSwitch(InputMode switchTo)
{
float elapsedTime = 0;
while (elapsedTime <= GameConstants.DELAYED_INPUT_SWITCH_DURATION)
{
elapsedTime += Time.unscaledDeltaTime;
yield return null;
}
mode = switchTo;
DelayedSwitch = null;
}
示例13: RawAppCommandInputReport
/// <summary>
/// Constructs ad instance of the RawAppCommandInputReport class.
/// </summary>
/// <param name="inputSource">
/// The input source that provided this input.
/// </param>
/// <param name="mode">
/// The mode in which the input is being provided.
/// </param>
/// <param name="timestamp">
/// The time when the input occured.
/// </param>
/// <param name="appCommand">
/// The Application Command associated.
/// </param>
/// <param name="device">
/// The device that generated the app command.
/// </param>
/// <param name="inputType">the input device that generated the input event</param>
internal RawAppCommandInputReport(
PresentationSource inputSource,
InputMode mode,
int timestamp,
int appCommand,
InputType device,
InputType inputType) : base(inputSource, inputType, mode, timestamp)
{
_appCommand = appCommand;
_device = device;
}
示例14: InputReport
protected InputReport(PresentationSource inputSource, InputType type, InputMode mode, int timestamp)
{
if (inputSource == null)
throw new ArgumentNullException("inputSource");
Validate_InputType( type );
Validate_InputMode( mode );
_inputSource= new SecurityCriticalData<PresentationSource>(inputSource);
_type = type;
_mode = mode;
_timestamp = timestamp;
}
示例15: Update
// Update is called once per frame
void Update()
{
// None -> Hold
// Hold -> Tap, or Drag
// Tap, Drag -> None
// Get data we will need
// We only care about clicks if they are not over a UI element
leftButtonDown = Input.GetMouseButton(0)
&& !UnityEngine.EventSystems.EventSystem.current.IsPointerOverGameObject();
Vector2 currentPosition = Input.mousePosition;
switch (currentInputMode) {
case InputMode.None:
// If we are in the default mode, we can only enter Hold mode
if (leftButtonDown) {
currentInputMode = InputMode.Hold;
lastPosition = currentPosition;
}
break;
case InputMode.Hold:
// If we are holding, we have to check position (transforming to Drag)
// and releaseing the click (transforming to Tap)
if (GetFastDistance(currentPosition, lastPosition) < 10 &&
framesSinceLastClick < 5) {
// Tap
if (!leftButtonDown) {
currentInputMode = InputMode.Tap;
eventPosition = currentPosition;
}
}
else {
// Drag
currentInputMode = InputMode.Drag;
eventPosition = currentPosition;
}
break;
case InputMode.Tap:
currentInputMode = InputMode.None;
break;
case InputMode.Drag:
if (leftButtonDown) {
framesSinceLastClick++;
lastPosition = eventPosition;
eventPosition = currentPosition;
}
else {
framesSinceLastClick = 0;
currentInputMode = InputMode.None;
}
break;
}
}