本文整理汇总了C#中IController.IsPressed方法的典型用法代码示例。如果您正苦于以下问题:C# IController.IsPressed方法的具体用法?C# IController.IsPressed怎么用?C# IController.IsPressed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IController
的用法示例。
在下文中一共展示了IController.IsPressed方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Set
public void Set(IController controller)
{
var newVal = controller.IsPressed(Name);
var changed = newVal != Checked;
Checked = newVal;
if (changed)
{
Refresh();
}
}
示例2: CreateDisplayValueForButton
public string CreateDisplayValueForButton(IController adapter, string buttonName)
{
if (adapter.Type.BoolButtons.Contains(buttonName))
{
return adapter.IsPressed(buttonName) ?
Mnemonics[buttonName].ToString() :
string.Empty;
}
if (adapter.Type.FloatControls.Contains(buttonName))
{
return adapter.GetFloat(buttonName).ToString();
}
return "!";
}
示例3: CopyFrom
/// <summary>
/// this controller's definition changes to that of source
/// </summary>
/// <param name="source"></param>
public void CopyFrom(IController source)
{
this.def = source.Type;
buttons.Clear();
foreach (var k in def.BoolButtons)
buttons.Add(k, source.IsPressed(k) ? 1.0f : 0);
foreach (var k in def.FloatControls)
{
if (buttons.Keys.Contains(k))
throw new Exception("name collision between bool and float lists!");
buttons.Add(k, source.GetFloat(k));
}
}
示例4: LatchFromSource
/// <summary>
/// latches all buttons from the provided source
/// </summary>
public void LatchFromSource(IController source)
{
foreach (var button in Type.BoolButtons)
{
MyBoolButtons[button] = source.IsPressed(button);
}
foreach (var name in Type.FloatControls)
{
MyFloatControls[name] = source.GetFloat(name);
}
}
示例5: ORLatchFromSource
private void ORLatchFromSource(Bk2ControllerAdapter latching, IController source)
{
foreach (string button in latching.Type.BoolButtons)
{
latching[button] |= source.IsPressed(button);
}
foreach (string name in latching.Type.FloatControls)
{
float sFloat = source.GetFloat(name);
int indexRange = source.Type.FloatControls.IndexOf(name);
if (sFloat == source.Type.FloatRanges[indexRange].Mid)
latching.SetFloat(name, sFloat);
}
}
示例6: LatchFromSourceButtons
public void LatchFromSourceButtons(Bk2ControllerAdapter latching, IController source)
{
foreach (string button in source.Type.BoolButtons)
{
latching[button] = source.IsPressed(button);
}
foreach (string name in source.Type.FloatControls)
{
latching.SetFloat(name, source.GetFloat(name));
}
}
示例7: OR_FromLogical
/// <summary>
/// merges pressed logical buttons from the supplied controller, effectively ORing it with the current state
/// </summary>
public void OR_FromLogical(IController controller)
{
// change: or from each button that the other input controller has
// foreach (string button in type.BoolButtons)
if (controller.Type != null)
{
foreach (var button in controller.Type.BoolButtons)
{
if (controller.IsPressed(button))
{
_buttons[button] = true;
}
}
}
}