public override void OnPreCollectAssemblies(BindingManager bindingManager) { bindingManager.SetAssemblyBlocked("ExCSS.Unity"); HackGetComponents(bindingManager.TransformType(typeof(GameObject))); HackGetComponents(bindingManager.TransformType(typeof(Component))); bindingManager.TransformType(typeof(MonoBehaviour)) .WriteCrossBindingConstructor(); bindingManager.TransformType(typeof(ScriptableObject)) .WriteCrossBindingConstructor(); var buildTarget = EditorUserBuildSettings.activeBuildTarget; if (buildTarget != BuildTarget.iOS) { bindingManager.AddTypePrefixBlacklist("UnityEngine.Apple"); } if (buildTarget != BuildTarget.Android) { bindingManager.AddTypePrefixBlacklist("UnityEngine.Android"); } bindingManager.AddTypePrefixBlacklist("SyntaxTree."); // fix d.ts, some C# classes use explicit implemented interface method bindingManager.SetTypeBlocked(typeof(UnityEngine.ILogHandler)); bindingManager.SetTypeBlocked(typeof(UnityEngine.ISerializationCallbackReceiver)); bindingManager.SetTypeBlocked(typeof(UnityEngine.Playables.ScriptPlayable <>)); bindingManager.SetTypeBlocked(typeof(AOT.MonoPInvokeCallbackAttribute)); // SetTypeBlocked(typeof(RendererExtensions)); bindingManager.TransformType(typeof(UnityEngine.Events.UnityEvent <>)) .Rename("UnityEvent1"); bindingManager.TransformType(typeof(UnityEngine.Events.UnityEvent <,>)) .Rename("UnityEvent2"); bindingManager.TransformType(typeof(UnityEngine.Events.UnityEvent <, ,>)) .Rename("UnityEvent3"); bindingManager.TransformType(typeof(UnityEngine.Events.UnityEvent <, , ,>)) .Rename("UnityEvent4"); bindingManager.TransformType(typeof(UnityEngine.Texture)) .SetMemberBlocked("imageContentsHash"); bindingManager.TransformType(typeof(UnityEngine.Texture2D)) .SetMemberBlocked("alphaIsTransparency"); //TODO: 增加成员的 defines 条件编译功能 bindingManager.TransformType(typeof(UnityEngine.Input)) .SetMemberBlocked("IsJoystickPreconfigured"); // specific platform available only bindingManager.TransformType(typeof(UnityEngine.MonoBehaviour)) .SetMemberBlocked("runInEditMode"); // editor only bindingManager.TransformType(typeof(UnityEngine.QualitySettings)) .SetMemberBlocked("streamingMipmapsRenderersPerFrame"); }
public override void OnPreCollectAssemblies(BindingManager bindingManager) { bindingManager.AddTypePrefixBlacklist("WebSocketSharp."); }
public override void OnPreExporting(BindingManager bindingManager) { bindingManager.AddTypePrefixBlacklist("Unity."); bindingManager.AddTypePrefixBlacklist("TreeEditor."); bindingManager.AddExportedType(typeof(GUI)).SetAllConstructorsBlocked(); bindingManager.AddExportedType(typeof(GUIUtility)).SetAllConstructorsBlocked(); bindingManager.AddExportedType(typeof(GUILayout)).SetAllConstructorsBlocked(); bindingManager.AddExportedType(typeof(GUILayoutUtility)).SetAllConstructorsBlocked(); bindingManager.AddExportedType(typeof(GUILayoutOption)); bindingManager.AddExportedType(typeof(GUIContent)); bindingManager.AddExportedType(typeof(GUISkin)); bindingManager.AddExportedType(typeof(GUIStyle)); bindingManager.AddExportedType(typeof(TextAnchor)); bindingManager.AddExportedType(typeof(ScaleMode)); bindingManager.AddExportedType(typeof(FocusType)); bindingManager.AddExportedType(typeof(AudioClip)); bindingManager.AddExportedType(typeof(RectInt)); bindingManager.AddExportedType(typeof(Bounds)); bindingManager.AddExportedType(typeof(BoundsInt)); bindingManager.AddExportedType(typeof(Gradient)); bindingManager.AddExportedType(typeof(AnimationCurve)); bindingManager.AddExportedType(typeof(Event)); bindingManager.AddExportedType(typeof(EventType)).OnFilter <string>(i => char.IsLower(i[0])); bindingManager.AddExportedType(typeof(Coroutine)); bindingManager.AddExportedType(typeof(System.Collections.IEnumerator)); bindingManager.AddExportedType(typeof(System.Collections.Generic.IEnumerable <string>)); bindingManager.AddExportedType(typeof(SearchField)).EditorRuntime(); bindingManager.AddExportedType(typeof(EditorStyles)).EditorRuntime(); bindingManager.AddExportedType(typeof(GenericMenu)).EditorRuntime(); bindingManager.AddExportedType(typeof(PrefabAssetType)).EditorRuntime(); bindingManager.AddExportedType(typeof(PrefabInstanceStatus)).EditorRuntime(); bindingManager.AddExportedType(typeof(UIOrientation)).EditorRuntime(); bindingManager.AddExportedType(typeof(MessageType)).EditorRuntime(); bindingManager.AddExportedType(typeof(Hash128)).EditorRuntime(); bindingManager.AddExportedType(typeof(ImportAssetOptions)).EditorRuntime(); #if !UNITY_2019_3_OR_NEWER bindingManager.AddExportedType(typeof(ScriptingRuntimeVersion)).EditorRuntime(); #endif bindingManager.AddExportedType(typeof(AssetPostprocessor)).EditorRuntime().SetAllConstructorsBlocked(); bindingManager.AddExportedType(typeof(AssetImporter)).EditorRuntime(); bindingManager.AddExportedType(typeof(ModelImporter)).EditorRuntime(); bindingManager.AddExportedType(typeof(AudioImporter)).EditorRuntime(); bindingManager.AddExportedType(typeof(VideoClipImporter)).EditorRuntime(); bindingManager.AddExportedType(typeof(TextureImporter)).EditorRuntime(); bindingManager.AddExportedType(typeof(MouseCursor)).EditorRuntime(); bindingManager.AddExportedType(typeof(PauseState)).EditorRuntime(); bindingManager.AddExportedType(typeof(PlayModeStateChange)).EditorRuntime(); bindingManager.AddExportedType(typeof(ExportPackageOptions)).EditorRuntime(); bindingManager.AddExportedType(typeof(ForceReserializeAssetsOptions)).EditorRuntime(); bindingManager.AddExportedType(typeof(StatusQueryOptions)).EditorRuntime(); bindingManager.AddExportedType(typeof(SerializedObject)).EditorRuntime(); bindingManager.AddExportedType(typeof(SerializedProperty)).EditorRuntime(); bindingManager.AddExportedType(typeof(SerializedPropertyType)).EditorRuntime(); bindingManager.AddExportedType(typeof(BuildPlayerOptions)).EditorRuntime(); bindingManager.AddExportedType(typeof(BuildAssetBundleOptions)).EditorRuntime(); bindingManager.AddExportedType(typeof(BuildTarget)).EditorRuntime(); bindingManager.AddExportedType(typeof(ObjectFactory)).EditorRuntime(); bindingManager.AddExportedType(typeof(CameraEditor)).EditorRuntime(); bindingManager.AddExportedType(typeof(CameraEditorUtils)).EditorRuntime(); bindingManager.AddExportedType(typeof(TransformUtils)).EditorRuntime(); bindingManager.AddExportedType(typeof(EditorJsonUtility)).EditorRuntime(); bindingManager.AddExportedType(typeof(GameObjectUtility)).EditorRuntime(); bindingManager.AddExportedType(typeof(EditorPrefs)).EditorRuntime().SetAllConstructorsBlocked(); bindingManager.AddExportedType(typeof(Handles)).EditorRuntime().SetAllConstructorsBlocked(); bindingManager.AddExportedType(typeof(HandleUtility)).EditorRuntime().SetAllConstructorsBlocked(); bindingManager.AddExportedType(typeof(SceneView)).EditorRuntime().SetAllConstructorsBlocked(); bindingManager.AddExportedType(typeof(MeshUtility)).EditorRuntime().SetAllConstructorsBlocked(); bindingManager.AddExportedType(typeof(PrefabUtility)).EditorRuntime().SetAllConstructorsBlocked(); bindingManager.AddExportedType(typeof(FileUtil)).EditorRuntime().SetAllConstructorsBlocked(); bindingManager.AddExportedType(typeof(UnityEditor.Build.Reporting.BuildReport)).EditorRuntime().SetAllConstructorsBlocked(); bindingManager.AddExportedType(typeof(AssetBundleManifest)).EditorRuntime().SetAllConstructorsBlocked(); bindingManager.AddExportedType(typeof(BuildPipeline)).EditorRuntime().SetAllConstructorsBlocked(); bindingManager.AddExportedType(typeof(AssetDatabase)).EditorRuntime().SetAllConstructorsBlocked(); bindingManager.AddExportedType(typeof(ShaderUtil)).EditorRuntime().SetAllConstructorsBlocked(); bindingManager.AddExportedType(typeof(EditorUtility)).EditorRuntime().SetAllConstructorsBlocked(); bindingManager.AddExportedType(typeof(EditorGUI)).EditorRuntime().SetAllConstructorsBlocked(); bindingManager.AddExportedType(typeof(EditorGUIUtility)).EditorRuntime().SetAllConstructorsBlocked(); bindingManager.AddExportedType(typeof(EditorGUILayout)).EditorRuntime().SetAllConstructorsBlocked(); bindingManager.AddExportedType(typeof(EditorApplication)).EditorRuntime().SetAllConstructorsBlocked(); bindingManager.AddExportedType(typeof(Editor)).EditorRuntime() .WriteCrossBindingConstructor(); bindingManager.AddExportedType(typeof(EditorWindow)).EditorRuntime() .SetMemberBlocked("GetWindowWithRect") //TODO: 此方法需要接管, 待处理, 暂时屏蔽 .SetMethodBlocked("GetWindow", typeof(Type), typeof(bool), typeof(string), typeof(bool)) //TODO: 此方法需要接管, 待处理, 暂时屏蔽 .SetMethodBlocked("GetWindow", typeof(Type), typeof(bool), typeof(string)) //TODO: 此方法需要接管, 待处理, 暂时屏蔽 .SetMethodBlocked("GetWindow", typeof(Type), typeof(bool)) .AddTSMethodDeclaration("static GetWindow<T extends EditorWindow>(type: { new(): T }): T", "GetWindow", typeof(Type)) .WriteCrossBindingConstructor() .WriteCSMethodOverrideBinding("GetWindow", EditorWindowFix.BindStatic_GetWindow) .AddStaticMethod(EditorWindowFix.CreateWindow) ; }