修复了重置动画时的一些bug
This commit is contained in:
		
							parent
							
								
									da004f8691
								
							
						
					
					
						commit
						6bd05e60b9
					
				|  | @ -64,6 +64,7 @@ void ActionSequence::_reset() | ||||||
| 	{ | 	{ | ||||||
| 		action->_reset(); | 		action->_reset(); | ||||||
| 	} | 	} | ||||||
|  | 	m_vActions[0]->_init(); | ||||||
| 	m_nActionIndex = 0; | 	m_nActionIndex = 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -2,10 +2,11 @@ | ||||||
| 
 | 
 | ||||||
| ActionTwo::ActionTwo(Action * actionFirst, Action * actionSecond) : | ActionTwo::ActionTwo(Action * actionFirst, Action * actionSecond) : | ||||||
| 	m_FirstAction(actionFirst), | 	m_FirstAction(actionFirst), | ||||||
| 	m_SecondAction(actionSecond) | 	m_SecondAction(actionSecond), | ||||||
|  | 	m_bFirstFinished(false) | ||||||
| { | { | ||||||
| 	if (m_FirstAction) m_FirstAction->retain(); | 	m_FirstAction->retain(); | ||||||
| 	if (m_SecondAction) m_SecondAction->retain(); | 	m_SecondAction->retain(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| ActionTwo::~ActionTwo() | ActionTwo::~ActionTwo() | ||||||
|  | @ -34,9 +35,9 @@ ActionTwo * ActionTwo::reverse(bool actionReverse) const | ||||||
| void ActionTwo::_init() | void ActionTwo::_init() | ||||||
| { | { | ||||||
| 	m_FirstAction->m_pParent = m_pParent; | 	m_FirstAction->m_pParent = m_pParent; | ||||||
| 	m_FirstAction->_init(); |  | ||||||
| 	 |  | ||||||
| 	m_SecondAction->m_pParent = m_pParent; | 	m_SecondAction->m_pParent = m_pParent; | ||||||
|  | 
 | ||||||
|  | 	m_FirstAction->_init(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool ActionTwo::_exec(LARGE_INTEGER nNow) | bool ActionTwo::_exec(LARGE_INTEGER nNow) | ||||||
|  | @ -44,27 +45,16 @@ bool ActionTwo::_exec(LARGE_INTEGER nNow) | ||||||
| 	if (m_bStop) return true; | 	if (m_bStop) return true; | ||||||
| 	if (!m_bRunning) return false; | 	if (!m_bRunning) return false; | ||||||
| 
 | 
 | ||||||
| 	if (m_FirstAction) | 	if (!m_bFirstFinished) | ||||||
| 	{ | 	{ | ||||||
| 		if (m_FirstAction->_exec(nNow)) | 		if (m_FirstAction->_exec(nNow)) | ||||||
| 		{ | 		{ | ||||||
| 			// 返回 true 表示第一个动作已经结束,删除这个
 | 			// 返回 true 表示第一个动作已经结束
 | ||||||
| 			// 动作,并初始化第二个动作
 |  | ||||||
| 			SafeRelease(m_FirstAction); |  | ||||||
| 			m_FirstAction = nullptr; |  | ||||||
| 			m_SecondAction->_init(); | 			m_SecondAction->_init(); | ||||||
|  | 			m_bFirstFinished = true; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	else if (m_SecondAction) | 	else if (m_SecondAction->_exec(nNow)) | ||||||
| 	{ |  | ||||||
| 		if (m_SecondAction->_exec(nNow)) |  | ||||||
| 		{ |  | ||||||
| 			SafeRelease(m_SecondAction); |  | ||||||
| 			m_SecondAction = nullptr; |  | ||||||
| 			return true; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 	else |  | ||||||
| 	{ | 	{ | ||||||
| 		return true; | 		return true; | ||||||
| 	} | 	} | ||||||
|  | @ -73,6 +63,9 @@ bool ActionTwo::_exec(LARGE_INTEGER nNow) | ||||||
| 
 | 
 | ||||||
| void ActionTwo::_reset() | void ActionTwo::_reset() | ||||||
| { | { | ||||||
| 	if (m_FirstAction) m_FirstAction->_reset(); | 	m_FirstAction->_reset(); | ||||||
| 	if (m_SecondAction) m_SecondAction->_reset(); | 	m_SecondAction->_reset(); | ||||||
|  | 
 | ||||||
|  | 	m_FirstAction->_init(); | ||||||
|  | 	m_bFirstFinished = false; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -141,7 +141,7 @@ void App::_initGraph() | ||||||
| 		TCHAR title[31]; | 		TCHAR title[31]; | ||||||
| 		GetWindowText(GetHWnd(), title, 30); | 		GetWindowText(GetHWnd(), title, 30); | ||||||
| 		m_sTitle = title; | 		m_sTitle = title; | ||||||
| 		m_sAppName = title; | 		if (m_sAppName.empty()) m_sAppName = title; | ||||||
| 	} | 	} | ||||||
| 	else | 	else | ||||||
| 	{ | 	{ | ||||||
|  | @ -320,7 +320,7 @@ void App::_enterNextScene() | ||||||
| 	} | 	} | ||||||
| 	else | 	else | ||||||
| 	{ | 	{ | ||||||
| 		SafeDelete(m_CurrentScene);		// ˇńÔňÉžłýľąÇ°łĄž°
 | 		SafeDelete(m_CurrentScene);			// ÉžłýľąÇ°łĄž°
 | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	m_CurrentScene = m_NextScene;			// Çл»³¡¾°
 | 	m_CurrentScene = m_NextScene;			// Çл»³¡¾°
 | ||||||
|  |  | ||||||
|  | @ -43,7 +43,7 @@ TString FileUtils::getDefaultSavePath() | ||||||
| 
 | 
 | ||||||
| 	TString path = m_lpszDefaultDir; | 	TString path = m_lpszDefaultDir; | ||||||
| 	path.append(_T("\\")); | 	path.append(_T("\\")); | ||||||
| 	path.append(App::get()->getAppName()); | 	path.append(App::getAppName()); | ||||||
| 
 | 
 | ||||||
| #ifdef UNICODE | #ifdef UNICODE | ||||||
| 	if (_waccess(path.c_str(), 0) == -1) | 	if (_waccess(path.c_str(), 0) == -1) | ||||||
|  |  | ||||||
|  | @ -1220,6 +1220,7 @@ public: | ||||||
| protected: | protected: | ||||||
| 	Action *	m_FirstAction; | 	Action *	m_FirstAction; | ||||||
| 	Action *	m_SecondAction; | 	Action *	m_SecondAction; | ||||||
|  | 	bool		m_bFirstFinished; | ||||||
| 
 | 
 | ||||||
| protected: | protected: | ||||||
| 	virtual void _init() override; | 	virtual void _init() override; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue