コード例 #1
0
ファイル: Context.cs プロジェクト: raptoravis/behaviac1
        public CNamedEvent FindNamedEventTemplate(List <CMethodBase> methods, string eventName)
        {
            CStringID eventID = new CStringID(eventName);

            //reverse, so the event in the derived class can override the one in the base class
            for (int i = methods.Count - 1; i >= 0; --i)
            {
                CMethodBase pMethod    = methods[i];
                string      methodName = pMethod.Name;
                CStringID   methodID   = new CStringID(methodName);
                if (methodID == eventID && pMethod.IsNamedEvent())
                {
                    Debug.Check(pMethod is CNamedEvent);
                    CNamedEvent pNamedMethod = (CNamedEvent)pMethod;

                    if (pNamedMethod.IsStatic())
                    {
                        InsertEventGlobal(pNamedMethod.GetClassNameString(), pNamedMethod);
                        return(pNamedMethod);
                    }

                    return(pNamedMethod);
                }
            }

            return(null);
        }
コード例 #2
0
ファイル: Action.cs プロジェクト: wujiangu/wanshiwu0.1
        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);
        }
コード例 #3
0
        public override bool Equals(System.Object obj)
        {
            // If parameter is null return false.
            if (obj == null)
            {
                return(false);
            }

            // If parameter cannot be cast to CStringID return false.
            if (obj is CStringID)
            {
                CStringID p = (CStringID)obj;

                // Return true if the fields match:
                return(m_id == p.m_id);
            }
            else if (obj is string)
            {
                CStringID p = new CStringID((string)obj);

                // Return true if the fields match:
                return(m_id == p.m_id);
            }

            return(false);
        }
コード例 #4
0
ファイル: Context.cs プロジェクト: TonyDongGuaPi/joework
        public CNamedEvent FindNamedEventTemplate(ListView <CMethodBase> methods, string eventName)
        {
            CStringID b = new CStringID(eventName);
            int       i = methods.get_Count() - 1;

            while (i >= 0)
            {
                CMethodBase cMethodBase = methods.get_Item(i);
                string      name        = cMethodBase.GetName();
                CStringID   a           = new CStringID(name);
                if (a == b && cMethodBase.IsNamedEvent())
                {
                    CNamedEvent cNamedEvent = (CNamedEvent)cMethodBase;
                    if (cNamedEvent.IsStatic())
                    {
                        this.InsertEventGlobal(cNamedEvent.GetClassNameString(), cNamedEvent);
                        return(cNamedEvent);
                    }
                    return(cNamedEvent);
                }
                else
                {
                    i--;
                }
            }
            return(null);
        }
コード例 #5
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);
        }
コード例 #6
0
 public bool Equals(CStringID p)
 {
     if (p == 0)
     {
         return(false);
     }
     return(this.m_id == p.m_id);
 }
コード例 #7
0
 public CMethodBase(MethodBase m, MethodMetaInfoAttribute a, string methodNameOverride)
 {
     this.m_id          = new CStringID();
     this.method_       = m;
     this.descAttrbute_ = a;
     this.m_name        = string.IsNullOrEmpty(methodNameOverride) ? this.method_.Name : methodNameOverride;
     this.m_id.SetId(this.m_name);
 }
コード例 #8
0
 protected CMethodBase(CMethodBase copy)
 {
     this.m_instanceName = copy.m_instanceName;
     this.m_parentType   = copy.m_parentType;
     this.method_        = copy.method_;
     this.descAttrbute_  = copy.descAttrbute_;
     this.m_name         = copy.m_name;
     this.m_id           = copy.m_id;
 }
コード例 #9
0
ファイル: Agent.cs プロジェクト: isoundy000/wzry-1
        public static CMethodBase CreateMethod(CStringID agentClassId, CStringID methodClassId)
        {
            CMethodBase base2 = FindMethodBase(agentClassId, methodClassId);

            if (base2 != null)
            {
                return(base2.clone());
            }
            return(null);
        }
コード例 #10
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            CStringID cStringID = (CStringID)obj;

            return(this.m_id == cStringID.m_id);
        }
コード例 #11
0
        public static CMethodBase CreateMethod(CStringID agentClassId, CStringID methodClassId)
        {
            CMethodBase cMethodBase = Agent.FindMethodBase(agentClassId, methodClassId);

            if (cMethodBase != null)
            {
                return(cMethodBase.clone());
            }
            return(null);
        }
コード例 #12
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);
        }
コード例 #13
0
ファイル: Agent.cs プロジェクト: TonyDongGuaPi/joework
        public static Type GetTypeFromName(string typeName)
        {
            CStringID cStringID = new CStringID(typeName);

            if (Agent.Metas.ContainsKey(cStringID))
            {
                Agent.CTagObjectDescriptor cTagObjectDescriptor = Agent.Metas.get_Item(cStringID);
                return(cTagObjectDescriptor.type);
            }
            return(null);
        }
