113 lines
3.0 KiB
C++
113 lines
3.0 KiB
C++
#ifndef TJDUI_APP_GAME_H
|
||
#define TJDUI_APP_GAME_H
|
||
|
||
#include "TjdUiAppGameAdapter.h"
|
||
#include "TjdUiAppGamePresenter.h"
|
||
#include "View.h"
|
||
#include "components/ui_button.h"
|
||
#include "components/ui_image_view.h"
|
||
#include "components/ui_label.h"
|
||
#include "components/ui_list.h"
|
||
#include "components/ui_scroll_view.h"
|
||
#include "graphic_timer.h"
|
||
#include "components/ui_transform_group.h"
|
||
|
||
using namespace OHOS;
|
||
|
||
namespace TJD {
|
||
|
||
class GameItemViewOnClickedListener : public UIView::OnClickListener
|
||
{
|
||
public:
|
||
GameItemViewOnClickedListener() {}
|
||
virtual ~GameItemViewOnClickedListener() {}
|
||
virtual bool OnClick(UIView &view, const ClickEvent &event) ;
|
||
|
||
private:
|
||
};
|
||
class GameItemView : public OHOS::UITransformGroup
|
||
{
|
||
public:
|
||
GameItemView(GameItemIndex index, const char *name, int iconResId) ;
|
||
~GameItemView();
|
||
|
||
private:
|
||
GameItemViewOnClickedListener onClickListener_;
|
||
OHOS::UILabel lblName_;
|
||
OHOS::UIImageView imgIcon_;
|
||
};
|
||
|
||
class GameItemViewBase : public OHOS::UIViewGroup
|
||
{
|
||
public:
|
||
// virtual ~GameItemViewBase() {}
|
||
|
||
/**
|
||
* @brief 显示设置项,在此做更新UI操作,子类需要重写此方法
|
||
*/
|
||
virtual void Show() = 0;
|
||
|
||
// /**
|
||
// * @brief 下发退出事件,子类需要重写此方法
|
||
// * @param view
|
||
// */
|
||
// virtual void PageExitEvent(bool isSwipe) = 0;
|
||
};
|
||
|
||
class TjdUiAppGamePresenter;
|
||
class TjdUiAppGameView : public OHOS::View<TjdUiAppGamePresenter>, public OHOS::UIViewGroup
|
||
{
|
||
public:
|
||
TjdUiAppGameView();
|
||
~TjdUiAppGameView();
|
||
static TjdUiAppGameView *GetInstance(void);
|
||
void OnStart() override;
|
||
void OnStop() override;
|
||
void InitGameList();
|
||
void InitGameView();
|
||
void ChooseGameItem(GameItemIndex index);
|
||
void InitGameItemView(GameItemIndex index);
|
||
void ReturnToMainPage();
|
||
OHOS::List<GameCaseInfo> &GetGameItemList() { return *gameItemList_; };
|
||
|
||
private:
|
||
GameItemView *gameItemView_[GAME_MAX_INDEX]{nullptr};
|
||
OHOS::UIViewGroup *mainContainer_{nullptr};
|
||
OHOS::UIScrollView gameView_;
|
||
OHOS::UIViewGroup titleContainer_;
|
||
OHOS::UILabel lblTitle_gameView;
|
||
// OHOS::ImageInfo* imgInfo{nullptr};
|
||
// OHOS::UIList gameList_;
|
||
UIView::OnClickListener *onClickListener_{nullptr};
|
||
UIView::OnDragListener *OnDragListener_{nullptr};
|
||
TjdUiAppGameAdapter gameListAdapter_;
|
||
OHOS::List<GameCaseInfo> *gameItemList_{nullptr};
|
||
OHOS::ImageInfo *imgItemInfo[GAME_MAX_INDEX];
|
||
|
||
GameItemViewBase *itemView_[GAME_MAX_INDEX]{nullptr};
|
||
static GameItemIndex currentGameItem_;
|
||
};
|
||
|
||
// class GameItemViewBase : public OHOS::UIScrollView
|
||
// {
|
||
// public:
|
||
// /**
|
||
// * @brief 游戏开始项,在此做更新UI操作,子类需要重写此方法
|
||
// */
|
||
// virtual void GamePlay() = 0;
|
||
|
||
// /**
|
||
// * @brief 游戏暂停项,子类需要重写此方法
|
||
// */
|
||
// virtual void GamePause() = 0;
|
||
|
||
// /**
|
||
// * @brief 游戏退出项,子类需要重写此方法
|
||
// * @param view
|
||
// */
|
||
// virtual void GameExit() = 0;
|
||
// };
|
||
|
||
} // namespace TJD
|
||
|
||
#endif |