本文整理汇总了C#中InputType类的典型用法代码示例。如果您正苦于以下问题:C# InputType类的具体用法?C# InputType怎么用?C# InputType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InputType类属于命名空间,在下文中一共展示了InputType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InputAction
public InputAction(GamePadButton myButton, bool myNewPressOnly,int myPlayer)
{
gamePadButton = myButton;
newPressOnly = myNewPressOnly;
inputType = InputType.gamepad;
playerIndex = myPlayer;
}
示例2: HoneyPotField
/// <summary>
/// Renders out field with honeypot security check enabled
/// </summary>
/// <param name="helper">HtmlHelper which will be extended</param>
/// <param name="name">Name of field. Should match model field of string type</param>
/// <param name="value">Value of the field</param>
/// <param name="css">CSS class to be applied to input field</param>
/// <returns>Returns render out MvcHtmlString for displaying on the View</returns>
public static MvcHtmlString HoneyPotField(this HtmlHelper helper, string name, object value, string inputCss = null, InputType fieldType=InputType.Text,string honeypotCss = null, InputType honeypotType=InputType.Hidden)
{
StringBuilder sbControlHtml = new StringBuilder();
using (StringWriter stringWriter = new StringWriter())
{
using (HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter))
{
HtmlInputText hashedField = new HtmlInputText(fieldType.ToString().ToLower());
string hashedName = GetHashedPropertyName(name);
hashedField.Value = value != null ? value.ToString() : string.Empty;
hashedField.ID = hashedName;
hashedField.Name = hashedName;
if (!string.IsNullOrWhiteSpace(inputCss))
{
hashedField.Attributes["class"] = inputCss;
}
hashedField.RenderControl(htmlWriter);
HtmlInputText hiddenField = new HtmlInputText(honeypotType.ToString().ToLower());
hiddenField.Value = string.Empty;
hiddenField.ID = name;
hiddenField.Name = name;
if (!string.IsNullOrWhiteSpace(honeypotCss))
{
hiddenField.Attributes["class"] = honeypotCss;
}
hiddenField.RenderControl(htmlWriter);
sbControlHtml.Append(stringWriter.ToString());
}
}
return new MvcHtmlString(sbControlHtml.ToString());
}
示例3: RenderFormGroupSelectElement
public static string RenderFormGroupSelectElement(HtmlHelper html, SelectElementModel inputModel,
LabelModel labelModel, InputType inputType)
{
HtmlString input = null;
if (inputType == InputType.DropDownList)
input = RenderSelectElement(html, inputModel, InputType.DropDownList);
if (inputType == InputType.ListBox)
input = RenderSelectElement(html, inputModel, InputType.ListBox);
var label = RenderLabel(html, labelModel ?? new LabelModel
{
htmlFieldName = inputModel.htmlFieldName,
metadata = inputModel.metadata,
htmlAttributes = new {@class = "control-label"}.ToDictionary()
});
var fieldIsValid = true;
if (inputModel != null)
fieldIsValid = html.ViewData.ModelState.IsValidField(inputModel.htmlFieldName);
return new FormGroup(input, label, FormGroupType.TextBoxLike, fieldIsValid).ToHtmlString();
}
示例4: HandleInput
public override void HandleInput(InputType input)
{
if (input == InputType.Confirm && ButtonClicked != null)
{
ButtonClicked.Invoke();
}
}
示例5: HtmlInput
public HtmlInput(InputType type, string name, string value)
: base("input")
{
SetAttribut("type", type.ToString());
SetAttribut("name", name);
SetAttribut("value", value);
}
示例6: dot
public void dot(){
m_dotPressed = true;
m_activeNum += 0.0f;
m_view.updateDisplay(m_activeNum);
m_lastInput = InputType.number;
}
示例7: GenerateHtml
public string GenerateHtml(InputType inputType, string label, string name, string value = null,
List<string> options = null)
{
string result = inputList[inputType].GenerateHtml(label, name, value, options);
return result;
}
示例8: swipeCalculator
/// <summary>
/// Calculates whether input is swipe or not.
/// </summary>
private void swipeCalculator()
{
if (Input.touchCount > 0)
{
Touch t = Input.GetTouch(0);
switch(t.phase)
{
case TouchPhase.Began:
{
startPos = t.position;
break;
}
case TouchPhase.Ended:
{
endPos = t.position;
Vector2 lengthOfSwipe = endPos - startPos;
if(lengthOfSwipe.magnitude > 90)
{
touchInput = InputType.SWIPE;
}
else
{
touchInput = InputType.TOUCH;
}
break;
}
}
}
}
示例9: InputConfig
public InputConfig(int index)
{
Name = "Input #" + (index + 1).ToString("N0");
PhantomPower = false;
Type = InputType.Line;
}
示例10: GameButton
public GameButton(Buttons buttonCode)
{
this.keyCode = Keys.None;
this.mouseCode = MouseButtons.None;
this.buttonCode = buttonCode;
this.inputType = InputType.Button;
}
示例11: OnInput
public InputResult OnInput(InputType inputType, MouseEventArgs beginArgs, MouseEventArgs endArgs, object args)
{
foreach (DrawComponent drawComponent in _drawComponents)
{
if (drawComponent is IInputEnabled && Utils.IsInputStartInBounds(drawComponent, beginArgs))
{
InputResult result = (drawComponent as IInputEnabled).OnInput(inputType, beginArgs, endArgs, args);
if (result == InputResult.Consumed)
{
FocusOn((drawComponent as IInputEnabled));
return InputResult.Consumed;
}
}
}
// try to consume the gesture by myself
if (inputType == InputType.Drag)
{
if ((args as DragDirection? ?? DragDirection.Left) == DragDirection.Down)
SetContentOffset(endArgs.Y - beginArgs.Y);
if ((args as DragDirection? ?? DragDirection.Left) == DragDirection.Up)
SetContentOffset(endArgs.Y - beginArgs.Y);
return InputResult.Consumed;
}
return InputResult.Bubble;
}
示例12: DrawWindow
/// <summary>
/// 绘制窗口
/// </summary>
public override void DrawWindow()
{
// 绘制标题
base.DrawWindow();
// 绘制选择类型
inputType = (InputType) EditorGUILayout.EnumPopup("Input type : " , inputType);
if(inputType == InputType.Number)
{
// 绘制Value
inputValue = EditorGUILayout.TextField("Value", inputValue);
}
else if(inputType == InputType.Randomization)
{
// 绘制范围
randomFrom = EditorGUILayout.TextField("From", randomFrom);
randomTo = EditorGUILayout.TextField("To", randomTo);
// 随机值
if(GUILayout.Button("Calculate Random"))
{
calculateRandom();
}
}
}
示例13: Initialise
public virtual void Initialise(string fieldTitle, string fieldType, int fieldId, int moduleId,
string controlHelpText, string defaultValue, bool required, string validationRule,
string validationMsg, string editStyle, string inputSettings,
string outputSettings, bool normalizeFlag, bool multipleValuesFlag,
bool inputFilterTags, bool inputFilterScript, InputType inputSettingsListType,
ModuleInstanceContext moduleContext, DataTable fieldSettingsTable,
IFormEvents formEvents)
{
FieldTitle = fieldTitle;
FieldType = fieldType;
FieldId = fieldId;
ModuleId = moduleId;
HelpText = controlHelpText;
DefaultValue = defaultValue;
Required = required;
ValidationRule = validationRule;
_customValidationMessage = validationMsg;
InputSettings = inputSettings;
OutputSettings = outputSettings;
Style = editStyle;
NormalizeFlag = normalizeFlag;
MultipleValuesFlag = multipleValuesFlag;
FilterScript = inputFilterScript;
FilterTags = inputFilterTags;
ListInputType = inputSettingsListType;
ModuleContext = moduleContext;
FieldSettingsTable = fieldSettingsTable;
FormEvents = formEvents;
}
示例14: OnInput
private void OnInput(InputType input)
{
if (IsSelected)
{
HandleInput(input);
}
}
示例15: HandleInput
public void HandleInput(InputType key, InputState state)
{
if (_currentGame == null)
return;
if (state == InputState.Released)
{
if (key == InputType.Next)
{
StartNextGame();
return;
}
if (key == InputType.Pause)
{
TogglePause(true);
return;
}
}
if (state == InputState.Pressed)
_currentGame.KeyPressed(key);
if (state == InputState.Released)
_currentGame.KeyReleased(key);
}