#ifndef __GameNotice_h__ #define __GameNotice_h__ #include "cocos2d.h" #include "cocostudio/CocoStudio.h" #include "UI/CocosGUI.h" #include "UI/UISlider.h" USING_NS_CC; using namespace cocos2d::ui; /*#include */ struct NotifyItem { int repeat; bool isForever; std::string message; NotifyItem(const std::string& strmessage, int irepeat, bool bForever) { message = strmessage; repeat = irepeat; isForever = bForever; } }; class SystemNotice : public Layer { protected: SystemNotice(); virtual ~SystemNotice(); public: static SystemNotice* createSystemNotice(const char* stencil_Path); virtual bool init(const char* stencil_Path); void postMessage(const std::string& message, int repeat = 0, bool bForever = false); void setCallBack(std::function sure); void setNoticTextColor(Color4B color); void setTextFontSize(int fontSize); Label* createLabel(const std::string& text, float fontSize, Color3B color); private: Size _showSize; Size _wordSize; Label* _text; std::queue _notifyMsgs; bool _runing; private: void start(); void stop(); void updateNextMessage(); private: void moveWord(float delta); private: std::function _sure; }; #endif // __GameNotice_h__