コード例 #1
0
        public static void UpdatePerahpsReferenceObjectList(MonoBehaviour component, List <PerhapsReferenceObject> list)
        {
            // analytics  source code.
            var monoScript      = MonoScript.FromMonoBehaviour(component);
            var uniqueClassList = SceneObjectUtility.SceneUniqueComponentName();

            foreach (var text in monoScript.text.Split(';'))
            {
                foreach (var methodPattern in getComponentFunctionPattern)
                {
                    Match m = Regex.Match(text, methodPattern);

                    if (m.Success)
                    {
                        var className = m.Groups ["call"].ToString();

                        if (!list.Exists(item => item.compType == component.GetType() && item.referenceMonobehaviourName == className))
                        {
                            var method = new PerhapsReferenceObject()
                            {
                                compType = component.GetType(),
                                referenceMonobehaviourName = className,
                                monoscript = monoScript,
                            };
                            list.Add(method);

                            uniqueClassList.RemoveAll(item => item.Name == className);
                        }
                    }
                }

                foreach (var className in uniqueClassList)
                {
                    if (component.GetType() == className)
                    {
                        continue;
                    }
                    var result = text.IndexOf(className.Name);
                    if (result != -1 && result != 0)
                    {
                        if (!list.Exists(item => item.compType == component.GetType() && item.referenceMonobehaviourName == className.Name))
                        {
                            var method = new PerhapsReferenceObject()
                            {
                                compType = component.GetType(),
                                referenceMonobehaviourName = className.Name,
                                monoscript = monoScript,
                            };
                            list.Add(method);
                            continue;
                        }
                    }
                }
            }
        }
コード例 #2
0
        public static void UpdatePerahpsReferenceObjectList(MonoBehaviour component, List<PerhapsReferenceObject> list)
        {
            // analytics  source code.
            var monoScript = MonoScript.FromMonoBehaviour(component);
            var uniqueClassList = SceneObjectUtility.SceneUniqueComponentName();

            foreach (var text in monoScript.text.Split(';')) {

                foreach( var methodPattern in getComponentFunctionPattern)
                {

                    Match m = Regex.Match (text, methodPattern);

                    if (m.Success) {
                        var className = m.Groups ["call"].ToString ();

                        if(! list.Exists (item =>  item.compType == component.GetType() && item.referenceMonobehaviourName == className) )
                        {
                            var method = new PerhapsReferenceObject ()
                            {
                                compType = component.GetType(),
                                referenceMonobehaviourName = className,
                                monoscript = monoScript,
                            };
                            list.Add (method);

                            uniqueClassList.RemoveAll( item => item.Name == className );
                        }
                    }
                }

                foreach( var className in uniqueClassList)
                {
                    if( component.GetType() == className )
                        continue;
                    var result = text.IndexOf(className.Name ) ;
                    if(result != -1 && result != 0 )
                    {
                        if(! list.Exists (item =>  item.compType == component.GetType() && item.referenceMonobehaviourName == className.Name) )
                        {
                            var method = new PerhapsReferenceObject ()
                            {
                                compType = component.GetType(),
                                referenceMonobehaviourName = className.Name,
                                monoscript = monoScript,
                            };
                            list.Add (method);
                            continue;
                        }
                    }
                }
            }
        }