//-------------------------------------------------------------------------------------------------------------------------- protected void notifyGlobalPress(bool press) { // 开始触摸时记录触摸状态,同步上一次的触摸位置 if (mSimulateTouch) { mMousePressed = press; if (mMousePressed) { mCurTouchPosition = Input.mousePosition; mLastMousePosition = mCurTouchPosition; } } Vector3 mousePosition = getCurMousePosition(); // 检查当前悬停窗口 checkHoverWindow(ref mousePosition, press); // 通知屏幕鼠标事件 foreach (var item in mAllObjectSet) { if (!item.isReceiveScreenMouse()) { continue; } if (press) { item.onScreenMouseDown(mousePosition); } else { item.onScreenMouseUp(mousePosition); } } var raycast = globalRaycast(ref mousePosition); int count = raycast.Count; for (int i = 0; i < count; ++i) { IMouseEventCollect obj = raycast[i]; // 如果此时窗口已经被销毁了,则不再通知 if (!mAllObjectSet.Contains(obj)) { continue; } if (press) { obj.onMouseDown(mousePosition); } else { obj.onMouseUp(mousePosition); } } // 保存鼠标按下时所选中的所有窗口,需要给这些窗口发送鼠标移动的消息 // 如果鼠标放开,则只是清空列表 mMouseDownWindowList.Clear(); if (press) { mMouseDownWindowList.AddRange(raycast); } }