예제 #1
0
        private void FindReferences()
        {
            MethodReference ImportPropertyGetter(string typeName, string propertyName) =>
            ModuleDefinition.ImportReference(
                FindType(typeName).Properties.Single(definition => definition.Name == propertyName).GetMethod);

            _isApplicationPlayingGetterReference            = ImportPropertyGetter("UnityEngine.Application", "isPlaying");
            _isActiveAndEnabledGetterReference              = ImportPropertyGetter("UnityEngine.Behaviour", "isActiveAndEnabled");
            _compilerGeneratedAttributeConstructorReference = ModuleDefinition.ImportReference(
                FindType("System.Runtime.CompilerServices.CompilerGeneratedAttribute")
                .Methods.First(definition => definition.IsConstructor));
            _behaviourReference   = ModuleDefinition.ImportReference(FindType("UnityEngine.Behaviour"));
            _isCompilingForEditor = DefineConstants.Contains("UNITY_EDITOR");
        }
예제 #2
0
 public override bool HasDefineSymbol(string symbol)
 {
     return(DefineConstants.Contains(symbol));
 }