去除Game::reset方法

This commit is contained in:
Nomango 2018-07-05 16:44:47 +08:00
parent caf6297bf1
commit 95a811cc17
3 changed files with 8 additions and 16 deletions

View File

@ -103,21 +103,13 @@ void e2d::Game::pause()
void e2d::Game::resume() void e2d::Game::resume()
{ {
if (_paused) if (_paused && !_ended)
{
Game::reset();
}
_paused = false;
}
void e2d::Game::reset()
{
if (!_ended)
{ {
Time::__reset(); Time::__reset();
Timer::__resetAll(); Timer::__resetAll();
ActionManager::getInstance()->__resetAll(); ActionManager::getInstance()->__resetAll();
} }
_paused = false;
} }
bool e2d::Game::isPaused() bool e2d::Game::isPaused()

View File

@ -359,20 +359,23 @@ void e2d::Window::setTypewritingEnabled(bool enabled)
void e2d::Window::info(const String & text, const String & title) void e2d::Window::info(const String & text, const String & title)
{ {
Game::getInstance()->pause();
::MessageBox(_hWnd, (LPCWSTR)text, (LPCWSTR)title, MB_ICONINFORMATION | MB_OK); ::MessageBox(_hWnd, (LPCWSTR)text, (LPCWSTR)title, MB_ICONINFORMATION | MB_OK);
Game::getInstance()->reset(); Game::getInstance()->resume();
} }
void e2d::Window::warning(const String& title, const String& text) void e2d::Window::warning(const String& title, const String& text)
{ {
Game::getInstance()->pause();
::MessageBox(_hWnd, (LPCWSTR)text, (LPCWSTR)title, MB_ICONWARNING | MB_OK); ::MessageBox(_hWnd, (LPCWSTR)text, (LPCWSTR)title, MB_ICONWARNING | MB_OK);
Game::getInstance()->reset(); Game::getInstance()->resume();
} }
void e2d::Window::error(const String & text, const String & title) void e2d::Window::error(const String & text, const String & title)
{ {
Game::getInstance()->pause();
::MessageBox(_hWnd, (LPCWSTR)text, (LPCWSTR)title, MB_ICONERROR | MB_OK); ::MessageBox(_hWnd, (LPCWSTR)text, (LPCWSTR)title, MB_ICONERROR | MB_OK);
Game::getInstance()->reset(); Game::getInstance()->resume();
} }

View File

@ -37,9 +37,6 @@ public:
// 清理资源 // 清理资源
void cleanup(); void cleanup();
// 重置游戏内部计时
void reset();
// 游戏是否暂停 // 游戏是否暂停
bool isPaused(); bool isPaused();