73 lines
2.0 KiB
C++
73 lines
2.0 KiB
C++
#include "TjdUiAppGamePresenter.h"
|
|
#include "NativeAbility.h"
|
|
#include "TjdUiAppIds.h"
|
|
#include "dock/input_device.h"
|
|
#include "sys_config.h"
|
|
#include "TjdUiAppGameView.h"
|
|
#include <stdio.h>
|
|
#include "TjdUiRegisterManager.h"
|
|
|
|
using namespace OHOS;
|
|
|
|
#define ENABLE_PRINT_INFO 1
|
|
#if ENABLE_PRINT_INFO
|
|
#define static_print_info(...) sys_ui_log_i(__VA_ARGS__) // 一般信息打印宏控制
|
|
#define static_print_warn(...) sys_ui_log_w(__VA_ARGS__) // 警告信息打印一般常开
|
|
#define static_print_error(...) sys_ui_log_e(__VA_ARGS__) // 错误信息打印一般常开
|
|
#define static_print_debug(...) sys_ui_log_d(__VA_ARGS__) // 调试信息打印
|
|
#else
|
|
#define static_print_info(...)
|
|
#define static_print_warn(...)
|
|
#define static_print_error(...)
|
|
#define static_print_debug(...)
|
|
#endif
|
|
|
|
namespace TJD {
|
|
|
|
// TJD_REGIST_NATIVE_MENU(TJD_APP_VIEW_GAME, TjdUiAppGameView, TjdUiAppGamePresenter, IMG_MENU_LIST_MENU_GAME, STR_ID_27);
|
|
|
|
static TjdUiAppGamePresenter *g_pv_AppGamePresenter = nullptr;
|
|
|
|
TjdUiAppGamePresenter::TjdUiAppGamePresenter() { g_pv_AppGamePresenter = this; }
|
|
|
|
TjdUiAppGamePresenter::~TjdUiAppGamePresenter() { g_pv_AppGamePresenter = nullptr; }
|
|
|
|
TjdUiAppGamePresenter *TjdUiAppGamePresenter::GetInstance(void) { return g_pv_AppGamePresenter; }
|
|
|
|
void TjdUiAppGamePresenter::OnStart()
|
|
{
|
|
TjdUiCommonOnKeyListener::GetInstance()->SetOnKeyActListener(TjdUiAppGamePresenter::GetInstance(), KeyModelType::APP_KEY_TYPE);
|
|
}
|
|
|
|
void TjdUiAppGamePresenter::OnPause()
|
|
{
|
|
Presenter::OnPause();
|
|
}
|
|
|
|
void TjdUiAppGamePresenter::OnResume()
|
|
{
|
|
Presenter::OnResume();
|
|
}
|
|
|
|
void TjdUiAppGamePresenter::OnStop()
|
|
{
|
|
TjdUiCommonOnKeyListener::GetInstance()->ClearOnKeyActListener(KeyModelType::APP_KEY_TYPE);
|
|
}
|
|
|
|
bool TjdUiAppGamePresenter::OnKeyAct(OHOS::UIView &view, const OHOS::KeyEvent &event)
|
|
{
|
|
if (!TjdUiCommonOnKeyListener::CheckIsExitEvent(event)) {
|
|
return true;
|
|
}
|
|
ExitGameView();
|
|
|
|
return false;
|
|
}
|
|
|
|
void TjdUiAppGamePresenter::ExitGameView(void)
|
|
{
|
|
OHOS::NativeAbility::GetInstance().ChangePreSlice();
|
|
}
|
|
|
|
} // namespace TJD
|