触屏点击模块

SR点击组件

SRTouchInputModule

基本流程

点触对应 mastercontrol0 按键

构建EventData

start=>start: 开始 position=>operation: 获取点触位置 delta=>operation: 获取位移delta raycast=>operation: 获取Raycast结果 GetTouchPointerEventData=>operation: 构建ButtonState end=>end: 构建结束 start->position->delta->raycast->GetTouchPointerEventData->end

触发点击事件

按下状态

start=>start: 开始 buttonData=>operation: 填充buttonData数据 RaycastGameObject=>operation: 获取Raycast到的GameObject eligibleForClick赋值为true GetSrEventObjectObject=>condition: GameObject上有无注册事件 或事件包含Touch类型 Down=>operation: 触发Down事件 Click=>operation: 更新点击次数 end1=>end: 退出 end=>end: 执行结束 start->RaycastGameObject->buttonData->GetSrEventObjectObject GetSrEventObjectObject(yes)->Down->Click->end GetSrEventObjectObject(no)->end1

触发的Down事件依次为
ISRTouchStartHandler
IPointerDownHandler - UnityEngine.EventSystems.IEventSystemHandler.pointerDownHandler
ISRTouchDownHandler
最终尝试获取IPointerClickHandler
若其中过程有有返回GameObject, 代表执行成功, 则不继续执行后续事件

释放状态

start=>start: 开始 RaycastGameObject=>operation: 获取Raycast到的GameObject Up=>operation: 触发Up事件 ClickHandler=>operation: 尝试获取Click事件GameObject eligibleForClick=>condition: 获取成功 且eligibleForClick为true Click=>operation: 触发Click事件 RaycastGameObjectIsNull=>condition: 射线投射到的GameObject为空 ISRVLPointerClickBlankHandler=>operation: 触发空白点击事件事件 ResetPointerEventData=>operation: 重置PointerEventData信息 end=>end: 执行结束 start->RaycastGameObject->Up->ClickHandler->eligibleForClick eligibleForClick(yes)->Click->RaycastGameObjectIsNull eligibleForClick(no)->RaycastGameObjectIsNull RaycastGameObjectIsNull(yes)->ISRVLPointerClickBlankHandler->ResetPointerEventData RaycastGameObjectIsNull(no)->ResetPointerEventData ResetPointerEventData->end

尝试触发的事件依次为
ISRTouchEndHandler
IPointerUpHandler - UnityEngine.EventSystems.IEventSystemHandler.pointerUpHandler
ISRVLPointerUpHandler
IPointerClickHandler - UnityEngine.EventSystems.IEventSystemHandler.pointerClickHandler
ISRTouchClickHandler
ISRTouchClickBlankHandler