本文整理汇总了C#中InputState.WentActive方法的典型用法代码示例。如果您正苦于以下问题:C# InputState.WentActive方法的具体用法?C# InputState.WentActive怎么用?C# InputState.WentActive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InputState
的用法示例。
在下文中一共展示了InputState.WentActive方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
public void Update(InputState input)
{
_model.Frozen = input.WentActive(Keys.Space, false) ? !_model.Frozen : _model.Frozen;
if (input.IsActive(Modifiers.Control) && input.WentActive(Keys.Right))
{
_model.Speed++;
}
if (input.IsActive(Modifiers.Control) && input.WentActive(Keys.Left))
{
_model.Speed--;
}
}
示例2: Update
public void Update(InputState input)
{
if (input.WentActive(Keys.Y))
{
Terminate = true;
_onSuccess();
} else if (input.WentActive(Keys.N))
{
Terminate = true;
_onFail();
}
_btnYes.Update(input, Offset + _btnYesOffset - Dimensions / 2);
_btnNo.Update(input, Offset + _btnNoOffset - Dimensions / 2);
}
示例3: Update
public void Update(InputState input, Vector2 offsetFromCenter)
{
var aabb = new AABB(offsetFromCenter, offsetFromCenter + _dim);
if (input.WentActive(Buttons.LeftButton) && aabb.IsPointInside(input.MouseRelativeToCenter))
{
_onClick();
}
}
示例4: Update
public void Update(InputState input)
{
if (input.WentActive(Keys.Enter))
{
Terminate = true;
_textField.Dispose();
return;
}
_textField.Update(input, Offset);
}
示例5: Update
public void Update(InputState input)
{
if (input.WentActive(Keys.F1))
{
_dialogMgr.Add(new Prompt(Console.WriteLine));
}
AABB selectionBox = new AABB(_selectionBoxP1, _selectionBoxP2);
int id;
if (_provinces.TryGetProvinceFromPoint(input.Mouse, out id))
{
if (input.WentActive(Buttons.LeftButton) &&
_labelClickableBoundaries.ContainsKey(id) &&
_labelClickableBoundaries[id].IsPointInside(input.ScreenMouse) &&
_units.IsPlayerArmy(id))
{
_unitsSelection.Select(id, input.IsActive(Keys.LeftControl));
}
// Only handle new selections.
else if (input.WentActive(Buttons.LeftButton))
{
_provinceSelection.Select(id);
}
else if (input.WentInactive(Buttons.LeftButton)
&& selectionBox.Area < _minimumSelectionSize
&& _unitsSelection.Count > 0)
{
_units.AddOrder(_unitsSelection.Set, id);
}
SwapInstrs(_provinceSelection.Hovering);
_provinceSelection.Hover(id);
SwapInstrs(id);
}
else
{
SwapInstrs(_provinceSelection.Hovering);
_provinceSelection.StopHovering();
}
if (input.WentActive(Keys.G)) MergeSelectedArmies();
if (input.WentActive(Keys.Escape)) _unitsSelection.DeselectAll();
if (input.WentActive(Keys.Delete)) DeleteSelectedArmies();
if (input.WentInactive(Buttons.LeftButton) && selectionBox.Area > _minimumSelectionSize)
{
_unitsSelection.DeselectAll();
// Find all units within the area and select them.
_labelClickableBoundaries
.FindAll(p => _units.IsPlayerArmy(p.Key) && p.Value.Intersects(selectionBox))
.ForEach(p => _unitsSelection.Select(p.Key, true));
}
UpdateSelectionBox(input);
if (_unitsSelection.Count > 0)
{
Debug.WriteToScreen("Armies", _unitsSelection.Set.Join(", "));
}
}
示例6: UpdateSelectionBox
public void UpdateSelectionBox(InputState input)
{
if (input.WentInactive(Buttons.LeftButton))
{
_selectionBoxP1 = Vector2.Zero;
_selectionBoxP2 = Vector2.Zero;
} else if (input.WentActive(Buttons.LeftButton))
{
_selectionBoxP1 = input.ScreenMouse;
_selectionBoxP2 = input.ScreenMouse;
}
else if (input.IsActive(Buttons.LeftButton))
{
_selectionBoxP2 = input.ScreenMouse;
}
}