本文整理汇总了C#中UnityEngine.EventSystems.BaseEventData.Use方法的典型用法代码示例。如果您正苦于以下问题:C# BaseEventData.Use方法的具体用法?C# BaseEventData.Use怎么用?C# BaseEventData.Use使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.EventSystems.BaseEventData
的用法示例。
在下文中一共展示了BaseEventData.Use方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnUpdateSelected
public override void OnUpdateSelected(BaseEventData eventData)
{
if (!isFocused)
return;
bool consumedEvent = false;
while (Event.PopEvent(m_ProcessingEvent))
{
if (m_ProcessingEvent.rawType == EventType.KeyDown)
{
if (!IsAllowedCombination(m_ProcessingEvent))
{
OnCharEntered(this, new EventArgs());
continue;
}
consumedEvent = true;
var shouldContinue = KeyPressed(m_ProcessingEvent);
if (shouldContinue == EditState.Finish)
{
DeactivateInputField();
break;
}
}
}
if (consumedEvent)
{
UpdateLabel();
}
eventData.Use();
}
示例2: OnUpdateSelected
public override void OnUpdateSelected(BaseEventData eventData)
{
if (!isFocused)
return;
bool consumedEvent = false;
while (Event.PopEvent(m_ProcessingEvent))
{
if (m_ProcessingEvent.rawType == EventType.KeyDown)
{
if (ProcessKeyPress(m_ProcessingEvent))
{
continue;
}
consumedEvent = true;
var shouldContinue = KeyPressed(m_ProcessingEvent);
if (shouldContinue == EditState.Finish)
{
DeactivateInputField();
break;
}
}
}
if (consumedEvent)
UpdateLabel();
eventData.Use();
}
示例3: OnUpdateSelected
public override void OnUpdateSelected(BaseEventData eventData)
{
if (!this.isFocused) {
return;
}
bool consumedEvent = false;
while (Event.PopEvent(processEvent)) {
if (processEvent.rawType == EventType.KeyDown) {
if (!CombinationPressed(processEvent)) {
continue;
}
consumedEvent = true;
EditState state = this.KeyPressed(processEvent);
if (state == EditState.Finish) {
DeactivateInputField();
}
break;
}
}
if (consumedEvent) {
this.UpdateLabel();
}
eventData.Use();
}
示例4: OnUpdateSelected
// To change default behavior and to support multiple gui,
// override InputFiled method here.
public override void OnUpdateSelected(BaseEventData eventData)
{
if (!isFocused) return;
// To support multiple gui, set the window that this input filed is belonging to
// as the current active window.
Window.selected = parentWindow;
bool consumedEvent = false;
var e = new Event();
while (Event.PopEvent(e)) {
if (e.rawType == EventType.KeyDown) {
consumedEvent = true;
// Skip because these keys are used for histroy selection in single-line mode
// and for move cursor manually in multi-line mode.
switch (e.keyCode) {
case KeyCode.UpArrow:
case KeyCode.DownArrow:
continue;
}
// Skip if completion view is open.
if (parentWindow.hasCompletion) {
if (e.keyCode == KeyCode.Tab || KeyUtil.Enter()) {
break;
}
}
var shouldContinue = KeyPressed(e);
// Prevent finish.
// Command submission and cancel are observed and handled in Core.
switch (e.keyCode) {
case KeyCode.Return:
case KeyCode.KeypadEnter:
case KeyCode.Escape:
shouldContinue = EditState.Continue;
break;
}
if (shouldContinue == EditState.Finish) {
DeactivateInputField();
break;
}
}
}
if (consumedEvent) {
UpdateLabel();
}
eventData.Use();
}