// ------------------------------------------------------------------------------- // THIS FILE IS ORIGINALLY GENERATED BY THE DESIGNER. // YOU ARE ONLY ALLOWED TO MODIFY CODE BETWEEN '///<<< BEGIN' AND '///<<< END'. // PLEASE MODIFY AND REGENERETE IT IN THE DESIGNER FOR CLASS/MEMBERS/METHODS, ETC. // ------------------------------------------------------------------------------- #ifndef _BEHAVIAC_RED_REDBEHAVIACTREE_H_ #define _BEHAVIAC_RED_REDBEHAVIACTREE_H_ #include "reboltBt_behaviac_headers.h" ///<<< BEGIN WRITING YOUR CODE FILE_INIT class ReboltRunDelegate; struct ReboltErrorInfo; namespace redream { class ReboltRedManager; class WaitableStateBase; class LoopWaiter; } ///<<< END WRITING YOUR CODE namespace red { ///<<< BEGIN WRITING YOUR CODE NAMESPACE_INIT typedef enum NumOperatorType{ NOT_abs = 0, //绝对值 NOT_floor, //向下取整 NOT_ceil, //向上取整 NOT_sqrt, //平方根 NOT_sin, NOT_cos, NOT_tan, NOT_asin, NOT_acos, NOT_atan, NOT_ln, //自然对数 NOT_log10, NOT_exp, NOT_pow10, } NumOperatorType; class RedBehaviacTree; class RedBehaviacTreeDelegate{ public: virtual void onTreeRunningEnd(RedBehaviacTree* tree, int endType, std::string treeName) = 0; }; ///<<< END WRITING YOUR CODE class RedBehaviacTree : public behaviac::Agent ///<<< BEGIN WRITING YOUR CODE RedBehaviacTree ///<<< END WRITING YOUR CODE { public: RedBehaviacTree(); virtual ~RedBehaviacTree(); BEHAVIAC_DECLARE_AGENTTYPE(red::RedBehaviacTree, behaviac::Agent) public: bool temporaryVariablesBool; public: float temporaryVariablesFloat; public: int temporaryVariablesInt; public: behaviac::string temporaryVariablesString; public: bool videoIsSuccess; public: void addCustomDataVar(behaviac::string blockId, behaviac::string dataName, float content); public: void addFunLocalBoolToMap(behaviac::string stringKey, bool content); public: void addFunLocalStringToMap(behaviac::string stringKey, behaviac::string content); public: void clearFunLocalMap(); public: void customFunc(behaviac::string blockId, behaviac::string funName); public: bool findSubString(behaviac::string stringKey1, behaviac::string stringKey2); public: behaviac::string floatFormat(float number, int format); public: behaviac::string floatToString(float num); public: float getCoderFloat(behaviac::string key); public: behaviac::string getCoderString(behaviac::string key); public: float getCustomFloat(behaviac::string key); public: behaviac::string getCustomString(behaviac::string key); public: bool getFunBoolVar(behaviac::string funcVarKey); public: behaviac::string getFunStringVar(behaviac::string funcVarKey); public: float getGlobalFloat(behaviac::string key); public: behaviac::string getGlobalString(behaviac::string key); public: behaviac::EBTStatus getInterstitialAdsState(behaviac::string adName); public: float getLocalTreeFloat(behaviac::string key); public: behaviac::string getLocalTreeString(behaviac::string dataKey); public: behaviac::EBTStatus getLoopState(behaviac::string blockId); public: float getLoopTimes(); public: behaviac::EBTStatus getNodeAnimState(behaviac::string nodeId, behaviac::string animPath); public: behaviac::EBTStatus getNotifyDevelopmentState(behaviac::string key); public: behaviac::EBTStatus getRewardVideoAdsState(behaviac::string adName); public: behaviac::EBTStatus getSubredTimeLineState(behaviac::string redPath, behaviac::string timeLineId); public: behaviac::EBTStatus getSubRedTreeState(behaviac::string redPath); public: behaviac::EBTStatus getTimeLineState(behaviac::string timeLineId); public: behaviac::EBTStatus getTreeState(); public: void globalListVarAdd(behaviac::string blockId, behaviac::string dataName, behaviac::string content); public: float globalListVarCount(behaviac::string dataName); public: void globalListVarDeleteAll(behaviac::string blockId, behaviac::string dataName); public: void globalListVarDeleteOne(behaviac::string blockId, behaviac::string dataName, int index); public: float globalListVarFindValueID(behaviac::string dataName, behaviac::string content); public: bool globalListVarHasValue(behaviac::string dataName, behaviac::string content); public: behaviac::string globalListVarIndexValue(behaviac::string dataName, int index); public: void globalListVarInsertBefore(behaviac::string blockId, behaviac::string dataName, int index, behaviac::string content); public: void globalListVarReplace(behaviac::string blockId, behaviac::string dataName, int index, behaviac::string content); public: void hiddenNode(behaviac::string blockId, behaviac::string nodeId); public: void hiddenRedNode(behaviac::string blockId, behaviac::string redPath, behaviac::string nodeId); public: void hiddenSelf(behaviac::string blockId); public: bool isHiddenNode(behaviac::string nodeId); public: bool isHiddenRedNode(behaviac::string redPath, behaviac::string nodeId); public: void messageSend(behaviac::string blockId, behaviac::string messageName, behaviac::string messageValue); public: float nodeGetGlobalPosX(behaviac::string nodeId); public: float nodeGetGlobalPosY(behaviac::string nodeId); public: float nodeGetPosX(behaviac::string nodeId); public: float nodeGetPosY(behaviac::string nodeId); public: void nodeSetAnimAction(behaviac::string blockId, behaviac::string nodeId, behaviac::string animPath, behaviac::string posXKey, behaviac::string posYKey, behaviac::string posXKey2, behaviac::string posYKey2); public: void nodeSetAnimActionWithCallBack(behaviac::string blockId, behaviac::string nodeId, behaviac::string animPath, behaviac::string callbacktreeId, behaviac::string posXKey, behaviac::string posYKey, behaviac::string posXKey2, behaviac::string posYKey2); public: void nodeSetAnimWaitAction(behaviac::string blockId, behaviac::string nodeId, behaviac::string animPath, behaviac::string posXKey, behaviac::string posYKey, behaviac::string posXKey2, behaviac::string posYKey2); public: void nodeSetPos(behaviac::string blockId, behaviac::string nodeId, behaviac::string posXKey, behaviac::string posYKey); public: void notifyDevelopment(behaviac::string blockId, behaviac::string key); public: void notifyDevelopmentWait(behaviac::string blockId, behaviac::string key); public: void notifyDevelopmentWithParam(behaviac::string blockId, behaviac::string key, behaviac::string paramKey); public: void notifyDevelopmentWithParamAndNode(behaviac::string blockId, behaviac::string key, behaviac::string paramKey, behaviac::string nodeId); public: void notifyDevelopmentWithParamAndNodeWait(behaviac::string blockId, behaviac::string key, behaviac::string paramKey, behaviac::string nodeId); public: void notifyDevelopmentWithParamAndSubredNode(behaviac::string blockId, behaviac::string key, behaviac::string paramKey, behaviac::string redPath, behaviac::string nodeId); public: void notifyDevelopmentWithParamAndSubredNodeWait(behaviac::string blockId, behaviac::string key, behaviac::string paramKey, behaviac::string redPath, behaviac::string nodeId); public: void notifyDevelopmentWithParamWait(behaviac::string blockId, behaviac::string key, behaviac::string paramKey); public: float numberOperator(behaviac::string floatKey1, int type); public: float numModOperator(behaviac::string floatKey1, behaviac::string floatKey2); public: behaviac::string numRandOperator(behaviac::string floatKey1); public: void onLoopEnd(); public: void playSubredTimeLine(behaviac::string blockId, behaviac::string redPath, behaviac::string actionName); public: void playSubredTimeLineWait(behaviac::string blockId, behaviac::string redPath, behaviac::string actionName); public: void playSubredTimeLineWithCallBack(behaviac::string blockId, behaviac::string redPath, behaviac::string actionName, behaviac::string callbacktreeId); public: void playTimeLine(behaviac::string blockId, behaviac::string actionName); public: void playTimeLineWait(behaviac::string blockId, behaviac::string actionName); public: void playTimeLineWithCallBack(behaviac::string blockId, behaviac::string actionName, behaviac::string callbacktreeId); public: void playWiseSound(behaviac::string blockId, behaviac::string bnkPathKey, behaviac::string eventNameKey); public: float randOperator(behaviac::string floatKey1, behaviac::string floatKey2); public: void redCustomFunc(behaviac::string blockId, behaviac::string redPath, behaviac::string funName); public: void redProgressBar(behaviac::string blockId, behaviac::string barName, float number); public: bool rewardVideoIsLoad(behaviac::string adName); public: float sceneNodeGetGlobalPosX(behaviac::string redPath, behaviac::string nodeId); public: float sceneNodeGetGlobalPosY(behaviac::string redPath, behaviac::string nodeId); public: float sceneNodeGetPosX(behaviac::string redPath, behaviac::string nodeId); public: float sceneNodeGetPosY(behaviac::string redPath, behaviac::string nodeId); public: void sceneNodeSetPos(behaviac::string blockId, behaviac::string redPath, behaviac::string nodeId, behaviac::string posXKey, behaviac::string posYKey); public: void sceneProgressBar(behaviac::string blockId, behaviac::string redPath, behaviac::string barName, float number); private: void setButtonEnable(behaviac::string blockId, behaviac::string nodeId, bool isEnable); public: void setCoderDataVar(behaviac::string blockId, behaviac::string dataName, behaviac::string content); public: void setCustomDataVar(behaviac::string blockId, behaviac::string dataName, behaviac::string content); public: void setGlobalDataVar(behaviac::string blockId, behaviac::string dataName, behaviac::string content); public: void setLabelTitle(behaviac::string blockId, behaviac::string labelName, behaviac::string content); public: void setNodeRotation(behaviac::string blockId, behaviac::string nodeId, float rotation); public: void setNodeScale(behaviac::string blockId, behaviac::string nodeId, behaviac::string scaleXKey, behaviac::string scaleYKey); public: void setSceneLabelTitle(behaviac::string blockId, behaviac::string redPath, behaviac::string labelName, behaviac::string content); public: void setSpriteImage(behaviac::string blockId, behaviac::string nodeId, behaviac::string imagePath); public: void setSpritePlist(behaviac::string blockId, behaviac::string nodeId, behaviac::string plistPath, behaviac::string frameName); private: void setSubredButtonEnable(behaviac::string blockId, behaviac::string redPath, behaviac::string nodeId, bool isEnable); public: void setSubredNodeRotation(behaviac::string blockId, behaviac::string redPath, behaviac::string nodeId, float rotation); public: void setSubredNodeScale(behaviac::string blockId, behaviac::string redPath, behaviac::string nodeId, behaviac::string scaleXKey, behaviac::string scaleYKey); public: void setSubredSpriteImage(behaviac::string blockId, behaviac::string redPath, behaviac::string nodeId, behaviac::string imagePath); public: void setSubredSpritePlist(behaviac::string blockId, behaviac::string redPath, behaviac::string nodeId, behaviac::string plistPath, behaviac::string frameName); public: void showInterstitialAds(behaviac::string blockId, behaviac::string adName); public: void showNode(behaviac::string blockId, behaviac::string nodeId); public: void showRedNode(behaviac::string blockId, behaviac::string redPath, behaviac::string nodeId); public: void showRewardVideoAds(behaviac::string blockId, behaviac::string adName); public: void showSelf(behaviac::string blockId); public: void startLoop(behaviac::string blockId); public: void stopSubredTimeLine(behaviac::string blockId, behaviac::string redPath); public: void stopTimeLine(behaviac::string blockId); public: void storageTemporaryVariables(behaviac::string keyVariables, float number); public: void storageTemporaryVariablesString(behaviac::string dataKey, behaviac::string v); public: bool stringEqual(behaviac::string stringKey1, behaviac::string stringKey2); public: float stringLen(behaviac::string stringKey1); public: behaviac::string stringLink(behaviac::string stringKey1, behaviac::string stringKey2); public: behaviac::string stringLinkMoreOperator(behaviac::string stringKeyA, behaviac::string stringKeyB, behaviac::string stringKeyC, behaviac::string stringKeyD, behaviac::string stringKeyE); public: float stringToFloat(behaviac::string str); ///<<< BEGIN WRITING YOUR CODE CLASS_PART public: void setReboltRedManager(redream::ReboltRedManager* pReboltRedManager){_reboltRedManager = pReboltRedManager;} void update(); void updateBySubTree(); void runBehaviacTree(); void setTreeName(std::string treeName){_treeName = treeName;} std::string getTreeName(){return _treeName;} void setReboltRunDelegate(ReboltRunDelegate* reboltRunDelegate){_reboltRunDelegate = reboltRunDelegate;} void setArgumentsBoolMap(const std::map &boolMap){_argumentsBoolMap = boolMap;} void setArgumentsStringMap(const std::map &stringMap){_argumentsStringMap = stringMap;} void setWaitableStateBase(redream::WaitableStateBase* wsb); void setReboltLoopManager(redream::LoopWaiter* rlm){_reboltLoopManager = rlm;} void addRedBehaviacTreeDelegate(RedBehaviacTreeDelegate* delegate); void removeRedBehaviacTreeDelegate(RedBehaviacTreeDelegate* delegate); void removeAllRedBehaviacTreeDelegate(); inline void prohibitUpdateByTree() {_canUpdateBySubTree = false;}; private: bool _isRunning; bool _canUpdateBySubTree; redream::ReboltRedManager* _reboltRedManager; std::string _treeName; std::string _runningSubtreeName; std::string _getTreeStateSubtreeName; std::string _getTreeStateRedPath; std::map _localTreeFloatMap; std::map _localTreeStringMap; std::map _argumentsBoolMap; std::map _argumentsStringMap; std::map _funLocalBoolMap; std::map _funLocalStringMap; ReboltRunDelegate* _reboltRunDelegate; int _runingAnimTag; //在一颗树上,同时只能存在一个等待结束的时间线,所以这个地方只要一个变量就足够了。 redream::WaitableStateBase* _waitableStateBase; // 等待执行类型块的逻辑管理对象 std::vector _delegateVer; redream::LoopWaiter* _reboltLoopManager; private: void onTreeStepStart(std::string blockId, std::string blockName); void processError(std::string blockId, ReboltErrorInfo& errorInfo); behaviac::EBTStatus getWaitableState(); ///<<< END WRITING YOUR CODE }; ///<<< BEGIN WRITING YOUR CODE NAMESPACE_UNINIT ///<<< END WRITING YOUR CODE } ///<<< BEGIN WRITING YOUR CODE FILE_UNINIT ///<<< END WRITING YOUR CODE #endif