コード例 #14
0
        public bool Equals(CStringID p)
        {
            // If parameter is null return false:
            if (((object)p) == null)
            {
                return(false);
            }

            // Return true if the fields match:
            return(m_id == p.m_id);
        }
コード例 #15
0
        public static Type GetTypeFromName(string typeName)
        {
            CStringID key = new CStringID(typeName);

            if (Agent.Metas.ContainsKey(key))
            {
                Agent.CTagObjectDescriptor cTagObjectDescriptor = Agent.Metas[key];
                return(cTagObjectDescriptor.type);
            }
            return(null);
        }
コード例 #16
0
ファイル: Agent.cs プロジェクト: isoundy000/wzry-1
        public static System.Type GetTypeFromName(string typeName)
        {
            CStringID key = new CStringID(typeName);

            if (Metas.ContainsKey(key))
            {
                CTagObjectDescriptor descriptor = Metas[key];
                return(descriptor.type);
            }
            return(null);
        }
コード例 #17
0
        public static Agent.CTagObjectDescriptor GetDescriptorByName(string className)
        {
            CStringID key = new CStringID(className);

            if (Agent.Metas.ContainsKey(key))
            {
                return(Agent.Metas[key]);
            }
            Agent.CTagObjectDescriptor cTagObjectDescriptor = new Agent.CTagObjectDescriptor();
            Agent.Metas.Add(key, cTagObjectDescriptor);
            return(cTagObjectDescriptor);
        }
コード例 #18
0
ファイル: Agent.cs プロジェクト: TonyDongGuaPi/joework
        public static Agent.CTagObjectDescriptor GetDescriptorByName(string className)
        {
            CStringID cStringID = new CStringID(className);

            if (Agent.Metas.ContainsKey(cStringID))
            {
                return(Agent.Metas.get_Item(cStringID));
            }
            Agent.CTagObjectDescriptor cTagObjectDescriptor = new Agent.CTagObjectDescriptor();
            Agent.Metas.Add(cStringID, cTagObjectDescriptor);
            return(cTagObjectDescriptor);
        }
コード例 #19
0
 public CNamedEvent FindEventStatic(string eventName, string className)
 {
     if (this.ms_eventInfosGlobal.ContainsKey(className))
     {
         DictionaryView <CStringID, CNamedEvent> dictionaryView = this.ms_eventInfosGlobal[className];
         CStringID key = new CStringID(eventName);
         if (dictionaryView.ContainsKey(key))
         {
             return(dictionaryView[key]);
         }
     }
     return(null);
 }
コード例 #20
0
ファイル: Agent.cs プロジェクト: isoundy000/wzry-1
        public static CTagObjectDescriptor GetDescriptorByName(string className)
        {
            CStringID key = new CStringID(className);

            if (Metas.ContainsKey(key))
            {
                return(Metas[key]);
            }
            CTagObjectDescriptor descriptor = new CTagObjectDescriptor();

            Metas.Add(key, descriptor);
            return(descriptor);
        }
コード例 #21
0
ファイル: Context.cs プロジェクト: TonyDongGuaPi/joework
 public CNamedEvent FindEventStatic(string eventName, string className)
 {
     if (this.ms_eventInfosGlobal.ContainsKey(className))
     {
         DictionaryView <CStringID, CNamedEvent> dictionaryView = this.ms_eventInfosGlobal.get_Item(className);
         CStringID cStringID = new CStringID(eventName);
         if (dictionaryView.ContainsKey(cStringID))
         {
             return(dictionaryView.get_Item(cStringID));
         }
     }
     return(null);
 }
コード例 #22
0
        public static CMethodBase FindMethodBase(string propertyName)
        {
            int num = propertyName.LastIndexOf(':');

            if (num != -1)
            {
                string    str          = propertyName.Substring(0, num - 1);
                CStringID agentClassId = new CStringID(str);
                CStringID propertyId   = new CStringID(propertyName.Substring(num + 1));
                return(Agent.FindMethodBase(agentClassId, propertyId));
            }
            return(null);
        }
コード例 #23
0
ファイル: Context.cs プロジェクト: isoundy000/wzry-1
 public void InsertEventGlobal(string className, CNamedEvent pEvent)
 {
     if (this.FindEventStatic(className, pEvent.GetName()) == null)
     {
         if (!this.ms_eventInfosGlobal.ContainsKey(className))
         {
             this.ms_eventInfosGlobal.Add(className, new DictionaryView <CStringID, CNamedEvent>());
         }
         DictionaryView <CStringID, CNamedEvent> view = this.ms_eventInfosGlobal[className];
         CNamedEvent event3 = (CNamedEvent)pEvent.clone();
         CStringID   key    = new CStringID(event3.GetName());
         view.Add(key, event3);
     }
 }
