Example #1
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.SetInstanceNameString(agentIntanceName, ParentType.PT_INSTANCE);
                }
                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(null, paramsTokens);
                }
            }

            return method;
        }
Example #2
0
		public static int GetActionCount(string actionString)
		{
			lock (m_actions_count)
			{
				int count = 0;
				CStringID actionId = new CStringID(actionString);
				if (m_actions_count.ContainsKey(actionId))
				{
					count = m_actions_count[actionId];
				}
				
				return count;
			}
		}
Example #3
0
		public static int UpdateActionCount(string actionString)
		{
			lock (m_actions_count)
			{
				int count = 1;
				CStringID actionId = new CStringID(actionString);
				if (!m_actions_count.ContainsKey(actionId))
				{
					m_actions_count[actionId] = count;
				}
				else
				{
					count = m_actions_count[actionId];
					count++;
					m_actions_count[actionId] = count;
				}
				
				return count;
			}
		}