예제 #1
0
        public static CMethodBase LoadMethod(string value_)
        {
            string      agentIntanceName = null;
            string      agentClassName   = null;
            string      methodName       = null;
            int         startIndex       = ParseMethodNames(value_, ref agentIntanceName, ref agentClassName, ref methodName);
            CStringID   agentClassId     = new CStringID(agentClassName);
            CStringID   methodClassId    = new CStringID(methodName);
            CMethodBase base2            = Agent.CreateMethod(agentClassId, methodClassId);

            if (base2 != null)
            {
                if (Agent.IsNameRegistered(agentIntanceName))
                {
                    base2.SetInstanceNameString(agentIntanceName, ParentType.PT_INSTANCE);
                }
                string        str4        = value_.Substring(startIndex);
                List <string> paramsToken = null;
                int           length      = str4.Length;
                paramsToken = ParseForParams(str4.Substring(1, length - 2));
                if (paramsToken != null)
                {
                    base2.Load(null, paramsToken);
                }
            }
            return(base2);
        }
예제 #2
0
        public static CMethodBase LoadMethod(string value_)
        {
            string      agentInstanceName = null;
            string      str           = null;
            string      str2          = null;
            int         num           = Action.ParseMethodNames(value_, ref agentInstanceName, ref str, ref str2);
            CStringID   agentClassId  = new CStringID(str);
            CStringID   methodClassId = new CStringID(str2);
            CMethodBase cMethodBase   = Agent.CreateMethod(agentClassId, methodClassId);

            if (cMethodBase != null)
            {
                if (Agent.IsNameRegistered(agentInstanceName))
                {
                    cMethodBase.SetInstanceNameString(agentInstanceName, ParentType.PT_INSTANCE);
                }
                string        text   = value_.Substring(num);
                int           length = text.get_Length();
                string        tsrc   = text.Substring(1, length - 2);
                List <string> list   = Action.ParseForParams(tsrc);
                if (list != null)
                {
                    cMethodBase.Load(null, list);
                }
            }
            return(cMethodBase);
        }
예제 #3
0
        public static CMethodBase LoadMethod(string value_)
        {
            //Self.test_ns::AgentActionTest::Action2(0)
            string agentIntanceName = null;
            string agentClassName   = null;
            string methodName       = null;
            int    pBeginP          = ParseMethodNames(value_, ref agentIntanceName, ref agentClassName, ref methodName);

            //propertyName = FormatString("%s::%s", agentClassName, methodName);
            CStringID agentClassId = new CStringID(agentClassName);
            CStringID methodId     = new CStringID(methodName);

            CMethodBase method = Agent.CreateMethod(agentClassId, methodId);

            if (method == null)
            {
                behaviac.Debug.LogWarning(string.Format("No Method {0}::{1} registered\n", agentClassName, methodName));
                Debug.Check(false, string.Format("No Method {0}::{1} registered\n", agentClassName, methodName));
            }
            else
            {
                if (Agent.IsNameRegistered(agentIntanceName))
                {
                    method.InstanceName = agentIntanceName;
                }
                else
                {
                    //Debug.Check(agentIntanceName == "Self");
                }

                Debug.Check(method != null, string.Format("No Method {0}::{1} registered", agentClassName, methodName));
                string params_ = value_.Substring(pBeginP);

                Debug.Check(params_[0] == '(');

                List <string> paramsTokens = null;

                {
                    int len = params_.Length;

                    Debug.Check(params_[len - 1] == ')');

                    string text = params_.Substring(1, len - 2);
                    //StringUtils::SplitIntoArray(text, ",", tokens);
                    paramsTokens = ParseForParams(text);
                }

                if (paramsTokens != null)
                {
                    method.Load(paramsTokens);
                }
            }

            return(method);
        }