/*
* 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.Reflection;
//using System.Linq;
//配置的详细介绍请看Doc下《XLua的配置.doc》
public static class LuaGenConfig
{
//lua中要使用到C#库的配置,比如C#标准库,或者Unity API,第三方库等。
[LuaCallCSharp]
[ReflectionUse]
public static List<Type> LuaCallCSharp = new List<Type>() {
typeof(System.Object),
typeof(UnityEngine.Object),
typeof(UnityEngine.Physics),
typeof(Vector2),
typeof(Vector3),
typeof(Vector4),
typeof(Quaternion),
typeof(Color),
typeof(Ray),
typeof(Bounds),
typeof(Ray2D),
typeof(Time),
typeof(GameObject),
typeof(Component),
typeof(Behaviour),
typeof(Transform),
typeof(Resources),
typeof(TextAsset),
typeof(Keyframe),
typeof(AnimationCurve),
typeof(AnimationClip),
typeof(MonoBehaviour),
typeof(ParticleSystem),
typeof(ParticleSystemRenderer),
typeof(SkinnedMeshRenderer),
typeof(Renderer),
typeof(WWW),
//typeof(Light),
typeof(Mathf),
typeof(BoxCollider),
typeof(LayerMask),
typeof(Camera),
typeof(Sprite),
typeof(Material),
typeof(Collider),
typeof(UnityEngine.Coroutine),
typeof(RectTransform),
typeof(Debug),
typeof(UnityEngine.SceneManagement.SceneManager),
typeof(AsyncOperation),
typeof(UnityEngine.Events.UnityEvent),
typeof(UnityEngine.Events.UnityEvent<bool>),
typeof(UnityEngine.EventSystems.PhysicsRaycaster),
typeof(UnityEngine.PlayerPrefs),
typeof(UnityEngine.SystemInfo),
typeof(RenderTexture),
typeof(UnityEngine.BatteryStatus),
//-----???? C# ???---//
typeof(System.Convert),
typeof(System.Linq.Enumerable),
typeof(System.Collections.IEnumerable),
typeof(System.Array),
typeof(System.Linq.EnumerableExecutor),
typeof(System.Linq.EnumerableQuery),
typeof(System.Collections.Generic.List<int>),
typeof(Action<string>),
//-----???? UI ???---//
typeof(UnityEngine.Canvas),
typeof(UnityEngine.UI.Text),
typeof(UnityEngine.UI.RawImage),
typeof(UnityEngine.UI.Image),
typeof(UnityEngine.UI.Image.Type),
typeof(UnityEngine.UI.Image.FillMethod),
typeof(UnityEngine.UI.Image.OriginHorizontal),
typeof(UnityEngine.UI.Image.Origin90),
typeof(UnityEngine.UI.Image.Origin180),
typeof(UnityEngine.UI.Image.Origin360),
typeof(UnityEngine.UI.Button),
typeof(UnityEngine.UI.VerticalLayoutGroup),
typeof(UnityEngine.UI.Toggle),
typeof(UnityEngine.UI.ToggleGroup),
typeof(UnityEngine.UI.ScrollRect),
typeof(UnityEngine.UI.ScrollRect.MovementType),
typeof(UnityEngine.UI.ScrollRect.ScrollbarVisibility),
typeof(UnityEngine.UI.ScrollRect.ScrollRectEvent),
typeof(UnityEngine.UI.Button.ButtonClickedEvent),
typeof(UnityEngine.UI.MaskableGraphic),
typeof(UnityEngine.UI.Graphic),
typeof(UnityEngine.UI.Toggle.ToggleTransition),
typeof(UnityEngine.UI.Toggle.ToggleEvent),
typeof(UnityEngine.UI.ContentSizeFitter),
typeof(UnityEngine.UI.ContentSizeFitter.FitMode),
typeof(UnityEngine.UI.HorizontalLayoutGroup),
typeof(UnityEngine.UI.Selectable),
typeof(UnityEngine.UI.Selectable.Transition),
//-----???? 自定义 ???---//
typeof(Assets.LuaHelper),
};
//C#静态调用Lua的配置(包括事件的原型),仅可以配delegate,interface
[CSharpCallLua]
[ReflectionUse]
public static List<Type> CSharpCallLua = new List<Type>() {
typeof(Action),
typeof(Func<double, double, double>),
typeof(Action<string>),
typeof(Action<double>),
typeof(Action<bool>),
typeof(Action<bool, string>),
typeof(Action<float, float>),
typeof(UnityEngine.Events.UnityAction<bool>),
typeof(Action<Vector2>),
typeof(Func<string[], string>),
typeof(UnityEngine.Events.UnityAction),
typeof(Action<UnityEngine.EventSystems.PointerEventData>),
typeof(System.Collections.IEnumerator),
typeof(UnityEngine.Events.UnityAction<int>),
typeof(Action<UnityEngine.GameObject, int>),
};
//黑名单
[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.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.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.UI.Graphic", "OnRebuildRequested" },
new List<string>(){ "UnityEngine.UI.Text", "OnRebuildRequested" }
};
}