Ejemplo n.º 1
0
 static void CheckMonoBehaviour(TypeDefinition td)
 {
     if (td.IsDerivedFrom(WeaverTypes.MonoBehaviourType))
     {
         MonoBehaviourProcessor.Process(td);
     }
 }
Ejemplo n.º 2
0
 static void CheckMonoBehaviour(TypeDefinition td)
 {
     if (td.IsDerivedFrom <UnityEngine.MonoBehaviour>())
     {
         MonoBehaviourProcessor.Process(td);
     }
 }
Ejemplo n.º 3
0
        void CheckMonoBehaviour(TypeDefinition td)
        {
            var processor = new MonoBehaviourProcessor(logger);

            if (td.IsDerivedFrom <UnityEngine.MonoBehaviour>())
            {
                processor.Process(td);
            }
        }
Ejemplo n.º 4
0
        // returns 'true' if modified (=if we did anything)
        bool WeaveNetworkBehavior(TypeDefinition td)
        {
            if (!td.IsClass)
            {
                return(false);
            }

            if (!td.IsDerivedFrom <NetworkBehaviour>())
            {
                if (td.IsDerivedFrom <UnityEngine.MonoBehaviour>())
                {
                    MonoBehaviourProcessor.Process(Log, td, ref WeavingFailed);
                }
                return(false);
            }

            // process this and base classes from parent to child order

            List <TypeDefinition> behaviourClasses = new List <TypeDefinition>();

            TypeDefinition parent = td;

            while (parent != null)
            {
                if (parent.Is <NetworkBehaviour>())
                {
                    break;
                }

                try
                {
                    behaviourClasses.Insert(0, parent);
                    parent = parent.BaseType.Resolve();
                }
                catch (AssemblyResolutionException)
                {
                    // this can happen for plugins.
                    //Console.WriteLine("AssemblyResolutionException: "+ ex.ToString());
                    break;
                }
            }

            bool modified = false;

            foreach (TypeDefinition behaviour in behaviourClasses)
            {
                modified |= new NetworkBehaviourProcessor(CurrentAssembly, weaverTypes, syncVarAccessLists, writers, readers, Log, behaviour).Process(ref WeavingFailed);
            }
            return(modified);
        }