/* * 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 Thousandto.Code.Logic; using Thousandto.Plugins.Common; using Thousandto.GameUI.Form; using Thousandto.Core.Base; using Thousandto.Code.Global; using Thousandto.Core.Asset; using Thousandto.Cfg.Data; using Thousandto.Code.Center; using Thousandto.Plugins.Common.UniScene; using Thousandto.Core.PostEffect; using Thousandto.Plugins.PathGrid; using EventSystemHandler = UnityEngine.Gonbest.MagicCube.EventSystemHandler; using EventConstDefine = UnityEngine.Gonbest.MagicCube.EventConstDefine; using FLogUploader = UnityEngine.Gonbest.MagicCube.FLogUploader; using PathUtils = UnityEngine.Gonbest.MagicCube.PathUtils; using UnityEngine.Playables; using Thousandto.Plugins.LuaType; using UnityEngine.Gonbest.MagicCube; using TimeUtils = Thousandto.Core.Base.TimeUtils; using System.IO; using System.Linq; using Thousandto.Core.Support; using System.Net; using System.Reflection; using Thousandto.CoreSDK; using Thousandto.Code.Logic.LocalPlayerBT; using Thousandto.Core.RootSystem; using MD5Utils = UnityEngine.Gonbest.MagicCube.MD5Utils; using BestHTTP; //using System.Reflection; //using System.Linq; //配置的详细介绍请看Doc下《XLua的配置.doc》 public static class ExampleGenConfig { //lua中要使用到C#库的配置,比如C#标准库,或者Unity API,第三方库等。 [LuaCallCSharp] public static List LuaCallCSharp = new List() { typeof(System.Type), typeof(System.Object), typeof(UnityEngine.Object), typeof(System.Text.Encoding), typeof(UnityEngine.WWWForm), typeof(UnityEngine.Networking.UnityWebRequest), typeof(UnityEngine.Networking.UnityWebRequestAsyncOperation), typeof(UnityEngine.AsyncOperation), typeof(UnityEngine.Rendering.CommandBuffer), typeof(UnityEngine.Rendering.BuiltinRenderTextureType), typeof(UnityEngine.Rendering.CameraEvent), typeof(UnityEngine.Rendering.RenderTargetIdentifier), typeof(Behaviour), typeof(MonoBehaviour), typeof(Component), typeof(GameObject), typeof(SendMessageOptions), typeof(Transform), typeof(Camera), typeof(Light), typeof(Material), typeof(Texture), typeof(Vector2), typeof(Vector3), typeof(RaycastHit), typeof(Vector4), typeof(Quaternion), typeof(Color), typeof(Ray), typeof(Bounds), typeof(Ray2D), typeof(Time), typeof(Resources), typeof(TextAsset), typeof(Keyframe), typeof(AnimationCurve), typeof(AnimationClip), typeof(Renderer), typeof(Mathf), typeof(List), typeof(Debug), typeof(Input), typeof(Rect), typeof(NGUIMath), typeof(UICamera), typeof(UIEventListener), typeof(List), typeof(NGUITools), typeof(UIToggle), typeof(PlayerPrefs), typeof(SystemInfo), typeof(File), typeof(WebRequest), typeof(HttpWebRequest), typeof(WebResponse), typeof(HttpWebResponse), typeof(RuntimePlatform), typeof(Physics), //枚举 typeof(UIEventDefine), typeof(LogicEventDefine), typeof(ImageTypeCode), typeof(AudioTypeCode), typeof(MsgBoxResultCode), typeof(MsgBoxIsSelect), typeof(KeyCode), typeof(FSkinTypeCode), typeof(ModelTypeCode), typeof(AllBattleProp), typeof(GuideTriggerType), typeof(FriendType), typeof(PKMode), typeof(UITweener.Method), typeof(UITweener.Style), typeof(UIWidget.Pivot), typeof(MsgBoxInfoTypeCode), typeof(MapTypeDef), typeof(SkillSelectFiledType), typeof(ActionEventCode), //物品枚举 typeof(ItemType), typeof(ItemTypeCode), typeof(ItemBigType), typeof(ItemOpertion), typeof(ContainerType), typeof(QualityCode), typeof(ItemTipsLocation), typeof(UIFormRegion), //UI typeof(UINormalForm), typeof(UIBaseFormWidget), typeof(UIButton), typeof(UISprite), typeof(UIAtlas), typeof(UITexture), typeof(UILabel), typeof(UIScrollView), typeof(UIGrid), typeof(UISlider), typeof(TweenPosition), typeof(TweenRotation), typeof(TweenTransform), typeof(UIWidget), typeof(UIBasicSprite), typeof(UIRect), typeof(UIIconBase), typeof(UIIcon), typeof(UILoopScrollViewBase), typeof(UIRoot), typeof(UIMoneyForm), typeof(UISutureTexture), typeof(UISutureTextureData), //自己写的类 typeof(GameCenter), typeof(TimeRecord), typeof(Networker), typeof(TimeUtils), typeof(UIUtility), typeof(UIPolygonScript), //typeof(UISelectPlayerSkin), typeof(UIPlayerLevelLabel), typeof(MyTweenUISlider), typeof(NetHandler), typeof(EventDelegate), typeof(AssetUtils), typeof(PathEditor.Proxy.Plugin.PathGirdData), typeof(TextureManager), typeof(RedPointSystem), typeof(ItemContianerSystem), typeof(ItemContianerModel), typeof(MsgPromptSystem), typeof(GameSceneSystem), typeof(TextureInfo), //typeof(GuildRepertorySystem), typeof(PathSearchSystem), typeof(PathGridSystem), typeof(PathLandSystem), typeof(UIFormManager), typeof(FormStateSystem), typeof(MD5Utils), typeof(GameUICenter), typeof(RedPointTaskCondition), typeof(RedPointLevelCondition), typeof(UIListMenu), typeof(FingerGesturesEventTrigger), typeof(IFingerGesturesEvent), typeof(CharacterDeadInfo), typeof(LocalPlayer), typeof(Player), typeof(GameScene), typeof(EntityContainer), typeof(CameraControl), typeof(CameraManager), typeof(SkillVisualManager), typeof(SkillVisualInfo), typeof(Idle), typeof(EntityFSM), typeof(EntityFState), typeof(PathMove), typeof(PathMoveData), typeof(UIRoleSkinCompoent), typeof(AssetUtils), typeof(LayerUtils), typeof(CommonUtils), typeof(PathFinderSystem), typeof(UIItemShow), typeof(ItemModel), typeof(LocalPlayerProperty), typeof(UIItem), typeof(ItemMsgCondition), typeof(BaseProperty), typeof(ItemBase), typeof(MainFunctionSystem), typeof(MainFunctionInfo), typeof(ChatSystem), typeof(NatureVfxEffect), typeof(UIPlayerSkinCompoent), typeof(EquipmentSystem), typeof(UIAnimationModule), typeof(Equipment), typeof(ImmortalEquip), //typeof(UISelectEquipItem), typeof(GameSetting), typeof(GameSettingKeyCode), typeof(HeartSystem), typeof(SDKSystem), typeof(MsgInfoBase), typeof(MsgPromptInfo), typeof(MsgBoxInfo), typeof(MsgBoxSelectInfo), typeof(Character), typeof(Entity), typeof(ForwardRoter), typeof(TimerEventSystem), typeof(LanguageConvertSystem), typeof(VariableSystem), typeof(HardwareManager), typeof(IDeviceInfo), typeof(IDiskInfo), typeof(IMemoryInfo), typeof(MapPathInfo.Position), typeof(TaskBD.TaskTargetType), typeof(WrapMode), typeof(AnimationPartType), typeof(AnimationCullingType), typeof(WordFilter), typeof(MyTweenPosition), typeof(MyTweenPosition), typeof(MonsterSoulEquipData), typeof(Buff), typeof(BuffSystem), typeof(TimeTicker), typeof(FuncellSDK), typeof(FSkinModelConfig), typeof(PostEffectManager), typeof(VideoManager), typeof(AnimationPlayer), typeof(Animator), typeof(UIVideoPlayUtils), typeof(HolyEquip), typeof(DynamicBlockerManager), typeof(UIVfxSkinCompoent), typeof(AudioPlayer), typeof(UpdateSystem), //typeof(NoticeType), typeof(AnimatorCullingMode), typeof(RedPointCustomCondition), typeof(RedPointItemCondition), typeof(RedPointEquipCondition), typeof(EntityStateID), typeof(BattlePropTools), typeof(VFXPlayState), typeof(UnityUtils), typeof(UIFormType), typeof(MsgInfoPriority), typeof(RoleBaseAttribute), typeof(Delegate), typeof(PlayerPropetry), typeof(Screen), typeof(RenderTexture), typeof(UITweener), typeof(MapLogicSwitch), typeof(List), typeof(List), typeof(List), typeof(List), typeof(List), typeof(List), typeof(List), typeof(List), typeof(List), typeof(List), typeof(Dictionary), typeof(Dictionary), typeof(Dictionary), typeof(Dictionary), typeof(Thousandto.CoreSDK.FuncellSDKDefault), typeof(Thousandto.Code.Logic.WorldMapInfoManager), typeof(Thousandto.Code.Logic.ImmortalResSystem), typeof(UIInput), typeof(UIPanel), typeof(UIButtonColor), typeof(UIWidgetContainer), typeof(MSG_Equip.ResEquipPartInfo), typeof(MSG_Equip.EquipPartInfo), typeof(MSG_Equip.EquipStrengthInfo), typeof(Thousandto.Cfg.Data.DeclareEquip), typeof(MSG_Equip.gemPartInfo), typeof(Thousandto.Core.Asset.AnimListBaseScript), typeof(Thousandto.Plugins.Common.UniScene.BaseScene), typeof(Thousandto.Plugins.Common.UIBaseFormAnimation), typeof(UITable), typeof(UISpriteAnimation), typeof(UIFrameAnimation), typeof(Thousandto.Plugins.Common.MonoCacheBase), typeof(Thousandto.Code.Logic.AttribuiteData), typeof(Thousandto.Cfg.Data.DeclareSoulBeasts), typeof(SpringPanel), typeof(System.Enum), typeof(System.ValueType), typeof(UIProgressBar), typeof(Thousandto.Cfg.Data.DeclareItem), typeof(UnityEngine.Camera.MonoOrStereoscopicEye), typeof(UnityEngine.Camera.StereoscopicEye), typeof(UnityEngine.Camera.GateFitParameters), typeof(EventDelegate.Parameter), typeof(UIWidget.AspectRatioSource), typeof(UnityEngine.Camera.GateFitMode), typeof(UILabel.Crispness), typeof(UILabel.Overflow), typeof(UILabel.Effect), typeof(UIInput.OnReturnKey), typeof(UIInput.KeyboardType), typeof(UIInput.Validation), typeof(UIInput.InputType), typeof(UIPanel.RenderQueue), typeof(UIButtonColor.State), typeof(UIBasicSprite.Flip), typeof(UIBasicSprite.AdvancedType), typeof(UIBasicSprite.FillDirection), typeof(UIBasicSprite.Type), typeof(UIRect.AnchorUpdate), typeof(UITable.Sorting), typeof(UITable.Direction), typeof(UIGrid.Sorting), typeof(UIGrid.Arrangement), typeof(UIScrollView.ShowCondition), typeof(UIScrollView.DragEffect), typeof(UIScrollView.Movement), typeof(UICamera.EventType), typeof(UICamera.ClickNotification), typeof(UICamera.ControlScheme), typeof(UIProgressBar.FillDirection), //typeof(Thousandto.Code.Logic.GuildRepertorySystem.PopQulityItem), //typeof(Thousandto.Code.Logic.GuildRepertorySystem.PopLevelItem), typeof(UICamera.Touch), typeof(UICamera.MouseOrTouch), typeof(MsgBoxButton), typeof(UISpriteData), typeof(ChatPrivateSystem), typeof(TweenAlpha), typeof(UnityEngine.BoxCollider), typeof(UnityEngine.Collider), typeof(System.Delegate), typeof(System.Runtime.CompilerServices.ExtensionAttribute), typeof(System.ParamArrayAttribute), typeof(System.ObsoleteAttribute), typeof(System.Nullable), typeof(System.Array), typeof(System.Decimal), typeof(Thousandto.Cfg.Data.DeclareFunctionStart), typeof(Thousandto.Code.Logic.MsgMarqueeInfo), typeof(Thousandto.Code.Logic.Npc), typeof(UIRect.AnchorPoint), typeof(SlotUtils), typeof(Slot), typeof(SlotNameDefine), typeof(PreLoadAssetInfo), typeof(UIShandowPlane), typeof(UIPanelShadowTexture), typeof(CacheSceneSystem), typeof(LogicAdaptor), typeof(ReconnectSystem), typeof(Thousandto.Code.Logic.LocalPlayerBT.PlayerBT), typeof(BISystem), typeof(UISceneManager), typeof(IUIScene), typeof(Thousandto.Core.Asset.TimelineInfo), typeof(Thousandto.Core.Asset.TimelinePlayer), typeof(TimelineSystem), typeof(PlayableDirector), typeof(TimelinePlayState), typeof(PlayableAsset), typeof(CastList), typeof(PrefabAssetManager), typeof(UIPoolAssetsLoader), typeof(Thousandto.Launcher.Form.UIClearCachePanelScript), typeof(MSG_Friend.CommonInfo), typeof(iTween), typeof(FAssetBase), typeof(FGameObjectBase), typeof(FGameObject), typeof(FGameObjectModel), typeof(FGameObjectAnim), typeof(FGameObjectVFX), typeof(FSkinBase), typeof(FSkinModel), typeof(FSkinPartBase), typeof(MSG_BI.Device), typeof(Thousandto.CoreSDK.SDKCacheData), typeof(CoroutinePool), typeof(LuaCoroutineUtils), typeof(LocalPlayerRoot), typeof(CombatUtil), typeof(FrameMonitor), typeof(DropAscriptionSystem), typeof(ITaskManager), typeof(ITaskController), typeof(SkillSelectFiledManager), typeof(InputSystem), typeof(JoystickHandler), typeof(RollDodgeHandler), typeof(MathLib), typeof(FPlayerAnimRelation), typeof(Npc), typeof(Monster), typeof(Collection), typeof(FlySword), typeof(LocalFlySword), typeof(Pet), typeof(LocalPet), typeof(RemotePlayer), typeof(RemotePlayerProperty), typeof(NpcProperty), typeof(MonsterProperty), typeof(FlySwordProperty), typeof(CollectionPropterty), typeof(PetProperty), typeof(ShaderManager), typeof(IPlayerVisualInfo), typeof(SpawnPoolNameCode), typeof(SkillManager), typeof(PlayerBDState), typeof(UseSkillBD), typeof(TaskBD), typeof(StrideMapMoveBD), typeof(TalkToNpcBD), typeof(CollectBD), typeof(FightBossBD), typeof(CrossMapBD), typeof(SceneRestoreSystem), typeof(IGuideSystem), typeof(IBlockingUpPromptSystem), typeof(MessageDef), typeof(Message), typeof(MessageId), typeof(MaterialManager), typeof(Shader), typeof(TexSyncUtils), //定义MagicCube中的类 typeof(PathUtils), typeof(FLogUploader), typeof(FLanguage), typeof(EventConstDefine), typeof(AppPersistData), typeof(MachineUUID), typeof(AppManager), typeof(AppAssetFileInfo), typeof(HTTPRequest), typeof(HTTPResponse), typeof(Uri), typeof(HTTPMethods), typeof(AssemblyUtils), //定义的专门用于Lua调用的类 typeof(LuaUnityUtility), typeof(LuaAssetUtils), typeof(LuaBehaviour), typeof(LuaUISutureTextureData), typeof(UILuaForm), typeof(UIExtendLuaForm), typeof(LuaFGameObjectVFX), typeof(LuaFGameObjectModel), typeof(LuaFGameObjectAnim), typeof(LuaFSkinModel), typeof(LuaFSkinPartBase), typeof(LuaCharacter), typeof(LuaCharStateData), typeof(LuaCharState), typeof(LuaItemBase), //反射的相关类 typeof(System.Reflection.MemberInfo), typeof(System.Reflection.MethodInfo), typeof(System.Reflection.PropertyInfo), typeof(System.Reflection.FieldInfo), typeof(System.Reflection.MemberFilter), typeof(System.Reflection.BindingFlags), }; //C#静态调用Lua的配置(包括事件的原型),仅可以配delegate,interface [CSharpCallLua] public static List CSharpCallLua = new List() { //delegate typeof(Action), typeof(MyAction), typeof(MyAction), typeof(MyAction), typeof(MyAction), typeof(Func), typeof(Func), typeof(Func), typeof(Func), typeof(MyAction), typeof(Func, FSkinPartBase>), typeof(Action), typeof(MyAction), typeof(MyAction), typeof(MyAction), typeof(MyAction), typeof(MyAction), typeof(MyAction), typeof(Action), typeof(Action), typeof(Action), typeof(Action), typeof(Action), typeof(Action), typeof(Action), typeof(Action), typeof(Action), typeof(Action), typeof(Action), typeof(Action), typeof(Action), typeof(Action), typeof(Action>), typeof(Action), typeof(Action), typeof(Action), typeof(Func), typeof(Func), typeof(Func), typeof(UnityEngine.Events.UnityAction), typeof(LuaUpdateDelegate), typeof(LuaUpdatePlussDelegate), typeof(DoResMessageDelegate), typeof(EventDelegate.Callback), typeof(CheckUILuaDelegate), typeof(NoParamesReturnBool), typeof(IsRenewForm), typeof(UILoopScrollViewBase.OnItemChange), typeof(UIPlayerBagItem.BagItemDelegate), typeof(EventSystemHandler), typeof(System.Collections.IEnumerator), typeof(EnterSceneDelegate), typeof(ShowItemTipsDelegate), typeof(ShowItemTipsByidDelegate), typeof(LeaveSceneDelegate), typeof(ParmesIntReturnInt), typeof(ParamFloatNoReturn), typeof(OnGameMessageDelagate), typeof(ClientGMDelagate), typeof(ParamPlayerHeadNoReturn), typeof(SetPlayerLevelDelagate), typeof(ParmesIntIntReturnItemBase), typeof(UIEventListener.KeyCodeDelegate), typeof(UIEventListener.ObjectDelegate), typeof(UIEventListener.VectorDelegate), typeof(UIEventListener.FloatDelegate), typeof(UIEventListener.BoolDelegate), typeof(UIEventListener.VoidDelegate), typeof(FingerDownEventHandler), typeof(FingerUpEventHandler), typeof(PinchEventHandler), typeof(RotationBeginEventHandler), typeof(RotationMoveEventHandler), typeof(RotationEndEventHandler), typeof(FingerMoveEventHandler), typeof(UIWidget.HitCheck), typeof(UIWidget.OnDimensionsChanged), typeof(UIWidget.OnPostFillCallback), typeof(UIInput.OnValidate), typeof(UIToggle.Validate), typeof(UIPanel.OnRenderQueueChanged), typeof(UIPanel.OnClippingMoved), typeof(UIPanel.OnGeometryUpdated), typeof(UITable.OnReposition), typeof(UIGrid.OnReposition), typeof(UIScrollView.OnDragNotification), typeof(SpringPanel.OnFinished), typeof(UICamera.GetTouchCallback), typeof(UICamera.GetTouchCountCallback), typeof(Camera.CameraCallback), typeof(UICamera.KeyCodeDelegate), typeof(UICamera.ObjectDelegate), typeof(UICamera.VectorDelegate), typeof(UICamera.FloatDelegate), typeof(UICamera.BoolDelegate), typeof(UICamera.VoidDelegate), typeof(UICamera.MoveDelegate), typeof(UICamera.OnSchemeChange), typeof(UICamera.OnCustomInput), typeof(UICamera.OnScreenResize), typeof(UICamera.GetAnyKeyFunc), typeof(UICamera.GetAxisFunc), typeof(UICamera.GetKeyStateFunc), typeof(UIProgressBar.OnDragFinished), typeof(Thousandto.GameUI.Form.UIItem.UIItemDelegate), typeof(Thousandto.Code.Logic.BaseProperty.BattlePropertyChange), typeof(Thousandto.Code.Logic.BaseProperty.BasePropertyChange), typeof(NoParamesReturnBool), typeof(NoParamesReturnInt), typeof(NoParamesReturnUintArr), typeof(NoParamesReturnStringArr), typeof(NoParamesReturnString), typeof(LuaItemBase.NoParamesReturnUInt), typeof(ParmesIntReturnInt), typeof(ParmesIntReturnBool), typeof(DoFunctionCallBackDelegate), typeof(FunctionOpenedDelegate), typeof(GetVariableShowTextDelegate), typeof(GetVariableShowProgressDelegate), typeof(IsVariableReachDelegate), typeof(GetVariableValueDelegate), typeof(ParamFuncNoReturn), typeof(NoParamNoReturn), typeof(ParamTransformNoReturn), typeof(ParamIntReturnString), typeof(NoParamReturnTable), typeof(AddShowNewItemDelegate), typeof(AddUseNewItemDelegate), typeof(RefreshPlayerSkinModelDelegate), typeof(OpenNpcTalkDelegate), typeof(BindLuaCharacterDelegate), typeof(ParmesIntIntReturnInt), typeof(IsTeamMemberDelegate), typeof(GetDressHolyEquipDelagate), typeof(GetMandateSkillListDelagate), typeof(SetFlySwordSkillDelagate), typeof(TranslateAnimNameDelegate), typeof(ParamRefRenderListNoReturn), typeof(ParamStringRefWrapModeReturnString), typeof(Func), typeof(Func), typeof(Func), typeof(MyFunc), typeof(Action), typeof(Action), typeof(Func), typeof(Action), typeof(Func), typeof(Func), typeof(Func), typeof(Func), typeof(Func), typeof(Func), typeof(OnRequestFinishedDelegate), typeof(OnDownloadProgressDelegate), typeof(OnUploadProgressDelegate), }; public static List BlackGenericTypeList = new List() { typeof(Span<>), typeof(ReadOnlySpan<>), }; private static bool IsBlacklistedGenericType(Type type) { if (!type.IsGenericType) return false; return BlackGenericTypeList.Contains(type.GetGenericTypeDefinition()); } [BlackList] public static Func GenericTypeFilter = (memberInfo) => { switch (memberInfo) { case PropertyInfo propertyInfo: return IsBlacklistedGenericType(propertyInfo.PropertyType); case ConstructorInfo constructorInfo: return constructorInfo.GetParameters().Any(p => IsBlacklistedGenericType(p.ParameterType)); case MethodInfo methodInfo: return methodInfo.GetParameters().Any(p => IsBlacklistedGenericType(p.ParameterType)); default: return false; } }; /** 黑名单,不需要生成wrap文件的数据 * 说明: * 类名称,函数名称,函数参数类型(命名空间,类名) */ [BlackList] public static List> BlackList = new List>() { new List(){"System.Xml.XmlNodeList", "ItemOf"}, new List(){"UnityEngine.WWW", "movie"}, #if UNITY_WEBGL new List(){"UnityEngine.WWW", "threadPriority"}, #endif new List(){"UnityEngine.Texture2D", "alphaIsTransparency"}, new List(){"UnityEngine.Security", "GetChainOfTrustValue"}, new List(){"UnityEngine.CanvasRenderer", "onRequestRebuild"}, new List(){"UnityEngine.Light", "areaSize"}, new List(){"UnityEngine.Light", "lightmapBakeType"}, new List(){"UnityEngine.Light", "SetLightDirty"}, new List(){"UnityEngine.Light", "shadowRadius"}, new List(){"UnityEngine.Light", "shadowAngle"}, new List(){"UnityEngine.WWW", "MovieTexture"}, new List(){"UnityEngine.WWW", "GetMovieTexture"}, new List(){"UnityEngine.AnimatorOverrideController", "PerformOverrideClipListCleanup"}, #if !UNITY_WEBPLAYER new List(){"UnityEngine.Application", "ExternalEval"}, #endif new List(){"UnityEngine.GameObject", "networkView"}, //4.6.2 not support new List(){"UnityEngine.Component", "networkView"}, //4.6.2 not support new List(){"UnityEngine.MonoBehaviour", "runInEditMode"}, new List(){"UnityEngine.Texture", "imageContentsHash"}, new List(){"UnityEngine.Input", "IsJoystickPreconfigured","System.String"}, new List(){"UnityEngine.Input", "location"}, new List(){"UnityEngine.SystemInfo", "supportsLocationService"}, new List(){"UIWidget", "showHandlesWithMoveTool"}, new List(){"UIWidget", "showHandles"}, new List(){"UIInput", "ProcessEvent", "UnityEngine.Event"}, new List(){"UILabel", "text", "System.String"}, new List(){"System.IO.FileInfo", "GetAccessControl", "System.Security.AccessControl.AccessControlSections" }, new List(){"System.IO.FileInfo", "SetAccessControl", "System.Security.AccessControl.FileSecurity" }, new List(){"System.IO.DirectoryInfo", "GetAccessControl", "System.Security.AccessControl.AccessControlSections" }, new List(){"System.IO.DirectoryInfo", "SetAccessControl", "System.Security.AccessControl.DirectorySecurity" }, new List(){"System.IO.DirectoryInfo", "CreateSubdirectory", "System.String", "System.Security.AccessControl.DirectorySecurity"}, new List(){"System.IO.DirectoryInfo", "Create", "System.Security.AccessControl.DirectorySecurity" }, new List(){"System.IO.File", "Create", "System.String", "System.Int32", "System.IO.FileOptions" }, new List(){"System.IO.File", "Create", "System.String", "System.Int32", "System.IO.FileOptions", "System.Security.AccessControl.FileSecurity" }, new List(){"System.IO.File", "GetAccessControl", "System.String" }, new List(){"System.IO.File", "GetAccessControl", "System.String", "System.Security.AccessControl.AccessControlSections" }, new List(){"System.IO.File", "SetAccessControl", "System.String", "System.Security.AccessControl.FileSecurity" }, new List(){ "System.Reflection.FieldInfo", "GetValueDirect", "System.TypedReference"}, new List(){ "System.Reflection.FieldInfo", "SetValueDirect", "System.TypedReference", "System.Object"}, new List(){"System.Type", "IsCollectible"}, new List(){"System.Type", "MakeGenericSignatureType"}, new List(){"UnityEngine.Physics","ContactModifyEvent"}, new List(){"UnityEngine.Physics","ContactModifyEventCCD"}, new List(){"UnityEngine.Physics","ContactEvent"}, }; //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; //} //// 配置某Assembly下所有涉及到的delegate到CSharpCallLua下,Hotfix下拿不准那些delegate需要适配到lua function可以这么配置 //[CSharpCallLua] //static IEnumerable AllDelegate //{ // get // { // BindingFlags flag = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public; // List allTypes = new List(); // var allAssemblys = new Assembly[] // { // Assembly.Load("Assembly-CSharp") // }; // foreach (var t in (from assembly in allAssemblys from type in assembly.GetTypes() select type)) // { // var p = t; // while (p != null) // { // allTypes.Add(p); // p = p.BaseType; // } // } // allTypes = allTypes.Distinct().ToList(); // var allMethods = from type in allTypes // from method in type.GetMethods(flag) // select method; // var returnTypes = from method in allMethods // select method.ReturnType; // var paramTypes = allMethods.SelectMany(m => m.GetParameters()).Select(pinfo => pinfo.ParameterType.IsByRef ? pinfo.ParameterType.GetElementType() : pinfo.ParameterType); // var fieldTypes = from type in allTypes // from field in type.GetFields(flag) // select field.FieldType; // return (returnTypes.Concat(paramTypes).Concat(fieldTypes)).Where(t => t.BaseType == typeof(MulticastDelegate) && !hasGenericParameter(t)).Distinct(); // } //} }