| 
									
										
										
										
											2018-04-21 21:24:46 +08:00
										 |  |  |  | #include "..\e2dmanager.h"
 | 
					
						
							|  |  |  |  | #include "..\e2daction.h"
 | 
					
						
							| 
									
										
										
										
											2018-05-24 00:58:16 +08:00
										 |  |  |  | #include "..\e2dnode.h"
 | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | e2d::ActionManager * e2d::ActionManager::GetInstance() | 
					
						
							| 
									
										
										
										
											2018-07-05 01:09:54 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-08-19 15:11:20 +08:00
										 |  |  |  | 	static ActionManager instance; | 
					
						
							|  |  |  |  | 	return &instance; | 
					
						
							| 
									
										
										
										
											2018-07-05 01:09:54 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | e2d::ActionManager::ActionManager() | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 	: actions_() | 
					
						
							|  |  |  |  | 	, running_actions_() | 
					
						
							| 
									
										
										
										
											2018-07-05 01:09:54 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | e2d::ActionManager::~ActionManager() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2017-10-19 12:48:58 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | void e2d::ActionManager::Update() | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 	if (running_actions_.empty()) | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | 		return; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-12 15:38:02 +08:00
										 |  |  |  | 	std::vector<Action*> currActions; | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 	currActions.reserve(running_actions_.size()); | 
					
						
							| 
									
										
										
										
											2018-08-12 15:38:02 +08:00
										 |  |  |  | 	std::copy_if( | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 		running_actions_.begin(), | 
					
						
							|  |  |  |  | 		running_actions_.end(), | 
					
						
							| 
									
										
										
										
											2018-08-12 15:38:02 +08:00
										 |  |  |  | 		std::back_inserter(currActions), | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 		[](Action* action) { return action->IsRunning() && !action->IsDone(); } | 
					
						
							| 
									
										
										
										
											2018-08-12 15:38:02 +08:00
										 |  |  |  | 	); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>еĶ<D0B5><C4B6><EFBFBD>
 | 
					
						
							|  |  |  |  | 	for (const auto& action : currActions) | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 		action->Update(); | 
					
						
							| 
									
										
										
										
											2018-08-12 15:38:02 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵĶ<C9B5><C4B6><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 	for (auto iter = running_actions_.begin(); iter != running_actions_.end();) | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 		if ((*iter)->IsDone()) | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 			(*iter)->Release(); | 
					
						
							|  |  |  |  | 			(*iter)->target_ = nullptr; | 
					
						
							|  |  |  |  | 			iter = running_actions_.erase(iter); | 
					
						
							| 
									
										
										
										
											2018-03-11 23:56:40 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 		else | 
					
						
							|  |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2018-08-12 15:38:02 +08:00
										 |  |  |  | 			++iter; | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | void e2d::ActionManager::Add(Action * action) | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-08 17:40:36 +08:00
										 |  |  |  | 	if (action) | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 		auto iter = std::find(actions_.begin(), actions_.end(), action); | 
					
						
							|  |  |  |  | 		if (iter == actions_.end()) | 
					
						
							| 
									
										
										
										
											2018-07-05 01:09:54 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 			actions_.push_back(action); | 
					
						
							| 
									
										
										
										
											2018-07-05 01:09:54 +08:00
										 |  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | void e2d::ActionManager::Remove(Action * action) | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 	if (actions_.empty() || action == nullptr) | 
					
						
							| 
									
										
										
										
											2018-05-22 00:11:57 +08:00
										 |  |  |  | 		return; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 	auto iter = std::find(actions_.begin(), actions_.end(), action); | 
					
						
							|  |  |  |  | 	if (iter != actions_.end()) | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 		actions_.erase(iter); | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | void e2d::ActionManager::ResumeAllBindedWith(Node * target) | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 	if (running_actions_.empty() || target == nullptr) | 
					
						
							| 
									
										
										
										
											2018-05-22 00:11:57 +08:00
										 |  |  |  | 		return; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 	for (const auto& action : running_actions_) | 
					
						
							| 
									
										
										
										
											2017-10-19 12:48:58 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 		if (action->GetTarget() == target) | 
					
						
							| 
									
										
										
										
											2017-10-19 12:48:58 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 			action->Resume(); | 
					
						
							| 
									
										
										
										
											2017-10-19 12:48:58 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | void e2d::ActionManager::PauseAllBindedWith(Node * target) | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 	if (running_actions_.empty() || target == nullptr) | 
					
						
							| 
									
										
										
										
											2018-05-22 00:11:57 +08:00
										 |  |  |  | 		return; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 	for (const auto& action : running_actions_) | 
					
						
							| 
									
										
										
										
											2017-10-19 12:48:58 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 		if (action->GetTarget() == target) | 
					
						
							| 
									
										
										
										
											2017-10-19 12:48:58 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 			action->Pause(); | 
					
						
							| 
									
										
										
										
											2017-10-19 12:48:58 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | void e2d::ActionManager::StopAllBindedWith(Node * target) | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 	if (running_actions_.empty() || target == nullptr) | 
					
						
							| 
									
										
										
										
											2018-05-22 00:11:57 +08:00
										 |  |  |  | 		return; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 	for (const auto& action : running_actions_) | 
					
						
							| 
									
										
										
										
											2017-10-19 12:48:58 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 		if (action->GetTarget() == target) | 
					
						
							| 
									
										
										
										
											2017-10-19 12:48:58 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 			action->Stop(); | 
					
						
							| 
									
										
										
										
											2017-10-19 12:48:58 +08:00
										 |  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | void e2d::ActionManager::Start(Action * action, Node * target, bool paused) | 
					
						
							| 
									
										
										
										
											2018-05-08 17:40:36 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-08 20:03:29 +08:00
										 |  |  |  | 	WARN_IF(action == nullptr, "Action NULL pointer exception!"); | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 	WARN_IF(target == nullptr, "GetTarget node NULL pointer exception!"); | 
					
						
							| 
									
										
										
										
											2018-05-08 17:40:36 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	if (action && target) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 		if (action->target_ == nullptr) | 
					
						
							| 
									
										
										
										
											2018-05-24 12:24:39 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 			auto iter = std::find(running_actions_.begin(), running_actions_.end(), action); | 
					
						
							|  |  |  |  | 			if (iter == running_actions_.end()) | 
					
						
							| 
									
										
										
										
											2018-05-24 12:24:39 +08:00
										 |  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 				action->Retain(); | 
					
						
							|  |  |  |  | 				action->StartWithTarget(target); | 
					
						
							|  |  |  |  | 				action->running_ = !paused; | 
					
						
							|  |  |  |  | 				running_actions_.push_back(action); | 
					
						
							| 
									
										
										
										
											2018-05-24 12:24:39 +08:00
										 |  |  |  | 			} | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 		else | 
					
						
							|  |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2018-08-15 00:06:03 +08:00
										 |  |  |  | 			throw Exception("<EFBFBD><EFBFBD> Action <20><><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4>Ŀ<EFBFBD><C4BF>"); | 
					
						
							| 
									
										
										
										
											2018-05-24 12:24:39 +08:00
										 |  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2018-05-08 17:40:36 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | void e2d::ActionManager::Resume(const String& name) | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 	if (running_actions_.empty() || name.IsEmpty()) | 
					
						
							| 
									
										
										
										
											2018-05-22 00:11:57 +08:00
										 |  |  |  | 		return; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 	for (const auto& action : running_actions_) | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 		if (action->GetName() == name) | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 			action->Resume(); | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | void e2d::ActionManager::Pause(const String& name) | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 	if (running_actions_.empty() || name.IsEmpty()) | 
					
						
							| 
									
										
										
										
											2018-05-22 00:11:57 +08:00
										 |  |  |  | 		return; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 	for (const auto& action : running_actions_) | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 		if (action->GetName() == name) | 
					
						
							| 
									
										
										
										
											2017-10-19 12:48:58 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 			action->Pause(); | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | void e2d::ActionManager::Stop(const String& name) | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 	if (running_actions_.empty() || name.IsEmpty()) | 
					
						
							| 
									
										
										
										
											2018-05-22 00:11:57 +08:00
										 |  |  |  | 		return; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 	for (const auto& action : running_actions_) | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 		if (action->GetName() == name) | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 			action->Stop(); | 
					
						
							| 
									
										
										
										
											2017-10-19 12:48:58 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | void e2d::ActionManager::ClearAllBindedWith(Node * target) | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-08 17:40:36 +08:00
										 |  |  |  | 	if (target) | 
					
						
							| 
									
										
										
										
											2017-10-19 12:48:58 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-08-12 15:38:02 +08:00
										 |  |  |  | 		auto iter = std::find_if( | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 			running_actions_.begin(), | 
					
						
							|  |  |  |  | 			running_actions_.end(), | 
					
						
							|  |  |  |  | 			[target](Action* action) ->bool { return action->GetTarget() == target; } | 
					
						
							| 
									
										
										
										
											2018-08-12 15:38:02 +08:00
										 |  |  |  | 		); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 		if (iter != running_actions_.end()) | 
					
						
							| 
									
										
										
										
											2017-10-19 12:48:58 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 			(*iter)->Release(); | 
					
						
							|  |  |  |  | 			running_actions_.erase(iter); | 
					
						
							| 
									
										
										
										
											2017-10-19 12:48:58 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | void e2d::ActionManager::ClearAll() | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 	if (!running_actions_.empty()) | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 		for (const auto& action : running_actions_) | 
					
						
							| 
									
										
										
										
											2018-07-21 22:57:21 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 			action->Release(); | 
					
						
							| 
									
										
										
										
											2018-07-21 22:57:21 +08:00
										 |  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 		running_actions_.clear(); | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-07-21 22:57:21 +08:00
										 |  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 	actions_.clear(); | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | std::vector<e2d::Action*> e2d::ActionManager::Get(const String& name) | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-10 00:58:43 +08:00
										 |  |  |  | 	std::vector<Action*> actions; | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 	for (const auto& action : actions_) | 
					
						
							| 
									
										
										
										
											2017-10-19 12:48:58 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 		if (action->GetName() == name) | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2018-05-10 00:58:43 +08:00
										 |  |  |  | 			actions.push_back(action); | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-10-19 12:48:58 +08:00
										 |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-05-10 00:58:43 +08:00
										 |  |  |  | 	return std::move(actions); | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | const std::vector<e2d::Action*>& e2d::ActionManager::GetAll() | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 	return actions_; | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | void e2d::ActionManager::UpdateTime() | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 	for (const auto& action : running_actions_) | 
					
						
							| 
									
										
										
										
											2017-10-19 12:48:58 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  |  | 		action->ResetTime(); | 
					
						
							| 
									
										
										
										
											2017-10-19 12:48:58 +08:00
										 |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  |  | } |