summaryrefslogtreecommitdiff
path: root/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/InputModules/StandaloneInputModule.cs
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-04-02 19:07:01 +0800
committerchai <chaifix@163.com>2021-04-02 19:07:01 +0800
commit6b25723ca33a657882588b2cc3a58101bb9d33e6 (patch)
treefa79c1e553f58586e4c659d0e71933f9f6ae3894 /Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/InputModules/StandaloneInputModule.cs
parentb1276a1b76ac3b87add90e0c6b887d5afea1cfea (diff)
+misc
Diffstat (limited to 'Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/InputModules/StandaloneInputModule.cs')
-rw-r--r--Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/InputModules/StandaloneInputModule.cs28
1 files changed, 17 insertions, 11 deletions
diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/InputModules/StandaloneInputModule.cs b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/InputModules/StandaloneInputModule.cs
index f9a2f77..7db371a 100644
--- a/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/InputModules/StandaloneInputModule.cs
+++ b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/InputModules/StandaloneInputModule.cs
@@ -141,16 +141,16 @@ namespace UnityEngine.EventSystems
default:
return false;
}
- }
-
- //c 更新鼠标坐标
+ }
+
+ //c! 这里只更新鼠标位置
public override void UpdateModule()
{
- // 如果没有获取焦点,且忽略没有焦点时的事件,返回(除非开启远程连接,否则会这样)
+ // 如果没有获取焦点,且忽略没有焦点时的事件,返回(除非开启远程连接,否则会这样)
if (!eventSystem.isFocused && ShouldIgnoreEventsOnNoFocus())
return;
- // 更新鼠标位置
+ // 更新鼠标位置
m_LastMousePosition = m_MousePosition;
m_MousePosition = input.mousePosition;
}
@@ -201,16 +201,17 @@ namespace UnityEngine.EventSystems
ClearSelection();
}
- //c input module事件处理主入口
+ //c! input module事件处理主入口,每帧更新
public override void Process()
{
- if (!eventSystem.isFocused && ShouldIgnoreEventsOnNoFocus()) // 如果没有获取焦点,不需要处理
+ // 如果没有获取焦点,不需要处理
+ if (!eventSystem.isFocused && ShouldIgnoreEventsOnNoFocus())
return;
//event 给选中的对象发布更新事件
bool usedEvent = SendUpdateEventToSelectedObject();
- // 如果勾上了,发送move , submit, cancel事件
+ // 如果勾上了Send Navigation Events,发送move , submit, cancel事件
if (eventSystem.sendNavigationEvents)
{
if (!usedEvent)
@@ -222,10 +223,10 @@ namespace UnityEngine.EventSystems
// 模拟触摸或鼠标输入
// touch needs to take precedence because of the mouse emulation layer
- usedEvent = ProcessTouchEvents(); //event 发布触摸事件
+ usedEvent = ProcessTouchEvents(); //event 检测屏幕触摸,PC上没有
if(!usedEvent && input.mousePresent)
- ProcessMouseEvent();
+ ProcessMouseEvent(); // 处理鼠标事件
}
//c 触摸事件
@@ -233,6 +234,8 @@ namespace UnityEngine.EventSystems
{
for (int i = 0; i < input.touchCount; ++i) //多点触控
{
+ Debug.Log("Touch");
+
Touch touch = input.GetTouch(i);
if (touch.type == TouchType.Indirect)
@@ -240,7 +243,8 @@ namespace UnityEngine.EventSystems
bool released; // 这是一个手指抬起操作
bool pressed; // 这是一个手指放下操作
- var pointer = GetTouchPointerEventData(touch, out pressed, out released); // 射线检测并保存检测结果
+ //
+ PointerEventData pointer = GetTouchPointerEventData(touch, out pressed, out released); // 射线检测并保存检测结果
// 处理触摸或抬起反馈,已经准备好了被触摸的物体
ProcessTouchPress(pointer, pressed, released);
@@ -495,6 +499,7 @@ namespace UnityEngine.EventSystems
}
}
+ // 每帧发送一个OnUpdateSelected事件
protected bool SendUpdateEventToSelectedObject()
{
if (eventSystem.currentSelectedGameObject == null)
@@ -506,6 +511,7 @@ namespace UnityEngine.EventSystems
return data.used;
}
+ // 处理鼠标按下事件,发送消息,调用回调
/// <summary>
/// Process the current mouse press.
/// </summary>