1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- //
- // REDBatchNode.h
- // cocos2d_libs
- //
- // Created by xiao鱼哥 on 2023/2/2.
- //
- #ifndef REDBatchNode_h
- #define REDBatchNode_h
- #include "REDReader.h"
- #include "REDBatchNodeHeader.h"
- NS_CC_BEGIN
- class EventDispatcher;
- class EventCustom;
- class EventListenerCustom;
- class Sprite;
- NS_CC_END
- namespace redream {
- class REDBatchNode : public Ref,public REDBatchNodeListener
- {
- #pragma mark - 预定义一些类型
- using string = std::string;
- using Node = cocos2d::Node;
- using REDPlistPic = std::unordered_map<string,std::vector<string>>;
- using VecNode = std::vector<Node*>;
- using EventListenerCustom = cocos2d::EventListenerCustom;
- using Sprite = cocos2d::Sprite;
- #pragma
- public:
- static REDBatchNode * create();
- REDBatchNode();
- virtual ~REDBatchNode();
- ///设置RootNode和对应的AnimMgr,同时监听以CCBName为key的自定义事件.
- void setRootNode(Node* node,REDAnimationManager* animMgr);
- ///从Reader中读取的信息赋值到batchNode
- void setBatchPlistSpriteNames(REDPlistPic & SpNames);
- virtual void onListener()override;
- protected:
- virtual bool init();
- void mergeFinish();
- void batchEnd(Node* node);
- bool resetNode(Node* node);
- bool resetSprite(Sprite* sp);
- Node* _rootNode = nullptr;
- REDAnimationManager* _animMgr = nullptr;
- ///需要合批的 plist图对应的所有的SpriteNames.
- REDPlistPic _needBatchPlistSpriteNames;
-
- bool _useCache = false;
- EventListenerCustom* _mergeListerner=nullptr;
- string _redreamName;
- };
- }
- #endif /* REDBatchNode_h */
|