c1_unity/Assets/Editor/LuaGenConfig.cs
2025-04-30 23:12:28 +08:00

760 lines
47 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* Tencent is pleased to support the open source community by making xLua available.
* Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved.
* Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/MIT
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
using System.Collections.Generic;
using System;
using UnityEngine;
using XLua;
using System.Linq;
using System.Reflection;
namespace BFEditor
{
//配置的详细介绍请看Doc下《XLua的配置.doc》
public static class LuaGenConfig
{
//--------------begin 纯lua编程配置参考----------------------------
static List<string> exclude = new List<string> {
"HideInInspector", "ExecuteInEditMode",
"AddComponentMenu", "ContextMenu",
"RequireComponent", "DisallowMultipleComponent",
"SerializeField", "AssemblyIsEditorAssembly",
"Attribute", "Types",
"UnitySurrogateSelector", "TrackedReference",
"TypeInferenceRules", "FFTWindow",
"RPC", "Network", "MasterServer",
"BitStream", "HostData",
"ConnectionTesterStatus", "GUI", "EventType",
"EventModifiers", "FontStyle", "TextAlignment",
"TextEditor", "TextEditorDblClickSnapping",
"TextGenerator", "TextClipping", "Gizmos",
"ADBannerView", "ADInterstitialAd",
"Android", "Tizen", "jvalue",
"iPhone", "iOS", "Windows", "CalendarIdentifier",
"CalendarUnit", "CalendarUnit",
"ClusterInput", "FullScreenMovieControlMode",
"FullScreenMovieScalingMode", "Handheld",
"LocalNotification", "NotificationServices",
"RemoteNotificationType", "RemoteNotification",
"SamsungTV", "TextureCompressionQuality",
"TouchScreenKeyboardType", "TouchScreenKeyboard",
"MovieTexture", "UnityEngineInternal",
"Terrain", "Tree", "SplatPrototype",
"DetailPrototype", "DetailRenderMode",
"MeshSubsetCombineUtility", "AOT", "Social", "Enumerator",
"SendMouseEvents", "Cursor", "Flash", "ActionScript",
"OnRequestRebuild", "Ping",
"ShaderVariantCollection", "SimpleJson.Reflection",
"CoroutineTween", "GraphicRebuildTracker",
"Advertisements", "UnityEditor", "WSA",
"EventProvider", "Apple",
"ClusterInput", "Motion",
"UnityEngine.UI.ReflectionMethodsCache", "NativeLeakDetection",
"NativeLeakDetectionMode", "WWWAudioExtensions", "UnityEngine.Experimental",
// 下面是项目自己补充的不导出的class
"UnityEngine.ClusterSerialization", "UnityEngine.AudioSettings", "UnityEngine.Caching",
"UnityEngine.DrivenRectTransformTracker", "UnityEngine.LightingSettings", "UnityEngine.InputManagerEntry",
"UnityEngine.InputRegistering", "UnityEngine.AnimatorControllerParameter", "UnityEngine.LightProbeGroup",
"UnityEngine.UI.DefaultControls", "UnityEngine.CanvasRenderer.OnRequestRebuild",
"TMPro.TMP_SpriteAssetImporter", "TMPro.TMP_PreBuildProcessor", "TMPro.TMP_PackageUtilities",
"TMPro.TMP_PostBuildProcessHandler", "TMPro.TMP_PackageUtilities", "TMPro.TMP_PackageResourceImporter",
"TMPro.TMP_ProjectConversionUtility", "TMPro.TMP_FontAsset_CreationMenu", "TMPro.TMP_EditorResourceManager",
"TMPro.SortingLayerHelper",
"UnityEngine.CloudStreaming",
"BFEditor.EditorBattleRoleAttackOperate",
"UnityEngine.QualitySettings",
"IronSourceBannerEvents", "IronSourceEvents", "IronSourceInterstitialEvents", "IronSourceRewardedVideoEvents",
"IronSourceAdQualityManifestTools", "TradplusSDK"
};
static bool isExcluded(Type type)
{
var fullName = type.FullName;
for (int i = 0; i < exclude.Count; i++)
{
if (fullName != null && fullName.Contains(exclude[i]))
{
return true;
}
}
return false;
}
[LuaCallCSharp]
public static IEnumerable<Type> LuaCallCSharp
{
get
{
List<string> namespaces = new List<string>() // 在这里添加名字空间
{
"BF",
// "UnityEngine",
// "UnityEngine.UI",
// "UnityEngine.U2D",
// "UnityEngine.Rendering.Universal",
// "TMPro",
// "DG.Tweening",
// "DG.Tweening.Core",
};
var unityTypes = (from assembly in AppDomain.CurrentDomain.GetAssemblies()
where !(assembly.ManifestModule is System.Reflection.Emit.ModuleBuilder)
from type in assembly.GetExportedTypes()
where type.Namespace != null && namespaces.Contains(type.Namespace) && !isExcluded(type)
&& type.BaseType != typeof(MulticastDelegate) && !type.IsInterface && !type.IsEnum
select type);
string[] customAssemblys = new string[] {
"Assembly-CSharp",
};
var customTypes = (from assembly in customAssemblys.Select(s => Assembly.Load(s))
from type in assembly.GetExportedTypes()
where type.Namespace == null || !type.Namespace.StartsWith("XLua") && !isExcluded(type)
&& type.BaseType != typeof(MulticastDelegate) && !type.IsInterface && !type.IsEnum
select type);
var otherTypes = new List<Type>() {
typeof(System.Object),
typeof(System.ValueType),
typeof(System.Reflection.BindingFlags),
typeof(System.Uri),
typeof(System.Enum),
typeof(System.DateTime),
typeof(System.DateTimeOffset),
typeof(System.IO.File),
typeof(System.DBNull),
typeof(System.Convert),
typeof(System.DayOfWeek),
typeof(System.Net.NetworkInformation.Ping),
typeof(System.Net.NetworkInformation.IPStatus),
typeof(System.Net.NetworkInformation.PingCompletedEventHandler),
typeof(System.Net.NetworkInformation.PingCompletedEventArgs),
typeof(System.Net.NetworkInformation.PingReply),
typeof(System.ComponentModel.AsyncCompletedEventArgs),
typeof(System.ComponentModel.Component),
typeof(UnityEngine.Events.UnityEvent<System.Single>),
typeof(System.Collections.Generic.List<int>),
typeof(System.Collections.Generic.List<System.Single>),
typeof(System.Collections.Generic.List<string>),
typeof(System.Collections.Generic.List<TMPro.TMP_FontAsset>),
typeof(System.Collections.Generic.List<UnityEngine.Camera>),
typeof(System.Collections.Generic.List<System.Collections.Generic.List<string>>),
typeof(System.Collections.Generic.List<BF.BFFinger>),
typeof(DG.Tweening.Core.TweenerCore<UnityEngine.Color, UnityEngine.Color, DG.Tweening.Plugins.Options.ColorOptions>),
typeof(DG.Tweening.Core.TweenerCore<UnityEngine.Vector2, UnityEngine.Vector2, DG.Tweening.Plugins.Options.VectorOptions>),
typeof(System.Action<string>),
typeof(System.Action<string, UnityEngine.Object>),
typeof(System.Action<string, UnityEngine.GameObject>),
typeof(UnityEngine.Camera),
typeof(UnityEngine.Camera.GateFitMode),
typeof(UnityEngine.Camera.GateFitParameters),
typeof(UnityEngine.Camera.StereoscopicEye),
typeof(UnityEngine.Camera.MonoOrStereoscopicEye),
typeof(UnityEngine.Camera.FieldOfViewAxis),
typeof(UnityEngine.Camera.RenderRequest),
typeof(UnityEngine.Camera.RenderRequestMode),
typeof(UnityEngine.Camera.RenderRequestOutputSpace),
typeof(UnityEngine.Camera.RenderRequest),
typeof(UnityEngine.Camera.SceneViewFilterMode),
typeof(UnityEngine.TextCore.FaceInfo),
typeof(UnityEngine.Rendering.LightShadowResolution),
typeof(UnityEngine.RenderTextureFormat),
typeof(UnityEngine.RenderTextureReadWrite),
typeof(UnityEngine.RigidbodyConstraints),
typeof(UnityEngine.TransparencySortMode),
typeof(UnityEngine.SystemInfo),
typeof(UnityEngine.Object),
typeof(UnityEngine.Rect),
typeof(UnityEngine.Vector2),
typeof(UnityEngine.Vector3),
typeof(UnityEngine.Vector4),
typeof(UnityEngine.Quaternion),
typeof(UnityEngine.Matrix4x4),
typeof(UnityEngine.Color),
typeof(UnityEngine.Ray),
typeof(UnityEngine.Bounds),
typeof(UnityEngine.Ray2D),
typeof(UnityEngine.Time),
typeof(UnityEngine.Motion),
typeof(UnityEngine.GameObject),
typeof(UnityEngine.Component),
typeof(UnityEngine.Behaviour),
typeof(UnityEngine.EventSystems.UIBehaviour),
typeof(UnityEngine.Transform),
typeof(UnityEngine.RectTransform),
typeof(UnityEngine.RectTransform.Axis),
typeof(UnityEngine.RectTransform.Edge),
typeof(UnityEngine.Resources),
typeof(UnityEngine.TextAsset),
typeof(UnityEngine.Keyframe),
typeof(UnityEngine.Sprite),
typeof(UnityEngine.AnimatorStateInfo),
typeof(UnityEngine.AnimatorCullingMode),
typeof(UnityEngine.Animation),
typeof(UnityEngine.AnimationCurve),
typeof(UnityEngine.AnimationClip),
typeof(UnityEngine.MonoBehaviour),
typeof(UnityEngine.ParticleSystem),
typeof(UnityEngine.ParticleSystem.MainModule),
typeof(UnityEngine.ParticleSystem.EmissionModule),
typeof(UnityEngine.ParticleSystem.ShapeModule),
typeof(UnityEngine.ParticleSystem.VelocityOverLifetimeModule),
typeof(UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule),
typeof(UnityEngine.ParticleSystem.InheritVelocityModule),
typeof(UnityEngine.ParticleSystem.ForceOverLifetimeModule),
typeof(UnityEngine.ParticleSystem.ColorOverLifetimeModule),
typeof(UnityEngine.ParticleSystem.ColorBySpeedModule),
typeof(UnityEngine.ParticleSystem.SizeOverLifetimeModule),
typeof(UnityEngine.ParticleSystem.SizeBySpeedModule),
typeof(UnityEngine.ParticleSystem.RotationBySpeedModule),
typeof(UnityEngine.ParticleSystem.RotationOverLifetimeModule),
typeof(UnityEngine.ParticleSystem.ExternalForcesModule),
typeof(UnityEngine.ParticleSystem.NoiseModule),
typeof(UnityEngine.ParticleSystem.CollisionModule),
typeof(UnityEngine.ParticleSystem.TriggerModule),
typeof(UnityEngine.ParticleSystem.SubEmittersModule),
typeof(UnityEngine.ParticleSystem.TextureSheetAnimationModule),
typeof(UnityEngine.ParticleSystem.LightsModule),
typeof(UnityEngine.ParticleSystem.TrailModule),
typeof(UnityEngine.ParticleSystem.CustomDataModule),
typeof(UnityEngine.ParticleSystem.MinMaxCurve),
typeof(UnityEngine.ParticleSystem.Particle),
typeof(UnityEngine.ParticleSystem.Burst),
typeof(UnityEngine.ParticleSystem.MinMaxGradient),
typeof(UnityEngine.ParticleSystem.EmitParams),
typeof(UnityEngine.ParticleSystemRenderer),
typeof(UnityEngine.MeshRenderer),
typeof(UnityEngine.SkinnedMeshRenderer),
typeof(UnityEngine.Renderer),
typeof(UnityEngine.WWW),
typeof(UnityEngine.Light),
typeof(UnityEngine.Mathf),
typeof(UnityEngine.Debug),
typeof(UnityEngine.Screen),
typeof(UnityEngine.Resolution),
typeof(UnityEngine.Shader),
typeof(UnityEngine.ShaderVariantCollection),
typeof(UnityEngine.Playables.PlayableDirector),
typeof(UnityEngine.Playables.PlayableAsset),
typeof(UnityEngine.Playables.Playable),
typeof(UnityEngine.RuntimeAnimatorController),
typeof(UnityEngine.Application),
typeof(UnityEngine.SystemLanguage),
typeof(UnityEngine.AudioClip),
typeof(UnityEngine.SceneManagement.SceneManager),
typeof(UnityEngine.SceneManagement.Scene),
typeof(UnityEngine.AssetBundle),
typeof(UnityEngine.AssetBundleRequest),
typeof(UnityEngine.AudioSource),
typeof(UnityEngine.AsyncOperation),
typeof(UnityEngine.Avatar),
typeof(UnityEngine.Animator),
typeof(UnityEngine.Events.UnityEvent),
typeof(UnityEngine.Events.UnityEvent<System.String>),
typeof(UnityEngine.Events.UnityEvent<UnityEngine.Vector2>),
typeof(UnityEngine.Events.UnityEvent<System.Int32>),
typeof(UnityEngine.Events.UnityEvent<System.Int64>),
typeof(UnityEngine.Events.UnityEventBase),
typeof(UnityEngine.LayerMask),
typeof(UnityEngine.RenderTextureDescriptor),
typeof(UnityEngine.Material),
typeof(UnityEngine.MaterialPropertyBlock),
typeof(UnityEngine.SpriteRenderer),
typeof(UnityEngine.Mesh),
typeof(UnityEngine.MeshFilter),
typeof(UnityEngine.Rendering.ShadowCastingMode),
typeof(UnityEngine.Video.VideoClip),
typeof(UnityEngine.Video.VideoPlayer),
typeof(UnityEngine.RenderSettings),
typeof(UnityEngine.Canvas),
typeof(UnityEngine.CanvasGroup),
typeof(UnityEngine.CanvasRenderer),
typeof(UnityEngine.LineRenderer),
typeof(UnityEngine.Texture2D),
typeof(UnityEngine.Texture2D.EXRFlags),
typeof(UnityEngine.Font),
typeof(UnityEngine.RenderTexture),
typeof(UnityEngine.Texture),
typeof(UnityEngine.Graphics),
typeof(UnityEngine.Input),
typeof(UnityEngine.KeyCode),
typeof(UnityEngine.Video.VideoClip),
typeof(UnityEngine.PlayerPrefs),
typeof(UnityEngine.ShaderVariantCollection),
typeof(UnityEngine.ShaderVariantCollection.ShaderVariant),
typeof(UnityEngine.NetworkReachability),
typeof(UnityEngine.RuntimePlatform),
typeof(UnityEngine.Rendering.CompareFunction),
typeof(UnityEngine.TextAnchor),
typeof(UnityEngine.LightProbes),
typeof(UnityEngine.Graphics),
typeof(UnityEngine.BoxCollider),
typeof(UnityEngine.RaycastHit),
typeof(UnityEngine.LightmapSettings),
typeof(UnityEngine.LightmapData),
typeof(UnityEngine.LightProbes),
typeof(UnityEngine.ReflectionProbe),
typeof(UnityEngine.BatteryStatus),
typeof(UnityEngine.SystemInfo),
typeof(UnityEngine.Rigidbody),
typeof(UnityEngine.SphereCollider),
typeof(UnityEngine.ScriptableObject),
typeof(UnityEngine.Physics),
typeof(UnityEngine.PhysicMaterial),
typeof(UnityEngine.MeshCollider),
typeof(UnityEngine.UI.CanvasScaler),
typeof(UnityEngine.UI.Dropdown),
typeof(UnityEngine.UI.Dropdown.OptionData),
typeof(UnityEngine.UI.Dropdown.OptionDataList),
typeof(UnityEngine.UI.Dropdown.DropdownEvent),
typeof(UnityEngine.UI.Graphic),
typeof(UnityEngine.UI.GraphicRaycaster),
typeof(UnityEngine.UI.GraphicRaycaster.BlockingObjects),
typeof(UnityEngine.UI.Image),
typeof(UnityEngine.UI.Image.Type),
typeof(UnityEngine.UI.Image.FillMethod),
typeof(UnityEngine.UI.Image.OriginHorizontal),
typeof(UnityEngine.UI.Image.OriginVertical),
typeof(UnityEngine.UI.Image.Origin90),
typeof(UnityEngine.UI.Image.Origin180),
typeof(UnityEngine.UI.Image.Origin360),
typeof(UnityEngine.UI.Button),
typeof(UnityEngine.UI.Button.ButtonClickedEvent),
typeof(UnityEngine.UI.InputField),
typeof(UnityEngine.UI.InputField.ContentType),
typeof(UnityEngine.UI.InputField.InputType),
typeof(UnityEngine.UI.InputField.EndEditEvent),
typeof(UnityEngine.UI.InputField.CharacterValidation),
typeof(UnityEngine.UI.InputField.LineType),
typeof(UnityEngine.UI.InputField.SubmitEvent),
typeof(UnityEngine.UI.InputField.OnChangeEvent),
typeof(UnityEngine.UI.Mask),
typeof(UnityEngine.UI.MaskableGraphic),
typeof(UnityEngine.UI.MaskableGraphic.CullStateChangedEvent),
typeof(UnityEngine.UI.MaskUtilities),
typeof(UnityEngine.UI.RawImage),
typeof(UnityEngine.UI.RectMask2D),
typeof(UnityEngine.UI.Scrollbar),
typeof(UnityEngine.UI.ScrollRect),
typeof(UnityEngine.UI.ScrollRect.MovementType),
typeof(UnityEngine.UI.ScrollRect.ScrollbarVisibility),
typeof(UnityEngine.UI.ScrollRect.ScrollRectEvent),
typeof(UnityEngine.UI.Selectable),
typeof(UnityEngine.UI.Slider),
typeof(UnityEngine.UI.Slider.Direction),
typeof(UnityEngine.UI.Slider.SliderEvent),
typeof(UnityEngine.UI.Text),
typeof(UnityEngine.UI.Toggle),
typeof(UnityEngine.UI.Toggle.ToggleTransition),
typeof(UnityEngine.UI.Toggle.ToggleEvent),
typeof(UnityEngine.UI.ToggleGroup),
typeof(UnityEngine.UI.LayoutElement),
typeof(UnityEngine.UI.GridLayoutGroup),
typeof(UnityEngine.UI.GridLayoutGroup.Corner),
typeof(UnityEngine.UI.GridLayoutGroup.Axis),
typeof(UnityEngine.UI.GridLayoutGroup.Constraint),
typeof(UnityEngine.UI.VerticalLayoutGroup),
typeof(UnityEngine.UI.LayoutGroup),
typeof(UnityEngine.U2D.SpriteAtlas),
// spine
typeof(Spine.TrackEntry),
typeof(Spine.SkeletonData),
typeof(Spine.Skeleton),
typeof(Spine.Slot),
typeof(Spine.RegionAttachment),
typeof(Spine.Animation),
typeof(Spine.AnimationState),
typeof(Spine.AnimationStateData),
typeof(Spine.AnimationStateData.AnimationPair),
typeof(Spine.AnimationStateData.AnimationPairComparer),
typeof(Spine.AnimationState.TrackEntryDelegate),
typeof(Spine.Unity.SkeletonGraphic),
typeof(Spine.Unity.SkeletonAnimation),
typeof(Spine.Unity.SkeletonDataAsset),
typeof(Spine.Unity.MeshGenerator),
typeof(Spine.MeshAttachment),
typeof(Spine.Unity.MeshGenerator.Settings),
typeof(Spine.Unity.SkeletonRenderer),
typeof(Spine.Unity.SkeletonRenderer.SpriteMaskInteractionMaterials),
typeof(Spine.Unity.BoneFollower),
typeof(Spine.Unity.BoneFollowerGraphic),
typeof(Spine.Unity.BoneFollower.AxisOrientation),
typeof(Spine.Unity.SkeletonGraphic.LayoutMode),
// TextMeshPro
typeof(TMPro.TextAlignmentOptions),
typeof(TMPro.TMP_FontAsset),
typeof(TMPro.TMP_Character),
typeof(TMPro.TextMeshProUGUI),
typeof(TMPro.TextMeshPro),
typeof(TMPro.TMP_Text),
typeof(TMPro.TMP_Dropdown),
typeof(TMPro.TMP_Dropdown.OptionData),
typeof(TMPro.TMP_Dropdown.OptionDataList),
typeof(TMPro.TMP_Dropdown.DropdownEvent),
typeof(TMPro.TMP_InputField),
typeof(TMPro.TMP_InputField.ContentType),
typeof(TMPro.TMP_InputField.InputType),
typeof(TMPro.TMP_InputField.CharacterValidation),
typeof(TMPro.TMP_InputField.LineType),
typeof(TMPro.TMP_InputField.SubmitEvent),
typeof(TMPro.TMP_InputField.OnChangeEvent),
typeof(TMPro.TMP_InputField.SelectionEvent),
typeof(TMPro.TMP_InputField.TextSelectionEvent),
typeof(TMPro.TMP_InputField.TouchScreenKeyboardEvent),
typeof(TMP_AnimationCurve),
typeof(TMP_Curve),
// 数数
typeof(ThinkingAnalytics.ThinkingAnalyticsAPI),
typeof(ThinkingAnalytics.ThinkingAnalyticsAPI.TATimeZone),
typeof(ThinkingAnalytics.ThinkingAnalyticsAPI.TAMode),
typeof(ThinkingAnalytics.ThinkingAnalyticsAPI.NetworkType),
typeof(ThinkingAnalytics.ThinkingAnalyticsAPI.Token),
typeof(ThinkingAnalytics.TDPresetProperties),
//DOTween
typeof(DG.Tweening.AutoPlay),
typeof(DG.Tweening.AxisConstraint),
typeof(DG.Tweening.Ease),
typeof(DG.Tweening.LogBehaviour),
typeof(DG.Tweening.LoopType),
typeof(DG.Tweening.PathMode),
typeof(DG.Tweening.PathType),
typeof(DG.Tweening.RotateMode),
typeof(DG.Tweening.ScrambleMode),
typeof(DG.Tweening.TweenType),
typeof(DG.Tweening.UpdateType),
typeof(DG.Tweening.DOTween),
typeof(DG.Tweening.Core.DOTweenComponent),
typeof(DG.Tweening.Core.TweenerCore<UnityEngine.Vector3, UnityEngine.Vector3[], DG.Tweening.Plugins.Options.Vector3ArrayOptions>),
typeof(DG.Tweening.Core.TweenerCore<UnityEngine.Quaternion, UnityEngine.Vector3, DG.Tweening.Plugins.Options.QuaternionOptions>),
typeof(DG.Tweening.Core.TweenerCore<UnityEngine.Vector3, DG.Tweening.Plugins.Core.PathCore.Path, DG.Tweening.Plugins.Options.PathOptions>),
typeof(DG.Tweening.Core.TweenerCore<System.Single, System.Single, DG.Tweening.Plugins.Options.FloatOptions>),
typeof(DG.Tweening.Core.TweenerCore<Vector3, Vector3, DG.Tweening.Plugins.Options.VectorOptions>),
typeof(DG.Tweening.Core.TweenerCore<UnityEngine.Vector2,UnityEngine.Vector2,DG.Tweening.Plugins.Options.VectorOptions>),
typeof(DG.Tweening.Core.TweenerCore<UnityEngine.Color, UnityEngine.Color, DG.Tweening.Plugins.Options.ColorOptions>),
typeof(DG.Tweening.DOVirtual),
typeof(DG.Tweening.EaseFactory),
typeof(DG.Tweening.Tweener),
typeof(DG.Tweening.Tween),
typeof(DG.Tweening.Sequence),
typeof(DG.Tweening.TweenParams),
typeof(DG.Tweening.Core.ABSSequentiable),
typeof(DG.Tweening.TweenCallback),
typeof(DG.Tweening.TweenExtensions),
typeof(DG.Tweening.TweenSettingsExtensions),
typeof(DG.Tweening.ShortcutExtensions),
typeof(DG.Tweening.DOTweenModuleUI),
// BestHTTP
typeof(Http.RequestState),
typeof(BestHTTP.HTTPRequest),
typeof(BestHTTP.HTTPResponse),
typeof(BestHTTP.Connections.HTTP2.HTTP2Response),
typeof(BestHTTP.Forms.HTTPUrlEncodedForm),
typeof(BestHTTP.Forms.HTTPFormBase),
// 支付
typeof(UnityEngine.Purchasing.Product),
typeof(UnityEngine.Purchasing.ProductDefinition),
typeof(UnityEngine.Purchasing.ProductMetadata),
typeof(UnityEngine.Purchasing.ProductType),
typeof(BF.MonoSingleton<BF.BFMain>),
typeof(BF.MonoSingleton<AdManager>),
typeof(BF.BFSlider.FillDirection),
typeof(BF.ScrollRectBaseOld.MovementType),
typeof(BF.ScrollRectBaseOld.ScrollbarVisibility),
typeof(BF.NetServiceType),
typeof(BF.NetIncomingMessageType),
// Touch
typeof(BF.BFEvent<System.Collections.Generic.List<BF.BFFinger>>),
typeof(BF.BFEvent<BF.SelectEventType, BF.BFFinger>),
typeof(BF.BFEvent<BF.TouchEventType, BF.BFFinger>),
typeof(BF.TouchEventType),
typeof(BF.SelectEventType),
typeof(BF.NativeCore.ThirdPlatform.FacebookSdk),
typeof(BF.NativeCore.ThirdPlatform.AppsFlyerSdk),
typeof(AdManager),
// 震动插件
// typeof(Lofelt.NiceVibrations.HapticPatterns),
// typeof(Lofelt.NiceVibrations.LofeltHaptics),
// typeof(Lofelt.NiceVibrations.HapticPatterns.PresetType),
typeof(UnityEngine.Purchasing.Security.AppleStoreKitTestTangle),
typeof(UnityEngine.Purchasing.Security.AppleTangle),
typeof(UnityEngine.SignInWithApple.SignInWithApple.CallbackArgs),
typeof(UnityEngine.SignInWithApple.SignInWithAppleEvent),
typeof(UnityEngine.SignInWithApple.SignInWithApple),
typeof(UnityEngine.SignInWithApple.UserInfo),
typeof(BF.EnumFlagsAttribute),
};
return unityTypes.Concat(customTypes).Concat(otherTypes);
}
}
//自动把LuaCallCSharp涉及到的delegate加到CSharpCallLua列表后续可以直接用lua函数做callback
[CSharpCallLua]
public static List<Type> CSharpCallLua
{
get
{
var lua_call_csharp = LuaCallCSharp;
var delegate_types = new List<Type>();
var flag = BindingFlags.Public | BindingFlags.Instance
| BindingFlags.Static | BindingFlags.IgnoreCase | BindingFlags.DeclaredOnly;
foreach (var field in (from type in lua_call_csharp select type).SelectMany(type => type.GetFields(flag)))
{
// 增加过滤黑名单class
if (typeof(Delegate).IsAssignableFrom(field.FieldType) && !isExcluded(field.FieldType))
{
delegate_types.Add(field.FieldType);
}
}
foreach (var method in (from type in lua_call_csharp select type).SelectMany(type => type.GetMethods(flag)))
{
// 增加过滤黑名单class
if (typeof(Delegate).IsAssignableFrom(method.ReturnType) && !isExcluded(method.ReturnType))
{
delegate_types.Add(method.ReturnType);
}
foreach (var param in method.GetParameters())
{
var paramType = param.ParameterType.IsByRef ? param.ParameterType.GetElementType() : param.ParameterType;
// 增加过滤黑名单class
if (typeof(Delegate).IsAssignableFrom(paramType) && !isExcluded(paramType))
{
delegate_types.Add(paramType);
}
}
}
return delegate_types.Where(t => t.BaseType == typeof(MulticastDelegate) && !hasGenericParameter(t) && !delegateHasEditorRef(t)).Distinct().ToList();
}
}
//黑名单
[BlackList]
public static List<List<string>> BlackList = new List<List<string>>() {
new List<string>(){"System.Xml.XmlNodeList", "ItemOf"},
new List<string>(){"UnityEngine.WWW", "movie"},
#if UNITY_WEBGL
new List<string>(){"UnityEngine.WWW", "threadPriority"},
#endif
new List<string>(){"UnityEngine.Texture2D", "alphaIsTransparency"},
new List<string>(){"UnityEngine.Security", "GetChainOfTrustValue"},
new List<string>(){"UnityEngine.CanvasRenderer", "onRequestRebuild"},
new List<string>(){"UnityEngine.Light", "areaSize"},
new List<string>(){"UnityEngine.Light", "lightmapBakeType"},
new List<string>(){"UnityEngine.Light", "SetLightDirty"},
new List<string>(){"UnityEngine.Light", "shadowRadius"},
new List<string>(){"UnityEngine.Light", "shadowAngle"},
new List<string>(){"UnityEngine.WWW", "MovieTexture"},
new List<string>(){"UnityEngine.WWW", "GetMovieTexture"},
new List<string>(){"UnityEngine.AnimatorOverrideController", "PerformOverrideClipListCleanup"},
#if !UNITY_WEBPLAYER
new List<string>(){"UnityEngine.Application", "ExternalEval"},
#endif
new List<string>(){"UnityEngine.GameObject", "networkView"}, //4.6.2 not support
new List<string>(){"UnityEngine.Component", "networkView"}, //4.6.2 not support
new List<string>(){"System.IO.FileInfo", "GetAccessControl", "System.Security.AccessControl.AccessControlSections"},
new List<string>(){"System.IO.FileInfo", "SetAccessControl", "System.Security.AccessControl.FileSecurity"},
new List<string>(){"System.IO.File", "Create", "System.String", "System.Int32", "System.IO.FileOptions", "System.Security.AccessControl.FileSecurity"},
new List<string>(){"System.IO.File", "SetAccessControl", "System.String", "System.Security.AccessControl.FileSecurity"},
new List<string>(){"System.IO.File", "GetAccessControl", "System.String"},
new List<string>(){"System.IO.File", "GetAccessControl", "System.String", "System.Security.AccessControl.AccessControlSections"},
new List<string>(){"System.IO.DirectoryInfo", "GetAccessControl", "System.Security.AccessControl.AccessControlSections"},
new List<string>(){"System.IO.DirectoryInfo", "SetAccessControl", "System.Security.AccessControl.DirectorySecurity"},
new List<string>(){"System.IO.DirectoryInfo", "CreateSubdirectory", "System.String", "System.Security.AccessControl.DirectorySecurity"},
new List<string>(){"System.IO.DirectoryInfo", "Create", "System.Security.AccessControl.DirectorySecurity"},
new List<string>(){"UnityEngine.MonoBehaviour", "runInEditMode"},
new List<string>(){"UnityEngine.Texture", "imageContentsHash"},
new List<string>(){"UnityEngine.UI.Text", "OnRebuildRequested"},
new List<string>(){"UnityEngine.UI.Graphic", "OnRebuildRequested"},
new List<string>(){"BF.Atlas", "Clear"},
new List<string>(){"BF.Atlas", "GetCount"},
new List<string>(){"BF.Atlas", "AddSprite", "UnityEngine.Sprite"},
new List<string>(){"BF.Atlas", "RemoveSprite", "UnityEngine.Sprite"},
new List<string>(){"BF.Atlas", "Contains", "UnityEngine.Sprite"},
new List<string>(){"BF.Atlas", "Contains", "System.String"},
new List<string>(){"BF.Atlas", "RemoveNullSprite"},
new List<string>(){"UnityEngine.Input", "IsJoystickPreconfigured", "System.String"},
new List<string>(){"UnityEngine.Rendering.Universal.UniversalRenderPipelineAsset", "Create"},
new List<string>(){"UnityEngine.Rendering.Universal.UniversalRenderPipelineAsset", "Create", "UnityEngine.Rendering.Universal.ScriptableRendererData"},
new List<string>(){"UnityEngine.Rendering.Universal.UniversalRenderPipelineAsset", "packagePath"},
new List<string>(){"UnityEngine.Rendering.Universal.UniversalRenderPipelineAsset", "editorResourcesGUID"},
new List<string>(){"UnityEngine.MeshRenderer", "scaleInLightmap"},
new List<string>(){"UnityEngine.MeshRenderer", "receiveGI"},
new List<string>(){"UnityEngine.MeshRenderer", "stitchLightmapSeams"},
new List<string>(){"UnityEngine.MeshRenderer", "stitchLightmapSeams"},
new List<string>(){"UnityEngine.ParticleSystemForceField", "FindAll"},
new List<string>(){"UnityEngine.ParticleSystemRenderer", "supportsMeshInstancing"},
new List<string>(){"Spine.Unity.SkeletonRenderer", "Start"},
new List<string>(){"Spine.Unity.SkeletonRenderer", "EditorSkipSkinSync"},
new List<string>(){"UnityEngine.AudioSource", "PlayOnGamepad", "System.Int32"},
new List<string>(){"UnityEngine.AudioSource", "DisableGamepadOutput"},
new List<string>(){"UnityEngine.AudioSource", "SetGamepadSpeakerMixLevel", "System.Int32", "System.Int32"},
new List<string>(){"UnityEngine.AudioSource", "SetGamepadSpeakerMixLevelDefault", "System.Int32"},
new List<string>(){"UnityEngine.AudioSource", "SetGamepadSpeakerRestrictedAudio", "System.Int32", "System.Boolean"},
new List<string>(){"UnityEngine.AudioSource", "SetGamepadSpeakerMixLevelDefault", "System.Int32"},
new List<string>(){"UnityEngine.AudioSource", "GamepadSpeakerSupportsOutputType", "UnityEngine.GamepadSpeakerOutputType"},
new List<string>(){"UnityEngine.AudioSource", "gamepadSpeakerOutputType",},
new List<string>(){"UnityEngine.Handheld", "SetActivityIndicatorStyle", "UnityEngine.AndroidActivityIndicatorStyle"},
new List<string>(){"UnityEngine.Handheld", "SetActivityIndicatorStyle", "UnityEngine.iOS.ActivityIndicatorStyle"},
new List<string>(){"ThinkingAnalytics.ThinkingAnalyticsAPI", "onPostProcessBuild", "UnityEditor.BuildTarget", "System.String"},
new List<string>(){"FBWindowsPhysicalGamepadManager", "state"},
new List<string>(){"IronSourceBannerEvents", "onAdLoaded", "System.String"},
new List<string>(){"IronSourceBannerEvents", "onAdLoadFailed", "System.String"},
new List<string>(){"IronSourceBannerEvents", "onAdClicked", "System.String"},
new List<string>(){"IronSourceBannerEvents", "onAdScreenPresented", "System.String"},
new List<string>(){"IronSourceBannerEvents", "onAdScreenDismissed", "System.String"},
new List<string>(){"IronSourceBannerEvents", "onAdLeftApplication", "System.String"},
new List<string>(){"IronSourceEvents", "onSdkInitializationCompleted", "System.String"},
new List<string>(){"IronSourceEvents", "onRewardedVideoAdOpened", "System.String"},
new List<string>(){"IronSourceEvents", "onRewardedVideoAdClosed", "System.String"},
new List<string>(){"IronSourceEvents", "onRewardedVideoAdStarted", "System.String"},
new List<string>(){"IronSourceEvents", "onRewardedVideoAdEnded", "System.String"},
new List<string>(){"IronSourceEvents", "onRewardedVideoAdShowFailed", "System.String"},
new List<string>(){"IronSourceEvents", "onRewardedVideoAdRewarded", "System.String"},
new List<string>(){"IronSourceEvents", "onRewardedVideoAdClicked", "System.String"},
new List<string>(){"IronSourceEvents", "onRewardedVideoAvailabilityChanged", "System.String"},
new List<string>(){"IronSourceEvents", "onRewardedVideoAdLoadedDemandOnly", "System.String"},
new List<string>(){"IronSourceEvents", "onRewardedVideoAdLoadFailedDemandOnly", "System.String"},
new List<string>(){"IronSourceEvents", "onRewardedVideoAdOpenedDemandOnly", "System.String"},
new List<string>(){"IronSourceEvents", "onRewardedVideoAdRewardedDemandOnly", "System.String"},
new List<string>(){"IronSourceEvents", "onRewardedVideoAdShowFailedDemandOnly", "System.String"},
new List<string>(){"IronSourceEvents", "onRewardedVideoAdClosedDemandOnly", "System.String"},
new List<string>(){"IronSourceEvents", "onRewardedVideoAdClickedDemandOnly", "System.String"},
new List<string>(){"IronSourceEvents", "onSegmentReceived", "System.String"},
new List<string>(){"IronSourceEvents", "onInterstitialAdReady"},
new List<string>(){"IronSourceEvents", "onInterstitialAdLoadFailed", "System.String"},
new List<string>(){"IronSourceEvents", "onInterstitialAdOpened", "System.String"},
new List<string>(){"IronSourceEvents", "onInterstitialAdClosed", "System.String"},
new List<string>(){"IronSourceEvents", "onInterstitialAdShowSucceeded", "System.String"},
new List<string>(){"IronSourceEvents", "onInterstitialAdShowFailed", "System.String"},
new List<string>(){"IronSourceEvents", "onInterstitialAdClicked", "System.String"},
new List<string>(){"IronSourceEvents", "onInterstitialAdReadyDemandOnly", "System.String"},
new List<string>(){"IronSourceEvents", "onInterstitialAdLoadFailedDemandOnly", "System.String"},
new List<string>(){"IronSourceEvents", "onInterstitialAdOpenedDemandOnly", "System.String"},
new List<string>(){"IronSourceEvents", "onInterstitialAdClosedDemandOnly", "System.String"},
new List<string>(){"IronSourceEvents", "onInterstitialAdShowFailedDemandOnly", "System.String"},
new List<string>(){"IronSourceEvents", "onInterstitialAdClickedDemandOnly", "System.String"},
new List<string>(){"IronSourceEvents", "onOfferwallOpened", "System.String"},
new List<string>(){"IronSourceEvents", "onOfferwallShowFailed", "System.String"},
new List<string>(){"IronSourceEvents", "onOfferwallClosed", "System.String"},
new List<string>(){"IronSourceEvents", "onGetOfferwallCreditsFailed", "System.String"},
new List<string>(){"IronSourceEvents", "onOfferwallAdCredited", "System.String"},
new List<string>(){"IronSourceEvents", "onOfferwallAvailable", "System.String"},
new List<string>(){"IronSourceEvents", "onBannerAdLoaded"},
new List<string>(){"IronSourceEvents", "onBannerAdLoadFailed", "System.String"},
new List<string>(){"IronSourceEvents", "onBannerAdClicked"},
new List<string>(){"IronSourceEvents", "onBannerAdScreenPresented"},
new List<string>(){"IronSourceEvents", "onBannerAdScreenDismissed"},
new List<string>(){"IronSourceEvents", "onBannerAdLeftApplication"},
new List<string>(){"IronSourceEvents", "onImpressionSuccess", "System.String"},
new List<string>(){"IronSourceEvents", "onRewardedVideoAdLoadFailed", "System.String"},
new List<string>(){"IronSourceEvents", "onRewardedVideoAdReady", "System.String"},
new List<string>(){"IronSourceInterstitialEvents", "onAdReady", "System.String"},
new List<string>(){"IronSourceInterstitialEvents", "onAdLoadFailed", "System.String"},
new List<string>(){"IronSourceInterstitialEvents", "onAdOpened", "System.String"},
new List<string>(){"IronSourceInterstitialEvents", "onAdClosed", "System.String"},
new List<string>(){"IronSourceInterstitialEvents", "onAdShowSucceeded", "System.String"},
new List<string>(){"IronSourceInterstitialEvents", "onAdShowFailed", "System.String"},
new List<string>(){"IronSourceInterstitialEvents", "onAdClicked", "System.String"},
new List<string>(){"IronSourceRewardedVideoEvents", "onAdShowFailed", "System.String"},
new List<string>(){"IronSourceRewardedVideoEvents", "onAdClosed", "System.String"},
new List<string>(){"IronSourceRewardedVideoEvents", "onAdRewarded", "System.String"},
new List<string>(){"IronSourceRewardedVideoEvents", "onAdOpened", "System.String"},
new List<string>(){"IronSourceRewardedVideoEvents", "onAdClicked", "System.String"},
new List<string>(){"IronSourceRewardedVideoEvents", "onAdAvailable", "System.String"},
new List<string>(){"IronSourceRewardedVideoEvents", "onAdUnavailable"},
new List<string>(){"IronSourceRewardedVideoEvents", "onAdLoadFailed", "System.String"},
new List<string>(){"IronSourceRewardedVideoEvents", "onAdReady", "System.String"},
new List<string>(){"UnityEngine.Rendering.Universal.ShaderUtils", "GetShaderGUID", "UnityEngine.Rendering.Universal.ShaderPathID"},
new List<string>(){"Spine.Unity.SkeletonRenderer", "EditorUpdateMeshFilterHideFlags"},
new List<string>(){"Spine.Unity.SkeletonRenderer", "fixPrefabOverrideViaMeshFilter"},
new List<string>(){"Spine.Unity.SkeletonRenderer", "fixPrefabOverrideViaMeshFilterGlobal"},
new List<string>(){"Spine.Unity.SkeletonDataAsset", "errorIfSkeletonFileNullGlobal"},
new List<string>(){"Spine.Unity.SkeletonGraphic", "ResetRectToReferenceRectSize"},
new List<string>(){"Spine.Unity.SkeletonGraphic", "GetReferenceRectSize"},
new List<string>(){"Spine.Unity.SpineHandles", "DrawReferenceRect", "Spine.Unity.SkeletonGraphic", "UnityEngine.Color"},
new List<string>(){"Spine.Unity.SkeletonGraphic", "EditReferenceRect"},
new List<string>(){"Spine.Unity.SkeletonGraphic", "RectTransformSize"},
};
static bool hasGenericParameter(Type type)
{
if (type.IsGenericTypeDefinition) return true;
if (type.IsGenericParameter) return true;
if (type.IsByRef || type.IsArray)
{
return hasGenericParameter(type.GetElementType());
}
if (type.IsGenericType)
{
foreach (var typeArg in type.GetGenericArguments())
{
if (hasGenericParameter(typeArg))
{
return true;
}
}
}
return false;
}
static bool typeHasEditorRef(Type type)
{
if (type.Namespace != null && (type.Namespace == "UnityEditor" || type.Namespace.StartsWith("UnityEditor.")))
{
return true;
}
if (type.IsNested)
{
return typeHasEditorRef(type.DeclaringType);
}
if (type.IsByRef || type.IsArray)
{
return typeHasEditorRef(type.GetElementType());
}
if (type.IsGenericType)
{
foreach (var typeArg in type.GetGenericArguments())
{
if (typeArg.IsGenericParameter)
{
//skip unsigned type parameter
continue;
}
if (typeHasEditorRef(typeArg))
{
return true;
}
}
}
return false;
}
static bool delegateHasEditorRef(Type delegateType)
{
if (typeHasEditorRef(delegateType)) return true;
var method = delegateType.GetMethod("Invoke");
if (method == null)
{
return false;
}
if (typeHasEditorRef(method.ReturnType)) return true;
return method.GetParameters().Any(pinfo => typeHasEditorRef(pinfo.ParameterType));
}
}
}