コード例 #24
0
ファイル: Agent.cs プロジェクト: isoundy000/wzry-1
        public static CMemberBase FindMemberBase(string propertyName)
        {
            string agentClassName = null;
            int    length         = ParsePropertyNames(propertyName, ref agentClassName);

            if (length != -1)
            {
                string    str          = propertyName.Substring(0, length).Replace("::", ".");
                CStringID agentClassId = new CStringID(str);
                CStringID propertyId   = new CStringID(agentClassName);
                return(FindMemberBase(agentClassId, propertyId));
            }
            return(null);
        }
コード例 #25
0
        public static CMemberBase FindMemberBase(string propertyName)
        {
            string str = null;
            int    num = Agent.ParsePropertyNames(propertyName, ref str);

            if (num != -1)
            {
                string    str2         = propertyName.Substring(0, num).Replace("::", ".");
                CStringID agentClassId = new CStringID(str2);
                CStringID propertyId   = new CStringID(str);
                return(Agent.FindMemberBase(agentClassId, propertyId));
            }
            return(null);
        }
コード例 #26
0
ファイル: Context.cs プロジェクト: TonyDongGuaPi/joework
 public void InsertEventGlobal(string className, CNamedEvent pEvent)
 {
     if (this.FindEventStatic(className, pEvent.GetName()) == null)
     {
         if (!this.ms_eventInfosGlobal.ContainsKey(className))
         {
             this.ms_eventInfosGlobal.Add(className, new DictionaryView <CStringID, CNamedEvent>());
         }
         DictionaryView <CStringID, CNamedEvent> dictionaryView = this.ms_eventInfosGlobal.get_Item(className);
         CNamedEvent cNamedEvent = (CNamedEvent)pEvent.clone();
         CStringID   cStringID   = new CStringID(cNamedEvent.GetName());
         dictionaryView.Add(cStringID, cNamedEvent);
     }
 }
コード例 #27
0
ファイル: Agent.cs プロジェクト: isoundy000/wzry-1
        private CNamedEvent findEvent(string eventName)
        {
            CTagObjectDescriptor descriptor = this.GetDescriptor();
            int         contextId           = this.GetContextId();
            CNamedEvent event2 = findNamedEventTemplate(descriptor.ms_methods, eventName, contextId);

            if (event2 != null)
            {
                CNamedEvent event3 = (CNamedEvent)event2.clone();
                CStringID   gid    = new CStringID(eventName);
                this.EventInfos[gid] = event3;
                return(event3);
            }
            return(null);
        }
コード例 #28
0
        private CNamedEvent findEvent(string eventName)
        {
            Agent.CTagObjectDescriptor descriptor = this.GetDescriptor();
            int         contextId   = this.GetContextId();
            CNamedEvent cNamedEvent = Agent.findNamedEventTemplate(descriptor.ms_methods, eventName, contextId);

            if (cNamedEvent != null)
            {
                CNamedEvent cNamedEvent2 = (CNamedEvent)cNamedEvent.clone();
                CStringID   key          = new CStringID(eventName);
                this.EventInfos[key] = cNamedEvent2;
                return(cNamedEvent2);
            }
            return(null);
        }
コード例 #29
0
ファイル: Context.cs プロジェクト: raptoravis/behaviac1
        public CNamedEvent FindEventStatic(string eventName, string className)
        {
            if (ms_eventInfosGlobal.ContainsKey(className))
            {
                Dictionary <CStringID, CNamedEvent> events = ms_eventInfosGlobal[className];
                CStringID eventID = new CStringID(eventName);

                if (events.ContainsKey(eventID))
                {
                    CNamedEvent pEvent = events[eventID];
                    return(pEvent);
                }
            }

            return(null);
        }
コード例 #30
0
ファイル: Context.cs プロジェクト: raptoravis/behaviac1
        public void InsertEventGlobal(string className, CNamedEvent pEvent)
        {
            CNamedEvent toFind = FindEventStatic(className, pEvent.Name);

            if (toFind == null)
            {
                if (!ms_eventInfosGlobal.ContainsKey(className))
                {
                    ms_eventInfosGlobal.Add(className, new Dictionary <CStringID, CNamedEvent>());
                }

                Dictionary <CStringID, CNamedEvent> events = ms_eventInfosGlobal[className];

                CNamedEvent e       = (CNamedEvent)pEvent.clone();
                CStringID   eventId = new CStringID(e.Name);
                events.Add(eventId, e);
            }
        }