值得一提的是 所有以m_开头的变量全部是类的成员变量,下面也给出这些变量的定义,其中有几个变量在类的构造函数中有初始化,也给出来
//标志变量 public: bool m_IsNeedExit; //UI变量 public: Sprite* m_spr_ExitTip; //退出提示 Armature* Dialog; //对话框 Label* m_DialogMsg; //对话框消息 Button* m_DialogConfirm; //对话框确认按钮 Button* m_DialogCancel; //对话框取消按钮 //层变量 Layer* m_UI_Dialog; //对话框层 最高层 Layer* m_UI_Tool; //工具栏层 次高层 Layer* m_UI_Game; //游戏层 低层 Layer* m_UI_Background; //背景层 底层 //回调函数变量 public: std::functionm_Dialog_ConfirmCallback; //对话框确认回调 //------------------------------函数---------------------------------- public: MomoScene():m_IsNeedExit(false),m_Dialog_ConfirmCallback(nullptr){}; ~MomoScene(){};
下面是对话框的使用方法:
auto fun = [=](Ref* e){
CCLog("OK You enter the Confirm");
};
LoadDialog("You Enter Continue",fun,true);
上述对话框的实现效果如下:(因为素材不太好,为了更好的展示效果,我在显示对话框的时候将菜单移除了)



表示不知道GIF图片要怎么展示出来 就先看着截图吧