예제 #1
0
        static bool CheckWarning_ExecuteNode(ActionNode actionNode, bool isActive)
        {
            bool haveWarning = false;

            if (actionNode is ExecuteNode)
            {
                ExecuteNode executeNode = (ExecuteNode)actionNode;
                haveWarning = CheckWarning_EventElementLimit(actionNode, isActive, executeNode.OnExecute, 1, true, "OnExecute");
                if (haveWarning)
                {
                    return(true);
                }
            }

            // get all child execute nodes
            ExecuteNode[] tmpENS = actionNode.GetComponentsInChildren <ExecuteNode>();

            // check warning children of this node for OnExecute limit
            for (int i = 0; i < tmpENS.Length; i++)
            {
                if (CheckWarning_EventElementLimit(actionNode, isActive, tmpENS[i].OnExecute, 1))
                {
                    haveWarning = true;
                    break;
                }
            }
            return(haveWarning);
        }
예제 #2
0
        static bool CheckError_ExecuteNode(ActionNode actionNode, bool isActive)
        {
            bool haveError = false;

            if (actionNode is ExecuteNode)
            {
                ExecuteNode executeNode = (ExecuteNode)actionNode;
                haveError = CheckEventError(actionNode, executeNode.OnExecute, true, "OnExecute");
                if (haveError)
                {
                    return(true);
                }
            }
            // get all child execute nodes
            ExecuteNode[] tmpENS = actionNode.GetComponentsInChildren <ExecuteNode>();

            // error in any children
            for (int i = 0; i < tmpENS.Length; i++)
            {
                if (CheckEventError(actionNode, tmpENS[i].OnExecute))
                {
                    haveError = true;
                    break;
                }
            }
            return(haveError);
        }
예제 #3
0
        static void Compute_ExecuteNode(ActionNode actionNode, Rect placeRect, bool isActive, bool haveWarning, bool haveError)
        {
            ExecuteNode executeNode     = (ExecuteNode)actionNode;
            string      typeName        = "> ";
            int         tmpCommentIndex = 90;
            string      detailsText     = "";

            #region task information
            // check there is any target
            if (executeNode.OnExecute == null)
            {
                return;
            }
            if (executeNode.OnExecute.GetPersistentEventCount() > 0)
            {
                var eventTarget = executeNode.OnExecute.GetPersistentTarget(0);

                // Get target component name.
                string componentName = GetComponentNameFromUnityEventTarget(actionNode, eventTarget);

                // Get target gameObject name.
                string gameObjectName = GetGameObjectNameFromUnityEventTarget(actionNode, eventTarget);

                // Get target methud name.
                string methodName   = executeNode.OnExecute.GetPersistentMethodName(0);
                string methodParams = "";

                // Set detailsText.
                if (eventTarget is IDetails)
                {
                    detailsText = ((IDetails)eventTarget).GetDetails(gameObjectName, componentName, methodName, methodParams);
                }
                else
                {
                    detailsText = string.Format(" [ {0} ] . {1} . {2}({3})", gameObjectName, componentName, methodName, methodParams);
                }
            }
            else if (executeNode.GetComponent <IDefaultExcute>() != null)
            {
                UnityEventTools.AddPersistentListener(executeNode.OnExecute, executeNode.GetComponent <IDefaultExcute>().DefaultExecute);
            }
            else
            {
                // Set detailsText.
                detailsText = string.Format(" [ --- ]");
            }
            #endregion

            #region show stuff
            ShowInformations_DefultStyle(actionNode,
                                         isActive,
                                         haveWarning,
                                         haveError,
                                         typeName,
                                         detailsText,
                                         placeRect,
                                         tmpCommentIndex,
                                         COLOR_NODE);
            #endregion
        }