| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | #include "..\emsg.h"
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | #include "..\enodes.h"
 | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | #include "..\Win\winbase.h"
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | e2d::EMouseMsg s_MouseMsg; | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | e2d::EKeyboardMsg s_KeyboardMsg; | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | e2d::EVector<e2d::EMouseListener*> s_vMouseListeners; | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | e2d::EVector<e2d::EKeyboardListener*> s_vKeyboardListeners; | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | DWORD e2d::EMouseMsg::getPosX() | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	return LOWORD(s_MouseMsg.m_lParam); | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | DWORD e2d::EMouseMsg::getPosY() | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	return HIWORD(s_MouseMsg.m_lParam); | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | e2d::EPoint e2d::EMouseMsg::getPos() | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	return EPoint(LOWORD(s_MouseMsg.m_lParam), HIWORD(s_MouseMsg.m_lParam)); | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | bool e2d::EMouseMsg::isLButtonDown() | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	return GET_KEYSTATE_WPARAM(s_MouseMsg.m_wParam) == MK_LBUTTON; | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | bool e2d::EMouseMsg::isMButtonDown() | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	return GET_KEYSTATE_WPARAM(s_MouseMsg.m_wParam) == MK_MBUTTON; | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | bool e2d::EMouseMsg::isRButtonDown() | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	return GET_KEYSTATE_WPARAM(s_MouseMsg.m_wParam) == MK_RBUTTON; | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | bool e2d::EMouseMsg::isShiftDown() | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	return GET_KEYSTATE_WPARAM(s_MouseMsg.m_wParam) == MK_SHIFT; | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | bool e2d::EMouseMsg::isCtrlDown() | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	return GET_KEYSTATE_WPARAM(s_MouseMsg.m_wParam) == MK_CONTROL; | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | DWORD e2d::EMouseMsg::getWheelDelta() | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	return GET_WHEEL_DELTA_WPARAM(s_MouseMsg.m_wParam); | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | e2d::EMouseMsg::MOUSE_MSG e2d::EMouseMsg::getMsg() | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	return MOUSE_MSG(s_MouseMsg.m_nMsg); | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | e2d::EKeyboardMsg::KEYBOARD_MSG e2d::EKeyboardMsg::getMsg() | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	return KEYBOARD_MSG(s_KeyboardMsg.m_nMsg); | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | e2d::EKeyboardMsg::KEY e2d::EKeyboardMsg::getVal() | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	return KEY(s_KeyboardMsg.m_wParam); | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | DWORD e2d::EKeyboardMsg::getCount() | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	return (((DWORD)s_KeyboardMsg.m_lParam) & 0x0000FFFF); | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | bool e2d::EKeyboardMsg::isKeyDown(KEY key) | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	if (::GetAsyncKeyState((int)key) & 0x8000) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		return true; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 	return false; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | bool e2d::EKeyboardMsg::isCapitalLockOn() | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	if (::GetKeyState(VK_CAPITAL) & 0x0001) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		return true; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 	return false; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | bool e2d::EKeyboardMsg::isNumpadLockOn() | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	if (::GetKeyState(VK_NUMLOCK) & 0x0001) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		return true; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 	return false; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | bool e2d::EKeyboardMsg::isScrollLockOn() | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	if (::GetKeyState(VK_SCROLL) & 0x0001) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		return true; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 	return false; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::EMsgManager::MouseProc(UINT message, WPARAM wParam, LPARAM lParam) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	s_MouseMsg.m_nMsg = message; | 
					
						
							|  |  |  |  | 	s_MouseMsg.m_wParam = wParam; | 
					
						
							|  |  |  |  | 	s_MouseMsg.m_lParam = lParam; | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 	// ִ<><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 	for (auto mlistener : s_vMouseListeners) | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		if (mlistener->isRunning()) | 
					
						
							|  |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  |  | 			mlistener->_callOn(); | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::EMsgManager::KeyboardProc(UINT message, WPARAM wParam, LPARAM lParam) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD>水<EFBFBD><E6B0B4><EFBFBD><EFBFBD>Ϣ
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	s_KeyboardMsg.m_nMsg = message; | 
					
						
							|  |  |  |  | 	s_KeyboardMsg.m_wParam = wParam; | 
					
						
							|  |  |  |  | 	s_KeyboardMsg.m_lParam = lParam; | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 	// ִ<>а<EFBFBD><D0B0><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2017-10-14 10:02:15 +08:00
										 |  |  |  | 	for (auto klistener : s_vKeyboardListeners) | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		if (klistener->isRunning()) | 
					
						
							|  |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  |  | 			klistener->_callOn(); | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | void e2d::EMsgManager::bindListener(e2d::EMouseListener * listener, EScene * pParentScene) | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	ASSERT( | 
					
						
							|  |  |  |  | 		(!listener->m_pParentNode) && (!listener->m_pParentScene), | 
					
						
							|  |  |  |  | 		"The listener is already binded, it cannot bind again!" | 
					
						
							|  |  |  |  | 	); | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 	WARN_IF(listener == nullptr, "EMouseListener NULL pointer exception!"); | 
					
						
							|  |  |  |  | 	WARN_IF(pParentScene == nullptr, "Bind EMouseListener with a NULL EScene pointer!"); | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	if (listener && pParentScene) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		listener->start(); | 
					
						
							|  |  |  |  | 		listener->retain(); | 
					
						
							| 
									
										
										
										
											2017-10-14 10:02:15 +08:00
										 |  |  |  | 		listener->m_pParentScene = pParentScene; | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 		s_vMouseListeners.push_back(listener); | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | void e2d::EMsgManager::bindListener(EKeyboardListener * listener, EScene * pParentScene) | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	ASSERT( | 
					
						
							|  |  |  |  | 		(!listener->m_pParentNode) && (!listener->m_pParentScene), | 
					
						
							|  |  |  |  | 		"The listener is already binded, it cannot bind again!" | 
					
						
							|  |  |  |  | 	); | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 	WARN_IF(listener == nullptr, "EKeyboardListener NULL pointer exception!"); | 
					
						
							|  |  |  |  | 	WARN_IF(pParentScene == nullptr, "Bind EKeyboardListener with a NULL EScene pointer!"); | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	if (listener && pParentScene) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		listener->start(); | 
					
						
							|  |  |  |  | 		listener->retain(); | 
					
						
							| 
									
										
										
										
											2017-10-14 10:02:15 +08:00
										 |  |  |  | 		listener->m_pParentScene = pParentScene; | 
					
						
							|  |  |  |  | 		s_vKeyboardListeners.push_back(listener); | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | void e2d::EMsgManager::bindListener(EMouseListener * listener, ENode * pParentNode) | 
					
						
							| 
									
										
										
										
											2017-10-14 10:02:15 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	ASSERT( | 
					
						
							|  |  |  |  | 		(!listener->m_pParentNode) && (!listener->m_pParentScene), | 
					
						
							|  |  |  |  | 		"The listener is already binded, it cannot bind again!" | 
					
						
							|  |  |  |  | 	); | 
					
						
							| 
									
										
										
										
											2017-10-14 10:02:15 +08:00
										 |  |  |  | 	WARN_IF(listener == nullptr, "EMouseListener NULL pointer exception!"); | 
					
						
							|  |  |  |  | 	WARN_IF(pParentNode == nullptr, "Bind EMouseListener with a NULL ENode pointer!"); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	if (listener && pParentNode) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		listener->start(); | 
					
						
							|  |  |  |  | 		listener->retain(); | 
					
						
							|  |  |  |  | 		listener->m_pParentNode = pParentNode; | 
					
						
							|  |  |  |  | 		s_vMouseListeners.push_back(listener); | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | void e2d::EMsgManager::bindListener(EKeyboardListener * listener, ENode * pParentNode) | 
					
						
							| 
									
										
										
										
											2017-10-14 10:02:15 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	ASSERT( | 
					
						
							|  |  |  |  | 		(!listener->m_pParentNode) && (!listener->m_pParentScene), | 
					
						
							|  |  |  |  | 		"The listener is already binded, it cannot bind again!" | 
					
						
							|  |  |  |  | 	); | 
					
						
							| 
									
										
										
										
											2017-10-14 10:02:15 +08:00
										 |  |  |  | 	WARN_IF(listener == nullptr, "EKeyboardListener NULL pointer exception!"); | 
					
						
							|  |  |  |  | 	WARN_IF(pParentNode == nullptr, "Bind EKeyboardListener with a NULL ENode pointer!"); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	if (listener && pParentNode) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		listener->start(); | 
					
						
							|  |  |  |  | 		listener->retain(); | 
					
						
							|  |  |  |  | 		listener->m_pParentNode = pParentNode; | 
					
						
							|  |  |  |  | 		s_vKeyboardListeners.push_back(listener); | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | void e2d::EMsgManager::startMouseListeners(const EString & name) | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 	for (auto l : s_vMouseListeners) | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		if (l->getName() == name) | 
					
						
							|  |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			l->start(); | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | void e2d::EMsgManager::stopMouseListeners(const EString & name) | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 	for (auto l : s_vMouseListeners) | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		if (l->getName() == name) | 
					
						
							|  |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			l->stop(); | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | void e2d::EMsgManager::delMouseListeners(const EString & name) | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	// ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	EVector<EMouseListener*>::iterator mIter; | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 	for (mIter = s_vMouseListeners.begin(); mIter != s_vMouseListeners.end();) | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 		if ((*mIter)->getName() == name) | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 			(*mIter)->autoRelease(); | 
					
						
							|  |  |  |  | 			(*mIter)->release(); | 
					
						
							|  |  |  |  | 			mIter = s_vMouseListeners.erase(mIter); | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 		else | 
					
						
							|  |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 			mIter++; | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::EMsgManager::startKeyboardListeners(const EString & name) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 	for (auto l : s_vKeyboardListeners) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		if (l->getName() == name) | 
					
						
							|  |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			l->start(); | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::EMsgManager::stopKeyboardListeners(const EString & name) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	// ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 	for (auto l : s_vKeyboardListeners) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		if (l->getName() == name) | 
					
						
							|  |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			l->stop(); | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::EMsgManager::delKeyboardListeners(const EString & name) | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 	// ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	EVector<EKeyboardListener*>::iterator kIter; | 
					
						
							| 
									
										
										
										
											2017-10-14 10:02:15 +08:00
										 |  |  |  | 	for (kIter = s_vKeyboardListeners.begin(); kIter != s_vKeyboardListeners.end();) | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 		if ((*kIter)->getName() == name) | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 			(*kIter)->autoRelease(); | 
					
						
							|  |  |  |  | 			(*kIter)->release(); | 
					
						
							| 
									
										
										
										
											2017-10-14 10:02:15 +08:00
										 |  |  |  | 			kIter = s_vKeyboardListeners.erase(kIter); | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 		else | 
					
						
							|  |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 			kIter++; | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | void e2d::EMsgManager::startAllMouseListenersBindedWith(EScene * pParentScene) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	for (auto l : s_vMouseListeners) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 		if (l->getParentScene() == pParentScene) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			l->start(); | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	for (auto child : pParentScene->getChildren()) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		EMsgManager::startAllMouseListenersBindedWith(child); | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | void e2d::EMsgManager::stopAllMouseListenersBindedWith(EScene * pParentScene) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	for (auto l : s_vMouseListeners) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 		if (l->getParentScene() == pParentScene) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			l->stop(); | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	for (auto child : pParentScene->getChildren()) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 		EMsgManager::stopAllMouseListenersBindedWith(child); | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | void e2d::EMsgManager::startAllMouseListenersBindedWith(ENode * pParentNode) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	for (auto l : s_vMouseListeners) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 		if (l->getParentNode() == pParentNode) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			l->start(); | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	for (auto child : pParentNode->getChildren()) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		EMsgManager::startAllMouseListenersBindedWith(child); | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | void e2d::EMsgManager::stopAllMouseListenersBindedWith(ENode * pParentNode) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	for (auto l : s_vMouseListeners) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 		if (l->getParentNode() == pParentNode) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			l->stop(); | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	for (auto child : pParentNode->getChildren()) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 		EMsgManager::stopAllMouseListenersBindedWith(child); | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | void e2d::EMsgManager::startAllKeyboardListenersBindedWith(EScene * pParentScene) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	for (auto l : s_vKeyboardListeners) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		if (l->getParentScene() == pParentScene) | 
					
						
							|  |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			l->start(); | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	for (auto child : pParentScene->getChildren()) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		EMsgManager::startAllKeyboardListenersBindedWith(child); | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | void e2d::EMsgManager::stopAllKeyboardListenersBindedWith(EScene * pParentScene) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	for (auto l : s_vKeyboardListeners) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		if (l->getParentScene() == pParentScene) | 
					
						
							|  |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			l->stop(); | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	for (auto child : pParentScene->getChildren()) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		EMsgManager::stopAllKeyboardListenersBindedWith(child); | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | void e2d::EMsgManager::startAllKeyboardListenersBindedWith(ENode * pParentNode) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-14 10:02:15 +08:00
										 |  |  |  | 	for (auto l : s_vKeyboardListeners) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 		if (l->getParentNode() == pParentNode) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			l->start(); | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	for (auto child : pParentNode->getChildren()) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		EMsgManager::startAllKeyboardListenersBindedWith(child); | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | void e2d::EMsgManager::stopAllKeyboardListenersBindedWith(ENode * pParentNode) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-14 10:02:15 +08:00
										 |  |  |  | 	for (auto l : s_vKeyboardListeners) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 		if (l->getParentNode() == pParentNode) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			l->stop(); | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	for (auto child : pParentNode->getChildren()) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		EMsgManager::stopAllKeyboardListenersBindedWith(child); | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | void e2d::EMsgManager::clearAllMouseListenersBindedWith(EScene * pParentScene) | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	for (size_t i = 0; i < s_vMouseListeners.size();) | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 		auto t = s_vMouseListeners[i]; | 
					
						
							|  |  |  |  | 		if (t->getParentScene() == pParentScene) | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 			t->autoRelease(); | 
					
						
							|  |  |  |  | 			t->release(); | 
					
						
							|  |  |  |  | 			s_vMouseListeners.erase(s_vMouseListeners.begin() + i); | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 		else | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 			i++; | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	for (auto child : pParentScene->getChildren()) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		EMsgManager::clearAllMouseListenersBindedWith(child); | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | void e2d::EMsgManager::clearAllKeyboardListenersBindedWith(EScene * pParentScene) | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	for (size_t i = 0; i < s_vKeyboardListeners.size();) | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 		auto t = s_vKeyboardListeners[i]; | 
					
						
							|  |  |  |  | 		if (t->getParentScene() == pParentScene) | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 			t->autoRelease(); | 
					
						
							|  |  |  |  | 			t->release(); | 
					
						
							|  |  |  |  | 			s_vKeyboardListeners.erase(s_vKeyboardListeners.begin() + i); | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 		else | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 			i++; | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	for (auto child : pParentScene->getChildren()) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		EMsgManager::clearAllKeyboardListenersBindedWith(child); | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-13 20:17:20 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | void e2d::EMsgManager::clearAllMouseListenersBindedWith(ENode * pParentNode) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	for (size_t i = 0; i < s_vMouseListeners.size();) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 		auto t = s_vMouseListeners[i]; | 
					
						
							|  |  |  |  | 		if (t->getParentNode() == pParentNode) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 			t->autoRelease(); | 
					
						
							|  |  |  |  | 			t->release(); | 
					
						
							|  |  |  |  | 			s_vMouseListeners.erase(s_vMouseListeners.begin() + i); | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 		else | 
					
						
							|  |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 			i++; | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	for (auto child : pParentNode->getChildren()) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		EMsgManager::clearAllMouseListenersBindedWith(child); | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::EMsgManager::clearAllKeyboardListenersBindedWith(ENode * pParentNode) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	for (size_t i = 0; i < s_vKeyboardListeners.size();) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 		auto t = s_vKeyboardListeners[i]; | 
					
						
							|  |  |  |  | 		if (t->getParentNode() == pParentNode) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 			t->autoRelease(); | 
					
						
							|  |  |  |  | 			t->release(); | 
					
						
							|  |  |  |  | 			s_vKeyboardListeners.erase(s_vKeyboardListeners.begin() + i); | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 		else | 
					
						
							|  |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 			i++; | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	for (auto child : pParentNode->getChildren()) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		EMsgManager::clearAllKeyboardListenersBindedWith(child); | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | void e2d::EMsgManager::_waitAllMouseListenersBindedWith(EScene * pParentScene) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	for (auto l : s_vMouseListeners) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 		if (l->getParentScene() == pParentScene) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 			l->_wait(); | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	for (auto child : pParentScene->getChildren()) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 		EMsgManager::_waitAllMouseListenersBindedWith(child); | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::EMsgManager::_notifyAllMouseListenersBindedWith(EScene * pParentScene) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	for (auto l : s_vMouseListeners) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		if (l->getParentScene() == pParentScene) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 			l->_notify(); | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	for (auto child : pParentScene->getChildren()) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		EMsgManager::_notifyAllMouseListenersBindedWith(child); | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | void e2d::EMsgManager::_waitAllMouseListenersBindedWith(ENode * pParentNode) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	for (auto l : s_vMouseListeners) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		if (l->getParentNode() == pParentNode) | 
					
						
							|  |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 			l->_wait(); | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	for (auto child : pParentNode->getChildren()) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		EMsgManager::_waitAllMouseListenersBindedWith(child); | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::EMsgManager::_notifyAllMouseListenersBindedWith(ENode * pParentNode) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	for (auto l : s_vMouseListeners) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		if (l->getParentNode() == pParentNode) | 
					
						
							|  |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 			l->_notify(); | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	for (auto child : pParentNode->getChildren()) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		EMsgManager::_notifyAllMouseListenersBindedWith(child); | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | void e2d::EMsgManager::_waitAllKeyboardListenersBindedWith(EScene * pParentScene) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	for (auto l : s_vKeyboardListeners) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 		if (l->getParentScene() == pParentScene) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 			l->_wait(); | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 	for (auto child : pParentScene->getChildren()) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		EMsgManager::_waitAllKeyboardListenersBindedWith(child); | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::EMsgManager::_notifyAllKeyboardListenersBindedWith(EScene * pParentScene) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	for (auto l : s_vKeyboardListeners) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		if (l->getParentScene() == pParentScene) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 			l->_notify(); | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	for (auto child : pParentScene->getChildren()) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		EMsgManager::_notifyAllKeyboardListenersBindedWith(child); | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::EMsgManager::_waitAllKeyboardListenersBindedWith(ENode * pParentNode) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	for (auto l : s_vKeyboardListeners) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 		if (l->getParentNode() == pParentNode) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 			l->_wait(); | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 	for (auto child : pParentNode->getChildren()) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		EMsgManager::_waitAllKeyboardListenersBindedWith(child); | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::EMsgManager::_notifyAllKeyboardListenersBindedWith(ENode * pParentNode) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	for (auto l : s_vKeyboardListeners) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		if (l->getParentNode() == pParentNode) | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 			l->_notify(); | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	for (auto child : pParentNode->getChildren()) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		EMsgManager::_notifyAllKeyboardListenersBindedWith(child); | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::EMsgManager::startAllMouseListeners() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	EMsgManager::startAllMouseListenersBindedWith(EApp::getCurrentScene()); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::EMsgManager::stopAllMouseListeners() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	EMsgManager::stopAllMouseListenersBindedWith(EApp::getCurrentScene()); | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:34 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | void e2d::EMsgManager::clearAllMouseListeners() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	EMsgManager::clearAllMouseListenersBindedWith(EApp::getCurrentScene()); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::EMsgManager::startAllKeyboardListeners() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	EMsgManager::startAllKeyboardListenersBindedWith(EApp::getCurrentScene()); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::EMsgManager::stopAllKeyboardListeners() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	EMsgManager::stopAllKeyboardListenersBindedWith(EApp::getCurrentScene()); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::EMsgManager::clearAllKeyboardListeners() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	EMsgManager::clearAllKeyboardListenersBindedWith(EApp::getCurrentScene()); | 
					
						
							|  |  |  |  | } |