diff --git a/Assets/Editor.meta b/Assets/Editor.meta new file mode 100644 index 0000000000000000000000000000000000000000..cafb3ee361f2f2eeb04f23f0e8a81febb4801f54 --- /dev/null +++ b/Assets/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 19864418aecd9304a962111ebfaaa135 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Build.meta b/Assets/Editor/Build.meta new file mode 100644 index 0000000000000000000000000000000000000000..a38eacdcb9d249e54e1289d1ebc192d1c4cc4f2d --- /dev/null +++ b/Assets/Editor/Build.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a730e3f543354fb458cf017d1205c0d5 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Build/BuildApp.cs b/Assets/Editor/Build/BuildApp.cs new file mode 100644 index 0000000000000000000000000000000000000000..c08d2c27694bd49cc31049d064f4b02ba0270c6e --- /dev/null +++ b/Assets/Editor/Build/BuildApp.cs @@ -0,0 +1,47 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; +using System.IO; + + +public class BuildApp : EditorWindow +{ + [MenuItem("Build/打包APP")] + public static void ShowWin() + { + var win = GetWindow(); + win.Show(); + } + + private void Awake() + { + m_versionGUI = new VersionGUI(); + m_versionGUI.Awake(); + } + + private void OnGUI() + { + m_versionGUI.DrawVersion(); + DrawBuildApp(); + } + + + + private void DrawBuildApp() + { + if(GUILayout.Button("Build APP")) + { + // 生成原始lua全量文件的md5 + BuildUtils.GenOriginalLuaFrameworkMD5File(); + // 打AssetBundle + BuildAssetBundle.Build(); + // 打包APP + BuildUtils.BuildApp(); + } + + + } + + private VersionGUI m_versionGUI; +} diff --git a/Assets/Editor/Build/BuildApp.cs.meta b/Assets/Editor/Build/BuildApp.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..675e5a606eb2992ec4b0d351fd6ab40c2d49f569 --- /dev/null +++ b/Assets/Editor/Build/BuildApp.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d9f4a1765020ccc47a60ad7bd5dc8289 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Build/BuildAssetBundle.cs b/Assets/Editor/Build/BuildAssetBundle.cs new file mode 100644 index 0000000000000000000000000000000000000000..7442ea40b932ce6aff4f7fefe6b9db3b1c58fb13 --- /dev/null +++ b/Assets/Editor/Build/BuildAssetBundle.cs @@ -0,0 +1,15 @@ +using UnityEngine; +using UnityEditor; + + +public class BuildAssetBundle +{ + public static void Build() + { + string targetPath = Application.streamingAssetsPath + "/res"; + BuildUtils.BuildLuaBundle(targetPath); + BuildUtils.BuildNormalCfgBundle(targetPath); + BuildUtils.BuildGameResBundle(targetPath); + GameLogger.Log("BuildAssetBundle Done"); + } +} diff --git a/Assets/Editor/Build/BuildAssetBundle.cs.meta b/Assets/Editor/Build/BuildAssetBundle.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..0f9ccf56bdcb630e128b5aa8fbce21330116e74e --- /dev/null +++ b/Assets/Editor/Build/BuildAssetBundle.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cbea85053b739d14897b492e9306406f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Build/BuildUpdateZip.cs b/Assets/Editor/Build/BuildUpdateZip.cs new file mode 100644 index 0000000000000000000000000000000000000000..f9d81b9a124873931b3007ec6178dcf4dee1fa45 --- /dev/null +++ b/Assets/Editor/Build/BuildUpdateZip.cs @@ -0,0 +1,169 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; +using Ionic.Zip; +using System.IO; +using LitJson; +using UObject = UnityEngine.Object; +using System.Text.RegularExpressions; + +public class BuildUpdateZip : EditorWindow +{ + [MenuItem("Build/打热更包")] + public static void ShowWindow() + { + var win = GetWindow(); + win.Show(); + } + + private void Awake() + { + m_versionGUI = new VersionGUI(); + m_versionGUI.Awake(); + m_luaFrameworkFilesVersion = TryGetLuaFrameworkFilesVersion(); + } + + private void OnGUI() + { + m_versionGUI.DrawVersion(); + GUILayout.BeginHorizontal(); + GUILayout.Label("LuaFrameworkFiles.json"); + m_luaFrameworkFilesVersion = EditorGUILayout.TextField(m_luaFrameworkFilesVersion); + GUILayout.EndHorizontal(); + if (GUILayout.Button("打热更包")) + { + var zipDir = BuildUtils.CreateTmpDir("updateZip"); + BuildUtils.BuildNormalCfgBundle(zipDir); + BuildLuaUpdateBundle(zipDir); + var contionsObj = BuildObjBundle(zipDir); + ZipUpdateDir(zipDir, contionsObj); + BuildUtils.DeleteDir(zipDir); + AssetDatabase.Refresh(); + } + DrawObjList(); + } + + private void DrawObjList() + { + m_scrollViewPos = GUILayout.BeginScrollView(m_scrollViewPos); + if (GUILayout.Button("+")) + { + m_objList.Add(null); + } + for (int i = 0, cnt = m_objList.Count; i < cnt; ++i) + { + GUILayout.BeginHorizontal(); + m_objList[i] = EditorGUILayout.ObjectField(m_objList[i], typeof(UObject), false); + if (GUILayout.Button("-")) + { + m_objList.RemoveAt(i); + break; + } + GUILayout.EndHorizontal(); + } + + GUILayout.EndScrollView(); + } + + private string TryGetLuaFrameworkFilesVersion() + { + if (!Directory.Exists(BuildUtils.BIN_PATH)) + return null; + var fs = Directory.GetFiles(BuildUtils.BIN_PATH); + foreach (var f in fs) + { + if (f.Contains("LuaFrameworkFiles_")) + { + var result = Regex.Match(f, ".*LuaFrameworkFiles_(.*).json"); + if (null != result) + { + return result.Groups[1].Value; + } + } + } + return null; + } + + private void ZipUpdateDir(string zipDir, bool contionsObj) + { + var zipFilePath = BuildUtils.BIN_PATH + "/" + (contionsObj ? "res_" : "script_") + VersionMgr.instance.resVersion + ".zip"; + if (File.Exists(zipFilePath)) + { + File.Delete(zipFilePath); + } + ZipFile zipFile = new ZipFile(); + var fs = Directory.GetFiles(zipDir); + foreach (var f in fs) + { + if (f.EndsWith("meta") || f.EndsWith(".manifest")) + continue; + zipFile.AddFile(f, ""); + } + zipFile.Save(zipFilePath); + zipFile.Dispose(); + } + + + + private void BuildLuaUpdateBundle(string zipDir) + { + var needUpdateLuaFiles = GetNeedUpdateLuaList(); + GameLogger.Log("needUpdateLuaFiles.Count:" + needUpdateLuaFiles.Count); + var luaBundleDir = BuildUtils.CreateTmpDir("luabundle"); + + BuildUtils.CopyLuaToBundleDir(needUpdateLuaFiles, luaBundleDir); + // 打包AssetBundle + Hashtable tb = new Hashtable(); + tb["lua_update.bundle"] = "luabundle"; + AssetBundleBuild[] buildArray = BuildUtils.MakeAssetBundleBuildArray(tb); + BuildUtils.BuildBundles(buildArray, zipDir); + BuildUtils.DeleteDir(luaBundleDir); + AssetDatabase.Refresh(); + } + + private bool BuildObjBundle(string zipDir) + { + if (0 == m_objList.Count) return false; + AssetBundleBuild[] bundleBuilds = new AssetBundleBuild[m_objList.Count]; + bool contionsObj = false; + for (int i = 0, cnt = m_objList.Count; i < cnt; ++i) + { + var obj = m_objList[i]; + if (null == obj) continue; + var assetPath = AssetDatabase.GetAssetPath(obj); + var fileName = Path.GetFileName(assetPath); + + bundleBuilds[i].assetBundleName = fileName; + bundleBuilds[i].assetNames = new string[] { assetPath }; + contionsObj = true; + } + BuildUtils.BuildBundles(bundleBuilds, zipDir); + return contionsObj; + } + + private List GetNeedUpdateLuaList() + { + var localLuaMD5 = BuildUtils.GetOriginalLuaframeworkMD5Json(); + var originalLuaMD5FilePath = BuildUtils.BIN_PATH + "/LuaFrameworkFiles_" + m_luaFrameworkFilesVersion + ".json"; + var originalLuaMD5File = File.OpenRead(originalLuaMD5FilePath); + StreamReader sr = new StreamReader(originalLuaMD5File); + var jsonStr = sr.ReadToEnd(); + sr.Close(); + var originalLuaMD5 = JsonMapper.ToObject(jsonStr); + List needUpdateLuaFiles = new List(); + foreach (var key in localLuaMD5.Keys) + { + if (!originalLuaMD5.ContainsKey(key) || originalLuaMD5[key].ToString() != localLuaMD5[key].ToString()) + { + needUpdateLuaFiles.Add(key); + } + } + return needUpdateLuaFiles; + } + + private VersionGUI m_versionGUI; + private string m_luaFrameworkFilesVersion; + private List m_objList = new List(); + private Vector2 m_scrollViewPos; +} diff --git a/Assets/Editor/Build/BuildUpdateZip.cs.meta b/Assets/Editor/Build/BuildUpdateZip.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..0ccba4dbb905b32b039d74435b18984a214e78a9 --- /dev/null +++ b/Assets/Editor/Build/BuildUpdateZip.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bca23174dce23564c87a92c47791dbca +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Build/BuildUtils.cs b/Assets/Editor/Build/BuildUtils.cs new file mode 100644 index 0000000000000000000000000000000000000000..4c8340c38d46e36de0ff6ff1a7324ff891ca135a --- /dev/null +++ b/Assets/Editor/Build/BuildUtils.cs @@ -0,0 +1,295 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; +using System.IO; +using LitJson; + +public class BuildUtils +{ + /// + /// 递归遍历获取目标目录中的所有文件 + /// + /// 目标目录 + /// 是否要切割目录,以Assets目录为根 + public static List GetFiles(string sourceDir, bool splitAssetPath) + { + List fileList = new List(); + string[] fs = Directory.GetFiles(sourceDir); + string[] ds = Directory.GetDirectories(sourceDir); + for (int i = 0, len = fs.Length; i < len; ++i) + { + var index = splitAssetPath ? fs[i].IndexOf("Assets") : 0; + fileList.Add(fs[i].Substring(index)); + } + for (int i = 0, len = ds.Length; i < len; ++i) + { + fileList.AddRange(GetFiles(ds[i], splitAssetPath)); + } + return fileList; + } + + public static List GetFiles(string[] sourceDirs, bool splitAssetPath) + { + List fileList = new List(); + foreach (var sourceDir in sourceDirs) + { + fileList.AddRange(GetFiles(sourceDir, splitAssetPath)); + } + return fileList; + } + + + + /// + /// 根据哈希表构建AssetBundleBuild列表 + /// + /// 哈希表,key为assetBundleName,value为目录 + /// + public static AssetBundleBuild[] MakeAssetBundleBuildArray(Hashtable tb) + { + AssetBundleBuild[] buildArray = new AssetBundleBuild[tb.Count]; + int index = 0; + foreach (string key in tb.Keys) + { + buildArray[index].assetBundleName = key; + List fileList = new List(); + fileList = GetFiles(Application.dataPath + "/" + tb[key], true); + buildArray[index].assetNames = fileList.ToArray(); + ++index; + } + + return buildArray; + } + + /// + /// 打包常规配置表AssetBundle + /// + public static void BuildNormalCfgBundle(string targetPath) + { + Hashtable tb = new Hashtable(); + tb["normal_cfg.bundle"] = "GameRes/Config"; + AssetBundleBuild[] buildArray = BuildUtils.MakeAssetBundleBuildArray(tb); + BuildUtils.BuildBundles(buildArray, targetPath); + } + + /// + /// 打包Lua的AssetBundle + /// + public static void BuildLuaBundle(string targetPath) + { + // 创建Lua的Bundle临时目录 + var luabundleDir = BuildUtils.CreateTmpDir("luabundle"); + // 将Lua代码拷贝到Bundle临时目录(做加密处理) + var luaFiles = BuildUtils.GetFiles(new string[] { + Application.dataPath + "/LuaFramework/Lua", + Application.dataPath + "/LuaFramework/ToLua/Lua", + }, true); + BuildUtils.CopyLuaToBundleDir(luaFiles, luabundleDir); + // 构建AssetBundleBuild列表 + Hashtable tb = new Hashtable(); + tb["lua.bundle"] = "luabundle"; + AssetBundleBuild[] buildArray = MakeAssetBundleBuildArray(tb); + // 打包AssetBundle + BuildBundles(buildArray, targetPath); + + // 删除Lua的Bundle临时目录 + DeleteDir(luabundleDir); + AssetDatabase.Refresh(); + } + + /// + /// 打包游戏资源AssetBundle + /// + public static void BuildGameResBundle(string targetPath) + { + Hashtable tb = new Hashtable(); + tb["baseres.bundle"] = "GameRes/BaseRes"; + tb["uiprefabs.bundle"] = "GameRes/UIPrefabs"; + AssetBundleBuild[] buildArray = MakeAssetBundleBuildArray(tb); + BuildBundles(buildArray, targetPath); + } + + /// + /// 打AssetBundle + /// + /// AssetBundleBuild列表 + public static void BuildBundles(AssetBundleBuild[] buildArray, string targetPath) + { + if (!Directory.Exists(targetPath)) + { + Directory.CreateDirectory(targetPath); + } + BuildPipeline.BuildAssetBundles(targetPath, buildArray, BuildAssetBundleOptions.ChunkBasedCompression, GetBuildTarget()); + + } + + public static void BuildApp() + { + string[] scenes = new string[] { "Assets/Scenes/Main.unity" }; + string appName = PlayerSettings.productName + "_" + VersionMgr.instance.appVersion + GetTargetPlatfromAppPostfix(); + string outputPath = Application.dataPath + "/../Bin/"; + if (!Directory.Exists(outputPath)) + { + Directory.CreateDirectory(outputPath); + } + string appPath = Path.Combine(outputPath, appName); + + // 根据你的需求设置各种版本号 + // PlayerSettings.Android.bundleVersionCode + // PlayerSettings.bundleVersion + // PlayerSettings.iOS.buildNumber + + BuildPipeline.BuildPlayer(scenes, appPath, GetBuildTarget(), BuildOptions.None); + GameLogger.Log("Build APP Done"); + } + + /// + /// 生成原始lua代码的md5 + /// + public static void GenOriginalLuaFrameworkMD5File() + { + VersionMgr.instance.Init(); + JsonData jd = GetOriginalLuaframeworkMD5Json(); + var jsonStr = JsonMapper.ToJson(jd); + jsonStr = jsonStr.Replace(",", ",\n"); + if (!Directory.Exists(BIN_PATH)) + { + Directory.CreateDirectory(BIN_PATH); + } + using (StreamWriter sw = new StreamWriter(BIN_PATH + "LuaFrameworkFiles_" + VersionMgr.instance.appVersion + ".json")) + { + sw.Write(jsonStr); + } + GameLogger.Log("GenLuaframeworkMd5 Done"); + } + + public static JsonData GetOriginalLuaframeworkMD5Json() + { + var sourceDirs = new string[] { + Application.dataPath + "/LuaFramework/Lua", + Application.dataPath + "/LuaFramework/ToLua/Lua", + }; + JsonData jd = new JsonData(); + foreach (var sourceDir in sourceDirs) + { + List fileList = new List(); + fileList = GetFiles(sourceDir, false); + foreach (var luaFile in fileList) + { + if (!luaFile.EndsWith(".lua")) continue; + + var md5 = LuaFramework.Util.md5file(luaFile); + var key = luaFile.Substring(luaFile.IndexOf("Assets/")); + jd[key] = md5; + } + } + + return jd; + } + + /// + /// 创建临时目录 + /// + /// + public static string CreateTmpDir(string dirName) + { + var tmpDir = string.Format(Application.dataPath + "/{0}/", dirName); + if (Directory.Exists(tmpDir)) + { + Directory.Delete(tmpDir, true); + + } + Directory.CreateDirectory(tmpDir); + return tmpDir; + } + + /// + /// 删除目录 + /// + public static void DeleteDir(string targetDir) + { + if (Directory.Exists(targetDir)) + { + Directory.Delete(targetDir, true); + } + AssetDatabase.Refresh(); + } + + + /// + /// 拷贝Lua到目标目录,并做加密处理 + /// + /// 源目录列表 + /// 母包目录 + public static void CopyLuaToBundleDir(List luaFiles, string luabundleDir) + { + foreach (var luaFile in luaFiles) + { + if (luaFile.EndsWith(".meta")) continue; + var luaFileFullPath = Application.dataPath + "/../" + luaFile; + // 由于Build AssetBundle不识别.lua文件,所以拷贝一份到临时目录,统一加上.bytes结尾 + var targetFile = luaFile.Replace("Assets/LuaFramework/Lua", ""); + targetFile = targetFile.Replace("Assets/LuaFramework/ToLua/Lua", ""); + targetFile = luabundleDir + targetFile + ".bytes"; + var targetDir = Path.GetDirectoryName(targetFile); + if (!Directory.Exists(targetDir)) + Directory.CreateDirectory(targetDir); + + // 做下加密 + byte[] bytes = File.ReadAllBytes(luaFileFullPath); + byte[] encryptBytes = AESEncrypt.Encrypt(bytes); + File.WriteAllBytes(targetFile, encryptBytes); + } + AssetDatabase.Refresh(); + } + + + public void BuildLuaUpdateBundle(List luaFileList) + { + + } + + /// + /// 获取当前平台 + /// + public static BuildTarget GetBuildTarget() + { + +#if UNITY_STANDALONE + return BuildTarget.StandaloneWindows; +#elif UNITY_ANDROID + return BuildTarget.Android; +#else + return BuildTarget.iOS; +#endif + } + + /// + /// 获取目标平台APP后缀 + /// + /// + public static string GetTargetPlatfromAppPostfix(bool useAAB = false) + { + +#if UNITY_STANDALONE + return ".exe"; +#elif UNITY_ANDROID + if(useAAB) + { + return ".aab"; + } + else + { + return ".apk"; + } +#else + return ".ipa"; +#endif + } + + public static string BIN_PATH + { + get { return Application.dataPath + "/../Bin/"; } + } +} diff --git a/Assets/Editor/Build/BuildUtils.cs.meta b/Assets/Editor/Build/BuildUtils.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..4b98c4e8c2a87b4510d633ce81b75e9cbea6b2a2 --- /dev/null +++ b/Assets/Editor/Build/BuildUtils.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1f8f12a57955dba4988e152c8e3f7246 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Build/VersionGUI.cs b/Assets/Editor/Build/VersionGUI.cs new file mode 100644 index 0000000000000000000000000000000000000000..fd0b34c5eb3455284eef261e73dff8ed67f6462b --- /dev/null +++ b/Assets/Editor/Build/VersionGUI.cs @@ -0,0 +1,37 @@ +using UnityEngine; +using UnityEditor; +using LitJson; +using System.IO; + +public class VersionGUI +{ + public void Awake() + { + VersionMgr.instance.Init(); + m_appVersion = VersionMgr.instance.appVersion; + } + + public void DrawVersion() + { + GUILayout.BeginHorizontal(); + m_appVersion = EditorGUILayout.TextField("version", m_appVersion); + JsonData jd = new JsonData(); + jd["app_version"] = m_appVersion; + jd["res_version"] = m_appVersion; + if (GUILayout.Button("Save")) + { + using (StreamWriter sw = new StreamWriter(Application.dataPath + "/Resources/version.bytes")) + { + sw.Write(jd.ToJson()); + } + AssetDatabase.Refresh(); + Debug.Log("Save Version OK: " + m_appVersion); + VersionMgr.instance.DeleteCacheResVersion(); + VersionMgr.instance.Init(); + } + GUILayout.EndHorizontal(); + } + + + private string m_appVersion; +} diff --git a/Assets/Editor/Build/VersionGUI.cs.meta b/Assets/Editor/Build/VersionGUI.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..6847c1f29b1e1ecd88ebeaddc4997afbae6130d9 --- /dev/null +++ b/Assets/Editor/Build/VersionGUI.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 09417d263b36c404dacbf8da14d68a1a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/PrefabObjBinder.meta b/Assets/Editor/PrefabObjBinder.meta new file mode 100644 index 0000000000000000000000000000000000000000..2dced63a2adf9ca9872084ee16c54c5c39017191 --- /dev/null +++ b/Assets/Editor/PrefabObjBinder.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4713dc4a92bf750408ff085522a4fe1f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/PrefabObjBinder/PrefabObjBinderEditor.cs b/Assets/Editor/PrefabObjBinder/PrefabObjBinderEditor.cs new file mode 100644 index 0000000000000000000000000000000000000000..7ff1a686ddc024a2c172e5a4f37e2c3c9eae15ff --- /dev/null +++ b/Assets/Editor/PrefabObjBinder/PrefabObjBinderEditor.cs @@ -0,0 +1,402 @@ +// PrefabObjBinder编辑器 + +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; +using System.Linq; + +public class PrefabObjBinderEditor : EditorWindow +{ + private GameObject m_prefabObjBinderObj; + private PrefabObjBinder m_binder; + private List m_itemList; + private List m_searchMatchItemList = new List(); + private Vector2 m_scrollViewPos; + private List m_comList = new List(); + private string m_itemName; + + + + private string m_itemNameSearch; + private string m_selectedItemName; + private string m_lockBtnName; + private Object m_itemObj; + private bool m_lock; + private string m_componentStr; + enum ItemOption + { + AddItem, + RemoveItem, + ClearItems, + SearchItems + } + + private GUIStyle m_labelSytleYellow; + private GUIStyle m_labelStyleNormal; + + + public static void ShowWindow() + { + var window = GetWindow(); + window.titleContent = new GUIContent("预设对象绑定", AssetPreview.GetMiniTypeThumbnail(typeof(UnityEngine.EventSystems.EventSystem)), "decent"); + window.Init(); + } + + [MenuItem("GameObject/PrefabObjBinder Window", priority = 0)] + public static void PrefabObjBinderWindow() + { + if (Selection.activeGameObject.GetComponent()) + ShowWindow(); + else + Debug.LogError("no PrefabObjBinder on this GameObject"); + } + + void Awake() + { + m_labelStyleNormal = new GUIStyle(EditorStyles.miniButton); + m_labelStyleNormal.fontSize = 12; + m_labelStyleNormal.normal.textColor = Color.white; + + m_labelSytleYellow = new GUIStyle(EditorStyles.miniButton); + m_labelSytleYellow.fontSize = 12; + m_labelSytleYellow.normal.textColor = Color.yellow; + + } + + void OnEnable() + { + EditorApplication.update += Repaint; + } + + void OnDisable() + { + EditorApplication.update -= Repaint; + } + + void Init() + { + m_itemList = new List(); + m_comList = new List(); + m_lockBtnName = "锁定item组件列表"; + m_componentStr = string.Empty; + m_lock = false; + if (Selection.activeGameObject.GetComponent()) + { + m_prefabObjBinderObj = Selection.activeGameObject; + OnRefreshBtnClicked(); + } + } + + void OnGUI() + { + BeginBox(new Rect(0, 0, 3 * Screen.width / 10f, Screen.height)); + DrawSearchBtn(); + DrawSearchItemList(); + EndBox(); + + BeginBox(new Rect(3 * Screen.width / 10f, 0, 3 * Screen.width / 10f, Screen.height)); + DrawLockBtn(); + GUILayout.Space(2); + DrawComponentList(); + EndBox(); + + BeginBox(new Rect(6 * Screen.width / 10f, 0, 4 * Screen.width / 10f, Screen.height)); + DrawPrefabObjBinderField(); + GUILayout.Space(2); + DrawItemField(); + EndBox(); + } + + private void DrawSearchBtn() + { + GUILayout.BeginHorizontal(); + string before = m_itemNameSearch; + string after = EditorGUILayout.TextField("", before, "SearchTextField"); + if (before != after) m_itemNameSearch = after; + + if (GUILayout.Button("", "SearchCancelButton")) + { + m_itemNameSearch = ""; + GUIUtility.keyboardControl = 0; + } + ComponentOperation(m_binder, ItemOption.SearchItems, after); + GUILayout.EndHorizontal(); + } + + private void DrawPrefabObjBinderField() + { + EditorGUILayout.BeginHorizontal(EditorStyles.toolbar); + GUILayout.Label("prefab"); + var oldObj = m_prefabObjBinderObj; + m_prefabObjBinderObj = EditorGUILayout.ObjectField(m_prefabObjBinderObj, typeof(GameObject), true) as GameObject; + + + EditorGUILayout.EndHorizontal(); + if (!m_prefabObjBinderObj) + { + EditorGUILayout.HelpBox("Select a PrefabObjBinder Object", MessageType.Warning); + } + else if (oldObj != m_prefabObjBinderObj) + { + m_binder = m_prefabObjBinderObj.GetComponent(); + } + } + + private void BeginBox(Rect rect) + { + rect.height -= 20; + GUILayout.BeginArea(rect); + GUILayout.Box("", GUILayout.Width(rect.width), GUILayout.Height(rect.height)); + GUILayout.EndArea(); + GUILayout.BeginArea(rect); + } + + private void EndBox() + { + GUILayout.EndArea(); + } + + private void DrawSearchItemList() + { + if (null == m_prefabObjBinderObj || null == m_binder) + m_searchMatchItemList.Clear(); + m_scrollViewPos = EditorGUILayout.BeginScrollView(m_scrollViewPos); + foreach (var item in m_searchMatchItemList) + { + GUILayout.BeginHorizontal(); + item.name = EditorGUILayout.TextField(item.name); + item.obj = EditorGUILayout.ObjectField(item.obj, typeof(GameObject), true); + if (GUILayout.Button("-", GUILayout.Width(20))) + { + m_itemList.Remove(item); + m_binder.items = m_itemList.ToArray(); + GUILayout.EndHorizontal(); + break; + } + GUILayout.EndHorizontal(); + } + EditorGUILayout.EndScrollView(); + } + + private void DrawItemField() + { + EditorGUILayout.BeginVertical(); + + GUILayout.Label(string.IsNullOrEmpty(m_componentStr) ? "null" : m_componentStr); + m_itemName = EditorGUILayout.TextField(m_itemName); + if (GUILayout.Button(new GUIContent("Add Item", "添加item"), GUILayout.Height(80))) + { + ComponentOperation(m_binder, ItemOption.AddItem); + } + if (GUILayout.Button(new GUIContent("Delete Item", "删除指定的item"))) + { + if (m_prefabObjBinderObj != null) + { + if (string.IsNullOrEmpty(m_itemName)) + Debug.LogWarning("请输入要删除的项目名称"); + else + ComponentOperation(m_binder, ItemOption.RemoveItem); + } + } + if (GUILayout.Button(new GUIContent("Refresh", "刷新"))) + { + OnRefreshBtnClicked(); + } + ItemTip(); + } + + private void OnRefreshBtnClicked() + { + if (null != m_prefabObjBinderObj) + m_binder = m_prefabObjBinderObj.GetComponent(); + if (null == m_binder) + { + m_itemList.Clear(); + m_comList.Clear(); + } + } + + private void DrawLockBtn() + { + if (GUILayout.Button(new GUIContent(m_lockBtnName, m_lockBtnName), EditorStyles.toolbarButton)) + { + m_lock = !m_lock; + if (m_lock == false) + m_lockBtnName = "锁定item组件列表"; + else + m_lockBtnName = "解锁item组件列表"; + } + } + + private void DrawComponentList() + { + var go = Selection.activeObject as GameObject; //获取选中对象 + if (go && m_lock == false) + { + Component[] components = go.GetComponents(); + m_comList.Clear(); + m_comList.AddRange(components); + m_selectedItemName = go.name; + } + + if (go == null) + { + m_comList.Clear(); + m_selectedItemName = "无选中对象"; + } + + if (go && GUILayout.Button("GameObject", "GameObject" == m_componentStr ? m_labelSytleYellow : m_labelStyleNormal)) + { + m_itemObj = go; + m_componentStr = "GameObject"; + } + + foreach (var com in m_comList) + { + + GUILayout.Space(2); + var comType = com.GetType().ToString(); + comType = comType.Replace("UnityEngine.UI.", ""); + comType = comType.Replace("UnityEngine.", ""); + if (GUILayout.Button(comType, comType == m_componentStr ? m_labelSytleYellow : m_labelStyleNormal)) + { + m_itemObj = com; + m_componentStr = comType; + } + } + + EditorGUILayout.EndVertical(); + } + + #region private method + private void ComponentOperation(PrefabObjBinder binder, ItemOption option, string name = " ") + { + if (null == binder) return; + PrefabObjBinder.Item item = new PrefabObjBinder.Item(); + switch (option) + { + case ItemOption.AddItem: + AddItem(item, binder); + break; + + case ItemOption.RemoveItem: + RemoveItem(item, binder); + break; + + case ItemOption.ClearItems: + ClearItem(item, binder); + break; + + case ItemOption.SearchItems: + SearchItem(item, binder, name); + break; + } + binder.items = m_itemList.ToArray(); + // 这样enabled一下,才能触发预设的Override + binder.enabled = false; + binder.enabled = true; + } + + private void AddItem(PrefabObjBinder.Item item, PrefabObjBinder binder) + { + item.name = m_itemName; + item.obj = m_itemObj; + m_itemList = binder.items.ToList(); + List nameList = new List(); + foreach (var obj in m_itemList) + { + nameList.Add(obj.name); + } + if (!string.IsNullOrEmpty(m_itemName) && m_itemObj != null) + { + if (nameList.Contains(m_itemName)) + { + Debug.LogError("重复元素"); + m_itemList.Add(item); + } + else + m_itemList.Add(item); + } + + } + + private void RemoveItem(PrefabObjBinder.Item item, PrefabObjBinder Ps) + { + item.name = m_itemName; + + m_itemList = Ps.items.ToList(); + for (int i = 0; i < m_itemList.Count; i++) + { + if (m_itemList[i].name.ToLower() == item.name.ToLower()) + { + m_itemList.Remove(m_itemList[i]); + break; + } + } + } + + private void ClearItem(PrefabObjBinder.Item item, PrefabObjBinder Ps) + { + item.name = m_itemName; + item.obj = m_itemObj; + m_itemList = Ps.items.ToList(); + + for (int i = 0; i < m_itemList.Count; i++) + { + if (m_itemList[i].obj == null || string.IsNullOrEmpty(m_itemList[i].name)) + { + m_itemList.Remove(m_itemList[i]); + } + } + } + + private void SearchItem(PrefabObjBinder.Item item, PrefabObjBinder binder, string name) + { + m_itemList = binder.items.ToList(); + m_searchMatchItemList.Clear(); + + foreach (var o in m_itemList) + { + if (string.IsNullOrEmpty(name)) + { + m_searchMatchItemList.Add(o); + } + else + { + if (o.name.ToLower().Contains(name.ToLower())) + { + m_searchMatchItemList.Add(o); + } + else if (null != o.obj) + { + var objName = o.obj.name; + if (objName.ToLower().Contains(name.ToLower())) + { + m_searchMatchItemList.Add(o); + } + } + } + } + } + + private void ItemTip() + { + if (string.IsNullOrEmpty(m_itemName) || m_itemObj == null) + { + string msg = string.Empty; + if (m_itemObj == null) + { + msg = "请选择项目组件"; + } + else if (string.IsNullOrEmpty(m_itemName)) + { + msg = "请输入要添加的项的名字"; + } + + EditorGUILayout.HelpBox(msg, MessageType.Warning); + EditorGUILayout.Space(); + } + } + + #endregion +} diff --git a/Assets/Editor/PrefabObjBinder/PrefabObjBinderEditor.cs.meta b/Assets/Editor/PrefabObjBinder/PrefabObjBinderEditor.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..b0a9f5e59abdc019b3b4d913da392bae760d4976 --- /dev/null +++ b/Assets/Editor/PrefabObjBinder/PrefabObjBinderEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 188c0adbe02f53b4ca36382d1757221e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/PrefabObjBinder/PrefabObjBinderInspector.cs b/Assets/Editor/PrefabObjBinder/PrefabObjBinderInspector.cs new file mode 100644 index 0000000000000000000000000000000000000000..bc3f551f580f82729a9fe0ede14b87fd9d4a5ebf --- /dev/null +++ b/Assets/Editor/PrefabObjBinder/PrefabObjBinderInspector.cs @@ -0,0 +1,15 @@ +using UnityEngine; +using UnityEditor; + +[CustomEditor(typeof(PrefabObjBinder), true)] +public class PrefabObjBinderInspector : Editor +{ + public override void OnInspectorGUI() + { + if (GUILayout.Button("Edit")) + { + PrefabObjBinderEditor.ShowWindow(); + } + base.OnInspectorGUI(); + } +} diff --git a/Assets/Editor/PrefabObjBinder/PrefabObjBinderInspector.cs.meta b/Assets/Editor/PrefabObjBinder/PrefabObjBinderInspector.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..572456e34ca111271ceb8f5ea41b813bf954f283 --- /dev/null +++ b/Assets/Editor/PrefabObjBinder/PrefabObjBinderInspector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 89dcc076b9af0bf40a784931eeda48f3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Utils.meta b/Assets/Editor/Utils.meta new file mode 100644 index 0000000000000000000000000000000000000000..10dd2e45548b186993e3000beacee808a66ccbfe --- /dev/null +++ b/Assets/Editor/Utils.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e7a83745da9587f4c8a4b10919d396a4 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Utils/PlayerPrefsTools.cs b/Assets/Editor/Utils/PlayerPrefsTools.cs new file mode 100644 index 0000000000000000000000000000000000000000..85e803b95429616568f01eff2bb10efa58642584 --- /dev/null +++ b/Assets/Editor/Utils/PlayerPrefsTools.cs @@ -0,0 +1,11 @@ +using UnityEngine; +using UnityEditor; + +public class PlayerPrefsTools +{ + [MenuItem("Tools/ClearCache")] + private static void ClearCache() + { + PlayerPrefs.DeleteAll(); + } +} diff --git a/Assets/Editor/Utils/PlayerPrefsTools.cs.meta b/Assets/Editor/Utils/PlayerPrefsTools.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..389ad3cc239e475f3c1d1095fe3e1e56c4c03e54 --- /dev/null +++ b/Assets/Editor/Utils/PlayerPrefsTools.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1413a3893acfe154fab3c1deb519bc9e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameRes.meta b/Assets/GameRes.meta new file mode 100644 index 0000000000000000000000000000000000000000..7841ceb0df36ff33fcf2ca29087498aed1e91471 --- /dev/null +++ b/Assets/GameRes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5f90414665418a340a4989266e67fb8d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameRes/BaseRes.meta b/Assets/GameRes/BaseRes.meta new file mode 100644 index 0000000000000000000000000000000000000000..88f269684db386af765eab79fe4cc3241b03bd97 --- /dev/null +++ b/Assets/GameRes/BaseRes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b121129f3c49c74438d3500e29ed5356 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameRes/BaseRes/UpdatePanel.prefab b/Assets/GameRes/BaseRes/UpdatePanel.prefab new file mode 100644 index 0000000000000000000000000000000000000000..8c23f8bbe8622a8022125fcbe3159ef6082b828f --- /dev/null +++ b/Assets/GameRes/BaseRes/UpdatePanel.prefab @@ -0,0 +1,2611 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &127435075127273411 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2627341221724831286} + - component: {fileID: 7253754363627289728} + - component: {fileID: 8508752690110791175} + - component: {fileID: 4012872279981242841} + - component: {fileID: 489411644151117908} + m_Layer: 5 + m_Name: content + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2627341221724831286 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 127435075127273411} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1.0000796, y: 1.0000796, z: 1.0000796} + m_Children: [] + m_Father: {fileID: 8169216279055291532} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 13.38} + m_SizeDelta: {x: 368, y: 35} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7253754363627289728 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 127435075127273411} + m_CullTransparentMesh: 1 +--- !u!114 &8508752690110791175 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 127435075127273411} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 28 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 2 + m_MaxSize: 53 + m_Alignment: 1 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u7F51\u7EDC\u5F02\u5E38\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u5E76\u91CD\u8BD5\uFF01" +--- !u!114 &4012872279981242841 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 127435075127273411} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalFit: 0 + m_VerticalFit: 2 +--- !u!114 &489411644151117908 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 127435075127273411} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalFit: 2 + m_VerticalFit: 2 +--- !u!1 &442167480898221417 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2667069267545874327} + - component: {fileID: 3097035349420066998} + - component: {fileID: 7824122740210349647} + m_Layer: 5 + m_Name: Fill + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2667069267545874327 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 442167480898221417} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4780904662823820692} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0.00000667572, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3097035349420066998 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 442167480898221417} + m_CullTransparentMesh: 1 +--- !u!114 &7824122740210349647 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 442167480898221417} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 0.70874226, b: 0.0141509175, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 39f15389aac6ab54fb0a0e64186596e9, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &530454541621996996 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2888024044834113930} + - component: {fileID: 6650888374038955260} + - component: {fileID: 8490483061770065397} + - component: {fileID: 985744687251361087} + m_Layer: 5 + m_Name: tips + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2888024044834113930 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 530454541621996996} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1716764499801592875} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: -67.25} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &6650888374038955260 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 530454541621996996} + m_CullTransparentMesh: 1 +--- !u!114 &8490483061770065397 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 530454541621996996} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 23 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 71 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Hello World +--- !u!114 &985744687251361087 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 530454541621996996} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalFit: 2 + m_VerticalFit: 2 +--- !u!1 &587295928839930100 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5986109436448821169} + - component: {fileID: 2975939592394248887} + - component: {fileID: 112036617332361202} + - component: {fileID: 8440994183198208197} + m_Layer: 5 + m_Name: author + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5986109436448821169 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 587295928839930100} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1.0000794, y: 1.0000794, z: 1.0000794} + m_Children: [] + m_Father: {fileID: 2883265401639076555} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0} + m_AnchorMax: {x: 0.5, y: 0} + m_AnchoredPosition: {x: 0, y: 23} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2975939592394248887 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 587295928839930100} + m_CullTransparentMesh: 1 +--- !u!114 &112036617332361202 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 587295928839930100} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 23 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 71 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u4F5C\u8005\uFF1A\u6797\u65B0\u53D1 \u535A\u5BA2\uFF1Ahttps://blog.csdn.net/linxinfa" +--- !u!114 &8440994183198208197 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 587295928839930100} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalFit: 2 + m_VerticalFit: 2 +--- !u!1 &607289192997231978 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1751088740464591024} + - component: {fileID: 7867683140212884259} + - component: {fileID: 7632158359244948378} + m_Layer: 5 + m_Name: Image (2) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1751088740464591024 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 607289192997231978} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1819744553754617726} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -44.53912} + m_SizeDelta: {x: 0, y: 43.2} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7867683140212884259 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 607289192997231978} + m_CullTransparentMesh: 1 +--- !u!114 &7632158359244948378 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 607289192997231978} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.74509805, g: 0.24705884, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &683416541903017529 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4164981497408244410} + - component: {fileID: 1109930678617156441} + m_Layer: 5 + m_Name: progressSlider + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4164981497408244410 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 683416541903017529} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 6694990506087024835} + - {fileID: 4780904662823820692} + - {fileID: 6010102870092386779} + - {fileID: 3615507629944270230} + m_Father: {fileID: 2883265401639076555} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0} + m_AnchorMax: {x: 0.5, y: 0} + m_AnchoredPosition: {x: 0, y: 87.20001} + m_SizeDelta: {x: 1061.6, y: 175.4} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1109930678617156441 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 683416541903017529} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 67db9e8f0e2ae9c40bc1e2b64352a6b4, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 0 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 0} + m_FillRect: {fileID: 2667069267545874327} + m_HandleRect: {fileID: 0} + m_Direction: 0 + m_MinValue: 0 + m_MaxValue: 1 + m_WholeNumbers: 0 + m_Value: 0.384 + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] +--- !u!1 &932681124464195780 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2029854573825283857} + - component: {fileID: 8222306377897371337} + - component: {fileID: 1009658154754080304} + m_Layer: 5 + m_Name: fullAppUpdateTips + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &2029854573825283857 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 932681124464195780} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 8671828006783231077} + m_Father: {fileID: 2883265401639076555} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &8222306377897371337 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 932681124464195780} + m_CullTransparentMesh: 1 +--- !u!114 &1009658154754080304 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 932681124464195780} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 0.5529412} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &1062468973286386833 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6694990506087024835} + - component: {fileID: 3604029299365877816} + - component: {fileID: 1414183642236815904} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6694990506087024835 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1062468973286386833} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4164981497408244410} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.25} + m_AnchorMax: {x: 1, y: 0.75} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3604029299365877816 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1062468973286386833} + m_CullTransparentMesh: 1 +--- !u!114 &1414183642236815904 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1062468973286386833} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 39f15389aac6ab54fb0a0e64186596e9, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &1836586877511410683 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8936710469800839449} + - component: {fileID: 3138236053593560673} + - component: {fileID: 1983570420503620129} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8936710469800839449 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1836586877511410683} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 9103090012770035748} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3138236053593560673 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1836586877511410683} + m_CullTransparentMesh: 1 +--- !u!114 &1983570420503620129 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1836586877511410683} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 33 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u91CD\u8BD5" +--- !u!1 &2299947774556282151 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 866725152063363637} + - component: {fileID: 4718661078060968338} + - component: {fileID: 5202994117773195028} + m_Layer: 5 + m_Name: Image (2) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &866725152063363637 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2299947774556282151} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 3407051580043351950} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -44.53912} + m_SizeDelta: {x: 0, y: 43.2} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4718661078060968338 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2299947774556282151} + m_CullTransparentMesh: 1 +--- !u!114 &5202994117773195028 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2299947774556282151} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.74509805, g: 0.24705884, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &2347518203672079614 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4252370615150106047} + - component: {fileID: 7006132298705718321} + - component: {fileID: 124222419015010052} + - component: {fileID: 8199802065090972100} + - component: {fileID: 7902800257378514912} + m_Layer: 5 + m_Name: content + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4252370615150106047 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2347518203672079614} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1.0000796, y: 1.0000796, z: 1.0000796} + m_Children: [] + m_Father: {fileID: 8671828006783231077} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 13.38} + m_SizeDelta: {x: 550, y: 35} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7006132298705718321 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2347518203672079614} + m_CullTransparentMesh: 1 +--- !u!114 &124222419015010052 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2347518203672079614} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 28 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 2 + m_MaxSize: 53 + m_Alignment: 1 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u68C0\u6D4B\u5230\u6709\u65B0\u7248\u672C\u66F4\u65B0\uFF0C\u662F\u5426\u524D\u5F80\u5E94\u7528\u5546\u5E97\u66F4\u65B0\uFF1F" +--- !u!114 &8199802065090972100 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2347518203672079614} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalFit: 0 + m_VerticalFit: 2 +--- !u!114 &7902800257378514912 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2347518203672079614} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalFit: 2 + m_VerticalFit: 2 +--- !u!1 &2631320718007617591 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8671828006783231077} + - component: {fileID: 9203485457062305650} + - component: {fileID: 8063120235863957175} + m_Layer: 5 + m_Name: bg + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8671828006783231077 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2631320718007617591} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1.0000796, y: 1.0000796, z: 1.0000796} + m_Children: + - {fileID: 1819744553754617726} + - {fileID: 4252370615150106047} + - {fileID: 5603049670005776493} + m_Father: {fileID: 2029854573825283857} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0.00054931635, y: -0.00045776358} + m_SizeDelta: {x: 679, y: 419} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9203485457062305650 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2631320718007617591} + m_CullTransparentMesh: 1 +--- !u!114 &8063120235863957175 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2631320718007617591} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: e6fc4d1a32513d64b987ea15d99cf3c9, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &2883265401639076552 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2883265401639076555} + - component: {fileID: 2883265401639076565} + - component: {fileID: 2883265401639076554} + - component: {fileID: 8202434717936827745} + m_Layer: 5 + m_Name: UpdatePanel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2883265401639076555 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2883265401639076552} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 4164981497408244410} + - {fileID: 1716764499801592875} + - {fileID: 5986109436448821169} + - {fileID: 3310088565328579368} + - {fileID: 2029854573825283857} + - {fileID: 1709403321775621723} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2883265401639076565 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2883265401639076552} + m_CullTransparentMesh: 1 +--- !u!114 &2883265401639076554 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2883265401639076552} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.745283, g: 0.24579607, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &8202434717936827745 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2883265401639076552} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f8e912e7ed686944bbbe9f5fd3960bdd, type: 3} + m_Name: + m_EditorClassIdentifier: + items: + - name: versionText + obj: {fileID: 8016622583982109263} + - name: tipsText + obj: {fileID: 7854890760246824629} + - name: progressSlider + obj: {fileID: 1109930678617156441} + - name: progressText + obj: {fileID: 7621721841642073425} + - name: appUpdateDlg + obj: {fileID: 932681124464195780} + - name: nextBtn + obj: {fileID: 3164510927767220596} + - name: updateBtn + obj: {fileID: 5660222156036244130} + - name: errorTipsDlg + obj: {fileID: 7429614225177424108} + - name: retryBtn + obj: {fileID: 3905577153133672284} + - name: errorText + obj: {fileID: 8508752690110791175} +--- !u!1 &3252220821508674583 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9103090012770035748} + - component: {fileID: 6170519042134275887} + - component: {fileID: 1863635890625543328} + - component: {fileID: 3905577153133672284} + m_Layer: 5 + m_Name: retryButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9103090012770035748 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3252220821508674583} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 8936710469800839449} + m_Father: {fileID: 8169216279055291532} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0} + m_AnchorMax: {x: 0.5, y: 0} + m_AnchoredPosition: {x: 0, y: 54} + m_SizeDelta: {x: 175.8, y: 66.66} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &6170519042134275887 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3252220821508674583} + m_CullTransparentMesh: 1 +--- !u!114 &1863635890625543328 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3252220821508674583} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.74509805, g: 0.24705884, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 679881943af014a4eaa06972bd740f32, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &3905577153133672284 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3252220821508674583} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1863635890625543328} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!1 &3528231101006265594 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5452845884945931745} + - component: {fileID: 2705695533692679911} + - component: {fileID: 912986058259980186} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5452845884945931745 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3528231101006265594} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 787386967026789516} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2705695533692679911 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3528231101006265594} + m_CullTransparentMesh: 1 +--- !u!114 &912986058259980186 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3528231101006265594} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 33 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u4E0B\u6B21" +--- !u!1 &3529780550805581241 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5603049670005776493} + - component: {fileID: 4997623181519685241} + m_Layer: 5 + m_Name: btns + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5603049670005776493 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3529780550805581241} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.9999204, y: 0.9999204, z: 0.9999204} + m_Children: + - {fileID: 787386967026789516} + - {fileID: 5028025846130418035} + m_Father: {fileID: 8671828006783231077} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0} + m_AnchorMax: {x: 0.5, y: 0} + m_AnchoredPosition: {x: 0, y: 54} + m_SizeDelta: {x: 465, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &4997623181519685241 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3529780550805581241} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_ChildAlignment: 4 + m_Spacing: 0 + m_ChildForceExpandWidth: 1 + m_ChildForceExpandHeight: 1 + m_ChildControlWidth: 0 + m_ChildControlHeight: 0 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 + m_ReverseArrangement: 0 +--- !u!1 &4019105670598456918 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3310088565328579368} + - component: {fileID: 3882149800180486016} + - component: {fileID: 8016622583982109263} + - component: {fileID: 2063010084188402726} + m_Layer: 5 + m_Name: version + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3310088565328579368 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4019105670598456918} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1.0000794, y: 1.0000794, z: 1.0000794} + m_Children: [] + m_Father: {fileID: 2883265401639076555} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 23, y: -26} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0.5} +--- !u!222 &3882149800180486016 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4019105670598456918} + m_CullTransparentMesh: 1 +--- !u!114 &8016622583982109263 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4019105670598456918} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 23 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 71 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: app ver 1.0.0.0 res ver 1.0.0.0 +--- !u!114 &2063010084188402726 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4019105670598456918} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalFit: 2 + m_VerticalFit: 2 +--- !u!1 &4074432230769760759 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4780904662823820692} + m_Layer: 5 + m_Name: Fill Area + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4780904662823820692 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4074432230769760759} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2667069267545874327} + m_Father: {fileID: 4164981497408244410} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.25} + m_AnchorMax: {x: 1, y: 0.75} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &4245494055269049833 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 787386967026789516} + - component: {fileID: 3809044554991955400} + - component: {fileID: 1225261535634333055} + - component: {fileID: 3164510927767220596} + m_Layer: 5 + m_Name: nextButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &787386967026789516 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4245494055269049833} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1.0000795, y: 1.0000795, z: 1.0000795} + m_Children: + - {fileID: 5452845884945931745} + m_Father: {fileID: 5603049670005776493} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 116.25, y: -50} + m_SizeDelta: {x: 175.8, y: 66.66} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3809044554991955400 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4245494055269049833} + m_CullTransparentMesh: 1 +--- !u!114 &1225261535634333055 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4245494055269049833} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0.6423669, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 679881943af014a4eaa06972bd740f32, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &3164510927767220596 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4245494055269049833} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1225261535634333055} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!1 &5364605390413085500 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8169216279055291532} + - component: {fileID: 4288389935732312571} + - component: {fileID: 9178509353108500340} + m_Layer: 5 + m_Name: bg + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8169216279055291532 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5364605390413085500} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1.0000796, y: 1.0000796, z: 1.0000796} + m_Children: + - {fileID: 3407051580043351950} + - {fileID: 2627341221724831286} + - {fileID: 9103090012770035748} + m_Father: {fileID: 1709403321775621723} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0.00054931635, y: -0.00045776358} + m_SizeDelta: {x: 679, y: 419} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4288389935732312571 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5364605390413085500} + m_CullTransparentMesh: 1 +--- !u!114 &9178509353108500340 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5364605390413085500} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: e6fc4d1a32513d64b987ea15d99cf3c9, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &5795091590449265964 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3944464905748731568} + - component: {fileID: 5914153372931371483} + - component: {fileID: 2794643343321482095} + m_Layer: 5 + m_Name: title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3944464905748731568 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5795091590449265964} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1819744553754617726} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 0, y: 0.5} + m_AnchoredPosition: {x: 23.130005, y: -12.55} + m_SizeDelta: {x: 160, y: 56.8} + m_Pivot: {x: 0, y: 0.5} +--- !u!222 &5914153372931371483 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5795091590449265964} + m_CullTransparentMesh: 1 +--- !u!114 &2794643343321482095 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5795091590449265964} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 36 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 53 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u6574\u5305\u66F4\u65B0" +--- !u!1 &6254145535702421450 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5028025846130418035} + - component: {fileID: 2293328003062683780} + - component: {fileID: 7830873033669636311} + - component: {fileID: 5660222156036244130} + m_Layer: 5 + m_Name: updateButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5028025846130418035 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6254145535702421450} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1.0000795, y: 1.0000795, z: 1.0000795} + m_Children: + - {fileID: 3746525588892746467} + m_Father: {fileID: 5603049670005776493} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 348.75, y: -50} + m_SizeDelta: {x: 175.8, y: 66.66} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2293328003062683780 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6254145535702421450} + m_CullTransparentMesh: 1 +--- !u!114 &7830873033669636311 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6254145535702421450} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.74509805, g: 0.24705884, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 679881943af014a4eaa06972bd740f32, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &5660222156036244130 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6254145535702421450} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 7830873033669636311} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!1 &6331276468584078838 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3407051580043351950} + - component: {fileID: 7618609642495347766} + - component: {fileID: 2473250408966202695} + m_Layer: 5 + m_Name: bar + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3407051580043351950 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6331276468584078838} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 866725152063363637} + - {fileID: 2770251618636907302} + m_Father: {fileID: 8169216279055291532} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 1} + m_AnchorMax: {x: 0.5, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 679, y: 43.2} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7618609642495347766 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6331276468584078838} + m_CullTransparentMesh: 1 +--- !u!114 &2473250408966202695 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6331276468584078838} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.74509805, g: 0.24705884, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: e6fc4d1a32513d64b987ea15d99cf3c9, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &6502320149199365345 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3746525588892746467} + - component: {fileID: 7985181244602413727} + - component: {fileID: 2176658581930432589} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3746525588892746467 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6502320149199365345} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 5028025846130418035} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7985181244602413727 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6502320149199365345} + m_CullTransparentMesh: 1 +--- !u!114 &2176658581930432589 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6502320149199365345} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 33 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u66F4\u65B0" +--- !u!1 &6574086598962614810 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1716764499801592875} + - component: {fileID: 8670994818295824522} + - component: {fileID: 2844783003394909785} + - component: {fileID: 7535460351895947787} + m_Layer: 5 + m_Name: titleText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1716764499801592875 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6574086598962614810} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1.0000798, y: 1.0000798, z: 1.0000798} + m_Children: + - {fileID: 2888024044834113930} + m_Father: {fileID: 2883265401639076555} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 203.29999} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &8670994818295824522 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6574086598962614810} + m_CullTransparentMesh: 1 +--- !u!114 &2844783003394909785 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6574086598962614810} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 70 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 6 + m_MaxSize: 71 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u7A0B\u5E8F\u5458\u70E7\u997C\u5E97" +--- !u!114 &7535460351895947787 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6574086598962614810} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalFit: 2 + m_VerticalFit: 2 +--- !u!1 &6684987069024435204 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6010102870092386779} + - component: {fileID: 6457259907469916999} + - component: {fileID: 7854890760246824629} + - component: {fileID: 3854225803657721753} + m_Layer: 5 + m_Name: tipsText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6010102870092386779 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6684987069024435204} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1.0000795, y: 1.0000795, z: 1.0000795} + m_Children: [] + m_Father: {fileID: 4164981497408244410} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 46.7} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &6457259907469916999 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6684987069024435204} + m_CullTransparentMesh: 1 +--- !u!114 &7854890760246824629 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6684987069024435204} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 23 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 71 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u6B63\u5728\u52AA\u529B\u52A0\u8F7D\uFF0C\u8BF7\u7A0D\u5019..." +--- !u!114 &3854225803657721753 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6684987069024435204} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalFit: 2 + m_VerticalFit: 2 +--- !u!1 &7429614225177424108 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1709403321775621723} + - component: {fileID: 1242752079884419701} + - component: {fileID: 8552081735826187351} + m_Layer: 5 + m_Name: errorTips + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &1709403321775621723 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7429614225177424108} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 8169216279055291532} + m_Father: {fileID: 2883265401639076555} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1242752079884419701 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7429614225177424108} + m_CullTransparentMesh: 1 +--- !u!114 &8552081735826187351 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7429614225177424108} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 0.5529412} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &7649767768535706361 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1819744553754617726} + - component: {fileID: 2129293152226525181} + - component: {fileID: 4085340932897787537} + m_Layer: 5 + m_Name: bar + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1819744553754617726 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7649767768535706361} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1751088740464591024} + - {fileID: 3944464905748731568} + m_Father: {fileID: 8671828006783231077} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 1} + m_AnchorMax: {x: 0.5, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 679, y: 43.2} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2129293152226525181 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7649767768535706361} + m_CullTransparentMesh: 1 +--- !u!114 &4085340932897787537 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7649767768535706361} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.74509805, g: 0.24705884, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: e6fc4d1a32513d64b987ea15d99cf3c9, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &7762145103788183454 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3615507629944270230} + - component: {fileID: 3743130734703252877} + - component: {fileID: 7621721841642073425} + - component: {fileID: 186444646610564681} + m_Layer: 5 + m_Name: progressText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3615507629944270230 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7762145103788183454} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1.0000795, y: 1.0000795, z: 1.0000795} + m_Children: [] + m_Father: {fileID: 4164981497408244410} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 510.5014, y: 46.7} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 1, y: 0.5} +--- !u!222 &3743130734703252877 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7762145103788183454} + m_CullTransparentMesh: 1 +--- !u!114 &7621721841642073425 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7762145103788183454} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 26 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 2 + m_MaxSize: 166 + m_Alignment: 5 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: 0% +--- !u!114 &186444646610564681 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7762145103788183454} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalFit: 2 + m_VerticalFit: 2 +--- !u!1 &9215943823460679619 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2770251618636907302} + - component: {fileID: 2349740355078548880} + - component: {fileID: 7190820689321084669} + m_Layer: 5 + m_Name: title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2770251618636907302 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9215943823460679619} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 3407051580043351950} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 0, y: 0.5} + m_AnchoredPosition: {x: 23.130005, y: -12.55} + m_SizeDelta: {x: 160, y: 56.8} + m_Pivot: {x: 0, y: 0.5} +--- !u!222 &2349740355078548880 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9215943823460679619} + m_CullTransparentMesh: 1 +--- !u!114 &7190820689321084669 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9215943823460679619} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 36 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 53 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u63D0\u793A" diff --git a/Assets/GameRes/BaseRes/UpdatePanel.prefab.meta b/Assets/GameRes/BaseRes/UpdatePanel.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..5e482d608e20f3c1e7cf8f7fb34ba123243c6219 --- /dev/null +++ b/Assets/GameRes/BaseRes/UpdatePanel.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: dc7f7f0b14777ec4f87cbb5a40d644a7 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameRes/Config.meta b/Assets/GameRes/Config.meta new file mode 100644 index 0000000000000000000000000000000000000000..34bd38ec8a55383be23ae1e534a99f78f4b9bc9b --- /dev/null +++ b/Assets/GameRes/Config.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4cf7bc58f25ad4d45984a7e39a57e3c0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameRes/Config/resources.bytes b/Assets/GameRes/Config/resources.bytes new file mode 100644 index 0000000000000000000000000000000000000000..76ee6fec7ba3a223f910f9b8e27102fb569d087c --- /dev/null +++ b/Assets/GameRes/Config/resources.bytes @@ -0,0 +1,5 @@ +[ + { "id":1, "editor_path":"UIPrefabs/LoginPanel.prefab", "desc":"鐧诲綍鐣岄潰" }, + { "id":2, "editor_path":"UIPrefabs/PlazaPanel.prefab", "desc":"澶у巺鐣岄潰" }, + { "id":3, "editor_path":"UIPrefabs/TipsFly.prefab", "desc":"鎻愮ず璇" } +] \ No newline at end of file diff --git a/Assets/GameRes/Config/resources.bytes.meta b/Assets/GameRes/Config/resources.bytes.meta new file mode 100644 index 0000000000000000000000000000000000000000..45cbdce1c4dd9aea05815967d940f6d558eb0124 --- /dev/null +++ b/Assets/GameRes/Config/resources.bytes.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 905542cec90faf749af8720311a9a36b +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameRes/UIPrefabs.meta b/Assets/GameRes/UIPrefabs.meta new file mode 100644 index 0000000000000000000000000000000000000000..02d6546f12d25b0db586bd25ab689bef68574da6 --- /dev/null +++ b/Assets/GameRes/UIPrefabs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 98ed8ce323a50c8449efa82d29ca7007 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameRes/UIPrefabs/LoginPanel.prefab b/Assets/GameRes/UIPrefabs/LoginPanel.prefab new file mode 100644 index 0000000000000000000000000000000000000000..95e5625208aed436bd6d23819f57a81851478a44 --- /dev/null +++ b/Assets/GameRes/UIPrefabs/LoginPanel.prefab @@ -0,0 +1,2442 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &304448792007435684 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4394404172772904708} + - component: {fileID: 5555854491503418235} + - component: {fileID: 1264345044057686404} + - component: {fileID: 2050436682494325038} + m_Layer: 5 + m_Name: userAgreement + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4394404172772904708 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 304448792007435684} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 5616580799960710479} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 0, y: 0.5} + m_AnchoredPosition: {x: 508, y: 0} + m_SizeDelta: {x: 605.4, y: 57} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &5555854491503418235 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 304448792007435684} + m_CullTransparentMesh: 1 +--- !u!114 &1264345044057686404 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 304448792007435684} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 0.944138, b: 0.45660377, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 26 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 2 + m_MaxSize: 109 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u300A\u7528\u6237\u534F\u8BAE\u300B" +--- !u!114 &2050436682494325038 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 304448792007435684} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1264345044057686404} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!1 &544392423054450240 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9072756696114006862} + - component: {fileID: 3640385999478871753} + - component: {fileID: 5921444249475114331} + m_Layer: 5 + m_Name: Checkmark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9072756696114006862 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 544392423054450240} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 6281018421972270910} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 1.5} + m_SizeDelta: {x: 30, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3640385999478871753 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 544392423054450240} + m_CullTransparentMesh: 1 +--- !u!114 &5921444249475114331 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 544392423054450240} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.74509805, g: 0.24705884, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 309e92e7f2e056c4ab7a518c5b2ed61f, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &1398459033835939378 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5303221867400667644} + - component: {fileID: 153465897397458347} + - component: {fileID: 2645141025251145492} + m_Layer: 5 + m_Name: Checkmark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5303221867400667644 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1398459033835939378} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1618021118814384439} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 1.5} + m_SizeDelta: {x: 30, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &153465897397458347 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1398459033835939378} + m_CullTransparentMesh: 1 +--- !u!114 &2645141025251145492 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1398459033835939378} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.74509805, g: 0.24705884, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 309e92e7f2e056c4ab7a518c5b2ed61f, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &1474452300386131146 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1618021118814384439} + - component: {fileID: 3181472936725407237} + - component: {fileID: 1451468510469449233} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1618021118814384439 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1474452300386131146} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 5303221867400667644} + m_Father: {fileID: 5616580799960710479} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -70, y: 0} + m_SizeDelta: {x: 30, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3181472936725407237 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1474452300386131146} + m_CullTransparentMesh: 1 +--- !u!114 &1451468510469449233 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1474452300386131146} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: e6fc4d1a32513d64b987ea15d99cf3c9, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &1643582832568732929 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6368286363579040881} + - component: {fileID: 7987214882712492481} + - component: {fileID: 8746679834826573286} + - component: {fileID: 7696986135417169942} + m_Layer: 5 + m_Name: pwdInputField + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6368286363579040881 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1643582832568732929} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2143985728555714847} + - {fileID: 1611844438153642544} + - {fileID: 4156704620249284840} + - {fileID: 4417776528625330669} + m_Father: {fileID: 9191204535057342831} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0} + m_AnchorMax: {x: 0.5, y: 0} + m_AnchoredPosition: {x: 11.69, y: 213} + m_SizeDelta: {x: 324.97, y: 57.53} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7987214882712492481 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1643582832568732929} + m_CullTransparentMesh: 1 +--- !u!114 &8746679834826573286 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1643582832568732929} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: e6fc4d1a32513d64b987ea15d99cf3c9, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &7696986135417169942 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1643582832568732929} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d199490a83bb2b844b9695cbf13b01ef, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 8746679834826573286} + m_TextComponent: {fileID: 7052405349452326021} + m_Placeholder: {fileID: 8726349248452005029} + m_ContentType: 7 + m_InputType: 2 + m_AsteriskChar: 42 + m_KeyboardType: 0 + m_LineType: 0 + m_HideMobileInput: 0 + m_CharacterValidation: 0 + m_CharacterLimit: 0 + m_OnEndEdit: + m_PersistentCalls: + m_Calls: [] + m_OnSubmit: + m_PersistentCalls: + m_Calls: [] + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] + m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_CustomCaretColor: 0 + m_SelectionColor: {r: 0.65882355, g: 0.80784315, b: 1, a: 0.7529412} + m_Text: + m_CaretBlinkRate: 0.85 + m_CaretWidth: 1 + m_ReadOnly: 0 + m_ShouldActivateOnSelect: 1 +--- !u!1 &3670125960804425023 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1611844438153642544} + - component: {fileID: 4917345883046778778} + - component: {fileID: 7052405349452326021} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1611844438153642544 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3670125960804425023} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 6368286363579040881} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -0.5} + m_SizeDelta: {x: -20, y: -13} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4917345883046778778 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3670125960804425023} + m_CullTransparentMesh: 1 +--- !u!114 &7052405349452326021 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3670125960804425023} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.74509805, g: 0.24705884, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 30 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 49 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 0 + m_HorizontalOverflow: 1 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: +--- !u!1 &4050868471215105201 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5415487115964929921} + - component: {fileID: 7846182227330605739} + - component: {fileID: 4733698280237844841} + - component: {fileID: 435477248223365456} + m_Layer: 5 + m_Name: registButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5415487115964929921 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4050868471215105201} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 4940810076194065821} + m_Father: {fileID: 9191204535057342831} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0} + m_AnchorMax: {x: 0.5, y: 0} + m_AnchoredPosition: {x: -100, y: 131} + m_SizeDelta: {x: 170.97, y: 56} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7846182227330605739 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4050868471215105201} + m_CullTransparentMesh: 1 +--- !u!114 &4733698280237844841 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4050868471215105201} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 679881943af014a4eaa06972bd740f32, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &435477248223365456 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4050868471215105201} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 4733698280237844841} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!1 &4575148195497778501 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4417776528625330669} + - component: {fileID: 7169136009765341736} + m_Layer: 5 + m_Name: rememberToggle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4417776528625330669 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4575148195497778501} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 6281018421972270910} + - {fileID: 5605667242963105015} + m_Father: {fileID: 6368286363579040881} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 270.90002, y: 0} + m_SizeDelta: {x: 160, y: 60.25} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &7169136009765341736 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4575148195497778501} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 2113404342470733846} + toggleTransition: 1 + graphic: {fileID: 5921444249475114331} + m_Group: {fileID: 0} + onValueChanged: + m_PersistentCalls: + m_Calls: [] + m_IsOn: 1 +--- !u!1 &5343879001847329422 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4940810076194065821} + - component: {fileID: 3905626541756827119} + - component: {fileID: 6366957759728492522} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4940810076194065821 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5343879001847329422} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 5415487115964929921} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3905626541756827119 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5343879001847329422} + m_CullTransparentMesh: 1 +--- !u!114 &6366957759728492522 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5343879001847329422} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.74509805, g: 0.24705884, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 30 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u6CE8\u518C" +--- !u!1 &6723325279655337213 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6281018421972270910} + - component: {fileID: 5823585189833170035} + - component: {fileID: 2113404342470733846} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6281018421972270910 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6723325279655337213} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 9072756696114006862} + m_Father: {fileID: 4417776528625330669} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -70, y: 0} + m_SizeDelta: {x: 30, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &5823585189833170035 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6723325279655337213} + m_CullTransparentMesh: 1 +--- !u!114 &2113404342470733846 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6723325279655337213} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: e6fc4d1a32513d64b987ea15d99cf3c9, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &7639924196840954198 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5616580799960710479} + - component: {fileID: 1190217148552363039} + m_Layer: 5 + m_Name: clauseToggle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5616580799960710479 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7639924196840954198} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1618021118814384439} + - {fileID: 4741027607622732999} + - {fileID: 4394404172772904708} + - {fileID: 8909397760948153694} + m_Father: {fileID: 9191204535057342831} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0} + m_AnchorMax: {x: 0.5, y: 0} + m_AnchoredPosition: {x: -158.3, y: 50.619995} + m_SizeDelta: {x: 160, y: 60.25} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1190217148552363039 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7639924196840954198} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1451468510469449233} + toggleTransition: 1 + graphic: {fileID: 2645141025251145492} + m_Group: {fileID: 0} + onValueChanged: + m_PersistentCalls: + m_Calls: [] + m_IsOn: 0 +--- !u!1 &7844715834223926320 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5605667242963105015} + - component: {fileID: 6170775189771375823} + - component: {fileID: 5792938161442036775} + m_Layer: 5 + m_Name: Label + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5605667242963105015 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7844715834223926320} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4417776528625330669} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 0, y: 0.5} + m_AnchoredPosition: {x: 101.1, y: 0} + m_SizeDelta: {x: 132, y: 57} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &6170775189771375823 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7844715834223926320} + m_CullTransparentMesh: 1 +--- !u!114 &5792938161442036775 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7844715834223926320} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 26 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 2 + m_MaxSize: 109 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u8BB0\u4F4F\u5BC6\u7801" +--- !u!1 &7936027226018267090 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6488107001304388060} + - component: {fileID: 5211674199784156133} + - component: {fileID: 8838053237910997985} + - component: {fileID: 6024389136387562325} + m_Layer: 5 + m_Name: version + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6488107001304388060 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7936027226018267090} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1.0000798, y: 1.0000798, z: 1.0000798} + m_Children: [] + m_Father: {fileID: 9191204535057342831} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 23, y: -26} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0.5} +--- !u!222 &5211674199784156133 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7936027226018267090} + m_CullTransparentMesh: 1 +--- !u!114 &8838053237910997985 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7936027226018267090} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 23 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 71 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: app ver 1.0.0.0 res ver 1.0.0.0 +--- !u!114 &6024389136387562325 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7936027226018267090} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalFit: 2 + m_VerticalFit: 2 +--- !u!1 &8086939358347815339 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2143985728555714847} + - component: {fileID: 1022309757655836177} + - component: {fileID: 8726349248452005029} + m_Layer: 5 + m_Name: Placeholder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2143985728555714847 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8086939358347815339} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 6368286363579040881} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -0.5} + m_SizeDelta: {x: -20, y: -13} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1022309757655836177 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8086939358347815339} + m_CullTransparentMesh: 1 +--- !u!114 &8726349248452005029 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8086939358347815339} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.74509805, g: 0.24705884, b: 0, a: 0.3254902} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 30 + m_FontStyle: 2 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 49 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u8BF7\u8F93\u5165\u5BC6\u7801" +--- !u!1 &8642939003319415997 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8909397760948153694} + - component: {fileID: 5145777784664617197} + - component: {fileID: 7722794372685439990} + - component: {fileID: 8588421252849557857} + m_Layer: 5 + m_Name: privacyPolicy + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8909397760948153694 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8642939003319415997} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 5616580799960710479} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 0, y: 0.5} + m_AnchoredPosition: {x: 652.4, y: 0} + m_SizeDelta: {x: 605.4, y: 57} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &5145777784664617197 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8642939003319415997} + m_CullTransparentMesh: 1 +--- !u!114 &7722794372685439990 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8642939003319415997} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 0.94509804, b: 0.45490196, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 26 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 2 + m_MaxSize: 109 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u300A\u9690\u79C1\u6761\u6B3E\u300B" +--- !u!114 &8588421252849557857 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8642939003319415997} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 7722794372685439990} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!1 &8745206606729472229 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4156704620249284840} + - component: {fileID: 2799634304356699631} + - component: {fileID: 5900263664027926558} + m_Layer: 5 + m_Name: Image + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4156704620249284840 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8745206606729472229} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 6368286363579040881} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -194.16, y: 0} + m_SizeDelta: {x: 48, y: 48} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2799634304356699631 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8745206606729472229} + m_CullTransparentMesh: 1 +--- !u!114 &5900263664027926558 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8745206606729472229} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: ede2bf3c6e8fcd345a1fd494c190f020, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &9043715969945225108 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4741027607622732999} + - component: {fileID: 433390629335851336} + - component: {fileID: 3694745612753364820} + m_Layer: 5 + m_Name: Label + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4741027607622732999 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9043715969945225108} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 5616580799960710479} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 0, y: 0.5} + m_AnchoredPosition: {x: 37, y: 0} + m_SizeDelta: {x: 178.3, y: 57} + m_Pivot: {x: 0, y: 0.5} +--- !u!222 &433390629335851336 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9043715969945225108} + m_CullTransparentMesh: 1 +--- !u!114 &3694745612753364820 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9043715969945225108} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 26 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 2 + m_MaxSize: 109 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u6211\u5DF2\u9605\u8BFB\u5E76\u540C\u610F" +--- !u!1 &9191204533577425191 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9191204533577425192} + - component: {fileID: 9191204533577425194} + - component: {fileID: 9191204533577425193} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9191204533577425192 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204533577425191} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 9191204534090084154} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9191204533577425194 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204533577425191} + m_CullTransparentMesh: 1 +--- !u!114 &9191204533577425193 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204533577425191} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.74509805, g: 0.24705884, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 30 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u767B\u5F55" +--- !u!1 &9191204533604104607 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9191204533604104672} + - component: {fileID: 9191204533604104675} + - component: {fileID: 9191204533604104674} + - component: {fileID: 9191204533604104673} + m_Layer: 5 + m_Name: accountInputField + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9191204533604104672 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204533604104607} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 9191204534739629989} + - {fileID: 9191204534676180932} + - {fileID: 9191204534593688516} + m_Father: {fileID: 9191204535057342831} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0} + m_AnchorMax: {x: 0.5, y: 0} + m_AnchoredPosition: {x: 11.69, y: 287} + m_SizeDelta: {x: 324.97, y: 57.53} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9191204533604104675 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204533604104607} + m_CullTransparentMesh: 1 +--- !u!114 &9191204533604104674 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204533604104607} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: e6fc4d1a32513d64b987ea15d99cf3c9, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &9191204533604104673 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204533604104607} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d199490a83bb2b844b9695cbf13b01ef, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 9191204533604104674} + m_TextComponent: {fileID: 9191204534676180933} + m_Placeholder: {fileID: 9191204534739629990} + m_ContentType: 0 + m_InputType: 0 + m_AsteriskChar: 42 + m_KeyboardType: 0 + m_LineType: 0 + m_HideMobileInput: 0 + m_CharacterValidation: 0 + m_CharacterLimit: 0 + m_OnEndEdit: + m_PersistentCalls: + m_Calls: [] + m_OnSubmit: + m_PersistentCalls: + m_Calls: [] + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] + m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_CustomCaretColor: 0 + m_SelectionColor: {r: 0.65882355, g: 0.80784315, b: 1, a: 0.7529412} + m_Text: + m_CaretBlinkRate: 0.85 + m_CaretWidth: 1 + m_ReadOnly: 0 + m_ShouldActivateOnSelect: 1 +--- !u!1 &9191204534090084153 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9191204534090084154} + - component: {fileID: 9191204534090084157} + - component: {fileID: 9191204534090084156} + - component: {fileID: 9191204534090084155} + m_Layer: 5 + m_Name: loginButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9191204534090084154 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204534090084153} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 9191204533577425192} + m_Father: {fileID: 9191204535057342831} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0} + m_AnchorMax: {x: 0.5, y: 0} + m_AnchoredPosition: {x: 100, y: 131} + m_SizeDelta: {x: 170.97, y: 56} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9191204534090084157 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204534090084153} + m_CullTransparentMesh: 1 +--- !u!114 &9191204534090084156 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204534090084153} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 679881943af014a4eaa06972bd740f32, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &9191204534090084155 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204534090084153} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 9191204534090084156} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!1 &9191204534524734877 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9191204534524734878} + - component: {fileID: 9191204534524734944} + - component: {fileID: 9191204534524734879} + - component: {fileID: 9191204534524734945} + m_Layer: 5 + m_Name: titleText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9191204534524734878 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204534524734877} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 9191204534849943962} + m_Father: {fileID: 9191204535057342831} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 203.3} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9191204534524734944 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204534524734877} + m_CullTransparentMesh: 1 +--- !u!114 &9191204534524734879 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204534524734877} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 70 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 6 + m_MaxSize: 71 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u7A0B\u5E8F\u5458\u70E7\u997C\u5E97" +--- !u!114 &9191204534524734945 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204534524734877} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalFit: 2 + m_VerticalFit: 2 +--- !u!1 &9191204534593688515 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9191204534593688516} + - component: {fileID: 9191204534593688518} + - component: {fileID: 9191204534593688517} + m_Layer: 5 + m_Name: Image + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9191204534593688516 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204534593688515} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 9191204533604104672} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -194.16, y: 0} + m_SizeDelta: {x: 48, y: 48} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9191204534593688518 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204534593688515} + m_CullTransparentMesh: 1 +--- !u!114 &9191204534593688517 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204534593688515} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 61c1f706b19533b45bba68b3caacdd39, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &9191204534676180931 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9191204534676180932} + - component: {fileID: 9191204534676180934} + - component: {fileID: 9191204534676180933} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9191204534676180932 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204534676180931} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 9191204533604104672} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -0.5} + m_SizeDelta: {x: -20, y: -13} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9191204534676180934 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204534676180931} + m_CullTransparentMesh: 1 +--- !u!114 &9191204534676180933 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204534676180931} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.74509805, g: 0.24705884, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 30 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 49 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 0 + m_HorizontalOverflow: 1 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: +--- !u!1 &9191204534739629988 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9191204534739629989} + - component: {fileID: 9191204534739629991} + - component: {fileID: 9191204534739629990} + m_Layer: 5 + m_Name: Placeholder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9191204534739629989 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204534739629988} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 9191204533604104672} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -0.5} + m_SizeDelta: {x: -20, y: -13} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9191204534739629991 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204534739629988} + m_CullTransparentMesh: 1 +--- !u!114 &9191204534739629990 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204534739629988} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.74509805, g: 0.24705884, b: 0, a: 0.3254902} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 30 + m_FontStyle: 2 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 49 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u8BF7\u8F93\u5165\u8D26\u53F7" +--- !u!1 &9191204534849943961 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9191204534849943962} + - component: {fileID: 9191204534849943964} + - component: {fileID: 9191204534849943963} + - component: {fileID: 9191204534849943965} + m_Layer: 5 + m_Name: tips + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9191204534849943962 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204534849943961} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 9191204534524734878} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: -67.25} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9191204534849943964 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204534849943961} + m_CullTransparentMesh: 1 +--- !u!114 &9191204534849943963 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204534849943961} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 23 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 71 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Hello World +--- !u!114 &9191204534849943965 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204534849943961} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalFit: 2 + m_VerticalFit: 2 +--- !u!1 &9191204535057342830 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9191204535057342831} + - component: {fileID: 9191204535057342833} + - component: {fileID: 9191204535057342832} + - component: {fileID: 7604990961548752018} + m_Layer: 5 + m_Name: LoginPanel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9191204535057342831 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204535057342830} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 9191204534524734878} + - {fileID: 9191204533604104672} + - {fileID: 6368286363579040881} + - {fileID: 5415487115964929921} + - {fileID: 9191204534090084154} + - {fileID: 6488107001304388060} + - {fileID: 5616580799960710479} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9191204535057342833 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204535057342830} + m_CullTransparentMesh: 1 +--- !u!114 &9191204535057342832 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204535057342830} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.74509805, g: 0.24705882, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &7604990961548752018 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9191204535057342830} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f8e912e7ed686944bbbe9f5fd3960bdd, type: 3} + m_Name: + m_EditorClassIdentifier: + items: + - name: accountInput + obj: {fileID: 9191204533604104673} + - name: loginBtn + obj: {fileID: 9191204534090084155} + - name: versionText + obj: {fileID: 8838053237910997985} + - name: passwordInput + obj: {fileID: 7696986135417169942} + - name: registBtn + obj: {fileID: 435477248223365456} + - name: userAgreementBtn + obj: {fileID: 2050436682494325038} + - name: privacyPolicyBtn + obj: {fileID: 8588421252849557857} + - name: clauseTgl + obj: {fileID: 1190217148552363039} + - name: rememberTgl + obj: {fileID: 7169136009765341736} diff --git a/Assets/GameRes/UIPrefabs/LoginPanel.prefab.meta b/Assets/GameRes/UIPrefabs/LoginPanel.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..ebd516f8faca141339eac419c8309ca4c2a417e8 --- /dev/null +++ b/Assets/GameRes/UIPrefabs/LoginPanel.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a36dfe0665b06564c85d89874d8bdb0e +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameRes/UIPrefabs/PlazaPanel.prefab b/Assets/GameRes/UIPrefabs/PlazaPanel.prefab new file mode 100644 index 0000000000000000000000000000000000000000..45c1233be251735117b6b6f7e1824c9b3cfca6a3 --- /dev/null +++ b/Assets/GameRes/UIPrefabs/PlazaPanel.prefab @@ -0,0 +1,1134 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &339359974178886678 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3346655354154129635} + - component: {fileID: 1957084333068781827} + - component: {fileID: 6301936550299381994} + m_Layer: 5 + m_Name: follow + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3346655354154129635 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 339359974178886678} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 192292532693511479} + m_Father: {fileID: 3075219980948515393} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -80, y: 0} + m_SizeDelta: {x: 48, y: 48} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1957084333068781827 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 339359974178886678} + m_CullTransparentMesh: 1 +--- !u!114 &6301936550299381994 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 339359974178886678} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.74509805, g: 0.24705884, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: e588197f5d9db114dabf74a3d4c8b967, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &1211098218520477113 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 468334749106579993} + - component: {fileID: 8189930169726937377} + - component: {fileID: 2093195747933642539} + m_Layer: 5 + m_Name: like + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &468334749106579993 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1211098218520477113} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 5254054460370274886} + m_Father: {fileID: 3075219980948515393} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 80, y: 0} + m_SizeDelta: {x: 48, y: 48} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &8189930169726937377 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1211098218520477113} + m_CullTransparentMesh: 1 +--- !u!114 &2093195747933642539 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1211098218520477113} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.74509805, g: 0.24705884, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: dfa52f43425978e489c788838a99092b, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &1549917186880250268 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7079875144204329697} + - component: {fileID: 6207605419053832868} + - component: {fileID: 2341169706410791477} + m_Layer: 5 + m_Name: collect + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7079875144204329697 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1549917186880250268} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 8483936981380628508} + m_Father: {fileID: 3075219980948515393} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 48, y: 48} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &6207605419053832868 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1549917186880250268} + m_CullTransparentMesh: 1 +--- !u!114 &2341169706410791477 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1549917186880250268} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.74509805, g: 0.24705884, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: c9d2c9c87e8a3ba4eaac921312ad1512, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &3934013859197551621 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3075219980948515393} + - component: {fileID: 6505414017867899783} + - component: {fileID: 5880664274686348868} + - component: {fileID: 6079090552588551537} + m_Layer: 5 + m_Name: btns + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3075219980948515393 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3934013859197551621} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 3346655354154129635} + - {fileID: 468334749106579993} + - {fileID: 7079875144204329697} + m_Father: {fileID: 4630606436331925903} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: -135.8} + m_SizeDelta: {x: 250.44, y: 213.1} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &6505414017867899783 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3934013859197551621} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 6079090552588551537} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!222 &5880664274686348868 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3934013859197551621} + m_CullTransparentMesh: 1 +--- !u!114 &6079090552588551537 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3934013859197551621} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &4039993070896317472 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8419024087990704402} + - component: {fileID: 7424651232770376112} + - component: {fileID: 3021385086147689884} + - component: {fileID: 7826736920285280836} + m_Layer: 5 + m_Name: 'Text ' + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8419024087990704402 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4039993070896317472} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.99986255, y: 0.99986255, z: 0.99986255} + m_Children: [] + m_Father: {fileID: 4630606436331925903} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 32.51} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7424651232770376112 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4039993070896317472} + m_CullTransparentMesh: 1 +--- !u!114 &3021385086147689884 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4039993070896317472} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.74509805, g: 0.24705884, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 60 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 0 + m_MaxSize: 106 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u70E7\u997C\u5E97\u88C5\u4FEE\u4E2D" +--- !u!114 &7826736920285280836 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4039993070896317472} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalFit: 2 + m_VerticalFit: 2 +--- !u!1 &4344763636343161089 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5254054460370274886} + - component: {fileID: 3304304991271436178} + - component: {fileID: 7714332755405248665} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5254054460370274886 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4344763636343161089} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.9998625, y: 0.9998625, z: 0.9998625} + m_Children: [] + m_Father: {fileID: 468334749106579993} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: -47.500004} + m_SizeDelta: {x: 168.3, y: 38.49} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3304304991271436178 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4344763636343161089} + m_CullTransparentMesh: 1 +--- !u!114 &7714332755405248665 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4344763636343161089} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.74509805, g: 0.24705884, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 23 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 0 + m_MaxSize: 106 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u70B9\u8D5E" +--- !u!1 &4630606436331925902 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4630606436331925903} + - component: {fileID: 4630606436331925901} + - component: {fileID: 4630606436331925900} + - component: {fileID: 6766561612343189734} + m_Layer: 5 + m_Name: PlazaPanel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4630606436331925903 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4630606436331925902} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 4630606436548166388} + - {fileID: 8419024087990704402} + - {fileID: 3075219980948515393} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4630606436331925901 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4630606436331925902} + m_CullTransparentMesh: 1 +--- !u!114 &4630606436331925900 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4630606436331925902} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &6766561612343189734 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4630606436331925902} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f8e912e7ed686944bbbe9f5fd3960bdd, type: 3} + m_Name: + m_EditorClassIdentifier: + items: + - name: outBtn + obj: {fileID: 4674901980099146120} + - name: accountText + obj: {fileID: 4630606437141578726} + - name: likeBtn + obj: {fileID: 6505414017867899783} +--- !u!1 &4630606436548166391 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4630606436548166388} + - component: {fileID: 4630606436548168970} + - component: {fileID: 4630606436548166389} + m_Layer: 5 + m_Name: top + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4630606436548166388 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4630606436548166391} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 4630606436853365868} + - {fileID: 9071372170307276546} + m_Father: {fileID: 4630606436331925903} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 65.5} + m_Pivot: {x: 0.5, y: 1} +--- !u!222 &4630606436548168970 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4630606436548166391} + m_CullTransparentMesh: 1 +--- !u!114 &4630606436548166389 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4630606436548166391} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.74509805, g: 0.24705882, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &4630606436853365871 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4630606436853365868} + - component: {fileID: 4630606436853365858} + - component: {fileID: 4630606436853365869} + m_Layer: 5 + m_Name: head + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4630606436853365868 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4630606436853365871} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 4630606437141578721} + m_Father: {fileID: 4630606436548166388} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 0, y: 0.5} + m_AnchoredPosition: {x: 70.5, y: 0} + m_SizeDelta: {x: 48, y: 48} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4630606436853365858 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4630606436853365871} + m_CullTransparentMesh: 1 +--- !u!114 &4630606436853365869 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4630606436853365871} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 61c1f706b19533b45bba68b3caacdd39, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &4630606437141578720 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4630606437141578721} + - component: {fileID: 4630606437141578727} + - component: {fileID: 4630606437141578726} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4630606437141578721 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4630606437141578720} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4630606436853365868} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 40.3, y: -0.0010070801} + m_SizeDelta: {x: 150.1, y: 49.5} + m_Pivot: {x: 0, y: 0.5} +--- !u!222 &4630606437141578727 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4630606437141578720} + m_CullTransparentMesh: 1 +--- !u!114 &4630606437141578726 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4630606437141578720} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 23 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u8D26\u53F7\u540D" +--- !u!1 &6936064816767874596 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8483936981380628508} + - component: {fileID: 8719198206401605632} + - component: {fileID: 1736489478580609541} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8483936981380628508 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6936064816767874596} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.9998625, y: 0.9998625, z: 0.9998625} + m_Children: [] + m_Father: {fileID: 7079875144204329697} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: -47.500004} + m_SizeDelta: {x: 168.3, y: 38.49} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &8719198206401605632 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6936064816767874596} + m_CullTransparentMesh: 1 +--- !u!114 &1736489478580609541 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6936064816767874596} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.74509805, g: 0.24705884, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 23 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 0 + m_MaxSize: 106 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u6536\u85CF" +--- !u!1 &7411083263436531653 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 192292532693511479} + - component: {fileID: 395069923993016677} + - component: {fileID: 7652694624084626643} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &192292532693511479 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7411083263436531653} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 3346655354154129635} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: -47.5} + m_SizeDelta: {x: 168.3, y: 38.49} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &395069923993016677 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7411083263436531653} + m_CullTransparentMesh: 1 +--- !u!114 &7652694624084626643 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7411083263436531653} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.74509805, g: 0.24705884, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 23 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 0 + m_MaxSize: 106 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u5173\u6CE8" +--- !u!1 &7485107505465469396 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9071372170307276546} + - component: {fileID: 6345402058433714385} + - component: {fileID: 7178694477918282873} + - component: {fileID: 4674901980099146120} + m_Layer: 5 + m_Name: outButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9071372170307276546 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7485107505465469396} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4630606436548166388} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 1, y: 0.5} + m_AnchorMax: {x: 1, y: 0.5} + m_AnchoredPosition: {x: -60.440002, y: 0} + m_SizeDelta: {x: 60.130005, y: 128} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &6345402058433714385 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7485107505465469396} + m_CullTransparentMesh: 1 +--- !u!114 &7178694477918282873 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7485107505465469396} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: fec64a66745a219459654b9bbe5e06b8, type: 3} + m_Type: 0 + m_PreserveAspect: 1 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &4674901980099146120 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7485107505465469396} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 7178694477918282873} + m_OnClick: + m_PersistentCalls: + m_Calls: [] diff --git a/Assets/GameRes/UIPrefabs/PlazaPanel.prefab.meta b/Assets/GameRes/UIPrefabs/PlazaPanel.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..42fcea3a131493bb32e75f68cd1c8791c86045fa --- /dev/null +++ b/Assets/GameRes/UIPrefabs/PlazaPanel.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a76efc0193422e94a8c7ccd522fad8d5 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameRes/UIPrefabs/TipsFly.prefab b/Assets/GameRes/UIPrefabs/TipsFly.prefab new file mode 100644 index 0000000000000000000000000000000000000000..2d0ddb270bc2df1bc80f58d552da10dc137364cf --- /dev/null +++ b/Assets/GameRes/UIPrefabs/TipsFly.prefab @@ -0,0 +1,278 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &2343502181331945100 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2343502181331945103} + - component: {fileID: 2343502181331945106} + - component: {fileID: 2343502181331945107} + - component: {fileID: 2343502181331945104} + - component: {fileID: 2343502181331945105} + - component: {fileID: 2343502181331945102} + - component: {fileID: 2329275373566224548} + - component: {fileID: 41178127} + - component: {fileID: 1184943201} + m_Layer: 5 + m_Name: TipsFly + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2343502181331945103 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2343502181331945100} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2343502181776658035} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2343502181331945106 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2343502181331945100} + m_CullTransparentMesh: 1 +--- !u!114 &2343502181331945107 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2343502181331945100} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 0.69411767} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: e6fc4d1a32513d64b987ea15d99cf3c9, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &2343502181331945104 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2343502181331945100} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalFit: 2 + m_VerticalFit: 0 +--- !u!114 &2343502181331945105 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2343502181331945100} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 26 + m_Right: 26 + m_Top: 0 + m_Bottom: 0 + m_ChildAlignment: 4 + m_Spacing: 0 + m_ChildForceExpandWidth: 1 + m_ChildForceExpandHeight: 1 + m_ChildControlWidth: 1 + m_ChildControlHeight: 0 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 + m_ReverseArrangement: 0 +--- !u!95 &2343502181331945102 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2343502181331945100} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: dc7057b8525f5e444ba01ee1b2b1c550, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!114 &2329275373566224548 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2343502181331945100} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f8e912e7ed686944bbbe9f5fd3960bdd, type: 3} + m_Name: + m_EditorClassIdentifier: + items: + - name: text + obj: {fileID: 2343502181776658037} + - name: aniEvent + obj: {fileID: 1184943201} +--- !u!225 &41178127 +CanvasGroup: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2343502181331945100} + m_Enabled: 1 + m_Alpha: 1 + m_Interactable: 1 + m_BlocksRaycasts: 1 + m_IgnoreParentGroups: 0 +--- !u!114 &1184943201 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2343502181331945100} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 72ba7ff7cd38d6b4b8574d33eb3e82eb, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &2343502181776658032 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2343502181776658035} + - component: {fileID: 2343502181776658036} + - component: {fileID: 2343502181776658037} + - component: {fileID: 2343502181776658034} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2343502181776658035 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2343502181776658032} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2343502181331945103} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 156.80292, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2343502181776658036 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2343502181776658032} + m_CullTransparentMesh: 1 +--- !u!114 &2343502181776658037 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2343502181776658032} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 8cc0d7bd50a4d8f41abb328cec3f642f, type: 3} + m_FontSize: 32 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 83 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u63D0\u793A\u8BED\u63D0\u793A\u8BED\u63D0\u793A\u8BED" +--- !u!114 &2343502181776658034 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2343502181776658032} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalFit: 2 + m_VerticalFit: 2 diff --git a/Assets/GameRes/UIPrefabs/TipsFly.prefab.meta b/Assets/GameRes/UIPrefabs/TipsFly.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..f72eea906d0264864272e452d8be888bd30626a5 --- /dev/null +++ b/Assets/GameRes/UIPrefabs/TipsFly.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 35d8e092974551b4e9625de602bb6531 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework.meta b/Assets/LuaFramework.meta new file mode 100644 index 0000000000000000000000000000000000000000..ef7c602ad500adcbcf0342a36e73850eacd2a831 --- /dev/null +++ b/Assets/LuaFramework.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 6e0bd67d664a3c7418742db812cb3644 +folderAsset: yes +timeCreated: 1453125768 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Editor.meta b/Assets/LuaFramework/Editor.meta new file mode 100644 index 0000000000000000000000000000000000000000..7cfe01a401e2ed5a0155c6e5f28c8fb8feae85a2 --- /dev/null +++ b/Assets/LuaFramework/Editor.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: a57bd8213452ba24ab5b93cc9d62fb15 +folderAsset: yes +timeCreated: 1453127194 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Editor/CustomSettings.cs b/Assets/LuaFramework/Editor/CustomSettings.cs new file mode 100644 index 0000000000000000000000000000000000000000..f7a3aed8f7b417bd50fe34dd29de7b25c8afedde --- /dev/null +++ b/Assets/LuaFramework/Editor/CustomSettings.cs @@ -0,0 +1,299 @@ +锘縰sing UnityEngine; +using System; +using System.Collections.Generic; +using LuaInterface; +using LuaFramework; +using UnityEditor; + +using BindType = ToLuaMenu.BindType; +using UnityEngine.UI; +using System.Reflection; +using UnityEngine.UI; + +public static class CustomSettings +{ + public static string FrameworkPath = AppConst.FrameworkRoot; + public static string saveDir = FrameworkPath + "/ToLua/Source/Generate/"; + public static string luaDir = FrameworkPath + "/Lua/"; + public static string toluaBaseType = FrameworkPath + "/ToLua/BaseType/"; + public static string baseLuaDir = FrameworkPath + "/ToLua/Lua"; + public static string injectionFilesPath = Application.dataPath + "/ToLua/Injection/"; + + //瀵煎嚭鏃跺己鍒跺仛涓洪潤鎬佺被鐨勭被鍨(娉ㄦ剰customTypeList 杩樿娣诲姞杩欎釜绫诲瀷鎵嶈兘瀵煎嚭) + //unity 鏈変簺绫讳綔涓簊ealed class, 鍏跺疄瀹屽叏绛変环浜庨潤鎬佺被 + public static List staticClassTypes = new List + { + typeof(UnityEngine.Application), + typeof(UnityEngine.Time), + typeof(UnityEngine.Screen), + typeof(UnityEngine.SleepTimeout), + typeof(UnityEngine.Input), + typeof(UnityEngine.Resources), + typeof(UnityEngine.Physics), + typeof(UnityEngine.RenderSettings), + typeof(UnityEngine.QualitySettings), + typeof(UnityEngine.GL), + typeof(UnityEngine.Graphics), + }; + + //闄勫姞瀵煎嚭濮旀墭绫诲瀷(鍦ㄥ鍑哄鎵樻椂, customTypeList 涓壍鎵殑濮旀墭绫诲瀷閮戒細瀵煎嚭锛 鏃犻渶鍐欏湪杩欓噷) + public static DelegateType[] customDelegateList = + { + _DT(typeof(Action)), + _DT(typeof(UnityEngine.Events.UnityAction)), + _DT(typeof(System.Predicate)), + _DT(typeof(System.Action)), + _DT(typeof(System.Comparison)), + _DT(typeof(System.Func)), + }; + + //鍦ㄨ繖閲屾坊鍔犱綘瑕佸鍑烘敞鍐屽埌lua鐨勭被鍨嬪垪琛 + public static BindType[] customTypeList = + { + //------------------------涓轰緥瀛愬鍑-------------------------------- + //_GT(typeof(TestEventListener)), + //_GT(typeof(TestProtol)), + //_GT(typeof(TestAccount)), + //_GT(typeof(Dictionary)).SetLibName("AccountMap"), + //_GT(typeof(KeyValuePair)), + //_GT(typeof(Dictionary.KeyCollection)), + //_GT(typeof(Dictionary.ValueCollection)), + //_GT(typeof(TestExport)), + //_GT(typeof(TestExport.Space)), + //------------------------------------------------------------------- + + _GT(typeof(LuaInjectionStation)), + _GT(typeof(InjectType)), + _GT(typeof(Debugger)).SetNameSpace(null), + +#if USING_DOTWEENING + _GT(typeof(DG.Tweening.DOTween)), + _GT(typeof(DG.Tweening.Tween)).SetBaseType(typeof(System.Object)).AddExtendType(typeof(DG.Tweening.TweenExtensions)), + _GT(typeof(DG.Tweening.Sequence)).AddExtendType(typeof(DG.Tweening.TweenSettingsExtensions)), + _GT(typeof(DG.Tweening.Tweener)).AddExtendType(typeof(DG.Tweening.TweenSettingsExtensions)), + _GT(typeof(DG.Tweening.LoopType)), + _GT(typeof(DG.Tweening.PathMode)), + _GT(typeof(DG.Tweening.PathType)), + _GT(typeof(DG.Tweening.RotateMode)), + _GT(typeof(Component)).AddExtendType(typeof(DG.Tweening.ShortcutExtensions)), + _GT(typeof(Transform)).AddExtendType(typeof(DG.Tweening.ShortcutExtensions)), + _GT(typeof(Light)).AddExtendType(typeof(DG.Tweening.ShortcutExtensions)), + _GT(typeof(Material)).AddExtendType(typeof(DG.Tweening.ShortcutExtensions)), + _GT(typeof(Rigidbody)).AddExtendType(typeof(DG.Tweening.ShortcutExtensions)), + _GT(typeof(Camera)).AddExtendType(typeof(DG.Tweening.ShortcutExtensions)), + _GT(typeof(AudioSource)).AddExtendType(typeof(DG.Tweening.ShortcutExtensions)), + //_GT(typeof(LineRenderer)).AddExtendType(typeof(DG.Tweening.ShortcutExtensions)), + //_GT(typeof(TrailRenderer)).AddExtendType(typeof(DG.Tweening.ShortcutExtensions)), +#else + + _GT(typeof(Component)), + _GT(typeof(Transform)), + _GT(typeof(Material)), + //_GT(typeof(Light)), + _GT(typeof(Rigidbody)), + _GT(typeof(Camera)), + _GT(typeof(AudioSource)), + //_GT(typeof(LineRenderer)) + //_GT(typeof(TrailRenderer)) +#endif + + _GT(typeof(Behaviour)), + _GT(typeof(MonoBehaviour)), + _GT(typeof(GameObject)), + _GT(typeof(TrackedReference)), + _GT(typeof(Application)), + _GT(typeof(Physics)), + _GT(typeof(Collider)), + _GT(typeof(Time)), + _GT(typeof(Texture)), + _GT(typeof(Texture2D)), + _GT(typeof(Shader)), + _GT(typeof(Renderer)), + _GT(typeof(WWW)), + _GT(typeof(Screen)), + _GT(typeof(CameraClearFlags)), + _GT(typeof(AudioClip)), + _GT(typeof(AssetBundle)), + //_GT(typeof(ParticleSystem)), + _GT(typeof(AsyncOperation)).SetBaseType(typeof(System.Object)), + _GT(typeof(LightType)), + _GT(typeof(SleepTimeout)), +#if UNITY_5_3_OR_NEWER && !UNITY_5_6_OR_NEWER + _GT(typeof(UnityEngine.Experimental.Director.DirectorPlayer)), +#endif + _GT(typeof(Animator)), + _GT(typeof(Input)), + _GT(typeof(KeyCode)), + _GT(typeof(SkinnedMeshRenderer)), + _GT(typeof(Space)), + + + //_GT(typeof(MeshRenderer)), +#if !UNITY_5_4_OR_NEWER + _GT(typeof(ParticleEmitter)), + _GT(typeof(ParticleRenderer)), + _GT(typeof(ParticleAnimator)), +#endif + + _GT(typeof(BoxCollider)), + _GT(typeof(MeshCollider)), + _GT(typeof(SphereCollider)), + _GT(typeof(CharacterController)), + _GT(typeof(CapsuleCollider)), + + _GT(typeof(Animation)), + _GT(typeof(AnimationClip)).SetBaseType(typeof(UnityEngine.Object)), + _GT(typeof(AnimationState)), + _GT(typeof(AnimationBlendMode)), + _GT(typeof(QueueMode)), + _GT(typeof(PlayMode)), + _GT(typeof(WrapMode)), + + //_GT(typeof(QualitySettings)), + _GT(typeof(RenderSettings)), + _GT(typeof(SkinWeights)), + _GT(typeof(RenderTexture)), + _GT(typeof(Resources)), + _GT(typeof(LuaProfiler)), + + //for LuaFramework + _GT(typeof(RectTransform)), + + + _GT(typeof(Util)), + _GT(typeof(AppConst)), + _GT(typeof(LuaHelper)), + _GT(typeof(ByteBuffer)), + + _GT(typeof(GameManager)), + _GT(typeof(LuaManager)), + _GT(typeof(NetworkManager)), + + _GT(typeof(PlayerPrefs)), + + // UGUI鐩稿叧------------------------------------------------------------ + _GT(typeof(Text)), + _GT(typeof(Button)), + _GT(typeof(Toggle)), + _GT(typeof(Image)), + _GT(typeof(RawImage)), + + + + // 鑷繁鍐欑殑C#鑴氭湰------------------------------------------------------------ + _GT(typeof(GameLogger)), + _GT(typeof(PanelMgr)), + _GT(typeof(ResourceMgr)), + _GT(typeof(PrefabObjBinder)), + _GT(typeof(VersionMgr)), + _GT(typeof(AnimationEventTrigger)), + + + }; + + public static List dynamicList = new List() + { + //typeof(MeshRenderer), +#if !UNITY_5_4_OR_NEWER + typeof(ParticleEmitter), + typeof(ParticleRenderer), + typeof(ParticleAnimator), +#endif + + typeof(BoxCollider), + typeof(MeshCollider), + typeof(SphereCollider), + typeof(CharacterController), + typeof(CapsuleCollider), + + typeof(Animation), + typeof(AnimationClip), + typeof(AnimationState), + + typeof(SkinWeights), + typeof(RenderTexture), + typeof(Rigidbody), + }; + + //閲嶈浇鍑芥暟锛岀浉鍚屽弬鏁颁釜鏁帮紝鐩稿悓浣嶇疆out鍙傛暟鍖归厤鍑洪棶棰樻椂, 闇瑕佸己鍒跺尮閰嶈В鍐 + //浣跨敤鏂规硶鍙傝渚嬪瓙14 + public static List outList = new List() + { + + }; + + //ngui浼樺寲锛屼笅闈㈢殑绫绘病鏈夋淳鐢熺被锛屽彲浠ヤ綔涓簊ealed class + public static List sealedList = new List() + { + /*typeof(Transform), + typeof(UIRoot), + typeof(UICamera), + typeof(UIViewport), + typeof(UIPanel), + typeof(UILabel), + typeof(UIAnchor), + typeof(UIAtlas), + typeof(UIFont), + typeof(UITexture), + typeof(UISprite), + typeof(UIGrid), + typeof(UITable), + typeof(UIWrapGrid), + typeof(in), + typeof(UIScrollView), + typeof(UIEventListener), + typeof(UIScrollBar), + typeof(UICenterOnChild), + typeof(UIScrollView), + typeof(UIButton), + typeof(UITextList), + typeof(UIPlayTween), + typeof(UIDragScrollView), + typeof(UISpriteAnimation), + typeof(UIWrapContent), + typeof(TweenWidth), + typeof(TweenAlpha), + typeof(TweenColor), + typeof(TweenRotation), + typeof(TweenPosition), + typeof(TweenScale), + typeof(TweenHeight), + typeof(TypewriterEffect), + typeof(UIToggle), + typeof(Localization),*/ + }; + + public static BindType _GT(Type t) + { + return new BindType(t); + } + + public static DelegateType _DT(Type t) + { + return new DelegateType(t); + } + + + [MenuItem("Lua/Attach Profiler", false, 151)] + static void AttachProfiler() + { + if (!Application.isPlaying) + { + EditorUtility.DisplayDialog("璀﹀憡", "璇峰湪杩愯鏃舵墽琛屾鍔熻兘", "纭畾"); + return; + } + + LuaClient.Instance.AttachProfiler(); + } + + [MenuItem("Lua/Detach Profiler", false, 152)] + static void DetachProfiler() + { + if (!Application.isPlaying) + { + return; + } + + LuaClient.Instance.DetachProfiler(); + } +} diff --git a/Assets/LuaFramework/Editor/CustomSettings.cs.meta b/Assets/LuaFramework/Editor/CustomSettings.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..f72dc0b28862790c292836f4206e997e465ffe7c --- /dev/null +++ b/Assets/LuaFramework/Editor/CustomSettings.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 86bf33513bdd8324985f8712180692d9 +timeCreated: 1457265758 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Lua.meta b/Assets/LuaFramework/Lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..d80a80fa1e020753aab13cd1947e203045f31301 --- /dev/null +++ b/Assets/LuaFramework/Lua.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: d1ff240b0de4c2c4aa0bfa3805e7b880 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd.meta b/Assets/LuaFramework/Lua/3rd.meta new file mode 100644 index 0000000000000000000000000000000000000000..3078a569f020cfb95157b6bb03f9584cb001f998 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: fef477624099d704ca56e26ccb995f63 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/cjson.meta b/Assets/LuaFramework/Lua/3rd/cjson.meta new file mode 100644 index 0000000000000000000000000000000000000000..a4a9715c3b4c9090b4b28356c1398dfd63e8a141 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/cjson.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 1119c4407810743de86d01fa652b2374 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/cjson/example1.json b/Assets/LuaFramework/Lua/3rd/cjson/example1.json new file mode 100644 index 0000000000000000000000000000000000000000..42486cec024e7cc7c2393e93a43f65f897db559b --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/cjson/example1.json @@ -0,0 +1,22 @@ +{ + "glossary": { + "title": "example glossary", + "GlossDiv": { + "title": "S", + "GlossList": { + "GlossEntry": { + "ID": "SGML", + "SortAs": "SGML", + "GlossTerm": "Standard Generalized Mark up Language", + "Acronym": "SGML", + "Abbrev": "ISO 8879:1986", + "GlossDef": { + "para": "A meta-markup language, used to create markup languages such as DocBook.", + "GlossSeeAlso": ["GML", "XML"] + }, + "GlossSee": "markup" + } + } + } + } +} diff --git a/Assets/LuaFramework/Lua/3rd/cjson/example1.json.meta b/Assets/LuaFramework/Lua/3rd/cjson/example1.json.meta new file mode 100644 index 0000000000000000000000000000000000000000..c400263ae77e3bf6bf88e95bd730e28bfc81d916 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/cjson/example1.json.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: d6de770751412fd43a5fd1fe331dd761 +TextScriptImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/cjson/example2.json b/Assets/LuaFramework/Lua/3rd/cjson/example2.json new file mode 100644 index 0000000000000000000000000000000000000000..5600991a4c7a02a9365bbc8248806fd11c3d197b --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/cjson/example2.json @@ -0,0 +1,11 @@ +{"menu": { + "id": "file", + "value": "File", + "popup": { + "menuitem": [ + {"value": "New", "onclick": "CreateNewDoc()"}, + {"value": "Open", "onclick": "OpenDoc()"}, + {"value": "Close", "onclick": "CloseDoc()"} + ] + } +}} diff --git a/Assets/LuaFramework/Lua/3rd/cjson/example2.json.meta b/Assets/LuaFramework/Lua/3rd/cjson/example2.json.meta new file mode 100644 index 0000000000000000000000000000000000000000..999d478e7b8d9cfb8995be11e8a25f43e1fadb37 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/cjson/example2.json.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 0d487a1ee1528714a93defdc9f730dfe +TextScriptImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/cjson/example3.json b/Assets/LuaFramework/Lua/3rd/cjson/example3.json new file mode 100644 index 0000000000000000000000000000000000000000..d7237a5ae037c182130de4255bfa58059b9dc05a --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/cjson/example3.json @@ -0,0 +1,26 @@ +{"widget": { + "debug": "on", + "window": { + "title": "Sample Konfabulator Widget", + "name": "main_window", + "width": 500, + "height": 500 + }, + "image": { + "src": "Images/Sun.png", + "name": "sun1", + "hOffset": 250, + "vOffset": 250, + "alignment": "center" + }, + "text": { + "data": "Click Here", + "size": 36, + "style": "bold", + "name": "text1", + "hOffset": 250, + "vOffset": 100, + "alignment": "center", + "onMouseUp": "sun1.opacity = (sun1.opacity / 100) * 90;" + } +}} diff --git a/Assets/LuaFramework/Lua/3rd/cjson/example3.json.meta b/Assets/LuaFramework/Lua/3rd/cjson/example3.json.meta new file mode 100644 index 0000000000000000000000000000000000000000..d503bce4216a65f5ae0f4c75a84673ec82e38d92 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/cjson/example3.json.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: ca313ab6bd2e8ab41bce696d1ee05a89 +TextScriptImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/cjson/example4.json b/Assets/LuaFramework/Lua/3rd/cjson/example4.json new file mode 100644 index 0000000000000000000000000000000000000000..d31a395bd495ef35a76b22e149d8f8e9f7b432f9 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/cjson/example4.json @@ -0,0 +1,88 @@ +{"web-app": { + "servlet": [ + { + "servlet-name": "cofaxCDS", + "servlet-class": "org.cofax.cds.CDSServlet", + "init-param": { + "configGlossary:installationAt": "Philadelphia, PA", + "configGlossary:adminEmail": "ksm@pobox.com", + "configGlossary:poweredBy": "Cofax", + "configGlossary:poweredByIcon": "/images/cofax.gif", + "configGlossary:staticPath": "/content/static", + "templateProcessorClass": "org.cofax.WysiwygTemplate", + "templateLoaderClass": "org.cofax.FilesTemplateLoader", + "templatePath": "templates", + "templateOverridePath": "", + "defaultListTemplate": "listTemplate.htm", + "defaultFileTemplate": "articleTemplate.htm", + "useJSP": false, + "jspListTemplate": "listTemplate.jsp", + "jspFileTemplate": "articleTemplate.jsp", + "cachePackageTagsTrack": 200, + "cachePackageTagsStore": 200, + "cachePackageTagsRefresh": 60, + "cacheTemplatesTrack": 100, + "cacheTemplatesStore": 50, + "cacheTemplatesRefresh": 15, + "cachePagesTrack": 200, + "cachePagesStore": 100, + "cachePagesRefresh": 10, + "cachePagesDirtyRead": 10, + "searchEngineListTemplate": "forSearchEnginesList.htm", + "searchEngineFileTemplate": "forSearchEngines.htm", + "searchEngineRobotsDb": "WEB-INF/robots.db", + "useDataStore": true, + "dataStoreClass": "org.cofax.SqlDataStore", + "redirectionClass": "org.cofax.SqlRedirection", + "dataStoreName": "cofax", + "dataStoreDriver": "com.microsoft.jdbc.sqlserver.SQLServerDriver", + "dataStoreUrl": "jdbc:microsoft:sqlserver://LOCALHOST:1433;DatabaseName=goon", + "dataStoreUser": "sa", + "dataStorePassword": "dataStoreTestQuery", + "dataStoreTestQuery": "SET NOCOUNT ON;select test='test';", + "dataStoreLogFile": "/usr/local/tomcat/logs/datastore.log", + "dataStoreInitConns": 10, + "dataStoreMaxConns": 100, + "dataStoreConnUsageLimit": 100, + "dataStoreLogLevel": "debug", + "maxUrlLength": 500}}, + { + "servlet-name": "cofaxEmail", + "servlet-class": "org.cofax.cds.EmailServlet", + "init-param": { + "mailHost": "mail1", + "mailHostOverride": "mail2"}}, + { + "servlet-name": "cofaxAdmin", + "servlet-class": "org.cofax.cds.AdminServlet"}, + + { + "servlet-name": "fileServlet", + "servlet-class": "org.cofax.cds.FileServlet"}, + { + "servlet-name": "cofaxTools", + "servlet-class": "org.cofax.cms.CofaxToolsServlet", + "init-param": { + "templatePath": "toolstemplates/", + "log": 1, + "logLocation": "/usr/local/tomcat/logs/CofaxTools.log", + "logMaxSize": "", + "dataLog": 1, + "dataLogLocation": "/usr/local/tomcat/logs/dataLog.log", + "dataLogMaxSize": "", + "removePageCache": "/content/admin/remove?cache=pages&id=", + "removeTemplateCache": "/content/admin/remove?cache=templates&id=", + "fileTransferFolder": "/usr/local/tomcat/webapps/content/fileTransferFolder", + "lookInContext": 1, + "adminGroupID": 4, + "betaServer": true}}], + "servlet-mapping": { + "cofaxCDS": "/", + "cofaxEmail": "/cofaxutil/aemail/*", + "cofaxAdmin": "/admin/*", + "fileServlet": "/static/*", + "cofaxTools": "/tools/*"}, + + "taglib": { + "taglib-uri": "cofax.tld", + "taglib-location": "/WEB-INF/tlds/cofax.tld"}}} diff --git a/Assets/LuaFramework/Lua/3rd/cjson/example4.json.meta b/Assets/LuaFramework/Lua/3rd/cjson/example4.json.meta new file mode 100644 index 0000000000000000000000000000000000000000..ff04e6d58c8f0690e02463f8c5c7a1a5613fac6b --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/cjson/example4.json.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: c69a28c5662c2204787fdd352f5595c5 +TextScriptImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/cjson/example5.json b/Assets/LuaFramework/Lua/3rd/cjson/example5.json new file mode 100644 index 0000000000000000000000000000000000000000..49980ca25bcc4b9e11efb75946bc15febb4ec352 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/cjson/example5.json @@ -0,0 +1,27 @@ +{"menu": { + "header": "SVG Viewer", + "items": [ + {"id": "Open"}, + {"id": "OpenNew", "label": "Open New"}, + null, + {"id": "ZoomIn", "label": "Zoom In"}, + {"id": "ZoomOut", "label": "Zoom Out"}, + {"id": "OriginalView", "label": "Original View"}, + null, + {"id": "Quality"}, + {"id": "Pause"}, + {"id": "Mute"}, + null, + {"id": "Find", "label": "Find..."}, + {"id": "FindAgain", "label": "Find Again"}, + {"id": "Copy"}, + {"id": "CopyAgain", "label": "Copy Again"}, + {"id": "CopySVG", "label": "Copy SVG"}, + {"id": "ViewSVG", "label": "View SVG"}, + {"id": "ViewSource", "label": "View Source"}, + {"id": "SaveAs", "label": "Save As"}, + null, + {"id": "Help"}, + {"id": "About", "label": "About Adobe CVG Viewer..."} + ] +}} diff --git a/Assets/LuaFramework/Lua/3rd/cjson/example5.json.meta b/Assets/LuaFramework/Lua/3rd/cjson/example5.json.meta new file mode 100644 index 0000000000000000000000000000000000000000..e6b0c4cc6644433fb0af5dccc42941125e36b13e --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/cjson/example5.json.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 9298ce1cff4eae34087e1cf24cdc89cb +TextScriptImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/cjson/json2lua.lua b/Assets/LuaFramework/Lua/3rd/cjson/json2lua.lua new file mode 100644 index 0000000000000000000000000000000000000000..014416d244bdb2fa5faacf852dc86bb151ae8ad2 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/cjson/json2lua.lua @@ -0,0 +1,14 @@ +#!/usr/bin/env lua + +-- usage: json2lua.lua [json_file] +-- +-- Eg: +-- echo '[ "testing" ]' | ./json2lua.lua +-- ./json2lua.lua test.json + +local json = require "cjson" +local util = require "cjson.util" + +local json_text = util.file_load(arg[1]) +local t = json.decode(json_text) +print(util.serialise_value(t)) diff --git a/Assets/LuaFramework/Lua/3rd/cjson/json2lua.lua.meta b/Assets/LuaFramework/Lua/3rd/cjson/json2lua.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..4867a31c0e73a6e902319ea64cd409e43a7f24a9 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/cjson/json2lua.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 4f17254f6d6b970429bbb11bfa82b22c +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/cjson/lua2json.lua b/Assets/LuaFramework/Lua/3rd/cjson/lua2json.lua new file mode 100644 index 0000000000000000000000000000000000000000..aee8869a89a5be935b8fce485d5bbd7610074b76 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/cjson/lua2json.lua @@ -0,0 +1,20 @@ +#!/usr/bin/env lua + +-- usage: lua2json.lua [lua_file] +-- +-- Eg: +-- echo '{ "testing" }' | ./lua2json.lua +-- ./lua2json.lua test.lua + +local json = require "cjson" +local util = require "cjson.util" + +local env = { + json = { null = json.null }, + null = json.null +} + +local t = util.run_script("data = " .. util.file_load(arg[1]), env) +print(json.encode(t.data)) + +-- vi:ai et sw=4 ts=4: diff --git a/Assets/LuaFramework/Lua/3rd/cjson/lua2json.lua.meta b/Assets/LuaFramework/Lua/3rd/cjson/lua2json.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..84b998402a5f9b37b204b611c44448649f6a1dc0 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/cjson/lua2json.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 2eeb576afff9def43b0081f6d7b2125b +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/cjson/test.lua b/Assets/LuaFramework/Lua/3rd/cjson/test.lua new file mode 100644 index 0000000000000000000000000000000000000000..b8fce84c4adb837e3be372e957dab7e443f1accf --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/cjson/test.lua @@ -0,0 +1,425 @@ +#!/usr/bin/env lua + +-- Lua CJSON tests +-- +-- Mark Pulford +-- +-- Note: The output of this script is easier to read with "less -S" + +local json = require "cjson" +local json_safe = require "cjson.safe" +local util = require "cjson.util" + +local function gen_raw_octets() + local chars = {} + for i = 0, 255 do chars[i + 1] = string.char(i) end + return table.concat(chars) +end + +-- Generate every UTF-16 codepoint, including supplementary codes +local function gen_utf16_escaped() + -- Create raw table escapes + local utf16_escaped = {} + local count = 0 + + local function append_escape(code) + local esc = ('\\u%04X'):format(code) + table.insert(utf16_escaped, esc) + end + + table.insert(utf16_escaped, '"') + for i = 0, 0xD7FF do + append_escape(i) + end + -- Skip 0xD800 - 0xDFFF since they are used to encode supplementary + -- codepoints + for i = 0xE000, 0xFFFF do + append_escape(i) + end + -- Append surrogate pair for each supplementary codepoint + for high = 0xD800, 0xDBFF do + for low = 0xDC00, 0xDFFF do + append_escape(high) + append_escape(low) + end + end + table.insert(utf16_escaped, '"') + + return table.concat(utf16_escaped) +end + +function load_testdata() + local data = {} + + -- Data for 8bit raw <-> escaped octets tests + data.octets_raw = gen_raw_octets() + data.octets_escaped = util.file_load("octets-escaped.dat") + + -- Data for \uXXXX -> UTF-8 test + data.utf16_escaped = gen_utf16_escaped() + + -- Load matching data for utf16_escaped + local utf8_loaded + utf8_loaded, data.utf8_raw = pcall(util.file_load, "utf8.dat") + if not utf8_loaded then + data.utf8_raw = "Failed to load utf8.dat - please run genutf8.pl" + end + + data.table_cycle = {} + data.table_cycle[1] = data.table_cycle + + local big = {} + for i = 1, 1100 do + big = { { 10, false, true, json.null }, "string", a = big } + end + data.deeply_nested_data = big + + return data +end + +function test_decode_cycle(filename) + local obj1 = json.decode(util.file_load(filename)) + local obj2 = json.decode(json.encode(obj1)) + return util.compare_values(obj1, obj2) +end + +-- Set up data used in tests +local Inf = math.huge; +local NaN = math.huge * 0; + +local testdata = load_testdata() + +local cjson_tests = { + -- Test API variables + { "Check module name, version", + function () return json._NAME, json._VERSION end, { }, + true, { "cjson", "2.1devel" } }, + + -- Test decoding simple types + { "Decode string", + json.decode, { '"test string"' }, true, { "test string" } }, + { "Decode numbers", + json.decode, { '[ 0.0, -5e3, -1, 0.3e-3, 1023.2, 0e10 ]' }, + true, { { 0.0, -5000, -1, 0.0003, 1023.2, 0 } } }, + { "Decode null", + json.decode, { 'null' }, true, { json.null } }, + { "Decode true", + json.decode, { 'true' }, true, { true } }, + { "Decode false", + json.decode, { 'false' }, true, { false } }, + { "Decode object with numeric keys", + json.decode, { '{ "1": "one", "3": "three" }' }, + true, { { ["1"] = "one", ["3"] = "three" } } }, + { "Decode object with string keys", + json.decode, { '{ "a": "a", "b": "b" }' }, + true, { { a = "a", b = "b" } } }, + { "Decode array", + json.decode, { '[ "one", null, "three" ]' }, + true, { { "one", json.null, "three" } } }, + + -- Test decoding errors + { "Decode UTF-16BE [throw error]", + json.decode, { '\0"\0"' }, + false, { "JSON parser does not support UTF-16 or UTF-32" } }, + { "Decode UTF-16LE [throw error]", + json.decode, { '"\0"\0' }, + false, { "JSON parser does not support UTF-16 or UTF-32" } }, + { "Decode UTF-32BE [throw error]", + json.decode, { '\0\0\0"' }, + false, { "JSON parser does not support UTF-16 or UTF-32" } }, + { "Decode UTF-32LE [throw error]", + json.decode, { '"\0\0\0' }, + false, { "JSON parser does not support UTF-16 or UTF-32" } }, + { "Decode partial JSON [throw error]", + json.decode, { '{ "unexpected eof": ' }, + false, { "Expected value but found T_END at character 21" } }, + { "Decode with extra comma [throw error]", + json.decode, { '{ "extra data": true }, false' }, + false, { "Expected the end but found T_COMMA at character 23" } }, + { "Decode invalid escape code [throw error]", + json.decode, { [[ { "bad escape \q code" } ]] }, + false, { "Expected object key string but found invalid escape code at character 16" } }, + { "Decode invalid unicode escape [throw error]", + json.decode, { [[ { "bad unicode \u0f6 escape" } ]] }, + false, { "Expected object key string but found invalid unicode escape code at character 17" } }, + { "Decode invalid keyword [throw error]", + json.decode, { ' [ "bad barewood", test ] ' }, + false, { "Expected value but found invalid token at character 20" } }, + { "Decode invalid number #1 [throw error]", + json.decode, { '[ -+12 ]' }, + false, { "Expected value but found invalid number at character 3" } }, + { "Decode invalid number #2 [throw error]", + json.decode, { '-v' }, + false, { "Expected value but found invalid number at character 1" } }, + { "Decode invalid number exponent [throw error]", + json.decode, { '[ 0.4eg10 ]' }, + false, { "Expected comma or array end but found invalid token at character 6" } }, + + -- Test decoding nested arrays / objects + { "Set decode_max_depth(5)", + json.decode_max_depth, { 5 }, true, { 5 } }, + { "Decode array at nested limit", + json.decode, { '[[[[[ "nested" ]]]]]' }, + true, { {{{{{ "nested" }}}}} } }, + { "Decode array over nested limit [throw error]", + json.decode, { '[[[[[[ "nested" ]]]]]]' }, + false, { "Found too many nested data structures (6) at character 6" } }, + { "Decode object at nested limit", + json.decode, { '{"a":{"b":{"c":{"d":{"e":"nested"}}}}}' }, + true, { {a={b={c={d={e="nested"}}}}} } }, + { "Decode object over nested limit [throw error]", + json.decode, { '{"a":{"b":{"c":{"d":{"e":{"f":"nested"}}}}}}' }, + false, { "Found too many nested data structures (6) at character 26" } }, + { "Set decode_max_depth(1000)", + json.decode_max_depth, { 1000 }, true, { 1000 } }, + { "Decode deeply nested array [throw error]", + json.decode, { string.rep("[", 1100) .. '1100' .. string.rep("]", 1100)}, + false, { "Found too many nested data structures (1001) at character 1001" } }, + + -- Test encoding nested tables + { "Set encode_max_depth(5)", + json.encode_max_depth, { 5 }, true, { 5 } }, + { "Encode nested table as array at nested limit", + json.encode, { {{{{{"nested"}}}}} }, true, { '[[[[["nested"]]]]]' } }, + { "Encode nested table as array after nested limit [throw error]", + json.encode, { { {{{{{"nested"}}}}} } }, + false, { "Cannot serialise, excessive nesting (6)" } }, + { "Encode nested table as object at nested limit", + json.encode, { {a={b={c={d={e="nested"}}}}} }, + true, { '{"a":{"b":{"c":{"d":{"e":"nested"}}}}}' } }, + { "Encode nested table as object over nested limit [throw error]", + json.encode, { {a={b={c={d={e={f="nested"}}}}}} }, + false, { "Cannot serialise, excessive nesting (6)" } }, + { "Encode table with cycle [throw error]", + json.encode, { testdata.table_cycle }, + false, { "Cannot serialise, excessive nesting (6)" } }, + { "Set encode_max_depth(1000)", + json.encode_max_depth, { 1000 }, true, { 1000 } }, + { "Encode deeply nested data [throw error]", + json.encode, { testdata.deeply_nested_data }, + false, { "Cannot serialise, excessive nesting (1001)" } }, + + -- Test encoding simple types + { "Encode null", + json.encode, { json.null }, true, { 'null' } }, + { "Encode true", + json.encode, { true }, true, { 'true' } }, + { "Encode false", + json.encode, { false }, true, { 'false' } }, + { "Encode empty object", + json.encode, { { } }, true, { '{}' } }, + { "Encode integer", + json.encode, { 10 }, true, { '10' } }, + { "Encode string", + json.encode, { "hello" }, true, { '"hello"' } }, + { "Encode Lua function [throw error]", + json.encode, { function () end }, + false, { "Cannot serialise function: type not supported" } }, + + -- Test decoding invalid numbers + { "Set decode_invalid_numbers(true)", + json.decode_invalid_numbers, { true }, true, { true } }, + { "Decode hexadecimal", + json.decode, { '0x6.ffp1' }, true, { 13.9921875 } }, + { "Decode numbers with leading zero", + json.decode, { '[ 0123, 00.33 ]' }, true, { { 123, 0.33 } } }, + { "Decode +-Inf", + json.decode, { '[ +Inf, Inf, -Inf ]' }, true, { { Inf, Inf, -Inf } } }, + { "Decode +-Infinity", + json.decode, { '[ +Infinity, Infinity, -Infinity ]' }, + true, { { Inf, Inf, -Inf } } }, + { "Decode +-NaN", + json.decode, { '[ +NaN, NaN, -NaN ]' }, true, { { NaN, NaN, NaN } } }, + { "Decode Infrared (not infinity) [throw error]", + json.decode, { 'Infrared' }, + false, { "Expected the end but found invalid token at character 4" } }, + { "Decode Noodle (not NaN) [throw error]", + json.decode, { 'Noodle' }, + false, { "Expected value but found invalid token at character 1" } }, + { "Set decode_invalid_numbers(false)", + json.decode_invalid_numbers, { false }, true, { false } }, + { "Decode hexadecimal [throw error]", + json.decode, { '0x6' }, + false, { "Expected value but found invalid number at character 1" } }, + { "Decode numbers with leading zero [throw error]", + json.decode, { '[ 0123, 00.33 ]' }, + false, { "Expected value but found invalid number at character 3" } }, + { "Decode +-Inf [throw error]", + json.decode, { '[ +Inf, Inf, -Inf ]' }, + false, { "Expected value but found invalid token at character 3" } }, + { "Decode +-Infinity [throw error]", + json.decode, { '[ +Infinity, Infinity, -Infinity ]' }, + false, { "Expected value but found invalid token at character 3" } }, + { "Decode +-NaN [throw error]", + json.decode, { '[ +NaN, NaN, -NaN ]' }, + false, { "Expected value but found invalid token at character 3" } }, + { 'Set decode_invalid_numbers("on")', + json.decode_invalid_numbers, { "on" }, true, { true } }, + + -- Test encoding invalid numbers + { "Set encode_invalid_numbers(false)", + json.encode_invalid_numbers, { false }, true, { false } }, + { "Encode NaN [throw error]", + json.encode, { NaN }, + false, { "Cannot serialise number: must not be NaN or Infinity" } }, + { "Encode Infinity [throw error]", + json.encode, { Inf }, + false, { "Cannot serialise number: must not be NaN or Infinity" } }, + { "Set encode_invalid_numbers(\"null\")", + json.encode_invalid_numbers, { "null" }, true, { "null" } }, + { "Encode NaN as null", + json.encode, { NaN }, true, { "null" } }, + { "Encode Infinity as null", + json.encode, { Inf }, true, { "null" } }, + { "Set encode_invalid_numbers(true)", + json.encode_invalid_numbers, { true }, true, { true } }, + { "Encode NaN", + json.encode, { NaN }, true, { "NaN" } }, + { "Encode +Infinity", + json.encode, { Inf }, true, { "Infinity" } }, + { "Encode -Infinity", + json.encode, { -Inf }, true, { "-Infinity" } }, + { 'Set encode_invalid_numbers("off")', + json.encode_invalid_numbers, { "off" }, true, { false } }, + + -- Test encoding tables + { "Set encode_sparse_array(true, 2, 3)", + json.encode_sparse_array, { true, 2, 3 }, true, { true, 2, 3 } }, + { "Encode sparse table as array #1", + json.encode, { { [3] = "sparse test" } }, + true, { '[null,null,"sparse test"]' } }, + { "Encode sparse table as array #2", + json.encode, { { [1] = "one", [4] = "sparse test" } }, + true, { '["one",null,null,"sparse test"]' } }, + { "Encode sparse array as object", + json.encode, { { [1] = "one", [5] = "sparse test" } }, + true, { '{"1":"one","5":"sparse test"}' } }, + { "Encode table with numeric string key as object", + json.encode, { { ["2"] = "numeric string key test" } }, + true, { '{"2":"numeric string key test"}' } }, + { "Set encode_sparse_array(false)", + json.encode_sparse_array, { false }, true, { false, 2, 3 } }, + { "Encode table with incompatible key [throw error]", + json.encode, { { [false] = "wrong" } }, + false, { "Cannot serialise boolean: table key must be a number or string" } }, + + -- Test escaping + { "Encode all octets (8-bit clean)", + json.encode, { testdata.octets_raw }, true, { testdata.octets_escaped } }, + { "Decode all escaped octets", + json.decode, { testdata.octets_escaped }, true, { testdata.octets_raw } }, + { "Decode single UTF-16 escape", + json.decode, { [["\uF800"]] }, true, { "\239\160\128" } }, + { "Decode all UTF-16 escapes (including surrogate combinations)", + json.decode, { testdata.utf16_escaped }, true, { testdata.utf8_raw } }, + { "Decode swapped surrogate pair [throw error]", + json.decode, { [["\uDC00\uD800"]] }, + false, { "Expected value but found invalid unicode escape code at character 2" } }, + { "Decode duplicate high surrogate [throw error]", + json.decode, { [["\uDB00\uDB00"]] }, + false, { "Expected value but found invalid unicode escape code at character 2" } }, + { "Decode duplicate low surrogate [throw error]", + json.decode, { [["\uDB00\uDB00"]] }, + false, { "Expected value but found invalid unicode escape code at character 2" } }, + { "Decode missing low surrogate [throw error]", + json.decode, { [["\uDB00"]] }, + false, { "Expected value but found invalid unicode escape code at character 2" } }, + { "Decode invalid low surrogate [throw error]", + json.decode, { [["\uDB00\uD"]] }, + false, { "Expected value but found invalid unicode escape code at character 2" } }, + + -- Test locale support + -- + -- The standard Lua interpreter is ANSI C online doesn't support locales + -- by default. Force a known problematic locale to test strtod()/sprintf(). + { "Set locale to cs_CZ (comma separator)", function () + os.setlocale("cs_CZ") + json.new() + end }, + { "Encode number under comma locale", + json.encode, { 1.5 }, true, { '1.5' } }, + { "Decode number in array under comma locale", + json.decode, { '[ 10, "test" ]' }, true, { { 10, "test" } } }, + { "Revert locale to POSIX", function () + os.setlocale("C") + json.new() + end }, + + -- Test encode_keep_buffer() and enable_number_precision() + { "Set encode_keep_buffer(false)", + json.encode_keep_buffer, { false }, true, { false } }, + { "Set encode_number_precision(3)", + json.encode_number_precision, { 3 }, true, { 3 } }, + { "Encode number with precision 3", + json.encode, { 1/3 }, true, { "0.333" } }, + { "Set encode_number_precision(14)", + json.encode_number_precision, { 14 }, true, { 14 } }, + { "Set encode_keep_buffer(true)", + json.encode_keep_buffer, { true }, true, { true } }, + + -- Test config API errors + -- Function is listed as '?' due to pcall + { "Set encode_number_precision(0) [throw error]", + json.encode_number_precision, { 0 }, + false, { "bad argument #1 to '?' (expected integer between 1 and 14)" } }, + { "Set encode_number_precision(\"five\") [throw error]", + json.encode_number_precision, { "five" }, + false, { "bad argument #1 to '?' (number expected, got string)" } }, + { "Set encode_keep_buffer(nil, true) [throw error]", + json.encode_keep_buffer, { nil, true }, + false, { "bad argument #2 to '?' (found too many arguments)" } }, + { "Set encode_max_depth(\"wrong\") [throw error]", + json.encode_max_depth, { "wrong" }, + false, { "bad argument #1 to '?' (number expected, got string)" } }, + { "Set decode_max_depth(0) [throw error]", + json.decode_max_depth, { "0" }, + false, { "bad argument #1 to '?' (expected integer between 1 and 2147483647)" } }, + { "Set encode_invalid_numbers(-2) [throw error]", + json.encode_invalid_numbers, { -2 }, + false, { "bad argument #1 to '?' (invalid option '-2')" } }, + { "Set decode_invalid_numbers(true, false) [throw error]", + json.decode_invalid_numbers, { true, false }, + false, { "bad argument #2 to '?' (found too many arguments)" } }, + { "Set encode_sparse_array(\"not quite on\") [throw error]", + json.encode_sparse_array, { "not quite on" }, + false, { "bad argument #1 to '?' (invalid option 'not quite on')" } }, + + { "Reset Lua CJSON configuration", function () json = json.new() end }, + -- Wrap in a function to ensure the table returned by json.new() is used + { "Check encode_sparse_array()", + function (...) return json.encode_sparse_array(...) end, { }, + true, { false, 2, 10 } }, + + { "Encode (safe) simple value", + json_safe.encode, { true }, + true, { "true" } }, + { "Encode (safe) argument validation [throw error]", + json_safe.encode, { "arg1", "arg2" }, + false, { "bad argument #1 to '?' (expected 1 argument)" } }, + { "Decode (safe) error generation", + json_safe.decode, { "Oops" }, + true, { nil, "Expected value but found invalid token at character 1" } }, + { "Decode (safe) error generation after new()", + function(...) return json_safe.new().decode(...) end, { "Oops" }, + true, { nil, "Expected value but found invalid token at character 1" } }, +} + +print(("==> Testing Lua CJSON version %s\n"):format(json._VERSION)) + +util.run_test_group(cjson_tests) + +for _, filename in ipairs(arg) do + util.run_test("Decode cycle " .. filename, test_decode_cycle, { filename }, + true, { true }) +end + +local pass, total = util.run_test_summary() + +if pass == total then + print("==> Summary: all tests succeeded") +else + print(("==> Summary: %d/%d tests failed"):format(total - pass, total)) + os.exit(1) +end + +-- vi:ai et sw=4 ts=4: diff --git a/Assets/LuaFramework/Lua/3rd/cjson/test.lua.meta b/Assets/LuaFramework/Lua/3rd/cjson/test.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..3b517bb2efa9ce20da7e5256a6c8e2b7aebd71c5 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/cjson/test.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: f35728f49db3fec4ea33001068e13c36 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/cjson/util.lua b/Assets/LuaFramework/Lua/3rd/cjson/util.lua new file mode 100644 index 0000000000000000000000000000000000000000..6916dad04bf57748661029a09ee65a66c87294aa --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/cjson/util.lua @@ -0,0 +1,271 @@ +local json = require "cjson" + +-- Various common routines used by the Lua CJSON package +-- +-- Mark Pulford + +-- Determine with a Lua table can be treated as an array. +-- Explicitly returns "not an array" for very sparse arrays. +-- Returns: +-- -1 Not an array +-- 0 Empty table +-- >0 Highest index in the array +local function is_array(table) + local max = 0 + local count = 0 + for k, v in pairs(table) do + if type(k) == "number" then + if k > max then max = k end + count = count + 1 + else + return -1 + end + end + if max > count * 2 then + return -1 + end + + return max +end + +local serialise_value + +local function serialise_table(value, indent, depth) + local spacing, spacing2, indent2 + if indent then + spacing = "\n" .. indent + spacing2 = spacing .. " " + indent2 = indent .. " " + else + spacing, spacing2, indent2 = " ", " ", false + end + depth = depth + 1 + if depth > 50 then + return "Cannot serialise any further: too many nested tables" + end + + local max = is_array(value) + + local comma = false + local fragment = { "{" .. spacing2 } + if max > 0 then + -- Serialise array + for i = 1, max do + if comma then + table.insert(fragment, "," .. spacing2) + end + table.insert(fragment, serialise_value(value[i], indent2, depth)) + comma = true + end + elseif max < 0 then + -- Serialise table + for k, v in pairs(value) do + if comma then + table.insert(fragment, "," .. spacing2) + end + table.insert(fragment, + ("[%s] = %s"):format(serialise_value(k, indent2, depth), + serialise_value(v, indent2, depth))) + comma = true + end + end + table.insert(fragment, spacing .. "}") + + return table.concat(fragment) +end + +function serialise_value(value, indent, depth) + if indent == nil then indent = "" end + if depth == nil then depth = 0 end + + if value == json.null then + return "json.null" + elseif type(value) == "string" then + return ("%q"):format(value) + elseif type(value) == "nil" or type(value) == "number" or + type(value) == "boolean" then + return tostring(value) + elseif type(value) == "table" then + return serialise_table(value, indent, depth) + else + return "\"<" .. type(value) .. ">\"" + end +end + +local function file_load(filename) + local file + if filename == nil then + file = io.stdin + else + local err + file, err = io.open(filename, "rb") + if file == nil then + error(("Unable to read '%s': %s"):format(filename, err)) + end + end + local data = file:read("*a") + + if filename ~= nil then + file:close() + end + + if data == nil then + error("Failed to read " .. filename) + end + + return data +end + +local function file_save(filename, data) + local file + if filename == nil then + file = io.stdout + else + local err + file, err = io.open(filename, "wb") + if file == nil then + error(("Unable to write '%s': %s"):format(filename, err)) + end + end + file:write(data) + if filename ~= nil then + file:close() + end +end + +local function compare_values(val1, val2) + local type1 = type(val1) + local type2 = type(val2) + if type1 ~= type2 then + return false + end + + -- Check for NaN + if type1 == "number" and val1 ~= val1 and val2 ~= val2 then + return true + end + + if type1 ~= "table" then + return val1 == val2 + end + + -- check_keys stores all the keys that must be checked in val2 + local check_keys = {} + for k, _ in pairs(val1) do + check_keys[k] = true + end + + for k, v in pairs(val2) do + if not check_keys[k] then + return false + end + + if not compare_values(val1[k], val2[k]) then + return false + end + + check_keys[k] = nil + end + for k, _ in pairs(check_keys) do + -- Not the same if any keys from val1 were not found in val2 + return false + end + return true +end + +local test_count_pass = 0 +local test_count_total = 0 + +local function run_test_summary() + return test_count_pass, test_count_total +end + +local function run_test(testname, func, input, should_work, output) + local function status_line(name, status, value) + local statusmap = { [true] = ":success", [false] = ":error" } + if status ~= nil then + name = name .. statusmap[status] + end + print(("[%s] %s"):format(name, serialise_value(value, false))) + end + + local result = { pcall(func, unpack(input)) } + local success = table.remove(result, 1) + + local correct = false + if success == should_work and compare_values(result, output) then + correct = true + test_count_pass = test_count_pass + 1 + end + test_count_total = test_count_total + 1 + + local teststatus = { [true] = "PASS", [false] = "FAIL" } + print(("==> Test [%d] %s: %s"):format(test_count_total, testname, + teststatus[correct])) + + status_line("Input", nil, input) + if not correct then + status_line("Expected", should_work, output) + end + status_line("Received", success, result) + print() + + return correct, result +end + +local function run_test_group(tests) + local function run_helper(name, func, input) + if type(name) == "string" and #name > 0 then + print("==> " .. name) + end + -- Not a protected call, these functions should never generate errors. + func(unpack(input or {})) + print() + end + + for _, v in ipairs(tests) do + -- Run the helper if "should_work" is missing + if v[4] == nil then + run_helper(unpack(v)) + else + run_test(unpack(v)) + end + end +end + +-- Run a Lua script in a separate environment +local function run_script(script, env) + local env = env or {} + local func + + -- Use setfenv() if it exists, otherwise assume Lua 5.2 load() exists + if _G.setfenv then + func = loadstring(script) + if func then + setfenv(func, env) + end + else + func = load(script, nil, nil, env) + end + + if func == nil then + error("Invalid syntax.") + end + func() + + return env +end + +-- Export functions +return { + serialise_value = serialise_value, + file_load = file_load, + file_save = file_save, + compare_values = compare_values, + run_test_summary = run_test_summary, + run_test = run_test, + run_test_group = run_test_group, + run_script = run_script +} + +-- vi:ai et sw=4 ts=4: diff --git a/Assets/LuaFramework/Lua/3rd/cjson/util.lua.meta b/Assets/LuaFramework/Lua/3rd/cjson/util.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..ea8ef3bdc4176a9a43ed6caf9a77fb60614c515b --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/cjson/util.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: ce18eb063e6d6cb43a5db89f763dd13d +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/luabitop.meta b/Assets/LuaFramework/Lua/3rd/luabitop.meta new file mode 100644 index 0000000000000000000000000000000000000000..6c1a4d256edf2cdf39504fb6395ee58eeffc0d5a --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 5717154c47289d9449d0cc51a3f78c4b +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/Makefile b/Assets/LuaFramework/Lua/3rd/luabitop/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..71c11f19ff13d79994e1f35370009716b176055c --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/Makefile @@ -0,0 +1,53 @@ +# Makefile for Lua BitOp -- a bit operations library for Lua 5.1/5.2. +# To compile with MSVC please run: msvcbuild.bat +# To compile with MinGW please run: mingw32-make -f Makefile.mingw + +# Include path where lua.h, luaconf.h and lauxlib.h reside: +INCLUDES= -I/usr/local/include + +DEFINES= +# Use this for the old ARM ABI with swapped FPA doubles. +# Do NOT use this for modern ARM EABI with VFP or soft-float! +#DEFINES= -DSWAPPED_DOUBLE + +# Lua executable name. Used to find the install path and for testing. +LUA= lua + +CC= gcc +CCOPT= -O2 -fomit-frame-pointer +CCWARN= -Wall +SOCC= $(CC) -shared +SOCFLAGS= -fPIC $(CCOPT) $(CCWARN) $(DEFINES) $(INCLUDES) $(CFLAGS) +SOLDFLAGS= -fPIC $(LDFLAGS) +RM= rm -f +INSTALL= install -p +INSTALLPATH= $(LUA) installpath.lua + +MODNAME= bit +MODSO= $(MODNAME).so + +all: $(MODSO) + +# Alternative target for compiling on Mac OS X: +macosx: + $(MAKE) all "SOCC=MACOSX_DEPLOYMENT_TARGET=10.4 $(CC) -dynamiclib -single_module -undefined dynamic_lookup" + +$(MODNAME).o: $(MODNAME).c + $(CC) $(SOCFLAGS) -c -o $@ $< + +$(MODSO): $(MODNAME).o + $(SOCC) $(SOLDFLAGS) -o $@ $< + +install: $(MODSO) + $(INSTALL) $< `$(INSTALLPATH) $(MODNAME)` + +test: $(MODSO) + @$(LUA) bittest.lua && echo "basic test OK" + @$(LUA) nsievebits.lua && echo "nsievebits test OK" + @$(LUA) md5test.lua && echo "MD5 test OK" + +clean: + $(RM) *.o *.so *.obj *.lib *.exp *.dll *.manifest + +.PHONY: all macosx install test clean + diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/Makefile.meta b/Assets/LuaFramework/Lua/3rd/luabitop/Makefile.meta new file mode 100644 index 0000000000000000000000000000000000000000..172ec7ea903b6be2b43719b8d31c3278e2902a57 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/Makefile.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 7ef1f5e2c7f70334eb6018a524a41161 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/Makefile.mingw b/Assets/LuaFramework/Lua/3rd/luabitop/Makefile.mingw new file mode 100644 index 0000000000000000000000000000000000000000..885e30a9ff122d11ffa3417d65e6dc07730aa78e --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/Makefile.mingw @@ -0,0 +1,52 @@ +# Makefile for Lua BitOp -- a bit operations library for Lua 5.1/5.2. +# This is a modified Makefile for MinGW. C:\MinGW\bin must be in your PATH. +# Compile: mingw32-make -f Makefile.mingw +# Install: mingw32-make -f Makefile.mingw install + +# Lua executable name. Used for testing. +LUA= lua + +# Include path where lua.h, luaconf.h and lauxlib.h reside: +INCLUDES= "-I.." + +# Path of lua51.dll: +LUADLLPATH= "..\lua51.dll" + +# Path where C modules for Lua should be installed: +LUACMODPATH= ".." + +CC= gcc +CCOPT= -O2 -fomit-frame-pointer +CCWARN = -Wall +SOCC= $(CC) -shared +SOCFLAGS= $(CCOPT) $(CCWARN) $(INCLUDES) $(CFLAGS) +SOLDFLAGS= $(LDFLAGS) +RM= del +STRIP= strip --strip-unneeded +INSTALL= copy + +MODNAME= bit +MODSO= $(MODNAME).dll + +all: $(MODSO) + +$(MODNAME).o: $(MODNAME).c + $(CC) $(SOCFLAGS) -c -o $@ $< + +$(MODSO): $(MODNAME).o + $(SOCC) $(SOLDFLAGS) -o $@ $< $(LUADLLPATH) + $(STRIP) $@ + +install: $(MODSO) + $(INSTALL) $< $(LUACMODPATH) + +test: $(MODSO) + @$(LUA) bittest.lua && echo "basic test OK" + @$(LUA) nsievebits.lua && echo "nsievebits test OK" + @$(LUA) md5test.lua && echo "MD5 test OK" + +clean: + $(RM) *.o *.so *.obj *.lib *.exp *.dll *.manifest + +.PHONY: all install test clean + diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/Makefile.mingw.meta b/Assets/LuaFramework/Lua/3rd/luabitop/Makefile.mingw.meta new file mode 100644 index 0000000000000000000000000000000000000000..08e0fbd503e2f276353b6155bed3c9f0d3a33652 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/Makefile.mingw.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 31646aa6f0dd23c4bbb00c75c25256b8 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/README b/Assets/LuaFramework/Lua/3rd/luabitop/README new file mode 100644 index 0000000000000000000000000000000000000000..bb9d4f07e25c6dfdfbe4d48374bca13e2d1b6850 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/README @@ -0,0 +1,22 @@ +README for Lua BitOp 1.0.2 +-------------------------- + +Lua BitOp is a C extension module for Lua 5.1/5.2 which adds +bitwise operations on numbers. + +Homepage: http://bitop.luajit.org/ + +Lua BitOp is Copyright (C) 2008-2012 Mike Pall. +Lua BitOp is free software, released under the MIT license. + +-------------------------- + +Full documentation for Lua BitOp is available in HTML format. +Please point your favourite browser to: + + doc/index.html + +Detailed installation instructions are here: + + doc/install.html + diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/README.meta b/Assets/LuaFramework/Lua/3rd/luabitop/README.meta new file mode 100644 index 0000000000000000000000000000000000000000..e259890b6da61a0b53fa7d9a9c1abc0bb69772de --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/README.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 2848b492482529244bd0d3cae9d98889 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/bitbench.lua b/Assets/LuaFramework/Lua/3rd/luabitop/bitbench.lua new file mode 100644 index 0000000000000000000000000000000000000000..247c362ac3a3826cecebe8f4682659550e9a73ff --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/bitbench.lua @@ -0,0 +1,69 @@ +-- Microbenchmark for bit operations library. Public domain. + +local bit = require"bit" + +if not bit.rol then -- Replacement function if rotates are missing. + local bor, shl, shr = bit.bor, bit.lshift, bit.rshift + function bit.rol(a, b) return bor(shl(a, b), shr(a, 32-b)) end +end + +if not bit.bswap then -- Replacement function if bswap is missing. + local bor, band, shl, shr = bit.bor, bit.band, bit.lshift, bit.rshift + function bit.bswap(a) + return bor(shr(a, 24), band(shr(a, 8), 0xff00), + shl(band(a, 0xff00), 8), shl(a, 24)); + end +end + +local base = 0 + +local function bench(name, t) + local n = 2000000 + repeat + local tm = os.clock() + t(n) + tm = os.clock() - tm + if tm > 1 then + local ns = tm*1000/(n/1000000) + io.write(string.format("%-15s %6.1f ns\n", name, ns-base)) + return ns + end + n = n + n + until false +end + +-- The overhead for the base loop is subtracted from the other measurements. +base = bench("loop baseline", function(n) + local x = 0; for i=1,n do x = x + i end +end) + +bench("tobit", function(n) + local f = bit.tobit or bit.cast + local x = 0; for i=1,n do x = x + f(i) end +end) + +bench("bnot", function(n) + local f = bit.bnot + local x = 0; for i=1,n do x = x + f(i) end +end) + +bench("bor/band/bxor", function(n) + local f = bit.bor + local x = 0; for i=1,n do x = x + f(i, 1) end +end) + +bench("shifts", function(n) + local f = bit.lshift + local x = 0; for i=1,n do x = x + f(i, 1) end +end) + +bench("rotates", function(n) + local f = bit.rol + local x = 0; for i=1,n do x = x + f(i, 1) end +end) + +bench("bswap", function(n) + local f = bit.bswap + local x = 0; for i=1,n do x = x + f(i) end +end) + diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/bitbench.lua.meta b/Assets/LuaFramework/Lua/3rd/luabitop/bitbench.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..44bc0e2afe5d7f377ce3f46369439401fb2ce2bc --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/bitbench.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 8a0b5a88625014c48a99057dda7923c5 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/bittest.lua b/Assets/LuaFramework/Lua/3rd/luabitop/bittest.lua new file mode 100644 index 0000000000000000000000000000000000000000..a642c2fa7355b6129287a8235736887c3ad47a88 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/bittest.lua @@ -0,0 +1,85 @@ +-- Test cases for bit operations library. Public domain. + +local bit = require"bit" + +local vb = { + 0, 1, -1, 2, -2, 0x12345678, 0x87654321, + 0x33333333, 0x77777777, 0x55aa55aa, 0xaa55aa55, + 0x7fffffff, 0x80000000, 0xffffffff +} + +local function cksum(name, s, r) + local z = 0 + for i=1,#s do z = (z + string.byte(s, i)*i) % 2147483629 end + if z ~= r then + error("bit."..name.." test failed (got "..z..", expected "..r..")", 0) + end +end + +local function check_unop(name, r) + local f = bit[name] + local s = "" + if pcall(f) or pcall(f, "z") or pcall(f, true) then + error("bit."..name.." fails to detect argument errors", 0) + end + for _,x in ipairs(vb) do s = s..","..tostring(f(x)) end + cksum(name, s, r) +end + +local function check_binop(name, r) + local f = bit[name] + local s = "" + if pcall(f) or pcall(f, "z") or pcall(f, true) then + error("bit."..name.." fails to detect argument errors", 0) + end + for _,x in ipairs(vb) do + for _,y in ipairs(vb) do s = s..","..tostring(f(x, y)) end + end + cksum(name, s, r) +end + +local function check_binop_range(name, r, yb, ye) + local f = bit[name] + local s = "" + if pcall(f) or pcall(f, "z") or pcall(f, true) or pcall(f, 1, true) then + error("bit."..name.." fails to detect argument errors", 0) + end + for _,x in ipairs(vb) do + for y=yb,ye do s = s..","..tostring(f(x, y)) end + end + cksum(name, s, r) +end + +local function check_shift(name, r) + check_binop_range(name, r, 0, 31) +end + +-- Minimal sanity checks. +assert(0x7fffffff == 2147483647, "broken hex literals") +assert(0xffffffff == -1 or 0xffffffff == 2^32-1, "broken hex literals") +assert(tostring(-1) == "-1", "broken tostring()") +assert(tostring(0xffffffff) == "-1" or tostring(0xffffffff) == "4294967295", "broken tostring()") + +-- Basic argument processing. +assert(bit.tobit(1) == 1) +assert(bit.band(1) == 1) +assert(bit.bxor(1,2) == 3) +assert(bit.bor(1,2,4,8,16,32,64,128) == 255) + +-- Apply operations to test vectors and compare checksums. +check_unop("tobit", 277312) +check_unop("bnot", 287870) +check_unop("bswap", 307611) + +check_binop("band", 41206764) +check_binop("bor", 51253663) +check_binop("bxor", 79322427) + +check_shift("lshift", 325260344) +check_shift("rshift", 139061800) +check_shift("arshift", 111364720) +check_shift("rol", 302401155) +check_shift("ror", 302316761) + +check_binop_range("tohex", 47880306, -8, 8) + diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/bittest.lua.meta b/Assets/LuaFramework/Lua/3rd/luabitop/bittest.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..e13ac64955a50f4fc7b04fc0b1336031b5d07a61 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/bittest.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 32f558c2109e12a41b2d1f1400e82a66 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/doc.meta b/Assets/LuaFramework/Lua/3rd/luabitop/doc.meta new file mode 100644 index 0000000000000000000000000000000000000000..1de6561e86b04ccecf01fb0e86d04a58ef677ca4 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/doc.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: a5fc982400798c4408b1bdc7357335f7 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/doc/api.html b/Assets/LuaFramework/Lua/3rd/luabitop/doc/api.html new file mode 100644 index 0000000000000000000000000000000000000000..db63460f5bbd6d7b446f0cf836cf51d89f6b69d3 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/doc/api.html @@ -0,0 +1,337 @@ + + + +API Functions + + + + + + + + +
+Bit +
+ + +
+

+This list of API functions is not intended to replace a tutorial. +If you are not familiar with the terms used, you may want to study the +» Wikipedia +article on bitwise operations first. +

+

Loading the BitOp Module

+

+The suggested way to use the BitOp module is to add the following +to the start of every Lua file that needs one of its functions: +

+
+local bit = require("bit")
+
+

+This makes the dependency explicit, limits the scope to the current file +and provides faster access to the bit.* functions, too. +It's good programming practice not to rely on the global variable +bit being set (assuming some other part of your application +has already loaded the module). The require function ensures +the module is only loaded once, in any case. +

+

Defining Shortcuts

+

+It's a common (but not a required) practice to cache often used module +functions in locals. This serves as a shortcut to save some typing +and also speeds up resolving them (only relevant if called hundreds of +thousands of times). +

+
+local bnot = bit.bnot
+local band, bor, bxor = bit.band, bit.bor, bit.bxor
+local lshift, rshift, rol = bit.lshift, bit.rshift, bit.rol
+-- etc...
+
+-- Example use of the shortcuts:
+local function tr_i(a, b, c, d, x, s)
+  return rol(bxor(c, bor(b, bnot(d))) + a + x, s) + b
+end
+
+

+Remember that and, or and not +are reserved keywords in Lua. They cannot be used for variable names or +literal field names. That's why the corresponding bitwise functions have +been named band, bor, and bnot +(and bxor for consistency). +

+While we are at it: a common pitfall is to use bit as the +name of a local temporary variable — well, don't! :-) +

+

About the Examples

+

+The examples below show small Lua one-liners. Their expected output +is shown after -->. This is interpreted as a comment marker +by Lua so you can cut & paste the whole line to a Lua prompt +and experiment with it. +

+

+Note that all bit operations return signed 32 bit numbers +(rationale). And these print +as signed decimal numbers by default. +

+

+For clarity the examples assume the definition of a helper function +printx(). This prints its argument as an unsigned +32 bit hexadecimal number on all platforms: +

+
+function printx(x)
+  print("0x"..bit.tohex(x))
+end
+
+ +

Bit Operations

+

y = bit.tobit(x)

+

+Normalizes a number to the numeric range for bit operations and returns it. +This function is usually not needed since all bit operations already +normalize all of their input arguments. Check the +operational semantics for details. +

+
+print(0xffffffff)                --> 4294967295 (*)
+print(bit.tobit(0xffffffff))     --> -1
+printx(bit.tobit(0xffffffff))    --> 0xffffffff
+print(bit.tobit(0xffffffff + 1)) --> 0
+print(bit.tobit(2^40 + 1234))    --> 1234
+
+

+(*) See the treatment of hex literals +for an explanation why the printed numbers in the first two lines +differ (if your Lua installation uses a double number type). +

+ +

y = bit.tohex(x [,n])

+

+Converts its first argument to a hex string. The number of hex digits is +given by the absolute value of the optional second argument. Positive +numbers between 1 and 8 generate lowercase hex digits. Negative numbers +generate uppercase hex digits. Only the least-significant 4*|n| bits are +used. The default is to generate 8 lowercase hex digits. +

+
+print(bit.tohex(1))              --> 00000001
+print(bit.tohex(-1))             --> ffffffff
+print(bit.tohex(0xffffffff))     --> ffffffff
+print(bit.tohex(-1, -8))         --> FFFFFFFF
+print(bit.tohex(0x21, 4))        --> 0021
+print(bit.tohex(0x87654321, 4))  --> 4321
+
+ +

y = bit.bnot(x)

+

+Returns the bitwise not of its argument. +

+
+print(bit.bnot(0))            --> -1
+printx(bit.bnot(0))           --> 0xffffffff
+print(bit.bnot(-1))           --> 0
+print(bit.bnot(0xffffffff))   --> 0
+printx(bit.bnot(0x12345678))  --> 0xedcba987
+
+ +

y = bit.bor(x1 [,x2...])
+y = bit.band(x1 [,x2...])
+y = bit.bxor(x1 [,x2...])

+

+Returns either the bitwise or, bitwise and, +or bitwise xor of all of its arguments. +Note that more than two arguments are allowed. +

+
+print(bit.bor(1, 2, 4, 8))                --> 15
+printx(bit.band(0x12345678, 0xff))        --> 0x00000078
+printx(bit.bxor(0xa5a5f0f0, 0xaa55ff00))  --> 0x0ff00ff0
+
+ +

y = bit.lshift(x, n)
+y = bit.rshift(x, n)
+y = bit.arshift(x, n)

+

+Returns either the bitwise logical left-shift, +bitwise logical right-shift, or bitwise arithmetic right-shift +of its first argument by the number of bits given by the second argument. +

+

+Logical shifts treat the first argument as an unsigned number and shift in +0-bits. Arithmetic right-shift treats the most-significant bit +as a sign bit and replicates it.
+Only the lower 5 bits of the shift count are used +(reduces to the range [0..31]). +

+
+print(bit.lshift(1, 0))              --> 1
+print(bit.lshift(1, 8))              --> 256
+print(bit.lshift(1, 40))             --> 256
+print(bit.rshift(256, 8))            --> 1
+print(bit.rshift(-256, 8))           --> 16777215
+print(bit.arshift(256, 8))           --> 1
+print(bit.arshift(-256, 8))          --> -1
+printx(bit.lshift(0x87654321, 12))   --> 0x54321000
+printx(bit.rshift(0x87654321, 12))   --> 0x00087654
+printx(bit.arshift(0x87654321, 12))  --> 0xfff87654
+
+ +

y = bit.rol(x, n)
+y = bit.ror(x, n)

+

+Returns either the bitwise left rotation, +or bitwise right rotation of its first argument by the +number of bits given by the second argument. +Bits shifted out on one side are shifted back in on the other side.
+Only the lower 5 bits of the rotate count are used +(reduces to the range [0..31]). +

+
+printx(bit.rol(0x12345678, 12))   --> 0x45678123
+printx(bit.ror(0x12345678, 12))   --> 0x67812345
+
+ +

y = bit.bswap(x)

+

+Swaps the bytes of its argument and returns it. This can be used +to convert little-endian 32 bit numbers to big-endian 32 bit +numbers or vice versa. +

+
+printx(bit.bswap(0x12345678)) --> 0x78563412
+printx(bit.bswap(0x78563412)) --> 0x12345678
+
+ +

Example Program

+

+This is an implementation of the (naïve) Sieve of Eratosthenes +algorithm. It counts the number of primes up to some maximum number. +

+

+A Lua table is used to hold a bit-vector. Every array index has +32 bits of the vector. Bitwise operations are used to access and +modify them. Note that the shift counts don't need to be masked +since this is already done by the BitOp shift and rotate functions. +

+
+local bit = require("bit")
+local band, bxor = bit.band, bit.bxor
+local rshift, rol = bit.rshift, bit.rol
+
+local m = tonumber(arg and arg[1]) or 100000
+if m < 2 then m = 2 end
+local count = 0
+local p = {}
+
+for i=0,(m+31)/32 do p[i] = -1 end
+
+for i=2,m do
+  if band(rshift(p[rshift(i, 5)], i), 1) ~= 0 then
+    count = count + 1
+    for j=i+i,m,i do
+      local jx = rshift(j, 5)
+      p[jx] = band(p[jx], rol(-2, j))
+    end
+  end
+end
+
+io.write(string.format("Found %d primes up to %d\n", count, m))
+
+

+Lua BitOp is quite fast. This program runs in less than +90 milliseconds on a 3 GHz CPU with a standard Lua installation, +but performs more than a million calls to bitwise functions. +If you're looking for even more speed, +check out » LuaJIT. +

+ +

Caveats

+

Signed Results

+

+Returning signed numbers from bitwise operations may be surprising to +programmers coming from other programming languages which have both +signed and unsigned types. But as long as you treat the results of +bitwise operations uniformly everywhere, this shouldn't cause any problems. +

+

+Preferably format results with bit.tohex if you want a +reliable unsigned string representation. Avoid the "%x" or +"%u" formats for string.format. They fail on some +architectures for negative numbers and can return more than 8 hex digits +on others. +

+

+You may also want to avoid the default number to string coercion, +since this is a signed conversion. +The coercion is used for string concatenation and all standard library +functions which accept string arguments (such as print() or +io.write()). +

+

Conditionals

+

+If you're transcribing some code from C/C++, watch out for +bit operations in conditionals. In C/C++ any non-zero value +is implicitly considered as "true". E.g. this C code:
+  if (x & 3) ...
+must not be turned into this Lua code:
+  if band(x, 3) then ... -- wrong! +

+

+In Lua all objects except nil and false are +considered "true". This includes all numbers. An explicit comparison +against zero is required in this case:
+  if band(x, 3) ~= 0 then ... -- correct! +

+

Comparing Against Hex Literals

+

+Comparing the results of bitwise operations (signed numbers) +against hex literals (unsigned numbers) needs some additional care. +The following conditional expression may or may not work right, +depending on the platform you run it on:
+  bit.bor(x, 1) == 0xffffffff
+E.g. it's never true on a Lua installation with the default number type. +Some simple solutions: +

+
    +
  • Either never use hex literals larger than 0x7fffffff in comparisons:
    +  bit.bor(x, 1) == -1
  • +
  • Or convert them with bit.tobit() before comparing:
    +  bit.bor(x, 1) == bit.tobit(0xffffffff)
  • +
  • Or use a generic workaround with bit.bxor():
    +  bit.bxor(bit.bor(x, 1), 0xffffffff) == 0
  • +
  • Or use a case-specific workaround:
    +  bit.rshift(x, 1) == 0x7fffffff
  • +
+
+
+ + + diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/doc/api.html.meta b/Assets/LuaFramework/Lua/3rd/luabitop/doc/api.html.meta new file mode 100644 index 0000000000000000000000000000000000000000..b5b22ffc82f6a927d75c0768ca08a46aa67adfdb --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/doc/api.html.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 6e176ba8ca8fc7645bfbc4d53009a5a9 +TextScriptImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/doc/bluequad-print.css b/Assets/LuaFramework/Lua/3rd/luabitop/doc/bluequad-print.css new file mode 100644 index 0000000000000000000000000000000000000000..16a6a72a304fc2a7d72c2df58d3dd55c0b922297 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/doc/bluequad-print.css @@ -0,0 +1,166 @@ +/* Copyright (C) 2004-2012 Mike Pall. + * + * You are welcome to use the general ideas of this design for your own sites. + * But please do not steal the stylesheet, the layout or the color scheme. + */ +body { + font-family: serif; + font-size: 11pt; + margin: 0 3em; + padding: 0; + border: none; +} +a:link, a:visited, a:hover, a:active { + text-decoration: none; + background: transparent; + color: #0000ff; +} +h1, h2, h3 { + font-family: sans-serif; + font-weight: bold; + text-align: left; + margin: 0.5em 0; + padding: 0; +} +h1 { + font-size: 200%; +} +h2 { + font-size: 150%; +} +h3 { + font-size: 125%; +} +p { + margin: 0 0 0.5em 0; + padding: 0; +} +ul, ol { + margin: 0.5em 0; + padding: 0 0 0 2em; +} +ul { + list-style: outside square; +} +ol { + list-style: outside decimal; +} +li { + margin: 0; + padding: 0; +} +dl { + margin: 1em 0; + padding: 1em; + border: 1px solid black; +} +dt { + font-weight: bold; + margin: 0; + padding: 0; +} +dt sup { + float: right; + margin-left: 1em; +} +dd { + margin: 0.5em 0 0 2em; + padding: 0; +} +table { + table-layout: fixed; + width: 100%; + margin: 1em 0; + padding: 0; + border: 1px solid black; + border-spacing: 0; + border-collapse: collapse; +} +tr { + margin: 0; + padding: 0; + border: none; +} +td { + text-align: left; + margin: 0; + padding: 0.2em 0.5em; + border-top: 1px solid black; + border-bottom: 1px solid black; +} +tr.separate td { + border-top: double; +} +tt, pre, code, kbd, samp { + font-family: monospace; + font-size: 75%; +} +kbd { + font-weight: bolder; +} +blockquote, pre { + margin: 1em 2em; + padding: 0; +} +img { + border: none; + vertical-align: baseline; + margin: 0; + padding: 0; +} +img.left { + float: left; + margin: 0.5em 1em 0.5em 0; +} +img.right { + float: right; + margin: 0.5em 0 0.5em 1em; +} +.flush { + clear: both; + visibility: hidden; +} +.hide, .noprint, #nav { + display: none !important; +} +.pagebreak { + page-break-before: always; +} +#site { + text-align: right; + font-family: sans-serif; + font-weight: bold; + margin: 0 1em; + border-bottom: 1pt solid black; +} +#site a { + font-size: 1.2em; +} +#site a:link, #site a:visited { + text-decoration: none; + font-weight: bold; + background: transparent; + color: #ffffff; +} +#logo { + color: #ff8000; +} +#head { + clear: both; + margin: 0 1em; +} +#main { + line-height: 1.3; + text-align: justify; + margin: 1em; +} +#foot { + clear: both; + font-size: 80%; + text-align: center; + margin: 0 1.25em; + padding: 0.5em 0 0 0; + border-top: 1pt solid black; + page-break-before: avoid; + page-break-after: avoid; +} diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/doc/bluequad-print.css.meta b/Assets/LuaFramework/Lua/3rd/luabitop/doc/bluequad-print.css.meta new file mode 100644 index 0000000000000000000000000000000000000000..0191a725c44b6e295a90544181be02cf2121b7c4 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/doc/bluequad-print.css.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: ac6cad9836ef2aa42be0d44fe67cce1d +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/doc/bluequad.css b/Assets/LuaFramework/Lua/3rd/luabitop/doc/bluequad.css new file mode 100644 index 0000000000000000000000000000000000000000..27cd410a5821281ca71dc7ea666a295a773ab34b --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/doc/bluequad.css @@ -0,0 +1,299 @@ +/* Copyright (C) 2004-2012 Mike Pall. + * + * You are welcome to use the general ideas of this design for your own sites. + * But please do not steal the stylesheet, the layout or the color scheme. + */ +/* colorscheme: + * + * site | head #4162bf/white | #6078bf/#e6ecff + * ------+------ ----------------+------------------- + * nav | main #bfcfff | #e6ecff/black + * + * nav: hiback loback #c5d5ff #b9c9f9 + * hiborder loborder #e6ecff #97a7d7 + * link hover #2142bf #ff0000 + * + * link: link visited hover #2142bf #8122bf #ff0000 + * + * main: boxback boxborder #f0f4ff #bfcfff + */ +body { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 10pt; + margin: 0; + padding: 0; + border: none; + background: #e0e0e0; + color: #000000; +} +a:link { + text-decoration: none; + background: transparent; + color: #2142bf; +} +a:visited { + text-decoration: none; + background: transparent; + color: #8122bf; +} +a:hover, a:active { + text-decoration: underline; + background: transparent; + color: #ff0000; +} +h1, h2, h3 { + font-weight: bold; + text-align: left; + margin: 0.5em 0; + padding: 0; + background: transparent; +} +h1 { + font-size: 200%; + line-height: 3em; /* really 6em relative to body, match #site span */ + margin: 0; +} +h2 { + font-size: 150%; + color: #606060; +} +h3 { + font-size: 125%; + color: #404040; +} +p { + max-width: 600px; + margin: 0 0 0.5em 0; + padding: 0; +} +ul, ol { + max-width: 600px; + margin: 0.5em 0; + padding: 0 0 0 2em; +} +ul { + list-style: outside square; +} +ol { + list-style: outside decimal; +} +li { + margin: 0; + padding: 0; +} +dl { + max-width: 600px; + margin: 1em 0; + padding: 1em; + border: 1px solid #bfcfff; + background: #f0f4ff; +} +dt { + font-weight: bold; + margin: 0; + padding: 0; +} +dt sup { + float: right; + margin-left: 1em; + color: #808080; +} +dt a:visited { + text-decoration: none; + color: #2142bf; +} +dt a:hover, dt a:active { + text-decoration: none; + color: #ff0000; +} +dd { + margin: 0.5em 0 0 2em; + padding: 0; +} +div.tablewrap { /* for IE *sigh* */ + max-width: 600px; +} +table { + table-layout: fixed; + border-spacing: 0; + border-collapse: collapse; + max-width: 600px; + width: 100%; + margin: 1em 0; + padding: 0; + border: 1px solid #bfcfff; +} +tr { + margin: 0; + padding: 0; + border: none; +} +tr.odd { + background: #f0f4ff; +} +tr.separate td { + border-top: 1px solid #bfcfff; +} +td { + text-align: left; + margin: 0; + padding: 0.2em 0.5em; + border: none; +} +tt, code, kbd, samp { + font-family: Courier New, Courier, monospace; + font-size: 110%; +} +kbd { + font-weight: bolder; +} +blockquote, pre { + max-width: 600px; + margin: 1em 2em; + padding: 0; +} +pre { + line-height: 1.1; +} +pre.code { + line-height: 1.4; + margin: 0.5em 0 1em 0.5em; + padding: 0.5em 1em; + border: 1px solid #bfcfff; + background: #f0f4ff; +} +img { + border: none; + vertical-align: baseline; + margin: 0; + padding: 0; +} +img.left { + float: left; + margin: 0.5em 1em 0.5em 0; +} +img.right { + float: right; + margin: 0.5em 0 0.5em 1em; +} +.indent { + padding-left: 1em; +} +.flush { + clear: both; + visibility: hidden; +} +.hide, .noscreen { + display: none !important; +} +.ext { + color: #ff8000; +} +#site { + clear: both; + float: left; + width: 13em; + text-align: center; + font-weight: bold; + margin: 0; + padding: 0; + background: transparent; + color: #ffffff; +} +#site a { + font-size: 200%; +} +#site a:link, #site a:visited { + text-decoration: none; + font-weight: bold; + background: transparent; + color: #ffffff; +} +#site span { + line-height: 3em; /* really 6em relative to body, match h1 */ +} +#logo { + color: #ffb380; +} +#head { + margin: 0; + padding: 0 0 0 2em; + border-left: solid 13em #4162bf; + border-right: solid 3em #6078bf; + background: #6078bf; + color: #e6ecff; +} +#nav { + clear: both; + float: left; + overflow: hidden; + text-align: left; + line-height: 1.5; + width: 13em; + padding-top: 1em; + background: transparent; +} +#nav ul { + list-style: none outside; + margin: 0; + padding: 0; +} +#nav li { + margin: 0; + padding: 0; +} +#nav a { + display: block; + text-decoration: none; + font-weight: bold; + margin: 0; + padding: 2px 1em; + border-top: 1px solid transparent; + border-bottom: 1px solid transparent; + background: transparent; + color: #2142bf; +} +#nav a:hover, #nav a:active { + text-decoration: none; + border-top: 1px solid #97a7d7; + border-bottom: 1px solid #e6ecff; + background: #b9c9f9; + color: #ff0000; +} +#nav a.current, #nav a.current:hover, #nav a.current:active { + border-top: 1px solid #e6ecff; + border-bottom: 1px solid #97a7d7; + background: #c5d5ff; + color: #2142bf; +} +#nav ul ul a { + padding: 0 1em 0 2em; +} +#main { + line-height: 1.5; + text-align: left; + margin: 0; + padding: 1em 2em; + border-left: solid 13em #bfcfff; + border-right: solid 3em #e6ecff; + background: #e6ecff; +} +#foot { + clear: both; + font-size: 80%; + text-align: center; + margin: 0; + padding: 0.5em; + background: #6078bf; + color: #ffffff; +} +#foot a:link, #foot a:visited { + text-decoration: underline; + background: transparent; + color: #ffffff; +} +#foot a:hover, #foot a:active { + text-decoration: underline; + background: transparent; + color: #bfcfff; +} diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/doc/bluequad.css.meta b/Assets/LuaFramework/Lua/3rd/luabitop/doc/bluequad.css.meta new file mode 100644 index 0000000000000000000000000000000000000000..9af51ac16784e062a75513ff62e2c9a901762b9e --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/doc/bluequad.css.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 51d1ba26d50c47e44b78257d90398dee +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/doc/changes.html b/Assets/LuaFramework/Lua/3rd/luabitop/doc/changes.html new file mode 100644 index 0000000000000000000000000000000000000000..d34f5cfae187a0377f7898197de7bfc7a4560ebd --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/doc/changes.html @@ -0,0 +1,73 @@ + + + +Change History + + + + + + + + +
+Bit +
+ + +
+

+This is a list of changes between the released versions of Lua BitOp. +The current release is Lua BitOp 1.0.2. +

+

+Please check the +» Online Change History +to see whether newer versions are available. +

+ +

Lua BitOp 1.0.2 — 2012-05-08

+
    +
  • Add Lua 5.2 compatibility.
  • +
+ +

Lua BitOp 1.0.1 — 2009-01-06

+
    +
  • Add bit.tohex for portable conversion of results +to hexadecimal strings.
  • +
  • Add missing LUA_LIB define.
  • +
  • Self-test checks for arithmetic right-shift semantics.
  • +
+ +

Lua BitOp 1.0.0 — 2008-12-17

+
    +
  • Initial public release.
  • +
+
+
+ + + diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/doc/changes.html.meta b/Assets/LuaFramework/Lua/3rd/luabitop/doc/changes.html.meta new file mode 100644 index 0000000000000000000000000000000000000000..1a2d2355a70812fcf25f555733e02a0e4fbe8a7e --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/doc/changes.html.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 5c0ff59da8ad6f44e99e685a3cb5c627 +TextScriptImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/doc/contact.html b/Assets/LuaFramework/Lua/3rd/luabitop/doc/contact.html new file mode 100644 index 0000000000000000000000000000000000000000..4cf84fa21cafdb2e7a4c76181e0b0aa783524527 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/doc/contact.html @@ -0,0 +1,78 @@ + + + +Contact + + + + + + + + +
+Bit +
+ + +
+

+Please send general questions to the +» Lua mailing list. +You can also send any questions you have directly to me: +

+ + + + + +

Copyright

+

+All documentation is +Copyright © 2005-2012 Mike Pall. +

+ + +
+
+ + + diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/doc/contact.html.meta b/Assets/LuaFramework/Lua/3rd/luabitop/doc/contact.html.meta new file mode 100644 index 0000000000000000000000000000000000000000..dd28ff2d41b53bb2359c5a3903c6def92e211829 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/doc/contact.html.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: d072c05c6fff47c47914b40192195e70 +TextScriptImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/doc/img.meta b/Assets/LuaFramework/Lua/3rd/luabitop/doc/img.meta new file mode 100644 index 0000000000000000000000000000000000000000..2038221d0e6b23647d97545bff93aec6cfc0cc13 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/doc/img.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 213a8412fa244f242b54a3383902415e +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/doc/img/contact.png b/Assets/LuaFramework/Lua/3rd/luabitop/doc/img/contact.png new file mode 100644 index 0000000000000000000000000000000000000000..c8a92096c722326c757d7143ecb8345669812d86 Binary files /dev/null and b/Assets/LuaFramework/Lua/3rd/luabitop/doc/img/contact.png differ diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/doc/img/contact.png.meta b/Assets/LuaFramework/Lua/3rd/luabitop/doc/img/contact.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..d159dd466ae789745349eefac3830cd3aaf06c78 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/doc/img/contact.png.meta @@ -0,0 +1,47 @@ +fileFormatVersion: 2 +guid: b4c87245cd1e43d46841ae1248659b8e +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/doc/index.html b/Assets/LuaFramework/Lua/3rd/luabitop/doc/index.html new file mode 100644 index 0000000000000000000000000000000000000000..f4830308174ffa82ba4b08bb02af629855b6bb4a --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/doc/index.html @@ -0,0 +1,87 @@ + + + +Lua Bit Operations Module + + + + + + + + +
+Bit +
+ + +
+

+Lua BitOp is a C extension module for Lua 5.1/5.2 +which adds bitwise operations on numbers. +

+

+Lua BitOp is Copyright © 2008-2012 Mike Pall. +Lua BitOp is free software, released under the +» MIT license +(same license as the Lua core). +

+

Features

+
    +
  • Supported functions: +bit.tobit, bit.tohex, bit.bnot, bit.band, bit.bor, bit.bxor, +bit.lshift, bit.rshift, bit.arshift, bit.rol, bit.ror, bit.bswap
  • +
  • Consistent semantics +across 16, 32 and 64 bit platforms.
  • +
  • Supports different lua_Number types: +either IEEE 754 doubles, int32_t or int64_t.
  • +
  • Runs on Linux, *BSD, Mac OS X, Windows and probably anything else +you can find.
  • +
  • Simple installation on all systems. +No bulky configure scripts. Embedded-systems-friendly.
  • +
  • Internal self-test on startup to detect miscompiles. +Includes a comprehensive test and benchmark suite.
  • +
  • Compatible with the built-in bitwise operations in +» LuaJIT 2.0.
  • +
  • It's as fast as you can get with the standard Lua/C API.
  • +
+ +

More ...

+

+Please click on one of the links in the navigation bar to your left +to learn more. +

+ +

+Click on the Logo in the upper left corner to visit +the Lua BitOp project page on the web. All other links to online +resources are marked with a '»'. +

+
+
+ + + diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/doc/index.html.meta b/Assets/LuaFramework/Lua/3rd/luabitop/doc/index.html.meta new file mode 100644 index 0000000000000000000000000000000000000000..591c2cf7a6bead300e80f6f055de17623dd5a5ec --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/doc/index.html.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 5503712ff1277d54b93febdc6208b110 +TextScriptImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/doc/install.html b/Assets/LuaFramework/Lua/3rd/luabitop/doc/install.html new file mode 100644 index 0000000000000000000000000000000000000000..d57ea87c4b0454802045d1f98d1ae81e170a2817 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/doc/install.html @@ -0,0 +1,238 @@ + + + +Installation + + + + + + + + +
+Bit +
+ + +
+

+This page explains how to build Lua BitOp from source, against an +existing Lua installation. If you've installed Lua using a package manager +(e.g. as part of a Linux distribution), you're advised to check for +a pre-built package of Lua BitOp and install this instead. +

+

Prerequisites

+

+To compile Lua BitOp, your Lua 5.1/5.2 installation must include all development +files (e.g. include files). If you've installed Lua from source, you +already have them (e.g. in /usr/local/include on POSIX systems). +

+

+If you've installed Lua using a package manager, you may need to install +an extra Lua development package (e.g. liblua5.1-dev on +Debian/Ubuntu). +

+

+Probably any current C compiler which can compile Lua also works for +Lua BitOp. The C99 <stdint.h> include file is mandatory, +but the source contains a workaround for MSVC. +

+

+Lua is by default configured to use double as its number type. +Lua BitOp supports IEEE 754 doubles or alternative configurations +with int32_t or int64_t (suitable for embedded systems without +floating-point hardware). The float number type is not supported. +

+

Configuration

+

+You may need to modify the build scripts and change the paths to +the Lua development files or some compiler flags. Check the start of +Makefile (POSIX), Makefile.mingw (MinGW on Windows) +or msvcbuild.bat (MSVC on Windows) and follow the instructions +in the comments. +

+

+E.g. the Lua 5.1 include files are located in /usr/include/lua5.1, +if you've installed the Debian/Ubuntu Lua development package. +

+

Build & Install

+

+After » downloading Lua BitOp, +unpack the distribution file, open a terminal/command window, +change into the newly created directory and follow the instructions below. +

+

Linux, *BSD, Mac OS X

+

+For Linux, *BSD and most other POSIX systems just run: +

+
+make
+
+

+For Mac OS X you need to run this instead: +

+
+make macosx
+
+

+You probably need to be the root user to install the resulting bit.so +into the C module directory for your current Lua installation. +Most systems provide sudo, so you can run: +

+
+sudo make install
+
+

MinGW on Windows

+

+Start a command prompt and make sure the MinGW tools are in your PATH. +Then run: +

+
+mingw32-make -f Makefile.mingw
+
+

+If you've adjusted the path where C modules for Lua should be installed, +you can run: +

+
+mingw32-make -f Makefile.mingw install
+
+

+Otherwise just copy the file bit.dll to the appropriate directory. +By default this is the same directory where lua.exe resides. +

+

MSVC on Windows

+

+Open a "Visual Studio .NET Command Prompt", change to the directory +where msvcbuild.bat resides and run it: +

+
+msvcbuild
+
+

+If the file bit.dll has been successfully built, copy it +to the directory where C modules for your Lua installation are installed. +By default this is the same directory where lua.exe resides. +

+

Embedding Lua BitOp

+

+If you're embedding Lua into your application, it's quite simple to +add Lua BitOp as a static module: +

+

+1. Copy the file bit.c from the Lua BitOp distribution +to your Lua source code directory. +

+

+2. Add this file to your build script (e.g. modify the Makefile) or +import it as a build dependency in your IDE. +

+

+3. Edit lualib.h and add the following two lines: +

+
+#define LUA_BITLIBNAME "bit"
+LUALIB_API int luaopen_bit(lua_State *L);
+
+

+4. Edit linit.c and add this immediately before the line +with {NULL, NULL}: +

+
+  {LUA_BITLIBNAME, luaopen_bit},
+
+

+5. Now recompile and you're done! +

+

Testing

+

+You can optionally test whether the installation of Lua BitOp was successful. +Keep the terminal/command window open and run one of the following commands: +

+

+For Linux, *BSD and Mac OS X: +

+
+make test
+
+

+For MinGW on Windows: +

+
+mingw32-make -f Makefile.mingw test
+
+

+For MSVC on Windows: +

+
+msvctest
+
+

+If any of the tests fail, please check that you've properly set the +paths in the build scripts, compiled with the same headers you've +compiled your Lua installation (in particular if you've changed the +number type in luaconf.h) and installed the C module into +the directory which matches your Lua installation. Double check everything +if you've installed multiple Lua interpreters (e.g. both in /usr/bin +and in /usr/local/bin). +

+

+If you get a warning or a failure about a broken tostring() function +or about broken hex literals, then your Lua installation is defective. +Check with your distributor, replace/upgrade a broken compiler or C library +or re-install Lua yourself with the right configuration settings +(in particular see LUA_NUMBER_* and luai_num* +in luaconf.h). +

+

Benchmarks

+

+The distribution contains several benchmarks: +

+
    +
  • bitbench.lua tests the speed of basic bit operations. +The benchmark is auto-scaling with a minimum runtime of 1 second +for each part. +The loop overhead is computed first and subtracted from the following +measurements. The time to run a bit operation includes the overhead +of setting up its parameters and calling the corresponding C function.
  • +
  • nsievebits.lua is a simple benchmark adapted from the +» Computer Language Benchmarks Game +(formerly known as Great Computer Language Shootout). The scale factor +is exponential, so run it with a small number between 2 and 10 and time it +(e.g. time lua nsievebits.lua 6).
  • +
  • md5test.lua when given the argument "bench" runs +an auto-scaling benchmark and prints the time per character +needed to compute the MD5 hash of a (medium-length) string. +Please note that this implementation is mainly intended as a +regression test. It's not suitable for cross-language comparisons +against fully optimized MD5 implementations.
  • +
+
+
+ + + diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/doc/install.html.meta b/Assets/LuaFramework/Lua/3rd/luabitop/doc/install.html.meta new file mode 100644 index 0000000000000000000000000000000000000000..b4cbc37beeece0e9539a51bfe0f538048748b7b5 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/doc/install.html.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 4d6a7ce26750bdb499ecd7b013361538 +TextScriptImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/doc/semantics.html b/Assets/LuaFramework/Lua/3rd/luabitop/doc/semantics.html new file mode 100644 index 0000000000000000000000000000000000000000..e22252f4f74d6c181f4185864f20cde8d3e11205 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/doc/semantics.html @@ -0,0 +1,167 @@ + + + +Operational Semantics and Rationale + + + + + + + + +
+Bit +
+ + +
+

+Lua uses only a single number type which can be redefined at compile-time. +By default this is a double, i.e. a floating-point number with +53 bits of precision. Operations in the range of 32 bit numbers +(and beyond) are exact. There is no loss of precision, +so there is no need to add an extra integer number type. +Modern desktop and server CPUs have fast floating-point hardware — +FP arithmetic is nearly the same speed as integer arithmetic. Any +differences vanish under the overhead of the Lua interpreter itself. +

+

+Even today, many embedded systems lack support for fast FP operations. +These systems benefit from compiling Lua with an integer number type +(with 32 bits or more). +

+

+The different possible number types and the use of FP numbers cause +some problems when defining bitwise operations on Lua numbers. The +following sections define the operational semantics and try to explain +the rationale behind them. +

+

Input and Output Ranges

+
    +
  • Bitwise operations cannot sensibly be applied to FP numbers +(or their underlying bit patterns). They must be converted to integers +before operating on them and then back to FP numbers.
  • +
  • It's desirable to define semantics that work the same across +all platforms. This dictates that all operations are based on +the common denominator of 32 bit integers.
  • +
  • The float type provides only 24 bits of precision. +This makes it unsuitable for use in bitwise operations. +Lua BitOp refuses to compile against a Lua installation with this +number type.
  • +
  • Bit operations only deal with the underlying bit patterns and +generally ignore signedness (except for arithmetic right-shift). +They are commonly displayed and treated like unsigned numbers, though.
  • +
  • But the Lua number type must be signed and may be limited +to 32 bits. Defining the result type as an unsigned number +would not be cross-platform safe. All bit operations are thus defined to +return results in the range of signed 32 bit numbers +(converted to the Lua number type).
  • +
  • Hexadecimal literals are treated as +unsigned numbers by the Lua parser before converting them +to the Lua number type. This means they can be out of the range of +signed 32 bit integers if the Lua number type has a greater range. +E.g. 0xffffffff has a value of 4294967295 in the default installation, +but may be -1 on embedded systems.
  • +
  • It's highly desirable that hex literals are treated uniformly across +systems when used in bitwise operations. +All bit operations accept arguments in the signed or +the unsigned 32 bit range (and more, see below). +Numbers with the same underlying bit pattern are treated the same by +all operations.
  • +
+

Modular Arithmetic

+

Arithmetic operations on n-bit integers are usually based on the rules of +» modular arithmetic +modulo 2n. Numbers wrap around when the mathematical result +of operations is outside their defined range. This simplifies hardware +implementations and some algorithms actually require this behavior +(like many cryptographic functions). +

+

+E.g. for 32 bit integers the following holds: 0xffffffff + 1 = 0 +

+

+Arithmetic modulo 232 is trivially available +if the Lua number type is a 32 bit integer. Otherwise normalization +steps must be inserted. Modular arithmetic should work the same +across all platforms as far as possible: +

+
    +
  • For the default number type of double, +arguments can be in the range of ±251 +and still be safely normalized across all platforms by taking their +least-significant 32 bits. The limit is derived from the way +doubles are converted to integers.
  • +
  • The function bit.tobit can be used to explicitly +normalize numbers to implement modular addition or subtraction. +E.g. bit.tobit(0xffffffff + 1) returns 0 on all platforms.
  • +
  • The limit on the argument range implies that modular multiplication +is usually restricted to multiplying already normalized numbers with +small constants. FP numbers are limited to 53 bits of precision, +anyway. E.g. (230+1)2 does not return an odd number +when computed with doubles.
  • +
+

+BTW: The tr_i function shown here +is one of the non-linear functions of the (flawed) MD5 cryptographic hash and +relies on modular arithmetic for correct operation. The result is +fed back to other bitwise operations (not shown) and does not need +to be normalized until the last step. +

+

Restricted and Undefined Behavior

+

+The following rules are intended to give a precise and useful definition +(for the programmer), yet give the implementation (interpreter and +compiler) the maximum flexibility and the freedom to apply advanced +optimizations. It's strongly advised not to rely on undefined or +implementation-defined behavior. +

+
    +
  • All kinds of floating-point numbers are acceptable to the bitwise +operations. None of them cause an error, but some may invoke undefined +behavior: +
      +
    • -0 is treated the same as +0 on input and +is never returned as a result.
    • +
    • Passing ±Inf, NaN or numbers outside the range of +±251 as input yields an undefined result.
    • +
    • Non-integral numbers may be rounded or truncated in an +implementation-defined way. This means the result could differ between +different BitOp versions, different Lua VMs, on different platforms or even +between interpreted vs. compiled code +(as in » LuaJIT).
      +Avoid passing fractional numbers to bitwise functions. Use +math.floor() or math.ceil() to get defined behavior.
    • +
  • +
  • Lua provides auto-coercion of string arguments to numbers +by default. This behavior is deprecated for bitwise operations.
  • +
+
+
+ + + diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/doc/semantics.html.meta b/Assets/LuaFramework/Lua/3rd/luabitop/doc/semantics.html.meta new file mode 100644 index 0000000000000000000000000000000000000000..d7d72250bf9915c4da116a57b17af86fb1df3e3b --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/doc/semantics.html.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 2613d747ce41e8b4b90e5c45a2478367 +TextScriptImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/installpath.lua b/Assets/LuaFramework/Lua/3rd/luabitop/installpath.lua new file mode 100644 index 0000000000000000000000000000000000000000..ae91dcebec489e01b73335549461b0eb03ba8c8c --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/installpath.lua @@ -0,0 +1,14 @@ +-- Script to find the install path for a C module. Public domain. + +if not arg or not arg[1] then + io.write("Usage: lua installpath.lua modulename\n") + os.exit(1) +end +for p in string.gmatch(package.cpath, "[^;]+") do + if string.sub(p, 1, 1) ~= "." then + local p2 = string.gsub(arg[1], "%.", string.sub(package.config, 1, 1)) + io.write(string.gsub(p, "%?", p2), "\n") + return + end +end +error("no suitable installation path found") diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/installpath.lua.meta b/Assets/LuaFramework/Lua/3rd/luabitop/installpath.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..def2c70f4604d8c26e357957e9176557f39bc1f0 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/installpath.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 4192b766affe82640a5aee438c3b964a +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/md5test.lua b/Assets/LuaFramework/Lua/3rd/luabitop/md5test.lua new file mode 100644 index 0000000000000000000000000000000000000000..3884f407a1074d66ede05ee83a8071ba083be399 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/md5test.lua @@ -0,0 +1,196 @@ +-- MD5 test and benchmark. Public domain. + +local bit = require("bit") +local tobit, tohex, bnot = bit.tobit or bit.cast, bit.tohex, bit.bnot +local bor, band, bxor = bit.bor, bit.band, bit.bxor +local lshift, rshift, rol, bswap = bit.lshift, bit.rshift, bit.rol, bit.bswap +local byte, char, sub, rep = string.byte, string.char, string.sub, string.rep + +if not rol then -- Replacement function if rotates are missing. + local bor, shl, shr = bit.bor, bit.lshift, bit.rshift + function rol(a, b) return bor(shl(a, b), shr(a, 32-b)) end +end + +if not bswap then -- Replacement function if bswap is missing. + local bor, band, shl, shr = bit.bor, bit.band, bit.lshift, bit.rshift + function bswap(a) + return bor(shr(a, 24), band(shr(a, 8), 0xff00), + shl(band(a, 0xff00), 8), shl(a, 24)); + end +end + +if not tohex then -- (Unreliable) replacement function if tohex is missing. + function tohex(a) + return string.sub(string.format("%08x", a), -8) + end +end + +local function tr_f(a, b, c, d, x, s) + return rol(bxor(d, band(b, bxor(c, d))) + a + x, s) + b +end + +local function tr_g(a, b, c, d, x, s) + return rol(bxor(c, band(d, bxor(b, c))) + a + x, s) + b +end + +local function tr_h(a, b, c, d, x, s) + return rol(bxor(b, c, d) + a + x, s) + b +end + +local function tr_i(a, b, c, d, x, s) + return rol(bxor(c, bor(b, bnot(d))) + a + x, s) + b +end + +local function transform(x, a1, b1, c1, d1) + local a, b, c, d = a1, b1, c1, d1 + + a = tr_f(a, b, c, d, x[ 1] + 0xd76aa478, 7) + d = tr_f(d, a, b, c, x[ 2] + 0xe8c7b756, 12) + c = tr_f(c, d, a, b, x[ 3] + 0x242070db, 17) + b = tr_f(b, c, d, a, x[ 4] + 0xc1bdceee, 22) + a = tr_f(a, b, c, d, x[ 5] + 0xf57c0faf, 7) + d = tr_f(d, a, b, c, x[ 6] + 0x4787c62a, 12) + c = tr_f(c, d, a, b, x[ 7] + 0xa8304613, 17) + b = tr_f(b, c, d, a, x[ 8] + 0xfd469501, 22) + a = tr_f(a, b, c, d, x[ 9] + 0x698098d8, 7) + d = tr_f(d, a, b, c, x[10] + 0x8b44f7af, 12) + c = tr_f(c, d, a, b, x[11] + 0xffff5bb1, 17) + b = tr_f(b, c, d, a, x[12] + 0x895cd7be, 22) + a = tr_f(a, b, c, d, x[13] + 0x6b901122, 7) + d = tr_f(d, a, b, c, x[14] + 0xfd987193, 12) + c = tr_f(c, d, a, b, x[15] + 0xa679438e, 17) + b = tr_f(b, c, d, a, x[16] + 0x49b40821, 22) + + a = tr_g(a, b, c, d, x[ 2] + 0xf61e2562, 5) + d = tr_g(d, a, b, c, x[ 7] + 0xc040b340, 9) + c = tr_g(c, d, a, b, x[12] + 0x265e5a51, 14) + b = tr_g(b, c, d, a, x[ 1] + 0xe9b6c7aa, 20) + a = tr_g(a, b, c, d, x[ 6] + 0xd62f105d, 5) + d = tr_g(d, a, b, c, x[11] + 0x02441453, 9) + c = tr_g(c, d, a, b, x[16] + 0xd8a1e681, 14) + b = tr_g(b, c, d, a, x[ 5] + 0xe7d3fbc8, 20) + a = tr_g(a, b, c, d, x[10] + 0x21e1cde6, 5) + d = tr_g(d, a, b, c, x[15] + 0xc33707d6, 9) + c = tr_g(c, d, a, b, x[ 4] + 0xf4d50d87, 14) + b = tr_g(b, c, d, a, x[ 9] + 0x455a14ed, 20) + a = tr_g(a, b, c, d, x[14] + 0xa9e3e905, 5) + d = tr_g(d, a, b, c, x[ 3] + 0xfcefa3f8, 9) + c = tr_g(c, d, a, b, x[ 8] + 0x676f02d9, 14) + b = tr_g(b, c, d, a, x[13] + 0x8d2a4c8a, 20) + + a = tr_h(a, b, c, d, x[ 6] + 0xfffa3942, 4) + d = tr_h(d, a, b, c, x[ 9] + 0x8771f681, 11) + c = tr_h(c, d, a, b, x[12] + 0x6d9d6122, 16) + b = tr_h(b, c, d, a, x[15] + 0xfde5380c, 23) + a = tr_h(a, b, c, d, x[ 2] + 0xa4beea44, 4) + d = tr_h(d, a, b, c, x[ 5] + 0x4bdecfa9, 11) + c = tr_h(c, d, a, b, x[ 8] + 0xf6bb4b60, 16) + b = tr_h(b, c, d, a, x[11] + 0xbebfbc70, 23) + a = tr_h(a, b, c, d, x[14] + 0x289b7ec6, 4) + d = tr_h(d, a, b, c, x[ 1] + 0xeaa127fa, 11) + c = tr_h(c, d, a, b, x[ 4] + 0xd4ef3085, 16) + b = tr_h(b, c, d, a, x[ 7] + 0x04881d05, 23) + a = tr_h(a, b, c, d, x[10] + 0xd9d4d039, 4) + d = tr_h(d, a, b, c, x[13] + 0xe6db99e5, 11) + c = tr_h(c, d, a, b, x[16] + 0x1fa27cf8, 16) + b = tr_h(b, c, d, a, x[ 3] + 0xc4ac5665, 23) + + a = tr_i(a, b, c, d, x[ 1] + 0xf4292244, 6) + d = tr_i(d, a, b, c, x[ 8] + 0x432aff97, 10) + c = tr_i(c, d, a, b, x[15] + 0xab9423a7, 15) + b = tr_i(b, c, d, a, x[ 6] + 0xfc93a039, 21) + a = tr_i(a, b, c, d, x[13] + 0x655b59c3, 6) + d = tr_i(d, a, b, c, x[ 4] + 0x8f0ccc92, 10) + c = tr_i(c, d, a, b, x[11] + 0xffeff47d, 15) + b = tr_i(b, c, d, a, x[ 2] + 0x85845dd1, 21) + a = tr_i(a, b, c, d, x[ 9] + 0x6fa87e4f, 6) + d = tr_i(d, a, b, c, x[16] + 0xfe2ce6e0, 10) + c = tr_i(c, d, a, b, x[ 7] + 0xa3014314, 15) + b = tr_i(b, c, d, a, x[14] + 0x4e0811a1, 21) + a = tr_i(a, b, c, d, x[ 5] + 0xf7537e82, 6) + d = tr_i(d, a, b, c, x[12] + 0xbd3af235, 10) + c = tr_i(c, d, a, b, x[ 3] + 0x2ad7d2bb, 15) + b = tr_i(b, c, d, a, x[10] + 0xeb86d391, 21) + + return tobit(a+a1), tobit(b+b1), tobit(c+c1), tobit(d+d1) +end + +-- Note: this is copying the original string and NOT particularly fast. +-- A library for struct unpacking would make this task much easier. +local function md5(msg) + local len = #msg + msg = msg.."\128"..rep("\0", 63 - band(len + 8, 63)) + ..char(band(lshift(len, 3), 255), band(rshift(len, 5), 255), + band(rshift(len, 13), 255), band(rshift(len, 21), 255)) + .."\0\0\0\0" + local a, b, c, d = 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 + local x, k = {}, 1 + for i=1,#msg,4 do + local m0, m1, m2, m3 = byte(msg, i, i+3) + x[k] = bor(m0, lshift(m1, 8), lshift(m2, 16), lshift(m3, 24)) + if k == 16 then + a, b, c, d = transform(x, a, b, c, d) + k = 1 + else + k = k + 1 + end + end + return tohex(bswap(a))..tohex(bswap(b))..tohex(bswap(c))..tohex(bswap(d)) +end + +assert(md5('') == 'd41d8cd98f00b204e9800998ecf8427e') +assert(md5('a') == '0cc175b9c0f1b6a831c399e269772661') +assert(md5('abc') == '900150983cd24fb0d6963f7d28e17f72') +assert(md5('message digest') == 'f96b697d7cb7938d525a2f31aaf161d0') +assert(md5('abcdefghijklmnopqrstuvwxyz') == 'c3fcd3d76192e4007dfb496cca67e13b') +assert(md5('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') == + 'd174ab98d277d9f5a5611c2c9f419d9f') +assert(md5('12345678901234567890123456789012345678901234567890123456789012345678901234567890') == + '57edf4a22be3c955ac49da2e2107b67a') + +if arg and arg[1] == "bench" then + -- Credits: William Shakespeare, Romeo and Juliet + local txt = [[Rebellious subjects, enemies to peace, +Profaners of this neighbour-stained steel,-- +Will they not hear? What, ho! you men, you beasts, +That quench the fire of your pernicious rage +With purple fountains issuing from your veins, +On pain of torture, from those bloody hands +Throw your mistemper'd weapons to the ground, +And hear the sentence of your moved prince. +Three civil brawls, bred of an airy word, +By thee, old Capulet, and Montague, +Have thrice disturb'd the quiet of our streets, +And made Verona's ancient citizens +Cast by their grave beseeming ornaments, +To wield old partisans, in hands as old, +Canker'd with peace, to part your canker'd hate: +If ever you disturb our streets again, +Your lives shall pay the forfeit of the peace. +For this time, all the rest depart away: +You Capulet; shall go along with me: +And, Montague, come you this afternoon, +To know our further pleasure in this case, +To old Free-town, our common judgment-place. +Once more, on pain of death, all men depart.]] + txt = txt..txt..txt..txt + txt = txt..txt..txt..txt + + local function bench() + local n = 80 + repeat + local tm = os.clock() + local res + for i=1,n do + res = md5(txt) + end + assert(res == 'a831e91e0f70eddcb70dc61c6f82f6cd') + tm = os.clock() - tm + if tm > 1 then return tm*(1000000000/(n*#txt)) end + n = n + n + until false + end + + io.write(string.format("MD5 %7.1f ns/char\n", bench())) +end + diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/md5test.lua.meta b/Assets/LuaFramework/Lua/3rd/luabitop/md5test.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..714758040d9c91d1972f4157415239038ad39a63 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/md5test.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 322f8fe07585d624bb3277c8e432a707 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/msvcbuild.bat b/Assets/LuaFramework/Lua/3rd/luabitop/msvcbuild.bat new file mode 100644 index 0000000000000000000000000000000000000000..21f5070f57c3da9f791c2e52ef1741d62ec8f583 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/msvcbuild.bat @@ -0,0 +1,29 @@ +@rem Script to build Lua BitOp with MSVC. + +@rem First change the paths to your Lua installation below. +@rem Then open a "Visual Studio .NET Command Prompt", cd to this directory +@rem and run this script. Afterwards copy the resulting bit.dll to +@rem the directory where lua.exe is installed. + +@if not defined INCLUDE goto :FAIL + +@setlocal +@rem Path to the Lua includes and the library file for the Lua DLL: +@set LUA_INC=-I .. +@set LUA_LIB=..\lua51.lib + +@set MYCOMPILE=cl /nologo /MD /O2 /W3 /c %LUA_INC% +@set MYLINK=link /nologo +@set MYMT=mt /nologo + +%MYCOMPILE% bit.c +%MYLINK% /DLL /export:luaopen_bit /out:bit.dll bit.obj %LUA_LIB% +if exist bit.dll.manifest^ + %MYMT% -manifest bit.dll.manifest -outputresource:bit.dll;2 + +del *.obj *.exp *.manifest + +@goto :END +:FAIL +@echo You must open a "Visual Studio .NET Command Prompt" to run this script +:END diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/msvcbuild.bat.meta b/Assets/LuaFramework/Lua/3rd/luabitop/msvcbuild.bat.meta new file mode 100644 index 0000000000000000000000000000000000000000..ec039bf69c41c78934730cbbc38f3c939bda7769 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/msvcbuild.bat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 01c89dc24e84d1841a654d3273df5698 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/msvctest.bat b/Assets/LuaFramework/Lua/3rd/luabitop/msvctest.bat new file mode 100644 index 0000000000000000000000000000000000000000..95dcc50c68c338f7ad70edf922f8393db6a0469c --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/msvctest.bat @@ -0,0 +1,19 @@ +@rem Script to test Lua BitOp. + +@setlocal +@rem Path to the Lua executable: +@set LUA=lua + +@echo off +for %%t in (bittest.lua nsievebits.lua md5test.lua) do ( + echo testing %%t + %LUA% %%t + if errorlevel 1^ + goto :FAIL +) +echo ****** ALL TESTS OK ****** +goto :END + +:FAIL +echo ****** TEST FAILED ****** +:END diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/msvctest.bat.meta b/Assets/LuaFramework/Lua/3rd/luabitop/msvctest.bat.meta new file mode 100644 index 0000000000000000000000000000000000000000..e1eff405f4770fc7615b56161eec399292513dae --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/msvctest.bat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 93f44eeeebf603843aaeca13c9510165 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/nsievebits.lua b/Assets/LuaFramework/Lua/3rd/luabitop/nsievebits.lua new file mode 100644 index 0000000000000000000000000000000000000000..b99d21ec80ecc16eff974c0ebabedb5d2d27c6d4 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/nsievebits.lua @@ -0,0 +1,32 @@ +-- This is the (naive) Sieve of Eratosthenes. Public domain. + +local bit = require("bit") +local band, bxor, rshift, rol = bit.band, bit.bxor, bit.rshift, bit.rol + +local function nsieve(p, m) + local count = 0 + for i=0,rshift(m, 5) do p[i] = -1 end + for i=2,m do + if band(rshift(p[rshift(i, 5)], i), 1) ~= 0 then + count = count + 1 + for j=i+i,m,i do + local jx = rshift(j, 5) + p[jx] = band(p[jx], rol(-2, j)) + end + end + end + return count +end + +if arg and arg[1] then + local N = tonumber(arg[1]) or 1 + if N < 2 then N = 2 end + local primes = {} + + for i=0,2 do + local m = (2^(N-i))*10000 + io.write(string.format("Primes up to %8d %8d\n", m, nsieve(primes, m))) + end +else + assert(nsieve({}, 10000) == 1229) +end diff --git a/Assets/LuaFramework/Lua/3rd/luabitop/nsievebits.lua.meta b/Assets/LuaFramework/Lua/3rd/luabitop/nsievebits.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..d7c2ed94bbeff112504852756cf983148a781f01 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/luabitop/nsievebits.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 27f415faeaf5a954ca75e5b632dda24c +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/pbc.meta b/Assets/LuaFramework/Lua/3rd/pbc.meta new file mode 100644 index 0000000000000000000000000000000000000000..e221da1e0000a80b4a71cf56177989ceab6c5a46 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/pbc.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: c01725dffbd9b40b9b386e3d7c0ea700 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/pbc/addressbook.pb b/Assets/LuaFramework/Lua/3rd/pbc/addressbook.pb new file mode 100644 index 0000000000000000000000000000000000000000..29de741e88291e6a4adb434d3b1fc388bb96dcd2 Binary files /dev/null and b/Assets/LuaFramework/Lua/3rd/pbc/addressbook.pb differ diff --git a/Assets/LuaFramework/Lua/3rd/pbc/addressbook.pb.meta b/Assets/LuaFramework/Lua/3rd/pbc/addressbook.pb.meta new file mode 100644 index 0000000000000000000000000000000000000000..4ef63bc705195c8a7e6664c5a0a06a08b880d952 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/pbc/addressbook.pb.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 9b46453c983e6824cabb4f3d5d639ba3 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/pbc/addressbook.proto b/Assets/LuaFramework/Lua/3rd/pbc/addressbook.proto new file mode 100644 index 0000000000000000000000000000000000000000..883a78810d5b67de0e8632d4e2fd4219c5e8f1a4 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/pbc/addressbook.proto @@ -0,0 +1,39 @@ +// See README.txt for information and build instructions. + +package tutorial; + +option java_package = "com.example.tutorial"; +option java_outer_classname = "AddressBookProtos"; + +message Person { + required string name = 1; + required int32 id = 2; // Unique ID number for this person. + optional string email = 3; + + enum PhoneType { + MOBILE = 0; + HOME = 1; + WORK = 2; + } + + message PhoneNumber { + required string number = 1; + optional PhoneType type = 2 [default = HOME]; + } + + repeated PhoneNumber phone = 4; + repeated int32 test = 5 [packed=true]; + + extensions 10 to max; +} + +message Ext { + extend Person { + optional int32 test = 10; + } +} + +// Our address book file is just one of these. +message AddressBook { + repeated Person person = 1; +} diff --git a/Assets/LuaFramework/Lua/3rd/pbc/addressbook.proto.meta b/Assets/LuaFramework/Lua/3rd/pbc/addressbook.proto.meta new file mode 100644 index 0000000000000000000000000000000000000000..45d6478c9444d3fa29b6f8e4f7524dc11e85a081 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/pbc/addressbook.proto.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 31723f391cfd51446b36f385ab093e6b +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/pbc/parser.lua b/Assets/LuaFramework/Lua/3rd/pbc/parser.lua new file mode 100644 index 0000000000000000000000000000000000000000..efd9b85d826c9ce0836ba681351be3590ee17684 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/pbc/parser.lua @@ -0,0 +1,397 @@ +----------------------- +-- simple proto parser +----------------------- + +local lpeg = require "lpeg" +local P = lpeg.P +local S = lpeg.S +local R = lpeg.R +local C = lpeg.C +local Ct = lpeg.Ct +local Cg = lpeg.Cg +local Cc = lpeg.Cc +local V = lpeg.V + +local next = next +local error = error +local tonumber = tonumber +local pairs = pairs +local ipairs = ipairs +local rawset = rawset +local tinsert = table.insert +local smatch = string.match +local sbyte = string.byte + +local internal_type = { + double = "TYPE_DOUBLE", + float = "TYPE_FLOAT", + uint64 = "TYPE_UINT64", + int = "TYPE_INT32", + int32 = "TYPE_INT32", + int64 = "TYPE_INT64", + fixed64 = "TYPE_FIXED64", + fixed32 = "TYPE_FIXED32", + bool = "TYPE_BOOL", + string = "TYPE_STRING", + bytes = "TYPE_BYTES", + uint32 = "TYPE_UINT32", + sfixed32 = "TYPE_SFIXED32", + sfixed64 = "TYPE_SFIXED64", + sint32 = "TYPE_SINT32", + sint64 = "TYPE_SINT64", +} + +local function count_lines(_,pos, parser_state) + if parser_state.pos < pos then + parser_state.line = parser_state.line + 1 + parser_state.pos = pos + end + return pos +end + +local exception = lpeg.Cmt( lpeg.Carg(1) , function ( _ , pos, parser_state) + error( "syntax error at [" .. (parser_state.file or "") .."] (" .. parser_state.line ..")" ) + return pos +end) + +local eof = P(-1) +local newline = lpeg.Cmt((P"\n" + "\r\n") * lpeg.Carg(1) ,count_lines) +local line_comment = "//" * (1 - newline) ^0 * (newline + eof) +local blank = S" \t" + newline + line_comment +local blank0 = blank ^ 0 +local blanks = blank ^ 1 +local alpha = R"az" + R"AZ" + "_" +local alnum = alpha + R"09" +local str_c = (1 - S("\\\"")) + P("\\") * 1 +local str = P"\"" * C(str_c^0) * "\"" +local dotname = ("." * alpha * alnum ^ 0) ^ 0 +local typename = C(alpha * alnum ^ 0 * dotname) +local name = C(alpha * alnum ^ 0) +local filename = P"\"" * C((alnum + "/" + "." + "-")^1) * "\"" +local id = R"09" ^ 1 / tonumber + "max" * Cc(-1) +local bool = "true" * Cc(true) + "false" * Cc(false) +local value = str + bool + name + id +local patterns = {} + +local enum_item = Cg(name * blank0 * "=" * blank0 * id * blank0 * ";" * blank0) + +local function insert(tbl, k,v) + tinsert(tbl, { name = k , number = v }) + return tbl +end + +patterns.ENUM = Ct(Cg("enum","type") * blanks * Cg(typename,"name") * blank0 * + "{" * blank0 * + Cg(lpeg.Cf(Ct"" * enum_item^1 , insert),"value") + * "}" * blank0) + +local prefix_field = P"required" * Cc"LABEL_REQUIRED" + + P"optional" * Cc"LABEL_OPTIONAL" + + P"repeated" * Cc"LABEL_REPEATED" +local postfix_pair = blank0 * Cg(name * blank0 * "=" * blank0 * value * blank0) +local postfix_pair_2 = blank0 * "," * postfix_pair +local postfix_field = "[" * postfix_pair * postfix_pair_2^0 * blank0 * "]" +local options = lpeg.Cf(Ct"" * postfix_field , rawset) ^ -1 + +local function setoption(t, options) + if next(options) then + t.options = options + end + return t +end + +local message_field = lpeg.Cf ( + Ct( Cg(prefix_field,"label") * blanks * + Cg(typename,"type_name") * blanks * + Cg(name,"name") * blank0 * "=" * blank0 * + Cg(id,"number") + ) * blank0 * options , + setoption) * blank0 * ";" * blank0 + +local extensions = Ct( + Cg("extensions" , "type") * blanks * + Cg(id,"start") * blanks * "to" * blanks * + Cg(id,"end") * blank0 * ";" * blank0 + ) + +patterns.EXTEND = Ct( + Cg("extend", "type") * blanks * + Cg(typename, "name") * blank0 * "{" * blank0 * + Cg(Ct((message_field) ^ 1),"extension") * "}" * blank0 + ) + +patterns.MESSAGE = P { Ct( + Cg("message","type") * blanks * + Cg(typename,"name") * blank0 * "{" * blank0 * + Cg(Ct((message_field + patterns.ENUM + extensions + patterns.EXTEND + V(1)) ^ 0),"items") * "}" * blank0 + ) } + +patterns.OPTION = Ct( + Cg("option" , "type") * blanks * + Cg(name, "name") * blank0 * "=" * blank0 * + Cg(value, "value") + ) * blank0 * ";" * blank0 + +patterns.IMPORT = Ct( Cg("import" , "type") * blanks * Cg(filename, "name") ) * blank0 * ";" * blank0 + +patterns.PACKAGE = Ct( Cg("package", "type") * blanks * Cg(typename, "name") ) * blank0 * ";" * blank0 + +local proto_tbl = { "PROTO" } + +do + local k, v = next(patterns) + local p = V(k) + proto_tbl[k] = v + for k,v in next , patterns , k do + proto_tbl[k] = v + p = p + V(k) + end + proto_tbl.PROTO = Ct(blank0 * p ^ 1) +end + +local proto = P(proto_tbl) + +local deal = {} + +function deal:import(v) + self.dependency = self.dependency or {} + tinsert(self.dependency , v.name) +end + +function deal:package(v) + self.package = v.name +end + +function deal:enum(v) + self.enum_type = self.enum_type or {} + tinsert(self.enum_type , v) +end + +function deal:option(v) + self.options = self.options or {} + self.options[v.name] = v.value +end + +function deal:extend(v) + self.extension = self.extension or {} + local extendee = v.name + for _,v in ipairs(v.extension) do + v.extendee = extendee + v.type = internal_type[v.type_name] + if v.type then + v.type_name = nil + end + tinsert(self.extension , v) + end +end + +function deal:extensions(v) + self.extension_range = self.extension_range or {} + tinsert(self.extension_range, v) +end + +local function _add_nested_message(self, item) + if item.type == nil then + item.type = internal_type[item.type_name] + if item.type then + item.type_name = nil + end + self.field = self.field or {} + tinsert(self.field, item) + else + local f = deal[item.type] + item.type = nil + f(self , item) + end +end + +function deal:message(v) + self.nested_type = self.nested_type or {} + local m = { name = v.name } + tinsert(self.nested_type , m) + for _,v in ipairs(v.items) do + _add_nested_message(m, v) + end +end + +local function fix(r) + local p = {} + for _,v in ipairs(r) do + local f = deal[v.type] + v.type = nil + f(p , v) + end + + p.message_type = p.nested_type + p.nested_type = nil + + return p +end + +--- fix message name + +local NULL = {} + +local function _match_name(namespace , n , all) + if sbyte(n) == 46 then + return n + end + + repeat + local name = namespace .. "." .. n + if all[name] then + return name + end + namespace = smatch(namespace,"(.*)%.[%w_]+$") + until namespace == nil +end + +local function _fix_field(namespace , field, all) + local type_name = field.type_name + if type_name == "" then + field.type_name = nil + return + elseif type_name == nil then + return + end + + local full_name = assert(_match_name(namespace, field.type_name, all) , field.type_name , all) + + field.type_name = full_name + field.type = all[full_name] + + local options = field.options + if options then + if options.default then + field.default_value = tostring(options.default) + options.default = nil + end + if next(options) == nil then + field.options = nil + end + end +end + +local function _fix_extension(namespace, ext, all) + for _,field in ipairs(ext or NULL) do + field.extendee = assert(_match_name(namespace, field.extendee,all),field.extendee) + _fix_field(namespace , field , all) + end +end + +local function _fix_message(msg , all) + for _,field in ipairs(msg.field or NULL) do + _fix_field(assert(all[msg],msg.name) , field , all) + end + for _,nest in ipairs(msg.nested_type or NULL) do + _fix_message(nest , all) + end + _fix_extension(all[msg] , msg.extension , all) +end + +local function _fix_typename(file , all) + for _,message in ipairs(file.message_type or NULL) do + _fix_message(message , all) + end + _fix_extension(file.package , file.extension , all) +end + +--- merge messages + +local function _enum_fullname(prefix, enum , all) + local fullname + if sbyte(enum.name) == 46 then + fullname = enum.name + else + fullname = prefix .. "." .. enum.name + end + all[fullname] = "TYPE_ENUM" + all[enum] = fullname +end + +local function _message_fullname(prefix , msg , all) + local fullname + if sbyte(msg.name) == 46 then + fullname = msg.name + else + fullname = prefix .. "." .. msg.name + end + all[fullname] = "TYPE_MESSAGE" + all[msg] = fullname + for _,nest in ipairs(msg.nested_type or NULL) do + _message_fullname(fullname , nest , all) + end + for _,enum in ipairs(msg.enum_type or NULL) do + _enum_fullname(fullname , enum , all) + end +end + +local function _gen_fullname(file , all) + local prefix = "" + if file.package then + prefix = "." .. file.package + end + for _,message in ipairs(file.message_type or NULL) do + _message_fullname(prefix , message , all) + end + for _,enum in ipairs(file.enum_type or NULL) do + _enum_fullname(prefix , enum , all) + end +end + +--- parser + +local parser = {} + +local function parser_one(text,filename) + local state = { file = filename, pos = 0, line = 1 } + local r = lpeg.match(proto * -1 + exception , text , 1, state ) + local t = fix(r) + return t +end + +function parser.parser(text,filename) + local t = parser_one(text,filename) + local all = {} + _gen_fullname(t,all) + _fix_typename(t , all) + return t +end + +local pb = require "protobuf" + +function parser.register(fileset , path) + local all = {} + local files = {} + if type(fileset) == "string" then + fileset = { fileset } + end + for _, filename in ipairs(fileset) do + local fullname + if path then + fullname = path .. "/" .. filename + else + fullname = filename + end + local f = assert(io.open(fullname , "r")) + local buffer = f:read "*a" + f:close() + local t = parser_one(buffer,filename) + _gen_fullname(t,all) + t.name = filename + tinsert(files , t) + end + for _,file in ipairs(files) do + _fix_typename(file,all) + end + + local pbencode = pb.encode("google.protobuf.FileDescriptorSet" , { file = files }) + + if pbencode == nil then + error(pb.lasterror()) + end + pb.register(pbencode) + return files +end + +return parser \ No newline at end of file diff --git a/Assets/LuaFramework/Lua/3rd/pbc/parser.lua.meta b/Assets/LuaFramework/Lua/3rd/pbc/parser.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..69ebe503f64e8e79e77f3eb81f44064f3edf9b7c --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/pbc/parser.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 5ba7654d41605834bb8a232818a9ebf8 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/pbc/protobuf.lua b/Assets/LuaFramework/Lua/3rd/pbc/protobuf.lua new file mode 100644 index 0000000000000000000000000000000000000000..1d652025d92464700b1678eb50ae21d0f3376789 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/pbc/protobuf.lua @@ -0,0 +1,555 @@ +local c = require "protobuf.c" + +local setmetatable = setmetatable +local type = type +local table = table +local assert = assert +local pairs = pairs +local ipairs = ipairs +local string = string +local print = print +local io = io +local tinsert = table.insert +local rawget = rawget + +module "protobuf" + +local _pattern_cache = {} + +-- skynet clear +local P = c._env_new() +local GC = c._gc(P) + +function lasterror() + return c._last_error(P) +end + +local decode_type_cache = {} +local _R_meta = {} + +function _R_meta:__index(key) + local v = decode_type_cache[self._CType][key](self, key) + self[key] = v + return v +end + +local _reader = {} + +function _reader:int(key) + return c._rmessage_integer(self._CObj , key , 0) +end + +function _reader:real(key) + return c._rmessage_real(self._CObj , key , 0) +end + +function _reader:string(key) + return c._rmessage_string(self._CObj , key , 0) +end + +function _reader:bool(key) + return c._rmessage_integer(self._CObj , key , 0) ~= 0 +end + +function _reader:message(key, message_type) + local rmessage = c._rmessage_message(self._CObj , key , 0) + if rmessage then + local v = { + _CObj = rmessage, + _CType = message_type, + _Parent = self, + } + return setmetatable( v , _R_meta ) + end +end + +function _reader:int32(key) + return c._rmessage_int32(self._CObj , key , 0) +end + +function _reader:int64(key) + return c._rmessage_int64(self._CObj , key , 0) +end + +function _reader:int52(key) + return c._rmessage_int52(self._CObj , key , 0) +end + +function _reader:uint52(key) + return c._rmessage_uint52(self._CObj , key , 0) +end + +function _reader:int_repeated(key) + local cobj = self._CObj + local n = c._rmessage_size(cobj , key) + local ret = {} + for i=0,n-1 do + tinsert(ret, c._rmessage_integer(cobj , key , i)) + end + return ret +end + +function _reader:real_repeated(key) + local cobj = self._CObj + local n = c._rmessage_size(cobj , key) + local ret = {} + for i=0,n-1 do + tinsert(ret, c._rmessage_real(cobj , key , i)) + end + return ret +end + +function _reader:string_repeated(key) + local cobj = self._CObj + local n = c._rmessage_size(cobj , key) + local ret = {} + for i=0,n-1 do + tinsert(ret, c._rmessage_string(cobj , key , i)) + end + return ret +end + +function _reader:bool_repeated(key) + local cobj = self._CObj + local n = c._rmessage_size(cobj , key) + local ret = {} + for i=0,n-1 do + tinsert(ret, c._rmessage_integer(cobj , key , i) ~= 0) + end + return ret +end + +function _reader:message_repeated(key, message_type) + local cobj = self._CObj + local n = c._rmessage_size(cobj , key) + local ret = {} + for i=0,n-1 do + local m = { + _CObj = c._rmessage_message(cobj , key , i), + _CType = message_type, + _Parent = self, + } + tinsert(ret, setmetatable( m , _R_meta )) + end + return ret +end + +function _reader:int32_repeated(key) + local cobj = self._CObj + local n = c._rmessage_size(cobj , key) + local ret = {} + for i=0,n-1 do + tinsert(ret, c._rmessage_int32(cobj , key , i)) + end + return ret +end + +function _reader:int64_repeated(key) + local cobj = self._CObj + local n = c._rmessage_size(cobj , key) + local ret = {} + for i=0,n-1 do + tinsert(ret, c._rmessage_int64(cobj , key , i)) + end + return ret +end + +function _reader:int52_repeated(key) + local cobj = self._CObj + local n = c._rmessage_size(cobj , key) + local ret = {} + for i=0,n-1 do + tinsert(ret, c._rmessage_int52(cobj , key , i)) + end + return ret +end + +function _reader:uint52_repeated(key) + local cobj = self._CObj + local n = c._rmessage_size(cobj , key) + local ret = {} + for i=0,n-1 do + tinsert(ret, c._rmessage_uint52(cobj , key , i)) + end + return ret +end + +_reader[1] = function(msg) return _reader.int end +_reader[2] = function(msg) return _reader.real end +_reader[3] = function(msg) return _reader.bool end +_reader[4] = function(msg) return _reader.string end +_reader[5] = function(msg) return _reader.string end +_reader[6] = function(msg) + local message = _reader.message + return function(self,key) + return message(self, key, msg) + end +end +_reader[7] = function(msg) return _reader.int64 end +_reader[8] = function(msg) return _reader.int32 end +_reader[9] = _reader[5] +_reader[10] = function(msg) return _reader.int52 end +_reader[11] = function(msg) return _reader.uint52 end + +_reader[128+1] = function(msg) return _reader.int_repeated end +_reader[128+2] = function(msg) return _reader.real_repeated end +_reader[128+3] = function(msg) return _reader.bool_repeated end +_reader[128+4] = function(msg) return _reader.string_repeated end +_reader[128+5] = function(msg) return _reader.string_repeated end +_reader[128+6] = function(msg) + local message = _reader.message_repeated + return function(self,key) + return message(self, key, msg) + end +end +_reader[128+7] = function(msg) return _reader.int64_repeated end +_reader[128+8] = function(msg) return _reader.int32_repeated end +_reader[128+9] = _reader[128+5] +_reader[128+10] = function(msg) return _reader.int52_repeated end +_reader[128+11] = function(msg) return _reader.uint52_repeated end + +local _decode_type_meta = {} + +function _decode_type_meta:__index(key) + local t, msg = c._env_type(P, self._CType, key) + local func = assert(_reader[t],key)(msg) + self[key] = func + return func +end + +setmetatable(decode_type_cache , { + __index = function(self, key) + local v = setmetatable({ _CType = key } , _decode_type_meta) + self[key] = v + return v + end +}) + +local function decode_message( message , buffer, length) + local rmessage = c._rmessage_new(P, message, buffer, length) + if rmessage then + local self = { + _CObj = rmessage, + _CType = message, + } + c._add_rmessage(GC,rmessage) + return setmetatable( self , _R_meta ) + end +end + +----------- encode ---------------- + +local encode_type_cache = {} + +local function encode_message(CObj, message_type, t) + local type = encode_type_cache[message_type] + for k,v in pairs(t) do + local func = type[k] + func(CObj, k , v) + end +end + +local _writer = { + int = c._wmessage_integer, + real = c._wmessage_real, + enum = c._wmessage_string, + string = c._wmessage_string, + int64 = c._wmessage_int64, + int32 = c._wmessage_int32, + int52 = c._wmessage_int52, + uint52 = c._wmessage_uint52, +} + +function _writer:bool(k,v) + c._wmessage_integer(self, k, v and 1 or 0) +end + +function _writer:message(k, v , message_type) + local submessage = c._wmessage_message(self, k) + encode_message(submessage, message_type, v) +end + +function _writer:int_repeated(k,v) + for _,v in ipairs(v) do + c._wmessage_integer(self,k,v) + end +end + +function _writer:real_repeated(k,v) + for _,v in ipairs(v) do + c._wmessage_real(self,k,v) + end +end + +function _writer:bool_repeated(k,v) + for _,v in ipairs(v) do + c._wmessage_integer(self, k, v and 1 or 0) + end +end + +function _writer:string_repeated(k,v) + for _,v in ipairs(v) do + c._wmessage_string(self,k,v) + end +end + +function _writer:message_repeated(k,v, message_type) + for _,v in ipairs(v) do + local submessage = c._wmessage_message(self, k) + encode_message(submessage, message_type, v) + end +end + +function _writer:int32_repeated(k,v) + for _,v in ipairs(v) do + c._wmessage_int32(self,k,v) + end +end + +function _writer:int64_repeated(k,v) + for _,v in ipairs(v) do + c._wmessage_int64(self,k,v) + end +end + +function _writer:int52_repeated(k,v) + for _,v in ipairs(v) do + c._wmessage_int52(self,k,v) + end +end + +function _writer:uint52_repeated(k,v) + for _,v in ipairs(v) do + c._wmessage_uint52(self,k,v) + end +end + +_writer[1] = function(msg) return _writer.int end +_writer[2] = function(msg) return _writer.real end +_writer[3] = function(msg) return _writer.bool end +_writer[4] = function(msg) return _writer.string end +_writer[5] = function(msg) return _writer.string end +_writer[6] = function(msg) + local message = _writer.message + return function(self,key , v) + return message(self, key, v, msg) + end +end +_writer[7] = function(msg) return _writer.int64 end +_writer[8] = function(msg) return _writer.int32 end +_writer[9] = _writer[5] +_writer[10] = function(msg) return _writer.int52 end +_writer[11] = function(msg) return _writer.uint52 end + +_writer[128+1] = function(msg) return _writer.int_repeated end +_writer[128+2] = function(msg) return _writer.real_repeated end +_writer[128+3] = function(msg) return _writer.bool_repeated end +_writer[128+4] = function(msg) return _writer.string_repeated end +_writer[128+5] = function(msg) return _writer.string_repeated end +_writer[128+6] = function(msg) + local message = _writer.message_repeated + return function(self,key, v) + return message(self, key, v, msg) + end +end +_writer[128+7] = function(msg) return _writer.int64_repeated end +_writer[128+8] = function(msg) return _writer.int32_repeated end +_writer[128+9] = _writer[128+5] +_writer[128+10] = function(msg) return _writer.int52_repeated end +_writer[128+11] = function(msg) return _writer.uint52_repeated end + +local _encode_type_meta = {} + +function _encode_type_meta:__index(key) + local t, msg = c._env_type(P, self._CType, key) + local func = assert(_writer[t],key)(msg) + self[key] = func + return func +end + +setmetatable(encode_type_cache , { + __index = function(self, key) + local v = setmetatable({ _CType = key } , _encode_type_meta) + self[key] = v + return v + end +}) + +function encode( message, t , func , ...) + local encoder = c._wmessage_new(P, message) + assert(encoder , message) + encode_message(encoder, message, t) + if func then + local buffer, len = c._wmessage_buffer(encoder) + local ret = func(buffer, len, ...) + c._wmessage_delete(encoder) + return ret + else + local s = c._wmessage_buffer_string(encoder) + c._wmessage_delete(encoder) + return s + end +end + +--------- unpack ---------- + +local _pattern_type = { + [1] = {"%d","i"}, + [2] = {"%F","r"}, + [3] = {"%d","b"}, + [4] = {"%d","i"}, + [5] = {"%s","s"}, + [6] = {"%s","m"}, + [7] = {"%D","x"}, + [8] = {"%d","p"}, + [10] = {"%D","d"}, + [11] = {"%D","u"}, + [128+1] = {"%a","I"}, + [128+2] = {"%a","R"}, + [128+3] = {"%a","B"}, + [128+4] = {"%a","I"}, + [128+5] = {"%a","S"}, + [128+6] = {"%a","M"}, + [128+7] = {"%a","X"}, + [128+8] = {"%a","P"}, + [128+10] = {"%a", "D" }, + [128+11] = {"%a", "U" }, +} + +_pattern_type[9] = _pattern_type[5] +_pattern_type[128+9] = _pattern_type[128+5] + + +local function _pattern_create(pattern) + local iter = string.gmatch(pattern,"[^ ]+") + local message = iter() + local cpat = {} + local lua = {} + for v in iter do + local tidx = c._env_type(P, message, v) + local t = _pattern_type[tidx] + assert(t,tidx) + tinsert(cpat,v .. " " .. t[1]) + tinsert(lua,t[2]) + end + local cobj = c._pattern_new(P, message , "@" .. table.concat(cpat," ")) + if cobj == nil then + return + end + c._add_pattern(GC, cobj) + local pat = { + CObj = cobj, + format = table.concat(lua), + size = 0 + } + pat.size = c._pattern_size(pat.format) + + return pat +end + +setmetatable(_pattern_cache, { + __index = function(t, key) + local v = _pattern_create(key) + t[key] = v + return v + end +}) + +function unpack(pattern, buffer, length) + local pat = _pattern_cache[pattern] + return c._pattern_unpack(pat.CObj , pat.format, pat.size, buffer, length) +end + +function pack(pattern, ...) + local pat = _pattern_cache[pattern] + return c._pattern_pack(pat.CObj, pat.format, pat.size , ...) +end + +function check(typename , field) + if field == nil then + return c._env_type(P,typename) + else + return c._env_type(P,typename,field) ~=0 + end +end + +-------------- + +local default_cache = {} + +-- todo : clear default_cache, v._CObj + +local function default_table(typename) + local v = default_cache[typename] + if v then + return v + end + + v = { __index = assert(decode_message(typename , "")) } + + default_cache[typename] = v + return v +end + +local decode_message_mt = {} + +local function decode_message_cb(typename, buffer) + return setmetatable ( { typename, buffer } , decode_message_mt) +end + +function decode(typename, buffer, length) + local ret = {} + local ok = c._decode(P, decode_message_cb , ret , typename, buffer, length) + if ok then + return setmetatable(ret , default_table(typename)) + else + return false , c._last_error(P) + end +end + +local function expand(tbl) + local typename = rawget(tbl , 1) + local buffer = rawget(tbl , 2) + tbl[1] , tbl[2] = nil , nil + assert(c._decode(P, decode_message_cb , tbl , typename, buffer), typename) + setmetatable(tbl , default_table(typename)) +end + +function decode_message_mt.__index(tbl, key) + expand(tbl) + return tbl[key] +end + +function decode_message_mt.__pairs(tbl) + expand(tbl) + return pairs(tbl) +end + +local function set_default(typename, tbl) + for k,v in pairs(tbl) do + if type(v) == "table" then + local t, msg = c._env_type(P, typename, k) + if t == 6 then + set_default(msg, v) + elseif t == 128+6 then + for _,v in ipairs(v) do + set_default(msg, v) + end + end + end + end + return setmetatable(tbl , default_table(typename)) +end + +function register( buffer) + c._env_register(P, buffer) +end + +function register_file(filename) + local f = assert(io.open(filename , "rb")) + local buffer = f:read "*a" + c._env_register(P, buffer) + f:close() +end + +default=set_default diff --git a/Assets/LuaFramework/Lua/3rd/pbc/protobuf.lua.meta b/Assets/LuaFramework/Lua/3rd/pbc/protobuf.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..58023c516ab8d12cab2a621cc12ce720ea344b1c --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/pbc/protobuf.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 1ba29465c7f40ae4aa388cefab41f5e0 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/pbc/test.lua b/Assets/LuaFramework/Lua/3rd/pbc/test.lua new file mode 100644 index 0000000000000000000000000000000000000000..67dfb538afc6f27d9cb7627d4172fb9f04f877a6 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/pbc/test.lua @@ -0,0 +1,47 @@ +require "protobuf" + +path = Application.dataPath; +addr = io.open(path.."/pbc/addressbook.pb", "rb") +buffer = addr:read "*a" +addr:close() + +protobuf.register(buffer) + +t = protobuf.decode("google.protobuf.FileDescriptorSet", buffer) + +proto = t.file[1] + +print(proto.name) +print(proto.package) + +message = proto.message_type + +for _,v in ipairs(message) do + print(v.name) + for _,v in ipairs(v.field) do + print("\t".. v.name .. " ["..v.number.."] " .. v.label) + end +end + +addressbook = { + name = "Alice", + id = 12345, + phone = { + { number = "1301234567" }, + { number = "87654321", type = "WORK" }, + } +} + +code = protobuf.encode("tutorial.Person", addressbook) + +decode = protobuf.decode("tutorial.Person" , code) + +print(decode.name) +print(decode.id) +for _,v in ipairs(decode.phone) do + print("\t"..v.number, v.type) +end + +phonebuf = protobuf.pack("tutorial.Person.PhoneNumber number","87654321") +buffer = protobuf.pack("tutorial.Person name id phone", "Alice", 123, { phonebuf }) +print(protobuf.unpack("tutorial.Person name id phone", buffer)) diff --git a/Assets/LuaFramework/Lua/3rd/pbc/test.lua.meta b/Assets/LuaFramework/Lua/3rd/pbc/test.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..4a28aa4e005cd10408ca952aab3693f07d14ee85 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/pbc/test.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 4c1211c0f06916048bef318d346d5f04 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/pbc/test2.lua b/Assets/LuaFramework/Lua/3rd/pbc/test2.lua new file mode 100644 index 0000000000000000000000000000000000000000..c704c0651632bd6965ea1cc6d99515dd989992e2 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/pbc/test2.lua @@ -0,0 +1,32 @@ +local protobuf = require "protobuf" + +addr = io.open("../../build/addressbook.pb","rb") +buffer = addr:read "*a" +addr:close() +protobuf.register(buffer) + +local person = { + name = "Alice", + id = 123, + phone = { + { number = "123456789" , type = "MOBILE" }, + { number = "87654321" , type = "HOME" }, + } +} + +local buffer = protobuf.encode("tutorial.Person", person) + +local t = protobuf.decode("tutorial.Person", buffer) + +for k,v in pairs(t) do + if type(k) == "string" then + print(k,v) + end +end + +print(t.phone[2].type) + +for k,v in pairs(t.phone[1]) do + print(k,v) +end + diff --git a/Assets/LuaFramework/Lua/3rd/pbc/test2.lua.meta b/Assets/LuaFramework/Lua/3rd/pbc/test2.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..57e4f01ef907019129e6fba185919d3b827ca96d --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/pbc/test2.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 9dc1b7c55df9f024689900af8eef3bb0 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/pbc/testparser.lua b/Assets/LuaFramework/Lua/3rd/pbc/testparser.lua new file mode 100644 index 0000000000000000000000000000000000000000..98901b62bc55f436a7d607550d7f4bc014a93aaf --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/pbc/testparser.lua @@ -0,0 +1,26 @@ +protobuf = require "protobuf" +parser = require "parser" + +t = parser.register("addressbook.proto","../../test") + +addressbook = { + name = "Alice", + id = 12345, + phone = { + { number = "1301234567" }, + { number = "87654321", type = "WORK" }, + } +} + +code = protobuf.encode("tutorial.Person", addressbook) + +decode = protobuf.decode("tutorial.Person" , code) + +print(decode.name) +print(decode.id) +for _,v in ipairs(decode.phone) do + print("\t"..v.number, v.type) +end + +buffer = protobuf.pack("tutorial.Person name id", "Alice", 123) +print(protobuf.unpack("tutorial.Person name id", buffer)) \ No newline at end of file diff --git a/Assets/LuaFramework/Lua/3rd/pbc/testparser.lua.meta b/Assets/LuaFramework/Lua/3rd/pbc/testparser.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..20d0db2949446b8531ed746308382e0830fe9248 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/pbc/testparser.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 24b27e96507cabd4abcf9f24e6a0aaef +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/pblua.meta b/Assets/LuaFramework/Lua/3rd/pblua.meta new file mode 100644 index 0000000000000000000000000000000000000000..20c126dcb905f717477a8799d72f0cf782a6e454 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/pblua.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: a26a655c69d98443e898aff76fc87e75 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/pblua/login.proto b/Assets/LuaFramework/Lua/3rd/pblua/login.proto new file mode 100644 index 0000000000000000000000000000000000000000..da528b2f81da1d643101e8682fea58d00142dc14 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/pblua/login.proto @@ -0,0 +1,10 @@ + +message LoginRequest { + required int32 id = 1; + required string name = 2; + optional string email = 3; +} + +message LoginResponse { + required int32 id = 1; +} \ No newline at end of file diff --git a/Assets/LuaFramework/Lua/3rd/pblua/login.proto.meta b/Assets/LuaFramework/Lua/3rd/pblua/login.proto.meta new file mode 100644 index 0000000000000000000000000000000000000000..3eb66654a08a4597947ff52904fe9e0a79354829 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/pblua/login.proto.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: d5f5ef4fb87587040afd36aa5620d62c +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/pblua/login_pb.lua b/Assets/LuaFramework/Lua/3rd/pblua/login_pb.lua new file mode 100644 index 0000000000000000000000000000000000000000..9f72d04e7b04117bd9d44dc5bbda70cd7d423b63 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/pblua/login_pb.lua @@ -0,0 +1,69 @@ +-- Generated By protoc-gen-lua Do not Edit +local protobuf = require "protobuf/protobuf" +module('login_pb') + +local LOGINREQUEST = protobuf.Descriptor(); +local LOGINREQUEST_ID_FIELD = protobuf.FieldDescriptor(); +local LOGINREQUEST_NAME_FIELD = protobuf.FieldDescriptor(); +local LOGINREQUEST_EMAIL_FIELD = protobuf.FieldDescriptor(); +local LOGINRESPONSE = protobuf.Descriptor(); +local LOGINRESPONSE_ID_FIELD = protobuf.FieldDescriptor(); + +LOGINREQUEST_ID_FIELD.name = "id" +LOGINREQUEST_ID_FIELD.full_name = ".LoginRequest.id" +LOGINREQUEST_ID_FIELD.number = 1 +LOGINREQUEST_ID_FIELD.index = 0 +LOGINREQUEST_ID_FIELD.label = 2 +LOGINREQUEST_ID_FIELD.has_default_value = false +LOGINREQUEST_ID_FIELD.default_value = 0 +LOGINREQUEST_ID_FIELD.type = 5 +LOGINREQUEST_ID_FIELD.cpp_type = 1 + +LOGINREQUEST_NAME_FIELD.name = "name" +LOGINREQUEST_NAME_FIELD.full_name = ".LoginRequest.name" +LOGINREQUEST_NAME_FIELD.number = 2 +LOGINREQUEST_NAME_FIELD.index = 1 +LOGINREQUEST_NAME_FIELD.label = 2 +LOGINREQUEST_NAME_FIELD.has_default_value = false +LOGINREQUEST_NAME_FIELD.default_value = "" +LOGINREQUEST_NAME_FIELD.type = 9 +LOGINREQUEST_NAME_FIELD.cpp_type = 9 + +LOGINREQUEST_EMAIL_FIELD.name = "email" +LOGINREQUEST_EMAIL_FIELD.full_name = ".LoginRequest.email" +LOGINREQUEST_EMAIL_FIELD.number = 3 +LOGINREQUEST_EMAIL_FIELD.index = 2 +LOGINREQUEST_EMAIL_FIELD.label = 1 +LOGINREQUEST_EMAIL_FIELD.has_default_value = false +LOGINREQUEST_EMAIL_FIELD.default_value = "" +LOGINREQUEST_EMAIL_FIELD.type = 9 +LOGINREQUEST_EMAIL_FIELD.cpp_type = 9 + +LOGINREQUEST.name = "LoginRequest" +LOGINREQUEST.full_name = ".LoginRequest" +LOGINREQUEST.nested_types = {} +LOGINREQUEST.enum_types = {} +LOGINREQUEST.fields = {LOGINREQUEST_ID_FIELD, LOGINREQUEST_NAME_FIELD, LOGINREQUEST_EMAIL_FIELD} +LOGINREQUEST.is_extendable = false +LOGINREQUEST.extensions = {} +LOGINRESPONSE_ID_FIELD.name = "id" +LOGINRESPONSE_ID_FIELD.full_name = ".LoginResponse.id" +LOGINRESPONSE_ID_FIELD.number = 1 +LOGINRESPONSE_ID_FIELD.index = 0 +LOGINRESPONSE_ID_FIELD.label = 2 +LOGINRESPONSE_ID_FIELD.has_default_value = false +LOGINRESPONSE_ID_FIELD.default_value = 0 +LOGINRESPONSE_ID_FIELD.type = 5 +LOGINRESPONSE_ID_FIELD.cpp_type = 1 + +LOGINRESPONSE.name = "LoginResponse" +LOGINRESPONSE.full_name = ".LoginResponse" +LOGINRESPONSE.nested_types = {} +LOGINRESPONSE.enum_types = {} +LOGINRESPONSE.fields = {LOGINRESPONSE_ID_FIELD} +LOGINRESPONSE.is_extendable = false +LOGINRESPONSE.extensions = {} + +LoginRequest = protobuf.Message(LOGINREQUEST) +LoginResponse = protobuf.Message(LOGINRESPONSE) + diff --git a/Assets/LuaFramework/Lua/3rd/pblua/login_pb.lua.meta b/Assets/LuaFramework/Lua/3rd/pblua/login_pb.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..9111f043255121ed61bc15d0ec813a3e4aeaaa45 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/pblua/login_pb.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: a9c9ec3a721a0684ba88195d462e2241 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/pblua/person_pb.lua b/Assets/LuaFramework/Lua/3rd/pblua/person_pb.lua new file mode 100644 index 0000000000000000000000000000000000000000..7d19cd1eab437f1873247733cc1955879c546baf --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/pblua/person_pb.lua @@ -0,0 +1,107 @@ +-- Generated By protoc-gen-lua Do not Edit +local protobuf = require "protobuf/protobuf" +module('person_pb') + + +local PERSON = protobuf.Descriptor(); +local PERSON_ID_FIELD = protobuf.FieldDescriptor(); +local PERSON_NAME_FIELD = protobuf.FieldDescriptor(); +local PERSON_EMAIL_FIELD = protobuf.FieldDescriptor(); +local PHONE = protobuf.Descriptor(); +local PHONE_PHONE_TYPE = protobuf.EnumDescriptor(); +local PHONE_PHONE_TYPE_MOBILE_ENUM = protobuf.EnumValueDescriptor(); +local PHONE_PHONE_TYPE_HOME_ENUM = protobuf.EnumValueDescriptor(); +local PHONE_NUM_FIELD = protobuf.FieldDescriptor(); +local PHONE_TYPE_FIELD = protobuf.FieldDescriptor(); +local PHONE_PHONES_FIELD = protobuf.FieldDescriptor(); + +PERSON_ID_FIELD.name = "id" +PERSON_ID_FIELD.full_name = ".Person.id" +PERSON_ID_FIELD.number = 1 +PERSON_ID_FIELD.index = 0 +PERSON_ID_FIELD.label = 2 +PERSON_ID_FIELD.has_default_value = false +PERSON_ID_FIELD.default_value = 0 +PERSON_ID_FIELD.type = 5 +PERSON_ID_FIELD.cpp_type = 1 + +PERSON_NAME_FIELD.name = "name" +PERSON_NAME_FIELD.full_name = ".Person.name" +PERSON_NAME_FIELD.number = 2 +PERSON_NAME_FIELD.index = 1 +PERSON_NAME_FIELD.label = 2 +PERSON_NAME_FIELD.has_default_value = false +PERSON_NAME_FIELD.default_value = "" +PERSON_NAME_FIELD.type = 9 +PERSON_NAME_FIELD.cpp_type = 9 + +PERSON_EMAIL_FIELD.name = "email" +PERSON_EMAIL_FIELD.full_name = ".Person.email" +PERSON_EMAIL_FIELD.number = 3 +PERSON_EMAIL_FIELD.index = 2 +PERSON_EMAIL_FIELD.label = 1 +PERSON_EMAIL_FIELD.has_default_value = false +PERSON_EMAIL_FIELD.default_value = "" +PERSON_EMAIL_FIELD.type = 9 +PERSON_EMAIL_FIELD.cpp_type = 9 + +PERSON.name = "Person" +PERSON.full_name = ".Person" +PERSON.nested_types = {} +PERSON.enum_types = {} +PERSON.fields = {PERSON_ID_FIELD, PERSON_NAME_FIELD, PERSON_EMAIL_FIELD} +PERSON.is_extendable = true +PERSON.extensions = {} +PHONE_PHONE_TYPE_MOBILE_ENUM.name = "MOBILE" +PHONE_PHONE_TYPE_MOBILE_ENUM.index = 0 +PHONE_PHONE_TYPE_MOBILE_ENUM.number = 1 +PHONE_PHONE_TYPE_HOME_ENUM.name = "HOME" +PHONE_PHONE_TYPE_HOME_ENUM.index = 1 +PHONE_PHONE_TYPE_HOME_ENUM.number = 2 +PHONE_PHONE_TYPE.name = "PHONE_TYPE" +PHONE_PHONE_TYPE.full_name = ".Phone.PHONE_TYPE" +PHONE_PHONE_TYPE.values = {PHONE_PHONE_TYPE_MOBILE_ENUM,PHONE_PHONE_TYPE_HOME_ENUM} +PHONE_NUM_FIELD.name = "num" +PHONE_NUM_FIELD.full_name = ".Phone.num" +PHONE_NUM_FIELD.number = 1 +PHONE_NUM_FIELD.index = 0 +PHONE_NUM_FIELD.label = 1 +PHONE_NUM_FIELD.has_default_value = false +PHONE_NUM_FIELD.default_value = "" +PHONE_NUM_FIELD.type = 9 +PHONE_NUM_FIELD.cpp_type = 9 + +PHONE_TYPE_FIELD.name = "type" +PHONE_TYPE_FIELD.full_name = ".Phone.type" +PHONE_TYPE_FIELD.number = 2 +PHONE_TYPE_FIELD.index = 1 +PHONE_TYPE_FIELD.label = 1 +PHONE_TYPE_FIELD.has_default_value = false +PHONE_TYPE_FIELD.default_value = nil +PHONE_TYPE_FIELD.enum_type = PHONE_PHONE_TYPE +PHONE_TYPE_FIELD.type = 14 +PHONE_TYPE_FIELD.cpp_type = 8 + +PHONE_PHONES_FIELD.name = "phones" +PHONE_PHONES_FIELD.full_name = ".Phone.phones" +PHONE_PHONES_FIELD.number = 10 +PHONE_PHONES_FIELD.index = 0 +PHONE_PHONES_FIELD.label = 3 +PHONE_PHONES_FIELD.has_default_value = false +PHONE_PHONES_FIELD.default_value = {} +PHONE_PHONES_FIELD.message_type = PHONE +PHONE_PHONES_FIELD.type = 11 +PHONE_PHONES_FIELD.cpp_type = 10 + +PHONE.name = "Phone" +PHONE.full_name = ".Phone" +PHONE.nested_types = {} +PHONE.enum_types = {PHONE_PHONE_TYPE} +PHONE.fields = {PHONE_NUM_FIELD, PHONE_TYPE_FIELD} +PHONE.is_extendable = false +PHONE.extensions = {PHONE_PHONES_FIELD} + +Person = protobuf.Message(PERSON) +Phone = protobuf.Message(PHONE) + +Person.RegisterExtension(PHONE_PHONES_FIELD) diff --git a/Assets/LuaFramework/Lua/3rd/pblua/person_pb.lua.meta b/Assets/LuaFramework/Lua/3rd/pblua/person_pb.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..653c8fd7d73de43054c4a4feebde8525e4c43658 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/pblua/person_pb.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 8547a09e09800054285c19fb7a4f6c72 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/sproto.meta b/Assets/LuaFramework/Lua/3rd/sproto.meta new file mode 100644 index 0000000000000000000000000000000000000000..18d9a03de96080b3c3e9b61e006b6168da2e23a0 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/sproto.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 6fe0629549ff98e49b7f9eaffdcc247f +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/sproto/print_r.lua b/Assets/LuaFramework/Lua/3rd/sproto/print_r.lua new file mode 100644 index 0000000000000000000000000000000000000000..3a4a710d4267952d7a24840cc1b672548b383a7a --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/sproto/print_r.lua @@ -0,0 +1,31 @@ +local print = print +local tconcat = table.concat +local tinsert = table.insert +local srep = string.rep +local type = type +local pairs = pairs +local tostring = tostring +local next = next + +local function print_r(root) + local cache = { [root] = "." } + local function _dump(t,space,name) + local temp = {} + for k,v in pairs(t) do + local key = tostring(k) + if cache[v] then + tinsert(temp,"+" .. key .. " {" .. cache[v].."}") + elseif type(v) == "table" then + local new_key = name .. "." .. key + cache[v] = new_key + tinsert(temp,"+" .. key .. _dump(v,space .. (next(t,k) and "|" or " " ).. srep(" ",#key),new_key)) + else + tinsert(temp,"+" .. key .. " [" .. tostring(v).."]") + end + end + return tconcat(temp,"\n"..space) + end + print(_dump(root, "","")) +end + +return print_r \ No newline at end of file diff --git a/Assets/LuaFramework/Lua/3rd/sproto/print_r.lua.meta b/Assets/LuaFramework/Lua/3rd/sproto/print_r.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..770632d43d27824e66a4cb4150324d3d1c5e2cc0 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/sproto/print_r.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: a0cc54520d1d7eb498493479ceb15d95 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/sproto/sproto.lua b/Assets/LuaFramework/Lua/3rd/sproto/sproto.lua new file mode 100644 index 0000000000000000000000000000000000000000..1bd92ab5c08d16bcccde6ec551c195e69e6c44c4 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/sproto/sproto.lua @@ -0,0 +1,230 @@ +local core = require "sproto.core" +local assert = assert + +local sproto = {} +local host = {} + +local weak_mt = { __mode = "kv" } +local sproto_mt = { __index = sproto } +local sproto_nogc = { __index = sproto } +local host_mt = { __index = host } + +function sproto_mt:__gc() + core.deleteproto(self.__cobj) +end + +function sproto.new(bin) + local cobj = assert(core.newproto(bin)) + local self = { + __cobj = cobj, + __tcache = setmetatable( {} , weak_mt ), + __pcache = setmetatable( {} , weak_mt ), + } + return setmetatable(self, sproto_mt) +end + +function sproto.sharenew(cobj) + local self = { + __cobj = cobj, + __tcache = setmetatable( {} , weak_mt ), + __pcache = setmetatable( {} , weak_mt ), + } + return setmetatable(self, sproto_nogc) +end + +function sproto.parse(ptext) + local parser = require "3rd/sproto/sprotoparser" + local pbin = parser.parse(ptext) + return sproto.new(pbin) +end + +function sproto:host( packagename ) + packagename = packagename or "package" + local obj = { + __proto = self, + __package = core.querytype(self.__cobj, packagename), + __session = {}, + } + return setmetatable(obj, host_mt) +end + +local function querytype(self, typename) + local v = self.__tcache[typename] + if not v then + v = core.querytype(self.__cobj, typename) + self.__tcache[typename] = v + end + + return v +end + +function sproto:encode(typename, tbl) + local st = querytype(self, typename) + return core.encode(st, tbl) +end + +function sproto:decode(typename, ...) + local st = querytype(self, typename) + return core.decode(st, ...) +end + +function sproto:pencode(typename, tbl) + local st = querytype(self, typename) + return core.pack(core.encode(st, tbl)) +end + +function sproto:pdecode(typename, ...) + local st = querytype(self, typename) + return core.decode(st, core.unpack(...)) +end + +local function queryproto(self, pname) + local v = self.__pcache[pname] + if not v then + local tag, req, resp = core.protocol(self.__cobj, pname) + assert(tag, pname .. " not found") + if tonumber(pname) then + pname, tag = tag, pname + end + v = { + request = req, + response =resp, + name = pname, + tag = tag, + } + self.__pcache[pname] = v + self.__pcache[tag] = v + end + + return v +end + +function sproto:request_encode(protoname, tbl) + local p = queryproto(self, protoname) + local request = p.request + if request then + return core.encode(request,tbl) , p.tag + else + return "" , p.tag + end +end + +function sproto:response_encode(protoname, tbl) + local p = queryproto(self, protoname) + local response = p.response + if response then + return core.encode(response,tbl) + else + return "" + end +end + +function sproto:request_decode(protoname, ...) + local p = queryproto(self, protoname) + local request = p.request + if request then + return core.decode(request,...) , p.name + else + return nil, p.name + end +end + +function sproto:response_decode(protoname, ...) + local p = queryproto(self, protoname) + local response = p.response + if response then + return core.decode(response,...) + end +end + +sproto.pack = core.pack +sproto.unpack = core.unpack + +function sproto:default(typename, type) + if type == nil then + return core.default(querytype(self, typename)) + else + local p = queryproto(self, typename) + if type == "REQUEST" then + if p.request then + return core.default(p.request) + end + elseif type == "RESPONSE" then + if p.response then + return core.default(p.response) + end + else + error "Invalid type" + end + end +end + +local header_tmp = {} + +local function gen_response(self, response, session) + return function(args) + header_tmp.type = nil + header_tmp.session = session + local header = core.encode(self.__package, header_tmp) + if response then + local content = core.encode(response, args) + return core.pack(header .. content) + else + return core.pack(header) + end + end +end + +function host:dispatch(...) + local bin = core.unpack(...) + header_tmp.type = nil + header_tmp.session = nil + local header, size = core.decode(self.__package, bin, header_tmp) + local content = bin:sub(size + 1) + if header.type then + -- request + local proto = queryproto(self.__proto, header.type) + local result + if proto.request then + result = core.decode(proto.request, content) + end + if header_tmp.session then + return "REQUEST", proto.name, result, gen_response(self, proto.response, header_tmp.session) + else + return "REQUEST", proto.name, result + end + else + -- response + local session = assert(header_tmp.session, "session not found") + local response = assert(self.__session[session], "Unknown session") + self.__session[session] = nil + if response == true then + return "RESPONSE", session + else + local result = core.decode(response, content) + return "RESPONSE", session, result + end + end +end + +function host:attach(sp) + return function(name, args, session) + local proto = queryproto(sp, name) + header_tmp.type = proto.tag + header_tmp.session = session + local header = core.encode(self.__package, header_tmp) + + if session then + self.__session[session] = proto.response or true + end + + if args then + local content = core.encode(proto.request, args) + return core.pack(header .. content) + else + return core.pack(header) + end + end +end + +return sproto diff --git a/Assets/LuaFramework/Lua/3rd/sproto/sproto.lua.meta b/Assets/LuaFramework/Lua/3rd/sproto/sproto.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..29dc515ba83f5f2743c31e9899fb5576baee4554 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/sproto/sproto.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 3bec7f55cc120f241b5cab88bf230ac3 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/sproto/sprotoparser.lua b/Assets/LuaFramework/Lua/3rd/sproto/sprotoparser.lua new file mode 100644 index 0000000000000000000000000000000000000000..03524ac0163be60e5aa863006cd9af84b4c27a00 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/sproto/sprotoparser.lua @@ -0,0 +1,463 @@ +local lpeg = require "lpeg" +local table = require "table" + +local packbytes +local packvalue + +if _VERSION == "Lua 5.3" then + function packbytes(str) + return string.pack("=0 and id < 65536) + local a = id % 256 + local b = math.floor(id / 256) + return string.char(a) .. string.char(b) + end +end + +local P = lpeg.P +local S = lpeg.S +local R = lpeg.R +local C = lpeg.C +local Ct = lpeg.Ct +local Cg = lpeg.Cg +local Cc = lpeg.Cc +local V = lpeg.V + +local function count_lines(_,pos, parser_state) + if parser_state.pos < pos then + parser_state.line = parser_state.line + 1 + parser_state.pos = pos + end + return pos +end + +local exception = lpeg.Cmt( lpeg.Carg(1) , function ( _ , pos, parser_state) + error(string.format("syntax error at [%s] line (%d)", parser_state.file or "", parser_state.line)) + return pos +end) + +local eof = P(-1) +local newline = lpeg.Cmt((P"\n" + "\r\n") * lpeg.Carg(1) ,count_lines) +local line_comment = "#" * (1 - newline) ^0 * (newline + eof) +local blank = S" \t" + newline + line_comment +local blank0 = blank ^ 0 +local blanks = blank ^ 1 +local alpha = R"az" + R"AZ" + "_" +local alnum = alpha + R"09" +local word = alpha * alnum ^ 0 +local name = C(word) +local typename = C(word * ("." * word) ^ 0) +local tag = R"09" ^ 1 / tonumber +local mainkey = "(" * blank0 * name * blank0 * ")" + +local function multipat(pat) + return Ct(blank0 * (pat * blanks) ^ 0 * pat^0 * blank0) +end + +local function namedpat(name, pat) + return Ct(Cg(Cc(name), "type") * Cg(pat)) +end + +local typedef = P { + "ALL", + FIELD = namedpat("field", (name * blanks * tag * blank0 * ":" * blank0 * (C"*")^-1 * typename * mainkey^0)), + STRUCT = P"{" * multipat(V"FIELD" + V"TYPE") * P"}", + TYPE = namedpat("type", P"." * name * blank0 * V"STRUCT" ), + SUBPROTO = Ct((C"request" + C"response") * blanks * (typename + V"STRUCT")), + PROTOCOL = namedpat("protocol", name * blanks * tag * blank0 * P"{" * multipat(V"SUBPROTO") * P"}"), + ALL = multipat(V"TYPE" + V"PROTOCOL"), +} + +local proto = blank0 * typedef * blank0 + +local convert = {} + +function convert.protocol(all, obj) + local result = { tag = obj[2] } + for _, p in ipairs(obj[3]) do + assert(result[p[1]] == nil) + local typename = p[2] + if type(typename) == "table" then + local struct = typename + typename = obj[1] .. "." .. p[1] + all.type[typename] = convert.type(all, { typename, struct }) + end + result[p[1]] = typename + end + return result +end + +function convert.type(all, obj) + local result = {} + local typename = obj[1] + local tags = {} + local names = {} + for _, f in ipairs(obj[2]) do + if f.type == "field" then + local name = f[1] + if names[name] then + error(string.format("redefine %s in type %s", name, typename)) + end + names[name] = true + local tag = f[2] + if tags[tag] then + error(string.format("redefine tag %d in type %s", tag, typename)) + end + tags[tag] = true + local field = { name = name, tag = tag } + table.insert(result, field) + local fieldtype = f[3] + if fieldtype == "*" then + field.array = true + fieldtype = f[4] + end + local mainkey = f[5] + if mainkey then + assert(field.array) + field.key = mainkey + end + field.typename = fieldtype + else + assert(f.type == "type") -- nest type + local nesttypename = typename .. "." .. f[1] + f[1] = nesttypename + assert(all.type[nesttypename] == nil, "redefined " .. nesttypename) + all.type[nesttypename] = convert.type(all, f) + end + end + table.sort(result, function(a,b) return a.tag < b.tag end) + return result +end + +local function adjust(r) + local result = { type = {} , protocol = {} } + + for _, obj in ipairs(r) do + local set = result[obj.type] + local name = obj[1] + assert(set[name] == nil , "redefined " .. name) + set[name] = convert[obj.type](result,obj) + end + + return result +end + +local buildin_types = { + integer = 0, + boolean = 1, + string = 2, +} + +local function checktype(types, ptype, t) + if buildin_types[t] then + return t + end + local fullname = ptype .. "." .. t + if types[fullname] then + return fullname + else + ptype = ptype:match "(.+)%..+$" + if ptype then + return checktype(types, ptype, t) + elseif types[t] then + return t + end + end +end + +local function check_protocol(r) + local map = {} + local type = r.type + for name, v in pairs(r.protocol) do + local tag = v.tag + local request = v.request + local response = v.response + local p = map[tag] + + if p then + error(string.format("redefined protocol tag %d at %s", tag, name)) + end + + if request and not type[request] then + error(string.format("Undefined request type %s in protocol %s", request, name)) + end + + if response and not type[response] then + error(string.format("Undefined response type %s in protocol %s", response, name)) + end + + map[tag] = v + end + return r +end + +local function flattypename(r) + for typename, t in pairs(r.type) do + for _, f in pairs(t) do + local ftype = f.typename + local fullname = checktype(r.type, typename, ftype) + if fullname == nil then + error(string.format("Undefined type %s in type %s", ftype, typename)) + end + f.typename = fullname + end + end + + return r +end + +local function parser(text,filename) + local state = { file = filename, pos = 0, line = 1 } + local r = lpeg.match(proto * -1 + exception , text , 1, state ) + return flattypename(check_protocol(adjust(r))) +end + +--[[ +-- The protocol of sproto +.type { + .field { + name 0 : string + buildin 1 : integer + type 2 : integer + tag 3 : integer + array 4 : boolean + key 5 : integer # If key exists, array must be true, and it's a map. + } + name 0 : string + fields 1 : *field +} + +.protocol { + name 0 : string + tag 1 : integer + request 2 : integer # index + response 3 : integer # index +} + +.group { + type 0 : *type + protocol 1 : *protocol +} +]] + +local function packfield(f) + local strtbl = {} + if f.array then + if f.key then + table.insert(strtbl, "\6\0") -- 6 fields + else + table.insert(strtbl, "\5\0") -- 5 fields + end + else + table.insert(strtbl, "\4\0") -- 4 fields + end + table.insert(strtbl, "\0\0") -- name (tag = 0, ref an object) + if f.buildin then + table.insert(strtbl, packvalue(f.buildin)) -- buildin (tag = 1) + table.insert(strtbl, "\1\0") -- skip (tag = 2) + table.insert(strtbl, packvalue(f.tag)) -- tag (tag = 3) + else + table.insert(strtbl, "\1\0") -- skip (tag = 1) + table.insert(strtbl, packvalue(f.type)) -- type (tag = 2) + table.insert(strtbl, packvalue(f.tag)) -- tag (tag = 3) + end + if f.array then + table.insert(strtbl, packvalue(1)) -- array = true (tag = 4) + end + if f.key then + table.insert(strtbl, packvalue(f.key)) -- key tag (tag = 5) + end + table.insert(strtbl, packbytes(f.name)) -- external object (name) + return packbytes(table.concat(strtbl)) +end + +local function packtype(name, t, alltypes) + local fields = {} + local tmp = {} + for _, f in ipairs(t) do + tmp.array = f.array + tmp.name = f.name + tmp.tag = f.tag + + tmp.buildin = buildin_types[f.typename] + local subtype + if not tmp.buildin then + subtype = assert(alltypes[f.typename]) + tmp.type = subtype.id + else + tmp.type = nil + end + if f.key then + tmp.key = subtype.fields[f.key] + if not tmp.key then + error("Invalid map index :" .. f.key) + end + else + tmp.key = nil + end + + table.insert(fields, packfield(tmp)) + end + local data + if #fields == 0 then + data = { + "\1\0", -- 1 fields + "\0\0", -- name (id = 0, ref = 0) + packbytes(name), + } + else + data = { + "\2\0", -- 2 fields + "\0\0", -- name (tag = 0, ref = 0) + "\0\0", -- field[] (tag = 1, ref = 1) + packbytes(name), + packbytes(table.concat(fields)), + } + end + + return packbytes(table.concat(data)) +end + +local function packproto(name, p, alltypes) + if p.request then + local request = alltypes[p.request] + if request == nil then + error(string.format("Protocol %s request type %s not found", name, p.request)) + end + request = request.id + end + local tmp = { + "\4\0", -- 4 fields + "\0\0", -- name (id=0, ref=0) + packvalue(p.tag), -- tag (tag=1) + } + if p.request == nil and p.response == nil then + tmp[1] = "\2\0" + else + if p.request then + table.insert(tmp, packvalue(alltypes[p.request].id)) -- request typename (tag=2) + else + table.insert(tmp, "\1\0") + end + if p.response then + table.insert(tmp, packvalue(alltypes[p.response].id)) -- request typename (tag=3) + else + tmp[1] = "\3\0" + end + end + + table.insert(tmp, packbytes(name)) + + return packbytes(table.concat(tmp)) +end + +local function packgroup(t,p) + if next(t) == nil then + assert(next(p) == nil) + return "\0\0" + end + local tt, tp + local alltypes = {} + for name in pairs(t) do + table.insert(alltypes, name) + end + table.sort(alltypes) -- make result stable + for idx, name in ipairs(alltypes) do + local fields = {} + for _, type_fields in ipairs(t[name]) do + if buildin_types[type_fields.typename] then + fields[type_fields.name] = type_fields.tag + end + end + alltypes[name] = { id = idx - 1, fields = fields } + end + tt = {} + for _,name in ipairs(alltypes) do + table.insert(tt, packtype(name, t[name], alltypes)) + end + tt = packbytes(table.concat(tt)) + if next(p) then + local tmp = {} + for name, tbl in pairs(p) do + table.insert(tmp, tbl) + tbl.name = name + end + table.sort(tmp, function(a,b) return a.tag < b.tag end) + + tp = {} + for _, tbl in ipairs(tmp) do + table.insert(tp, packproto(tbl.name, tbl, alltypes)) + end + tp = packbytes(table.concat(tp)) + end + local result + if tp == nil then + result = { + "\1\0", -- 1 field + "\0\0", -- type[] (id = 0, ref = 0) + tt, + } + else + result = { + "\2\0", -- 2fields + "\0\0", -- type array (id = 0, ref = 0) + "\0\0", -- protocol array (id = 1, ref =1) + + tt, + tp, + } + end + + return table.concat(result) +end + +local function encodeall(r) + return packgroup(r.type, r.protocol) +end + +local sparser = {} + +function sparser.dump(str) + local tmp = "" + for i=1,#str do + tmp = tmp .. string.format("%02X ", string.byte(str,i)) + if i % 8 == 0 then + if i % 16 == 0 then + print(tmp) + tmp = "" + else + tmp = tmp .. "- " + end + end + end + print(tmp) +end + +function sparser.parse(text, name) + local r = parser(text, name or "=text") + local data = encodeall(r) + return data +end + +return sparser diff --git a/Assets/LuaFramework/Lua/3rd/sproto/sprotoparser.lua.meta b/Assets/LuaFramework/Lua/3rd/sproto/sprotoparser.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..484087f67524eef0f332b2b0661e41b8b240b7c4 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/sproto/sprotoparser.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 5da2b55784b954744b87ba7434bbfc6b +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/sproto/test.lua b/Assets/LuaFramework/Lua/3rd/sproto/test.lua new file mode 100644 index 0000000000000000000000000000000000000000..a70884f7d5d9ba567e8aba257d4d2a0dc64dd0a6 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/sproto/test.lua @@ -0,0 +1,66 @@ +local sproto = require "sproto" +local core = require "sproto.core" +local print_r = require "print_r" + +local sp = sproto.parse [[ +.Person { + name 0 : string + id 1 : integer + email 2 : string + + .PhoneNumber { + number 0 : string + type 1 : integer + } + + phone 3 : *PhoneNumber +} + +.AddressBook { + person 0 : *Person(id) + others 1 : *Person +} +]] + +-- core.dumpproto only for debug use +core.dumpproto(sp.__cobj) + +local def = sp:default "Person" +print("default table for Person") +print_r(def) +print("--------------") + +local ab = { + person = { + [10000] = { + name = "Alice", + id = 10000, + phone = { + { number = "123456789" , type = 1 }, + { number = "87654321" , type = 2 }, + } + }, + [20000] = { + name = "Bob", + id = 20000, + phone = { + { number = "01234567890" , type = 3 }, + } + } + }, + others = { + { + name = "Carol", + id = 30000, + phone = { + { number = "9876543210" }, + } + }, + } +} + +collectgarbage "stop" + +local code = sp:encode("AddressBook", ab) +local addr = sp:decode("AddressBook", code) +print_r(addr) diff --git a/Assets/LuaFramework/Lua/3rd/sproto/test.lua.meta b/Assets/LuaFramework/Lua/3rd/sproto/test.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..3991ee0197f833a7af411b6b4b54b2afcaea9031 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/sproto/test.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 770c604ef5792ca4fb5fdb25616901ec +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/sproto/testall.lua b/Assets/LuaFramework/Lua/3rd/sproto/testall.lua new file mode 100644 index 0000000000000000000000000000000000000000..22bdaa2c4c0696b15cd3a8f1def7ad1b92f50cdc --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/sproto/testall.lua @@ -0,0 +1,56 @@ +local sproto = require "sproto" +local print_r = require "print_r" + +local sp = sproto.parse [[ +.foobar { + .nest { + a 1 : string + b 3 : boolean + c 5 : integer + } + a 0 : string + b 1 : integer + c 2 : boolean + d 3 : *nest(a) + + e 4 : *string + f 5 : *integer + g 6 : *boolean + h 7 : *foobar +} +]] + +local obj = { + a = "hello", + b = 1000000, + c = true, + d = { + { + a = "one", + -- skip b + c = -1, + }, + { + a = "two", + b = true, + }, + { + a = "", + b = false, + c = 1, + }, + }, + e = { "ABC", "", "def" }, + f = { -3, -2, -1, 0 , 1, 2}, + g = { true, false, true }, + h = { + { b = 100 }, + {}, + { b = -100, c= false }, + { b = 0, e = { "test" } }, + }, +} + +local code = sp:encode("foobar", obj) +obj = sp:decode("foobar", code) +print_r(obj) diff --git a/Assets/LuaFramework/Lua/3rd/sproto/testall.lua.meta b/Assets/LuaFramework/Lua/3rd/sproto/testall.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..1cc429fbca8c0e4c0af37c54d5da1b3c105d5290 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/sproto/testall.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 938292c8d9e6fe546bedc5276526deec +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/3rd/sproto/testrpc.lua b/Assets/LuaFramework/Lua/3rd/sproto/testrpc.lua new file mode 100644 index 0000000000000000000000000000000000000000..8a02f9a895834e95e0f638c3c5b19db4546c6259 --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/sproto/testrpc.lua @@ -0,0 +1,94 @@ +local sproto = require "sproto" +local print_r = require "print_r" + +local server_proto = sproto.parse [[ +.package { + type 0 : integer + session 1 : integer +} + +foobar 1 { + request { + what 0 : string + } + response { + ok 0 : boolean + } +} + +foo 2 { + response { + ok 0 : boolean + } +} + +bar 3 {} + +blackhole 4 { +} +]] + +local client_proto = sproto.parse [[ +.package { + type 0 : integer + session 1 : integer +} +]] + +print("=== default table") + +print_r(server_proto:default("package")) +print_r(server_proto:default("foobar", "REQUEST")) +assert(server_proto:default("foo", "REQUEST")==nil) +assert(server_proto:request_encode("foo")=="") +server_proto:response_encode("foo", { ok = true }) +assert(server_proto:request_decode("blackhole")==nil) +assert(server_proto:response_decode("blackhole")==nil) + +print("=== test 1") + +-- The type package must has two field : type and session +local server = server_proto:host "package" +local client = client_proto:host "package" +local client_request = client:attach(server_proto) + +print("client request foobar") +local req = client_request("foobar", { what = "foo" }, 1) +print("request foobar size =", #req) +local type, name, request, response = server:dispatch(req) +assert(type == "REQUEST" and name == "foobar") +print_r(request) +print("server response") +local resp = response { ok = true } +print("response package size =", #resp) +print("client dispatch") +local type, session, response = client:dispatch(resp) +assert(type == "RESPONSE" and session == 1) +print_r(response) + +local req = client_request("foo", nil, 2) +print("request foo size =", #req) +local type, name, request, response = server:dispatch(req) +assert(type == "REQUEST" and name == "foo" and request == nil) +local resp = response { ok = false } +print("response package size =", #resp) +print("client dispatch") +local type, session, response = client:dispatch(resp) +assert(type == "RESPONSE" and session == 2) +print_r(response) + +local req = client_request("bar") -- bar has no response +print("request bar size =", #req) +local type, name, request, response = server:dispatch(req) +assert(type == "REQUEST" and name == "bar" and request == nil and response == nil) + +local req = client_request "blackhole" +print("request blackhole size = ", #req) + +print("=== test 2") +local v, tag = server_proto:request_encode("foobar", { what = "hello"}) +print("tag =", tag) +print_r(server_proto:request_decode("foobar", v)) +local v, tag = server_proto:response_encode("foobar", { ok = true }) +print("tag =", tag) +print_r(server_proto:response_decode("foobar", v)) diff --git a/Assets/LuaFramework/Lua/3rd/sproto/testrpc.lua.meta b/Assets/LuaFramework/Lua/3rd/sproto/testrpc.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..52776b81caf8ee8c7a14d70fe172c730dcb62e4d --- /dev/null +++ b/Assets/LuaFramework/Lua/3rd/sproto/testrpc.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 9e5d4ccf4f7badd428fc6aed849504ff +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/Common.meta b/Assets/LuaFramework/Lua/Common.meta new file mode 100644 index 0000000000000000000000000000000000000000..c7e8464db58a2e3f13a85a8ffb467d589dab386f --- /dev/null +++ b/Assets/LuaFramework/Lua/Common.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 1a9e9888a6a944b7595d96047083e405 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/Common/define.lua b/Assets/LuaFramework/Lua/Common/define.lua new file mode 100644 index 0000000000000000000000000000000000000000..b20e7029c1ddf7c920dd69829d1c2e80df3d2ccb --- /dev/null +++ b/Assets/LuaFramework/Lua/Common/define.lua @@ -0,0 +1,24 @@ + +--鍗忚绫诲瀷-- +ProtocalType = { + BINARY = 0, + PB_LUA = 1, + PBC = 2, + SPROTO = 3, +} +--褰撳墠浣跨敤鐨勫崗璁被鍨-- +TestProtoType = ProtocalType.BINARY + +Util = LuaFramework.Util +AppConst = LuaFramework.AppConst +LuaHelper = LuaFramework.LuaHelper +ByteBuffer = LuaFramework.ByteBuffer + + +networkMgr = LuaHelper.GetNetManager() + +WWW = UnityEngine.WWW +GameObject = UnityEngine.GameObject +PlayerPrefs = UnityEngine.PlayerPrefs + +panelMgr = PanelMgr.instance \ No newline at end of file diff --git a/Assets/LuaFramework/Lua/Common/define.lua.meta b/Assets/LuaFramework/Lua/Common/define.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..a286f7aacff2210b8e47b7a3a6637ce4e6b49036 --- /dev/null +++ b/Assets/LuaFramework/Lua/Common/define.lua.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 453aacf6267e73748b38e2d4d5df2e75 +timeCreated: 1426783365 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Lua/Common/functions.lua b/Assets/LuaFramework/Lua/Common/functions.lua new file mode 100644 index 0000000000000000000000000000000000000000..7b33aad06afc6231eb1512e354bd87956669afd0 --- /dev/null +++ b/Assets/LuaFramework/Lua/Common/functions.lua @@ -0,0 +1,69 @@ + +--杈撳嚭鏃ュ織-- +function log(str) + GameLogger.Log(str); +end + +--閿欒鏃ュ織-- +function logError(str) + GameLogger.LogError(str); +end + +--璀﹀憡鏃ュ織-- +function logWarn(str) + GameLogger.LogWarning(str); +end + +function logGreen(str) + GameLogger.LogGreen(str) +end + +--鏌ユ壘瀵硅薄-- +function find(str) + return GameObject.Find(str); +end + +function destroy(obj) + GameObject.Destroy(obj); +end + +function newObject(prefab) + return GameObject.Instantiate(prefab); +end + +--鍒涘缓闈㈡澘-- +function createPanel(name) + PanelManager:CreatePanel(name); +end + +function child(str) + return transform:FindChild(str); +end + +function subGet(childNode, typeName) + return child(childNode):GetComponent(typeName); +end + +function findPanel(str) + local obj = find(str); + if obj == nil then + error(str.." is null"); + return nil; + end + return obj:GetComponent("BaseLua"); +end + +function isNilOrNull(obj) + return nil == obj or null == obj +end + +function safeDestroy(obj) + if not isNilOrNull(obj) then + GameObject.Destroy(obj) + obj = nil + end +end + +function isStringNilOrEmpty(str) + return nil == str or null == str or "" == str +end \ No newline at end of file diff --git a/Assets/LuaFramework/Lua/Common/functions.lua.meta b/Assets/LuaFramework/Lua/Common/functions.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..171607b18430aab43e8fa544f38d0cb0f817796f --- /dev/null +++ b/Assets/LuaFramework/Lua/Common/functions.lua.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 945af47fecee10044989b172212a1256 +timeCreated: 1426783366 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Lua/Common/protocal.lua b/Assets/LuaFramework/Lua/Common/protocal.lua new file mode 100644 index 0000000000000000000000000000000000000000..2c567a5dd3d5507f7fd217936343d86cbe07f178 --- /dev/null +++ b/Assets/LuaFramework/Lua/Common/protocal.lua @@ -0,0 +1,9 @@ +--Buildin Table +Protocal = { + Connect = '101'; --杩炴帴鏈嶅姟鍣 + Exception = '102'; --寮傚父鎺夌嚎 + Disconnect = '103'; --姝e父鏂嚎 + Message = '104'; --鎺ユ敹娑堟伅 +} + + diff --git a/Assets/LuaFramework/Lua/Common/protocal.lua.meta b/Assets/LuaFramework/Lua/Common/protocal.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..3136bccb52411f08c0390f90aa5cc327efb90467 --- /dev/null +++ b/Assets/LuaFramework/Lua/Common/protocal.lua.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 41c0bebeedd51e84fb0130409341ef47 +timeCreated: 1426783365 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Lua/Config.meta b/Assets/LuaFramework/Lua/Config.meta new file mode 100644 index 0000000000000000000000000000000000000000..3ddcef2411eea3539f45c2e9713a7bbc3ac1af32 --- /dev/null +++ b/Assets/LuaFramework/Lua/Config.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bc7f76eac5bc62343b8f25ba956057a1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Lua/Config/GlobalCfg.lua b/Assets/LuaFramework/Lua/Config/GlobalCfg.lua new file mode 100644 index 0000000000000000000000000000000000000000..c6234fd147684cae2a38130d144636a397c05ebc --- /dev/null +++ b/Assets/LuaFramework/Lua/Config/GlobalCfg.lua @@ -0,0 +1,6 @@ +-- 鑰冭瘯鍑嗗叆vip绛夌骇 +examine_entrance_vip_level = 1 +-- 鎵惧伐浣滃噯鍏ip绛夌骇 +job_entrance_vip_level = 2 +-- 鐩镐翰鍑嗗叆vip绛夌骇 +date_entrance_vip_level = 3 \ No newline at end of file diff --git a/Assets/LuaFramework/Lua/Config/GlobalCfg.lua.meta b/Assets/LuaFramework/Lua/Config/GlobalCfg.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..b940153c505b73e62aee916a627d83768032a5ab --- /dev/null +++ b/Assets/LuaFramework/Lua/Config/GlobalCfg.lua.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 5ed8d023ccfe445468122c6e7c9b7bc7 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Lua/Logic.meta b/Assets/LuaFramework/Lua/Logic.meta new file mode 100644 index 0000000000000000000000000000000000000000..bfd07451aaaa9a628dc48021984cb316e00d7194 --- /dev/null +++ b/Assets/LuaFramework/Lua/Logic.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 4bd4c8762df45ba4b922467e09297fb6 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/Logic/Game.lua b/Assets/LuaFramework/Lua/Logic/Game.lua new file mode 100644 index 0000000000000000000000000000000000000000..a8a94708b879c639042e7090ac491c0cb98bde2a --- /dev/null +++ b/Assets/LuaFramework/Lua/Logic/Game.lua @@ -0,0 +1,39 @@ +require "3rd/pblua/login_pb" +require "3rd/pbc/protobuf" + +local lpeg = require "lpeg" + +local json = require "cjson" +local util = require "3rd/cjson/util" + +local sproto = require "3rd/sproto/sproto" +local core = require "sproto.core" +local print_r = require "3rd/sproto/print_r" + +require "Logic/LuaClass" +require "Common/functions" +require "LuaFileList" + +--绠$悊鍣-- +Game = {}; +local this = Game; + +local game; +local transform; +local gameObject; +local WWW = UnityEngine.WWW; + + + +--鍒濆鍖栧畬鎴愶紝鍙戦侀摼鎺ユ湇鍔″櫒淇℃伅-- +function Game.OnInitOK() + -- 鍒涘缓鐧诲綍鐣岄潰 + LoginPanel.Show() + + log('Game.OnInitOK--->>>'); +end + +--閿姣-- +function Game.OnDestroy() + +end diff --git a/Assets/LuaFramework/Lua/Logic/Game.lua.meta b/Assets/LuaFramework/Lua/Logic/Game.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..1eb43736bfdc4b11cb5be8249ea83b55a7fa6656 --- /dev/null +++ b/Assets/LuaFramework/Lua/Logic/Game.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: a211e85690e156749ad8816bba582708 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/Logic/LoginLogic.lua b/Assets/LuaFramework/Lua/Logic/LoginLogic.lua new file mode 100644 index 0000000000000000000000000000000000000000..1191d31c0c04f13c656c9332caaaafab427a17fd --- /dev/null +++ b/Assets/LuaFramework/Lua/Logic/LoginLogic.lua @@ -0,0 +1,47 @@ +LoginLogic = {} +local this = LoginLogic +local json = require 'cjson' + +-- 鐧诲綍 +function LoginLogic.Dologin(account, pwd, cb) + + pwd = Util.md5(pwd) + -- 璇绘暟鎹簱 + local dbStr = PlayerPrefs.GetString("ACCOUNT_PWD", "{}") + local db = json.decode(dbStr) + if nil == db[account] then + cb(3, "璐﹀彿鏈敞鍐岋紝璇峰厛娉ㄥ唽") + return + end + if pwd ~= db[account] then + cb(4, "瀵嗙爜涓嶆纭") + return + end + cb(0, "鐧诲綍鎴愬姛") +end + +-- 娉ㄥ唽 +function LoginLogic.DoRegist(account, pwd, cb) + if isStringNilOrEmpty(account) then + cb(1, "璇疯緭鍏ヨ处鍙") + return + end + if isStringNilOrEmpty(pwd) then + cb(2, "璇疯緭鍏ュ瘑鐮") + return + end + pwd = Util.md5(pwd) + -- 璇绘暟鎹簱 + local dbStr = PlayerPrefs.GetString("ACCOUNT_PWD", "{}") + local db = json.decode(dbStr) + + if nil ~= db[account] then + cb(3, "璐﹀彿宸茶娉ㄥ唽") + return + end + -- 瀛樿处鍙蜂俊鎭 + db[account] = pwd + -- 鍐欐暟鎹簱 + PlayerPrefs.SetString("ACCOUNT_PWD", json.encode(db)) + cb(0, "鐧诲綍鎴愬姛") +end \ No newline at end of file diff --git a/Assets/LuaFramework/Lua/Logic/LoginLogic.lua.meta b/Assets/LuaFramework/Lua/Logic/LoginLogic.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..ee150ea6d5f3154ee0a93dd2ea16c781bea8e90e --- /dev/null +++ b/Assets/LuaFramework/Lua/Logic/LoginLogic.lua.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: acbf3b8c75e7603448e00683d4146386 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Lua/Logic/LuaClass.lua b/Assets/LuaFramework/Lua/Logic/LuaClass.lua new file mode 100644 index 0000000000000000000000000000000000000000..96b7178cac99315fd78e26ed77d7edbeca4ee019 --- /dev/null +++ b/Assets/LuaFramework/Lua/Logic/LuaClass.lua @@ -0,0 +1,24 @@ +--Author : Administrator +--Date : 2014/11/25 + +--澹版槑锛岃繖閲屽0鏄庝簡绫诲悕杩樻湁灞炴э紝骞朵笖缁欏嚭浜嗗睘鎬х殑鍒濆鍊笺 +LuaClass = {x = 0, y = 0} + +--杩欏彞鏄噸瀹氫箟鍏冭〃鐨勭储寮曪紝灏辨槸璇存湁浜嗚繖鍙ワ紝杩欎釜鎵嶆槸涓涓被銆 +LuaClass.__index = LuaClass + +--鏋勯犱綋锛屾瀯閫犱綋鐨勫悕瀛楁槸闅忎究璧风殑锛屼範鎯ф敼涓篘ew() +function LuaClass:New(x, y) + local self = {}; --鍒濆鍖杝elf锛屽鏋滄病鏈夎繖鍙ワ紝閭d箞绫绘墍寤虹珛鐨勫璞℃敼鍙橈紝鍏朵粬瀵硅薄閮戒細鏀瑰彉 + setmetatable(self, LuaClass); --灏唖elf鐨勫厓琛ㄨ瀹氫负Class + self.x = x; + self.y = y; + return self; --杩斿洖鑷韩 +end + +--娴嬭瘯鎵撳嵃鏂规硶-- +function LuaClass:test() + logWarn("x:>" .. self.x .. " y:>" .. self.y); +end + +--endregion diff --git a/Assets/LuaFramework/Lua/Logic/LuaClass.lua.meta b/Assets/LuaFramework/Lua/Logic/LuaClass.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..e6198d1ebafcd019aeb21f43271de6ef15d32d3c --- /dev/null +++ b/Assets/LuaFramework/Lua/Logic/LuaClass.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: efb0d6648bfd84c36b2c88e122dc06c8 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/Logic/Network.lua b/Assets/LuaFramework/Lua/Logic/Network.lua new file mode 100644 index 0000000000000000000000000000000000000000..c20af493b59d0e35678eeffb5c0637072ca6cd0f --- /dev/null +++ b/Assets/LuaFramework/Lua/Logic/Network.lua @@ -0,0 +1,148 @@ + +require "Common/define" +require "Common/protocal" +require "Common/functions" +Event = require 'events' + +require "3rd/pblua/login_pb" +require "3rd/pbc/protobuf" + +local sproto = require "3rd/sproto/sproto" +local core = require "sproto.core" +local print_r = require "3rd/sproto/print_r" + +Network = {}; +local this = Network; + +local transform; +local gameObject; +local islogging = false; + +function Network.Start() + logWarn("Network.Start!!"); + Event.AddListener(Protocal.Connect, this.OnConnect); + Event.AddListener(Protocal.Message, this.OnMessage); + Event.AddListener(Protocal.Exception, this.OnException); + Event.AddListener(Protocal.Disconnect, this.OnDisconnect); +end + +--Socket娑堟伅-- +function Network.OnSocket(key, data) + Event.Brocast(tostring(key), data); +end + +--褰撹繛鎺ュ缓绔嬫椂-- +function Network.OnConnect() + logWarn("Game Server connected!!"); +end + +--寮傚父鏂嚎-- +function Network.OnException() + islogging = false; + NetManager:SendConnect(); + logError("OnException------->>>>"); +end + +--杩炴帴涓柇锛屾垨鑰呰韪㈡帀-- +function Network.OnDisconnect() + islogging = false; + logError("OnDisconnect------->>>>"); +end + +--鐧诲綍杩斿洖-- +function Network.OnMessage(buffer) + if TestProtoType == ProtocalType.BINARY then + this.TestLoginBinary(buffer); + end + if TestProtoType == ProtocalType.PB_LUA then + this.TestLoginPblua(buffer); + end + if TestProtoType == ProtocalType.PBC then + this.TestLoginPbc(buffer); + end + if TestProtoType == ProtocalType.SPROTO then + this.TestLoginSproto(buffer); + end + ---------------------------------------------------- + local ctrl = CtrlManager.GetCtrl(CtrlNames.Message); + if ctrl ~= nil then + ctrl:Awake(); + end + logWarn('OnMessage-------->>>'); +end + +--浜岃繘鍒剁櫥褰-- +function Network.TestLoginBinary(buffer) + local protocal = buffer:ReadByte(); + local str = buffer:ReadString(); + log('TestLoginBinary: protocal:>'..protocal..' str:>'..str); +end + +--PBLUA鐧诲綍-- +function Network.TestLoginPblua(buffer) + local protocal = buffer:ReadByte(); + local data = buffer:ReadBuffer(); + + local msg = login_pb.LoginResponse(); + msg:ParseFromString(data); + log('TestLoginPblua: protocal:>'..protocal..' msg:>'..msg.id); +end + +--PBC鐧诲綍-- +function Network.TestLoginPbc(buffer) + local protocal = buffer:ReadByte(); + local data = buffer:ReadBuffer(); + + local path = Util.DataPath.."lua/3rd/pbc/addressbook.pb"; + + local addr = io.open(path, "rb") + local buffer = addr:read "*a" + addr:close() + protobuf.register(buffer) + local decode = protobuf.decode("tutorial.Person" , data) + + print(decode.name) + print(decode.id) + for _,v in ipairs(decode.phone) do + print("\t"..v.number, v.type) + end + log('TestLoginPbc: protocal:>'..protocal); +end + +--SPROTO鐧诲綍-- +function Network.TestLoginSproto(buffer) + local protocal = buffer:ReadByte(); + local code = buffer:ReadBuffer(); + + local sp = sproto.parse [[ + .Person { + name 0 : string + id 1 : integer + email 2 : string + + .PhoneNumber { + number 0 : string + type 1 : integer + } + + phone 3 : *PhoneNumber + } + + .AddressBook { + person 0 : *Person(id) + others 1 : *Person + } + ]] + local addr = sp:decode("AddressBook", code) + print_r(addr) + log('TestLoginSproto: protocal:>'..protocal); +end + +--鍗歌浇缃戠粶鐩戝惉-- +function Network.Unload() + Event.RemoveListener(Protocal.Connect); + Event.RemoveListener(Protocal.Message); + Event.RemoveListener(Protocal.Exception); + Event.RemoveListener(Protocal.Disconnect); + logWarn('Unload Network...'); +end \ No newline at end of file diff --git a/Assets/LuaFramework/Lua/Logic/Network.lua.meta b/Assets/LuaFramework/Lua/Logic/Network.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..42bcfb9d696174de192059024183c835ffe8ffd6 --- /dev/null +++ b/Assets/LuaFramework/Lua/Logic/Network.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: e7ede560670584545bf0b6620250fd0a +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/Logic/UserData.lua b/Assets/LuaFramework/Lua/Logic/UserData.lua new file mode 100644 index 0000000000000000000000000000000000000000..04370d7db9055f8c7b83e91d701baf6c1bb3304a --- /dev/null +++ b/Assets/LuaFramework/Lua/Logic/UserData.lua @@ -0,0 +1,4 @@ +UserData = {} +local this = UserData + +this.account = '' \ No newline at end of file diff --git a/Assets/LuaFramework/Lua/Logic/UserData.lua.meta b/Assets/LuaFramework/Lua/Logic/UserData.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..88056775965ddc5a231469061f8d33014cd21cef --- /dev/null +++ b/Assets/LuaFramework/Lua/Logic/UserData.lua.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a12956cf5b5e650469d96c1c96064671 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Lua/LuaFileList.lua b/Assets/LuaFramework/Lua/LuaFileList.lua new file mode 100644 index 0000000000000000000000000000000000000000..3767d7579f0a497191eb015c418fd1621e653ee9 --- /dev/null +++ b/Assets/LuaFramework/Lua/LuaFileList.lua @@ -0,0 +1,10 @@ + +-- 鎶婅嚜宸卞啓鐨刲ua鑴氭湰閮藉湪杩欓噷require +require "Logic/LoginLogic" +require "Logic/UserData" + +require "View/ShowFlyTips" +require "View/LoginPanel" +require "View/PlazaPanel" + +log("LuaFileList done") \ No newline at end of file diff --git a/Assets/LuaFramework/Lua/LuaFileList.lua.meta b/Assets/LuaFramework/Lua/LuaFileList.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..67bd2e094b7cd4391465a8e84b1c45a4c6b76ab4 --- /dev/null +++ b/Assets/LuaFramework/Lua/LuaFileList.lua.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 5db4762cd816a664fab873d5be48b0e9 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Lua/Main.lua b/Assets/LuaFramework/Lua/Main.lua new file mode 100644 index 0000000000000000000000000000000000000000..95bd32c23c2fa4ce80101f171f5fb09a20c7d411 --- /dev/null +++ b/Assets/LuaFramework/Lua/Main.lua @@ -0,0 +1,13 @@ +--涓诲叆鍙e嚱鏁般備粠杩欓噷寮濮媗ua閫昏緫 +function Main() + print("logic start") +end + +--鍦烘櫙鍒囨崲閫氱煡 +function OnLevelWasLoaded(level) + collectgarbage("collect") + Time.timeSinceLevelLoad = 0 +end + +function OnApplicationQuit() +end \ No newline at end of file diff --git a/Assets/LuaFramework/Lua/Main.lua.meta b/Assets/LuaFramework/Lua/Main.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..90c6a16ff13a3fffac0167da9be17eb221116ae0 --- /dev/null +++ b/Assets/LuaFramework/Lua/Main.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 091b02c3490daac4f8ed8cd5b62090b1 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/View.meta b/Assets/LuaFramework/Lua/View.meta new file mode 100644 index 0000000000000000000000000000000000000000..499d7c7a32266f9658a530e999bc0d6e03ef9332 --- /dev/null +++ b/Assets/LuaFramework/Lua/View.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 3ca4e7fdd1e1e7b4e8df29447d383ce8 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/View/LoginPanel.lua b/Assets/LuaFramework/Lua/View/LoginPanel.lua new file mode 100644 index 0000000000000000000000000000000000000000..e64b088b97ec17afff34975f69c8fc8cad019e99 --- /dev/null +++ b/Assets/LuaFramework/Lua/View/LoginPanel.lua @@ -0,0 +1,97 @@ +LoginPanel = {} +local this = LoginPanel + +this.panelObj = nil + +function LoginPanel.Show() + panelMgr:ShowPanel("LoginPanel", 1) +end + +function LoginPanel.Hide() + panelMgr:HidePanel("LoginPanel") +end + +function LoginPanel.OnShow(obj) + this.panelObj = obj + local uiBinder = obj:GetComponent('PrefabObjBinder') + local accountInput = uiBinder:GetObj("accountInput") + local passwordInput = uiBinder:GetObj("passwordInput") + -- 璁颁綇瀵嗙爜鍕鹃 + this.rememberTgl = uiBinder:GetObj("rememberTgl") + -- 鏉℃鍕鹃 + this.clauseTgl = uiBinder:SetToggle("clauseTgl", function(v) + PlayerPrefs.SetString("CLAUSE_TGL", v and "1" or "0") + end) + this.clauseTgl.isOn = "1" == PlayerPrefs.GetString("CLAUSE_TGL", "0") + accountInput.text = PlayerPrefs.GetString("LAST_LOGIN_ACCOUNT", "") + passwordInput.text = PlayerPrefs.GetString("LAST_LOGIN_PWD", "") + -- 鐗堟湰鍙 + uiBinder:SetText("versionText", string.format("app: %s res: %s", VersionMgr.instance.appVersion, VersionMgr.instance.resVersion)) + -- 娉ㄥ唽鎸夐挳 + uiBinder:SetBtnClick("registBtn", function() + if not this.CheckAccountPwd(accountInput.text, passwordInput.text) then return end + LoginLogic.DoRegist(accountInput.text, passwordInput.text, function(errorCode, msg) + if 0 == errorCode then + this.LoginOk(accountInput.text, passwordInput.text) + else + ShowFlyTips.Show(msg) + end + end) + end) + -- 鐧诲綍鎸夐挳 + uiBinder:SetBtnClick("loginBtn", function() + if not this.CheckAccountPwd(accountInput.text, passwordInput.text) then return end + LoginLogic.Dologin(accountInput.text, passwordInput.text, function(errorCode, msg) + if 0 == errorCode then + this.LoginOk(accountInput.text, passwordInput.text) + else + ShowFlyTips.Show(msg) + end + end) + end) + -- 鐢ㄦ埛鍗忚 + uiBinder:SetBtnClick("userAgreementBtn", function() + -- 鎵撳紑CSDN鐨勬潯娆 + UnityEngine.Application.OpenURL("https://passport.csdn.net/service") + end) + -- 闅愮鏉℃ + uiBinder:SetBtnClick("privacyPolicyBtn", function() + -- 鎵撳紑CSDN鐨勬潯娆 + UnityEngine.Application.OpenURL("https://passport.csdn.net/service") + end) +end + +function LoginPanel.CheckAccountPwd(account, pwd) + if isStringNilOrEmpty(account) then + ShowFlyTips.Show("璇疯緭鍏ヨ处鍙") + return false + elseif isStringNilOrEmpty(pwd) then + ShowFlyTips.Show("璇疯緭鍏ュ瘑鐮") + return false + elseif not this.clauseTgl.isOn then + ShowFlyTips.Show("璇烽槄璇诲苟鍕鹃変笅鏂瑰崗璁") + return false + end + return true +end + +function LoginPanel.LoginOk(account, pwd) + -- 缂撳瓨鐧诲綍鐨勮处鍙 + PlayerPrefs.SetString("LAST_LOGIN_ACCOUNT", account) + UserData.account = account + + if this.rememberTgl.isOn then + PlayerPrefs.SetString("LAST_LOGIN_PWD", pwd) + else + PlayerPrefs.SetString("LAST_LOGIN_PWD", "") + end + -- 鍏抽棴鐧诲綍鐣岄潰 + this.Hide() + -- 鏄剧ず澶у巺鐣岄潰 + PlazaPanel.Show() +end + +function LoginPanel.OnHide() + this.panelObj = nil +end + diff --git a/Assets/LuaFramework/Lua/View/LoginPanel.lua.meta b/Assets/LuaFramework/Lua/View/LoginPanel.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..217e4a68f5c3c26c13bb8da3a94c5dc86716bbca --- /dev/null +++ b/Assets/LuaFramework/Lua/View/LoginPanel.lua.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 624d3a0bfacbea34cb16a7a42c92f4aa +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Lua/View/PlazaPanel.lua b/Assets/LuaFramework/Lua/View/PlazaPanel.lua new file mode 100644 index 0000000000000000000000000000000000000000..37b74bbf2b89e8951f71155a1fa7665ddff92249 --- /dev/null +++ b/Assets/LuaFramework/Lua/View/PlazaPanel.lua @@ -0,0 +1,33 @@ +PlazaPanel = {} +local this = PlazaPanel + +this.panelObj = nil + +function PlazaPanel.Show() + panelMgr:ShowPanel("PlazaPanel", 2) +end + +function PlazaPanel.Hide() + panelMgr:HidePanel("PlazaPanel") +end + +function PlazaPanel.OnShow(obj) + this.panelObj = obj + local uiBinder = obj:GetComponent('PrefabObjBinder') + -- 璐﹀彿鍚 + uiBinder:SetText("accountText", UserData.account) + -- 杩斿洖鎸夐挳 + uiBinder:SetBtnClick("outBtn", function() + this.Hide() + LoginPanel.Show() + end) + -- 鍏虫敞銆佹敹钘忋佺偣璧炴寜閽 + uiBinder:SetBtnClick("likeBtn", function() + -- 鐩存帴鎵撳紑鎴戠殑CSDN鍗氬 + UnityEngine.Application.OpenURL("https://blog.csdn.net/linxinfa") + end) +end + +function PlazaPanel.OnHide() + this.panelObj = nil +end \ No newline at end of file diff --git a/Assets/LuaFramework/Lua/View/PlazaPanel.lua.meta b/Assets/LuaFramework/Lua/View/PlazaPanel.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..a71755e9a8e585af76b8ddf96dbd0cf792d1dadf --- /dev/null +++ b/Assets/LuaFramework/Lua/View/PlazaPanel.lua.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1f8b87b5a9f15c8479a1c53ae3c26f51 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Lua/View/ShowFlyTips.lua b/Assets/LuaFramework/Lua/View/ShowFlyTips.lua new file mode 100644 index 0000000000000000000000000000000000000000..d3f8848834e5091d18acea4501a47407aaa0cfac --- /dev/null +++ b/Assets/LuaFramework/Lua/View/ShowFlyTips.lua @@ -0,0 +1,14 @@ +ShowFlyTips = {} +local this = ShowFlyTips + +function ShowFlyTips.Show(str) + local uiObj = panelMgr:InstantiateUI(3) + local uiBinder = uiObj:GetComponent("PrefabObjBinder") + uiBinder:SetText("text", str) + local aniEvent = uiBinder:GetObj("aniEvent") + aniEvent.aniEvent = function(msg) + if "finish" == msg then + safeDestroy(uiObj) + end + end +end \ No newline at end of file diff --git a/Assets/LuaFramework/Lua/View/ShowFlyTips.lua.meta b/Assets/LuaFramework/Lua/View/ShowFlyTips.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..d976a7129a106a5156f27603a80e02b56795f85c --- /dev/null +++ b/Assets/LuaFramework/Lua/View/ShowFlyTips.lua.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 0bd5bdb5620a0774cb2fd9d25c72ba12 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Lua/eventlib.lua b/Assets/LuaFramework/Lua/eventlib.lua new file mode 100644 index 0000000000000000000000000000000000000000..ff6df9f806ce67d1482942eb7d2c9ef776558284 --- /dev/null +++ b/Assets/LuaFramework/Lua/eventlib.lua @@ -0,0 +1,285 @@ +-- EventLib - An event library in pure lua (uses standard coroutine library) +-- License: WTFPL +-- Author: Elijah Frederickson +-- Version: 1.0 +-- Copyright (C) 2012 LoDC +-- +-- Description: +-- ROBLOX has an event library in its RbxUtility library, but it isn't pure Lua. +-- It originally used a BoolValue but now uses BindableEvent. I wanted to write +-- it in pure Lua, so here it is. It also contains some new features. +-- +-- +-- API: +-- +-- EventLib +-- new([name]) +-- aliases: CreateEvent +-- returns: the event, with a metatable __index for the EventLib table +-- Connect(event, func) +-- aliases: connect +-- returns: a Connection +-- Disconnect(event, [func]) +-- aliases: disconnect +-- returns: the index of [func] +-- notes: if [func] is nil, it removes all connections +-- DisconnectAll(event) +-- notes: calls Disconnect() +-- Fire(event, ... ) +-- aliases: Simulate, fire +-- notes: resumes all :wait() first +-- Wait(event) +-- aliases: wait +-- returns: the Fire() arguments +-- notes: blocks the thread until Fire() is called +-- ConnectionCount(event) +-- returns: the number of current connections +-- Spawn(func) +-- aliases: spawn +-- returns: the result of func +-- notes: runs func in a separate coroutine/thread +-- Destroy(event) +-- aliases: destroy, Remove, remove +-- notes: renders the event completely useless +-- WaitForCompletion(event) +-- notes: blocks current thread until the current event Fire() is done +-- If a connected function calls WaitForCompletion, it will hang forever +-- IsWaiting(event) +-- returns: if the event has any waiters +-- WaitForWaiters(event) +-- notes: waits for all waiters to finish. Called in Fire() to make sure that all +-- the waiting threads are done before settings self.args to nil +-- +-- Event +-- [All EventLib functions] +-- EventName +-- Property, defaults to "" +-- +-- handlers, waiter, args, waiters, executing, +-- +-- Connection +-- Disconnect +-- aliases: disconnect +-- returns: the result of [Event].Disconnect +-- +-- Basic usage (there are some tests on the bottom): +-- local EventLib = require'EventLib' +-- For ROBLOX use: repeat wait() until _G.EventLib local EventLib = _G.EventLib +-- +-- local event = EventLib:new() +-- local con = event:Connect(function(...) print(...) end) +-- event:Fire("test") --> 'test' is print'ed +-- con:disconnect() +-- event:Fire("test") --> nothing happens: no connections +-- +-- Supported versions/implementations of Lua: +-- Lua 5.1, 5.2 +-- SharpLua 2 +-- MetaLua +-- RbxLua (automatically registers if it detects ROBLOX) + +--[[ +Issues: +- None, but see [Todo 1] + +Todo: +- fix Wait() for non-roblox clients without a wait function... + +Changelog: + +v1.0 +- Initial version + +]] + +local _M = { } +_M._VERSION = "1.0" +_M._M = _M +_M._AUTHOR = "Elijah Frederickson" +_M._COPYRIGHT = "Copyright (C) 2012 LoDC" + +local function spawn(f) + return coroutine.resume(coroutine.create(function() + f() + end)) +end +_M.Spawn = spawn +_M.spawn = spawn + +function _M:new(name) + assert(self ~= nil and type(self) == "table" and self == _M, "Invalid EventLib table (make sure you're using ':' not '.')") + local s = { } + s.handlers = { } + s.waiter = false + s.args = nil + s.waiters = 0 + s.EventName = name or "" + s.executing = false + return setmetatable(s, { __index = self }) +end +_M.CreateEvent = _M.new + +function _M:Connect(handler) + assert(self ~= nil and type(self) == "table", "Invalid Event (make sure you're using ':' not '.')") + assert(type(handler) == "function", "Invalid handler. Expected function got " .. type(handler)) + assert(self.handlers, "Invalid Event") + table.insert(self.handlers, handler) + local t = { } + t.Disconnect = function() + return self:Disconnect(handler) + end + t.disconnect = t.Disconnect + return t +end +_M.connect = _M.Connect + +function _M:Disconnect(handler) + assert(self ~= nil and type(self) == "table", "Invalid Event (make sure you're using ':' not '.')") + assert(type(handler) == "function" or type(handler) == "nil", "Invalid handler. Expected function or nil, got " .. type(handler)) + if not handler then + self.handlers = { } + else + for k, v in pairs(self.handlers) do + if v == handler then + self.handlers[k] = nil + return k + end + end + end +end +_M.disconnect = _M.Disconnect + +function _M:DisconnectAll() + assert(self ~= nil and type(self) == "table", "Invalid Event (make sure you're using ':' not '.')") + self:Disconnect() +end + +function _M:Fire(...) + assert(self ~= nil and type(self) == "table", "Invalid Event (make sure you're using ':' not '.')") + self.args = { ... } + self.executing = true + --[[ + if self.waiter then + self.waiter = false + for k, v in pairs(self.waiters) do + coroutine.resume(v) + end + end]] + self.waiter = false + local i = 0 +assert(self.handlers, "no handler table") + for k, v in pairs(self.handlers) do + i = i + 1 + spawn(function() + v(unpack(self.args)) + i = i - 1 + if i == 0 then self.executing = false end + end) + end + self:WaitForWaiters() + self.args = nil + --self.executing = false +end +_M.Simulate = _M.Fire +_M.fire = _M.Fire + +function _M:Wait() + assert(self ~= nil and type(self) == "table", "Invalid Event (make sure you're using ':' not '.')") + self.waiter = true + self.waiters = self.waiters + 1 + --[[ + local c = coroutine.create(function() + coroutine.yield() + return unpack(self.args) + end) + + table.insert(self.waiters, c) + coroutine.resume(c) + ]] + + while self.waiter or not self.args do if wait then wait() end end + self.waiters = self.waiters - 1 + return unpack(self.args) +end +_M.wait = _M.Wait + +function _M:ConnectionCount() + assert(self ~= nil and type(self) == "table", "Invalid Event (make sure you're using ':' not '.')") + return #self.handlers +end + +function _M:Destroy() + assert(self ~= nil and type(self) == "table", "Invalid Event (make sure you're using ':' not '.')") + self:DisconnectAll() + for k, v in pairs(self) do + self[k] = nil + end + setmetatable(self, { }) +end +_M.destroy = _M.Destroy +_M.Remove = _M.Destroy +_M.remove = _M.Destroy + +function _M:WaitForCompletion() + assert(self ~= nil and type(self) == "table", "Invalid Event (make sure you're using ':' not '.')") + while self.executing do if wait then wait() end end + while self.waiters > 0 do if wait then wait() end end +end + +function _M:IsWaiting() + assert(self ~= nil and type(self) == "table", "Invalid Event (make sure you're using ':' not '.')") + return self.waiter or self.waiters > 0 +end + +function _M:WaitForWaiters() + assert(self ~= nil and type(self) == "table", "Invalid Event (make sure you're using ':' not '.')") + while self.waiters > 0 do if wait then wait() end end +end + +-- Tests +if false then + local e = _M:new("test") + local f = function(...) print("| Fired!", ...) end + local e2 = e:connect(f) + e:fire("arg1", 5, { }) + -- Would work in a ROBLOX Script, but not on Lua 5.1... + if script ~= nil and failhorribly then + spawn(function() print("Wait() results", e:wait()) print"|- done waiting!" end) + end + e:fire(nil, "x") + print("Disconnected events index:", e:disconnect(f)) + print("Couldn't disconnect an already disconnected handler?", e2:disconnect()==nil) + print("Connections:", e:ConnectionCount()) + assert(e:ConnectionCount() == 0 and e:ConnectionCount() == #e.handlers) + e:connect(f) + e:connect(function() print"Throwing error... " error("...") end) + e:fire("Testing throwing an error...") + e:disconnect() + e:Simulate() + f("plain function call") + assert(e:ConnectionCount() == 0) + + if wait then + e:connect(function() wait(2, true) print'fired after waiting' end) + e:Fire() + e:WaitForCompletion() + print'Done!' + end + + local failhorribly = false + if failhorribly then -- causes an eternal loop in the WaitForCompletion call + e:connect(function() e:WaitForCompletion() print'done with connected function' end) + e:Fire() + print'done' + end + + e:Destroy() + assert(not e.EventName and not e.Fire and not e.Connect) +end + +if shared and Instance then -- ROBLOX support + shared.EventLib = _M + _G.EventLib = _M +end + +return _M diff --git a/Assets/LuaFramework/Lua/eventlib.lua.meta b/Assets/LuaFramework/Lua/eventlib.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..9bdab5fc8dbf6c905e2d810c5a1fa9ace3839c97 --- /dev/null +++ b/Assets/LuaFramework/Lua/eventlib.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: fb355d54d4306354cb2dfc482136aabd +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Lua/events.lua b/Assets/LuaFramework/Lua/events.lua new file mode 100644 index 0000000000000000000000000000000000000000..56eaa5eceb3621d8cff2af70637328ac899caf2b --- /dev/null +++ b/Assets/LuaFramework/Lua/events.lua @@ -0,0 +1,44 @@ +--[[ +Auth:Chiuan +like Unity Brocast Event System in lua. +]] + +local EventLib = require "eventlib" + +local Event = {} +local events = {} + +function Event.AddListener(event,handler) + if not event or type(event) ~= "string" then + error("event parameter in addlistener function has to be string, " .. type(event) .. " not right.") + end + if not handler or type(handler) ~= "function" then + error("handler parameter in addlistener function has to be function, " .. type(handler) .. " not right") + end + + if not events[event] then + --create the Event with name + events[event] = EventLib:new(event) + end + + --conn this handler + events[event]:connect(handler) +end + +function Event.Brocast(event,...) + if not events[event] then + error("brocast " .. event .. " has no event.") + else + events[event]:fire(...) + end +end + +function Event.RemoveListener(event,handler) + if not events[event] then + error("remove " .. event .. " has no event.") + else + events[event]:disconnect(handler) + end +end + +return Event \ No newline at end of file diff --git a/Assets/LuaFramework/Lua/events.lua.meta b/Assets/LuaFramework/Lua/events.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..f40f5e8d28c0e7798861c2bb0fafdfd249115588 --- /dev/null +++ b/Assets/LuaFramework/Lua/events.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: c28c4dd769d9f694787a0b0fd64e8eea +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Luajit.meta b/Assets/LuaFramework/Luajit.meta new file mode 100644 index 0000000000000000000000000000000000000000..3c4d3391bfe28dfaf4ddcdde3f5abbddc9583734 --- /dev/null +++ b/Assets/LuaFramework/Luajit.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 5a1858bc94b3706489b84787e227e6a6 +folderAsset: yes +timeCreated: 1498139739 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Luajit/Build.bat b/Assets/LuaFramework/Luajit/Build.bat new file mode 100644 index 0000000000000000000000000000000000000000..4ea5f3a37799cf22181b5c0e7b48164d85959175 --- /dev/null +++ b/Assets/LuaFramework/Luajit/Build.bat @@ -0,0 +1,31 @@ +@echo off +cd /d %~dp0 + +if not exist dir (mkdir jit) +if not exist Out (mkdir Out) + +xcopy /Y /D ..\..\..\Luajit\jit jit +setlocal enabledelayedexpansion + +for /r %%i in (*.lua) do ( + set v=%%~dpi + call :loop + set v=!v:%~dp0=! + if not exist %~dp0out\!v! (mkdir %~dp0Out\!v!) + ) + +for /r %%i in (*.lua) do ( + set v=%%i + set v=!v:%~dp0=! + call :loop + ..\..\..\Luajit\luajit.exe -b -g !v! Out\!v!.bytes +) + +rd /s/q jit +rd /s/q .\Out\jit\ +setlocal disabledelayedexpansion + +:loop +if "!v:~-1!"==" " set "v=!v:~0,-1!" & goto loop + + diff --git a/Assets/LuaFramework/Luajit/Build.bat.meta b/Assets/LuaFramework/Luajit/Build.bat.meta new file mode 100644 index 0000000000000000000000000000000000000000..1d3cd92ec1eb15307b480485a96ee2884f8d2ca6 --- /dev/null +++ b/Assets/LuaFramework/Luajit/Build.bat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3717a1ffedc585945a43193f52a32f26 +timeCreated: 1498139739 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Luajit/jit.meta b/Assets/LuaFramework/Luajit/jit.meta new file mode 100644 index 0000000000000000000000000000000000000000..1c64772a39d43b54369d450eaf752980e6ee37b0 --- /dev/null +++ b/Assets/LuaFramework/Luajit/jit.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 91ba6b2190e00254aa340e1e35dadcb4 +folderAsset: yes +timeCreated: 1498139739 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Luajit/jit/bc.lua b/Assets/LuaFramework/Luajit/jit/bc.lua new file mode 100644 index 0000000000000000000000000000000000000000..a8cb8496e432fc197664e697ad981c417f66a111 --- /dev/null +++ b/Assets/LuaFramework/Luajit/jit/bc.lua @@ -0,0 +1,190 @@ +---------------------------------------------------------------------------- +-- LuaJIT bytecode listing module. +-- +-- Copyright (C) 2005-2016 Mike Pall. All rights reserved. +-- Released under the MIT license. See Copyright Notice in luajit.h +---------------------------------------------------------------------------- +-- +-- This module lists the bytecode of a Lua function. If it's loaded by -jbc +-- it hooks into the parser and lists all functions of a chunk as they +-- are parsed. +-- +-- Example usage: +-- +-- luajit -jbc -e 'local x=0; for i=1,1e6 do x=x+i end; print(x)' +-- luajit -jbc=- foo.lua +-- luajit -jbc=foo.list foo.lua +-- +-- Default output is to stderr. To redirect the output to a file, pass a +-- filename as an argument (use '-' for stdout) or set the environment +-- variable LUAJIT_LISTFILE. The file is overwritten every time the module +-- is started. +-- +-- This module can also be used programmatically: +-- +-- local bc = require("jit.bc") +-- +-- local function foo() print("hello") end +-- +-- bc.dump(foo) --> -- BYTECODE -- [...] +-- print(bc.line(foo, 2)) --> 0002 KSTR 1 1 ; "hello" +-- +-- local out = { +-- -- Do something with each line: +-- write = function(t, ...) io.write(...) end, +-- close = function(t) end, +-- flush = function(t) end, +-- } +-- bc.dump(foo, out) +-- +------------------------------------------------------------------------------ + +-- Cache some library functions and objects. +local jit = require("jit") +assert(jit.version_num == 20100, "LuaJIT core/library version mismatch") +local jutil = require("jit.util") +local vmdef = require("jit.vmdef") +local bit = require("bit") +local sub, gsub, format = string.sub, string.gsub, string.format +local byte, band, shr = string.byte, bit.band, bit.rshift +local funcinfo, funcbc, funck = jutil.funcinfo, jutil.funcbc, jutil.funck +local funcuvname = jutil.funcuvname +local bcnames = vmdef.bcnames +local stdout, stderr = io.stdout, io.stderr + +------------------------------------------------------------------------------ + +local function ctlsub(c) + if c == "\n" then return "\\n" + elseif c == "\r" then return "\\r" + elseif c == "\t" then return "\\t" + else return format("\\%03d", byte(c)) + end +end + +-- Return one bytecode line. +local function bcline(func, pc, prefix) + local ins, m = funcbc(func, pc) + if not ins then return end + local ma, mb, mc = band(m, 7), band(m, 15*8), band(m, 15*128) + local a = band(shr(ins, 8), 0xff) + local oidx = 6*band(ins, 0xff) + local op = sub(bcnames, oidx+1, oidx+6) + local s = format("%04d %s %-6s %3s ", + pc, prefix or " ", op, ma == 0 and "" or a) + local d = shr(ins, 16) + if mc == 13*128 then -- BCMjump + return format("%s=> %04d\n", s, pc+d-0x7fff) + end + if mb ~= 0 then + d = band(d, 0xff) + elseif mc == 0 then + return s.."\n" + end + local kc + if mc == 10*128 then -- BCMstr + kc = funck(func, -d-1) + kc = format(#kc > 40 and '"%.40s"~' or '"%s"', gsub(kc, "%c", ctlsub)) + elseif mc == 9*128 then -- BCMnum + kc = funck(func, d) + if op == "TSETM " then kc = kc - 2^52 end + elseif mc == 12*128 then -- BCMfunc + local fi = funcinfo(funck(func, -d-1)) + if fi.ffid then + kc = vmdef.ffnames[fi.ffid] + else + kc = fi.loc + end + elseif mc == 5*128 then -- BCMuv + kc = funcuvname(func, d) + end + if ma == 5 then -- BCMuv + local ka = funcuvname(func, a) + if kc then kc = ka.." ; "..kc else kc = ka end + end + if mb ~= 0 then + local b = shr(ins, 24) + if kc then return format("%s%3d %3d ; %s\n", s, b, d, kc) end + return format("%s%3d %3d\n", s, b, d) + end + if kc then return format("%s%3d ; %s\n", s, d, kc) end + if mc == 7*128 and d > 32767 then d = d - 65536 end -- BCMlits + return format("%s%3d\n", s, d) +end + +-- Collect branch targets of a function. +local function bctargets(func) + local target = {} + for pc=1,1000000000 do + local ins, m = funcbc(func, pc) + if not ins then break end + if band(m, 15*128) == 13*128 then target[pc+shr(ins, 16)-0x7fff] = true end + end + return target +end + +-- Dump bytecode instructions of a function. +local function bcdump(func, out, all) + if not out then out = stdout end + local fi = funcinfo(func) + if all and fi.children then + for n=-1,-1000000000,-1 do + local k = funck(func, n) + if not k then break end + if type(k) == "proto" then bcdump(k, out, true) end + end + end + out:write(format("-- BYTECODE -- %s-%d\n", fi.loc, fi.lastlinedefined)) + local target = bctargets(func) + for pc=1,1000000000 do + local s = bcline(func, pc, target[pc] and "=>") + if not s then break end + out:write(s) + end + out:write("\n") + out:flush() +end + +------------------------------------------------------------------------------ + +-- Active flag and output file handle. +local active, out + +-- List handler. +local function h_list(func) + return bcdump(func, out) +end + +-- Detach list handler. +local function bclistoff() + if active then + active = false + jit.attach(h_list) + if out and out ~= stdout and out ~= stderr then out:close() end + out = nil + end +end + +-- Open the output file and attach list handler. +local function bcliston(outfile) + if active then bclistoff() end + if not outfile then outfile = os.getenv("LUAJIT_LISTFILE") end + if outfile then + out = outfile == "-" and stdout or assert(io.open(outfile, "w")) + else + out = stderr + end + jit.attach(h_list, "bc") + active = true +end + +-- Public module functions. +return { + line = bcline, + dump = bcdump, + targets = bctargets, + on = bcliston, + off = bclistoff, + start = bcliston -- For -j command line option. +} + diff --git a/Assets/LuaFramework/Luajit/jit/bc.lua.meta b/Assets/LuaFramework/Luajit/jit/bc.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..7b725606bb92a80a17d6781031e3de17f6fbf337 --- /dev/null +++ b/Assets/LuaFramework/Luajit/jit/bc.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: d18ce292c8e9a3446a5890f324daddc8 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Luajit/jit/bcsave.lua b/Assets/LuaFramework/Luajit/jit/bcsave.lua new file mode 100644 index 0000000000000000000000000000000000000000..d0968b187603f769a8456f40895a472c37200593 --- /dev/null +++ b/Assets/LuaFramework/Luajit/jit/bcsave.lua @@ -0,0 +1,661 @@ +---------------------------------------------------------------------------- +-- LuaJIT module to save/list bytecode. +-- +-- Copyright (C) 2005-2016 Mike Pall. All rights reserved. +-- Released under the MIT license. See Copyright Notice in luajit.h +---------------------------------------------------------------------------- +-- +-- This module saves or lists the bytecode for an input file. +-- It's run by the -b command line option. +-- +------------------------------------------------------------------------------ + +local jit = require("jit") +assert(jit.version_num == 20100, "LuaJIT core/library version mismatch") +local bit = require("bit") + +-- Symbol name prefix for LuaJIT bytecode. +local LJBC_PREFIX = "luaJIT_BC_" + +------------------------------------------------------------------------------ + +local function usage() + io.stderr:write[[ +Save LuaJIT bytecode: luajit -b[options] input output + -l Only list bytecode. + -s Strip debug info (default). + -g Keep debug info. + -n name Set module name (default: auto-detect from input name). + -t type Set output file type (default: auto-detect from output name). + -a arch Override architecture for object files (default: native). + -o os Override OS for object files (default: native). + -e chunk Use chunk string as input. + -- Stop handling options. + - Use stdin as input and/or stdout as output. + +File types: c h obj o raw (default) +]] + os.exit(1) +end + +local function check(ok, ...) + if ok then return ok, ... end + io.stderr:write("luajit: ", ...) + io.stderr:write("\n") + os.exit(1) +end + +local function readfile(input) + if type(input) == "function" then return input end + if input == "-" then input = nil end + return check(loadfile(input)) +end + +local function savefile(name, mode) + if name == "-" then return io.stdout end + return check(io.open(name, mode)) +end + +------------------------------------------------------------------------------ + +local map_type = { + raw = "raw", c = "c", h = "h", o = "obj", obj = "obj", +} + +local map_arch = { + x86 = true, x64 = true, arm = true, arm64 = true, ppc = true, + mips = true, mipsel = true, +} + +local map_os = { + linux = true, windows = true, osx = true, freebsd = true, netbsd = true, + openbsd = true, dragonfly = true, solaris = true, +} + +local function checkarg(str, map, err) + str = string.lower(str) + local s = check(map[str], "unknown ", err) + return s == true and str or s +end + +local function detecttype(str) + local ext = string.match(string.lower(str), "%.(%a+)$") + return map_type[ext] or "raw" +end + +local function checkmodname(str) + check(string.match(str, "^[%w_.%-]+$"), "bad module name") + return string.gsub(str, "[%.%-]", "_") +end + +local function detectmodname(str) + if type(str) == "string" then + local tail = string.match(str, "[^/\\]+$") + if tail then str = tail end + local head = string.match(str, "^(.*)%.[^.]*$") + if head then str = head end + str = string.match(str, "^[%w_.%-]+") + else + str = nil + end + check(str, "cannot derive module name, use -n name") + return string.gsub(str, "[%.%-]", "_") +end + +------------------------------------------------------------------------------ + +local function bcsave_tail(fp, output, s) + local ok, err = fp:write(s) + if ok and output ~= "-" then ok, err = fp:close() end + check(ok, "cannot write ", output, ": ", err) +end + +local function bcsave_raw(output, s) + local fp = savefile(output, "wb") + bcsave_tail(fp, output, s) +end + +local function bcsave_c(ctx, output, s) + local fp = savefile(output, "w") + if ctx.type == "c" then + fp:write(string.format([[ +#ifdef _cplusplus +extern "C" +#endif +#ifdef _WIN32 +__declspec(dllexport) +#endif +const char %s%s[] = { +]], LJBC_PREFIX, ctx.modname)) + else + fp:write(string.format([[ +#define %s%s_SIZE %d +static const char %s%s[] = { +]], LJBC_PREFIX, ctx.modname, #s, LJBC_PREFIX, ctx.modname)) + end + local t, n, m = {}, 0, 0 + for i=1,#s do + local b = tostring(string.byte(s, i)) + m = m + #b + 1 + if m > 78 then + fp:write(table.concat(t, ",", 1, n), ",\n") + n, m = 0, #b + 1 + end + n = n + 1 + t[n] = b + end + bcsave_tail(fp, output, table.concat(t, ",", 1, n).."\n};\n") +end + +local function bcsave_elfobj(ctx, output, s, ffi) + ffi.cdef[[ +typedef struct { + uint8_t emagic[4], eclass, eendian, eversion, eosabi, eabiversion, epad[7]; + uint16_t type, machine; + uint32_t version; + uint32_t entry, phofs, shofs; + uint32_t flags; + uint16_t ehsize, phentsize, phnum, shentsize, shnum, shstridx; +} ELF32header; +typedef struct { + uint8_t emagic[4], eclass, eendian, eversion, eosabi, eabiversion, epad[7]; + uint16_t type, machine; + uint32_t version; + uint64_t entry, phofs, shofs; + uint32_t flags; + uint16_t ehsize, phentsize, phnum, shentsize, shnum, shstridx; +} ELF64header; +typedef struct { + uint32_t name, type, flags, addr, ofs, size, link, info, align, entsize; +} ELF32sectheader; +typedef struct { + uint32_t name, type; + uint64_t flags, addr, ofs, size; + uint32_t link, info; + uint64_t align, entsize; +} ELF64sectheader; +typedef struct { + uint32_t name, value, size; + uint8_t info, other; + uint16_t sectidx; +} ELF32symbol; +typedef struct { + uint32_t name; + uint8_t info, other; + uint16_t sectidx; + uint64_t value, size; +} ELF64symbol; +typedef struct { + ELF32header hdr; + ELF32sectheader sect[6]; + ELF32symbol sym[2]; + uint8_t space[4096]; +} ELF32obj; +typedef struct { + ELF64header hdr; + ELF64sectheader sect[6]; + ELF64symbol sym[2]; + uint8_t space[4096]; +} ELF64obj; +]] + local symname = LJBC_PREFIX..ctx.modname + local is64, isbe = false, false + if ctx.arch == "x64" or ctx.arch == "arm64" then + is64 = true + elseif ctx.arch == "ppc" or ctx.arch == "mips" then + isbe = true + end + + -- Handle different host/target endianess. + local function f32(x) return x end + local f16, fofs = f32, f32 + if ffi.abi("be") ~= isbe then + f32 = bit.bswap + function f16(x) return bit.rshift(bit.bswap(x), 16) end + if is64 then + local two32 = ffi.cast("int64_t", 2^32) + function fofs(x) return bit.bswap(x)*two32 end + else + fofs = f32 + end + end + + -- Create ELF object and fill in header. + local o = ffi.new(is64 and "ELF64obj" or "ELF32obj") + local hdr = o.hdr + if ctx.os == "bsd" or ctx.os == "other" then -- Determine native hdr.eosabi. + local bf = assert(io.open("/bin/ls", "rb")) + local bs = bf:read(9) + bf:close() + ffi.copy(o, bs, 9) + check(hdr.emagic[0] == 127, "no support for writing native object files") + else + hdr.emagic = "\127ELF" + hdr.eosabi = ({ freebsd=9, netbsd=2, openbsd=12, solaris=6 })[ctx.os] or 0 + end + hdr.eclass = is64 and 2 or 1 + hdr.eendian = isbe and 2 or 1 + hdr.eversion = 1 + hdr.type = f16(1) + hdr.machine = f16(({ x86=3, x64=62, arm=40, arm64=183, ppc=20, mips=8, mipsel=8 })[ctx.arch]) + if ctx.arch == "mips" or ctx.arch == "mipsel" then + hdr.flags = 0x50001006 + end + hdr.version = f32(1) + hdr.shofs = fofs(ffi.offsetof(o, "sect")) + hdr.ehsize = f16(ffi.sizeof(hdr)) + hdr.shentsize = f16(ffi.sizeof(o.sect[0])) + hdr.shnum = f16(6) + hdr.shstridx = f16(2) + + -- Fill in sections and symbols. + local sofs, ofs = ffi.offsetof(o, "space"), 1 + for i,name in ipairs{ + ".symtab", ".shstrtab", ".strtab", ".rodata", ".note.GNU-stack", + } do + local sect = o.sect[i] + sect.align = fofs(1) + sect.name = f32(ofs) + ffi.copy(o.space+ofs, name) + ofs = ofs + #name+1 + end + o.sect[1].type = f32(2) -- .symtab + o.sect[1].link = f32(3) + o.sect[1].info = f32(1) + o.sect[1].align = fofs(8) + o.sect[1].ofs = fofs(ffi.offsetof(o, "sym")) + o.sect[1].entsize = fofs(ffi.sizeof(o.sym[0])) + o.sect[1].size = fofs(ffi.sizeof(o.sym)) + o.sym[1].name = f32(1) + o.sym[1].sectidx = f16(4) + o.sym[1].size = fofs(#s) + o.sym[1].info = 17 + o.sect[2].type = f32(3) -- .shstrtab + o.sect[2].ofs = fofs(sofs) + o.sect[2].size = fofs(ofs) + o.sect[3].type = f32(3) -- .strtab + o.sect[3].ofs = fofs(sofs + ofs) + o.sect[3].size = fofs(#symname+1) + ffi.copy(o.space+ofs+1, symname) + ofs = ofs + #symname + 2 + o.sect[4].type = f32(1) -- .rodata + o.sect[4].flags = fofs(2) + o.sect[4].ofs = fofs(sofs + ofs) + o.sect[4].size = fofs(#s) + o.sect[5].type = f32(1) -- .note.GNU-stack + o.sect[5].ofs = fofs(sofs + ofs + #s) + + -- Write ELF object file. + local fp = savefile(output, "wb") + fp:write(ffi.string(o, ffi.sizeof(o)-4096+ofs)) + bcsave_tail(fp, output, s) +end + +local function bcsave_peobj(ctx, output, s, ffi) + ffi.cdef[[ +typedef struct { + uint16_t arch, nsects; + uint32_t time, symtabofs, nsyms; + uint16_t opthdrsz, flags; +} PEheader; +typedef struct { + char name[8]; + uint32_t vsize, vaddr, size, ofs, relocofs, lineofs; + uint16_t nreloc, nline; + uint32_t flags; +} PEsection; +typedef struct __attribute((packed)) { + union { + char name[8]; + uint32_t nameref[2]; + }; + uint32_t value; + int16_t sect; + uint16_t type; + uint8_t scl, naux; +} PEsym; +typedef struct __attribute((packed)) { + uint32_t size; + uint16_t nreloc, nline; + uint32_t cksum; + uint16_t assoc; + uint8_t comdatsel, unused[3]; +} PEsymaux; +typedef struct { + PEheader hdr; + PEsection sect[2]; + // Must be an even number of symbol structs. + PEsym sym0; + PEsymaux sym0aux; + PEsym sym1; + PEsymaux sym1aux; + PEsym sym2; + PEsym sym3; + uint32_t strtabsize; + uint8_t space[4096]; +} PEobj; +]] + local symname = LJBC_PREFIX..ctx.modname + local is64 = false + if ctx.arch == "x86" then + symname = "_"..symname + elseif ctx.arch == "x64" then + is64 = true + end + local symexport = " /EXPORT:"..symname..",DATA " + + -- The file format is always little-endian. Swap if the host is big-endian. + local function f32(x) return x end + local f16 = f32 + if ffi.abi("be") then + f32 = bit.bswap + function f16(x) return bit.rshift(bit.bswap(x), 16) end + end + + -- Create PE object and fill in header. + local o = ffi.new("PEobj") + local hdr = o.hdr + hdr.arch = f16(({ x86=0x14c, x64=0x8664, arm=0x1c0, ppc=0x1f2, mips=0x366, mipsel=0x366 })[ctx.arch]) + hdr.nsects = f16(2) + hdr.symtabofs = f32(ffi.offsetof(o, "sym0")) + hdr.nsyms = f32(6) + + -- Fill in sections and symbols. + o.sect[0].name = ".drectve" + o.sect[0].size = f32(#symexport) + o.sect[0].flags = f32(0x00100a00) + o.sym0.sect = f16(1) + o.sym0.scl = 3 + o.sym0.name = ".drectve" + o.sym0.naux = 1 + o.sym0aux.size = f32(#symexport) + o.sect[1].name = ".rdata" + o.sect[1].size = f32(#s) + o.sect[1].flags = f32(0x40300040) + o.sym1.sect = f16(2) + o.sym1.scl = 3 + o.sym1.name = ".rdata" + o.sym1.naux = 1 + o.sym1aux.size = f32(#s) + o.sym2.sect = f16(2) + o.sym2.scl = 2 + o.sym2.nameref[1] = f32(4) + o.sym3.sect = f16(-1) + o.sym3.scl = 2 + o.sym3.value = f32(1) + o.sym3.name = "@feat.00" -- Mark as SafeSEH compliant. + ffi.copy(o.space, symname) + local ofs = #symname + 1 + o.strtabsize = f32(ofs + 4) + o.sect[0].ofs = f32(ffi.offsetof(o, "space") + ofs) + ffi.copy(o.space + ofs, symexport) + ofs = ofs + #symexport + o.sect[1].ofs = f32(ffi.offsetof(o, "space") + ofs) + + -- Write PE object file. + local fp = savefile(output, "wb") + fp:write(ffi.string(o, ffi.sizeof(o)-4096+ofs)) + bcsave_tail(fp, output, s) +end + +local function bcsave_machobj(ctx, output, s, ffi) + ffi.cdef[[ +typedef struct +{ + uint32_t magic, cputype, cpusubtype, filetype, ncmds, sizeofcmds, flags; +} mach_header; +typedef struct +{ + mach_header; uint32_t reserved; +} mach_header_64; +typedef struct { + uint32_t cmd, cmdsize; + char segname[16]; + uint32_t vmaddr, vmsize, fileoff, filesize; + uint32_t maxprot, initprot, nsects, flags; +} mach_segment_command; +typedef struct { + uint32_t cmd, cmdsize; + char segname[16]; + uint64_t vmaddr, vmsize, fileoff, filesize; + uint32_t maxprot, initprot, nsects, flags; +} mach_segment_command_64; +typedef struct { + char sectname[16], segname[16]; + uint32_t addr, size; + uint32_t offset, align, reloff, nreloc, flags; + uint32_t reserved1, reserved2; +} mach_section; +typedef struct { + char sectname[16], segname[16]; + uint64_t addr, size; + uint32_t offset, align, reloff, nreloc, flags; + uint32_t reserved1, reserved2, reserved3; +} mach_section_64; +typedef struct { + uint32_t cmd, cmdsize, symoff, nsyms, stroff, strsize; +} mach_symtab_command; +typedef struct { + int32_t strx; + uint8_t type, sect; + int16_t desc; + uint32_t value; +} mach_nlist; +typedef struct { + uint32_t strx; + uint8_t type, sect; + uint16_t desc; + uint64_t value; +} mach_nlist_64; +typedef struct +{ + uint32_t magic, nfat_arch; +} mach_fat_header; +typedef struct +{ + uint32_t cputype, cpusubtype, offset, size, align; +} mach_fat_arch; +typedef struct { + struct { + mach_header hdr; + mach_segment_command seg; + mach_section sec; + mach_symtab_command sym; + } arch[1]; + mach_nlist sym_entry; + uint8_t space[4096]; +} mach_obj; +typedef struct { + struct { + mach_header_64 hdr; + mach_segment_command_64 seg; + mach_section_64 sec; + mach_symtab_command sym; + } arch[1]; + mach_nlist_64 sym_entry; + uint8_t space[4096]; +} mach_obj_64; +typedef struct { + mach_fat_header fat; + mach_fat_arch fat_arch[2]; + struct { + mach_header hdr; + mach_segment_command seg; + mach_section sec; + mach_symtab_command sym; + } arch[2]; + mach_nlist sym_entry; + uint8_t space[4096]; +} mach_fat_obj; +]] + local symname = '_'..LJBC_PREFIX..ctx.modname + local isfat, is64, align, mobj = false, false, 4, "mach_obj" + if ctx.arch == "x64" then + is64, align, mobj = true, 8, "mach_obj_64" + elseif ctx.arch == "arm" then + isfat, mobj = true, "mach_fat_obj" + elseif ctx.arch == "arm64" then + is64, align, isfat, mobj = true, 8, true, "mach_fat_obj" + else + check(ctx.arch == "x86", "unsupported architecture for OSX") + end + local function aligned(v, a) return bit.band(v+a-1, -a) end + local be32 = bit.bswap -- Mach-O FAT is BE, supported archs are LE. + + -- Create Mach-O object and fill in header. + local o = ffi.new(mobj) + local mach_size = aligned(ffi.offsetof(o, "space")+#symname+2, align) + local cputype = ({ x86={7}, x64={0x01000007}, arm={7,12}, arm64={0x01000007,0x0100000c} })[ctx.arch] + local cpusubtype = ({ x86={3}, x64={3}, arm={3,9}, arm64={3,0} })[ctx.arch] + if isfat then + o.fat.magic = be32(0xcafebabe) + o.fat.nfat_arch = be32(#cpusubtype) + end + + -- Fill in sections and symbols. + for i=0,#cpusubtype-1 do + local ofs = 0 + if isfat then + local a = o.fat_arch[i] + a.cputype = be32(cputype[i+1]) + a.cpusubtype = be32(cpusubtype[i+1]) + -- Subsequent slices overlap each other to share data. + ofs = ffi.offsetof(o, "arch") + i*ffi.sizeof(o.arch[0]) + a.offset = be32(ofs) + a.size = be32(mach_size-ofs+#s) + end + local a = o.arch[i] + a.hdr.magic = is64 and 0xfeedfacf or 0xfeedface + a.hdr.cputype = cputype[i+1] + a.hdr.cpusubtype = cpusubtype[i+1] + a.hdr.filetype = 1 + a.hdr.ncmds = 2 + a.hdr.sizeofcmds = ffi.sizeof(a.seg)+ffi.sizeof(a.sec)+ffi.sizeof(a.sym) + a.seg.cmd = is64 and 0x19 or 0x1 + a.seg.cmdsize = ffi.sizeof(a.seg)+ffi.sizeof(a.sec) + a.seg.vmsize = #s + a.seg.fileoff = mach_size-ofs + a.seg.filesize = #s + a.seg.maxprot = 1 + a.seg.initprot = 1 + a.seg.nsects = 1 + ffi.copy(a.sec.sectname, "__data") + ffi.copy(a.sec.segname, "__DATA") + a.sec.size = #s + a.sec.offset = mach_size-ofs + a.sym.cmd = 2 + a.sym.cmdsize = ffi.sizeof(a.sym) + a.sym.symoff = ffi.offsetof(o, "sym_entry")-ofs + a.sym.nsyms = 1 + a.sym.stroff = ffi.offsetof(o, "sym_entry")+ffi.sizeof(o.sym_entry)-ofs + a.sym.strsize = aligned(#symname+2, align) + end + o.sym_entry.type = 0xf + o.sym_entry.sect = 1 + o.sym_entry.strx = 1 + ffi.copy(o.space+1, symname) + + -- Write Macho-O object file. + local fp = savefile(output, "wb") + fp:write(ffi.string(o, mach_size)) + bcsave_tail(fp, output, s) +end + +local function bcsave_obj(ctx, output, s) + local ok, ffi = pcall(require, "ffi") + check(ok, "FFI library required to write this file type") + if ctx.os == "windows" then + return bcsave_peobj(ctx, output, s, ffi) + elseif ctx.os == "osx" then + return bcsave_machobj(ctx, output, s, ffi) + else + return bcsave_elfobj(ctx, output, s, ffi) + end +end + +------------------------------------------------------------------------------ + +local function bclist(input, output) + local f = readfile(input) + require("jit.bc").dump(f, savefile(output, "w"), true) +end + +local function bcsave(ctx, input, output) + local f = readfile(input) + local s = string.dump(f, ctx.strip) + local t = ctx.type + if not t then + t = detecttype(output) + ctx.type = t + end + if t == "raw" then + bcsave_raw(output, s) + else + if not ctx.modname then ctx.modname = detectmodname(input) end + if t == "obj" then + bcsave_obj(ctx, output, s) + else + bcsave_c(ctx, output, s) + end + end +end + +local function docmd(...) + local arg = {...} + local n = 1 + local list = false + local ctx = { + strip = true, arch = jit.arch, os = string.lower(jit.os), + type = false, modname = false, + } + while n <= #arg do + local a = arg[n] + if type(a) == "string" and string.sub(a, 1, 1) == "-" and a ~= "-" then + table.remove(arg, n) + if a == "--" then break end + for m=2,#a do + local opt = string.sub(a, m, m) + if opt == "l" then + list = true + elseif opt == "s" then + ctx.strip = true + elseif opt == "g" then + ctx.strip = false + else + if arg[n] == nil or m ~= #a then usage() end + if opt == "e" then + if n ~= 1 then usage() end + arg[1] = check(loadstring(arg[1])) + elseif opt == "n" then + ctx.modname = checkmodname(table.remove(arg, n)) + elseif opt == "t" then + ctx.type = checkarg(table.remove(arg, n), map_type, "file type") + elseif opt == "a" then + ctx.arch = checkarg(table.remove(arg, n), map_arch, "architecture") + elseif opt == "o" then + ctx.os = checkarg(table.remove(arg, n), map_os, "OS name") + else + usage() + end + end + end + else + n = n + 1 + end + end + if list then + if #arg == 0 or #arg > 2 then usage() end + bclist(arg[1], arg[2] or "-") + else + if #arg ~= 2 then usage() end + bcsave(ctx, arg[1], arg[2]) + end +end + +------------------------------------------------------------------------------ + +-- Public module functions. +return { + start = docmd -- Process -b command line option. +} + diff --git a/Assets/LuaFramework/Luajit/jit/bcsave.lua.meta b/Assets/LuaFramework/Luajit/jit/bcsave.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..ca4e3055ab6d2887dadbaae0aff42eacb30e85a5 --- /dev/null +++ b/Assets/LuaFramework/Luajit/jit/bcsave.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 9cb37ebfedf93ae4b96e0da0d77065c4 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Luajit/jit/dis_arm.lua b/Assets/LuaFramework/Luajit/jit/dis_arm.lua new file mode 100644 index 0000000000000000000000000000000000000000..1296d816be036f90afd9a48f2a44eadf28803bf6 --- /dev/null +++ b/Assets/LuaFramework/Luajit/jit/dis_arm.lua @@ -0,0 +1,689 @@ +---------------------------------------------------------------------------- +-- LuaJIT ARM disassembler module. +-- +-- Copyright (C) 2005-2016 Mike Pall. All rights reserved. +-- Released under the MIT license. See Copyright Notice in luajit.h +---------------------------------------------------------------------------- +-- This is a helper module used by the LuaJIT machine code dumper module. +-- +-- It disassembles most user-mode ARMv7 instructions +-- NYI: Advanced SIMD and VFP instructions. +------------------------------------------------------------------------------ + +local type = type +local sub, byte, format = string.sub, string.byte, string.format +local match, gmatch, gsub = string.match, string.gmatch, string.gsub +local concat = table.concat +local bit = require("bit") +local band, bor, ror, tohex = bit.band, bit.bor, bit.ror, bit.tohex +local lshift, rshift, arshift = bit.lshift, bit.rshift, bit.arshift + +------------------------------------------------------------------------------ +-- Opcode maps +------------------------------------------------------------------------------ + +local map_loadc = { + shift = 8, mask = 15, + [10] = { + shift = 20, mask = 1, + [0] = { + shift = 23, mask = 3, + [0] = "vmovFmDN", "vstmFNdr", + _ = { + shift = 21, mask = 1, + [0] = "vstrFdl", + { shift = 16, mask = 15, [13] = "vpushFdr", _ = "vstmdbFNdr", } + }, + }, + { + shift = 23, mask = 3, + [0] = "vmovFDNm", + { shift = 16, mask = 15, [13] = "vpopFdr", _ = "vldmFNdr", }, + _ = { + shift = 21, mask = 1, + [0] = "vldrFdl", "vldmdbFNdr", + }, + }, + }, + [11] = { + shift = 20, mask = 1, + [0] = { + shift = 23, mask = 3, + [0] = "vmovGmDN", "vstmGNdr", + _ = { + shift = 21, mask = 1, + [0] = "vstrGdl", + { shift = 16, mask = 15, [13] = "vpushGdr", _ = "vstmdbGNdr", } + }, + }, + { + shift = 23, mask = 3, + [0] = "vmovGDNm", + { shift = 16, mask = 15, [13] = "vpopGdr", _ = "vldmGNdr", }, + _ = { + shift = 21, mask = 1, + [0] = "vldrGdl", "vldmdbGNdr", + }, + }, + }, + _ = { + shift = 0, mask = 0 -- NYI ldc, mcrr, mrrc. + }, +} + +local map_vfps = { + shift = 6, mask = 0x2c001, + [0] = "vmlaF.dnm", "vmlsF.dnm", + [0x04000] = "vnmlsF.dnm", [0x04001] = "vnmlaF.dnm", + [0x08000] = "vmulF.dnm", [0x08001] = "vnmulF.dnm", + [0x0c000] = "vaddF.dnm", [0x0c001] = "vsubF.dnm", + [0x20000] = "vdivF.dnm", + [0x24000] = "vfnmsF.dnm", [0x24001] = "vfnmaF.dnm", + [0x28000] = "vfmaF.dnm", [0x28001] = "vfmsF.dnm", + [0x2c000] = "vmovF.dY", + [0x2c001] = { + shift = 7, mask = 0x1e01, + [0] = "vmovF.dm", "vabsF.dm", + [0x0200] = "vnegF.dm", [0x0201] = "vsqrtF.dm", + [0x0800] = "vcmpF.dm", [0x0801] = "vcmpeF.dm", + [0x0a00] = "vcmpzF.d", [0x0a01] = "vcmpzeF.d", + [0x0e01] = "vcvtG.dF.m", + [0x1000] = "vcvt.f32.u32Fdm", [0x1001] = "vcvt.f32.s32Fdm", + [0x1800] = "vcvtr.u32F.dm", [0x1801] = "vcvt.u32F.dm", + [0x1a00] = "vcvtr.s32F.dm", [0x1a01] = "vcvt.s32F.dm", + }, +} + +local map_vfpd = { + shift = 6, mask = 0x2c001, + [0] = "vmlaG.dnm", "vmlsG.dnm", + [0x04000] = "vnmlsG.dnm", [0x04001] = "vnmlaG.dnm", + [0x08000] = "vmulG.dnm", [0x08001] = "vnmulG.dnm", + [0x0c000] = "vaddG.dnm", [0x0c001] = "vsubG.dnm", + [0x20000] = "vdivG.dnm", + [0x24000] = "vfnmsG.dnm", [0x24001] = "vfnmaG.dnm", + [0x28000] = "vfmaG.dnm", [0x28001] = "vfmsG.dnm", + [0x2c000] = "vmovG.dY", + [0x2c001] = { + shift = 7, mask = 0x1e01, + [0] = "vmovG.dm", "vabsG.dm", + [0x0200] = "vnegG.dm", [0x0201] = "vsqrtG.dm", + [0x0800] = "vcmpG.dm", [0x0801] = "vcmpeG.dm", + [0x0a00] = "vcmpzG.d", [0x0a01] = "vcmpzeG.d", + [0x0e01] = "vcvtF.dG.m", + [0x1000] = "vcvt.f64.u32GdFm", [0x1001] = "vcvt.f64.s32GdFm", + [0x1800] = "vcvtr.u32FdG.m", [0x1801] = "vcvt.u32FdG.m", + [0x1a00] = "vcvtr.s32FdG.m", [0x1a01] = "vcvt.s32FdG.m", + }, +} + +local map_datac = { + shift = 24, mask = 1, + [0] = { + shift = 4, mask = 1, + [0] = { + shift = 8, mask = 15, + [10] = map_vfps, + [11] = map_vfpd, + -- NYI cdp, mcr, mrc. + }, + { + shift = 8, mask = 15, + [10] = { + shift = 20, mask = 15, + [0] = "vmovFnD", "vmovFDn", + [14] = "vmsrD", + [15] = { shift = 12, mask = 15, [15] = "vmrs", _ = "vmrsD", }, + }, + }, + }, + "svcT", +} + +local map_loadcu = { + shift = 0, mask = 0, -- NYI unconditional CP load/store. +} + +local map_datacu = { + shift = 0, mask = 0, -- NYI unconditional CP data. +} + +local map_simddata = { + shift = 0, mask = 0, -- NYI SIMD data. +} + +local map_simdload = { + shift = 0, mask = 0, -- NYI SIMD load/store, preload. +} + +local map_preload = { + shift = 0, mask = 0, -- NYI preload. +} + +local map_media = { + shift = 20, mask = 31, + [0] = false, + { --01 + shift = 5, mask = 7, + [0] = "sadd16DNM", "sasxDNM", "ssaxDNM", "ssub16DNM", + "sadd8DNM", false, false, "ssub8DNM", + }, + { --02 + shift = 5, mask = 7, + [0] = "qadd16DNM", "qasxDNM", "qsaxDNM", "qsub16DNM", + "qadd8DNM", false, false, "qsub8DNM", + }, + { --03 + shift = 5, mask = 7, + [0] = "shadd16DNM", "shasxDNM", "shsaxDNM", "shsub16DNM", + "shadd8DNM", false, false, "shsub8DNM", + }, + false, + { --05 + shift = 5, mask = 7, + [0] = "uadd16DNM", "uasxDNM", "usaxDNM", "usub16DNM", + "uadd8DNM", false, false, "usub8DNM", + }, + { --06 + shift = 5, mask = 7, + [0] = "uqadd16DNM", "uqasxDNM", "uqsaxDNM", "uqsub16DNM", + "uqadd8DNM", false, false, "uqsub8DNM", + }, + { --07 + shift = 5, mask = 7, + [0] = "uhadd16DNM", "uhasxDNM", "uhsaxDNM", "uhsub16DNM", + "uhadd8DNM", false, false, "uhsub8DNM", + }, + { --08 + shift = 5, mask = 7, + [0] = "pkhbtDNMU", false, "pkhtbDNMU", + { shift = 16, mask = 15, [15] = "sxtb16DMU", _ = "sxtab16DNMU", }, + "pkhbtDNMU", "selDNM", "pkhtbDNMU", + }, + false, + { --0a + shift = 5, mask = 7, + [0] = "ssatDxMu", "ssat16DxM", "ssatDxMu", + { shift = 16, mask = 15, [15] = "sxtbDMU", _ = "sxtabDNMU", }, + "ssatDxMu", false, "ssatDxMu", + }, + { --0b + shift = 5, mask = 7, + [0] = "ssatDxMu", "revDM", "ssatDxMu", + { shift = 16, mask = 15, [15] = "sxthDMU", _ = "sxtahDNMU", }, + "ssatDxMu", "rev16DM", "ssatDxMu", + }, + { --0c + shift = 5, mask = 7, + [3] = { shift = 16, mask = 15, [15] = "uxtb16DMU", _ = "uxtab16DNMU", }, + }, + false, + { --0e + shift = 5, mask = 7, + [0] = "usatDwMu", "usat16DwM", "usatDwMu", + { shift = 16, mask = 15, [15] = "uxtbDMU", _ = "uxtabDNMU", }, + "usatDwMu", false, "usatDwMu", + }, + { --0f + shift = 5, mask = 7, + [0] = "usatDwMu", "rbitDM", "usatDwMu", + { shift = 16, mask = 15, [15] = "uxthDMU", _ = "uxtahDNMU", }, + "usatDwMu", "revshDM", "usatDwMu", + }, + { --10 + shift = 12, mask = 15, + [15] = { + shift = 5, mask = 7, + "smuadNMS", "smuadxNMS", "smusdNMS", "smusdxNMS", + }, + _ = { + shift = 5, mask = 7, + [0] = "smladNMSD", "smladxNMSD", "smlsdNMSD", "smlsdxNMSD", + }, + }, + false, false, false, + { --14 + shift = 5, mask = 7, + [0] = "smlaldDNMS", "smlaldxDNMS", "smlsldDNMS", "smlsldxDNMS", + }, + { --15 + shift = 5, mask = 7, + [0] = { shift = 12, mask = 15, [15] = "smmulNMS", _ = "smmlaNMSD", }, + { shift = 12, mask = 15, [15] = "smmulrNMS", _ = "smmlarNMSD", }, + false, false, false, false, + "smmlsNMSD", "smmlsrNMSD", + }, + false, false, + { --18 + shift = 5, mask = 7, + [0] = { shift = 12, mask = 15, [15] = "usad8NMS", _ = "usada8NMSD", }, + }, + false, + { --1a + shift = 5, mask = 3, [2] = "sbfxDMvw", + }, + { --1b + shift = 5, mask = 3, [2] = "sbfxDMvw", + }, + { --1c + shift = 5, mask = 3, + [0] = { shift = 0, mask = 15, [15] = "bfcDvX", _ = "bfiDMvX", }, + }, + { --1d + shift = 5, mask = 3, + [0] = { shift = 0, mask = 15, [15] = "bfcDvX", _ = "bfiDMvX", }, + }, + { --1e + shift = 5, mask = 3, [2] = "ubfxDMvw", + }, + { --1f + shift = 5, mask = 3, [2] = "ubfxDMvw", + }, +} + +local map_load = { + shift = 21, mask = 9, + { + shift = 20, mask = 5, + [0] = "strtDL", "ldrtDL", [4] = "strbtDL", [5] = "ldrbtDL", + }, + _ = { + shift = 20, mask = 5, + [0] = "strDL", "ldrDL", [4] = "strbDL", [5] = "ldrbDL", + } +} + +local map_load1 = { + shift = 4, mask = 1, + [0] = map_load, map_media, +} + +local map_loadm = { + shift = 20, mask = 1, + [0] = { + shift = 23, mask = 3, + [0] = "stmdaNR", "stmNR", + { shift = 16, mask = 63, [45] = "pushR", _ = "stmdbNR", }, "stmibNR", + }, + { + shift = 23, mask = 3, + [0] = "ldmdaNR", { shift = 16, mask = 63, [61] = "popR", _ = "ldmNR", }, + "ldmdbNR", "ldmibNR", + }, +} + +local map_data = { + shift = 21, mask = 15, + [0] = "andDNPs", "eorDNPs", "subDNPs", "rsbDNPs", + "addDNPs", "adcDNPs", "sbcDNPs", "rscDNPs", + "tstNP", "teqNP", "cmpNP", "cmnNP", + "orrDNPs", "movDPs", "bicDNPs", "mvnDPs", +} + +local map_mul = { + shift = 21, mask = 7, + [0] = "mulNMSs", "mlaNMSDs", "umaalDNMS", "mlsDNMS", + "umullDNMSs", "umlalDNMSs", "smullDNMSs", "smlalDNMSs", +} + +local map_sync = { + shift = 20, mask = 15, -- NYI: brackets around N. R(D+1) for ldrexd/strexd. + [0] = "swpDMN", false, false, false, + "swpbDMN", false, false, false, + "strexDMN", "ldrexDN", "strexdDN", "ldrexdDN", + "strexbDMN", "ldrexbDN", "strexhDN", "ldrexhDN", +} + +local map_mulh = { + shift = 21, mask = 3, + [0] = { shift = 5, mask = 3, + [0] = "smlabbNMSD", "smlatbNMSD", "smlabtNMSD", "smlattNMSD", }, + { shift = 5, mask = 3, + [0] = "smlawbNMSD", "smulwbNMS", "smlawtNMSD", "smulwtNMS", }, + { shift = 5, mask = 3, + [0] = "smlalbbDNMS", "smlaltbDNMS", "smlalbtDNMS", "smlalttDNMS", }, + { shift = 5, mask = 3, + [0] = "smulbbNMS", "smultbNMS", "smulbtNMS", "smulttNMS", }, +} + +local map_misc = { + shift = 4, mask = 7, + -- NYI: decode PSR bits of msr. + [0] = { shift = 21, mask = 1, [0] = "mrsD", "msrM", }, + { shift = 21, mask = 3, "bxM", false, "clzDM", }, + { shift = 21, mask = 3, "bxjM", }, + { shift = 21, mask = 3, "blxM", }, + false, + { shift = 21, mask = 3, [0] = "qaddDMN", "qsubDMN", "qdaddDMN", "qdsubDMN", }, + false, + { shift = 21, mask = 3, "bkptK", }, +} + +local map_datar = { + shift = 4, mask = 9, + [9] = { + shift = 5, mask = 3, + [0] = { shift = 24, mask = 1, [0] = map_mul, map_sync, }, + { shift = 20, mask = 1, [0] = "strhDL", "ldrhDL", }, + { shift = 20, mask = 1, [0] = "ldrdDL", "ldrsbDL", }, + { shift = 20, mask = 1, [0] = "strdDL", "ldrshDL", }, + }, + _ = { + shift = 20, mask = 25, + [16] = { shift = 7, mask = 1, [0] = map_misc, map_mulh, }, + _ = { + shift = 0, mask = 0xffffffff, + [bor(0xe1a00000)] = "nop", + _ = map_data, + } + }, +} + +local map_datai = { + shift = 20, mask = 31, -- NYI: decode PSR bits of msr. Decode imm12. + [16] = "movwDW", [20] = "movtDW", + [18] = { shift = 0, mask = 0xf00ff, [0] = "nopv6", _ = "msrNW", }, + [22] = "msrNW", + _ = map_data, +} + +local map_branch = { + shift = 24, mask = 1, + [0] = "bB", "blB" +} + +local map_condins = { + [0] = map_datar, map_datai, map_load, map_load1, + map_loadm, map_branch, map_loadc, map_datac +} + +-- NYI: setend. +local map_uncondins = { + [0] = false, map_simddata, map_simdload, map_preload, + false, "blxB", map_loadcu, map_datacu, +} + +------------------------------------------------------------------------------ + +local map_gpr = { + [0] = "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", + "r8", "r9", "r10", "r11", "r12", "sp", "lr", "pc", +} + +local map_cond = { + [0] = "eq", "ne", "hs", "lo", "mi", "pl", "vs", "vc", + "hi", "ls", "ge", "lt", "gt", "le", "al", +} + +local map_shift = { [0] = "lsl", "lsr", "asr", "ror", } + +------------------------------------------------------------------------------ + +-- Output a nicely formatted line with an opcode and operands. +local function putop(ctx, text, operands) + local pos = ctx.pos + local extra = "" + if ctx.rel then + local sym = ctx.symtab[ctx.rel] + if sym then + extra = "\t->"..sym + elseif band(ctx.op, 0x0e000000) ~= 0x0a000000 then + extra = "\t; 0x"..tohex(ctx.rel) + end + end + if ctx.hexdump > 0 then + ctx.out(format("%08x %s %-5s %s%s\n", + ctx.addr+pos, tohex(ctx.op), text, concat(operands, ", "), extra)) + else + ctx.out(format("%08x %-5s %s%s\n", + ctx.addr+pos, text, concat(operands, ", "), extra)) + end + ctx.pos = pos + 4 +end + +-- Fallback for unknown opcodes. +local function unknown(ctx) + return putop(ctx, ".long", { "0x"..tohex(ctx.op) }) +end + +-- Format operand 2 of load/store opcodes. +local function fmtload(ctx, op, pos) + local base = map_gpr[band(rshift(op, 16), 15)] + local x, ofs + local ext = (band(op, 0x04000000) == 0) + if not ext and band(op, 0x02000000) == 0 then + ofs = band(op, 4095) + if band(op, 0x00800000) == 0 then ofs = -ofs end + if base == "pc" then ctx.rel = ctx.addr + pos + 8 + ofs end + ofs = "#"..ofs + elseif ext and band(op, 0x00400000) ~= 0 then + ofs = band(op, 15) + band(rshift(op, 4), 0xf0) + if band(op, 0x00800000) == 0 then ofs = -ofs end + if base == "pc" then ctx.rel = ctx.addr + pos + 8 + ofs end + ofs = "#"..ofs + else + ofs = map_gpr[band(op, 15)] + if ext or band(op, 0xfe0) == 0 then + elseif band(op, 0xfe0) == 0x60 then + ofs = format("%s, rrx", ofs) + else + local sh = band(rshift(op, 7), 31) + if sh == 0 then sh = 32 end + ofs = format("%s, %s #%d", ofs, map_shift[band(rshift(op, 5), 3)], sh) + end + if band(op, 0x00800000) == 0 then ofs = "-"..ofs end + end + if ofs == "#0" then + x = format("[%s]", base) + elseif band(op, 0x01000000) == 0 then + x = format("[%s], %s", base, ofs) + else + x = format("[%s, %s]", base, ofs) + end + if band(op, 0x01200000) == 0x01200000 then x = x.."!" end + return x +end + +-- Format operand 2 of vector load/store opcodes. +local function fmtvload(ctx, op, pos) + local base = map_gpr[band(rshift(op, 16), 15)] + local ofs = band(op, 255)*4 + if band(op, 0x00800000) == 0 then ofs = -ofs end + if base == "pc" then ctx.rel = ctx.addr + pos + 8 + ofs end + if ofs == 0 then + return format("[%s]", base) + else + return format("[%s, #%d]", base, ofs) + end +end + +local function fmtvr(op, vr, sh0, sh1) + if vr == "s" then + return format("s%d", 2*band(rshift(op, sh0), 15)+band(rshift(op, sh1), 1)) + else + return format("d%d", band(rshift(op, sh0), 15)+band(rshift(op, sh1-4), 16)) + end +end + +-- Disassemble a single instruction. +local function disass_ins(ctx) + local pos = ctx.pos + local b0, b1, b2, b3 = byte(ctx.code, pos+1, pos+4) + local op = bor(lshift(b3, 24), lshift(b2, 16), lshift(b1, 8), b0) + local operands = {} + local suffix = "" + local last, name, pat + local vr + ctx.op = op + ctx.rel = nil + + local cond = rshift(op, 28) + local opat + if cond == 15 then + opat = map_uncondins[band(rshift(op, 25), 7)] + else + if cond ~= 14 then suffix = map_cond[cond] end + opat = map_condins[band(rshift(op, 25), 7)] + end + while type(opat) ~= "string" do + if not opat then return unknown(ctx) end + opat = opat[band(rshift(op, opat.shift), opat.mask)] or opat._ + end + name, pat = match(opat, "^([a-z0-9]*)(.*)") + if sub(pat, 1, 1) == "." then + local s2, p2 = match(pat, "^([a-z0-9.]*)(.*)") + suffix = suffix..s2 + pat = p2 + end + + for p in gmatch(pat, ".") do + local x = nil + if p == "D" then + x = map_gpr[band(rshift(op, 12), 15)] + elseif p == "N" then + x = map_gpr[band(rshift(op, 16), 15)] + elseif p == "S" then + x = map_gpr[band(rshift(op, 8), 15)] + elseif p == "M" then + x = map_gpr[band(op, 15)] + elseif p == "d" then + x = fmtvr(op, vr, 12, 22) + elseif p == "n" then + x = fmtvr(op, vr, 16, 7) + elseif p == "m" then + x = fmtvr(op, vr, 0, 5) + elseif p == "P" then + if band(op, 0x02000000) ~= 0 then + x = ror(band(op, 255), 2*band(rshift(op, 8), 15)) + else + x = map_gpr[band(op, 15)] + if band(op, 0xff0) ~= 0 then + operands[#operands+1] = x + local s = map_shift[band(rshift(op, 5), 3)] + local r = nil + if band(op, 0xf90) == 0 then + if s == "ror" then s = "rrx" else r = "#32" end + elseif band(op, 0x10) == 0 then + r = "#"..band(rshift(op, 7), 31) + else + r = map_gpr[band(rshift(op, 8), 15)] + end + if name == "mov" then name = s; x = r + elseif r then x = format("%s %s", s, r) + else x = s end + end + end + elseif p == "L" then + x = fmtload(ctx, op, pos) + elseif p == "l" then + x = fmtvload(ctx, op, pos) + elseif p == "B" then + local addr = ctx.addr + pos + 8 + arshift(lshift(op, 8), 6) + if cond == 15 then addr = addr + band(rshift(op, 23), 2) end + ctx.rel = addr + x = "0x"..tohex(addr) + elseif p == "F" then + vr = "s" + elseif p == "G" then + vr = "d" + elseif p == "." then + suffix = suffix..(vr == "s" and ".f32" or ".f64") + elseif p == "R" then + if band(op, 0x00200000) ~= 0 and #operands == 1 then + operands[1] = operands[1].."!" + end + local t = {} + for i=0,15 do + if band(rshift(op, i), 1) == 1 then t[#t+1] = map_gpr[i] end + end + x = "{"..concat(t, ", ").."}" + elseif p == "r" then + if band(op, 0x00200000) ~= 0 and #operands == 2 then + operands[1] = operands[1].."!" + end + local s = tonumber(sub(last, 2)) + local n = band(op, 255) + if vr == "d" then n = rshift(n, 1) end + operands[#operands] = format("{%s-%s%d}", last, vr, s+n-1) + elseif p == "W" then + x = band(op, 0x0fff) + band(rshift(op, 4), 0xf000) + elseif p == "T" then + x = "#0x"..tohex(band(op, 0x00ffffff), 6) + elseif p == "U" then + x = band(rshift(op, 7), 31) + if x == 0 then x = nil end + elseif p == "u" then + x = band(rshift(op, 7), 31) + if band(op, 0x40) == 0 then + if x == 0 then x = nil else x = "lsl #"..x end + else + if x == 0 then x = "asr #32" else x = "asr #"..x end + end + elseif p == "v" then + x = band(rshift(op, 7), 31) + elseif p == "w" then + x = band(rshift(op, 16), 31) + elseif p == "x" then + x = band(rshift(op, 16), 31) + 1 + elseif p == "X" then + x = band(rshift(op, 16), 31) - last + 1 + elseif p == "Y" then + x = band(rshift(op, 12), 0xf0) + band(op, 0x0f) + elseif p == "K" then + x = "#0x"..tohex(band(rshift(op, 4), 0x0000fff0) + band(op, 15), 4) + elseif p == "s" then + if band(op, 0x00100000) ~= 0 then suffix = "s"..suffix end + else + assert(false) + end + if x then + last = x + if type(x) == "number" then x = "#"..x end + operands[#operands+1] = x + end + end + + return putop(ctx, name..suffix, operands) +end + +------------------------------------------------------------------------------ + +-- Disassemble a block of code. +local function disass_block(ctx, ofs, len) + if not ofs then ofs = 0 end + local stop = len and ofs+len or #ctx.code + ctx.pos = ofs + ctx.rel = nil + while ctx.pos < stop do disass_ins(ctx) end +end + +-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len). +local function create(code, addr, out) + local ctx = {} + ctx.code = code + ctx.addr = addr or 0 + ctx.out = out or io.write + ctx.symtab = {} + ctx.disass = disass_block + ctx.hexdump = 8 + return ctx +end + +-- Simple API: disassemble code (a string) at address and output via out. +local function disass(code, addr, out) + create(code, addr, out):disass() +end + +-- Return register name for RID. +local function regname(r) + if r < 16 then return map_gpr[r] end + return "d"..(r-16) +end + +-- Public module functions. +return { + create = create, + disass = disass, + regname = regname +} + diff --git a/Assets/LuaFramework/Luajit/jit/dis_arm.lua.meta b/Assets/LuaFramework/Luajit/jit/dis_arm.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..c4f69d0f36bc49723b7677bc6631c631bfe34042 --- /dev/null +++ b/Assets/LuaFramework/Luajit/jit/dis_arm.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 4a5d0750f7c50434799a22a9fd01dd11 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Luajit/jit/dis_mips.lua b/Assets/LuaFramework/Luajit/jit/dis_mips.lua new file mode 100644 index 0000000000000000000000000000000000000000..2bf8b389c36574a21e44d6ca7ec3c13d8a2989bb --- /dev/null +++ b/Assets/LuaFramework/Luajit/jit/dis_mips.lua @@ -0,0 +1,428 @@ +---------------------------------------------------------------------------- +-- LuaJIT MIPS disassembler module. +-- +-- Copyright (C) 2005-2016 Mike Pall. All rights reserved. +-- Released under the MIT/X license. See Copyright Notice in luajit.h +---------------------------------------------------------------------------- +-- This is a helper module used by the LuaJIT machine code dumper module. +-- +-- It disassembles all standard MIPS32R1/R2 instructions. +-- Default mode is big-endian, but see: dis_mipsel.lua +------------------------------------------------------------------------------ + +local type = type +local sub, byte, format = string.sub, string.byte, string.format +local match, gmatch, gsub = string.match, string.gmatch, string.gsub +local concat = table.concat +local bit = require("bit") +local band, bor, tohex = bit.band, bit.bor, bit.tohex +local lshift, rshift, arshift = bit.lshift, bit.rshift, bit.arshift + +------------------------------------------------------------------------------ +-- Primary and extended opcode maps +------------------------------------------------------------------------------ + +local map_movci = { shift = 16, mask = 1, [0] = "movfDSC", "movtDSC", } +local map_srl = { shift = 21, mask = 1, [0] = "srlDTA", "rotrDTA", } +local map_srlv = { shift = 6, mask = 1, [0] = "srlvDTS", "rotrvDTS", } + +local map_special = { + shift = 0, mask = 63, + [0] = { shift = 0, mask = -1, [0] = "nop", _ = "sllDTA" }, + map_movci, map_srl, "sraDTA", + "sllvDTS", false, map_srlv, "sravDTS", + "jrS", "jalrD1S", "movzDST", "movnDST", + "syscallY", "breakY", false, "sync", + "mfhiD", "mthiS", "mfloD", "mtloS", + false, false, false, false, + "multST", "multuST", "divST", "divuST", + false, false, false, false, + "addDST", "addu|moveDST0", "subDST", "subu|neguDS0T", + "andDST", "orDST", "xorDST", "nor|notDST0", + false, false, "sltDST", "sltuDST", + false, false, false, false, + "tgeSTZ", "tgeuSTZ", "tltSTZ", "tltuSTZ", + "teqSTZ", false, "tneSTZ", +} + +local map_special2 = { + shift = 0, mask = 63, + [0] = "maddST", "madduST", "mulDST", false, + "msubST", "msubuST", + [32] = "clzDS", [33] = "cloDS", + [63] = "sdbbpY", +} + +local map_bshfl = { + shift = 6, mask = 31, + [2] = "wsbhDT", + [16] = "sebDT", + [24] = "sehDT", +} + +local map_special3 = { + shift = 0, mask = 63, + [0] = "extTSAK", [4] = "insTSAL", + [32] = map_bshfl, + [59] = "rdhwrTD", +} + +local map_regimm = { + shift = 16, mask = 31, + [0] = "bltzSB", "bgezSB", "bltzlSB", "bgezlSB", + false, false, false, false, + "tgeiSI", "tgeiuSI", "tltiSI", "tltiuSI", + "teqiSI", false, "tneiSI", false, + "bltzalSB", "bgezalSB", "bltzallSB", "bgezallSB", + false, false, false, false, + false, false, false, false, + false, false, false, "synciSO", +} + +local map_cop0 = { + shift = 25, mask = 1, + [0] = { + shift = 21, mask = 15, + [0] = "mfc0TDW", [4] = "mtc0TDW", + [10] = "rdpgprDT", + [11] = { shift = 5, mask = 1, [0] = "diT0", "eiT0", }, + [14] = "wrpgprDT", + }, { + shift = 0, mask = 63, + [1] = "tlbr", [2] = "tlbwi", [6] = "tlbwr", [8] = "tlbp", + [24] = "eret", [31] = "deret", + [32] = "wait", + }, +} + +local map_cop1s = { + shift = 0, mask = 63, + [0] = "add.sFGH", "sub.sFGH", "mul.sFGH", "div.sFGH", + "sqrt.sFG", "abs.sFG", "mov.sFG", "neg.sFG", + "round.l.sFG", "trunc.l.sFG", "ceil.l.sFG", "floor.l.sFG", + "round.w.sFG", "trunc.w.sFG", "ceil.w.sFG", "floor.w.sFG", + false, + { shift = 16, mask = 1, [0] = "movf.sFGC", "movt.sFGC" }, + "movz.sFGT", "movn.sFGT", + false, "recip.sFG", "rsqrt.sFG", false, + false, false, false, false, + false, false, false, false, + false, "cvt.d.sFG", false, false, + "cvt.w.sFG", "cvt.l.sFG", "cvt.ps.sFGH", false, + false, false, false, false, + false, false, false, false, + "c.f.sVGH", "c.un.sVGH", "c.eq.sVGH", "c.ueq.sVGH", + "c.olt.sVGH", "c.ult.sVGH", "c.ole.sVGH", "c.ule.sVGH", + "c.sf.sVGH", "c.ngle.sVGH", "c.seq.sVGH", "c.ngl.sVGH", + "c.lt.sVGH", "c.nge.sVGH", "c.le.sVGH", "c.ngt.sVGH", +} + +local map_cop1d = { + shift = 0, mask = 63, + [0] = "add.dFGH", "sub.dFGH", "mul.dFGH", "div.dFGH", + "sqrt.dFG", "abs.dFG", "mov.dFG", "neg.dFG", + "round.l.dFG", "trunc.l.dFG", "ceil.l.dFG", "floor.l.dFG", + "round.w.dFG", "trunc.w.dFG", "ceil.w.dFG", "floor.w.dFG", + false, + { shift = 16, mask = 1, [0] = "movf.dFGC", "movt.dFGC" }, + "movz.dFGT", "movn.dFGT", + false, "recip.dFG", "rsqrt.dFG", false, + false, false, false, false, + false, false, false, false, + "cvt.s.dFG", false, false, false, + "cvt.w.dFG", "cvt.l.dFG", false, false, + false, false, false, false, + false, false, false, false, + "c.f.dVGH", "c.un.dVGH", "c.eq.dVGH", "c.ueq.dVGH", + "c.olt.dVGH", "c.ult.dVGH", "c.ole.dVGH", "c.ule.dVGH", + "c.df.dVGH", "c.ngle.dVGH", "c.deq.dVGH", "c.ngl.dVGH", + "c.lt.dVGH", "c.nge.dVGH", "c.le.dVGH", "c.ngt.dVGH", +} + +local map_cop1ps = { + shift = 0, mask = 63, + [0] = "add.psFGH", "sub.psFGH", "mul.psFGH", false, + false, "abs.psFG", "mov.psFG", "neg.psFG", + false, false, false, false, + false, false, false, false, + false, + { shift = 16, mask = 1, [0] = "movf.psFGC", "movt.psFGC" }, + "movz.psFGT", "movn.psFGT", + false, false, false, false, + false, false, false, false, + false, false, false, false, + "cvt.s.puFG", false, false, false, + false, false, false, false, + "cvt.s.plFG", false, false, false, + "pll.psFGH", "plu.psFGH", "pul.psFGH", "puu.psFGH", + "c.f.psVGH", "c.un.psVGH", "c.eq.psVGH", "c.ueq.psVGH", + "c.olt.psVGH", "c.ult.psVGH", "c.ole.psVGH", "c.ule.psVGH", + "c.psf.psVGH", "c.ngle.psVGH", "c.pseq.psVGH", "c.ngl.psVGH", + "c.lt.psVGH", "c.nge.psVGH", "c.le.psVGH", "c.ngt.psVGH", +} + +local map_cop1w = { + shift = 0, mask = 63, + [32] = "cvt.s.wFG", [33] = "cvt.d.wFG", +} + +local map_cop1l = { + shift = 0, mask = 63, + [32] = "cvt.s.lFG", [33] = "cvt.d.lFG", +} + +local map_cop1bc = { + shift = 16, mask = 3, + [0] = "bc1fCB", "bc1tCB", "bc1flCB", "bc1tlCB", +} + +local map_cop1 = { + shift = 21, mask = 31, + [0] = "mfc1TG", false, "cfc1TG", "mfhc1TG", + "mtc1TG", false, "ctc1TG", "mthc1TG", + map_cop1bc, false, false, false, + false, false, false, false, + map_cop1s, map_cop1d, false, false, + map_cop1w, map_cop1l, map_cop1ps, +} + +local map_cop1x = { + shift = 0, mask = 63, + [0] = "lwxc1FSX", "ldxc1FSX", false, false, + false, "luxc1FSX", false, false, + "swxc1FSX", "sdxc1FSX", false, false, + false, "suxc1FSX", false, "prefxMSX", + false, false, false, false, + false, false, false, false, + false, false, false, false, + false, false, "alnv.psFGHS", false, + "madd.sFRGH", "madd.dFRGH", false, false, + false, false, "madd.psFRGH", false, + "msub.sFRGH", "msub.dFRGH", false, false, + false, false, "msub.psFRGH", false, + "nmadd.sFRGH", "nmadd.dFRGH", false, false, + false, false, "nmadd.psFRGH", false, + "nmsub.sFRGH", "nmsub.dFRGH", false, false, + false, false, "nmsub.psFRGH", false, +} + +local map_pri = { + [0] = map_special, map_regimm, "jJ", "jalJ", + "beq|beqz|bST00B", "bne|bnezST0B", "blezSB", "bgtzSB", + "addiTSI", "addiu|liTS0I", "sltiTSI", "sltiuTSI", + "andiTSU", "ori|liTS0U", "xoriTSU", "luiTU", + map_cop0, map_cop1, false, map_cop1x, + "beql|beqzlST0B", "bnel|bnezlST0B", "blezlSB", "bgtzlSB", + false, false, false, false, + map_special2, false, false, map_special3, + "lbTSO", "lhTSO", "lwlTSO", "lwTSO", + "lbuTSO", "lhuTSO", "lwrTSO", false, + "sbTSO", "shTSO", "swlTSO", "swTSO", + false, false, "swrTSO", "cacheNSO", + "llTSO", "lwc1HSO", "lwc2TSO", "prefNSO", + false, "ldc1HSO", "ldc2TSO", false, + "scTSO", "swc1HSO", "swc2TSO", false, + false, "sdc1HSO", "sdc2TSO", false, +} + +------------------------------------------------------------------------------ + +local map_gpr = { + [0] = "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", + "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", + "r24", "r25", "r26", "r27", "r28", "sp", "r30", "ra", +} + +------------------------------------------------------------------------------ + +-- Output a nicely formatted line with an opcode and operands. +local function putop(ctx, text, operands) + local pos = ctx.pos + local extra = "" + if ctx.rel then + local sym = ctx.symtab[ctx.rel] + if sym then extra = "\t->"..sym end + end + if ctx.hexdump > 0 then + ctx.out(format("%08x %s %-7s %s%s\n", + ctx.addr+pos, tohex(ctx.op), text, concat(operands, ", "), extra)) + else + ctx.out(format("%08x %-7s %s%s\n", + ctx.addr+pos, text, concat(operands, ", "), extra)) + end + ctx.pos = pos + 4 +end + +-- Fallback for unknown opcodes. +local function unknown(ctx) + return putop(ctx, ".long", { "0x"..tohex(ctx.op) }) +end + +local function get_be(ctx) + local pos = ctx.pos + local b0, b1, b2, b3 = byte(ctx.code, pos+1, pos+4) + return bor(lshift(b0, 24), lshift(b1, 16), lshift(b2, 8), b3) +end + +local function get_le(ctx) + local pos = ctx.pos + local b0, b1, b2, b3 = byte(ctx.code, pos+1, pos+4) + return bor(lshift(b3, 24), lshift(b2, 16), lshift(b1, 8), b0) +end + +-- Disassemble a single instruction. +local function disass_ins(ctx) + local op = ctx:get() + local operands = {} + local last = nil + ctx.op = op + ctx.rel = nil + + local opat = map_pri[rshift(op, 26)] + while type(opat) ~= "string" do + if not opat then return unknown(ctx) end + opat = opat[band(rshift(op, opat.shift), opat.mask)] or opat._ + end + local name, pat = match(opat, "^([a-z0-9_.]*)(.*)") + local altname, pat2 = match(pat, "|([a-z0-9_.|]*)(.*)") + if altname then pat = pat2 end + + for p in gmatch(pat, ".") do + local x = nil + if p == "S" then + x = map_gpr[band(rshift(op, 21), 31)] + elseif p == "T" then + x = map_gpr[band(rshift(op, 16), 31)] + elseif p == "D" then + x = map_gpr[band(rshift(op, 11), 31)] + elseif p == "F" then + x = "f"..band(rshift(op, 6), 31) + elseif p == "G" then + x = "f"..band(rshift(op, 11), 31) + elseif p == "H" then + x = "f"..band(rshift(op, 16), 31) + elseif p == "R" then + x = "f"..band(rshift(op, 21), 31) + elseif p == "A" then + x = band(rshift(op, 6), 31) + elseif p == "M" then + x = band(rshift(op, 11), 31) + elseif p == "N" then + x = band(rshift(op, 16), 31) + elseif p == "C" then + x = band(rshift(op, 18), 7) + if x == 0 then x = nil end + elseif p == "K" then + x = band(rshift(op, 11), 31) + 1 + elseif p == "L" then + x = band(rshift(op, 11), 31) - last + 1 + elseif p == "I" then + x = arshift(lshift(op, 16), 16) + elseif p == "U" then + x = band(op, 0xffff) + elseif p == "O" then + local disp = arshift(lshift(op, 16), 16) + operands[#operands] = format("%d(%s)", disp, last) + elseif p == "X" then + local index = map_gpr[band(rshift(op, 16), 31)] + operands[#operands] = format("%s(%s)", index, last) + elseif p == "B" then + x = ctx.addr + ctx.pos + arshift(lshift(op, 16), 16)*4 + 4 + ctx.rel = x + x = "0x"..tohex(x) + elseif p == "J" then + x = band(ctx.addr + ctx.pos, 0xf0000000) + band(op, 0x03ffffff)*4 + ctx.rel = x + x = "0x"..tohex(x) + elseif p == "V" then + x = band(rshift(op, 8), 7) + if x == 0 then x = nil end + elseif p == "W" then + x = band(op, 7) + if x == 0 then x = nil end + elseif p == "Y" then + x = band(rshift(op, 6), 0x000fffff) + if x == 0 then x = nil end + elseif p == "Z" then + x = band(rshift(op, 6), 1023) + if x == 0 then x = nil end + elseif p == "0" then + if last == "r0" or last == 0 then + local n = #operands + operands[n] = nil + last = operands[n-1] + if altname then + local a1, a2 = match(altname, "([^|]*)|(.*)") + if a1 then name, altname = a1, a2 + else name = altname end + end + end + elseif p == "1" then + if last == "ra" then + operands[#operands] = nil + end + else + assert(false) + end + if x then operands[#operands+1] = x; last = x end + end + + return putop(ctx, name, operands) +end + +------------------------------------------------------------------------------ + +-- Disassemble a block of code. +local function disass_block(ctx, ofs, len) + if not ofs then ofs = 0 end + local stop = len and ofs+len or #ctx.code + stop = stop - stop % 4 + ctx.pos = ofs - ofs % 4 + ctx.rel = nil + while ctx.pos < stop do disass_ins(ctx) end +end + +-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len). +local function create(code, addr, out) + local ctx = {} + ctx.code = code + ctx.addr = addr or 0 + ctx.out = out or io.write + ctx.symtab = {} + ctx.disass = disass_block + ctx.hexdump = 8 + ctx.get = get_be + return ctx +end + +local function create_el(code, addr, out) + local ctx = create(code, addr, out) + ctx.get = get_le + return ctx +end + +-- Simple API: disassemble code (a string) at address and output via out. +local function disass(code, addr, out) + create(code, addr, out):disass() +end + +local function disass_el(code, addr, out) + create_el(code, addr, out):disass() +end + +-- Return register name for RID. +local function regname(r) + if r < 32 then return map_gpr[r] end + return "f"..(r-32) +end + +-- Public module functions. +return { + create = create, + create_el = create_el, + disass = disass, + disass_el = disass_el, + regname = regname +} + diff --git a/Assets/LuaFramework/Luajit/jit/dis_mips.lua.meta b/Assets/LuaFramework/Luajit/jit/dis_mips.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..594d9ba0c09e3c577d7ee4f0d254ddc6722c3356 --- /dev/null +++ b/Assets/LuaFramework/Luajit/jit/dis_mips.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 6d6b0da48d262af4b902b41b630d7c55 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Luajit/jit/dis_mipsel.lua b/Assets/LuaFramework/Luajit/jit/dis_mipsel.lua new file mode 100644 index 0000000000000000000000000000000000000000..3f2f6efc98f3b626a0b732b336fa5c404d4ef0b1 --- /dev/null +++ b/Assets/LuaFramework/Luajit/jit/dis_mipsel.lua @@ -0,0 +1,17 @@ +---------------------------------------------------------------------------- +-- LuaJIT MIPSEL disassembler wrapper module. +-- +-- Copyright (C) 2005-2016 Mike Pall. All rights reserved. +-- Released under the MIT license. See Copyright Notice in luajit.h +---------------------------------------------------------------------------- +-- This module just exports the little-endian functions from the +-- MIPS disassembler module. All the interesting stuff is there. +------------------------------------------------------------------------------ + +local dis_mips = require((string.match(..., ".*%.") or "").."dis_mips") +return { + create = dis_mips.create_el, + disass = dis_mips.disass_el, + regname = dis_mips.regname +} + diff --git a/Assets/LuaFramework/Luajit/jit/dis_mipsel.lua.meta b/Assets/LuaFramework/Luajit/jit/dis_mipsel.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..481244e3fb362215930893c5bd1526280ae84514 --- /dev/null +++ b/Assets/LuaFramework/Luajit/jit/dis_mipsel.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 06a369592f16cc54b82ec90d905c271c +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Luajit/jit/dis_ppc.lua b/Assets/LuaFramework/Luajit/jit/dis_ppc.lua new file mode 100644 index 0000000000000000000000000000000000000000..30f51ecdc1473f2711d3d60c9efe6815e2b3f697 --- /dev/null +++ b/Assets/LuaFramework/Luajit/jit/dis_ppc.lua @@ -0,0 +1,591 @@ +---------------------------------------------------------------------------- +-- LuaJIT PPC disassembler module. +-- +-- Copyright (C) 2005-2016 Mike Pall. All rights reserved. +-- Released under the MIT/X license. See Copyright Notice in luajit.h +---------------------------------------------------------------------------- +-- This is a helper module used by the LuaJIT machine code dumper module. +-- +-- It disassembles all common, non-privileged 32/64 bit PowerPC instructions +-- plus the e500 SPE instructions and some Cell/Xenon extensions. +-- +-- NYI: VMX, VMX128 +------------------------------------------------------------------------------ + +local type = type +local sub, byte, format = string.sub, string.byte, string.format +local match, gmatch, gsub = string.match, string.gmatch, string.gsub +local concat = table.concat +local bit = require("bit") +local band, bor, tohex = bit.band, bit.bor, bit.tohex +local lshift, rshift, arshift = bit.lshift, bit.rshift, bit.arshift + +------------------------------------------------------------------------------ +-- Primary and extended opcode maps +------------------------------------------------------------------------------ + +local map_crops = { + shift = 1, mask = 1023, + [0] = "mcrfXX", + [33] = "crnor|crnotCCC=", [129] = "crandcCCC", + [193] = "crxor|crclrCCC%", [225] = "crnandCCC", + [257] = "crandCCC", [289] = "creqv|crsetCCC%", + [417] = "crorcCCC", [449] = "cror|crmoveCCC=", + [16] = "b_lrKB", [528] = "b_ctrKB", + [150] = "isync", +} + +local map_rlwinm = setmetatable({ + shift = 0, mask = -1, +}, +{ __index = function(t, x) + local rot = band(rshift(x, 11), 31) + local mb = band(rshift(x, 6), 31) + local me = band(rshift(x, 1), 31) + if mb == 0 and me == 31-rot then + return "slwiRR~A." + elseif me == 31 and mb == 32-rot then + return "srwiRR~-A." + else + return "rlwinmRR~AAA." + end + end +}) + +local map_rld = { + shift = 2, mask = 7, + [0] = "rldiclRR~HM.", "rldicrRR~HM.", "rldicRR~HM.", "rldimiRR~HM.", + { + shift = 1, mask = 1, + [0] = "rldclRR~RM.", "rldcrRR~RM.", + }, +} + +local map_ext = setmetatable({ + shift = 1, mask = 1023, + + [0] = "cmp_YLRR", [32] = "cmpl_YLRR", + [4] = "twARR", [68] = "tdARR", + + [8] = "subfcRRR.", [40] = "subfRRR.", + [104] = "negRR.", [136] = "subfeRRR.", + [200] = "subfzeRR.", [232] = "subfmeRR.", + [520] = "subfcoRRR.", [552] = "subfoRRR.", + [616] = "negoRR.", [648] = "subfeoRRR.", + [712] = "subfzeoRR.", [744] = "subfmeoRR.", + + [9] = "mulhduRRR.", [73] = "mulhdRRR.", [233] = "mulldRRR.", + [457] = "divduRRR.", [489] = "divdRRR.", + [745] = "mulldoRRR.", + [969] = "divduoRRR.", [1001] = "divdoRRR.", + + [10] = "addcRRR.", [138] = "addeRRR.", + [202] = "addzeRR.", [234] = "addmeRR.", [266] = "addRRR.", + [522] = "addcoRRR.", [650] = "addeoRRR.", + [714] = "addzeoRR.", [746] = "addmeoRR.", [778] = "addoRRR.", + + [11] = "mulhwuRRR.", [75] = "mulhwRRR.", [235] = "mullwRRR.", + [459] = "divwuRRR.", [491] = "divwRRR.", + [747] = "mullwoRRR.", + [971] = "divwouRRR.", [1003] = "divwoRRR.", + + [15] = "iselltRRR", [47] = "iselgtRRR", [79] = "iseleqRRR", + + [144] = { shift = 20, mask = 1, [0] = "mtcrfRZ~", "mtocrfRZ~", }, + [19] = { shift = 20, mask = 1, [0] = "mfcrR", "mfocrfRZ", }, + [371] = { shift = 11, mask = 1023, [392] = "mftbR", [424] = "mftbuR", }, + [339] = { + shift = 11, mask = 1023, + [32] = "mferR", [256] = "mflrR", [288] = "mfctrR", [16] = "mfspefscrR", + }, + [467] = { + shift = 11, mask = 1023, + [32] = "mtxerR", [256] = "mtlrR", [288] = "mtctrR", [16] = "mtspefscrR", + }, + + [20] = "lwarxRR0R", [84] = "ldarxRR0R", + + [21] = "ldxRR0R", [53] = "lduxRRR", + [149] = "stdxRR0R", [181] = "stduxRRR", + [341] = "lwaxRR0R", [373] = "lwauxRRR", + + [23] = "lwzxRR0R", [55] = "lwzuxRRR", + [87] = "lbzxRR0R", [119] = "lbzuxRRR", + [151] = "stwxRR0R", [183] = "stwuxRRR", + [215] = "stbxRR0R", [247] = "stbuxRRR", + [279] = "lhzxRR0R", [311] = "lhzuxRRR", + [343] = "lhaxRR0R", [375] = "lhauxRRR", + [407] = "sthxRR0R", [439] = "sthuxRRR", + + [54] = "dcbst-R0R", [86] = "dcbf-R0R", + [150] = "stwcxRR0R.", [214] = "stdcxRR0R.", + [246] = "dcbtst-R0R", [278] = "dcbt-R0R", + [310] = "eciwxRR0R", [438] = "ecowxRR0R", + [470] = "dcbi-RR", + + [598] = { + shift = 21, mask = 3, + [0] = "sync", "lwsync", "ptesync", + }, + [758] = "dcba-RR", + [854] = "eieio", [982] = "icbi-R0R", [1014] = "dcbz-R0R", + + [26] = "cntlzwRR~", [58] = "cntlzdRR~", + [122] = "popcntbRR~", + [154] = "prtywRR~", [186] = "prtydRR~", + + [28] = "andRR~R.", [60] = "andcRR~R.", [124] = "nor|notRR~R=.", + [284] = "eqvRR~R.", [316] = "xorRR~R.", + [412] = "orcRR~R.", [444] = "or|mrRR~R=.", [476] = "nandRR~R.", + [508] = "cmpbRR~R", + + [512] = "mcrxrX", + + [532] = "ldbrxRR0R", [660] = "stdbrxRR0R", + + [533] = "lswxRR0R", [597] = "lswiRR0A", + [661] = "stswxRR0R", [725] = "stswiRR0A", + + [534] = "lwbrxRR0R", [662] = "stwbrxRR0R", + [790] = "lhbrxRR0R", [918] = "sthbrxRR0R", + + [535] = "lfsxFR0R", [567] = "lfsuxFRR", + [599] = "lfdxFR0R", [631] = "lfduxFRR", + [663] = "stfsxFR0R", [695] = "stfsuxFRR", + [727] = "stfdxFR0R", [759] = "stfduxFR0R", + [855] = "lfiwaxFR0R", + [983] = "stfiwxFR0R", + + [24] = "slwRR~R.", + + [27] = "sldRR~R.", [536] = "srwRR~R.", + [792] = "srawRR~R.", [824] = "srawiRR~A.", + + [794] = "sradRR~R.", [826] = "sradiRR~H.", [827] = "sradiRR~H.", + [922] = "extshRR~.", [954] = "extsbRR~.", [986] = "extswRR~.", + + [539] = "srdRR~R.", +}, +{ __index = function(t, x) + if band(x, 31) == 15 then return "iselRRRC" end + end +}) + +local map_ld = { + shift = 0, mask = 3, + [0] = "ldRRE", "lduRRE", "lwaRRE", +} + +local map_std = { + shift = 0, mask = 3, + [0] = "stdRRE", "stduRRE", +} + +local map_fps = { + shift = 5, mask = 1, + { + shift = 1, mask = 15, + [0] = false, false, "fdivsFFF.", false, + "fsubsFFF.", "faddsFFF.", "fsqrtsF-F.", false, + "fresF-F.", "fmulsFF-F.", "frsqrtesF-F.", false, + "fmsubsFFFF~.", "fmaddsFFFF~.", "fnmsubsFFFF~.", "fnmaddsFFFF~.", + } +} + +local map_fpd = { + shift = 5, mask = 1, + [0] = { + shift = 1, mask = 1023, + [0] = "fcmpuXFF", [32] = "fcmpoXFF", [64] = "mcrfsXX", + [38] = "mtfsb1A.", [70] = "mtfsb0A.", [134] = "mtfsfiA>>-A>", + [8] = "fcpsgnFFF.", [40] = "fnegF-F.", [72] = "fmrF-F.", + [136] = "fnabsF-F.", [264] = "fabsF-F.", + [12] = "frspF-F.", + [14] = "fctiwF-F.", [15] = "fctiwzF-F.", + [583] = "mffsF.", [711] = "mtfsfZF.", + [392] = "frinF-F.", [424] = "frizF-F.", + [456] = "fripF-F.", [488] = "frimF-F.", + [814] = "fctidF-F.", [815] = "fctidzF-F.", [846] = "fcfidF-F.", + }, + { + shift = 1, mask = 15, + [0] = false, false, "fdivFFF.", false, + "fsubFFF.", "faddFFF.", "fsqrtF-F.", "fselFFFF~.", + "freF-F.", "fmulFF-F.", "frsqrteF-F.", false, + "fmsubFFFF~.", "fmaddFFFF~.", "fnmsubFFFF~.", "fnmaddFFFF~.", + } +} + +local map_spe = { + shift = 0, mask = 2047, + + [512] = "evaddwRRR", [514] = "evaddiwRAR~", + [516] = "evsubwRRR~", [518] = "evsubiwRAR~", + [520] = "evabsRR", [521] = "evnegRR", + [522] = "evextsbRR", [523] = "evextshRR", [524] = "evrndwRR", + [525] = "evcntlzwRR", [526] = "evcntlswRR", + + [527] = "brincRRR", + + [529] = "evandRRR", [530] = "evandcRRR", [534] = "evxorRRR", + [535] = "evor|evmrRRR=", [536] = "evnor|evnotRRR=", + [537] = "eveqvRRR", [539] = "evorcRRR", [542] = "evnandRRR", + + [544] = "evsrwuRRR", [545] = "evsrwsRRR", + [546] = "evsrwiuRRA", [547] = "evsrwisRRA", + [548] = "evslwRRR", [550] = "evslwiRRA", + [552] = "evrlwRRR", [553] = "evsplatiRS", + [554] = "evrlwiRRA", [555] = "evsplatfiRS", + [556] = "evmergehiRRR", [557] = "evmergeloRRR", + [558] = "evmergehiloRRR", [559] = "evmergelohiRRR", + + [560] = "evcmpgtuYRR", [561] = "evcmpgtsYRR", + [562] = "evcmpltuYRR", [563] = "evcmpltsYRR", + [564] = "evcmpeqYRR", + + [632] = "evselRRR", [633] = "evselRRRW", + [634] = "evselRRRW", [635] = "evselRRRW", + [636] = "evselRRRW", [637] = "evselRRRW", + [638] = "evselRRRW", [639] = "evselRRRW", + + [640] = "evfsaddRRR", [641] = "evfssubRRR", + [644] = "evfsabsRR", [645] = "evfsnabsRR", [646] = "evfsnegRR", + [648] = "evfsmulRRR", [649] = "evfsdivRRR", + [652] = "evfscmpgtYRR", [653] = "evfscmpltYRR", [654] = "evfscmpeqYRR", + [656] = "evfscfuiR-R", [657] = "evfscfsiR-R", + [658] = "evfscfufR-R", [659] = "evfscfsfR-R", + [660] = "evfsctuiR-R", [661] = "evfsctsiR-R", + [662] = "evfsctufR-R", [663] = "evfsctsfR-R", + [664] = "evfsctuizR-R", [666] = "evfsctsizR-R", + [668] = "evfststgtYRR", [669] = "evfststltYRR", [670] = "evfststeqYRR", + + [704] = "efsaddRRR", [705] = "efssubRRR", + [708] = "efsabsRR", [709] = "efsnabsRR", [710] = "efsnegRR", + [712] = "efsmulRRR", [713] = "efsdivRRR", + [716] = "efscmpgtYRR", [717] = "efscmpltYRR", [718] = "efscmpeqYRR", + [719] = "efscfdR-R", + [720] = "efscfuiR-R", [721] = "efscfsiR-R", + [722] = "efscfufR-R", [723] = "efscfsfR-R", + [724] = "efsctuiR-R", [725] = "efsctsiR-R", + [726] = "efsctufR-R", [727] = "efsctsfR-R", + [728] = "efsctuizR-R", [730] = "efsctsizR-R", + [732] = "efststgtYRR", [733] = "efststltYRR", [734] = "efststeqYRR", + + [736] = "efdaddRRR", [737] = "efdsubRRR", + [738] = "efdcfuidR-R", [739] = "efdcfsidR-R", + [740] = "efdabsRR", [741] = "efdnabsRR", [742] = "efdnegRR", + [744] = "efdmulRRR", [745] = "efddivRRR", + [746] = "efdctuidzR-R", [747] = "efdctsidzR-R", + [748] = "efdcmpgtYRR", [749] = "efdcmpltYRR", [750] = "efdcmpeqYRR", + [751] = "efdcfsR-R", + [752] = "efdcfuiR-R", [753] = "efdcfsiR-R", + [754] = "efdcfufR-R", [755] = "efdcfsfR-R", + [756] = "efdctuiR-R", [757] = "efdctsiR-R", + [758] = "efdctufR-R", [759] = "efdctsfR-R", + [760] = "efdctuizR-R", [762] = "efdctsizR-R", + [764] = "efdtstgtYRR", [765] = "efdtstltYRR", [766] = "efdtsteqYRR", + + [768] = "evlddxRR0R", [769] = "evlddRR8", + [770] = "evldwxRR0R", [771] = "evldwRR8", + [772] = "evldhxRR0R", [773] = "evldhRR8", + [776] = "evlhhesplatxRR0R", [777] = "evlhhesplatRR2", + [780] = "evlhhousplatxRR0R", [781] = "evlhhousplatRR2", + [782] = "evlhhossplatxRR0R", [783] = "evlhhossplatRR2", + [784] = "evlwhexRR0R", [785] = "evlwheRR4", + [788] = "evlwhouxRR0R", [789] = "evlwhouRR4", + [790] = "evlwhosxRR0R", [791] = "evlwhosRR4", + [792] = "evlwwsplatxRR0R", [793] = "evlwwsplatRR4", + [796] = "evlwhsplatxRR0R", [797] = "evlwhsplatRR4", + + [800] = "evstddxRR0R", [801] = "evstddRR8", + [802] = "evstdwxRR0R", [803] = "evstdwRR8", + [804] = "evstdhxRR0R", [805] = "evstdhRR8", + [816] = "evstwhexRR0R", [817] = "evstwheRR4", + [820] = "evstwhoxRR0R", [821] = "evstwhoRR4", + [824] = "evstwwexRR0R", [825] = "evstwweRR4", + [828] = "evstwwoxRR0R", [829] = "evstwwoRR4", + + [1027] = "evmhessfRRR", [1031] = "evmhossfRRR", [1032] = "evmheumiRRR", + [1033] = "evmhesmiRRR", [1035] = "evmhesmfRRR", [1036] = "evmhoumiRRR", + [1037] = "evmhosmiRRR", [1039] = "evmhosmfRRR", [1059] = "evmhessfaRRR", + [1063] = "evmhossfaRRR", [1064] = "evmheumiaRRR", [1065] = "evmhesmiaRRR", + [1067] = "evmhesmfaRRR", [1068] = "evmhoumiaRRR", [1069] = "evmhosmiaRRR", + [1071] = "evmhosmfaRRR", [1095] = "evmwhssfRRR", [1096] = "evmwlumiRRR", + [1100] = "evmwhumiRRR", [1101] = "evmwhsmiRRR", [1103] = "evmwhsmfRRR", + [1107] = "evmwssfRRR", [1112] = "evmwumiRRR", [1113] = "evmwsmiRRR", + [1115] = "evmwsmfRRR", [1127] = "evmwhssfaRRR", [1128] = "evmwlumiaRRR", + [1132] = "evmwhumiaRRR", [1133] = "evmwhsmiaRRR", [1135] = "evmwhsmfaRRR", + [1139] = "evmwssfaRRR", [1144] = "evmwumiaRRR", [1145] = "evmwsmiaRRR", + [1147] = "evmwsmfaRRR", + + [1216] = "evaddusiaawRR", [1217] = "evaddssiaawRR", + [1218] = "evsubfusiaawRR", [1219] = "evsubfssiaawRR", + [1220] = "evmraRR", + [1222] = "evdivwsRRR", [1223] = "evdivwuRRR", + [1224] = "evaddumiaawRR", [1225] = "evaddsmiaawRR", + [1226] = "evsubfumiaawRR", [1227] = "evsubfsmiaawRR", + + [1280] = "evmheusiaawRRR", [1281] = "evmhessiaawRRR", + [1283] = "evmhessfaawRRR", [1284] = "evmhousiaawRRR", + [1285] = "evmhossiaawRRR", [1287] = "evmhossfaawRRR", + [1288] = "evmheumiaawRRR", [1289] = "evmhesmiaawRRR", + [1291] = "evmhesmfaawRRR", [1292] = "evmhoumiaawRRR", + [1293] = "evmhosmiaawRRR", [1295] = "evmhosmfaawRRR", + [1320] = "evmhegumiaaRRR", [1321] = "evmhegsmiaaRRR", + [1323] = "evmhegsmfaaRRR", [1324] = "evmhogumiaaRRR", + [1325] = "evmhogsmiaaRRR", [1327] = "evmhogsmfaaRRR", + [1344] = "evmwlusiaawRRR", [1345] = "evmwlssiaawRRR", + [1352] = "evmwlumiaawRRR", [1353] = "evmwlsmiaawRRR", + [1363] = "evmwssfaaRRR", [1368] = "evmwumiaaRRR", + [1369] = "evmwsmiaaRRR", [1371] = "evmwsmfaaRRR", + [1408] = "evmheusianwRRR", [1409] = "evmhessianwRRR", + [1411] = "evmhessfanwRRR", [1412] = "evmhousianwRRR", + [1413] = "evmhossianwRRR", [1415] = "evmhossfanwRRR", + [1416] = "evmheumianwRRR", [1417] = "evmhesmianwRRR", + [1419] = "evmhesmfanwRRR", [1420] = "evmhoumianwRRR", + [1421] = "evmhosmianwRRR", [1423] = "evmhosmfanwRRR", + [1448] = "evmhegumianRRR", [1449] = "evmhegsmianRRR", + [1451] = "evmhegsmfanRRR", [1452] = "evmhogumianRRR", + [1453] = "evmhogsmianRRR", [1455] = "evmhogsmfanRRR", + [1472] = "evmwlusianwRRR", [1473] = "evmwlssianwRRR", + [1480] = "evmwlumianwRRR", [1481] = "evmwlsmianwRRR", + [1491] = "evmwssfanRRR", [1496] = "evmwumianRRR", + [1497] = "evmwsmianRRR", [1499] = "evmwsmfanRRR", +} + +local map_pri = { + [0] = false, false, "tdiARI", "twiARI", + map_spe, false, false, "mulliRRI", + "subficRRI", false, "cmpl_iYLRU", "cmp_iYLRI", + "addicRRI", "addic.RRI", "addi|liRR0I", "addis|lisRR0I", + "b_KBJ", "sc", "bKJ", map_crops, + "rlwimiRR~AAA.", map_rlwinm, false, "rlwnmRR~RAA.", + "oriNRR~U", "orisRR~U", "xoriRR~U", "xorisRR~U", + "andi.RR~U", "andis.RR~U", map_rld, map_ext, + "lwzRRD", "lwzuRRD", "lbzRRD", "lbzuRRD", + "stwRRD", "stwuRRD", "stbRRD", "stbuRRD", + "lhzRRD", "lhzuRRD", "lhaRRD", "lhauRRD", + "sthRRD", "sthuRRD", "lmwRRD", "stmwRRD", + "lfsFRD", "lfsuFRD", "lfdFRD", "lfduFRD", + "stfsFRD", "stfsuFRD", "stfdFRD", "stfduFRD", + false, false, map_ld, map_fps, + false, false, map_std, map_fpd, +} + +------------------------------------------------------------------------------ + +local map_gpr = { + [0] = "r0", "sp", "r2", "r3", "r4", "r5", "r6", "r7", + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", + "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", + "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", +} + +local map_cond = { [0] = "lt", "gt", "eq", "so", "ge", "le", "ne", "ns", } + +-- Format a condition bit. +local function condfmt(cond) + if cond <= 3 then + return map_cond[band(cond, 3)] + else + return format("4*cr%d+%s", rshift(cond, 2), map_cond[band(cond, 3)]) + end +end + +------------------------------------------------------------------------------ + +-- Output a nicely formatted line with an opcode and operands. +local function putop(ctx, text, operands) + local pos = ctx.pos + local extra = "" + if ctx.rel then + local sym = ctx.symtab[ctx.rel] + if sym then extra = "\t->"..sym end + end + if ctx.hexdump > 0 then + ctx.out(format("%08x %s %-7s %s%s\n", + ctx.addr+pos, tohex(ctx.op), text, concat(operands, ", "), extra)) + else + ctx.out(format("%08x %-7s %s%s\n", + ctx.addr+pos, text, concat(operands, ", "), extra)) + end + ctx.pos = pos + 4 +end + +-- Fallback for unknown opcodes. +local function unknown(ctx) + return putop(ctx, ".long", { "0x"..tohex(ctx.op) }) +end + +-- Disassemble a single instruction. +local function disass_ins(ctx) + local pos = ctx.pos + local b0, b1, b2, b3 = byte(ctx.code, pos+1, pos+4) + local op = bor(lshift(b0, 24), lshift(b1, 16), lshift(b2, 8), b3) + local operands = {} + local last = nil + local rs = 21 + ctx.op = op + ctx.rel = nil + + local opat = map_pri[rshift(b0, 2)] + while type(opat) ~= "string" do + if not opat then return unknown(ctx) end + opat = opat[band(rshift(op, opat.shift), opat.mask)] + end + local name, pat = match(opat, "^([a-z0-9_.]*)(.*)") + local altname, pat2 = match(pat, "|([a-z0-9_.]*)(.*)") + if altname then pat = pat2 end + + for p in gmatch(pat, ".") do + local x = nil + if p == "R" then + x = map_gpr[band(rshift(op, rs), 31)] + rs = rs - 5 + elseif p == "F" then + x = "f"..band(rshift(op, rs), 31) + rs = rs - 5 + elseif p == "A" then + x = band(rshift(op, rs), 31) + rs = rs - 5 + elseif p == "S" then + x = arshift(lshift(op, 27-rs), 27) + rs = rs - 5 + elseif p == "I" then + x = arshift(lshift(op, 16), 16) + elseif p == "U" then + x = band(op, 0xffff) + elseif p == "D" or p == "E" then + local disp = arshift(lshift(op, 16), 16) + if p == "E" then disp = band(disp, -4) end + if last == "r0" then last = "0" end + operands[#operands] = format("%d(%s)", disp, last) + elseif p >= "2" and p <= "8" then + local disp = band(rshift(op, rs), 31) * p + if last == "r0" then last = "0" end + operands[#operands] = format("%d(%s)", disp, last) + elseif p == "H" then + x = band(rshift(op, rs), 31) + lshift(band(op, 2), 4) + rs = rs - 5 + elseif p == "M" then + x = band(rshift(op, rs), 31) + band(op, 0x20) + elseif p == "C" then + x = condfmt(band(rshift(op, rs), 31)) + rs = rs - 5 + elseif p == "B" then + local bo = rshift(op, 21) + local cond = band(rshift(op, 16), 31) + local cn = "" + rs = rs - 10 + if band(bo, 4) == 0 then + cn = band(bo, 2) == 0 and "dnz" or "dz" + if band(bo, 0x10) == 0 then + cn = cn..(band(bo, 8) == 0 and "f" or "t") + end + if band(bo, 0x10) == 0 then x = condfmt(cond) end + name = name..(band(bo, 1) == band(rshift(op, 15), 1) and "-" or "+") + elseif band(bo, 0x10) == 0 then + cn = map_cond[band(cond, 3) + (band(bo, 8) == 0 and 4 or 0)] + if cond > 3 then x = "cr"..rshift(cond, 2) end + name = name..(band(bo, 1) == band(rshift(op, 15), 1) and "-" or "+") + end + name = gsub(name, "_", cn) + elseif p == "J" then + x = arshift(lshift(op, 27-rs), 29-rs)*4 + if band(op, 2) == 0 then x = ctx.addr + pos + x end + ctx.rel = x + x = "0x"..tohex(x) + elseif p == "K" then + if band(op, 1) ~= 0 then name = name.."l" end + if band(op, 2) ~= 0 then name = name.."a" end + elseif p == "X" or p == "Y" then + x = band(rshift(op, rs+2), 7) + if x == 0 and p == "Y" then x = nil else x = "cr"..x end + rs = rs - 5 + elseif p == "W" then + x = "cr"..band(op, 7) + elseif p == "Z" then + x = band(rshift(op, rs-4), 255) + rs = rs - 10 + elseif p == ">" then + operands[#operands] = rshift(operands[#operands], 1) + elseif p == "0" then + if last == "r0" then + operands[#operands] = nil + if altname then name = altname end + end + elseif p == "L" then + name = gsub(name, "_", band(op, 0x00200000) ~= 0 and "d" or "w") + elseif p == "." then + if band(op, 1) == 1 then name = name.."." end + elseif p == "N" then + if op == 0x60000000 then name = "nop"; break end + elseif p == "~" then + local n = #operands + operands[n-1], operands[n] = operands[n], operands[n-1] + elseif p == "=" then + local n = #operands + if last == operands[n-1] then + operands[n] = nil + name = altname + end + elseif p == "%" then + local n = #operands + if last == operands[n-1] and last == operands[n-2] then + operands[n] = nil + operands[n-1] = nil + name = altname + end + elseif p == "-" then + rs = rs - 5 + else + assert(false) + end + if x then operands[#operands+1] = x; last = x end + end + + return putop(ctx, name, operands) +end + +------------------------------------------------------------------------------ + +-- Disassemble a block of code. +local function disass_block(ctx, ofs, len) + if not ofs then ofs = 0 end + local stop = len and ofs+len or #ctx.code + stop = stop - stop % 4 + ctx.pos = ofs - ofs % 4 + ctx.rel = nil + while ctx.pos < stop do disass_ins(ctx) end +end + +-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len). +local function create(code, addr, out) + local ctx = {} + ctx.code = code + ctx.addr = addr or 0 + ctx.out = out or io.write + ctx.symtab = {} + ctx.disass = disass_block + ctx.hexdump = 8 + return ctx +end + +-- Simple API: disassemble code (a string) at address and output via out. +local function disass(code, addr, out) + create(code, addr, out):disass() +end + +-- Return register name for RID. +local function regname(r) + if r < 32 then return map_gpr[r] end + return "f"..(r-32) +end + +-- Public module functions. +return { + create = create, + disass = disass, + regname = regname +} + diff --git a/Assets/LuaFramework/Luajit/jit/dis_ppc.lua.meta b/Assets/LuaFramework/Luajit/jit/dis_ppc.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..46faada8ea58046bce1d7e91cbc04338a23fc342 --- /dev/null +++ b/Assets/LuaFramework/Luajit/jit/dis_ppc.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 16a81ab6de25d044280dbc5a24abfa3a +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Luajit/jit/dis_x64.lua b/Assets/LuaFramework/Luajit/jit/dis_x64.lua new file mode 100644 index 0000000000000000000000000000000000000000..077b1b127cac1867c23c413802be52634d832137 --- /dev/null +++ b/Assets/LuaFramework/Luajit/jit/dis_x64.lua @@ -0,0 +1,17 @@ +---------------------------------------------------------------------------- +-- LuaJIT x64 disassembler wrapper module. +-- +-- Copyright (C) 2005-2016 Mike Pall. All rights reserved. +-- Released under the MIT license. See Copyright Notice in luajit.h +---------------------------------------------------------------------------- +-- This module just exports the 64 bit functions from the combined +-- x86/x64 disassembler module. All the interesting stuff is there. +------------------------------------------------------------------------------ + +local dis_x86 = require((string.match(..., ".*%.") or "").."dis_x86") +return { + create = dis_x86.create64, + disass = dis_x86.disass64, + regname = dis_x86.regname64 +} + diff --git a/Assets/LuaFramework/Luajit/jit/dis_x64.lua.meta b/Assets/LuaFramework/Luajit/jit/dis_x64.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..0e6dbd8cc173ac9d320e72830ccabfdc46c6dfc5 --- /dev/null +++ b/Assets/LuaFramework/Luajit/jit/dis_x64.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: da9358785297a39428fd96e0e17ad8f7 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Luajit/jit/dis_x86.lua b/Assets/LuaFramework/Luajit/jit/dis_x86.lua new file mode 100644 index 0000000000000000000000000000000000000000..f8a21ff30ec7cc15da54a775735aa56d511fcdc5 --- /dev/null +++ b/Assets/LuaFramework/Luajit/jit/dis_x86.lua @@ -0,0 +1,928 @@ +---------------------------------------------------------------------------- +-- LuaJIT x86/x64 disassembler module. +-- +-- Copyright (C) 2005-2016 Mike Pall. All rights reserved. +-- Released under the MIT license. See Copyright Notice in luajit.h +---------------------------------------------------------------------------- +-- This is a helper module used by the LuaJIT machine code dumper module. +-- +-- Sending small code snippets to an external disassembler and mixing the +-- output with our own stuff was too fragile. So I had to bite the bullet +-- and write yet another x86 disassembler. Oh well ... +-- +-- The output format is very similar to what ndisasm generates. But it has +-- been developed independently by looking at the opcode tables from the +-- Intel and AMD manuals. The supported instruction set is quite extensive +-- and reflects what a current generation Intel or AMD CPU implements in +-- 32 bit and 64 bit mode. Yes, this includes MMX, SSE, SSE2, SSE3, SSSE3, +-- SSE4.1, SSE4.2, SSE4a, AVX, AVX2 and even privileged and hypervisor +-- (VMX/SVM) instructions. +-- +-- Notes: +-- * The (useless) a16 prefix, 3DNow and pre-586 opcodes are unsupported. +-- * No attempt at optimization has been made -- it's fast enough for my needs. +------------------------------------------------------------------------------ + +local type = type +local sub, byte, format = string.sub, string.byte, string.format +local match, gmatch, gsub = string.match, string.gmatch, string.gsub +local lower, rep = string.lower, string.rep +local bit = require("bit") +local tohex = bit.tohex + +-- Map for 1st opcode byte in 32 bit mode. Ugly? Well ... read on. +local map_opc1_32 = { +--0x +[0]="addBmr","addVmr","addBrm","addVrm","addBai","addVai","push es","pop es", +"orBmr","orVmr","orBrm","orVrm","orBai","orVai","push cs","opc2*", +--1x +"adcBmr","adcVmr","adcBrm","adcVrm","adcBai","adcVai","push ss","pop ss", +"sbbBmr","sbbVmr","sbbBrm","sbbVrm","sbbBai","sbbVai","push ds","pop ds", +--2x +"andBmr","andVmr","andBrm","andVrm","andBai","andVai","es:seg","daa", +"subBmr","subVmr","subBrm","subVrm","subBai","subVai","cs:seg","das", +--3x +"xorBmr","xorVmr","xorBrm","xorVrm","xorBai","xorVai","ss:seg","aaa", +"cmpBmr","cmpVmr","cmpBrm","cmpVrm","cmpBai","cmpVai","ds:seg","aas", +--4x +"incVR","incVR","incVR","incVR","incVR","incVR","incVR","incVR", +"decVR","decVR","decVR","decVR","decVR","decVR","decVR","decVR", +--5x +"pushUR","pushUR","pushUR","pushUR","pushUR","pushUR","pushUR","pushUR", +"popUR","popUR","popUR","popUR","popUR","popUR","popUR","popUR", +--6x +"sz*pushaw,pusha","sz*popaw,popa","boundVrm","arplWmr", +"fs:seg","gs:seg","o16:","a16", +"pushUi","imulVrmi","pushBs","imulVrms", +"insb","insVS","outsb","outsVS", +--7x +"joBj","jnoBj","jbBj","jnbBj","jzBj","jnzBj","jbeBj","jaBj", +"jsBj","jnsBj","jpeBj","jpoBj","jlBj","jgeBj","jleBj","jgBj", +--8x +"arith!Bmi","arith!Vmi","arith!Bmi","arith!Vms", +"testBmr","testVmr","xchgBrm","xchgVrm", +"movBmr","movVmr","movBrm","movVrm", +"movVmg","leaVrm","movWgm","popUm", +--9x +"nop*xchgVaR|pause|xchgWaR|repne nop","xchgVaR","xchgVaR","xchgVaR", +"xchgVaR","xchgVaR","xchgVaR","xchgVaR", +"sz*cbw,cwde,cdqe","sz*cwd,cdq,cqo","call farViw","wait", +"sz*pushfw,pushf","sz*popfw,popf","sahf","lahf", +--Ax +"movBao","movVao","movBoa","movVoa", +"movsb","movsVS","cmpsb","cmpsVS", +"testBai","testVai","stosb","stosVS", +"lodsb","lodsVS","scasb","scasVS", +--Bx +"movBRi","movBRi","movBRi","movBRi","movBRi","movBRi","movBRi","movBRi", +"movVRI","movVRI","movVRI","movVRI","movVRI","movVRI","movVRI","movVRI", +--Cx +"shift!Bmu","shift!Vmu","retBw","ret","vex*3$lesVrm","vex*2$ldsVrm","movBmi","movVmi", +"enterBwu","leave","retfBw","retf","int3","intBu","into","iretVS", +--Dx +"shift!Bm1","shift!Vm1","shift!Bmc","shift!Vmc","aamBu","aadBu","salc","xlatb", +"fp*0","fp*1","fp*2","fp*3","fp*4","fp*5","fp*6","fp*7", +--Ex +"loopneBj","loopeBj","loopBj","sz*jcxzBj,jecxzBj,jrcxzBj", +"inBau","inVau","outBua","outVua", +"callVj","jmpVj","jmp farViw","jmpBj","inBad","inVad","outBda","outVda", +--Fx +"lock:","int1","repne:rep","rep:","hlt","cmc","testb!Bm","testv!Vm", +"clc","stc","cli","sti","cld","std","incb!Bm","incd!Vm", +} +assert(#map_opc1_32 == 255) + +-- Map for 1st opcode byte in 64 bit mode (overrides only). +local map_opc1_64 = setmetatable({ + [0x06]=false, [0x07]=false, [0x0e]=false, + [0x16]=false, [0x17]=false, [0x1e]=false, [0x1f]=false, + [0x27]=false, [0x2f]=false, [0x37]=false, [0x3f]=false, + [0x60]=false, [0x61]=false, [0x62]=false, [0x63]="movsxdVrDmt", [0x67]="a32:", + [0x40]="rex*", [0x41]="rex*b", [0x42]="rex*x", [0x43]="rex*xb", + [0x44]="rex*r", [0x45]="rex*rb", [0x46]="rex*rx", [0x47]="rex*rxb", + [0x48]="rex*w", [0x49]="rex*wb", [0x4a]="rex*wx", [0x4b]="rex*wxb", + [0x4c]="rex*wr", [0x4d]="rex*wrb", [0x4e]="rex*wrx", [0x4f]="rex*wrxb", + [0x82]=false, [0x9a]=false, [0xc4]="vex*3", [0xc5]="vex*2", [0xce]=false, + [0xd4]=false, [0xd5]=false, [0xd6]=false, [0xea]=false, +}, { __index = map_opc1_32 }) + +-- Map for 2nd opcode byte (0F xx). True CISC hell. Hey, I told you. +-- Prefix dependent MMX/SSE opcodes: (none)|rep|o16|repne, -|F3|66|F2 +local map_opc2 = { +--0x +[0]="sldt!Dmp","sgdt!Ump","larVrm","lslVrm",nil,"syscall","clts","sysret", +"invd","wbinvd",nil,"ud1",nil,"$prefetch!Bm","femms","3dnowMrmu", +--1x +"movupsXrm|movssXrvm|movupdXrm|movsdXrvm", +"movupsXmr|movssXmvr|movupdXmr|movsdXmvr", +"movhlpsXrm$movlpsXrm|movsldupXrm|movlpdXrm|movddupXrm", +"movlpsXmr||movlpdXmr", +"unpcklpsXrvm||unpcklpdXrvm", +"unpckhpsXrvm||unpckhpdXrvm", +"movlhpsXrm$movhpsXrm|movshdupXrm|movhpdXrm", +"movhpsXmr||movhpdXmr", +"$prefetcht!Bm","hintnopVm","hintnopVm","hintnopVm", +"hintnopVm","hintnopVm","hintnopVm","hintnopVm", +--2x +"movUmx$","movUmy$","movUxm$","movUym$","movUmz$",nil,"movUzm$",nil, +"movapsXrm||movapdXrm", +"movapsXmr||movapdXmr", +"cvtpi2psXrMm|cvtsi2ssXrvVmt|cvtpi2pdXrMm|cvtsi2sdXrvVmt", +"movntpsXmr|movntssXmr|movntpdXmr|movntsdXmr", +"cvttps2piMrXm|cvttss2siVrXm|cvttpd2piMrXm|cvttsd2siVrXm", +"cvtps2piMrXm|cvtss2siVrXm|cvtpd2piMrXm|cvtsd2siVrXm", +"ucomissXrm||ucomisdXrm", +"comissXrm||comisdXrm", +--3x +"wrmsr","rdtsc","rdmsr","rdpmc","sysenter","sysexit",nil,"getsec", +"opc3*38",nil,"opc3*3a",nil,nil,nil,nil,nil, +--4x +"cmovoVrm","cmovnoVrm","cmovbVrm","cmovnbVrm", +"cmovzVrm","cmovnzVrm","cmovbeVrm","cmovaVrm", +"cmovsVrm","cmovnsVrm","cmovpeVrm","cmovpoVrm", +"cmovlVrm","cmovgeVrm","cmovleVrm","cmovgVrm", +--5x +"movmskpsVrXm$||movmskpdVrXm$","sqrtpsXrm|sqrtssXrm|sqrtpdXrm|sqrtsdXrm", +"rsqrtpsXrm|rsqrtssXrvm","rcppsXrm|rcpssXrvm", +"andpsXrvm||andpdXrvm","andnpsXrvm||andnpdXrvm", +"orpsXrvm||orpdXrvm","xorpsXrvm||xorpdXrvm", +"addpsXrvm|addssXrvm|addpdXrvm|addsdXrvm","mulpsXrvm|mulssXrvm|mulpdXrvm|mulsdXrvm", +"cvtps2pdXrm|cvtss2sdXrvm|cvtpd2psXrm|cvtsd2ssXrvm", +"cvtdq2psXrm|cvttps2dqXrm|cvtps2dqXrm", +"subpsXrvm|subssXrvm|subpdXrvm|subsdXrvm","minpsXrvm|minssXrvm|minpdXrvm|minsdXrvm", +"divpsXrvm|divssXrvm|divpdXrvm|divsdXrvm","maxpsXrvm|maxssXrvm|maxpdXrvm|maxsdXrvm", +--6x +"punpcklbwPrvm","punpcklwdPrvm","punpckldqPrvm","packsswbPrvm", +"pcmpgtbPrvm","pcmpgtwPrvm","pcmpgtdPrvm","packuswbPrvm", +"punpckhbwPrvm","punpckhwdPrvm","punpckhdqPrvm","packssdwPrvm", +"||punpcklqdqXrvm","||punpckhqdqXrvm", +"movPrVSm","movqMrm|movdquXrm|movdqaXrm", +--7x +"pshufwMrmu|pshufhwXrmu|pshufdXrmu|pshuflwXrmu","pshiftw!Pvmu", +"pshiftd!Pvmu","pshiftq!Mvmu||pshiftdq!Xvmu", +"pcmpeqbPrvm","pcmpeqwPrvm","pcmpeqdPrvm","emms*|", +"vmreadUmr||extrqXmuu$|insertqXrmuu$","vmwriteUrm||extrqXrm$|insertqXrm$", +nil,nil, +"||haddpdXrvm|haddpsXrvm","||hsubpdXrvm|hsubpsXrvm", +"movVSmMr|movqXrm|movVSmXr","movqMmr|movdquXmr|movdqaXmr", +--8x +"joVj","jnoVj","jbVj","jnbVj","jzVj","jnzVj","jbeVj","jaVj", +"jsVj","jnsVj","jpeVj","jpoVj","jlVj","jgeVj","jleVj","jgVj", +--9x +"setoBm","setnoBm","setbBm","setnbBm","setzBm","setnzBm","setbeBm","setaBm", +"setsBm","setnsBm","setpeBm","setpoBm","setlBm","setgeBm","setleBm","setgBm", +--Ax +"push fs","pop fs","cpuid","btVmr","shldVmru","shldVmrc",nil,nil, +"push gs","pop gs","rsm","btsVmr","shrdVmru","shrdVmrc","fxsave!Dmp","imulVrm", +--Bx +"cmpxchgBmr","cmpxchgVmr","$lssVrm","btrVmr", +"$lfsVrm","$lgsVrm","movzxVrBmt","movzxVrWmt", +"|popcntVrm","ud2Dp","bt!Vmu","btcVmr", +"bsfVrm","bsrVrm|lzcntVrm|bsrWrm","movsxVrBmt","movsxVrWmt", +--Cx +"xaddBmr","xaddVmr", +"cmppsXrvmu|cmpssXrvmu|cmppdXrvmu|cmpsdXrvmu","$movntiVmr|", +"pinsrwPrvWmu","pextrwDrPmu", +"shufpsXrvmu||shufpdXrvmu","$cmpxchg!Qmp", +"bswapVR","bswapVR","bswapVR","bswapVR","bswapVR","bswapVR","bswapVR","bswapVR", +--Dx +"||addsubpdXrvm|addsubpsXrvm","psrlwPrvm","psrldPrvm","psrlqPrvm", +"paddqPrvm","pmullwPrvm", +"|movq2dqXrMm|movqXmr|movdq2qMrXm$","pmovmskbVrMm||pmovmskbVrXm", +"psubusbPrvm","psubuswPrvm","pminubPrvm","pandPrvm", +"paddusbPrvm","padduswPrvm","pmaxubPrvm","pandnPrvm", +--Ex +"pavgbPrvm","psrawPrvm","psradPrvm","pavgwPrvm", +"pmulhuwPrvm","pmulhwPrvm", +"|cvtdq2pdXrm|cvttpd2dqXrm|cvtpd2dqXrm","$movntqMmr||$movntdqXmr", +"psubsbPrvm","psubswPrvm","pminswPrvm","porPrvm", +"paddsbPrvm","paddswPrvm","pmaxswPrvm","pxorPrvm", +--Fx +"|||lddquXrm","psllwPrvm","pslldPrvm","psllqPrvm", +"pmuludqPrvm","pmaddwdPrvm","psadbwPrvm","maskmovqMrm||maskmovdquXrm$", +"psubbPrvm","psubwPrvm","psubdPrvm","psubqPrvm", +"paddbPrvm","paddwPrvm","padddPrvm","ud", +} +assert(map_opc2[255] == "ud") + +-- Map for three-byte opcodes. Can't wait for their next invention. +local map_opc3 = { +["38"] = { -- [66] 0f 38 xx +--0x +[0]="pshufbPrvm","phaddwPrvm","phadddPrvm","phaddswPrvm", +"pmaddubswPrvm","phsubwPrvm","phsubdPrvm","phsubswPrvm", +"psignbPrvm","psignwPrvm","psigndPrvm","pmulhrswPrvm", +"||permilpsXrvm","||permilpdXrvm",nil,nil, +--1x +"||pblendvbXrma",nil,nil,nil, +"||blendvpsXrma","||blendvpdXrma","||permpsXrvm","||ptestXrm", +"||broadcastssXrm","||broadcastsdXrm","||broadcastf128XrlXm",nil, +"pabsbPrm","pabswPrm","pabsdPrm",nil, +--2x +"||pmovsxbwXrm","||pmovsxbdXrm","||pmovsxbqXrm","||pmovsxwdXrm", +"||pmovsxwqXrm","||pmovsxdqXrm",nil,nil, +"||pmuldqXrvm","||pcmpeqqXrvm","||$movntdqaXrm","||packusdwXrvm", +"||maskmovpsXrvm","||maskmovpdXrvm","||maskmovpsXmvr","||maskmovpdXmvr", +--3x +"||pmovzxbwXrm","||pmovzxbdXrm","||pmovzxbqXrm","||pmovzxwdXrm", +"||pmovzxwqXrm","||pmovzxdqXrm","||permdXrvm","||pcmpgtqXrvm", +"||pminsbXrvm","||pminsdXrvm","||pminuwXrvm","||pminudXrvm", +"||pmaxsbXrvm","||pmaxsdXrvm","||pmaxuwXrvm","||pmaxudXrvm", +--4x +"||pmulddXrvm","||phminposuwXrm",nil,nil, +nil,"||psrlvVSXrvm","||psravdXrvm","||psllvVSXrvm", +--5x +[0x58] = "||pbroadcastdXrlXm",[0x59] = "||pbroadcastqXrlXm", +[0x5a] = "||broadcasti128XrlXm", +--7x +[0x78] = "||pbroadcastbXrlXm",[0x79] = "||pbroadcastwXrlXm", +--8x +[0x8c] = "||pmaskmovXrvVSm", +[0x8e] = "||pmaskmovVSmXvr", +--Dx +[0xdc] = "||aesencXrvm", [0xdd] = "||aesenclastXrvm", +[0xde] = "||aesdecXrvm", [0xdf] = "||aesdeclastXrvm", +--Fx +[0xf0] = "|||crc32TrBmt",[0xf1] = "|||crc32TrVmt", +}, + +["3a"] = { -- [66] 0f 3a xx +--0x +[0x00]="||permqXrmu","||permpdXrmu","||pblenddXrvmu",nil, +"||permilpsXrmu","||permilpdXrmu","||perm2f128Xrvmu",nil, +"||roundpsXrmu","||roundpdXrmu","||roundssXrvmu","||roundsdXrvmu", +"||blendpsXrvmu","||blendpdXrvmu","||pblendwXrvmu","palignrPrvmu", +--1x +nil,nil,nil,nil, +"||pextrbVmXru","||pextrwVmXru","||pextrVmSXru","||extractpsVmXru", +"||insertf128XrvlXmu","||extractf128XlXmYru",nil,nil, +nil,nil,nil,nil, +--2x +"||pinsrbXrvVmu","||insertpsXrvmu","||pinsrXrvVmuS",nil, +--3x +[0x38] = "||inserti128Xrvmu",[0x39] = "||extracti128XlXmYru", +--4x +[0x40] = "||dppsXrvmu", +[0x41] = "||dppdXrvmu", +[0x42] = "||mpsadbwXrvmu", +[0x44] = "||pclmulqdqXrvmu", +[0x46] = "||perm2i128Xrvmu", +[0x4a] = "||blendvpsXrvmb",[0x4b] = "||blendvpdXrvmb", +[0x4c] = "||pblendvbXrvmb", +--6x +[0x60] = "||pcmpestrmXrmu",[0x61] = "||pcmpestriXrmu", +[0x62] = "||pcmpistrmXrmu",[0x63] = "||pcmpistriXrmu", +[0xdf] = "||aeskeygenassistXrmu", +}, +} + +-- Map for VMX/SVM opcodes 0F 01 C0-FF (sgdt group with register operands). +local map_opcvm = { +[0xc1]="vmcall",[0xc2]="vmlaunch",[0xc3]="vmresume",[0xc4]="vmxoff", +[0xc8]="monitor",[0xc9]="mwait", +[0xd8]="vmrun",[0xd9]="vmmcall",[0xda]="vmload",[0xdb]="vmsave", +[0xdc]="stgi",[0xdd]="clgi",[0xde]="skinit",[0xdf]="invlpga", +[0xf8]="swapgs",[0xf9]="rdtscp", +} + +-- Map for FP opcodes. And you thought stack machines are simple? +local map_opcfp = { +-- D8-DF 00-BF: opcodes with a memory operand. +-- D8 +[0]="faddFm","fmulFm","fcomFm","fcompFm","fsubFm","fsubrFm","fdivFm","fdivrFm", +"fldFm",nil,"fstFm","fstpFm","fldenvVm","fldcwWm","fnstenvVm","fnstcwWm", +-- DA +"fiaddDm","fimulDm","ficomDm","ficompDm", +"fisubDm","fisubrDm","fidivDm","fidivrDm", +-- DB +"fildDm","fisttpDm","fistDm","fistpDm",nil,"fld twordFmp",nil,"fstp twordFmp", +-- DC +"faddGm","fmulGm","fcomGm","fcompGm","fsubGm","fsubrGm","fdivGm","fdivrGm", +-- DD +"fldGm","fisttpQm","fstGm","fstpGm","frstorDmp",nil,"fnsaveDmp","fnstswWm", +-- DE +"fiaddWm","fimulWm","ficomWm","ficompWm", +"fisubWm","fisubrWm","fidivWm","fidivrWm", +-- DF +"fildWm","fisttpWm","fistWm","fistpWm", +"fbld twordFmp","fildQm","fbstp twordFmp","fistpQm", +-- xx C0-FF: opcodes with a pseudo-register operand. +-- D8 +"faddFf","fmulFf","fcomFf","fcompFf","fsubFf","fsubrFf","fdivFf","fdivrFf", +-- D9 +"fldFf","fxchFf",{"fnop"},nil, +{"fchs","fabs",nil,nil,"ftst","fxam"}, +{"fld1","fldl2t","fldl2e","fldpi","fldlg2","fldln2","fldz"}, +{"f2xm1","fyl2x","fptan","fpatan","fxtract","fprem1","fdecstp","fincstp"}, +{"fprem","fyl2xp1","fsqrt","fsincos","frndint","fscale","fsin","fcos"}, +-- DA +"fcmovbFf","fcmoveFf","fcmovbeFf","fcmovuFf",nil,{nil,"fucompp"},nil,nil, +-- DB +"fcmovnbFf","fcmovneFf","fcmovnbeFf","fcmovnuFf", +{nil,nil,"fnclex","fninit"},"fucomiFf","fcomiFf",nil, +-- DC +"fadd toFf","fmul toFf",nil,nil, +"fsub toFf","fsubr toFf","fdivr toFf","fdiv toFf", +-- DD +"ffreeFf",nil,"fstFf","fstpFf","fucomFf","fucompFf",nil,nil, +-- DE +"faddpFf","fmulpFf",nil,{nil,"fcompp"}, +"fsubrpFf","fsubpFf","fdivrpFf","fdivpFf", +-- DF +nil,nil,nil,nil,{"fnstsw ax"},"fucomipFf","fcomipFf",nil, +} +assert(map_opcfp[126] == "fcomipFf") + +-- Map for opcode groups. The subkey is sp from the ModRM byte. +local map_opcgroup = { + arith = { "add", "or", "adc", "sbb", "and", "sub", "xor", "cmp" }, + shift = { "rol", "ror", "rcl", "rcr", "shl", "shr", "sal", "sar" }, + testb = { "testBmi", "testBmi", "not", "neg", "mul", "imul", "div", "idiv" }, + testv = { "testVmi", "testVmi", "not", "neg", "mul", "imul", "div", "idiv" }, + incb = { "inc", "dec" }, + incd = { "inc", "dec", "callUmp", "$call farDmp", + "jmpUmp", "$jmp farDmp", "pushUm" }, + sldt = { "sldt", "str", "lldt", "ltr", "verr", "verw" }, + sgdt = { "vm*$sgdt", "vm*$sidt", "$lgdt", "vm*$lidt", + "smsw", nil, "lmsw", "vm*$invlpg" }, + bt = { nil, nil, nil, nil, "bt", "bts", "btr", "btc" }, + cmpxchg = { nil, "sz*,cmpxchg8bQmp,cmpxchg16bXmp", nil, nil, + nil, nil, "vmptrld|vmxon|vmclear", "vmptrst" }, + pshiftw = { nil, nil, "psrlw", nil, "psraw", nil, "psllw" }, + pshiftd = { nil, nil, "psrld", nil, "psrad", nil, "pslld" }, + pshiftq = { nil, nil, "psrlq", nil, nil, nil, "psllq" }, + pshiftdq = { nil, nil, "psrlq", "psrldq", nil, nil, "psllq", "pslldq" }, + fxsave = { "$fxsave", "$fxrstor", "$ldmxcsr", "$stmxcsr", + nil, "lfenceDp$", "mfenceDp$", "sfenceDp$clflush" }, + prefetch = { "prefetch", "prefetchw" }, + prefetcht = { "prefetchnta", "prefetcht0", "prefetcht1", "prefetcht2" }, +} + +------------------------------------------------------------------------------ + +-- Maps for register names. +local map_regs = { + B = { "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh", + "r8b", "r9b", "r10b", "r11b", "r12b", "r13b", "r14b", "r15b" }, + B64 = { "al", "cl", "dl", "bl", "spl", "bpl", "sil", "dil", + "r8b", "r9b", "r10b", "r11b", "r12b", "r13b", "r14b", "r15b" }, + W = { "ax", "cx", "dx", "bx", "sp", "bp", "si", "di", + "r8w", "r9w", "r10w", "r11w", "r12w", "r13w", "r14w", "r15w" }, + D = { "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi", + "r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d" }, + Q = { "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi", + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15" }, + M = { "mm0", "mm1", "mm2", "mm3", "mm4", "mm5", "mm6", "mm7", + "mm0", "mm1", "mm2", "mm3", "mm4", "mm5", "mm6", "mm7" }, -- No x64 ext! + X = { "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7", + "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15" }, + Y = { "ymm0", "ymm1", "ymm2", "ymm3", "ymm4", "ymm5", "ymm6", "ymm7", + "ymm8", "ymm9", "ymm10", "ymm11", "ymm12", "ymm13", "ymm14", "ymm15" }, +} +local map_segregs = { "es", "cs", "ss", "ds", "fs", "gs", "segr6", "segr7" } + +-- Maps for size names. +local map_sz2n = { + B = 1, W = 2, D = 4, Q = 8, M = 8, X = 16, Y = 32, +} +local map_sz2prefix = { + B = "byte", W = "word", D = "dword", + Q = "qword", + M = "qword", X = "xword", Y = "yword", + F = "dword", G = "qword", -- No need for sizes/register names for these two. +} + +------------------------------------------------------------------------------ + +-- Output a nicely formatted line with an opcode and operands. +local function putop(ctx, text, operands) + local code, pos, hex = ctx.code, ctx.pos, "" + local hmax = ctx.hexdump + if hmax > 0 then + for i=ctx.start,pos-1 do + hex = hex..format("%02X", byte(code, i, i)) + end + if #hex > hmax then hex = sub(hex, 1, hmax)..". " + else hex = hex..rep(" ", hmax-#hex+2) end + end + if operands then text = text.." "..operands end + if ctx.o16 then text = "o16 "..text; ctx.o16 = false end + if ctx.a32 then text = "a32 "..text; ctx.a32 = false end + if ctx.rep then text = ctx.rep.." "..text; ctx.rep = false end + if ctx.rex then + local t = (ctx.rexw and "w" or "")..(ctx.rexr and "r" or "").. + (ctx.rexx and "x" or "")..(ctx.rexb and "b" or "").. + (ctx.vexl and "l" or "") + if ctx.vexv and ctx.vexv ~= 0 then t = t.."v"..ctx.vexv end + if t ~= "" then text = ctx.rex.."."..t.." "..text + elseif ctx.rex == "vex" then text = "v"..text end + ctx.rexw = false; ctx.rexr = false; ctx.rexx = false; ctx.rexb = false + ctx.rex = false; ctx.vexl = false; ctx.vexv = false + end + if ctx.seg then + local text2, n = gsub(text, "%[", "["..ctx.seg..":") + if n == 0 then text = ctx.seg.." "..text else text = text2 end + ctx.seg = false + end + if ctx.lock then text = "lock "..text; ctx.lock = false end + local imm = ctx.imm + if imm then + local sym = ctx.symtab[imm] + if sym then text = text.."\t->"..sym end + end + ctx.out(format("%08x %s%s\n", ctx.addr+ctx.start, hex, text)) + ctx.mrm = false + ctx.vexv = false + ctx.start = pos + ctx.imm = nil +end + +-- Clear all prefix flags. +local function clearprefixes(ctx) + ctx.o16 = false; ctx.seg = false; ctx.lock = false; ctx.rep = false + ctx.rexw = false; ctx.rexr = false; ctx.rexx = false; ctx.rexb = false + ctx.rex = false; ctx.a32 = false; ctx.vexl = false +end + +-- Fallback for incomplete opcodes at the end. +local function incomplete(ctx) + ctx.pos = ctx.stop+1 + clearprefixes(ctx) + return putop(ctx, "(incomplete)") +end + +-- Fallback for unknown opcodes. +local function unknown(ctx) + clearprefixes(ctx) + return putop(ctx, "(unknown)") +end + +-- Return an immediate of the specified size. +local function getimm(ctx, pos, n) + if pos+n-1 > ctx.stop then return incomplete(ctx) end + local code = ctx.code + if n == 1 then + local b1 = byte(code, pos, pos) + return b1 + elseif n == 2 then + local b1, b2 = byte(code, pos, pos+1) + return b1+b2*256 + else + local b1, b2, b3, b4 = byte(code, pos, pos+3) + local imm = b1+b2*256+b3*65536+b4*16777216 + ctx.imm = imm + return imm + end +end + +-- Process pattern string and generate the operands. +local function putpat(ctx, name, pat) + local operands, regs, sz, mode, sp, rm, sc, rx, sdisp + local code, pos, stop, vexl = ctx.code, ctx.pos, ctx.stop, ctx.vexl + + -- Chars used: 1DFGIMPQRSTUVWXYabcdfgijlmoprstuvwxyz + for p in gmatch(pat, ".") do + local x = nil + if p == "V" or p == "U" then + if ctx.rexw then sz = "Q"; ctx.rexw = false + elseif ctx.o16 then sz = "W"; ctx.o16 = false + elseif p == "U" and ctx.x64 then sz = "Q" + else sz = "D" end + regs = map_regs[sz] + elseif p == "T" then + if ctx.rexw then sz = "Q"; ctx.rexw = false else sz = "D" end + regs = map_regs[sz] + elseif p == "B" then + sz = "B" + regs = ctx.rex and map_regs.B64 or map_regs.B + elseif match(p, "[WDQMXYFG]") then + sz = p + if sz == "X" and vexl then sz = "Y"; ctx.vexl = false end + regs = map_regs[sz] + elseif p == "P" then + sz = ctx.o16 and "X" or "M"; ctx.o16 = false + if sz == "X" and vexl then sz = "Y"; ctx.vexl = false end + regs = map_regs[sz] + elseif p == "S" then + name = name..lower(sz) + elseif p == "s" then + local imm = getimm(ctx, pos, 1); if not imm then return end + x = imm <= 127 and format("+0x%02x", imm) + or format("-0x%02x", 256-imm) + pos = pos+1 + elseif p == "u" then + local imm = getimm(ctx, pos, 1); if not imm then return end + x = format("0x%02x", imm) + pos = pos+1 + elseif p == "b" then + local imm = getimm(ctx, pos, 1); if not imm then return end + x = regs[imm/16+1] + pos = pos+1 + elseif p == "w" then + local imm = getimm(ctx, pos, 2); if not imm then return end + x = format("0x%x", imm) + pos = pos+2 + elseif p == "o" then -- [offset] + if ctx.x64 then + local imm1 = getimm(ctx, pos, 4); if not imm1 then return end + local imm2 = getimm(ctx, pos+4, 4); if not imm2 then return end + x = format("[0x%08x%08x]", imm2, imm1) + pos = pos+8 + else + local imm = getimm(ctx, pos, 4); if not imm then return end + x = format("[0x%08x]", imm) + pos = pos+4 + end + elseif p == "i" or p == "I" then + local n = map_sz2n[sz] + if n == 8 and ctx.x64 and p == "I" then + local imm1 = getimm(ctx, pos, 4); if not imm1 then return end + local imm2 = getimm(ctx, pos+4, 4); if not imm2 then return end + x = format("0x%08x%08x", imm2, imm1) + else + if n == 8 then n = 4 end + local imm = getimm(ctx, pos, n); if not imm then return end + if sz == "Q" and (imm < 0 or imm > 0x7fffffff) then + imm = (0xffffffff+1)-imm + x = format(imm > 65535 and "-0x%08x" or "-0x%x", imm) + else + x = format(imm > 65535 and "0x%08x" or "0x%x", imm) + end + end + pos = pos+n + elseif p == "j" then + local n = map_sz2n[sz] + if n == 8 then n = 4 end + local imm = getimm(ctx, pos, n); if not imm then return end + if sz == "B" and imm > 127 then imm = imm-256 + elseif imm > 2147483647 then imm = imm-4294967296 end + pos = pos+n + imm = imm + pos + ctx.addr + if imm > 4294967295 and not ctx.x64 then imm = imm-4294967296 end + ctx.imm = imm + if sz == "W" then + x = format("word 0x%04x", imm%65536) + elseif ctx.x64 then + local lo = imm % 0x1000000 + x = format("0x%02x%06x", (imm-lo) / 0x1000000, lo) + else + x = "0x"..tohex(imm) + end + elseif p == "R" then + local r = byte(code, pos-1, pos-1)%8 + if ctx.rexb then r = r + 8; ctx.rexb = false end + x = regs[r+1] + elseif p == "a" then x = regs[1] + elseif p == "c" then x = "cl" + elseif p == "d" then x = "dx" + elseif p == "1" then x = "1" + else + if not mode then + mode = ctx.mrm + if not mode then + if pos > stop then return incomplete(ctx) end + mode = byte(code, pos, pos) + pos = pos+1 + end + rm = mode%8; mode = (mode-rm)/8 + sp = mode%8; mode = (mode-sp)/8 + sdisp = "" + if mode < 3 then + if rm == 4 then + if pos > stop then return incomplete(ctx) end + sc = byte(code, pos, pos) + pos = pos+1 + rm = sc%8; sc = (sc-rm)/8 + rx = sc%8; sc = (sc-rx)/8 + if ctx.rexx then rx = rx + 8; ctx.rexx = false end + if rx == 4 then rx = nil end + end + if mode > 0 or rm == 5 then + local dsz = mode + if dsz ~= 1 then dsz = 4 end + local disp = getimm(ctx, pos, dsz); if not disp then return end + if mode == 0 then rm = nil end + if rm or rx or (not sc and ctx.x64 and not ctx.a32) then + if dsz == 1 and disp > 127 then + sdisp = format("-0x%x", 256-disp) + elseif disp >= 0 and disp <= 0x7fffffff then + sdisp = format("+0x%x", disp) + else + sdisp = format("-0x%x", (0xffffffff+1)-disp) + end + else + sdisp = format(ctx.x64 and not ctx.a32 and + not (disp >= 0 and disp <= 0x7fffffff) + and "0xffffffff%08x" or "0x%08x", disp) + end + pos = pos+dsz + end + end + if rm and ctx.rexb then rm = rm + 8; ctx.rexb = false end + if ctx.rexr then sp = sp + 8; ctx.rexr = false end + end + if p == "m" then + if mode == 3 then x = regs[rm+1] + else + local aregs = ctx.a32 and map_regs.D or ctx.aregs + local srm, srx = "", "" + if rm then srm = aregs[rm+1] + elseif not sc and ctx.x64 and not ctx.a32 then srm = "rip" end + ctx.a32 = false + if rx then + if rm then srm = srm.."+" end + srx = aregs[rx+1] + if sc > 0 then srx = srx.."*"..(2^sc) end + end + x = format("[%s%s%s]", srm, srx, sdisp) + end + if mode < 3 and + (not match(pat, "[aRrgp]") or match(pat, "t")) then -- Yuck. + x = map_sz2prefix[sz].." "..x + end + elseif p == "r" then x = regs[sp+1] + elseif p == "g" then x = map_segregs[sp+1] + elseif p == "p" then -- Suppress prefix. + elseif p == "f" then x = "st"..rm + elseif p == "x" then + if sp == 0 and ctx.lock and not ctx.x64 then + x = "CR8"; ctx.lock = false + else + x = "CR"..sp + end + elseif p == "v" then + if ctx.vexv then + x = regs[ctx.vexv+1]; ctx.vexv = false + end + elseif p == "y" then x = "DR"..sp + elseif p == "z" then x = "TR"..sp + elseif p == "l" then vexl = false + elseif p == "t" then + else + error("bad pattern `"..pat.."'") + end + end + if x then operands = operands and operands..", "..x or x end + end + ctx.pos = pos + return putop(ctx, name, operands) +end + +-- Forward declaration. +local map_act + +-- Fetch and cache MRM byte. +local function getmrm(ctx) + local mrm = ctx.mrm + if not mrm then + local pos = ctx.pos + if pos > ctx.stop then return nil end + mrm = byte(ctx.code, pos, pos) + ctx.pos = pos+1 + ctx.mrm = mrm + end + return mrm +end + +-- Dispatch to handler depending on pattern. +local function dispatch(ctx, opat, patgrp) + if not opat then return unknown(ctx) end + if match(opat, "%|") then -- MMX/SSE variants depending on prefix. + local p + if ctx.rep then + p = ctx.rep=="rep" and "%|([^%|]*)" or "%|[^%|]*%|[^%|]*%|([^%|]*)" + ctx.rep = false + elseif ctx.o16 then p = "%|[^%|]*%|([^%|]*)"; ctx.o16 = false + else p = "^[^%|]*" end + opat = match(opat, p) + if not opat then return unknown(ctx) end +-- ctx.rep = false; ctx.o16 = false + --XXX fails for 66 f2 0f 38 f1 06 crc32 eax,WORD PTR [esi] + --XXX remove in branches? + end + if match(opat, "%$") then -- reg$mem variants. + local mrm = getmrm(ctx); if not mrm then return incomplete(ctx) end + opat = match(opat, mrm >= 192 and "^[^%$]*" or "%$(.*)") + if opat == "" then return unknown(ctx) end + end + if opat == "" then return unknown(ctx) end + local name, pat = match(opat, "^([a-z0-9 ]*)(.*)") + if pat == "" and patgrp then pat = patgrp end + return map_act[sub(pat, 1, 1)](ctx, name, pat) +end + +-- Get a pattern from an opcode map and dispatch to handler. +local function dispatchmap(ctx, opcmap) + local pos = ctx.pos + local opat = opcmap[byte(ctx.code, pos, pos)] + pos = pos + 1 + ctx.pos = pos + return dispatch(ctx, opat) +end + +-- Map for action codes. The key is the first char after the name. +map_act = { + -- Simple opcodes without operands. + [""] = function(ctx, name, pat) + return putop(ctx, name) + end, + + -- Operand size chars fall right through. + B = putpat, W = putpat, D = putpat, Q = putpat, + V = putpat, U = putpat, T = putpat, + M = putpat, X = putpat, P = putpat, + F = putpat, G = putpat, Y = putpat, + + -- Collect prefixes. + [":"] = function(ctx, name, pat) + ctx[pat == ":" and name or sub(pat, 2)] = name + if ctx.pos - ctx.start > 5 then return unknown(ctx) end -- Limit #prefixes. + end, + + -- Chain to special handler specified by name. + ["*"] = function(ctx, name, pat) + return map_act[name](ctx, name, sub(pat, 2)) + end, + + -- Use named subtable for opcode group. + ["!"] = function(ctx, name, pat) + local mrm = getmrm(ctx); if not mrm then return incomplete(ctx) end + return dispatch(ctx, map_opcgroup[name][((mrm-(mrm%8))/8)%8+1], sub(pat, 2)) + end, + + -- o16,o32[,o64] variants. + sz = function(ctx, name, pat) + if ctx.o16 then ctx.o16 = false + else + pat = match(pat, ",(.*)") + if ctx.rexw then + local p = match(pat, ",(.*)") + if p then pat = p; ctx.rexw = false end + end + end + pat = match(pat, "^[^,]*") + return dispatch(ctx, pat) + end, + + -- Two-byte opcode dispatch. + opc2 = function(ctx, name, pat) + return dispatchmap(ctx, map_opc2) + end, + + -- Three-byte opcode dispatch. + opc3 = function(ctx, name, pat) + return dispatchmap(ctx, map_opc3[pat]) + end, + + -- VMX/SVM dispatch. + vm = function(ctx, name, pat) + return dispatch(ctx, map_opcvm[ctx.mrm]) + end, + + -- Floating point opcode dispatch. + fp = function(ctx, name, pat) + local mrm = getmrm(ctx); if not mrm then return incomplete(ctx) end + local rm = mrm%8 + local idx = pat*8 + ((mrm-rm)/8)%8 + if mrm >= 192 then idx = idx + 64 end + local opat = map_opcfp[idx] + if type(opat) == "table" then opat = opat[rm+1] end + return dispatch(ctx, opat) + end, + + -- REX prefix. + rex = function(ctx, name, pat) + if ctx.rex then return unknown(ctx) end -- Only 1 REX or VEX prefix allowed. + for p in gmatch(pat, ".") do ctx["rex"..p] = true end + ctx.rex = "rex" + end, + + -- VEX prefix. + vex = function(ctx, name, pat) + if ctx.rex then return unknown(ctx) end -- Only 1 REX or VEX prefix allowed. + ctx.rex = "vex" + local pos = ctx.pos + if ctx.mrm then + ctx.mrm = nil + pos = pos-1 + end + local b = byte(ctx.code, pos, pos) + if not b then return incomplete(ctx) end + pos = pos+1 + if b < 128 then ctx.rexr = true end + local m = 1 + if pat == "3" then + m = b%32; b = (b-m)/32 + local nb = b%2; b = (b-nb)/2 + if nb == 0 then ctx.rexb = true end + local nx = b%2; b = (b-nx)/2 + if nx == 0 then ctx.rexx = true end + b = byte(ctx.code, pos, pos) + if not b then return incomplete(ctx) end + pos = pos+1 + if b >= 128 then ctx.rexw = true end + end + ctx.pos = pos + local map + if m == 1 then map = map_opc2 + elseif m == 2 then map = map_opc3["38"] + elseif m == 3 then map = map_opc3["3a"] + else return unknown(ctx) end + local p = b%4; b = (b-p)/4 + if p == 1 then ctx.o16 = "o16" + elseif p == 2 then ctx.rep = "rep" + elseif p == 3 then ctx.rep = "repne" end + local l = b%2; b = (b-l)/2 + if l ~= 0 then ctx.vexl = true end + ctx.vexv = (-1-b)%16 + return dispatchmap(ctx, map) + end, + + -- Special case for nop with REX prefix. + nop = function(ctx, name, pat) + return dispatch(ctx, ctx.rex and pat or "nop") + end, + + -- Special case for 0F 77. + emms = function(ctx, name, pat) + if ctx.rex ~= "vex" then + return putop(ctx, "emms") + elseif ctx.vexl then + ctx.vexl = false + return putop(ctx, "zeroall") + else + return putop(ctx, "zeroupper") + end + end, +} + +------------------------------------------------------------------------------ + +-- Disassemble a block of code. +local function disass_block(ctx, ofs, len) + if not ofs then ofs = 0 end + local stop = len and ofs+len or #ctx.code + ofs = ofs + 1 + ctx.start = ofs + ctx.pos = ofs + ctx.stop = stop + ctx.imm = nil + ctx.mrm = false + clearprefixes(ctx) + while ctx.pos <= stop do dispatchmap(ctx, ctx.map1) end + if ctx.pos ~= ctx.start then incomplete(ctx) end +end + +-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len). +local function create(code, addr, out) + local ctx = {} + ctx.code = code + ctx.addr = (addr or 0) - 1 + ctx.out = out or io.write + ctx.symtab = {} + ctx.disass = disass_block + ctx.hexdump = 16 + ctx.x64 = false + ctx.map1 = map_opc1_32 + ctx.aregs = map_regs.D + return ctx +end + +local function create64(code, addr, out) + local ctx = create(code, addr, out) + ctx.x64 = true + ctx.map1 = map_opc1_64 + ctx.aregs = map_regs.Q + return ctx +end + +-- Simple API: disassemble code (a string) at address and output via out. +local function disass(code, addr, out) + create(code, addr, out):disass() +end + +local function disass64(code, addr, out) + create64(code, addr, out):disass() +end + +-- Return register name for RID. +local function regname(r) + if r < 8 then return map_regs.D[r+1] end + return map_regs.X[r-7] +end + +local function regname64(r) + if r < 16 then return map_regs.Q[r+1] end + return map_regs.X[r-15] +end + +-- Public module functions. +return { + create = create, + create64 = create64, + disass = disass, + disass64 = disass64, + regname = regname, + regname64 = regname64 +} + diff --git a/Assets/LuaFramework/Luajit/jit/dis_x86.lua.meta b/Assets/LuaFramework/Luajit/jit/dis_x86.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..a4c55e6c7f4f88b9005b031cadb19a85c5aec755 --- /dev/null +++ b/Assets/LuaFramework/Luajit/jit/dis_x86.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 676a7cf93973aa444ad7cf6d244083d8 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Luajit/jit/dump.lua b/Assets/LuaFramework/Luajit/jit/dump.lua new file mode 100644 index 0000000000000000000000000000000000000000..9d8330e1838c9b7284ae1939bc79ad56b32b9c2a --- /dev/null +++ b/Assets/LuaFramework/Luajit/jit/dump.lua @@ -0,0 +1,707 @@ +---------------------------------------------------------------------------- +-- LuaJIT compiler dump module. +-- +-- Copyright (C) 2005-2016 Mike Pall. All rights reserved. +-- Released under the MIT license. See Copyright Notice in luajit.h +---------------------------------------------------------------------------- +-- +-- This module can be used to debug the JIT compiler itself. It dumps the +-- code representations and structures used in various compiler stages. +-- +-- Example usage: +-- +-- luajit -jdump -e "local x=0; for i=1,1e6 do x=x+i end; print(x)" +-- luajit -jdump=im -e "for i=1,1000 do for j=1,1000 do end end" | less -R +-- luajit -jdump=is myapp.lua | less -R +-- luajit -jdump=-b myapp.lua +-- luajit -jdump=+aH,myapp.html myapp.lua +-- luajit -jdump=ixT,myapp.dump myapp.lua +-- +-- The first argument specifies the dump mode. The second argument gives +-- the output file name. Default output is to stdout, unless the environment +-- variable LUAJIT_DUMPFILE is set. The file is overwritten every time the +-- module is started. +-- +-- Different features can be turned on or off with the dump mode. If the +-- mode starts with a '+', the following features are added to the default +-- set of features; a '-' removes them. Otherwise the features are replaced. +-- +-- The following dump features are available (* marks the default): +-- +-- * t Print a line for each started, ended or aborted trace (see also -jv). +-- * b Dump the traced bytecode. +-- * i Dump the IR (intermediate representation). +-- r Augment the IR with register/stack slots. +-- s Dump the snapshot map. +-- * m Dump the generated machine code. +-- x Print each taken trace exit. +-- X Print each taken trace exit and the contents of all registers. +-- a Print the IR of aborted traces, too. +-- +-- The output format can be set with the following characters: +-- +-- T Plain text output. +-- A ANSI-colored text output +-- H Colorized HTML + CSS output. +-- +-- The default output format is plain text. It's set to ANSI-colored text +-- if the COLORTERM variable is set. Note: this is independent of any output +-- redirection, which is actually considered a feature. +-- +-- You probably want to use less -R to enjoy viewing ANSI-colored text from +-- a pipe or a file. Add this to your ~/.bashrc: export LESS="-R" +-- +------------------------------------------------------------------------------ + +-- Cache some library functions and objects. +local jit = require("jit") +assert(jit.version_num == 20100, "LuaJIT core/library version mismatch") +local jutil = require("jit.util") +local vmdef = require("jit.vmdef") +local funcinfo, funcbc = jutil.funcinfo, jutil.funcbc +local traceinfo, traceir, tracek = jutil.traceinfo, jutil.traceir, jutil.tracek +local tracemc, tracesnap = jutil.tracemc, jutil.tracesnap +local traceexitstub, ircalladdr = jutil.traceexitstub, jutil.ircalladdr +local bit = require("bit") +local band, shl, shr, tohex = bit.band, bit.lshift, bit.rshift, bit.tohex +local sub, gsub, format = string.sub, string.gsub, string.format +local byte, char, rep = string.byte, string.char, string.rep +local type, tostring = type, tostring +local stdout, stderr = io.stdout, io.stderr + +-- Load other modules on-demand. +local bcline, disass + +-- Active flag, output file handle and dump mode. +local active, out, dumpmode + +------------------------------------------------------------------------------ + +local symtabmt = { __index = false } +local symtab = {} +local nexitsym = 0 + +-- Fill nested symbol table with per-trace exit stub addresses. +local function fillsymtab_tr(tr, nexit) + local t = {} + symtabmt.__index = t + if jit.arch == "mips" or jit.arch == "mipsel" then + t[traceexitstub(tr, 0)] = "exit" + return + end + for i=0,nexit-1 do + local addr = traceexitstub(tr, i) + if addr < 0 then addr = addr + 2^32 end + t[addr] = tostring(i) + end + local addr = traceexitstub(tr, nexit) + if addr then t[addr] = "stack_check" end +end + +-- Fill symbol table with trace exit stub addresses. +local function fillsymtab(tr, nexit) + local t = symtab + if nexitsym == 0 then + local ircall = vmdef.ircall + for i=0,#ircall do + local addr = ircalladdr(i) + if addr ~= 0 then + if addr < 0 then addr = addr + 2^32 end + t[addr] = ircall[i] + end + end + end + if nexitsym == 1000000 then -- Per-trace exit stubs. + fillsymtab_tr(tr, nexit) + elseif nexit > nexitsym then -- Shared exit stubs. + for i=nexitsym,nexit-1 do + local addr = traceexitstub(i) + if addr == nil then -- Fall back to per-trace exit stubs. + fillsymtab_tr(tr, nexit) + setmetatable(symtab, symtabmt) + nexit = 1000000 + break + end + if addr < 0 then addr = addr + 2^32 end + t[addr] = tostring(i) + end + nexitsym = nexit + end + return t +end + +local function dumpwrite(s) + out:write(s) +end + +-- Disassemble machine code. +local function dump_mcode(tr) + local info = traceinfo(tr) + if not info then return end + local mcode, addr, loop = tracemc(tr) + if not mcode then return end + if not disass then disass = require("jit.dis_"..jit.arch) end + if addr < 0 then addr = addr + 2^32 end + out:write("---- TRACE ", tr, " mcode ", #mcode, "\n") + local ctx = disass.create(mcode, addr, dumpwrite) + ctx.hexdump = 0 + ctx.symtab = fillsymtab(tr, info.nexit) + if loop ~= 0 then + symtab[addr+loop] = "LOOP" + ctx:disass(0, loop) + out:write("->LOOP:\n") + ctx:disass(loop, #mcode-loop) + symtab[addr+loop] = nil + else + ctx:disass(0, #mcode) + end +end + +------------------------------------------------------------------------------ + +local irtype_text = { + [0] = "nil", + "fal", + "tru", + "lud", + "str", + "p32", + "thr", + "pro", + "fun", + "p64", + "cdt", + "tab", + "udt", + "flt", + "num", + "i8 ", + "u8 ", + "i16", + "u16", + "int", + "u32", + "i64", + "u64", + "sfp", +} + +local colortype_ansi = { + [0] = "%s", + "%s", + "%s", + "\027[36m%s\027[m", + "\027[32m%s\027[m", + "%s", + "\027[1m%s\027[m", + "%s", + "\027[1m%s\027[m", + "%s", + "\027[33m%s\027[m", + "\027[31m%s\027[m", + "\027[36m%s\027[m", + "\027[34m%s\027[m", + "\027[34m%s\027[m", + "\027[35m%s\027[m", + "\027[35m%s\027[m", + "\027[35m%s\027[m", + "\027[35m%s\027[m", + "\027[35m%s\027[m", + "\027[35m%s\027[m", + "\027[35m%s\027[m", + "\027[35m%s\027[m", + "\027[35m%s\027[m", +} + +local function colorize_text(s, t) + return s +end + +local function colorize_ansi(s, t) + return format(colortype_ansi[t], s) +end + +local irtype_ansi = setmetatable({}, + { __index = function(tab, t) + local s = colorize_ansi(irtype_text[t], t); tab[t] = s; return s; end }) + +local html_escape = { ["<"] = "<", [">"] = ">", ["&"] = "&", } + +local function colorize_html(s, t) + s = gsub(s, "[<>&]", html_escape) + return format('%s', irtype_text[t], s) +end + +local irtype_html = setmetatable({}, + { __index = function(tab, t) + local s = colorize_html(irtype_text[t], t); tab[t] = s; return s; end }) + +local header_html = [[ + +]] + +local colorize, irtype + +-- Lookup tables to convert some literals into names. +local litname = { + ["SLOAD "] = setmetatable({}, { __index = function(t, mode) + local s = "" + if band(mode, 1) ~= 0 then s = s.."P" end + if band(mode, 2) ~= 0 then s = s.."F" end + if band(mode, 4) ~= 0 then s = s.."T" end + if band(mode, 8) ~= 0 then s = s.."C" end + if band(mode, 16) ~= 0 then s = s.."R" end + if band(mode, 32) ~= 0 then s = s.."I" end + t[mode] = s + return s + end}), + ["XLOAD "] = { [0] = "", "R", "V", "RV", "U", "RU", "VU", "RVU", }, + ["CONV "] = setmetatable({}, { __index = function(t, mode) + local s = irtype[band(mode, 31)] + s = irtype[band(shr(mode, 5), 31)].."."..s + if band(mode, 0x800) ~= 0 then s = s.." sext" end + local c = shr(mode, 14) + if c == 2 then s = s.." index" elseif c == 3 then s = s.." check" end + t[mode] = s + return s + end}), + ["FLOAD "] = vmdef.irfield, + ["FREF "] = vmdef.irfield, + ["FPMATH"] = vmdef.irfpm, + ["BUFHDR"] = { [0] = "RESET", "APPEND" }, + ["TOSTR "] = { [0] = "INT", "NUM", "CHAR" }, +} + +local function ctlsub(c) + if c == "\n" then return "\\n" + elseif c == "\r" then return "\\r" + elseif c == "\t" then return "\\t" + else return format("\\%03d", byte(c)) + end +end + +local function fmtfunc(func, pc) + local fi = funcinfo(func, pc) + if fi.loc then + return fi.loc + elseif fi.ffid then + return vmdef.ffnames[fi.ffid] + elseif fi.addr then + return format("C:%x", fi.addr) + else + return "(?)" + end +end + +local function formatk(tr, idx) + local k, t, slot = tracek(tr, idx) + local tn = type(k) + local s + if tn == "number" then + if k == 2^52+2^51 then + s = "bias" + else + s = format("%+.14g", k) + end + elseif tn == "string" then + s = format(#k > 20 and '"%.20s"~' or '"%s"', gsub(k, "%c", ctlsub)) + elseif tn == "function" then + s = fmtfunc(k) + elseif tn == "table" then + s = format("{%p}", k) + elseif tn == "userdata" then + if t == 12 then + s = format("userdata:%p", k) + else + s = format("[%p]", k) + if s == "[0x00000000]" then s = "NULL" end + end + elseif t == 21 then -- int64_t + s = sub(tostring(k), 1, -3) + if sub(s, 1, 1) ~= "-" then s = "+"..s end + else + s = tostring(k) -- For primitives. + end + s = colorize(format("%-4s", s), t) + if slot then + s = format("%s @%d", s, slot) + end + return s +end + +local function printsnap(tr, snap) + local n = 2 + for s=0,snap[1]-1 do + local sn = snap[n] + if shr(sn, 24) == s then + n = n + 1 + local ref = band(sn, 0xffff) - 0x8000 -- REF_BIAS + if ref < 0 then + out:write(formatk(tr, ref)) + elseif band(sn, 0x80000) ~= 0 then -- SNAP_SOFTFPNUM + out:write(colorize(format("%04d/%04d", ref, ref+1), 14)) + else + local m, ot, op1, op2 = traceir(tr, ref) + out:write(colorize(format("%04d", ref), band(ot, 31))) + end + out:write(band(sn, 0x10000) == 0 and " " or "|") -- SNAP_FRAME + else + out:write("---- ") + end + end + out:write("]\n") +end + +-- Dump snapshots (not interleaved with IR). +local function dump_snap(tr) + out:write("---- TRACE ", tr, " snapshots\n") + for i=0,1000000000 do + local snap = tracesnap(tr, i) + if not snap then break end + out:write(format("#%-3d %04d [ ", i, snap[0])) + printsnap(tr, snap) + end +end + +-- Return a register name or stack slot for a rid/sp location. +local function ridsp_name(ridsp, ins) + if not disass then disass = require("jit.dis_"..jit.arch) end + local rid, slot = band(ridsp, 0xff), shr(ridsp, 8) + if rid == 253 or rid == 254 then + return (slot == 0 or slot == 255) and " {sink" or format(" {%04d", ins-slot) + end + if ridsp > 255 then return format("[%x]", slot*4) end + if rid < 128 then return disass.regname(rid) end + return "" +end + +-- Dump CALL* function ref and return optional ctype. +local function dumpcallfunc(tr, ins) + local ctype + if ins > 0 then + local m, ot, op1, op2 = traceir(tr, ins) + if band(ot, 31) == 0 then -- nil type means CARG(func, ctype). + ins = op1 + ctype = formatk(tr, op2) + end + end + if ins < 0 then + out:write(format("[0x%x](", tonumber((tracek(tr, ins))))) + else + out:write(format("%04d (", ins)) + end + return ctype +end + +-- Recursively gather CALL* args and dump them. +local function dumpcallargs(tr, ins) + if ins < 0 then + out:write(formatk(tr, ins)) + else + local m, ot, op1, op2 = traceir(tr, ins) + local oidx = 6*shr(ot, 8) + local op = sub(vmdef.irnames, oidx+1, oidx+6) + if op == "CARG " then + dumpcallargs(tr, op1) + if op2 < 0 then + out:write(" ", formatk(tr, op2)) + else + out:write(" ", format("%04d", op2)) + end + else + out:write(format("%04d", ins)) + end + end +end + +-- Dump IR and interleaved snapshots. +local function dump_ir(tr, dumpsnap, dumpreg) + local info = traceinfo(tr) + if not info then return end + local nins = info.nins + out:write("---- TRACE ", tr, " IR\n") + local irnames = vmdef.irnames + local snapref = 65536 + local snap, snapno + if dumpsnap then + snap = tracesnap(tr, 0) + snapref = snap[0] + snapno = 0 + end + for ins=1,nins do + if ins >= snapref then + if dumpreg then + out:write(format(".... SNAP #%-3d [ ", snapno)) + else + out:write(format(".... SNAP #%-3d [ ", snapno)) + end + printsnap(tr, snap) + snapno = snapno + 1 + snap = tracesnap(tr, snapno) + snapref = snap and snap[0] or 65536 + end + local m, ot, op1, op2, ridsp = traceir(tr, ins) + local oidx, t = 6*shr(ot, 8), band(ot, 31) + local op = sub(irnames, oidx+1, oidx+6) + if op == "LOOP " then + if dumpreg then + out:write(format("%04d ------------ LOOP ------------\n", ins)) + else + out:write(format("%04d ------ LOOP ------------\n", ins)) + end + elseif op ~= "NOP " and op ~= "CARG " and + (dumpreg or op ~= "RENAME") then + local rid = band(ridsp, 255) + if dumpreg then + out:write(format("%04d %-6s", ins, ridsp_name(ridsp, ins))) + else + out:write(format("%04d ", ins)) + end + out:write(format("%s%s %s %s ", + (rid == 254 or rid == 253) and "}" or + (band(ot, 128) == 0 and " " or ">"), + band(ot, 64) == 0 and " " or "+", + irtype[t], op)) + local m1, m2 = band(m, 3), band(m, 3*4) + if sub(op, 1, 4) == "CALL" then + local ctype + if m2 == 1*4 then -- op2 == IRMlit + out:write(format("%-10s (", vmdef.ircall[op2])) + else + ctype = dumpcallfunc(tr, op2) + end + if op1 ~= -1 then dumpcallargs(tr, op1) end + out:write(")") + if ctype then out:write(" ctype ", ctype) end + elseif op == "CNEW " and op2 == -1 then + out:write(formatk(tr, op1)) + elseif m1 ~= 3 then -- op1 != IRMnone + if op1 < 0 then + out:write(formatk(tr, op1)) + else + out:write(format(m1 == 0 and "%04d" or "#%-3d", op1)) + end + if m2 ~= 3*4 then -- op2 != IRMnone + if m2 == 1*4 then -- op2 == IRMlit + local litn = litname[op] + if litn and litn[op2] then + out:write(" ", litn[op2]) + elseif op == "UREFO " or op == "UREFC " then + out:write(format(" #%-3d", shr(op2, 8))) + else + out:write(format(" #%-3d", op2)) + end + elseif op2 < 0 then + out:write(" ", formatk(tr, op2)) + else + out:write(format(" %04d", op2)) + end + end + end + out:write("\n") + end + end + if snap then + if dumpreg then + out:write(format(".... SNAP #%-3d [ ", snapno)) + else + out:write(format(".... SNAP #%-3d [ ", snapno)) + end + printsnap(tr, snap) + end +end + +------------------------------------------------------------------------------ + +local recprefix = "" +local recdepth = 0 + +-- Format trace error message. +local function fmterr(err, info) + if type(err) == "number" then + if type(info) == "function" then info = fmtfunc(info) end + err = format(vmdef.traceerr[err], info) + end + return err +end + +-- Dump trace states. +local function dump_trace(what, tr, func, pc, otr, oex) + if what == "stop" or (what == "abort" and dumpmode.a) then + if dumpmode.i then dump_ir(tr, dumpmode.s, dumpmode.r and what == "stop") + elseif dumpmode.s then dump_snap(tr) end + if dumpmode.m then dump_mcode(tr) end + end + if what == "start" then + if dumpmode.H then out:write('
\n') end
+    out:write("---- TRACE ", tr, " ", what)
+    if otr then out:write(" ", otr, "/", oex) end
+    out:write(" ", fmtfunc(func, pc), "\n")
+  elseif what == "stop" or what == "abort" then
+    out:write("---- TRACE ", tr, " ", what)
+    if what == "abort" then
+      out:write(" ", fmtfunc(func, pc), " -- ", fmterr(otr, oex), "\n")
+    else
+      local info = traceinfo(tr)
+      local link, ltype = info.link, info.linktype
+      if link == tr or link == 0 then
+	out:write(" -> ", ltype, "\n")
+      elseif ltype == "root" then
+	out:write(" -> ", link, "\n")
+      else
+	out:write(" -> ", link, " ", ltype, "\n")
+      end
+    end
+    if dumpmode.H then out:write("
\n\n") else out:write("\n") end + else + if what == "flush" then symtab, nexitsym = {}, 0 end + out:write("---- TRACE ", what, "\n\n") + end + out:flush() +end + +-- Dump recorded bytecode. +local function dump_record(tr, func, pc, depth, callee) + if depth ~= recdepth then + recdepth = depth + recprefix = rep(" .", depth) + end + local line + if pc >= 0 then + line = bcline(func, pc, recprefix) + if dumpmode.H then line = gsub(line, "[<>&]", html_escape) end + else + line = "0000 "..recprefix.." FUNCC \n" + callee = func + end + if pc <= 0 then + out:write(sub(line, 1, -2), " ; ", fmtfunc(func), "\n") + else + out:write(line) + end + if pc >= 0 and band(funcbc(func, pc), 0xff) < 16 then -- ORDER BC + out:write(bcline(func, pc+1, recprefix)) -- Write JMP for cond. + end +end + +------------------------------------------------------------------------------ + +-- Dump taken trace exits. +local function dump_texit(tr, ex, ngpr, nfpr, ...) + out:write("---- TRACE ", tr, " exit ", ex, "\n") + if dumpmode.X then + local regs = {...} + if jit.arch == "x64" then + for i=1,ngpr do + out:write(format(" %016x", regs[i])) + if i % 4 == 0 then out:write("\n") end + end + else + for i=1,ngpr do + out:write(" ", tohex(regs[i])) + if i % 8 == 0 then out:write("\n") end + end + end + if jit.arch == "mips" or jit.arch == "mipsel" then + for i=1,nfpr,2 do + out:write(format(" %+17.14g", regs[ngpr+i])) + if i % 8 == 7 then out:write("\n") end + end + else + for i=1,nfpr do + out:write(format(" %+17.14g", regs[ngpr+i])) + if i % 4 == 0 then out:write("\n") end + end + end + end +end + +------------------------------------------------------------------------------ + +-- Detach dump handlers. +local function dumpoff() + if active then + active = false + jit.attach(dump_texit) + jit.attach(dump_record) + jit.attach(dump_trace) + if out and out ~= stdout and out ~= stderr then out:close() end + out = nil + end +end + +-- Open the output file and attach dump handlers. +local function dumpon(opt, outfile) + if active then dumpoff() end + + local colormode = os.getenv("COLORTERM") and "A" or "T" + if opt then + opt = gsub(opt, "[TAH]", function(mode) colormode = mode; return ""; end) + end + + local m = { t=true, b=true, i=true, m=true, } + if opt and opt ~= "" then + local o = sub(opt, 1, 1) + if o ~= "+" and o ~= "-" then m = {} end + for i=1,#opt do m[sub(opt, i, i)] = (o ~= "-") end + end + dumpmode = m + + if m.t or m.b or m.i or m.s or m.m then + jit.attach(dump_trace, "trace") + end + if m.b then + jit.attach(dump_record, "record") + if not bcline then bcline = require("jit.bc").line end + end + if m.x or m.X then + jit.attach(dump_texit, "texit") + end + + if not outfile then outfile = os.getenv("LUAJIT_DUMPFILE") end + if outfile then + out = outfile == "-" and stdout or assert(io.open(outfile, "w")) + else + out = stdout + end + + m[colormode] = true + if colormode == "A" then + colorize = colorize_ansi + irtype = irtype_ansi + elseif colormode == "H" then + colorize = colorize_html + irtype = irtype_html + out:write(header_html) + else + colorize = colorize_text + irtype = irtype_text + end + + active = true +end + +-- Public module functions. +return { + on = dumpon, + off = dumpoff, + start = dumpon -- For -j command line option. +} + diff --git a/Assets/LuaFramework/Luajit/jit/dump.lua.meta b/Assets/LuaFramework/Luajit/jit/dump.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..5d559ce5338b90d1e5f78bc7532180a763bd1f9e --- /dev/null +++ b/Assets/LuaFramework/Luajit/jit/dump.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 029c25a735609054d81dee95957d1fc8 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Luajit/jit/v.lua b/Assets/LuaFramework/Luajit/jit/v.lua new file mode 100644 index 0000000000000000000000000000000000000000..60c8b05aa4e3157b9e5440e11d96b631bbbaa5a5 --- /dev/null +++ b/Assets/LuaFramework/Luajit/jit/v.lua @@ -0,0 +1,170 @@ +---------------------------------------------------------------------------- +-- Verbose mode of the LuaJIT compiler. +-- +-- Copyright (C) 2005-2016 Mike Pall. All rights reserved. +-- Released under the MIT license. See Copyright Notice in luajit.h +---------------------------------------------------------------------------- +-- +-- This module shows verbose information about the progress of the +-- JIT compiler. It prints one line for each generated trace. This module +-- is useful to see which code has been compiled or where the compiler +-- punts and falls back to the interpreter. +-- +-- Example usage: +-- +-- luajit -jv -e "for i=1,1000 do for j=1,1000 do end end" +-- luajit -jv=myapp.out myapp.lua +-- +-- Default output is to stderr. To redirect the output to a file, pass a +-- filename as an argument (use '-' for stdout) or set the environment +-- variable LUAJIT_VERBOSEFILE. The file is overwritten every time the +-- module is started. +-- +-- The output from the first example should look like this: +-- +-- [TRACE 1 (command line):1 loop] +-- [TRACE 2 (1/3) (command line):1 -> 1] +-- +-- The first number in each line is the internal trace number. Next are +-- the file name ('(command line)') and the line number (':1') where the +-- trace has started. Side traces also show the parent trace number and +-- the exit number where they are attached to in parentheses ('(1/3)'). +-- An arrow at the end shows where the trace links to ('-> 1'), unless +-- it loops to itself. +-- +-- In this case the inner loop gets hot and is traced first, generating +-- a root trace. Then the last exit from the 1st trace gets hot, too, +-- and triggers generation of the 2nd trace. The side trace follows the +-- path along the outer loop and *around* the inner loop, back to its +-- start, and then links to the 1st trace. Yes, this may seem unusual, +-- if you know how traditional compilers work. Trace compilers are full +-- of surprises like this -- have fun! :-) +-- +-- Aborted traces are shown like this: +-- +-- [TRACE --- foo.lua:44 -- leaving loop in root trace at foo:lua:50] +-- +-- Don't worry -- trace aborts are quite common, even in programs which +-- can be fully compiled. The compiler may retry several times until it +-- finds a suitable trace. +-- +-- Of course this doesn't work with features that are not-yet-implemented +-- (NYI error messages). The VM simply falls back to the interpreter. This +-- may not matter at all if the particular trace is not very high up in +-- the CPU usage profile. Oh, and the interpreter is quite fast, too. +-- +-- Also check out the -jdump module, which prints all the gory details. +-- +------------------------------------------------------------------------------ + +-- Cache some library functions and objects. +local jit = require("jit") +assert(jit.version_num == 20100, "LuaJIT core/library version mismatch") +local jutil = require("jit.util") +local vmdef = require("jit.vmdef") +local funcinfo, traceinfo = jutil.funcinfo, jutil.traceinfo +local type, format = type, string.format +local stdout, stderr = io.stdout, io.stderr + +-- Active flag and output file handle. +local active, out + +------------------------------------------------------------------------------ + +local startloc, startex + +local function fmtfunc(func, pc) + local fi = funcinfo(func, pc) + if fi.loc then + return fi.loc + elseif fi.ffid then + return vmdef.ffnames[fi.ffid] + elseif fi.addr then + return format("C:%x", fi.addr) + else + return "(?)" + end +end + +-- Format trace error message. +local function fmterr(err, info) + if type(err) == "number" then + if type(info) == "function" then info = fmtfunc(info) end + err = format(vmdef.traceerr[err], info) + end + return err +end + +-- Dump trace states. +local function dump_trace(what, tr, func, pc, otr, oex) + if what == "start" then + startloc = fmtfunc(func, pc) + startex = otr and "("..otr.."/"..oex..") " or "" + else + if what == "abort" then + local loc = fmtfunc(func, pc) + if loc ~= startloc then + out:write(format("[TRACE --- %s%s -- %s at %s]\n", + startex, startloc, fmterr(otr, oex), loc)) + else + out:write(format("[TRACE --- %s%s -- %s]\n", + startex, startloc, fmterr(otr, oex))) + end + elseif what == "stop" then + local info = traceinfo(tr) + local link, ltype = info.link, info.linktype + if ltype == "interpreter" then + out:write(format("[TRACE %3s %s%s -- fallback to interpreter]\n", + tr, startex, startloc)) + elseif ltype == "stitch" then + out:write(format("[TRACE %3s %s%s %s %s]\n", + tr, startex, startloc, ltype, fmtfunc(func, pc))) + elseif link == tr or link == 0 then + out:write(format("[TRACE %3s %s%s %s]\n", + tr, startex, startloc, ltype)) + elseif ltype == "root" then + out:write(format("[TRACE %3s %s%s -> %d]\n", + tr, startex, startloc, link)) + else + out:write(format("[TRACE %3s %s%s -> %d %s]\n", + tr, startex, startloc, link, ltype)) + end + else + out:write(format("[TRACE %s]\n", what)) + end + out:flush() + end +end + +------------------------------------------------------------------------------ + +-- Detach dump handlers. +local function dumpoff() + if active then + active = false + jit.attach(dump_trace) + if out and out ~= stdout and out ~= stderr then out:close() end + out = nil + end +end + +-- Open the output file and attach dump handlers. +local function dumpon(outfile) + if active then dumpoff() end + if not outfile then outfile = os.getenv("LUAJIT_VERBOSEFILE") end + if outfile then + out = outfile == "-" and stdout or assert(io.open(outfile, "w")) + else + out = stderr + end + jit.attach(dump_trace, "trace") + active = true +end + +-- Public module functions. +return { + on = dumpon, + off = dumpoff, + start = dumpon -- For -j command line option. +} + diff --git a/Assets/LuaFramework/Luajit/jit/v.lua.meta b/Assets/LuaFramework/Luajit/jit/v.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..fd9488083465065a4bf377f55aef1e1e24cf0675 --- /dev/null +++ b/Assets/LuaFramework/Luajit/jit/v.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 724b205f5019d9449807abad317fbb38 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Luajit/jit/vmdef.lua b/Assets/LuaFramework/Luajit/jit/vmdef.lua new file mode 100644 index 0000000000000000000000000000000000000000..466066049cae63386cc5f353f0fadb788afe990d --- /dev/null +++ b/Assets/LuaFramework/Luajit/jit/vmdef.lua @@ -0,0 +1,331 @@ +-- This is a generated file. DO NOT EDIT! + +module(...) + +bcnames = "ISLT ISGE ISLE ISGT ISEQV ISNEV ISEQS ISNES ISEQN ISNEN ISEQP ISNEP ISTC ISFC IST ISF MOV NOT UNM LEN ADDVN SUBVN MULVN DIVVN MODVN ADDNV SUBNV MULNV DIVNV MODNV ADDVV SUBVV MULVV DIVVV MODVV POW CAT KSTR KCDATAKSHORTKNUM KPRI KNIL UGET USETV USETS USETN USETP UCLO FNEW TNEW TDUP GGET GSET TGETV TGETS TGETB TSETV TSETS TSETB TSETM CALLM CALL CALLMTCALLT ITERC ITERN VARG ISNEXTRETM RET RET0 RET1 FORI JFORI FORL IFORL JFORL ITERL IITERLJITERLLOOP ILOOP JLOOP JMP FUNCF IFUNCFJFUNCFFUNCV IFUNCVJFUNCVFUNCC FUNCCW" + +irnames = "LT GE LE GT ULT UGE ULE UGT EQ NE ABC RETF NOP BASE PVAL GCSTEPHIOP LOOP USE PHI RENAMEKPRI KINT KGC KPTR KKPTR KNULL KNUM KINT64KSLOT BNOT BSWAP BAND BOR BXOR BSHL BSHR BSAR BROL BROR ADD SUB MUL DIV MOD POW NEG ABS ATAN2 LDEXP MIN MAX FPMATHADDOV SUBOV MULOV AREF HREFK HREF NEWREFUREFO UREFC FREF STRREFALOAD HLOAD ULOAD FLOAD XLOAD SLOAD VLOAD ASTOREHSTOREUSTOREFSTOREXSTORESNEW XSNEW TNEW TDUP CNEW CNEWI TBAR OBAR XBAR CONV TOBIT TOSTR STRTO CALLN CALLL CALLS CALLXSCARG " + +irfpm = { [0]="floor", "ceil", "trunc", "sqrt", "exp", "exp2", "log", "log2", "log10", "sin", "cos", "tan", "other", } + +irfield = { [0]="str.len", "func.env", "func.pc", "tab.meta", "tab.array", "tab.node", "tab.asize", "tab.hmask", "tab.nomm", "udata.meta", "udata.udtype", "udata.file", "cdata.ctypeid", "cdata.ptr", "cdata.int", "cdata.int64", "cdata.int64_4", } + +ircall = { +[0]="lj_str_cmp", +"lj_str_new", +"lj_strscan_num", +"lj_str_fromint", +"lj_str_fromnum", +"lj_tab_new1", +"lj_tab_dup", +"lj_tab_newkey", +"lj_tab_len", +"lj_gc_step_jit", +"lj_gc_barrieruv", +"lj_mem_newgco", +"lj_math_random_step", +"lj_vm_modi", +"sinh", +"cosh", +"tanh", +"fputc", +"fwrite", +"fflush", +"lj_vm_floor", +"lj_vm_ceil", +"lj_vm_trunc", +"sqrt", +"exp", +"lj_vm_exp2", +"log", +"lj_vm_log2", +"log10", +"sin", +"cos", +"tan", +"lj_vm_powi", +"pow", +"atan2", +"ldexp", +"lj_vm_tobit", +"softfp_add", +"softfp_sub", +"softfp_mul", +"softfp_div", +"softfp_cmp", +"softfp_i2d", +"softfp_d2i", +"softfp_ui2d", +"softfp_f2d", +"softfp_d2ui", +"softfp_d2f", +"softfp_i2f", +"softfp_ui2f", +"softfp_f2i", +"softfp_f2ui", +"fp64_l2d", +"fp64_ul2d", +"fp64_l2f", +"fp64_ul2f", +"fp64_d2l", +"fp64_d2ul", +"fp64_f2l", +"fp64_f2ul", +"lj_carith_divi64", +"lj_carith_divu64", +"lj_carith_modi64", +"lj_carith_modu64", +"lj_carith_powi64", +"lj_carith_powu64", +"lj_cdata_setfin", +"strlen", +"memcpy", +"memset", +"lj_vm_errno", +"lj_carith_mul64", +} + +traceerr = { +[0]="error thrown or hook called during recording", +"trace too long", +"trace too deep", +"too many snapshots", +"blacklisted", +"NYI: bytecode %d", +"leaving loop in root trace", +"inner loop in root trace", +"loop unroll limit reached", +"bad argument type", +"JIT compilation disabled for function", +"call unroll limit reached", +"down-recursion, restarting", +"NYI: C function %p", +"NYI: FastFunc %s", +"NYI: unsupported variant of FastFunc %s", +"NYI: return to lower frame", +"store with nil or NaN key", +"missing metamethod", +"looping index lookup", +"NYI: mixed sparse/dense table", +"symbol not in cache", +"NYI: unsupported C type conversion", +"NYI: unsupported C function type", +"guard would always fail", +"too many PHIs", +"persistent type instability", +"failed to allocate mcode memory", +"machine code too long", +"hit mcode limit (retrying)", +"too many spill slots", +"inconsistent register allocation", +"NYI: cannot assemble IR instruction %d", +"NYI: PHI shuffling too complex", +"NYI: register coalescing too complex", +} + +ffnames = { +[0]="Lua", +"C", +"assert", +"type", +"next", +"pairs", +"ipairs_aux", +"ipairs", +"getmetatable", +"setmetatable", +"getfenv", +"setfenv", +"rawget", +"rawset", +"rawequal", +"unpack", +"select", +"tonumber", +"tostring", +"error", +"pcall", +"xpcall", +"loadfile", +"load", +"loadstring", +"dofile", +"gcinfo", +"collectgarbage", +"newproxy", +"print", +"coroutine.status", +"coroutine.running", +"coroutine.create", +"coroutine.yield", +"coroutine.resume", +"coroutine.wrap_aux", +"coroutine.wrap", +"math.abs", +"math.floor", +"math.ceil", +"math.sqrt", +"math.log10", +"math.exp", +"math.sin", +"math.cos", +"math.tan", +"math.asin", +"math.acos", +"math.atan", +"math.sinh", +"math.cosh", +"math.tanh", +"math.frexp", +"math.modf", +"math.deg", +"math.rad", +"math.log", +"math.atan2", +"math.pow", +"math.fmod", +"math.ldexp", +"math.min", +"math.max", +"math.random", +"math.randomseed", +"bit.tobit", +"bit.bnot", +"bit.bswap", +"bit.lshift", +"bit.rshift", +"bit.arshift", +"bit.rol", +"bit.ror", +"bit.band", +"bit.bor", +"bit.bxor", +"bit.tohex", +"string.len", +"string.byte", +"string.char", +"string.sub", +"string.rep", +"string.reverse", +"string.lower", +"string.upper", +"string.dump", +"string.find", +"string.match", +"string.gmatch_aux", +"string.gmatch", +"string.gsub", +"string.format", +"table.foreachi", +"table.foreach", +"table.getn", +"table.maxn", +"table.insert", +"table.remove", +"table.concat", +"table.sort", +"io.method.close", +"io.method.read", +"io.method.write", +"io.method.flush", +"io.method.seek", +"io.method.setvbuf", +"io.method.lines", +"io.method.__gc", +"io.method.__tostring", +"io.open", +"io.popen", +"io.tmpfile", +"io.close", +"io.read", +"io.write", +"io.flush", +"io.input", +"io.output", +"io.lines", +"io.type", +"os.execute", +"os.remove", +"os.rename", +"os.tmpname", +"os.getenv", +"os.exit", +"os.clock", +"os.date", +"os.time", +"os.difftime", +"os.setlocale", +"debug.getregistry", +"debug.getmetatable", +"debug.setmetatable", +"debug.getfenv", +"debug.setfenv", +"debug.getinfo", +"debug.getlocal", +"debug.setlocal", +"debug.getupvalue", +"debug.setupvalue", +"debug.upvalueid", +"debug.upvaluejoin", +"debug.sethook", +"debug.gethook", +"debug.debug", +"debug.traceback", +"jit.on", +"jit.off", +"jit.flush", +"jit.status", +"jit.attach", +"jit.util.funcinfo", +"jit.util.funcbc", +"jit.util.funck", +"jit.util.funcuvname", +"jit.util.traceinfo", +"jit.util.traceir", +"jit.util.tracek", +"jit.util.tracesnap", +"jit.util.tracemc", +"jit.util.traceexitstub", +"jit.util.ircalladdr", +"jit.opt.start", +"ffi.meta.__index", +"ffi.meta.__newindex", +"ffi.meta.__eq", +"ffi.meta.__len", +"ffi.meta.__lt", +"ffi.meta.__le", +"ffi.meta.__concat", +"ffi.meta.__call", +"ffi.meta.__add", +"ffi.meta.__sub", +"ffi.meta.__mul", +"ffi.meta.__div", +"ffi.meta.__mod", +"ffi.meta.__pow", +"ffi.meta.__unm", +"ffi.meta.__tostring", +"ffi.meta.__pairs", +"ffi.meta.__ipairs", +"ffi.clib.__index", +"ffi.clib.__newindex", +"ffi.clib.__gc", +"ffi.callback.free", +"ffi.callback.set", +"ffi.cdef", +"ffi.new", +"ffi.cast", +"ffi.typeof", +"ffi.istype", +"ffi.sizeof", +"ffi.alignof", +"ffi.offsetof", +"ffi.errno", +"ffi.string", +"ffi.copy", +"ffi.fill", +"ffi.abi", +"ffi.metatype", +"ffi.gc", +"ffi.load", +} + diff --git a/Assets/LuaFramework/Luajit/jit/vmdef.lua.meta b/Assets/LuaFramework/Luajit/jit/vmdef.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..dc73d35bccd16106e9b64733be943e1758a2c4af --- /dev/null +++ b/Assets/LuaFramework/Luajit/jit/vmdef.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: cd5259d2e7ff79146978231b90c15d75 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Luajit/lua51.dll b/Assets/LuaFramework/Luajit/lua51.dll new file mode 100644 index 0000000000000000000000000000000000000000..eba797be79ada57e63436874fca513ba10bfd413 Binary files /dev/null and b/Assets/LuaFramework/Luajit/lua51.dll differ diff --git a/Assets/LuaFramework/Luajit/lua51.dll.meta b/Assets/LuaFramework/Luajit/lua51.dll.meta new file mode 100644 index 0000000000000000000000000000000000000000..fcfab03206df8da9b308c32fd8db4134b43d9cd9 --- /dev/null +++ b/Assets/LuaFramework/Luajit/lua51.dll.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: ee6027814429a0a43822294a9a9047a2 +timeCreated: 1498139740 +licenseType: Pro +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Luajit/luajit.exe b/Assets/LuaFramework/Luajit/luajit.exe new file mode 100644 index 0000000000000000000000000000000000000000..27d70270d7c23403b86343fbdaea0bedf33821e1 Binary files /dev/null and b/Assets/LuaFramework/Luajit/luajit.exe differ diff --git a/Assets/LuaFramework/Luajit/luajit.exe.meta b/Assets/LuaFramework/Luajit/luajit.exe.meta new file mode 100644 index 0000000000000000000000000000000000000000..8078bb29e5a8cbd767fa949101ce34497c151262 --- /dev/null +++ b/Assets/LuaFramework/Luajit/luajit.exe.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cecf08c1bab22534d9355eecd48576be +timeCreated: 1498139739 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Resources.meta b/Assets/LuaFramework/Resources.meta new file mode 100644 index 0000000000000000000000000000000000000000..f655ea43ab86d47a5d932dd4398310d07b9689b6 --- /dev/null +++ b/Assets/LuaFramework/Resources.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: a60d9cccbd70c474f9c67679bf24af07 +folderAsset: yes +timeCreated: 1468686465 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Resources/TestGameObjectPrefab.prefab b/Assets/LuaFramework/Resources/TestGameObjectPrefab.prefab new file mode 100644 index 0000000000000000000000000000000000000000..4deb343f932e4af793eba88669ba42162498d4da --- /dev/null +++ b/Assets/LuaFramework/Resources/TestGameObjectPrefab.prefab @@ -0,0 +1,40 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &180150 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 4: {fileID: 433712} + m_Layer: 0 + m_Name: TestGameObjectPrefab + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &433712 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 180150} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 180150} + m_IsPrefabParent: 1 diff --git a/Assets/LuaFramework/Resources/TestGameObjectPrefab.prefab.meta b/Assets/LuaFramework/Resources/TestGameObjectPrefab.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..7638737d3990f73624fb757d180bead6aab72479 --- /dev/null +++ b/Assets/LuaFramework/Resources/TestGameObjectPrefab.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 064ce7f9fcc2fba4a885cc163c7354df +timeCreated: 1468686469 +licenseType: Pro +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Scripts.meta b/Assets/LuaFramework/Scripts.meta new file mode 100644 index 0000000000000000000000000000000000000000..de39ff6cfe97d4a05038a238532d884944d69fb7 --- /dev/null +++ b/Assets/LuaFramework/Scripts.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 340bca7100420314d8cde6bde4e69bf6 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Scripts/Common.meta b/Assets/LuaFramework/Scripts/Common.meta new file mode 100644 index 0000000000000000000000000000000000000000..da54251ca2b15cc083ad97fac8a190b05148b19a --- /dev/null +++ b/Assets/LuaFramework/Scripts/Common.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: c0489f1f062fbaa428bd858ee3b0dfad +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Scripts/Common/LuaLoader.cs b/Assets/LuaFramework/Scripts/Common/LuaLoader.cs new file mode 100644 index 0000000000000000000000000000000000000000..41f0b3bc124c7753d42dca714ae4581755bc574a --- /dev/null +++ b/Assets/LuaFramework/Scripts/Common/LuaLoader.cs @@ -0,0 +1,105 @@ +锘縰sing UnityEngine; +using System.Collections.Generic; +using System.IO; +using LuaInterface; + +namespace LuaFramework +{ + /// + /// 闆嗘垚鑷狶uaFileUtils锛岄噸鍐欓噷闈㈢殑ReadFile锛 + /// + public class LuaLoader : LuaFileUtils + { + public LuaLoader() + { + instance = this; + beZip = AppConst.LuaBundleMode; + } + + /// + /// 娣诲姞鎵撳叆Lua浠g爜鐨凙ssetBundle + /// + public void AddBundle(AssetBundle bundle) + { + if (null != bundle) + { + luaBundleList.Add(bundle); + GameLogger.Log("LuaLoader.AddBundle: " + bundle.name); + } + } + + /// + /// 褰揕uaVM鍔犺浇Lua鏂囦欢鐨勬椂鍊欙紝杩欓噷灏变細琚皟鐢紝 + /// 鐢ㄦ埛鍙互鑷畾涔夊姞杞借涓猴紝鍙杩斿洖byte[]鍗冲彲銆 + /// + /// + /// + public override byte[] ReadFile(string fileName) + { + if (!beZip) + { + string path = FindFile(fileName); + byte[] str = null; + + if (!string.IsNullOrEmpty(path) && File.Exists(path)) + { +#if !UNITY_WEBPLAYER + str = File.ReadAllBytes(path); +#else + throw new LuaException("can't run in web platform, please switch to other platform"); +#endif + } + + return str; + } + else + { + return ReadBytesFromAssetBundle(fileName); + } + } + + + /// + /// 浠嶢ssetBundle璇诲彇lua浠g爜 + /// + /// lua鑴氭湰鍚 + /// + private byte[] ReadBytesFromAssetBundle(string fileName) + { + fileName = "assets/luabundle/" + fileName; + + TextAsset luaCode = null; + for (int i = 0, cnt = luaBundleList.Count; i < cnt; ++i) + { + var bundle = luaBundleList[i]; + luaCode = bundle.LoadAsset(fileName + ".bytes"); + if (null != luaCode) + break; + else + { + // require杩囨潵鐨勬病鏈.lua鍚庣紑 + var extension = Path.GetExtension(fileName); + if (string.IsNullOrEmpty(extension)) + { + luaCode = bundle.LoadAsset(fileName + ".lua.bytes"); + if (null != luaCode) + break; + } + } + } + if (null != luaCode) + { + // 鍥犱负鎵揕ua AssetBundle涔嬪墠瀵筶ua鑴氭湰鍋氫簡鍔犲瘑锛屾墍浠ヨ繖閲岄渶瑕佽繘琛岃В瀵 + var butes = AESEncrypt.Decrypt(luaCode.bytes); + return butes; + } + else + { + Debug.LogError("LuaFileUtils.ReadBytesFromAssetBundle Error, null == luaCode, fileName:" + fileName); + return null; + } + } + + private List luaBundleList = new List(); + } +} \ No newline at end of file diff --git a/Assets/LuaFramework/Scripts/Common/LuaLoader.cs.meta b/Assets/LuaFramework/Scripts/Common/LuaLoader.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..fc3badd11b21d1657b487bb1cdb728ad41f6f2bd --- /dev/null +++ b/Assets/LuaFramework/Scripts/Common/LuaLoader.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 317fe630a9afeed49987f352e46b52af +timeCreated: 1453126595 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Scripts/ConstDefine.meta b/Assets/LuaFramework/Scripts/ConstDefine.meta new file mode 100644 index 0000000000000000000000000000000000000000..7b0e98dfa002773daa49d9282e78b93bd2bde9cd --- /dev/null +++ b/Assets/LuaFramework/Scripts/ConstDefine.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: e2e8945a11cc58147a755808392f6134 +folderAsset: yes +timeCreated: 1436458259 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Scripts/ConstDefine/AppConst.cs b/Assets/LuaFramework/Scripts/ConstDefine/AppConst.cs new file mode 100644 index 0000000000000000000000000000000000000000..ce76e94ee9518c828325df6c182184065e3239cd --- /dev/null +++ b/Assets/LuaFramework/Scripts/ConstDefine/AppConst.cs @@ -0,0 +1,36 @@ +锘縰sing UnityEngine; + +namespace LuaFramework +{ + public class AppConst + { +#if UNITY_EDITOR + // Lua浠g爜AssetBundle妯″紡 + public const bool LuaBundleMode = false; +#else + public const bool LuaBundleMode = true; +#endif + // 娓告垙甯ч + public const int GameFrameRate = 30; + + + // 绱犳潗鐩綍 + public const string AssetDir = "StreamingAssets"; + + // Web鏈嶅姟鍣ㄥ湴鍧锛岀敤浜庣儹鏇 + public const string WebUrl = "http://localhost:7890/"; + + // 娓告垙鏈嶅姟鍣↖P + public const string SocketAddress = ""; + // 娓告垙鏈嶅姟鍣ㄧ鍙 + public const int SocketPort = 0; + + public static string FrameworkRoot + { + get + { + return Application.dataPath + "/LuaFramework"; + } + } + } +} \ No newline at end of file diff --git a/Assets/LuaFramework/Scripts/ConstDefine/AppConst.cs.meta b/Assets/LuaFramework/Scripts/ConstDefine/AppConst.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..5eb271cc6d9dd26ac7958fb1308117f0420ac632 --- /dev/null +++ b/Assets/LuaFramework/Scripts/ConstDefine/AppConst.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1f38ff056ec61eb45b45be6237f94dfc +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/Scripts/ConstDefine/ManagerName.cs b/Assets/LuaFramework/Scripts/ConstDefine/ManagerName.cs new file mode 100644 index 0000000000000000000000000000000000000000..972c67275530321198faac2c857cdde65b9a1adb --- /dev/null +++ b/Assets/LuaFramework/Scripts/ConstDefine/ManagerName.cs @@ -0,0 +1,16 @@ +锘縰sing UnityEngine; +using System.Collections; + +namespace LuaFramework { + public class ManagerName { + public const string Lua = "LuaManager"; + public const string Game = "GameManager"; + public const string Timer = "TimeManager"; + public const string Sound = "SoundManager"; + public const string Panel = "PanelManager"; + public const string Network = "NetworkManager"; + public const string Resource = "ResourceManager"; + public const string Thread = "ThreadManager"; + public const string ObjectPool = "ObjectPoolManager"; + } +} \ No newline at end of file diff --git a/Assets/LuaFramework/Scripts/ConstDefine/ManagerName.cs.meta b/Assets/LuaFramework/Scripts/ConstDefine/ManagerName.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..d5e865d82cd6bbdefdfbc36c48231331a3610479 --- /dev/null +++ b/Assets/LuaFramework/Scripts/ConstDefine/ManagerName.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 346265bf4db1f3d4fa1bef253c5e7d07 +timeCreated: 1436458376 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Scripts/ConstDefine/NotiConst.cs b/Assets/LuaFramework/Scripts/ConstDefine/NotiConst.cs new file mode 100644 index 0000000000000000000000000000000000000000..2ad90702026dea9950e836303d7d5fdf89598e2e --- /dev/null +++ b/Assets/LuaFramework/Scripts/ConstDefine/NotiConst.cs @@ -0,0 +1,19 @@ +锘縰sing UnityEngine; +using System.Collections; + +public class NotiConst +{ + /// + /// Controller灞傛秷鎭氱煡 + /// + public const string START_UP = "StartUp"; //鍚姩妗嗘灦 + public const string DISPATCH_MESSAGE = "DispatchMessage"; //娲惧彂淇℃伅 + + /// + /// View灞傛秷鎭氱煡 + /// + public const string UPDATE_MESSAGE = "UpdateMessage"; //鏇存柊娑堟伅 + public const string UPDATE_EXTRACT = "UpdateExtract"; //鏇存柊瑙e寘 + public const string UPDATE_DOWNLOAD = "UpdateDownload"; //鏇存柊涓嬭浇 + public const string UPDATE_PROGRESS = "UpdateProgress"; //鏇存柊杩涘害 +} diff --git a/Assets/LuaFramework/Scripts/ConstDefine/NotiConst.cs.meta b/Assets/LuaFramework/Scripts/ConstDefine/NotiConst.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..7afc65e034fdea6d89b697921c2810c633aa4c11 --- /dev/null +++ b/Assets/LuaFramework/Scripts/ConstDefine/NotiConst.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c25f0bc8fa002704f89822240c642a30 +timeCreated: 1436458367 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Scripts/Controller.meta b/Assets/LuaFramework/Scripts/Controller.meta new file mode 100644 index 0000000000000000000000000000000000000000..374ae4d19e0a8ff3f8c2f9fe6c6e3951c6898fb2 --- /dev/null +++ b/Assets/LuaFramework/Scripts/Controller.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 5e19e94e26010ef4b8a1b38bdc32036a +folderAsset: yes +timeCreated: 1436458507 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Scripts/Controller/Command.meta b/Assets/LuaFramework/Scripts/Controller/Command.meta new file mode 100644 index 0000000000000000000000000000000000000000..e60623ac1cd20e4ceca3e4fef11efe5c4738790d --- /dev/null +++ b/Assets/LuaFramework/Scripts/Controller/Command.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 630be41b40e25154caf419024c9da88c +folderAsset: yes +timeCreated: 1440243851 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Scripts/Controller/Command/SocketCommand.cs b/Assets/LuaFramework/Scripts/Controller/Command/SocketCommand.cs new file mode 100644 index 0000000000000000000000000000000000000000..6844b107f84efdb407369116bfc852e9990d1d4c --- /dev/null +++ b/Assets/LuaFramework/Scripts/Controller/Command/SocketCommand.cs @@ -0,0 +1,16 @@ +锘縰sing UnityEngine; +using System.Collections; +using System.Collections.Generic; +using LuaFramework; + +public class SocketCommand : ControllerCommand { + + public override void Execute(IMessage message) { + object data = message.Body; + if (data == null) return; + KeyValuePair buffer = (KeyValuePair)data; + switch (buffer.Key) { + default: Util.CallMethod("Network", "OnSocket", buffer.Key, buffer.Value); break; + } + } +} diff --git a/Assets/LuaFramework/Scripts/Controller/Command/SocketCommand.cs.meta b/Assets/LuaFramework/Scripts/Controller/Command/SocketCommand.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..f544f8d23dee4d63634bf6398d62e0fa2810ab6d --- /dev/null +++ b/Assets/LuaFramework/Scripts/Controller/Command/SocketCommand.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2384cc1ec84c1674793c84b948d36fe8 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/Scripts/Controller/Command/StartUpCommand.cs b/Assets/LuaFramework/Scripts/Controller/Command/StartUpCommand.cs new file mode 100644 index 0000000000000000000000000000000000000000..7a195d5e6169282cd4d8c37d688d9ceb2a500f70 --- /dev/null +++ b/Assets/LuaFramework/Scripts/Controller/Command/StartUpCommand.cs @@ -0,0 +1,19 @@ +锘//using UnityEngine; +//using System.Collections; +//using LuaFramework; + +//public class StartUpCommand : ControllerCommand { + +// public override void Execute(IMessage message) { + +// LuaInterface.LuaFileUtils.Instance.Init(); + +// //-----------------鍏宠仈鍛戒护----------------------- +// AppFacade.Instance.RegisterCommand(NotiConst.DISPATCH_MESSAGE, typeof(SocketCommand)); + +// //-----------------鍒濆鍖栫鐞嗗櫒----------------------- +// AppFacade.Instance.AddManager(ManagerName.Lua); +// AppFacade.Instance.AddManager(ManagerName.Network); +// AppFacade.Instance.AddManager(ManagerName.Game); +// } +//} \ No newline at end of file diff --git a/Assets/LuaFramework/Scripts/Controller/Command/StartUpCommand.cs.meta b/Assets/LuaFramework/Scripts/Controller/Command/StartUpCommand.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..9cf67ce241490a3a60b177a4f4704d253c572d47 --- /dev/null +++ b/Assets/LuaFramework/Scripts/Controller/Command/StartUpCommand.cs.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 38eead90304f29a46aa58db16836d3db +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Scripts/Framework.meta b/Assets/LuaFramework/Scripts/Framework.meta new file mode 100644 index 0000000000000000000000000000000000000000..ea7388695e4de87f5aabd2d26ba49a440db3c9f8 --- /dev/null +++ b/Assets/LuaFramework/Scripts/Framework.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 000f913f7e6e2c843a8d39a9ec62d97d +folderAsset: yes +timeCreated: 1440243700 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Scripts/Framework/AppFacade.cs b/Assets/LuaFramework/Scripts/Framework/AppFacade.cs new file mode 100644 index 0000000000000000000000000000000000000000..1f1a98f44e5fa5d915b7f43712a4923394bbe52e --- /dev/null +++ b/Assets/LuaFramework/Scripts/Framework/AppFacade.cs @@ -0,0 +1,49 @@ +锘縰sing UnityEngine; +using System; +using System.Collections; +using System.Collections.Generic; +using LuaFramework; + +public class AppFacade : Facade +{ + private static AppFacade _instance; + + public AppFacade() : base() + { + } + + public static AppFacade Instance + { + get + { + if (_instance == null) + { + _instance = new AppFacade(); + } + return _instance; + } + } + + override protected void InitFramework() + { + base.InitFramework(); + } + + /// + /// 鍚姩妗嗘灦 + /// + public void StartUp() + { + + + //-----------------鍏宠仈鍛戒护----------------------- + RegisterCommand(NotiConst.DISPATCH_MESSAGE, typeof(SocketCommand)); + + //-----------------鍒濆鍖栫鐞嗗櫒----------------------- + AddManager(ManagerName.Lua); + AddManager(ManagerName.Network); + AddManager(ManagerName.Game); + } +} + + diff --git a/Assets/LuaFramework/Scripts/Framework/AppFacade.cs.meta b/Assets/LuaFramework/Scripts/Framework/AppFacade.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..ee3194ffe67b10db2f62e2c12741b228a98ce69d --- /dev/null +++ b/Assets/LuaFramework/Scripts/Framework/AppFacade.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 53fd5affad4061d4d9511214b25daeb8 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/Scripts/Framework/Core.meta b/Assets/LuaFramework/Scripts/Framework/Core.meta new file mode 100644 index 0000000000000000000000000000000000000000..9f16f2fdf6510b4a4b14ec5f0370b0ede8b256ba --- /dev/null +++ b/Assets/LuaFramework/Scripts/Framework/Core.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: bd800a5c26e3e3142877a63571edbf0c +folderAsset: yes +timeCreated: 1435850375 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Scripts/Framework/Core/Base.cs b/Assets/LuaFramework/Scripts/Framework/Core/Base.cs new file mode 100644 index 0000000000000000000000000000000000000000..ce4ea3597ea4a4680d6acc10d759c3e9284c552f --- /dev/null +++ b/Assets/LuaFramework/Scripts/Framework/Core/Base.cs @@ -0,0 +1,60 @@ +锘縰sing UnityEngine; +using System.Collections; +using LuaFramework; +using System.Collections.Generic; + +public class Base : MonoBehaviour { + private AppFacade m_Facade; + private LuaManager m_LuaMgr; + + private NetworkManager m_NetMgr; + + + /// + /// 娉ㄥ唽娑堟伅 + /// + /// + /// + protected void RegisterMessage(IView view, List messages) { + if (messages == null || messages.Count == 0) return; + Controller.Instance.RegisterViewCommand(view, messages.ToArray()); + } + + /// + /// 绉婚櫎娑堟伅 + /// + /// + /// + protected void RemoveMessage(IView view, List messages) { + if (messages == null || messages.Count == 0) return; + Controller.Instance.RemoveViewCommand(view, messages.ToArray()); + } + + protected AppFacade facade { + get { + if (m_Facade == null) { + m_Facade = AppFacade.Instance; + } + return m_Facade; + } + } + + protected LuaManager LuaManager { + get { + if (m_LuaMgr == null) { + m_LuaMgr = facade.GetManager(ManagerName.Lua); + } + return m_LuaMgr; + } + } + + + protected NetworkManager NetManager { + get { + if (m_NetMgr == null) { + m_NetMgr = facade.GetManager(ManagerName.Network); + } + return m_NetMgr; + } + } +} diff --git a/Assets/LuaFramework/Scripts/Framework/Core/Base.cs.meta b/Assets/LuaFramework/Scripts/Framework/Core/Base.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..322482cb5300030b561cac68f954a6bf2108a28b --- /dev/null +++ b/Assets/LuaFramework/Scripts/Framework/Core/Base.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 323d5ecb296d22b48979e529d041e70d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/Scripts/Framework/Core/Controller.cs b/Assets/LuaFramework/Scripts/Framework/Core/Controller.cs new file mode 100644 index 0000000000000000000000000000000000000000..f6b7fa595c7b3468cca529d3cbe36018d5eaa85f --- /dev/null +++ b/Assets/LuaFramework/Scripts/Framework/Core/Controller.cs @@ -0,0 +1,118 @@ +锘/* + LuaFramework Code By Jarjin lee +*/ + +using System; +using System.Collections.Generic; + +public class Controller : IController { + protected IDictionary m_commandMap; + protected IDictionary> m_viewCmdMap; + + protected static volatile IController m_instance; + protected readonly object m_syncRoot = new object(); + protected static readonly object m_staticSyncRoot = new object(); + + protected Controller() { + InitializeController(); + } + + static Controller() { + } + + public static IController Instance { + get { + if (m_instance == null) { + lock (m_staticSyncRoot) { + if (m_instance == null) m_instance = new Controller(); + } + } + return m_instance; + } + } + + protected virtual void InitializeController() { + m_commandMap = new Dictionary(); + m_viewCmdMap = new Dictionary>(); + } + + public virtual void ExecuteCommand(IMessage note) { + Type commandType = null; + List views = null; + lock (m_syncRoot) { + if (m_commandMap.ContainsKey(note.Name)) { + commandType = m_commandMap[note.Name]; + } else { + views = new List(); + foreach (var de in m_viewCmdMap) { + if (de.Value.Contains(note.Name)) { + views.Add(de.Key); + } + } + } + } + if (commandType != null) { //Controller + object commandInstance = Activator.CreateInstance(commandType); + if (commandInstance is ICommand) { + ((ICommand)commandInstance).Execute(note); + } + } + if (views != null && views.Count > 0) { + for (int i = 0; i < views.Count; i++) { + views[i].OnMessage(note); + } + views = null; + } + } + + public virtual void RegisterCommand(string commandName, Type commandType) { + lock (m_syncRoot) { + m_commandMap[commandName] = commandType; + } + } + + public virtual void RegisterViewCommand(IView view, string[] commandNames) { + lock (m_syncRoot) { + if (m_viewCmdMap.ContainsKey(view)) { + List list = null; + if (m_viewCmdMap.TryGetValue(view, out list)) { + for (int i = 0; i < commandNames.Length; i++) { + if (list.Contains(commandNames[i])) continue; + list.Add(commandNames[i]); + } + } + } else { + m_viewCmdMap.Add(view, new List(commandNames)); + } + } + } + + public virtual bool HasCommand(string commandName) { + lock (m_syncRoot) { + return m_commandMap.ContainsKey(commandName); + } + } + + public virtual void RemoveCommand(string commandName) { + lock (m_syncRoot) { + if (m_commandMap.ContainsKey(commandName)) { + m_commandMap.Remove(commandName); + } + } + } + + public virtual void RemoveViewCommand(IView view, string[] commandNames) { + lock (m_syncRoot) { + if (m_viewCmdMap.ContainsKey(view)) { + List list = null; + if (m_viewCmdMap.TryGetValue(view, out list)) { + for (int i = 0; i < commandNames.Length; i++) { + if (!list.Contains(commandNames[i])) continue; + list.Remove(commandNames[i]); + } + } + } + } + } +} + diff --git a/Assets/LuaFramework/Scripts/Framework/Core/Controller.cs.meta b/Assets/LuaFramework/Scripts/Framework/Core/Controller.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..2042feccceeb5404e2397293faac28f2893fc574 --- /dev/null +++ b/Assets/LuaFramework/Scripts/Framework/Core/Controller.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 01d871bede794c34784a5d6fddf1b208 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/Scripts/Framework/Core/Facade.cs b/Assets/LuaFramework/Scripts/Framework/Core/Facade.cs new file mode 100644 index 0000000000000000000000000000000000000000..acb9751bee356163d784f19d8aefb613f984f2db --- /dev/null +++ b/Assets/LuaFramework/Scripts/Framework/Core/Facade.cs @@ -0,0 +1,119 @@ +锘/* + LuaFramework Code By Jarjin lee +*/ + +using System; +using System.Collections.Generic; +using UnityEngine; + +/// +/// 浜嬩欢鍛戒护 +/// +public class ControllerCommand : ICommand { + public virtual void Execute(IMessage message) { + } +} + +public class Facade { + protected IController m_controller; + static GameObject m_GameManager; + static Dictionary m_Managers = new Dictionary(); + + GameObject AppGameManager { + get { + if (m_GameManager == null) { + m_GameManager = GameObject.Find("GameManager"); + } + return m_GameManager; + } + } + + protected Facade() { + InitFramework(); + } + protected virtual void InitFramework() { + if (m_controller != null) return; + m_controller = Controller.Instance; + } + + public virtual void RegisterCommand(string commandName, Type commandType) { + m_controller.RegisterCommand(commandName, commandType); + } + + public virtual void RemoveCommand(string commandName) { + m_controller.RemoveCommand(commandName); + } + + public virtual bool HasCommand(string commandName) { + return m_controller.HasCommand(commandName); + } + + public void RegisterMultiCommand(Type commandType, params string[] commandNames) { + int count = commandNames.Length; + for (int i = 0; i < count; i++) { + RegisterCommand(commandNames[i], commandType); + } + } + + public void RemoveMultiCommand(params string[] commandName) { + int count = commandName.Length; + for (int i = 0; i < count; i++) { + RemoveCommand(commandName[i]); + } + } + + public void SendMessageCommand(string message, object body = null) { + m_controller.ExecuteCommand(new Message(message, body)); + } + + /// + /// 娣诲姞绠$悊鍣 + /// + public void AddManager(string typeName, object obj) { + if (!m_Managers.ContainsKey(typeName)) { + m_Managers.Add(typeName, obj); + } + } + + /// + /// 娣诲姞Unity瀵硅薄 + /// + public T AddManager(string typeName) where T : Component { + object result = null; + m_Managers.TryGetValue(typeName, out result); + if (result != null) { + return (T)result; + } + Component c = AppGameManager.AddComponent(); + m_Managers.Add(typeName, c); + return default(T); + } + + /// + /// 鑾峰彇绯荤粺绠$悊鍣 + /// + public T GetManager(string typeName) where T : class { + if (!m_Managers.ContainsKey(typeName)) { + return default(T); + } + object manager = null; + m_Managers.TryGetValue(typeName, out manager); + return (T)manager; + } + + /// + /// 鍒犻櫎绠$悊鍣 + /// + public void RemoveManager(string typeName) { + if (!m_Managers.ContainsKey(typeName)) { + return; + } + object manager = null; + m_Managers.TryGetValue(typeName, out manager); + Type type = manager.GetType(); + if (type.IsSubclassOf(typeof(MonoBehaviour))) { + GameObject.Destroy((Component)manager); + } + m_Managers.Remove(typeName); + } +} diff --git a/Assets/LuaFramework/Scripts/Framework/Core/Facade.cs.meta b/Assets/LuaFramework/Scripts/Framework/Core/Facade.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..3d27826d88d6885d9f39819850716c32150fe754 --- /dev/null +++ b/Assets/LuaFramework/Scripts/Framework/Core/Facade.cs.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 08b887f792736bc47b499a0836c9d0b4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Scripts/Framework/Core/Manager.cs b/Assets/LuaFramework/Scripts/Framework/Core/Manager.cs new file mode 100644 index 0000000000000000000000000000000000000000..2b1e3b381e2dabe6a8fc20fba48d1e3b0eabee2c --- /dev/null +++ b/Assets/LuaFramework/Scripts/Framework/Core/Manager.cs @@ -0,0 +1,16 @@ +锘縰sing UnityEngine; +using System.Collections; +using LuaFramework; + +public class Manager : Base, IManager { + + // Use this for initialization + void Start () { + + } + + // Update is called once per frame + void Update () { + + } +} diff --git a/Assets/LuaFramework/Scripts/Framework/Core/Manager.cs.meta b/Assets/LuaFramework/Scripts/Framework/Core/Manager.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..15b023d9fda394d63f65afd8f4547f1499cb7d9f --- /dev/null +++ b/Assets/LuaFramework/Scripts/Framework/Core/Manager.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7c71b17dd8e0c314fb7b2465e5717b5e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/Scripts/Framework/Core/Message.cs b/Assets/LuaFramework/Scripts/Framework/Core/Message.cs new file mode 100644 index 0000000000000000000000000000000000000000..cec5b403ee6ec3aaac3b32039846e5843372721f --- /dev/null +++ b/Assets/LuaFramework/Scripts/Framework/Core/Message.cs @@ -0,0 +1,94 @@ +锘/* + LuaFramework Code By Jarjin lee +*/ + +using System; +public class Message : IMessage +{ + public Message(string name) + : this(name, null, null) + { } + + public Message(string name, object body) + : this(name, body, null) + { } + + public Message(string name, object body, string type) + { + m_name = name; + m_body = body; + m_type = type; + } + + /// + /// Get the string representation of the Notification instance + /// + /// The string representation of the Notification instance + public override string ToString() + { + string msg = "Notification Name: " + Name; + msg += "\nBody:" + ((Body == null) ? "null" : Body.ToString()); + msg += "\nType:" + ((Type == null) ? "null" : Type); + return msg; + } + + /// + /// The name of the Notification instance + /// + public virtual string Name + { + get { return m_name; } + } + + /// + /// The body of the Notification instance + /// + /// This accessor is thread safe + public virtual object Body + { + get + { + // Setting and getting of reference types is atomic, no need to lock here + return m_body; + } + set + { + // Setting and getting of reference types is atomic, no need to lock here + m_body = value; + } + } + + /// + /// The type of the Notification instance + /// + /// This accessor is thread safe + public virtual string Type + { + get + { + // Setting and getting of reference types is atomic, no need to lock here + return m_type; + } + set + { + // Setting and getting of reference types is atomic, no need to lock here + m_type = value; + } + } + + /// + /// The name of the notification instance + /// + private string m_name; + + /// + /// The type of the notification instance + /// + private string m_type; + + /// + /// The body of the notification instance + /// + private object m_body; +} + diff --git a/Assets/LuaFramework/Scripts/Framework/Core/Message.cs.meta b/Assets/LuaFramework/Scripts/Framework/Core/Message.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..269714e097856d1ae3933dc25dffe53344cd92d6 --- /dev/null +++ b/Assets/LuaFramework/Scripts/Framework/Core/Message.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7c43b926e665fea43b8b5f49e21fecb8 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/Scripts/Framework/Core/View.cs b/Assets/LuaFramework/Scripts/Framework/Core/View.cs new file mode 100644 index 0000000000000000000000000000000000000000..c81ac17b1807789ba0a7b6ff6446b4a042e60fe2 --- /dev/null +++ b/Assets/LuaFramework/Scripts/Framework/Core/View.cs @@ -0,0 +1,11 @@ +锘縰sing UnityEngine; +using System; +using System.Collections; +using System.Collections.Generic; +using LuaInterface; +using LuaFramework; + +public class View : Base, IView { + public virtual void OnMessage(IMessage message) { + } +} diff --git a/Assets/LuaFramework/Scripts/Framework/Core/View.cs.meta b/Assets/LuaFramework/Scripts/Framework/Core/View.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..4428aff2fd74c18ea1cc78c34396f65b47788058 --- /dev/null +++ b/Assets/LuaFramework/Scripts/Framework/Core/View.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 65cb27367c0951e4abc2cbfe1a5a6e08 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/Scripts/Framework/Interfaces.meta b/Assets/LuaFramework/Scripts/Framework/Interfaces.meta new file mode 100644 index 0000000000000000000000000000000000000000..1fecd3d9b47cdd2d8bd0a9a3277a2b94d088986a --- /dev/null +++ b/Assets/LuaFramework/Scripts/Framework/Interfaces.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: e48e7668a3d5a9640ac68b6e9efca1d6 +folderAsset: yes +timeCreated: 1435850375 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Scripts/Framework/Interfaces/ICommand.cs b/Assets/LuaFramework/Scripts/Framework/Interfaces/ICommand.cs new file mode 100644 index 0000000000000000000000000000000000000000..41d54be5aa92899de45ecbcbe15f62b73cf92023 --- /dev/null +++ b/Assets/LuaFramework/Scripts/Framework/Interfaces/ICommand.cs @@ -0,0 +1,9 @@ +锘/* + LuaFramework Code By Jarjin lee +*/ +using System; + +public interface ICommand { + void Execute(IMessage message); +} + diff --git a/Assets/LuaFramework/Scripts/Framework/Interfaces/ICommand.cs.meta b/Assets/LuaFramework/Scripts/Framework/Interfaces/ICommand.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..322e7768a63430480cfc2772e2589b5a73e1f56c --- /dev/null +++ b/Assets/LuaFramework/Scripts/Framework/Interfaces/ICommand.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d75586fb8a8da2a448f5d672f6874890 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/Scripts/Framework/Interfaces/IController.cs b/Assets/LuaFramework/Scripts/Framework/Interfaces/IController.cs new file mode 100644 index 0000000000000000000000000000000000000000..63b2b927695033c29e8b1ab1b1e0627048547db2 --- /dev/null +++ b/Assets/LuaFramework/Scripts/Framework/Interfaces/IController.cs @@ -0,0 +1,18 @@ +锘/* + LuaFramework Code By Jarjin leeibution 3.0 License +*/ +using System; +using System.Collections.Generic; + +public interface IController +{ + void RegisterCommand(string messageName, Type commandType); + void RegisterViewCommand(IView view, string[] commandNames); + + void ExecuteCommand(IMessage message); + + void RemoveCommand(string messageName); + void RemoveViewCommand(IView view, string[] commandNames); + + bool HasCommand(string messageName); +} diff --git a/Assets/LuaFramework/Scripts/Framework/Interfaces/IController.cs.meta b/Assets/LuaFramework/Scripts/Framework/Interfaces/IController.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..31f965502e636fb6126585e603e2ede3f22e5517 --- /dev/null +++ b/Assets/LuaFramework/Scripts/Framework/Interfaces/IController.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f886f4c4b7344b8458ade2117e91bf4f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/Scripts/Framework/Interfaces/IManager.cs b/Assets/LuaFramework/Scripts/Framework/Interfaces/IManager.cs new file mode 100644 index 0000000000000000000000000000000000000000..89b2944af8cb338659ece0b60281a5d834af5ffe --- /dev/null +++ b/Assets/LuaFramework/Scripts/Framework/Interfaces/IManager.cs @@ -0,0 +1,9 @@ +锘/* + LuaFramework Code By Jarjin leeibution 3.0 License +*/ + +using UnityEngine; +using System.Collections; + +public interface IManager { +} diff --git a/Assets/LuaFramework/Scripts/Framework/Interfaces/IManager.cs.meta b/Assets/LuaFramework/Scripts/Framework/Interfaces/IManager.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..65c10e34c3f2bb688d2fcd1b277e73429924b463 --- /dev/null +++ b/Assets/LuaFramework/Scripts/Framework/Interfaces/IManager.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d635b206a771bcf4ea52409f19424fb8 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/Scripts/Framework/Interfaces/IMessage.cs b/Assets/LuaFramework/Scripts/Framework/Interfaces/IMessage.cs new file mode 100644 index 0000000000000000000000000000000000000000..ca0207cba4b37d8ff4d19e7e23678ee707f787bd --- /dev/null +++ b/Assets/LuaFramework/Scripts/Framework/Interfaces/IMessage.cs @@ -0,0 +1,16 @@ +锘/* + LuaFramework Code By Jarjin lee +*/ +using System; + +public interface IMessage +{ + string Name { get; } + + object Body { get; set; } + + string Type { get; set; } + + string ToString(); +} + diff --git a/Assets/LuaFramework/Scripts/Framework/Interfaces/IMessage.cs.meta b/Assets/LuaFramework/Scripts/Framework/Interfaces/IMessage.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..bd552852a81c25dc60b874635e3682f0986381f1 --- /dev/null +++ b/Assets/LuaFramework/Scripts/Framework/Interfaces/IMessage.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c8a6705483eabb541bd34cb568a0abee +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/Scripts/Framework/Interfaces/IView.cs b/Assets/LuaFramework/Scripts/Framework/Interfaces/IView.cs new file mode 100644 index 0000000000000000000000000000000000000000..254ad243b901b9fff45dc7880bf11d659da9b761 --- /dev/null +++ b/Assets/LuaFramework/Scripts/Framework/Interfaces/IView.cs @@ -0,0 +1,5 @@ +锘縰sing System; + +public interface IView { + void OnMessage(IMessage message); +} diff --git a/Assets/LuaFramework/Scripts/Framework/Interfaces/IView.cs.meta b/Assets/LuaFramework/Scripts/Framework/Interfaces/IView.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..9f0d0d60a4da30ba781e823f00bda2f2c5fa1c79 --- /dev/null +++ b/Assets/LuaFramework/Scripts/Framework/Interfaces/IView.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fec82531236c5aa4bb957279a5a05fb6 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/Scripts/Manager.meta b/Assets/LuaFramework/Scripts/Manager.meta new file mode 100644 index 0000000000000000000000000000000000000000..05bc0d3ffce0752ba0f7bda39bca681b10cbc430 --- /dev/null +++ b/Assets/LuaFramework/Scripts/Manager.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 3e037ccb531438b498940c40edb54326 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Scripts/Manager/GameManager.cs b/Assets/LuaFramework/Scripts/Manager/GameManager.cs new file mode 100644 index 0000000000000000000000000000000000000000..4b0e7ab11b4c9aaba1ca3888d8441d19beb46fdf --- /dev/null +++ b/Assets/LuaFramework/Scripts/Manager/GameManager.cs @@ -0,0 +1,63 @@ +锘縰sing UnityEngine; +using System.Collections.Generic; +using LuaInterface; + + + +namespace LuaFramework +{ + public class GameManager : Manager + { + protected static bool initialize = false; + private List downloadFiles = new List(); + + /// + /// 鍒濆鍖栨父鎴忕鐞嗗櫒 + /// + void Awake() + { + Init(); + } + + /// + /// 鍒濆鍖 + /// + void Init() + { + DontDestroyOnLoad(gameObject); //闃叉閿姣佽嚜宸 + + Screen.sleepTimeout = SleepTimeout.NeverSleep; + Application.targetFrameRate = AppConst.GameFrameRate; + OnInitialize(); + } + + + void OnInitialize() + { + LuaManager.InitStart(); + LuaManager.DoFile("Logic/Game"); //鍔犺浇娓告垙 + LuaManager.DoFile("Logic/Network"); //鍔犺浇缃戠粶 + NetManager.OnInit(); //鍒濆鍖栫綉缁 + Util.CallMethod("Game", "OnInitOK"); //鍒濆鍖栧畬鎴 + + initialize = true; + } + + + /// + /// 鏋愭瀯鍑芥暟 + /// + void OnDestroy() + { + if (NetManager != null) + { + NetManager.Unload(); + } + if (LuaManager != null) + { + LuaManager.Close(); + } + Debug.Log("~GameManager was destroyed"); + } + } +} \ No newline at end of file diff --git a/Assets/LuaFramework/Scripts/Manager/GameManager.cs.meta b/Assets/LuaFramework/Scripts/Manager/GameManager.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..1e78e53a117908cce70762feab38278fa4b07009 --- /dev/null +++ b/Assets/LuaFramework/Scripts/Manager/GameManager.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b1545d35cb5d31e469cff9e3dbc576e9 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/Scripts/Manager/Interface.meta b/Assets/LuaFramework/Scripts/Manager/Interface.meta new file mode 100644 index 0000000000000000000000000000000000000000..3770a15f3640dbf7ff8feba6dcc6cb027ba0c43c --- /dev/null +++ b/Assets/LuaFramework/Scripts/Manager/Interface.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 4654f39cc1fc05b4ca5f272cc65b39a8 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Scripts/Manager/Interface/ITimerBehaviour.cs b/Assets/LuaFramework/Scripts/Manager/Interface/ITimerBehaviour.cs new file mode 100644 index 0000000000000000000000000000000000000000..9904997839cc0e758ad26ea110755db084708dfe --- /dev/null +++ b/Assets/LuaFramework/Scripts/Manager/Interface/ITimerBehaviour.cs @@ -0,0 +1,8 @@ +using System; +using System.Collections; + +namespace LuaFramework { + public interface ITimerBehaviour { + void TimerUpdate(); + } +} \ No newline at end of file diff --git a/Assets/LuaFramework/Scripts/Manager/Interface/ITimerBehaviour.cs.meta b/Assets/LuaFramework/Scripts/Manager/Interface/ITimerBehaviour.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..f008b1216a6147464c233bfa5ef12df0dbc95fca --- /dev/null +++ b/Assets/LuaFramework/Scripts/Manager/Interface/ITimerBehaviour.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fbedf5a696e61a1408b87a90afcb33f1 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/Scripts/Manager/LuaManager.cs b/Assets/LuaFramework/Scripts/Manager/LuaManager.cs new file mode 100644 index 0000000000000000000000000000000000000000..35e16e4c9e4d4eb7673656d3c2b82f79e478acad --- /dev/null +++ b/Assets/LuaFramework/Scripts/Manager/LuaManager.cs @@ -0,0 +1,121 @@ +锘縰sing UnityEngine; +using System.Collections; +using LuaInterface; + +namespace LuaFramework { + public class LuaManager : Manager { + private LuaState lua; + private LuaLoader loader; + private LuaLooper loop = null; + + // Use this for initialization + void Awake() { + loader = new LuaLoader(); + lua = new LuaState(); + this.OpenLibs(); + lua.LuaSetTop(0); + + LuaBinder.Bind(lua); + DelegateFactory.Init(); + LuaCoroutine.Register(lua, this); + } + + public void InitStart() { + InitLuaPath(); + InitLuaBundle(); + this.lua.Start(); //鍚姩LUAVM + this.StartMain(); + this.StartLooper(); + } + + void StartLooper() { + loop = gameObject.AddComponent(); + loop.luaState = lua; + } + + //cjson 姣旇緝鐗规畩锛屽彧new浜嗕竴涓猼able锛屾病鏈夋敞鍐屽簱锛岃繖閲屾敞鍐屼竴涓 + protected void OpenCJson() { + lua.LuaGetField(LuaIndexes.LUA_REGISTRYINDEX, "_LOADED"); + lua.OpenLibs(LuaDLL.luaopen_cjson); + lua.LuaSetField(-2, "cjson"); + + lua.OpenLibs(LuaDLL.luaopen_cjson_safe); + lua.LuaSetField(-2, "cjson.safe"); + } + + void StartMain() { + lua.DoFile("Main.lua"); + + LuaFunction main = lua.GetFunction("Main"); + main.Call(); + main.Dispose(); + main = null; + } + + /// + /// 鍒濆鍖栧姞杞界涓夋柟搴 + /// + void OpenLibs() { + lua.OpenLibs(LuaDLL.luaopen_pb); + lua.OpenLibs(LuaDLL.luaopen_sproto_core); + lua.OpenLibs(LuaDLL.luaopen_protobuf_c); + lua.OpenLibs(LuaDLL.luaopen_lpeg); + lua.OpenLibs(LuaDLL.luaopen_bit); + lua.OpenLibs(LuaDLL.luaopen_socket_core); + + this.OpenCJson(); + } + + /// + /// 鍒濆鍖朙ua浠g爜鍔犺浇璺緞 + /// + void InitLuaPath() + { + string rootPath = AppConst.FrameworkRoot; + lua.AddSearchPath(rootPath + "/Lua"); + lua.AddSearchPath(rootPath + "/ToLua/Lua"); + } + + /// + /// 鍒濆鍖朙uaBundle + /// + void InitLuaBundle() { + if (loader.beZip) { + loader.AddBundle(ResourceMgr.instance.GetAssetBundle("lua_update.bundle")); + loader.AddBundle(ResourceMgr.instance.GetAssetBundle("lua.bundle")); + } + } + + public void DoFile(string filename) { + lua.DoFile(filename); + } + + // Update is called once per frame + public object[] CallFunction(string funcName, params object[] args) { + LuaFunction func = lua.GetFunction(funcName); + if (func != null) { + return func.LazyCall(args); + } + return null; + } + + + public LuaFunction GetFunction(string funcName, bool logMiss = true) + { + return lua.GetFunction(funcName, logMiss); + } + + public void LuaGC() { + lua.LuaGC(LuaGCOptions.LUA_GCCOLLECT); + } + + public void Close() { + loop.Destroy(); + loop = null; + + lua.Dispose(); + lua = null; + loader = null; + } + } +} \ No newline at end of file diff --git a/Assets/LuaFramework/Scripts/Manager/LuaManager.cs.meta b/Assets/LuaFramework/Scripts/Manager/LuaManager.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..de01aef3eec02affb5a4c34b88ec2f8cfbd7a21d --- /dev/null +++ b/Assets/LuaFramework/Scripts/Manager/LuaManager.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f310fe963a737bd4c98a67be8a395ac3 +timeCreated: 1453126347 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Scripts/Manager/NetworkManager.cs b/Assets/LuaFramework/Scripts/Manager/NetworkManager.cs new file mode 100644 index 0000000000000000000000000000000000000000..884b80b34133b0245e50bb3131c1e4be29c9d4d0 --- /dev/null +++ b/Assets/LuaFramework/Scripts/Manager/NetworkManager.cs @@ -0,0 +1,102 @@ +using UnityEngine; +using System; +using System.Collections; +using System.Collections.Generic; +using LuaInterface; + +namespace LuaFramework +{ + public class NetworkManager : Manager + { + private SocketClient socket; + static readonly object m_lockObject = new object(); + static Queue> mEvents = new Queue>(); + + SocketClient SocketClient + { + get + { + if (socket == null) + socket = new SocketClient(); + return socket; + } + } + + void Awake() + { + Init(); + } + + void Init() + { + SocketClient.OnRegister(); + } + + public void OnInit() + { + CallMethod("Start"); + } + + public void Unload() + { + CallMethod("Unload"); + } + + /// + /// 执行Lua方法 + /// + public object[] CallMethod(string func, params object[] args) + { + return Util.CallMethod("Network", func, args); + } + + ///------------------------------------------------------------------------------------ + public static void AddEvent(int _event, ByteBuffer data) + { + lock (m_lockObject) + { + mEvents.Enqueue(new KeyValuePair(_event, data)); + } + } + + /// + /// 交给Command,这里不想关心发给谁。 + /// + void Update() + { + if (mEvents.Count > 0) + { + while (mEvents.Count > 0) + { + KeyValuePair _event = mEvents.Dequeue(); + facade.SendMessageCommand(NotiConst.DISPATCH_MESSAGE, _event); + } + } + } + + /// + /// 发送链接请求 + /// + public void SendConnect() + { + SocketClient.SendConnect(); + } + + /// + /// 发送SOCKET消息 + /// + public void SendMessage(ByteBuffer buffer) + { + SocketClient.SendMessage(buffer); + } + + /// + /// 析构函数 + /// + private void OnDestroy() + { + SocketClient.OnRemove(); + Debug.Log("~NetworkManager was destroy"); + } + } +} \ No newline at end of file diff --git a/Assets/LuaFramework/Scripts/Manager/NetworkManager.cs.meta b/Assets/LuaFramework/Scripts/Manager/NetworkManager.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..8d5389514d9ddf64dc6b7ca8a3f18560b9947529 --- /dev/null +++ b/Assets/LuaFramework/Scripts/Manager/NetworkManager.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 7a3394bbff8e75d4c8e1770951839b5e +timeCreated: 1436458954 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Scripts/Network.meta b/Assets/LuaFramework/Scripts/Network.meta new file mode 100644 index 0000000000000000000000000000000000000000..255c19ed517bbba6157cd7be89e60c5a112db271 --- /dev/null +++ b/Assets/LuaFramework/Scripts/Network.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 8b0e4504435d17a42a0a79938ed843e6 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Scripts/Network/ByteBuffer.cs b/Assets/LuaFramework/Scripts/Network/ByteBuffer.cs new file mode 100644 index 0000000000000000000000000000000000000000..fe311be5179d662b93e35c1ee6bf76b9962f3508 --- /dev/null +++ b/Assets/LuaFramework/Scripts/Network/ByteBuffer.cs @@ -0,0 +1,136 @@ +锘縰sing UnityEngine; +using System.Collections; +using System.IO; +using System.Text; +using System; +using LuaInterface; + +namespace LuaFramework { + public class ByteBuffer { + MemoryStream stream = null; + BinaryWriter writer = null; + BinaryReader reader = null; + + public ByteBuffer() { + stream = new MemoryStream(); + writer = new BinaryWriter(stream); + } + + public ByteBuffer(byte[] data) { + if (data != null) { + stream = new MemoryStream(data); + reader = new BinaryReader(stream); + } else { + stream = new MemoryStream(); + writer = new BinaryWriter(stream); + } + } + + public void Close() { + if (writer != null) writer.Close(); + if (reader != null) reader.Close(); + + stream.Close(); + writer = null; + reader = null; + stream = null; + } + + public void WriteByte(byte v) { + writer.Write(v); + } + + public void WriteInt(int v) { + writer.Write((int)v); + } + + public void WriteShort(ushort v) { + writer.Write((ushort)v); + } + + public void WriteLong(long v) { + writer.Write((long)v); + } + + public void WriteFloat(float v) { + byte[] temp = BitConverter.GetBytes(v); + Array.Reverse(temp); + writer.Write(BitConverter.ToSingle(temp, 0)); + } + + public void WriteDouble(double v) { + byte[] temp = BitConverter.GetBytes(v); + Array.Reverse(temp); + writer.Write(BitConverter.ToDouble(temp, 0)); + } + + public void WriteString(string v) { + byte[] bytes = Encoding.UTF8.GetBytes(v); + writer.Write((ushort)bytes.Length); + writer.Write(bytes); + } + + public void WriteBytes(byte[] v) { + writer.Write((int)v.Length); + writer.Write(v); + } + + public void WriteBuffer(LuaByteBuffer strBuffer) { + WriteBytes(strBuffer.buffer); + } + + public byte ReadByte() { + return reader.ReadByte(); + } + + public int ReadInt() { + return (int)reader.ReadInt32(); + } + + public ushort ReadShort() { + return (ushort)reader.ReadInt16(); + } + + public long ReadLong() { + return (long)reader.ReadInt64(); + } + + public float ReadFloat() { + byte[] temp = BitConverter.GetBytes(reader.ReadSingle()); + Array.Reverse(temp); + return BitConverter.ToSingle(temp, 0); + } + + public double ReadDouble() { + byte[] temp = BitConverter.GetBytes(reader.ReadDouble()); + Array.Reverse(temp); + return BitConverter.ToDouble(temp, 0); + } + + public string ReadString() { + ushort len = ReadShort(); + byte[] buffer = new byte[len]; + buffer = reader.ReadBytes(len); + return Encoding.UTF8.GetString(buffer); + } + + public byte[] ReadBytes() { + int len = ReadInt(); + return reader.ReadBytes(len); + } + + public LuaByteBuffer ReadBuffer() { + byte[] bytes = ReadBytes(); + return new LuaByteBuffer(bytes); + } + + public byte[] ToBytes() { + writer.Flush(); + return stream.ToArray(); + } + + public void Flush() { + writer.Flush(); + } + } +} \ No newline at end of file diff --git a/Assets/LuaFramework/Scripts/Network/ByteBuffer.cs.meta b/Assets/LuaFramework/Scripts/Network/ByteBuffer.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..96221b91f01f327690fdb9d0105e88fd4c5ebbb1 --- /dev/null +++ b/Assets/LuaFramework/Scripts/Network/ByteBuffer.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b2b21f02a43963a4baf3a5abd3c98ceb +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/Scripts/Network/Converter.cs b/Assets/LuaFramework/Scripts/Network/Converter.cs new file mode 100644 index 0000000000000000000000000000000000000000..fd43f02cefbb89053eef57a7c7101504e4167a7a --- /dev/null +++ b/Assets/LuaFramework/Scripts/Network/Converter.cs @@ -0,0 +1,149 @@ +锘/* +* Copyright (c) 2008 Jonathan Wagner +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +* THE SOFTWARE. +*/ + +using System; + +namespace LuaFramework { + public class Converter { + public static Int32 GetBigEndian(Int32 value) { + if (BitConverter.IsLittleEndian) { + return swapByteOrder(value); + } else { + return value; + } + } + + public static UInt16 GetBigEndian(UInt16 value) { + if (BitConverter.IsLittleEndian) { + return swapByteOrder(value); + } else { + return value; + } + } + + public static UInt32 GetBigEndian(UInt32 value) { + if (BitConverter.IsLittleEndian) { + return swapByteOrder(value); + } else { + return value; + } + } + + public static Int64 GetBigEndian(Int64 value) { + if (BitConverter.IsLittleEndian) { + return swapByteOrder(value); + } else { + return value; + } + } + + public static Double GetBigEndian(Double value) { + if (BitConverter.IsLittleEndian) { + return swapByteOrder(value); + } else { + return value; + } + } + + public static float GetBigEndian(float value) { + if (BitConverter.IsLittleEndian) { + return swapByteOrder((int)value); + + } else { + return value; + } + } + + public static Int32 GetLittleEndian(Int32 value) { + if (BitConverter.IsLittleEndian) { + return value; + } else { + return swapByteOrder(value); + } + } + + public static UInt32 GetLittleEndian(UInt32 value) { + if (BitConverter.IsLittleEndian) { + return value; + } else { + return swapByteOrder(value); + } + } + + public static UInt16 GetLittleEndian(UInt16 value) { + if (BitConverter.IsLittleEndian) { + return value; + } else { + return swapByteOrder(value); + } + } + + public static Double GetLittleEndian(Double value) { + if (BitConverter.IsLittleEndian) { + return value; + } else { + return swapByteOrder(value); + } + } + + private static Int32 swapByteOrder(Int32 value) { + Int32 swap = (Int32)((0x000000FF) & (value >> 24) + | (0x0000FF00) & (value >> 8) + | (0x00FF0000) & (value << 8) + | (0xFF000000) & (value << 24)); + return swap; + } + + private static Int64 swapByteOrder(Int64 value) { + UInt64 uvalue = (UInt64)value; + UInt64 swap = ((0x00000000000000FF) & (uvalue >> 56) + | (0x000000000000FF00) & (uvalue >> 40) + | (0x0000000000FF0000) & (uvalue >> 24) + | (0x00000000FF000000) & (uvalue >> 8) + | (0x000000FF00000000) & (uvalue << 8) + | (0x0000FF0000000000) & (uvalue << 24) + | (0x00FF000000000000) & (uvalue << 40) + | (0xFF00000000000000) & (uvalue << 56)); + + return (Int64)swap; + } + + private static UInt16 swapByteOrder(UInt16 value) { + return (UInt16)((0x00FF & (value >> 8)) + | (0xFF00 & (value << 8))); + } + + private static UInt32 swapByteOrder(UInt32 value) { + UInt32 swap = ((0x000000FF) & (value >> 24) + | (0x0000FF00) & (value >> 8) + | (0x00FF0000) & (value << 8) + | (0xFF000000) & (value << 24)); + return swap; + } + + private static Double swapByteOrder(Double value) { + Byte[] buffer = BitConverter.GetBytes(value); + Array.Reverse(buffer, 0, buffer.Length); + return BitConverter.ToDouble(buffer, 0); + } + } +} \ No newline at end of file diff --git a/Assets/LuaFramework/Scripts/Network/Converter.cs.meta b/Assets/LuaFramework/Scripts/Network/Converter.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..b476879ce5e1626720d80fc08931c237710ce9e7 --- /dev/null +++ b/Assets/LuaFramework/Scripts/Network/Converter.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1ccd07face6ebb5469d1cbed8e8b4789 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/Scripts/Network/Protocal.cs b/Assets/LuaFramework/Scripts/Network/Protocal.cs new file mode 100644 index 0000000000000000000000000000000000000000..a8075b05b101ba1a4a27ff23eea143f48cb243f0 --- /dev/null +++ b/Assets/LuaFramework/Scripts/Network/Protocal.cs @@ -0,0 +1,9 @@ + +namespace LuaFramework { + public class Protocal { + ///BUILD TABLE + public const int Connect = 101; //连接服务器 + public const int Exception = 102; //异常掉线 + public const int Disconnect = 103; //正常断线 + } +} \ No newline at end of file diff --git a/Assets/LuaFramework/Scripts/Network/Protocal.cs.meta b/Assets/LuaFramework/Scripts/Network/Protocal.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..502c0b18ac122c50a8f3f9006f808716a97413a8 --- /dev/null +++ b/Assets/LuaFramework/Scripts/Network/Protocal.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 44d57d2c5dd4548479b3cd5d47520699 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/Scripts/Network/SocketClient.cs b/Assets/LuaFramework/Scripts/Network/SocketClient.cs new file mode 100644 index 0000000000000000000000000000000000000000..199ae3905a832b36afd62381a8bea7b10c0a970e --- /dev/null +++ b/Assets/LuaFramework/Scripts/Network/SocketClient.cs @@ -0,0 +1,244 @@ +锘縰sing UnityEngine; +using System; +using System.IO; +using System.Net; +using System.Net.Sockets; +using LuaFramework; + +public enum DisType { + Exception, + Disconnect, +} + +public class SocketClient { + private TcpClient client = null; + private NetworkStream outStream = null; + private MemoryStream memStream; + private BinaryReader reader; + + private const int MAX_READ = 8192; + private byte[] byteBuffer = new byte[MAX_READ]; + public static bool loggedIn = false; + + // Use this for initialization + public SocketClient() { + } + + /// + /// 娉ㄥ唽浠g悊 + /// + public void OnRegister() { + memStream = new MemoryStream(); + reader = new BinaryReader(memStream); + } + + /// + /// 绉婚櫎浠g悊 + /// + public void OnRemove() { + this.Close(); + reader.Close(); + memStream.Close(); + } + + /// + /// 杩炴帴鏈嶅姟鍣 + /// + void ConnectServer(string host, int port) { + client = null; + try { + IPAddress[] address = Dns.GetHostAddresses(host); + if (address.Length == 0) { + Debug.LogError("host invalid"); + return; + } + if (address[0].AddressFamily == AddressFamily.InterNetworkV6) { + client = new TcpClient(AddressFamily.InterNetworkV6); + } + else { + client = new TcpClient(AddressFamily.InterNetwork); + } + client.SendTimeout = 1000; + client.ReceiveTimeout = 1000; + client.NoDelay = true; + client.BeginConnect(host, port, new AsyncCallback(OnConnect), null); + } catch (Exception e) { + Close(); Debug.LogError(e.Message); + } + } + + /// + /// 杩炴帴涓婃湇鍔″櫒 + /// + void OnConnect(IAsyncResult asr) { + outStream = client.GetStream(); + client.GetStream().BeginRead(byteBuffer, 0, MAX_READ, new AsyncCallback(OnRead), null); + NetworkManager.AddEvent(Protocal.Connect, new ByteBuffer()); + } + + /// + /// 鍐欐暟鎹 + /// + void WriteMessage(byte[] message) { + MemoryStream ms = null; + using (ms = new MemoryStream()) { + ms.Position = 0; + BinaryWriter writer = new BinaryWriter(ms); + ushort msglen = (ushort)message.Length; + writer.Write(msglen); + writer.Write(message); + writer.Flush(); + if (client != null && client.Connected) { + //NetworkStream stream = client.GetStream(); + byte[] payload = ms.ToArray(); + outStream.BeginWrite(payload, 0, payload.Length, new AsyncCallback(OnWrite), null); + } else { + Debug.LogError("client.connected----->>false"); + } + } + } + + /// + /// 璇诲彇娑堟伅 + /// + void OnRead(IAsyncResult asr) { + int bytesRead = 0; + try { + lock (client.GetStream()) { //璇诲彇瀛楄妭娴佸埌缂撳啿鍖 + bytesRead = client.GetStream().EndRead(asr); + } + if (bytesRead < 1) { //鍖呭昂瀵告湁闂锛屾柇绾垮鐞 + OnDisconnected(DisType.Disconnect, "bytesRead < 1"); + return; + } + OnReceive(byteBuffer, bytesRead); //鍒嗘瀽鏁版嵁鍖呭唴瀹癸紝鎶涚粰閫昏緫灞 + lock (client.GetStream()) { //鍒嗘瀽瀹岋紝鍐嶆鐩戝惉鏈嶅姟鍣ㄥ彂杩囨潵鐨勬柊娑堟伅 + Array.Clear(byteBuffer, 0, byteBuffer.Length); //娓呯┖鏁扮粍 + client.GetStream().BeginRead(byteBuffer, 0, MAX_READ, new AsyncCallback(OnRead), null); + } + } catch (Exception ex) { + //PrintBytes(); + OnDisconnected(DisType.Exception, ex.Message); + } + } + + /// + /// 涓㈠け閾炬帴 + /// + void OnDisconnected(DisType dis, string msg) { + Close(); //鍏虫帀瀹㈡埛绔摼鎺 + int protocal = dis == DisType.Exception ? + Protocal.Exception : Protocal.Disconnect; + + ByteBuffer buffer = new ByteBuffer(); + buffer.WriteShort((ushort)protocal); + NetworkManager.AddEvent(protocal, buffer); + Debug.LogError("Connection was closed by the server:>" + msg + " Distype:>" + dis); + } + + /// + /// 鎵撳嵃瀛楄妭 + /// + /// + void PrintBytes() { + string returnStr = string.Empty; + for (int i = 0; i < byteBuffer.Length; i++) { + returnStr += byteBuffer[i].ToString("X2"); + } + Debug.LogError(returnStr); + } + + /// + /// 鍚戦摼鎺ュ啓鍏ユ暟鎹祦 + /// + void OnWrite(IAsyncResult r) { + try { + outStream.EndWrite(r); + } catch (Exception ex) { + Debug.LogError("OnWrite--->>>" + ex.Message); + } + } + + /// + /// 鎺ユ敹鍒版秷鎭 + /// + void OnReceive(byte[] bytes, int length) { + memStream.Seek(0, SeekOrigin.End); + memStream.Write(bytes, 0, length); + //Reset to beginning + memStream.Seek(0, SeekOrigin.Begin); + while (RemainingBytes() > 2) { + ushort messageLen = reader.ReadUInt16(); + if (RemainingBytes() >= messageLen) { + MemoryStream ms = new MemoryStream(); + BinaryWriter writer = new BinaryWriter(ms); + writer.Write(reader.ReadBytes(messageLen)); + ms.Seek(0, SeekOrigin.Begin); + OnReceivedMessage(ms); + } else { + //Back up the position two bytes + memStream.Position = memStream.Position - 2; + break; + } + } + //Create a new stream with any leftover bytes + byte[] leftover = reader.ReadBytes((int)RemainingBytes()); + memStream.SetLength(0); //Clear + memStream.Write(leftover, 0, leftover.Length); + } + + /// + /// 鍓╀綑鐨勫瓧鑺 + /// + private long RemainingBytes() { + return memStream.Length - memStream.Position; + } + + /// + /// 鎺ユ敹鍒版秷鎭 + /// + /// + void OnReceivedMessage(MemoryStream ms) { + BinaryReader r = new BinaryReader(ms); + byte[] message = r.ReadBytes((int)(ms.Length - ms.Position)); + //int msglen = message.Length; + + ByteBuffer buffer = new ByteBuffer(message); + int mainId = buffer.ReadShort(); + NetworkManager.AddEvent(mainId, buffer); + } + + + /// + /// 浼氳瘽鍙戦 + /// + void SessionSend(byte[] bytes) { + WriteMessage(bytes); + } + + /// + /// 鍏抽棴閾炬帴 + /// + public void Close() { + if (client != null) { + if (client.Connected) client.Close(); + client = null; + } + loggedIn = false; + } + + /// + /// 鍙戦佽繛鎺ヨ姹 + /// + public void SendConnect() { + ConnectServer(AppConst.SocketAddress, AppConst.SocketPort); + } + + /// + /// 鍙戦佹秷鎭 + /// + public void SendMessage(ByteBuffer buffer) { + SessionSend(buffer.ToBytes()); + buffer.Close(); + } +} diff --git a/Assets/LuaFramework/Scripts/Network/SocketClient.cs.meta b/Assets/LuaFramework/Scripts/Network/SocketClient.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..81711719ee3c2cc116737c8d3a4a027751ad13a3 --- /dev/null +++ b/Assets/LuaFramework/Scripts/Network/SocketClient.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2c8a96e463bf5d74ca866ab1a04f00d2 +timeCreated: 1440243780 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Scripts/ObjectPool.meta b/Assets/LuaFramework/Scripts/ObjectPool.meta new file mode 100644 index 0000000000000000000000000000000000000000..ee499abdbf8769eb777805e6752012baa6fabecc --- /dev/null +++ b/Assets/LuaFramework/Scripts/ObjectPool.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: a65303a59ec1f4c4698174743dac0e53 +folderAsset: yes +timeCreated: 1468659132 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Scripts/ObjectPool/GameObjectPool.cs b/Assets/LuaFramework/Scripts/ObjectPool/GameObjectPool.cs new file mode 100644 index 0000000000000000000000000000000000000000..ca821b4ce7ebfbbc63359f6529f608833a78054f --- /dev/null +++ b/Assets/LuaFramework/Scripts/ObjectPool/GameObjectPool.cs @@ -0,0 +1,76 @@ +锘縰sing UnityEngine; +using System; +using System.Collections; +using System.Collections.Generic; + +namespace LuaFramework { + + [Serializable] + public class PoolInfo { + public string poolName; + public GameObject prefab; + public int poolSize; + public bool fixedSize; + } + + public class GameObjectPool { + private int maxSize; + private int poolSize; + private string poolName; + private Transform poolRoot; + private GameObject poolObjectPrefab; + private Stack availableObjStack = new Stack(); + + public GameObjectPool(string poolName, GameObject poolObjectPrefab, int initCount, int maxSize, Transform pool) { + this.poolName = poolName; + this.poolSize = initCount; + this.maxSize = maxSize; + this.poolRoot = pool; + this.poolObjectPrefab = poolObjectPrefab; + + //populate the pool + for(int index = 0; index < initCount; index++) { + AddObjectToPool(NewObjectInstance()); + } + } + + //o(1) + private void AddObjectToPool(GameObject go) { + if (go == null) + { + return; + } + //add to pool + go.SetActive(false); + availableObjStack.Push(go); + go.transform.SetParent(poolRoot, false); + } + + private GameObject NewObjectInstance() { + return GameObject.Instantiate(poolObjectPrefab) as GameObject; + } + + public GameObject NextAvailableObject() { + GameObject go = null; + if(availableObjStack.Count > 0) { + go = availableObjStack.Pop(); + } else { + Debug.LogWarning("No object available & cannot grow pool: " + poolName); + } + if (go != null) + { + go.SetActive(true); + } + return go; + } + + //o(1) + public void ReturnObjectToPool(string pool, GameObject po) { + if (poolName.Equals(pool)) { + AddObjectToPool(po); + } else { + Debug.LogError(string.Format("Trying to add object to incorrect pool {0} ", poolName)); + } + } + } +} diff --git a/Assets/LuaFramework/Scripts/ObjectPool/GameObjectPool.cs.meta b/Assets/LuaFramework/Scripts/ObjectPool/GameObjectPool.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..29a460358fb328652efb9d0cfe1785c876b3ed6a --- /dev/null +++ b/Assets/LuaFramework/Scripts/ObjectPool/GameObjectPool.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a7707a3f90b0df3458906855b9ef93ed +timeCreated: 1468659140 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Scripts/ObjectPool/ObjectPool.cs b/Assets/LuaFramework/Scripts/ObjectPool/ObjectPool.cs new file mode 100644 index 0000000000000000000000000000000000000000..29f8bb5203b56e5b658c373e19683c6cf8e64c00 --- /dev/null +++ b/Assets/LuaFramework/Scripts/ObjectPool/ObjectPool.cs @@ -0,0 +1,40 @@ +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Events; + +namespace LuaFramework +{ + public class ObjectPool where T : class + { + private readonly Stack m_Stack = new Stack(); + private readonly UnityAction m_ActionOnGet; + private readonly UnityAction m_ActionOnRelease; + + public int countAll { get; private set; } + public int countActive { get { return countAll - countInactive; } } + public int countInactive { get { return m_Stack.Count; } } + + public ObjectPool(UnityAction actionOnGet, UnityAction actionOnRelease) + { + m_ActionOnGet = actionOnGet; + m_ActionOnRelease = actionOnRelease; + } + + public T Get() + { + T element = m_Stack.Pop(); + if (m_ActionOnGet != null) + m_ActionOnGet(element); + return element; + } + + public void Release(T element) + { + if (m_Stack.Count > 0 && ReferenceEquals(m_Stack.Peek(), element)) + Debug.LogError("Internal error. Trying to destroy object that is already released to pool."); + if (m_ActionOnRelease != null) + m_ActionOnRelease(element); + m_Stack.Push(element); + } + } +} diff --git a/Assets/LuaFramework/Scripts/ObjectPool/ObjectPool.cs.meta b/Assets/LuaFramework/Scripts/ObjectPool/ObjectPool.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..c886b3e16074a6e2adaae8cdcca5438824c1efe3 --- /dev/null +++ b/Assets/LuaFramework/Scripts/ObjectPool/ObjectPool.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: db92184dc1857cc45b1ca78fc424a7b5 +timeCreated: 1468659171 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Scripts/ObjectPool/TestObjectClass.cs b/Assets/LuaFramework/Scripts/ObjectPool/TestObjectClass.cs new file mode 100644 index 0000000000000000000000000000000000000000..9329ba093ead99dd6b658bf1f15efb012299ddb8 --- /dev/null +++ b/Assets/LuaFramework/Scripts/ObjectPool/TestObjectClass.cs @@ -0,0 +1,23 @@ +锘縰sing UnityEngine; +using System.Collections; + +namespace LuaFramework { + + public class TestObjectClass { + + public string name; + public int value1; + public float value2; + + // Use this for initialization + public TestObjectClass(string name, int value1, float value2) { + this.name = name; + this.value1 = value1; + this.value2 = value2; + } + + public string ToString() { + return string.Format("name={0} value1={1} = value2={2}", name, value1, value2); + } + } +} \ No newline at end of file diff --git a/Assets/LuaFramework/Scripts/ObjectPool/TestObjectClass.cs.meta b/Assets/LuaFramework/Scripts/ObjectPool/TestObjectClass.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..3988045509611153e358df53df373ff1d4b78177 --- /dev/null +++ b/Assets/LuaFramework/Scripts/ObjectPool/TestObjectClass.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 555d607a23760d14e9bc08011fb58e7b +timeCreated: 1468685016 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Scripts/Utility.meta b/Assets/LuaFramework/Scripts/Utility.meta new file mode 100644 index 0000000000000000000000000000000000000000..d31f87e4a62515cf7496aeaefca23f3caea4398c --- /dev/null +++ b/Assets/LuaFramework/Scripts/Utility.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: baa37d76ca33abd438e215438cd16438 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/Scripts/Utility/LuaHelper.cs b/Assets/LuaFramework/Scripts/Utility/LuaHelper.cs new file mode 100644 index 0000000000000000000000000000000000000000..ef635d00070de76be39bb18e57cce5be981a5618 --- /dev/null +++ b/Assets/LuaFramework/Scripts/Utility/LuaHelper.cs @@ -0,0 +1,68 @@ +锘縰sing UnityEngine; +using System.Reflection; +using LuaInterface; +using System; + +namespace LuaFramework +{ + public static class LuaHelper + { + + /// + /// getType + /// + /// + /// + public static Type GetType(string classname) + { + Assembly assb = Assembly.GetExecutingAssembly(); //.GetExecutingAssembly(); + Type t = null; + t = assb.GetType(classname); ; + if (t == null) + { + t = assb.GetType(classname); + } + return t; + } + + + + /// + /// 缃戠粶绠$悊鍣 + /// + public static NetworkManager GetNetManager() + { + return AppFacade.Instance.GetManager(ManagerName.Network); + } + + /// + /// Lua绠$悊鍣 + /// + public static LuaManager GetLuaManager() + { + if (null == AppFacade.Instance) return null; + return AppFacade.Instance.GetManager(ManagerName.Lua); + } + + /// + /// pbc/pblua鍑芥暟鍥炶皟 + /// + /// + public static void OnCallLuaFunc(LuaByteBuffer data, LuaFunction func) + { + if (func != null) func.Call(data); + Debug.LogWarning("OnCallLuaFunc length:>>" + data.buffer.Length); + } + + /// + /// cjson鍑芥暟鍥炶皟 + /// + /// + /// + public static void OnJsonCallFunc(string data, LuaFunction func) + { + Debug.LogWarning("OnJsonCallback data:>>" + data + " lenght:>>" + data.Length); + if (func != null) func.Call(data); + } + } +} \ No newline at end of file diff --git a/Assets/LuaFramework/Scripts/Utility/LuaHelper.cs.meta b/Assets/LuaFramework/Scripts/Utility/LuaHelper.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..a8244afbbdfcee1f3ef452a4c1f46a1f5886d3bb --- /dev/null +++ b/Assets/LuaFramework/Scripts/Utility/LuaHelper.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ab3c31e7a9bca8c4b9e87dfce78a2835 +timeCreated: 1453126638 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Scripts/Utility/Util.cs b/Assets/LuaFramework/Scripts/Utility/Util.cs new file mode 100644 index 0000000000000000000000000000000000000000..36db9fac147a46f38681c7ea23cd74875bbda40d --- /dev/null +++ b/Assets/LuaFramework/Scripts/Utility/Util.cs @@ -0,0 +1,343 @@ +锘縰sing UnityEngine; +using System; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Security.Cryptography; +using System.Text.RegularExpressions; +using LuaInterface; +using LuaFramework; + + + +namespace LuaFramework +{ + public class Util + { + private static List luaPaths = new List(); + + public static int Int(object o) + { + return Convert.ToInt32(o); + } + + public static float Float(object o) + { + return (float)Math.Round(Convert.ToSingle(o), 2); + } + + public static long Long(object o) + { + return Convert.ToInt64(o); + } + + public static int Random(int min, int max) + { + return UnityEngine.Random.Range(min, max); + } + + public static float Random(float min, float max) + { + return UnityEngine.Random.Range(min, max); + } + + public static string Uid(string uid) + { + int position = uid.LastIndexOf('_'); + return uid.Remove(0, position + 1); + } + + public static long GetTime() + { + TimeSpan ts = new TimeSpan(DateTime.UtcNow.Ticks - new DateTime(1970, 1, 1, 0, 0, 0).Ticks); + return (long)ts.TotalMilliseconds; + } + + /// + /// 鎼滅储瀛愮墿浣撶粍浠-GameObject鐗 + /// + public static T Get(GameObject go, string subnode) where T : Component + { + if (go != null) + { + Transform sub = go.transform.Find(subnode); + if (sub != null) return sub.GetComponent(); + } + return null; + } + + /// + /// 鎼滅储瀛愮墿浣撶粍浠-Transform鐗 + /// + public static T Get(Transform go, string subnode) where T : Component + { + if (go != null) + { + Transform sub = go.Find(subnode); + if (sub != null) return sub.GetComponent(); + } + return null; + } + + /// + /// 鎼滅储瀛愮墿浣撶粍浠-Component鐗 + /// + public static T Get(Component go, string subnode) where T : Component + { + return go.transform.Find(subnode).GetComponent(); + } + + /// + /// 娣诲姞缁勪欢 + /// + public static T Add(GameObject go) where T : Component + { + if (go != null) + { + T[] ts = go.GetComponents(); + for (int i = 0; i < ts.Length; i++) + { + if (ts[i] != null) GameObject.Destroy(ts[i]); + } + return go.gameObject.AddComponent(); + } + return null; + } + + /// + /// 娣诲姞缁勪欢 + /// + public static T Add(Transform go) where T : Component + { + return Add(go.gameObject); + } + + /// + /// 鏌ユ壘瀛愬璞 + /// + public static GameObject Child(GameObject go, string subnode) + { + return Child(go.transform, subnode); + } + + /// + /// 鏌ユ壘瀛愬璞 + /// + public static GameObject Child(Transform go, string subnode) + { + Transform tran = go.Find(subnode); + if (tran == null) return null; + return tran.gameObject; + } + + /// + /// 鍙栧钩绾у璞 + /// + public static GameObject Peer(GameObject go, string subnode) + { + return Peer(go.transform, subnode); + } + + /// + /// 鍙栧钩绾у璞 + /// + public static GameObject Peer(Transform go, string subnode) + { + Transform tran = go.parent.Find(subnode); + if (tran == null) return null; + return tran.gameObject; + } + + /// + /// 璁$畻瀛楃涓茬殑MD5鍊 + /// + public static string md5(string source) + { + MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider(); + byte[] data = System.Text.Encoding.UTF8.GetBytes(source); + byte[] md5Data = md5.ComputeHash(data, 0, data.Length); + md5.Clear(); + + string destString = ""; + for (int i = 0; i < md5Data.Length; i++) + { + destString += System.Convert.ToString(md5Data[i], 16).PadLeft(2, '0'); + } + destString = destString.PadLeft(32, '0'); + return destString; + } + + /// + /// 璁$畻鏂囦欢鐨凪D5鍊 + /// + public static string md5file(string file) + { + try + { + FileStream fs = new FileStream(file, FileMode.Open); + MD5 md5 = new MD5CryptoServiceProvider(); + byte[] retVal = md5.ComputeHash(fs); + fs.Close(); + + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < retVal.Length; i++) + { + sb.Append(retVal[i].ToString("x2")); + } + return sb.ToString(); + } + catch (Exception ex) + { + throw new Exception("md5file() fail, error:" + ex.Message); + } + } + + /// + /// 娓呴櫎鎵鏈夊瓙鑺傜偣 + /// + public static void ClearChild(Transform go) + { + if (go == null) return; + for (int i = go.childCount - 1; i >= 0; i--) + { + GameObject.Destroy(go.GetChild(i).gameObject); + } + } + + /// + /// 娓呯悊鍐呭瓨 + /// + public static void ClearMemory() + { + GC.Collect(); Resources.UnloadUnusedAssets(); + LuaManager mgr = AppFacade.Instance.GetManager(ManagerName.Lua); + if (mgr != null) mgr.LuaGC(); + } + + /// + /// 鍙栧緱琛屾枃鏈 + /// + public static string GetFileText(string path) + { + return File.ReadAllText(path); + } + + /// + /// 缃戠粶鍙敤 + /// + public static bool NetAvailable + { + get + { + return Application.internetReachability != NetworkReachability.NotReachable; + } + } + + /// + /// 鏄惁鏄棤绾 + /// + public static bool IsWifi + { + get + { + return Application.internetReachability == NetworkReachability.ReachableViaLocalAreaNetwork; + } + } + + /// + /// 搴旂敤绋嬪簭鍐呭璺緞 + /// + public static string AppContentPath() + { + string path = string.Empty; + switch (Application.platform) + { + case RuntimePlatform.Android: + path = "jar:file://" + Application.dataPath + "!/assets/"; + break; + case RuntimePlatform.IPhonePlayer: + path = Application.dataPath + "/Raw/"; + break; + default: + path = Application.dataPath + "/" + AppConst.AssetDir + "/"; + break; + } + return path; + } + + public static void Log(string str) + { + Debug.Log(str); + } + + public static void LogWarning(string str) + { + Debug.LogWarning(str); + } + + public static void LogError(string str) + { + Debug.LogError(str); + } + + /// + /// 闃叉鍒濆鑰呬笉鎸夋楠ゆ潵鎿嶄綔 + /// + /// + public static int CheckRuntimeFile() + { + if (!Application.isEditor) return 0; + string streamDir = Application.dataPath + "/StreamingAssets/"; + if (!Directory.Exists(streamDir)) + { + return -1; + } + else + { + string[] files = Directory.GetFiles(streamDir); + if (files.Length == 0) return -1; + + if (!File.Exists(streamDir + "files.txt")) + { + return -1; + } + } + string sourceDir = AppConst.FrameworkRoot + "/ToLua/Source/Generate/"; + if (!Directory.Exists(sourceDir)) + { + return -2; + } + else + { + string[] files = Directory.GetFiles(sourceDir); + if (files.Length == 0) return -2; + } + return 0; + } + + /// + /// 鎵цLua鏂规硶 + /// + public static object[] CallMethod(string module, string func, params object[] args) + { + LuaManager luaMgr = AppFacade.Instance.GetManager(ManagerName.Lua); + if (luaMgr == null) return null; + return luaMgr.CallFunction(module + "." + func, args); + } + + public static void RecordStartTime(string key) + { + var ts = System.DateTime.Now - System.DateTime.Parse("1970-1-1"); + PlayerPrefs.SetString(key, ts.TotalSeconds.ToString()); + } + + public static void EndRecordTime(string key) + { + var ts = System.DateTime.Now - System.DateTime.Parse("1970-1-1"); + var nowT = ts.TotalSeconds; + var startT = double.Parse(PlayerPrefs.GetString(key, "0")); + GameLogger.Log(key + "鑰楁椂: " + (nowT - startT) + "绉"); + } + } +} \ No newline at end of file diff --git a/Assets/LuaFramework/Scripts/Utility/Util.cs.meta b/Assets/LuaFramework/Scripts/Utility/Util.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..437be317247a41573eb5fdee7a38bfa520eb38ad --- /dev/null +++ b/Assets/LuaFramework/Scripts/Utility/Util.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7166ffbcb4403784d9566a56c33b58b1 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/Scripts/View.meta b/Assets/LuaFramework/Scripts/View.meta new file mode 100644 index 0000000000000000000000000000000000000000..7fa4a4ae014aafbed39f5e95cfda1ef60f7e4b4b --- /dev/null +++ b/Assets/LuaFramework/Scripts/View.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: ab2ae9946b07212448c6c13614e0b239 +folderAsset: yes +timeCreated: 1436458509 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/Scripts/View/AppView.cs b/Assets/LuaFramework/Scripts/View/AppView.cs new file mode 100644 index 0000000000000000000000000000000000000000..1deda9c397ed3fdb75846cb47a2a8dd14c48ed5d --- /dev/null +++ b/Assets/LuaFramework/Scripts/View/AppView.cs @@ -0,0 +1,76 @@ +锘縰sing UnityEngine; +using LuaFramework; +using System.Collections.Generic; + +public class AppView : View { + private string message; + + /// + /// 鐩戝惉鐨勬秷鎭 + /// + List MessageList { + get { + return new List() + { + NotiConst.UPDATE_MESSAGE, + NotiConst.UPDATE_EXTRACT, + NotiConst.UPDATE_DOWNLOAD, + NotiConst.UPDATE_PROGRESS, + }; + } + } + + void Awake() { + RemoveMessage(this, MessageList); + RegisterMessage(this, MessageList); + } + + /// + /// 澶勭悊View娑堟伅 + /// + /// + public override void OnMessage(IMessage message) { + string name = message.Name; + object body = message.Body; + switch (name) { + case NotiConst.UPDATE_MESSAGE: //鏇存柊娑堟伅 + UpdateMessage(body.ToString()); + break; + case NotiConst.UPDATE_EXTRACT: //鏇存柊瑙e帇 + UpdateExtract(body.ToString()); + break; + case NotiConst.UPDATE_DOWNLOAD: //鏇存柊涓嬭浇 + UpdateDownload(body.ToString()); + break; + case NotiConst.UPDATE_PROGRESS: //鏇存柊涓嬭浇杩涘害 + UpdateProgress(body.ToString()); + break; + } + } + + public void UpdateMessage(string data) { + this.message = data; + } + + public void UpdateExtract(string data) { + this.message = data; + } + + public void UpdateDownload(string data) { + this.message = data; + } + + public void UpdateProgress(string data) { + this.message = data; + } + + void OnGUI() { + GUI.Label(new Rect(10, 120, 960, 50), message); + + GUI.Label(new Rect(10, 0, 500, 50), "(1) 鍗曞嚮 \"Lua/Gen Lua Wrap Files\"銆"); + GUI.Label(new Rect(10, 20, 500, 50), "(2) 杩愯Unity娓告垙"); + GUI.Label(new Rect(10, 40, 500, 50), "PS: 娓呴櫎缂撳瓨锛屽崟鍑籠"Lua/Clear LuaBinder File + Wrap Files\"銆"); + GUI.Label(new Rect(10, 60, 900, 50), "PS: 鑻ヨ繍琛屽埌鐪熸満锛岃璁剧疆Const.DebugMode=false锛屾湰鍦拌皟璇曡璁剧疆Const.DebugMode=true"); + GUI.Label(new Rect(10, 80, 500, 50), "PS: 鍔燯nity+ulua鎶鏈璁虹兢锛>>341746602"); + } +} diff --git a/Assets/LuaFramework/Scripts/View/AppView.cs.meta b/Assets/LuaFramework/Scripts/View/AppView.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..07f824c3d978ae20a42240ac36d247e611a89a21 --- /dev/null +++ b/Assets/LuaFramework/Scripts/View/AppView.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 354aa74efb1b7424f9b142bc0073df53 +timeCreated: 1440243752 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua.meta b/Assets/LuaFramework/ToLua.meta new file mode 100644 index 0000000000000000000000000000000000000000..35c02a1aae6b0548a246d992bc06129d12d74ab1 --- /dev/null +++ b/Assets/LuaFramework/ToLua.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 4ae0be170ef420e44922b1fe362ccf60 +folderAsset: yes +timeCreated: 1453125963 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/BaseType.meta b/Assets/LuaFramework/ToLua/BaseType.meta new file mode 100644 index 0000000000000000000000000000000000000000..593c0d9430e964b255f9e23f7b6f78f954090a34 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 337508ffab1cff64bbf7476789c95d59 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/BaseType/LuaInterface_EventObjectWrap.cs b/Assets/LuaFramework/ToLua/BaseType/LuaInterface_EventObjectWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..f388c90d6b1f9118c5246c14dce51f4ecca23e99 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/LuaInterface_EventObjectWrap.cs @@ -0,0 +1,50 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class LuaInterface_EventObjectWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(LuaInterface.EventObject), typeof(System.Object)); + L.RegFunction("__add", op_Addition); + L.RegFunction("__sub", op_Subtraction); + L.RegFunction("__tostring", ToLua.op_ToString); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Subtraction(IntPtr L) + { + try + { + EventObject arg0 = (EventObject)ToLua.CheckObject(L, 1, typeof(EventObject)); + arg0.func = ToLua.CheckDelegate(arg0.type, L, 2); + arg0.op = EventOp.Sub; + ToLua.Push(L, arg0); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Addition(IntPtr L) + { + try + { + EventObject arg0 = (EventObject)ToLua.CheckObject(L, 1, typeof(EventObject)); + arg0.func = ToLua.CheckDelegate(arg0.type, L, 2); + arg0.op = EventOp.Add; + ToLua.Push(L, arg0); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/BaseType/LuaInterface_EventObjectWrap.cs.meta b/Assets/LuaFramework/ToLua/BaseType/LuaInterface_EventObjectWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..35455a58e2446e6730fe71d5b69c9701763f60a4 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/LuaInterface_EventObjectWrap.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9eec90316b4c2da499dee7c75f1f94ae +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/BaseType/LuaInterface_LuaConstructorWrap.cs b/Assets/LuaFramework/ToLua/BaseType/LuaInterface_LuaConstructorWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..0cf8481b07e9f7093c314f27c9e01075cd7bd026 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/LuaInterface_LuaConstructorWrap.cs @@ -0,0 +1,47 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class LuaInterface_LuaConstructorWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(LuaInterface.LuaConstructor), typeof(System.Object)); + L.RegFunction("Call", Call); + L.RegFunction("Destroy", Destroy); + L.RegFunction("__tostring", ToLua.op_ToString); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Call(IntPtr L) + { + try + { + LuaConstructor obj = (LuaConstructor)ToLua.CheckObject(L, 1, typeof(LuaConstructor)); + return obj.Call(L); + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Destroy(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + LuaConstructor obj = (LuaConstructor)ToLua.CheckObject(L, 1, typeof(LuaConstructor)); + obj.Destroy(); + ToLua.Destroy(L); + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/BaseType/LuaInterface_LuaConstructorWrap.cs.meta b/Assets/LuaFramework/ToLua/BaseType/LuaInterface_LuaConstructorWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..34a0915666cae8cd9fd82beb96c8b819381b7f02 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/LuaInterface_LuaConstructorWrap.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: be39bc8579dccd14bb20b24e64a68faf +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/BaseType/LuaInterface_LuaFieldWrap.cs b/Assets/LuaFramework/ToLua/BaseType/LuaInterface_LuaFieldWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..b155b651b4ef126e84627f94dca5d2309d2c6b72 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/LuaInterface_LuaFieldWrap.cs @@ -0,0 +1,44 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class LuaInterface_LuaFieldWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(LuaInterface.LuaField), typeof(System.Object)); + L.RegFunction("Get", Get); + L.RegFunction("Set", Set); + L.RegFunction("__tostring", ToLua.op_ToString); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Get(IntPtr L) + { + try + { + LuaField obj = (LuaField)ToLua.CheckObject(L, 1, typeof(LuaField)); + return obj.Get(L); + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Set(IntPtr L) + { + try + { + LuaField obj = (LuaField)ToLua.CheckObject(L, 1, typeof(LuaField)); + return obj.Set(L); + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/BaseType/LuaInterface_LuaFieldWrap.cs.meta b/Assets/LuaFramework/ToLua/BaseType/LuaInterface_LuaFieldWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..9777e3bfad4a58f02dfb6667acbd8b41b8482ad3 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/LuaInterface_LuaFieldWrap.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 58e0ce586689f58419f26062891e1fc1 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/BaseType/LuaInterface_LuaMethodWrap.cs b/Assets/LuaFramework/ToLua/BaseType/LuaInterface_LuaMethodWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..7346553e1474a98e3b33741c22d847e461cae1be --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/LuaInterface_LuaMethodWrap.cs @@ -0,0 +1,47 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class LuaInterface_LuaMethodWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(LuaInterface.LuaMethod), typeof(System.Object)); + L.RegFunction("Destroy", Destroy); + L.RegFunction("Call", Call); + L.RegFunction("__tostring", ToLua.op_ToString); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Destroy(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + LuaMethod obj = (LuaMethod)ToLua.CheckObject(L, 1, typeof(LuaMethod)); + obj.Destroy(); + ToLua.Destroy(L); + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Call(IntPtr L) + { + try + { + LuaMethod obj = (LuaMethod)ToLua.CheckObject(L, 1, typeof(LuaMethod)); + return obj.Call(L); + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/BaseType/LuaInterface_LuaMethodWrap.cs.meta b/Assets/LuaFramework/ToLua/BaseType/LuaInterface_LuaMethodWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..3c3be2252632299a60863817d4f954e18b40e99e --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/LuaInterface_LuaMethodWrap.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bd62b7af99a9c284cb3b8c9c8a177e8c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/BaseType/LuaInterface_LuaOutWrap.cs b/Assets/LuaFramework/ToLua/BaseType/LuaInterface_LuaOutWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..df54da4d8b545205d1c672e1841d737f37c5999f --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/LuaInterface_LuaOutWrap.cs @@ -0,0 +1,49 @@ +锘縰sing System; +using LuaInterface; + +public class LuaInterface_LuaOutWrap +{ + public static void Register(LuaState L) + { + L.BeginPreLoad(); + L.RegFunction("tolua.out", LuaOpen_ToLua_Out); + L.EndPreLoad(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LuaOpen_ToLua_Out(IntPtr L) + { + try + { + LuaDLL.lua_newtable(L); + + RawSetOutType(L); + RawSetOutType(L); + RawSetOutType(L); + RawSetOutType(L); + RawSetOutType(L); + RawSetOutType(L); + RawSetOutType(L); + RawSetOutType(L); + RawSetOutType(L); + RawSetOutType(L); + RawSetOutType(L); + RawSetOutType(L); + RawSetOutType(L); + + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + static void RawSetOutType(IntPtr L) + { + string str = TypeTraits.GetTypeName(); + LuaDLL.lua_pushstring(L, str); + ToLua.PushOut(L, new LuaOut()); + LuaDLL.lua_rawset(L, -3); + } +} diff --git a/Assets/LuaFramework/ToLua/BaseType/LuaInterface_LuaOutWrap.cs.meta b/Assets/LuaFramework/ToLua/BaseType/LuaInterface_LuaOutWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..71c3a1fc12b3417d0e2e2c413322b02457cb8156 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/LuaInterface_LuaOutWrap.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6ba873a052f57bc45890275ec67bb4dc +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/BaseType/LuaInterface_LuaPropertyWrap.cs b/Assets/LuaFramework/ToLua/BaseType/LuaInterface_LuaPropertyWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..5fcae6704fbd6ab538bcd3cd11eddc138d208553 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/LuaInterface_LuaPropertyWrap.cs @@ -0,0 +1,44 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class LuaInterface_LuaPropertyWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(LuaInterface.LuaProperty), typeof(System.Object)); + L.RegFunction("Get", Get); + L.RegFunction("Set", Set); + L.RegFunction("__tostring", ToLua.op_ToString); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Get(IntPtr L) + { + try + { + LuaProperty obj = (LuaProperty)ToLua.CheckObject(L, 1, typeof(LuaProperty)); + return obj.Get(L); + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Set(IntPtr L) + { + try + { + LuaProperty obj = (LuaProperty)ToLua.CheckObject(L, 1, typeof(LuaProperty)); + return obj.Set(L); + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/BaseType/LuaInterface_LuaPropertyWrap.cs.meta b/Assets/LuaFramework/ToLua/BaseType/LuaInterface_LuaPropertyWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..ba0430e077b1769797ad9e57709aec3522471dcc --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/LuaInterface_LuaPropertyWrap.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5b401947a631ece4487e44f4b8ef9418 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/BaseType/System_ArrayWrap.cs b/Assets/LuaFramework/ToLua/BaseType/System_ArrayWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..2c87d11647f0476099ed85b5c7ec4ebf6ab32a0c --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/System_ArrayWrap.cs @@ -0,0 +1,1448 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; +using UnityEngine; + +public class System_ArrayWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(Array), typeof(System.Object)); + L.RegFunction(".geti", get_Item); + L.RegFunction(".seti", set_Item); + L.RegFunction("ToTable", ToTable); + L.RegFunction("GetLength", GetLength); + L.RegFunction("GetLongLength", GetLongLength); + L.RegFunction("GetLowerBound", GetLowerBound); + L.RegFunction("GetValue", GetValue); + L.RegFunction("SetValue", SetValue); + L.RegFunction("GetEnumerator", GetEnumerator); + L.RegFunction("GetUpperBound", GetUpperBound); + L.RegFunction("CreateInstance", CreateInstance); + L.RegFunction("BinarySearch", BinarySearch); + L.RegFunction("Clear", Clear); + L.RegFunction("Clone", Clone); + L.RegFunction("Copy", Copy); + L.RegFunction("IndexOf", IndexOf); + L.RegFunction("Initialize", Initialize); + L.RegFunction("LastIndexOf", LastIndexOf); + L.RegFunction("Reverse", Reverse); + L.RegFunction("Sort", Sort); + L.RegFunction("CopyTo", CopyTo); + L.RegFunction("ConstrainedCopy", ConstrainedCopy); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("Length", get_Length, null); + L.RegVar("LongLength", get_LongLength, null); + L.RegVar("Rank", get_Rank, null); + L.RegVar("IsSynchronized", get_IsSynchronized, null); + L.RegVar("SyncRoot", get_SyncRoot, null); + L.RegVar("IsFixedSize", get_IsFixedSize, null); + L.RegVar("IsReadOnly", get_IsReadOnly, null); + L.EndClass(); + } + + static bool GetPrimitiveValue(IntPtr L, object obj, Type t, int index) + { + bool flag = true; + + if (t == typeof(System.Single)) + { + float[] array = obj as float[]; + float ret = array[index]; + LuaDLL.lua_pushnumber(L, ret); + } + else if (t == typeof(System.Int32)) + { + int[] array = obj as int[]; + int ret = array[index]; + LuaDLL.lua_pushinteger(L, ret); + } + else if (t == typeof(System.Double)) + { + double[] array = obj as double[]; + double ret = array[index]; + LuaDLL.lua_pushnumber(L, ret); + } + else if (t == typeof(System.Boolean)) + { + bool[] array = obj as bool[]; + bool ret = array[index]; + LuaDLL.lua_pushboolean(L, ret); + } + else if (t == typeof(System.Int64)) + { + long[] array = obj as long[]; + long ret = array[index]; + LuaDLL.tolua_pushint64(L, ret); + } + else if (t == typeof(System.SByte)) + { + sbyte[] array = obj as sbyte[]; + sbyte ret = array[index]; + LuaDLL.lua_pushnumber(L, ret); + } + else if (t == typeof(System.Byte)) + { + byte[] array = obj as byte[]; + byte ret = array[index]; + LuaDLL.lua_pushnumber(L, ret); + } + else if (t == typeof(System.Int16)) + { + short[] array = obj as short[]; + short ret = array[index]; + LuaDLL.lua_pushnumber(L, ret); + } + else if (t == typeof(System.UInt16)) + { + ushort[] array = obj as ushort[]; + ushort ret = array[index]; + LuaDLL.lua_pushnumber(L, ret); + } + else if (t == typeof(System.Char)) + { + char[] array = obj as char[]; + char ret = array[index]; + LuaDLL.lua_pushnumber(L, ret); + } + else if (t == typeof(System.UInt32)) + { + uint[] array = obj as uint[]; + uint ret = array[index]; + LuaDLL.lua_pushnumber(L, ret); + } + else + { + flag = false; + } + + return flag; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Item(IntPtr L) + { + try + { + Array obj = ToLua.ToObject(L, 1) as Array; + + if (obj == null) + { + throw new LuaException("trying to index an invalid object reference"); + } + + int index = (int)LuaDLL.lua_tointeger(L, 2); + + if (index >= obj.Length) + { + throw new LuaException("array index out of bounds: " + index + " " + obj.Length); + } + + Type t = obj.GetType().GetElementType(); + + if (t.IsValueType) + { + if (t.IsPrimitive) + { + if (GetPrimitiveValue(L, obj, t, index)) + { + return 1; + } + } + else if (t == typeof(Vector3)) + { + Vector3[] array = obj as Vector3[]; + Vector3 ret = array[index]; + ToLua.Push(L, ret); + return 1; + } + else if (t == typeof(Quaternion)) + { + Quaternion[] array = obj as Quaternion[]; + Quaternion ret = array[index]; + ToLua.Push(L, ret); + return 1; + } + else if (t == typeof(Vector2)) + { + Vector2[] array = obj as Vector2[]; + Vector2 ret = array[index]; + ToLua.Push(L, ret); + return 1; + } + else if (t == typeof(Vector4)) + { + Vector4[] array = obj as Vector4[]; + Vector4 ret = array[index]; + ToLua.Push(L, ret); + return 1; + } + else if (t == typeof(Color)) + { + Color[] array = obj as Color[]; + Color ret = array[index]; + ToLua.Push(L, ret); + return 1; + } + } + + object val = obj.GetValue(index); + ToLua.Push(L, val); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + static bool SetPrimitiveValue(IntPtr L, object obj, Type t, int index) + { + bool flag = true; + + if (t == typeof(System.Single)) + { + float[] array = obj as float[]; + float val = (float)LuaDLL.luaL_checknumber(L, 3); + array[index] = val; + } + else if (t == typeof(System.Int32)) + { + int[] array = obj as int[]; + int val = (int)LuaDLL.luaL_checkinteger(L, 3); + array[index] = val; + } + else if (t == typeof(System.Double)) + { + double[] array = obj as double[]; + double val = LuaDLL.luaL_checknumber(L, 3); + array[index] = val; + } + else if (t == typeof(System.Boolean)) + { + bool[] array = obj as bool[]; + bool val = LuaDLL.luaL_checkboolean(L, 3); + array[index] = val; + } + else if (t == typeof(System.Int64)) + { + long[] array = obj as long[]; + long val = LuaDLL.tolua_toint64(L, 3); + array[index] = val; + } + else if (t == typeof(System.SByte)) + { + sbyte[] array = obj as sbyte[]; + sbyte val = (sbyte)LuaDLL.luaL_checknumber(L, 3); + array[index] = val; + } + else if (t == typeof(System.Byte)) + { + byte[] array = obj as byte[]; + byte val = (byte)LuaDLL.luaL_checknumber(L, 3); + array[index] = val; + } + else if (t == typeof(System.Int16)) + { + short[] array = obj as short[]; + short val = (short)LuaDLL.luaL_checknumber(L, 3); + array[index] = val; + } + else if (t == typeof(System.UInt16)) + { + ushort[] array = obj as ushort[]; + ushort val = (ushort)LuaDLL.luaL_checknumber(L, 3); + array[index] = val; + } + else if (t == typeof(System.Char)) + { + char[] array = obj as char[]; + char val = (char)LuaDLL.luaL_checknumber(L, 3); + array[index] = val; + } + else if (t == typeof(System.UInt32)) + { + uint[] array = obj as uint[]; + uint val = (uint)LuaDLL.luaL_checknumber(L, 3); + array[index] = val; + } + else + { + flag = false; + } + + return flag; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_Item(IntPtr L) + { + try + { + Array obj = ToLua.ToObject(L, 1) as Array; + + if (obj == null) + { + throw new LuaException("trying to index an invalid object reference"); + } + + int index = (int)LuaDLL.lua_tointeger(L, 2); + Type t = obj.GetType().GetElementType(); + + if (t.IsValueType) + { + if (t.IsPrimitive) + { + if (SetPrimitiveValue(L, obj, t, index)) + { + return 0; + } + } + else if (t == typeof(Vector3)) + { + Vector3[] array = obj as Vector3[]; + Vector3 val = ToLua.ToVector3(L, 3); + array[index] = val; + return 0; + } + else if (t == typeof(Quaternion)) + { + Quaternion[] array = obj as Quaternion[]; + Quaternion val = ToLua.ToQuaternion(L, 3); + array[index] = val; + return 0; + } + else if (t == typeof(Vector2)) + { + Vector2[] array = obj as Vector2[]; + Vector2 val = ToLua.ToVector2(L, 3); + array[index] = val; + return 0; + } + else if (t == typeof(Vector4)) + { + Vector4[] array = obj as Vector4[]; + Vector4 val = ToLua.ToVector4(L, 3); + array[index] = val; + return 0; + } + else if (t == typeof(Color)) + { + Color[] array = obj as Color[]; + Color val = ToLua.ToColor(L, 3); + array[index] = val; + return 0; + } + } + + if (!TypeChecker.CheckType(L, t, 3)) + { + return LuaDLL.luaL_typerror(L, 3, LuaMisc.GetTypeName(t)); + } + + object v = ToLua.CheckVarObject(L, 3, t); + v = TypeChecker.ChangeType(v, t); + obj.SetValue(v, index); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Length(IntPtr L) + { + try + { + Array obj = ToLua.ToObject(L, 1) as Array; + + if (obj == null) + { + throw new LuaException("trying to index an invalid object reference"); + } + + LuaDLL.lua_pushinteger(L, obj.Length); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ToTable(IntPtr L) + { + try + { + Array obj = ToLua.ToObject(L, 1) as Array; + + if (obj == null) + { + throw new LuaException("trying to index an invalid object reference"); + } + + LuaDLL.lua_createtable(L, obj.Length, 0); + Type t = obj.GetType().GetElementType(); + + if (t.IsValueType) + { + if (t.IsPrimitive) + { + if (t == typeof(System.Single)) + { + float[] array = obj as float[]; + + for (int i = 0; i < array.Length; i++) + { + float ret = array[i]; + LuaDLL.lua_pushnumber(L, ret); + LuaDLL.lua_rawseti(L, -2, i + 1); + } + + return 1; + } + else if (t == typeof(System.Int32)) + { + int[] array = obj as int[]; + + for (int i = 0; i < array.Length; i++) + { + int ret = array[i]; + LuaDLL.lua_pushinteger(L, ret); + LuaDLL.lua_rawseti(L, -2, i + 1); + } + + return 1; + } + else if (t == typeof(System.Double)) + { + double[] array = obj as double[]; + + for (int i = 0; i < array.Length; i++) + { + double ret = array[i]; + LuaDLL.lua_pushnumber(L, ret); + LuaDLL.lua_rawseti(L, -2, i + 1); + } + + return 1; + } + else if (t == typeof(System.Boolean)) + { + bool[] array = obj as bool[]; + + for (int i = 0; i < array.Length; i++) + { + bool ret = array[i]; + LuaDLL.lua_pushboolean(L, ret); + LuaDLL.lua_rawseti(L, -2, i + 1); + } + + return 1; + } + else if (t == typeof(System.Int64)) + { + long[] array = obj as long[]; + + for (int i = 0; i < array.Length; i++) + { + long ret = array[i]; + LuaDLL.tolua_pushint64(L, ret); + LuaDLL.lua_rawseti(L, -2, i + 1); + } + + return 1; + } + else if (t == typeof(System.Byte)) + { + byte[] array = obj as byte[]; + + for (int i = 0; i < array.Length; i++) + { + byte ret = array[i]; + LuaDLL.lua_pushnumber(L, ret); + LuaDLL.lua_rawseti(L, -2, i + 1); + } + + return 1; + } + else if (t == typeof(System.SByte)) + { + sbyte[] array = obj as sbyte[]; + + for (int i = 0; i < array.Length; i++) + { + sbyte ret = array[i]; + LuaDLL.lua_pushnumber(L, ret); + LuaDLL.lua_rawseti(L, -2, i + 1); + } + + return 1; + } + else if (t == typeof(System.Char)) + { + char[] array = obj as char[]; + + for (int i = 0; i < array.Length; i++) + { + char ret = array[i]; + LuaDLL.lua_pushnumber(L, ret); + LuaDLL.lua_rawseti(L, -2, i + 1); + } + + return 1; + } + else if (t == typeof(System.UInt32)) + { + uint[] array = obj as uint[]; + + for (int i = 0; i < array.Length; i++) + { + uint ret = array[i]; + LuaDLL.lua_pushnumber(L, ret); + LuaDLL.lua_rawseti(L, -2, i + 1); + } + + return 1; + } + else if (t == typeof(System.Int16)) + { + short[] array = obj as short[]; + + for (int i = 0; i < array.Length; i++) + { + short ret = array[i]; + LuaDLL.lua_pushnumber(L, ret); + LuaDLL.lua_rawseti(L, -2, i + 1); + } + + return 1; + } + else if (t == typeof(System.UInt16)) + { + ushort[] array = obj as ushort[]; + + for (int i = 0; i < array.Length; i++) + { + ushort ret = array[i]; + LuaDLL.lua_pushnumber(L, ret); + LuaDLL.lua_rawseti(L, -2, i + 1); + } + + return 1; + } + } + else if (t == typeof(Vector3)) + { + Vector3[] array = obj as Vector3[]; + + for (int i = 0; i < array.Length; i++) + { + Vector3 ret = array[i]; + ToLua.Push(L, ret); + LuaDLL.lua_rawseti(L, -2, i + 1); + } + + return 1; + } + else if (t == typeof(Quaternion)) + { + Quaternion[] array = obj as Quaternion[]; + + for (int i = 0; i < array.Length; i++) + { + Quaternion ret = array[i]; + ToLua.Push(L, ret); + LuaDLL.lua_rawseti(L, -2, i + 1); + } + + return 1; + } + else if (t == typeof(Vector2)) + { + Vector2[] array = obj as Vector2[]; + + for (int i = 0; i < array.Length; i++) + { + Vector2 ret = array[i]; + ToLua.Push(L, ret); + LuaDLL.lua_rawseti(L, -2, i + 1); + } + + return 1; + } + else if (t == typeof(Vector4)) + { + Vector4[] array = obj as Vector4[]; + + for (int i = 0; i < array.Length; i++) + { + Vector4 ret = array[i]; + ToLua.Push(L, ret); + LuaDLL.lua_rawseti(L, -2, i + 1); + } + + return 1; + } + else if (t == typeof(Color)) + { + Color[] array = obj as Color[]; + + for (int i = 0; i < array.Length; i++) + { + Color ret = array[i]; + ToLua.Push(L, ret); + LuaDLL.lua_rawseti(L, -2, i + 1); + } + + return 1; + } + } + + + for (int i = 0; i < obj.Length; i++) + { + object val = obj.GetValue(i); + ToLua.Push(L, val); + LuaDLL.lua_rawseti(L, -2, i + 1); + } + + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetLength(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + System.Array obj = (System.Array)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int o = obj.GetLength(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetLongLength(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + System.Array obj = (System.Array)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + long o = obj.GetLongLength(arg0); + LuaDLL.lua_pushnumber(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetLowerBound(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + System.Array obj = (System.Array)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int o = obj.GetLowerBound(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetValue(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + System.Array obj = (System.Array)ToLua.CheckObject(L, 1); + long arg0 = (long)LuaDLL.lua_tonumber(L, 2); + object o = obj.GetValue(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + System.Array obj = (System.Array)ToLua.CheckObject(L, 1); + long arg0 = (long)LuaDLL.lua_tonumber(L, 2); + long arg1 = (long)LuaDLL.lua_tonumber(L, 3); + object o = obj.GetValue(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + System.Array obj = (System.Array)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + object o = obj.GetValue(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + System.Array obj = (System.Array)ToLua.CheckObject(L, 1); + long arg0 = (long)LuaDLL.lua_tonumber(L, 2); + long arg1 = (long)LuaDLL.lua_tonumber(L, 3); + long arg2 = (long)LuaDLL.lua_tonumber(L, 4); + object o = obj.GetValue(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + System.Array obj = (System.Array)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + int arg2 = (int)LuaDLL.lua_tonumber(L, 4); + object o = obj.GetValue(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else if (TypeChecker.CheckParamsType(L, 2, count - 1)) + { + System.Array obj = (System.Array)ToLua.CheckObject(L, 1); + long[] arg0 = ToLua.ToParamsNumber(L, 2, count - 1); + object o = obj.GetValue(arg0); + ToLua.Push(L, o); + return 1; + } + else if (TypeChecker.CheckParamsType(L, 2, count - 1)) + { + System.Array obj = (System.Array)ToLua.CheckObject(L, 1); + int[] arg0 = ToLua.ToParamsNumber(L, 2, count - 1); + object o = obj.GetValue(arg0); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.Array.GetValue"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetValue(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + System.Array obj = (System.Array)ToLua.CheckObject(L, 1); + object arg0 = ToLua.ToVarObject(L, 2, obj.GetType().GetElementType()); + long arg1 = (long)LuaDLL.lua_tonumber(L, 3); + obj.SetValue(arg0, arg1); + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + System.Array obj = (System.Array)ToLua.CheckObject(L, 1); + object arg0 = ToLua.ToVarObject(L, 2, obj.GetType().GetElementType()); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + int arg2 = (int)LuaDLL.lua_tonumber(L, 4); + obj.SetValue(arg0, arg1, arg2); + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + System.Array obj = (System.Array)ToLua.CheckObject(L, 1); + object arg0 = ToLua.ToVarObject(L, 2, obj.GetType().GetElementType()); + long arg1 = (long)LuaDLL.lua_tonumber(L, 3); + long arg2 = (long)LuaDLL.lua_tonumber(L, 4); + obj.SetValue(arg0, arg1, arg2); + return 0; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 2)) + { + System.Array obj = (System.Array)ToLua.CheckObject(L, 1); + object arg0 = ToLua.ToVarObject(L, 2, obj.GetType().GetElementType()); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + int arg2 = (int)LuaDLL.lua_tonumber(L, 4); + int arg3 = (int)LuaDLL.lua_tonumber(L, 5); + obj.SetValue(arg0, arg1, arg2, arg3); + return 0; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 2)) + { + System.Array obj = (System.Array)ToLua.CheckObject(L, 1); + object arg0 = ToLua.ToVarObject(L, 2, obj.GetType().GetElementType()); + long arg1 = (long)LuaDLL.lua_tonumber(L, 3); + long arg2 = (long)LuaDLL.lua_tonumber(L, 4); + long arg3 = (long)LuaDLL.lua_tonumber(L, 5); + obj.SetValue(arg0, arg1, arg2, arg3); + return 0; + } + else if (TypeChecker.CheckTypes(L, 2) && TypeChecker.CheckParamsType(L, 3, count - 2)) + { + System.Array obj = (System.Array)ToLua.CheckObject(L, 1); + object arg0 = ToLua.ToVarObject(L, 2, obj.GetType().GetElementType()); + long[] arg1 = ToLua.ToParamsNumber(L, 3, count - 2); + obj.SetValue(arg0, arg1); + return 0; + } + else if (TypeChecker.CheckTypes(L, 2) && TypeChecker.CheckParamsType(L, 3, count - 2)) + { + System.Array obj = (System.Array)ToLua.CheckObject(L, 1); + object arg0 = ToLua.ToVarObject(L, 2, obj.GetType().GetElementType()); + int[] arg1 = ToLua.ToParamsNumber(L, 3, count - 2); + obj.SetValue(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.Array.SetValue"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetEnumerator(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Array obj = (System.Array)ToLua.CheckObject(L, 1); + System.Collections.IEnumerator o = obj.GetEnumerator(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetUpperBound(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + System.Array obj = (System.Array)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int o = obj.GetUpperBound(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CreateInstance(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + System.Type arg0 = (System.Type)ToLua.ToObject(L, 1); + int arg1 = (int)LuaDLL.lua_tonumber(L, 2); + System.Array o = System.Array.CreateInstance(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + System.Type arg0 = (System.Type)ToLua.ToObject(L, 1); + int[] arg1 = ToLua.CheckNumberArray(L, 2); + int[] arg2 = ToLua.CheckNumberArray(L, 3); + System.Array o = System.Array.CreateInstance(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + System.Type arg0 = (System.Type)ToLua.ToObject(L, 1); + int arg1 = (int)LuaDLL.lua_tonumber(L, 2); + int arg2 = (int)LuaDLL.lua_tonumber(L, 3); + System.Array o = System.Array.CreateInstance(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 1)) + { + System.Type arg0 = (System.Type)ToLua.ToObject(L, 1); + int arg1 = (int)LuaDLL.lua_tonumber(L, 2); + int arg2 = (int)LuaDLL.lua_tonumber(L, 3); + int arg3 = (int)LuaDLL.lua_tonumber(L, 4); + System.Array o = System.Array.CreateInstance(arg0, arg1, arg2, arg3); + ToLua.Push(L, o); + return 1; + } + else if (TypeChecker.CheckTypes(L, 1) && TypeChecker.CheckParamsType(L, 2, count - 1)) + { + System.Type arg0 = (System.Type)ToLua.ToObject(L, 1); + long[] arg1 = ToLua.ToParamsNumber(L, 2, count - 1); + System.Array o = System.Array.CreateInstance(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else if (TypeChecker.CheckTypes(L, 1) && TypeChecker.CheckParamsType(L, 2, count - 1)) + { + System.Type arg0 = (System.Type)ToLua.ToObject(L, 1); + int[] arg1 = ToLua.ToParamsNumber(L, 2, count - 1); + System.Array o = System.Array.CreateInstance(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.Array.CreateInstance"); + } + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int BinarySearch(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + System.Array arg0 = (System.Array)ToLua.CheckObject(L, 1); + object arg1 = ToLua.ToVarObject(L, 2, arg0.GetType().GetElementType()); + int o = System.Array.BinarySearch(arg0, arg1); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 3) + { + System.Array arg0 = (System.Array)ToLua.CheckObject(L, 1); + object arg1 = ToLua.ToVarObject(L, 2, arg0.GetType().GetElementType()); + System.Collections.IComparer arg2 = (System.Collections.IComparer)ToLua.CheckObject(L, 3); + int o = System.Array.BinarySearch(arg0, arg1, arg2); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 4) + { + System.Array arg0 = (System.Array)ToLua.CheckObject(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + object arg3 = ToLua.ToVarObject(L, 4, arg0.GetType().GetElementType()); + int o = System.Array.BinarySearch(arg0, arg1, arg2, arg3); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 5) + { + System.Array arg0 = (System.Array)ToLua.CheckObject(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + object arg3 = ToLua.ToVarObject(L, 4, arg0.GetType().GetElementType()); + System.Collections.IComparer arg4 = (System.Collections.IComparer)ToLua.CheckObject(L, 5); + int o = System.Array.BinarySearch(arg0, arg1, arg2, arg3, arg4); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.Array.BinarySearch"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Clear(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + System.Array arg0 = (System.Array)ToLua.CheckObject(L, 1, typeof(System.Array)); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + System.Array.Clear(arg0, arg1, arg2); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Clone(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Array obj = (System.Array)ToLua.CheckObject(L, 1); + object o = obj.Clone(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Copy(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3) + { + System.Array arg0 = (System.Array)ToLua.CheckObject(L, 1); + System.Array arg1 = (System.Array)ToLua.CheckObject(L, 2); + long arg2 = LuaDLL.tolua_checkint64(L, 3); + System.Array.Copy(arg0, arg1, arg2); + return 0; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 2)) + { + System.Array arg0 = (System.Array)ToLua.CheckObject(L, 1); + long arg1 = LuaDLL.tolua_toint64(L, 2); + System.Array arg2 = (System.Array)ToLua.ToObject(L, 3); + long arg3 = LuaDLL.tolua_toint64(L, 4); + long arg4 = LuaDLL.tolua_toint64(L, 5); + System.Array.Copy(arg0, arg1, arg2, arg3, arg4); + return 0; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 2)) + { + System.Array arg0 = (System.Array)ToLua.CheckObject(L, 1); + int arg1 = (int)LuaDLL.lua_tonumber(L, 2); + System.Array arg2 = (System.Array)ToLua.ToObject(L, 3); + int arg3 = (int)LuaDLL.lua_tonumber(L, 4); + int arg4 = (int)LuaDLL.lua_tonumber(L, 5); + System.Array.Copy(arg0, arg1, arg2, arg3, arg4); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.Array.Copy"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IndexOf(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + System.Array arg0 = (System.Array)ToLua.CheckObject(L, 1); + object arg1 = ToLua.ToVarObject(L, 2, arg0.GetType().GetElementType()); + int o = System.Array.IndexOf(arg0, arg1); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 3) + { + System.Array arg0 = (System.Array)ToLua.CheckObject(L, 1); + object arg1 = ToLua.ToVarObject(L, 2, arg0.GetType().GetElementType()); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + int o = System.Array.IndexOf(arg0, arg1, arg2); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 4) + { + System.Array arg0 = (System.Array)ToLua.CheckObject(L, 1); + object arg1 = ToLua.ToVarObject(L, 2, arg0.GetType().GetElementType()); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 4); + int o = System.Array.IndexOf(arg0, arg1, arg2, arg3); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.Array.IndexOf"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Initialize(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Array obj = (System.Array)ToLua.CheckObject(L, 1); + obj.Initialize(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LastIndexOf(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + System.Array arg0 = (System.Array)ToLua.CheckObject(L, 1); + object arg1 = ToLua.ToVarObject(L, 2, arg0.GetType().GetElementType()); + int o = System.Array.LastIndexOf(arg0, arg1); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 3) + { + System.Array arg0 = (System.Array)ToLua.CheckObject(L, 1); + object arg1 = ToLua.ToVarObject(L, 2, arg0.GetType().GetElementType()); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + int o = System.Array.LastIndexOf(arg0, arg1, arg2); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 4) + { + System.Array arg0 = (System.Array)ToLua.CheckObject(L, 1); + object arg1 = ToLua.ToVarObject(L, 2, arg0.GetType().GetElementType()); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 4); + int o = System.Array.LastIndexOf(arg0, arg1, arg2, arg3); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.Array.LastIndexOf"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Reverse(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + System.Array arg0 = (System.Array)ToLua.CheckObject(L, 1); + System.Array.Reverse(arg0); + return 0; + } + else if (count == 3) + { + System.Array arg0 = (System.Array)ToLua.CheckObject(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + System.Array.Reverse(arg0, arg1, arg2); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.Array.Reverse"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Sort(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + System.Array arg0 = (System.Array)ToLua.CheckObject(L, 1); + System.Array.Sort(arg0); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + System.Array arg0 = (System.Array)ToLua.CheckObject(L, 1); + System.Collections.IComparer arg1 = (System.Collections.IComparer)ToLua.ToObject(L, 2); + System.Array.Sort(arg0, arg1); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + System.Array arg0 = (System.Array)ToLua.CheckObject(L, 1); + System.Array arg1 = (System.Array)ToLua.ToObject(L, 2); + System.Array.Sort(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + System.Array arg0 = (System.Array)ToLua.CheckObject(L, 1); + System.Array arg1 = (System.Array)ToLua.ToObject(L, 2); + System.Collections.IComparer arg2 = (System.Collections.IComparer)ToLua.ToObject(L, 3); + System.Array.Sort(arg0, arg1, arg2); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + System.Array arg0 = (System.Array)ToLua.CheckObject(L, 1); + int arg1 = (int)LuaDLL.lua_tonumber(L, 2); + int arg2 = (int)LuaDLL.lua_tonumber(L, 3); + System.Array.Sort(arg0, arg1, arg2); + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + System.Array arg0 = (System.Array)ToLua.CheckObject(L, 1); + int arg1 = (int)LuaDLL.lua_tonumber(L, 2); + int arg2 = (int)LuaDLL.lua_tonumber(L, 3); + System.Collections.IComparer arg3 = (System.Collections.IComparer)ToLua.ToObject(L, 4); + System.Array.Sort(arg0, arg1, arg2, arg3); + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + System.Array arg0 = (System.Array)ToLua.CheckObject(L, 1); + System.Array arg1 = (System.Array)ToLua.ToObject(L, 2); + int arg2 = (int)LuaDLL.lua_tonumber(L, 3); + int arg3 = (int)LuaDLL.lua_tonumber(L, 4); + System.Array.Sort(arg0, arg1, arg2, arg3); + return 0; + } + else if (count == 5) + { + System.Array arg0 = (System.Array)ToLua.CheckObject(L, 1); + System.Array arg1 = (System.Array)ToLua.CheckObject(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 4); + System.Collections.IComparer arg4 = (System.Collections.IComparer)ToLua.CheckObject(L, 5); + System.Array.Sort(arg0, arg1, arg2, arg3, arg4); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.Array.Sort"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CopyTo(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + System.Array obj = (System.Array)ToLua.CheckObject(L, 1); + System.Array arg0 = (System.Array)ToLua.CheckObject(L, 2); + long arg1 = (long)LuaDLL.luaL_checknumber(L, 3); + obj.CopyTo(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ConstrainedCopy(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 5); + System.Array arg0 = (System.Array)ToLua.CheckObject(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + System.Array arg2 = (System.Array)ToLua.CheckObject(L, 3); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 4); + int arg4 = (int)LuaDLL.luaL_checknumber(L, 5); + System.Array.ConstrainedCopy(arg0, arg1, arg2, arg3, arg4); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_LongLength(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Array obj = (System.Array)o; + long ret = obj.LongLength; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index LongLength on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Rank(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Array obj = (System.Array)o; + int ret = obj.Rank; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index Rank on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsSynchronized(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Array obj = (System.Array)o; + bool ret = obj.IsSynchronized; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsSynchronized on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_SyncRoot(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Array obj = (System.Array)o; + object ret = obj.SyncRoot; + ToLua.Push(L, ret); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index SyncRoot on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsFixedSize(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Array obj = (System.Array)o; + bool ret = obj.IsFixedSize; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsFixedSize on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsReadOnly(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Array obj = (System.Array)o; + bool ret = obj.IsReadOnly; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsReadOnly on a nil value"); + } + } +} diff --git a/Assets/LuaFramework/ToLua/BaseType/System_ArrayWrap.cs.meta b/Assets/LuaFramework/ToLua/BaseType/System_ArrayWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..e687431bbc388ffd09b92e286ff409a8b697db89 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/System_ArrayWrap.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 270e5e13dbb276c47a14c00ec09f9254 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_DictionaryWrap.cs b/Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_DictionaryWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..4b9dcfc1dde6f6fa0bd3d34c46679028ad4962a4 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_DictionaryWrap.cs @@ -0,0 +1,417 @@ +锘縰sing System; +using LuaInterface; +using System.Collections.Generic; +using System.Runtime.Serialization; +using System.Collections; + +public class System_Collections_Generic_DictionaryWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(Dictionary<,>), typeof(System.Object), "Dictionary"); + L.RegFunction("get_Item", get_Item); + L.RegFunction("set_Item", set_Item); + L.RegFunction(".geti", _geti); + L.RegFunction(".seti", _seti); + L.RegFunction("Add", Add); + L.RegFunction("Clear", Clear); + L.RegFunction("ContainsKey", ContainsKey); + L.RegFunction("ContainsValue", ContainsValue); + L.RegFunction("GetObjectData", GetObjectData); + L.RegFunction("OnDeserialization", OnDeserialization); + L.RegFunction("Remove", Remove); + L.RegFunction("TryGetValue", TryGetValue); + L.RegFunction("GetEnumerator", GetEnumerator); + L.RegVar("this", _this, null); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("Count", get_Count, null); + L.RegVar("Comparer", get_Comparer, null); + L.RegVar("Keys", get_Keys, null); + L.RegVar("Values", get_Values, null); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _get_this(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + Type kt = null; + object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>), out kt); + object arg0 = ToLua.CheckVarObject(L, 2, kt); + object o = LuaMethodCache.CallSingleMethod("get_Item", obj, arg0); + ToLua.Push(L, o); + return 1; + + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _set_this(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + Type kt, vt; + object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>), out kt, out vt); + object arg0 = ToLua.CheckVarObject(L, 2, kt); + object arg1 = ToLua.CheckVarObject(L, 3, vt); + LuaMethodCache.CallSingleMethod("set_Item", obj, arg0, arg1); + return 0; + + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _this(IntPtr L) + { + try + { + LuaDLL.lua_pushvalue(L, 1); + LuaDLL.tolua_bindthis(L, _get_this, _set_this); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Item(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + Type kt = null; + object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>), out kt); + object arg0 = ToLua.CheckVarObject(L, 2, kt); + object o = LuaMethodCache.CallSingleMethod("get_Item", obj, arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_Item(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + Type kt, vt; + object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>), out kt, out vt); + object arg0 = ToLua.CheckVarObject(L, 2, kt); + object arg1 = ToLua.CheckVarObject(L, 3, vt); + LuaMethodCache.CallSingleMethod("set_Item", obj, arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _geti(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + Type kt = null; + object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>), out kt); + + if (kt != typeof(int)) + { + LuaDLL.lua_pushnil(L); + } + else + { + object arg0 = ToLua.CheckVarObject(L, 2, kt); + object o = LuaMethodCache.CallSingleMethod("get_Item", obj, arg0); + ToLua.Push(L, o); + } + + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _seti(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + Type kt, vt; + object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>), out kt, out vt); + + if (kt == typeof(int)) + { + object arg0 = ToLua.CheckVarObject(L, 2, kt); + object arg1 = ToLua.CheckVarObject(L, 3, vt); + LuaMethodCache.CallSingleMethod("set_Item", obj, arg0, arg1); + } + + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Add(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + Type kt, vt; + object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>), out kt, out vt); + object arg0 = ToLua.CheckVarObject(L, 2, kt); + object arg1 = ToLua.CheckVarObject(L, 3, vt); + LuaMethodCache.CallSingleMethod("Add", obj, arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Clear(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>)); + LuaMethodCache.CallSingleMethod("Clear", obj); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ContainsKey(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + Type kt; + object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>), out kt); + object arg0 = ToLua.CheckVarObject(L, 2, kt); + bool o = (bool)LuaMethodCache.CallSingleMethod("ContainsKey", obj, arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ContainsValue(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + Type kt, vt; + object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>), out kt, out vt); + object arg0 = ToLua.CheckVarObject(L, 2, vt); + bool o = (bool)LuaMethodCache.CallSingleMethod("ContainsValue", obj, arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetObjectData(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>)); + SerializationInfo arg0 = (SerializationInfo)ToLua.CheckObject(L, 2, typeof(SerializationInfo)); + StreamingContext arg1 = (StreamingContext)ToLua.CheckObject(L, 3, typeof(StreamingContext)); + LuaMethodCache.CallSingleMethod("GetObjectData", obj, arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OnDeserialization(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>)); + object arg0 = ToLua.ToVarObject(L, 2); + LuaMethodCache.CallSingleMethod("OnDeserialization", obj, arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Remove(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + Type kt; + object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>), out kt); + object arg0 = ToLua.CheckVarObject(L, 2, kt); + bool o = (bool)LuaMethodCache.CallSingleMethod("Remove", obj, arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TryGetValue(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + Type kt; + object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>), out kt); + object arg0 = ToLua.CheckVarObject(L, 2, kt); + object arg1 = null; + object[] args = new object[] { arg0, arg1 }; + bool o = (bool)LuaMethodCache.CallSingleMethod("TryGetValue", obj, args); + LuaDLL.lua_pushboolean(L, o); + ToLua.Push(L, args[1]); + return 2; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetEnumerator(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>)); + IEnumerator o = (IEnumerator)LuaMethodCache.CallSingleMethod("GetEnumerator", obj); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Count(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + int ret = (int)LuaMethodCache.CallSingleMethod("get_Count", o); + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index Count on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Comparer(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + object ret = LuaMethodCache.CallSingleMethod("get_Comparer", o); + ToLua.PushObject(L, ret); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index Comparer on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Keys(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + object ret = LuaMethodCache.CallSingleMethod("get_Keys", o); + ToLua.PushObject(L, ret); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index Keys on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Values(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + object ret = LuaMethodCache.CallSingleMethod("get_Values", o); + ToLua.PushObject(L, ret); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index Values on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_DictionaryWrap.cs.meta b/Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_DictionaryWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..4d199220d990f8b952ab9668333ce8c577dc3c42 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_DictionaryWrap.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 973a63c864c67f34b852be1021aa8445 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_Dictionary_KeyCollectionWrap.cs b/Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_Dictionary_KeyCollectionWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..91d5fc718118a45669655886867c7f01a533d9f7 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_Dictionary_KeyCollectionWrap.cs @@ -0,0 +1,99 @@ +锘縰sing System; +using LuaInterface; +using System.Collections.Generic; +using System.Collections; + +public class System_Collections_Generic_Dictionary_KeyCollectionWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(Dictionary<,>.KeyCollection), typeof(System.Object), "KeyCollection"); + L.RegFunction("CopyTo", CopyTo); + L.RegFunction("GetEnumerator", GetEnumerator); + L.RegFunction("New", _CreateSystem_Collections_Generic_Dictionary_KeyCollection); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("Count", get_Count, null); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateSystem_Collections_Generic_Dictionary_KeyCollection(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + object arg0 = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>)); + Type kc = arg0.GetType().GetNestedType("KeyCollection"); + object obj = Activator.CreateInstance(kc, arg0); + ToLua.PushObject(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: System.Collections.Generic.Dictionary.KeyCollection.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CopyTo(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + Type kt = null; + object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>.KeyCollection), out kt); + object arg0 = ToLua.CheckObject(L, 2, kt.MakeArrayType()); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + LuaMethodCache.CallSingleMethod("CopyTo", obj, arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetEnumerator(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>.KeyCollection)); + IEnumerator o = (IEnumerator)LuaMethodCache.CallSingleMethod("GetEnumerator", obj); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Count(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + int ret = (int)LuaMethodCache.CallSingleMethod("get_Count", o); + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index Count on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_Dictionary_KeyCollectionWrap.cs.meta b/Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_Dictionary_KeyCollectionWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..13cec8308b84ddc777713094c4522dfe48e7c91b --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_Dictionary_KeyCollectionWrap.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b5a969e41ba260d4197ec05de2e0b107 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_Dictionary_ValueCollectionWrap.cs b/Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_Dictionary_ValueCollectionWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..49e25c42af497418f00988984550bf3038e0cad0 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_Dictionary_ValueCollectionWrap.cs @@ -0,0 +1,99 @@ +锘縰sing System; +using LuaInterface; +using System.Collections.Generic; +using System.Collections; + +public class System_Collections_Generic_Dictionary_ValueCollectionWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(Dictionary<,>.ValueCollection), typeof(System.Object), "ValueCollection"); + L.RegFunction("CopyTo", CopyTo); + L.RegFunction("GetEnumerator", GetEnumerator); + L.RegFunction("New", _CreateSystem_Collections_Generic_Dictionary_ValueCollection); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("Count", get_Count, null); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateSystem_Collections_Generic_Dictionary_ValueCollection(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + object arg0 = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>)); + Type kv = arg0.GetType().GetNestedType("ValueCollection"); + object obj = Activator.CreateInstance(kv, arg0); + ToLua.PushObject(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: System.Collections.Generic.Dictionary.ValueCollection.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CopyTo(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + Type kt, kv; + object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>.ValueCollection), out kt, out kv); + object arg0 = ToLua.CheckObject(L, 2, kv.MakeArrayType()); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + LuaMethodCache.CallSingleMethod("CopyTo", obj, arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetEnumerator(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>.ValueCollection)); + IEnumerator o = (IEnumerator)LuaMethodCache.CallSingleMethod("GetEnumerator", obj); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Count(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + int ret = (int)LuaMethodCache.CallSingleMethod("get_Count", o); + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index Count on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_Dictionary_ValueCollectionWrap.cs.meta b/Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_Dictionary_ValueCollectionWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..a90dc87ae31b5903d4e83d13652031572cd28b77 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_Dictionary_ValueCollectionWrap.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8b073f28ab535d6478ab1e2f76f44547 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_KeyValuePairWrap.cs b/Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_KeyValuePairWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..7312d8209339bfcc47052cd8d704ffe9fa79304e --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_KeyValuePairWrap.cs @@ -0,0 +1,52 @@ +锘縰sing System; +using LuaInterface; +using System.Collections.Generic; + +public class System_Collections_Generic_KeyValuePairWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(KeyValuePair<,>), null, "KeyValuePair"); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("Key", get_Key, null); + L.RegVar("Value", get_Value, null); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Key(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + object ret = LuaMethodCache.CallSingleMethod("get_Key", o); + ToLua.Push(L, ret); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index Key on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Value(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + object ret = LuaMethodCache.CallSingleMethod("get_Value", o); + ToLua.Push(L, ret); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index Value on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_KeyValuePairWrap.cs.meta b/Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_KeyValuePairWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..c6a35f5965aaf20eb56d51858ea25ba9e64fba36 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_KeyValuePairWrap.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2bfe26e81faf9a1498eaae521869ecea +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_ListWrap.cs b/Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_ListWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..d7174e7ee2d075366540da7f570a2fe746f2af5a --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_ListWrap.cs @@ -0,0 +1,866 @@ +锘縰sing System; +using LuaInterface; +using System.Collections.Generic; +using System.Reflection; +using UnityEngine; +using System.Collections; + +public class System_Collections_Generic_ListWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(List<>), typeof(System.Object), "List"); + L.RegFunction("Add", Add); + L.RegFunction("AddRange", AddRange); + L.RegFunction("AsReadOnly", AsReadOnly); + L.RegFunction("BinarySearch", BinarySearch); + L.RegFunction("Clear", Clear); + L.RegFunction("Contains", Contains); + L.RegFunction("CopyTo", CopyTo); + L.RegFunction("Exists", Exists); + L.RegFunction("Find", Find); + L.RegFunction("FindAll", FindAll); + L.RegFunction("FindIndex", FindIndex); + L.RegFunction("FindLast", FindLast); + L.RegFunction("FindLastIndex", FindLastIndex); + L.RegFunction("ForEach", ForEach); + L.RegFunction("GetEnumerator", GetEnumerator); + L.RegFunction("GetRange", GetRange); + L.RegFunction("IndexOf", IndexOf); + L.RegFunction("Insert", Insert); + L.RegFunction("InsertRange", InsertRange); + L.RegFunction("LastIndexOf", LastIndexOf); + L.RegFunction("Remove", Remove); + L.RegFunction("RemoveAll", RemoveAll); + L.RegFunction("RemoveAt", RemoveAt); + L.RegFunction("RemoveRange", RemoveRange); + L.RegFunction("Reverse", Reverse); + L.RegFunction("Sort", Sort); + L.RegFunction("ToArray", ToArray); + L.RegFunction("TrimExcess", TrimExcess); + L.RegFunction("TrueForAll", TrueForAll); + L.RegFunction("get_Item", get_Item); + L.RegFunction("set_Item", set_Item); + L.RegFunction(".geti", get_Item); + L.RegFunction(".seti", set_Item); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("Capacity", get_Capacity, set_Capacity); + L.RegVar("Count", get_Count, null); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Add(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + Type argType = null; + object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType); + object arg0 = ToLua.CheckVarObject(L, 2, argType); + LuaMethodCache.CallSingleMethod("Add", obj, arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int AddRange(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + Type argType = null; + object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType); + object arg0 = ToLua.CheckObject(L, 2, typeof(IEnumerable<>).MakeGenericType(argType)); + LuaMethodCache.CallSingleMethod("AddRange", obj, arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int AsReadOnly(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + Type argType = null; + object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType); + object o = LuaMethodCache.CallSingleMethod("AsReadOnly", obj); + ToLua.Push(L, o); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int BinarySearch(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + Type argType = null; + object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType); + + if (count == 2) + { + object arg0 = ToLua.CheckVarObject(L, 2, argType); + int o = (int)LuaMethodCache.CallMethod("BinarySearch", obj, arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 3) + { + object arg0 = ToLua.CheckVarObject(L, 2, argType); + object arg1 = ToLua.CheckObject(L, 3, typeof(IComparer<>).MakeGenericType(argType)); + int o = (int)LuaMethodCache.CallMethod("BinarySearch", obj, arg0, arg1); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 5) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + object arg2 = ToLua.CheckVarObject(L, 4, argType); + object arg3 = ToLua.CheckObject(L, 5, typeof(IComparer<>).MakeGenericType(argType)); + int o = (int)LuaMethodCache.CallMethod("BinarySearch", obj, arg0, arg1, arg2, arg3); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, string.Format("invalid arguments to method: List<{0}>.BinarySearch", LuaMisc.GetTypeName(argType))); + } + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Clear(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>)); + LuaMethodCache.CallSingleMethod("Clear", obj); + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Contains(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + Type argType = null; + object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType); + object arg0 = ToLua.CheckVarObject(L, 2, argType); + object o = LuaMethodCache.CallSingleMethod("Contains", obj, arg0); + LuaDLL.lua_pushboolean(L, (bool)o); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CopyTo(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + Type argType = null; + object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType); + + if (count == 2) + { + object arg0 = ToLua.CheckObject(L, 2, argType.MakeArrayType()); + LuaMethodCache.CallMethod("CopyTo", obj, arg0); + return 0; + } + else if (count == 3) + { + object arg0 = ToLua.CheckObject(L, 2, argType.MakeArrayType()); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + LuaMethodCache.CallMethod("CopyTo", obj, arg0, arg1); + return 0; + } + else if (count == 5) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + object arg1 = ToLua.CheckObject(L, 3, argType.MakeArrayType()); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 5); + LuaMethodCache.CallMethod("CopyTo", obj, arg0, arg1, arg2, arg3); + return 0; + } + else + { + + return LuaDLL.luaL_throw(L, string.Format("invalid arguments to method: List<{0}>.CopyTo", LuaMisc.GetTypeName(argType))); + } + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Exists(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + Type argType = null; + object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType); + Delegate arg0 = ToLua.CheckDelegate(typeof(System.Predicate<>).MakeGenericType(argType), L, 2); + bool o = (bool)LuaMethodCache.CallMethod("Exists", obj, arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Find(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + Type argType = null; + object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType); + Delegate arg0 = ToLua.CheckDelegate(typeof(System.Predicate<>).MakeGenericType(argType), L, 2); + object o = LuaMethodCache.CallMethod("Find", obj, arg0); + ToLua.Push(L, o); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int FindAll(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + Type argType = null; + object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType); + Delegate arg0 = ToLua.CheckDelegate(typeof(System.Predicate<>).MakeGenericType(argType), L, 2); + object o = LuaMethodCache.CallMethod("FindAll", obj, arg0); + ToLua.Push(L, o); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int FindIndex(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + Type argType = null; + object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType); + + if (count == 2) + { + Delegate arg0 = ToLua.CheckDelegate(typeof(System.Predicate<>).MakeGenericType(argType), L, 2); + int o = (int)LuaMethodCache.CallMethod("FindIndex", obj, arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 3) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + Delegate arg1 = ToLua.CheckDelegate(typeof(System.Predicate<>).MakeGenericType(argType), L, 3); + int o = (int)LuaMethodCache.CallMethod("FindIndex", obj, arg0, arg1); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 4) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + Delegate arg2 = ToLua.CheckDelegate(typeof(System.Predicate<>).MakeGenericType(argType), L, 4); + int o = (int)LuaMethodCache.CallMethod("FindIndex", obj, arg0, arg1, arg2); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, string.Format("invalid arguments to method: List<{0}>.FindIndex", LuaMisc.GetTypeName(argType))); + } + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int FindLast(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + Type argType = null; + object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType); + Delegate arg0 = ToLua.CheckDelegate(typeof(System.Predicate<>).MakeGenericType(argType), L, 2); + object o = LuaMethodCache.CallSingleMethod("FindLast", obj, arg0); + ToLua.Push(L, o); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int FindLastIndex(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + Type argType = null; + object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType); + + if (count == 2) + { + Delegate arg0 = (Delegate)ToLua.CheckObject(L, 2, typeof(System.Predicate<>).MakeGenericType(argType)); + int o = (int)LuaMethodCache.CallMethod("FindLastIndex", obj, arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 3) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + Delegate arg1 = (Delegate)ToLua.CheckObject(L, 3, typeof(System.Predicate<>).MakeGenericType(argType)); + int o = (int)LuaMethodCache.CallMethod("FindLastIndex", obj, arg0, arg1); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 4) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + Delegate arg2 = (Delegate)ToLua.CheckObject(L, 4, typeof(System.Predicate<>).MakeGenericType(argType)); + int o = (int)LuaMethodCache.CallMethod("FindLastIndex", obj, arg0, arg1, arg2); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, string.Format("invalid arguments to method: List<{0}>.FindLastIndex", LuaMisc.GetTypeName(argType))); + } + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ForEach(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + Type argType = null; + object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType); + Delegate arg0 = ToLua.CheckDelegate(typeof(System.Action<>).MakeGenericType(argType), L, 2); + LuaMethodCache.CallSingleMethod("ForEach", obj, arg0); + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetEnumerator(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>)); + IEnumerator o = LuaMethodCache.CallSingleMethod("GetEnumerator", obj) as IEnumerator; + ToLua.Push(L, o); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetRange(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + object o = LuaMethodCache.CallSingleMethod("GetRange", obj, arg0, arg1); + ToLua.PushObject(L, o); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IndexOf(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + Type argType = null; + object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType); + + if (count == 2) + { + object arg0 = ToLua.CheckVarObject(L, 2, argType); + int o = (int)LuaMethodCache.CallMethod("IndexOf", obj, arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 3) + { + object arg0 = ToLua.CheckVarObject(L, 2, argType); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + int o = (int)LuaMethodCache.CallMethod("IndexOf", obj, arg0, arg1); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 4) + { + object arg0 = ToLua.CheckVarObject(L, 2, argType); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); + int o = (int)LuaMethodCache.CallMethod("IndexOf", obj, arg0, arg1, arg2); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, string.Format("invalid arguments to method: List<{0}>.IndexOf", LuaMisc.GetTypeName(argType))); + } + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Insert(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + Type argType = null; + object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + object arg1 = ToLua.CheckVarObject(L, 3, argType); + LuaMethodCache.CallSingleMethod("Insert", obj, arg0, arg1); + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int InsertRange(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + Type argType = null; + object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + IEnumerable arg1 = (IEnumerable)ToLua.CheckObject(L, 3, typeof(IEnumerable<>).MakeGenericType(argType)); + LuaMethodCache.CallSingleMethod("InsertRange", obj, arg0, arg1); + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LastIndexOf(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + Type argType = null; + object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType); + + if (count == 2) + { + object arg0 = ToLua.CheckVarObject(L, 2, argType); + int o = (int)LuaMethodCache.CallMethod("LastIndexOf", obj, arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 3) + { + object arg0 = ToLua.CheckVarObject(L, 2, argType); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + int o = (int)LuaMethodCache.CallMethod("LastIndexOf", obj, arg0, arg1); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 4) + { + object arg0 = ToLua.CheckVarObject(L, 2, argType); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); + int o = (int)LuaMethodCache.CallMethod("LastIndexOf", obj, arg0, arg1, arg2); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, string.Format("invalid arguments to method: List<{0}>.LastIndexOf", LuaMisc.GetTypeName(argType))); + } + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Remove(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + Type argType = null; + object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType); + object arg0 = ToLua.CheckVarObject(L, 2, argType); + bool o = (bool)LuaMethodCache.CallSingleMethod("Remove", obj, arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int RemoveAll(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + Type argType = null; + object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType); + Delegate arg0 = ToLua.CheckDelegate(typeof(System.Predicate<>).MakeGenericType(argType), L, 2); + int o = (int)LuaMethodCache.CallSingleMethod("RemoveAll", obj, arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int RemoveAt(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + LuaMethodCache.CallSingleMethod("RemoveAt", obj, arg0); + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int RemoveRange(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + LuaMethodCache.CallSingleMethod("RemoveRange", obj, arg0, arg1); + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Reverse(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + Type argType = null; + object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType); + + if (count == 1) + { + LuaMethodCache.CallMethod("Reverse", obj); + return 0; + } + else if (count == 3) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + LuaMethodCache.CallMethod("Reverse", obj, arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, string.Format("invalid arguments to method: List<{0}>.LastIndexOf", LuaMisc.GetTypeName(argType))); + } + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Sort(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + Type argType = null; + object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType); + + if (count == 1) + { + LuaMethodCache.CallMethod("Sort", obj); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2, typeof(System.Comparison<>).MakeGenericType(argType))) + { + Delegate arg0 = (Delegate)ToLua.ToObject(L, 2); + LuaMethodCache.CallMethod("Sort", obj, arg0); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2, typeof(IComparer<>).MakeGenericType(argType))) + { + object arg0 = ToLua.ToObject(L, 2); + LuaMethodCache.CallMethod("Sort", obj, arg0); + return 0; + } + else if (count == 4) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + object arg2 = ToLua.CheckObject(L, 4, typeof(IComparer<>).MakeGenericType(argType)); + LuaMethodCache.CallMethod("Sort", obj, arg0, arg1, arg2); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, string.Format("invalid arguments to method: List<{0}>.LastIndexOf", LuaMisc.GetTypeName(argType))); + } + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ToArray(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>)); + Array o = (Array)LuaMethodCache.CallSingleMethod("ToArray", obj); + ToLua.Push(L, o); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TrimExcess(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>)); + LuaMethodCache.CallSingleMethod("TrimExcess", obj); + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TrueForAll(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + Type argType = null; + object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType); + Delegate arg0 = ToLua.CheckDelegate(typeof(System.Predicate<>).MakeGenericType(argType), L, 2); + bool o = (bool)LuaMethodCache.CallSingleMethod("TrueForAll", obj, arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Item(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + object o = LuaMethodCache.CallSingleMethod("get_Item", obj, arg0); + ToLua.Push(L, o); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_Item(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + Type argType = null; + object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + object arg1 = ToLua.CheckObject(L, 3, argType); + LuaMethodCache.CallSingleMethod("set_Item", obj, arg0, arg1); + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Capacity(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + int ret = (int)LuaMethodCache.CallSingleMethod("get_Capacity", o); + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index Capacity on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Count(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + int ret = (int)LuaMethodCache.CallSingleMethod("get_Count", o); + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index Count on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_Capacity(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + LuaMethodCache.CallSingleMethod("set_Capacity", o, arg0); + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index Capacity on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_ListWrap.cs.meta b/Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_ListWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..6d2cebdde2311c2e5c3ffa8e43a87454747cc605 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/System_Collections_Generic_ListWrap.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9806172156647e244b2fb905a4d02611 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/BaseType/System_Collections_IEnumeratorWrap.cs b/Assets/LuaFramework/ToLua/BaseType/System_Collections_IEnumeratorWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..0bc8637cb3c6c7426d021899efc2d7c4e9d77d0d --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/System_Collections_IEnumeratorWrap.cs @@ -0,0 +1,68 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class System_Collections_IEnumeratorWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(System.Collections.IEnumerator), null); + L.RegFunction("MoveNext", MoveNext); + L.RegFunction("Reset", Reset); + L.RegVar("Current", get_Current, null); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int MoveNext(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Collections.IEnumerator obj = ToLua.CheckIter(L, 1); + bool o = obj.MoveNext(); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Reset(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Collections.IEnumerator obj = ToLua.CheckIter(L, 1); + obj.Reset(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Current(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Collections.IEnumerator obj = (System.Collections.IEnumerator)o; + object ret = obj.Current; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index Current on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/BaseType/System_Collections_IEnumeratorWrap.cs.meta b/Assets/LuaFramework/ToLua/BaseType/System_Collections_IEnumeratorWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..e17ad8f203dcf7a9f70e9e8d99eb3d6cd6fa6410 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/System_Collections_IEnumeratorWrap.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7eaa472c4f36f9d419d9bf704795f0d6 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/BaseType/System_Collections_ObjectModel_ReadOnlyCollectionWrap.cs b/Assets/LuaFramework/ToLua/BaseType/System_Collections_ObjectModel_ReadOnlyCollectionWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..0f5734f9fbb61e705fb2e1e079e3efd908afd19e --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/System_Collections_ObjectModel_ReadOnlyCollectionWrap.cs @@ -0,0 +1,132 @@ +锘縰sing System; +using LuaInterface; +using System.Collections.ObjectModel; +using System.Collections; + +public class System_Collections_ObjectModel_ReadOnlyCollectionWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(ReadOnlyCollection<>), typeof(System.Object), "ReadOnlyCollection"); + L.RegFunction("Contains", Contains); + L.RegFunction("CopyTo", CopyTo); + L.RegFunction("GetEnumerator", GetEnumerator); + L.RegFunction("IndexOf", IndexOf); + L.RegFunction(".geti", get_Item); + L.RegFunction("get_Item", get_Item); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("Count", get_Count, null); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Contains(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + Type argType = null; + object obj = ToLua.CheckGenericObject(L, 1, typeof(ReadOnlyCollection<>), out argType); + object arg0 = ToLua.CheckVarObject(L, 2, argType); + bool o = (bool)LuaMethodCache.CallSingleMethod("Contains", obj, arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CopyTo(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + Type argType = null; + object obj = ToLua.CheckGenericObject(L, 1, typeof(ReadOnlyCollection<>), out argType); + object arg0 = ToLua.CheckObject(L, 2, argType.MakeArrayType()); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + LuaMethodCache.CallSingleMethod("CopyTo", obj, arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetEnumerator(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + object obj = ToLua.CheckGenericObject(L, 1, typeof(ReadOnlyCollection<>)); + IEnumerator o = (IEnumerator)LuaMethodCache.CallSingleMethod("GetEnumerator", obj); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IndexOf(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + Type argType = null; + object obj = ToLua.CheckGenericObject(L, 1, typeof(ReadOnlyCollection<>), out argType); + object arg0 = ToLua.CheckVarObject(L, 2, argType); + int o = (int)LuaMethodCache.CallSingleMethod("IndexOf", obj, arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Item(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + object obj = ToLua.CheckGenericObject(L, 1, typeof(ReadOnlyCollection<>)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int o = (int)LuaMethodCache.CallSingleMethod("get_Item", obj, arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Count(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + int ret = (int)LuaMethodCache.CallSingleMethod("get_Count", o); + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index Count on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/BaseType/System_Collections_ObjectModel_ReadOnlyCollectionWrap.cs.meta b/Assets/LuaFramework/ToLua/BaseType/System_Collections_ObjectModel_ReadOnlyCollectionWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..54a2fbaafd437943f30bbae1586fb5b868a9a5ed --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/System_Collections_ObjectModel_ReadOnlyCollectionWrap.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fa5b181e2942520408fb4d6bac615d4f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/BaseType/System_DelegateWrap.cs b/Assets/LuaFramework/ToLua/BaseType/System_DelegateWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..2b754ce3209bc4cefa3695f173854812f955b5d6 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/System_DelegateWrap.cs @@ -0,0 +1,475 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using System.Collections.Generic; +using LuaInterface; + +public class System_DelegateWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(System.Delegate), typeof(System.Object)); + L.RegFunction("CreateDelegate", CreateDelegate); + L.RegFunction("DynamicInvoke", DynamicInvoke); + L.RegFunction("Clone", Clone); + L.RegFunction("GetObjectData", GetObjectData); + L.RegFunction("GetInvocationList", GetInvocationList); + L.RegFunction("Combine", Combine); + L.RegFunction("Remove", Remove); + L.RegFunction("RemoveAll", RemoveAll); + L.RegFunction("Destroy", Destroy); + L.RegFunction("GetHashCode", GetHashCode); + L.RegFunction("Equals", Equals); + L.RegFunction("__add", op_Addition); + L.RegFunction("__sub", op_Subtraction); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("Method", get_Method, null); + L.RegVar("Target", get_Target, null); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CreateDelegate(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + System.Type arg0 = ToLua.CheckMonoType(L, 1); + System.Reflection.MethodInfo arg1 = (System.Reflection.MethodInfo)ToLua.CheckObject(L, 2); + System.Delegate o = System.Delegate.CreateDelegate(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + System.Type arg0 = ToLua.CheckMonoType(L, 1); + System.Reflection.MethodInfo arg1 = (System.Reflection.MethodInfo)ToLua.ToObject(L, 2); + bool arg2 = LuaDLL.lua_toboolean(L, 3); + System.Delegate o = System.Delegate.CreateDelegate(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + System.Type arg0 = ToLua.CheckMonoType(L, 1); + System.Type arg1 = (System.Type)ToLua.ToObject(L, 2); + string arg2 = ToLua.ToString(L, 3); + System.Delegate o = System.Delegate.CreateDelegate(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + System.Type arg0 = ToLua.CheckMonoType(L, 1); + object arg1 = ToLua.ToVarObject(L, 2); + string arg2 = ToLua.ToString(L, 3); + System.Delegate o = System.Delegate.CreateDelegate(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + System.Type arg0 = ToLua.CheckMonoType(L, 1); + object arg1 = ToLua.ToVarObject(L, 2); + System.Reflection.MethodInfo arg2 = (System.Reflection.MethodInfo)ToLua.ToObject(L, 3); + System.Delegate o = System.Delegate.CreateDelegate(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + System.Type arg0 = ToLua.CheckMonoType(L, 1); + System.Type arg1 = (System.Type)ToLua.ToObject(L, 2); + string arg2 = ToLua.ToString(L, 3); + bool arg3 = LuaDLL.lua_toboolean(L, 4); + System.Delegate o = System.Delegate.CreateDelegate(arg0, arg1, arg2, arg3); + ToLua.Push(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + System.Type arg0 = ToLua.CheckMonoType(L, 1); + object arg1 = ToLua.ToVarObject(L, 2); + string arg2 = ToLua.ToString(L, 3); + bool arg3 = LuaDLL.lua_toboolean(L, 4); + System.Delegate o = System.Delegate.CreateDelegate(arg0, arg1, arg2, arg3); + ToLua.Push(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + System.Type arg0 = ToLua.CheckMonoType(L, 1); + object arg1 = ToLua.ToVarObject(L, 2); + System.Reflection.MethodInfo arg2 = (System.Reflection.MethodInfo)ToLua.ToObject(L, 3); + bool arg3 = LuaDLL.lua_toboolean(L, 4); + System.Delegate o = System.Delegate.CreateDelegate(arg0, arg1, arg2, arg3); + ToLua.Push(L, o); + return 1; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 2)) + { + System.Type arg0 = ToLua.CheckMonoType(L, 1); + System.Type arg1 = (System.Type)ToLua.ToObject(L, 2); + string arg2 = ToLua.ToString(L, 3); + bool arg3 = LuaDLL.lua_toboolean(L, 4); + bool arg4 = LuaDLL.lua_toboolean(L, 5); + System.Delegate o = System.Delegate.CreateDelegate(arg0, arg1, arg2, arg3, arg4); + ToLua.Push(L, o); + return 1; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 2)) + { + System.Type arg0 = ToLua.CheckMonoType(L, 1); + object arg1 = ToLua.ToVarObject(L, 2); + string arg2 = ToLua.ToString(L, 3); + bool arg3 = LuaDLL.lua_toboolean(L, 4); + bool arg4 = LuaDLL.lua_toboolean(L, 5); + System.Delegate o = System.Delegate.CreateDelegate(arg0, arg1, arg2, arg3, arg4); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.Delegate.CreateDelegate"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int DynamicInvoke(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + System.Delegate obj = (System.Delegate)ToLua.CheckObject(L, 1); + object[] arg0 = ToLua.ToParamsObject(L, 2, count - 1); + object o = obj.DynamicInvoke(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Clone(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Delegate obj = (System.Delegate)ToLua.CheckObject(L, 1); + object o = obj.Clone(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetObjectData(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + System.Delegate obj = (System.Delegate)ToLua.CheckObject(L, 1); + System.Runtime.Serialization.SerializationInfo arg0 = (System.Runtime.Serialization.SerializationInfo)ToLua.CheckObject(L, 2, typeof(System.Runtime.Serialization.SerializationInfo)); + System.Runtime.Serialization.StreamingContext arg1 = StackTraits.Check(L, 3); + obj.GetObjectData(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetInvocationList(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Delegate obj = (System.Delegate)ToLua.CheckObject(L, 1); + System.Delegate[] o = obj.GetInvocationList(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Combine(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + System.Delegate arg0 = (System.Delegate)ToLua.ToObject(L, 1); + System.Delegate arg1 = (System.Delegate)ToLua.ToObject(L, 2); + System.Delegate o = System.Delegate.Combine(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else if (TypeChecker.CheckParamsType(L, 1, count)) + { + System.Delegate[] arg0 = ToLua.ToParamsObject(L, 1, count); + System.Delegate o = System.Delegate.Combine(arg0); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.Delegate.Combine"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Remove(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + System.Delegate arg0 = (System.Delegate)ToLua.CheckObject(L, 1); + System.Delegate arg1 = (System.Delegate)ToLua.CheckObject(L, 2); + System.Delegate o = System.Delegate.Remove(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int RemoveAll(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + System.Delegate arg0 = (System.Delegate)ToLua.CheckObject(L, 1); + System.Delegate arg1 = (System.Delegate)ToLua.CheckObject(L, 2); + System.Delegate o = System.Delegate.RemoveAll(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Subtraction(IntPtr L) + { + try + { + Delegate arg0 = (Delegate)ToLua.CheckObject(L, 1); + LuaTypes type = LuaDLL.lua_type(L, 2); + + if (type == LuaTypes.LUA_TFUNCTION) + { + LuaState state = LuaState.Get(L); + LuaFunction func = ToLua.ToLuaFunction(L, 2); + Delegate[] ds = arg0.GetInvocationList(); + + for (int i = 0; i < ds.Length; i++) + { + LuaDelegate ld = ds[i].Target as LuaDelegate; + + if (ld != null && ld.func == func && ld.self == null) + { + arg0 = Delegate.Remove(arg0, ds[i]); + state.DelayDispose(ld.func); + break; + } + } + + func.Dispose(); + ToLua.Push(L, arg0); + return 1; + } + else + { + Delegate arg1 = (Delegate)ToLua.CheckObject(L, 2); + arg0 = DelegateFactory.RemoveDelegate(arg0, arg1); + ToLua.Push(L, arg0); + return 1; + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Addition(IntPtr L) + { + try + { + LuaTypes type = LuaDLL.lua_type(L, 1); + + switch (type) + { + case LuaTypes.LUA_TFUNCTION: + Delegate arg0 = ToLua.ToObject(L, 2) as Delegate; + LuaFunction func = ToLua.ToLuaFunction(L, 1); + Type t = arg0.GetType(); + Delegate arg1 = DelegateFactory.CreateDelegate(t, func); + Delegate arg2 = Delegate.Combine(arg0, arg1); + ToLua.Push(L, arg2); + return 1; + case LuaTypes.LUA_TNIL: + LuaDLL.lua_pushvalue(L, 2); + return 1; + case LuaTypes.LUA_TUSERDATA: + Delegate a0 = ToLua.ToObject(L, 1) as Delegate; + Delegate a1 = ToLua.CheckDelegate(a0.GetType(), L, 2); + Delegate ret = Delegate.Combine(a0, a1); + ToLua.Push(L, ret); + return 1; + default: + LuaDLL.luaL_typerror(L, 1, "Delegate"); + return 0; + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + System.Delegate arg0 = (System.Delegate)ToLua.ToObject(L, 1); + System.Delegate arg1 = (System.Delegate)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Destroy(IntPtr L) + { + Delegate arg0 = (Delegate)ToLua.CheckObject(L, 1); + Delegate[] ds = arg0.GetInvocationList(); + + for (int i = 0; i < ds.Length; i++) + { + LuaDelegate ld = ds[i].Target as LuaDelegate; + + if (ld != null) + { + ld.Dispose(); + } + } + + return 0; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetHashCode(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Delegate obj = (System.Delegate)ToLua.CheckObject(L, 1); + int o = obj.GetHashCode(); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Equals(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + System.Delegate obj = (System.Delegate)ToLua.CheckObject(L, 1); + object arg0 = ToLua.ToVarObject(L, 2); + bool o = obj != null ? obj.Equals(arg0) : arg0 == null; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Method(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Delegate obj = (System.Delegate)o; + System.Reflection.MethodInfo ret = obj.Method; + ToLua.PushObject(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index Method on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Target(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Delegate obj = (System.Delegate)o; + object ret = obj.Target; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index Target on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/BaseType/System_DelegateWrap.cs.meta b/Assets/LuaFramework/ToLua/BaseType/System_DelegateWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..f37bfec08dacc0ae613385c2acc4623b40e9476b --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/System_DelegateWrap.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 86ed9798a2c5dc74e9018394dfc827ea +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/BaseType/System_EnumWrap.cs b/Assets/LuaFramework/ToLua/BaseType/System_EnumWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..1e02c44a85d97fdb0320f9fd71291ec251f89485 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/System_EnumWrap.cs @@ -0,0 +1,322 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class System_EnumWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(System.Enum), null); + L.RegFunction("GetTypeCode", GetTypeCode); + L.RegFunction("GetValues", GetValues); + L.RegFunction("GetNames", GetNames); + L.RegFunction("GetName", GetName); + L.RegFunction("IsDefined", IsDefined); + L.RegFunction("GetUnderlyingType", GetUnderlyingType); + L.RegFunction("CompareTo", CompareTo); + L.RegFunction("ToString", ToString); + L.RegFunction("Equals", Equals); + L.RegFunction("GetHashCode", GetHashCode); + L.RegFunction("Format", Format); + L.RegFunction("Parse", Parse); + L.RegFunction("ToObject", ToObject); + L.RegFunction("ToInt", ToInt); + L.RegFunction("__tostring", ToLua.op_ToString); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetTypeCode(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Enum obj = (System.Enum)ToLua.CheckObject(L, 1); + System.TypeCode o = obj.GetTypeCode(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetValues(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Type arg0 = ToLua.CheckMonoType(L, 1); + System.Array o = System.Enum.GetValues(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetNames(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Type arg0 = ToLua.CheckMonoType(L, 1); + string[] o = System.Enum.GetNames(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetName(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + System.Type arg0 = ToLua.CheckMonoType(L, 1); + object arg1 = ToLua.ToVarObject(L, 2); + string o = System.Enum.GetName(arg0, arg1); + LuaDLL.lua_pushstring(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IsDefined(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + System.Type arg0 = ToLua.CheckMonoType(L, 1); + object arg1 = ToLua.ToVarObject(L, 2); + bool o = System.Enum.IsDefined(arg0, arg1); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetUnderlyingType(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Type arg0 = ToLua.CheckMonoType(L, 1); + System.Type o = System.Enum.GetUnderlyingType(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CompareTo(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + System.Enum obj = (System.Enum)ToLua.CheckObject(L, 1); + object arg0 = ToLua.ToVarObject(L, 2); + int o = obj.CompareTo(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ToString(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + System.Enum obj = (System.Enum)ToLua.CheckObject(L, 1); + string o = obj.ToString(); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else if (count == 2) + { + System.Enum obj = (System.Enum)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + string o = obj.ToString(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.Enum.ToString"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Equals(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + System.Enum obj = (System.Enum)ToLua.CheckObject(L, 1); + object arg0 = ToLua.ToVarObject(L, 2); + bool o = obj != null ? obj.Equals(arg0) : arg0 == null; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetHashCode(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Enum obj = (System.Enum)ToLua.CheckObject(L, 1); + int o = obj.GetHashCode(); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Format(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + System.Type arg0 = ToLua.CheckMonoType(L, 1); + object arg1 = ToLua.ToVarObject(L, 2); + string arg2 = ToLua.CheckString(L, 3); + string o = System.Enum.Format(arg0, arg1, arg2); + LuaDLL.lua_pushstring(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Parse(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + System.Type arg0 = (System.Type)ToLua.ToObject(L, 1); + string arg1 = ToLua.ToString(L, 2); + object o = System.Enum.Parse(arg0, arg1); + ToLua.Push(L, (Enum)o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + System.Type arg0 = (System.Type)ToLua.ToObject(L, 1); + string arg1 = ToLua.ToString(L, 2); + bool arg2 = LuaDLL.lua_toboolean(L, 3); + object o = System.Enum.Parse(arg0, arg1, arg2); + ToLua.Push(L, (Enum)o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.Enum.Parse"); + } + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ToObject(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + System.Type arg0 = (System.Type)ToLua.ToObject(L, 1); + int arg1 = (int)LuaDLL.lua_tonumber(L, 2); + object o = System.Enum.ToObject(arg0, arg1); + ToLua.Push(L, (Enum)o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + System.Type arg0 = (System.Type)ToLua.ToObject(L, 1); + object arg1 = ToLua.ToVarObject(L, 2); + object o = System.Enum.ToObject(arg0, arg1); + ToLua.Push(L, (Enum)o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.Enum.ToObject"); + } + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ToInt(IntPtr L) + { + try + { + object arg0 = ToLua.CheckObject(L, 1); + int ret = Convert.ToInt32(arg0); + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/BaseType/System_EnumWrap.cs.meta b/Assets/LuaFramework/ToLua/BaseType/System_EnumWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..6a47e1b5cdd3770b0511b96e29a86da57a44e61a --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/System_EnumWrap.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9fd9d683a50920540914bdd15aa75290 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/BaseType/System_NullObjectWrap.cs b/Assets/LuaFramework/ToLua/BaseType/System_NullObjectWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..280eeb5cffb8c3aec2c5f53b6835329ab420b105 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/System_NullObjectWrap.cs @@ -0,0 +1,11 @@ +锘縰sing System; +using LuaInterface; + +public class System_NullObjectWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(NullObject), null, "null"); + L.EndClass(); + } +} diff --git a/Assets/LuaFramework/ToLua/BaseType/System_NullObjectWrap.cs.meta b/Assets/LuaFramework/ToLua/BaseType/System_NullObjectWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..689946a791b23c2d88acb01447c20d7241e4d467 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/System_NullObjectWrap.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bdcd3994912f4e145b1f12f3d76376b6 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/BaseType/System_ObjectWrap.cs b/Assets/LuaFramework/ToLua/BaseType/System_ObjectWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..d432ac973ae68cae88edbb1047ebc36072f2f2d6 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/System_ObjectWrap.cs @@ -0,0 +1,156 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class System_ObjectWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(System.Object), null); + L.RegFunction("Equals", Equals); + L.RegFunction("GetHashCode", GetHashCode); + L.RegFunction("GetType", GetType); + L.RegFunction("ToString", ToString); + L.RegFunction("ReferenceEquals", ReferenceEquals); + L.RegFunction("Destroy", Destroy); + L.RegFunction("New", _CreateSystem_Object); + L.RegFunction("__eq", op_Equality); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateSystem_Object(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + System.Object obj = new System.Object(); + ToLua.Push(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: System.Object.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Equals(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + object obj = ToLua.CheckObject(L, 1); + object arg0 = ToLua.ToVarObject(L, 2); + bool o = obj != null ? obj.Equals(arg0) : arg0 == null; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetHashCode(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + object obj = ToLua.CheckObject(L, 1); + int o = obj.GetHashCode(); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetType(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + object obj = ToLua.CheckObject(L, 1); + System.Type o = obj.GetType(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ToString(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + object obj = ToLua.CheckObject(L, 1); + string o = obj.ToString(); + LuaDLL.lua_pushstring(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ReferenceEquals(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + object arg0 = ToLua.ToVarObject(L, 1); + object arg1 = ToLua.ToVarObject(L, 2); + bool o = System.Object.ReferenceEquals(arg0, arg1); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + object arg0 = ToLua.ToVarObject(L, 1); + object arg1 = ToLua.ToVarObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Destroy(IntPtr L) + { + return ToLua.Destroy(L); + } +} + diff --git a/Assets/LuaFramework/ToLua/BaseType/System_ObjectWrap.cs.meta b/Assets/LuaFramework/ToLua/BaseType/System_ObjectWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..c75f969867b928d1065614ad211f7f13119b5500 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/System_ObjectWrap.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fcf1094389eec494d9d80c46f54f2a7e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/BaseType/System_StringWrap.cs b/Assets/LuaFramework/ToLua/BaseType/System_StringWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..bd40d641d76189d3b864b05354386fc42c4ef1e8 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/System_StringWrap.cs @@ -0,0 +1,1692 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class System_StringWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(System.String), typeof(System.Object)); + L.RegFunction("Equals", Equals); + L.RegFunction("Clone", Clone); + L.RegFunction("GetTypeCode", GetTypeCode); + L.RegFunction("CopyTo", CopyTo); + L.RegFunction("ToCharArray", ToCharArray); + L.RegFunction("Split", Split); + L.RegFunction("Substring", Substring); + L.RegFunction("Trim", Trim); + L.RegFunction("TrimStart", TrimStart); + L.RegFunction("TrimEnd", TrimEnd); + L.RegFunction("Compare", Compare); + L.RegFunction("CompareTo", CompareTo); + L.RegFunction("CompareOrdinal", CompareOrdinal); + L.RegFunction("EndsWith", EndsWith); + L.RegFunction("IndexOfAny", IndexOfAny); + L.RegFunction("IndexOf", IndexOf); + L.RegFunction("LastIndexOf", LastIndexOf); + L.RegFunction("LastIndexOfAny", LastIndexOfAny); + L.RegFunction("Contains", Contains); + L.RegFunction("IsNullOrEmpty", IsNullOrEmpty); + L.RegFunction("Normalize", Normalize); + L.RegFunction("IsNormalized", IsNormalized); + L.RegFunction("Remove", Remove); + L.RegFunction("PadLeft", PadLeft); + L.RegFunction("PadRight", PadRight); + L.RegFunction("StartsWith", StartsWith); + L.RegFunction("Replace", Replace); + L.RegFunction("ToLower", ToLower); + L.RegFunction("ToLowerInvariant", ToLowerInvariant); + L.RegFunction("ToUpper", ToUpper); + L.RegFunction("ToUpperInvariant", ToUpperInvariant); + L.RegFunction("ToString", ToString); + L.RegFunction("Format", Format); + L.RegFunction("Copy", Copy); + L.RegFunction("Concat", Concat); + L.RegFunction("Insert", Insert); + L.RegFunction("Intern", Intern); + L.RegFunction("IsInterned", IsInterned); + L.RegFunction("Join", Join); + L.RegFunction("GetEnumerator", GetEnumerator); + L.RegFunction("GetHashCode", GetHashCode); + L.RegFunction("New", _CreateSystem_String); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("Empty", get_Empty, null); + L.RegVar("Length", get_Length, null); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateSystem_String(IntPtr L) + { + try + { + LuaTypes luatype = LuaDLL.lua_type(L, 1); + + if (luatype == LuaTypes.LUA_TSTRING) + { + string arg0 = LuaDLL.lua_tostring(L, 1); + ToLua.PushSealed(L, arg0); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to string's ctor method"); + } + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Equals(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + string arg0 = ToLua.ToString(L, 2); + bool o = obj != null ? obj.Equals(arg0) : arg0 == null; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + object arg0 = ToLua.ToVarObject(L, 2); + bool o = obj != null ? obj.Equals(arg0) : arg0 == null; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 3) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + string arg0 = ToLua.CheckString(L, 2); + System.StringComparison arg1 = (System.StringComparison)ToLua.CheckObject(L, 3, typeof(System.StringComparison)); + bool o = obj.Equals(arg0, arg1); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.String.Equals"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Clone(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + object o = obj.Clone(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetTypeCode(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + System.TypeCode o = obj.GetTypeCode(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CopyTo(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 5); + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + char[] arg1 = ToLua.CheckCharBuffer(L, 3); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 5); + obj.CopyTo(arg0, arg1, arg2, arg3); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ToCharArray(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + char[] o = obj.ToCharArray(); + ToLua.Push(L, o); + return 1; + } + else if (count == 3) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + char[] o = obj.ToCharArray(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.String.ToCharArray"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Split(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + System.String obj = (System.String)ToLua.ToObject(L, 1); + char[] arg0 = ToLua.CheckCharBuffer(L, 2); + System.StringSplitOptions arg1 = (System.StringSplitOptions)ToLua.ToObject(L, 3); + string[] o = obj.Split(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + System.String obj = (System.String)ToLua.ToObject(L, 1); + char[] arg0 = ToLua.CheckCharBuffer(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + string[] o = obj.Split(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + System.String obj = (System.String)ToLua.ToObject(L, 1); + string[] arg0 = ToLua.ToStringArray(L, 2); + System.StringSplitOptions arg1 = (System.StringSplitOptions)ToLua.ToObject(L, 3); + string[] o = obj.Split(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 1)) + { + System.String obj = (System.String)ToLua.ToObject(L, 1); + string[] arg0 = ToLua.ToStringArray(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + System.StringSplitOptions arg2 = (System.StringSplitOptions)ToLua.ToObject(L, 4); + string[] o = obj.Split(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 1)) + { + System.String obj = (System.String)ToLua.ToObject(L, 1); + char[] arg0 = ToLua.CheckCharBuffer(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + System.StringSplitOptions arg2 = (System.StringSplitOptions)ToLua.ToObject(L, 4); + string[] o = obj.Split(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else if (TypeChecker.CheckTypes(L, 1) && TypeChecker.CheckParamsType(L, 2, count - 1)) + { + System.String obj = (System.String)ToLua.ToObject(L, 1); + char[] arg0 = ToLua.ToParamsChar(L, 2, count - 1); + string[] o = obj.Split(arg0); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.String.Split"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Substring(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + string o = obj.Substring(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else if (count == 3) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + string o = obj.Substring(arg0, arg1); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.String.Substring"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Trim(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + System.String obj = (System.String)ToLua.ToObject(L, 1); + string o = obj.Trim(); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else if (TypeChecker.CheckTypes(L, 1) && TypeChecker.CheckParamsType(L, 2, count - 1)) + { + System.String obj = (System.String)ToLua.ToObject(L, 1); + char[] arg0 = ToLua.ToParamsChar(L, 2, count - 1); + string o = obj.Trim(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.String.Trim"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TrimStart(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + char[] arg0 = ToLua.CheckParamsChar(L, 2, count - 1); + string o = obj.TrimStart(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TrimEnd(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + char[] arg0 = ToLua.CheckParamsChar(L, 2, count - 1); + string o = obj.TrimEnd(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Compare(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + string arg0 = ToLua.CheckString(L, 1); + string arg1 = ToLua.CheckString(L, 2); + int o = System.String.Compare(arg0, arg1); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 3)) + { + string arg0 = ToLua.CheckString(L, 1); + string arg1 = ToLua.CheckString(L, 2); + System.StringComparison arg2 = (System.StringComparison)ToLua.ToObject(L, 3); + int o = System.String.Compare(arg0, arg1, arg2); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 3)) + { + string arg0 = ToLua.CheckString(L, 1); + string arg1 = ToLua.CheckString(L, 2); + bool arg2 = LuaDLL.lua_toboolean(L, 3); + int o = System.String.Compare(arg0, arg1, arg2); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 3)) + { + string arg0 = ToLua.CheckString(L, 1); + string arg1 = ToLua.CheckString(L, 2); + System.Globalization.CultureInfo arg2 = (System.Globalization.CultureInfo)ToLua.ToObject(L, 3); + System.Globalization.CompareOptions arg3 = (System.Globalization.CompareOptions)ToLua.ToObject(L, 4); + int o = System.String.Compare(arg0, arg1, arg2, arg3); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 3)) + { + string arg0 = ToLua.CheckString(L, 1); + string arg1 = ToLua.CheckString(L, 2); + bool arg2 = LuaDLL.lua_toboolean(L, 3); + System.Globalization.CultureInfo arg3 = (System.Globalization.CultureInfo)ToLua.ToObject(L, 4); + int o = System.String.Compare(arg0, arg1, arg2, arg3); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 5) + { + string arg0 = ToLua.CheckString(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + string arg2 = ToLua.CheckString(L, 3); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 4); + int arg4 = (int)LuaDLL.luaL_checknumber(L, 5); + int o = System.String.Compare(arg0, arg1, arg2, arg3, arg4); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 6 && TypeChecker.CheckTypes(L, 6)) + { + string arg0 = ToLua.CheckString(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + string arg2 = ToLua.CheckString(L, 3); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 4); + int arg4 = (int)LuaDLL.luaL_checknumber(L, 5); + System.StringComparison arg5 = (System.StringComparison)ToLua.ToObject(L, 6); + int o = System.String.Compare(arg0, arg1, arg2, arg3, arg4, arg5); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 6 && TypeChecker.CheckTypes(L, 6)) + { + string arg0 = ToLua.CheckString(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + string arg2 = ToLua.CheckString(L, 3); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 4); + int arg4 = (int)LuaDLL.luaL_checknumber(L, 5); + bool arg5 = LuaDLL.lua_toboolean(L, 6); + int o = System.String.Compare(arg0, arg1, arg2, arg3, arg4, arg5); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 7 && TypeChecker.CheckTypes(L, 6)) + { + string arg0 = ToLua.CheckString(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + string arg2 = ToLua.CheckString(L, 3); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 4); + int arg4 = (int)LuaDLL.luaL_checknumber(L, 5); + System.Globalization.CultureInfo arg5 = (System.Globalization.CultureInfo)ToLua.ToObject(L, 6); + System.Globalization.CompareOptions arg6 = (System.Globalization.CompareOptions)ToLua.ToObject(L, 7); + int o = System.String.Compare(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 7 && TypeChecker.CheckTypes(L, 6)) + { + string arg0 = ToLua.CheckString(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + string arg2 = ToLua.CheckString(L, 3); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 4); + int arg4 = (int)LuaDLL.luaL_checknumber(L, 5); + bool arg5 = LuaDLL.lua_toboolean(L, 6); + System.Globalization.CultureInfo arg6 = (System.Globalization.CultureInfo)ToLua.ToObject(L, 7); + int o = System.String.Compare(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.String.Compare"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CompareTo(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + string arg0 = ToLua.ToString(L, 2); + int o = obj.CompareTo(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + object arg0 = ToLua.ToVarObject(L, 2); + int o = obj.CompareTo(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.String.CompareTo"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CompareOrdinal(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + string arg0 = ToLua.CheckString(L, 1); + string arg1 = ToLua.CheckString(L, 2); + int o = System.String.CompareOrdinal(arg0, arg1); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 5) + { + string arg0 = ToLua.CheckString(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + string arg2 = ToLua.CheckString(L, 3); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 4); + int arg4 = (int)LuaDLL.luaL_checknumber(L, 5); + int o = System.String.CompareOrdinal(arg0, arg1, arg2, arg3, arg4); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.String.CompareOrdinal"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int EndsWith(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + string arg0 = ToLua.CheckString(L, 2); + bool o = obj.EndsWith(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 3) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + string arg0 = ToLua.CheckString(L, 2); + System.StringComparison arg1 = (System.StringComparison)ToLua.CheckObject(L, 3, typeof(System.StringComparison)); + bool o = obj.EndsWith(arg0, arg1); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 4) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + string arg0 = ToLua.CheckString(L, 2); + bool arg1 = LuaDLL.luaL_checkboolean(L, 3); + System.Globalization.CultureInfo arg2 = (System.Globalization.CultureInfo)ToLua.CheckObject(L, 4); + bool o = obj.EndsWith(arg0, arg1, arg2); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.String.EndsWith"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IndexOfAny(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + char[] arg0 = ToLua.CheckCharBuffer(L, 2); + int o = obj.IndexOfAny(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 3) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + char[] arg0 = ToLua.CheckCharBuffer(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + int o = obj.IndexOfAny(arg0, arg1); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 4) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + char[] arg0 = ToLua.CheckCharBuffer(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); + int o = obj.IndexOfAny(arg0, arg1, arg2); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.String.IndexOfAny"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IndexOf(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + char arg0 = (char)LuaDLL.lua_tonumber(L, 2); + int o = obj.IndexOf(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + string arg0 = ToLua.ToString(L, 2); + int o = obj.IndexOf(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + string arg0 = ToLua.ToString(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + int o = obj.IndexOf(arg0, arg1); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + char arg0 = (char)LuaDLL.lua_tonumber(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + int o = obj.IndexOf(arg0, arg1); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + string arg0 = ToLua.ToString(L, 2); + System.StringComparison arg1 = (System.StringComparison)ToLua.ToObject(L, 3); + int o = obj.IndexOf(arg0, arg1); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + string arg0 = ToLua.ToString(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + int arg2 = (int)LuaDLL.lua_tonumber(L, 4); + int o = obj.IndexOf(arg0, arg1, arg2); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + string arg0 = ToLua.ToString(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + System.StringComparison arg2 = (System.StringComparison)ToLua.ToObject(L, 4); + int o = obj.IndexOf(arg0, arg1, arg2); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + char arg0 = (char)LuaDLL.lua_tonumber(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + int arg2 = (int)LuaDLL.lua_tonumber(L, 4); + int o = obj.IndexOf(arg0, arg1, arg2); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 5) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + string arg0 = ToLua.CheckString(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); + System.StringComparison arg3 = (System.StringComparison)ToLua.CheckObject(L, 5, typeof(System.StringComparison)); + int o = obj.IndexOf(arg0, arg1, arg2, arg3); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.String.IndexOf"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LastIndexOf(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + char arg0 = (char)LuaDLL.lua_tonumber(L, 2); + int o = obj.LastIndexOf(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + string arg0 = ToLua.ToString(L, 2); + int o = obj.LastIndexOf(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + string arg0 = ToLua.ToString(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + int o = obj.LastIndexOf(arg0, arg1); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + char arg0 = (char)LuaDLL.lua_tonumber(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + int o = obj.LastIndexOf(arg0, arg1); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + string arg0 = ToLua.ToString(L, 2); + System.StringComparison arg1 = (System.StringComparison)ToLua.ToObject(L, 3); + int o = obj.LastIndexOf(arg0, arg1); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + string arg0 = ToLua.ToString(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + int arg2 = (int)LuaDLL.lua_tonumber(L, 4); + int o = obj.LastIndexOf(arg0, arg1, arg2); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + string arg0 = ToLua.ToString(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + System.StringComparison arg2 = (System.StringComparison)ToLua.ToObject(L, 4); + int o = obj.LastIndexOf(arg0, arg1, arg2); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + char arg0 = (char)LuaDLL.lua_tonumber(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + int arg2 = (int)LuaDLL.lua_tonumber(L, 4); + int o = obj.LastIndexOf(arg0, arg1, arg2); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 5) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + string arg0 = ToLua.CheckString(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); + System.StringComparison arg3 = (System.StringComparison)ToLua.CheckObject(L, 5, typeof(System.StringComparison)); + int o = obj.LastIndexOf(arg0, arg1, arg2, arg3); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.String.LastIndexOf"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LastIndexOfAny(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + char[] arg0 = ToLua.CheckCharBuffer(L, 2); + int o = obj.LastIndexOfAny(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 3) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + char[] arg0 = ToLua.CheckCharBuffer(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + int o = obj.LastIndexOfAny(arg0, arg1); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 4) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + char[] arg0 = ToLua.CheckCharBuffer(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); + int o = obj.LastIndexOfAny(arg0, arg1, arg2); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.String.LastIndexOfAny"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Contains(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + string arg0 = ToLua.CheckString(L, 2); + bool o = obj.Contains(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IsNullOrEmpty(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + bool o = System.String.IsNullOrEmpty(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Normalize(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + string o = obj.Normalize(); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else if (count == 2) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + System.Text.NormalizationForm arg0 = (System.Text.NormalizationForm)ToLua.CheckObject(L, 2, typeof(System.Text.NormalizationForm)); + string o = obj.Normalize(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.String.Normalize"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IsNormalized(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + bool o = obj.IsNormalized(); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 2) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + System.Text.NormalizationForm arg0 = (System.Text.NormalizationForm)ToLua.CheckObject(L, 2, typeof(System.Text.NormalizationForm)); + bool o = obj.IsNormalized(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.String.IsNormalized"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Remove(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + string o = obj.Remove(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else if (count == 3) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + string o = obj.Remove(arg0, arg1); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.String.Remove"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int PadLeft(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + string o = obj.PadLeft(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else if (count == 3) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + char arg1 = (char)LuaDLL.luaL_checknumber(L, 3); + string o = obj.PadLeft(arg0, arg1); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.String.PadLeft"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int PadRight(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + string o = obj.PadRight(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else if (count == 3) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + char arg1 = (char)LuaDLL.luaL_checknumber(L, 3); + string o = obj.PadRight(arg0, arg1); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.String.PadRight"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int StartsWith(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + string arg0 = ToLua.CheckString(L, 2); + bool o = obj.StartsWith(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 3) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + string arg0 = ToLua.CheckString(L, 2); + System.StringComparison arg1 = (System.StringComparison)ToLua.CheckObject(L, 3, typeof(System.StringComparison)); + bool o = obj.StartsWith(arg0, arg1); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 4) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + string arg0 = ToLua.CheckString(L, 2); + bool arg1 = LuaDLL.luaL_checkboolean(L, 3); + System.Globalization.CultureInfo arg2 = (System.Globalization.CultureInfo)ToLua.CheckObject(L, 4); + bool o = obj.StartsWith(arg0, arg1, arg2); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.String.StartsWith"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Replace(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + string arg0 = ToLua.ToString(L, 2); + string arg1 = ToLua.ToString(L, 3); + string o = obj.Replace(arg0, arg1); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + char arg0 = (char)LuaDLL.lua_tonumber(L, 2); + char arg1 = (char)LuaDLL.lua_tonumber(L, 3); + string o = obj.Replace(arg0, arg1); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.String.Replace"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ToLower(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + string o = obj.ToLower(); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else if (count == 2) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + System.Globalization.CultureInfo arg0 = (System.Globalization.CultureInfo)ToLua.CheckObject(L, 2); + string o = obj.ToLower(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.String.ToLower"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ToLowerInvariant(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + string o = obj.ToLowerInvariant(); + LuaDLL.lua_pushstring(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ToUpper(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + string o = obj.ToUpper(); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else if (count == 2) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + System.Globalization.CultureInfo arg0 = (System.Globalization.CultureInfo)ToLua.CheckObject(L, 2); + string o = obj.ToUpper(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.String.ToUpper"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ToUpperInvariant(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + string o = obj.ToUpperInvariant(); + LuaDLL.lua_pushstring(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ToString(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + string o = obj.ToString(); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else if (count == 2) + { + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + System.IFormatProvider arg0 = (System.IFormatProvider)ToLua.CheckObject(L, 2); + string o = obj.ToString(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.String.ToString"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Format(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + object arg1 = ToLua.ToVarObject(L, 2); + string o = System.String.Format(arg0, arg1); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + object arg1 = ToLua.ToVarObject(L, 2); + object arg2 = ToLua.ToVarObject(L, 3); + string o = System.String.Format(arg0, arg1, arg2); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + object arg1 = ToLua.ToVarObject(L, 2); + object arg2 = ToLua.ToVarObject(L, 3); + object arg3 = ToLua.ToVarObject(L, 4); + string o = System.String.Format(arg0, arg1, arg2, arg3); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else if (TypeChecker.CheckTypes(L, 1) && TypeChecker.CheckParamsType(L, 3, count - 2)) + { + System.IFormatProvider arg0 = (System.IFormatProvider)ToLua.ToObject(L, 1); + string arg1 = ToLua.ToString(L, 2); + object[] arg2 = ToLua.ToParamsObject(L, 3, count - 2); + string o = System.String.Format(arg0, arg1, arg2); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else if (TypeChecker.CheckTypes(L, 1) && TypeChecker.CheckParamsType(L, 2, count - 1)) + { + string arg0 = ToLua.ToString(L, 1); + object[] arg1 = ToLua.ToParamsObject(L, 2, count - 1); + string o = System.String.Format(arg0, arg1); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.String.Format"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Copy(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + string o = System.String.Copy(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Concat(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + object arg0 = ToLua.ToVarObject(L, 1); + string o = System.String.Concat(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + string arg1 = ToLua.ToString(L, 2); + string o = System.String.Concat(arg0, arg1); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + object arg0 = ToLua.ToVarObject(L, 1); + object arg1 = ToLua.ToVarObject(L, 2); + string o = System.String.Concat(arg0, arg1); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + string arg1 = ToLua.ToString(L, 2); + string arg2 = ToLua.ToString(L, 3); + string o = System.String.Concat(arg0, arg1, arg2); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + object arg0 = ToLua.ToVarObject(L, 1); + object arg1 = ToLua.ToVarObject(L, 2); + object arg2 = ToLua.ToVarObject(L, 3); + string o = System.String.Concat(arg0, arg1, arg2); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + string arg1 = ToLua.ToString(L, 2); + string arg2 = ToLua.ToString(L, 3); + string arg3 = ToLua.ToString(L, 4); + string o = System.String.Concat(arg0, arg1, arg2, arg3); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 1)) + { + object arg0 = ToLua.ToVarObject(L, 1); + object arg1 = ToLua.ToVarObject(L, 2); + object arg2 = ToLua.ToVarObject(L, 3); + object arg3 = ToLua.ToVarObject(L, 4); + string o = System.String.Concat(arg0, arg1, arg2, arg3); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else if (TypeChecker.CheckParamsType(L, 1, count)) + { + string[] arg0 = ToLua.ToParamsString(L, 1, count); + string o = System.String.Concat(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else if (TypeChecker.CheckParamsType(L, 1, count)) + { + object[] arg0 = ToLua.ToParamsObject(L, 1, count); + string o = System.String.Concat(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.String.Concat"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Insert(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + string arg1 = ToLua.CheckString(L, 3); + string o = obj.Insert(arg0, arg1); + LuaDLL.lua_pushstring(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Intern(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + string o = System.String.Intern(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IsInterned(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + string o = System.String.IsInterned(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Join(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + string arg0 = ToLua.CheckString(L, 1); + string[] arg1 = ToLua.CheckStringArray(L, 2); + string o = System.String.Join(arg0, arg1); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else if (count == 4) + { + string arg0 = ToLua.CheckString(L, 1); + string[] arg1 = ToLua.CheckStringArray(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 4); + string o = System.String.Join(arg0, arg1, arg2, arg3); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.String.Join"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetEnumerator(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + System.Collections.IEnumerator o = obj.GetEnumerator(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetHashCode(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String)); + int o = obj.GetHashCode(); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + string arg0 = ToLua.ToString(L, 1); + string arg1 = ToLua.ToString(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Empty(IntPtr L) + { + try + { + LuaDLL.lua_pushstring(L, System.String.Empty); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Length(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.String obj = (System.String)o; + int ret = obj.Length; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index Length on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/BaseType/System_StringWrap.cs.meta b/Assets/LuaFramework/ToLua/BaseType/System_StringWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..95199fb901e17c24cd2c2de7fbeb4853c5e39489 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/System_StringWrap.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6380cf60ae81034418e4fe4dabc06bc2 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/BaseType/System_TypeWrap.cs b/Assets/LuaFramework/ToLua/BaseType/System_TypeWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..60f5a180a494416e892d853550d2facbf7fe130b --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/System_TypeWrap.cs @@ -0,0 +1,1930 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class System_TypeWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(System.Type), typeof(System.Object)); + L.RegFunction("Equals", Equals); + L.RegFunction("GetType", GetType); + L.RegFunction("GetTypeArray", GetTypeArray); + L.RegFunction("GetTypeCode", GetTypeCode); + L.RegFunction("GetTypeFromHandle", GetTypeFromHandle); + L.RegFunction("GetTypeHandle", GetTypeHandle); + L.RegFunction("IsSubclassOf", IsSubclassOf); + L.RegFunction("FindInterfaces", FindInterfaces); + L.RegFunction("GetInterface", GetInterface); + L.RegFunction("GetInterfaceMap", GetInterfaceMap); + L.RegFunction("GetInterfaces", GetInterfaces); + L.RegFunction("IsAssignableFrom", IsAssignableFrom); + L.RegFunction("IsInstanceOfType", IsInstanceOfType); + L.RegFunction("GetArrayRank", GetArrayRank); + L.RegFunction("GetElementType", GetElementType); + L.RegFunction("GetHashCode", GetHashCode); + L.RegFunction("GetNestedType", GetNestedType); + L.RegFunction("GetNestedTypes", GetNestedTypes); + L.RegFunction("GetDefaultMembers", GetDefaultMembers); + L.RegFunction("FindMembers", FindMembers); + L.RegFunction("InvokeMember", InvokeMember); + L.RegFunction("ToString", ToString); + L.RegFunction("GetGenericArguments", GetGenericArguments); + L.RegFunction("GetGenericTypeDefinition", GetGenericTypeDefinition); + L.RegFunction("MakeGenericType", MakeGenericType); + L.RegFunction("GetGenericParameterConstraints", GetGenericParameterConstraints); + L.RegFunction("MakeArrayType", MakeArrayType); + L.RegFunction("MakeByRefType", MakeByRefType); + L.RegFunction("MakePointerType", MakePointerType); + L.RegFunction("ReflectionOnlyGetType", ReflectionOnlyGetType); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("Delimiter", get_Delimiter, null); + L.RegVar("EmptyTypes", get_EmptyTypes, null); + L.RegVar("FilterAttribute", get_FilterAttribute, null); + L.RegVar("FilterName", get_FilterName, null); + L.RegVar("FilterNameIgnoreCase", get_FilterNameIgnoreCase, null); + L.RegVar("Missing", get_Missing, null); + L.RegVar("Assembly", get_Assembly, null); + L.RegVar("AssemblyQualifiedName", get_AssemblyQualifiedName, null); + L.RegVar("Attributes", get_Attributes, null); + L.RegVar("BaseType", get_BaseType, null); + L.RegVar("DeclaringType", get_DeclaringType, null); + L.RegVar("DefaultBinder", get_DefaultBinder, null); + L.RegVar("FullName", get_FullName, null); + L.RegVar("GUID", get_GUID, null); + L.RegVar("HasElementType", get_HasElementType, null); + L.RegVar("IsAbstract", get_IsAbstract, null); + L.RegVar("IsAnsiClass", get_IsAnsiClass, null); + L.RegVar("IsArray", get_IsArray, null); + L.RegVar("IsAutoClass", get_IsAutoClass, null); + L.RegVar("IsAutoLayout", get_IsAutoLayout, null); + L.RegVar("IsByRef", get_IsByRef, null); + L.RegVar("IsClass", get_IsClass, null); + L.RegVar("IsCOMObject", get_IsCOMObject, null); + L.RegVar("IsContextful", get_IsContextful, null); + L.RegVar("IsEnum", get_IsEnum, null); + L.RegVar("IsExplicitLayout", get_IsExplicitLayout, null); + L.RegVar("IsImport", get_IsImport, null); + L.RegVar("IsInterface", get_IsInterface, null); + L.RegVar("IsLayoutSequential", get_IsLayoutSequential, null); + L.RegVar("IsMarshalByRef", get_IsMarshalByRef, null); + L.RegVar("IsNestedAssembly", get_IsNestedAssembly, null); + L.RegVar("IsNestedFamANDAssem", get_IsNestedFamANDAssem, null); + L.RegVar("IsNestedFamily", get_IsNestedFamily, null); + L.RegVar("IsNestedFamORAssem", get_IsNestedFamORAssem, null); + L.RegVar("IsNestedPrivate", get_IsNestedPrivate, null); + L.RegVar("IsNestedPublic", get_IsNestedPublic, null); + L.RegVar("IsNotPublic", get_IsNotPublic, null); + L.RegVar("IsPointer", get_IsPointer, null); + L.RegVar("IsPrimitive", get_IsPrimitive, null); + L.RegVar("IsPublic", get_IsPublic, null); + L.RegVar("IsSealed", get_IsSealed, null); + L.RegVar("IsSerializable", get_IsSerializable, null); + L.RegVar("IsSpecialName", get_IsSpecialName, null); + L.RegVar("IsUnicodeClass", get_IsUnicodeClass, null); + L.RegVar("IsValueType", get_IsValueType, null); + L.RegVar("MemberType", get_MemberType, null); + L.RegVar("Module", get_Module, null); + L.RegVar("Namespace", get_Namespace, null); + L.RegVar("ReflectedType", get_ReflectedType, null); + L.RegVar("TypeHandle", get_TypeHandle, null); + L.RegVar("TypeInitializer", get_TypeInitializer, null); + L.RegVar("UnderlyingSystemType", get_UnderlyingSystemType, null); + L.RegVar("ContainsGenericParameters", get_ContainsGenericParameters, null); + L.RegVar("IsGenericTypeDefinition", get_IsGenericTypeDefinition, null); + L.RegVar("IsGenericType", get_IsGenericType, null); + L.RegVar("IsGenericParameter", get_IsGenericParameter, null); + L.RegVar("IsNested", get_IsNested, null); + L.RegVar("IsVisible", get_IsVisible, null); + L.RegVar("GenericParameterPosition", get_GenericParameterPosition, null); + L.RegVar("GenericParameterAttributes", get_GenericParameterAttributes, null); + L.RegVar("DeclaringMethod", get_DeclaringMethod, null); + L.RegVar("StructLayoutAttribute", get_StructLayoutAttribute, null); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Equals(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + System.Type obj = ToLua.CheckMonoType(L, 1); + System.Type arg0 = (System.Type)ToLua.ToObject(L, 2); + bool o = obj != null ? obj.Equals(arg0) : arg0 == null; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + System.Type obj = ToLua.CheckMonoType(L, 1); + object arg0 = ToLua.ToVarObject(L, 2); + bool o = obj != null ? obj.Equals(arg0) : arg0 == null; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.Type.Equals"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetType(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + System.Type obj = (System.Type)ToLua.ToObject(L, 1); + System.Type o = obj.GetType(); + ToLua.Push(L, o); + return 1; + } + else if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + System.Type o = System.Type.GetType(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 2) + { + string arg0 = ToLua.CheckString(L, 1); + bool arg1 = LuaDLL.luaL_checkboolean(L, 2); + System.Type o = System.Type.GetType(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else if (count == 3) + { + string arg0 = ToLua.CheckString(L, 1); + bool arg1 = LuaDLL.luaL_checkboolean(L, 2); + bool arg2 = LuaDLL.luaL_checkboolean(L, 3); + System.Type o = System.Type.GetType(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.Type.GetType"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetTypeArray(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + object[] arg0 = ToLua.CheckObjectArray(L, 1); + System.Type[] o = System.Type.GetTypeArray(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetTypeCode(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Type arg0 = ToLua.CheckMonoType(L, 1); + System.TypeCode o = System.Type.GetTypeCode(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetTypeFromHandle(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.RuntimeTypeHandle arg0 = StackTraits.Check(L, 1); + System.Type o = System.Type.GetTypeFromHandle(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetTypeHandle(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + object arg0 = ToLua.ToVarObject(L, 1); + System.RuntimeTypeHandle o = System.Type.GetTypeHandle(arg0); + ToLua.PushValue(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IsSubclassOf(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + System.Type obj = ToLua.CheckMonoType(L, 1); + System.Type arg0 = ToLua.CheckMonoType(L, 2); + bool o = obj.IsSubclassOf(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int FindInterfaces(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + System.Type obj = ToLua.CheckMonoType(L, 1); + System.Reflection.TypeFilter arg0 = (System.Reflection.TypeFilter)ToLua.CheckDelegate(L, 2); + object arg1 = ToLua.ToVarObject(L, 3); + System.Type[] o = obj.FindInterfaces(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetInterface(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + System.Type obj = ToLua.CheckMonoType(L, 1); + string arg0 = ToLua.CheckString(L, 2); + System.Type o = obj.GetInterface(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 3) + { + System.Type obj = ToLua.CheckMonoType(L, 1); + string arg0 = ToLua.CheckString(L, 2); + bool arg1 = LuaDLL.luaL_checkboolean(L, 3); + System.Type o = obj.GetInterface(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.Type.GetInterface"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetInterfaceMap(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + System.Type obj = ToLua.CheckMonoType(L, 1); + System.Type arg0 = ToLua.CheckMonoType(L, 2); + System.Reflection.InterfaceMapping o = obj.GetInterfaceMap(arg0); + ToLua.PushValue(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetInterfaces(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Type obj = ToLua.CheckMonoType(L, 1); + System.Type[] o = obj.GetInterfaces(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IsAssignableFrom(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + System.Type obj = ToLua.CheckMonoType(L, 1); + System.Type arg0 = ToLua.CheckMonoType(L, 2); + bool o = obj.IsAssignableFrom(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IsInstanceOfType(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + System.Type obj = ToLua.CheckMonoType(L, 1); + object arg0 = ToLua.ToVarObject(L, 2); + bool o = obj.IsInstanceOfType(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetArrayRank(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Type obj = ToLua.CheckMonoType(L, 1); + int o = obj.GetArrayRank(); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetElementType(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Type obj = ToLua.CheckMonoType(L, 1); + System.Type o = obj.GetElementType(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetHashCode(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Type obj = ToLua.CheckMonoType(L, 1); + int o = obj.GetHashCode(); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetNestedType(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + System.Type obj = ToLua.CheckMonoType(L, 1); + string arg0 = ToLua.CheckString(L, 2); + System.Type o = obj.GetNestedType(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 3) + { + System.Type obj = ToLua.CheckMonoType(L, 1); + string arg0 = ToLua.CheckString(L, 2); + System.Reflection.BindingFlags arg1 = (System.Reflection.BindingFlags)LuaDLL.luaL_checknumber(L, 3); + System.Type o = obj.GetNestedType(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.Type.GetNestedType"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetNestedTypes(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + System.Type obj = ToLua.CheckMonoType(L, 1); + System.Type[] o = obj.GetNestedTypes(); + ToLua.Push(L, o); + return 1; + } + else if (count == 2) + { + System.Type obj = ToLua.CheckMonoType(L, 1); + System.Reflection.BindingFlags arg0 = (System.Reflection.BindingFlags)LuaDLL.luaL_checknumber(L, 2); + System.Type[] o = obj.GetNestedTypes(arg0); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.Type.GetNestedTypes"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetDefaultMembers(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Type obj = ToLua.CheckMonoType(L, 1); + System.Reflection.MemberInfo[] o = obj.GetDefaultMembers(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int FindMembers(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 5); + System.Type obj = ToLua.CheckMonoType(L, 1); + System.Reflection.MemberTypes arg0 = (System.Reflection.MemberTypes)ToLua.CheckObject(L, 2, typeof(System.Reflection.MemberTypes)); + System.Reflection.BindingFlags arg1 = (System.Reflection.BindingFlags)LuaDLL.luaL_checknumber(L, 3); + System.Reflection.MemberFilter arg2 = (System.Reflection.MemberFilter)ToLua.CheckDelegate(L, 4); + object arg3 = ToLua.ToVarObject(L, 5); + System.Reflection.MemberInfo[] o = obj.FindMembers(arg0, arg1, arg2, arg3); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int InvokeMember(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 6) + { + System.Type obj = ToLua.CheckMonoType(L, 1); + string arg0 = ToLua.CheckString(L, 2); + System.Reflection.BindingFlags arg1 = (System.Reflection.BindingFlags)LuaDLL.luaL_checknumber(L, 3); + System.Reflection.Binder arg2 = (System.Reflection.Binder)ToLua.CheckObject(L, 4); + object arg3 = ToLua.ToVarObject(L, 5); + object[] arg4 = ToLua.CheckObjectArray(L, 6); + object o = obj.InvokeMember(arg0, arg1, arg2, arg3, arg4); + ToLua.Push(L, o); + return 1; + } + else if (count == 7) + { + System.Type obj = ToLua.CheckMonoType(L, 1); + string arg0 = ToLua.CheckString(L, 2); + System.Reflection.BindingFlags arg1 = (System.Reflection.BindingFlags)LuaDLL.luaL_checknumber(L, 3); + System.Reflection.Binder arg2 = (System.Reflection.Binder)ToLua.CheckObject(L, 4); + object arg3 = ToLua.ToVarObject(L, 5); + object[] arg4 = ToLua.CheckObjectArray(L, 6); + System.Globalization.CultureInfo arg5 = (System.Globalization.CultureInfo)ToLua.CheckObject(L, 7); + object o = obj.InvokeMember(arg0, arg1, arg2, arg3, arg4, arg5); + ToLua.Push(L, o); + return 1; + } + else if (count == 9) + { + System.Type obj = ToLua.CheckMonoType(L, 1); + string arg0 = ToLua.CheckString(L, 2); + System.Reflection.BindingFlags arg1 = (System.Reflection.BindingFlags)LuaDLL.luaL_checknumber(L, 3); + System.Reflection.Binder arg2 = (System.Reflection.Binder)ToLua.CheckObject(L, 4); + object arg3 = ToLua.ToVarObject(L, 5); + object[] arg4 = ToLua.CheckObjectArray(L, 6); + System.Reflection.ParameterModifier[] arg5 = ToLua.CheckStructArray(L, 7); + System.Globalization.CultureInfo arg6 = (System.Globalization.CultureInfo)ToLua.CheckObject(L, 8); + string[] arg7 = ToLua.CheckStringArray(L, 9); + object o = obj.InvokeMember(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.Type.InvokeMember"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ToString(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Type obj = ToLua.CheckMonoType(L, 1); + string o = obj.ToString(); + LuaDLL.lua_pushstring(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetGenericArguments(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Type obj = ToLua.CheckMonoType(L, 1); + System.Type[] o = obj.GetGenericArguments(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetGenericTypeDefinition(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Type obj = ToLua.CheckMonoType(L, 1); + System.Type o = obj.GetGenericTypeDefinition(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int MakeGenericType(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + System.Type obj = ToLua.CheckMonoType(L, 1); + System.Type[] arg0 = ToLua.CheckParamsObject(L, 2, count - 1); + System.Type o = obj.MakeGenericType(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetGenericParameterConstraints(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Type obj = ToLua.CheckMonoType(L, 1); + System.Type[] o = obj.GetGenericParameterConstraints(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int MakeArrayType(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + System.Type obj = ToLua.CheckMonoType(L, 1); + System.Type o = obj.MakeArrayType(); + ToLua.Push(L, o); + return 1; + } + else if (count == 2) + { + System.Type obj = ToLua.CheckMonoType(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + System.Type o = obj.MakeArrayType(arg0); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: System.Type.MakeArrayType"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int MakeByRefType(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Type obj = ToLua.CheckMonoType(L, 1); + System.Type o = obj.MakeByRefType(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int MakePointerType(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Type obj = ToLua.CheckMonoType(L, 1); + System.Type o = obj.MakePointerType(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ReflectionOnlyGetType(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + string arg0 = ToLua.CheckString(L, 1); + bool arg1 = LuaDLL.luaL_checkboolean(L, 2); + bool arg2 = LuaDLL.luaL_checkboolean(L, 3); + System.Type o = System.Type.ReflectionOnlyGetType(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Delimiter(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, System.Type.Delimiter); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_EmptyTypes(IntPtr L) + { + try + { + ToLua.Push(L, System.Type.EmptyTypes); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_FilterAttribute(IntPtr L) + { + try + { + ToLua.Push(L, System.Type.FilterAttribute); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_FilterName(IntPtr L) + { + try + { + ToLua.Push(L, System.Type.FilterName); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_FilterNameIgnoreCase(IntPtr L) + { + try + { + ToLua.Push(L, System.Type.FilterNameIgnoreCase); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Missing(IntPtr L) + { + try + { + ToLua.Push(L, System.Type.Missing); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Assembly(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + System.Reflection.Assembly ret = obj.Assembly; + ToLua.PushObject(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index Assembly on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_AssemblyQualifiedName(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + string ret = obj.AssemblyQualifiedName; + LuaDLL.lua_pushstring(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index AssemblyQualifiedName on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Attributes(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + System.Reflection.TypeAttributes ret = obj.Attributes; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index Attributes on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_BaseType(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + System.Type ret = obj.BaseType; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index BaseType on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_DeclaringType(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + System.Type ret = obj.DeclaringType; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index DeclaringType on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_DefaultBinder(IntPtr L) + { + try + { + ToLua.PushObject(L, System.Type.DefaultBinder); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_FullName(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + string ret = obj.FullName; + LuaDLL.lua_pushstring(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index FullName on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_GUID(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + System.Guid ret = obj.GUID; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index GUID on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_HasElementType(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.HasElementType; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index HasElementType on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsAbstract(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsAbstract; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsAbstract on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsAnsiClass(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsAnsiClass; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsAnsiClass on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsArray(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsArray; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsArray on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsAutoClass(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsAutoClass; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsAutoClass on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsAutoLayout(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsAutoLayout; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsAutoLayout on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsByRef(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsByRef; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsByRef on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsClass(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsClass; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsClass on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsCOMObject(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsCOMObject; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsCOMObject on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsContextful(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsContextful; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsContextful on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsEnum(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsEnum; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsEnum on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsExplicitLayout(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsExplicitLayout; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsExplicitLayout on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsImport(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsImport; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsImport on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsInterface(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsInterface; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsInterface on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsLayoutSequential(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsLayoutSequential; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsLayoutSequential on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsMarshalByRef(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsMarshalByRef; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsMarshalByRef on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsNestedAssembly(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsNestedAssembly; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsNestedAssembly on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsNestedFamANDAssem(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsNestedFamANDAssem; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsNestedFamANDAssem on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsNestedFamily(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsNestedFamily; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsNestedFamily on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsNestedFamORAssem(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsNestedFamORAssem; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsNestedFamORAssem on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsNestedPrivate(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsNestedPrivate; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsNestedPrivate on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsNestedPublic(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsNestedPublic; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsNestedPublic on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsNotPublic(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsNotPublic; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsNotPublic on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsPointer(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsPointer; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsPointer on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsPrimitive(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsPrimitive; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsPrimitive on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsPublic(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsPublic; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsPublic on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsSealed(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsSealed; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsSealed on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsSerializable(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsSerializable; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsSerializable on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsSpecialName(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsSpecialName; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsSpecialName on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsUnicodeClass(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsUnicodeClass; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsUnicodeClass on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsValueType(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsValueType; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsValueType on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_MemberType(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + System.Reflection.MemberTypes ret = obj.MemberType; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index MemberType on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Module(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + System.Reflection.Module ret = obj.Module; + ToLua.PushObject(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index Module on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Namespace(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + string ret = obj.Namespace; + LuaDLL.lua_pushstring(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index Namespace on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_ReflectedType(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + System.Type ret = obj.ReflectedType; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index ReflectedType on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_TypeHandle(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + System.RuntimeTypeHandle ret = obj.TypeHandle; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index TypeHandle on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_TypeInitializer(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + System.Reflection.ConstructorInfo ret = obj.TypeInitializer; + ToLua.PushObject(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index TypeInitializer on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_UnderlyingSystemType(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + System.Type ret = obj.UnderlyingSystemType; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index UnderlyingSystemType on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_ContainsGenericParameters(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.ContainsGenericParameters; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index ContainsGenericParameters on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsGenericTypeDefinition(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsGenericTypeDefinition; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsGenericTypeDefinition on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsGenericType(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsGenericType; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsGenericType on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsGenericParameter(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsGenericParameter; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsGenericParameter on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsNested(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsNested; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsNested on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsVisible(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + bool ret = obj.IsVisible; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index IsVisible on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_GenericParameterPosition(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + int ret = obj.GenericParameterPosition; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index GenericParameterPosition on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_GenericParameterAttributes(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + System.Reflection.GenericParameterAttributes ret = obj.GenericParameterAttributes; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index GenericParameterAttributes on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_DeclaringMethod(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + System.Reflection.MethodBase ret = obj.DeclaringMethod; + ToLua.PushObject(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index DeclaringMethod on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_StructLayoutAttribute(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Type obj = (System.Type)o; + System.Runtime.InteropServices.StructLayoutAttribute ret = obj.StructLayoutAttribute; + ToLua.PushSealed(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index StructLayoutAttribute on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/BaseType/System_TypeWrap.cs.meta b/Assets/LuaFramework/ToLua/BaseType/System_TypeWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..35ee934c5a63a0b9800f8708f4f37e6ad468bd18 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/System_TypeWrap.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a713f1fe057cf7248b09e045a105933b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/BaseType/UnityEngine_CoroutineWrap.cs b/Assets/LuaFramework/ToLua/BaseType/UnityEngine_CoroutineWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..ddfbfd05d73bb853d0fb6080c6447c66aeb57565 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/UnityEngine_CoroutineWrap.cs @@ -0,0 +1,12 @@ +锘縰sing System; +using LuaInterface; + +public class UnityEngine_CoroutineWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.Coroutine), null); + L.RegFunction("__tostring", ToLua.op_ToString); + L.EndClass(); + } +} diff --git a/Assets/LuaFramework/ToLua/BaseType/UnityEngine_CoroutineWrap.cs.meta b/Assets/LuaFramework/ToLua/BaseType/UnityEngine_CoroutineWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..28205327f6bb126ae6a0f2f7a0adf32d2a43ea2b --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/UnityEngine_CoroutineWrap.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 0142bbe402aab764582bb960d6966d34 +timeCreated: 1471422858 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/BaseType/UnityEngine_MeshRendererWrap.cs b/Assets/LuaFramework/ToLua/BaseType/UnityEngine_MeshRendererWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..4823dcafcba950e1858ca3df73230d5ba35249a3 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/UnityEngine_MeshRendererWrap.cs @@ -0,0 +1,273 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_MeshRendererWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.MeshRenderer), typeof(UnityEngine.Renderer)); + L.RegFunction("New", _CreateUnityEngine_MeshRenderer); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("additionalVertexStreams", get_additionalVertexStreams, set_additionalVertexStreams); + L.RegVar("enlightenVertexStream", get_enlightenVertexStream, set_enlightenVertexStream); + L.RegVar("subMeshStartIndex", get_subMeshStartIndex, null); + L.RegVar("scaleInLightmap", get_scaleInLightmap, set_scaleInLightmap); + L.RegVar("receiveGI", get_receiveGI, set_receiveGI); + L.RegVar("stitchLightmapSeams", get_stitchLightmapSeams, set_stitchLightmapSeams); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateUnityEngine_MeshRenderer(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + UnityEngine.MeshRenderer obj = new UnityEngine.MeshRenderer(); + ToLua.Push(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.MeshRenderer.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_additionalVertexStreams(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.MeshRenderer obj = (UnityEngine.MeshRenderer)o; + UnityEngine.Mesh ret = obj.additionalVertexStreams; + ToLua.PushSealed(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index additionalVertexStreams on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_enlightenVertexStream(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.MeshRenderer obj = (UnityEngine.MeshRenderer)o; + UnityEngine.Mesh ret = obj.enlightenVertexStream; + ToLua.PushSealed(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index enlightenVertexStream on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_subMeshStartIndex(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.MeshRenderer obj = (UnityEngine.MeshRenderer)o; + int ret = obj.subMeshStartIndex; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index subMeshStartIndex on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_scaleInLightmap(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.MeshRenderer obj = (UnityEngine.MeshRenderer)o; + //float ret = obj.scaleInLightmap; + //LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index scaleInLightmap on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_receiveGI(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.MeshRenderer obj = (UnityEngine.MeshRenderer)o; + //UnityEngine.ReceiveGI ret = obj.receiveGI; + //ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index receiveGI on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_stitchLightmapSeams(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.MeshRenderer obj = (UnityEngine.MeshRenderer)o; + //bool ret = obj.stitchLightmapSeams; + //LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index stitchLightmapSeams on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_additionalVertexStreams(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.MeshRenderer obj = (UnityEngine.MeshRenderer)o; + UnityEngine.Mesh arg0 = (UnityEngine.Mesh)ToLua.CheckObject(L, 2, typeof(UnityEngine.Mesh)); + obj.additionalVertexStreams = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index additionalVertexStreams on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_enlightenVertexStream(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.MeshRenderer obj = (UnityEngine.MeshRenderer)o; + UnityEngine.Mesh arg0 = (UnityEngine.Mesh)ToLua.CheckObject(L, 2, typeof(UnityEngine.Mesh)); + obj.enlightenVertexStream = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index enlightenVertexStream on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_scaleInLightmap(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.MeshRenderer obj = (UnityEngine.MeshRenderer)o; + //float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + //obj.scaleInLightmap = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index scaleInLightmap on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_receiveGI(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.MeshRenderer obj = (UnityEngine.MeshRenderer)o; + UnityEngine.ReceiveGI arg0 = (UnityEngine.ReceiveGI)ToLua.CheckObject(L, 2, typeof(UnityEngine.ReceiveGI)); + //obj.receiveGI = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index receiveGI on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_stitchLightmapSeams(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.MeshRenderer obj = (UnityEngine.MeshRenderer)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + //obj.stitchLightmapSeams = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index stitchLightmapSeams on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/BaseType/UnityEngine_MeshRendererWrap.cs.meta b/Assets/LuaFramework/ToLua/BaseType/UnityEngine_MeshRendererWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..e858183981cbc3fb62e67796a1a0420a7baa2f85 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/UnityEngine_MeshRendererWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0ca3e23fe85562642bf7c9d934719fe2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/BaseType/UnityEngine_ObjectWrap.cs b/Assets/LuaFramework/ToLua/BaseType/UnityEngine_ObjectWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..92e5147195c8d55fdc9002db0612ef0cb80dac22 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/UnityEngine_ObjectWrap.cs @@ -0,0 +1,469 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_ObjectWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.Object), typeof(System.Object)); + L.RegFunction("FindObjectsOfType", FindObjectsOfType); + L.RegFunction("DontDestroyOnLoad", DontDestroyOnLoad); + L.RegFunction("ToString", ToString); + L.RegFunction("GetInstanceID", GetInstanceID); + L.RegFunction("GetHashCode", GetHashCode); + L.RegFunction("Equals", Equals); + L.RegFunction("FindObjectOfType", FindObjectOfType); + L.RegFunction("Instantiate", Instantiate); + L.RegFunction("DestroyImmediate", DestroyImmediate); + L.RegFunction("Destroy", Destroy); + L.RegFunction("New", _CreateUnityEngine_Object); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("name", get_name, set_name); + L.RegVar("hideFlags", get_hideFlags, set_hideFlags); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateUnityEngine_Object(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + UnityEngine.Object obj = new UnityEngine.Object(); + ToLua.Push(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.Object.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int FindObjectsOfType(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Type arg0 = ToLua.CheckMonoType(L, 1); + UnityEngine.Object[] o = UnityEngine.Object.FindObjectsOfType(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int DontDestroyOnLoad(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject(L, 1); + UnityEngine.Object.DontDestroyOnLoad(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ToString(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Object obj = (UnityEngine.Object)ToLua.CheckObject(L, 1); + string o = obj.ToString(); + LuaDLL.lua_pushstring(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetInstanceID(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Object obj = (UnityEngine.Object)ToLua.CheckObject(L, 1); + int o = obj.GetInstanceID(); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetHashCode(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Object obj = (UnityEngine.Object)ToLua.CheckObject(L, 1); + int o = obj.GetHashCode(); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Equals(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object obj = (UnityEngine.Object)ToLua.CheckObject(L, 1); + object arg0 = ToLua.ToVarObject(L, 2); + bool o = obj != null ? obj.Equals(arg0) : arg0 == null; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int FindObjectOfType(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Type arg0 = ToLua.CheckMonoType(L, 1); + UnityEngine.Object o = UnityEngine.Object.FindObjectOfType(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Instantiate(IntPtr L) + { + IntPtr L0 = LuaException.L; + + try + { + ++LuaException.InstantiateCount; + LuaException.L = L; + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject(L, 1); + UnityEngine.Object o = UnityEngine.Object.Instantiate(arg0); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + else + { + ToLua.Push(L, o); + } + + LuaException.L = L0; + --LuaException.InstantiateCount; + return 1; + } +#if UNITY_5_4_OR_NEWER + else if (count == 2) + { + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject(L, 1); + UnityEngine.Transform arg1 = (UnityEngine.Transform)ToLua.CheckObject(L, 2); + UnityEngine.Object o = UnityEngine.Object.Instantiate(arg0, arg1); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + else + { + ToLua.Push(L, o); + } + + LuaException.L = L0; + --LuaException.InstantiateCount; + return 1; + } +#endif + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Quaternion arg2 = ToLua.ToQuaternion(L, 3); + UnityEngine.Object o = UnityEngine.Object.Instantiate(arg0, arg1, arg2); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + else + { + ToLua.Push(L, o); + } + + LuaException.L = L0; + --LuaException.InstantiateCount; + return 1; + } +#if UNITY_5_4_OR_NEWER + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject(L, 1); + UnityEngine.Transform arg1 = (UnityEngine.Transform)ToLua.ToObject(L, 2); + bool arg2 = LuaDLL.lua_toboolean(L, 3); + UnityEngine.Object o = UnityEngine.Object.Instantiate(arg0, arg1, arg2); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + else + { + ToLua.Push(L, o); + } + + LuaException.L = L0; + --LuaException.InstantiateCount; + return 1; + } + else if (count == 4) + { + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg1 = ToLua.CheckVector3(L, 2); + UnityEngine.Quaternion arg2 = ToLua.CheckQuaternion(L, 3); + UnityEngine.Transform arg3 = (UnityEngine.Transform)ToLua.CheckObject(L, 4); + UnityEngine.Object o = UnityEngine.Object.Instantiate(arg0, arg1, arg2, arg3); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + else + { + ToLua.Push(L, o); + } + + LuaException.L = L0; + --LuaException.InstantiateCount; + return 1; + } +#endif + else + { + LuaException.L = L0; + --LuaException.InstantiateCount; + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Object.Instantiate"); + } + } + catch (Exception e) + { + LuaException.L = L0; + --LuaException.InstantiateCount; + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int DestroyImmediate(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject(L, 1); + ToLua.Destroy(L); + UnityEngine.Object.DestroyImmediate(arg0); + return 0; + } + else if (count == 2) + { + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject(L, 1); + bool arg1 = LuaDLL.luaL_checkboolean(L, 2); + ToLua.Destroy(L); + UnityEngine.Object.DestroyImmediate(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: Object.DestroyImmediate"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Destroy(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject(L, 1); + ToLua.Destroy(L); + UnityEngine.Object.Destroy(arg0); + return 0; + } + else if (count == 2) + { + float arg1 = (float)LuaDLL.luaL_checknumber(L, 2); + int udata = LuaDLL.tolua_rawnetobj(L, 1); + ObjectTranslator translator = LuaState.GetTranslator(L); + translator.DelayDestroy(udata, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: Object.Destroy"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_name(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Object obj = (UnityEngine.Object)o; + string ret = obj.name; + LuaDLL.lua_pushstring(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index name on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_hideFlags(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Object obj = (UnityEngine.Object)o; + UnityEngine.HideFlags ret = obj.hideFlags; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index hideFlags on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_name(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Object obj = (UnityEngine.Object)o; + string arg0 = ToLua.CheckString(L, 2); + obj.name = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index name on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_hideFlags(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Object obj = (UnityEngine.Object)o; + UnityEngine.HideFlags arg0 = (UnityEngine.HideFlags)ToLua.CheckObject(L, 2, typeof(UnityEngine.HideFlags)); + obj.hideFlags = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index hideFlags on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/BaseType/UnityEngine_ObjectWrap.cs.meta b/Assets/LuaFramework/ToLua/BaseType/UnityEngine_ObjectWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..2f790561064b43f12b17b3a66db8bea62491c759 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/UnityEngine_ObjectWrap.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 66f068299d0233f409ae0011b24ae1ba +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/BaseType/UnityEngine_ParticleSystemWrap.cs b/Assets/LuaFramework/ToLua/BaseType/UnityEngine_ParticleSystemWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..2f33cbcae999dbfe5a761c2ceedc61eecfb8c266 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/UnityEngine_ParticleSystemWrap.cs @@ -0,0 +1,1322 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_ParticleSystemWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.ParticleSystem), typeof(UnityEngine.Component)); + L.RegFunction("SetParticles", SetParticles); + L.RegFunction("GetParticles", GetParticles); + L.RegFunction("SetCustomParticleData", SetCustomParticleData); + L.RegFunction("GetCustomParticleData", GetCustomParticleData); + L.RegFunction("GetPlaybackState", GetPlaybackState); + L.RegFunction("SetPlaybackState", SetPlaybackState); + L.RegFunction("GetTrails", GetTrails); + L.RegFunction("SetTrails", SetTrails); + L.RegFunction("Simulate", Simulate); + L.RegFunction("Play", Play); + L.RegFunction("Pause", Pause); + L.RegFunction("Stop", Stop); + L.RegFunction("Clear", Clear); + L.RegFunction("IsAlive", IsAlive); + L.RegFunction("Emit", Emit); + L.RegFunction("TriggerSubEmitter", TriggerSubEmitter); + L.RegFunction("ResetPreMappedBufferMemory", ResetPreMappedBufferMemory); + L.RegFunction("New", _CreateUnityEngine_ParticleSystem); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("isPlaying", get_isPlaying, null); + L.RegVar("isEmitting", get_isEmitting, null); + L.RegVar("isStopped", get_isStopped, null); + L.RegVar("isPaused", get_isPaused, null); + L.RegVar("particleCount", get_particleCount, null); + L.RegVar("time", get_time, set_time); + L.RegVar("randomSeed", get_randomSeed, set_randomSeed); + L.RegVar("useAutoRandomSeed", get_useAutoRandomSeed, set_useAutoRandomSeed); + L.RegVar("proceduralSimulationSupported", get_proceduralSimulationSupported, null); + L.RegVar("main", get_main, null); + L.RegVar("emission", get_emission, null); + L.RegVar("shape", get_shape, null); + L.RegVar("velocityOverLifetime", get_velocityOverLifetime, null); + L.RegVar("limitVelocityOverLifetime", get_limitVelocityOverLifetime, null); + L.RegVar("inheritVelocity", get_inheritVelocity, null); + L.RegVar("lifetimeByEmitterSpeed", get_lifetimeByEmitterSpeed, null); + L.RegVar("forceOverLifetime", get_forceOverLifetime, null); + L.RegVar("colorOverLifetime", get_colorOverLifetime, null); + L.RegVar("colorBySpeed", get_colorBySpeed, null); + L.RegVar("sizeOverLifetime", get_sizeOverLifetime, null); + L.RegVar("sizeBySpeed", get_sizeBySpeed, null); + L.RegVar("rotationOverLifetime", get_rotationOverLifetime, null); + L.RegVar("rotationBySpeed", get_rotationBySpeed, null); + L.RegVar("externalForces", get_externalForces, null); + L.RegVar("noise", get_noise, null); + L.RegVar("collision", get_collision, null); + L.RegVar("trigger", get_trigger, null); + L.RegVar("subEmitters", get_subEmitters, null); + L.RegVar("textureSheetAnimation", get_textureSheetAnimation, null); + L.RegVar("lights", get_lights, null); + L.RegVar("trails", get_trails, null); + L.RegVar("customData", get_customData, null); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateUnityEngine_ParticleSystem(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + UnityEngine.ParticleSystem obj = new UnityEngine.ParticleSystem(); + ToLua.PushSealed(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.ParticleSystem.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetParticles(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes>(L, 2)) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + UnityEngine.ParticleSystem.Particle[] arg0 = null; + obj.SetParticles(arg0); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + Unity.Collections.NativeArray arg0; + //obj.SetParticles(arg0); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes, int>(L, 2)) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + UnityEngine.ParticleSystem.Particle[] arg0 = null; + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + obj.SetParticles(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + Unity.Collections.NativeArray arg0; + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + //obj.SetParticles(arg0, arg1); + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes, int, int>(L, 2)) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + UnityEngine.ParticleSystem.Particle[] arg0 = null; + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + int arg2 = (int)LuaDLL.lua_tonumber(L, 4); + obj.SetParticles(arg0, arg1, arg2); + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + Unity.Collections.NativeArray arg0; + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + int arg2 = (int)LuaDLL.lua_tonumber(L, 4); + //obj.SetParticles(arg0, arg1, arg2); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.ParticleSystem.SetParticles"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetParticles(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes>(L, 2)) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + UnityEngine.ParticleSystem.Particle[] arg0 = null; + int o = obj.GetParticles(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + Unity.Collections.NativeArray arg0; + //int o = obj.GetParticles(arg0); + //LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes, int>(L, 2)) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + UnityEngine.ParticleSystem.Particle[] arg0 = null; + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + int o = obj.GetParticles(arg0, arg1); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + Unity.Collections.NativeArray arg0; + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + //int o = obj.GetParticles(arg0, arg1); + //LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes, int, int>(L, 2)) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + UnityEngine.ParticleSystem.Particle[] arg0 = null; + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + int arg2 = (int)LuaDLL.lua_tonumber(L, 4); + int o = obj.GetParticles(arg0, arg1, arg2); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + Unity.Collections.NativeArray arg0; + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + int arg2 = (int)LuaDLL.lua_tonumber(L, 4); + //int o = obj.GetParticles(arg0, arg1, arg2); + //LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.ParticleSystem.GetParticles"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetCustomParticleData(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + System.Collections.Generic.List arg0 = (System.Collections.Generic.List)ToLua.CheckObject(L, 2, typeof(System.Collections.Generic.List)); + UnityEngine.ParticleSystemCustomData arg1 = (UnityEngine.ParticleSystemCustomData)ToLua.CheckObject(L, 3, typeof(UnityEngine.ParticleSystemCustomData)); + obj.SetCustomParticleData(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetCustomParticleData(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + System.Collections.Generic.List arg0 = (System.Collections.Generic.List)ToLua.CheckObject(L, 2, typeof(System.Collections.Generic.List)); + UnityEngine.ParticleSystemCustomData arg1 = (UnityEngine.ParticleSystemCustomData)ToLua.CheckObject(L, 3, typeof(UnityEngine.ParticleSystemCustomData)); + int o = obj.GetCustomParticleData(arg0, arg1); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetPlaybackState(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + UnityEngine.ParticleSystem.PlaybackState o = obj.GetPlaybackState(); + ToLua.PushValue(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetPlaybackState(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + UnityEngine.ParticleSystem.PlaybackState arg0 = StackTraits.Check(L, 2); + obj.SetPlaybackState(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetTrails(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + UnityEngine.ParticleSystem.Trails o = obj.GetTrails(); + ToLua.PushValue(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetTrails(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + UnityEngine.ParticleSystem.Trails arg0 = StackTraits.Check(L, 2); + obj.SetTrails(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Simulate(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.Simulate(arg0); + return 0; + } + else if (count == 3) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + bool arg1 = LuaDLL.luaL_checkboolean(L, 3); + obj.Simulate(arg0, arg1); + return 0; + } + else if (count == 4) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + bool arg1 = LuaDLL.luaL_checkboolean(L, 3); + bool arg2 = LuaDLL.luaL_checkboolean(L, 4); + obj.Simulate(arg0, arg1, arg2); + return 0; + } + else if (count == 5) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + bool arg1 = LuaDLL.luaL_checkboolean(L, 3); + bool arg2 = LuaDLL.luaL_checkboolean(L, 4); + bool arg3 = LuaDLL.luaL_checkboolean(L, 5); + obj.Simulate(arg0, arg1, arg2, arg3); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.ParticleSystem.Simulate"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Play(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + obj.Play(); + return 0; + } + else if (count == 2) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.Play(arg0); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.ParticleSystem.Play"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Pause(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + obj.Pause(); + return 0; + } + else if (count == 2) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.Pause(arg0); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.ParticleSystem.Pause"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Stop(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + obj.Stop(); + return 0; + } + else if (count == 2) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.Stop(arg0); + return 0; + } + else if (count == 3) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + UnityEngine.ParticleSystemStopBehavior arg1 = (UnityEngine.ParticleSystemStopBehavior)ToLua.CheckObject(L, 3, typeof(UnityEngine.ParticleSystemStopBehavior)); + obj.Stop(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.ParticleSystem.Stop"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Clear(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + obj.Clear(); + return 0; + } + else if (count == 2) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.Clear(arg0); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.ParticleSystem.Clear"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IsAlive(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + bool o = obj.IsAlive(); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 2) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + bool o = obj.IsAlive(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.ParticleSystem.IsAlive"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Emit(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.Emit(arg0); + return 0; + } + else if (count == 3) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + UnityEngine.ParticleSystem.EmitParams arg0 = StackTraits.Check(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + obj.Emit(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.ParticleSystem.Emit"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TriggerSubEmitter(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.TriggerSubEmitter(arg0); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 3)) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.ParticleSystem.Particle arg1 = StackTraits.To(L, 3); + obj.TriggerSubEmitter(arg0, ref arg1); + ToLua.PushValue(L, arg1); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes>(L, 3)) + { + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.ToObject(L, 3); + obj.TriggerSubEmitter(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.ParticleSystem.TriggerSubEmitter"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ResetPreMappedBufferMemory(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 0); + UnityEngine.ParticleSystem.ResetPreMappedBufferMemory(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isPlaying(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + bool ret = obj.isPlaying; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isPlaying on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isEmitting(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + bool ret = obj.isEmitting; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isEmitting on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isStopped(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + bool ret = obj.isStopped; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isStopped on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isPaused(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + bool ret = obj.isPaused; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isPaused on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_particleCount(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + int ret = obj.particleCount; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index particleCount on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_time(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + float ret = obj.time; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index time on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_randomSeed(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + uint ret = obj.randomSeed; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index randomSeed on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_useAutoRandomSeed(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + bool ret = obj.useAutoRandomSeed; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index useAutoRandomSeed on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_proceduralSimulationSupported(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + bool ret = obj.proceduralSimulationSupported; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index proceduralSimulationSupported on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_main(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + UnityEngine.ParticleSystem.MainModule ret = obj.main; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index main on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_emission(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + UnityEngine.ParticleSystem.EmissionModule ret = obj.emission; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index emission on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_shape(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + UnityEngine.ParticleSystem.ShapeModule ret = obj.shape; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index shape on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_velocityOverLifetime(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + UnityEngine.ParticleSystem.VelocityOverLifetimeModule ret = obj.velocityOverLifetime; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index velocityOverLifetime on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_limitVelocityOverLifetime(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule ret = obj.limitVelocityOverLifetime; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index limitVelocityOverLifetime on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_inheritVelocity(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + UnityEngine.ParticleSystem.InheritVelocityModule ret = obj.inheritVelocity; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index inheritVelocity on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_lifetimeByEmitterSpeed(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + UnityEngine.ParticleSystem.LifetimeByEmitterSpeedModule ret = obj.lifetimeByEmitterSpeed; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index lifetimeByEmitterSpeed on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_forceOverLifetime(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + UnityEngine.ParticleSystem.ForceOverLifetimeModule ret = obj.forceOverLifetime; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index forceOverLifetime on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_colorOverLifetime(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + UnityEngine.ParticleSystem.ColorOverLifetimeModule ret = obj.colorOverLifetime; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index colorOverLifetime on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_colorBySpeed(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + UnityEngine.ParticleSystem.ColorBySpeedModule ret = obj.colorBySpeed; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index colorBySpeed on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_sizeOverLifetime(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + UnityEngine.ParticleSystem.SizeOverLifetimeModule ret = obj.sizeOverLifetime; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index sizeOverLifetime on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_sizeBySpeed(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + UnityEngine.ParticleSystem.SizeBySpeedModule ret = obj.sizeBySpeed; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index sizeBySpeed on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_rotationOverLifetime(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + UnityEngine.ParticleSystem.RotationOverLifetimeModule ret = obj.rotationOverLifetime; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index rotationOverLifetime on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_rotationBySpeed(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + UnityEngine.ParticleSystem.RotationBySpeedModule ret = obj.rotationBySpeed; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index rotationBySpeed on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_externalForces(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + UnityEngine.ParticleSystem.ExternalForcesModule ret = obj.externalForces; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index externalForces on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_noise(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + UnityEngine.ParticleSystem.NoiseModule ret = obj.noise; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index noise on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_collision(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + UnityEngine.ParticleSystem.CollisionModule ret = obj.collision; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index collision on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_trigger(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + UnityEngine.ParticleSystem.TriggerModule ret = obj.trigger; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index trigger on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_subEmitters(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + UnityEngine.ParticleSystem.SubEmittersModule ret = obj.subEmitters; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index subEmitters on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_textureSheetAnimation(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + UnityEngine.ParticleSystem.TextureSheetAnimationModule ret = obj.textureSheetAnimation; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index textureSheetAnimation on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_lights(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + UnityEngine.ParticleSystem.LightsModule ret = obj.lights; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index lights on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_trails(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + UnityEngine.ParticleSystem.TrailModule ret = obj.trails; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index trails on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_customData(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + UnityEngine.ParticleSystem.CustomDataModule ret = obj.customData; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index customData on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_time(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.time = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index time on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_randomSeed(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + uint arg0 = (uint)LuaDLL.luaL_checknumber(L, 2); + obj.randomSeed = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index randomSeed on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_useAutoRandomSeed(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.useAutoRandomSeed = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index useAutoRandomSeed on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/BaseType/UnityEngine_ParticleSystemWrap.cs.meta b/Assets/LuaFramework/ToLua/BaseType/UnityEngine_ParticleSystemWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..7152eb530f491f3b5724c41d9f0cfa44eb103f4d --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/UnityEngine_ParticleSystemWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cf1e3fe6df787314db8b06a4ec90d849 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/BaseType/UnityEngine_UI_InputFieldWrap.cs b/Assets/LuaFramework/ToLua/BaseType/UnityEngine_UI_InputFieldWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..f93aa878e561a718fbfb3ceeef3813e69d4b923a --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/UnityEngine_UI_InputFieldWrap.cs @@ -0,0 +1,1549 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_UI_InputFieldWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.UI.InputField), typeof(UnityEngine.UI.Selectable)); + L.RegFunction("SetTextWithoutNotify", SetTextWithoutNotify); + L.RegFunction("MoveTextEnd", MoveTextEnd); + L.RegFunction("MoveTextStart", MoveTextStart); + L.RegFunction("OnBeginDrag", OnBeginDrag); + L.RegFunction("OnDrag", OnDrag); + L.RegFunction("OnEndDrag", OnEndDrag); + L.RegFunction("OnPointerDown", OnPointerDown); + L.RegFunction("ProcessEvent", ProcessEvent); + L.RegFunction("OnUpdateSelected", OnUpdateSelected); + L.RegFunction("ForceLabelUpdate", ForceLabelUpdate); + L.RegFunction("Rebuild", Rebuild); + L.RegFunction("LayoutComplete", LayoutComplete); + L.RegFunction("GraphicUpdateComplete", GraphicUpdateComplete); + L.RegFunction("ActivateInputField", ActivateInputField); + L.RegFunction("OnSelect", OnSelect); + L.RegFunction("OnPointerClick", OnPointerClick); + L.RegFunction("DeactivateInputField", DeactivateInputField); + L.RegFunction("OnDeselect", OnDeselect); + L.RegFunction("OnSubmit", OnSubmit); + L.RegFunction("CalculateLayoutInputHorizontal", CalculateLayoutInputHorizontal); + L.RegFunction("CalculateLayoutInputVertical", CalculateLayoutInputVertical); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("shouldHideMobileInput", get_shouldHideMobileInput, set_shouldHideMobileInput); + L.RegVar("shouldActivateOnSelect", get_shouldActivateOnSelect, set_shouldActivateOnSelect); + L.RegVar("text", get_text, set_text); + L.RegVar("isFocused", get_isFocused, null); + L.RegVar("caretBlinkRate", get_caretBlinkRate, set_caretBlinkRate); + L.RegVar("caretWidth", get_caretWidth, set_caretWidth); + L.RegVar("textComponent", get_textComponent, set_textComponent); + L.RegVar("placeholder", get_placeholder, set_placeholder); + L.RegVar("caretColor", get_caretColor, set_caretColor); + L.RegVar("customCaretColor", get_customCaretColor, set_customCaretColor); + L.RegVar("selectionColor", get_selectionColor, set_selectionColor); + L.RegVar("onValueChanged", get_onValueChanged, set_onValueChanged); + L.RegVar("onValidateInput", get_onValidateInput, set_onValidateInput); + L.RegVar("characterLimit", get_characterLimit, set_characterLimit); + L.RegVar("contentType", get_contentType, set_contentType); + L.RegVar("lineType", get_lineType, set_lineType); + L.RegVar("inputType", get_inputType, set_inputType); + L.RegVar("touchScreenKeyboard", get_touchScreenKeyboard, null); + L.RegVar("keyboardType", get_keyboardType, set_keyboardType); + L.RegVar("characterValidation", get_characterValidation, set_characterValidation); + L.RegVar("readOnly", get_readOnly, set_readOnly); + L.RegVar("multiLine", get_multiLine, null); + L.RegVar("asteriskChar", get_asteriskChar, set_asteriskChar); + L.RegVar("wasCanceled", get_wasCanceled, null); + L.RegVar("caretPosition", get_caretPosition, set_caretPosition); + L.RegVar("selectionAnchorPosition", get_selectionAnchorPosition, set_selectionAnchorPosition); + L.RegVar("selectionFocusPosition", get_selectionFocusPosition, set_selectionFocusPosition); + L.RegVar("minWidth", get_minWidth, null); + L.RegVar("preferredWidth", get_preferredWidth, null); + L.RegVar("flexibleWidth", get_flexibleWidth, null); + L.RegVar("minHeight", get_minHeight, null); + L.RegVar("preferredHeight", get_preferredHeight, null); + L.RegVar("flexibleHeight", get_flexibleHeight, null); + L.RegVar("layoutPriority", get_layoutPriority, null); + L.RegFunction("OnValidateInput", UnityEngine_UI_InputField_OnValidateInput); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetTextWithoutNotify(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + obj.SetTextWithoutNotify(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int MoveTextEnd(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)ToLua.CheckObject(L, 1); + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.MoveTextEnd(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int MoveTextStart(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)ToLua.CheckObject(L, 1); + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.MoveTextStart(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OnBeginDrag(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)ToLua.CheckObject(L, 1); + UnityEngine.EventSystems.PointerEventData arg0 = (UnityEngine.EventSystems.PointerEventData)ToLua.CheckObject(L, 2); + obj.OnBeginDrag(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OnDrag(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)ToLua.CheckObject(L, 1); + UnityEngine.EventSystems.PointerEventData arg0 = (UnityEngine.EventSystems.PointerEventData)ToLua.CheckObject(L, 2); + obj.OnDrag(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OnEndDrag(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)ToLua.CheckObject(L, 1); + UnityEngine.EventSystems.PointerEventData arg0 = (UnityEngine.EventSystems.PointerEventData)ToLua.CheckObject(L, 2); + obj.OnEndDrag(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OnPointerDown(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)ToLua.CheckObject(L, 1); + UnityEngine.EventSystems.PointerEventData arg0 = (UnityEngine.EventSystems.PointerEventData)ToLua.CheckObject(L, 2); + obj.OnPointerDown(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ProcessEvent(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)ToLua.CheckObject(L, 1); + UnityEngine.Event arg0 = (UnityEngine.Event)ToLua.CheckObject(L, 2, typeof(UnityEngine.Event)); + obj.ProcessEvent(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OnUpdateSelected(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)ToLua.CheckObject(L, 1); + UnityEngine.EventSystems.BaseEventData arg0 = (UnityEngine.EventSystems.BaseEventData)ToLua.CheckObject(L, 2); + obj.OnUpdateSelected(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ForceLabelUpdate(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)ToLua.CheckObject(L, 1); + obj.ForceLabelUpdate(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Rebuild(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)ToLua.CheckObject(L, 1); + UnityEngine.UI.CanvasUpdate arg0 = (UnityEngine.UI.CanvasUpdate)ToLua.CheckObject(L, 2, typeof(UnityEngine.UI.CanvasUpdate)); + obj.Rebuild(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LayoutComplete(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)ToLua.CheckObject(L, 1); + obj.LayoutComplete(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GraphicUpdateComplete(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)ToLua.CheckObject(L, 1); + obj.GraphicUpdateComplete(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ActivateInputField(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)ToLua.CheckObject(L, 1); + obj.ActivateInputField(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OnSelect(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)ToLua.CheckObject(L, 1); + UnityEngine.EventSystems.BaseEventData arg0 = (UnityEngine.EventSystems.BaseEventData)ToLua.CheckObject(L, 2); + obj.OnSelect(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OnPointerClick(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)ToLua.CheckObject(L, 1); + UnityEngine.EventSystems.PointerEventData arg0 = (UnityEngine.EventSystems.PointerEventData)ToLua.CheckObject(L, 2); + obj.OnPointerClick(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int DeactivateInputField(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)ToLua.CheckObject(L, 1); + obj.DeactivateInputField(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OnDeselect(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)ToLua.CheckObject(L, 1); + UnityEngine.EventSystems.BaseEventData arg0 = (UnityEngine.EventSystems.BaseEventData)ToLua.CheckObject(L, 2); + obj.OnDeselect(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OnSubmit(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)ToLua.CheckObject(L, 1); + UnityEngine.EventSystems.BaseEventData arg0 = (UnityEngine.EventSystems.BaseEventData)ToLua.CheckObject(L, 2); + obj.OnSubmit(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CalculateLayoutInputHorizontal(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)ToLua.CheckObject(L, 1); + obj.CalculateLayoutInputHorizontal(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CalculateLayoutInputVertical(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)ToLua.CheckObject(L, 1); + obj.CalculateLayoutInputVertical(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_shouldHideMobileInput(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + bool ret = obj.shouldHideMobileInput; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index shouldHideMobileInput on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_shouldActivateOnSelect(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + bool ret = obj.shouldActivateOnSelect; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index shouldActivateOnSelect on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_text(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + string ret = obj.text; + LuaDLL.lua_pushstring(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index text on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isFocused(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + bool ret = obj.isFocused; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isFocused on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_caretBlinkRate(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + float ret = obj.caretBlinkRate; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index caretBlinkRate on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_caretWidth(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + int ret = obj.caretWidth; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index caretWidth on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_textComponent(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + UnityEngine.UI.Text ret = obj.textComponent; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index textComponent on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_placeholder(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + UnityEngine.UI.Graphic ret = obj.placeholder; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index placeholder on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_caretColor(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + UnityEngine.Color ret = obj.caretColor; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index caretColor on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_customCaretColor(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + bool ret = obj.customCaretColor; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index customCaretColor on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_selectionColor(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + UnityEngine.Color ret = obj.selectionColor; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index selectionColor on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_onValueChanged(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + UnityEngine.UI.InputField.OnChangeEvent ret = obj.onValueChanged; + ToLua.PushObject(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index onValueChanged on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_onValidateInput(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + UnityEngine.UI.InputField.OnValidateInput ret = obj.onValidateInput; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index onValidateInput on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_characterLimit(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + int ret = obj.characterLimit; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index characterLimit on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_contentType(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + UnityEngine.UI.InputField.ContentType ret = obj.contentType; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index contentType on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_lineType(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + UnityEngine.UI.InputField.LineType ret = obj.lineType; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index lineType on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_inputType(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + UnityEngine.UI.InputField.InputType ret = obj.inputType; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index inputType on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_touchScreenKeyboard(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + UnityEngine.TouchScreenKeyboard ret = obj.touchScreenKeyboard; + ToLua.PushObject(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index touchScreenKeyboard on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_keyboardType(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + UnityEngine.TouchScreenKeyboardType ret = obj.keyboardType; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index keyboardType on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_characterValidation(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + UnityEngine.UI.InputField.CharacterValidation ret = obj.characterValidation; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index characterValidation on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_readOnly(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + bool ret = obj.readOnly; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index readOnly on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_multiLine(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + bool ret = obj.multiLine; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index multiLine on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_asteriskChar(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + char ret = obj.asteriskChar; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index asteriskChar on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_wasCanceled(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + bool ret = obj.wasCanceled; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index wasCanceled on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_caretPosition(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + int ret = obj.caretPosition; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index caretPosition on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_selectionAnchorPosition(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + int ret = obj.selectionAnchorPosition; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index selectionAnchorPosition on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_selectionFocusPosition(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + int ret = obj.selectionFocusPosition; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index selectionFocusPosition on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_minWidth(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + float ret = obj.minWidth; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index minWidth on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_preferredWidth(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + float ret = obj.preferredWidth; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index preferredWidth on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_flexibleWidth(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + float ret = obj.flexibleWidth; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index flexibleWidth on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_minHeight(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + float ret = obj.minHeight; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index minHeight on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_preferredHeight(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + float ret = obj.preferredHeight; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index preferredHeight on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_flexibleHeight(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + float ret = obj.flexibleHeight; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index flexibleHeight on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_layoutPriority(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + int ret = obj.layoutPriority; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index layoutPriority on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_shouldHideMobileInput(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.shouldHideMobileInput = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index shouldHideMobileInput on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_shouldActivateOnSelect(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.shouldActivateOnSelect = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index shouldActivateOnSelect on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_text(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + string arg0 = ToLua.CheckString(L, 2); + obj.text = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index text on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_caretBlinkRate(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.caretBlinkRate = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index caretBlinkRate on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_caretWidth(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.caretWidth = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index caretWidth on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_textComponent(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + UnityEngine.UI.Text arg0 = (UnityEngine.UI.Text)ToLua.CheckObject(L, 2); + obj.textComponent = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index textComponent on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_placeholder(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + UnityEngine.UI.Graphic arg0 = (UnityEngine.UI.Graphic)ToLua.CheckObject(L, 2); + obj.placeholder = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index placeholder on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_caretColor(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + UnityEngine.Color arg0 = ToLua.ToColor(L, 2); + obj.caretColor = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index caretColor on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_customCaretColor(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.customCaretColor = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index customCaretColor on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_selectionColor(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + UnityEngine.Color arg0 = ToLua.ToColor(L, 2); + obj.selectionColor = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index selectionColor on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_onValueChanged(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + UnityEngine.UI.InputField.OnChangeEvent arg0 = (UnityEngine.UI.InputField.OnChangeEvent)ToLua.CheckObject(L, 2); + obj.onValueChanged = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index onValueChanged on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_onValidateInput(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + UnityEngine.UI.InputField.OnValidateInput arg0 = (UnityEngine.UI.InputField.OnValidateInput)ToLua.CheckDelegate(L, 2); + obj.onValidateInput = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index onValidateInput on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_characterLimit(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.characterLimit = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index characterLimit on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_contentType(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + UnityEngine.UI.InputField.ContentType arg0 = (UnityEngine.UI.InputField.ContentType)ToLua.CheckObject(L, 2, typeof(UnityEngine.UI.InputField.ContentType)); + obj.contentType = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index contentType on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_lineType(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + UnityEngine.UI.InputField.LineType arg0 = (UnityEngine.UI.InputField.LineType)ToLua.CheckObject(L, 2, typeof(UnityEngine.UI.InputField.LineType)); + obj.lineType = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index lineType on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_inputType(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + UnityEngine.UI.InputField.InputType arg0 = (UnityEngine.UI.InputField.InputType)ToLua.CheckObject(L, 2, typeof(UnityEngine.UI.InputField.InputType)); + obj.inputType = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index inputType on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_keyboardType(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + UnityEngine.TouchScreenKeyboardType arg0 = (UnityEngine.TouchScreenKeyboardType)ToLua.CheckObject(L, 2, typeof(UnityEngine.TouchScreenKeyboardType)); + obj.keyboardType = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index keyboardType on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_characterValidation(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + UnityEngine.UI.InputField.CharacterValidation arg0 = (UnityEngine.UI.InputField.CharacterValidation)ToLua.CheckObject(L, 2, typeof(UnityEngine.UI.InputField.CharacterValidation)); + obj.characterValidation = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index characterValidation on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_readOnly(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.readOnly = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index readOnly on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_asteriskChar(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + char arg0 = (char)LuaDLL.luaL_checknumber(L, 2); + obj.asteriskChar = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index asteriskChar on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_caretPosition(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.caretPosition = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index caretPosition on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_selectionAnchorPosition(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.selectionAnchorPosition = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index selectionAnchorPosition on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_selectionFocusPosition(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.InputField obj = (UnityEngine.UI.InputField)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.selectionFocusPosition = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index selectionFocusPosition on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int UnityEngine_UI_InputField_OnValidateInput(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + LuaFunction func = ToLua.CheckLuaFunction(L, 1); + + if (count == 1) + { + Delegate arg1 = DelegateTraits.Create(func); + ToLua.Push(L, arg1); + } + else + { + LuaTable self = ToLua.CheckLuaTable(L, 2); + Delegate arg1 = DelegateTraits.Create(func, self); + ToLua.Push(L, arg1); + } + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/BaseType/UnityEngine_UI_InputFieldWrap.cs.meta b/Assets/LuaFramework/ToLua/BaseType/UnityEngine_UI_InputFieldWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..2f7267b2669de1b6130ccd239eb7558a676f2150 --- /dev/null +++ b/Assets/LuaFramework/ToLua/BaseType/UnityEngine_UI_InputFieldWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bab23de682a8bdb40ac94b24eaebd4f0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Core.meta b/Assets/LuaFramework/ToLua/Core.meta new file mode 100644 index 0000000000000000000000000000000000000000..2726bddcd20647f65bc5d8870243ceb39805ad1f --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 7714c4ebcd6e6474da6ec5df53bca350 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Core/LuaAttributes.cs b/Assets/LuaFramework/ToLua/Core/LuaAttributes.cs new file mode 100644 index 0000000000000000000000000000000000000000..0b49d635d1054dd95ad3ee5388c36831e7053663 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaAttributes.cs @@ -0,0 +1,73 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +using System; + +namespace LuaInterface +{ + [AttributeUsage(AttributeTargets.Method)] + public sealed class MonoPInvokeCallbackAttribute : Attribute + { + public MonoPInvokeCallbackAttribute(Type type) + { + } + } + + public class NoToLuaAttribute : System.Attribute + { + public NoToLuaAttribute() + { + + } + } + + public class UseDefinedAttribute : System.Attribute + { + public UseDefinedAttribute() + { + + } + } + + public class OverrideDefinedAttribute: System.Attribute + { + public OverrideDefinedAttribute() + { + + } + } + + public sealed class LuaByteBufferAttribute : Attribute + { + public LuaByteBufferAttribute() + { + } + } + + [AttributeUsage(AttributeTargets.Method)] + public sealed class LuaRenameAttribute : Attribute + { + public string Name; + public LuaRenameAttribute() + { + } + } +} \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Core/LuaAttributes.cs.meta b/Assets/LuaFramework/ToLua/Core/LuaAttributes.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..78360aca0ee7b77ba3e0cb1a2a3dd0fcde99063b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaAttributes.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 036fab5eb22f19e4bba933e194fb4756 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Core/LuaBaseRef.cs b/Assets/LuaFramework/ToLua/Core/LuaBaseRef.cs new file mode 100644 index 0000000000000000000000000000000000000000..7710c3e5e1b925b5d4ad93c0df1b5861d235c2d5 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaBaseRef.cs @@ -0,0 +1,170 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +using System; +using System.Runtime.CompilerServices; +using UnityEngine; + +namespace LuaInterface +{ + public abstract class LuaBaseRef : IDisposable + { + public string name = null; + protected int reference = -1; + protected LuaState luaState; + protected ObjectTranslator translator = null; + + protected volatile bool beDisposed; + protected int count = 0; + + public LuaBaseRef() + { + IsAlive = true; + count = 1; + } + + ~LuaBaseRef() + { + IsAlive = false; + Dispose(false); + } + + public virtual void Dispose() + { + --count; + + if (count > 0) + { + return; + } + + IsAlive = false; + Dispose(true); + } + + public void AddRef() + { + ++count; + } + + public virtual void Dispose(bool disposeManagedResources) + { + if (!beDisposed) + { + beDisposed = true; + + if (reference > 0 && luaState != null) + { + luaState.CollectRef(reference, name, !disposeManagedResources); + } + + reference = -1; + luaState = null; + count = 0; + } + } + + //鎱庣敤 + public void Dispose(int generation) + { + if (count > generation) + { + return; + } + + Dispose(true); + } + + public LuaState GetLuaState() + { + return luaState; + } + + public void Push() + { + luaState.Push(this); + } + + public override int GetHashCode() + { + return RuntimeHelpers.GetHashCode(this); + } + + public virtual int GetReference() + { + return reference; + } + + public override bool Equals(object o) + { + if (o == null) return reference <= 0; + LuaBaseRef lr = o as LuaBaseRef; + + if (lr == null || lr.reference != reference) + { + return false; + } + + return reference > 0; + } + + static bool CompareRef(LuaBaseRef a, LuaBaseRef b) + { + if (System.Object.ReferenceEquals(a, b)) + { + return true; + } + + object l = a; + object r = b; + + if (l == null && r != null) + { + return b.reference <= 0; + } + + if (l != null && r == null) + { + return a.reference <= 0; + } + + if (a.reference != b.reference) + { + return false; + } + + return a.reference > 0; + } + + public static bool operator == (LuaBaseRef a, LuaBaseRef b) + { + return CompareRef(a, b); + } + + public static bool operator != (LuaBaseRef a, LuaBaseRef b) + { + return !CompareRef(a, b); + } + + public volatile bool IsAlive = true; + } +} \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Core/LuaBaseRef.cs.meta b/Assets/LuaFramework/ToLua/Core/LuaBaseRef.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..e11b0867c206c8db0ae987c39afbfbbe86ebecf1 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaBaseRef.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 39292548101f65b41be91c5d20f20812 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Core/LuaBeatEvent.cs b/Assets/LuaFramework/ToLua/Core/LuaBeatEvent.cs new file mode 100644 index 0000000000000000000000000000000000000000..95c138b0d7e47cd9ffe262b1f65edd543c89b0c8 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaBeatEvent.cs @@ -0,0 +1,134 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +using System; +using LuaInterface; + +namespace LuaInterface +{ + public class LuaBeatEvent : IDisposable + { + protected LuaState luaState; + protected bool beDisposed; + + LuaTable self = null; + LuaFunction _add = null; + LuaFunction _remove = null; + //LuaFunction _call = null; + + public LuaBeatEvent(LuaTable table) + { + self = table; + luaState = table.GetLuaState(); + self.AddRef(); + + _add = self.GetLuaFunction("Add"); + _remove = self.GetLuaFunction("Remove"); + //_call = self.GetLuaFunction("__call"); + } + + public void Dispose() + { + self.Dispose(); + _add.Dispose(); + _remove.Dispose(); + //_call.Dispose(); + Clear(); + } + + void Clear() + { + //_call = null; + _add = null; + _remove = null; + self = null; + luaState = null; + } + + public void Dispose(bool disposeManagedResources) + { + if (!beDisposed) + { + beDisposed = true; + + //if (_call != null) + //{ + // _call.Dispose(disposeManagedResources); + // _call = null; + //} + + if (_add != null) + { + _add.Dispose(disposeManagedResources); + _add = null; + } + + if (_remove != null) + { + _remove.Dispose(disposeManagedResources); + _remove = null; + } + + if (self != null) + { + self.Dispose(disposeManagedResources); + } + + Clear(); + } + } + + public void Add(LuaFunction func, LuaTable obj) + { + if (func == null) + { + return; + } + + _add.BeginPCall(); + _add.Push(self); + _add.Push(func); + _add.Push(obj); + _add.PCall(); + _add.EndPCall(); + } + + public void Remove(LuaFunction func, LuaTable obj) + { + if (func == null) + { + return; + } + + _remove.BeginPCall(); + _remove.Push(self); + _remove.Push(func); + _remove.Push(obj); + _remove.PCall(); + _remove.EndPCall(); + } + + //public override int GetReference() + //{ + // return self.GetReference(); + //} + } +} diff --git a/Assets/LuaFramework/ToLua/Core/LuaBeatEvent.cs.meta b/Assets/LuaFramework/ToLua/Core/LuaBeatEvent.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..e9ff489825a1878449121803252de65c61a6aa90 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaBeatEvent.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c7332596f22ac5446852c531d7148318 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Core/LuaDLL.cs b/Assets/LuaFramework/ToLua/Core/LuaDLL.cs new file mode 100644 index 0000000000000000000000000000000000000000..d83d8c377ad7f5f53d445272f939f027b0fe7bc1 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaDLL.cs @@ -0,0 +1,1286 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +using System; +using System.Runtime.InteropServices; +using System.Reflection; +using System.Collections; +using System.Text; +using System.Security; + +namespace LuaInterface +{ + public enum LuaTypes + { + LUA_TNONE = -1, + LUA_TNIL = 0, + LUA_TBOOLEAN = 1, + LUA_TLIGHTUSERDATA = 2, + LUA_TNUMBER = 3, + LUA_TSTRING = 4, + LUA_TTABLE = 5, + LUA_TFUNCTION = 6, + LUA_TUSERDATA = 7, + LUA_TTHREAD = 8, + + } + + public enum LuaGCOptions + { + LUA_GCSTOP = 0, + LUA_GCRESTART = 1, + LUA_GCCOLLECT = 2, + LUA_GCCOUNT = 3, + LUA_GCCOUNTB = 4, + LUA_GCSTEP = 5, + LUA_GCSETPAUSE = 6, + LUA_GCSETSTEPMUL = 7, + } + + public enum LuaThreadStatus + { + LUA_YIELD = 1, + LUA_ERRRUN = 2, + LUA_ERRSYNTAX = 3, + LUA_ERRMEM = 4, + LUA_ERRERR = 5, + } + + public enum LuaHookFlag + { + LUA_HOOKCALL = 0, + LUA_HOOKRET = 1, + LUA_HOOKLINE = 2, + LUA_HOOKCOUNT = 3, + LUA_HOOKTAILRET = 4, + } + + public enum LuaMask + { + LUA_MASKCALL = 1, //1 << LUA_HOOKCALL + LUA_MASKRET = 2, //(1 << LUA_HOOKRET) + LUA_MASKLINE = 4,// (1 << LUA_HOOKLINE) + LUA_MASKCOUNT = 8, // (1 << LUA_HOOKCOUNT) + } + + + public class LuaIndexes + { + public static int LUA_REGISTRYINDEX = -10000; + public static int LUA_ENVIRONINDEX = -10001; + public static int LUA_GLOBALSINDEX = -10002; + } + + public class LuaRIDX + { + public int LUA_RIDX_MAINTHREAD = 1; + public int LUA_RIDX_GLOBALS = 2; + public int LUA_RIDX_PRELOAD = 25; + public int LUA_RIDX_LOADED = 26; + } + + public static class ToLuaFlags + { + public const int INDEX_ERROR = 1; //Index 澶辫触鎻愮ずerror淇℃伅锛宖alse杩斿洖nil + public const int USE_INT64 = 2; //鏄惁luavm鍐呴儴鏀寔鍘熺敓int64(鐩墠鐢ㄧ殑vm閮戒笉鏀寔, 榛樿false) + } + + [StructLayout(LayoutKind.Sequential)] + public struct Lua_Debug + { + public int eventcode; + public IntPtr _name; /* (n) */ + public IntPtr _namewhat; /* (n) `global', `local', `field', `method' */ + public IntPtr _what; /* (S) `Lua', `C', `main', `tail' */ + public IntPtr _source; /* (S) */ + public int currentline; /* (l) */ + public int nups; /* (u) number of upvalues */ + public int linedefined; /* (S) */ + public int lastlinedefined; /* (S) */ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] _short_src; + public int i_ci; /* active function */ + + string tostring(IntPtr p) + { + if (p != IntPtr.Zero) + { + int len = LuaDLL.tolua_strlen(p); + return LuaDLL.lua_ptrtostring(p, len); + } + + return string.Empty; + } + + public string namewhat + { + get + { + return tostring(_namewhat); + } + } + + public string name + { + get + { + return tostring(_name); + } + } + + public string what + { + get + { + return tostring(_what); + } + } + + public string source + { + get + { + return tostring(_source); + } + } + + int GetShortSrcLen(byte[] str) + { + int i = 0; + + for (; i < 128; i++) + { + if (str[i] == '\0') + { + return i; + } + } + + return i; + } + + public string short_src + { + get + { + if (_short_src == null) + { + return string.Empty; + } + + int count = GetShortSrcLen(_short_src); + return Encoding.UTF8.GetString(_short_src, 0, count); + } + } + } + +#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate int LuaCSFunction(IntPtr luaState); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate void LuaHookFunc(IntPtr L, ref Lua_Debug ar); +#else + public delegate int LuaCSFunction(IntPtr luaState); + public delegate void LuaHookFunc(IntPtr L, ref Lua_Debug ar); +#endif + + public class LuaDLL + { + public static string version = "1.0.7.386"; + public static int LUA_MULTRET = -1; + public static string[] LuaTypeName = { "none", "nil", "boolean", "lightuserdata", "number", "string", "table", "function", "userdata", "thread" }; + +#if !UNITY_EDITOR && UNITY_IPHONE + const string LUADLL = "__Internal"; +#else + const string LUADLL = "tolua"; +#endif + /* + ** third party library + */ + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int luaopen_sproto_core(IntPtr L); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int luaopen_protobuf_c(IntPtr L); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int luaopen_pb(IntPtr L); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int luaopen_ffi(IntPtr L); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int luaopen_bit(IntPtr L); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int luaopen_struct(IntPtr L); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int luaopen_lpeg(IntPtr L); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int luaopen_socket_core(IntPtr L); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int luaopen_mime_core(IntPtr L); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int luaopen_cjson(IntPtr L); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int luaopen_cjson_safe(IntPtr L); + + /* + ** pseudo-indices + */ + public static int lua_upvalueindex(int i) + { + return LuaIndexes.LUA_GLOBALSINDEX - i; + } + + /* + * state manipulation + */ + //[DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + //public static extern IntPtr lua_newstate(LuaAlloc f, IntPtr ud); //luajit64浣嶄笉鑳界敤杩欎釜鍑芥暟 + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void lua_close(IntPtr luaState); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] //[-0, +1, m] + public static extern IntPtr lua_newthread(IntPtr L); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr lua_atpanic(IntPtr luaState, IntPtr panic); + + /* + * basic stack manipulation + */ + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int lua_gettop(IntPtr luaState); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void lua_settop(IntPtr luaState, int top); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void lua_pushvalue(IntPtr luaState, int idx); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void lua_remove(IntPtr luaState, int idx); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void lua_insert(IntPtr luaState, int idx); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void lua_replace(IntPtr luaState, int index); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int lua_checkstack(IntPtr luaState, int extra); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void lua_xmove(IntPtr from, IntPtr to, int n); + + /* + * access functions (stack -> C) + */ + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int lua_isnumber(IntPtr luaState, int idx); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int lua_isstring(IntPtr luaState, int index); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int lua_iscfunction(IntPtr luaState, int index); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int lua_isuserdata(IntPtr luaState, int stackPos); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern LuaTypes lua_type(IntPtr luaState, int index); + + public static string lua_typename(IntPtr luaState, LuaTypes type) + { + int t = (int)type; + return LuaTypeName[t + 1]; + } + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int lua_equal(IntPtr luaState, int idx1, int idx2); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int lua_rawequal(IntPtr luaState, int idx1, int idx2); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int lua_lessthan(IntPtr luaState, int idx1, int idx2); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern double lua_tonumber(IntPtr luaState, int idx); + + public static int lua_tointeger(IntPtr luaState, int idx) + { + return tolua_tointeger(luaState, idx); + } + + public static bool lua_toboolean(IntPtr luaState, int idx) + { + return tolua_toboolean(luaState, idx); + } + + public static IntPtr lua_tolstring(IntPtr luaState, int index, out int strLen) //[-0, +0, m] + { + return tolua_tolstring(luaState, index, out strLen); + } + + public static int lua_objlen(IntPtr luaState, int idx) + { + return tolua_objlen(luaState, idx); + } + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr lua_tocfunction(IntPtr luaState, int idx); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr lua_touserdata(IntPtr luaState, int idx); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr lua_tothread(IntPtr L, int idx); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr lua_topointer(IntPtr L, int idx); + + /* + * push functions (C -> stack) + */ + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void lua_pushnil(IntPtr luaState); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void lua_pushnumber(IntPtr luaState, double number); + + public static void lua_pushinteger(IntPtr L, int n) + { + lua_pushnumber(L, n); + } + + public static void lua_pushlstring(IntPtr luaState, byte[] str, int size) //[-0, +1, m] + { + if (size >= 0x7fffff00) + { + throw new LuaException("string length overflow"); + } + + tolua_pushlstring(luaState, str, size); + } + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void lua_pushstring(IntPtr luaState, string str); //[-0, +1, m] + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void lua_pushcclosure(IntPtr luaState, IntPtr fn, int n); //[-n, +1, m] + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void lua_pushboolean(IntPtr luaState, int value); + + public static void lua_pushboolean(IntPtr luaState, bool value) + { + lua_pushboolean(luaState, value ? 1 : 0); + } + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void lua_pushlightuserdata(IntPtr luaState, IntPtr udata); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int lua_pushthread(IntPtr L); + + /* + * get functions (Lua -> stack) + */ + public static void lua_gettable(IntPtr L, int idx) + { + if (LuaDLL.tolua_gettable(L, idx) != 0) + { + string error = LuaDLL.lua_tostring(L, -1); + throw new LuaException(error); + } + } + + public static void lua_getfield(IntPtr L, int idx, string key) + { + if (LuaDLL.tolua_getfield(L, idx, key) != 0) + { + string error = LuaDLL.lua_tostring(L, -1); + throw new LuaException(error); + } + } + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void lua_rawget(IntPtr luaState, int idx); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void lua_rawgeti(IntPtr luaState, int idx, int n); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void lua_createtable(IntPtr luaState, int narr, int nrec); //[-0, +1, m] + + public static IntPtr lua_newuserdata(IntPtr luaState, int size) //[-0, +1, m] + { + return tolua_newuserdata(luaState, size); + } + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int lua_getmetatable(IntPtr luaState, int objIndex); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void lua_getfenv(IntPtr luaState, int idx); + + /* + * set functions (stack -> Lua) + */ + public static void lua_settable(IntPtr L, int idx) + { + if (tolua_settable(L, idx) != 0) + { + string error = LuaDLL.lua_tostring(L, -1); + throw new LuaException(error); + } + } + + public static void lua_setfield(IntPtr L, int idx, string key) + { + if (tolua_setfield(L, idx, key) != 0) + { + string error = LuaDLL.lua_tostring(L, -1); + throw new LuaException(error); + } + } + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void lua_rawset(IntPtr luaState, int idx); //[-2, +0, m] + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void lua_rawseti(IntPtr luaState, int tableIndex, int index); //[-1, +0, m] + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void lua_setmetatable(IntPtr luaState, int objIndex); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int lua_setfenv(IntPtr luaState, int stackPos); + + /* + * `load' and `call' functions (load and run Lua code) + */ + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void lua_call(IntPtr luaState, int nArgs, int nResults); //[-(nargs+1), +nresults, e] + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int lua_pcall(IntPtr luaState, int nArgs, int nResults, int errfunc); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int lua_cpcall(IntPtr L, IntPtr func, IntPtr ud); + + //[DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + //public static extern int lua_load(IntPtr luaState, LuaChunkReader chunkReader, ref ReaderInfo data, string chunkName); + //[DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + //public static extern int lua_dump(IntPtr L, LuaWriter writer, IntPtr data); + + /* + * coroutine functions + */ + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int lua_yield(IntPtr L, int nresults); //[-?, +?, e] + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int lua_resume(IntPtr L, int narg); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int lua_status(IntPtr L); + + /* + * garbage-collection function and options + */ + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int lua_gc(IntPtr luaState, LuaGCOptions what, int data); //[-0, +0, e] + + /* + * miscellaneous functions + */ + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int lua_next(IntPtr luaState, int index); //[-1, +(2|0), e] + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void lua_concat(IntPtr luaState, int n); //[-n, +1, e] + + /* + ** =============================================================== + ** some useful functions + ** =============================================================== + */ + public static void lua_pop(IntPtr luaState, int amount) + { + LuaDLL.lua_settop(luaState, -(amount) - 1); + } + + public static void lua_newtable(IntPtr luaState) + { + LuaDLL.lua_createtable(luaState, 0, 0); + } + + public static void lua_register(IntPtr luaState, string name, LuaCSFunction func) + { + lua_pushcfunction(luaState, func); + lua_setglobal(luaState, name); + } + + public static void lua_pushcfunction(IntPtr luaState, LuaCSFunction func) + { + IntPtr fn = Marshal.GetFunctionPointerForDelegate(func); + lua_pushcclosure(luaState, fn, 0); + } + + public static bool lua_isfunction(IntPtr luaState, int n) + { + return lua_type(luaState, n) == LuaTypes.LUA_TFUNCTION; + } + + public static bool lua_istable(IntPtr luaState, int n) + { + return lua_type(luaState, n) == LuaTypes.LUA_TTABLE; + } + + public static bool lua_islightuserdata(IntPtr luaState, int n) + { + return lua_type(luaState, n) == LuaTypes.LUA_TLIGHTUSERDATA; + } + + public static bool lua_isnil(IntPtr luaState, int n) + { + return (lua_type(luaState, n) == LuaTypes.LUA_TNIL); + } + + public static bool lua_isboolean(IntPtr luaState, int n) + { + LuaTypes type = lua_type(luaState, n); + return type == LuaTypes.LUA_TBOOLEAN || type == LuaTypes.LUA_TNIL; + } + + public static bool lua_isthread(IntPtr luaState, int n) + { + return lua_type(luaState, n) == LuaTypes.LUA_TTHREAD; + } + + public static bool lua_isnone(IntPtr luaState, int n) + { + return lua_type(luaState, n) == LuaTypes.LUA_TNONE; + } + + public static bool lua_isnoneornil(IntPtr luaState, int n) + { + return lua_type(luaState, n) <= LuaTypes.LUA_TNIL; + } + + public static void lua_setglobal(IntPtr luaState, string name) + { + lua_setfield(luaState, LuaIndexes.LUA_GLOBALSINDEX, name); + } + + public static void lua_getglobal(IntPtr luaState, string name) + { + lua_getfield(luaState, LuaIndexes.LUA_GLOBALSINDEX, name); + } + + public static string lua_ptrtostring(IntPtr str, int len) + { + string ss = Marshal.PtrToStringAnsi(str, len); + + if (ss == null) + { + byte[] buffer = new byte[len]; + Marshal.Copy(str, buffer, 0, len); + return Encoding.UTF8.GetString(buffer); + } + + return ss; + } + + public static string lua_tostring(IntPtr luaState, int index) + { + int len = 0; + IntPtr str = tolua_tolstring(luaState, index, out len); + + if (str != IntPtr.Zero) + { + return lua_ptrtostring(str, len); + } + + return null; + } + + public static IntPtr lua_open() + { + return luaL_newstate(); + } + + public static void lua_getregistry(IntPtr L) + { + lua_pushvalue(L, LuaIndexes.LUA_REGISTRYINDEX); + } + + public static int lua_getgccount(IntPtr L) + { + return lua_gc(L, LuaGCOptions.LUA_GCCOUNT, 0); + } + + /* + ** ====================================================================== + ** Debug API + ** ======================================================================= + */ + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int lua_getstack(IntPtr L, int level, ref Lua_Debug ar); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int lua_getinfo(IntPtr L, string what, ref Lua_Debug ar); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern string lua_getlocal(IntPtr L, ref Lua_Debug ar, int n); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern string lua_setlocal(IntPtr L, ref Lua_Debug ar, int n); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern string lua_getupvalue(IntPtr L, int funcindex, int n); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern string lua_setupvalue(IntPtr L, int funcindex, int n); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int lua_sethook(IntPtr L, LuaHookFunc func, int mask, int count); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern LuaHookFunc lua_gethook(IntPtr L); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int lua_gethookmask(IntPtr L); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int lua_gethookcount(IntPtr L); + + //lualib.h + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void luaL_openlibs(IntPtr luaState); + + //lauxlib.h + public static int abs_index(IntPtr L, int i) + { + return (i > 0 || i <= LuaIndexes.LUA_REGISTRYINDEX) ? i : lua_gettop(L) + i + 1; + } + + public static int luaL_getn(IntPtr luaState, int i) + { + return (int)tolua_getn(luaState, i); + } + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int luaL_getmetafield(IntPtr luaState, int stackPos, string field); //[-0, +(0|1), m] + + public static int luaL_callmeta(IntPtr L, int stackPos, string field) //[-0, +(0|1), m] + { + stackPos = abs_index(L, stackPos); + + if (luaL_getmetafield(L, stackPos, field) == 0) /* no metafield? */ + { + return 0; + } + + lua_pushvalue(L, stackPos); + + if (lua_pcall(L, 1, 1, 0) != 0) + { + string error = LuaDLL.lua_tostring(L, -1); + lua_pop(L, 1); + throw new LuaException(error); + } + + return 1; + } + + public static int luaL_argerror(IntPtr L, int narg, string extramsg) + { + if (tolua_argerror(L, narg, extramsg) != 0) + { + string error = LuaDLL.lua_tostring(L, -1); + lua_pop(L, 1); + throw new LuaException(error); + } + + return 0; + } + + public static int luaL_typerror(IntPtr L, int stackPos, string tname, string t2 = null) + { + if (t2 == null) + { + t2 = luaL_typename(L, stackPos); + } + + string msg = string.Format("{0} expected, got {1}", tname, t2); + return luaL_argerror(L, stackPos, msg); + } + + public static string luaL_checklstring(IntPtr L, int numArg, out int len) + { + IntPtr str = tolua_tolstring(L, numArg, out len); + + if (str == IntPtr.Zero) + { + luaL_typerror(L, numArg, "string"); + return null; + } + + return lua_ptrtostring(str, len); + } + + public static string luaL_optlstring(IntPtr L, int narg, string def, out int len) + { + if (lua_isnoneornil(L, narg)) + { + len = def != null ? def.Length : 0; + return def; + } + + return luaL_checklstring(L, narg, out len); + } + + public static double luaL_checknumber(IntPtr L, int stackPos) + { + double d = lua_tonumber(L, stackPos); + + if (d == 0 && LuaDLL.lua_isnumber(L, stackPos) == 0) + { + luaL_typerror(L, stackPos, "number"); + return 0; + } + + return d; + } + + public static double luaL_optnumber(IntPtr L, int idx, double def) + { + if (lua_isnoneornil(L, idx)) + { + return def; + } + + return luaL_checknumber(L, idx); + } + + public static int luaL_checkinteger(IntPtr L, int stackPos) + { + int d = tolua_tointeger(L, stackPos); + + if (d == 0 && lua_isnumber(L, stackPos) == 0) + { + luaL_typerror(L, stackPos, "number"); + return 0; + } + + return d; + } + + public static int luaL_optinteger(IntPtr L, int idx, int def) + { + if (lua_isnoneornil(L, idx)) + { + return def; + } + + return luaL_checkinteger(L, idx); + } + + public static bool luaL_checkboolean(IntPtr luaState, int index) + { + if (lua_isboolean(luaState, index)) + { + return lua_toboolean(luaState, index); + } + + luaL_typerror(luaState, index, "boolean"); + return false; + } + + public static void luaL_checkstack(IntPtr L, int space, string mes) + { + if (lua_checkstack(L, space) == 0) + { + throw new LuaException(string.Format("stack overflow {0}", mes)); + } + } + + public static void luaL_checktype(IntPtr L, int narg, LuaTypes t) + { + if (lua_type(L, narg) != t) + { + luaL_typerror(L, narg, lua_typename(L, t)); + } + } + + public static void luaL_checkany(IntPtr L, int narg) + { + if (lua_type(L, narg) == LuaTypes.LUA_TNONE) + { + luaL_argerror(L, narg, "value expected"); + } + } + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int luaL_newmetatable(IntPtr luaState, string meta); //[-0, +1, m] + + public static IntPtr luaL_checkudata(IntPtr L, int ud, string tname) + { + IntPtr p = lua_touserdata(L, ud); + + if (p != IntPtr.Zero) + { + if (lua_getmetatable(L, ud) != 0) + { + lua_getfield(L, LuaIndexes.LUA_REGISTRYINDEX, tname); /* get correct metatable */ + + if (lua_rawequal(L, -1, -2) != 0) + { /* does it have the correct mt? */ + lua_pop(L, 2); /* remove both metatables */ + return p; + } + } + } + + luaL_typerror(L, ud, tname); /* else error */ + return IntPtr.Zero; /* to avoid warnings */ + } + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void luaL_where(IntPtr luaState, int level); //[-0, +1, e] + + //[DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + //public static extern int luaL_error(IntPtr luaState, string message); + + public static int luaL_throw(IntPtr L, string message) + { + tolua_pushtraceback(L); + lua_pushstring(L, message); + lua_pushnumber(L, 1); + + if (lua_pcall(L, 2, -1, 0) == 0) + { + message = lua_tostring(L, -1); + } + else + { + lua_pop(L, 1); + } + + throw new LuaException(message, null, 2); + } + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int luaL_ref(IntPtr luaState, int t); //[-1, +0, m] + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void luaL_unref(IntPtr luaState, int registryIndex, int reference); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int luaL_loadfile(IntPtr luaState, string filename); //[-0, +1, e] + + public static int luaL_loadbuffer(IntPtr luaState, byte[] buff, int size, string name) + { + return tolua_loadbuffer(luaState, buff, size, name); + } + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int luaL_loadstring(IntPtr luaState, string chunk); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr luaL_newstate(); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr luaL_gsub(IntPtr luaState, string str, string pattern, string replacement); //[-0, +1, e] + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr luaL_findtable(IntPtr luaState, int idx, string fname, int szhint = 1); + + /* + ** =============================================================== + ** some useful functions + ** =============================================================== + */ + public static string luaL_typename(IntPtr luaState, int stackPos) + { + LuaTypes type = LuaDLL.lua_type(luaState, stackPos); + return lua_typename(luaState, type); + } + + public static bool luaL_dofile(IntPtr luaState, string fileName) //[-0, +1, e] + { + int result = luaL_loadfile(luaState, fileName); + + if (result != 0) + { + return false; + } + + return LuaDLL.lua_pcall(luaState, 0, LUA_MULTRET, 0) == 0; + } + + public static bool luaL_dostring(IntPtr luaState, string chunk) + { + int result = LuaDLL.luaL_loadstring(luaState, chunk); + + if (result != 0) + { + return false; + } + + return LuaDLL.lua_pcall(luaState, 0, LUA_MULTRET, 0) == 0; + } + + public static void luaL_getmetatable(IntPtr luaState, string meta) + { + LuaDLL.lua_getfield(luaState, LuaIndexes.LUA_REGISTRYINDEX, meta); + } + + + /* compatibility with ref system */ + public static int lua_ref(IntPtr luaState) + { + return LuaDLL.luaL_ref(luaState, LuaIndexes.LUA_REGISTRYINDEX); + } + + public static void lua_getref(IntPtr luaState, int reference) + { + lua_rawgeti(luaState, LuaIndexes.LUA_REGISTRYINDEX, reference); + } + + public static void lua_unref(IntPtr luaState, int reference) + { + luaL_unref(luaState, LuaIndexes.LUA_REGISTRYINDEX, reference); + } + + /* + ** ====================================================== + ** tolua libs + ** ======================================================= + */ + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_openlibs(IntPtr L); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_openint64(IntPtr L); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int tolua_openlualibs(IntPtr L); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr tolua_tag(); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_newudata(IntPtr luaState, int val); //[-0, +0, m] + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int tolua_rawnetobj(IntPtr luaState, int obj); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern bool tolua_pushudata(IntPtr L, int index); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern bool tolua_pushnewudata(IntPtr L, int metaRef, int index); //[-0, +0, m] + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int tolua_beginpcall(IntPtr L, int reference); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_pushtraceback(IntPtr L); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_getvec2(IntPtr luaState, int stackPos, out float x, out float y); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_getvec3(IntPtr luaState, int stackPos, out float x, out float y, out float z); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_getvec4(IntPtr luaState, int stackPos, out float x, out float y, out float z, out float w); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_getclr(IntPtr luaState, int stackPos, out float r, out float g, out float b, out float a); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_getquat(IntPtr luaState, int stackPos, out float x, out float y, out float z, out float w); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int tolua_getlayermask(IntPtr luaState, int stackPos); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_pushvec2(IntPtr luaState, float x, float y); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_pushvec3(IntPtr luaState, float x, float y, float z); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_pushvec4(IntPtr luaState, float x, float y, float z, float w); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_pushquat(IntPtr luaState, float x, float y, float z, float w); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_pushclr(IntPtr luaState, float r, float g, float b, float a); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_pushlayermask(IntPtr luaState, int mask); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern bool tolua_isint64(IntPtr luaState, int stackPos); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern long tolua_toint64(IntPtr luaState, int stackPos); + + public static long tolua_checkint64(IntPtr L, int stackPos) + { + long d = tolua_toint64(L, stackPos); + + if (d == 0 && !tolua_isint64(L, stackPos)) + { + luaL_typerror(L, stackPos, "long"); + return 0; + } + + return d; + } + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_pushint64(IntPtr luaState, long n); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern bool tolua_isuint64(IntPtr luaState, int stackPos); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern ulong tolua_touint64(IntPtr luaState, int stackPos); + + public static ulong tolua_checkuint64(IntPtr L, int stackPos) + { + ulong d = tolua_touint64(L, stackPos); + + if (d == 0 && !tolua_isuint64(L, stackPos)) + { + luaL_typerror(L, stackPos, "ulong"); + return 0; + } + + return d; + } + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_pushuint64(IntPtr luaState, ulong n); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_setindex(IntPtr L); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_setnewindex(IntPtr L); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int toluaL_ref(IntPtr L); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void toluaL_unref(IntPtr L, int reference); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr tolua_getmainstate(IntPtr L); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int tolua_getvaluetype(IntPtr L, int stackPos); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern bool tolua_createtable(IntPtr L, string fullPath, int szhint = 0); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern bool tolua_pushluatable(IntPtr L, string fullPath); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern bool tolua_beginmodule(IntPtr L, string name); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_endmodule(IntPtr L); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern bool tolua_beginpremodule(IntPtr L, string fullPath, int szhint = 0); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_endpremodule(IntPtr L, int reference); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern bool tolua_addpreload(IntPtr L, string path); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int tolua_beginclass(IntPtr L, string name, int baseMetaRef, int reference = -1); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_endclass(IntPtr L); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_function(IntPtr L, string name, IntPtr fn); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr tolua_tocbuffer(string name, int sz); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_freebuffer(IntPtr buffer); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_variable(IntPtr L, string name, IntPtr get, IntPtr set); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_constant(IntPtr L, string name, double val); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int tolua_beginenum(IntPtr L, string name); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_endenum(IntPtr L); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_beginstaticclass(IntPtr L, string name); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_endstaticclass(IntPtr L); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int tolua_require(IntPtr L, string fileName); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int tolua_getmetatableref(IntPtr L, int pos); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_setflag(int bit, bool flag); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern bool tolua_isvptrtable(IntPtr L, int index); + + public static int toluaL_exception(IntPtr L, Exception e) + { + LuaException.luaStack = new LuaException(e.Message, e, 2); + return tolua_error(L, e.Message); + } + + public static int toluaL_exception(IntPtr L, Exception e, object o, string msg) + { + if (o != null && !o.Equals(null)) + { + msg = e.Message; + } + + LuaException.luaStack = new LuaException(msg, e, 2); + return tolua_error(L, msg); + } + + //閫傞厤鍑芥暟 + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int tolua_loadbuffer(IntPtr luaState, byte[] buff, int size, string name); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern bool tolua_toboolean(IntPtr luaState, int index); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int tolua_tointeger(IntPtr luaState, int idx); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr tolua_tolstring(IntPtr luaState, int index, out int strLen); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_pushlstring(IntPtr luaState, byte[] str, int size); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int tolua_objlen(IntPtr luaState, int stackPos); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr tolua_newuserdata(IntPtr luaState, int size); //[-0, +1, m] + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int tolua_argerror(IntPtr luaState, int narg, string extramsg); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int tolua_error(IntPtr L, string msg); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int tolua_getfield(IntPtr L, int idx, string key); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int tolua_setfield(IntPtr L, int idx, string key); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int tolua_gettable(IntPtr luaState, int idx); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int tolua_settable(IntPtr luaState, int idx); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int tolua_getn(IntPtr luaState, int stackPos); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int tolua_strlen(IntPtr str); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_pushcfunction(IntPtr L, IntPtr fn); + + public static void tolua_pushcfunction(IntPtr luaState, LuaCSFunction func) + { + IntPtr fn = Marshal.GetFunctionPointerForDelegate(func); + tolua_pushcfunction(luaState, fn); + } + + public static string tolua_findtable(IntPtr L, int idx, string name, int size = 1) + { + int oldTop = lua_gettop(L); + IntPtr p = LuaDLL.luaL_findtable(L, idx, name, size); + + if (p != IntPtr.Zero) + { + LuaDLL.lua_settop(L, oldTop); + int len = LuaDLL.tolua_strlen(p); + return LuaDLL.lua_ptrtostring(p, len); + } + + return null; + } + + public static IntPtr tolua_atpanic(IntPtr L, LuaCSFunction func) + { + IntPtr fn = Marshal.GetFunctionPointerForDelegate(func); + return lua_atpanic(L, fn); + } + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr tolua_buffinit(IntPtr luaState); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_addlstring(IntPtr b, string str, int l); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_addstring(IntPtr b, string s); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_addchar(IntPtr b, byte s); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_pushresult(IntPtr b); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int tolua_update(IntPtr L, float deltaTime, float unscaledDelta); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int tolua_lateupdate(IntPtr L); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int tolua_fixedupdate(IntPtr L, float fixedTime); + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern void tolua_regthis(IntPtr L, IntPtr get, IntPtr set); + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int tolua_where(IntPtr L, int level); + + public static void tolua_bindthis(IntPtr L, LuaCSFunction get, LuaCSFunction set) + { + IntPtr pGet = IntPtr.Zero; + IntPtr pSet = IntPtr.Zero; + + if (get != null) + { + pGet = Marshal.GetFunctionPointerForDelegate(get); + } + + if (set != null) + { + pSet = Marshal.GetFunctionPointerForDelegate(set); + } + + tolua_regthis(L, pGet, pSet); + } + + [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)] + public static extern int tolua_getclassref(IntPtr L, int pos); + } +} diff --git a/Assets/LuaFramework/ToLua/Core/LuaDLL.cs.meta b/Assets/LuaFramework/ToLua/Core/LuaDLL.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..231adb213fa18d054582351f1bee65fef35d85a3 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaDLL.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d60cef534e986e849a829838fbeb74b5 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Core/LuaEvent.cs b/Assets/LuaFramework/ToLua/Core/LuaEvent.cs new file mode 100644 index 0000000000000000000000000000000000000000..6dac56b83050d861ce7e3d72251cf342005cf478 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaEvent.cs @@ -0,0 +1,134 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +using System; +using LuaInterface; + +namespace LuaInterface +{ + public class LuaEvent : IDisposable + { + protected LuaState luaState; + protected bool beDisposed; + + LuaTable self = null; + LuaFunction _add = null; + LuaFunction _remove = null; + //LuaFunction _call = null; + + public LuaEvent(LuaTable table) + { + self = table; + luaState = table.GetLuaState(); + self.AddRef(); + + _add = self.GetLuaFunction("Add"); + _remove = self.GetLuaFunction("Remove"); + //_call = self.GetLuaFunction("__call"); + } + + public void Dispose() + { + self.Dispose(); + _add.Dispose(); + _remove.Dispose(); + //_call.Dispose(); + Clear(); + } + + void Clear() + { + //_call = null; + _add = null; + _remove = null; + self = null; + luaState = null; + } + + public void Dispose(bool disposeManagedResources) + { + if (!beDisposed) + { + beDisposed = true; + + //if (_call != null) + //{ + // _call.Dispose(disposeManagedResources); + // _call = null; + //} + + if (_add != null) + { + _add.Dispose(disposeManagedResources); + _add = null; + } + + if (_remove != null) + { + _remove.Dispose(disposeManagedResources); + _remove = null; + } + + if (self != null) + { + self.Dispose(disposeManagedResources); + } + + Clear(); + } + } + + public void Add(LuaFunction func, LuaTable obj) + { + if (func == null) + { + return; + } + + _add.BeginPCall(); + _add.Push(self); + _add.Push(func); + _add.Push(obj); + _add.PCall(); + _add.EndPCall(); + } + + public void Remove(LuaFunction func, LuaTable obj) + { + if (func == null) + { + return; + } + + _remove.BeginPCall(); + _remove.Push(self); + _remove.Push(func); + _remove.Push(obj); + _remove.PCall(); + _remove.EndPCall(); + } + + //public override int GetReference() + //{ + // return self.GetReference(); + //} + } +} diff --git a/Assets/LuaFramework/ToLua/Core/LuaEvent.cs.meta b/Assets/LuaFramework/ToLua/Core/LuaEvent.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..4c7130f101c9f8bdd09a55922a075b4467421bb0 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaEvent.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ce5b2d0ac4f71564c84ecc85556409a4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Core/LuaException.cs b/Assets/LuaFramework/ToLua/Core/LuaException.cs new file mode 100644 index 0000000000000000000000000000000000000000..4d5e73fa50829e85ab294b46c982318822700200 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaException.cs @@ -0,0 +1,193 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +using System; +using System.Diagnostics; +using System.Reflection; +using System.Text; +using UnityEngine; + +namespace LuaInterface +{ + public class LuaException : Exception + { + public static Exception luaStack = null; + public static string projectFolder = null; + public static int InstantiateCount = 0; + public static int SendMsgCount = 0; + public static IntPtr L = IntPtr.Zero; + + public override string StackTrace + { + get + { + return _stack; + } + } + + protected string _stack = string.Empty; + + public LuaException(string msg, Exception e = null, int skip = 1) + : base(msg) + { + if (e != null) + { + if (e is LuaException) + { + _stack = e.StackTrace; + } + else + { + StackTrace trace = new StackTrace(e, true); + StringBuilder sb = new StringBuilder(); + ExtractFormattedStackTrace(trace, sb); + StackTrace self = new StackTrace(skip, true); + ExtractFormattedStackTrace(self, sb, trace); + _stack = sb.ToString(); + } + } + else + { + StackTrace self = new StackTrace(skip, true); + StringBuilder sb = new StringBuilder(); + ExtractFormattedStackTrace(self, sb); + _stack = sb.ToString(); + } + } + + public static Exception GetLastError() + { + Exception last = luaStack; + luaStack = null; + return last; + } + + public static void ExtractFormattedStackTrace(StackTrace trace, StringBuilder sb, StackTrace skip = null) + { + int begin = 0; + + if (skip != null && skip.FrameCount > 0) + { + MethodBase m0 = skip.GetFrame(skip.FrameCount - 1).GetMethod(); + + for (int i = 0; i < trace.FrameCount; i++) + { + StackFrame frame = trace.GetFrame(i); + MethodBase method = frame.GetMethod(); + + if (method == m0) + { + begin = i + 1; + break; + } + } + + sb.AppendLineEx(); + } + + for (int i = begin; i < trace.FrameCount; i++) + { + StackFrame frame = trace.GetFrame(i); + MethodBase method = frame.GetMethod(); + + if (method == null || method.DeclaringType == null) + { + continue; + } + + Type declaringType = method.DeclaringType; + string str = declaringType.Namespace; + + if ( (InstantiateCount == 0 && declaringType == typeof(UnityEngine.Object) && method.Name == "Instantiate") //(method.Name == "Internal_CloneSingle" + || (SendMsgCount == 0 && declaringType == typeof(GameObject) && method.Name == "SendMessage")) + { + break; + } + + if ((str != null) && (str.Length != 0)) + { + sb.Append(str); + sb.Append("."); + } + + sb.Append(declaringType.Name); + sb.Append(":"); + sb.Append(method.Name); + sb.Append("("); + int index = 0; + ParameterInfo[] parameters = method.GetParameters(); + bool flag = true; + + while (index < parameters.Length) + { + if (!flag) + { + sb.Append(", "); + } + else + { + flag = false; + } + + sb.Append(parameters[index].ParameterType.Name); + index++; + } + + sb.Append(")"); + string fileName = frame.GetFileName(); + + if (fileName != null) + { + fileName = fileName.Replace('\\', '/'); + sb.Append(" (at "); + + if (fileName.StartsWith(projectFolder)) + { + fileName = fileName.Substring(projectFolder.Length, fileName.Length - projectFolder.Length); + } + + sb.Append(fileName); + sb.Append(":"); + sb.Append(frame.GetFileLineNumber().ToString()); + sb.Append(")"); + } + + if (i != trace.FrameCount - 1) + { + sb.Append("\n"); + } + } + } + + public static void Init(IntPtr L0) + { + L = L0; + Type type = typeof(StackTraceUtility); + FieldInfo field = type.GetField("projectFolder", BindingFlags.Static | BindingFlags.GetField | BindingFlags.NonPublic); + LuaException.projectFolder = (string)field.GetValue(null); + projectFolder = projectFolder.Replace('\\', '/'); +#if DEVELOPER + Debugger.Log("projectFolder is {0}", projectFolder); +#endif + } + } +} \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Core/LuaException.cs.meta b/Assets/LuaFramework/ToLua/Core/LuaException.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..b15756788a859b2462062466ca51a9c97ef0c5ff --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaException.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1b37c8a2d4e86364c85c26a407d79af7 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Core/LuaFileUtils.cs b/Assets/LuaFramework/ToLua/Core/LuaFileUtils.cs new file mode 100644 index 0000000000000000000000000000000000000000..92afa68c198681417bd077b28c82146fb968e86f --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaFileUtils.cs @@ -0,0 +1,281 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +using UnityEngine; +using System.Collections.Generic; +using System.IO; +using System.Collections; +using System.Text; + +namespace LuaInterface +{ + public class LuaFileUtils + { + public static LuaFileUtils Instance + { + get + { + if (instance == null) + { + instance = new LuaFileUtils(); + } + + return instance; + } + + protected set + { + instance = value; + } + } + + //beZip = false 鍦╯earch path 涓煡鎵捐鍙杔ua鏂囦欢銆傚惁鍒欎粠澶栭儴璁剧疆杩囨潵bundel鏂囦欢涓鍙杔ua鏂囦欢 + public bool beZip = false; + protected List searchPaths = new List(); + protected Dictionary zipMap = new Dictionary(); + + protected static LuaFileUtils instance = null; + + public LuaFileUtils() + { + instance = this; + } + + public virtual void Dispose() + { + if (instance != null) + { + instance = null; + searchPaths.Clear(); + + foreach (KeyValuePair iter in zipMap) + { + iter.Value.Unload(true); + } + + zipMap.Clear(); + } + } + + //鏍煎紡: 璺緞/?.lua + public bool AddSearchPath(string path, bool front = false) + { + int index = searchPaths.IndexOf(path); + + if (index >= 0) + { + return false; + } + + if (front) + { + searchPaths.Insert(0, path); + } + else + { + searchPaths.Add(path); + } + + return true; + } + + public bool RemoveSearchPath(string path) + { + int index = searchPaths.IndexOf(path); + + if (index >= 0) + { + searchPaths.RemoveAt(index); + return true; + } + + return false; + } + + public void AddSearchBundle(string name, AssetBundle bundle) + { + zipMap[name] = bundle; + } + + public string FindFile(string fileName) + { + if (fileName == string.Empty) + { + return string.Empty; + } + + if (Path.IsPathRooted(fileName)) + { + if (!fileName.EndsWith(".lua")) + { + fileName += ".lua"; + } + + return fileName; + } + + if (fileName.EndsWith(".lua")) + { + fileName = fileName.Substring(0, fileName.Length - 4); + } + + string fullPath = null; + + for (int i = 0; i < searchPaths.Count; i++) + { + fullPath = searchPaths[i].Replace("?", fileName); + + if (File.Exists(fullPath)) + { + return fullPath; + } + } + + return null; + } + + public virtual byte[] ReadFile(string fileName) + { + if (!beZip) + { + string path = FindFile(fileName); + byte[] str = null; + + if (!string.IsNullOrEmpty(path) && File.Exists(path)) + { +#if !UNITY_WEBPLAYER + str = File.ReadAllBytes(path); +#else + throw new LuaException("can't run in web platform, please switch to other platform"); +#endif + } + + return str; + } + else + { + return ReadZipFile(fileName); + } + } + + public virtual string FindFileError(string fileName) + { + if (Path.IsPathRooted(fileName)) + { + return fileName; + } + + if (fileName.EndsWith(".lua")) + { + fileName = fileName.Substring(0, fileName.Length - 4); + } + + using (CString.Block()) + { + CString sb = CString.Alloc(512); + + for (int i = 0; i < searchPaths.Count; i++) + { + sb.Append("\n\tno file '").Append(searchPaths[i]).Append('\''); + } + + sb = sb.Replace("?", fileName); + + if (beZip) + { + int pos = fileName.LastIndexOf('/'); + + if (pos > 0) + { + int tmp = pos + 1; + sb.Append("\n\tno file '").Append(fileName, tmp, fileName.Length - tmp).Append(".lua' in ").Append("lua_"); + tmp = sb.Length; + sb.Append(fileName, 0, pos).Replace('/', '_', tmp, pos).Append(".unity3d"); + } + else + { + sb.Append("\n\tno file '").Append(fileName).Append(".lua' in ").Append("lua.unity3d"); + } + } + + return sb.ToString(); + } + } + + byte[] ReadZipFile(string fileName) + { + AssetBundle zipFile = null; + byte[] buffer = null; + string zipName = null; + + using (CString.Block()) + { + CString sb = CString.Alloc(256); + sb.Append("lua"); + int pos = fileName.LastIndexOf('/'); + + if (pos > 0) + { + sb.Append("_"); + sb.Append(fileName, 0, pos).ToLower().Replace('/', '_'); + fileName = fileName.Substring(pos + 1); + } + + if (!fileName.EndsWith(".lua")) + { + fileName += ".lua"; + } + +#if UNITY_5 || UNITY_5_3_OR_NEWER + fileName += ".bytes"; +#endif + zipName = sb.ToString(); + zipMap.TryGetValue(zipName, out zipFile); + } + + if (zipFile != null) + { +#if UNITY_4_6 || UNITY_4_7 + TextAsset luaCode = zipFile.Load(fileName, typeof(TextAsset)) as TextAsset; +#else + TextAsset luaCode = zipFile.LoadAsset(fileName); +#endif + if (luaCode != null) + { + buffer = luaCode.bytes; + Resources.UnloadAsset(luaCode); + } + } + + return buffer; + } + + + + public static string GetOSDir() + { + return LuaConst.osDir; + } + + + } +} diff --git a/Assets/LuaFramework/ToLua/Core/LuaFileUtils.cs.meta b/Assets/LuaFramework/ToLua/Core/LuaFileUtils.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..0edd903a53c41fce08199ec8675d5c430aedbbc4 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaFileUtils.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bc1dfae6a246cdf418b607701b2dfc7c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Core/LuaFunction.cs b/Assets/LuaFramework/ToLua/Core/LuaFunction.cs new file mode 100644 index 0000000000000000000000000000000000000000..43fdd8b8d2a4e286aae268f0645bb42c238b8bff --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaFunction.cs @@ -0,0 +1,951 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace LuaInterface +{ + public class LuaFunction : LuaBaseRef + { + protected struct FuncData + { + public int oldTop; + public int stackPos; + + public FuncData(int top, int stack) + { + oldTop = top; + stackPos = stack; + } + } + + protected int oldTop = -1; + private int argCount = 0; + private int stackPos = -1; + private Stack stack = new Stack(); + + public LuaFunction(int reference, LuaState state) + { + this.reference = reference; + this.luaState = state; + } + + public override void Dispose() + { +#if UNITY_EDITOR + if (oldTop != -1 && count <= 1) + { + Debugger.LogError("You must call EndPCall before calling Dispose"); + } +#endif + base.Dispose(); + } + + public T ToDelegate() where T : class + { + return DelegateTraits.Create(this) as T; + } + + public virtual int BeginPCall() + { + if (luaState == null) + { + throw new LuaException("LuaFunction has been disposed"); + } + + stack.Push(new FuncData(oldTop, stackPos)); + oldTop = luaState.BeginPCall(reference); + stackPos = -1; + argCount = 0; + return oldTop; + } + + public void PCall() + { +#if UNITY_EDITOR + if (oldTop == -1) + { + Debugger.LogError("You must call BeginPCall before calling PCall"); + } +#endif + + stackPos = oldTop + 1; + + try + { + luaState.PCall(argCount, oldTop); + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + + public void EndPCall() + { + if (oldTop != -1) + { + luaState.EndPCall(oldTop); + argCount = 0; + FuncData data = stack.Pop(); + oldTop = data.oldTop; + stackPos = data.stackPos; + } + } + + public void Call() + { + BeginPCall(); + PCall(); + EndPCall(); + } + + public void Call(T1 arg1) + { + BeginPCall(); + PushGeneric(arg1); + PCall(); + EndPCall(); + } + + public void Call(T1 arg1, T2 arg2) + { + BeginPCall(); + PushGeneric(arg1); + PushGeneric(arg2); + PCall(); + EndPCall(); + } + + public void Call(T1 arg1, T2 arg2, T3 arg3) + { + BeginPCall(); + PushGeneric(arg1); + PushGeneric(arg2); + PushGeneric(arg3); + PCall(); + EndPCall(); + } + + public void Call(T1 arg1, T2 arg2, T3 arg3, T4 arg4) + { + BeginPCall(); + PushGeneric(arg1); + PushGeneric(arg2); + PushGeneric(arg3); + PushGeneric(arg4); + PCall(); + EndPCall(); + } + + public void Call(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) + { + BeginPCall(); + PushGeneric(arg1); + PushGeneric(arg2); + PushGeneric(arg3); + PushGeneric(arg4); + PushGeneric(arg5); + PCall(); + EndPCall(); + } + + public void Call(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) + { + BeginPCall(); + PushGeneric(arg1); + PushGeneric(arg2); + PushGeneric(arg3); + PushGeneric(arg4); + PushGeneric(arg5); + PushGeneric(arg6); + PCall(); + EndPCall(); + } + + public void Call(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) + { + BeginPCall(); + PushGeneric(arg1); + PushGeneric(arg2); + PushGeneric(arg3); + PushGeneric(arg4); + PushGeneric(arg5); + PushGeneric(arg6); + PushGeneric(arg7); + PCall(); + EndPCall(); + } + + public void Call(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) + { + BeginPCall(); + PushGeneric(arg1); + PushGeneric(arg2); + PushGeneric(arg3); + PushGeneric(arg4); + PushGeneric(arg5); + PushGeneric(arg6); + PushGeneric(arg7); + PushGeneric(arg8); + PCall(); + EndPCall(); + } + + public void Call(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) + { + BeginPCall(); + PushGeneric(arg1); + PushGeneric(arg2); + PushGeneric(arg3); + PushGeneric(arg4); + PushGeneric(arg5); + PushGeneric(arg6); + PushGeneric(arg7); + PushGeneric(arg8); + PushGeneric(arg9); + PCall(); + EndPCall(); + } + + public R1 Invoke() + { + BeginPCall(); + PCall(); + R1 ret1 = CheckValue(); + EndPCall(); + return ret1; + } + + public R1 Invoke(T1 arg1) + { + BeginPCall(); + PushGeneric(arg1); + PCall(); + R1 ret1 = CheckValue(); + EndPCall(); + return ret1; + } + + public R1 Invoke(T1 arg1, T2 arg2) + { + BeginPCall(); + PushGeneric(arg1); + PushGeneric(arg2); + PCall(); + R1 ret1 = CheckValue(); + EndPCall(); + return ret1; + } + + public R1 Invoke(T1 arg1, T2 arg2, T3 arg3) + { + BeginPCall(); + PushGeneric(arg1); + PushGeneric(arg2); + PushGeneric(arg3); + PCall(); + R1 ret1 = CheckValue(); + EndPCall(); + return ret1; + } + + public R1 Invoke(T1 arg1, T2 arg2, T3 arg3, T4 arg4) + { + BeginPCall(); + PushGeneric(arg1); + PushGeneric(arg2); + PushGeneric(arg3); + PushGeneric(arg4); + PCall(); + R1 ret1 = CheckValue(); + EndPCall(); + return ret1; + } + + public R1 Invoke(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) + { + BeginPCall(); + PushGeneric(arg1); + PushGeneric(arg2); + PushGeneric(arg3); + PushGeneric(arg4); + PushGeneric(arg5); + PCall(); + R1 ret1 = CheckValue(); + EndPCall(); + return ret1; + } + + public R1 Invoke(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) + { + BeginPCall(); + PushGeneric(arg1); + PushGeneric(arg2); + PushGeneric(arg3); + PushGeneric(arg4); + PushGeneric(arg5); + PushGeneric(arg6); + PCall(); + R1 ret1 = CheckValue(); + EndPCall(); + return ret1; + } + + public R1 Invoke(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) + { + BeginPCall(); + PushGeneric(arg1); + PushGeneric(arg2); + PushGeneric(arg3); + PushGeneric(arg4); + PushGeneric(arg5); + PushGeneric(arg6); + PushGeneric(arg7); + PCall(); + R1 ret1 = CheckValue(); + EndPCall(); + return ret1; + } + + public R1 Invoke(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) + { + BeginPCall(); + PushGeneric(arg1); + PushGeneric(arg2); + PushGeneric(arg3); + PushGeneric(arg4); + PushGeneric(arg5); + PushGeneric(arg6); + PushGeneric(arg7); + PushGeneric(arg8); + PCall(); + R1 ret1 = CheckValue(); + EndPCall(); + return ret1; + } + + public R1 Invoke(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) + { + BeginPCall(); + PushGeneric(arg1); + PushGeneric(arg2); + PushGeneric(arg3); + PushGeneric(arg4); + PushGeneric(arg5); + PushGeneric(arg6); + PushGeneric(arg7); + PushGeneric(arg8); + PushGeneric(arg9); + PCall(); + R1 ret1 = CheckValue(); + EndPCall(); + return ret1; + } + + //鎱庣敤, 鏈塯c alloc + [System.Obsolete("LuaFunction.LazyCall() is obsolete.Use LuaFunction.Invoke()")] + public object[] LazyCall(params object[] args) + { + BeginPCall(); + int count = args == null ? 0 : args.Length; + + if (!luaState.LuaCheckStack(count + 6)) + { + EndPCall(); + throw new LuaException("stack overflow"); + } + + PushArgs(args); + PCall(); + object[] objs = luaState.CheckObjects(oldTop); + EndPCall(); + return objs; + } + + public void CheckStack(int args) + { + luaState.LuaCheckStack(args + 6); + } + + public bool IsBegin() + { + return oldTop != -1; + } + + public void Push(double num) + { + luaState.Push(num); + ++argCount; + } + + public void Push(int n) + { + luaState.Push(n); + ++argCount; + } + + public void PushLayerMask(LayerMask n) + { + luaState.PushLayerMask(n); + ++argCount; + } + + public void Push(uint un) + { + luaState.Push(un); + ++argCount; + } + + public void Push(long num) + { + luaState.Push(num); + ++argCount; + } + + public void Push(ulong un) + { + luaState.Push(un); + ++argCount; + } + + public void Push(bool b) + { + luaState.Push(b); + ++argCount; + } + + public void Push(string str) + { + luaState.Push(str); + ++argCount; + } + + public void Push(IntPtr ptr) + { + luaState.Push(ptr); + ++argCount; + } + + public void Push(LuaBaseRef lbr) + { + luaState.Push(lbr); + ++argCount; + } + + public void Push(object o) + { + luaState.PushVariant(o); + ++argCount; + } + + public void Push(UnityEngine.Object o) + { + luaState.Push(o); + ++argCount; + } + + public void Push(Type t) + { + luaState.Push(t); + ++argCount; + } + + public void Push(Enum e) + { + luaState.Push(e); + ++argCount; + } + + public void Push(Array array) + { + luaState.Push(array); + ++argCount; + } + + public void Push(Vector3 v3) + { + luaState.Push(v3); + ++argCount; + } + + public void Push(Vector2 v2) + { + luaState.Push(v2); + ++argCount; + } + + public void Push(Vector4 v4) + { + luaState.Push(v4); + ++argCount; + } + + public void Push(Quaternion quat) + { + luaState.Push(quat); + ++argCount; + } + + public void Push(Color clr) + { + luaState.Push(clr); + ++argCount; + } + + public void Push(Ray ray) + { + try + { + luaState.Push(ray); + ++argCount; + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + + public void Push(Bounds bounds) + { + try + { + luaState.Push(bounds); + ++argCount; + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + + public void Push(RaycastHit hit) + { + try + { + luaState.Push(hit); + ++argCount; + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + + public void Push(Touch t) + { + try + { + luaState.Push(t); + ++argCount; + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + + public void Push(LuaByteBuffer buffer) + { + try + { + luaState.Push(buffer); + ++argCount; + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + + public void PushValue(T value) where T : struct + { + try + { + luaState.PushValue(value); + ++argCount; + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + + public void PushObject(object o) + { + try + { + luaState.PushObject(o); + ++argCount; + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + + public void PushSealed(T o) + { + try + { + luaState.PushSealed(o); + ++argCount; + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + + public void PushGeneric(T t) + { + try + { + luaState.PushGeneric(t); + ++argCount; + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + + public void PushArgs(object[] args) + { + if (args == null) + { + return; + } + + argCount += args.Length; + luaState.PushArgs(args); + } + + public void PushByteBuffer(byte[] buffer, int len = -1) + { + try + { + if (len == -1) + { + len = buffer.Length; + } + + luaState.PushByteBuffer(buffer, len); + ++argCount; + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + + public double CheckNumber() + { + try + { + return luaState.LuaCheckNumber(stackPos++); + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + + public bool CheckBoolean() + { + try + { + return luaState.LuaCheckBoolean(stackPos++); + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + + public string CheckString() + { + try + { + return luaState.CheckString(stackPos++); + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + + public Vector3 CheckVector3() + { + try + { + return luaState.CheckVector3(stackPos++); + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + + public Quaternion CheckQuaternion() + { + try + { + return luaState.CheckQuaternion(stackPos++); + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + + public Vector2 CheckVector2() + { + try + { + return luaState.CheckVector2(stackPos++); + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + + public Vector4 CheckVector4() + { + try + { + return luaState.CheckVector4(stackPos++); + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + + public Color CheckColor() + { + try + { + return luaState.CheckColor(stackPos++); + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + + public Ray CheckRay() + { + try + { + return luaState.CheckRay(stackPos++); + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + + public Bounds CheckBounds() + { + try + { + return luaState.CheckBounds(stackPos++); + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + + public LayerMask CheckLayerMask() + { + try + { + return luaState.CheckLayerMask(stackPos++); + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + + public long CheckLong() + { + try + { + return luaState.CheckLong(stackPos++); + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + + public ulong CheckULong() + { + try + { + return luaState.CheckULong(stackPos++); + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + + public Delegate CheckDelegate() + { + try + { + return luaState.CheckDelegate(stackPos++); + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + + public object CheckVariant() + { + return luaState.ToVariant(stackPos++); + } + + public char[] CheckCharBuffer() + { + try + { + return luaState.CheckCharBuffer(stackPos++); + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + + public byte[] CheckByteBuffer() + { + try + { + return luaState.CheckByteBuffer(stackPos++); + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + + public object CheckObject(Type t) + { + try + { + return luaState.CheckObject(stackPos++, t); + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + + public LuaFunction CheckLuaFunction() + { + try + { + return luaState.CheckLuaFunction(stackPos++); + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + + public LuaTable CheckLuaTable() + { + try + { + return luaState.CheckLuaTable(stackPos++); + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + + public LuaThread CheckLuaThread() + { + try + { + return luaState.CheckLuaThread(stackPos++); + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + + public T CheckValue() + { + try + { + return luaState.CheckValue(stackPos++); + } + catch (Exception e) + { + EndPCall(); + throw e; + } + } + } +} diff --git a/Assets/LuaFramework/ToLua/Core/LuaFunction.cs.meta b/Assets/LuaFramework/ToLua/Core/LuaFunction.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..84de07fe75155ce0437e1a85d1e2bd1b68379fa0 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaFunction.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8f2e7f7664506cc45b1e1d375c066432 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Core/LuaMatchType.cs b/Assets/LuaFramework/ToLua/Core/LuaMatchType.cs new file mode 100644 index 0000000000000000000000000000000000000000..c540efee175974ec08f23237c4e44ccdb8d11180 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaMatchType.cs @@ -0,0 +1,709 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +using UnityEngine; +using System; +using System.Collections; + +namespace LuaInterface +{ + public class LuaMatchType + { + public bool CheckNumber(IntPtr L, int pos) + { + return LuaDLL.lua_type(L, pos) == LuaTypes.LUA_TNUMBER; + } + + public bool CheckBool(IntPtr L, int pos) + { + return LuaDLL.lua_type(L, pos) == LuaTypes.LUA_TBOOLEAN; + } + + public bool CheckLong(IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + + switch (luaType) + { + case LuaTypes.LUA_TNUMBER: + return true; + case LuaTypes.LUA_TUSERDATA: + return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Int64; + default: + return false; + } + } + + public bool CheckULong(IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + + switch (luaType) + { + case LuaTypes.LUA_TNUMBER: + return LuaDLL.lua_tonumber(L, pos) >= 0; + case LuaTypes.LUA_TUSERDATA: + return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.UInt64; + default: + return false; + } + } + + public bool CheckNullNumber(IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + return luaType == LuaTypes.LUA_TNUMBER || luaType == LuaTypes.LUA_TNIL; + } + + public bool CheckNullBool(IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + return luaType == LuaTypes.LUA_TBOOLEAN || luaType == LuaTypes.LUA_TNIL; + } + + public bool CheckNullLong(IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return true; + case LuaTypes.LUA_TNUMBER: + return true; + case LuaTypes.LUA_TUSERDATA: + return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Int64; + default: + return false; + } + } + + public bool CheckNullULong(IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return true; + case LuaTypes.LUA_TNUMBER: + return true; + case LuaTypes.LUA_TUSERDATA: + return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.UInt64; + default: + return false; + } + } + + public bool CheckString(IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return true; + case LuaTypes.LUA_TSTRING: + return true; + case LuaTypes.LUA_TUSERDATA: + return CheckClassType(typeof(string), L, pos); + default: + return false; + } + } + + public bool CheckByteArray(IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return true; + case LuaTypes.LUA_TSTRING: + return true; + case LuaTypes.LUA_TUSERDATA: + return CheckClassType(typeof(byte[]), L, pos); + default: + return false; + } + } + + public bool CheckCharArray(IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return true; + case LuaTypes.LUA_TSTRING: + return true; + case LuaTypes.LUA_TUSERDATA: + return CheckClassType(typeof(char[]), L, pos); + default: + return false; + } + } + + public bool CheckArray(Type t, IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return true; + case LuaTypes.LUA_TTABLE: + return true; + case LuaTypes.LUA_TUSERDATA: + return CheckClassType(t, L, pos); + default: + return false; + } + } + + public bool CheckBoolArray(IntPtr L, int pos) + { + return CheckArray(typeof(bool[]), L, pos); + } + + public bool CheckSByteArray(IntPtr L, int pos) + { + return CheckArray(typeof(sbyte[]), L, pos); + } + + public bool CheckInt16Array(IntPtr L, int pos) + { + return CheckArray(typeof(short[]), L, pos); + } + + public bool CheckUInt16Array(IntPtr L, int pos) + { + return CheckArray(typeof(ushort[]), L, pos); + } + + public bool CheckDecimalArray(IntPtr L, int pos) + { + return CheckArray(typeof(decimal[]), L, pos); + } + + public bool CheckSingleArray(IntPtr L, int pos) + { + return CheckArray(typeof(float[]), L, pos); + } + + public bool CheckDoubleArray(IntPtr L, int pos) + { + return CheckArray(typeof(double[]), L, pos); + } + + public bool CheckInt32Array(IntPtr L, int pos) + { + return CheckArray(typeof(int[]), L, pos); + } + + public bool CheckUInt32Array(IntPtr L, int pos) + { + return CheckArray(typeof(uint[]), L, pos); + } + + public bool CheckInt64Array(IntPtr L, int pos) + { + return CheckArray(typeof(long[]), L, pos); + } + + public bool CheckUInt64Array(IntPtr L, int pos) + { + return CheckArray(typeof(ulong[]), L, pos); + } + + public bool CheckStringArray(IntPtr L, int pos) + { + return CheckArray(typeof(string[]), L, pos); + } + + public bool CheckTypeArray(IntPtr L, int pos) + { + return CheckArray(typeof(Type[]), L, pos); + } + + public bool CheckObjectArray(IntPtr L, int pos) + { + return CheckArray(typeof(object[]), L, pos); + } + + bool CheckValueType(IntPtr L, int pos, int valueType, Type nt) + { + if (LuaDLL.lua_type(L, pos) == LuaTypes.LUA_TTABLE) + { + int vt = LuaDLL.tolua_getvaluetype(L, pos); + return vt == valueType; + } + + return false; + } + + public bool CheckVec3(IntPtr L, int pos) + { + if (LuaDLL.lua_type(L, pos) == LuaTypes.LUA_TTABLE) + { + return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Vector3; + } + + return false; + } + + public bool CheckQuat(IntPtr L, int pos) + { + if (LuaDLL.lua_type(L, pos) == LuaTypes.LUA_TTABLE) + { + return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Quaternion; + } + + return false; + } + + public bool CheckVec2(IntPtr L, int pos) + { + if (LuaDLL.lua_type(L, pos) == LuaTypes.LUA_TTABLE) + { + return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Vector2; + } + + return false; + } + + public bool CheckColor(IntPtr L, int pos) + { + if (LuaDLL.lua_type(L, pos) == LuaTypes.LUA_TTABLE) + { + return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Color; + } + + return false; + } + + public bool CheckVec4(IntPtr L, int pos) + { + if (LuaDLL.lua_type(L, pos) == LuaTypes.LUA_TTABLE) + { + return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Vector4; + } + + return false; + } + + public bool CheckRay(IntPtr L, int pos) + { + if (LuaDLL.lua_type(L, pos) == LuaTypes.LUA_TTABLE) + { + return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Ray; + } + + return false; + } + + public bool CheckBounds(IntPtr L, int pos) + { + if (LuaDLL.lua_type(L, pos) == LuaTypes.LUA_TTABLE) + { + return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Bounds; + } + + return false; + } + + public bool CheckTouch(IntPtr L, int pos) + { + if (LuaDLL.lua_type(L, pos) == LuaTypes.LUA_TTABLE) + { + return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Touch; + } + + return false; + } + + public bool CheckLayerMask(IntPtr L, int pos) + { + if (LuaDLL.lua_type(L, pos) == LuaTypes.LUA_TTABLE) + { + return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.LayerMask; + } + + return false; + } + + public bool CheckRaycastHit(IntPtr L, int pos) + { + if (LuaDLL.lua_type(L, pos) == LuaTypes.LUA_TTABLE) + { + return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.RaycastHit; + } + + return false; + } + + public bool CheckNullVec3(IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return true; + case LuaTypes.LUA_TTABLE: + return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Vector3; + default: + return false; + } + } + + public bool CheckNullQuat(IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return true; + case LuaTypes.LUA_TTABLE: + return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Quaternion; + default: + return false; + } + } + + public bool CheckNullVec2(IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return true; + case LuaTypes.LUA_TTABLE: + return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Vector2; + default: + return false; + } + } + + public bool CheckNullColor(IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return true; + case LuaTypes.LUA_TTABLE: + return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Color; + default: + return false; + } + } + + public bool CheckNullVec4(IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return true; + case LuaTypes.LUA_TTABLE: + return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Vector4; + default: + return false; + } + } + + public bool CheckNullRay(IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return true; + case LuaTypes.LUA_TTABLE: + return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Ray; + default: + return false; + } + } + + public bool CheckNullBounds(IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return true; + case LuaTypes.LUA_TTABLE: + return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Bounds; + default: + return false; + } + } + + public bool CheckNullTouch(IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return true; + case LuaTypes.LUA_TTABLE: + return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Touch; + default: + return false; + } + } + + public bool CheckNullLayerMask(IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return true; + case LuaTypes.LUA_TTABLE: + return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.LayerMask; + default: + return false; + } + } + + public bool CheckNullRaycastHit(IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return true; + case LuaTypes.LUA_TTABLE: + return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.RaycastHit; + default: + return false; + } + } + + public bool CheckVec3Array(IntPtr L, int pos) + { + return CheckArray(typeof(Vector3[]), L, pos); + } + + public bool CheckQuatArray(IntPtr L, int pos) + { + return CheckArray(typeof(Quaternion[]), L, pos); + } + + public bool CheckVec2Array(IntPtr L, int pos) + { + return CheckArray(typeof(Vector2[]), L, pos); + } + + public bool CheckVec4Array(IntPtr L, int pos) + { + return CheckArray(typeof(Vector4[]), L, pos); + } + + public bool CheckColorArray(IntPtr L, int pos) + { + return CheckArray(typeof(Color[]), L, pos); + } + + public bool CheckPtr(IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + return luaType == LuaTypes.LUA_TLIGHTUSERDATA || luaType == LuaTypes.LUA_TNIL; + } + + public bool CheckLuaFunc(IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + return luaType == LuaTypes.LUA_TFUNCTION || luaType == LuaTypes.LUA_TNIL; + } + + public bool CheckLuaTable(IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + return luaType == LuaTypes.LUA_TTABLE || luaType == LuaTypes.LUA_TNIL; + } + + public bool CheckLuaThread(IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + return luaType == LuaTypes.LUA_TTHREAD || luaType == LuaTypes.LUA_TNIL; + } + + public bool CheckLuaBaseRef(IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + + switch(luaType) + { + case LuaTypes.LUA_TNIL: + return true; + case LuaTypes.LUA_TFUNCTION: + return true; + case LuaTypes.LUA_TTABLE: + return true; + case LuaTypes.LUA_TTHREAD: + return true; + default: + return false; + } + } + + public bool CheckByteBuffer(IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + return luaType == LuaTypes.LUA_TSTRING || luaType == LuaTypes.LUA_TNIL; + } + + public bool CheckEventObject(IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return true; + case LuaTypes.LUA_TUSERDATA: + return CheckClassType(typeof(EventObject), L, pos); + default: + return false; + } + } + + public bool CheckEnumerator(IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return true; + case LuaTypes.LUA_TUSERDATA: + int udata = LuaDLL.tolua_rawnetobj(L, pos); + + if (udata != -1) + { + ObjectTranslator translator = ObjectTranslator.Get(L); + object obj = translator.GetObject(udata); + return obj == null ? true : obj is IEnumerator; + } + return false; + default: + return false; + } + } + + //涓嶅瓨鍦ㄦ淳鐢熺被鐨勭被鍨 + bool CheckFinalType(Type type, IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return true; + case LuaTypes.LUA_TUSERDATA: + return CheckClassType(type, L, pos); + default: + return false; + } + } + + public bool CheckGameObject(IntPtr L, int pos) + { + return CheckFinalType(typeof(GameObject), L, pos); + } + + public bool CheckTransform(IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return true; + case LuaTypes.LUA_TUSERDATA: + int udata = LuaDLL.tolua_rawnetobj(L, pos); + + if (udata != -1) + { + ObjectTranslator translator = ObjectTranslator.Get(L); + object obj = translator.GetObject(udata); + return obj == null ? true : obj is Transform; + } + + return false; + default: + return false; + } + } + + static Type monoType = typeof(Type).GetType(); + + public bool CheckMonoType(IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return true; + case LuaTypes.LUA_TUSERDATA: + return CheckClassType(monoType, L, pos); + default: + return false; + } + } + + public bool CheckVariant(IntPtr L, int pos) + { + return true; + } + + bool CheckClassType(Type t, IntPtr L, int pos) + { + int udata = LuaDLL.tolua_rawnetobj(L, pos); + + if (udata != -1) + { + ObjectTranslator translator = ObjectTranslator.Get(L); + object obj = translator.GetObject(udata); + return obj == null ? true : obj.GetType() == t; + } + + return false; + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Core/LuaMatchType.cs.meta b/Assets/LuaFramework/ToLua/Core/LuaMatchType.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..d10994991feb55daa7d73310d9e1c0d3967c1c05 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaMatchType.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 23fa92cf1685f2d4da97d54967a224ad +timeCreated: 1494397554 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Core/LuaMethodCache.cs b/Assets/LuaFramework/ToLua/Core/LuaMethodCache.cs new file mode 100644 index 0000000000000000000000000000000000000000..9d9721ba86dcecc24e6bd15278a8ac30e361c614 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaMethodCache.cs @@ -0,0 +1,113 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +using System; +using System.Reflection; +using System.Collections.Generic; + +namespace LuaInterface +{ + public static class LuaMethodCache + { + public static Dictionary>> dict = new Dictionary>>(); + + static MethodInfo GetMethod(Type t, string name, Type[] ts) + { + Dictionary> map = null; + List list = null; + + if (!dict.TryGetValue(t, out map)) + { + map = new Dictionary>(); + dict.Add(t, map); + } + + if (!map.TryGetValue(name, out list)) + { + list = new List(); + MethodInfo[] mds = t.GetMethods(); + + for (int i = 0; i < mds.Length; i++) + { + if (mds[i].Name == name) + { + list.Add(mds[i]); + } + } + + map.Add(name, list); + } + + if (list.Count == 1) + { + return list[0]; + } + + for (int i = 0; i < list.Count; i++) + { + ParameterInfo[] pis = list[i].GetParameters(); + bool flag = true; + + if (pis.Length == 0 && (ts == null || ts.Length == 0)) + { + return list[i]; + } + else if (pis.Length == ts.Length) + { + for (int j = 0; j < ts.Length; j++) + { + if (pis[j].ParameterType != ts[j]) + { + flag = false; + break; + } + } + + if (flag) + { + return list[i]; + } + } + } + + return null; + } + + public static object CallSingleMethod(string name, object obj, params object[] args) + { + MethodInfo md = GetMethod(obj.GetType(), name, null); + return md.Invoke(obj, args); + } + + public static object CallMethod(string name, object obj, params object[] args) + { + Type[] ts = new Type[args.Length]; + + for (int i = 0; i < args.Length; i++) + { + ts[i] = args[i].GetType(); + } + + MethodInfo md = GetMethod(obj.GetType(), name, ts); + return md.Invoke(obj, args); + } + } +} diff --git a/Assets/LuaFramework/ToLua/Core/LuaMethodCache.cs.meta b/Assets/LuaFramework/ToLua/Core/LuaMethodCache.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..0b94c8fd1b0cf920e85010d75d634a27f0240874 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaMethodCache.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6d0c295670bdae343be5791ad4a0e9ae +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Core/LuaMisc.cs b/Assets/LuaFramework/ToLua/Core/LuaMisc.cs new file mode 100644 index 0000000000000000000000000000000000000000..7403e61b21aa5006eb6e1c289aed3a09861f9a1d --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaMisc.cs @@ -0,0 +1,562 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +using System; +using System.Runtime.InteropServices; +using System.Collections.Generic; +using System.Reflection; +using System.Text; +using System.Runtime.CompilerServices; + +namespace LuaInterface +{ + public class GCRef + { + public int reference; + public string name = null; + + public GCRef(int reference, string name) + { + this.reference = reference; + this.name = name; + } + } + + //璁゜yte[] 鍘嬪叆鎴愪负lua string 鑰屼笉鏄暟缁 userdata + //涔熷彲浠ヤ娇鐢↙uaByteBufferAttribute鏉ユ爣璁癰yte[] + public struct LuaByteBuffer + { + public LuaByteBuffer(IntPtr source, int len) + : this() + { + buffer = new byte[len]; + Length = len; + Marshal.Copy(source, buffer, 0, len); + } + + public LuaByteBuffer(byte[] buf) + : this() + { + buffer = buf; + Length = buf.Length; + } + + public LuaByteBuffer(byte[] buf, int len) + : this() + { + buffer = buf; + Length = len; + } + + public LuaByteBuffer(System.IO.MemoryStream stream) + : this() + { + buffer = stream.GetBuffer(); + Length = (int)stream.Length; + } + + public static implicit operator LuaByteBuffer(System.IO.MemoryStream stream) + { + return new LuaByteBuffer(stream); + } + + public byte[] buffer; + + public int Length + { + get; + private set; + } + } + + public class LuaOut { } + //public class LuaOutMetatable {} + public class NullObject { } + + //娉涘瀷鍑芥暟鍙傛暟null浠f浛 + public struct nil { } + + public class LuaDelegate + { + public LuaFunction func = null; + public LuaTable self = null; + public MethodInfo method = null; + + public LuaDelegate(LuaFunction func) + { + this.func = func; + } + + public LuaDelegate(LuaFunction func, LuaTable self) + { + this.func = func; + this.self = self; + } + + //濡傛灉count涓嶆槸1锛岃鏄庤繕鏈夊叾浠栦汉寮曠敤锛屽彧鑳界瓑寰単c鏉ュ鐞 + public virtual void Dispose() + { + method = null; + + if (func != null) + { + func.Dispose(1); + func = null; + } + + if (self != null) + { + self.Dispose(1); + self = null; + } + } + + public override bool Equals(object o) + { + if (o == null) return func == null && self == null; + LuaDelegate ld = o as LuaDelegate; + + if (ld == null || ld.func != func || ld.self != self) + { + return false; + } + + return ld.func != null; + } + + static bool CompareLuaDelegate(LuaDelegate a, LuaDelegate b) + { + if (System.Object.ReferenceEquals(a, b)) + { + return true; + } + + object l = a; + object r = b; + + if (l == null && r != null) + { + return b.func == null && b.self == null; + } + + if (l != null && r == null) + { + return a.func == null && a.self == null; + } + + if (a.func != b.func || a.self != b.self) + { + return false; + } + + return a.func != null; + } + + public static bool operator == (LuaDelegate a, LuaDelegate b) + { + return CompareLuaDelegate(a, b); + } + + public static bool operator != (LuaDelegate a, LuaDelegate b) + { + return !CompareLuaDelegate(a, b); + } + public override int GetHashCode() + { + return RuntimeHelpers.GetHashCode(this); + } + } + + [NoToLuaAttribute] + public static class LuaMisc + { + public static string GetArrayRank(Type t) + { + int count = t.GetArrayRank(); + + if (count == 1) + { + return "[]"; + } + + using (CString.Block()) + { + CString sb = CString.Alloc(64); + sb.Append('['); + + for (int i = 1; i < count; i++) + { + sb.Append(','); + } + + sb.Append(']'); + return sb.ToString(); + } + } + + public static string GetTypeName(Type t) + { + if (t.IsArray) + { + string str = GetTypeName(t.GetElementType()); + str += GetArrayRank(t); + return str; + } + else if (t.IsByRef) + { + t = t.GetElementType(); + return GetTypeName(t); + } + else if (t.IsGenericType) + { + return GetGenericName(t); + } + else if (t == typeof(void)) + { + return "void"; + } + else + { + string name = GetPrimitiveStr(t); + return name.Replace('+', '.'); + } + } + + public static string[] GetGenericName(Type[] types, int offset, int count) + { + string[] results = new string[count]; + + for (int i = 0; i < count; i++) + { + int pos = i + offset; + + if (types[pos].IsGenericType) + { + results[i] = GetGenericName(types[pos]); + } + else + { + results[i] = GetTypeName(types[pos]); + } + + } + + return results; + } + + static string CombineTypeStr(string space, string name) + { + if (string.IsNullOrEmpty(space)) + { + return name; + } + else + { + return space + "." + name; + } + } + + static string GetGenericName(Type t) + { + Type[] gArgs = t.GetGenericArguments(); + string typeName = t.FullName ?? t.Name; + int count = gArgs.Length; + int pos = typeName.IndexOf("["); + + if (pos > 0) + { + typeName = typeName.Substring(0, pos); + } + + string str = null; + string name = null; + int offset = 0; + pos = typeName.IndexOf("+"); + + while (pos > 0) + { + str = typeName.Substring(0, pos); + typeName = typeName.Substring(pos + 1); + pos = str.IndexOf('`'); + + if (pos > 0) + { + count = (int)(str[pos + 1] - '0'); + str = str.Substring(0, pos); + str += "<" + string.Join(",", GetGenericName(gArgs, offset, count)) + ">"; + offset += count; + } + + name = CombineTypeStr(name, str); + pos = typeName.IndexOf("+"); + } + + str = typeName; + + if (offset < gArgs.Length) + { + pos = str.IndexOf('`'); + count = (int)(str[pos + 1] - '0'); + str = str.Substring(0, pos); + str += "<" + string.Join(",", GetGenericName(gArgs, offset, count)) + ">"; + } + + return CombineTypeStr(name, str); + } + + public static Delegate GetEventHandler(object obj, Type t, string eventName) + { + FieldInfo eventField = t.GetField(eventName, BindingFlags.GetField | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static); + return (Delegate)eventField.GetValue(obj); + } + + public static string GetPrimitiveStr(Type t) + { + if (t == typeof(System.Single)) + { + return "float"; + } + else if (t == typeof(System.String)) + { + return "string"; + } + else if (t == typeof(System.Int32)) + { + return "int"; + } + else if (t == typeof(System.Double)) + { + return "double"; + } + else if (t == typeof(System.Boolean)) + { + return "bool"; + } + else if (t == typeof(System.UInt32)) + { + return "uint"; + } + else if (t == typeof(System.SByte)) + { + return "sbyte"; + } + else if (t == typeof(System.Byte)) + { + return "byte"; + } + else if (t == typeof(System.Int16)) + { + return "short"; + } + else if (t == typeof(System.UInt16)) + { + return "ushort"; + } + else if (t == typeof(System.Char)) + { + return "char"; + } + else if (t == typeof(System.Int64)) + { + return "long"; + } + else if (t == typeof(System.UInt64)) + { + return "ulong"; + } + else if (t == typeof(System.Decimal)) + { + return "decimal"; + } + else if (t == typeof(System.Object)) + { + return "object"; + } + else + { + return t.ToString(); + } + } + + public static double ToDouble(object obj) + { + Type t = obj.GetType(); + + if (t == typeof(double) || t == typeof(float)) + { + double d = Convert.ToDouble(obj); + return d; + } + else if (t == typeof(int)) + { + int n = Convert.ToInt32(obj); + return (double)n; + } + else if (t == typeof(uint)) + { + uint n = Convert.ToUInt32(obj); + return (double)n; + } + else if (t == typeof(long)) + { + long n = Convert.ToInt64(obj); + return (double)n; + } + else if (t == typeof(ulong)) + { + ulong n = Convert.ToUInt64(obj); + return (double)n; + } + else if (t == typeof(byte)) + { + byte b = Convert.ToByte(obj); + return (double)b; + } + else if (t == typeof(sbyte)) + { + sbyte b = Convert.ToSByte(obj); + return (double)b; + } + else if (t == typeof(char)) + { + char c = Convert.ToChar(obj); + return (double)c; + } + else if (t == typeof(short)) + { + Int16 n = Convert.ToInt16(obj); + return (double)n; + } + else if (t == typeof(ushort)) + { + UInt16 n = Convert.ToUInt16(obj); + return (double)n; + } + + return 0; + } + + //鍙骇鐢熷鍑烘枃浠剁殑鍩虹被 + public static Type GetExportBaseType(Type t) + { + Type baseType = t.BaseType; + + if (baseType == typeof(ValueType)) + { + return null; + } + + if (t.IsAbstract && t.IsSealed) + { + return baseType == typeof(object) ? null : baseType; + } + + return baseType; + } + } + + /*[NoToLuaAttribute] + public struct LuaInteger64 + { + public long i64; + + public LuaInteger64(long i64) + { + this.i64 = i64; + } + + public static implicit operator LuaInteger64(long i64) + { + return new LuaInteger64(i64); + } + + public static implicit operator long(LuaInteger64 self) + { + return self.i64; + } + + public ulong ToUInt64() + { + return (ulong)i64; + } + + public override string ToString() + { + return Convert.ToString(i64); + } + }*/ + + public class TouchBits + { + public const int DeltaPosition = 1; + public const int Position = 2; + public const int RawPosition = 4; + public const int ALL = 7; + } + + public class RaycastBits + { + public const int Collider = 1; + public const int Normal = 2; + public const int Point = 4; + public const int Rigidbody = 8; + public const int Transform = 16; + public const int ALL = 31; + } + + public enum EventOp + { + None = 0, + Add = 1, + Sub = 2, + } + + public class EventObject + { + [NoToLuaAttribute] + public EventOp op = EventOp.None; + [NoToLuaAttribute] + public Delegate func = null; + [NoToLuaAttribute] + public Type type; + + [NoToLuaAttribute] + public EventObject(Type t) + { + type = t; + } + + public static EventObject operator +(EventObject a, Delegate b) + { + a.op = EventOp.Add; + a.func = b; + return a; + } + + public static EventObject operator -(EventObject a, Delegate b) + { + a.op = EventOp.Sub; + a.func = b; + return a; + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Core/LuaMisc.cs.meta b/Assets/LuaFramework/ToLua/Core/LuaMisc.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..8a245eb3346ab34990dba2d8c94a6229c3be1203 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaMisc.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 49b0c76b911a9d34bac07d4b3aa7f6de +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Core/LuaStackOp.cs b/Assets/LuaFramework/ToLua/Core/LuaStackOp.cs new file mode 100644 index 0000000000000000000000000000000000000000..1390e6fd7be2e664d91dfae1a1c6068575a0602b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaStackOp.cs @@ -0,0 +1,1215 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +using UnityEngine; +using System; +using System.Runtime.InteropServices; +using System.Collections; + +namespace LuaInterface +{ + public class LuaStackOp + { + public sbyte ToSByte(IntPtr L, int stackPos) + { + double ret = LuaDLL.lua_tonumber(L, stackPos); + return Convert.ToSByte(ret); + } + + public byte ToByte(IntPtr L, int stackPos) + { + double ret = LuaDLL.lua_tonumber(L, stackPos); + return Convert.ToByte(ret); + } + + public short ToInt16(IntPtr L, int stackPos) + { + double ret = LuaDLL.lua_tonumber(L, stackPos); + return Convert.ToInt16(ret); + } + + public ushort ToUInt16(IntPtr L, int stackPos) + { + double ret = LuaDLL.lua_tonumber(L, stackPos); + return Convert.ToUInt16(ret); + } + + public char ToChar(IntPtr L, int stackPos) + { + double ret = LuaDLL.lua_tonumber(L, stackPos); + return Convert.ToChar(ret); + } + + public int ToInt32(IntPtr L, int stackPos) + { + double ret = LuaDLL.lua_tonumber(L, stackPos); + return Convert.ToInt32(ret); + } + + public uint ToUInt32(IntPtr L, int stackPos) + { + double ret = LuaDLL.lua_tonumber(L, stackPos); + return Convert.ToUInt32(ret); + } + + public decimal ToDecimal(IntPtr L, int stackPos) + { + double ret = LuaDLL.lua_tonumber(L, stackPos); + return Convert.ToDecimal(ret); + } + + public float ToFloat(IntPtr L, int stackPos) + { + double ret = LuaDLL.lua_tonumber(L, stackPos); + return Convert.ToSingle(ret); + } + + public LuaByteBuffer ToLuaByteBuffer(IntPtr L, int stackPos) + { + return new LuaByteBuffer(ToLua.ToByteBuffer(L, stackPos)); + } + + public IEnumerator ToIter(IntPtr L, int stackPos) + { + return (IEnumerator)ToLua.ToObject(L, stackPos); + } + + public Type ToType(IntPtr L, int stackPos) + { + return (Type)ToLua.ToObject(L, stackPos); + } + + public EventObject ToEventObject(IntPtr L, int stackPos) + { + return (EventObject)ToLua.ToObject(L, stackPos); + } + + public Transform ToTransform(IntPtr L, int stackPos) + { + return (Transform)ToLua.ToObject(L, stackPos); + } + + public GameObject ToGameObject(IntPtr L, int stackPos) + { + return (GameObject)ToLua.ToObject(L, stackPos); + } + + public object ToObject(IntPtr L, int stackPos) + { + return ToLua.ToObject(L, stackPos); + } + + public sbyte CheckSByte(IntPtr L, int stackPos) + { + double ret = LuaDLL.luaL_checknumber(L, stackPos); + return Convert.ToSByte(ret); + } + + public byte CheckByte(IntPtr L, int stackPos) + { + double ret = LuaDLL.luaL_checknumber(L, stackPos); + return Convert.ToByte(ret); + } + + public short CheckInt16(IntPtr L, int stackPos) + { + double ret = LuaDLL.luaL_checknumber(L, stackPos); + return Convert.ToInt16(ret); + } + + public ushort CheckUInt16(IntPtr L, int stackPos) + { + double ret = LuaDLL.luaL_checknumber(L, stackPos); + return Convert.ToUInt16(ret); + } + + public char CheckChar(IntPtr L, int stackPos) + { + double ret = LuaDLL.luaL_checknumber(L, stackPos); + return Convert.ToChar(ret); + } + + public int CheckInt32(IntPtr L, int stackPos) + { + double ret = LuaDLL.luaL_checknumber(L, stackPos); + return Convert.ToInt32(ret); + } + + public uint CheckUInt32(IntPtr L, int stackPos) + { + double ret = LuaDLL.luaL_checknumber(L, stackPos); + return Convert.ToUInt32(ret); + } + + public decimal CheckDecimal(IntPtr L, int stackPos) + { + double ret = LuaDLL.luaL_checknumber(L, stackPos); + return Convert.ToDecimal(ret); + } + + public float CheckFloat(IntPtr L, int stackPos) + { + double ret = LuaDLL.luaL_checknumber(L, stackPos); + return Convert.ToSingle(ret); + } + + public IntPtr CheckIntPtr(IntPtr L, int stackPos) + { + LuaTypes luaType = LuaDLL.lua_type(L, stackPos); + + switch(luaType) + { + case LuaTypes.LUA_TNIL: + return IntPtr.Zero; + case LuaTypes.LUA_TLIGHTUSERDATA: + return LuaDLL.lua_touserdata(L, stackPos); + default: + LuaDLL.luaL_typerror(L, stackPos, "IntPtr"); + return IntPtr.Zero; + } + } + + public UIntPtr CheckUIntPtr(IntPtr L, int stackPos) + { + throw new LuaException("NYI"); + } + + public LuaByteBuffer CheckLuaByteBuffer(IntPtr L, int stackPos) + { + return new LuaByteBuffer(ToLua.CheckByteBuffer(L, stackPos)); + } + + public EventObject CheckEventObject(IntPtr L, int stackPos) + { + return (EventObject)ToLua.CheckObject(L, stackPos, typeof(EventObject)); + } + + public Transform CheckTransform(IntPtr L, int stackPos) + { + return (Transform)ToLua.CheckObject(L, stackPos, typeof(Transform)); + } + + public GameObject CheckGameObject(IntPtr L, int stackPos) + { + return (GameObject)ToLua.CheckObject(L, stackPos, typeof(GameObject)); + } + + public void Push(IntPtr L, sbyte n) + { + LuaDLL.lua_pushnumber(L, n); + } + + public void Push(IntPtr L, byte n) + { + LuaDLL.lua_pushnumber(L, n); + } + + public void Push(IntPtr L, short n) + { + LuaDLL.lua_pushnumber(L, n); + } + + public void Push(IntPtr L, ushort n) + { + LuaDLL.lua_pushnumber(L, n); + } + + public void Push(IntPtr L, char n) + { + LuaDLL.lua_pushnumber(L, n); + } + + public void Push(IntPtr L, int n) + { + LuaDLL.lua_pushnumber(L, n); + } + + public void Push(IntPtr L, uint n) + { + LuaDLL.lua_pushnumber(L, n); + } + + public void Push(IntPtr L, decimal n) + { + LuaDLL.lua_pushnumber(L, (double)n); + } + + public void Push(IntPtr L, float n) + { + LuaDLL.lua_pushnumber(L, n); + } + + public void Push(IntPtr L, UIntPtr p) + { + throw new LuaException("NYI"); + } + + public void Push(IntPtr L, Delegate ev) + { + ToLua.Push(L, ev); + } + + public void Push(IntPtr L, object obj) + { + ToLua.Push(L, obj); + } + + public void Push(IntPtr L, GameObject o) + { + if (o == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + int reference = TypeTraits.GetLuaReference(L); + + if (reference <= 0) + { + reference = ToLua.LoadPreType(L, typeof(GameObject)); + } + + ToLua.PushUserData(L, o, reference); + } + } + + public void Push(IntPtr L, Transform o) + { + if (o == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + Type type = o.GetType(); + int reference = -1; + + if (type == typeof(Transform)) + { + reference = TypeTraits.GetLuaReference(L); + } + else + { + reference = LuaStatic.GetMetaReference(L, type); + } + + if (reference <= 0) + { + reference = ToLua.LoadPreType(L, type); + } + + ToLua.PushUserData(L, o, reference); + } + } + + #region Nullable + public Nullable ToNullSByte(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + double ret = LuaDLL.lua_tonumber(L, stackPos); + return Convert.ToSByte(ret); + } + + public Nullable ToNullByte(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + double ret = LuaDLL.lua_tonumber(L, stackPos); + return Convert.ToByte(ret); + } + + public Nullable ToNullInt16(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + double ret = LuaDLL.lua_tonumber(L, stackPos); + return Convert.ToInt16(ret); + } + + public Nullable ToNullUInt16(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + double ret = LuaDLL.lua_tonumber(L, stackPos); + return Convert.ToUInt16(ret); + } + + public Nullable ToNullChar(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + double ret = LuaDLL.lua_tonumber(L, stackPos); + return Convert.ToChar(ret); + } + + public Nullable ToNullInt32(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + double ret = LuaDLL.lua_tonumber(L, stackPos); + return Convert.ToInt32(ret); + } + + public Nullable ToNullUInt32(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + double ret = LuaDLL.lua_tonumber(L, stackPos); + return Convert.ToUInt32(ret); + } + + public Nullable ToNullDecimal(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + double ret = LuaDLL.lua_tonumber(L, stackPos); + return Convert.ToDecimal(ret); + } + + public Nullable ToNullFloat(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + double ret = LuaDLL.lua_tonumber(L, stackPos); + return Convert.ToSingle(ret); + } + + public Nullable ToNullNumber(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + return LuaDLL.lua_tonumber(L, stackPos); + } + + public Nullable ToNullBool(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + return LuaDLL.lua_toboolean(L, stackPos); + } + + public Nullable ToNullInt64(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + return LuaDLL.tolua_toint64(L, stackPos); + } + + public Nullable ToNullUInt64(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + return LuaDLL.tolua_touint64(L, stackPos); + } + + public sbyte[] ToSByteArray(IntPtr L, int stackPos) + { + return ToLua.ToNumberArray(L, stackPos); + } + + public short[] ToInt16Array(IntPtr L, int stackPos) + { + return ToLua.ToNumberArray(L, stackPos); + } + + public ushort[] ToUInt16Array(IntPtr L, int stackPos) + { + return ToLua.ToNumberArray(L, stackPos); + } + + public decimal[] ToDecimalArray(IntPtr L, int stackPos) + { + return ToLua.ToNumberArray(L, stackPos); + } + + public float[] ToFloatArray(IntPtr L, int stackPos) + { + return ToLua.ToNumberArray(L, stackPos); + } + + public double[] ToDoubleArray(IntPtr L, int stackPos) + { + return ToLua.ToNumberArray(L, stackPos); + } + + public int[] ToInt32Array(IntPtr L, int stackPos) + { + return ToLua.ToNumberArray(L, stackPos); + } + + public uint[] ToUInt32Array(IntPtr L, int stackPos) + { + return ToLua.ToNumberArray(L, stackPos); + } + + public long[] ToInt64Array(IntPtr L, int stackPos) + { + return ToLua.ToStructArray(L, stackPos); + } + + public ulong[] ToUInt64Array(IntPtr L, int stackPos) + { + return ToLua.ToStructArray(L, stackPos); + } + + public Nullable ToNullVec3(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + float x = 0, y = 0, z = 0; + LuaDLL.tolua_getvec3(L, stackPos, out x, out y, out z); + return new Vector3(x, y, z); + } + + public Nullable ToNullQuat(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + float x, y, z, w; + LuaDLL.tolua_getquat(L, stackPos, out x, out y, out z, out w); + return new Quaternion(x, y, z, w); + } + + public Nullable ToNullVec2(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + float x, y; + LuaDLL.tolua_getvec2(L, stackPos, out x, out y); + return new Vector2(x, y); + } + + public Nullable ToNullColor(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + float r, g, b, a; + LuaDLL.tolua_getclr(L, stackPos, out r, out g, out b, out a); + return new Color(r, g, b, a); + } + + public Nullable ToNullVec4(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + float x, y, z, w; + LuaDLL.tolua_getvec4(L, stackPos, out x, out y, out z, out w); + return new Vector4(x, y, z, w); + } + + public Nullable ToNullRay(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + return ToLua.ToRay(L, stackPos); + } + + public Nullable ToNullBounds(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + return ToLua.ToBounds(L, stackPos); + } + + public Nullable ToNullLayerMask(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + return LuaDLL.tolua_getlayermask(L, stackPos); + } + + public Vector3[] ToVec3Array(IntPtr L, int stackPos) + { + return ToLua.ToStructArray(L, stackPos); + } + + public Quaternion[] ToQuatArray(IntPtr L, int stackPos) + { + return ToLua.ToStructArray(L, stackPos); + } + + public Vector2[] ToVec2Array(IntPtr L, int stackPos) + { + return ToLua.ToStructArray(L, stackPos); + } + + public Color[] ToColorArray(IntPtr L, int stackPos) + { + return ToLua.ToStructArray(L, stackPos); + } + + public Vector4[] ToVec4Array(IntPtr L, int stackPos) + { + return ToLua.ToStructArray(L, stackPos); + } + + public Type[] ToTypeArray(IntPtr L, int stackPos) + { + return ToLua.ToObjectArray(L, stackPos); + } + + public Nullable CheckNullSByte(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + double ret = LuaDLL.luaL_checknumber(L, stackPos); + return Convert.ToSByte(ret); + } + + public Nullable CheckNullByte(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + double ret = LuaDLL.luaL_checknumber(L, stackPos); + return Convert.ToByte(ret); + } + + public Nullable CheckNullInt16(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + double ret = LuaDLL.luaL_checknumber(L, stackPos); + return Convert.ToInt16(ret); + } + + public Nullable CheckNullUInt16(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + double ret = LuaDLL.luaL_checknumber(L, stackPos); + return Convert.ToUInt16(ret); + } + + public Nullable CheckNullChar(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + double ret = LuaDLL.luaL_checknumber(L, stackPos); + return Convert.ToChar(ret); + } + + public Nullable CheckNullInt32(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + double ret = LuaDLL.luaL_checknumber(L, stackPos); + return Convert.ToInt32(ret); + } + + public Nullable CheckNullUInt32(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + double ret = LuaDLL.luaL_checknumber(L, stackPos); + return Convert.ToUInt32(ret); + } + + public Nullable CheckNullDecimal(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + double ret = LuaDLL.luaL_checknumber(L, stackPos); + return Convert.ToDecimal(ret); + } + + public Nullable CheckNullFloat(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + double ret = LuaDLL.luaL_checknumber(L, stackPos); + return Convert.ToSingle(ret); + } + + public Nullable CheckNullNumber(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + return LuaDLL.luaL_checknumber(L, stackPos); + } + + public Nullable CheckNullBool(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + return LuaDLL.luaL_checkboolean(L, stackPos); + } + + public Nullable CheckNullInt64(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + return LuaDLL.tolua_checkint64(L, stackPos); + } + + public Nullable CheckNullUInt64(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + return LuaDLL.tolua_checkuint64(L, stackPos); + } + + public sbyte[] CheckSByteArray(IntPtr L, int stackPos) + { + return ToLua.CheckNumberArray(L, stackPos); + } + + public short[] CheckInt16Array(IntPtr L, int stackPos) + { + return ToLua.CheckNumberArray(L, stackPos); + } + + public ushort[] CheckUInt16Array(IntPtr L, int stackPos) + { + return ToLua.CheckNumberArray(L, stackPos); + } + + public decimal[] CheckDecimalArray(IntPtr L, int stackPos) + { + return ToLua.CheckNumberArray(L, stackPos); + } + + public float[] CheckFloatArray(IntPtr L, int stackPos) + { + return ToLua.CheckNumberArray(L, stackPos); + } + + public double[] CheckDoubleArray(IntPtr L, int stackPos) + { + return ToLua.CheckNumberArray(L, stackPos); + } + + public int[] CheckInt32Array(IntPtr L, int stackPos) + { + return ToLua.CheckNumberArray(L, stackPos); + } + + public uint[] CheckUInt32Array(IntPtr L, int stackPos) + { + return ToLua.CheckNumberArray(L, stackPos); + } + + public long[] CheckInt64Array(IntPtr L, int stackPos) + { + return ToLua.CheckStructArray(L, stackPos); + } + + public ulong[] CheckUInt64Array(IntPtr L, int stackPos) + { + return ToLua.CheckStructArray(L, stackPos); + } + + public Nullable CheckNullVec3(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + return ToLua.CheckVector3(L, stackPos); + } + + public Nullable CheckNullQuat(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + return ToLua.CheckQuaternion(L, stackPos); + } + + public Nullable CheckNullVec2(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + return ToLua.CheckVector2(L, stackPos); + } + + public Nullable CheckNullColor(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + return ToLua.CheckColor(L, stackPos); + } + + public Nullable CheckNullVec4(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + return ToLua.CheckVector4(L, stackPos); + } + + public Nullable CheckNullRay(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + return ToLua.CheckRay(L, stackPos); + } + + public Nullable CheckNullBounds(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + return ToLua.CheckBounds(L, stackPos); + } + + public Nullable CheckNullLayerMask(IntPtr L, int stackPos) + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + return ToLua.CheckLayerMask(L, stackPos); + } + + public Vector3[] CheckVec3Array(IntPtr L, int stackPos) + { + return ToLua.CheckStructArray(L, stackPos); + } + + public Quaternion[] CheckQuatArray(IntPtr L, int stackPos) + { + return ToLua.CheckStructArray(L, stackPos); + } + + public Vector2[] CheckVec2Array(IntPtr L, int stackPos) + { + return ToLua.CheckStructArray(L, stackPos); + } + + public Color[] CheckColorArray(IntPtr L, int stackPos) + { + return ToLua.CheckStructArray(L, stackPos); + } + + public Vector4[] CheckVec4Array(IntPtr L, int stackPos) + { + return ToLua.CheckStructArray(L, stackPos); + } + + public Type[] CheckTypeArray(IntPtr L, int stackPos) + { + return ToLua.CheckObjectArray(L, stackPos); + } + + public void Push(IntPtr L, Nullable n) + { + if (n == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + LuaDLL.lua_pushnumber(L, n.Value); + } + } + + public void Push(IntPtr L, Nullable n) + { + if (n == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + LuaDLL.lua_pushnumber(L, n.Value); + } + } + + public void Push(IntPtr L, Nullable n) + { + if (n == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + LuaDLL.lua_pushnumber(L, n.Value); + } + } + + public void Push(IntPtr L, Nullable n) + { + if (n == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + LuaDLL.lua_pushnumber(L, n.Value); + } + } + + public void Push(IntPtr L, Nullable n) + { + if (n == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + LuaDLL.lua_pushnumber(L, n.Value); + } + } + + public void Push(IntPtr L, Nullable n) + { + if (n == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + LuaDLL.lua_pushnumber(L, n.Value); + } + } + + public void Push(IntPtr L, Nullable n) + { + if (n == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + LuaDLL.lua_pushnumber(L, n.Value); + } + } + + public void Push(IntPtr L, Nullable n) + { + if (n == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + LuaDLL.lua_pushnumber(L, Convert.ToDouble(n.Value)); + } + } + + public void Push(IntPtr L, Nullable n) + { + if (n == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + LuaDLL.lua_pushnumber(L, n.Value); + } + } + + public void Push(IntPtr L, Nullable n) + { + if (n == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + LuaDLL.lua_pushnumber(L, n.Value); + } + } + + public void Push(IntPtr L, Nullable n) + { + if (n == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + LuaDLL.lua_pushboolean(L, n.Value); + } + } + + public void Push(IntPtr L, Nullable n) + { + if (n == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + LuaDLL.tolua_pushint64(L, n.Value); + } + } + + public void Push(IntPtr L, Nullable n) + { + if (n == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + LuaDLL.tolua_pushuint64(L, n.Value); + } + } + + public void Push(IntPtr L, Nullable v3) + { + if (v3 == null) + { + LuaDLL.lua_pushnil(L); + return; + } + else + { + Vector3 v = v3.Value; + LuaDLL.tolua_pushvec3(L, v.x, v.y, v.z); + } + } + + public void Push(IntPtr L, Nullable n) + { + if (n == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + Quaternion q = n.Value; + LuaDLL.tolua_pushquat(L, q.x, q.y, q.z, q.w); + } + } + + public void Push(IntPtr L, Nullable n) + { + if (n == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + Vector2 v2 = n.Value; + LuaDLL.tolua_pushvec2(L, v2.x, v2.y); + } + } + + public void Push(IntPtr L, Nullable n) + { + if (n == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + Color clr = n.Value; + LuaDLL.tolua_pushclr(L, clr.r, clr.g, clr.b, clr.a); + } + } + + public void Push(IntPtr L, Nullable n) + { + if (n == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + Vector4 v4 = n.Value; + LuaDLL.tolua_pushvec4(L, v4.x, v4.y, v4.z, v4.w); + } + } + + public void Push(IntPtr L, Nullable n) + { + if (n == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + ToLua.Push(L, n.Value); + } + } + + public void Push(IntPtr L, Nullable n) + { + if (n == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + ToLua.Push(L, n.Value); + } + } + + public void Push(IntPtr L, Nullable n) + { + if (n == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + LuaDLL.tolua_pushlayermask(L, n.Value); + } + } + + public void Push(IntPtr L, Nullable n) + { + if (n == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + ToLua.Push(L, n.Value); + } + } + + public void Push(IntPtr L, Nullable n) + { + if (n == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + ToLua.Push(L, n.Value); + } + } + #endregion + } +} diff --git a/Assets/LuaFramework/ToLua/Core/LuaStackOp.cs.meta b/Assets/LuaFramework/ToLua/Core/LuaStackOp.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..8c0e5d437d058ca27b18d21933f92b6215cdfd99 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaStackOp.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 57935fe3acd7c654599f70b62465e1d0 +timeCreated: 1495076837 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Core/LuaState.cs b/Assets/LuaFramework/ToLua/Core/LuaState.cs new file mode 100644 index 0000000000000000000000000000000000000000..26d9f09fc6d8ae08a84bdce900ed2ec871849abe --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaState.cs @@ -0,0 +1,2766 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +#define MISS_WARNING + +using System; +using System.IO; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.InteropServices; +using System.Runtime.CompilerServices; +using System.Text; +using UnityEngine; + +namespace LuaInterface +{ + public class LuaState : LuaStatePtr, IDisposable + { + public ObjectTranslator translator = new ObjectTranslator(); + public LuaReflection reflection = new LuaReflection(); + + public int ArrayMetatable { get; private set; } + public int DelegateMetatable { get; private set; } + public int TypeMetatable { get; private set; } + public int EnumMetatable { get; private set; } + public int IterMetatable { get; private set; } + public int EventMetatable { get; private set; } + + //function ref + public int PackBounds { get; private set; } + public int UnpackBounds { get; private set; } + public int PackRay { get; private set; } + public int UnpackRay { get; private set; } + public int PackRaycastHit { get; private set; } + public int PackTouch { get; private set; } + + public bool LogGC + { + get + { + return beLogGC; + } + + set + { + beLogGC = value; + translator.LogGC = value; + } + } + + public Action OnDestroy = delegate { }; + + Dictionary funcMap = new Dictionary(); + Dictionary funcRefMap = new Dictionary(); + Dictionary delegateMap = new Dictionary(); + + List gcList = new List(); + List subList = new List(); + + Dictionary metaMap = new Dictionary(); + Dictionary enumMap = new Dictionary(); + Dictionary preLoadMap = new Dictionary(); + + Dictionary typeMap = new Dictionary(); + HashSet genericSet = new HashSet(); + HashSet moduleSet = null; + + private static LuaState mainState = null; + private static LuaState injectionState = null; + private static Dictionary stateMap = new Dictionary(); + + private int beginCount = 0; + private bool beLogGC = false; + private bool bInjectionInited = false; +#if UNITY_EDITOR + private bool beStart = false; +#endif + +#if MISS_WARNING + HashSet missSet = new HashSet(); +#endif + + public LuaState() + { + if (mainState == null) + { + mainState = this; + // MULTI_STATE Not Support + injectionState = mainState; + } + + float time = Time.realtimeSinceStartup; + InitTypeTraits(); + InitStackTraits(); + L = LuaNewState(); + LuaException.Init(L); + stateMap.Add(L, this); + OpenToLuaLibs(); + ToLua.OpenLibs(L); + OpenBaseLibs(); + LuaSetTop(0); + InitLuaPath(); + Debugger.Log("Init lua state cost: {0}", Time.realtimeSinceStartup - time); + } + + void OpenBaseLibs() + { + BeginModule(null); + + BeginModule("System"); + System_ObjectWrap.Register(this); + System_NullObjectWrap.Register(this); + System_StringWrap.Register(this); + System_DelegateWrap.Register(this); + System_EnumWrap.Register(this); + System_ArrayWrap.Register(this); + System_TypeWrap.Register(this); + BeginModule("Collections"); + System_Collections_IEnumeratorWrap.Register(this); + + BeginModule("ObjectModel"); + System_Collections_ObjectModel_ReadOnlyCollectionWrap.Register(this); + EndModule();//ObjectModel + + BeginModule("Generic"); + System_Collections_Generic_ListWrap.Register(this); + System_Collections_Generic_DictionaryWrap.Register(this); + System_Collections_Generic_KeyValuePairWrap.Register(this); + + BeginModule("Dictionary"); + System_Collections_Generic_Dictionary_KeyCollectionWrap.Register(this); + System_Collections_Generic_Dictionary_ValueCollectionWrap.Register(this); + EndModule();//Dictionary + EndModule();//Generic + EndModule();//Collections + EndModule();//end System + + //娉ㄥ唽ParticleSystemWrap绫 + UnityEngine_ParticleSystemWrap.Register(this); + UnityEngine_MeshRendererWrap.Register(this); + + BeginModule("LuaInterface"); + LuaInterface_LuaOutWrap.Register(this); + LuaInterface_EventObjectWrap.Register(this); + EndModule();//end LuaInterface + + BeginModule("UnityEngine"); + UnityEngine_ObjectWrap.Register(this); + UnityEngine_CoroutineWrap.Register(this); + + BeginModule("UI"); + UnityEngine_UI_InputFieldWrap.Register(this); + EndModule(); //end UnityEngine.UI + + EndModule(); //end UnityEngine + + EndModule(); //end global + + LuaUnityLibs.OpenLibs(L); + LuaReflection.OpenLibs(L); + ArrayMetatable = metaMap[typeof(System.Array)]; + TypeMetatable = metaMap[typeof(System.Type)]; + DelegateMetatable = metaMap[typeof(System.Delegate)]; + EnumMetatable = metaMap[typeof(System.Enum)]; + IterMetatable = metaMap[typeof(IEnumerator)]; + EventMetatable = metaMap[typeof(EventObject)]; + } + + void InitLuaPath() + { + InitPackagePath(); + + if (!LuaFileUtils.Instance.beZip) + { +#if UNITY_EDITOR + if (!Directory.Exists(LuaConst.luaDir)) + { + string msg = string.Format("luaDir path not exists: {0}, configer it in LuaConst.cs", LuaConst.luaDir); + throw new LuaException(msg); + } + + if (!Directory.Exists(LuaConst.toluaDir)) + { + string msg = string.Format("toluaDir path not exists: {0}, configer it in LuaConst.cs", LuaConst.toluaDir); + throw new LuaException(msg); + } + + AddSearchPath(LuaConst.toluaDir); + AddSearchPath(LuaConst.luaDir); +#endif + if (LuaFileUtils.Instance.GetType() == typeof(LuaFileUtils)) + { + AddSearchPath(LuaConst.luaResDir); + } + } + } + + void OpenBaseLuaLibs() + { + DoFile("tolua.lua"); //tolua table鍚嶅瓧宸茬粡瀛樺湪浜,涓嶈兘鐢╮equire + LuaUnityLibs.OpenLuaLibs(L); + } + + public void Start() + { +#if UNITY_EDITOR + beStart = true; +#endif + Debugger.Log("LuaState start"); + OpenBaseLuaLibs(); +#if ENABLE_LUA_INJECTION + Push(LuaDLL.tolua_tag()); + LuaSetGlobal("tolua_tag"); +#if UNITY_EDITOR + if (UnityEditor.EditorPrefs.GetInt(Application.dataPath + "InjectStatus") == 1) + { +#endif + DoFile("System/Injection/LuaInjectionStation.lua"); + bInjectionInited = true; +#if UNITY_EDITOR + } +#endif +#endif + PackBounds = GetFuncRef("Bounds.New"); + UnpackBounds = GetFuncRef("Bounds.Get"); + PackRay = GetFuncRef("Ray.New"); + UnpackRay = GetFuncRef("Ray.Get"); + PackRaycastHit = GetFuncRef("RaycastHit.New"); + PackTouch = GetFuncRef("Touch.New"); + } + + public int OpenLibs(LuaCSFunction open) + { + int ret = open(L); + return ret; + } + + public void BeginPreLoad() + { + LuaGetGlobal("package"); + LuaGetField(-1, "preload"); + moduleSet = new HashSet(); + } + + public void EndPreLoad() + { + LuaPop(2); + moduleSet = null; + } + + public void AddPreLoad(string name, LuaCSFunction func, Type type) + { + if (!preLoadMap.ContainsKey(type)) + { + LuaDLL.tolua_pushcfunction(L, func); + LuaSetField(-2, name); + preLoadMap[type] = func; + string module = type.Namespace; + + if (!string.IsNullOrEmpty(module) && !moduleSet.Contains(module)) + { + LuaDLL.tolua_addpreload(L, module); + moduleSet.Add(module); + } + } + } + + //鎱庣敤锛岄渶瑕佽嚜宸变繚璇佷笉浼氶噸澶岮dd鐩稿悓鐨刵ame,骞朵笖涓婇潰鍑芥暟娌℃湁浣跨敤杩囪繖涓猲ame + public void AddPreLoad(string name, LuaCSFunction func) + { + LuaDLL.tolua_pushcfunction(L, func); + LuaSetField(-2, name); + } + + public int BeginPreModule(string name) + { + int top = LuaGetTop(); + + if (string.IsNullOrEmpty(name)) + { + LuaDLL.lua_pushvalue(L, LuaIndexes.LUA_GLOBALSINDEX); + ++beginCount; + return top; + } + else if (LuaDLL.tolua_beginpremodule(L, name)) + { + ++beginCount; + return top; + } + + throw new LuaException(string.Format("create table {0} fail", name)); + } + + public void EndPreModule(int reference) + { + --beginCount; + LuaDLL.tolua_endpremodule(L, reference); + } + + public void EndPreModule(IntPtr L, int reference) + { + --beginCount; + LuaDLL.tolua_endpremodule(L, reference); + } + + public void BindPreModule(Type t, LuaCSFunction func) + { + preLoadMap[t] = func; + } + + public LuaCSFunction GetPreModule(Type t) + { + LuaCSFunction func = null; + preLoadMap.TryGetValue(t, out func); + return func; + } + + public bool BeginModule(string name) + { +#if UNITY_EDITOR + if (name != null) + { + LuaTypes type = LuaType(-1); + + if (type != LuaTypes.LUA_TTABLE) + { + throw new LuaException("open global module first"); + } + } +#endif + if (LuaDLL.tolua_beginmodule(L, name)) + { + ++beginCount; + return true; + } + + LuaSetTop(0); + throw new LuaException(string.Format("create table {0} fail", name)); + } + + public void EndModule() + { + --beginCount; + LuaDLL.tolua_endmodule(L); + } + + void BindTypeRef(int reference, Type t) + { + metaMap.Add(t, reference); + typeMap.Add(reference, t); + + if (t.IsGenericTypeDefinition) + { + genericSet.Add(t); + } + } + + public Type GetClassType(int reference) + { + Type t = null; + typeMap.TryGetValue(reference, out t); + return t; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + public static int Collect(IntPtr L) + { + int udata = LuaDLL.tolua_rawnetobj(L, 1); + + if (udata != -1) + { + ObjectTranslator translator = GetTranslator(L); + translator.RemoveObject(udata); + } + + return 0; + } + + public static bool GetInjectInitState(int index) + { + if (injectionState != null && injectionState.bInjectionInited) + { + return true; + } + + return false; + } + + string GetToLuaTypeName(Type t) + { + if (t.IsGenericType) + { + string str = t.Name; + int pos = str.IndexOf('`'); + + if (pos > 0) + { + str = str.Substring(0, pos); + } + + return str; + } + + return t.Name; + } + + public int BeginClass(Type t, Type baseType, string name = null) + { + if (beginCount == 0) + { + throw new LuaException("must call BeginModule first"); + } + + int baseMetaRef = 0; + int reference = 0; + + if (name == null) + { + name = GetToLuaTypeName(t); + } + + if (baseType != null && !metaMap.TryGetValue(baseType, out baseMetaRef)) + { + LuaCreateTable(); + baseMetaRef = LuaRef(LuaIndexes.LUA_REGISTRYINDEX); + BindTypeRef(baseMetaRef, baseType); + } + + if (metaMap.TryGetValue(t, out reference)) + { + LuaDLL.tolua_beginclass(L, name, baseMetaRef, reference); + RegFunction("__gc", Collect); + } + else + { + reference = LuaDLL.tolua_beginclass(L, name, baseMetaRef); + RegFunction("__gc", Collect); + BindTypeRef(reference, t); + } + + return reference; + } + + public void EndClass() + { + LuaDLL.tolua_endclass(L); + } + + public int BeginEnum(Type t) + { + if (beginCount == 0) + { + throw new LuaException("must call BeginModule first"); + } + + int reference = LuaDLL.tolua_beginenum(L, t.Name); + RegFunction("__gc", Collect); + BindTypeRef(reference, t); + return reference; + } + + public void EndEnum() + { + LuaDLL.tolua_endenum(L); + } + + public void BeginStaticLibs(string name) + { + if (beginCount == 0) + { + throw new LuaException("must call BeginModule first"); + } + + LuaDLL.tolua_beginstaticclass(L, name); + } + + public void EndStaticLibs() + { + LuaDLL.tolua_endstaticclass(L); + } + + public void RegFunction(string name, LuaCSFunction func) + { + IntPtr fn = Marshal.GetFunctionPointerForDelegate(func); + LuaDLL.tolua_function(L, name, fn); + } + + public void RegVar(string name, LuaCSFunction get, LuaCSFunction set) + { + IntPtr fget = IntPtr.Zero; + IntPtr fset = IntPtr.Zero; + + if (get != null) + { + fget = Marshal.GetFunctionPointerForDelegate(get); + } + + if (set != null) + { + fset = Marshal.GetFunctionPointerForDelegate(set); + } + + LuaDLL.tolua_variable(L, name, fget, fset); + } + + public void RegConstant(string name, double d) + { + LuaDLL.tolua_constant(L, name, d); + } + + public void RegConstant(string name, bool flag) + { + LuaDLL.lua_pushstring(L, name); + LuaDLL.lua_pushboolean(L, flag); + LuaDLL.lua_rawset(L, -3); + } + + int GetFuncRef(string name) + { + if (PushLuaFunction(name, false)) + { + return LuaRef(LuaIndexes.LUA_REGISTRYINDEX); + } + + throw new LuaException("get lua function reference failed: " + name); + } + + public static LuaState Get(IntPtr ptr) + { +#if !MULTI_STATE + return mainState; +#else + + if (mainState != null && mainState.L == ptr) + { + return mainState; + } + + LuaState state = null; + + if (stateMap.TryGetValue(ptr, out state)) + { + return state; + } + else + { + return Get(LuaDLL.tolua_getmainstate(ptr)); + } +#endif + } + + public static ObjectTranslator GetTranslator(IntPtr ptr) + { +#if !MULTI_STATE + return mainState.translator; +#else + if (mainState != null && mainState.L == ptr) + { + return mainState.translator; + } + + return Get(ptr).translator; +#endif + } + + public static LuaReflection GetReflection(IntPtr ptr) + { +#if !MULTI_STATE + return mainState.reflection; +#else + if (mainState != null && mainState.L == ptr) + { + return mainState.reflection; + } + + return Get(ptr).reflection; +#endif + } + + public void DoString(string chunk, string chunkName = "LuaState.cs") + { +#if UNITY_EDITOR + if (!beStart) + { + throw new LuaException("you must call Start() first to initialize LuaState"); + } +#endif + byte[] buffer = Encoding.UTF8.GetBytes(chunk); + LuaLoadBuffer(buffer, chunkName); + } + + public T DoString(string chunk, string chunkName = "LuaState.cs") + { + byte[] buffer = Encoding.UTF8.GetBytes(chunk); + return LuaLoadBuffer(buffer, chunkName); + } + + byte[] LoadFileBuffer(string fileName) + { +#if UNITY_EDITOR + if (!beStart) + { + throw new LuaException("you must call Start() first to initialize LuaState"); + } +#endif + byte[] buffer = LuaFileUtils.Instance.ReadFile(fileName); + + if (buffer == null) + { + string error = string.Format("cannot open {0}: No such file or directory", fileName); + error += LuaFileUtils.Instance.FindFileError(fileName); + throw new LuaException(error); + } + + return buffer; + } + + string LuaChunkName(string name) + { + if (LuaConst.openLuaDebugger) + { + name = LuaFileUtils.Instance.FindFile(name); + } + + return "@" + name; + } + + public void DoFile(string fileName) + { + byte[] buffer = LoadFileBuffer(fileName); + fileName = LuaChunkName(fileName); + LuaLoadBuffer(buffer, fileName); + } + + public T DoFile(string fileName) + { + byte[] buffer = LoadFileBuffer(fileName); + fileName = LuaChunkName(fileName); + return LuaLoadBuffer(buffer, fileName); + } + + //娉ㄦ剰fileName涓巐ua鏂囦欢涓璻equire涓鑷淬 + public void Require(string fileName) + { + int top = LuaGetTop(); + int ret = LuaRequire(fileName); + + if (ret != 0) + { + string err = LuaToString(-1); + LuaSetTop(top); + throw new LuaException(err, LuaException.GetLastError()); + } + + LuaSetTop(top); + } + + public T Require(string fileName) + { + int top = LuaGetTop(); + int ret = LuaRequire(fileName); + + if (ret != 0) + { + string err = LuaToString(-1); + LuaSetTop(top); + throw new LuaException(err, LuaException.GetLastError()); + } + + T o = CheckValue(-1); + LuaSetTop(top); + return o; + } + + public void InitPackagePath() + { + LuaGetGlobal("package"); + LuaGetField(-1, "path"); + string current = LuaToString(-1); + string[] paths = current.Split(';'); + + for (int i = 0; i < paths.Length; i++) + { + if (!string.IsNullOrEmpty(paths[i])) + { + string path = paths[i].Replace('\\', '/'); + LuaFileUtils.Instance.AddSearchPath(path); + } + } + + LuaPushString(""); + LuaSetField(-3, "path"); + LuaPop(2); + } + + string ToPackagePath(string path) + { + using (CString.Block()) + { + CString sb = CString.Alloc(256); + sb.Append(path); + sb.Replace('\\', '/'); + + if (sb.Length > 0 && sb[sb.Length - 1] != '/') + { + sb.Append('/'); + } + + sb.Append("?.lua"); + return sb.ToString(); + } + } + + public void AddSearchPath(string fullPath) + { + if (!Path.IsPathRooted(fullPath)) + { + throw new LuaException(fullPath + " is not a full path"); + } + + fullPath = ToPackagePath(fullPath); + LuaFileUtils.Instance.AddSearchPath(fullPath); + } + + public void RemoveSeachPath(string fullPath) + { + if (!Path.IsPathRooted(fullPath)) + { + throw new LuaException(fullPath + " is not a full path"); + } + + fullPath = ToPackagePath(fullPath); + LuaFileUtils.Instance.RemoveSearchPath(fullPath); + } + + public int BeginPCall(int reference) + { + return LuaDLL.tolua_beginpcall(L, reference); + } + + public void PCall(int args, int oldTop) + { + if (LuaDLL.lua_pcall(L, args, LuaDLL.LUA_MULTRET, oldTop) != 0) + { + string error = LuaToString(-1); + throw new LuaException(error, LuaException.GetLastError()); + } + } + + public void EndPCall(int oldTop) + { + LuaDLL.lua_settop(L, oldTop - 1); + } + + public void PushArgs(object[] args) + { + for (int i = 0; i < args.Length; i++) + { + PushVariant(args[i]); + } + } + + void CheckNull(LuaBaseRef lbr, string fmt, object arg0) + { + if (lbr == null) + { + string error = string.Format(fmt, arg0); + throw new LuaException(error, null, 2); + } + } + + //鍘嬪叆涓涓瓨鍦ㄧ殑鎴栦笉瀛樺湪鐨則able, 浣嗕笉澧炲姞寮曠敤璁℃暟 + bool PushLuaTable(string fullPath, bool checkMap = true) + { + if (checkMap) + { + WeakReference weak = null; + + if (funcMap.TryGetValue(fullPath, out weak)) + { + if (weak.IsAlive) + { + LuaTable table = weak.Target as LuaTable; + CheckNull(table, "{0} not a lua table", fullPath); + Push(table); + return true; + } + else + { + funcMap.Remove(fullPath); + } + } + } + + if (!LuaDLL.tolua_pushluatable(L, fullPath)) + { + return false; + } + + return true; + } + + bool PushLuaFunction(string fullPath, bool checkMap = true) + { + if (checkMap) + { + WeakReference weak = null; + + if (funcMap.TryGetValue(fullPath, out weak)) + { + if (weak.IsAlive) + { + LuaFunction func = weak.Target as LuaFunction; + CheckNull(func, "{0} not a lua function", fullPath); + + if (func.IsAlive) + { + func.AddRef(); + return true; + } + } + + funcMap.Remove(fullPath); + } + } + + int oldTop = LuaDLL.lua_gettop(L); + int pos = fullPath.LastIndexOf('.'); + + if (pos > 0) + { + string tableName = fullPath.Substring(0, pos); + + if (PushLuaTable(tableName, checkMap)) + { + string funcName = fullPath.Substring(pos + 1); + LuaDLL.lua_pushstring(L, funcName); + LuaDLL.lua_rawget(L, -2); + + LuaTypes type = LuaDLL.lua_type(L, -1); + + if (type == LuaTypes.LUA_TFUNCTION) + { + LuaDLL.lua_insert(L, oldTop + 1); + LuaDLL.lua_settop(L, oldTop + 1); + return true; + } + } + + LuaDLL.lua_settop(L, oldTop); + return false; + } + else + { + LuaDLL.lua_getglobal(L, fullPath); + LuaTypes type = LuaDLL.lua_type(L, -1); + + if (type != LuaTypes.LUA_TFUNCTION) + { + LuaDLL.lua_settop(L, oldTop); + return false; + } + } + + return true; + } + + void RemoveFromGCList(int reference) + { + lock (gcList) + { + for (int i = 0; i < gcList.Count; i++) + { + if (gcList[i].reference == reference) + { + gcList.RemoveAt(i); + break; + } + } + } + } + + public LuaFunction GetFunction(string name, bool beLogMiss = true) + { + WeakReference weak = null; + + if (funcMap.TryGetValue(name, out weak)) + { + if (weak.IsAlive) + { + LuaFunction func = weak.Target as LuaFunction; + CheckNull(func, "{0} not a lua function", name); + + if (func.IsAlive) + { + func.AddRef(); + RemoveFromGCList(func.GetReference()); + return func; + } + } + + funcMap.Remove(name); + } + + if (PushLuaFunction(name, false)) + { + int reference = ToLuaRef(); + + if (funcRefMap.TryGetValue(reference, out weak)) + { + if (weak.IsAlive) + { + LuaFunction func = weak.Target as LuaFunction; + CheckNull(func, "{0} not a lua function", name); + + if (func.IsAlive) + { + funcMap.Add(name, weak); + func.AddRef(); + RemoveFromGCList(reference); + return func; + } + } + + funcRefMap.Remove(reference); + delegateMap.Remove(reference); + } + + LuaFunction fun = new LuaFunction(reference, this); + fun.name = name; + funcMap.Add(name, new WeakReference(fun)); + funcRefMap.Add(reference, new WeakReference(fun)); + RemoveFromGCList(reference); + if (LogGC) Debugger.Log("Alloc LuaFunction name {0}, id {1}", name, reference); + return fun; + } + + if (beLogMiss) + { + Debugger.Log("Lua function {0} not exists", name); + } + + return null; + } + + LuaBaseRef TryGetLuaRef(int reference) + { + WeakReference weak = null; + + if (funcRefMap.TryGetValue(reference, out weak)) + { + if (weak.IsAlive) + { + LuaBaseRef luaRef = (LuaBaseRef)weak.Target; + + if (luaRef.IsAlive) + { + luaRef.AddRef(); + return luaRef; + } + } + + funcRefMap.Remove(reference); + } + + return null; + } + + public LuaFunction GetFunction(int reference) + { + LuaFunction func = TryGetLuaRef(reference) as LuaFunction; + + if (func == null) + { + func = new LuaFunction(reference, this); + funcRefMap.Add(reference, new WeakReference(func)); + if (LogGC) Debugger.Log("Alloc LuaFunction name , id {0}", reference); + } + + RemoveFromGCList(reference); + return func; + } + + public LuaTable GetTable(string fullPath, bool beLogMiss = true) + { + WeakReference weak = null; + + if (funcMap.TryGetValue(fullPath, out weak)) + { + if (weak.IsAlive) + { + LuaTable table = weak.Target as LuaTable; + CheckNull(table, "{0} not a lua table", fullPath); + + if (table.IsAlive) + { + table.AddRef(); + RemoveFromGCList(table.GetReference()); + return table; + } + } + + funcMap.Remove(fullPath); + } + + if (PushLuaTable(fullPath, false)) + { + int reference = ToLuaRef(); + LuaTable table = null; + + if (funcRefMap.TryGetValue(reference, out weak)) + { + if (weak.IsAlive) + { + table = weak.Target as LuaTable; + CheckNull(table, "{0} not a lua table", fullPath); + + if (table.IsAlive) + { + funcMap.Add(fullPath, weak); + table.AddRef(); + RemoveFromGCList(reference); + return table; + } + } + + funcRefMap.Remove(reference); + } + + table = new LuaTable(reference, this); + table.name = fullPath; + funcMap.Add(fullPath, new WeakReference(table)); + funcRefMap.Add(reference, new WeakReference(table)); + if (LogGC) Debugger.Log("Alloc LuaTable name {0}, id {1}", fullPath, reference); + RemoveFromGCList(reference); + return table; + } + + if (beLogMiss) + { + Debugger.LogWarning("Lua table {0} not exists", fullPath); + } + + return null; + } + + public LuaTable GetTable(int reference) + { + LuaTable table = TryGetLuaRef(reference) as LuaTable; + + if (table == null) + { + table = new LuaTable(reference, this); + funcRefMap.Add(reference, new WeakReference(table)); + } + + RemoveFromGCList(reference); + return table; + } + + public LuaThread GetLuaThread(int reference) + { + LuaThread thread = TryGetLuaRef(reference) as LuaThread; + + if (thread == null) + { + thread = new LuaThread(reference, this); + funcRefMap.Add(reference, new WeakReference(thread)); + } + + RemoveFromGCList(reference); + return thread; + } + + public LuaDelegate GetLuaDelegate(LuaFunction func) + { + WeakReference weak = null; + int reference = func.GetReference(); + delegateMap.TryGetValue(reference, out weak); + + if (weak != null) + { + if (weak.IsAlive) + { + return weak.Target as LuaDelegate; + } + + delegateMap.Remove(reference); + } + + return null; + } + + public LuaDelegate GetLuaDelegate(LuaFunction func, LuaTable self) + { + WeakReference weak = null; + long high = func.GetReference(); + long low = self == null ? 0 : self.GetReference(); + low = low >= 0 ? low : 0; + long key = high << 32 | low; + delegateMap.TryGetValue(key, out weak); + + if (weak != null) + { + if (weak.IsAlive) + { + return weak.Target as LuaDelegate; + } + + delegateMap.Remove(key); + } + + return null; + } + + public void AddLuaDelegate(LuaDelegate target, LuaFunction func) + { + int key = func.GetReference(); + + if (key > 0) + { + delegateMap[key] = new WeakReference(target); + } + } + + public void AddLuaDelegate(LuaDelegate target, LuaFunction func, LuaTable self) + { + long high = func.GetReference(); + long low = self == null ? 0 : self.GetReference(); + low = low >= 0 ? low : 0; + long key = high << 32 | low; + + if (key > 0) + { + delegateMap[key] = new WeakReference(target); + } + } + + public bool CheckTop() + { + int n = LuaGetTop(); + + if (n != 0) + { + Debugger.LogWarning("Lua stack top is {0}", n); + return false; + } + + return true; + } + + public void Push(bool b) + { + LuaDLL.lua_pushboolean(L, b); + } + + public void Push(double d) + { + LuaDLL.lua_pushnumber(L, d); + } + + public void Push(uint un) + { + LuaDLL.lua_pushnumber(L, un); + } + + public void Push(int n) + { + LuaDLL.lua_pushinteger(L, n); + } + + public void Push(short s) + { + LuaDLL.lua_pushnumber(L, s); + } + + public void Push(ushort us) + { + LuaDLL.lua_pushnumber(L, us); + } + + public void Push(long l) + { + LuaDLL.tolua_pushint64(L, l); + } + + public void Push(ulong ul) + { + LuaDLL.tolua_pushuint64(L, ul); + } + + public void Push(string str) + { + LuaDLL.lua_pushstring(L, str); + } + + public void Push(IntPtr p) + { + LuaDLL.lua_pushlightuserdata(L, p); + } + + public void Push(Vector3 v3) + { + LuaDLL.tolua_pushvec3(L, v3.x, v3.y, v3.z); + } + + public void Push(Vector2 v2) + { + LuaDLL.tolua_pushvec2(L, v2.x, v2.y); + } + + public void Push(Vector4 v4) + { + LuaDLL.tolua_pushvec4(L, v4.x, v4.y, v4.z, v4.w); + } + + public void Push(Color clr) + { + LuaDLL.tolua_pushclr(L, clr.r, clr.g, clr.b, clr.a); + } + + public void Push(Quaternion q) + { + LuaDLL.tolua_pushquat(L, q.x, q.y, q.z, q.w); + } + + public void Push(Ray ray) + { + ToLua.Push(L, ray); + } + + public void Push(Bounds bound) + { + ToLua.Push(L, bound); + } + + public void Push(RaycastHit hit) + { + ToLua.Push(L, hit); + } + + public void Push(Touch touch) + { + ToLua.Push(L, touch); + } + + public void PushLayerMask(LayerMask mask) + { + LuaDLL.tolua_pushlayermask(L, mask.value); + } + + public void Push(LuaByteBuffer bb) + { + LuaDLL.lua_pushlstring(L, bb.buffer, bb.Length); + } + + public void PushByteBuffer(byte[] buffer) + { + LuaDLL.lua_pushlstring(L, buffer, buffer.Length); + } + + public void PushByteBuffer(byte[] buffer, int len) + { + LuaDLL.lua_pushlstring(L, buffer, len); + } + + public void Push(LuaBaseRef lbr) + { + if (lbr == null) + { + LuaPushNil(); + } + else + { + LuaGetRef(lbr.GetReference()); + } + } + + void PushUserData(object o, int reference) + { + int index; + + if (translator.Getudata(o, out index)) + { + if (LuaDLL.tolua_pushudata(L, index)) + { + return; + } + + translator.Destroyudata(index); + } + + index = translator.AddObject(o); + LuaDLL.tolua_pushnewudata(L, reference, index); + } + + public void Push(Array array) + { + if (array == null) + { + LuaPushNil(); + } + else + { + PushUserData(array, ArrayMetatable); + } + } + + public void Push(Type t) + { + if (t == null) + { + LuaPushNil(); + } + else + { + PushUserData(t, TypeMetatable); + } + } + + public void Push(Delegate ev) + { + if (ev == null) + { + LuaPushNil(); + } + else + { + PushUserData(ev, DelegateMetatable); + } + } + + public object GetEnumObj(Enum e) + { + object o = null; + + if (!enumMap.TryGetValue(e, out o)) + { + o = e; + enumMap.Add(e, o); + } + + return o; + } + + public void Push(Enum e) + { + if (e == null) + { + LuaPushNil(); + } + else + { + object o = GetEnumObj(e); + PushUserData(o, EnumMetatable); + } + } + + public void Push(IEnumerator iter) + { + ToLua.Push(L, iter); + } + + public void Push(UnityEngine.Object obj) + { + ToLua.Push(L, obj); + } + + public void Push(UnityEngine.TrackedReference tracker) + { + ToLua.Push(L, tracker); + } + + public void PushVariant(object obj) + { + ToLua.Push(L, obj); + } + + public void PushObject(object obj) + { + ToLua.PushObject(L, obj); + } + + public void PushSealed(T o) + { + ToLua.PushSealed(L, o); + } + + public void PushValue(T v) where T : struct + { + StackTraits.Push(L, v); + } + + public void PushGeneric(T o) + { + StackTraits.Push(L, o); + } + + Vector3 ToVector3(int stackPos) + { + float x, y, z; + stackPos = LuaDLL.abs_index(L, stackPos); + LuaDLL.tolua_getvec3(L, stackPos, out x, out y, out z); + return new Vector3(x, y, z); + } + + public Vector3 CheckVector3(int stackPos) + { + int type = LuaDLL.tolua_getvaluetype(L, stackPos); + + if (type != LuaValueType.Vector3) + { + LuaTypeError(stackPos, "Vector3", LuaValueTypeName.Get(type)); + return Vector3.zero; + } + + float x, y, z; + stackPos = LuaDLL.abs_index(L, stackPos); + LuaDLL.tolua_getvec3(L, stackPos, out x, out y, out z); + return new Vector3(x, y, z); + } + + public Quaternion CheckQuaternion(int stackPos) + { + int type = LuaDLL.tolua_getvaluetype(L, stackPos); + + if (type != LuaValueType.Quaternion) + { + LuaTypeError(stackPos, "Quaternion", LuaValueTypeName.Get(type)); + return Quaternion.identity; + } + + float x, y, z, w; + stackPos = LuaDLL.abs_index(L, stackPos); + LuaDLL.tolua_getquat(L, stackPos, out x, out y, out z, out w); + return new Quaternion(x, y, z, w); + } + + public Vector2 CheckVector2(int stackPos) + { + int type = LuaDLL.tolua_getvaluetype(L, stackPos); + + if (type != LuaValueType.Vector2) + { + LuaTypeError(stackPos, "Vector2", LuaValueTypeName.Get(type)); + return Vector2.zero; + } + + float x, y; + stackPos = LuaDLL.abs_index(L, stackPos); + LuaDLL.tolua_getvec2(L, stackPos, out x, out y); + return new Vector2(x, y); + } + + public Vector4 CheckVector4(int stackPos) + { + int type = LuaDLL.tolua_getvaluetype(L, stackPos); + + if (type != LuaValueType.Vector4) + { + LuaTypeError(stackPos, "Vector4", LuaValueTypeName.Get(type)); + return Vector4.zero; + } + + float x, y, z, w; + stackPos = LuaDLL.abs_index(L, stackPos); + LuaDLL.tolua_getvec4(L, stackPos, out x, out y, out z, out w); + return new Vector4(x, y, z, w); + } + + public Color CheckColor(int stackPos) + { + int type = LuaDLL.tolua_getvaluetype(L, stackPos); + + if (type != LuaValueType.Color) + { + LuaTypeError(stackPos, "Color", LuaValueTypeName.Get(type)); + return Color.black; + } + + float r, g, b, a; + stackPos = LuaDLL.abs_index(L, stackPos); + LuaDLL.tolua_getclr(L, stackPos, out r, out g, out b, out a); + return new Color(r, g, b, a); + } + + public Ray CheckRay(int stackPos) + { + int type = LuaDLL.tolua_getvaluetype(L, stackPos); + + if (type != LuaValueType.Ray) + { + LuaTypeError(stackPos, "Ray", LuaValueTypeName.Get(type)); + return new Ray(); + } + + stackPos = LuaDLL.abs_index(L, stackPos); + int oldTop = BeginPCall(UnpackRay); + LuaPushValue(stackPos); + + try + { + PCall(1, oldTop); + Vector3 origin = ToVector3(oldTop + 1); + Vector3 dir = ToVector3(oldTop + 2); + EndPCall(oldTop); + return new Ray(origin, dir); + } + catch(Exception e) + { + EndPCall(oldTop); + throw e; + } + } + + public Bounds CheckBounds(int stackPos) + { + int type = LuaDLL.tolua_getvaluetype(L, stackPos); + + if (type != LuaValueType.Bounds) + { + LuaTypeError(stackPos, "Bounds", LuaValueTypeName.Get(type)); + return new Bounds(); + } + + stackPos = LuaDLL.abs_index(L, stackPos); + int oldTop = BeginPCall(UnpackBounds); + LuaPushValue(stackPos); + + try + { + PCall(1, oldTop); + Vector3 center = ToVector3(oldTop + 1); + Vector3 size = ToVector3(oldTop + 2); + EndPCall(oldTop); + return new Bounds(center, size); + } + catch(Exception e) + { + EndPCall(oldTop); + throw e; + } + } + + public LayerMask CheckLayerMask(int stackPos) + { + int type = LuaDLL.tolua_getvaluetype(L, stackPos); + + if (type != LuaValueType.LayerMask) + { + LuaTypeError(stackPos, "LayerMask", LuaValueTypeName.Get(type)); + return 0; + } + + stackPos = LuaDLL.abs_index(L, stackPos); + return LuaDLL.tolua_getlayermask(L, stackPos); + } + + public long CheckLong(int stackPos) + { + stackPos = LuaDLL.abs_index(L, stackPos); + return LuaDLL.tolua_checkint64(L, stackPos); + } + + public ulong CheckULong(int stackPos) + { + stackPos = LuaDLL.abs_index(L, stackPos); + return LuaDLL.tolua_checkuint64(L, stackPos); + } + + public string CheckString(int stackPos) + { + return ToLua.CheckString(L, stackPos); + } + + public Delegate CheckDelegate(int stackPos) + { + int udata = LuaDLL.tolua_rawnetobj(L, stackPos); + + if (udata != -1) + { + object obj = translator.GetObject(udata); + + if (obj != null) + { + if (obj is Delegate) + { + return (Delegate)obj; + } + + LuaTypeError(stackPos, "Delegate", obj.GetType().FullName); + } + + return null; + } + else if (LuaDLL.lua_isnil(L,stackPos)) + { + return null; + } + + LuaTypeError(stackPos, "Delegate"); + return null; + } + + public char[] CheckCharBuffer(int stackPos) + { + return ToLua.CheckCharBuffer(L, stackPos); + } + + public byte[] CheckByteBuffer(int stackPos) + { + return ToLua.CheckByteBuffer(L, stackPos); + } + + public T[] CheckNumberArray(int stackPos) where T : struct + { + return ToLua.CheckNumberArray(L, stackPos); + } + + public object CheckObject(int stackPos, Type type) + { + return ToLua.CheckObject(L, stackPos, type); + } + + public object CheckVarObject(int stackPos, Type type) + { + return ToLua.CheckVarObject(L, stackPos, type); + } + + public object[] CheckObjects(int oldTop) + { + int newTop = LuaGetTop(); + + if (oldTop == newTop) + { + return null; + } + else + { + List returnValues = new List(); + + for (int i = oldTop + 1; i <= newTop; i++) + { + returnValues.Add(ToVariant(i)); + } + + return returnValues.ToArray(); + } + } + + public LuaFunction CheckLuaFunction(int stackPos) + { + return ToLua.CheckLuaFunction(L, stackPos); + } + + public LuaTable CheckLuaTable(int stackPos) + { + return ToLua.CheckLuaTable(L, stackPos); + } + + public LuaThread CheckLuaThread(int stackPos) + { + return ToLua.CheckLuaThread(L, stackPos); + } + + //浠庡爢鏍堣鍙栦竴涓肩被鍨 + public T CheckValue(int stackPos) + { + return StackTraits.Check(L, stackPos); + } + + public object ToVariant(int stackPos) + { + return ToLua.ToVarObject(L, stackPos); + } + + public void CollectRef(int reference, string name, bool isGCThread = false) + { + if (!isGCThread) + { + Collect(reference, name, false); + } + else + { + lock (gcList) + { + gcList.Add(new GCRef(reference, name)); + } + } + } + + //鍦ㄥ鎵樿皟鐢ㄤ腑鍑忔帀涓涓狶uaFunction, 姝ua鍑芥暟鍦ㄥ鎵樹腑杩樹細鎵ц涓娆, 鎵浠ュ繀椤诲欢杩熷垹闄わ紝濮旀墭鍊肩被鍨嬭〃鐜颁箣涓 + public void DelayDispose(LuaBaseRef br) + { + if (br != null) + { + subList.Add(br); + } + } + + public int Collect() + { + int count = gcList.Count; + + if (count > 0) + { + lock (gcList) + { + for (int i = 0; i < gcList.Count; i++) + { + int reference = gcList[i].reference; + string name = gcList[i].name; + Collect(reference, name, true); + } + + gcList.Clear(); + return count; + } + } + + for (int i = 0; i < subList.Count; i++) + { + subList[i].Dispose(); + } + + subList.Clear(); + translator.Collect(); + return 0; + } + + public void RefreshDelegateMap() + { + List list = new List(); + var iter = delegateMap.GetEnumerator(); + + while (iter.MoveNext()) + { + if (!iter.Current.Value.IsAlive) + { + list.Add(iter.Current.Key); + } + } + + for (int i = 0; i < list.Count; i++) + { + delegateMap.Remove(list[i]); + } + } + + public object this[string fullPath] + { + get + { + int oldTop = LuaGetTop(); + int pos = fullPath.LastIndexOf('.'); + object obj = null; + + if (pos > 0) + { + string tableName = fullPath.Substring(0, pos); + + if (PushLuaTable(tableName)) + { + string name = fullPath.Substring(pos + 1); + LuaPushString(name); + LuaRawGet(-2); + obj = ToVariant(-1); + } + else + { + LuaSetTop(oldTop); + return null; + } + } + else + { + LuaGetGlobal(fullPath); + obj = ToVariant(-1); + } + + LuaSetTop(oldTop); + return obj; + } + + set + { + int oldTop = LuaGetTop(); + int pos = fullPath.LastIndexOf('.'); + + if (pos > 0) + { + string tableName = fullPath.Substring(0, pos); + IntPtr p = LuaFindTable(LuaIndexes.LUA_GLOBALSINDEX, tableName); + + if (p == IntPtr.Zero) + { + string name = fullPath.Substring(pos + 1); + LuaPushString(name); + PushVariant(value); + LuaSetTable(-3); + } + else + { + LuaSetTop(oldTop); + int len = LuaDLL.tolua_strlen(p); + string str = LuaDLL.lua_ptrtostring(p, len); + throw new LuaException(string.Format("{0} not a Lua table", str)); + } + } + else + { + PushVariant(value); + LuaSetGlobal(fullPath); + } + + LuaSetTop(oldTop); + } + } + + public void NewTable(string fullPath) + { + string[] path = fullPath.Split(new char[] { '.' }); + int oldTop = LuaDLL.lua_gettop(L); + + if (path.Length == 1) + { + LuaDLL.lua_newtable(L); + LuaDLL.lua_setglobal(L, fullPath); + } + else + { + LuaDLL.lua_getglobal(L, path[0]); + + for (int i = 1; i < path.Length - 1; i++) + { + LuaDLL.lua_pushstring(L, path[i]); + LuaDLL.lua_gettable(L, -2); + } + + LuaDLL.lua_pushstring(L, path[path.Length - 1]); + LuaDLL.lua_newtable(L); + LuaDLL.lua_settable(L, -3); + } + + LuaDLL.lua_settop(L, oldTop); + } + + + public LuaTable NewTable(int narr = 0, int nrec = 0) + { + int oldTop = LuaDLL.lua_gettop(L); + + LuaDLL.lua_createtable(L, 0, 0); + LuaTable table = ToLua.ToLuaTable(L, oldTop + 1); + + LuaDLL.lua_settop(L, oldTop); + return table; + } + + //鎱庣敤 + public void ReLoad(string moduleFileName) + { + LuaGetGlobal("package"); + LuaGetField(-1, "loaded"); + LuaPushString(moduleFileName); + LuaGetTable(-2); + + if (!LuaIsNil(-1)) + { + LuaPushString(moduleFileName); + LuaPushNil(); + LuaSetTable(-4); + } + + LuaPop(3); + string require = string.Format("require '{0}'", moduleFileName); + DoString(require, "ReLoad"); + } + + public int GetMetaReference(Type t) + { + int reference = -1; + metaMap.TryGetValue(t, out reference); + return reference; + } + + public int GetMissMetaReference(Type t) + { + int reference = -1; + Type type = GetBaseType(t); + + while (type != null) + { + if (metaMap.TryGetValue(type, out reference)) + { +#if MISS_WARNING + if (!missSet.Contains(t)) + { + missSet.Add(t); + Debugger.LogWarning("Type {0} not wrap to lua, push as {1}, the warning is only raised once", LuaMisc.GetTypeName(t), LuaMisc.GetTypeName(type)); + } +#endif + return reference; + } + + type = GetBaseType(type); + } + + if (reference <= 0) + { + type = typeof(object); + reference = LuaStatic.GetMetaReference(L, type); + } + +#if MISS_WARNING + if (!missSet.Contains(t)) + { + missSet.Add(t); + Debugger.LogWarning("Type {0} not wrap to lua, push as {1}, the warning is only raised once", LuaMisc.GetTypeName(t), LuaMisc.GetTypeName(type)); + } +#endif + + return reference; + } + + Type GetBaseType(Type t) + { + if (t.IsGenericType) + { + return GetSpecialGenericType(t); + } + + return LuaMisc.GetExportBaseType(t); + } + + Type GetSpecialGenericType(Type t) + { + Type generic = t.GetGenericTypeDefinition(); + + if (genericSet.Contains(generic)) + { + return t == generic ? t.BaseType : generic; + } + + return t.BaseType; + } + + void CloseBaseRef() + { + LuaUnRef(PackBounds); + LuaUnRef(UnpackBounds); + LuaUnRef(PackRay); + LuaUnRef(UnpackRay); + LuaUnRef(PackRaycastHit); + LuaUnRef(PackTouch); + } + + public void Dispose() + { + if (IntPtr.Zero != L) + { + Collect(); + + foreach (KeyValuePair kv in metaMap) + { + LuaUnRef(kv.Value); + } + + List list = new List(); + + foreach (KeyValuePair kv in funcRefMap) + { + if (kv.Value.IsAlive) + { + list.Add((LuaBaseRef)kv.Value.Target); + } + } + + for (int i = 0; i < list.Count; i++) + { + list[i].Dispose(true); + } + + CloseBaseRef(); + delegateMap.Clear(); + funcRefMap.Clear(); + funcMap.Clear(); + metaMap.Clear(); + typeMap.Clear(); + enumMap.Clear(); + preLoadMap.Clear(); + genericSet.Clear(); + LuaDLL.lua_close(L); + translator.Dispose(); + stateMap.Remove(L); + translator = null; + L = IntPtr.Zero; +#if MISS_WARNING + missSet.Clear(); +#endif + OnDestroy(); + Debugger.Log("LuaState destroy"); + } + + if (mainState == this) + { + mainState = null; + } + if (injectionState == this) + { + injectionState = null; + } + +#if UNITY_EDITOR + beStart = false; +#endif + + LuaFileUtils.Instance.Dispose(); + System.GC.SuppressFinalize(this); + } + + //public virtual void Dispose(bool dispose) + //{ + //} + + public override int GetHashCode() + { + return RuntimeHelpers.GetHashCode(this); + } + + public override bool Equals(object o) + { + if (o == null) return L == IntPtr.Zero; + LuaState state = o as LuaState; + + if (state == null || state.L != L) + { + return false; + } + + return L != IntPtr.Zero; + } + + public static bool operator == (LuaState a, LuaState b) + { + if (System.Object.ReferenceEquals(a, b)) + { + return true; + } + + object l = a; + object r = b; + + if (l == null && r != null) + { + return b.L == IntPtr.Zero; + } + + if (l != null && r == null) + { + return a.L == IntPtr.Zero; + } + + if (a.L != b.L) + { + return false; + } + + return a.L != IntPtr.Zero; + } + + public static bool operator != (LuaState a, LuaState b) + { + return !(a == b); + } + + public void PrintTable(string name) + { + LuaTable table = GetTable(name); + LuaDictTable dict = table.ToDictTable(); + table.Dispose(); + var iter2 = dict.GetEnumerator(); + + while (iter2.MoveNext()) + { + Debugger.Log("map item, k,v is {0}:{1}", iter2.Current.Key, iter2.Current.Value); + } + + iter2.Dispose(); + dict.Dispose(); + } + + protected void Collect(int reference, string name, bool beThread) + { + if (beThread) + { + WeakReference weak = null; + + if (name != null) + { + funcMap.TryGetValue(name, out weak); + + if (weak != null && !weak.IsAlive) + { + funcMap.Remove(name); + weak = null; + } + } + + funcRefMap.TryGetValue(reference, out weak); + + if (weak != null && !weak.IsAlive) + { + ToLuaUnRef(reference); + funcRefMap.Remove(reference); + delegateMap.Remove(reference); + + if (LogGC) + { + string str = name == null ? "null" : name; + Debugger.Log("collect lua reference name {0}, id {1} in thread", str, reference); + } + } + } + else + { + if (name != null) + { + WeakReference weak = null; + funcMap.TryGetValue(name, out weak); + + if (weak != null && weak.IsAlive) + { + LuaBaseRef lbr = (LuaBaseRef)weak.Target; + + if (reference == lbr.GetReference()) + { + funcMap.Remove(name); + } + } + } + + ToLuaUnRef(reference); + funcRefMap.Remove(reference); + delegateMap.Remove(reference); + + if (LogGC) + { + string str = name == null ? "null" : name; + Debugger.Log("collect lua reference name {0}, id {1} in main", str, reference); + } + } + } + + protected void LuaLoadBuffer(byte[] buffer, string chunkName) + { + LuaDLL.tolua_pushtraceback(L); + int oldTop = LuaGetTop(); + + if (LuaLoadBuffer(buffer, buffer.Length, chunkName) == 0) + { + if (LuaPCall(0, LuaDLL.LUA_MULTRET, oldTop) == 0) + { + LuaSetTop(oldTop - 1); + return; + } + } + + string err = LuaToString(-1); + LuaSetTop(oldTop - 1); + throw new LuaException(err, LuaException.GetLastError()); + } + + protected T LuaLoadBuffer(byte[] buffer, string chunkName) + { + LuaDLL.tolua_pushtraceback(L); + int oldTop = LuaGetTop(); + + if (LuaLoadBuffer(buffer, buffer.Length, chunkName) == 0) + { + if (LuaPCall(0, LuaDLL.LUA_MULTRET, oldTop) == 0) + { + T result = CheckValue(oldTop + 1); + LuaSetTop(oldTop - 1); + return result; + } + } + + string err = LuaToString(-1); + LuaSetTop(oldTop - 1); + throw new LuaException(err, LuaException.GetLastError()); + } + + public bool BeginCall(string name, int top, bool beLogMiss) + { + LuaDLL.tolua_pushtraceback(L); + + if (PushLuaFunction(name, false)) + { + return true; + } + else + { + LuaDLL.lua_settop(L, top); + if (beLogMiss) + { + Debugger.Log("Lua function {0} not exists", name); + } + + return false; + } + } + + public void Call(int nArgs, int errfunc, int top) + { + if (LuaDLL.lua_pcall(L, nArgs, LuaDLL.LUA_MULTRET, errfunc) != 0) + { + string error = LuaDLL.lua_tostring(L, -1); + throw new LuaException(error, LuaException.GetLastError()); + } + } + + public void Call(string name, bool beLogMiss) + { + int top = LuaDLL.lua_gettop(L); + + try + { + if (BeginCall(name, top, beLogMiss)) + { + Call(0, top + 1, top); + LuaDLL.lua_settop(L, top); + } + } + catch (Exception e) + { + LuaDLL.lua_settop(L, top); + throw e; + } + } + + public void Call(string name, T arg1, bool beLogMiss) + { + int top = LuaDLL.lua_gettop(L); + + try + { + if (BeginCall(name, top, beLogMiss)) + { + PushGeneric(arg1); + Call(1, top + 1, top); + LuaDLL.lua_settop(L, top); + } + } + catch (Exception e) + { + LuaDLL.lua_settop(L, top); + throw e; + } + } + + public void Call(string name, T1 arg1, T2 arg2, bool beLogMiss) + { + int top = LuaDLL.lua_gettop(L); + + try + { + if (BeginCall(name, top, beLogMiss)) + { + PushGeneric(arg1); + PushGeneric(arg2); + Call(2, top + 1, top); + LuaDLL.lua_settop(L, top); + } + } + catch (Exception e) + { + LuaDLL.lua_settop(L, top); + throw e; + } + } + + public void Call(string name, T1 arg1, T2 arg2, T3 arg3, bool beLogMiss) + { + int top = LuaDLL.lua_gettop(L); + + try + { + if (BeginCall(name, top, beLogMiss)) + { + PushGeneric(arg1); + PushGeneric(arg2); + PushGeneric(arg3); + Call(3, top + 1, top); + LuaDLL.lua_settop(L, top); + } + } + catch (Exception e) + { + LuaDLL.lua_settop(L, top); + throw e; + } + } + + public void Call(string name, T1 arg1, T2 arg2, T3 arg3, T4 arg4, bool beLogMiss) + { + int top = LuaDLL.lua_gettop(L); + + try + { + if (BeginCall(name, top, beLogMiss)) + { + PushGeneric(arg1); + PushGeneric(arg2); + PushGeneric(arg3); + PushGeneric(arg4); + Call(4, top + 1, top); + LuaDLL.lua_settop(L, top); + } + } + catch (Exception e) + { + LuaDLL.lua_settop(L, top); + throw e; + } + } + + public void Call(string name, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, bool beLogMiss) + { + int top = LuaDLL.lua_gettop(L); + + try + { + if (BeginCall(name, top, beLogMiss)) + { + PushGeneric(arg1); + PushGeneric(arg2); + PushGeneric(arg3); + PushGeneric(arg4); + PushGeneric(arg5); + Call(5, top + 1, top); + LuaDLL.lua_settop(L, top); + } + } + catch (Exception e) + { + LuaDLL.lua_settop(L, top); + throw e; + } + } + + public void Call(string name, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, bool beLogMiss) + { + int top = LuaDLL.lua_gettop(L); + + try + { + if (BeginCall(name, top, beLogMiss)) + { + PushGeneric(arg1); + PushGeneric(arg2); + PushGeneric(arg3); + PushGeneric(arg4); + PushGeneric(arg5); + PushGeneric(arg6); + Call(6, top + 1, top); + LuaDLL.lua_settop(L, top); + } + } + catch (Exception e) + { + LuaDLL.lua_settop(L, top); + throw e; + } + } + + public R1 Invoke(string name, bool beLogMiss) + { + int top = LuaDLL.lua_gettop(L); + + try + { + if (BeginCall(name, top, beLogMiss)) + { + Call(0, top + 1, top); + R1 ret1 = CheckValue(top + 2); + LuaDLL.lua_settop(L, top); + return ret1; + } + + return default(R1); + } + catch (Exception e) + { + LuaDLL.lua_settop(L, top); + throw e; + } + } + + public R1 Invoke(string name, T1 arg1, bool beLogMiss) + { + int top = LuaDLL.lua_gettop(L); + + try + { + if (BeginCall(name, top, beLogMiss)) + { + PushGeneric(arg1); + Call(1, top + 1, top); + R1 ret1 = CheckValue(top + 2); + LuaDLL.lua_settop(L, top); + return ret1; + } + + return default(R1); + } + catch (Exception e) + { + LuaDLL.lua_settop(L, top); + throw e; + } + } + + public R1 Invoke(string name, T1 arg1, T2 arg2, bool beLogMiss) + { + int top = LuaDLL.lua_gettop(L); + + try + { + if (BeginCall(name, top, beLogMiss)) + { + PushGeneric(arg1); + PushGeneric(arg2); + Call(2, top + 1, top); + R1 ret1 = CheckValue(top + 2); + LuaDLL.lua_settop(L, top); + return ret1; + } + + return default(R1); + } + catch (Exception e) + { + LuaDLL.lua_settop(L, top); + throw e; + } + } + + public R1 Invoke(string name, T1 arg1, T2 arg2, T3 arg3, bool beLogMiss) + { + int top = LuaDLL.lua_gettop(L); + + try + { + if (BeginCall(name, top, beLogMiss)) + { + PushGeneric(arg1); + PushGeneric(arg2); + PushGeneric(arg3); + Call(3, top + 1, top); + R1 ret1 = CheckValue(top + 2); + LuaDLL.lua_settop(L, top); + return ret1; + } + + return default(R1); + } + catch (Exception e) + { + LuaDLL.lua_settop(L, top); + throw e; + } + } + + public R1 Invoke(string name, T1 arg1, T2 arg2, T3 arg3, T4 arg4, bool beLogMiss) + { + int top = LuaDLL.lua_gettop(L); + + try + { + if (BeginCall(name, top, beLogMiss)) + { + PushGeneric(arg1); + PushGeneric(arg2); + PushGeneric(arg3); + PushGeneric(arg4); + Call(4, top + 1, top); + R1 ret1 = CheckValue(top + 2); + LuaDLL.lua_settop(L, top); + return ret1; + } + + return default(R1); + } + catch (Exception e) + { + LuaDLL.lua_settop(L, top); + throw e; + } + } + + public R1 Invoke(string name, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, bool beLogMiss) + { + int top = LuaDLL.lua_gettop(L); + + try + { + if (BeginCall(name, top, beLogMiss)) + { + PushGeneric(arg1); + PushGeneric(arg2); + PushGeneric(arg3); + PushGeneric(arg4); + PushGeneric(arg5); + Call(5, top + 1, top); + R1 ret1 = CheckValue(top + 2); + LuaDLL.lua_settop(L, top); + return ret1; + } + + return default(R1); + } + catch (Exception e) + { + LuaDLL.lua_settop(L, top); + throw e; + } + } + + public R1 Invoke(string name, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, bool beLogMiss) + { + int top = LuaDLL.lua_gettop(L); + + try + { + if (BeginCall(name, top, beLogMiss)) + { + PushGeneric(arg1); + PushGeneric(arg2); + PushGeneric(arg3); + PushGeneric(arg4); + PushGeneric(arg5); + PushGeneric(arg6); + Call(6, top + 1, top); + R1 ret1 = CheckValue(top + 2); + LuaDLL.lua_settop(L, top); + return ret1; + } + + return default(R1); + } + catch (Exception e) + { + LuaDLL.lua_settop(L, top); + throw e; + } + } + + void InitTypeTraits() + { + LuaMatchType _ck = new LuaMatchType(); + TypeTraits.Init(_ck.CheckNumber); + TypeTraits.Init(_ck.CheckNumber); + TypeTraits.Init(_ck.CheckNumber); + TypeTraits.Init(_ck.CheckNumber); + TypeTraits.Init(_ck.CheckNumber); + TypeTraits.Init(_ck.CheckNumber); + TypeTraits.Init(_ck.CheckNumber); + TypeTraits.Init(_ck.CheckNumber); + TypeTraits.Init(_ck.CheckNumber); + TypeTraits.Init(_ck.CheckNumber); + TypeTraits.Init(_ck.CheckBool); + TypeTraits.Init(_ck.CheckLong); + TypeTraits.Init(_ck.CheckULong); + TypeTraits.Init(_ck.CheckString); + + TypeTraits>.Init(_ck.CheckNullNumber); + TypeTraits>.Init(_ck.CheckNullNumber); + TypeTraits>.Init(_ck.CheckNullNumber); + TypeTraits>.Init(_ck.CheckNullNumber); + TypeTraits>.Init(_ck.CheckNullNumber); + TypeTraits>.Init(_ck.CheckNullNumber); + TypeTraits>.Init(_ck.CheckNullNumber); + TypeTraits>.Init(_ck.CheckNullNumber); + TypeTraits>.Init(_ck.CheckNullNumber); + TypeTraits>.Init(_ck.CheckNullNumber); + TypeTraits>.Init(_ck.CheckNullBool); + TypeTraits>.Init(_ck.CheckNullLong); + TypeTraits>.Init(_ck.CheckNullULong); + + TypeTraits.Init(_ck.CheckByteArray); + TypeTraits.Init(_ck.CheckCharArray); + TypeTraits.Init(_ck.CheckBoolArray); + TypeTraits.Init(_ck.CheckSByteArray); + TypeTraits.Init(_ck.CheckInt16Array); + TypeTraits.Init(_ck.CheckUInt16Array); + TypeTraits.Init(_ck.CheckDecimalArray); + TypeTraits.Init(_ck.CheckSingleArray); + TypeTraits.Init(_ck.CheckDoubleArray); + TypeTraits.Init(_ck.CheckInt32Array); + TypeTraits.Init(_ck.CheckUInt32Array); + TypeTraits.Init(_ck.CheckInt64Array); + TypeTraits.Init(_ck.CheckUInt64Array); + TypeTraits.Init(_ck.CheckStringArray); + + TypeTraits.Init(_ck.CheckVec3); + TypeTraits.Init(_ck.CheckQuat); + TypeTraits.Init(_ck.CheckVec2); + TypeTraits.Init(_ck.CheckColor); + TypeTraits.Init(_ck.CheckVec4); + TypeTraits.Init(_ck.CheckRay); + TypeTraits.Init(_ck.CheckBounds); + TypeTraits.Init(_ck.CheckTouch); + TypeTraits.Init(_ck.CheckLayerMask); + TypeTraits.Init(_ck.CheckRaycastHit); + + TypeTraits>.Init(_ck.CheckNullVec3); + TypeTraits>.Init(_ck.CheckNullQuat); + TypeTraits>.Init(_ck.CheckNullVec2); + TypeTraits>.Init(_ck.CheckNullColor); + TypeTraits>.Init(_ck.CheckNullVec4); + TypeTraits>.Init(_ck.CheckNullRay); + TypeTraits>.Init(_ck.CheckNullBounds); + TypeTraits>.Init(_ck.CheckNullTouch); + TypeTraits>.Init(_ck.CheckNullLayerMask); + TypeTraits>.Init(_ck.CheckNullRaycastHit); + + TypeTraits.Init(_ck.CheckVec3Array); + TypeTraits.Init(_ck.CheckQuatArray); + TypeTraits.Init(_ck.CheckVec2Array); + TypeTraits.Init(_ck.CheckColorArray); + TypeTraits.Init(_ck.CheckVec4Array); + + TypeTraits.Init(_ck.CheckPtr); + TypeTraits.Init(_ck.CheckPtr); + TypeTraits.Init(_ck.CheckLuaFunc); + TypeTraits.Init(_ck.CheckLuaTable); + TypeTraits.Init(_ck.CheckLuaThread); + TypeTraits.Init(_ck.CheckLuaBaseRef); + + TypeTraits.Init(_ck.CheckByteBuffer); + TypeTraits.Init(_ck.CheckEventObject); + TypeTraits.Init(_ck.CheckEnumerator); + TypeTraits.Init(_ck.CheckMonoType); + TypeTraits.Init(_ck.CheckGameObject); + TypeTraits.Init(_ck.CheckTransform); + TypeTraits.Init(_ck.CheckTypeArray); + TypeTraits.Init(_ck.CheckVariant); + TypeTraits.Init(_ck.CheckObjectArray); + } + + void InitStackTraits() + { + LuaStackOp op = new LuaStackOp(); + StackTraits.Init(op.Push, op.CheckSByte, op.ToSByte); + StackTraits.Init(op.Push, op.CheckByte, op.ToByte); + StackTraits.Init(op.Push, op.CheckInt16, op.ToInt16); + StackTraits.Init(op.Push, op.CheckUInt16, op.ToUInt16); + StackTraits.Init(op.Push, op.CheckChar, op.ToChar); + StackTraits.Init(op.Push, op.CheckInt32, op.ToInt32); + StackTraits.Init(op.Push, op.CheckUInt32, op.ToUInt32); + StackTraits.Init(op.Push, op.CheckDecimal, op.ToDecimal); + StackTraits.Init(op.Push, op.CheckFloat, op.ToFloat); + StackTraits.Init(LuaDLL.lua_pushnumber, LuaDLL.luaL_checknumber, LuaDLL.lua_tonumber); + StackTraits.Init(LuaDLL.lua_pushboolean, LuaDLL.luaL_checkboolean, LuaDLL.lua_toboolean); + StackTraits.Init(LuaDLL.tolua_pushint64, LuaDLL.tolua_checkint64, LuaDLL.tolua_toint64); + StackTraits.Init(LuaDLL.tolua_pushuint64, LuaDLL.tolua_checkuint64, LuaDLL.tolua_touint64); + StackTraits.Init(LuaDLL.lua_pushstring, ToLua.CheckString, ToLua.ToString); + + StackTraits>.Init(op.Push, op.CheckNullSByte, op.ToNullSByte); + StackTraits>.Init(op.Push, op.CheckNullByte, op.ToNullByte); + StackTraits>.Init(op.Push, op.CheckNullInt16, op.ToNullInt16); + StackTraits>.Init(op.Push, op.CheckNullUInt16, op.ToNullUInt16); + StackTraits>.Init(op.Push, op.CheckNullChar, op.ToNullChar); + StackTraits>.Init(op.Push, op.CheckNullInt32, op.ToNullInt32); + StackTraits>.Init(op.Push, op.CheckNullUInt32, op.ToNullUInt32); + StackTraits>.Init(op.Push, op.CheckNullDecimal, op.ToNullDecimal); + StackTraits>.Init(op.Push, op.CheckNullFloat, op.ToNullFloat); + StackTraits>.Init(op.Push, op.CheckNullNumber, op.ToNullNumber); + StackTraits>.Init(op.Push, op.CheckNullBool, op.ToNullBool); + StackTraits>.Init(op.Push, op.CheckNullInt64, op.ToNullInt64); + StackTraits>.Init(op.Push, op.CheckNullUInt64, op.ToNullUInt64); + + StackTraits.Init(ToLua.Push, ToLua.CheckByteBuffer, ToLua.ToByteBuffer); + StackTraits.Init(ToLua.Push, ToLua.CheckCharBuffer, ToLua.ToCharBuffer); + StackTraits.Init(ToLua.Push, ToLua.CheckBoolArray, ToLua.ToBoolArray); + StackTraits.Init(ToLua.Push, op.CheckSByteArray, op.ToSByteArray); + StackTraits.Init(ToLua.Push, op.CheckInt16Array, op.ToInt16Array); + StackTraits.Init(ToLua.Push, op.CheckUInt16Array, op.ToUInt16Array); + StackTraits.Init(ToLua.Push, op.CheckDecimalArray, op.ToDecimalArray); + StackTraits.Init(ToLua.Push, op.CheckFloatArray, op.ToFloatArray); + StackTraits.Init(ToLua.Push, op.CheckDoubleArray, op.ToDoubleArray); + StackTraits.Init(ToLua.Push, op.CheckInt32Array, op.ToInt32Array); + StackTraits.Init(ToLua.Push, op.CheckUInt32Array, op.ToUInt32Array); + StackTraits.Init(ToLua.Push, op.CheckInt64Array, op.ToInt64Array); + StackTraits.Init(ToLua.Push, op.CheckUInt64Array, op.ToUInt64Array); + StackTraits.Init(ToLua.Push, ToLua.CheckStringArray, ToLua.ToStringArray); + + StackTraits.Init(ToLua.Push, ToLua.CheckVector3, ToLua.ToVector3); + StackTraits.Init(ToLua.Push, ToLua.CheckQuaternion, ToLua.ToQuaternion); + StackTraits.Init(ToLua.Push, ToLua.CheckVector2, ToLua.ToVector2); + StackTraits.Init(ToLua.Push, ToLua.CheckColor, ToLua.ToColor); + StackTraits.Init(ToLua.Push, ToLua.CheckVector4, ToLua.ToVector4); + StackTraits.Init(ToLua.Push, ToLua.CheckRay, ToLua.ToRay); + StackTraits.Init(ToLua.Push, null, null); + StackTraits.Init(ToLua.Push, ToLua.CheckBounds, ToLua.ToBounds); + StackTraits.Init(ToLua.PushLayerMask, ToLua.CheckLayerMask, ToLua.ToLayerMask); + StackTraits.Init(ToLua.Push, null, null); + + StackTraits>.Init(op.Push, op.CheckNullVec3, op.ToNullVec3); + StackTraits>.Init(op.Push, op.CheckNullQuat, op.ToNullQuat); + StackTraits>.Init(op.Push, op.CheckNullVec2, op.ToNullVec2); + StackTraits>.Init(op.Push, op.CheckNullColor, op.ToNullColor); + StackTraits>.Init(op.Push, op.CheckNullVec4, op.ToNullVec4); + StackTraits>.Init(op.Push, op.CheckNullRay, op.ToNullRay); + StackTraits>.Init(op.Push, null, null); + StackTraits>.Init(op.Push, op.CheckNullBounds, op.ToNullBounds); + StackTraits>.Init(op.Push, op.CheckNullLayerMask, op.ToNullLayerMask); + StackTraits>.Init(op.Push, null, null); + + StackTraits.Init(ToLua.Push, op.CheckVec3Array, op.ToVec3Array); + StackTraits.Init(ToLua.Push, op.CheckQuatArray, op.ToQuatArray); + StackTraits.Init(ToLua.Push, op.CheckVec2Array, op.ToVec2Array); + StackTraits.Init(ToLua.Push, op.CheckColorArray, op.ToColorArray); + StackTraits.Init(ToLua.Push, op.CheckVec4Array, op.ToVec4Array); + + StackTraits.Init(op.Push, op.CheckUIntPtr, op.CheckUIntPtr); //"NYI" + StackTraits.Init(LuaDLL.lua_pushlightuserdata, ToLua.CheckIntPtr, ToLua.CheckIntPtr); + StackTraits.Init(ToLua.Push, ToLua.CheckLuaFunction, ToLua.ToLuaFunction); + StackTraits.Init(ToLua.Push, ToLua.CheckLuaTable, ToLua.ToLuaTable); + StackTraits.Init(ToLua.Push, ToLua.CheckLuaThread, ToLua.ToLuaThread); + StackTraits.Init(ToLua.Push, ToLua.CheckLuaBaseRef, ToLua.CheckLuaBaseRef); + + StackTraits.Init(ToLua.Push, op.CheckLuaByteBuffer, op.ToLuaByteBuffer); + StackTraits.Init(ToLua.Push, op.CheckEventObject, op.ToEventObject); + StackTraits.Init(ToLua.Push, ToLua.CheckIter, op.ToIter); + StackTraits.Init(ToLua.Push, ToLua.CheckMonoType, op.ToType); + StackTraits.Init(ToLua.Push, op.CheckTypeArray, op.ToTypeArray); + StackTraits.Init(op.Push, op.CheckGameObject, op.ToGameObject); + StackTraits.Init(op.Push, op.CheckTransform, op.ToTransform); + StackTraits.Init(ToLua.Push, ToLua.ToVarObject, ToLua.ToVarObject); + StackTraits.Init(ToLua.Push, ToLua.CheckObjectArray, ToLua.ToObjectArray); + + StackTraits.Init(ToLua.Push, null, null); + } + } +} \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Core/LuaState.cs.meta b/Assets/LuaFramework/ToLua/Core/LuaState.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..d02c4ed202f39aa4e17f6b17d820e81678db7380 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaState.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 358b86bdf79858e46b17d8700238c397 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Core/LuaStatePtr.cs b/Assets/LuaFramework/ToLua/Core/LuaStatePtr.cs new file mode 100644 index 0000000000000000000000000000000000000000..3f987aa5e774861ea8aece1bef21eedd5a0dcef8 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaStatePtr.cs @@ -0,0 +1,690 @@ +锘縰sing UnityEngine; +using System; +using System.IO; +using System.Runtime.InteropServices; +using System.Text; + +namespace LuaInterface +{ + public class LuaStatePtr + { + protected IntPtr L; + + string jit = @" + function Euler(x, y, z) + x = x * 0.0087266462599716 + y = y * 0.0087266462599716 + z = z * 0.0087266462599716 + + local sinX = math.sin(x) + local cosX = math.cos(x) + local sinY = math.sin(y) + local cosY = math.cos(y) + local sinZ = math.sin(z) + local cosZ = math.cos(z) + + local w = cosY * cosX * cosZ + sinY * sinX * sinZ + x = cosY* sinX * cosZ + sinY* cosX * sinZ + y = sinY * cosX * cosZ - cosY * sinX * sinZ + z = cosY* cosX * sinZ - sinY* sinX * cosZ + + return {x = x, y = y, z= z, w = w} + end + + function Slerp(q1, q2, t) + local x1, y1, z1, w1 = q1.x, q1.y, q1.z, q1.w + local x2,y2,z2,w2 = q2.x, q2.y, q2.z, q2.w + local dot = x1* x2 + y1* y2 + z1* z2 + w1* w2 + + if dot< 0 then + dot = -dot + x2, y2, z2, w2 = -x2, -y2, -z2, -w2 + end + + if dot< 0.95 then + local sin = math.sin + local angle = math.acos(dot) + local invSinAngle = 1 / sin(angle) + local t1 = sin((1 - t) * angle) * invSinAngle + local t2 = sin(t * angle) * invSinAngle + return {x = x1* t1 + x2* t2, y = y1 * t1 + y2 * t2, z = z1 * t1 + z2 * t2, w = w1 * t1 + w2 * t2} + else + x1 = x1 + t* (x2 - x1) + y1 = y1 + t* (y2 - y1) + z1 = z1 + t* (z2 - z1) + w1 = w1 + t* (w2 - w1) + dot = x1* x1 + y1* y1 + z1* z1 + w1* w1 + + return {x = x1 / dot, y = y1 / dot, z = z1 / dot, w = w1 / dot} + end + end + + if jit then + if jit.status() then + for i=1,10000 do + local q1 = Euler(i, i, i) + Slerp({ x = 0, y = 0, z = 0, w = 1}, q1, 0.5) + end + end + end"; + + public int LuaUpValueIndex(int i) + { + return LuaIndexes.LUA_GLOBALSINDEX - i; + } + + public IntPtr LuaNewState() + { + return LuaDLL.luaL_newstate(); + } + + public void LuaOpenJit() + { + if (!LuaDLL.luaL_dostring(L, jit)) + { + string str = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_settop(L, 0); + throw new Exception(str); + } + } + + public void LuaClose() + { + LuaDLL.lua_close(L); + L = IntPtr.Zero; + } + + public IntPtr LuaNewThread() + { + return LuaDLL.lua_newthread(L); + } + + public IntPtr LuaAtPanic(IntPtr panic) + { + return LuaDLL.lua_atpanic(L, panic); + } + + public int LuaGetTop() + { + return LuaDLL.lua_gettop(L); + } + + public void LuaSetTop(int newTop) + { + LuaDLL.lua_settop(L, newTop); + } + + public void LuaPushValue(int idx) + { + LuaDLL.lua_pushvalue(L, idx); + } + + public void LuaRemove(int index) + { + LuaDLL.lua_remove(L, index); + } + + public void LuaInsert(int idx) + { + LuaDLL.lua_insert(L, idx); + } + + public void LuaReplace(int idx) + { + LuaDLL.lua_replace(L, idx); + } + + public bool LuaCheckStack(int args) + { + return LuaDLL.lua_checkstack(L, args) != 0; + } + + public void LuaXMove(IntPtr to, int n) + { + LuaDLL.lua_xmove(L, to, n); + } + + public bool LuaIsNumber(int idx) + { + return LuaDLL.lua_isnumber(L, idx) != 0; + } + + public bool LuaIsString(int index) + { + return LuaDLL.lua_isstring(L, index) != 0; + } + + public bool LuaIsCFunction(int index) + { + return LuaDLL.lua_iscfunction(L, index) != 0; + } + + public bool LuaIsUserData(int index) + { + return LuaDLL.lua_isuserdata(L, index) != 0; + } + + public bool LuaIsNil(int n) + { + return LuaDLL.lua_isnil(L, n); + } + + public LuaTypes LuaType(int index) + { + return LuaDLL.lua_type(L, index); + } + + public string LuaTypeName(LuaTypes type) + { + return LuaDLL.lua_typename(L, type); + } + + public string LuaTypeName(int idx) + { + return LuaDLL.luaL_typename(L, idx); + } + + public bool LuaEqual(int idx1, int idx2) + { + return LuaDLL.lua_equal(L, idx1, idx2) != 0; + } + + public bool LuaRawEqual(int idx1, int idx2) + { + return LuaDLL.lua_rawequal(L, idx1, idx2) != 0; + } + + public bool LuaLessThan(int idx1, int idx2) + { + return LuaDLL.lua_lessthan(L, idx1, idx2) != 0; + } + + public double LuaToNumber(int idx) + { + return LuaDLL.lua_tonumber(L, idx); + } + + public int LuaToInteger(int idx) + { + return LuaDLL.lua_tointeger(L, idx); + } + + public bool LuaToBoolean(int idx) + { + return LuaDLL.lua_toboolean(L, idx); + } + + public string LuaToString(int index) + { + return LuaDLL.lua_tostring(L, index); + } + + public IntPtr LuaToLString(int index, out int len) + { + return LuaDLL.tolua_tolstring(L, index, out len); + } + + public IntPtr LuaToCFunction(int idx) + { + return LuaDLL.lua_tocfunction(L, idx); + } + + public IntPtr LuaToUserData(int idx) + { + return LuaDLL.lua_touserdata(L, idx); + } + + public IntPtr LuaToThread(int idx) + { + return LuaDLL.lua_tothread(L, idx); + } + + public IntPtr LuaToPointer(int idx) + { + return LuaDLL.lua_topointer(L, idx); + } + + public int LuaObjLen(int index) + { + return LuaDLL.tolua_objlen(L, index); + } + + public void LuaPushNil() + { + LuaDLL.lua_pushnil(L); + } + + public void LuaPushNumber(double number) + { + LuaDLL.lua_pushnumber(L, number); + } + + public void LuaPushInteger(int n) + { + LuaDLL.lua_pushnumber(L, n); + } + + public void LuaPushLString(byte[] str, int size) + { + LuaDLL.lua_pushlstring(L, str, size); + } + + public void LuaPushString(string str) + { + LuaDLL.lua_pushstring(L, str); + } + + public void LuaPushCClosure(IntPtr fn, int n) + { + LuaDLL.lua_pushcclosure(L, fn, n); + } + + public void LuaPushBoolean(bool value) + { + LuaDLL.lua_pushboolean(L, value ? 1 : 0); + } + + public void LuaPushLightUserData(IntPtr udata) + { + LuaDLL.lua_pushlightuserdata(L, udata); + } + + public int LuaPushThread() + { + return LuaDLL.lua_pushthread(L); + } + + public void LuaGetTable(int idx) + { + LuaDLL.lua_gettable(L, idx); + } + + public void LuaGetField(int index, string key) + { + LuaDLL.lua_getfield(L, index, key); + } + + public void LuaRawGet(int idx) + { + LuaDLL.lua_rawget(L, idx); + } + + public void LuaRawGetI(int tableIndex, int index) + { + LuaDLL.lua_rawgeti(L, tableIndex, index); + } + + public void LuaCreateTable(int narr = 0, int nec = 0) + { + LuaDLL.lua_createtable(L, narr, nec); + } + + public IntPtr LuaNewUserData(int size) + { + return LuaDLL.tolua_newuserdata(L, size); + } + + public int LuaGetMetaTable(int idx) + { + return LuaDLL.lua_getmetatable(L, idx); + } + + public void LuaGetEnv(int idx) + { + LuaDLL.lua_getfenv(L, idx); + } + + public void LuaSetTable(int idx) + { + LuaDLL.lua_settable(L, idx); + } + + public void LuaSetField(int idx, string key) + { + LuaDLL.lua_setfield(L, idx, key); + } + + public void LuaRawSet(int idx) + { + LuaDLL.lua_rawset(L, idx); + } + + public void LuaRawSetI(int tableIndex, int index) + { + LuaDLL.lua_rawseti(L, tableIndex, index); + } + + public void LuaSetMetaTable(int objIndex) + { + LuaDLL.lua_setmetatable(L, objIndex); + } + + public void LuaSetEnv(int idx) + { + LuaDLL.lua_setfenv(L, idx); + } + + public void LuaCall(int nArgs, int nResults) + { + LuaDLL.lua_call(L, nArgs, nResults); + } + + public int LuaPCall(int nArgs, int nResults, int errfunc) + { + return LuaDLL.lua_pcall(L, nArgs, nResults, errfunc); + } + + public int LuaYield(int nresults) + { + return LuaDLL.lua_yield(L, nresults); + } + + public int LuaResume(int narg) + { + return LuaDLL.lua_resume(L, narg); + } + + public int LuaStatus() + { + return LuaDLL.lua_status(L); + } + + public int LuaGC(LuaGCOptions what, int data = 0) + { + return LuaDLL.lua_gc(L, what, data); + } + + public bool LuaNext(int index) + { + return LuaDLL.lua_next(L, index) != 0; + } + + public void LuaConcat(int n) + { + LuaDLL.lua_concat(L, n); + } + + public void LuaPop(int amount) + { + LuaDLL.lua_pop(L, amount); + } + + public void LuaNewTable() + { + LuaDLL.lua_createtable(L, 0 , 0); + } + + public void LuaPushFunction(LuaCSFunction func) + { + IntPtr fn = Marshal.GetFunctionPointerForDelegate(func); + LuaDLL.lua_pushcclosure(L, fn, 0); + } + + public bool lua_isfunction(int n) + { + return LuaDLL.lua_type(L, n) == LuaTypes.LUA_TFUNCTION; + } + + public bool lua_istable(int n) + { + return LuaDLL.lua_type(L, n) == LuaTypes.LUA_TTABLE; + } + + public bool lua_islightuserdata(int n) + { + return LuaDLL.lua_type(L, n) == LuaTypes.LUA_TLIGHTUSERDATA; + } + + public bool lua_isnil(int n) + { + return LuaDLL.lua_type(L, n) == LuaTypes.LUA_TNIL; + } + + public bool lua_isboolean(int n) + { + LuaTypes type = LuaDLL.lua_type(L, n); + return type == LuaTypes.LUA_TBOOLEAN || type == LuaTypes.LUA_TNIL; + } + + public bool lua_isthread(int n) + { + return LuaDLL.lua_type(L, n) == LuaTypes.LUA_TTHREAD; + } + + public bool lua_isnone(int n) + { + return LuaDLL.lua_type(L, n) == LuaTypes.LUA_TNONE; + } + + public bool lua_isnoneornil(int n) + { + return LuaDLL.lua_type(L, n) <= LuaTypes.LUA_TNIL; + } + + public void LuaRawGlobal(string name) + { + LuaDLL.lua_pushstring(L, name); + LuaDLL.lua_rawget(L, LuaIndexes.LUA_GLOBALSINDEX); + } + + public void LuaSetGlobal(string name) + { + LuaDLL.lua_setglobal(L, name); + } + + public void LuaGetGlobal(string name) + { + LuaDLL.lua_getglobal(L, name); + } + + public void LuaOpenLibs() + { + LuaDLL.luaL_openlibs(L); + } + + public int AbsIndex(int i) + { + return (i > 0 || i <= LuaIndexes.LUA_REGISTRYINDEX) ? i : LuaDLL.lua_gettop(L) + i + 1; + } + + public int LuaGetN(int i) + { + return LuaDLL.luaL_getn(L, i); + } + + public double LuaCheckNumber(int stackPos) + { + return LuaDLL.luaL_checknumber(L, stackPos); + } + + public int LuaCheckInteger(int idx) + { + return LuaDLL.luaL_checkinteger(L, idx); + } + + public bool LuaCheckBoolean(int stackPos) + { + return LuaDLL.luaL_checkboolean(L, stackPos); + } + + public string LuaCheckLString(int numArg, out int len) + { + return LuaDLL.luaL_checklstring(L, numArg, out len); + } + + public int LuaLoadBuffer(byte[] buff, int size, string name) + { + return LuaDLL.luaL_loadbuffer(L, buff, size, name); + } + + public IntPtr LuaFindTable(int idx, string fname, int szhint = 1) + { + return LuaDLL.luaL_findtable(L, idx, fname, szhint); + } + + public int LuaTypeError(int stackPos, string tname, string t2 = null) + { + return LuaDLL.luaL_typerror(L, stackPos, tname, t2); + } + + public bool LuaDoString(string chunk, string chunkName = "@LuaStatePtr.cs") + { + byte[] buffer = Encoding.UTF8.GetBytes(chunk); + int status = LuaDLL.luaL_loadbuffer(L, buffer, buffer.Length, chunkName); + + if (status != 0) + { + return false; + } + + return LuaDLL.lua_pcall(L, 0, LuaDLL.LUA_MULTRET, 0) == 0; + //return LuaDLL.luaL_dostring(L, chunk); + } + + public bool LuaDoFile(string fileName) + { + int top = LuaGetTop(); + + if (LuaDLL.luaL_dofile(L, fileName)) + { + return true; + } + + string err = LuaToString(-1); + LuaSetTop(top); + throw new LuaException(err, LuaException.GetLastError()); + } + + public void LuaGetMetaTable(string meta) + { + LuaDLL.luaL_getmetatable(L, meta); + } + + public int LuaRef(int t) + { + return LuaDLL.luaL_ref(L, t); + } + + public void LuaGetRef(int reference) + { + LuaDLL.lua_getref(L, reference); + } + + public void LuaUnRef(int reference) + { + LuaDLL.lua_unref(L, reference); + } + + public int LuaRequire(string fileName) + { +#if UNITY_EDITOR + string str = Path.GetExtension(fileName); + + if (str == ".lua") + { + throw new LuaException("Require not need file extension: " + str); + } +#endif + return LuaDLL.tolua_require(L, fileName); + } + + //閫傚悎Awake OnSendMsg浣跨敤 + public void ThrowLuaException(Exception e) + { + if (LuaException.InstantiateCount > 0 || LuaException.SendMsgCount > 0) + { + LuaDLL.toluaL_exception(LuaException.L, e); + } + else + { + throw e; + } + } + + public int ToLuaRef() + { + return LuaDLL.toluaL_ref(L); + } + + public int LuaUpdate(float delta, float unscaled) + { + return LuaDLL.tolua_update(L, delta, unscaled); + } + + public int LuaLateUpdate() + { + return LuaDLL.tolua_lateupdate(L); + } + + public int LuaFixedUpdate(float fixedTime) + { + return LuaDLL.tolua_fixedupdate(L, fixedTime); + } + + public void OpenToLuaLibs() + { + LuaDLL.tolua_openlibs(L); + LuaOpenJit(); + } + + public void ToLuaPushTraceback() + { + LuaDLL.tolua_pushtraceback(L); + } + + public void ToLuaUnRef(int reference) + { + LuaDLL.toluaL_unref(L, reference); + } + + public int LuaGetStack(int level, ref Lua_Debug ar) + { + return LuaDLL.lua_getstack(L, level, ref ar); + } + + public int LuaGetInfo(string what, ref Lua_Debug ar) + { + return LuaDLL.lua_getinfo(L, what, ref ar); + } + + public string LuaGetLocal(ref Lua_Debug ar, int n) + { + return LuaDLL.lua_getlocal(L, ref ar, n); + } + + public string LuaSetLocal(ref Lua_Debug ar, int n) + { + return LuaDLL.lua_setlocal(L, ref ar, n); + } + + public string LuaGetUpvalue(int funcindex, int n) + { + return LuaDLL.lua_getupvalue(L, funcindex, n); + } + + public string LuaSetUpvalue(int funcindex, int n) + { + return LuaDLL.lua_setupvalue(L, funcindex, n); + } + + public int LuaSetHook(LuaHookFunc func, int mask, int count) + { + return LuaDLL.lua_sethook(L, func, mask, count); + } + + public LuaHookFunc LuaGetHook() + { + return LuaDLL.lua_gethook(L); + } + + public int LuaGetHookMask() + { + return LuaDLL.lua_gethookmask(L); + } + + public int LuaGetHookCount() + { + return LuaDLL.lua_gethookcount(L); + } + } +} \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Core/LuaStatePtr.cs.meta b/Assets/LuaFramework/ToLua/Core/LuaStatePtr.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..7958cfd106de3ec729dbfa06b1511cb724a3fca1 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaStatePtr.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e68c435592e3d3b47a315497b6150aae +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Core/LuaStatic.cs b/Assets/LuaFramework/ToLua/Core/LuaStatic.cs new file mode 100644 index 0000000000000000000000000000000000000000..316fb52525754ec981f0d83ae25891cb6d49ac9e --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaStatic.cs @@ -0,0 +1,145 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +using System; +using System.IO; +using System.Text; + +namespace LuaInterface +{ + public static class LuaStatic + { + public static int GetMetaReference(IntPtr L, Type t) + { + LuaState state = LuaState.Get(L); + return state.GetMetaReference(t); + } + + public static int GetMissMetaReference(IntPtr L, Type t) + { + LuaState state = LuaState.Get(L); + return state.GetMissMetaReference(t); + } + + public static Type GetClassType(IntPtr L, int reference) + { + LuaState state = LuaState.Get(L); + return state.GetClassType(reference); + } + + public static LuaFunction GetFunction(IntPtr L, int reference) + { + LuaState state = LuaState.Get(L); + return state.GetFunction(reference); + } + + public static LuaTable GetTable(IntPtr L, int reference) + { + LuaState state = LuaState.Get(L); + return state.GetTable(reference); + } + + public static LuaThread GetLuaThread(IntPtr L, int reference) + { + LuaState state = LuaState.Get(L); + return state.GetLuaThread(reference); + } + + public static void GetUnpackRayRef(IntPtr L) + { + LuaState state = LuaState.Get(L); + LuaDLL.lua_getref(L, state.UnpackRay); + } + + public static void GetUnpackBounds(IntPtr L) + { + LuaState state = LuaState.Get(L); + LuaDLL.lua_getref(L, state.UnpackBounds); + } + + public static void GetPackRay(IntPtr L) + { + LuaState state = LuaState.Get(L); + LuaDLL.lua_getref(L, state.PackRay); + } + + public static void GetPackRaycastHit(IntPtr L) + { + LuaState state = LuaState.Get(L); + LuaDLL.lua_getref(L, state.PackRaycastHit); + } + + public static void GetPackTouch(IntPtr L) + { + LuaState state = LuaState.Get(L); + LuaDLL.lua_getref(L, state.PackTouch); + } + + public static void GetPackBounds(IntPtr L) + { + LuaState state = LuaState.Get(L); + LuaDLL.lua_getref(L, state.PackBounds); + } + + public static int GetArrayMetatable(IntPtr L) + { + LuaState state = LuaState.Get(L); + return state.ArrayMetatable; + } + + public static int GetTypeMetatable(IntPtr L) + { + LuaState state = LuaState.Get(L); + return state.TypeMetatable; + } + + public static int GetDelegateMetatable(IntPtr L) + { + LuaState state = LuaState.Get(L); + return state.DelegateMetatable; + } + + public static int GetEventMetatable(IntPtr L) + { + LuaState state = LuaState.Get(L); + return state.EventMetatable; + } + + public static int GetIterMetatable(IntPtr L) + { + LuaState state = LuaState.Get(L); + return state.IterMetatable; + } + + public static int GetEnumObject(IntPtr L, System.Enum e, out object obj) + { + LuaState state = LuaState.Get(L); + obj = state.GetEnumObj(e); + return state.EnumMetatable; + } + + public static LuaCSFunction GetPreModule(IntPtr L, Type t) + { + LuaState state = LuaState.Get(L); + return state.GetPreModule(t); + } + } +} \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Core/LuaStatic.cs.meta b/Assets/LuaFramework/ToLua/Core/LuaStatic.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..e0c391296914fa5483bbb19b483ea66fd9aecbee --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaStatic.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e7f8fdc4e97256748b422edf401c641d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Core/LuaTable.cs b/Assets/LuaFramework/ToLua/Core/LuaTable.cs new file mode 100644 index 0000000000000000000000000000000000000000..a59d9842ea4a96fc3187be54f42149a1826e2798 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaTable.cs @@ -0,0 +1,1135 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace LuaInterface +{ + public class LuaTable : LuaBaseRef + { + public LuaTable(int reference, LuaState state) + { + this.reference = reference; + this.luaState = state; + } + + public object this[string key] + { + get + { + int top = luaState.LuaGetTop(); + + try + { + luaState.Push(this); + luaState.Push(key); + luaState.LuaGetTable(top + 1); + object ret = luaState.ToVariant(top + 2); + luaState.LuaSetTop(top); + return ret; + } + catch (Exception e) + { + luaState.LuaSetTop(top); + throw e; + } + } + + set + { + int top = luaState.LuaGetTop(); + + try + { + luaState.Push(this); + luaState.Push(key); + luaState.PushVariant(value); + luaState.LuaSetTable(top + 1); + luaState.LuaSetTop(top); + } + catch (Exception e) + { + luaState.LuaSetTop(top); + throw e; + } + } + } + + public object this[int key] + { + get + { + int oldTop = luaState.LuaGetTop(); + + try + { + luaState.Push(this); + luaState.LuaRawGetI(oldTop + 1, key); + object obj = luaState.ToVariant(oldTop + 2); + luaState.LuaSetTop(oldTop); + return obj; + } + catch (Exception e) + { + luaState.LuaSetTop(oldTop); + throw e; + } + } + + set + { + int oldTop = luaState.LuaGetTop(); + + try + { + luaState.Push(this); + luaState.PushVariant(value); + luaState.LuaRawSetI(oldTop + 1, key); + luaState.LuaSetTop(oldTop); + } + catch (Exception e) + { + luaState.LuaSetTop(oldTop); + throw e; + } + } + } + + public int Length + { + get + { + luaState.Push(this); + int n = luaState.LuaObjLen(-1); + luaState.LuaPop(1); + return n; + } + } + + public T RawGetIndex(int index) + { + int top = luaState.LuaGetTop(); + + try + { + luaState.Push(this); + luaState.LuaRawGetI(top + 1, index); + T ret = luaState.CheckValue(top + 2); + luaState.LuaSetTop(top); + return ret; + } + catch (Exception e) + { + luaState.LuaSetTop(top); + throw e; + } + } + + public void RawSetIndex(int index, T value) + { + int top = luaState.LuaGetTop(); + + try + { + luaState.Push(this); + luaState.PushGeneric(value); + luaState.LuaRawSetI(top + 1, index); + luaState.LuaSetTop(top); + } + catch (Exception e) + { + luaState.LuaSetTop(top); + throw e; + } + } + + public V RawGet(K key) + { + int top = luaState.LuaGetTop(); + + try + { + luaState.Push(this); + luaState.PushGeneric(key); + luaState.LuaRawGet(top + 1); + V ret = luaState.CheckValue(top + 2); + luaState.LuaSetTop(top); + return ret; + } + catch (Exception e) + { + luaState.LuaSetTop(top); + throw e; + } + } + + public void RawSet(K key, V arg) + { + int top = luaState.LuaGetTop(); + + try + { + luaState.Push(this); + luaState.PushGeneric(key); + luaState.PushGeneric(arg); + luaState.LuaRawSet(top + 1); + luaState.LuaSetTop(top); + } + catch (Exception e) + { + luaState.LuaSetTop(top); + throw e; + } + } + + public T GetTable(string key) + { + int top = luaState.LuaGetTop(); + + try + { + luaState.Push(this); + luaState.Push(key); + luaState.LuaGetTable(top + 1); + T ret = luaState.CheckValue(top + 2); + luaState.LuaSetTop(top); + return ret; + } + catch (Exception e) + { + luaState.LuaSetTop(top); + throw e; + } + } + + public void SetTable(string key, T arg) + { + int top = luaState.LuaGetTop(); + + try + { + luaState.Push(this); + luaState.Push(key); + luaState.PushGeneric(arg); + luaState.LuaSetTable(top + 1); + luaState.LuaSetTop(top); + } + catch (Exception e) + { + luaState.LuaSetTop(top); + throw e; + } + } + + public LuaFunction RawGetLuaFunction(string key) + { + int top = luaState.LuaGetTop(); + + try + { + luaState.Push(this); + luaState.Push(key); + luaState.LuaRawGet(top + 1); + LuaFunction func = luaState.CheckLuaFunction(top + 2); + luaState.LuaSetTop(top); +#if UNITY_EDITOR + if (func != null) + { + func.name = name + "." + key; + } +#endif + return func; + } + catch(Exception e) + { + luaState.LuaSetTop(top); + throw e; + } + } + + public LuaFunction GetLuaFunction(string key) + { + int top = luaState.LuaGetTop(); + + try + { + luaState.Push(this); + luaState.Push(key); + luaState.LuaGetTable(top + 1); + LuaFunction func = luaState.CheckLuaFunction(top + 2); + luaState.LuaSetTop(top); +#if UNITY_EDITOR + if (func != null) + { + func.name = name + "." + key; + } +#endif + return func; + } + catch(Exception e) + { + luaState.LuaSetTop(top); + throw e; + } + } + + bool BeginCall(string name, int top) + { + luaState.Push(this); + luaState.ToLuaPushTraceback(); + luaState.Push(name); + luaState.LuaGetTable(top + 1); + return luaState.LuaType(top + 3) == LuaTypes.LUA_TFUNCTION; + } + + public void Call(string name) + { + int top = luaState.LuaGetTop(); + + try + { + if (BeginCall(name, top)) + { + luaState.Call(0, top + 2, top); + } + + luaState.LuaSetTop(top); + } + catch (Exception e) + { + luaState.LuaSetTop(top); + throw e; + } + } + + public void Call(string name, T1 arg1) + { + int top = luaState.LuaGetTop(); + + try + { + if (BeginCall(name, top)) + { + luaState.PushGeneric(arg1); + luaState.Call(1, top + 2, top); + } + + luaState.LuaSetTop(top); + } + catch (Exception e) + { + luaState.LuaSetTop(top); + throw e; + } + } + + public void Call(string name, T1 arg1, T2 arg2) + { + int top = luaState.LuaGetTop(); + + try + { + if (BeginCall(name, top)) + { + luaState.PushGeneric(arg1); + luaState.PushGeneric(arg2); + luaState.Call(2, top + 2, top); + } + + luaState.LuaSetTop(top); + } + catch (Exception e) + { + luaState.LuaSetTop(top); + throw e; + } + } + + public void Call(string name, T1 arg1, T2 arg2, T3 arg3) + { + int top = luaState.LuaGetTop(); + + try + { + if (BeginCall(name, top)) + { + luaState.PushGeneric(arg1); + luaState.PushGeneric(arg2); + luaState.PushGeneric(arg3); + luaState.Call(3, top + 2, top); + } + + luaState.LuaSetTop(top); + } + catch (Exception e) + { + luaState.LuaSetTop(top); + throw e; + } + } + + public void Call(string name, T1 arg1, T2 arg2, T3 arg3, T4 arg4) + { + int top = luaState.LuaGetTop(); + + try + { + if (BeginCall(name, top)) + { + luaState.PushGeneric(arg1); + luaState.PushGeneric(arg2); + luaState.PushGeneric(arg3); + luaState.PushGeneric(arg4); + luaState.Call(4, top + 2, top); + } + + luaState.LuaSetTop(top); + } + catch (Exception e) + { + luaState.LuaSetTop(top); + throw e; + } + } + + public void Call(string name, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) + { + int top = luaState.LuaGetTop(); + + try + { + if (BeginCall(name, top)) + { + luaState.PushGeneric(arg1); + luaState.PushGeneric(arg2); + luaState.PushGeneric(arg3); + luaState.PushGeneric(arg4); + luaState.PushGeneric(arg5); + luaState.Call(5, top + 2, top); + } + + luaState.LuaSetTop(top); + } + catch (Exception e) + { + luaState.LuaSetTop(top); + throw e; + } + } + + public void Call(string name, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) + { + int top = luaState.LuaGetTop(); + + try + { + if (BeginCall(name, top)) + { + luaState.PushGeneric(arg1); + luaState.PushGeneric(arg2); + luaState.PushGeneric(arg3); + luaState.PushGeneric(arg4); + luaState.PushGeneric(arg5); + luaState.PushGeneric(arg6); + luaState.Call(6, top + 2, top); + } + + luaState.LuaSetTop(top); + } + catch (Exception e) + { + luaState.LuaSetTop(top); + throw e; + } + } + + public R1 Invoke(string name) + { + int top = luaState.LuaGetTop(); + + try + { + R1 ret1 = default(R1); + + if (BeginCall(name, top)) + { + luaState.Call(0, top + 2, top); + ret1 = luaState.CheckValue(top + 3); + } + + luaState.LuaSetTop(top); + return ret1; + } + catch (Exception e) + { + luaState.LuaSetTop(top); + throw e; + } + } + + public R1 Invoke(string name, T1 arg1) + { + int top = luaState.LuaGetTop(); + + try + { + R1 ret1 = default(R1); + + if (BeginCall(name, top)) + { + luaState.PushGeneric(arg1); + luaState.Call(1, top + 2, top); + ret1 = luaState.CheckValue(top + 3); + } + + luaState.LuaSetTop(top); + return ret1; + } + catch (Exception e) + { + luaState.LuaSetTop(top); + throw e; + } + } + + public R1 Invoke(string name, T1 arg1, T2 arg2) + { + int top = luaState.LuaGetTop(); + + try + { + R1 ret1 = default(R1); + + if (BeginCall(name, top)) + { + luaState.PushGeneric(arg1); + luaState.PushGeneric(arg2); + luaState.Call(2, top + 2, top); + ret1 = luaState.CheckValue(top + 3); + } + + luaState.LuaSetTop(top); + return ret1; + } + catch (Exception e) + { + luaState.LuaSetTop(top); + throw e; + } + } + + public R1 Invoke(string name, T1 arg1, T2 arg2, T3 arg3) + { + int top = luaState.LuaGetTop(); + + try + { + R1 ret1 = default(R1); + + if (BeginCall(name, top)) + { + luaState.PushGeneric(arg1); + luaState.PushGeneric(arg2); + luaState.PushGeneric(arg3); + luaState.Call(3, top + 2, top); + ret1 = luaState.CheckValue(top + 3); + } + + luaState.LuaSetTop(top); + return ret1; + } + catch (Exception e) + { + luaState.LuaSetTop(top); + throw e; + } + } + + public R1 Invoke(string name, T1 arg1, T2 arg2, T3 arg3, T4 arg4) + { + int top = luaState.LuaGetTop(); + + try + { + R1 ret1 = default(R1); + + if (BeginCall(name, top)) + { + luaState.PushGeneric(arg1); + luaState.PushGeneric(arg2); + luaState.PushGeneric(arg3); + luaState.PushGeneric(arg4); + luaState.Call(4, top + 2, top); + ret1 = luaState.CheckValue(top + 3); + } + + luaState.LuaSetTop(top); + return ret1; + } + catch (Exception e) + { + luaState.LuaSetTop(top); + throw e; + } + } + + public R1 Invoke(string name, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) + { + int top = luaState.LuaGetTop(); + + try + { + R1 ret1 = default(R1); + + if (BeginCall(name, top)) + { + luaState.PushGeneric(arg1); + luaState.PushGeneric(arg2); + luaState.PushGeneric(arg3); + luaState.PushGeneric(arg4); + luaState.PushGeneric(arg5); + luaState.Call(5, top + 2, top); + ret1 = luaState.CheckValue(top + 3); + } + + luaState.LuaSetTop(top); + return ret1; + } + catch (Exception e) + { + luaState.LuaSetTop(top); + throw e; + } + } + + public R1 Invoke(string name, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) + { + int top = luaState.LuaGetTop(); + + try + { + R1 ret1 = default(R1); + + if (BeginCall(name, top)) + { + luaState.PushGeneric(arg1); + luaState.PushGeneric(arg2); + luaState.PushGeneric(arg3); + luaState.PushGeneric(arg4); + luaState.PushGeneric(arg5); + luaState.PushGeneric(arg6); + luaState.Call(6, top + 2, top); + ret1 = luaState.CheckValue(top + 3); + } + + luaState.LuaSetTop(top); + return ret1; + } + catch (Exception e) + { + luaState.LuaSetTop(top); + throw e; + } + } + + public string GetStringField(string name) + { + int oldTop = luaState.LuaGetTop(); + + try + { + luaState.Push(this); + luaState.LuaGetField(oldTop + 1, name); + string str = luaState.CheckString(-1); + luaState.LuaSetTop(oldTop); + return str; + } + catch(LuaException e) + { + luaState.LuaSetTop(oldTop); + throw e; + } + } + + public void AddTable(string name) + { + int oldTop = luaState.LuaGetTop(); + + try + { + luaState.Push(this); + luaState.Push(name); + luaState.LuaCreateTable(); + luaState.LuaRawSet(oldTop + 1); + luaState.LuaSetTop(oldTop); + } + catch (Exception e) + { + luaState.LuaSetTop(oldTop); + throw e; + } + } + + public object[] ToArray() + { + int oldTop = luaState.LuaGetTop(); + + try + { + luaState.Push(this); + int len = luaState.LuaObjLen(-1); + List list = new List(len + 1); + int index = 1; + object obj = null; + + while(index <= len) + { + luaState.LuaRawGetI(-1, index++); + obj = luaState.ToVariant(-1); + luaState.LuaPop(1); + list.Add(obj); + } + + luaState.LuaSetTop(oldTop); + return list.ToArray(); + } + catch (Exception e) + { + luaState.LuaSetTop(oldTop); + throw e; + } + } + + public override string ToString() + { + luaState.Push(this); + IntPtr p = luaState.LuaToPointer(-1); + luaState.LuaPop(1); + return string.Format("table:0x{0}", p.ToString("X")); + } + + public LuaArrayTable ToArrayTable() + { + return new LuaArrayTable(this); + } + + public LuaDictTable ToDictTable() + { + return new LuaDictTable(this); + } + + public LuaDictTable ToDictTable() + { + return new LuaDictTable(this); + } + + public LuaTable GetMetaTable() + { + int oldTop = luaState.LuaGetTop(); + + try + { + LuaTable t = null; + luaState.Push(this); + + if (luaState.LuaGetMetaTable(-1) != 0) + { + t = luaState.CheckLuaTable(-1); + } + + luaState.LuaSetTop(oldTop); + return t; + } + catch (Exception e) + { + luaState.LuaSetTop(oldTop); + throw e; + } + } + } + + public class LuaArrayTable : IDisposable, IEnumerable + { + private LuaTable table = null; + private LuaState state = null; + + public LuaArrayTable(LuaTable table) + { + table.AddRef(); + this.table = table; + this.state = table.GetLuaState(); + } + + public void Dispose() + { + if (table != null) + { + table.Dispose(); + table = null; + } + } + + public int Length + { + get + { + return table.Length; + } + } + + public object this[int key] + { + get + { + return table[key]; + } + set + { + table[key] = value; + } + } + + public void ForEach(Action action) + { + using (var iter = this.GetEnumerator()) + { + while (iter.MoveNext()) + { + action(iter.Current); + } + } + } + + public IEnumerator GetEnumerator() + { + return new Enumerator(this); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + class Enumerator : IEnumerator + { + LuaState state; + int index = 1; + object current = null; + int top = -1; + + public Enumerator(LuaArrayTable list) + { + state = list.state; + top = state.LuaGetTop(); + state.Push(list.table); + } + + public object Current + { + get + { + return current; + } + } + + public bool MoveNext() + { + state.LuaRawGetI(-1, index); + current = state.ToVariant(-1); + state.LuaPop(1); + ++index; + return current == null ? false : true; + } + + public void Reset() + { + index = 1; + current = null; + } + + public void Dispose() + { + if (state != null) + { + state.LuaSetTop(top); + state = null; + } + } + } + } + + public class LuaDictTable : IDisposable, IEnumerable + { + LuaTable table; + LuaState state; + + public LuaDictTable(LuaTable table) + { + table.AddRef(); + this.table = table; + this.state = table.GetLuaState() ; + } + + public void Dispose() + { + if (table != null) + { + table.Dispose(); + table = null; + } + } + + public object this[string key] + { + get + { + return table[key]; + } + + set + { + table[key] = value; + } + } + + public Hashtable ToHashtable() + { + Hashtable hash = new Hashtable(); + var iter = GetEnumerator(); + + while (iter.MoveNext()) + { + hash.Add(iter.Current.Key, iter.Current.Value); + } + + iter.Dispose(); + return hash; + } + + public IEnumerator GetEnumerator() + { + return new Enumerator(this); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + class Enumerator : IEnumerator + { + LuaState state; + DictionaryEntry current = new DictionaryEntry(); + int top = -1; + + public Enumerator(LuaDictTable list) + { + state = list.state; + top = state.LuaGetTop(); + state.Push(list.table); + state.LuaPushNil(); + } + + public DictionaryEntry Current + { + get + { + return current; + } + } + + object IEnumerator.Current + { + get + { + return Current; + } + } + + public bool MoveNext() + { + if (state.LuaNext(-2)) + { + current = new DictionaryEntry(); + current.Key = state.ToVariant(-2); + current.Value = state.ToVariant(-1); + state.LuaPop(1); + return true; + } + else + { + current = new DictionaryEntry(); + return false; + } + } + + public void Reset() + { + current = new DictionaryEntry(); + } + + public void Dispose() + { + if (state != null) + { + state.LuaSetTop(top); + state = null; + } + } + } + } + + public struct LuaDictEntry + { + public LuaDictEntry(K key, V value) + : this() + { + Key = key; + Value = value; + } + + public K Key { get; set; } + public V Value { get; set; } + } + + public class LuaDictTable : IDisposable, IEnumerable> + { + LuaTable table; + LuaState state; + + public LuaDictTable(LuaTable table) + { + table.AddRef(); + this.table = table; + this.state = table.GetLuaState(); + } + + public void Dispose() + { + if (table != null) + { + table.Dispose(); + table = null; + } + } + + public V this[K key] + { + get + { + return table.RawGet(key); + } + + set + { + table.RawSet(key, value); + } + } + + public Dictionary ToDictionary() + { + Dictionary dict = new Dictionary(); + var iter = GetEnumerator(); + + while (iter.MoveNext()) + { + dict.Add(iter.Current.Key, iter.Current.Value); + } + + iter.Dispose(); + return dict; + } + + public IEnumerator> GetEnumerator() + { + return new Enumerator(this); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + class Enumerator : IEnumerator> + { + LuaState state; + LuaDictEntry current = new LuaDictEntry(); + int top = -1; + + public Enumerator(LuaDictTable list) + { + state = list.state; + top = state.LuaGetTop(); + state.Push(list.table); + state.LuaPushNil(); + } + + public LuaDictEntry Current + { + get + { + return current; + } + } + + object IEnumerator.Current + { + get + { + return Current; + } + } + + public bool MoveNext() + { + if (state.LuaNext(-2)) + { + current = new LuaDictEntry(); + current.Key = state.CheckValue(-2); + current.Value = state.CheckValue(-1); + state.LuaPop(1); + return true; + } + else + { + current = new LuaDictEntry(); + return false; + } + } + + public void Reset() + { + current = new LuaDictEntry(); + } + + public void Dispose() + { + if (state != null) + { + state.LuaSetTop(top); + state = null; + } + } + } + } +} diff --git a/Assets/LuaFramework/ToLua/Core/LuaTable.cs.meta b/Assets/LuaFramework/ToLua/Core/LuaTable.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..7a9efafbec3ad21f1e6389b00a7fd4bd0df44aec --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaTable.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b68fd1e3004ea4a4a879bf6fbda73510 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Core/LuaThread.cs b/Assets/LuaFramework/ToLua/Core/LuaThread.cs new file mode 100644 index 0000000000000000000000000000000000000000..fbc7887814bcbac58ccc2fc3fe4a047c211d52f3 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaThread.cs @@ -0,0 +1,207 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +using System; + +namespace LuaInterface +{ + public class LuaThread : LuaBaseRef + { + public LuaThread(int reference, LuaState state) + { + this.luaState = state; + this.reference = reference; + } + + protected int Resume(IntPtr L, int nArgs) + { + int ret = LuaDLL.lua_resume(L, nArgs); + + if (ret > (int)LuaThreadStatus.LUA_YIELD) + { + string error = null; + int top = LuaDLL.lua_gettop(L); + LuaDLL.tolua_pushtraceback(L); + LuaDLL.lua_pushthread(L); + LuaDLL.lua_pushvalue(L, top); + + if (LuaDLL.lua_pcall(L, 2, -1, 0) != 0) + { + LuaDLL.lua_settop(L, top); + } + + error = LuaDLL.lua_tostring(L, -1); + luaState.LuaSetTop(0); + throw new LuaException(error); + } + + return ret; + } + + public int Resume() + { + luaState.Push(this); + IntPtr L = luaState.LuaToThread(-1); + luaState.LuaPop(1); + int ret = Resume(L, 0); + if (ret == 0) + { + Dispose(); + } + return ret; + } + + public int Resume(T1 arg1) + { + luaState.Push(this); + IntPtr L = luaState.LuaToThread(-1); + luaState.LuaPop(1); + StackTraits.Push(L, arg1); + int ret = Resume(L, 1); + if (ret == 0) + { + Dispose(); + } + return ret; + } + + public int Resume(T1 arg1, T2 arg2) + { + luaState.Push(this); + IntPtr L = luaState.LuaToThread(-1); + luaState.LuaPop(1); + StackTraits.Push(L, arg1); + StackTraits.Push(L, arg2); + int ret = Resume(L, 2); + if (ret == 0) + { + Dispose(); + } + return ret; + } + + public int Resume(T1 arg1, T2 arg2, T3 arg3) + { + luaState.Push(this); + IntPtr L = luaState.LuaToThread(-1); + luaState.LuaPop(1); + StackTraits.Push(L, arg1); + StackTraits.Push(L, arg2); + StackTraits.Push(L, arg3); + int ret = Resume(L, 3); + if (ret == 0) + { + Dispose(); + } + return ret; + } + + public int Resume(out R1 ret1) + { + luaState.Push(this); + IntPtr L = luaState.LuaToThread(-1); + luaState.LuaPop(1); + int ret = Resume(L, 0); + + if (ret == 0) + { + ret1 = default(R1); + Dispose(); + } + else + { + int top = LuaDLL.lua_gettop(L); + ret1 = StackTraits.Check(L, top); + } + + return ret; + } + + public int Resume(T1 arg1, out R1 ret1) + { + luaState.Push(this); + IntPtr L = luaState.LuaToThread(-1); + luaState.LuaPop(1); + StackTraits.Push(L, arg1); + int ret = Resume(L, 1); + + if (ret == 0) + { + ret1 = default(R1); + Dispose(); + } + else + { + int top = LuaDLL.lua_gettop(L); + ret1 = StackTraits.Check(L, top); + } + + return ret; + } + + public int Resume(T1 arg1, T2 arg2, out R1 ret1) + { + luaState.Push(this); + IntPtr L = luaState.LuaToThread(-1); + luaState.LuaPop(1); + StackTraits.Push(L, arg1); + StackTraits.Push(L, arg2); + int ret = Resume(L, 2); + + if (ret == 0) + { + ret1 = default(R1); + Dispose(); + } + else + { + int top = LuaDLL.lua_gettop(L); + ret1 = StackTraits.Check(L, top); + } + + return ret; + } + + public int Resume(T1 arg1, T2 arg2, T3 arg3, out R1 ret1) + { + luaState.Push(this); + IntPtr L = luaState.LuaToThread(-1); + luaState.LuaPop(1); + StackTraits.Push(L, arg1); + StackTraits.Push(L, arg2); + StackTraits.Push(L, arg3); + int ret = Resume(L, 3); + + if (ret == 0) + { + ret1 = default(R1); + Dispose(); + } + else + { + int top = LuaDLL.lua_gettop(L); + ret1 = StackTraits.Check(L, top); + } + + return ret; + } + } +} \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Core/LuaThread.cs.meta b/Assets/LuaFramework/ToLua/Core/LuaThread.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..33fe1ab187fba745f38e0e0ee5b805b4965eeb3a --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaThread.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c80e713269311db4689148e01949206a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Core/LuaUnityLibs.cs b/Assets/LuaFramework/ToLua/Core/LuaUnityLibs.cs new file mode 100644 index 0000000000000000000000000000000000000000..f513b947371ff1146b0e81ee3f55236f8cad19c3 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaUnityLibs.cs @@ -0,0 +1,181 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +using System; +using System.Runtime.InteropServices; +using UnityEngine; + +namespace LuaInterface +{ + public sealed class LuaUnityLibs + { + public static void OpenLibs(IntPtr L) + { + InitMathf(L); + InitLayer(L); + } + + public static void OpenLuaLibs(IntPtr L) + { + if (LuaDLL.tolua_openlualibs(L) != 0) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error); + } + + SetOutMethods(L, "Vector3", GetOutVector3); + SetOutMethods(L, "Vector2", GetOutVector2); + SetOutMethods(L, "Vector4", GetOutVector4); + SetOutMethods(L, "Color", GetOutColor); + SetOutMethods(L, "Quaternion", GetOutQuaternion); + SetOutMethods(L, "Ray", GetOutRay); + SetOutMethods(L, "Bounds", GetOutBounds); + SetOutMethods(L, "Touch", GetOutTouch); + SetOutMethods(L, "RaycastHit", GetOutRaycastHit); + SetOutMethods(L, "LayerMask", GetOutLayerMask); + } + + static void InitMathf(IntPtr L) + { + LuaDLL.lua_getglobal(L, "Mathf"); + LuaDLL.lua_pushstring(L, "PerlinNoise"); + LuaDLL.tolua_pushcfunction(L, PerlinNoise); + LuaDLL.lua_rawset(L, -3); + LuaDLL.lua_pop(L, 1); + } + + static void InitLayer(IntPtr L) + { + LuaDLL.tolua_createtable(L, "Layer"); + + for (int i = 0; i < 32; i++) + { + string str = LayerMask.LayerToName(i); + + if (!string.IsNullOrEmpty(str)) + { + LuaDLL.lua_pushstring(L, str); + LuaDLL.lua_pushinteger(L, i); + LuaDLL.lua_rawset(L, -3); + } + } + + LuaDLL.lua_pop(L, 1); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int PerlinNoise(IntPtr L) + { + try + { + float x = (float)LuaDLL.luaL_checknumber(L, 1); + float y = (float)LuaDLL.luaL_checknumber(L, 2); + float ret = Mathf.PerlinNoise(x, y); + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + static void SetOutMethods(IntPtr L, string table, LuaCSFunction getOutFunc = null) + { + LuaDLL.lua_getglobal(L, table); + IntPtr get = Marshal.GetFunctionPointerForDelegate(getOutFunc); + LuaDLL.tolua_variable(L, "out", get, IntPtr.Zero); + + LuaDLL.lua_pop(L, 1); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetOutVector3(IntPtr L) + { + ToLua.PushOut(L, new LuaOut()); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetOutVector2(IntPtr L) + { + ToLua.PushOut(L, new LuaOut()); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetOutVector4(IntPtr L) + { + ToLua.PushOut(L, new LuaOut()); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetOutColor(IntPtr L) + { + ToLua.PushOut(L, new LuaOut()); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetOutQuaternion(IntPtr L) + { + ToLua.PushOut(L, new LuaOut()); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetOutRay(IntPtr L) + { + ToLua.PushOut(L, new LuaOut()); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetOutBounds(IntPtr L) + { + ToLua.PushOut(L, new LuaOut()); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetOutRaycastHit(IntPtr L) + { + ToLua.PushOut(L, new LuaOut()); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetOutTouch(IntPtr L) + { + ToLua.PushOut(L, new LuaOut()); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetOutLayerMask(IntPtr L) + { + ToLua.PushOut(L, new LuaOut()); + return 1; + } + } +} diff --git a/Assets/LuaFramework/ToLua/Core/LuaUnityLibs.cs.meta b/Assets/LuaFramework/ToLua/Core/LuaUnityLibs.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..af0296d0da5ff4081a79d5d106669755d05e4a65 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaUnityLibs.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6f293d0bd6470a044a8688cd9a61b433 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Core/LuaValueType.cs b/Assets/LuaFramework/ToLua/Core/LuaValueType.cs new file mode 100644 index 0000000000000000000000000000000000000000..dfae94fd13c857aef2a4287a3737a7d9d70aedd1 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaValueType.cs @@ -0,0 +1,96 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +using System; +using System.Collections.Generic; + +namespace LuaInterface +{ + public partial struct LuaValueType + { + public const int None = 0; + public const int Vector3 = 1; + public const int Quaternion = 2; + public const int Vector2 = 3; + public const int Color = 4; + public const int Vector4 = 5; + public const int Ray = 6; + public const int Bounds = 7; + public const int Touch = 8; + public const int LayerMask = 9; + public const int RaycastHit = 10; + public const int Int64 = 11; + public const int UInt64 = 12; + public const int Max = 64; + + private int type; + + public LuaValueType(int value) + { + type = value; + } + + public static implicit operator int(LuaValueType mask) + { + return mask.type; + } + + public static implicit operator LuaValueType(int intVal) + { + return new LuaValueType(intVal); + } + + public override string ToString() + { + return LuaValueTypeName.Get(type); + } + } + + public static class LuaValueTypeName + { + public static string[] names = new string[LuaValueType.Max]; + + static LuaValueTypeName() + { + names[LuaValueType.None] = "None"; + names[LuaValueType.Vector3] = "Vector3"; + names[LuaValueType.Quaternion] = "Quaternion"; + names[LuaValueType.Vector2] = "Vector2"; + names[LuaValueType.Color] = "Color"; + names[LuaValueType.Vector4] = "Vector4"; + names[LuaValueType.Ray] = "Ray"; + names[LuaValueType.Bounds] = "Bounds"; + names[LuaValueType.Touch] = "Touch"; + names[LuaValueType.LayerMask] = "LayerMask"; + names[LuaValueType.RaycastHit] = "RaycastHit"; + } + + static public string Get(int type) + { + if (type >= 0 && type < LuaValueType.Max) + { + return names[type]; + } + + return "UnKnownType:" + ConstStringTable.GetNumIntern(type); + } + } +} diff --git a/Assets/LuaFramework/ToLua/Core/LuaValueType.cs.meta b/Assets/LuaFramework/ToLua/Core/LuaValueType.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..833ebcca0b447cd4db1074a41786814b069510dc --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/LuaValueType.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: caa2d85e8d1314547a78624e7fec25a3 +timeCreated: 1494919728 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Core/ObjectPool.cs b/Assets/LuaFramework/ToLua/Core/ObjectPool.cs new file mode 100644 index 0000000000000000000000000000000000000000..507cb50a51abb76f7f424348b01ece72d5583a32 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/ObjectPool.cs @@ -0,0 +1,145 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +using System; +using System.Collections.Generic; + +namespace LuaInterface +{ + public class LuaObjectPool + { + class PoolNode + { + public int index; + public object obj; + + public PoolNode(int index, object obj) + { + this.index = index; + this.obj = obj; + } + } + + private List list; + //鍚宭ua_ref绛栫暐锛0浣滀负涓涓洖鏀堕摼琛ㄥご锛屼笉浣跨敤杩欎釜浣嶇疆 + private PoolNode head = null; + private int count = 0; + + public LuaObjectPool() + { + list = new List(1024); + head = new PoolNode(0, null); + list.Add(head); + list.Add(new PoolNode(1, null)); + count = list.Count; + } + + public object this[int i] + { + get + { + if (i > 0 && i < count) + { + return list[i].obj; + } + + return null; + } + } + + public void Clear() + { + list.Clear(); + head = null; + count = 0; + } + + public int Add(object obj) + { + int pos = -1; + + if (head.index != 0) + { + pos = head.index; + list[pos].obj = obj; + head.index = list[pos].index; + } + else + { + pos = list.Count; + list.Add(new PoolNode(pos, obj)); + count = pos + 1; + } + + return pos; + } + + public object TryGetValue(int index) + { + if (index > 0 && index < count) + { + return list[index].obj; + } + + return null; + } + + public object Remove(int pos) + { + if (pos > 0 && pos < count) + { + object o = list[pos].obj; + list[pos].obj = null; + list[pos].index = head.index; + head.index = pos; + + return o; + } + + return null; + } + + public object Destroy(int pos) + { + if (pos > 0 && pos < count) + { + object o = list[pos].obj; + list[pos].obj = null; + return o; + } + + return null; + } + + public object Replace(int pos, object o) + { + if (pos > 0 && pos < count) + { + object obj = list[pos].obj; + list[pos].obj = o; + return obj; + } + + return null; + } + } +} \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Core/ObjectPool.cs.meta b/Assets/LuaFramework/ToLua/Core/ObjectPool.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..950f5288241cbf6d5ac46a3cd345dfd1db6c647a --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/ObjectPool.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 375ac727a60642f4e9db9303e4025911 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Core/ObjectTranslator.cs b/Assets/LuaFramework/ToLua/Core/ObjectTranslator.cs new file mode 100644 index 0000000000000000000000000000000000000000..ed2bb239543d701fb1e908418191a5177e559ffb --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/ObjectTranslator.cs @@ -0,0 +1,246 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using UnityEngine; + +namespace LuaInterface +{ + public class ObjectTranslator + { + private class DelayGC + { + public DelayGC(int id, UnityEngine.Object obj, float time) + { + this.id = id; + this.time = time; + this.obj = obj; + } + + public int id; + public UnityEngine.Object obj; + public float time; + } + + private class CompareObject : IEqualityComparer + { + public new bool Equals(object x, object y) + { + return object.ReferenceEquals(x, y); + } + + public int GetHashCode(object obj) + { + return RuntimeHelpers.GetHashCode(obj); + } + } + + public bool LogGC { get; set; } + public readonly Dictionary objectsBackMap = new Dictionary(new CompareObject()); + public readonly LuaObjectPool objects = new LuaObjectPool(); + private List gcList = new List(); + +#if !MULTI_STATE + private static ObjectTranslator _translator = null; +#endif + + public ObjectTranslator() + { + LogGC = false; +#if !MULTI_STATE + _translator = this; +#endif + } + + public int AddObject(object obj) + { + int index = objects.Add(obj); + + if (!TypeChecker.IsValueType(obj.GetType())) + { + objectsBackMap[obj] = index; + } + + return index; + } + + public static ObjectTranslator Get(IntPtr L) + { +#if !MULTI_STATE + return _translator; +#else + return LuaState.GetTranslator(L); +#endif + } + + //fixed 鏋氫妇鍞竴鎬ч棶棰橈紙瀵硅薄鍞竴锛屾病鏈夊疄鐜癬_eq鎿嶄綔绗︼級 + void RemoveObject(object o, int udata) + { + int index = -1; + + if (objectsBackMap.TryGetValue(o, out index) && index == udata) + { + objectsBackMap.Remove(o); + } + } + + //lua gc涓涓璞(lua 搴撲笉鍐嶅紩鐢紝浣嗕笉浠h〃c#娌′娇鐢) + public void RemoveObject(int udata) + { + //鍙湁lua gc鎵嶈兘绉婚櫎 + object o = objects.Remove(udata); + + if (o != null) + { + if (!TypeChecker.IsValueType(o.GetType())) + { + RemoveObject(o, udata); + } + + if (LogGC) + { + Debugger.Log("gc object {0}, id {1}", o, udata); + } + } + } + + public object GetObject(int udata) + { + return objects.TryGetValue(udata); + } + + //棰勫垹闄わ紝浣嗕笉绉婚櫎涓涓猯ua瀵硅薄(绉婚櫎id鍙兘鐢眊c瀹屾垚) + public void Destroy(int udata) + { + object o = objects.Destroy(udata); + + if (o != null) + { + if (!TypeChecker.IsValueType(o.GetType())) + { + RemoveObject(o, udata); + } + + if (LogGC) + { + Debugger.Log("destroy object {0}, id {1}", o, udata); + } + } + } + + //Unity Object 寤惰繜鍒犻櫎 + public void DelayDestroy(int id, float time) + { + UnityEngine.Object obj = (UnityEngine.Object)GetObject(id); + + if (obj != null) + { + gcList.Add(new DelayGC(id, obj, time)); + } + } + + public bool Getudata(object o, out int index) + { + index = -1; + return objectsBackMap.TryGetValue(o, out index); + } + + public void Destroyudata(int udata) + { + objects.Destroy(udata); + } + + public void SetBack(int index, object o) + { + objects.Replace(index, o); + } + + bool RemoveFromGCList(int id) + { + int index = gcList.FindIndex((p) => { return p.id == id; }); + + if (index >= 0) + { + gcList.RemoveAt(index); + return true; + } + + return false; + } + + //寤惰繜鍒犻櫎澶勭悊 + void DestroyUnityObject(int udata, UnityEngine.Object obj) + { + object o = objects.TryGetValue(udata); + + if (object.ReferenceEquals(o, obj)) + { + RemoveObject(o, udata); + //涓瀹氫笉鑳絉emove, 鍥犱负GC杩樺彲鑳藉啀鏉ヤ竴娆 + objects.Destroy(udata); + + if (LogGC) + { + Debugger.Log("destroy object {0}, id {1}", o, udata); + } + } + + UnityEngine.Object.Destroy(obj); + } + + public void Collect() + { + if (gcList.Count == 0) + { + return; + } + + float delta = Time.deltaTime; + + for (int i = gcList.Count - 1; i >= 0; i--) + { + float time = gcList[i].time - delta; + + if (time <= 0) + { + DestroyUnityObject(gcList[i].id, gcList[i].obj); + gcList.RemoveAt(i); + } + else + { + gcList[i].time = time; + } + } + } + + public void Dispose() + { + objectsBackMap.Clear(); + objects.Clear(); + +#if !MULTI_STATE + _translator = null; +#endif + } + } +} \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Core/ObjectTranslator.cs.meta b/Assets/LuaFramework/ToLua/Core/ObjectTranslator.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..fb0906b1945d15cbabcdf2dfd529875fa817499e --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/ObjectTranslator.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 607902915586ecd43b863b154c1337ad +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Core/ToLua.cs b/Assets/LuaFramework/ToLua/Core/ToLua.cs new file mode 100644 index 0000000000000000000000000000000000000000..ef9733a5bbc39f7c127ab54ff77ed1ad305c4194 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/ToLua.cs @@ -0,0 +1,2903 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +using UnityEngine; +using System; +using System.Diagnostics; +using System.IO; +using System.Collections.Generic; +using System.Collections; +using System.Runtime.InteropServices; +using System.Text; + +#if UNITY_EDITOR +using UnityEditor; +using UnityEditor.Callbacks; +using System.Reflection; +#endif + +namespace LuaInterface +{ + public static class ToLua + { + public delegate object LuaTableToVar(IntPtr L, int pos); + public delegate void LuaPushVarObject(IntPtr L, object o); + static Type monoType = typeof(Type).GetType(); + static public LuaTableToVar[] ToVarMap = new LuaTableToVar[LuaValueType.Max]; + static public Dictionary VarPushMap = new Dictionary(); + +#if UNITY_EDITOR + static int _instanceID = -1; + static int _line = 201; + private static object consoleWindow; + private static object logListView; + private static FieldInfo logListViewCurrentRow; + private static MethodInfo LogEntriesGetEntry; + private static object logEntry; + private static FieldInfo logEntryCondition; +#endif + + static ToLua() + { + ToVarMap[LuaValueType.Vector3] = ToObjectVec3; + ToVarMap[LuaValueType.Quaternion] = ToObjectQuat; + ToVarMap[LuaValueType.Vector2] = ToObjectVec2; + ToVarMap[LuaValueType.Color] = ToObjectColor; + ToVarMap[LuaValueType.Vector4] = ToObjectVec4; + ToVarMap[LuaValueType.Ray] = ToObjectRay; + ToVarMap[LuaValueType.LayerMask] = ToObjectLayerMask; + ToVarMap[LuaValueType.Bounds] = ToObjectBounds; + } + + public static void OpenLibs(IntPtr L) + { + AddLuaLoader(L); + LuaDLL.tolua_atpanic(L, Panic); + LuaDLL.tolua_pushcfunction(L, Print); + LuaDLL.lua_setglobal(L, "print"); + LuaDLL.tolua_pushcfunction(L, DoFile); + LuaDLL.lua_setglobal(L, "dofile"); + LuaDLL.tolua_pushcfunction(L, LoadFile); + LuaDLL.lua_setglobal(L, "loadfile"); + + LuaDLL.lua_getglobal(L, "tolua"); + + LuaDLL.lua_pushstring(L, "isnull"); + LuaDLL.lua_pushcfunction(L, IsNull); + LuaDLL.lua_rawset(L, -3); + + LuaDLL.lua_pushstring(L, "typeof"); + LuaDLL.lua_pushcfunction(L, GetClassType); + LuaDLL.lua_rawset(L, -3); + + LuaDLL.lua_pushstring(L, "tolstring"); + LuaDLL.tolua_pushcfunction(L, BufferToString); + LuaDLL.lua_rawset(L, -3); + + LuaDLL.lua_pushstring(L, "toarray"); + LuaDLL.tolua_pushcfunction(L, TableToArray); + LuaDLL.lua_rawset(L, -3); + + //鎵嬪姩妯℃嫙gc + //LuaDLL.lua_pushstring(L, "collect"); + //LuaDLL.lua_pushcfunction(L, Collect); + //LuaDLL.lua_rawset(L, -3); + + int meta = LuaStatic.GetMetaReference(L, typeof(NullObject)); + LuaDLL.lua_pushstring(L, "null"); + LuaDLL.tolua_pushnewudata(L, meta, 1); + LuaDLL.lua_rawset(L, -3); + LuaDLL.lua_pop(L, 1); + + LuaDLL.tolua_pushudata(L, 1); + LuaDLL.lua_setfield(L, LuaIndexes.LUA_GLOBALSINDEX, "null"); + +#if UNITY_EDITOR + GetToLuaInstanceID(); + GetConsoleWindowListView(); +#endif + } + + /*--------------------------------瀵逛簬tolua鎵╁睍鍑芥暟------------------------------------------*/ + #region TOLUA_EXTEND_FUNCTIONS + static void AddLuaLoader(IntPtr L) + { + LuaDLL.lua_getglobal(L, "package"); + LuaDLL.lua_getfield(L, -1, "loaders"); + LuaDLL.tolua_pushcfunction(L, Loader); + + for (int i = LuaDLL.lua_objlen(L, -2) + 1; i > 2; i--) + { + LuaDLL.lua_rawgeti(L, -2, i - 1); + LuaDLL.lua_rawseti(L, -3, i); + } + + LuaDLL.lua_rawseti(L, -2, 2); + LuaDLL.lua_pop(L, 2); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Panic(IntPtr L) + { + string reason = String.Format("PANIC: unprotected error in call to Lua API ({0})", LuaDLL.lua_tostring(L, -1)); + throw new LuaException(reason); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Print(IntPtr L) + { + try + { + int n = LuaDLL.lua_gettop(L); + + using (CString.Block()) + { + CString sb = CString.Alloc(256); +#if UNITY_EDITOR + int line = LuaDLL.tolua_where(L, 1); + string filename = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_settop(L, n); + int offset = filename[0] == '@' ? 1 : 0; + + if (!filename.Contains(".")) + { + sb.Append('[').Append(filename, offset, filename.Length - offset).Append(".lua:").Append(line).Append("]:"); + } + else + { + sb.Append('[').Append(filename, offset, filename.Length - offset).Append(':').Append(line).Append("]:"); + } +#endif + + for (int i = 1; i <= n; i++) + { + if (i > 1) sb.Append(" "); + + if (LuaDLL.lua_isstring(L, i) == 1) + { + sb.Append(LuaDLL.lua_tostring(L, i)); + } + else if (LuaDLL.lua_isnil(L, i)) + { + sb.Append("nil"); + } + else if (LuaDLL.lua_isboolean(L, i)) + { + sb.Append(LuaDLL.lua_toboolean(L, i) ? "true" : "false"); + } + else + { + IntPtr p = LuaDLL.lua_topointer(L, i); + + if (p == IntPtr.Zero) + { + sb.Append("nil"); + } + else + { + sb.Append(LuaDLL.luaL_typename(L, i)).Append(":0x").Append(p.ToString("X")); + } + } + } + + Debugger.Log(sb.ToString()); //200琛屼笌_line涓鑷 + } + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Loader(IntPtr L) + { + try + { + string fileName = LuaDLL.lua_tostring(L, 1); + fileName = fileName.Replace(".", "/"); + byte[] buffer = LuaFileUtils.Instance.ReadFile(fileName); + + if (buffer == null) + { + string error = LuaFileUtils.Instance.FindFileError(fileName); + LuaDLL.lua_pushstring(L, error); + return 1; + } + + if (LuaConst.openLuaDebugger) + { + fileName = LuaFileUtils.Instance.FindFile(fileName); + } + + if (LuaDLL.luaL_loadbuffer(L, buffer, buffer.Length, "@"+ fileName) != 0) + { + string err = LuaDLL.lua_tostring(L, -1); + throw new LuaException(err, LuaException.GetLastError()); + } + + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + public static int DoFile(IntPtr L) + { + try + { + string fileName = LuaDLL.lua_tostring(L, 1); + int n = LuaDLL.lua_gettop(L); + byte[] buffer = LuaFileUtils.Instance.ReadFile(fileName); + + if (buffer == null) + { + string error = string.Format("cannot open {0}: No such file or directory", fileName); + error += LuaFileUtils.Instance.FindFileError(fileName); + throw new LuaException(error); + } + + if (LuaDLL.luaL_loadbuffer(L, buffer, buffer.Length, fileName) == 0) + { + if (LuaDLL.lua_pcall(L, 0, LuaDLL.LUA_MULTRET, 0) != 0) + { + string error = LuaDLL.lua_tostring(L, -1); + throw new LuaException(error, LuaException.GetLastError()); + } + } + + return LuaDLL.lua_gettop(L) - n; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + public static int LoadFile(IntPtr L) + { + try + { + string fileName = LuaDLL.lua_tostring(L, 1); + byte[] buffer = LuaFileUtils.Instance.ReadFile(fileName); + + if (buffer == null) + { + string error = string.Format("cannot open {0}: No such file or directory", fileName); + error += LuaFileUtils.Instance.FindFileError(fileName); + throw new LuaException(error); + } + + if (LuaDLL.luaL_loadbuffer(L, buffer, buffer.Length, fileName) == 0) + { + return 1; + } + + LuaDLL.lua_pushnil(L); + LuaDLL.lua_insert(L, -2); /* put before error message */ + return 2; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IsNull(IntPtr L) + { + LuaTypes t = LuaDLL.lua_type(L, 1); + + if (t == LuaTypes.LUA_TNIL) + { + LuaDLL.lua_pushboolean(L, true); + } + else + { + object o = ToLua.ToObject(L, -1); + + if (o == null || o.Equals(null)) + { + LuaDLL.lua_pushboolean(L, true); + } + else + { + LuaDLL.lua_pushboolean(L, false); + } + } + + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int BufferToString(IntPtr L) + { + try + { + object o = CheckObject(L, 1); + + if (o is byte[]) + { + byte[] buff = (byte[])o; + LuaDLL.lua_pushlstring(L, buff, buff.Length); + } + else if (o is char[]) + { + byte[] buff = System.Text.Encoding.UTF8.GetBytes((char[])o); + LuaDLL.lua_pushlstring(L, buff, buff.Length); + } + else if (o is string) + { + LuaDLL.lua_pushstring(L, (string)o); + } + else + { + LuaDLL.luaL_typerror(L, 1, "byte[] or char[]"); + } + + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetClassType(IntPtr L) + { + int reference = LuaDLL.tolua_getmetatableref(L, 1); + + if (reference > 0) + { + Type t = LuaStatic.GetClassType(L, reference); + Push(L, t); + } + else + { + int ret = LuaDLL.tolua_getvaluetype(L, -1); + + if (ret != LuaValueType.None) + { + Type t = TypeChecker.LuaValueTypeMap[ret]; + Push(L, t); + } + else + { + Debugger.LogError("type not register to lua"); + LuaDLL.lua_pushnil(L); + } + } + + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TableToArray(IntPtr L) + { + try + { + object[] objs = ToLua.CheckObjectArray(L, 1); + Type t = ToLua.CheckMonoType(L, 2); + Array ret = System.Array.CreateInstance(t, objs.Length); + + for (int i = 0; i < objs.Length; i++) + { + ret.SetValue(objs[i], i); + } + + ToLua.Push(L, ret); + return 1; + } + catch(LuaException e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + public static int op_ToString(IntPtr L) + { + object obj = ToLua.ToObject(L, 1); + + if (obj != null) + { + LuaDLL.lua_pushstring(L, obj.ToString()); + } + else + { + LuaDLL.lua_pushnil(L); + } + + return 1; + } + +#if UNITY_EDITOR + private static bool GetConsoleWindowListView() + { + if (logListView == null) + { + Assembly unityEditorAssembly = Assembly.GetAssembly(typeof(EditorWindow)); + Type consoleWindowType = unityEditorAssembly.GetType("UnityEditor.ConsoleWindow"); + FieldInfo fieldInfo = consoleWindowType.GetField("ms_ConsoleWindow", BindingFlags.Static | BindingFlags.NonPublic); + consoleWindow = fieldInfo.GetValue(null); + + if (consoleWindow == null) + { + logListView = null; + return false; + } + + FieldInfo listViewFieldInfo = consoleWindowType.GetField("m_ListView", BindingFlags.Instance | BindingFlags.NonPublic); + logListView = listViewFieldInfo.GetValue(consoleWindow); + logListViewCurrentRow = listViewFieldInfo.FieldType.GetField("row", BindingFlags.Instance | BindingFlags.Public); +#if UNITY_2017_1_OR_NEWER + Type logEntriesType = unityEditorAssembly.GetType("UnityEditor.LogEntries"); + LogEntriesGetEntry = logEntriesType.GetMethod("GetEntryInternal", BindingFlags.Static | BindingFlags.Public); + Type logEntryType = unityEditorAssembly.GetType("UnityEditor.LogEntry"); +#else + Type logEntriesType = unityEditorAssembly.GetType("UnityEditorInternal.LogEntries"); + LogEntriesGetEntry = logEntriesType.GetMethod("GetEntryInternal", BindingFlags.Static | BindingFlags.Public); + Type logEntryType = unityEditorAssembly.GetType("UnityEditorInternal.LogEntry"); +#endif + logEntry = Activator.CreateInstance(logEntryType); + logEntryCondition = logEntryType.GetField("condition", BindingFlags.Instance | BindingFlags.Public); + } + + return true; + } + + + private static string GetListViewRowCount(ref int line) + { + int row = (int)logListViewCurrentRow.GetValue(logListView); + LogEntriesGetEntry.Invoke(null, new object[] { row, logEntry }); + string condition = logEntryCondition.GetValue(logEntry) as string; + condition = condition.Substring(0, condition.IndexOf('\n')); + int index = condition.IndexOf(".lua:"); + + if (index >= 0) + { + int start = condition.IndexOf("["); + int end = condition.IndexOf("]:"); + string _line = condition.Substring(index + 5, end - index - 4); + Int32.TryParse(_line, out line); + return condition.Substring(start + 1, index + 3 - start); + } + + index = condition.IndexOf(".cs:"); + + if (index >= 0) + { + int start = condition.IndexOf("["); + int end = condition.IndexOf("]:"); + string _line = condition.Substring(index + 5, end - index - 4); + Int32.TryParse(_line, out line); + return condition.Substring(start + 1, index + 2 - start); + } + + return null; + } + + static void GetToLuaInstanceID() + { + if (_instanceID == -1) + { + int start = LuaConst.toluaDir.IndexOf("Assets"); + int end = LuaConst.toluaDir.LastIndexOf("/Lua"); + string dir = LuaConst.toluaDir.Substring(start, end - start); + dir += "/Core/ToLua.cs"; + _instanceID = AssetDatabase.LoadAssetAtPath(dir, typeof(MonoScript)).GetInstanceID();//"Assets/ToLua/Core/ToLua.cs" + } + } + + [OnOpenAssetAttribute(0)] + public static bool OnOpenAsset(int instanceID, int line) + { + GetToLuaInstanceID(); + + if (!GetConsoleWindowListView() || (object)EditorWindow.focusedWindow != consoleWindow) + { + return false; + } + + if (instanceID == _instanceID && line == _line) + { + string fileName = GetListViewRowCount(ref line); + + if (fileName == null) + { + return false; + } + + if (fileName.EndsWith(".cs")) + { + string filter = fileName.Substring(0, fileName.Length - 3); + filter += " t:MonoScript"; + string[] searchPaths = AssetDatabase.FindAssets(filter); + + for (int i = 0; i < searchPaths.Length; i++) + { + string path = AssetDatabase.GUIDToAssetPath(searchPaths[i]); + + if (path.EndsWith(fileName)) + { + UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath(path, typeof(MonoScript)); + AssetDatabase.OpenAsset(obj, line); + return true; + } + } + } + else + { + string filter = fileName.Substring(0, fileName.Length - 4); + int index = filter.IndexOf("/"); + if (index > 0) + { + filter = filter.Substring(index + 1); + } + string[] searchPaths = AssetDatabase.FindAssets(filter); + + for (int i = 0; i < searchPaths.Length; i++) + { + string path = AssetDatabase.GUIDToAssetPath(searchPaths[i]); + + if (path.EndsWith(fileName) || path.EndsWith(fileName + ".bytes")) + { + UnityEngine.Object obj = AssetDatabase.LoadMainAssetAtPath(path); + AssetDatabase.OpenAsset(obj, line); + return true; + } + } + + } + } + + return false; + } +#endif +#endregion + /*-------------------------------------------------------------------------------------------*/ + + public static string ToString(IntPtr L, int stackPos) + { + LuaTypes luaType = LuaDLL.lua_type(L, stackPos); + + switch (luaType) + { + case LuaTypes.LUA_TSTRING: + return LuaDLL.lua_tostring(L, stackPos); + case LuaTypes.LUA_TUSERDATA: + return (string)ToObject(L, stackPos); + default: + return null; + } + } + + public static object ToObject(IntPtr L, int stackPos) + { + int udata = LuaDLL.tolua_rawnetobj(L, stackPos); + + if (udata != -1) + { + ObjectTranslator translator = ObjectTranslator.Get(L); + return translator.GetObject(udata); + } + + return null; + } + + public static LuaFunction ToLuaFunction(IntPtr L, int stackPos) + { + LuaTypes type = LuaDLL.lua_type(L, stackPos); + + if (type == LuaTypes.LUA_TNIL) + { + return null; + } + + stackPos = LuaDLL.abs_index(L, stackPos); + LuaDLL.lua_pushvalue(L, stackPos); + int reference = LuaDLL.toluaL_ref(L); + return LuaStatic.GetFunction(L, reference); + } + + public static LuaTable ToLuaTable(IntPtr L, int stackPos) + { + LuaTypes type = LuaDLL.lua_type(L, stackPos); + + if (type == LuaTypes.LUA_TNIL) + { + return null; + } + + stackPos = LuaDLL.abs_index(L, stackPos); + LuaDLL.lua_pushvalue(L, stackPos); + int reference = LuaDLL.toluaL_ref(L); + return LuaStatic.GetTable(L, reference); + } + + public static LuaThread ToLuaThread(IntPtr L, int stackPos) + { + LuaTypes type = LuaDLL.lua_type(L, stackPos); + + if (type == LuaTypes.LUA_TNIL) + { + return null; + } + + stackPos = LuaDLL.abs_index(L, stackPos); + LuaDLL.lua_pushvalue(L, stackPos); + int reference = LuaDLL.toluaL_ref(L); + return LuaStatic.GetLuaThread(L, reference); + } + + public static Vector3 ToVector3(IntPtr L, int stackPos) + { + float x = 0, y = 0, z = 0; + LuaDLL.tolua_getvec3(L, stackPos, out x, out y, out z); + return new Vector3(x, y, z); + } + + public static Vector4 ToVector4(IntPtr L, int stackPos) + { + float x, y, z, w; + LuaDLL.tolua_getvec4(L, stackPos, out x, out y, out z, out w); + return new Vector4(x, y, z, w); + } + + public static Vector2 ToVector2(IntPtr L, int stackPos) + { + float x, y; + LuaDLL.tolua_getvec2(L, stackPos, out x, out y); + return new Vector2(x, y); + } + + public static Quaternion ToQuaternion(IntPtr L, int stackPos) + { + float x, y, z, w; + LuaDLL.tolua_getquat(L, stackPos, out x, out y, out z, out w); + return new Quaternion(x, y, z, w); + } + + public static Color ToColor(IntPtr L, int stackPos) + { + float r, g, b, a; + LuaDLL.tolua_getclr(L, stackPos, out r, out g, out b, out a); + return new Color(r, g, b, a); + } + + public static Ray ToRay(IntPtr L, int stackPos) + { + int top = LuaDLL.lua_gettop(L); + LuaStatic.GetUnpackRayRef(L); + stackPos = LuaDLL.abs_index(L, stackPos); + LuaDLL.lua_pushvalue(L, stackPos); + + if (LuaDLL.lua_pcall(L, 1, 6, 0) == 0) + { + float ox = (float)LuaDLL.lua_tonumber(L, top + 1); + float oy = (float)LuaDLL.lua_tonumber(L, top + 2); + float oz = (float)LuaDLL.lua_tonumber(L, top + 3); + float dx = (float)LuaDLL.lua_tonumber(L, top + 4); + float dy = (float)LuaDLL.lua_tonumber(L, top + 5); + float dz = (float)LuaDLL.lua_tonumber(L, top + 6); + LuaDLL.lua_settop(L, top); + return new Ray(new Vector3(ox, oy, oz), new Vector3(dx, dy, dz)); + } + else + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_settop(L, top); + throw new LuaException(error); + } + } + + public static Bounds ToBounds(IntPtr L, int stackPos) + { + int top = LuaDLL.lua_gettop(L); + LuaStatic.GetUnpackBounds(L); + stackPos = LuaDLL.abs_index(L, stackPos); + LuaDLL.lua_pushvalue(L, stackPos); + + if (LuaDLL.lua_pcall(L, 1, 2, 0) == 0) + { + Vector3 center = ToVector3(L, top + 1); + Vector3 size = ToVector3(L, top + 2); + LuaDLL.lua_settop(L, top); + return new Bounds(center, size); + } + else + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_settop(L, top); + throw new LuaException(error); + } + } + + public static LayerMask ToLayerMask(IntPtr L, int stackPos) + { + return LuaDLL.tolua_getlayermask(L, stackPos); + } + + public static object ToVarObject(IntPtr L, int stackPos) + { + LuaTypes type = LuaDLL.lua_type(L, stackPos); + + switch (type) + { + case LuaTypes.LUA_TNUMBER: + return LuaDLL.lua_tonumber(L, stackPos); + case LuaTypes.LUA_TSTRING: + return LuaDLL.lua_tostring(L, stackPos); + case LuaTypes.LUA_TUSERDATA: + switch(LuaDLL.tolua_getvaluetype(L, stackPos)) + { + case LuaValueType.Int64: + return LuaDLL.tolua_toint64(L, stackPos); + case LuaValueType.UInt64: + return LuaDLL.tolua_touint64(L, stackPos); + default: + return ToObject(L, stackPos); + } + case LuaTypes.LUA_TBOOLEAN: + return LuaDLL.lua_toboolean(L, stackPos); + case LuaTypes.LUA_TFUNCTION: + return ToLuaFunction(L, stackPos); + case LuaTypes.LUA_TTABLE: + return ToVarTable(L, stackPos); + case LuaTypes.LUA_TNIL: + return null; + case LuaTypes.LUA_TLIGHTUSERDATA: + return LuaDLL.lua_touserdata(L, stackPos); + case LuaTypes.LUA_TTHREAD: + return ToLuaThread(L, stackPos); + default: + return null; + } + } + + //for Generic Array and List, 杞崲double涓烘寚瀹歵ype鍦ㄥ瓨鍏bject + public static object ToVarObject(IntPtr L, int stackPos, Type t) + { + LuaTypes type = LuaDLL.lua_type(L, stackPos); + + if (type == LuaTypes.LUA_TNUMBER) + { + object o = LuaDLL.lua_tonumber(L, stackPos); + o = Convert.ChangeType(o, t); + return o; + } + + return ToVarObject(L, stackPos); + } + + public static object ToVarTable(IntPtr L, int stackPos) + { + stackPos = LuaDLL.abs_index(L, stackPos); + int ret = LuaDLL.tolua_getvaluetype(L, stackPos); + LuaTableToVar _ToObject = ToVarMap[ret]; + + if (_ToObject != null) + { + return _ToObject(L, stackPos); + } + else + { + LuaDLL.lua_pushvalue(L, stackPos); + int reference = LuaDLL.toluaL_ref(L); + return LuaStatic.GetTable(L, reference); + } + } + + public static Nullable ToNullable(IntPtr L, int stackPos) where T : struct + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + return StackTraits.To(L, stackPos); + } + + static object ToObjectVec3(IntPtr L, int stackPos) + { + return ToVector3(L, stackPos); + } + + static object ToObjectQuat(IntPtr L, int stackPos) + { + return ToQuaternion(L, stackPos); + } + + static object ToObjectColor(IntPtr L, int stackPos) + { + return ToColor(L, stackPos); + } + + static object ToObjectVec4(IntPtr L, int stackPos) + { + return ToVector4(L, stackPos); + } + + static object ToObjectVec2(IntPtr L, int stackPos) + { + return ToVector2(L, stackPos); + } + + static object ToObjectRay(IntPtr L, int stackPos) + { + return ToRay(L, stackPos); + } + + static object ToObjectLayerMask(IntPtr L, int stackPos) + { + return ToLayerMask(L, stackPos); + } + + static object ToObjectBounds(IntPtr L, int stackPos) + { + return ToBounds(L, stackPos); + } + + public static LuaFunction CheckLuaFunction(IntPtr L, int stackPos) + { + LuaTypes luaType = LuaDLL.lua_type(L, stackPos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return null; + case LuaTypes.LUA_TFUNCTION: + stackPos = LuaDLL.abs_index(L, stackPos); + LuaDLL.lua_pushvalue(L, stackPos); + int reference = LuaDLL.toluaL_ref(L); + return LuaStatic.GetFunction(L, reference); + default: + LuaDLL.luaL_typerror(L, stackPos, "function"); + return null; + } + } + + public static LuaTable CheckLuaTable(IntPtr L, int stackPos) + { + LuaTypes luaType = LuaDLL.lua_type(L, stackPos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return null; + case LuaTypes.LUA_TTABLE: + stackPos = LuaDLL.abs_index(L, stackPos); + LuaDLL.lua_pushvalue(L, stackPos); + int reference = LuaDLL.toluaL_ref(L); + return LuaStatic.GetTable(L, reference); + default: + LuaDLL.luaL_typerror(L, stackPos, "table"); + return null; + } + } + + public static LuaThread CheckLuaThread(IntPtr L, int stackPos) + { + LuaTypes luaType = LuaDLL.lua_type(L, stackPos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return null; + case LuaTypes.LUA_TTHREAD: + stackPos = LuaDLL.abs_index(L, stackPos); + LuaDLL.lua_pushvalue(L, stackPos); + int reference = LuaDLL.toluaL_ref(L); + return LuaStatic.GetLuaThread(L, reference); + default: + LuaDLL.luaL_typerror(L, stackPos, "thread"); + return null; + } + } + + public static LuaBaseRef CheckLuaBaseRef(IntPtr L, int stackPos) + { + LuaTypes luaType = LuaDLL.lua_type(L, stackPos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return null; + case LuaTypes.LUA_TFUNCTION: + stackPos = LuaDLL.abs_index(L, stackPos); + LuaDLL.lua_pushvalue(L, stackPos); + int ref1 = LuaDLL.toluaL_ref(L); + return LuaStatic.GetFunction(L, ref1); + case LuaTypes.LUA_TTABLE: + stackPos = LuaDLL.abs_index(L, stackPos); + LuaDLL.lua_pushvalue(L, stackPos); + int ref2 = LuaDLL.toluaL_ref(L); + return LuaStatic.GetTable(L, ref2); + case LuaTypes.LUA_TTHREAD: + stackPos = LuaDLL.abs_index(L, stackPos); + LuaDLL.lua_pushvalue(L, stackPos); + int ref3 = LuaDLL.toluaL_ref(L); + return LuaStatic.GetLuaThread(L, ref3); + default: + LuaDLL.luaL_typerror(L, stackPos, "function or table or thread"); + return null; + } + } + + public static string CheckString(IntPtr L, int stackPos) + { + LuaTypes luaType = LuaDLL.lua_type(L, stackPos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return null; + case LuaTypes.LUA_TNUMBER: + return LuaDLL.lua_tostring(L, stackPos); + case LuaTypes.LUA_TSTRING: + return LuaDLL.lua_tostring(L, stackPos); + case LuaTypes.LUA_TUSERDATA: + int udata = LuaDLL.tolua_rawnetobj(L, stackPos); + + if (udata != -1) + { + ObjectTranslator translator = ObjectTranslator.Get(L); + object obj = translator.GetObject(udata); + + if (obj != null) + { + if (obj is string) + { + return (string)obj; + } + + LuaDLL.luaL_argerror(L, stackPos, string.Format("string expected, got {0}", obj.GetType().FullName)); + } + + return null; + } + + break; + } + + LuaDLL.luaL_typerror(L, stackPos, "string"); + return null; + } + + public static IntPtr CheckIntPtr(IntPtr L, int stackPos) + { + LuaTypes luaType = LuaDLL.lua_type(L, stackPos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return IntPtr.Zero; + case LuaTypes.LUA_TLIGHTUSERDATA: + return LuaDLL.lua_touserdata(L, stackPos); + default: + LuaDLL.luaL_typerror(L, stackPos, "IntPtr"); + return IntPtr.Zero; + } + } + + static public Type CheckMonoType(IntPtr L, int stackPos) + { + int udata = LuaDLL.tolua_rawnetobj(L, stackPos); + + if (udata != -1) + { + ObjectTranslator translator = ObjectTranslator.Get(L); + object obj = translator.GetObject(udata); + + if (obj != null) + { + if (obj is Type) + { + return (Type)obj; + } + + LuaDLL.luaL_argerror(L, stackPos, string.Format("Type expected, got {0}", obj.GetType().FullName)); + } + + return null; + } + else if (LuaDLL.lua_isnil(L, stackPos)) + { + return null; + } + + LuaDLL.luaL_typerror(L, stackPos, "Type"); + return null; + } + + public static IEnumerator CheckIter(IntPtr L, int stackPos) + { + int udata = LuaDLL.tolua_rawnetobj(L, stackPos); + + if (udata != -1) + { + ObjectTranslator translator = ObjectTranslator.Get(L); + object obj = translator.GetObject(udata); + + if (obj != null) + { + if (obj is IEnumerator) + { + return (IEnumerator)obj; + } + + LuaDLL.luaL_argerror(L, stackPos, string.Format("Type expected, got {0}", obj.GetType().FullName)); + } + + return null; + } + else if (LuaDLL.lua_isnil(L, stackPos)) + { + return null; + } + + LuaDLL.luaL_typerror(L, stackPos, "Type"); + return null; + } + + public static object CheckObject(IntPtr L, int stackPos) + { + int udata = LuaDLL.tolua_rawnetobj(L, stackPos); + + if (udata != -1) + { + ObjectTranslator translator = ObjectTranslator.Get(L); + return translator.GetObject(udata); + } + else if (LuaDLL.lua_isnil(L, stackPos)) + { + return null; + } + + LuaDLL.luaL_typerror(L, stackPos, "object"); + return null; + } + + public static object CheckObject(IntPtr L, int stackPos, Type type) + { + int udata = LuaDLL.tolua_rawnetobj(L, stackPos); + + if (udata != -1) + { + ObjectTranslator translator = ObjectTranslator.Get(L); + object obj = translator.GetObject(udata); + + if (obj != null) + { + Type objType = obj.GetType(); + + if (type == objType || type.IsAssignableFrom(objType)) + { + return obj; + } + + LuaDLL.luaL_argerror(L, stackPos, string.Format("{0} expected, got {1}", LuaMisc.GetTypeName(type), LuaMisc.GetTypeName(objType))); + } + + return null; + } + else if (LuaDLL.lua_isnil(L, stackPos)) + { + return null; + } + + LuaDLL.luaL_typerror(L, stackPos, LuaMisc.GetTypeName(type)); + return null; + } + + public static object CheckObject(IntPtr L, int stackPos) where T : class + { + int udata = LuaDLL.tolua_rawnetobj(L, stackPos); + + if (udata != -1) + { + ObjectTranslator translator = ObjectTranslator.Get(L); + object obj = translator.GetObject(udata); + + if (obj != null) + { + Type objType = obj.GetType(); + + if (obj is T) + { + return obj; + } + + LuaDLL.luaL_argerror(L, stackPos, string.Format("{0} expected, got {1}", TypeTraits.GetTypeName(), objType.FullName)); + } + + return null; + } + else if (LuaDLL.lua_isnil(L, stackPos)) + { + return null; + } + + LuaDLL.luaL_typerror(L, stackPos, TypeTraits.GetTypeName()); + return null; + } + + static public Vector3 CheckVector3(IntPtr L, int stackPos) + { + int type = LuaDLL.tolua_getvaluetype(L, stackPos); + + if (type != LuaValueType.Vector3) + { + LuaDLL.luaL_typerror(L, stackPos, "Vector3", LuaValueTypeName.Get(type)); + return Vector3.zero; + } + + float x, y, z; + LuaDLL.tolua_getvec3(L, stackPos, out x, out y, out z); + return new Vector3(x, y, z); + } + + static public Quaternion CheckQuaternion(IntPtr L, int stackPos) + { + int type = LuaDLL.tolua_getvaluetype(L, stackPos); + + if (type != LuaValueType.Quaternion) + { + LuaDLL.luaL_typerror(L, stackPos, "Quaternion", LuaValueTypeName.Get(type)); + return Quaternion.identity; + } + + float x, y, z, w; + LuaDLL.tolua_getquat(L, stackPos, out x, out y, out z, out w); + return new Quaternion(x, y, z, w); + } + + static public Vector2 CheckVector2(IntPtr L, int stackPos) + { + int type = LuaDLL.tolua_getvaluetype(L, stackPos); + + if (type != LuaValueType.Vector2) + { + LuaDLL.luaL_typerror(L, stackPos, "Vector2", LuaValueTypeName.Get(type)); + return Vector2.zero; + } + + float x, y; + LuaDLL.tolua_getvec2(L, stackPos, out x, out y); + return new Vector2(x, y); + } + + static public Vector4 CheckVector4(IntPtr L, int stackPos) + { + int type = LuaDLL.tolua_getvaluetype(L, stackPos); + + if (type != LuaValueType.Vector4) + { + LuaDLL.luaL_typerror(L, stackPos, "Vector4", LuaValueTypeName.Get(type)); + return Vector4.zero; + } + + float x, y, z, w; + LuaDLL.tolua_getvec4(L, stackPos, out x, out y, out z, out w); + return new Vector4(x, y, z, w); + } + + static public Color CheckColor(IntPtr L, int stackPos) + { + int type = LuaDLL.tolua_getvaluetype(L, stackPos); + + if (type != LuaValueType.Color) + { + LuaDLL.luaL_typerror(L, stackPos, "Color", LuaValueTypeName.Get(type)); + return Color.black; + } + + float r, g, b, a; + LuaDLL.tolua_getclr(L, stackPos, out r, out g, out b, out a); + return new Color(r, g, b, a); + } + + static public Ray CheckRay(IntPtr L, int stackPos) + { + int type = LuaDLL.tolua_getvaluetype(L, stackPos); + + if (type != LuaValueType.Ray) + { + LuaDLL.luaL_typerror(L, stackPos, "Ray", LuaValueTypeName.Get(type)); + return new Ray(); + } + + return ToRay(L, stackPos); + } + + static public Bounds CheckBounds(IntPtr L, int stackPos) + { + int type = LuaDLL.tolua_getvaluetype(L, stackPos); + + if (type != LuaValueType.Bounds) + { + LuaDLL.luaL_typerror(L, stackPos, "Bounds", LuaValueTypeName.Get(type)); + return new Bounds(); + } + + return ToBounds(L, stackPos); + } + + static public LayerMask CheckLayerMask(IntPtr L, int stackPos) + { + int type = LuaDLL.tolua_getvaluetype(L, stackPos); + + if (type != LuaValueType.LayerMask) + { + LuaDLL.luaL_typerror(L, stackPos, "LayerMask", LuaValueTypeName.Get(type)); + return 0; + } + + return LuaDLL.tolua_getlayermask(L, stackPos); + } + + public static T CheckValue(IntPtr L, int stackPos) where T : struct + { + return StackTraits.Check(L, stackPos); + } + + public static Nullable CheckNullable(IntPtr L, int stackPos) where T : struct + { + if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL) + { + return null; + } + + return StackTraits.Check(L, stackPos); + } + + public static object CheckVarObject(IntPtr L, int stackPos, Type t) + { + bool beValue = TypeChecker.IsValueType(t); + LuaTypes luaType = LuaDLL.lua_type(L, stackPos); + + if (!beValue && luaType == LuaTypes.LUA_TNIL) + { + return null; + } + + if (beValue) + { + if (TypeChecker.IsNullable(t)) + { + if (luaType == LuaTypes.LUA_TNIL) + { + return null; + } + + Type[] ts = t.GetGenericArguments(); + t = ts[0]; + } + + if (t == typeof(bool)) + { + return LuaDLL.luaL_checkboolean(L, stackPos); + } + else if (t == typeof(long)) + { + return LuaDLL.tolua_checkint64(L, stackPos); + } + else if (t == typeof(ulong)) + { + return LuaDLL.tolua_checkuint64(L, stackPos); + } + else if (t.IsPrimitive) + { + double d = LuaDLL.luaL_checknumber(L, stackPos); + return Convert.ChangeType(d, t); + } + else if (t == typeof(LuaByteBuffer)) + { + int len = 0; + IntPtr source = LuaDLL.tolua_tolstring(L, stackPos, out len); + return new LuaByteBuffer(source, len); + } + else if (t == typeof(Vector3)) + { + return CheckVector3(L, stackPos); + } + else if (t == typeof(Quaternion)) + { + return CheckQuaternion(L, stackPos); + } + else if (t == typeof(Vector2)) + { + return CheckVector2(L, stackPos); + } + else if (t == typeof(Vector4)) + { + return CheckVector4(L, stackPos); + } + else if (t == typeof(Color)) + { + return CheckColor(L, stackPos); + } + else if (t == typeof(Ray)) + { + return CheckRay(L, stackPos); + } + else if (t == typeof(Bounds)) + { + return CheckBounds(L, stackPos); + } + else if (t == typeof(LayerMask)) + { + return CheckLayerMask(L, stackPos); + } + else + { + if (luaType == LuaTypes.LUA_TTABLE) + { + object o = ToVarTable(L, stackPos); + + if (o.GetType() != t) + { + LuaDLL.luaL_typerror(L, stackPos, LuaMisc.GetTypeName(t)); + } + + return o; + } + else + { + return CheckObject(L, stackPos, t); + } + } + } + else + { + if (t.IsEnum) + { + return ToLua.CheckObject(L, stackPos, t); + } + else if ( t == typeof(string)) + { + return CheckString(L, stackPos); + } + else + { + return CheckObject(L, stackPos, t); + } + } + } + + public static UnityEngine.Object CheckUnityObject(IntPtr L, int stackPos, Type type) + { + int udata = LuaDLL.tolua_rawnetobj(L, stackPos); + object obj = null; + + if (udata != -1) + { + ObjectTranslator translator = ObjectTranslator.Get(L); + obj = translator.GetObject(udata); + + if (obj != null) + { + UnityEngine.Object uObj = (UnityEngine.Object)obj; + + if (uObj == null) + { + LuaDLL.luaL_argerror(L, stackPos, string.Format("{0} expected, got nil", type.FullName)); + return null; + } + + Type objType = uObj.GetType(); + + if (type == objType || objType.IsSubclassOf(type)) + { + return uObj; + } + + LuaDLL.luaL_argerror(L, stackPos, string.Format("{0} expected, got {1}", type.FullName, objType.FullName)); + } + + //浼犻掍簡tolua.null杩囨潵 + return null; + } + else if (LuaDLL.lua_isnil(L, stackPos)) + { + return null; + } + + LuaDLL.luaL_typerror(L, stackPos, type.FullName); + return null; + } + + public static UnityEngine.TrackedReference CheckTrackedReference(IntPtr L, int stackPos, Type type) + { + int udata = LuaDLL.tolua_rawnetobj(L, stackPos); + object obj = null; + + if (udata != -1) + { + ObjectTranslator translator = ObjectTranslator.Get(L); + obj = translator.GetObject(udata); + + if (obj != null) + { + UnityEngine.TrackedReference uObj = (UnityEngine.TrackedReference)obj; + + if (uObj == null) + { + LuaDLL.luaL_argerror(L, stackPos, string.Format("{0} expected, got nil", type.FullName)); + return null; + } + + Type objType = uObj.GetType(); + + if (type == objType || objType.IsSubclassOf(type)) + { + return uObj; + } + + LuaDLL.luaL_argerror(L, stackPos, string.Format("{0} expected, got {1}", type.FullName, objType.FullName)); + } + + return null; + } + else if (LuaDLL.lua_isnil(L, stackPos)) + { + return null; + } + + LuaDLL.luaL_typerror(L, stackPos, type.FullName); + return null; + } + + //蹇呴』妫娴嬬被鍨 + public static object[] CheckObjectArray(IntPtr L, int stackPos) + { + LuaTypes luatype = LuaDLL.lua_type(L, stackPos); + + switch (luatype) + { + case LuaTypes.LUA_TNIL: + return null; + case LuaTypes.LUA_TTABLE: + int len = LuaDLL.lua_objlen(L, stackPos); + object[] list = new object[len]; + int pos = LuaDLL.lua_gettop(L) + 1; + + for (int i = 1; i <= len; i++) + { + LuaDLL.lua_rawgeti(L, stackPos, i); + list[i - 1] = ToVarObject(L, pos); + LuaDLL.lua_pop(L, 1); + } + return list; + case LuaTypes.LUA_TUSERDATA: + return (object[])CheckObject(L, stackPos, typeof(object[])); + default: + LuaDLL.luaL_typerror(L, stackPos, "object[] or table"); + return null; + } + } + + public static T[] CheckObjectArray(IntPtr L, int stackPos) where T : class + { + LuaTypes luatype = LuaDLL.lua_type(L, stackPos); + + switch(luatype) + { + case LuaTypes.LUA_TNIL: + return null; + case LuaTypes.LUA_TTABLE: + int len = LuaDLL.lua_objlen(L, stackPos); + T[] list = new T[len]; + int pos = LuaDLL.lua_gettop(L) + 1; + + for (int i = 1; i <= len; i++) + { + LuaDLL.lua_rawgeti(L, stackPos, i); + + if (!TypeTraits.Check(L, pos)) + { + LuaDLL.lua_pop(L, 1); + LuaDLL.luaL_typerror(L, stackPos, typeof(T[]).FullName); + return list; + } + + list[i - 1] = StackTraits.To(L, pos); + LuaDLL.lua_pop(L, 1); + } + return list; + case LuaTypes.LUA_TUSERDATA: + return (T[])CheckObject(L, stackPos, typeof(T[])); + default: + LuaDLL.luaL_typerror(L, stackPos, TypeTraits.GetTypeName()); + return null; + } + } + + public static T[] CheckStructArray(IntPtr L, int stackPos) where T : struct + { + LuaTypes luatype = LuaDLL.lua_type(L, stackPos); + + switch (luatype) + { + case LuaTypes.LUA_TTABLE: + int len = LuaDLL.lua_objlen(L, stackPos); + T[] list = new T[len]; + int pos = LuaDLL.lua_gettop(L) + 1; + + for (int i = 1; i <= len; i++) + { + LuaDLL.lua_rawgeti(L, stackPos, i); + + if (!TypeTraits.Check(L, pos)) + { + LuaDLL.lua_pop(L, 1); + LuaDLL.luaL_typerror(L, stackPos, typeof(T[]).FullName); + return list; + } + + list[i-1] = StackTraits.To(L, pos); + LuaDLL.lua_pop(L, 1); + } + return list; + case LuaTypes.LUA_TUSERDATA: + return (T[])CheckObject(L, stackPos, typeof(T[])); + default: + LuaDLL.luaL_typerror(L, stackPos, TypeTraits.GetTypeName()); + return null; + } + } + + public static char[] CheckCharBuffer(IntPtr L, int stackPos) + { + LuaTypes luaType = LuaDLL.lua_type(L, stackPos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return null; + case LuaTypes.LUA_TSTRING: + string str = LuaDLL.lua_tostring(L, stackPos); + return str.ToCharArray(); ; + case LuaTypes.LUA_TUSERDATA: + return (char[])CheckObject(L, stackPos, typeof(char[])); + default: + LuaDLL.luaL_typerror(L, stackPos, "string or char[]"); + return null; + } + } + + public static byte[] CheckByteBuffer(IntPtr L, int stackPos) + { + LuaTypes luaType = LuaDLL.lua_type(L, stackPos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return null; + case LuaTypes.LUA_TSTRING: + int len; + IntPtr source = LuaDLL.lua_tolstring(L, stackPos, out len); + byte[] buffer = new byte[len]; + Marshal.Copy(source, buffer, 0, len); + return buffer; + case LuaTypes.LUA_TUSERDATA: + return (byte[])CheckObject(L, stackPos, typeof(byte[])); + default: + LuaDLL.luaL_typerror(L, stackPos, "string or byte[]"); + return null; + } + } + + public static T[] CheckNumberArray(IntPtr L, int stackPos) where T : struct + { + LuaTypes luatype = LuaDLL.lua_type(L, stackPos); + + switch(luatype) + { + case LuaTypes.LUA_TNIL: + return null; + case LuaTypes.LUA_TTABLE: + int len = LuaDLL.lua_objlen(L, stackPos); + T[] list = new T[len]; + int pos = LuaDLL.lua_gettop(L) + 1; + + for (int i = 1; i <= len; i++) + { + LuaDLL.lua_rawgeti(L, stackPos, i); + + if (LuaDLL.lua_type(L, pos) != LuaTypes.LUA_TNUMBER) + { + LuaDLL.lua_pop(L, 1); + LuaDLL.luaL_typerror(L, stackPos, TypeTraits.GetTypeName()); + return list; + } + + list[i - 1] = StackTraits.To(L, pos); + LuaDLL.lua_pop(L, 1); + } + + return list; + case LuaTypes.LUA_TUSERDATA: + return (T[])CheckObject(L, stackPos, typeof(T[])); + default: + LuaDLL.luaL_typerror(L, stackPos, TypeTraits.GetTypeName()); + return null; + } + } + + + public static bool[] CheckBoolArray(IntPtr L, int stackPos) + { + LuaTypes luatype = LuaDLL.lua_type(L, stackPos); + + switch(luatype) + { + case LuaTypes.LUA_TNIL: + return null; + case LuaTypes.LUA_TTABLE: + int len = LuaDLL.lua_objlen(L, stackPos); + bool[] list = new bool[len]; + int pos = LuaDLL.lua_gettop(L) + 1; + + for (int i = 1; i <= len; i++) + { + LuaDLL.lua_rawgeti(L, stackPos, i); + + if (LuaDLL.lua_type(L, pos) != LuaTypes.LUA_TBOOLEAN) + { + LuaDLL.lua_pop(L, 1); + LuaDLL.luaL_typerror(L, stackPos, "bool[]"); + return list; + } + + list[i - 1] = LuaDLL.lua_toboolean(L, pos); + LuaDLL.lua_pop(L, 1); + } + + return list; + case LuaTypes.LUA_TUSERDATA: + return (bool[])CheckObject(L, stackPos, typeof(bool[])); + default: + LuaDLL.luaL_typerror(L, stackPos, "bool[]"); + return null; + } + } + + public static string[] CheckStringArray(IntPtr L, int stackPos) + { + LuaTypes luatype = LuaDLL.lua_type(L, stackPos); + + switch(luatype) + { + case LuaTypes.LUA_TNIL: + return null; + case LuaTypes.LUA_TTABLE: + int len = LuaDLL.lua_objlen(L, stackPos); + string[] list = new string[len]; + int pos = LuaDLL.lua_gettop(L) + 1; + + for (int i = 1; i <= len; i++) + { + LuaDLL.lua_rawgeti(L, stackPos, i); + + if (!TypeTraits.Check(L, pos)) + { + LuaDLL.lua_pop(L, 1); + LuaDLL.luaL_typerror(L, stackPos, "string[]"); + return list; + } + + list[i - 1] = StackTraits.To(L, pos); + LuaDLL.lua_pop(L, 1); + } + return list; + case LuaTypes.LUA_TUSERDATA: + return (string[])CheckObject(L, stackPos, typeof(string[])); + default: + LuaDLL.luaL_typerror(L, stackPos, "string[]"); + return null; + } + } + + public static object CheckGenericObject(IntPtr L, int stackPos, Type type, out Type ArgType) + { + object obj = ToLua.ToObject(L, 1); + Type t = obj.GetType(); + ArgType = null; + + if (t.IsGenericType && t.GetGenericTypeDefinition() == type) + { + Type[] ts = t.GetGenericArguments(); + ArgType = ts[0]; + return obj; + } + + LuaDLL.luaL_argerror(L, stackPos, LuaMisc.GetTypeName(type)); + return null; + } + + public static object CheckGenericObject(IntPtr L, int stackPos, Type type, out Type t1, out Type t2) + { + object obj = ToLua.ToObject(L, 1); + Type t = obj.GetType(); + t1 = null; + t2 = null; + + if (t.IsGenericType && t.GetGenericTypeDefinition() == type) + { + Type[] ts = t.GetGenericArguments(); + t1 = ts[0]; + t2 = ts[1]; + return obj; + } + + LuaDLL.luaL_argerror(L, stackPos, LuaMisc.GetTypeName(type)); + return null; + } + + public static object CheckGenericObject(IntPtr L, int stackPos, Type type) + { + object obj = ToLua.ToObject(L, 1); + Type t = obj.GetType(); + + if (t.IsGenericType && t.GetGenericTypeDefinition() == type) + { + return obj; + } + + LuaDLL.luaL_argerror(L, stackPos, LuaMisc.GetTypeName(type)); + return null; + } + + public static object[] ToParamsObject(IntPtr L, int stackPos, int count) + { + if (count <= 0) + { + return null; + } + + object[] list = new object[count]; + int pos = 0; + + while (pos < count) + { + list[pos++] = ToVarObject(L, stackPos++); + } + + return list; + } + + public static T[] ToParamsObject(IntPtr L, int stackPos, int count) + { + if (count <= 0) + { + return null; + } + + T[] list = new T[count]; + int pos = 0; + + while (pos < count) + { + list[pos++] = StackTraits.To(L, stackPos++); + } + + return list; + } + + public static string[] ToParamsString(IntPtr L, int stackPos, int count) + { + if (count <= 0) + { + return null; + } + + string[] list = new string[count]; + int pos = 0; + + while (pos < count) + { + list[pos++] = ToString(L, stackPos++); + } + + return list; + } + + public static T[] ToParamsNumber(IntPtr L, int stackPos, int count) where T : struct + { + if (count <= 0) + { + return null; + } + + T[] list = new T[count]; + int pos = 0; + + while (pos < count) + { + list[pos++] = StackTraits.To(L, stackPos++); + } + + return list; + } + + public static char[] ToParamsChar(IntPtr L, int stackPos, int count) + { + if (count <= 0) + { + return null; + } + + char[] list = new char[count]; + int pos = 0; + + while (pos < count) + { + list[pos++] = (char)LuaDLL.lua_tointeger(L, stackPos++); + } + + return list; + } + + public static bool[] CheckParamsBool(IntPtr L, int stackPos, int count) + { + if (count <= 0) + { + return null; + } + + bool[] list = new bool[count]; + int pos = 0; + + while (pos < count) + { + list[pos++] = LuaDLL.luaL_checkboolean(L, stackPos++); + } + + return list; + } + + public static T[] CheckParamsNumber(IntPtr L, int stackPos, int count) where T : struct + { + if (count <= 0) + { + return null; + } + + T[] list = new T[count]; + int pos = 0; + + while (pos < count) + { + list[pos++] = StackTraits.Check(L, stackPos++); + } + + return list; + } + + public static char[] CheckParamsChar(IntPtr L, int stackPos, int count) + { + if (count <= 0) + { + return null; + } + + char[] list = new char[count]; + int pos = 0; + + while (pos < count) + { + list[pos++] = (char)LuaDLL.luaL_checkinteger(L, stackPos++); + } + + return list; + } + + public static string[] CheckParamsString(IntPtr L, int stackPos, int count) + { + if (count <= 0) + { + return null; + } + + string[] list = new string[count]; + int pos = 0; + + while (pos < count) + { + list[pos++] = CheckString(L, stackPos++); + } + + return list; + } + + public static T[] CheckParamsObject(IntPtr L, int stackPos, int count) + { + if (count <= 0) + { + return null; + } + + T[] list = new T[count]; + int pos = 0; + + while (pos < count) + { + list[pos++] = StackTraits.Check(L, stackPos++); + } + + return list; + } + + static public char[] ToCharBuffer(IntPtr L, int stackPos) + { + LuaTypes luaType = LuaDLL.lua_type(L, stackPos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return null; + case LuaTypes.LUA_TSTRING: + string str = LuaDLL.lua_tostring(L, stackPos); + return str.ToCharArray(); + case LuaTypes.LUA_TUSERDATA: + return (char[])ToObject(L, stackPos); + default: + return null; + } + } + + static public byte[] ToByteBuffer(IntPtr L, int stackPos) + { + LuaTypes luaType = LuaDLL.lua_type(L, stackPos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return null; + case LuaTypes.LUA_TSTRING: + int len; + IntPtr source = LuaDLL.lua_tolstring(L, stackPos, out len); + byte[] buffer = new byte[len]; + Marshal.Copy(source, buffer, 0, len); + return buffer; + case LuaTypes.LUA_TUSERDATA: + return (byte[])ToObject(L, stackPos); + default: + return null; + } + } + + public static T[] ToNumberArray(IntPtr L, int stackPos) where T : struct + { + LuaTypes luatype = LuaDLL.lua_type(L, stackPos); + + switch (luatype) + { + case LuaTypes.LUA_TNIL: + return null; + case LuaTypes.LUA_TTABLE: + int len = LuaDLL.lua_objlen(L, stackPos); + T[] list = new T[len]; + int pos = LuaDLL.lua_gettop(L) + 1; + + for (int i = 1; i <= len; i++) + { + LuaDLL.lua_rawgeti(L, stackPos, i); + + if (LuaDLL.lua_type(L, pos) != LuaTypes.LUA_TNUMBER) + { + LuaDLL.lua_pop(L, 1); + LuaDLL.luaL_typerror(L, stackPos, TypeTraits.GetTypeName()); + return list; + } + + list[i - 1] = StackTraits.To(L, pos); + LuaDLL.lua_pop(L, 1); + } + + return list; + case LuaTypes.LUA_TUSERDATA: + return (T[])ToObject(L, stackPos); + default: + return null; + } + } + + public static bool[] ToBoolArray(IntPtr L, int stackPos) + { + LuaTypes luatype = LuaDLL.lua_type(L, stackPos); + + switch (luatype) + { + case LuaTypes.LUA_TNIL: + return null; + case LuaTypes.LUA_TTABLE: + int len = LuaDLL.lua_objlen(L, stackPos); + bool[] list = new bool[len]; + int pos = LuaDLL.lua_gettop(L) + 1; + + for (int i = 1; i <= len; i++) + { + LuaDLL.lua_rawgeti(L, stackPos, i); + + if (LuaDLL.lua_type(L, pos) != LuaTypes.LUA_TBOOLEAN) + { + LuaDLL.lua_pop(L, 1); + LuaDLL.luaL_typerror(L, stackPos, "bool[]"); + return list; + } + + list[i - 1] = LuaDLL.lua_toboolean(L, pos); + LuaDLL.lua_pop(L, 1); + } + + return list; + case LuaTypes.LUA_TUSERDATA: + return (bool[])ToObject(L, stackPos); + default: + return null; + } + } + + + public static string[] ToStringArray(IntPtr L, int stackPos) + { + LuaTypes luatype = LuaDLL.lua_type(L, stackPos); + + switch(luatype) + { + case LuaTypes.LUA_TNIL: + return null; + case LuaTypes.LUA_TTABLE: + int len = LuaDLL.lua_objlen(L, stackPos); + string[] list = new string[len]; + int pos = LuaDLL.lua_gettop(L) + 1; + + for (int i = 1; i <= len; i++) + { + LuaDLL.lua_rawgeti(L, stackPos, i); + + if (!TypeTraits.Check(L, pos)) + { + LuaDLL.lua_pop(L, 1); + LuaDLL.luaL_typerror(L, stackPos, "string[]"); + return list; + } + + list[i - 1] = StackTraits.To(L, pos); + LuaDLL.lua_pop(L, 1); + } + return list; + case LuaTypes.LUA_TUSERDATA: + return (string[])ToObject(L, stackPos); + default: + return null; + } + } + + public static object[] ToObjectArray(IntPtr L, int stackPos) + { + LuaTypes luatype = LuaDLL.lua_type(L, stackPos); + + switch(luatype) + { + case LuaTypes.LUA_TNIL: + return null; + case LuaTypes.LUA_TTABLE: + int len = LuaDLL.lua_objlen(L, stackPos); + object[] list = new object[len]; + int pos = LuaDLL.lua_gettop(L) + 1; + + for (int i = 1; i <= len; i++) + { + LuaDLL.lua_rawgeti(L, stackPos, i); + list[i - 1] = ToVarObject(L, pos); + LuaDLL.lua_pop(L, 1); + } + return list; + case LuaTypes.LUA_TUSERDATA: + return (object[])ToObject(L, stackPos); + default: + return null; + } + } + + + public static T[] ToObjectArray(IntPtr L, int stackPos) where T : class + { + LuaTypes luatype = LuaDLL.lua_type(L, stackPos); + + switch (luatype) + { + case LuaTypes.LUA_TNIL: + return null; + case LuaTypes.LUA_TTABLE: + int len = LuaDLL.lua_objlen(L, stackPos); + T[] list = new T[len]; + int pos = LuaDLL.lua_gettop(L) + 1; + + for (int i = 1; i <= len; i++) + { + LuaDLL.lua_rawgeti(L, stackPos, i); + + if (!TypeTraits.Check(L, pos)) + { + LuaDLL.lua_pop(L, 1); + LuaDLL.luaL_typerror(L, stackPos, typeof(T[]).FullName); + return list; + } + + list[i - 1] = StackTraits.To(L, pos); + LuaDLL.lua_pop(L, 1); + } + return list; + case LuaTypes.LUA_TUSERDATA: + return (T[])ToObject(L, stackPos); + default: + return null; + } + } + + + public static T[] ToStructArray(IntPtr L, int stackPos) where T : struct + { + LuaTypes luatype = LuaDLL.lua_type(L, stackPos); + + switch (luatype) + { + case LuaTypes.LUA_TNIL: + return null; + case LuaTypes.LUA_TTABLE: + int len = LuaDLL.lua_objlen(L, stackPos); + T[] list = new T[len]; + int pos = LuaDLL.lua_gettop(L) + 1; + + for (int i = 1; i <= len; i++) + { + LuaDLL.lua_rawgeti(L, stackPos, i); + + if (!TypeTraits.Check(L, pos)) + { + LuaDLL.lua_pop(L, 1); + LuaDLL.luaL_typerror(L, stackPos, typeof(T[]).FullName); + return list; + } + + list[i - 1] = StackTraits.To(L, pos); + LuaDLL.lua_pop(L, 1); + } + return list; + case LuaTypes.LUA_TUSERDATA: + return (T[])ToObject(L, stackPos); + default: + return null; + } + } + + + public static void Push(IntPtr L, Vector3 v3) + { + LuaDLL.tolua_pushvec3(L, v3.x, v3.y, v3.z); + } + + public static void Push(IntPtr L, Vector2 v2) + { + LuaDLL.tolua_pushvec2(L, v2.x, v2.y); + } + + public static void Push(IntPtr L, Vector4 v4) + { + LuaDLL.tolua_pushvec4(L, v4.x, v4.y, v4.z, v4.w); + } + + public static void Push(IntPtr L, Quaternion q) + { + LuaDLL.tolua_pushquat(L, q.x, q.y, q.z, q.w); + } + + public static void Push(IntPtr L, Color clr) + { + LuaDLL.tolua_pushclr(L, clr.r, clr.g, clr.b, clr.a); + } + + public static void Push(IntPtr L, Ray ray) + { + LuaStatic.GetPackRay(L); + Push(L, ray.direction); + Push(L, ray.origin); + + if (LuaDLL.lua_pcall(L, 2, 1, 0) != 0) + { + string error = LuaDLL.lua_tostring(L, -1); + throw new LuaException(error); + } + } + + public static void Push(IntPtr L, Bounds bound) + { + LuaStatic.GetPackBounds(L); + Push(L, bound.center); + Push(L, bound.size); + + if (LuaDLL.lua_pcall(L, 2, 1, 0) != 0) + { + string error = LuaDLL.lua_tostring(L, -1); + throw new LuaException(error); + } + } + + public static void Push(IntPtr L, RaycastHit hit) + { + LuaStatic.GetPackRaycastHit(L); + Push(L, hit.collider); + LuaDLL.lua_pushnumber(L, hit.distance); + Push(L, hit.normal); + Push(L, hit.point); + Push(L, hit.rigidbody); + Push(L, hit.transform); + + if (LuaDLL.lua_pcall(L, 6, 1, 0) != 0) + { + string error = LuaDLL.lua_tostring(L, -1); + throw new LuaException(error); + } + } + + public static void Push(IntPtr L, RaycastHit hit, int flag) + { + LuaStatic.GetPackRaycastHit(L); + + if ((flag & RaycastBits.Collider) != 0) + { + Push(L, hit.collider); + } + else + { + LuaDLL.lua_pushnil(L); + } + + LuaDLL.lua_pushnumber(L, hit.distance); + + if ((flag & RaycastBits.Normal) != 0) + { + Push(L, hit.normal); + } + else + { + LuaDLL.lua_pushnil(L); + } + + if ((flag & RaycastBits.Point) != 0) + { + Push(L, hit.point); + } + else + { + LuaDLL.lua_pushnil(L); + } + + if ((flag & RaycastBits.Rigidbody) != 0) + { + Push(L, hit.rigidbody); + } + else + { + LuaDLL.lua_pushnil(L); + } + + if ((flag & RaycastBits.Transform) != 0) + { + Push(L, hit.transform); + } + else + { + LuaDLL.lua_pushnil(L); + } + + if (LuaDLL.lua_pcall(L, 6, 1, 0) != 0) + { + string error = LuaDLL.lua_tostring(L, -1); + throw new LuaException(error); + } + } + + public static void Push(IntPtr L, Touch t) + { + Push(L, t, TouchBits.ALL); + } + + public static void Push(IntPtr L, Touch t, int flag) + { + LuaStatic.GetPackTouch(L); + LuaDLL.lua_pushinteger(L, t.fingerId); + + if ((flag & TouchBits.Position) != 0) + { + Push(L, t.position); + } + else + { + LuaDLL.lua_pushnil(L); + } + + if ((flag & TouchBits.RawPosition) != 0) + { + Push(L, t.rawPosition); + } + else + { + LuaDLL.lua_pushnil(L); + } + + if ((flag & TouchBits.DeltaPosition) != 0) + { + Push(L, t.deltaPosition); + } + else + { + LuaDLL.lua_pushnil(L); + } + + LuaDLL.lua_pushnumber(L, t.deltaTime); + LuaDLL.lua_pushinteger(L, t.tapCount); + LuaDLL.lua_pushinteger(L, (int)t.phase); + + if (LuaDLL.lua_pcall(L, 7, -1, 0) != 0) + { + string error = LuaDLL.lua_tostring(L, -1); + throw new LuaException(error); + } + } + + public static void PushLayerMask(IntPtr L, LayerMask l) + { + LuaDLL.tolua_pushlayermask(L, l.value); + } + + public static void Push(IntPtr L, LuaByteBuffer bb) + { + LuaDLL.lua_pushlstring(L, bb.buffer, bb.buffer.Length); + } + + public static void PushByteBuffer(IntPtr L, byte[] buffer) + { + LuaDLL.tolua_pushlstring(L, buffer, buffer.Length); + } + + public static void Push(IntPtr L, Array array) + { + if (array == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + int arrayMetaTable = LuaStatic.GetArrayMetatable(L); + PushUserData(L, array, arrayMetaTable); + } + } + + public static void Push(IntPtr L, LuaBaseRef lbr) + { + if (lbr == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + LuaDLL.lua_getref(L, lbr.GetReference()); + } + } + + public static void Push(IntPtr L, Type t) + { + if (t == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + int typeMetatable = LuaStatic.GetTypeMetatable(L); + PushUserData(L, t, typeMetatable); + } + } + + public static void Push(IntPtr L, Delegate ev) + { + if (ev == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + int delegateMetatable = LuaStatic.GetDelegateMetatable(L); + PushUserData(L, ev, delegateMetatable); + } + } + + public static void Push(IntPtr L, EventObject ev) + { + if (ev == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + int eventMetatable = LuaStatic.GetEventMetatable(L); + PushUserData(L, ev, eventMetatable); + } + } + + public static void Push(IntPtr L, IEnumerator iter) + { + if (iter == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + int reference = LuaStatic.GetMetaReference(L, iter.GetType()); + + if (reference > 0) + { + PushUserData(L, iter, reference); + } + else + { + int iterMetatable = LuaStatic.GetIterMetatable(L); + PushUserData(L, iter, iterMetatable); + } + } + } + + public static void Push(IntPtr L, System.Enum e) + { + object obj = null; + int enumMetatable = LuaStatic.GetEnumObject(L, e, out obj); + PushUserData(L, obj, enumMetatable); + } + + //鍩虹绫诲瀷鑾峰彇闇瑕佷竴涓嚱鏁 + public static void PushOut(IntPtr L, LuaOut lo) + { + ObjectTranslator translator = ObjectTranslator.Get(L); + int index = translator.AddObject(lo); + LuaDLL.tolua_pushnewudata(L, LuaIndexes.LUA_REGISTRYINDEX, index); + } + + public static void PushStruct(IntPtr L, object o) + { + if (o == null || o.Equals(null)) + { + LuaDLL.lua_pushnil(L); + return; + } + + if (o is Enum) + { + ToLua.Push(L, (Enum)o); + return; + } + + Type type = o.GetType(); + int reference = LuaStatic.GetMetaReference(L, type); + + if (reference <= 0) + { + reference = LoadPreType(L, type); + } + + ObjectTranslator translator = ObjectTranslator.Get(L); + int index = translator.AddObject(o); + LuaDLL.tolua_pushnewudata(L, reference, index); + } + + public static void PushValue(IntPtr L, T v) where T : struct + { + StackTraits.Push(L, v); + } + + public static void PusNullable(IntPtr L, Nullable v) where T : struct + { + if (v == null) + { + LuaDLL.lua_pushnil(L); + return; + } + + StackTraits.Push(L, v.Value); + } + + public static void PushUserData(IntPtr L, object o, int reference) + { + int index; + ObjectTranslator translator = ObjectTranslator.Get(L); + + if (translator.Getudata(o, out index)) + { + if (LuaDLL.tolua_pushudata(L, index)) + { + return; + } + + translator.Destroyudata(index); + } + + index = translator.AddObject(o); + LuaDLL.tolua_pushnewudata(L, reference, index); + } + + static int LuaPCall(IntPtr L, LuaCSFunction func) + { + int top = LuaDLL.lua_gettop(L); + LuaDLL.tolua_pushcfunction(L, func); + + if (LuaDLL.lua_pcall(L, 0, -1, 0) != 0) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_settop(L, top); + throw new LuaException(error, LuaException.GetLastError()); + } + + int reference = LuaDLL.tolua_getclassref(L, -1); + LuaDLL.lua_settop(L, top); + return reference; + } + + public static int LoadPreType(IntPtr L, Type type) + { + LuaCSFunction LuaOpenLib = LuaStatic.GetPreModule(L, type); + int reference = -1; + + if (LuaOpenLib != null) + { +#if UNITY_EDITOR + Debugger.LogWarning("register PreLoad type {0} to lua", LuaMisc.GetTypeName(type)); +#endif + reference = LuaPCall(L, LuaOpenLib); + } + else + { + //绫诲瀷鏈猈rap + reference = LuaStatic.GetMissMetaReference(L, type); + } + + return reference; + } + + //o 涓嶄负 null + static void PushUserObject(IntPtr L, object o) + { + Type type = o.GetType(); + int reference = LuaStatic.GetMetaReference(L, type); + + if (reference <= 0) + { + reference = LoadPreType(L, type); + } + + PushUserData(L, o, reference); + } + + public static void Push(IntPtr L, UnityEngine.Object obj) + { + if (obj == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + PushUserObject(L, obj); + } + } + + public static void Push(IntPtr L, UnityEngine.TrackedReference obj) + { + if (obj == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + PushUserObject(L, obj); + } + } + + public static void PushSealed(IntPtr L, T o) + { + if (o == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + int reference = TypeTraits.GetLuaReference(L); + + if (reference <= 0) + { + reference = LoadPreType(L, o.GetType()); + } + + ToLua.PushUserData(L, o, reference); + } + } + + public static void PushObject(IntPtr L, object o) + { + if (o == null || o.Equals(null)) + { + LuaDLL.lua_pushnil(L); + } + else + { + if (o is Enum) + { + ToLua.Push(L, (Enum)o); + } + else + { + PushUserObject(L, o); + } + } + } + + /*static void PushNull(IntPtr L) + { + LuaDLL.tolua_pushudata(L, 1); + }*/ + + public static void Push(IntPtr L, nil obj) + { + LuaDLL.lua_pushnil(L); + } + + //PushVarObject + public static void Push(IntPtr L, object obj) + { + if (obj == null || obj.Equals(null)) + { + LuaDLL.lua_pushnil(L); + return; + } + + Type t = obj.GetType(); + + if (t.IsValueType) + { + if (TypeChecker.IsNullable(t)) + { + Type[] ts = t.GetGenericArguments(); + t = ts[0]; + } + + if (t == typeof(bool)) + { + bool b = (bool)obj; + LuaDLL.lua_pushboolean(L, b); + } + else if (obj is Enum) + { + Push(L, (System.Enum)obj); + } + else if (t == typeof(long)) + { + LuaDLL.tolua_pushint64(L, (long)obj); + } + else if (t == typeof(ulong)) + { + LuaDLL.tolua_pushuint64(L, (ulong)obj); + } + else if (t.IsPrimitive) + { + double d = LuaMisc.ToDouble(obj); + LuaDLL.lua_pushnumber(L, d); + } + else if (t == typeof(LuaByteBuffer)) + { + LuaByteBuffer lbb = (LuaByteBuffer)obj; + LuaDLL.lua_pushlstring(L, lbb.buffer, lbb.buffer.Length); + } + else if (t == typeof(Vector3)) + { + Push(L, (Vector3)obj); + } + else if (t == typeof(Quaternion)) + { + Push(L, (Quaternion)obj); + } + else if (t == typeof(Vector2)) + { + Push(L, (Vector2)obj); + } + else if (t == typeof(Vector4)) + { + Push(L, (Vector4)obj); + } + else if (t == typeof(Color)) + { + Push(L, (Color)obj); + } + else if (t == typeof(RaycastHit)) + { + Push(L, (RaycastHit)obj); + } + else if (t == typeof(Touch)) + { + Push(L, (Touch)obj); + } + else if (t == typeof(Ray)) + { + Push(L, (Ray)obj); + } + else if (t == typeof(Bounds)) + { + Push(L, (Bounds)obj); + } + else if (t == typeof(LayerMask)) + { + PushLayerMask(L, (LayerMask)obj); + } + else + { + LuaPushVarObject _Push = null; + + if (VarPushMap.TryGetValue(t, out _Push)) + { + _Push(L, obj); + } + else + { + PushStruct(L, obj); + } + } + } + else + { + if (t.IsArray) + { + Push(L, (Array)obj); + } + else if(t == typeof(string)) + { + LuaDLL.lua_pushstring(L, (string)obj); + } + else if (obj is LuaBaseRef) + { + Push(L, (LuaBaseRef)obj); + } + else if (obj is UnityEngine.Object) + { + Push(L, (UnityEngine.Object)obj); + } + else if (obj is UnityEngine.TrackedReference) + { + Push(L, (UnityEngine.TrackedReference)obj); + } + else if (obj is Delegate) + { + Push(L, (Delegate)obj); + } + else if (obj is IEnumerator) + { + Push(L, (IEnumerator)obj); + } + else if (t == typeof(EventObject)) + { + Push(L, (EventObject)obj); + } + else if (t == monoType) + { + Push(L, (Type)obj); + } + else + { + PushObject(L, obj); + } + } + } + + public static void SetBack(IntPtr L, int stackPos, object o) + { + int udata = LuaDLL.tolua_rawnetobj(L, stackPos); + ObjectTranslator translator = ObjectTranslator.Get(L); + + if (udata != -1) + { + translator.SetBack(udata, o); + } + } + + public static int Destroy(IntPtr L) + { + int udata = LuaDLL.tolua_rawnetobj(L, 1); + ObjectTranslator translator = ObjectTranslator.Get(L); + translator.Destroy(udata); + return 0; + } + + public static void CheckArgsCount(IntPtr L, string method, int count) + { + int c = LuaDLL.lua_gettop(L); + + if (c != count) + { + throw new LuaException(string.Format("no overload for method '{0}' takes '{1}' arguments", method, c)); + } + } + + public static void CheckArgsCount(IntPtr L, int count) + { + int c = LuaDLL.lua_gettop(L); + + if (c != count) + { + throw new LuaException(string.Format("no overload for method takes '{0}' arguments", c)); + } + } + + public static Delegate CheckDelegate(Type t, IntPtr L, int stackPos) + { + LuaTypes luatype = LuaDLL.lua_type(L, stackPos); + + switch (luatype) + { + case LuaTypes.LUA_TNIL: + return null; + case LuaTypes.LUA_TFUNCTION: + LuaFunction func = ToLua.ToLuaFunction(L, stackPos); + return DelegateFactory.CreateDelegate(t, func); + case LuaTypes.LUA_TUSERDATA: + return (Delegate)ToLua.CheckObject(L, stackPos, t); + default: + LuaDLL.luaL_typerror(L, stackPos, LuaMisc.GetTypeName(t)); + return null; + } + } + + public static Delegate CheckDelegate(IntPtr L, int stackPos) + { + LuaTypes luatype = LuaDLL.lua_type(L, stackPos); + + switch (luatype) + { + case LuaTypes.LUA_TNIL: + return null; + case LuaTypes.LUA_TFUNCTION: + LuaFunction func = ToLua.ToLuaFunction(L, stackPos); + return DelegateTraits.Create(func); + case LuaTypes.LUA_TUSERDATA: + return (Delegate)ToLua.CheckObject(L, stackPos, typeof(T)); + default: + LuaDLL.luaL_typerror(L, stackPos, TypeTraits.GetTypeName()); + return null; + } + } + } +} \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Core/ToLua.cs.meta b/Assets/LuaFramework/ToLua/Core/ToLua.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..3e550baae1a8dcde5e1360f220f232f35ae8f2a1 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/ToLua.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8558028e53ff5d946b0ef857634815da +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Core/TypeChecker.cs b/Assets/LuaFramework/ToLua/Core/TypeChecker.cs new file mode 100644 index 0000000000000000000000000000000000000000..9d255281d95d28e52fc0a354ce962fe61fed8eb6 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/TypeChecker.cs @@ -0,0 +1,447 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +using UnityEngine; +using System; +using System.Collections.Generic; + +namespace LuaInterface +{ + public static class TypeChecker + { + public static Type[] LuaValueTypeMap = new Type[LuaValueType.Max]; + + static TypeChecker() + { + LuaValueTypeMap[LuaValueType.None] = null; + LuaValueTypeMap[LuaValueType.Vector3] = typeof(Vector3); + LuaValueTypeMap[LuaValueType.Quaternion] = typeof(Quaternion); + LuaValueTypeMap[LuaValueType.Vector2] = typeof(Vector2); + LuaValueTypeMap[LuaValueType.Color] = typeof(Color); + LuaValueTypeMap[LuaValueType.Vector4] = typeof(Vector4); + LuaValueTypeMap[LuaValueType.Ray] = typeof(Ray); + LuaValueTypeMap[LuaValueType.Bounds] = typeof(Bounds); + LuaValueTypeMap[LuaValueType.Touch] = typeof(Touch); + LuaValueTypeMap[LuaValueType.LayerMask] = typeof(LayerMask); + LuaValueTypeMap[LuaValueType.RaycastHit] = typeof(RaycastHit); + LuaValueTypeMap[LuaValueType.Int64] = typeof(long); + LuaValueTypeMap[LuaValueType.UInt64] = typeof(ulong); + } + + public static bool IsValueType(Type t) + { + return !t.IsEnum && t.IsValueType; + } + + public static bool CheckTypes(IntPtr L, int begin, Type type0) + { + return CheckType(L, type0, begin); + } + + public static bool CheckTypes(IntPtr L, int begin, Type type0, Type type1) + { + return CheckType(L, type0, begin) && CheckType(L, type1, begin + 1); + } + + public static bool CheckTypes(IntPtr L, int begin, Type type0, Type type1, Type type2) + { + return CheckType(L, type0, begin) && CheckType(L, type1, begin + 1) && CheckType(L, type2, begin + 2); + } + + public static bool CheckTypes(IntPtr L, int begin, Type type0, Type type1, Type type2, Type type3) + { + return CheckType(L, type0, begin) && CheckType(L, type1, begin + 1) && CheckType(L, type2, begin + 2) && CheckType(L, type3, begin + 3); + } + + public static bool CheckTypes(IntPtr L, int begin, Type type0, Type type1, Type type2, Type type3, Type type4) + { + return CheckType(L, type0, begin) && CheckType(L, type1, begin + 1) && CheckType(L, type2, begin + 2) && CheckType(L, type3, begin + 3) && CheckType(L, type4, begin + 4); + } + + public static bool CheckTypes(IntPtr L, int begin, Type type0, Type type1, Type type2, Type type3, Type type4, Type type5) + { + return CheckType(L, type0, begin) && CheckType(L, type1, begin + 1) && CheckType(L, type2, begin + 2) && CheckType(L, type3, begin + 3) && CheckType(L, type4, begin + 4) && + CheckType(L, type5, begin + 5); + } + + public static bool CheckTypes(IntPtr L, int begin, Type type0, Type type1, Type type2, Type type3, Type type4, Type type5, Type type6) + { + return CheckType(L, type0, begin) && CheckType(L, type1, begin + 1) && CheckType(L, type2, begin + 2) && CheckType(L, type3, begin + 3) && CheckType(L, type4, begin + 4) && + CheckType(L, type5, begin + 5) && CheckType(L, type6, begin + 6); + } + + public static bool CheckTypes(IntPtr L, int begin, Type type0, Type type1, Type type2, Type type3, Type type4, Type type5, Type type6, Type type7) + { + return CheckType(L, type0, begin) && CheckType(L, type1, begin + 1) && CheckType(L, type2, begin + 2) && CheckType(L, type3, begin + 3) && CheckType(L, type4, begin + 4) && + CheckType(L, type5, begin + 5) && CheckType(L, type6, begin + 6) && CheckType(L, type7, begin + 7); + } + + public static bool CheckTypes(IntPtr L, int begin, Type type0, Type type1, Type type2, Type type3, Type type4, Type type5, Type type6, Type type7, Type type8) + { + return CheckType(L, type0, begin) && CheckType(L, type1, begin + 1) && CheckType(L, type2, begin + 2) && CheckType(L, type3, begin + 3) && CheckType(L, type4, begin + 4) && + CheckType(L, type5, begin + 5) && CheckType(L, type6, begin + 6) && CheckType(L, type7, begin + 7) && CheckType(L, type8, begin + 8); + } + + public static bool CheckTypes(IntPtr L, int begin, Type type0, Type type1, Type type2, Type type3, Type type4, Type type5, Type type6, Type type7, Type type8, Type type9) + { + return CheckType(L, type0, begin) && CheckType(L, type1, begin + 1) && CheckType(L, type2, begin + 2) && CheckType(L, type3, begin + 3) && CheckType(L, type4, begin + 4) && + CheckType(L, type5, begin + 5) && CheckType(L, type6, begin + 6) && CheckType(L, type7, begin + 7) && CheckType(L, type8, begin + 8) && CheckType(L, type9, begin + 9); + } + + public static bool CheckTypes(IntPtr L, int begin, params Type[] types) + { + for (int i = 0; i < types.Length; i++) + { + if (!CheckType(L, types[i], i + begin)) + { + return false; + } + } + + return true; + } + + public static bool CheckParamsType(IntPtr L, Type t, int begin, int count) + { + if (t == typeof(object)) + { + return true; + } + + for (int i = 0; i < count; i++) + { + if (!CheckType(L, t, i + begin)) + { + return false; + } + } + + return true; + } + + static bool IsNilType(Type t) + { + if (!t.IsValueType) + { + return true; + } + + if (IsNullable(t)) + { + return true; + } + + return false; + } + + public static bool IsNullable(Type t) + { + if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Nullable<>)) + { + return true; + } + + return false; + } + + public static Type GetNullableType(Type t) + { + if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Nullable<>)) + { + Type[] ts = t.GetGenericArguments(); + t = ts[0]; + } + + return t; + } + + public static bool CheckType(IntPtr L, Type type, int pos) + { + //榛樿閮藉彲浠ヨ浆 object + if (type == typeof(object)) + { + return true; + } + + Type t = GetNullableType(type); + LuaTypes luaType = LuaDLL.lua_type(L, pos); + + switch (luaType) + { + case LuaTypes.LUA_TNUMBER: + return IsNumberType(t); + case LuaTypes.LUA_TSTRING: + return t == typeof(string) || t == typeof(byte[]) || t == typeof(char[]) || t == typeof(LuaByteBuffer); + case LuaTypes.LUA_TUSERDATA: + return IsMatchUserData(L, t, pos); + case LuaTypes.LUA_TBOOLEAN: + return t == typeof(bool); + case LuaTypes.LUA_TFUNCTION: + return t == typeof(LuaFunction); + case LuaTypes.LUA_TTABLE: + return IsUserTable(t, L, pos); + case LuaTypes.LUA_TLIGHTUSERDATA: + return t == typeof(IntPtr) || t == typeof(UIntPtr); + case LuaTypes.LUA_TNIL: + return IsNilType(type); + default: + break; + } + + throw new LuaException("undefined type to check" + LuaDLL.luaL_typename(L, pos)); + } + + static Type monoType = typeof(Type).GetType(); + + public static T ChangeType(object temp, Type type) + { + if (temp.GetType() == monoType) + { + return (T)temp; + } + else + { + return (T)Convert.ChangeType(temp, type); + } + } + + public static object ChangeType(object temp, Type type) + { + if (temp.GetType() == monoType) + { + return (Type)temp; + } + else + { + return Convert.ChangeType(temp, type); + } + } + + static bool IsMatchUserData(IntPtr L, Type t, int pos) + { + if (t == typeof(long)) + { + return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Int64; + } + else if (t == typeof(ulong)) + { + return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.UInt64; + } + + object obj = null; + int udata = LuaDLL.tolua_rawnetobj(L, pos); + + if (udata != -1) + { + ObjectTranslator translator = ObjectTranslator.Get(L); + obj = translator.GetObject(udata); + + if (obj != null) + { + Type objType = obj.GetType(); + + if (t == objType || t.IsAssignableFrom(objType)) + { + return true; + } + } + else + { + return !t.IsValueType; + } + } + + return false; + } + + public static bool IsNumberType(Type t) + { + if (t.IsPrimitive) + { + if (t == typeof(bool) || t == typeof(IntPtr) || t == typeof(UIntPtr)) + { + return false; + } + + return true; + } + + return false; + } + + public static bool IsUserTable(Type t, IntPtr L, int pos) + { + int type = LuaDLL.tolua_getvaluetype(L, pos); + + if (type != LuaValueType.None) + { + return t == LuaValueTypeMap[type]; + } + + if (t.IsArray) + { + if (t.GetElementType().IsArray || t.GetArrayRank() > 1) + { + return false; + } + + return true; + } + else if (t == typeof(LuaTable)) + { + return true; + } + else if (LuaDLL.tolua_isvptrtable(L, pos)) + { + return IsMatchUserData(L, t, pos); + } + + return false; + } + + public static bool CheckTypes(IntPtr L, int pos) + { + return TypeTraits.Check(L, pos); + } + + public static bool CheckTypes(IntPtr L, int pos) + { + return TypeTraits.Check(L, pos) && TypeTraits.Check(L, pos + 1); + } + + public static bool CheckTypes(IntPtr L, int pos) + { + return TypeTraits.Check(L, pos) && TypeTraits.Check(L, pos + 1) && TypeTraits.Check(L, pos + 2); + } + + public static bool CheckTypes(IntPtr L, int pos) + { + return TypeTraits.Check(L, pos) && TypeTraits.Check(L, pos + 1) && TypeTraits.Check(L, pos + 2) && TypeTraits.Check(L, pos + 3); + } + + public static bool CheckTypes(IntPtr L, int pos) + { + return TypeTraits.Check(L, pos) && TypeTraits.Check(L, pos + 1) && TypeTraits.Check(L, pos + 2) && TypeTraits.Check(L, pos + 3) && TypeTraits.Check(L, pos + 4); + } + + public static bool CheckTypes(IntPtr L, int pos) + { + return TypeTraits.Check(L, pos) && TypeTraits.Check(L, pos + 1) && TypeTraits.Check(L, pos + 2) && TypeTraits.Check(L, pos + 3) && TypeTraits.Check(L, pos + 4) && + TypeTraits.Check(L, pos + 5); + } + + public static bool CheckTypes(IntPtr L, int pos) + { + return TypeTraits.Check(L, pos) && TypeTraits.Check(L, pos + 1) && TypeTraits.Check(L, pos + 2) && TypeTraits.Check(L, pos + 3) && TypeTraits.Check(L, pos + 4) && + TypeTraits.Check(L, pos + 5) && TypeTraits.Check(L, pos + 6); + } + + public static bool CheckTypes(IntPtr L, int pos) + { + return TypeTraits.Check(L, pos) && TypeTraits.Check(L, pos + 1) && TypeTraits.Check(L, pos + 2) && TypeTraits.Check(L, pos + 3) && TypeTraits.Check(L, pos + 4) && + TypeTraits.Check(L, pos + 5) && TypeTraits.Check(L, pos + 6) && TypeTraits.Check(L, pos + 7); + } + + public static bool CheckTypes(IntPtr L, int pos) + { + return TypeTraits.Check(L, pos) && TypeTraits.Check(L, pos + 1) && TypeTraits.Check(L, pos + 2) && TypeTraits.Check(L, pos + 3) && TypeTraits.Check(L, pos + 4) && + TypeTraits.Check(L, pos + 5) && TypeTraits.Check(L, pos + 6) && TypeTraits.Check(L, pos + 7) && TypeTraits.Check(L, pos + 8); + } + + public static bool CheckTypes(IntPtr L, int pos) + { + return TypeTraits.Check(L, pos) && TypeTraits.Check(L, pos + 1) && TypeTraits.Check(L, pos + 2) && TypeTraits.Check(L, pos + 3) && TypeTraits.Check(L, pos + 4) && + TypeTraits.Check(L, pos + 5) && TypeTraits.Check(L, pos + 6) && TypeTraits.Check(L, pos + 7) && TypeTraits.Check(L, pos + 8) && TypeTraits.Check(L, pos + 9); + } + + public static bool CheckTypes(IntPtr L, int pos) + { + return TypeTraits.Check(L, pos) && TypeTraits.Check(L, pos + 1) && TypeTraits.Check(L, pos + 2) && TypeTraits.Check(L, pos + 3) && TypeTraits.Check(L, pos + 4) && + TypeTraits.Check(L, pos + 5) && TypeTraits.Check(L, pos + 6) && TypeTraits.Check(L, pos + 7) && TypeTraits.Check(L, pos + 8) && TypeTraits.Check(L, pos + 9) && + TypeTraits.Check(L, pos + 10); + } + + public static bool CheckTypes(IntPtr L, int pos) + { + return TypeTraits.Check(L, pos) && TypeTraits.Check(L, pos + 1) && TypeTraits.Check(L, pos + 2) && TypeTraits.Check(L, pos + 3) && TypeTraits.Check(L, pos + 4) && + TypeTraits.Check(L, pos + 5) && TypeTraits.Check(L, pos + 6) && TypeTraits.Check(L, pos + 7) && TypeTraits.Check(L, pos + 8) && TypeTraits.Check(L, pos + 9) && + TypeTraits.Check(L, pos + 10) && TypeTraits.Check(L, pos + 11); + } + + public static bool CheckParamsType(IntPtr L, int begin, int count) + { + if (typeof(T) == typeof(object)) + { + return true; + } + + for (int i = 0; i < count; i++) + { + if (!TypeTraits.Check(L, i + begin)) + { + return false; + } + } + + return true; + } + + static public bool CheckDelegateType(Type type, IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return true; + case LuaTypes.LUA_TUSERDATA: + int udata = LuaDLL.tolua_rawnetobj(L, pos); + + if (udata != -1) + { + ObjectTranslator translator = ObjectTranslator.Get(L); + object obj = translator.GetObject(udata); + return obj == null ? true : type == obj.GetType(); + } + return false; + default: + return false; + } + } + + static public bool CheckEnumType(Type type, IntPtr L, int pos) + { + if (LuaDLL.lua_type(L, pos) == LuaTypes.LUA_TUSERDATA) + { + int udata = LuaDLL.tolua_rawnetobj(L, pos); + + if (udata != -1) + { + ObjectTranslator translator = ObjectTranslator.Get(L); + object obj = translator.GetObject(udata); + return obj == null ? false : type == obj.GetType(); + } + } + + return false; + } + } +} \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Core/TypeChecker.cs.meta b/Assets/LuaFramework/ToLua/Core/TypeChecker.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..1d5d8923125e51f8a7bc5b2a9bca78281534bf37 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/TypeChecker.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b2c5d493c1805784994fefe7b22da126 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Core/TypeTraits.cs b/Assets/LuaFramework/ToLua/Core/TypeTraits.cs new file mode 100644 index 0000000000000000000000000000000000000000..7e3351a5b51933e02ff17e547491153182c5861a --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/TypeTraits.cs @@ -0,0 +1,334 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +using UnityEngine; +using System; +using System.Collections; + +namespace LuaInterface +{ + public static class TypeTraits + { + static public Func Check = DefaultCheck; + static public Type type = typeof(T); + static public bool IsValueType = type.IsValueType; + static public bool IsArray = type.IsArray; + + static string typeName = string.Empty; + static int nilType = -1; + static int metaref = -1; + + static public void Init(Func check) + { + if (check != null) + { + Check = check; + } + } + + static public string GetTypeName() + { + if (typeName == string.Empty) + { + typeName = LuaMisc.GetTypeName(type); + } + + return typeName; + } + + static public int GetLuaReference(IntPtr L) + { +#if MULTI_STATE + return LuaStatic.GetMetaReference(L, type); +#else + if (metaref > 0) + { + return metaref; + } + + metaref = LuaStatic.GetMetaReference(L, type); + + if (metaref > 0) + { + LuaState.Get(L).OnDestroy += () => { metaref = -1; }; + } + + return metaref; +#endif + } + + static bool DefaultCheck(IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return IsNilType(); + case LuaTypes.LUA_TUSERDATA: + return IsUserData(L, pos); + case LuaTypes.LUA_TTABLE: + return IsUserTable(L, pos); + default: + return false; + } + } + + static bool IsNilType() + { + if (nilType != -1) + { + return nilType != 0; + } + + if (!IsValueType) + { + nilType = 1; + return true; + } + + if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>)) + { + nilType = 1; + return true; + } + + nilType = 0; + return false; + } + + static bool IsUserData(IntPtr L, int pos) + { + object obj = null; + int udata = LuaDLL.tolua_rawnetobj(L, pos); + + if (udata != -1) + { + ObjectTranslator translator = ObjectTranslator.Get(L); + obj = translator.GetObject(udata); + + if (obj != null) + { + return obj is T; + } + else + { + return !IsValueType; + } + } + + return false; + } + + static bool IsUserTable(IntPtr L, int pos) + { + if (type == typeof(LuaTable)) + { + return true; + } + else if (type.IsArray) + { + if (type.GetElementType().IsArray || type.GetArrayRank() > 1) + { + return false; + } + + return true; + } + else if (LuaDLL.tolua_isvptrtable(L, pos)) + { + return IsUserData(L, pos); + } + + return false; + } + } + + public static class DelegateTraits + { + static DelegateFactory.DelegateCreate _Create = null; + + static public void Init(DelegateFactory.DelegateCreate func) + { + _Create = func; + } + + static public Delegate Create(LuaFunction func) + { +#if UNITY_EDITOR + if (_Create == null) + { + throw new LuaException(string.Format("Delegate {0} not register", TypeTraits.GetTypeName())); + } +#endif + if (func != null) + { + LuaState state = func.GetLuaState(); + LuaDelegate target = state.GetLuaDelegate(func); + + if (target != null) + { + return Delegate.CreateDelegate(typeof(T), target, target.method); + } + else + { + Delegate d = _Create(func, null, false); + target = d.Target as LuaDelegate; + state.AddLuaDelegate(target, func); + return d; + } + } + + return _Create(null, null, false); + } + + static public Delegate Create(LuaFunction func, LuaTable self) + { +#if UNITY_EDITOR + if (_Create == null) + { + throw new LuaException(string.Format("Delegate {0} not register", TypeTraits.GetTypeName())); + } +#endif + if (func != null) + { + LuaState state = func.GetLuaState(); + LuaDelegate target = state.GetLuaDelegate(func, self); + + if (target != null) + { + return Delegate.CreateDelegate(typeof(T), target, target.method); + } + else + { + Delegate d = _Create(func, self, true); + target = d.Target as LuaDelegate; + state.AddLuaDelegate(target, func, self); + return d; + } + } + + return _Create(null, null, true); + } + } + + public static class StackTraits + { + static public Action Push = SelectPush(); + static public Func Check = DefaultCheck; + static public Func To = DefaultTo; + + static public void Init(Action push, Func check, Func to) + { + if (push != null) + { + Push = push; + } + + if (to != null) + { + To = to; + } + + if (check != null) + { + Check = check; + } + } + + static Action SelectPush() + { + if (TypeTraits.IsValueType) + { + return PushValue; + } + else if (TypeTraits.IsArray) + { + return PushArray; + } + else + { + return PushObject; + } + } + + static void PushValue(IntPtr L, T o) + { + ToLua.PushStruct(L, o); + } + + static void PushObject(IntPtr L, T o) + { + ToLua.PushObject(L, o); + } + + static void PushArray(IntPtr L, T array) + { + if (array == null) + { + LuaDLL.lua_pushnil(L); + } + else + { + int arrayMetaTable = LuaStatic.GetArrayMetatable(L); + ToLua.PushUserData(L, array, arrayMetaTable); + } + } + + static T DefaultTo(IntPtr L, int pos) + { + return (T)ToLua.ToObject(L, pos); + } + + static T DefaultCheck(IntPtr L, int stackPos) + { + int udata = LuaDLL.tolua_rawnetobj(L, stackPos); + + if (udata != -1) + { + ObjectTranslator translator = ObjectTranslator.Get(L); + object obj = translator.GetObject(udata); + + if (obj != null) + { + if (obj is T) + { + return (T)obj; + } + + LuaDLL.luaL_argerror(L, stackPos, string.Format("{0} expected, got {1}", TypeTraits.GetTypeName(), obj.GetType().FullName)); + } + + if (!TypeTraits.IsValueType) + { + return default(T); + } + } + else if (LuaDLL.lua_isnil(L, stackPos) && !TypeTraits.IsValueType) + { + return default(T); + } + + LuaDLL.luaL_typerror(L, stackPos, TypeTraits.GetTypeName()); + return default(T); + } + } +} diff --git a/Assets/LuaFramework/ToLua/Core/TypeTraits.cs.meta b/Assets/LuaFramework/ToLua/Core/TypeTraits.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..5519ffd5fc9d633a51ff4c4ec18e43b6ccee0f18 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Core/TypeTraits.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 82858b365ef4145429c2f3227be8c845 +timeCreated: 1494572166 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Editor.meta b/Assets/LuaFramework/ToLua/Editor.meta new file mode 100644 index 0000000000000000000000000000000000000000..4f8c135b654b8e063687e57c2fe0bb50cd65d16d --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 3d9fa950d6c449e42893b939877b4ec7 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Editor/Extend.meta b/Assets/LuaFramework/ToLua/Editor/Extend.meta new file mode 100644 index 0000000000000000000000000000000000000000..91f1260e3d51894dfc21edc0375a3bb5132233cc --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/Extend.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: bdd2718c24fc3014d96c208f87886fe3 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_LuaInterface_EventObject.cs b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_LuaInterface_EventObject.cs new file mode 100644 index 0000000000000000000000000000000000000000..cbfd9f8a5d39aaa086bbec78a29044cedd66d22a --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_LuaInterface_EventObject.cs @@ -0,0 +1,47 @@ +锘縰sing System; +using LuaInterface; + +public class ToLua_LuaInterface_EventObject +{ + [NoToLuaAttribute] + public static string op_AdditionDefined = +@" try + { + EventObject arg0 = (EventObject)ToLua.CheckObject(L, 1, typeof(EventObject)); + arg0.func = ToLua.CheckDelegate(arg0.type, L, 2); + arg0.op = EventOp.Add; + ToLua.Push(L, arg0); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + }"; + + [NoToLuaAttribute] + public static string op_SubtractionDefined = +@" try + { + EventObject arg0 = (EventObject)ToLua.CheckObject(L, 1, typeof(EventObject)); + arg0.func = ToLua.CheckDelegate(arg0.type, L, 2); + arg0.op = EventOp.Sub; + ToLua.Push(L, arg0); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + }"; + + [UseDefinedAttribute] + public static ToLua_LuaInterface_EventObject operator +(ToLua_LuaInterface_EventObject a, ToLua_LuaInterface_EventObject b) + { + return null; + } + + [UseDefinedAttribute] + public static ToLua_LuaInterface_EventObject operator -(ToLua_LuaInterface_EventObject a, ToLua_LuaInterface_EventObject b) + { + return null; + } +} diff --git a/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_LuaInterface_EventObject.cs.meta b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_LuaInterface_EventObject.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..ff046d1c8ef9f2f60435dd1306f262fb39bd055b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_LuaInterface_EventObject.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6a98ce054e1b9e848a9ed23974b72436 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_LuaInterface_LuaConstructor.cs b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_LuaInterface_LuaConstructor.cs new file mode 100644 index 0000000000000000000000000000000000000000..5093b23b00497d71d048d6681d6657d3ba344373 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_LuaInterface_LuaConstructor.cs @@ -0,0 +1,42 @@ +锘縰sing System; +using LuaInterface; + +public class ToLua_LuaInterface_LuaConstructor +{ + public static string CallDefined = +@" try + { + LuaConstructor obj = (LuaConstructor)ToLua.CheckObject(L, 1, typeof(LuaConstructor)); + return obj.Call(L); + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + }"; + + public static string DestroyDefined = +@" try + { + ToLua.CheckArgsCount(L, 1); + LuaConstructor obj = (LuaConstructor)ToLua.CheckObject(L, 1, typeof(LuaConstructor)); + obj.Destroy(); + ToLua.Destroy(L); + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + }"; + + [UseDefinedAttribute] + public void Destroy() + { + + } + + [UseDefinedAttribute] + public int Call(IntPtr L) + { + return 0; + } +} diff --git a/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_LuaInterface_LuaConstructor.cs.meta b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_LuaInterface_LuaConstructor.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..26e467ef36440e7413f6cc9cfb68269f06b753b1 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_LuaInterface_LuaConstructor.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 24ae6f8094d27814db58bed92723e5eb +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_LuaInterface_LuaField.cs b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_LuaInterface_LuaField.cs new file mode 100644 index 0000000000000000000000000000000000000000..1e698143220500dc23d600e18d17f800aa08ade5 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_LuaInterface_LuaField.cs @@ -0,0 +1,39 @@ +锘縰sing System; +using LuaInterface; + +public class ToLua_LuaInterface_LuaField +{ + public static string GetDefined = +@" try + { + LuaField obj = (LuaField)ToLua.CheckObject(L, 1, typeof(LuaField)); + return obj.Get(L); + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + }"; + + public static string SetDefined = +@" try + { + LuaField obj = (LuaField)ToLua.CheckObject(L, 1, typeof(LuaField)); + return obj.Set(L); + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + }"; + + [UseDefinedAttribute] + public int Set(IntPtr L) + { + return 0; + } + + [UseDefinedAttribute] + public int Get(IntPtr L) + { + return 0; + } +} diff --git a/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_LuaInterface_LuaField.cs.meta b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_LuaInterface_LuaField.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..ba3c39d8165a9aab364fd8efa93a5c8276368b05 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_LuaInterface_LuaField.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f6b190ca703de424fafa500033a782a3 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_LuaInterface_LuaMethod.cs b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_LuaInterface_LuaMethod.cs new file mode 100644 index 0000000000000000000000000000000000000000..48cacbdb272c6d2f4c27d6932575d4a7ae0f329e --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_LuaInterface_LuaMethod.cs @@ -0,0 +1,42 @@ +锘縰sing System; +using LuaInterface; + +public class ToLua_LuaInterface_LuaMethod +{ + public static string CallDefined = +@" try + { + LuaMethod obj = (LuaMethod)ToLua.CheckObject(L, 1, typeof(LuaMethod)); + return obj.Call(L); + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + }"; + + public static string DestroyDefined = +@" try + { + ToLua.CheckArgsCount(L, 1); + LuaMethod obj = (LuaMethod)ToLua.CheckObject(L, 1, typeof(LuaMethod)); + obj.Destroy(); + ToLua.Destroy(L); + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + }"; + + [UseDefinedAttribute] + public int Call(IntPtr L) + { + return 0; + } + + [UseDefinedAttribute] + public void Destroy() + { + + } +} diff --git a/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_LuaInterface_LuaMethod.cs.meta b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_LuaInterface_LuaMethod.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..dc9b54fc684ac1fbf00ceb08cec2162b7b39684e --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_LuaInterface_LuaMethod.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6eac87eec04d6e547ac028d69e0eeb71 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_LuaInterface_LuaProperty.cs b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_LuaInterface_LuaProperty.cs new file mode 100644 index 0000000000000000000000000000000000000000..f6c03f756601981ca84ab11542eb6787b37834e5 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_LuaInterface_LuaProperty.cs @@ -0,0 +1,40 @@ +锘縰sing System; +using LuaInterface; + +public class ToLua_LuaInterface_LuaProperty +{ + public static string GetDefined = +@" try + { + LuaProperty obj = (LuaProperty)ToLua.CheckObject(L, 1, typeof(LuaProperty)); + return obj.Get(L); + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + }"; + + public static string SetDefined = +@" try + { + LuaProperty obj = (LuaProperty)ToLua.CheckObject(L, 1, typeof(LuaProperty)); + return obj.Set(L); + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + }"; + + + [UseDefinedAttribute] + public int Set(IntPtr L) + { + return 0; + } + + [UseDefinedAttribute] + public int Get(IntPtr L) + { + return 0; + } +} diff --git a/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_LuaInterface_LuaProperty.cs.meta b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_LuaInterface_LuaProperty.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..8acd01adf8c12c5388eb1eda9017654b79cd27d1 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_LuaInterface_LuaProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e00a567610c97754bbae9672db75a1f2 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_System_Delegate.cs b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_System_Delegate.cs new file mode 100644 index 0000000000000000000000000000000000000000..29c728e7f06a282165f8bf30e27a83a9d9f578c7 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_System_Delegate.cs @@ -0,0 +1,138 @@ +锘縰sing System; +using LuaInterface; + +public class ToLua_System_Delegate +{ + public static string AdditionNameSpace = "System.Collections.Generic"; + + [NoToLuaAttribute] + public static string op_AdditionDefined = +@" try + { + LuaTypes type = LuaDLL.lua_type(L, 1); + + switch (type) + { + case LuaTypes.LUA_TFUNCTION: + Delegate arg0 = ToLua.ToObject(L, 2) as Delegate; + LuaFunction func = ToLua.ToLuaFunction(L, 1); + Type t = arg0.GetType(); + Delegate arg1 = DelegateFactory.CreateDelegate(t, func); + Delegate arg2 = Delegate.Combine(arg0, arg1); + ToLua.Push(L, arg2); + return 1; + case LuaTypes.LUA_TNIL: + LuaDLL.lua_pushvalue(L, 2); + return 1; + case LuaTypes.LUA_TUSERDATA: + Delegate a0 = ToLua.ToObject(L, 1) as Delegate; + Delegate a1 = ToLua.CheckDelegate(a0.GetType(), L, 2); + Delegate ret = Delegate.Combine(a0, a1); + ToLua.Push(L, ret); + return 1; + default: + LuaDLL.luaL_typerror(L, 1, ""Delegate""); + return 0; + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + }"; + + [NoToLuaAttribute] + public static string op_SubtractionDefined = +@" try + { + Delegate arg0 = (Delegate)ToLua.CheckObject(L, 1); + LuaTypes type = LuaDLL.lua_type(L, 2); + + if (type == LuaTypes.LUA_TFUNCTION) + { + LuaState state = LuaState.Get(L); + LuaFunction func = ToLua.ToLuaFunction(L, 2); + Delegate[] ds = arg0.GetInvocationList(); + + for (int i = 0; i < ds.Length; i++) + { + LuaDelegate ld = ds[i].Target as LuaDelegate; + + if (ld != null && ld.func == func && ld.self == null) + { + arg0 = Delegate.Remove(arg0, ds[i]); + state.DelayDispose(ld.func); + break; + } + } + + func.Dispose(); + ToLua.Push(L, arg0); + return 1; + } + else + { + Delegate arg1 = (Delegate)ToLua.CheckObject(L, 2); + arg0 = DelegateFactory.RemoveDelegate(arg0, arg1); + ToLua.Push(L, arg0); + return 1; + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + }"; + + public static bool operator ==(ToLua_System_Delegate lhs, ToLua_System_Delegate rhs) + { + return false; + } + + public static bool operator !=(ToLua_System_Delegate lhs, ToLua_System_Delegate rhs) + { + return false; + } + + [UseDefinedAttribute] + public static ToLua_System_Delegate operator +(ToLua_System_Delegate a, ToLua_System_Delegate b) + { + return null; + } + + [UseDefinedAttribute] + public static ToLua_System_Delegate operator -(ToLua_System_Delegate a, ToLua_System_Delegate b) + { + return null; + } + + + public override bool Equals(object other) + { + return false; + } + + public override int GetHashCode() + { + return 0; + } + + public static string DestroyDefined = +@" Delegate arg0 = (Delegate)ToLua.CheckObject(L, 1); + Delegate[] ds = arg0.GetInvocationList(); + + for (int i = 0; i < ds.Length; i++) + { + LuaDelegate ld = ds[i].Target as LuaDelegate; + + if (ld != null) + { + ld.Dispose(); + } + } + + return 0;"; + + [UseDefinedAttribute] + public static void Destroy(object obj) + { + } +} diff --git a/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_System_Delegate.cs.meta b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_System_Delegate.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..abd5022c15a9ff346f4ae88c3375b5dec186bd66 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_System_Delegate.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6f0591686bc09e74e9a4fe2ad4e9fdb2 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_System_Enum.cs b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_System_Enum.cs new file mode 100644 index 0000000000000000000000000000000000000000..7ab9005dfd31adafe03e43e392d8392176cec322 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_System_Enum.cs @@ -0,0 +1,98 @@ +锘縰sing System; +using LuaInterface; + +public class ToLua_System_Enum +{ + public static string ToIntDefined = +@" try + { + object arg0 = ToLua.CheckObject(L, 1); + int ret = Convert.ToInt32(arg0); + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + }"; + + public static string ParseDefined = +@" try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + System.Type arg0 = (System.Type)ToLua.ToObject(L, 1); + string arg1 = ToLua.ToString(L, 2); + object o = System.Enum.Parse(arg0, arg1); + ToLua.Push(L, (Enum)o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + System.Type arg0 = (System.Type)ToLua.ToObject(L, 1); + string arg1 = ToLua.ToString(L, 2); + bool arg2 = LuaDLL.lua_toboolean(L, 3); + object o = System.Enum.Parse(arg0, arg1, arg2); + ToLua.Push(L, (Enum)o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, ""invalid arguments to method: System.Enum.Parse""); + } + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + }"; + + public static string ToObjectDefined = +@" try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + System.Type arg0 = (System.Type)ToLua.ToObject(L, 1); + int arg1 = (int)LuaDLL.lua_tonumber(L, 2); + object o = System.Enum.ToObject(arg0, arg1); + ToLua.Push(L, (Enum)o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + System.Type arg0 = (System.Type)ToLua.ToObject(L, 1); + object arg1 = ToLua.ToVarObject(L, 2); + object o = System.Enum.ToObject(arg0, arg1); + ToLua.Push(L, (Enum)o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, ""invalid arguments to method: System.Enum.ToObject""); + } + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + }"; + + [UseDefinedAttribute] + public static void ToInt(System.Enum obj) + { + } + + [UseDefinedAttribute] + public static object ToObject(Type enumType, int value) + { + return null; + } + + [UseDefinedAttribute] + public static object Parse(Type enumType, string value) + { + return null; + } +} diff --git a/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_System_Enum.cs.meta b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_System_Enum.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..54d18d51c08f20fa90d52207bf0fa7d4cd6a9991 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_System_Enum.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ff4fa54c22d6f7c428ef9aa02f6c10d4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_System_Object.cs b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_System_Object.cs new file mode 100644 index 0000000000000000000000000000000000000000..3e4dac7817c47c0b648265abeb917701344c9bfc --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_System_Object.cs @@ -0,0 +1,17 @@ +锘縰sing System; +using LuaInterface; + +public class ToLua_System_Object +{ + public static string DestroyDefined = "\t\treturn ToLua.Destroy(L);"; + + [UseDefinedAttribute] + public static void Destroy(object obj) + { + } + + public static bool op_Equality(Object x, Object y) + { + return false; + } +} diff --git a/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_System_Object.cs.meta b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_System_Object.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..025e00d76aa8e9021a1e3a52a469a848b5246248 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_System_Object.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: afb4e6913f506df4c9eb98f70781a578 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_System_String.cs b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_System_String.cs new file mode 100644 index 0000000000000000000000000000000000000000..b783578c59b9b91dad5b40f115d50a0bb9ec8c8e --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_System_String.cs @@ -0,0 +1,34 @@ +锘縰sing UnityEngine; +using System.Collections; +using LuaInterface; + +public class ToLua_System_String +{ + [NoToLuaAttribute] + public static string ToLua_System_StringDefined = +@" try + { + LuaTypes luatype = LuaDLL.lua_type(L, 1); + + if (luatype == LuaTypes.LUA_TSTRING) + { + string arg0 = LuaDLL.lua_tostring(L, 1); + ToLua.PushSealed(L, arg0); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, ""invalid arguments to string's ctor method""); + } + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + }"; + + [UseDefinedAttribute] + public ToLua_System_String() + { + + } +} diff --git a/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_System_String.cs.meta b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_System_String.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..f46750133d19764d48e3d7d31bf21b2e3540a12a --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_System_String.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7cc775dacb56ec34587e28d9e3f68417 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_System_Type.cs b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_System_Type.cs new file mode 100644 index 0000000000000000000000000000000000000000..d40999e813c0cd582d8b309ed6dbc7b16fdbe58e --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_System_Type.cs @@ -0,0 +1,216 @@ +锘縰sing System; +using System.Reflection; +using LuaInterface; + +public class ToLua_System_Type +{ + [NoToLuaAttribute] + public EventInfo GetEvent(string name) + { + return null; + } + + [NoToLuaAttribute] + public EventInfo GetEvent(string name, BindingFlags bindingAttr) + { + return null; + } + + [NoToLuaAttribute] + public EventInfo[] GetEvents() + { + return null; + } + + [NoToLuaAttribute] + public EventInfo[] GetEvents(BindingFlags bindingAttr) + { + return null; + } + + [NoToLuaAttribute] + public MethodInfo GetMethod(string name) + { + return null; + } + + [NoToLuaAttribute] + public MethodInfo GetMethod(string name, Type[] types) + { + return null; + } + + [NoToLuaAttribute] + public MethodInfo GetMethod(string name, BindingFlags bindingAttr) + { + return null; + } + + [NoToLuaAttribute] + public MethodInfo GetMethod(string name, Type[] types, ParameterModifier[] modifiers) + { + return null; + } + + [NoToLuaAttribute] + public MethodInfo GetMethod(string name, BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers) + { + return null; + } + + [NoToLuaAttribute] + public MethodInfo GetMethod(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) + { + return null; + } + + [NoToLuaAttribute] + public MethodInfo[] GetMethods() + { + return null; + } + + [NoToLuaAttribute] + public MethodInfo[] GetMethods(BindingFlags bindingAttr) + { + return null; + } + + [NoToLuaAttribute] + public PropertyInfo[] GetProperties() + { + return null; + } + + [NoToLuaAttribute] + public PropertyInfo[] GetProperties(BindingFlags bindingAttr) + { + return null; + } + + [NoToLuaAttribute] + public PropertyInfo GetProperty(string name) + { + return null; + } + + [NoToLuaAttribute] + public PropertyInfo GetProperty(string name, Type[] types) + { + return null; + } + + [NoToLuaAttribute] + public PropertyInfo GetProperty(string name, Type returnType) + { + return null; + } + + [NoToLuaAttribute] + public PropertyInfo GetProperty(string name, BindingFlags bindingAttr) + { + return null; + } + + [NoToLuaAttribute] + public PropertyInfo GetProperty(string name, Type returnType, Type[] types) + { + return null; + } + + [NoToLuaAttribute] + public PropertyInfo GetProperty(string name, Type returnType, Type[] types, ParameterModifier[] modifiers) + { + return null; + } + + [NoToLuaAttribute] + public PropertyInfo GetProperty(string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) + { + return null; + } + + [NoToLuaAttribute] + public FieldInfo GetField(string name) + { + return null; + } + + [NoToLuaAttribute] + public FieldInfo GetField(string name, BindingFlags bindingAttr) + { + return null; + } + + [NoToLuaAttribute] + public FieldInfo[] GetFields() + { + return null; + } + + [NoToLuaAttribute] + public FieldInfo[] GetFields(BindingFlags bindingAttr) + { + return null; + } + + [NoToLuaAttribute] + public ConstructorInfo GetConstructor(Type[] types) + { + return null; + } + + [NoToLuaAttribute] + public ConstructorInfo GetConstructor(BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers) + { + return null; + } + + [NoToLuaAttribute] + public ConstructorInfo GetConstructor(BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) + { + return null; + } + + [NoToLuaAttribute] + public ConstructorInfo[] GetConstructors() + { + return null; + } + + [NoToLuaAttribute] + public ConstructorInfo[] GetConstructors(BindingFlags bindingAttr) + { + return null; + } + + [NoToLuaAttribute] + public MemberInfo[] GetMember(string name) + { + return null; + } + + [NoToLuaAttribute] + public MemberInfo[] GetMember(string name, BindingFlags bindingAttr) + { + return null; + } + + [NoToLuaAttribute] + public MemberInfo[] GetMember(string name, MemberTypes type, BindingFlags bindingAttr) + { + return null; + } + + [NoToLuaAttribute] + public MemberInfo[] GetMembers() + { + return null; + } + + [NoToLuaAttribute] + public MemberInfo[] GetMembers(BindingFlags bindingAttr) + { + return null; + } +} diff --git a/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_System_Type.cs.meta b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_System_Type.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..e5535a410d8e6ec5bbe31b6833e1af119872fed0 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_System_Type.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a67e5f490d5d4cd4f8754c921a414d9a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_UnityEngine_GameObject.cs b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_UnityEngine_GameObject.cs new file mode 100644 index 0000000000000000000000000000000000000000..ebd159963bcd1ca19ad399508f0a62d847d224e7 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_UnityEngine_GameObject.cs @@ -0,0 +1,345 @@ +锘縰sing UnityEngine; +using System.Collections; +using LuaInterface; +using System; + +public class ToLua_UnityEngine_GameObject +{ + public static string SendMessageDefined = +@" IntPtr L0 = LuaException.L; + + try + { + ++LuaException.SendMsgCount; + LuaException.L = L; + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + string arg0 = ToLua.ToString(L, 2); + obj.SendMessage(arg0); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + + --LuaException.SendMsgCount; + LuaException.L = L0; + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.SendMessageOptions arg1 = (UnityEngine.SendMessageOptions)ToLua.ToObject(L, 3); + obj.SendMessage(arg0, arg1); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + + --LuaException.SendMsgCount; + LuaException.L = L0; + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + string arg0 = ToLua.ToString(L, 2); + object arg1 = ToLua.ToVarObject(L, 3); + obj.SendMessage(arg0, arg1); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + + --LuaException.SendMsgCount; + LuaException.L = L0; + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + string arg0 = ToLua.ToString(L, 2); + object arg1 = ToLua.ToVarObject(L, 3); + UnityEngine.SendMessageOptions arg2 = (UnityEngine.SendMessageOptions)ToLua.ToObject(L, 4); + obj.SendMessage(arg0, arg1, arg2); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + + --LuaException.SendMsgCount; + LuaException.L = L0; + return 0; + } + else + { + --LuaException.SendMsgCount; + LuaException.L = L0; + return LuaDLL.luaL_throw(L, ""invalid arguments to method: UnityEngine.GameObject.SendMessage""); + } + } + catch(Exception e) + { + --LuaException.SendMsgCount; + LuaException.L = L0; + return LuaDLL.toluaL_exception(L, e); + }"; + + public static string SendMessageUpwardsDefined = +@" IntPtr L0 = LuaException.L; + + try + { + ++LuaException.SendMsgCount; + LuaException.L = L; + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + string arg0 = ToLua.ToString(L, 2); + obj.SendMessageUpwards(arg0); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + + --LuaException.SendMsgCount; + LuaException.L = L0; + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.SendMessageOptions arg1 = (UnityEngine.SendMessageOptions)ToLua.ToObject(L, 3); + obj.SendMessageUpwards(arg0, arg1); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + + --LuaException.SendMsgCount; + LuaException.L = L0; + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + string arg0 = ToLua.ToString(L, 2); + object arg1 = ToLua.ToVarObject(L, 3); + obj.SendMessageUpwards(arg0, arg1); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + + --LuaException.SendMsgCount; + LuaException.L = L0; + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + string arg0 = ToLua.ToString(L, 2); + object arg1 = ToLua.ToVarObject(L, 3); + UnityEngine.SendMessageOptions arg2 = (UnityEngine.SendMessageOptions)ToLua.ToObject(L, 4); + obj.SendMessageUpwards(arg0, arg1, arg2); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + + --LuaException.SendMsgCount; + LuaException.L = L0; + return 0; + } + else + { + --LuaException.SendMsgCount; + LuaException.L = L0; + return LuaDLL.luaL_throw(L, ""invalid arguments to method: UnityEngine.GameObject.SendMessageUpwards""); + } + } + catch (Exception e) + { + --LuaException.SendMsgCount; + LuaException.L = L0; + return LuaDLL.toluaL_exception(L, e); + }"; + + public static string BroadcastMessageDefined = +@" IntPtr L0 = LuaException.L; + + try + { + ++LuaException.SendMsgCount; + LuaException.L = L; + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + string arg0 = ToLua.ToString(L, 2); + obj.BroadcastMessage(arg0); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + + --LuaException.SendMsgCount; + LuaException.L = L0; + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.SendMessageOptions arg1 = (UnityEngine.SendMessageOptions)ToLua.ToObject(L, 3); + obj.BroadcastMessage(arg0, arg1); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + + --LuaException.SendMsgCount; + LuaException.L = L0; + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + string arg0 = ToLua.ToString(L, 2); + object arg1 = ToLua.ToVarObject(L, 3); + obj.BroadcastMessage(arg0, arg1); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + + --LuaException.SendMsgCount; + LuaException.L = L0; + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + string arg0 = ToLua.ToString(L, 2); + object arg1 = ToLua.ToVarObject(L, 3); + UnityEngine.SendMessageOptions arg2 = (UnityEngine.SendMessageOptions)ToLua.ToObject(L, 4); + obj.BroadcastMessage(arg0, arg1, arg2); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + + --LuaException.SendMsgCount; + LuaException.L = L0; + return 0; + } + else + { + --LuaException.SendMsgCount; + LuaException.L = L0; + return LuaDLL.luaL_throw(L, ""invalid arguments to method: UnityEngine.GameObject.BroadcastMessage""); + } + } + catch (Exception e) + { + --LuaException.SendMsgCount; + LuaException.L = L0; + return LuaDLL.toluaL_exception(L, e); + }"; + + + public static string AddComponentDefined = +@" IntPtr L0 = LuaException.L; + + try + { + ++LuaException.InstantiateCount; + LuaException.L = L; + ToLua.CheckArgsCount(L, 2); + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + System.Type arg0 = ToLua.CheckMonoType(L, 2); + UnityEngine.Component o = obj.AddComponent(arg0); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + + ToLua.Push(L, o); + LuaException.L = L0; + --LuaException.InstantiateCount; + return 1; + } + catch (Exception e) + { + LuaException.L = L0; + --LuaException.InstantiateCount; + return LuaDLL.toluaL_exception(L, e); + }"; + [UseDefinedAttribute] + public void SendMessage(string methodName) + { + } + + [UseDefinedAttribute] + public void SendMessageUpwards(string methodName) + { + } + + [UseDefinedAttribute] + public void BroadcastMessage(string methodName) + { + + } + + [UseDefinedAttribute] + public void AddComponent(Type t) + { + + } +} diff --git a/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_UnityEngine_GameObject.cs.meta b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_UnityEngine_GameObject.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..423d0a26d8fd44f510106f1923ef829bdf6adb7a --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_UnityEngine_GameObject.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1ed77ac31b521ad4bae3fe7e8b84cab4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_UnityEngine_Input.cs b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_UnityEngine_Input.cs new file mode 100644 index 0000000000000000000000000000000000000000..24b2a053b70b6a2f5d1599e3c6126aa29f048cd4 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_UnityEngine_Input.cs @@ -0,0 +1,25 @@ +锘縰sing UnityEngine; +using LuaInterface; + +public class ToLua_UnityEngine_Input +{ + public static string GetTouchDefined = +@" try + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = LuaDLL.luaL_optinteger(L, 2, TouchBits.ALL); + UnityEngine.Touch o = UnityEngine.Input.GetTouch(arg0); + ToLua.Push(L, o, arg1); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + }"; + + [UseDefinedAttribute] + public static Touch GetTouch(int index, int flag) + { + return new Touch(); + } +} diff --git a/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_UnityEngine_Input.cs.meta b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_UnityEngine_Input.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..f84c5b465ddaa3f041a68c38502228dfa23d6954 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_UnityEngine_Input.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3cee476932ca9a04da9cff77f92e1894 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_UnityEngine_Object.cs b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_UnityEngine_Object.cs new file mode 100644 index 0000000000000000000000000000000000000000..55e0cbe24948f2f6facab5ce5a2bbe31eef12e84 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_UnityEngine_Object.cs @@ -0,0 +1,232 @@ +锘縰sing UnityEngine; +using System.Collections; +using LuaInterface; + +public class ToLua_UnityEngine_Object +{ + public static string DestroyDefined = +@" try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject(L, 1); + ToLua.Destroy(L); + UnityEngine.Object.Destroy(arg0); + return 0; + } + else if (count == 2) + { + float arg1 = (float)LuaDLL.luaL_checknumber(L, 2); + int udata = LuaDLL.tolua_rawnetobj(L, 1); + ObjectTranslator translator = LuaState.GetTranslator(L); + translator.DelayDestroy(udata, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, ""invalid arguments to method: Object.Destroy""); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + }"; + + public static string DestroyImmediateDefined = +@" try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject(L, 1); + ToLua.Destroy(L); + UnityEngine.Object.DestroyImmediate(arg0); + return 0; + } + else if (count == 2) + { + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject(L, 1); + bool arg1 = LuaDLL.luaL_checkboolean(L, 2); + ToLua.Destroy(L); + UnityEngine.Object.DestroyImmediate(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, ""invalid arguments to method: Object.DestroyImmediate""); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + }"; + + public static string InstantiateDefined = +@" IntPtr L0 = LuaException.L; + + try + { + ++LuaException.InstantiateCount; + LuaException.L = L; + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject(L, 1); + UnityEngine.Object o = UnityEngine.Object.Instantiate(arg0); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + else + { + ToLua.Push(L, o); + } + + LuaException.L = L0; + --LuaException.InstantiateCount; + return 1; + } +#if UNITY_5_4_OR_NEWER + else if (count == 2) + { + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject(L, 1); + UnityEngine.Transform arg1 = (UnityEngine.Transform)ToLua.CheckObject(L, 2); + UnityEngine.Object o = UnityEngine.Object.Instantiate(arg0, arg1); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + else + { + ToLua.Push(L, o); + } + + LuaException.L = L0; + --LuaException.InstantiateCount; + return 1; + } +#endif + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Quaternion arg2 = ToLua.ToQuaternion(L, 3); + UnityEngine.Object o = UnityEngine.Object.Instantiate(arg0, arg1, arg2); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + else + { + ToLua.Push(L, o); + } + + LuaException.L = L0; + --LuaException.InstantiateCount; + return 1; + } +#if UNITY_5_4_OR_NEWER + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject(L, 1); + UnityEngine.Transform arg1 = (UnityEngine.Transform)ToLua.ToObject(L, 2); + bool arg2 = LuaDLL.lua_toboolean(L, 3); + UnityEngine.Object o = UnityEngine.Object.Instantiate(arg0, arg1, arg2); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + else + { + ToLua.Push(L, o); + } + + LuaException.L = L0; + --LuaException.InstantiateCount; + return 1; + } + else if (count == 4) + { + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg1 = ToLua.CheckVector3(L, 2); + UnityEngine.Quaternion arg2 = ToLua.CheckQuaternion(L, 3); + UnityEngine.Transform arg3 = (UnityEngine.Transform)ToLua.CheckObject(L, 4); + UnityEngine.Object o = UnityEngine.Object.Instantiate(arg0, arg1, arg2, arg3); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + else + { + ToLua.Push(L, o); + } + + LuaException.L = L0; + --LuaException.InstantiateCount; + return 1; + } +#endif + else + { + LuaException.L = L0; + --LuaException.InstantiateCount; + return LuaDLL.luaL_throw(L, ""invalid arguments to method: UnityEngine.Object.Instantiate""); + } + } + catch (Exception e) + { + LuaException.L = L0; + --LuaException.InstantiateCount; + return LuaDLL.toluaL_exception(L, e); + }"; + + + [UseDefinedAttribute] + public static void Destroy(Object obj) + { + + } + + [UseDefinedAttribute] + public static void DestroyImmediate(Object obj) + { + + } + + [NoToLuaAttribute] + public static void DestroyObject(Object obj) + { + + } + + [NoToLuaAttribute] + public static void DestroyObject(Object obj, float t) + { + + } + + [UseDefinedAttribute] + public static void Instantiate(Object original) + { + + } +} diff --git a/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_UnityEngine_Object.cs.meta b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_UnityEngine_Object.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..ed37e8797af3c5ace6d99685f10f9b2ee6fc9c25 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_UnityEngine_Object.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ed2a77b78fd7258438b2b5a9e881d7c2 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_UnityEngine_RectTransform.cs b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_UnityEngine_RectTransform.cs new file mode 100644 index 0000000000000000000000000000000000000000..269c07afdd40448b39f5214d2192fa882dbe2900 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_UnityEngine_RectTransform.cs @@ -0,0 +1,38 @@ +锘縰sing UnityEngine; +using System.Collections; +using LuaInterface; + +public class ToLua_UnityEngine_RectTransform +{ + public static string GetLocalCornersDefined = +@" if (count == 1) + { + UnityEngine.RectTransform obj = (UnityEngine.RectTransform)ToLua.CheckObject(L, 1, typeof(UnityEngine.RectTransform)); + UnityEngine.Vector3[] arg0 = new UnityEngine.Vector3[4]; + obj.GetLocalCorners(arg0); + ToLua.Push(L, arg0); + return 1; + }"; + + public static string GetWorldCornersDefined = +@" if (count == 1) + { + UnityEngine.RectTransform obj = (UnityEngine.RectTransform)ToLua.CheckObject(L, 1, typeof(UnityEngine.RectTransform)); + UnityEngine.Vector3[] arg0 = new UnityEngine.Vector3[4]; + obj.GetWorldCorners(arg0); + ToLua.Push(L, arg0); + return 1; + }"; + + [OverrideDefinedAttribute] + public Vector3[] GetLocalCorners() + { + return null; + } + + [OverrideDefinedAttribute] + public Vector3[] GetWorldCorners() + { + return null; + } +} diff --git a/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_UnityEngine_RectTransform.cs.meta b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_UnityEngine_RectTransform.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..e30cb4a2755fd004da76b12a1ed669ba9a6de18b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/Extend/ToLua_UnityEngine_RectTransform.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2479ef1b120013c478a5f7148251be9e +timeCreated: 1501832587 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Editor/ToLuaExport.cs b/Assets/LuaFramework/ToLua/Editor/ToLuaExport.cs new file mode 100644 index 0000000000000000000000000000000000000000..f9f816bf8f5250815aa23e7e92c35612ca6502e7 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/ToLuaExport.cs @@ -0,0 +1,4478 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +using UnityEngine; +using System; +using System.Collections; +using System.Text; +using System.Reflection; +using System.Collections.Generic; +using LuaInterface; + +using Object = UnityEngine.Object; +using System.IO; +using System.Text.RegularExpressions; +using System.Runtime.CompilerServices; + +public enum MetaOp +{ + None = 0, + Add = 1, + Sub = 2, + Mul = 4, + Div = 8, + Eq = 16, + Neg = 32, + ToStr = 64, + ALL = Add | Sub | Mul | Div | Eq | Neg | ToStr, +} + +public enum ObjAmbig +{ + None = 0, + U3dObj = 1, + NetObj = 2, + All = 3 +} + +public class DelegateType +{ + public string name; + public Type type; + public string abr = null; + + public string strType = ""; + + public DelegateType(Type t) + { + type = t; + strType = ToLuaExport.GetTypeStr(t); + name = ToLuaExport.ConvertToLibSign(strType); + } + + public DelegateType SetAbrName(string str) + { + abr = str; + return this; + } +} + +public static class ToLuaExport +{ + public static string className = string.Empty; + public static Type type = null; + public static Type baseType = null; + + public static bool isStaticClass = true; + + static HashSet usingList = new HashSet(); + static MetaOp op = MetaOp.None; + static StringBuilder sb = null; + static List<_MethodBase> methods = new List<_MethodBase>(); + static Dictionary nameCounter = new Dictionary(); + static FieldInfo[] fields = null; + static PropertyInfo[] props = null; + static List propList = new List(); //闈為潤鎬佸睘鎬 + static List allProps = new List(); + static EventInfo[] events = null; + static List eventList = new List(); + static List<_MethodBase> ctorList = new List<_MethodBase>(); + static List ctorExtList = new List(); + static List<_MethodBase> getItems = new List<_MethodBase>(); //鐗规畩灞炴 + static List<_MethodBase> setItems = new List<_MethodBase>(); + + static BindingFlags binding = BindingFlags.Public | BindingFlags.Static | BindingFlags.IgnoreCase; + + static ObjAmbig ambig = ObjAmbig.NetObj; + //wrapClaaName + "Wrap" = 瀵煎嚭鏂囦欢鍚嶏紝瀵煎嚭绫诲悕 + public static string wrapClassName = ""; + + public static string libClassName = ""; + public static string extendName = ""; + public static Type extendType = null; + + public static HashSet eventSet = new HashSet(); + public static List extendList = new List(); + + public static List memberFilter = new List + { + "String.Chars", + "Directory.SetAccessControl", + "File.GetAccessControl", + "File.SetAccessControl", + //UnityEngine + "AnimationClip.averageDuration", + "AnimationClip.averageAngularSpeed", + "AnimationClip.averageSpeed", + "AnimationClip.apparentSpeed", + "AnimationClip.isLooping", + "AnimationClip.isAnimatorMotion", + "AnimationClip.isHumanMotion", + "AnimatorOverrideController.PerformOverrideClipListCleanup", + "AnimatorControllerParameter.name", + "Caching.SetNoBackupFlag", + "Caching.ResetNoBackupFlag", + "Light.areaSize", + "Light.lightmappingMode", + "Light.lightmapBakeType", + "Light.shadowAngle", + "Light.shadowRadius", + "Security.GetChainOfTrustValue", + "Texture2D.alphaIsTransparency", + "WWW.movie", + "WWW.GetMovieTexture", + "WebCamTexture.MarkNonReadable", + "WebCamTexture.isReadable", + "Graphic.OnRebuildRequested", + "Text.OnRebuildRequested", + "Resources.LoadAssetAtPath", + "Application.ExternalEval", + "Handheld.SetActivityIndicatorStyle", + "CanvasRenderer.OnRequestRebuild", + "CanvasRenderer.onRequestRebuild", + "Terrain.bakeLightProbesForTrees", + "MonoBehaviour.runInEditMode", + "TextureFormat.DXT1Crunched", + "TextureFormat.DXT5Crunched", + "Texture.imageContentsHash", + //NGUI + "UIInput.ProcessEvent", + "UIWidget.showHandlesWithMoveTool", + "UIWidget.showHandles", + "Input.IsJoystickPreconfigured", + "UIDrawCall.isActive" + }; + + class _MethodBase + { + public bool IsStatic + { + get + { + return method.IsStatic; + } + } + + public bool IsConstructor + { + get + { + return method.IsConstructor; + } + } + + public string Name + { + get + { + return method.Name; + } + } + + public MethodBase Method + { + get + { + return method; + } + } + + public bool IsGenericMethod + { + get + { + return method.IsGenericMethod; + } + } + + + MethodBase method; + ParameterInfo[] args; + + public _MethodBase(MethodBase m, int argCount = -1) + { + method = m; + ParameterInfo[] infos = m.GetParameters(); + argCount = argCount != -1 ? argCount : infos.Length; + args = new ParameterInfo[argCount]; + Array.Copy(infos, args, argCount); + } + + public ParameterInfo[] GetParameters() + { + return args; + } + + public int GetParamsCount() + { + int c = method.IsStatic ? 0 : 1; + return args.Length + c; + } + + public int GetEqualParamsCount(_MethodBase b) + { + int count = 0; + List list1 = new List(); + List list2 = new List(); + + if (!IsStatic) + { + list1.Add(type); + } + + if (!b.IsStatic) + { + list2.Add(type); + } + + for (int i = 0; i < args.Length; i++) + { + list1.Add(GetParameterType(args[i])); + } + + ParameterInfo[] p = b.args; + + for (int i = 0; i < p.Length; i++) + { + list2.Add(GetParameterType(p[i])); + } + + for (int i = 0; i < list1.Count; i++) + { + if (list1[i] != list2[i]) + { + break; + } + + ++count; + } + + return count; + } + + public string GenParamTypes(int offset = 0) + { + StringBuilder sb = new StringBuilder(); + List list = new List(); + + if (!method.IsStatic) + { + list.Add(type); + } + + for (int i = 0; i < args.Length; i++) + { + if (IsParams(args[i])) + { + continue; + } + + if (args[i].Attributes != ParameterAttributes.Out) + { + list.Add(GetGenericBaseType(method, args[i].ParameterType)); + } + else + { + Type genericClass = typeof(LuaOut<>); + var elementType = args[i].ParameterType.GetElementType(); + if(null != elementType) + { + Type t = genericClass.MakeGenericType(elementType); + list.Add(t); + } + } + } + + for (int i = offset; i < list.Count - 1; i++) + { + sb.Append(GetTypeOf(list[i], ", ")); + } + + if (list.Count > 0) + { + sb.Append(GetTypeOf(list[list.Count - 1], "")); + } + + return sb.ToString(); + } + + public bool HasSetIndex() + { + if (method.Name == "set_Item") + { + return true; + } + + object[] attrs = type.GetCustomAttributes(true); + + for (int i = 0; i < attrs.Length; i++) + { + if (attrs[i] is DefaultMemberAttribute) + { + return method.Name == "set_ItemOf"; + } + } + + return false; + } + + public bool HasGetIndex() + { + if (method.Name == "get_Item") + { + return true; + } + + object[] attrs = type.GetCustomAttributes(true); + + for (int i = 0; i < attrs.Length; i++) + { + if (attrs[i] is DefaultMemberAttribute) + { + return method.Name == "get_ItemOf"; + } + } + + return false; + } + + public Type GetReturnType() + { + MethodInfo m = method as MethodInfo; + + if (m != null) + { + return m.ReturnType; + } + + return null; + } + + public string GetTotalName() + { + string[] ss = new string[args.Length]; + + for (int i = 0; i < args.Length; i++) + { + ss[i] = GetTypeStr(args[i].GetType()); + } + + if (!ToLuaExport.IsGenericMethod(method)) + { + return Name + "(" + string.Join(",", ss) + ")"; + } + else + { + Type[] gts = method.GetGenericArguments(); + string[] ts = new string[gts.Length]; + + for (int i = 0; i < gts.Length; i++) + { + ts[i] = GetTypeStr(gts[i]); + } + + return Name + "<" + string.Join(",", ts) + ">" + "(" + string.Join(",", ss) + ")"; + } + } + + public bool BeExtend = false; + + public int ProcessParams(int tab, bool beConstruct, int checkTypePos) + { + ParameterInfo[] paramInfos = args; + + if (BeExtend) + { + ParameterInfo[] pt = new ParameterInfo[paramInfos.Length - 1]; + Array.Copy(paramInfos, 1, pt, 0, pt.Length); + paramInfos = pt; + } + + int count = paramInfos.Length; + string head = string.Empty; + PropertyInfo pi = null; + int methodType = GetMethodType(method, out pi); + int offset = ((method.IsStatic && !BeExtend) || beConstruct) ? 1 : 2; + + if (method.Name == "op_Equality") + { + checkTypePos = -1; + } + + for (int i = 0; i < tab; i++) + { + head += "\t"; + } + + if ((!method.IsStatic && !beConstruct) || BeExtend) + { + if (checkTypePos > 0) + { + CheckObject(head, type, className, 1); + } + else + { + if (method.Name == "Equals") + { + if (!type.IsValueType && checkTypePos > 0) + { + CheckObject(head, type, className, 1); + } + else + { + sb.AppendFormat("{0}{1} obj = ({1})ToLua.ToObject(L, 1);\r\n", head, className); + } + } + else if (checkTypePos > 0)// && methodType == 0) + { + CheckObject(head, type, className, 1); + } + else + { + ToObject(head, type, className, 1); + } + } + } + + StringBuilder sbArgs = new StringBuilder(); + List refList = new List(); + List refTypes = new List(); + checkTypePos = checkTypePos - offset + 1; + + for (int j = 0; j < count; j++) + { + ParameterInfo param = paramInfos[j]; + string arg = "arg" + j; + bool beOutArg = param.Attributes == ParameterAttributes.Out; + bool beParams = IsParams(param); + Type t = GetGenericBaseType(method, param.ParameterType); + ProcessArg(t, head, arg, offset + j, j >= checkTypePos, beParams, beOutArg); + } + + for (int j = 0; j < count; j++) + { + ParameterInfo param = paramInfos[j]; + + if (!param.ParameterType.IsByRef) + { + sbArgs.Append("arg"); + } + else + { + if (param.Attributes == ParameterAttributes.Out) + { + sbArgs.Append("out arg"); + } + else + { + sbArgs.Append("ref arg"); + } + + refList.Add("arg" + j); + refTypes.Add(GetRefBaseType(param.ParameterType)); + } + + sbArgs.Append(j); + + if (j != count - 1) + { + sbArgs.Append(", "); + } + } + + if (beConstruct) + { + sb.AppendFormat("{2}{0} obj = new {0}({1});\r\n", className, sbArgs.ToString(), head); + string str = GetPushFunction(type); + sb.AppendFormat("{0}ToLua.{1}(L, obj);\r\n", head, str); + + for (int i = 0; i < refList.Count; i++) + { + GenPushStr(refTypes[i], refList[i], head); + } + + return refList.Count + 1; + } + + string obj = (method.IsStatic && !BeExtend) ? className : "obj"; + Type retType = GetReturnType(); + + if (retType == typeof(void)) + { + if (HasSetIndex()) + { + if (methodType == 2) + { + string str = sbArgs.ToString(); + string[] ss = str.Split(','); + str = string.Join(",", ss, 0, ss.Length - 1); + + sb.AppendFormat("{0}{1}[{2}] ={3};\r\n", head, obj, str, ss[ss.Length - 1]); + } + else if (methodType == 1) + { + sb.AppendFormat("{0}{1}.Item = arg0;\r\n", head, obj, pi.Name); + } + else + { + sb.AppendFormat("{0}{1}.{2}({3});\r\n", head, obj, method.Name, sbArgs.ToString()); + } + } + else if (methodType == 1) + { + sb.AppendFormat("{0}{1}.{2} = arg0;\r\n", head, obj, pi.Name); + } + else + { + sb.AppendFormat("{3}{0}.{1}({2});\r\n", obj, method.Name, sbArgs.ToString(), head); + } + } + else + { + Type genericType = GetGenericBaseType(method, retType); + string ret = GetTypeStr(genericType); + + if (method.Name.StartsWith("op_")) + { + CallOpFunction(method.Name, tab, ret); + } + else if (HasGetIndex()) + { + if (methodType == 2) + { + sb.AppendFormat("{0}{1} o = {2}[{3}];\r\n", head, ret, obj, sbArgs.ToString()); + } + else if (methodType == 1) + { + sb.AppendFormat("{0}{1} o = {2}.Item;\r\n", head, ret, obj); + } + else + { + sb.AppendFormat("{0}{1} o = {2}.{3}({4});\r\n", head, ret, obj, method.Name, sbArgs.ToString()); + } + } + else if (method.Name == "Equals") + { + if (type.IsValueType || method.GetParameters().Length > 1) + { + sb.AppendFormat("{0}{1} o = obj.Equals({2});\r\n", head, ret, sbArgs.ToString()); + } + else + { + sb.AppendFormat("{0}{1} o = obj != null ? obj.Equals({2}) : arg0 == null;\r\n", head, ret, sbArgs.ToString()); + } + } + else if (methodType == 1) + { + sb.AppendFormat("{0}{1} o = {2}.{3};\r\n", head, ret, obj, pi.Name); + } + else + { + sb.AppendFormat("{0}{1} o = {2}.{3}({4});\r\n", head, ret, obj, method.Name, sbArgs.ToString()); + } + + bool isbuffer = IsByteBuffer(); + GenPushStr(retType, "o", head, isbuffer); + } + + for (int i = 0; i < refList.Count; i++) + { + if (refTypes[i] == typeof(RaycastHit) && method.Name == "Raycast" && (type == typeof(Physics) || type == typeof(Collider))) + { + sb.AppendFormat("{0}if (o) ToLua.Push(L, {1}); else LuaDLL.lua_pushnil(L);\r\n", head, refList[i]); + } + else + { + GenPushStr(refTypes[i], refList[i], head); + } + } + + if (!method.IsStatic && type.IsValueType && method.Name != "ToString") + { + sb.Append(head + "ToLua.SetBack(L, 1, obj);\r\n"); + } + + return refList.Count; + } + + bool IsByteBuffer() + { + object[] attrs = method.GetCustomAttributes(true); + + for (int j = 0; j < attrs.Length; j++) + { + Type t = attrs[j].GetType(); + + if (t == typeof(LuaByteBufferAttribute)) + { + return true; + } + } + + return false; + } + } + + public static List memberInfoFilter = new List + { + //鍙簿纭煡鎵句竴涓嚱鏁 + //Type.GetMethod(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers); + }; + + public static bool IsMemberFilter(MemberInfo mi) + { + return memberInfoFilter.Contains(mi) || memberFilter.Contains(type.Name + "." + mi.Name); + } + + public static bool IsMemberFilter(Type t) + { + string name = LuaMisc.GetTypeName(t); + return memberInfoFilter.Contains(t) || memberFilter.Find((p) => { return name.Contains(p); }) != null; + } + + static ToLuaExport() + { + Debugger.useLog = true; + } + + public static void Clear() + { + className = null; + type = null; + baseType = null; + isStaticClass = false; + usingList.Clear(); + op = MetaOp.None; + sb = new StringBuilder(); + fields = null; + props = null; + methods.Clear(); + allProps.Clear(); + propList.Clear(); + eventList.Clear(); + ctorList.Clear(); + ctorExtList.Clear(); + ambig = ObjAmbig.NetObj; + wrapClassName = ""; + libClassName = ""; + extendName = ""; + eventSet.Clear(); + extendType = null; + nameCounter.Clear(); + events = null; + getItems.Clear(); + setItems.Clear(); + } + + private static MetaOp GetOp(string name) + { + if (name == "op_Addition") + { + return MetaOp.Add; + } + else if (name == "op_Subtraction") + { + return MetaOp.Sub; + } + else if (name == "op_Equality") + { + return MetaOp.Eq; + } + else if (name == "op_Multiply") + { + return MetaOp.Mul; + } + else if (name == "op_Division") + { + return MetaOp.Div; + } + else if (name == "op_UnaryNegation") + { + return MetaOp.Neg; + } + else if (name == "ToString" && !isStaticClass) + { + return MetaOp.ToStr; + } + + return MetaOp.None; + } + + //鎿嶄綔绗﹀嚱鏁版棤娉曢氳繃缁ф壙metatable瀹炵幇 + static void GenBaseOpFunction(List<_MethodBase> list) + { + Type baseType = type.BaseType; + + while (baseType != null) + { + if (allTypes.IndexOf(baseType) >= 0) + { + MethodInfo[] methods = baseType.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.Static | BindingFlags.IgnoreCase); + + for (int i = 0; i < methods.Length; i++) + { + MetaOp baseOp = GetOp(methods[i].Name); + + if (baseOp != MetaOp.None && (op & baseOp) == 0) + { + if (baseOp != MetaOp.ToStr) + { + list.Add(new _MethodBase(methods[i])); + } + + op |= baseOp; + } + } + } + + baseType = baseType.BaseType; + } + } + + public static void Generate(string dir) + { +#if !EXPORT_INTERFACE + Type iterType = typeof(System.Collections.IEnumerator); + + if (type.IsInterface && type != iterType) + { + return; + } +#endif + + //Debugger.Log("Begin Generate lua Wrap for class {0}", className); + sb = new StringBuilder(); + usingList.Add("System"); + + if (wrapClassName == "") + { + wrapClassName = className; + } + + if (type.IsEnum) + { + BeginCodeGen(); + GenEnum(); + EndCodeGen(dir); + return; + } + + InitMethods(); + InitPropertyList(); + InitCtorList(); + + BeginCodeGen(); + + GenRegisterFunction(); + GenConstructFunction(); + GenItemPropertyFunction(); + GenFunctions(); + //GenToStringFunction(); + GenIndexFunc(); + GenNewIndexFunc(); + GenOutFunction(); + GenEventFunctions(); + + EndCodeGen(dir); + } + + //璁板綍鎵鏈夌殑瀵煎嚭绫诲瀷 + public static List allTypes = new List(); + + static bool BeDropMethodType(MethodInfo md) + { + Type t = md.DeclaringType; + + if (t == type) + { + return true; + } + + return allTypes.IndexOf(t) < 0; + } + + //鏄惁涓哄鎵樼被鍨嬶紝娌″鐞嗗簾寮 + public static bool IsDelegateType(Type t) + { + if (!typeof(System.MulticastDelegate).IsAssignableFrom(t) || t == typeof(System.MulticastDelegate)) + { + return false; + } + + if (IsMemberFilter(t)) + { + return false; + } + + return true; + } + + static void BeginCodeGen() + { + sb.AppendFormat("public class {0}Wrap\r\n", wrapClassName); + sb.AppendLineEx("{"); + } + + static void EndCodeGen(string dir) + { + sb.AppendLineEx("}\r\n"); + SaveFile(dir + wrapClassName + "Wrap.cs"); + } + + static void InitMethods() + { + bool flag = false; + + if (baseType != null || isStaticClass) + { + binding |= BindingFlags.DeclaredOnly; + flag = true; + } + + List<_MethodBase> list = new List<_MethodBase>(); + MethodInfo[] infos = type.GetMethods(BindingFlags.Instance | binding); + + for (int i = 0; i < infos.Length; i++) + { + list.Add(new _MethodBase(infos[i])); + } + + for (int i = list.Count - 1; i >= 0; --i) + { + //鍘绘帀鎿嶄綔绗﹀嚱鏁 + if (list[i].Name.StartsWith("op_") || list[i].Name.StartsWith("add_") || list[i].Name.StartsWith("remove_")) + { + if (!IsNeedOp(list[i].Name)) + { + list.RemoveAt(i); + } + + continue; + } + + //鎵旀帀 unity3d 搴熷純鐨勫嚱鏁 + if (IsObsolete(list[i].Method)) + { + list.RemoveAt(i); + } + } + + PropertyInfo[] ps = type.GetProperties(); + + for (int i = 0; i < ps.Length; i++) + { + if (IsObsolete(ps[i])) + { + list.RemoveAll((p) => { return p.Method == ps[i].GetGetMethod() || p.Method == ps[i].GetSetMethod(); }); + } + else + { + MethodInfo md = ps[i].GetGetMethod(); + + if (md != null) + { + int index = list.FindIndex((m) => { return m.Method == md; }); + + if (index >= 0) + { + if (md.GetParameters().Length == 0) + { + list.RemoveAt(index); + } + else if (list[index].HasGetIndex()) + { + getItems.Add(list[index]); + } + } + } + + md = ps[i].GetSetMethod(); + + if (md != null) + { + int index = list.FindIndex((m) => { return m.Method == md; }); + + if (index >= 0) + { + if (md.GetParameters().Length == 1) + { + list.RemoveAt(index); + } + else if (list[index].HasSetIndex()) + { + setItems.Add(list[index]); + } + } + } + } + } + + if (flag && !isStaticClass) + { + List baseList = new List(type.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.IgnoreCase)); + + for (int i = baseList.Count - 1; i >= 0; i--) + { + if (BeDropMethodType(baseList[i])) + { + baseList.RemoveAt(i); + } + } + + HashSet addList = new HashSet(); + + for (int i = 0; i < list.Count; i++) + { + List mds = baseList.FindAll((p) => { return p.Name == list[i].Name; }); + + for (int j = 0; j < mds.Count; j++) + { + addList.Add(mds[j]); + baseList.Remove(mds[j]); + } + } + + foreach(var iter in addList) + { + list.Add(new _MethodBase(iter)); + } + } + + for (int i = 0; i < list.Count; i++) + { + GetDelegateTypeFromMethodParams(list[i]); + } + + ProcessExtends(list); + GenBaseOpFunction(list); + + for (int i = 0; i < list.Count; i++) + { + int count = GetDefalutParamCount(list[i].Method); + int length = list[i].GetParameters().Length; + + for (int j = 0; j < count + 1; j++) + { + _MethodBase r = new _MethodBase(list[i].Method, length - j); + r.BeExtend = list[i].BeExtend; + methods.Add(r); + } + } + } + + static void InitPropertyList() + { + props = type.GetProperties(BindingFlags.GetProperty | BindingFlags.SetProperty | BindingFlags.Instance | binding); + propList.AddRange(type.GetProperties(BindingFlags.GetProperty | BindingFlags.SetProperty | BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase)); + fields = type.GetFields(BindingFlags.GetField | BindingFlags.SetField | BindingFlags.Instance | binding); + events = type.GetEvents(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.Static); + eventList.AddRange(type.GetEvents(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public)); + + List fieldList = new List(); + fieldList.AddRange(fields); + + for (int i = fieldList.Count - 1; i >= 0; i--) + { + if (IsObsolete(fieldList[i])) + { + fieldList.RemoveAt(i); + } + else if (IsDelegateType(fieldList[i].FieldType)) + { + eventSet.Add(fieldList[i].FieldType); + } + } + + fields = fieldList.ToArray(); + + List piList = new List(); + piList.AddRange(props); + + for (int i = piList.Count - 1; i >= 0; i--) + { + if (IsObsolete(piList[i])) + { + piList.RemoveAt(i); + } + else if (piList[i].Name == "Item" && IsItemThis(piList[i])) + { + piList.RemoveAt(i); + } + else if(piList[i].GetGetMethod() != null && HasGetIndex(piList[i].GetGetMethod())) + { + piList.RemoveAt(i); + } + else if (piList[i].GetSetMethod() != null && HasSetIndex(piList[i].GetSetMethod())) + { + piList.RemoveAt(i); + } + else if (IsDelegateType(piList[i].PropertyType)) + { + eventSet.Add(piList[i].PropertyType); + } + } + + props = piList.ToArray(); + + for (int i = propList.Count - 1; i >= 0; i--) + { + if (IsObsolete(propList[i])) + { + propList.RemoveAt(i); + } + } + + allProps.AddRange(props); + allProps.AddRange(propList); + + List evList = new List(); + evList.AddRange(events); + + for (int i = evList.Count - 1; i >= 0; i--) + { + if (IsObsolete(evList[i])) + { + evList.RemoveAt(i); + } + else if (IsDelegateType(evList[i].EventHandlerType)) + { + eventSet.Add(evList[i].EventHandlerType); + } + } + + events = evList.ToArray(); + + for (int i = eventList.Count - 1; i >= 0; i--) + { + if (IsObsolete(eventList[i])) + { + eventList.RemoveAt(i); + } + } + } + + static void SaveFile(string file) + { + using (StreamWriter textWriter = new StreamWriter(file, false, Encoding.UTF8)) + { + StringBuilder usb = new StringBuilder(); + usb.AppendLineEx("//this source code was auto-generated by tolua#, do not modify it"); + + foreach (string str in usingList) + { + usb.AppendFormat("using {0};\r\n", str); + } + + usb.AppendLineEx("using LuaInterface;"); + + if (ambig == ObjAmbig.All) + { + usb.AppendLineEx("using Object = UnityEngine.Object;"); + } + + usb.AppendLineEx(); + + textWriter.Write(usb.ToString()); + textWriter.Write(sb.ToString()); + textWriter.Flush(); + textWriter.Close(); + } + } + + static string GetMethodName(MethodBase md) + { + if (md.Name.StartsWith("op_")) + { + return md.Name; + } + + object[] attrs = md.GetCustomAttributes(true); + + for (int i = 0; i < attrs.Length; i++) + { + if (attrs[i] is LuaRenameAttribute) + { + LuaRenameAttribute attr = attrs[i] as LuaRenameAttribute; + return attr.Name; + } + } + + return md.Name; + } + + static bool HasGetIndex(MemberInfo md) + { + if (md.Name == "get_Item") + { + return true; + } + + object[] attrs = type.GetCustomAttributes(true); + + for (int i = 0; i < attrs.Length; i++) + { + if (attrs[i] is DefaultMemberAttribute) + { + return md.Name == "get_ItemOf"; + } + } + + return false; + } + + static bool HasSetIndex(MemberInfo md) + { + if (md.Name == "set_Item") + { + return true; + } + + object[] attrs = type.GetCustomAttributes(true); + + for (int i = 0; i < attrs.Length; i++) + { + if (attrs[i] is DefaultMemberAttribute) + { + return md.Name == "set_ItemOf"; + } + } + + return false; + } + + static bool IsThisArray(MethodBase md, int count) + { + ParameterInfo[] pis = md.GetParameters(); + + if (pis.Length != count) + { + return false; + } + + if (pis[0].ParameterType == typeof(int)) + { + return true; + } + + return false; + } + + static void GenRegisterFuncItems() + { + //bool isList = type.IsGenericType && type.GetGenericTypeDefinition() == typeof(List<>); + //娉ㄥ唽搴撳嚱鏁 + for (int i = 0; i < methods.Count; i++) + { + _MethodBase m = methods[i]; + int count = 1; + + if (IsGenericMethod(m.Method)) + { + continue; + } + + string name = GetMethodName(m.Method); + + if (!nameCounter.TryGetValue(name, out count)) + { + if (name == "get_Item" && IsThisArray(m.Method, 1)) + { + sb.AppendFormat("\t\tL.RegFunction(\"{0}\", get_Item);\r\n", ".geti"); + } + else if (name == "set_Item" && IsThisArray(m.Method, 2)) + { + sb.AppendFormat("\t\tL.RegFunction(\"{0}\", set_Item);\r\n", ".seti"); + } + + if (!name.StartsWith("op_")) + { + sb.AppendFormat("\t\tL.RegFunction(\"{0}\", {1});\r\n", name, name == "Register" ? "_Register" : name); + } + + nameCounter[name] = 1; + } + else + { + nameCounter[name] = count + 1; + } + } + + if (ctorList.Count > 0 || type.IsValueType || ctorExtList.Count > 0) + { + sb.AppendFormat("\t\tL.RegFunction(\"New\", _Create{0});\r\n", wrapClassName); + } + + if (getItems.Count > 0 || setItems.Count > 0) + { + sb.AppendLineEx("\t\tL.RegVar(\"this\", _this, null);"); + } + } + + static void GenRegisterOpItems() + { + if ((op & MetaOp.Add) != 0) + { + sb.AppendLineEx("\t\tL.RegFunction(\"__add\", op_Addition);"); + } + + if ((op & MetaOp.Sub) != 0) + { + sb.AppendLineEx("\t\tL.RegFunction(\"__sub\", op_Subtraction);"); + } + + if ((op & MetaOp.Mul) != 0) + { + sb.AppendLineEx("\t\tL.RegFunction(\"__mul\", op_Multiply);"); + } + + if ((op & MetaOp.Div) != 0) + { + sb.AppendLineEx("\t\tL.RegFunction(\"__div\", op_Division);"); + } + + if ((op & MetaOp.Eq) != 0) + { + sb.AppendLineEx("\t\tL.RegFunction(\"__eq\", op_Equality);"); + } + + if ((op & MetaOp.Neg) != 0) + { + sb.AppendLineEx("\t\tL.RegFunction(\"__unm\", op_UnaryNegation);"); + } + + if ((op & MetaOp.ToStr) != 0) + { + sb.AppendLineEx("\t\tL.RegFunction(\"__tostring\", ToLua.op_ToString);"); + } + } + + static bool IsItemThis(PropertyInfo info) + { + MethodInfo md = info.GetGetMethod(); + + if (md != null) + { + return md.GetParameters().Length != 0; + } + + md = info.GetSetMethod(); + + if (md != null) + { + return md.GetParameters().Length != 1; + } + + return true; + } + + static void GenRegisterVariables() + { + if (fields.Length == 0 && props.Length == 0 && events.Length == 0 && isStaticClass && baseType == null) + { + return; + } + + for (int i = 0; i < fields.Length; i++) + { + if (fields[i].IsLiteral || fields[i].IsPrivate || fields[i].IsInitOnly) + { + if (fields[i].IsLiteral && fields[i].FieldType.IsPrimitive && !fields[i].FieldType.IsEnum) + { + double d = Convert.ToDouble(fields[i].GetValue(null)); + sb.AppendFormat("\t\tL.RegConstant(\"{0}\", {1});\r\n", fields[i].Name, d); + } + else + { + sb.AppendFormat("\t\tL.RegVar(\"{0}\", get_{0}, null);\r\n", fields[i].Name); + } + } + else + { + sb.AppendFormat("\t\tL.RegVar(\"{0}\", get_{0}, set_{0});\r\n", fields[i].Name); + } + } + + for (int i = 0; i < props.Length; i++) + { + if (props[i].CanRead && props[i].CanWrite && props[i].GetSetMethod(true).IsPublic) + { + _MethodBase md = methods.Find((p) => { return p.Name == "get_" + props[i].Name; }); + string get = md == null ? "get" : "_get"; + md = methods.Find((p) => { return p.Name == "set_" + props[i].Name; }); + string set = md == null ? "set" : "_set"; + sb.AppendFormat("\t\tL.RegVar(\"{0}\", {1}_{0}, {2}_{0});\r\n", props[i].Name, get, set); + } + else if (props[i].CanRead) + { + _MethodBase md = methods.Find((p) => { return p.Name == "get_" + props[i].Name; }); + sb.AppendFormat("\t\tL.RegVar(\"{0}\", {1}_{0}, null);\r\n", props[i].Name, md == null ? "get" : "_get"); + } + else if (props[i].CanWrite) + { + _MethodBase md = methods.Find((p) => { return p.Name == "set_" + props[i].Name; }); + sb.AppendFormat("\t\tL.RegVar(\"{0}\", null, {1}_{0});\r\n", props[i].Name, md == null ? "set" : "_set"); + } + } + + for (int i = 0; i < events.Length; i++) + { + sb.AppendFormat("\t\tL.RegVar(\"{0}\", get_{0}, set_{0});\r\n", events[i].Name); + } + } + + static void GenRegisterEventTypes() + { + List list = new List(); + + foreach (Type t in eventSet) + { + string funcName = null; + string space = GetNameSpace(t, out funcName); + + if (space != className) + { + list.Add(t); + continue; + } + + funcName = ConvertToLibSign(funcName); + int index = Array.FindIndex(CustomSettings.customDelegateList, (p) => { return p.type == t; }); + string abr = null; + if (index >= 0) abr = CustomSettings.customDelegateList[index].abr; + abr = abr == null ? funcName : abr; + funcName = ConvertToLibSign(space) + "_" + funcName; + + sb.AppendFormat("\t\tL.RegFunction(\"{0}\", {1});\r\n", abr, funcName); + } + + for (int i = 0; i < list.Count; i++) + { + eventSet.Remove(list[i]); + } + } + + static void GenRegisterFunction() + { + sb.AppendLineEx("\tpublic static void Register(LuaState L)"); + sb.AppendLineEx("\t{"); + + if (isStaticClass) + { + sb.AppendFormat("\t\tL.BeginStaticLibs(\"{0}\");\r\n", libClassName); + } + else if (!type.IsGenericType) + { + if (baseType == null) + { + sb.AppendFormat("\t\tL.BeginClass(typeof({0}), null);\r\n", className); + } + else + { + sb.AppendFormat("\t\tL.BeginClass(typeof({0}), typeof({1}));\r\n", className, GetBaseTypeStr(baseType)); + } + } + else + { + if (baseType == null) + { + sb.AppendFormat("\t\tL.BeginClass(typeof({0}), null, \"{1}\");\r\n", className, libClassName); + } + else + { + sb.AppendFormat("\t\tL.BeginClass(typeof({0}), typeof({1}), \"{2}\");\r\n", className, GetBaseTypeStr(baseType), libClassName); + } + } + + GenRegisterFuncItems(); + GenRegisterOpItems(); + GenRegisterVariables(); + GenRegisterEventTypes(); //娉ㄥ唽浜嬩欢绫诲瀷 + + if (!isStaticClass) + { + if (CustomSettings.outList.IndexOf(type) >= 0) + { + sb.AppendLineEx("\t\tL.RegVar(\"out\", get_out, null);"); + } + + sb.AppendFormat("\t\tL.EndClass();\r\n"); + } + else + { + sb.AppendFormat("\t\tL.EndStaticLibs();\r\n"); + } + + sb.AppendLineEx("\t}"); + } + + static bool IsParams(ParameterInfo param) + { + return param.GetCustomAttributes(typeof(ParamArrayAttribute), false).Length > 0; + } + + static void GenFunction(_MethodBase m) + { + string name = GetMethodName(m.Method); + sb.AppendLineEx("\r\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]"); + sb.AppendFormat("\tstatic int {0}(IntPtr L)\r\n", name == "Register" ? "_Register" : name); + sb.AppendLineEx("\t{"); + + if (HasAttribute(m.Method, typeof(UseDefinedAttribute))) + { + FieldInfo field = extendType.GetField(name + "Defined"); + string strfun = field.GetValue(null) as string; + sb.AppendLineEx(strfun); + sb.AppendLineEx("\t}"); + return; + } + + ParameterInfo[] paramInfos = m.GetParameters(); + int offset = m.IsStatic ? 0 : 1; + bool haveParams = HasOptionalParam(paramInfos); + int rc = m.GetReturnType() == typeof(void) ? 0 : 1; + + BeginTry(); + + if (!haveParams) + { + int count = paramInfos.Length + offset; + if (m.Name == "op_UnaryNegation") count = 2; + sb.AppendFormat("\t\t\tToLua.CheckArgsCount(L, {0});\r\n", count); + } + else + { + sb.AppendLineEx("\t\t\tint count = LuaDLL.lua_gettop(L);"); + } + + rc += m.ProcessParams(3, false, int.MaxValue); + sb.AppendFormat("\t\t\treturn {0};\r\n", rc); + EndTry(); + sb.AppendLineEx("\t}"); + } + + //娌℃湁鏈煡绫诲瀷鐨勬ā鐗堢被鍨婰ist 杩斿洖false, List杩斿洖true + static bool IsGenericConstraintType(Type t) + { + if (!t.IsGenericType) + { + return t.IsGenericParameter || t == typeof(System.ValueType); + } + + Type[] types = t.GetGenericArguments(); + + for (int i = 0; i < types.Length; i++) + { + Type t1 = types[i]; + + if (t1.IsGenericParameter || t1 == typeof(System.ValueType)) + { + return true; + } + + if (IsGenericConstraintType(t1)) + { + return true; + } + } + + return false; + } + + static bool IsGenericConstraints(Type[] constraints) + { + for (int i = 0; i < constraints.Length; i++) + { + if (!IsGenericConstraintType(constraints[i])) + { + return false; + } + } + + return true; + } + + static bool IsGenericMethod(MethodBase md) + { + if (md.IsGenericMethod) + { + Type[] gts = md.GetGenericArguments(); + List list = new List(md.GetParameters()); + + for (int i = 0; i < gts.Length; i++) + { + Type[] ts = gts[i].GetGenericParameterConstraints(); + + if (ts == null || ts.Length == 0 || IsGenericConstraints(ts)) + { + return true; + } + + ParameterInfo p = list.Find((iter) => { return iter.ParameterType == gts[i]; }); + + if (p == null) + { + return true; + } + + list.RemoveAll((iter) => { return iter.ParameterType == gts[i]; }); + } + + for (int i = 0; i < list.Count; i++) + { + Type t = list[i].ParameterType; + + if (IsGenericConstraintType(t)) + { + return true; + } + } + } + + return false; + } + + static void GenFunctions() + { + HashSet set = new HashSet(); + + for (int i = 0; i < methods.Count; i++) + { + _MethodBase m = methods[i]; + + if (IsGenericMethod(m.Method)) + { + Debugger.Log("Generic Method {0}.{1} cannot be export to lua", LuaMisc.GetTypeName(type), m.GetTotalName()); + continue; + } + + string name = GetMethodName(m.Method); + + if (nameCounter[name] > 1) + { + if (!set.Contains(name)) + { + _MethodBase mi = GenOverrideFunc(name); + + if (mi == null) + { + set.Add(name); + continue; + } + else + { + m = mi; //闈為噸杞藉嚱鏁帮紝鎴栬呮姌鍙犱箣鍚庡彧鏈変竴涓嚱鏁 + } + } + else + { + continue; + } + } + + set.Add(name); + GenFunction(m); + } + } + + static bool IsSealedType(Type t) + { + if (t.IsSealed || CustomSettings.sealedList.Contains(t)) + { + return true; + } + + if (t.IsGenericType && (t.GetGenericTypeDefinition() == typeof(List<>) || t.GetGenericTypeDefinition() == typeof(Dictionary<,>))) + { + return true; + } + + return false; + } + + static bool IsIEnumerator(Type t) + { + if (t == typeof(IEnumerator) || t == typeof(CharEnumerator)) return true; + + if (typeof(IEnumerator).IsAssignableFrom(t)) + { + if (t.IsGenericType) + { + Type gt = t.GetGenericTypeDefinition(); + + if (gt == typeof(List<>.Enumerator) || gt == typeof(Dictionary<,>.Enumerator)) + { + return true; + } + } + } + + return false; + } + + static string GetPushFunction(Type t, bool isByteBuffer = false) + { + if (t.IsEnum || t.IsPrimitive || t == typeof(string) || t == typeof(LuaTable) || t == typeof(LuaCSFunction) || t == typeof(LuaThread) || t == typeof(LuaFunction) + || t == typeof(Type) || t == typeof(IntPtr) || typeof(Delegate).IsAssignableFrom(t) || t == typeof(LuaByteBuffer) // || t == typeof(LuaInteger64) + || t == typeof(Vector3) || t == typeof(Vector2) || t == typeof(Vector4) || t == typeof(Quaternion) || t == typeof(Color) || t == typeof(RaycastHit) + || t == typeof(Ray) || t == typeof(Touch) || t == typeof(Bounds) || t == typeof(object)) + { + return "Push"; + } + else if (t.IsArray || t == typeof(System.Array)) + { + return "Push"; + } + else if (IsIEnumerator(t)) + { + return "Push"; + } + else if (t == typeof(LayerMask)) + { + return "PushLayerMask"; + } + else if (typeof(UnityEngine.Object).IsAssignableFrom(t) || typeof(UnityEngine.TrackedReference).IsAssignableFrom(t)) + { + return IsSealedType(t) ? "PushSealed" : "Push"; + } + else if (t.IsValueType) + { + if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Nullable<>)) + { + return "PusNullable"; + } + + return "PushValue"; + } + else if (IsSealedType(t)) + { + return "PushSealed"; + } + + return "PushObject"; + } + + static void DefaultConstruct() + { + sb.AppendLineEx("\r\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]"); + sb.AppendFormat("\tstatic int _Create{0}(IntPtr L)\r\n", wrapClassName); + sb.AppendLineEx("\t{"); + sb.AppendFormat("\t\t{0} obj = new {0}();\r\n", className); + GenPushStr(type, "obj", "\t\t"); + sb.AppendLineEx("\t\treturn 1;"); + sb.AppendLineEx("\t}"); + } + + static string GetCountStr(int count) + { + if (count != 0) + { + return string.Format("count - {0}", count); + } + + return "count"; + } + + static void GenOutFunction() + { + if (isStaticClass || CustomSettings.outList.IndexOf(type) < 0) + { + return; + } + + sb.AppendLineEx("\r\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]"); + sb.AppendLineEx("\tstatic int get_out(IntPtr L)"); + sb.AppendLineEx("\t{"); + sb.AppendFormat("\t\tToLua.PushOut<{0}>(L, new LuaOut<{0}>());\r\n", className); + sb.AppendLineEx("\t\treturn 1;"); + sb.AppendLineEx("\t}"); + } + + static int GetDefalutParamCount(MethodBase md) + { + int count = 0; + ParameterInfo[] infos = md.GetParameters(); + + for (int i = 0; i < infos.Length; i++) + { + if (!(infos[i].DefaultValue is DBNull)) + { + ++count; + } + } + + return count; + } + + static void InitCtorList() + { + if (isStaticClass || type.IsAbstract || typeof(MonoBehaviour).IsAssignableFrom(type)) + { + return; + } + + ConstructorInfo[] constructors = type.GetConstructors(BindingFlags.Instance | binding); + + if (extendType != null) + { + ConstructorInfo[] ctorExtends = extendType.GetConstructors(BindingFlags.Instance | binding); + + if (HasAttribute(ctorExtends[0], typeof(UseDefinedAttribute))) + { + ctorExtList.AddRange(ctorExtends); + } + } + + if (constructors.Length == 0) + { + return; + } + + for (int i = 0; i < constructors.Length; i++) + { + if (IsObsolete(constructors[i])) + { + continue; + } + + int count = GetDefalutParamCount(constructors[i]); + int length = constructors[i].GetParameters().Length; + + for (int j = 0; j < count + 1; j++) + { + _MethodBase r = new _MethodBase(constructors[i], length - j); + int index = ctorList.FindIndex((p) => { return CompareMethod(p, r) >= 0; }); + + if (index >= 0) + { + if (CompareMethod(ctorList[index], r) == 2) + { + ctorList.RemoveAt(index); + ctorList.Add(r); + } + } + else + { + ctorList.Add(r); + } + } + } + } + + static void GenConstructFunction() + { + if (ctorExtList.Count > 0) + { + if (HasAttribute(ctorExtList[0], typeof(UseDefinedAttribute))) + { + sb.AppendLineEx("\r\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]"); + sb.AppendFormat("\tstatic int _Create{0}(IntPtr L)\r\n", wrapClassName); + sb.AppendLineEx("\t{"); + + FieldInfo field = extendType.GetField(extendName + "Defined"); + string strfun = field.GetValue(null) as string; + sb.AppendLineEx(strfun); + sb.AppendLineEx("\t}"); + return; + } + } + + if (ctorList.Count == 0) + { + if (type.IsValueType) + { + DefaultConstruct(); + } + + return; + } + + ctorList.Sort(Compare); + int[] checkTypeMap = CheckCheckTypePos(ctorList); + sb.AppendLineEx("\r\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]"); + sb.AppendFormat("\tstatic int _Create{0}(IntPtr L)\r\n", wrapClassName); + sb.AppendLineEx("\t{"); + + BeginTry(); + sb.AppendLineEx("\t\t\tint count = LuaDLL.lua_gettop(L);"); + sb.AppendLineEx(); + + _MethodBase md = ctorList[0]; + bool hasEmptyCon = ctorList[0].GetParameters().Length == 0 ? true : false; + + //澶勭悊閲嶈浇鏋勯犲嚱鏁 + if (HasOptionalParam(md.GetParameters())) + { + ParameterInfo[] paramInfos = md.GetParameters(); + ParameterInfo param = paramInfos[paramInfos.Length - 1]; + string str = GetTypeStr(param.ParameterType.GetElementType()); + + if (paramInfos.Length > 1) + { + string strParams = md.GenParamTypes(1); + sb.AppendFormat("\t\t\tif (TypeChecker.CheckTypes<{0}>(L, 1) && TypeChecker.CheckParamsType<{1}>(L, {2}, {3}))\r\n", strParams, str, paramInfos.Length, GetCountStr(paramInfos.Length - 1)); + } + else + { + sb.AppendFormat("\t\t\tif (TypeChecker.CheckParamsType<{0}>(L, {1}, {2}))\r\n", str, paramInfos.Length, GetCountStr(paramInfos.Length - 1)); + } + } + else + { + ParameterInfo[] paramInfos = md.GetParameters(); + + if (ctorList.Count == 1 || paramInfos.Length == 0 || paramInfos.Length + 1 <= checkTypeMap[0]) + { + sb.AppendFormat("\t\t\tif (count == {0})\r\n", paramInfos.Length); + } + else + { + string strParams = md.GenParamTypes(checkTypeMap[0]); + sb.AppendFormat("\t\t\tif (count == {0} && TypeChecker.CheckTypes<{1}>(L, {2}))\r\n", paramInfos.Length, strParams, checkTypeMap[0]); + } + } + + sb.AppendLineEx("\t\t\t{"); + int rc = md.ProcessParams(4, true, checkTypeMap[0] - 1); + sb.AppendFormat("\t\t\t\treturn {0};\r\n", rc); + sb.AppendLineEx("\t\t\t}"); + + for (int i = 1; i < ctorList.Count; i++) + { + hasEmptyCon = ctorList[i].GetParameters().Length == 0 ? true : hasEmptyCon; + md = ctorList[i]; + ParameterInfo[] paramInfos = md.GetParameters(); + + if (!HasOptionalParam(md.GetParameters())) + { + string strParams = md.GenParamTypes(checkTypeMap[i]); + + if (paramInfos.Length + 1 > checkTypeMap[i]) + { + sb.AppendFormat("\t\t\telse if (count == {0} && TypeChecker.CheckTypes<{1}>(L, {2}))\r\n", paramInfos.Length, strParams, checkTypeMap[i]); + } + else + { + sb.AppendFormat("\t\t\telse if (count == {0})\r\n", paramInfos.Length); + } + } + else + { + ParameterInfo param = paramInfos[paramInfos.Length - 1]; + string str = GetTypeStr(param.ParameterType.GetElementType()); + + if (paramInfos.Length > 1) + { + string strParams = md.GenParamTypes(1); + sb.AppendFormat("\t\t\telse if (TypeChecker.CheckTypes<{0}>(L, 1) && TypeChecker.CheckParamsType<{1}>(L, {2}, {3}))\r\n", strParams, str, paramInfos.Length, GetCountStr(paramInfos.Length - 1)); + } + else + { + sb.AppendFormat("\t\t\telse if (TypeChecker.CheckParamsType<{0}>(L, {1}, {2}))\r\n", str, paramInfos.Length, GetCountStr(paramInfos.Length - 1)); + } + } + + sb.AppendLineEx("\t\t\t{"); + rc = md.ProcessParams(4, true, checkTypeMap[i] - 1); + sb.AppendFormat("\t\t\t\treturn {0};\r\n", rc); + sb.AppendLineEx("\t\t\t}"); + } + + if (type.IsValueType && !hasEmptyCon) + { + sb.AppendLineEx("\t\t\telse if (count == 0)"); + sb.AppendLineEx("\t\t\t{"); + sb.AppendFormat("\t\t\t\t{0} obj = new {0}();\r\n", className); + GenPushStr(type, "obj", "\t\t\t\t"); + sb.AppendLineEx("\t\t\t\treturn 1;"); + sb.AppendLineEx("\t\t\t}"); + } + + sb.AppendLineEx("\t\t\telse"); + sb.AppendLineEx("\t\t\t{"); + sb.AppendFormat("\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to ctor method: {0}.New\");\r\n", className); + sb.AppendLineEx("\t\t\t}"); + + EndTry(); + sb.AppendLineEx("\t}"); + } + + + //this[] 闈為潤鎬佸嚱鏁 + static void GenItemPropertyFunction() + { + int flag = 0; + + if (getItems.Count > 0) + { + sb.AppendLineEx("\r\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]"); + sb.AppendLineEx("\tstatic int _get_this(IntPtr L)"); + sb.AppendLineEx("\t{"); + BeginTry(); + + if (getItems.Count == 1) + { + _MethodBase m = getItems[0]; + int count = m.GetParameters().Length + 1; + sb.AppendFormat("\t\t\tToLua.CheckArgsCount(L, {0});\r\n", count); + m.ProcessParams(3, false, int.MaxValue); + sb.AppendLineEx("\t\t\treturn 1;\r\n"); + } + else + { + getItems.Sort(Compare); + int[] checkTypeMap = CheckCheckTypePos(getItems); + + sb.AppendLineEx("\t\t\tint count = LuaDLL.lua_gettop(L);"); + sb.AppendLineEx(); + + for (int i = 0; i < getItems.Count; i++) + { + GenOverrideFuncBody(getItems[i], i == 0, checkTypeMap[i]); + } + + sb.AppendLineEx("\t\t\telse"); + sb.AppendLineEx("\t\t\t{"); + sb.AppendFormat("\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to operator method: {0}.this\");\r\n", className); + sb.AppendLineEx("\t\t\t}"); + } + + EndTry(); + sb.AppendLineEx("\t}"); + flag |= 1; + } + + if (setItems.Count > 0) + { + sb.AppendLineEx("\r\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]"); + sb.AppendLineEx("\tstatic int _set_this(IntPtr L)"); + sb.AppendLineEx("\t{"); + BeginTry(); + + if (setItems.Count == 1) + { + _MethodBase m = setItems[0]; + int count = m.GetParameters().Length + 1; + sb.AppendFormat("\t\t\tToLua.CheckArgsCount(L, {0});\r\n", count); + m.ProcessParams(3, false, int.MaxValue); + sb.AppendLineEx("\t\t\treturn 0;\r\n"); + } + else + { + setItems.Sort(Compare); + int[] checkTypeMap = CheckCheckTypePos(setItems); + + sb.AppendLineEx("\t\t\tint count = LuaDLL.lua_gettop(L);"); + sb.AppendLineEx(); + + for (int i = 0; i < setItems.Count; i++) + { + GenOverrideFuncBody(setItems[i], i == 0, checkTypeMap[i]); + } + + sb.AppendLineEx("\t\t\telse"); + sb.AppendLineEx("\t\t\t{"); + sb.AppendFormat("\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to operator method: {0}.this\");\r\n", className); + sb.AppendLineEx("\t\t\t}"); + } + + + EndTry(); + sb.AppendLineEx("\t}"); + flag |= 2; + } + + if (flag != 0) + { + sb.AppendLineEx("\r\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]"); + sb.AppendLineEx("\tstatic int _this(IntPtr L)"); + sb.AppendLineEx("\t{"); + BeginTry(); + sb.AppendLineEx("\t\t\tLuaDLL.lua_pushvalue(L, 1);"); + sb.AppendFormat("\t\t\tLuaDLL.tolua_bindthis(L, {0}, {1});\r\n", (flag & 1) == 1 ? "_get_this" : "null", (flag & 2) == 2 ? "_set_this" : "null"); + sb.AppendLineEx("\t\t\treturn 1;"); + EndTry(); + sb.AppendLineEx("\t}"); + } + } + + static int GetOptionalParamPos(ParameterInfo[] infos) + { + for (int i = 0; i < infos.Length; i++) + { + if (IsParams(infos[i])) + { + return i; + } + } + + return -1; + } + + static bool Is64bit(Type t) + { + return t == typeof(long) || t == typeof(ulong); + } + + static int Compare(_MethodBase lhs, _MethodBase rhs) + { + int off1 = lhs.IsStatic ? 0 : 1; + int off2 = rhs.IsStatic ? 0 : 1; + + ParameterInfo[] lp = lhs.GetParameters(); + ParameterInfo[] rp = rhs.GetParameters(); + + int pos1 = GetOptionalParamPos(lp); + int pos2 = GetOptionalParamPos(rp); + + if (pos1 >= 0 && pos2 < 0) + { + return 1; + } + else if (pos1 < 0 && pos2 >= 0) + { + return -1; + } + else if (pos1 >= 0 && pos2 >= 0) + { + pos1 += off1; + pos2 += off2; + + if (pos1 != pos2) + { + return pos1 > pos2 ? -1 : 1; + } + else + { + pos1 -= off1; + pos2 -= off2; + + if (lp[pos1].ParameterType.GetElementType() == typeof(object) && rp[pos2].ParameterType.GetElementType() != typeof(object)) + { + return 1; + } + else if (lp[pos1].ParameterType.GetElementType() != typeof(object) && rp[pos2].ParameterType.GetElementType() == typeof(object)) + { + return -1; + } + } + } + + int c1 = off1 + lp.Length; + int c2 = off2 + rp.Length; + + if (c1 > c2) + { + return 1; + } + else if (c1 == c2) + { + List list1 = new List(lp); + List list2 = new List(rp); + + if (list1.Count > list2.Count) + { + if (list1[0].ParameterType == typeof(object)) + { + return 1; + } + + list1.RemoveAt(0); + } + else if (list2.Count > list1.Count) + { + if (list2[0].ParameterType == typeof(object)) + { + return -1; + } + + list2.RemoveAt(0); + } + + for (int i = 0; i < list1.Count; i++) + { + if (list1[i].ParameterType == typeof(object) && list2[i].ParameterType != typeof(object)) + { + return 1; + } + else if (list1[i].ParameterType != typeof(object) && list2[i].ParameterType == typeof(object)) + { + return -1; + } + else if (list1[i].ParameterType.IsPrimitive && list2[i].ParameterType.IsPrimitive) + { + if (Is64bit(list1[i].ParameterType) && !Is64bit(list2[i].ParameterType)) + { + return 1; + } + else if (!Is64bit(list1[i].ParameterType) && Is64bit(list2[i].ParameterType)) + { + return -1; + } + else if (Is64bit(list1[i].ParameterType) && Is64bit(list2[i].ParameterType) && list1[i].ParameterType != list2[i].ParameterType) + { + if (list1[i].ParameterType == typeof(ulong)) + { + return 1; + } + + return -1; + } + } + } + + return 0; + } + else + { + return -1; + } + } + + static bool HasOptionalParam(ParameterInfo[] infos) + { + for (int i = 0; i < infos.Length; i++) + { + if (IsParams(infos[i])) + { + return true; + } + } + + return false; + } + + static void CheckObject(string head, Type type, string className, int pos) + { + if (type == typeof(object)) + { + sb.AppendFormat("{0}object obj = ToLua.CheckObject(L, {1});\r\n", head, pos); + } + else if (type == typeof(Type)) + { + sb.AppendFormat("{0}{1} obj = ToLua.CheckMonoType(L, {2});\r\n", head, className, pos); + } + else if (IsIEnumerator(type)) + { + sb.AppendFormat("{0}{1} obj = ToLua.CheckIter(L, {2});\r\n", head, className, pos); + } + else + { + if (IsSealedType(type)) + { + sb.AppendFormat("{0}{1} obj = ({1})ToLua.CheckObject(L, {2}, typeof({1}));\r\n", head, className, pos); + } + else + { + sb.AppendFormat("{0}{1} obj = ({1})ToLua.CheckObject<{1}>(L, {2});\r\n", head, className, pos); + } + } + } + + static void ToObject(string head, Type type, string className, int pos) + { + if (type == typeof(object)) + { + sb.AppendFormat("{0}object obj = ToLua.ToObject(L, {1});\r\n", head, pos); + } + else + { + sb.AppendFormat("{0}{1} obj = ({1})ToLua.ToObject(L, {2});\r\n", head, className, pos); + } + } + + static void BeginTry() + { + sb.AppendLineEx("\t\ttry"); + sb.AppendLineEx("\t\t{"); + } + + static void EndTry() + { + sb.AppendLineEx("\t\t}"); + sb.AppendLineEx("\t\tcatch (Exception e)"); + sb.AppendLineEx("\t\t{"); + sb.AppendLineEx("\t\t\treturn LuaDLL.toluaL_exception(L, e);"); + sb.AppendLineEx("\t\t}"); + } + + static Type GetRefBaseType(Type argType) + { + if (argType.IsByRef) + { + return argType.GetElementType(); + } + + return argType; + } + + static void ProcessArg(Type varType, string head, string arg, int stackPos, bool beCheckTypes = false, bool beParams = false, bool beOutArg = false) + { + varType = GetRefBaseType(varType); + string str = GetTypeStr(varType); + string checkStr = beCheckTypes ? "To" : "Check"; + + if (beOutArg) + { + if (varType.IsValueType) + { + sb.AppendFormat("{0}{1} {2};\r\n", head, str, arg); + } + else + { + sb.AppendFormat("{0}{1} {2} = null;\r\n", head, str, arg); + } + } + else if (varType == typeof(bool)) + { + string chkstr = beCheckTypes ? "lua_toboolean" : "luaL_checkboolean"; + sb.AppendFormat("{0}bool {1} = LuaDLL.{2}(L, {3});\r\n", head, arg, chkstr, stackPos); + } + else if (varType == typeof(string)) + { + sb.AppendFormat("{0}string {1} = ToLua.{2}String(L, {3});\r\n", head, arg, checkStr, stackPos); + } + else if (varType == typeof(IntPtr)) + { + sb.AppendFormat("{0}{1} {2} = ToLua.CheckIntPtr(L, {3});\r\n", head, str, arg, stackPos); + } + else if (varType == typeof(long)) + { + string chkstr = beCheckTypes ? "tolua_toint64" : "tolua_checkint64"; + sb.AppendFormat("{0}{1} {2} = LuaDLL.{3}(L, {4});\r\n", head, str, arg, chkstr, stackPos); + } + else if (varType == typeof(ulong)) + { + string chkstr = beCheckTypes ? "tolua_touint64" : "tolua_checkuint64"; + sb.AppendFormat("{0}{1} {2} = LuaDLL.{3}(L, {4});\r\n", head, str, arg, chkstr, stackPos); + } + else if (varType.IsPrimitive || IsNumberEnum(varType)) + { + string chkstr = beCheckTypes ? "lua_tonumber" : "luaL_checknumber"; + sb.AppendFormat("{0}{1} {2} = ({1})LuaDLL.{3}(L, {4});\r\n", head, str, arg, chkstr, stackPos); + } + else if (varType == typeof(LuaFunction)) + { + sb.AppendFormat("{0}LuaFunction {1} = ToLua.{2}LuaFunction(L, {3});\r\n", head, arg, checkStr, stackPos); + } + else if (varType.IsSubclassOf(typeof(System.MulticastDelegate))) + { + if (beCheckTypes) + { + sb.AppendFormat("{0}{1} {2} = ({1})ToLua.ToObject(L, {3});\r\n", head, str, arg, stackPos); + } + else + { + sb.AppendFormat("{0}{1} {2} = ({1})ToLua.CheckDelegate<{1}>(L, {3});\r\n", head, str, arg, stackPos); + } + } + else if (varType == typeof(LuaTable)) + { + sb.AppendFormat("{0}LuaTable {1} = ToLua.{2}LuaTable(L, {3});\r\n", head, arg, checkStr, stackPos); + } + else if (varType == typeof(Vector2)) + { + sb.AppendFormat("{0}UnityEngine.Vector2 {1} = ToLua.ToVector2(L, {2});\r\n", head, arg, stackPos); + } + else if (varType == typeof(Vector3)) + { + sb.AppendFormat("{0}UnityEngine.Vector3 {1} = ToLua.ToVector3(L, {2});\r\n", head, arg, stackPos); + } + else if (varType == typeof(Vector4)) + { + sb.AppendFormat("{0}UnityEngine.Vector4 {1} = ToLua.ToVector4(L, {2});\r\n", head, arg, stackPos); + } + else if (varType == typeof(Quaternion)) + { + sb.AppendFormat("{0}UnityEngine.Quaternion {1} = ToLua.ToQuaternion(L, {2});\r\n", head, arg, stackPos); + } + else if (varType == typeof(Color)) + { + sb.AppendFormat("{0}UnityEngine.Color {1} = ToLua.ToColor(L, {2});\r\n", head, arg, stackPos); + } + else if (varType == typeof(Ray)) + { + sb.AppendFormat("{0}UnityEngine.Ray {1} = ToLua.ToRay(L, {2});\r\n", head, arg, stackPos); + } + else if (varType == typeof(Bounds)) + { + sb.AppendFormat("{0}UnityEngine.Bounds {1} = ToLua.ToBounds(L, {2});\r\n", head, arg, stackPos); + } + else if (varType == typeof(LayerMask)) + { + sb.AppendFormat("{0}UnityEngine.LayerMask {1} = ToLua.ToLayerMask(L, {2});\r\n", head, arg, stackPos); + } + else if (varType == typeof(object)) + { + sb.AppendFormat("{0}object {1} = ToLua.ToVarObject(L, {2});\r\n", head, arg, stackPos); + } + else if (varType == typeof(LuaByteBuffer)) + { + sb.AppendFormat("{0}LuaByteBuffer {1} = new LuaByteBuffer(ToLua.CheckByteBuffer(L, {2}));\r\n", head, arg, stackPos); + } + else if (varType == typeof(Type)) + { + if (beCheckTypes) + { + sb.AppendFormat("{0}System.Type {1} = (System.Type)ToLua.ToObject(L, {2});\r\n", head, arg, stackPos); + } + else + { + sb.AppendFormat("{0}System.Type {1} = ToLua.CheckMonoType(L, {2});\r\n", head, arg, stackPos); + } + } + else if (IsIEnumerator(varType)) + { + if (beCheckTypes) + { + sb.AppendFormat("{0}System.Collections.IEnumerator {1} = (System.Collections.IEnumerator)ToLua.ToObject(L, {2});\r\n", head, arg, stackPos); + } + else + { + sb.AppendFormat("{0}System.Collections.IEnumerator {1} = ToLua.CheckIter(L, {2});\r\n", head, arg, stackPos); + } + } + else if (varType.IsArray && varType.GetArrayRank() == 1) + { + Type et = varType.GetElementType(); + string atstr = GetTypeStr(et); + string fname; + bool flag = false; //鏄惁妯$増鍑芥暟 + bool isObject = false; + + if (et.IsPrimitive) + { + if (beParams) + { + if (et == typeof(bool)) + { + fname = beCheckTypes ? "ToParamsBool" : "CheckParamsBool"; + } + else if (et == typeof(char)) + { + //char鐢ㄧ殑澶氫簺锛岀壒娈婂鐞嗕竴涓嬪噺灏慻calloc + fname = beCheckTypes ? "ToParamsChar" : "CheckParamsChar"; + } + else + { + flag = true; + fname = beCheckTypes ? "ToParamsNumber" : "CheckParamsNumber"; + } + } + else if(et == typeof(char)) + { + fname = "CheckCharBuffer"; + } + else if (et == typeof(byte)) + { + fname = "CheckByteBuffer"; + } + else if (et == typeof(bool)) + { + fname = "CheckBoolArray"; + } + else + { + fname = beCheckTypes ? "ToNumberArray" : "CheckNumberArray"; + flag = true; + } + } + else if (et == typeof(string)) + { + if (beParams) + { + fname = beCheckTypes ? "ToParamsString" : "CheckParamsString"; + } + else + { + fname = beCheckTypes ? "ToStringArray" : "CheckStringArray"; + } + } + else //if (et == typeof(object)) + { + flag = true; + + if (et == typeof(object)) + { + isObject = true; + flag = false; + } + + if (beParams) + { + fname = (isObject || beCheckTypes) ? "ToParamsObject" : "CheckParamsObject"; + } + else + { + if (et.IsValueType) + { + fname = beCheckTypes ? "ToStructArray" : "CheckStructArray"; + } + else + { + fname = beCheckTypes ? "ToObjectArray" : "CheckObjectArray"; + } + } + + if (et == typeof(UnityEngine.Object)) + { + ambig |= ObjAmbig.U3dObj; + } + } + + if (flag) + { + if (beParams) + { + if (!isObject) + { + sb.AppendFormat("{0}{1}[] {2} = ToLua.{3}<{1}>(L, {4}, {5});\r\n", head, atstr, arg, fname, stackPos, GetCountStr(stackPos - 1)); + } + else + { + sb.AppendFormat("{0}object[] {1} = ToLua.{2}(L, {3}, {4});\r\n", head, arg, fname, stackPos, GetCountStr(stackPos - 1)); + } + } + else + { + sb.AppendFormat("{0}{1}[] {2} = ToLua.{3}<{1}>(L, {4});\r\n", head, atstr, arg, fname, stackPos); + } + } + else + { + if (beParams) + { + sb.AppendFormat("{0}{1}[] {2} = ToLua.{3}(L, {4}, {5});\r\n", head, atstr, arg, fname, stackPos, GetCountStr(stackPos - 1)); + } + else + { + sb.AppendFormat("{0}{1}[] {2} = ToLua.{3}(L, {4});\r\n", head, atstr, arg, fname, stackPos); + } + } + } + else if (varType.IsGenericType && varType.GetGenericTypeDefinition() == typeof(Nullable<>)) + { + Type t = TypeChecker.GetNullableType(varType); + + if (beCheckTypes) + { + sb.AppendFormat("{0}{1} {2} = ToLua.ToNullable<{3}>(L, {4});\r\n", head, str, arg, GetTypeStr(t), stackPos); + } + else + { + sb.AppendFormat("{0}{1} {2} = ToLua.CheckNullable<{3}>(L, {4});\r\n", head, str, arg, GetTypeStr(t), stackPos); + } + } + else if (varType.IsValueType && !varType.IsEnum) + { + string func = beCheckTypes ? "To" : "Check"; + sb.AppendFormat("{0}{1} {2} = StackTraits<{1}>.{3}(L, {4});\r\n", head, str, arg, func, stackPos); + } + else //浠巓bject娲剧敓浣嗕笉鏄痮bject + { + if (beCheckTypes) + { + sb.AppendFormat("{0}{1} {2} = ({1})ToLua.ToObject(L, {3});\r\n", head, str, arg, stackPos); + } + //else if (varType == typeof(UnityEngine.TrackedReference) || typeof(UnityEngine.TrackedReference).IsAssignableFrom(varType)) + //{ + // sb.AppendFormat("{3}{0} {1} = ({0})ToLua.CheckTrackedReference(L, {2}, typeof({0}));\r\n", str, arg, stackPos, head); + //} + //else if (typeof(UnityEngine.Object).IsAssignableFrom(varType)) + //{ + // sb.AppendFormat("{3}{0} {1} = ({0})ToLua.CheckUnityObject(L, {2}, typeof({0}));\r\n", str, arg, stackPos, head); + //} + else + { + if (IsSealedType(varType)) + { + sb.AppendFormat("{0}{1} {2} = ({1})ToLua.CheckObject(L, {3}, typeof({1}));\r\n", head, str, arg, stackPos); + } + else + { + sb.AppendFormat("{0}{1} {2} = ({1})ToLua.CheckObject<{1}>(L, {3});\r\n", head, str, arg, stackPos); + } + } + } + } + + static int GetMethodType(MethodBase md, out PropertyInfo pi) + { + pi = null; + + if (!md.IsSpecialName) + { + return 0; + } + + int methodType = 0; + int pos = allProps.FindIndex((p) => { return p.GetGetMethod() == md || p.GetSetMethod() == md; }); + + if (pos >= 0) + { + methodType = 1; + pi = allProps[pos]; + + if (md == pi.GetGetMethod()) + { + if (md.GetParameters().Length > 0) + { + methodType = 2; + } + } + else if (md == pi.GetSetMethod()) + { + if (md.GetParameters().Length > 1) + { + methodType = 2; + } + } + } + + return methodType; + } + + static Type GetGenericBaseType(MethodBase md, Type t) + { + if (!md.IsGenericMethod) + { + return t; + } + + List list = new List(md.GetGenericArguments()); + + if (list.Contains(t)) + { + return t.BaseType; + } + + return t; + } + + static bool IsNumberEnum(Type t) + { + if (t == typeof(BindingFlags)) + { + return true; + } + + return false; + } + + static void GenPushStr(Type t, string arg, string head, bool isByteBuffer = false) + { + if (t == typeof(int)) + { + sb.AppendFormat("{0}LuaDLL.lua_pushinteger(L, {1});\r\n", head, arg); + } + else if (t == typeof(bool)) + { + sb.AppendFormat("{0}LuaDLL.lua_pushboolean(L, {1});\r\n", head, arg); + } + else if (t == typeof(string)) + { + sb.AppendFormat("{0}LuaDLL.lua_pushstring(L, {1});\r\n", head, arg); + } + else if (t == typeof(IntPtr)) + { + sb.AppendFormat("{0}LuaDLL.lua_pushlightuserdata(L, {1});\r\n", head, arg); + } + else if (t == typeof(long)) + { + sb.AppendFormat("{0}LuaDLL.tolua_pushint64(L, {1});\r\n", head, arg); + } + else if (t == typeof(ulong)) + { + sb.AppendFormat("{0}LuaDLL.tolua_pushuint64(L, {1});\r\n", head, arg); + } + else if ((t.IsPrimitive)) + { + sb.AppendFormat("{0}LuaDLL.lua_pushnumber(L, {1});\r\n", head, arg); + } + else + { + if (isByteBuffer && t == typeof(byte[])) + { + sb.AppendFormat("{0}LuaDLL.tolua_pushlstring(L, {1}, {1}.Length);\r\n", head, arg); + } + else + { + string str = GetPushFunction(t); + sb.AppendFormat("{0}ToLua.{1}(L, {2});\r\n", head, str, arg); + } + } + } + + static bool CompareParmsCount(_MethodBase l, _MethodBase r) + { + if (l == r) + { + return false; + } + + int c1 = l.IsStatic ? 0 : 1; + int c2 = r.IsStatic ? 0 : 1; + + c1 += l.GetParameters().Length; + c2 += r.GetParameters().Length; + + return c1 == c2; + } + + //decimal 绫诲瀷鎵旀帀浜 + static Dictionary typeSize = new Dictionary() + { + { typeof(char), 2 }, + { typeof(byte), 3 }, + { typeof(sbyte), 4 }, + { typeof(ushort),5 }, + { typeof(short), 6 }, + { typeof(uint), 7 }, + { typeof(int), 8 }, + //{ typeof(ulong), 9 }, + //{ typeof(long), 10 }, + { typeof(decimal), 11 }, + { typeof(float), 12 }, + { typeof(double), 13 }, + + }; + + //-1 涓嶅瓨鍦ㄦ浛鎹, 1 淇濈暀宸﹂潰锛 2 淇濈暀鍙抽潰 + static int CompareMethod(_MethodBase l, _MethodBase r) + { + int s = 0; + + if (!CompareParmsCount(l, r)) + { + return -1; + } + else + { + ParameterInfo[] lp = l.GetParameters(); + ParameterInfo[] rp = r.GetParameters(); + + List ll = new List(); + List lr = new List(); + + if (!l.IsStatic) + { + ll.Add(type); + } + + if (!r.IsStatic) + { + lr.Add(type); + } + + for (int i = 0; i < lp.Length; i++) + { + ll.Add(GetParameterType(lp[i])); + } + + for (int i = 0; i < rp.Length; i++) + { + lr.Add(GetParameterType(rp[i])); + } + + for (int i = 0; i < ll.Count; i++) + { + if (!typeSize.ContainsKey(ll[i]) || !typeSize.ContainsKey(lr[i])) + { + if (ll[i] == lr[i]) + { + continue; + } + else + { + return -1; + } + } + else if (ll[i].IsPrimitive && lr[i].IsPrimitive && s == 0) + { + s = typeSize[ll[i]] >= typeSize[lr[i]] ? 1 : 2; + } + else if (ll[i] != lr[i] && !ll[i].IsPrimitive && !lr[i].IsPrimitive) + { + return -1; + } + } + + if (s == 0 && l.IsStatic) + { + s = 2; + } + } + + return s; + } + + static void Push(List<_MethodBase> list, _MethodBase r) + { + string name = GetMethodName(r.Method); + int index = list.FindIndex((p) => { return GetMethodName(p.Method) == name && CompareMethod(p, r) >= 0; }); + + if (index >= 0) + { + if (CompareMethod(list[index], r) == 2) + { + Debugger.LogWarning("{0}.{1} has been dropped as function {2} more match lua", className, list[index].GetTotalName(), r.GetTotalName()); + list.RemoveAt(index); + list.Add(r); + return; + } + else + { + Debugger.LogWarning("{0}.{1} has been dropped as function {2} more match lua", className, r.GetTotalName(), list[index].GetTotalName()); + return; + } + } + + list.Add(r); + } + + static void GenOverrideFuncBody(_MethodBase md, bool beIf, int checkTypeOffset) + { + int offset = md.IsStatic ? 0 : 1; + int ret = md.GetReturnType() == typeof(void) ? 0 : 1; + string strIf = beIf ? "if " : "else if "; + + if (HasOptionalParam(md.GetParameters())) + { + ParameterInfo[] paramInfos = md.GetParameters(); + ParameterInfo param = paramInfos[paramInfos.Length - 1]; + string str = GetTypeStr(param.ParameterType.GetElementType()); + + if (paramInfos.Length + offset > 1) + { + string strParams = md.GenParamTypes(0); + sb.AppendFormat("\t\t\t{0}(TypeChecker.CheckTypes<{1}>(L, 1) && TypeChecker.CheckParamsType<{2}>(L, {3}, {4}))\r\n", strIf, strParams, str, paramInfos.Length + offset, GetCountStr(paramInfos.Length + offset - 1)); + } + else + { + sb.AppendFormat("\t\t\t{0}(TypeChecker.CheckParamsType<{1}>(L, {2}, {3}))\r\n", strIf, str, paramInfos.Length + offset, GetCountStr(paramInfos.Length + offset - 1)); + } + } + else + { + ParameterInfo[] paramInfos = md.GetParameters(); + + if (paramInfos.Length + offset > checkTypeOffset) + { + string strParams = md.GenParamTypes(checkTypeOffset); + sb.AppendFormat("\t\t\t{0}(count == {1} && TypeChecker.CheckTypes<{2}>(L, {3}))\r\n", strIf, paramInfos.Length + offset, strParams, checkTypeOffset + 1); + } + else + { + sb.AppendFormat("\t\t\t{0}(count == {1})\r\n", strIf, paramInfos.Length + offset); + } + } + + sb.AppendLineEx("\t\t\t{"); + int count = md.ProcessParams(4, false, checkTypeOffset); + sb.AppendFormat("\t\t\t\treturn {0};\r\n", ret + count); + sb.AppendLineEx("\t\t\t}"); + } + + static int[] CheckCheckTypePos(List list) where T : _MethodBase + { + int[] map = new int[list.Count]; + + for (int i = 0; i < list.Count;) + { + if (HasOptionalParam(list[i].GetParameters())) + { + if (list[0].IsConstructor) + { + for (int k = 0; k < map.Length; k++) + { + map[k] = 1; + } + } + else + { + Array.Clear(map, 0, map.Length); + } + + return map; + } + + int c1 = list[i].GetParamsCount(); + int count = c1; + map[i] = count; + int j = i + 1; + + for (; j < list.Count; j++) + { + int c2 = list[j].GetParamsCount(); + + if (c1 == c2) + { + count = Mathf.Min(count, list[i].GetEqualParamsCount(list[j])); + } + else + { + map[j] = c2; + break; + } + + for (int m = i; m <= j; m++) + { + map[m] = count; + } + } + + i = j; + } + + return map; + } + + static void GenOverrideDefinedFunc(MethodBase method) + { + string name = GetMethodName(method); + FieldInfo field = extendType.GetField(name + "Defined"); + string strfun = field.GetValue(null) as string; + sb.AppendLineEx(strfun); + return; + } + + static _MethodBase GenOverrideFunc(string name) + { + List<_MethodBase> list = new List<_MethodBase>(); + + for (int i = 0; i < methods.Count; i++) + { + string curName = GetMethodName(methods[i].Method); + + if (curName == name && !IsGenericMethod(methods[i].Method)) + { + Push(list, methods[i]); + } + } + + if (list.Count == 1) + { + return list[0]; + } + else if(list.Count == 0) + { + return null; + } + + list.Sort(Compare); + int[] checkTypeMap = CheckCheckTypePos(list); + + sb.AppendLineEx("\r\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]"); + sb.AppendFormat("\tstatic int {0}(IntPtr L)\r\n", name == "Register" ? "_Register" : name); + sb.AppendLineEx("\t{"); + + BeginTry(); + sb.AppendLineEx("\t\t\tint count = LuaDLL.lua_gettop(L);"); + sb.AppendLineEx(); + + for (int i = 0; i < list.Count; i++) + { + if (HasAttribute(list[i].Method, typeof(OverrideDefinedAttribute))) + { + GenOverrideDefinedFunc(list[i].Method); + } + else + { + GenOverrideFuncBody(list[i], i == 0, checkTypeMap[i]); + } + } + + sb.AppendLineEx("\t\t\telse"); + sb.AppendLineEx("\t\t\t{"); + sb.AppendFormat("\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: {0}.{1}\");\r\n", className, name); + sb.AppendLineEx("\t\t\t}"); + + EndTry(); + sb.AppendLineEx("\t}"); + return null; + } + + public static string CombineTypeStr(string space, string name) + { + if (string.IsNullOrEmpty(space)) + { + return name; + } + else + { + return space + "." + name; + } + } + + public static string GetBaseTypeStr(Type t) + { + if(t.IsGenericType) + { + return LuaMisc.GetTypeName(t); + } + else + { + return t.FullName.Replace("+", "."); + } + } + + //鑾峰彇绫诲瀷鍚嶅瓧 + public static string GetTypeStr(Type t) + { + if (t.IsByRef) + { + t = t.GetElementType(); + return GetTypeStr(t); + } + else if (t.IsArray) + { + string str = GetTypeStr(t.GetElementType()); + str += LuaMisc.GetArrayRank(t); + return str; + } + else if(t == extendType) + { + return GetTypeStr(type); + } + else if(IsIEnumerator(t)) + { + return LuaMisc.GetTypeName(typeof(IEnumerator)); + } + + return LuaMisc.GetTypeName(t); + } + + //鑾峰彇 typeof(string) 杩欐牱鐨勫悕瀛 + static string GetTypeOf(Type t, string sep) + { + string str; + + if (t.IsByRef) + { + t = t.GetElementType(); + } + + if (IsNumberEnum(t)) + { + str = string.Format("uint{0}", sep); + } + else if (IsIEnumerator(t)) + { + str = string.Format("{0}{1}", GetTypeStr(typeof(IEnumerator)), sep); + } + else + { + str = string.Format("{0}{1}", GetTypeStr(t), sep); + } + + return str; + } + + static string GenParamTypes(ParameterInfo[] p, MethodBase mb, int offset = 0) + { + StringBuilder sb = new StringBuilder(); + List list = new List(); + + if (!mb.IsStatic) + { + list.Add(type); + } + + for (int i = 0; i < p.Length; i++) + { + if (IsParams(p[i])) + { + continue; + } + + if (p[i].Attributes != ParameterAttributes.Out) + { + list.Add(GetGenericBaseType(mb, p[i].ParameterType)); + } + else + { + Type genericClass = typeof(LuaOut<>); + Type t = genericClass.MakeGenericType(p[i].ParameterType); + list.Add(t); + } + } + + for (int i = offset; i < list.Count - 1; i++) + { + sb.Append(GetTypeOf(list[i], ", ")); + } + + if (list.Count > 0) + { + sb.Append(GetTypeOf(list[list.Count - 1], "")); + } + + return sb.ToString(); + } + + static void CheckObjectNull() + { + if (type.IsValueType) + { + sb.AppendLineEx("\t\t\tif (o == null)"); + } + else + { + sb.AppendLineEx("\t\t\tif (obj == null)"); + } + } + + static void GenGetFieldStr(string varName, Type varType, bool isStatic, bool isByteBuffer, bool beOverride = false) + { + sb.AppendLineEx("\r\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]"); + sb.AppendFormat("\tstatic int {0}_{1}(IntPtr L)\r\n", beOverride ? "_get" : "get", varName); + sb.AppendLineEx("\t{"); + + if (isStatic) + { + string arg = string.Format("{0}.{1}", className, varName); + BeginTry(); + GenPushStr(varType, arg, "\t\t\t", isByteBuffer); + sb.AppendLineEx("\t\t\treturn 1;"); + EndTry(); + } + else + { + sb.AppendLineEx("\t\tobject o = null;\r\n"); + BeginTry(); + sb.AppendLineEx("\t\t\to = ToLua.ToObject(L, 1);"); + sb.AppendFormat("\t\t\t{0} obj = ({0})o;\r\n", className); + sb.AppendFormat("\t\t\t{0} ret = obj.{1};\r\n", GetTypeStr(varType), varName); + GenPushStr(varType, "ret", "\t\t\t", isByteBuffer); + sb.AppendLineEx("\t\t\treturn 1;"); + + sb.AppendLineEx("\t\t}"); + sb.AppendLineEx("\t\tcatch(Exception e)"); + sb.AppendLineEx("\t\t{"); + + sb.AppendFormat("\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index {0} on a nil value\");\r\n", varName); + sb.AppendLineEx("\t\t}"); + } + + sb.AppendLineEx("\t}"); + } + + static void GenGetEventStr(string varName, Type varType) + { + sb.AppendLineEx("\r\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]"); + sb.AppendFormat("\tstatic int get_{0}(IntPtr L)\r\n", varName); + sb.AppendLineEx("\t{"); + sb.AppendFormat("\t\tToLua.Push(L, new EventObject(typeof({0})));\r\n",GetTypeStr(varType)); + sb.AppendLineEx("\t\treturn 1;"); + sb.AppendLineEx("\t}"); + } + + static void GenIndexFunc() + { + for(int i = 0; i < fields.Length; i++) + { + if (fields[i].IsLiteral && fields[i].FieldType.IsPrimitive && !fields[i].FieldType.IsEnum) + { + continue; + } + + bool beBuffer = IsByteBuffer(fields[i]); + GenGetFieldStr(fields[i].Name, fields[i].FieldType, fields[i].IsStatic, beBuffer); + } + + for (int i = 0; i < props.Length; i++) + { + if (!props[i].CanRead) + { + continue; + } + + bool isStatic = true; + int index = propList.IndexOf(props[i]); + + if (index >= 0) + { + isStatic = false; + } + + _MethodBase md = methods.Find((p) => { return p.Name == "get_" + props[i].Name; }); + bool beBuffer = IsByteBuffer(props[i]); + + GenGetFieldStr(props[i].Name, props[i].PropertyType, isStatic, beBuffer, md != null); + } + + for (int i = 0; i < events.Length; i++) + { + GenGetEventStr(events[i].Name, events[i].EventHandlerType); + } + } + + static void GenSetFieldStr(string varName, Type varType, bool isStatic, bool beOverride = false) + { + sb.AppendLineEx("\r\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]"); + sb.AppendFormat("\tstatic int {0}_{1}(IntPtr L)\r\n", beOverride ? "_set" : "set", varName); + sb.AppendLineEx("\t{"); + + if (!isStatic) + { + sb.AppendLineEx("\t\tobject o = null;\r\n"); + BeginTry(); + sb.AppendLineEx("\t\t\to = ToLua.ToObject(L, 1);"); + sb.AppendFormat("\t\t\t{0} obj = ({0})o;\r\n", className); + ProcessArg(varType, "\t\t\t", "arg0", 2); + sb.AppendFormat("\t\t\tobj.{0} = arg0;\r\n", varName); + + if (type.IsValueType) + { + sb.AppendLineEx("\t\t\tToLua.SetBack(L, 1, obj);"); + } + sb.AppendLineEx("\t\t\treturn 0;"); + sb.AppendLineEx("\t\t}"); + sb.AppendLineEx("\t\tcatch(Exception e)"); + sb.AppendLineEx("\t\t{"); + sb.AppendFormat("\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index {0} on a nil value\");\r\n", varName); + sb.AppendLineEx("\t\t}"); + } + else + { + BeginTry(); + ProcessArg(varType, "\t\t\t", "arg0", 2); + sb.AppendFormat("\t\t\t{0}.{1} = arg0;\r\n", className, varName); + sb.AppendLineEx("\t\t\treturn 0;"); + EndTry(); + } + + sb.AppendLineEx("\t}"); + } + + static void GenSetEventStr(string varName, Type varType, bool isStatic) + { + sb.AppendLineEx("\r\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]"); + sb.AppendFormat("\tstatic int set_{0}(IntPtr L)\r\n", varName); + sb.AppendLineEx("\t{"); + BeginTry(); + + if (!isStatic) + { + sb.AppendFormat("\t\t\t{0} obj = ({0})ToLua.CheckObject(L, 1, typeof({0}));\r\n", className); + } + + string strVarType = GetTypeStr(varType); + string objStr = isStatic ? className : "obj"; + + sb.AppendLineEx("\t\t\tEventObject arg0 = null;\r\n"); + sb.AppendLineEx("\t\t\tif (LuaDLL.lua_isuserdata(L, 2) != 0)"); + sb.AppendLineEx("\t\t\t{"); + sb.AppendLineEx("\t\t\t\targ0 = (EventObject)ToLua.ToObject(L, 2);"); + sb.AppendLineEx("\t\t\t}"); + sb.AppendLineEx("\t\t\telse"); + sb.AppendLineEx("\t\t\t{"); + sb.AppendFormat("\t\t\t\treturn LuaDLL.luaL_throw(L, \"The event '{0}.{1}' can only appear on the left hand side of += or -= when used outside of the type '{0}'\");\r\n", className, varName); + sb.AppendLineEx("\t\t\t}\r\n"); + + sb.AppendLineEx("\t\t\tif (arg0.op == EventOp.Add)"); + sb.AppendLineEx("\t\t\t{"); + sb.AppendFormat("\t\t\t\t{0} ev = ({0})arg0.func;\r\n", strVarType); + sb.AppendFormat("\t\t\t\t{0}.{1} += ev;\r\n", objStr, varName); + sb.AppendLineEx("\t\t\t}"); + sb.AppendLineEx("\t\t\telse if (arg0.op == EventOp.Sub)"); + sb.AppendLineEx("\t\t\t{"); + sb.AppendFormat("\t\t\t\t{0} ev = ({0})arg0.func;\r\n", strVarType); + sb.AppendFormat("\t\t\t\t{0}.{1} -= ev;\r\n", objStr, varName); + sb.AppendLineEx("\t\t\t}\r\n"); + + sb.AppendLineEx("\t\t\treturn 0;"); + EndTry(); + + sb.AppendLineEx("\t}"); + } + + static void GenNewIndexFunc() + { + for (int i = 0; i < fields.Length; i++) + { + if (fields[i].IsLiteral || fields[i].IsInitOnly || fields[i].IsPrivate) + { + continue; + } + + GenSetFieldStr(fields[i].Name, fields[i].FieldType, fields[i].IsStatic); + } + + for (int i = 0; i < props.Length; i++) + { + if (!props[i].CanWrite || !props[i].GetSetMethod(true).IsPublic) + { + continue; + } + + bool isStatic = true; + int index = propList.IndexOf(props[i]); + + if (index >= 0) + { + isStatic = false; + } + + _MethodBase md = methods.Find((p) => { return p.Name == "set_" + props[i].Name; }); + GenSetFieldStr(props[i].Name, props[i].PropertyType, isStatic, md != null); + } + + for (int i = 0; i < events.Length; i++) + { + bool isStatic = eventList.IndexOf(events[i]) < 0; + GenSetEventStr(events[i].Name, events[i].EventHandlerType, isStatic); + } + } + + static void GenLuaFunctionRetValue(StringBuilder sb, Type t, string head, string name , bool beDefined = false) + { + if (t == typeof(bool)) + { + name = beDefined ? name : "bool " + name; + sb.AppendFormat("{0}{1} = func.CheckBoolean();\r\n", head, name); + } + else if (t == typeof(long)) + { + name = beDefined ? name : "long " + name; + sb.AppendFormat("{0}{1} = func.CheckLong();\r\n", head, name); + } + else if (t == typeof(ulong)) + { + name = beDefined ? name : "ulong " + name; + sb.AppendFormat("{0}{1} = func.CheckULong();\r\n", head, name); + } + else if (t.IsPrimitive || IsNumberEnum(t)) + { + string type = GetTypeStr(t); + name = beDefined ? name : type + " " + name; + sb.AppendFormat("{0}{1} = ({2})func.CheckNumber();\r\n", head, name, type); + } + else if (t == typeof(string)) + { + name = beDefined ? name : "string " + name; + sb.AppendFormat("{0}{1} = func.CheckString();\r\n", head, name); + } + else if (typeof(System.MulticastDelegate).IsAssignableFrom(t)) + { + name = beDefined ? name : GetTypeStr(t) + " " + name; + sb.AppendFormat("{0}{1} = func.CheckDelegate();\r\n", head, name); + } + else if (t == typeof(Vector3)) + { + name = beDefined ? name : "UnityEngine.Vector3 " + name; + sb.AppendFormat("{0}{1} = func.CheckVector3();\r\n", head, name); + } + else if (t == typeof(Quaternion)) + { + name = beDefined ? name : "UnityEngine.Quaternion " + name; + sb.AppendFormat("{0}{1} = func.CheckQuaternion();\r\n", head, name); + } + else if (t == typeof(Vector2)) + { + name = beDefined ? name : "UnityEngine.Vector2 " + name; + sb.AppendFormat("{0}{1} = func.CheckVector2();\r\n", head, name); + } + else if (t == typeof(Vector4)) + { + name = beDefined ? name : "UnityEngine.Vector4 " + name; + sb.AppendFormat("{0}{1} = func.CheckVector4();\r\n", head, name); + } + else if (t == typeof(Color)) + { + name = beDefined ? name : "UnityEngine.Color " + name; + sb.AppendFormat("{0}{1} = func.CheckColor();\r\n", head, name); + } + else if (t == typeof(Ray)) + { + name = beDefined ? name : "UnityEngine.Ray " + name; + sb.AppendFormat("{0}{1} = func.CheckRay();\r\n", head, name); + } + else if (t == typeof(Bounds)) + { + name = beDefined ? name : "UnityEngine.Bounds " + name; + sb.AppendFormat("{0}{1} = func.CheckBounds();\r\n", head, name); + } + else if (t == typeof(LayerMask)) + { + name = beDefined ? name : "UnityEngine.LayerMask " + name; + sb.AppendFormat("{0}{1} = func.CheckLayerMask();\r\n", head, name); + } + else if (t == typeof(object)) + { + name = beDefined ? name : "object " + name; + sb.AppendFormat("{0}{1} = func.CheckVariant();\r\n", head, name); + } + else if (t == typeof(byte[])) + { + name = beDefined ? name : "byte[] " + name; + sb.AppendFormat("{0}{1} = func.CheckByteBuffer();\r\n", head, name); + } + else if (t == typeof(char[])) + { + name = beDefined ? name : "char[] " + name; + sb.AppendFormat("{0}{1} = func.CheckCharBuffer();\r\n", head, name); + } + else + { + string type = GetTypeStr(t); + name = beDefined ? name : type + " " + name; + sb.AppendFormat("{0}{1} = ({2})func.CheckObject(typeof({2}));\r\n", head, name, type); + + //Debugger.LogError("GenLuaFunctionCheckValue undefined type:" + t.FullName); + } + } + + public static bool IsByteBuffer(Type type) + { + object[] attrs = type.GetCustomAttributes(true); + + for (int j = 0; j < attrs.Length; j++) + { + Type t = attrs[j].GetType(); + + if (t == typeof(LuaByteBufferAttribute)) + { + return true; + } + } + + return false; + } + + public static bool IsByteBuffer(MemberInfo mb) + { + object[] attrs = mb.GetCustomAttributes(true); + + for (int j = 0; j < attrs.Length; j++) + { + Type t = attrs[j].GetType(); + + if (t == typeof(LuaByteBufferAttribute)) + { + return true; + } + } + + return false; + } + + /*static void LuaFuncToDelegate(Type t, string head) + { + MethodInfo mi = t.GetMethod("Invoke"); + ParameterInfo[] pi = mi.GetParameters(); + int n = pi.Length; + + if (n == 0) + { + sb.AppendLineEx("() =>"); + + if (mi.ReturnType == typeof(void)) + { + sb.AppendFormat("{0}{{\r\n{0}\tfunc.Call();\r\n{0}}};\r\n", head); + } + else + { + sb.AppendFormat("{0}{{\r\n{0}\tfunc.BeginPCall();\r\n", head); + sb.AppendFormat("{0}\tfunc.PCall();\r\n", head); + GenLuaFunctionRetValue(sb, mi.ReturnType, head + "\t", "ret"); + sb.AppendFormat("{0}\tfunc.EndPCall();\r\n", head); + sb.AppendLineEx(head + "\treturn ret;"); + sb.AppendFormat("{0}}};\r\n", head); + } + + return; + } + + sb.AppendFormat("(param0"); + + for (int i = 1; i < n; i++) + { + sb.AppendFormat(", param{0}", i); + } + + sb.AppendFormat(") =>\r\n{0}{{\r\n{0}", head); + sb.AppendLineEx("\tfunc.BeginPCall();"); + + for (int i = 0; i < n; i++) + { + string push = GetPushFunction(pi[i].ParameterType); + + if (!IsParams(pi[i])) + { + if (pi[i].ParameterType == typeof(byte[]) && IsByteBuffer(t)) + { + sb.AppendFormat("{0}\tfunc.PushByteBuffer(param{1});\r\n", head, i); + } + else + { + sb.AppendFormat("{0}\tfunc.{1}(param{2});\r\n", head, push, i); + } + } + else + { + sb.AppendLineEx(); + sb.AppendFormat("{0}\tfor (int i = 0; i < param{1}.Length; i++)\r\n", head, i); + sb.AppendLineEx(head + "\t{"); + sb.AppendFormat("{0}\t\tfunc.{1}(param{2}[i]);\r\n", head, push, i); + sb.AppendLineEx(head + "\t}\r\n"); + } + } + + sb.AppendFormat("{0}\tfunc.PCall();\r\n", head); + + if (mi.ReturnType == typeof(void)) + { + for (int i = 0; i < pi.Length; i++) + { + if ((pi[i].Attributes & ParameterAttributes.Out) != ParameterAttributes.None) + { + GenLuaFunctionRetValue(sb, pi[i].ParameterType, head + "\t", "param" + i, true); + } + } + + sb.AppendFormat("{0}\tfunc.EndPCall();\r\n", head); + } + else + { + GenLuaFunctionRetValue(sb, mi.ReturnType, head + "\t", "ret"); + + for (int i = 0; i < pi.Length; i++) + { + if ((pi[i].Attributes & ParameterAttributes.Out) != ParameterAttributes.None) + { + GenLuaFunctionRetValue(sb, pi[i].ParameterType, head + "\t", "param" + i, true); + } + } + + sb.AppendFormat("{0}\tfunc.EndPCall();\r\n", head); + sb.AppendLineEx(head + "\treturn ret;"); + } + + sb.AppendFormat("{0}}};\r\n", head); + }*/ + + static void GenDelegateBody(StringBuilder sb, Type t, string head, bool hasSelf = false) + { + MethodInfo mi = t.GetMethod("Invoke"); + ParameterInfo[] pi = mi.GetParameters(); + int n = pi.Length; + + if (n == 0) + { + if (mi.ReturnType == typeof(void)) + { + if (!hasSelf) + { + sb.AppendFormat("{0}{{\r\n{0}\tfunc.Call();\r\n{0}}}\r\n", head); + } + else + { + sb.AppendFormat("{0}{{\r\n{0}\tfunc.BeginPCall();\r\n", head); + sb.AppendFormat("{0}\tfunc.Push(self);\r\n", head); + sb.AppendFormat("{0}\tfunc.PCall();\r\n", head); + sb.AppendFormat("{0}\tfunc.EndPCall();\r\n", head); + sb.AppendFormat("{0}}}\r\n", head); + } + } + else + { + sb.AppendFormat("{0}{{\r\n{0}\tfunc.BeginPCall();\r\n", head); + if (hasSelf) sb.AppendFormat("{0}\tfunc.Push(self);\r\n", head); + sb.AppendFormat("{0}\tfunc.PCall();\r\n", head); + GenLuaFunctionRetValue(sb, mi.ReturnType, head + "\t", "ret"); + sb.AppendFormat("{0}\tfunc.EndPCall();\r\n", head); + sb.AppendLineEx(head + "\treturn ret;"); + sb.AppendFormat("{0}}}\r\n", head); + } + + return; + } + + sb.AppendFormat("{0}{{\r\n{0}", head); + sb.AppendLineEx("\tfunc.BeginPCall();"); + if (hasSelf) sb.AppendFormat("{0}\tfunc.Push(self);\r\n", head); + + for (int i = 0; i < n; i++) + { + string push = GetPushFunction(pi[i].ParameterType); + + if (!IsParams(pi[i])) + { + if (pi[i].ParameterType == typeof(byte[]) && IsByteBuffer(t)) + { + sb.AppendFormat("{2}\tfunc.PushByteBuffer(param{1});\r\n", push, i, head); + } + else if (pi[i].Attributes != ParameterAttributes.Out) + { + sb.AppendFormat("{2}\tfunc.{0}(param{1});\r\n", push, i, head); + } + } + else + { + sb.AppendLineEx(); + sb.AppendFormat("{0}\tfor (int i = 0; i < param{1}.Length; i++)\r\n", head, i); + sb.AppendLineEx(head + "\t{"); + sb.AppendFormat("{2}\t\tfunc.{0}(param{1}[i]);\r\n", push, i, head); + sb.AppendLineEx(head + "\t}\r\n"); + } + } + + sb.AppendFormat("{0}\tfunc.PCall();\r\n", head); + + if (mi.ReturnType == typeof(void)) + { + for (int i = 0; i < pi.Length; i++) + { + if ((pi[i].Attributes & ParameterAttributes.Out) != ParameterAttributes.None) + { + GenLuaFunctionRetValue(sb, pi[i].ParameterType.GetElementType(), head + "\t", "param" + i, true); + } + } + + sb.AppendFormat("{0}\tfunc.EndPCall();\r\n", head); + } + else + { + GenLuaFunctionRetValue(sb, mi.ReturnType, head + "\t", "ret"); + + for (int i = 0; i < pi.Length; i++) + { + if ((pi[i].Attributes & ParameterAttributes.Out) != ParameterAttributes.None) + { + GenLuaFunctionRetValue(sb, pi[i].ParameterType.GetElementType(), head + "\t", "param" + i, true); + } + } + + sb.AppendFormat("{0}\tfunc.EndPCall();\r\n", head); + sb.AppendLineEx(head + "\treturn ret;"); + } + + sb.AppendFormat("{0}}}\r\n", head); + } + + //static void GenToStringFunction() + //{ + // if ((op & MetaOp.ToStr) == 0) + // { + // return; + // } + + // sb.AppendLineEx("\r\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]"); + // sb.AppendLineEx("\tstatic int Lua_ToString(IntPtr L)"); + // sb.AppendLineEx("\t{"); + // sb.AppendLineEx("\t\tobject obj = ToLua.ToObject(L, 1);\r\n"); + + // sb.AppendLineEx("\t\tif (obj != null)"); + // sb.AppendLineEx("\t\t{"); + // sb.AppendLineEx("\t\t\tLuaDLL.lua_pushstring(L, obj.ToString());"); + // sb.AppendLineEx("\t\t}"); + // sb.AppendLineEx("\t\telse"); + // sb.AppendLineEx("\t\t{"); + // sb.AppendLineEx("\t\t\tLuaDLL.lua_pushnil(L);"); + // sb.AppendLineEx("\t\t}"); + // sb.AppendLineEx(); + // sb.AppendLineEx("\t\treturn 1;"); + // sb.AppendLineEx("\t}"); + //} + + static bool IsNeedOp(string name) + { + if (name == "op_Addition") + { + op |= MetaOp.Add; + } + else if (name == "op_Subtraction") + { + op |= MetaOp.Sub; + } + else if (name == "op_Equality") + { + op |= MetaOp.Eq; + } + else if (name == "op_Multiply") + { + op |= MetaOp.Mul; + } + else if (name == "op_Division") + { + op |= MetaOp.Div; + } + else if (name == "op_UnaryNegation") + { + op |= MetaOp.Neg; + } + else if (name == "ToString" && !isStaticClass) + { + op |= MetaOp.ToStr; + } + else + { + return false; + } + + + return true; + } + + static void CallOpFunction(string name, int count, string ret) + { + string head = string.Empty; + + for (int i = 0; i < count; i++) + { + head += "\t"; + } + + if (name == "op_Addition") + { + sb.AppendFormat("{0}{1} o = arg0 + arg1;\r\n", head, ret); + } + else if (name == "op_Subtraction") + { + sb.AppendFormat("{0}{1} o = arg0 - arg1;\r\n", head, ret); + } + else if (name == "op_Equality") + { + sb.AppendFormat("{0}{1} o = arg0 == arg1;\r\n", head, ret); + } + else if (name == "op_Multiply") + { + sb.AppendFormat("{0}{1} o = arg0 * arg1;\r\n", head, ret); + } + else if (name == "op_Division") + { + sb.AppendFormat("{0}{1} o = arg0 / arg1;\r\n", head, ret); + } + else if (name == "op_UnaryNegation") + { + sb.AppendFormat("{0}{1} o = -arg0;\r\n", head, ret); + } + } + + public static bool IsObsolete(MemberInfo mb) + { + object[] attrs = mb.GetCustomAttributes(true); + + for (int j = 0; j < attrs.Length; j++) + { + Type t = attrs[j].GetType() ; + + if (t == typeof(System.ObsoleteAttribute) || t == typeof(NoToLuaAttribute) || t == typeof(MonoPInvokeCallbackAttribute) || + t.Name == "MonoNotSupportedAttribute" || t.Name == "MonoTODOAttribute") // || t.ToString() == "UnityEngine.WrapperlessIcall") + { + return true; + } + } + + if (IsMemberFilter(mb)) + { + return true; + } + + return false; + } + + public static bool HasAttribute(MemberInfo mb, Type atrtype) + { + object[] attrs = mb.GetCustomAttributes(true); + + for (int j = 0; j < attrs.Length; j++) + { + Type t = attrs[j].GetType(); + + if (t == atrtype) + { + return true; + } + } + + return false; + } + + static void GenEnum() + { + fields = type.GetFields(BindingFlags.GetField | BindingFlags.Public | BindingFlags.Static); + List list = new List(fields); + + for (int i = list.Count - 1; i > 0; i--) + { + if (IsObsolete(list[i])) + { + list.RemoveAt(i); + } + } + + fields = list.ToArray(); + + sb.AppendLineEx("\tpublic static void Register(LuaState L)"); + sb.AppendLineEx("\t{"); + sb.AppendFormat("\t\tL.BeginEnum(typeof({0}));\r\n", className); + + for (int i = 0; i < fields.Length; i++) + { + sb.AppendFormat("\t\tL.RegVar(\"{0}\", get_{0}, null);\r\n", fields[i].Name); + } + + sb.AppendFormat("\t\tL.RegFunction(\"IntToEnum\", IntToEnum);\r\n"); + sb.AppendFormat("\t\tL.EndEnum();\r\n"); + sb.AppendFormat("\t\tTypeTraits<{0}>.Check = CheckType;\r\n", className); + sb.AppendFormat("\t\tStackTraits<{0}>.Push = Push;\r\n", className); + sb.AppendLineEx("\t}"); + sb.AppendLineEx(); + + sb.AppendFormat("\tstatic void Push(IntPtr L, {0} arg)\r\n", className); + sb.AppendLineEx("\t{"); + sb.AppendLineEx("\t\tToLua.Push(L, arg);"); + sb.AppendLineEx("\t}"); + sb.AppendLineEx(); + + sb.AppendLineEx("\tstatic bool CheckType(IntPtr L, int pos)"); + sb.AppendLineEx("\t{"); + sb.AppendFormat("\t\treturn TypeChecker.CheckEnumType(typeof({0}), L, pos);\r\n", className); + sb.AppendLineEx("\t}"); + + for (int i = 0; i < fields.Length; i++) + { + sb.AppendLineEx("\r\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]"); + sb.AppendFormat("\tstatic int get_{0}(IntPtr L)\r\n", fields[i].Name); + sb.AppendLineEx("\t{"); + sb.AppendFormat("\t\tToLua.Push(L, {0}.{1});\r\n", className, fields[i].Name); + sb.AppendLineEx("\t\treturn 1;"); + sb.AppendLineEx("\t}"); + } + + sb.AppendLineEx("\r\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]"); + sb.AppendLineEx("\tstatic int IntToEnum(IntPtr L)"); + sb.AppendLineEx("\t{"); + sb.AppendLineEx("\t\tint arg0 = (int)LuaDLL.lua_tonumber(L, 1);"); + sb.AppendFormat("\t\t{0} o = ({0})arg0;\r\n", className); + sb.AppendLineEx("\t\tToLua.Push(L, o);"); + sb.AppendLineEx("\t\treturn 1;"); + sb.AppendLineEx("\t}"); + } + + static string CreateDelegate = @" + public static Delegate CreateDelegate(Type t, LuaFunction func = null) + { + DelegateCreate Create = null; + + if (!dict.TryGetValue(t, out Create)) + { + throw new LuaException(string.Format(""Delegate {0} not register"", LuaMisc.GetTypeName(t))); + } + + if (func != null) + { + LuaState state = func.GetLuaState(); + LuaDelegate target = state.GetLuaDelegate(func); + + if (target != null) + { + return Delegate.CreateDelegate(t, target, target.method); + } + else + { + Delegate d = Create(func, null, false); + target = d.Target as LuaDelegate; + state.AddLuaDelegate(target, func); + return d; + } + } + + return Create(null, null, false); + } + + public static Delegate CreateDelegate(Type t, LuaFunction func, LuaTable self) + { + DelegateCreate Create = null; + + if (!dict.TryGetValue(t, out Create)) + { + throw new LuaException(string.Format(""Delegate {0} not register"", LuaMisc.GetTypeName(t))); + } + + if (func != null) + { + LuaState state = func.GetLuaState(); + LuaDelegate target = state.GetLuaDelegate(func, self); + + if (target != null) + { + return Delegate.CreateDelegate(t, target, target.method); + } + else + { + Delegate d = Create(func, self, true); + target = d.Target as LuaDelegate; + state.AddLuaDelegate(target, func, self); + return d; + } + } + + return Create(null, null, true); + } +"; + + static string RemoveDelegate = @" + public static Delegate RemoveDelegate(Delegate obj, LuaFunction func) + { + LuaState state = func.GetLuaState(); + Delegate[] ds = obj.GetInvocationList(); + + for (int i = 0; i < ds.Length; i++) + { + LuaDelegate ld = ds[i].Target as LuaDelegate; + + if (ld != null && ld.func == func) + { + obj = Delegate.Remove(obj, ds[i]); + state.DelayDispose(ld.func); + break; + } + } + + return obj; + } + + public static Delegate RemoveDelegate(Delegate obj, Delegate dg) + { + LuaDelegate remove = dg.Target as LuaDelegate; + + if (remove == null) + { + obj = Delegate.Remove(obj, dg); + return obj; + } + + LuaState state = remove.func.GetLuaState(); + Delegate[] ds = obj.GetInvocationList(); + + for (int i = 0; i < ds.Length; i++) + { + LuaDelegate ld = ds[i].Target as LuaDelegate; + + if (ld != null && ld == remove) + { + obj = Delegate.Remove(obj, ds[i]); + state.DelayDispose(ld.func); + state.DelayDispose(ld.self); + break; + } + } + + return obj; + } +"; + + static string GetDelegateParams(MethodInfo mi) + { + ParameterInfo[] infos = mi.GetParameters(); + List list = new List(); + + for (int i = 0; i < infos.Length; i++) + { + string s2 = GetTypeStr(infos[i].ParameterType) + " param" + i; + + if (infos[i].ParameterType.IsByRef) + { + if (infos[i].Attributes == ParameterAttributes.Out) + { + s2 = "out " + s2; + } + else + { + s2 = "ref " + s2; + } + } + + list.Add(s2); + } + + return string.Join(", ", list.ToArray()); + } + + static string GetReturnValue(Type t) + { + if (t.IsPrimitive) + { + if (t == typeof(bool)) + { + return "false"; + } + else if (t == typeof(char)) + { + return "'\\0'"; + } + else + { + return "0"; + } + } + else if (!t.IsValueType) + { + return "null"; + } + else + { + return string.Format("default({0})", GetTypeStr(t)); + } + } + + static string GetDefaultDelegateBody(MethodInfo md) + { + string str = "\r\n\t\t\t{\r\n"; + bool flag = false; + ParameterInfo[] pis = md.GetParameters(); + + for (int i = 0; i < pis.Length; i++) + { + if (pis[i].Attributes == ParameterAttributes.Out) + { + str += string.Format("\t\t\t\tparam{0} = {1};\r\n", i, GetReturnValue(pis[i].ParameterType.GetElementType())); + flag = true; + } + } + + if (flag) + { + if (md.ReturnType != typeof(void)) + { + str += "\t\t\treturn "; + str += GetReturnValue(md.ReturnType); + str += ";"; + } + + str += "\t\t\t};\r\n\r\n"; + return str; + } + + if (md.ReturnType == typeof(void)) + { + return "{ };\r\n"; + } + else + { + return string.Format("{{ return {0}; }};\r\n", GetReturnValue(md.ReturnType)); + } + } + + public static void GenDelegates(DelegateType[] list) + { + usingList.Add("System"); + usingList.Add("System.Collections.Generic"); + + for (int i = 0; i < list.Length; i++) + { + Type t = list[i].type; + + if (!typeof(System.Delegate).IsAssignableFrom(t)) + { + Debug.LogError(t.FullName + " not a delegate type"); + return; + } + } + + sb.Append("public class DelegateFactory\r\n"); + sb.Append("{\r\n"); + sb.Append("\tpublic delegate Delegate DelegateCreate(LuaFunction func, LuaTable self, bool flag);\r\n"); + sb.Append("\tpublic static Dictionary dict = new Dictionary();\r\n"); + sb.Append("\tstatic DelegateFactory factory = new DelegateFactory();\r\n"); + sb.AppendLineEx(); + sb.Append("\tpublic static void Init()\r\n"); + sb.Append("\t{\r\n"); + sb.Append("\t\tRegister();\r\n"); + sb.AppendLineEx("\t}\r\n"); + + sb.Append("\tpublic static void Register()\r\n"); + sb.Append("\t{\r\n"); + sb.Append("\t\tdict.Clear();\r\n"); + + for (int i = 0; i < list.Length; i++) + { + string type = list[i].strType; + string name = list[i].name; + sb.AppendFormat("\t\tdict.Add(typeof({0}), factory.{1});\r\n", type, name); + } + + sb.AppendLineEx(); + + for (int i = 0; i < list.Length; i++) + { + string type = list[i].strType; + string name = list[i].name; + sb.AppendFormat("\t\tDelegateTraits<{0}>.Init(factory.{1});\r\n", type, name); + } + + sb.AppendLineEx(); + + for (int i = 0; i < list.Length; i++) + { + string type = list[i].strType; + string name = list[i].name; + sb.AppendFormat("\t\tTypeTraits<{0}>.Init(factory.Check_{1});\r\n", type, name); + } + + sb.AppendLineEx(); + + for (int i = 0; i < list.Length; i++) + { + string type = list[i].strType; + string name = list[i].name; + sb.AppendFormat("\t\tStackTraits<{0}>.Push = factory.Push_{1};\r\n", type, name); + } + + sb.Append("\t}\r\n"); + sb.Append(CreateDelegate); + sb.AppendLineEx(RemoveDelegate); + + for (int i = 0; i < list.Length; i++) + { + Type t = list[i].type; + string strType = list[i].strType; + string name = list[i].name; + MethodInfo mi = t.GetMethod("Invoke"); + string args = GetDelegateParams(mi); + + //鐢熸垚濮旀墭绫 + sb.AppendFormat("\tclass {0}_Event : LuaDelegate\r\n", name); + sb.AppendLineEx("\t{"); + sb.AppendFormat("\t\tpublic {0}_Event(LuaFunction func) : base(func) {{ }}\r\n", name); + sb.AppendFormat("\t\tpublic {0}_Event(LuaFunction func, LuaTable self) : base(func, self) {{ }}\r\n", name); + sb.AppendLineEx(); + sb.AppendFormat("\t\tpublic {0} Call({1})\r\n", GetTypeStr(mi.ReturnType), args); + GenDelegateBody(sb, t, "\t\t"); + sb.AppendLineEx(); + sb.AppendFormat("\t\tpublic {0} CallWithSelf({1})\r\n", GetTypeStr(mi.ReturnType), args); + GenDelegateBody(sb, t, "\t\t", true); + sb.AppendLineEx("\t}\r\n"); + + //鐢熸垚杞崲鍑芥暟1 + sb.AppendFormat("\tpublic {0} {1}(LuaFunction func, LuaTable self, bool flag)\r\n", strType, name); + sb.AppendLineEx("\t{"); + sb.AppendLineEx("\t\tif (func == null)"); + sb.AppendLineEx("\t\t{"); + sb.AppendFormat("\t\t\t{0} fn = delegate({1}) {2}", strType, args, GetDefaultDelegateBody(mi)); + sb.AppendLineEx("\t\t\treturn fn;"); + sb.AppendLineEx("\t\t}\r\n"); + sb.AppendLineEx("\t\tif(!flag)"); + sb.AppendLineEx("\t\t{"); + sb.AppendFormat("\t\t\t{0}_Event target = new {0}_Event(func);\r\n", name); + sb.AppendFormat("\t\t\t{0} d = target.Call;\r\n", strType); + sb.AppendLineEx("\t\t\ttarget.method = d.Method;"); + sb.AppendLineEx("\t\t\treturn d;"); + sb.AppendLineEx("\t\t}"); + sb.AppendLineEx("\t\telse"); + sb.AppendLineEx("\t\t{"); + sb.AppendFormat("\t\t\t{0}_Event target = new {0}_Event(func, self);\r\n", name); + sb.AppendFormat("\t\t\t{0} d = target.CallWithSelf;\r\n", strType); + sb.AppendLineEx("\t\t\ttarget.method = d.Method;"); + sb.AppendLineEx("\t\t\treturn d;"); + sb.AppendLineEx("\t\t}"); + sb.AppendLineEx("\t}\r\n"); + + sb.AppendFormat("\tbool Check_{0}(IntPtr L, int pos)\r\n", name); + sb.AppendLineEx("\t{"); + sb.AppendFormat("\t\treturn TypeChecker.CheckDelegateType(typeof({0}), L, pos);\r\n", strType); + sb.AppendLineEx("\t}\r\n"); + + sb.AppendFormat("\tvoid Push_{0}(IntPtr L, {1} o)\r\n", name, strType); + sb.AppendLineEx("\t{"); + sb.AppendLineEx("\t\tToLua.Push(L, o);"); + sb.AppendLineEx("\t}\r\n"); + } + + sb.AppendLineEx("}\r\n"); + SaveFile(CustomSettings.saveDir + "DelegateFactory.cs"); + + Clear(); + } + + static bool IsUseDefinedAttributee(MemberInfo mb) + { + object[] attrs = mb.GetCustomAttributes(false); + + for (int j = 0; j < attrs.Length; j++) + { + Type t = attrs[j].GetType(); + + if (t == typeof(UseDefinedAttribute)) + { + return true; + } + } + + return false; + } + + static bool IsMethodEqualExtend(MethodBase a, MethodBase b) + { + if (a.Name != b.Name) + { + return false; + } + + int c1 = a.IsStatic ? 0 : 1; + int c2 = b.IsStatic ? 0 : 1; + + c1 += a.GetParameters().Length; + c2 += b.GetParameters().Length; + + if (c1 != c2) return false; + + ParameterInfo[] lp = a.GetParameters(); + ParameterInfo[] rp = b.GetParameters(); + + List ll = new List(); + List lr = new List(); + + if (!a.IsStatic) + { + ll.Add(type); + } + + if (!b.IsStatic) + { + lr.Add(type); + } + + for (int i = 0; i < lp.Length; i++) + { + ll.Add(GetParameterType(lp[i])); + } + + for (int i = 0; i < rp.Length; i++) + { + lr.Add(GetParameterType(rp[i])); + } + + for (int i = 0; i < ll.Count; i++) + { + if (ll[i] != lr[i]) + { + return false; + } + } + + return true; + } + + static void ProcessEditorExtend(Type extendType, List<_MethodBase> list) + { + if (extendType != null) + { + List list2 = new List(); + list2.AddRange(extendType.GetMethods(BindingFlags.Instance | binding | BindingFlags.DeclaredOnly)); + + for (int i = list2.Count - 1; i >= 0; i--) + { + if (list2[i].Name.StartsWith("op_") || list2[i].Name.StartsWith("add_") || list2[i].Name.StartsWith("remove_")) + { + if (!IsNeedOp(list2[i].Name)) + { + continue; + } + } + + if (IsUseDefinedAttributee(list2[i])) + { + list.RemoveAll((md) => { return md.Name == list2[i].Name; }); + } + else + { + int index = list.FindIndex((md) => { return IsMethodEqualExtend(md.Method, list2[i]); }); + + if (index >= 0) + { + list.RemoveAt(index); + } + } + + if (!IsObsolete(list2[i])) + { + list.Add(new _MethodBase(list2[i])); + } + } + + FieldInfo field = extendType.GetField("AdditionNameSpace"); + + if (field != null) + { + string str = field.GetValue(null) as string; + string[] spaces = str.Split(new char[] { ';' }); + + for (int i = 0; i < spaces.Length; i++) + { + usingList.Add(spaces[i]); + } + } + } + } + + static bool IsGenericType(MethodInfo md, Type t) + { + Type[] list = md.GetGenericArguments(); + + for (int i = 0; i < list.Length; i++) + { + if (list[i] == t) + { + return true; + } + } + + return false; + } + + static void ProcessExtendType(Type extendType, List<_MethodBase> list) + { + if (extendType != null) + { + List list2 = new List(); + list2.AddRange(extendType.GetMethods(BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly)); + + for (int i = list2.Count - 1; i >= 0; i--) + { + MethodInfo md = list2[i]; + + if (!md.IsDefined(typeof(ExtensionAttribute), false)) + { + continue; + } + + ParameterInfo[] plist = md.GetParameters(); + Type t = plist[0].ParameterType; + + if (t == type || t.IsAssignableFrom(type) || (IsGenericType(md, t) && (type == t.BaseType || type.IsSubclassOf(t.BaseType)))) + { + if (!IsObsolete(list2[i])) + { + _MethodBase mb = new _MethodBase(md); + mb.BeExtend = true; + list.Add(mb); + } + } + } + } + } + + static void ProcessExtends(List<_MethodBase> list) + { + extendName = "ToLua_" + className.Replace(".", "_"); + extendType = Type.GetType(extendName + ", Assembly-CSharp-Editor"); + ProcessEditorExtend(extendType, list); + string temp = null; + + for (int i = 0; i < extendList.Count; i++) + { + ProcessExtendType(extendList[i], list); + string nameSpace = GetNameSpace(extendList[i], out temp); + + if (!string.IsNullOrEmpty(nameSpace)) + { + usingList.Add(nameSpace); + } + } + } + + static void GetDelegateTypeFromMethodParams(_MethodBase m) + { + if (m.IsGenericMethod) + { + return; + } + + ParameterInfo[] pifs = m.GetParameters(); + + for (int k = 0; k < pifs.Length; k++) + { + Type t = pifs[k].ParameterType; + + if (IsDelegateType(t)) + { + eventSet.Add(t); + } + } + } + + public static void GenEventFunction(Type t, StringBuilder sb) + { + string funcName; + string space = GetNameSpace(t, out funcName); + funcName = CombineTypeStr(space, funcName); + funcName = ConvertToLibSign(funcName); + + sb.AppendLineEx("\r\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]"); + sb.AppendFormat("\tstatic int {0}(IntPtr L)\r\n", funcName); + sb.AppendLineEx("\t{"); + sb.AppendLineEx("\t\ttry"); + sb.AppendLineEx("\t\t{"); + sb.AppendLineEx("\t\t\tint count = LuaDLL.lua_gettop(L);"); + sb.AppendLineEx("\t\t\tLuaFunction func = ToLua.CheckLuaFunction(L, 1);"); + sb.AppendLineEx(); + sb.AppendLineEx("\t\t\tif (count == 1)"); + sb.AppendLineEx("\t\t\t{"); + sb.AppendFormat("\t\t\t\tDelegate arg1 = DelegateTraits<{0}>.Create(func);\r\n", GetTypeStr(t)); + sb.AppendLineEx("\t\t\t\tToLua.Push(L, arg1);"); + sb.AppendLineEx("\t\t\t}"); + sb.AppendLineEx("\t\t\telse"); + sb.AppendLineEx("\t\t\t{"); + sb.AppendLineEx("\t\t\t\tLuaTable self = ToLua.CheckLuaTable(L, 2);"); + sb.AppendFormat("\t\t\t\tDelegate arg1 = DelegateTraits<{0}>.Create(func, self);\r\n", GetTypeStr(t)); + sb.AppendFormat("\t\t\t\tToLua.Push(L, arg1);\r\n"); + sb.AppendLineEx("\t\t\t}"); + + sb.AppendLineEx("\t\t\treturn 1;"); + sb.AppendLineEx("\t\t}"); + sb.AppendLineEx("\t\tcatch(Exception e)"); + sb.AppendLineEx("\t\t{"); + sb.AppendLineEx("\t\t\treturn LuaDLL.toluaL_exception(L, e);"); + sb.AppendLineEx("\t\t}"); + sb.AppendLineEx("\t}"); + } + + static void GenEventFunctions() + { + foreach (Type t in eventSet) + { + GenEventFunction(t, sb); + } + } + + static string RemoveChar(string str, char c) + { + int index = str.IndexOf(c); + + while (index > 0) + { + str = str.Remove(index, 1); + index = str.IndexOf(c); + } + + return str; + } + + public static string ConvertToLibSign(string str) + { + if (string.IsNullOrEmpty(str)) + { + return null; + } + + str = str.Replace('<', '_'); + str = RemoveChar(str, '>'); + str = str.Replace('[', 's'); + str = RemoveChar(str, ']'); + str = str.Replace('.', '_'); + return str.Replace(',', '_'); + } + + public static string GetNameSpace(Type t, out string libName) + { + if (t.IsGenericType) + { + return GetGenericNameSpace(t, out libName); + } + else + { + string space = t.FullName; + + if (space.Contains("+")) + { + space = space.Replace('+', '.'); + int index = space.LastIndexOf('.'); + libName = space.Substring(index + 1); + return space.Substring(0, index); + } + else + { + libName = t.Namespace == null ? space : space.Substring(t.Namespace.Length + 1); + return t.Namespace; + } + } + } + + static string GetGenericNameSpace(Type t, out string libName) + { + Type[] gArgs = t.GetGenericArguments(); + string typeName = t.FullName; + int count = gArgs.Length; + int pos = typeName.IndexOf("["); + typeName = typeName.Substring(0, pos); + + string str = null; + string name = null; + int offset = 0; + pos = typeName.IndexOf("+"); + + while (pos > 0) + { + str = typeName.Substring(0, pos); + typeName = typeName.Substring(pos + 1); + pos = str.IndexOf('`'); + + if (pos > 0) + { + count = (int)(str[pos + 1] - '0'); + str = str.Substring(0, pos); + str += "<" + string.Join(",", LuaMisc.GetGenericName(gArgs, offset, count)) + ">"; + offset += count; + } + + name = CombineTypeStr(name, str); + pos = typeName.IndexOf("+"); + } + + string space = name; + str = typeName; + + if (offset < gArgs.Length) + { + pos = str.IndexOf('`'); + count = (int)(str[pos + 1] - '0'); + str = str.Substring(0, pos); + str += "<" + string.Join(",", LuaMisc.GetGenericName(gArgs, offset, count)) + ">"; + } + + libName = str; + + if (string.IsNullOrEmpty(space)) + { + space = t.Namespace; + + if (space != null) + { + libName = str.Substring(space.Length + 1); + } + } + + return space; + } + + static Type GetParameterType(ParameterInfo info) + { + if (info.ParameterType == extendType) + { + return type; + } + + return info.ParameterType; + } +} diff --git a/Assets/LuaFramework/ToLua/Editor/ToLuaExport.cs.meta b/Assets/LuaFramework/ToLua/Editor/ToLuaExport.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..e372f45ec35859d460c1d152a0276561d65bc6ab --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/ToLuaExport.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 73e814f0ef0ab914181c1f1e0a989935 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Editor/ToLuaMenu.cs b/Assets/LuaFramework/ToLua/Editor/ToLuaMenu.cs new file mode 100644 index 0000000000000000000000000000000000000000..46ed1df94eeeb9f0c7f9a97a73a73c0fdb1c122b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/ToLuaMenu.cs @@ -0,0 +1,1446 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +//鎵撳紑寮鍏虫病鏈夊啓鍏ュ鍑哄垪琛ㄧ殑绾櫄绫昏嚜鍔ㄨ烦杩 +//#define JUMP_NODEFINED_ABSTRACT + +using UnityEngine; +using UnityEditor; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using System.Text; +using System.IO; +using System.Diagnostics; +using LuaInterface; + +using Object = UnityEngine.Object; +using Debug = UnityEngine.Debug; +using Debugger = LuaInterface.Debugger; +using System.Threading; + +[InitializeOnLoad] +public static class ToLuaMenu +{ + //涓嶉渶瑕佸鍑烘垨鑰呮棤娉曞鍑虹殑绫诲瀷 + public static List dropType = new List + { + typeof(ValueType), //涓嶉渶瑕 +#if UNITY_4_6 || UNITY_4_7 + typeof(Motion), //寰堝骞冲彴鍙槸绌虹被 +#endif + +#if UNITY_5_3_OR_NEWER + typeof(UnityEngine.CustomYieldInstruction), +#endif + typeof(UnityEngine.YieldInstruction), //鏃犻渶瀵煎嚭鐨勭被 + typeof(UnityEngine.WaitForEndOfFrame), //鍐呴儴鏀寔 + typeof(UnityEngine.WaitForFixedUpdate), + typeof(UnityEngine.WaitForSeconds), + typeof(UnityEngine.Mathf), //lua灞傛敮鎸 + typeof(Plane), + typeof(LayerMask), + typeof(Vector3), + typeof(Vector4), + typeof(Vector2), + typeof(Quaternion), + typeof(Ray), + typeof(Bounds), + typeof(Color), + typeof(Touch), + typeof(RaycastHit), + typeof(TouchPhase), + //typeof(LuaInterface.LuaOutMetatable), //鎵嬪啓鏀寔 + typeof(LuaInterface.NullObject), + typeof(System.Array), + typeof(System.Reflection.MemberInfo), + typeof(System.Reflection.BindingFlags), + typeof(LuaClient), + typeof(LuaInterface.LuaFunction), + typeof(LuaInterface.LuaTable), + typeof(LuaInterface.LuaThread), + typeof(LuaInterface.LuaByteBuffer), //鍙槸绫诲瀷鏍囪瘑绗 + typeof(DelegateFactory), //鏃犻渶瀵煎嚭锛屽鍑虹被鏀寔lua鍑芥暟杞崲涓哄鎵樸傚UIEventListener.OnClick(luafunc) + }; + + //鍙互瀵煎嚭鐨勫唴閮ㄦ敮鎸佺被鍨 + public static List baseType = new List + { + typeof(System.Object), + typeof(System.Delegate), + typeof(System.String), + typeof(System.Enum), + typeof(System.Type), + typeof(System.Collections.IEnumerator), + typeof(UnityEngine.Object), + typeof(LuaInterface.EventObject), + typeof(LuaInterface.LuaMethod), + typeof(LuaInterface.LuaProperty), + typeof(LuaInterface.LuaField), + typeof(LuaInterface.LuaConstructor), + }; + + private static bool beAutoGen = false; + private static bool beCheck = true; + static List allTypes = new List(); + + static ToLuaMenu() + { + string dir = CustomSettings.saveDir; + string[] files = Directory.GetFiles(dir, "*.cs", SearchOption.TopDirectoryOnly); + + if (files.Length < 3 && beCheck) + { + if (EditorUtility.DisplayDialog("鑷姩鐢熸垚", "鐐瑰嚮纭畾鑷姩鐢熸垚甯哥敤绫诲瀷娉ㄥ唽鏂囦欢锛 涔熷彲閫氳繃鑿滃崟閫愭瀹屾垚姝ゅ姛鑳", "纭畾", "鍙栨秷")) + { + beAutoGen = true; + GenLuaDelegates(); + AssetDatabase.Refresh(); + GenerateClassWraps(); + GenLuaBinder(); + beAutoGen = false; + } + + beCheck = false; + } + } + + static string RemoveNameSpace(string name, string space) + { + if (space != null) + { + name = name.Remove(0, space.Length + 1); + } + + return name; + } + + public class BindType + { + public string name; //绫诲悕绉 + public Type type; + public bool IsStatic; + public string wrapName = ""; //浜х敓鐨剋rap鏂囦欢鍚嶅瓧 + public string libName = ""; //娉ㄥ唽鍒發ua鐨勫悕瀛 + public Type baseType = null; + public string nameSpace = null; //娉ㄥ唽鍒發ua鐨則able灞傜骇 + + public List extendList = new List(); + + public BindType(Type t) + { + if (typeof(System.MulticastDelegate).IsAssignableFrom(t)) + { + throw new NotSupportedException(string.Format("\nDon't export Delegate {0} as a class, register it in customDelegateList", LuaMisc.GetTypeName(t))); + } + + //if (IsObsolete(t)) + //{ + // throw new Exception(string.Format("\n{0} is obsolete, don't export it!", LuaMisc.GetTypeName(t))); + //} + + type = t; + nameSpace = ToLuaExport.GetNameSpace(t, out libName); + name = ToLuaExport.CombineTypeStr(nameSpace, libName); + libName = ToLuaExport.ConvertToLibSign(libName); + + if (name == "object") + { + wrapName = "System_Object"; + name = "System.Object"; + } + else if (name == "string") + { + wrapName = "System_String"; + name = "System.String"; + } + else + { + wrapName = name.Replace('.', '_'); + wrapName = ToLuaExport.ConvertToLibSign(wrapName); + } + + int index = CustomSettings.staticClassTypes.IndexOf(type); + + if (index >= 0 || (type.IsAbstract && type.IsSealed)) + { + IsStatic = true; + } + + baseType = LuaMisc.GetExportBaseType(type); + } + + public BindType SetBaseType(Type t) + { + baseType = t; + return this; + } + + public BindType AddExtendType(Type t) + { + if (!extendList.Contains(t)) + { + extendList.Add(t); + } + + return this; + } + + public BindType SetWrapName(string str) + { + wrapName = str; + return this; + } + + public BindType SetLibName(string str) + { + libName = str; + return this; + } + + public BindType SetNameSpace(string space) + { + nameSpace = space; + return this; + } + + public static bool IsObsolete(Type type) + { + object[] attrs = type.GetCustomAttributes(true); + + for (int j = 0; j < attrs.Length; j++) + { + Type t = attrs[j].GetType(); + + if (t == typeof(System.ObsoleteAttribute) || t == typeof(NoToLuaAttribute) || t.Name == "MonoNotSupportedAttribute" || t.Name == "MonoTODOAttribute") + { + return true; + } + } + + return false; + } + } + + static void AutoAddBaseType(BindType bt, bool beDropBaseType) + { + Type t = bt.baseType; + + if (t == null) + { + return; + } + + if (CustomSettings.sealedList.Contains(t)) + { + CustomSettings.sealedList.Remove(t); + Debugger.LogError("{0} not a sealed class, it is parent of {1}", LuaMisc.GetTypeName(t), bt.name); + } + + if (t.IsInterface) + { + Debugger.LogWarning("{0} has a base type {1} is Interface, use SetBaseType to jump it", bt.name, t.FullName); + bt.baseType = t.BaseType; + } + else if (dropType.IndexOf(t) >= 0) + { + Debugger.LogWarning("{0} has a base type {1} is a drop type", bt.name, t.FullName); + bt.baseType = t.BaseType; + } + else if (!beDropBaseType || baseType.IndexOf(t) < 0) + { + int index = allTypes.FindIndex((iter) => { return iter.type == t; }); + + if (index < 0) + { +#if JUMP_NODEFINED_ABSTRACT + if (t.IsAbstract && !t.IsSealed) + { + Debugger.LogWarning("not defined bindtype for {0}, it is abstract class, jump it, child class is {1}", LuaMisc.GetTypeName(t), bt.name); + bt.baseType = t.BaseType; + } + else + { + Debugger.LogWarning("not defined bindtype for {0}, autogen it, child class is {1}", LuaMisc.GetTypeName(t), bt.name); + bt = new BindType(t); + allTypes.Add(bt); + } +#else + Debugger.LogWarning("not defined bindtype for {0}, autogen it, child class is {1}", LuaMisc.GetTypeName(t), bt.name); + bt = new BindType(t); + allTypes.Add(bt); +#endif + } + else + { + return; + } + } + else + { + return; + } + + AutoAddBaseType(bt, beDropBaseType); + } + + static BindType[] GenBindTypes(BindType[] list, bool beDropBaseType = true) + { + allTypes = new List(list); + + for (int i = 0; i < list.Length; i++) + { + for (int j = i + 1; j < list.Length; j++) + { + if (list[i].type == list[j].type) + throw new NotSupportedException("Repeat BindType:" + list[i].type); + } + + if (dropType.IndexOf(list[i].type) >= 0) + { + Debug.LogWarning(list[i].type.FullName + " in dropType table, not need to export"); + allTypes.Remove(list[i]); + continue; + } + else if (beDropBaseType && baseType.IndexOf(list[i].type) >= 0) + { + Debug.LogWarning(list[i].type.FullName + " is Base Type, not need to export"); + allTypes.Remove(list[i]); + continue; + } + else if (list[i].type.IsEnum) + { + continue; + } + + AutoAddBaseType(list[i], beDropBaseType); + } + + return allTypes.ToArray(); + } + + [MenuItem("Lua/Gen Lua Wrap Files", false, 1)] + public static void GenerateClassWraps() + { + if (!beAutoGen && EditorApplication.isCompiling) + { + EditorUtility.DisplayDialog("璀﹀憡", "璇风瓑寰呯紪杈戝櫒瀹屾垚缂栬瘧鍐嶆墽琛屾鍔熻兘", "纭畾"); + return; + } + + if (!File.Exists(CustomSettings.saveDir)) + { + Directory.CreateDirectory(CustomSettings.saveDir); + } + + allTypes.Clear(); + BindType[] typeList = CustomSettings.customTypeList; + + BindType[] list = GenBindTypes(typeList); + ToLuaExport.allTypes.AddRange(baseType); + + for (int i = 0; i < list.Length; i++) + { + ToLuaExport.allTypes.Add(list[i].type); + } + + for (int i = 0; i < list.Length; i++) + { + ToLuaExport.Clear(); + ToLuaExport.className = list[i].name; + ToLuaExport.type = list[i].type; + ToLuaExport.isStaticClass = list[i].IsStatic; + ToLuaExport.baseType = list[i].baseType; + ToLuaExport.wrapClassName = list[i].wrapName; + ToLuaExport.libClassName = list[i].libName; + ToLuaExport.extendList = list[i].extendList; + ToLuaExport.Generate(CustomSettings.saveDir); + } + + Debug.Log("Generate lua binding files over"); + ToLuaExport.allTypes.Clear(); + allTypes.Clear(); + AssetDatabase.Refresh(); + } + + static HashSet GetCustomTypeDelegates() + { + BindType[] list = CustomSettings.customTypeList; + HashSet set = new HashSet(); + BindingFlags binding = BindingFlags.Public | BindingFlags.Static | BindingFlags.IgnoreCase | BindingFlags.Instance; + + for (int i = 0; i < list.Length; i++) + { + Type type = list[i].type; + FieldInfo[] fields = type.GetFields(BindingFlags.GetField | BindingFlags.SetField | binding); + PropertyInfo[] props = type.GetProperties(BindingFlags.GetProperty | BindingFlags.SetProperty | binding); + MethodInfo[] methods = null; + + if (type.IsInterface) + { + methods = type.GetMethods(); + } + else + { + methods = type.GetMethods(BindingFlags.Instance | binding); + } + + for (int j = 0; j < fields.Length; j++) + { + Type t = fields[j].FieldType; + + if (ToLuaExport.IsDelegateType(t)) + { + set.Add(t); + } + } + + for (int j = 0; j < props.Length; j++) + { + Type t = props[j].PropertyType; + + if (ToLuaExport.IsDelegateType(t)) + { + set.Add(t); + } + } + + for (int j = 0; j < methods.Length; j++) + { + MethodInfo m = methods[j]; + + if (m.IsGenericMethod) + { + continue; + } + + ParameterInfo[] pifs = m.GetParameters(); + + for (int k = 0; k < pifs.Length; k++) + { + Type t = pifs[k].ParameterType; + if (t.IsByRef) t = t.GetElementType(); + + if (ToLuaExport.IsDelegateType(t)) + { + set.Add(t); + } + } + } + + } + + return set; + } + + [MenuItem("Lua/Gen Lua Delegates", false, 2)] + static void GenLuaDelegates() + { + if (!beAutoGen && EditorApplication.isCompiling) + { + EditorUtility.DisplayDialog("璀﹀憡", "璇风瓑寰呯紪杈戝櫒瀹屾垚缂栬瘧鍐嶆墽琛屾鍔熻兘", "纭畾"); + return; + } + + ToLuaExport.Clear(); + List list = new List(); + list.AddRange(CustomSettings.customDelegateList); + HashSet set = GetCustomTypeDelegates(); + + foreach (Type t in set) + { + if (null == list.Find((p) => { return p.type == t; })) + { + list.Add(new DelegateType(t)); + } + } + + ToLuaExport.GenDelegates(list.ToArray()); + set.Clear(); + ToLuaExport.Clear(); + AssetDatabase.Refresh(); + Debug.Log("Create lua delegate over"); + } + + static ToLuaTree InitTree() + { + ToLuaTree tree = new ToLuaTree(); + ToLuaNode root = tree.GetRoot(); + BindType[] list = GenBindTypes(CustomSettings.customTypeList); + + for (int i = 0; i < list.Length; i++) + { + string space = list[i].nameSpace; + AddSpaceNameToTree(tree, root, space); + } + + DelegateType[] dts = CustomSettings.customDelegateList; + string str = null; + + for (int i = 0; i < dts.Length; i++) + { + string space = ToLuaExport.GetNameSpace(dts[i].type, out str); + AddSpaceNameToTree(tree, root, space); + } + + return tree; + } + + static void AddSpaceNameToTree(ToLuaTree tree, ToLuaNode parent, string space) + { + if (space == null || space == string.Empty) + { + return; + } + + string[] ns = space.Split(new char[] { '.' }); + + for (int j = 0; j < ns.Length; j++) + { + List> nodes = tree.Find((_t) => { return _t == ns[j]; }, j); + + if (nodes.Count == 0) + { + ToLuaNode node = new ToLuaNode(); + node.value = ns[j]; + parent.childs.Add(node); + node.parent = parent; + node.layer = j; + parent = node; + } + else + { + bool flag = false; + int index = 0; + + for (int i = 0; i < nodes.Count; i++) + { + int count = j; + int size = j; + ToLuaNode nodecopy = nodes[i]; + + while (nodecopy.parent != null) + { + nodecopy = nodecopy.parent; + if (nodecopy.value != null && nodecopy.value == ns[--count]) + { + size--; + } + } + + if (size == 0) + { + index = i; + flag = true; + break; + } + } + + if (!flag) + { + ToLuaNode nnode = new ToLuaNode(); + nnode.value = ns[j]; + nnode.layer = j; + nnode.parent = parent; + parent.childs.Add(nnode); + parent = nnode; + } + else + { + parent = nodes[index]; + } + } + } + } + + static string GetSpaceNameFromTree(ToLuaNode node) + { + string name = node.value; + + while (node.parent != null && node.parent.value != null) + { + node = node.parent; + name = node.value + "." + name; + } + + return name; + } + + static string RemoveTemplateSign(string str) + { + str = str.Replace('<', '_'); + + int index = str.IndexOf('>'); + + while (index > 0) + { + str = str.Remove(index, 1); + index = str.IndexOf('>'); + } + + return str; + } + + [MenuItem("Lua/Gen LuaBinder File", false, 4)] + static void GenLuaBinder() + { + if (!beAutoGen && EditorApplication.isCompiling) + { + EditorUtility.DisplayDialog("璀﹀憡", "璇风瓑寰呯紪杈戝櫒瀹屾垚缂栬瘧鍐嶆墽琛屾鍔熻兘", "纭畾"); + return; + } + + allTypes.Clear(); + ToLuaTree tree = InitTree(); + StringBuilder sb = new StringBuilder(); + List dtList = new List(); + + List list = new List(); + list.AddRange(CustomSettings.customDelegateList); + HashSet set = GetCustomTypeDelegates(); + + List backupList = new List(); + backupList.AddRange(allTypes); + ToLuaNode root = tree.GetRoot(); + string libname = null; + + foreach (Type t in set) + { + if (null == list.Find((p) => { return p.type == t; })) + { + DelegateType dt = new DelegateType(t); + AddSpaceNameToTree(tree, root, ToLuaExport.GetNameSpace(t, out libname)); + list.Add(dt); + } + } + + sb.AppendLineEx("//this source code was auto-generated by tolua#, do not modify it"); + sb.AppendLineEx("using System;"); + sb.AppendLineEx("using UnityEngine;"); + sb.AppendLineEx("using LuaInterface;"); + sb.AppendLineEx(); + sb.AppendLineEx("public static class LuaBinder"); + sb.AppendLineEx("{"); + sb.AppendLineEx("\tpublic static void Bind(LuaState L)"); + sb.AppendLineEx("\t{"); + sb.AppendLineEx("\t\tfloat t = Time.realtimeSinceStartup;"); + sb.AppendLineEx("\t\tL.BeginModule(null);"); + + GenRegisterInfo(null, sb, list, dtList); + + Action> begin = (node) => + { + if (node.value == null) + { + return; + } + + sb.AppendFormat("\t\tL.BeginModule(\"{0}\");\r\n", node.value); + string space = GetSpaceNameFromTree(node); + + GenRegisterInfo(space, sb, list, dtList); + }; + + Action> end = (node) => + { + if (node.value != null) + { + sb.AppendLineEx("\t\tL.EndModule();"); + } + }; + + tree.DepthFirstTraversal(begin, end, tree.GetRoot()); + sb.AppendLineEx("\t\tL.EndModule();"); + + if (CustomSettings.dynamicList.Count > 0) + { + sb.AppendLineEx("\t\tL.BeginPreLoad();"); + + for (int i = 0; i < CustomSettings.dynamicList.Count; i++) + { + Type t1 = CustomSettings.dynamicList[i]; + BindType bt = backupList.Find((p) => { return p.type == t1; }); + if (bt != null) sb.AppendFormat("\t\tL.AddPreLoad(\"{0}\", LuaOpen_{1}, typeof({0}));\r\n", bt.name, bt.wrapName); + } + + sb.AppendLineEx("\t\tL.EndPreLoad();"); + } + + sb.AppendLineEx("\t\tDebugger.Log(\"Register lua type cost time: {0}\", Time.realtimeSinceStartup - t);"); + sb.AppendLineEx("\t}"); + + for (int i = 0; i < dtList.Count; i++) + { + ToLuaExport.GenEventFunction(dtList[i].type, sb); + } + + if (CustomSettings.dynamicList.Count > 0) + { + + for (int i = 0; i < CustomSettings.dynamicList.Count; i++) + { + Type t = CustomSettings.dynamicList[i]; + BindType bt = backupList.Find((p) => { return p.type == t; }); + if (bt != null) GenPreLoadFunction(bt, sb); + } + } + + sb.AppendLineEx("}\r\n"); + allTypes.Clear(); + string file = CustomSettings.saveDir + "LuaBinder.cs"; + + using (StreamWriter textWriter = new StreamWriter(file, false, Encoding.UTF8)) + { + textWriter.Write(sb.ToString()); + textWriter.Flush(); + textWriter.Close(); + } + + AssetDatabase.Refresh(); + Debugger.Log("Generate LuaBinder over !"); + } + + static void GenRegisterInfo(string nameSpace, StringBuilder sb, List delegateList, List wrappedDelegatesCache) + { + for (int i = 0; i < allTypes.Count; i++) + { + Type dt = CustomSettings.dynamicList.Find((p) => { return allTypes[i].type == p; }); + + if (dt == null && allTypes[i].nameSpace == nameSpace) + { + string str = "\t\t" + allTypes[i].wrapName + "Wrap.Register(L);\r\n"; + sb.Append(str); + allTypes.RemoveAt(i--); + } + } + + string funcName = null; + + for (int i = 0; i < delegateList.Count; i++) + { + DelegateType dt = delegateList[i]; + Type type = dt.type; + string typeSpace = ToLuaExport.GetNameSpace(type, out funcName); + + if (typeSpace == nameSpace) + { + funcName = ToLuaExport.ConvertToLibSign(funcName); + string abr = dt.abr; + abr = abr == null ? funcName : abr; + sb.AppendFormat("\t\tL.RegFunction(\"{0}\", {1});\r\n", abr, dt.name); + wrappedDelegatesCache.Add(dt); + } + } + } + + static void GenPreLoadFunction(BindType bt, StringBuilder sb) + { + string funcName = "LuaOpen_" + bt.wrapName; + + sb.AppendLineEx("\r\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]"); + sb.AppendFormat("\tstatic int {0}(IntPtr L)\r\n", funcName); + sb.AppendLineEx("\t{"); + sb.AppendLineEx("\t\ttry"); + sb.AppendLineEx("\t\t{"); + sb.AppendLineEx("\t\t\tLuaState state = LuaState.Get(L);"); + sb.AppendFormat("\t\t\tstate.BeginPreModule(\"{0}\");\r\n", bt.nameSpace); + sb.AppendFormat("\t\t\t{0}Wrap.Register(state);\r\n", bt.wrapName); + sb.AppendFormat("\t\t\tint reference = state.GetMetaReference(typeof({0}));\r\n", bt.name); + sb.AppendLineEx("\t\t\tstate.EndPreModule(L, reference);"); + sb.AppendLineEx("\t\t\treturn 1;"); + sb.AppendLineEx("\t\t}"); + sb.AppendLineEx("\t\tcatch(Exception e)"); + sb.AppendLineEx("\t\t{"); + sb.AppendLineEx("\t\t\treturn LuaDLL.toluaL_exception(L, e);"); + sb.AppendLineEx("\t\t}"); + sb.AppendLineEx("\t}"); + } + + static string GetOS() + { + return LuaConst.osDir; + } + + static string CreateStreamDir(string dir) + { + dir = Application.streamingAssetsPath + "/" + dir; + + if (!File.Exists(dir)) + { + Directory.CreateDirectory(dir); + } + + return dir; + } + + static void BuildLuaBundle(string subDir, string sourceDir) + { + string[] files = Directory.GetFiles(sourceDir + subDir, "*.bytes"); + string bundleName = subDir == null ? "lua.unity3d" : "lua" + subDir.Replace('/', '_') + ".unity3d"; + bundleName = bundleName.ToLower(); + +#if UNITY_4_6 || UNITY_4_7 + List list = new List(); + + for (int i = 0; i < files.Length; i++) + { + Object obj = AssetDatabase.LoadMainAssetAtPath(files[i]); + list.Add(obj); + } + + BuildAssetBundleOptions options = BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets | BuildAssetBundleOptions.DeterministicAssetBundle; + + if (files.Length > 0) + { + string output = string.Format("{0}/{1}/" + bundleName, Application.streamingAssetsPath, GetOS()); + File.Delete(output); + BuildPipeline.BuildAssetBundle(null, list.ToArray(), output, options, EditorUserBuildSettings.activeBuildTarget); + } +#else + for (int i = 0; i < files.Length; i++) + { + AssetImporter importer = AssetImporter.GetAtPath(files[i]); + + if (importer) + { + importer.assetBundleName = bundleName; + importer.assetBundleVariant = null; + } + } +#endif + } + + static void ClearAllLuaFiles() + { + string osPath = Application.streamingAssetsPath + "/" + GetOS(); + + if (Directory.Exists(osPath)) + { + string[] files = Directory.GetFiles(osPath, "Lua*.unity3d"); + + for (int i = 0; i < files.Length; i++) + { + File.Delete(files[i]); + } + } + + string path = osPath + "/Lua"; + + if (Directory.Exists(path)) + { + Directory.Delete(path, true); + } + + path = Application.streamingAssetsPath + "/Lua"; + + if (Directory.Exists(path)) + { + Directory.Delete(path, true); + } + + path = Application.dataPath + "/temp"; + + if (Directory.Exists(path)) + { + Directory.Delete(path, true); + } + + path = Application.dataPath + "/Resources/Lua"; + + if (Directory.Exists(path)) + { + Directory.Delete(path, true); + } + + path = Application.persistentDataPath + "/" + GetOS() + "/Lua"; + + if (Directory.Exists(path)) + { + Directory.Delete(path, true); + } + } + + [MenuItem("Lua/Gen LuaWrap + Binder", false, 4)] + static void GenLuaWrapBinder() + { + if (EditorApplication.isCompiling) + { + EditorUtility.DisplayDialog("璀﹀憡", "璇风瓑寰呯紪杈戝櫒瀹屾垚缂栬瘧鍐嶆墽琛屾鍔熻兘", "纭畾"); + return; + } + + beAutoGen = true; + AssetDatabase.Refresh(); + GenerateClassWraps(); + GenLuaBinder(); + beAutoGen = false; + } + + [MenuItem("Lua/Generate All", false, 5)] + static void GenLuaAll() + { + if (EditorApplication.isCompiling) + { + EditorUtility.DisplayDialog("璀﹀憡", "璇风瓑寰呯紪杈戝櫒瀹屾垚缂栬瘧鍐嶆墽琛屾鍔熻兘", "纭畾"); + return; + } + + beAutoGen = true; + GenLuaDelegates(); + AssetDatabase.Refresh(); + GenerateClassWraps(); + GenLuaBinder(); + beAutoGen = false; + } + + [MenuItem("Lua/Clear wrap files", false, 6)] + static void ClearLuaWraps() + { + string[] files = Directory.GetFiles(CustomSettings.saveDir, "*.cs", SearchOption.TopDirectoryOnly); + + for (int i = 0; i < files.Length; i++) + { + File.Delete(files[i]); + } + + ToLuaExport.Clear(); + List list = new List(); + ToLuaExport.GenDelegates(list.ToArray()); + ToLuaExport.Clear(); + + StringBuilder sb = new StringBuilder(); + sb.AppendLineEx("using System;"); + sb.AppendLineEx("using LuaInterface;"); + sb.AppendLineEx(); + sb.AppendLineEx("public static class LuaBinder"); + sb.AppendLineEx("{"); + sb.AppendLineEx("\tpublic static void Bind(LuaState L)"); + sb.AppendLineEx("\t{"); + sb.AppendLineEx("\t\tthrow new LuaException(\"Please generate LuaBinder files first!\");"); + sb.AppendLineEx("\t}"); + sb.AppendLineEx("}"); + + string file = CustomSettings.saveDir + "LuaBinder.cs"; + + using (StreamWriter textWriter = new StreamWriter(file, false, Encoding.UTF8)) + { + textWriter.Write(sb.ToString()); + textWriter.Flush(); + textWriter.Close(); + } + + AssetDatabase.Refresh(); + } + + public static void CopyLuaBytesFiles(string sourceDir, string destDir, bool appendext = true, string searchPattern = "*.lua", SearchOption option = SearchOption.AllDirectories) + { + if (!Directory.Exists(sourceDir)) + { + return; + } + + string[] files = Directory.GetFiles(sourceDir, searchPattern, option); + int len = sourceDir.Length; + + if (sourceDir[len - 1] == '/' || sourceDir[len - 1] == '\\') + { + --len; + } + + for (int i = 0; i < files.Length; i++) + { + string str = files[i].Remove(0, len); + string dest = destDir + "/" + str; + if (appendext) dest += ".bytes"; + string dir = Path.GetDirectoryName(dest); + Directory.CreateDirectory(dir); + File.Copy(files[i], dest, true); + } + } + + + [MenuItem("Lua/Copy Lua files to Resources", false, 51)] + public static void CopyLuaFilesToRes() + { + ClearAllLuaFiles(); + string destDir = Application.dataPath + "/Resources" + "/Lua"; + CopyLuaBytesFiles(LuaConst.luaDir, destDir); + CopyLuaBytesFiles(LuaConst.toluaDir, destDir); + AssetDatabase.Refresh(); + Debug.Log("Copy lua files over"); + } + + [MenuItem("Lua/Copy Lua files to Persistent", false, 52)] + public static void CopyLuaFilesToPersistent() + { + ClearAllLuaFiles(); + string destDir = Application.persistentDataPath + "/" + GetOS() + "/Lua"; + CopyLuaBytesFiles(LuaConst.luaDir, destDir, false); + CopyLuaBytesFiles(LuaConst.toluaDir, destDir, false); + AssetDatabase.Refresh(); + Debug.Log("Copy lua files over"); + } + + static void GetAllDirs(string dir, List list) + { + string[] dirs = Directory.GetDirectories(dir); + list.AddRange(dirs); + + for (int i = 0; i < dirs.Length; i++) + { + GetAllDirs(dirs[i], list); + } + } + + static void CopyDirectory(string source, string dest, string searchPattern = "*.lua", SearchOption option = SearchOption.AllDirectories) + { + string[] files = Directory.GetFiles(source, searchPattern, option); + + for (int i = 0; i < files.Length; i++) + { + string str = files[i].Remove(0, source.Length); + string path = dest + "/" + str; + string dir = Path.GetDirectoryName(path); + Directory.CreateDirectory(dir); + File.Copy(files[i], path, true); + } + } + + static void CopyBuildBat(string path, string tempDir) + { + if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows64) + { + File.Copy(path + "/Luajit64/Build.bat", tempDir + "/Build.bat", true); + } + else if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows) + { + if (IntPtr.Size == 4) + { + File.Copy(path + "/Luajit/Build.bat", tempDir + "/Build.bat", true); + } + else if (IntPtr.Size == 8) + { + File.Copy(path + "/Luajit64/Build.bat", tempDir + "/Build.bat", true); + } + } +#if UNITY_5_3_OR_NEWER + else if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.iOS) +#else + else if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.iOS) +#endif + { + //Debug.Log("iOS榛樿鐢64浣嶏紝32浣嶈嚜琛岃冭檻"); + File.Copy(path + "/Luajit64/Build.bat", tempDir + "/Build.bat", true); + } + else + { + File.Copy(path + "/Luajit/Build.bat", tempDir + "/Build.bat", true); + } + + } + + [MenuItem("Lua/Build Lua files to Resources (PC)", false, 53)] + public static void BuildLuaToResources() + { + ClearAllLuaFiles(); + string tempDir = CreateStreamDir("Lua"); + string destDir = Application.dataPath + "/Resources" + "/Lua"; + + string path = Application.dataPath.Replace('\\', '/'); + path = path.Substring(0, path.LastIndexOf('/')); + CopyBuildBat(path, tempDir); + CopyLuaBytesFiles(LuaConst.luaDir, tempDir, false); + Process proc = Process.Start(tempDir + "/Build.bat"); + proc.WaitForExit(); + CopyLuaBytesFiles(tempDir + "/Out/", destDir, false, "*.lua.bytes"); + CopyLuaBytesFiles(LuaConst.toluaDir, destDir); + + Directory.Delete(tempDir, true); + AssetDatabase.Refresh(); + } + + [MenuItem("Lua/Build Lua files to Persistent (PC)", false, 54)] + public static void BuildLuaToPersistent() + { + ClearAllLuaFiles(); + string tempDir = CreateStreamDir("Lua"); + string destDir = Application.persistentDataPath + "/" + GetOS() + "/Lua/"; + + string path = Application.dataPath.Replace('\\', '/'); + path = path.Substring(0, path.LastIndexOf('/')); + CopyBuildBat(path, tempDir); + CopyLuaBytesFiles(LuaConst.luaDir, tempDir, false); + Process proc = Process.Start(tempDir + "/Build.bat"); + proc.WaitForExit(); + CopyLuaBytesFiles(LuaConst.toluaDir, destDir, false); + + path = tempDir + "/Out/"; + string[] files = Directory.GetFiles(path, "*.lua.bytes"); + int len = path.Length; + + for (int i = 0; i < files.Length; i++) + { + path = files[i].Remove(0, len); + path = path.Substring(0, path.Length - 6); + path = destDir + path; + + File.Copy(files[i], path, true); + } + + Directory.Delete(tempDir, true); + AssetDatabase.Refresh(); + } + + [MenuItem("Lua/Build bundle files not jit", false, 55)] + public static void BuildNotJitBundles() + { + ClearAllLuaFiles(); + CreateStreamDir(GetOS()); + +#if UNITY_4_6 || UNITY_4_7 + string tempDir = CreateStreamDir("Lua"); +#else + string tempDir = Application.dataPath + "/temp/Lua"; + + if (!File.Exists(tempDir)) + { + Directory.CreateDirectory(tempDir); + } +#endif + CopyLuaBytesFiles(LuaConst.luaDir, tempDir); + CopyLuaBytesFiles(LuaConst.toluaDir, tempDir); + + AssetDatabase.Refresh(); + List dirs = new List(); + GetAllDirs(tempDir, dirs); + +#if UNITY_5 || UNITY_5_3_OR_NEWER + for (int i = 0; i < dirs.Count; i++) + { + string str = dirs[i].Remove(0, tempDir.Length); + BuildLuaBundle(str.Replace('\\', '/'), "Assets/temp/Lua"); + } + + BuildLuaBundle(null, "Assets/temp/Lua"); + + AssetDatabase.SaveAssets(); + string output = string.Format("{0}/{1}", Application.streamingAssetsPath, GetOS()); + BuildPipeline.BuildAssetBundles(output, BuildAssetBundleOptions.DeterministicAssetBundle, EditorUserBuildSettings.activeBuildTarget); + + //Directory.Delete(Application.dataPath + "/temp/", true); +#else + for (int i = 0; i < dirs.Count; i++) + { + string str = dirs[i].Remove(0, tempDir.Length); + BuildLuaBundle(str.Replace('\\', '/'), "Assets/StreamingAssets/Lua"); + } + + BuildLuaBundle(null, "Assets/StreamingAssets/Lua"); + Directory.Delete(Application.streamingAssetsPath + "/Lua/", true); +#endif + AssetDatabase.Refresh(); + } + + [MenuItem("Lua/Build Luajit bundle files (PC)", false, 56)] + public static void BuildLuaBundles() + { + ClearAllLuaFiles(); + CreateStreamDir(GetOS()); + +#if UNITY_4_6 || UNITY_4_7 + string tempDir = CreateStreamDir("Lua"); +#else + string tempDir = Application.dataPath + "/temp/Lua"; + + if (!File.Exists(tempDir)) + { + Directory.CreateDirectory(tempDir); + } +#endif + + string path = Application.dataPath.Replace('\\', '/'); + path = path.Substring(0, path.LastIndexOf('/')); + CopyBuildBat(path, tempDir); + CopyLuaBytesFiles(LuaConst.luaDir, tempDir, false); + Process proc = Process.Start(tempDir + "/Build.bat"); + proc.WaitForExit(); + CopyLuaBytesFiles(LuaConst.toluaDir, tempDir + "/Out"); + + AssetDatabase.Refresh(); + + string sourceDir = tempDir + "/Out"; + List dirs = new List(); + GetAllDirs(sourceDir, dirs); + +#if UNITY_5 || UNITY_5_3_OR_NEWER + for (int i = 0; i < dirs.Count; i++) + { + string str = dirs[i].Remove(0, sourceDir.Length); + BuildLuaBundle(str.Replace('\\', '/'), "Assets/temp/Lua/Out"); + } + + BuildLuaBundle(null, "Assets/temp/Lua/Out"); + + AssetDatabase.Refresh(); + string output = string.Format("{0}/{1}", Application.streamingAssetsPath, GetOS()); + BuildPipeline.BuildAssetBundles(output, BuildAssetBundleOptions.DeterministicAssetBundle, EditorUserBuildSettings.activeBuildTarget); + Directory.Delete(Application.dataPath + "/temp/", true); +#else + for (int i = 0; i < dirs.Count; i++) + { + string str = dirs[i].Remove(0, sourceDir.Length); + BuildLuaBundle(str.Replace('\\', '/'), "Assets/StreamingAssets/Lua/Out"); + } + + BuildLuaBundle(null, "Assets/StreamingAssets/Lua/Out/"); + Directory.Delete(tempDir, true); +#endif + AssetDatabase.Refresh(); + } + + [MenuItem("Lua/Clear all Lua files", false, 57)] + public static void ClearLuaFiles() + { + ClearAllLuaFiles(); + } + + + [MenuItem("Lua/Gen BaseType Wrap", false, 101)] + static void GenBaseTypeLuaWrap() + { + if (!beAutoGen && EditorApplication.isCompiling) + { + EditorUtility.DisplayDialog("璀﹀憡", "璇风瓑寰呯紪杈戝櫒瀹屾垚缂栬瘧鍐嶆墽琛屾鍔熻兘", "纭畾"); + return; + } + + string dir = CustomSettings.toluaBaseType; + + if (!File.Exists(dir)) + { + Directory.CreateDirectory(dir); + } + + allTypes.Clear(); + ToLuaExport.allTypes.AddRange(baseType); + List btList = new List(); + + for (int i = 0; i < baseType.Count; i++) + { + btList.Add(new BindType(baseType[i])); + } + + GenBindTypes(btList.ToArray(), false); + BindType[] list = allTypes.ToArray(); + + for (int i = 0; i < list.Length; i++) + { + ToLuaExport.Clear(); + ToLuaExport.className = list[i].name; + ToLuaExport.type = list[i].type; + ToLuaExport.isStaticClass = list[i].IsStatic; + ToLuaExport.baseType = list[i].baseType; + ToLuaExport.wrapClassName = list[i].wrapName; + ToLuaExport.libClassName = list[i].libName; + ToLuaExport.Generate(dir); + } + + Debug.Log("Generate base type files over"); + allTypes.Clear(); + AssetDatabase.Refresh(); + } + + static void CreateDefaultWrapFile(string path, string name) + { + StringBuilder sb = new StringBuilder(); + path = path + name + ".cs"; + sb.AppendLineEx("using System;"); + sb.AppendLineEx("using LuaInterface;"); + sb.AppendLineEx(); + sb.AppendLineEx("public static class " + name); + sb.AppendLineEx("{"); + sb.AppendLineEx("\tpublic static void Register(LuaState L)"); + sb.AppendLineEx("\t{"); + sb.AppendLineEx("\t\tthrow new LuaException(\"Please click menu Lua/Gen BaseType Wrap first!\");"); + sb.AppendLineEx("\t}"); + sb.AppendLineEx("}"); + + using (StreamWriter textWriter = new StreamWriter(path, false, Encoding.UTF8)) + { + textWriter.Write(sb.ToString()); + textWriter.Flush(); + textWriter.Close(); + } + } + + [MenuItem("Lua/Clear BaseType Wrap", false, 102)] + static void ClearBaseTypeLuaWrap() + { + CreateDefaultWrapFile(CustomSettings.toluaBaseType, "System_ObjectWrap"); + CreateDefaultWrapFile(CustomSettings.toluaBaseType, "System_DelegateWrap"); + CreateDefaultWrapFile(CustomSettings.toluaBaseType, "System_StringWrap"); + CreateDefaultWrapFile(CustomSettings.toluaBaseType, "System_EnumWrap"); + CreateDefaultWrapFile(CustomSettings.toluaBaseType, "System_TypeWrap"); + CreateDefaultWrapFile(CustomSettings.toluaBaseType, "System_Collections_IEnumeratorWrap"); + CreateDefaultWrapFile(CustomSettings.toluaBaseType, "UnityEngine_ObjectWrap"); + CreateDefaultWrapFile(CustomSettings.toluaBaseType, "LuaInterface_EventObjectWrap"); + CreateDefaultWrapFile(CustomSettings.toluaBaseType, "LuaInterface_LuaMethodWrap"); + CreateDefaultWrapFile(CustomSettings.toluaBaseType, "LuaInterface_LuaPropertyWrap"); + CreateDefaultWrapFile(CustomSettings.toluaBaseType, "LuaInterface_LuaFieldWrap"); + CreateDefaultWrapFile(CustomSettings.toluaBaseType, "LuaInterface_LuaConstructorWrap"); + + Debug.Log("Clear base type wrap files over"); + AssetDatabase.Refresh(); + } + + [MenuItem("Lua/Enable Lua Injection &e", false, 102)] + static void EnableLuaInjection() + { + bool EnableSymbols = false; + if (UpdateMonoCecil(ref EnableSymbols) != -1) + { + BuildTargetGroup curBuildTargetGroup = EditorUserBuildSettings.selectedBuildTargetGroup; + string existSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(curBuildTargetGroup); + if (!existSymbols.Contains("ENABLE_LUA_INJECTION")) + { + PlayerSettings.SetScriptingDefineSymbolsForGroup(curBuildTargetGroup, existSymbols + ";ENABLE_LUA_INJECTION"); + } + + AssetDatabase.Refresh(); + } + } + +#if ENABLE_LUA_INJECTION + [MenuItem("Lua/Injection Remove &r", false, 5)] +#endif + static void RemoveInjection() + { + if (Application.isPlaying) + { + EditorUtility.DisplayDialog("璀﹀憡", "娓告垙杩愯杩囩▼涓棤娉曟搷浣", "纭畾"); + return; + } + + BuildTargetGroup curBuildTargetGroup = EditorUserBuildSettings.selectedBuildTargetGroup; + string existSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(curBuildTargetGroup); + PlayerSettings.SetScriptingDefineSymbolsForGroup(curBuildTargetGroup, existSymbols.Replace("ENABLE_LUA_INJECTION", "")); + Debug.Log("Lua Injection Removed!"); + } + + public static int UpdateMonoCecil(ref bool EnableSymbols) + { + string appFileName = Environment.GetCommandLineArgs()[0]; + string appPath = Path.GetDirectoryName(appFileName); + string directory = appPath + "/Data/Managed/"; + if (UnityEngine.Application.platform == UnityEngine.RuntimePlatform.OSXEditor) + { + directory = appPath.Substring(0, appPath.IndexOf("MacOS")) + "Managed/"; + } + string suitedMonoCecilPath = directory + +#if UNITY_2017_1_OR_NEWER + "Unity.Cecil.dll"; +#else + "Mono.Cecil.dll"; +#endif + string suitedMonoCecilMdbPath = directory + +#if UNITY_2017_1_OR_NEWER + "Unity.Cecil.Mdb.dll"; +#else + "Mono.Cecil.Mdb.dll"; +#endif + string suitedMonoCecilPdbPath = directory + +#if UNITY_2017_1_OR_NEWER + "Unity.Cecil.Pdb.dll"; +#else + "Mono.Cecil.Pdb.dll"; +#endif + string suitedMonoCecilToolPath = directory + "Unity.CecilTools.dll"; + + if (!File.Exists(suitedMonoCecilPath) +#if UNITY_5_1 || UNITY_5_2 || UNITY_5_3 || UNITY_5_3_OR_NEWER + && !File.Exists(suitedMonoCecilMdbPath) + && !File.Exists(suitedMonoCecilPdbPath) +#endif + ) + { + EnableSymbols = false; + Debug.Log("Haven't found Mono.Cecil.dll!Symbols Will Be Disabled"); + return -1; + } + + bool bInjectionToolUpdated = false; + string injectionToolPath = CustomSettings.injectionFilesPath + "Editor/"; + string existMonoCecilPath = injectionToolPath + Path.GetFileName(suitedMonoCecilPath); + string existMonoCecilPdbPath = injectionToolPath + Path.GetFileName(suitedMonoCecilPdbPath); + string existMonoCecilMdbPath = injectionToolPath + Path.GetFileName(suitedMonoCecilMdbPath); + string existMonoCecilToolPath = injectionToolPath + Path.GetFileName(suitedMonoCecilToolPath); + + try + { + bInjectionToolUpdated = TryUpdate(suitedMonoCecilPath, existMonoCecilPath) ? true : bInjectionToolUpdated; +#if UNITY_5_1 || UNITY_5_2 || UNITY_5_3 || UNITY_5_3_OR_NEWER + bInjectionToolUpdated = TryUpdate(suitedMonoCecilPdbPath, existMonoCecilPdbPath) ? true : bInjectionToolUpdated; + bInjectionToolUpdated = TryUpdate(suitedMonoCecilMdbPath, existMonoCecilMdbPath) ? true : bInjectionToolUpdated; +#endif + TryUpdate(suitedMonoCecilToolPath, existMonoCecilToolPath); + } + catch (Exception e) + { + Debug.LogError(e.ToString()); + return -1; + } + EnableSymbols = true; + + return bInjectionToolUpdated ? 1 : 0; + } + + static bool TryUpdate(string srcPath, string destPath) + { + if (GetFileContentMD5(srcPath) != GetFileContentMD5(destPath)) + { + File.Copy(srcPath, destPath, true); + return true; + } + + return false; + } + + static string GetFileContentMD5(string file) + { + if (!File.Exists(file)) + { + return string.Empty; + } + + FileStream fs = new FileStream(file, FileMode.Open); + System.Security.Cryptography.MD5 md5 = new System.Security.Cryptography.MD5CryptoServiceProvider(); + byte[] retVal = md5.ComputeHash(fs); + fs.Close(); + + StringBuilder sb = StringBuilderCache.Acquire(); + for (int i = 0; i < retVal.Length; i++) + { + sb.Append(retVal[i].ToString("x2")); + } + return StringBuilderCache.GetStringAndRelease(sb); + } +} diff --git a/Assets/LuaFramework/ToLua/Editor/ToLuaMenu.cs.meta b/Assets/LuaFramework/ToLua/Editor/ToLuaMenu.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..f9497ccc965ad7e0b7fc0a34ec273b3b4872871a --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/ToLuaMenu.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 97fb7996cd1338442af03841f30cddaf +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Editor/ToLuaTree.cs b/Assets/LuaFramework/ToLua/Editor/ToLuaTree.cs new file mode 100644 index 0000000000000000000000000000000000000000..9e98776a6a0f7a6fa7a6a9975311e768f45489c8 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/ToLuaTree.cs @@ -0,0 +1,115 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +using UnityEngine; +using System.Collections.Generic; +using System; + +public class ToLuaNode +{ + public List> childs = new List>(); + public ToLuaNode parent = null; + public T value; + //娣诲姞鍛藉悕绌洪棿鑺傜偣鎵鍦ㄤ綅缃紝瑙e喅A.B.C/A.C瀛樺湪鐩稿悓鍚嶇О鍗村湪涓嶅悓鍛藉悕绌洪棿鎵閫犳垚鐨刉rap闂 + public int layer; +} + +public class ToLuaTree +{ + public ToLuaNode _root = null; + private List> _list = null; + + public ToLuaTree() + { + _root = new ToLuaNode(); + _list = new List>(); + } + + //鍔犲叆pos璺焤oot閲岀殑pos姣旇緝锛屽彧鏈変綅缃浉鍚屾墠鏄粺涓鍛藉悕绌洪棿鑺傜偣 + void FindParent(List> list, List> root, Predicate match, int layer) + { + if (list == null || root == null) + { + return; + } + + for (int i = 0; i < root.Count; i++) + { + // 鍔犲叆layer璺焤oot閲岀殑pos姣旇緝锛屽彧鏈変綅缃浉鍚屾墠鏄粺涓鍛藉悕绌洪棿鑺傜偣 + if (match(root[i].value) && root[i].layer == layer) + { + list.Add(root[i]); + } + + FindParent(list, root[i].childs, match, layer); + } + } + + /*public void BreadthFirstTraversal(Action> action) + { + List> root = _root.childs; + Queue> queue = new Queue>(); + + for (int i = 0; i < root.Count; i++) + { + queue.Enqueue(root[i]); + } + + while (queue.Count > 0) + { + ToLuaNode node = queue.Dequeue(); + action(node); + + if (node.childs != null) + { + for (int i = 0; i < node.childs.Count; i++) + { + queue.Enqueue(node.childs[i]); + } + } + } + }*/ + + public void DepthFirstTraversal(Action> begin, Action> end, ToLuaNode node) + { + begin(node); + + for (int i = 0; i < node.childs.Count; i++) + { + DepthFirstTraversal(begin, end, node.childs[i]); + } + + end(node); + } + + //鍙湁浣嶇疆鐩稿悓鎵嶆槸缁熶竴鍛藉悕绌洪棿鑺傜偣 + public List> Find(Predicate match, int layer) + { + _list.Clear(); + FindParent(_list, _root.childs, match, layer); + return _list; + } + + public ToLuaNode GetRoot() + { + return _root; + } +} diff --git a/Assets/LuaFramework/ToLua/Editor/ToLuaTree.cs.meta b/Assets/LuaFramework/ToLua/Editor/ToLuaTree.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..693739610e9e18e0d887764e653add488360f121 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Editor/ToLuaTree.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 99b4e579c20c91f4d84ce5aa9add4672 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples.meta b/Assets/LuaFramework/ToLua/Examples.meta new file mode 100644 index 0000000000000000000000000000000000000000..cbbe7f7f35150b9360f0cfdee171f2267c9f31b9 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 940a49ebae9b91b4fb0682c92d968933 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/01_HelloWorld.meta b/Assets/LuaFramework/ToLua/Examples/01_HelloWorld.meta new file mode 100644 index 0000000000000000000000000000000000000000..c06335a5d72bce072e6b9ff247a95cc726df0cfa --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/01_HelloWorld.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 79324a58d1dd94843a6e15fb4d77da66 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/01_HelloWorld/HelloWorld.cs b/Assets/LuaFramework/ToLua/Examples/01_HelloWorld/HelloWorld.cs new file mode 100644 index 0000000000000000000000000000000000000000..ffac400c16167f63666f7be2f43923be116f51e1 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/01_HelloWorld/HelloWorld.cs @@ -0,0 +1,21 @@ +锘縰sing UnityEngine; +using LuaInterface; +using System; + +public class HelloWorld : MonoBehaviour +{ + void Awake() + { + LuaState lua = new LuaState(); + lua.Start(); + string hello = + @" + print('hello tolua#') + "; + + lua.DoString(hello, "HelloWorld.cs"); + lua.CheckTop(); + lua.Dispose(); + lua = null; + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/01_HelloWorld/HelloWorld.cs.meta b/Assets/LuaFramework/ToLua/Examples/01_HelloWorld/HelloWorld.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..37d4edd993b5112a37b62cc9dc5c76972c20d92f --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/01_HelloWorld/HelloWorld.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1db6056d0e0ccb049ae392139c512608 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/01_HelloWorld/HelloWorld.unity b/Assets/LuaFramework/ToLua/Examples/01_HelloWorld/HelloWorld.unity new file mode 100644 index 0000000000000000000000000000000000000000..97f5e772b3d715ac8ee48c59178a15271bf87b82 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/01_HelloWorld/HelloWorld.unity @@ -0,0 +1,212 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_GIWorkflowMode: 1 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 1 + m_BakeResolution: 50 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_LightmapSnapshot: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: .166666657 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &276284474 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 276284475} + - 114: {fileID: 276284476} + m_Layer: 0 + m_Name: Hello + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &276284475 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 276284474} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 +--- !u!114 &276284476 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 276284474} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1db6056d0e0ccb049ae392139c512608, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &2034107965 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 2034107970} + - 20: {fileID: 2034107969} + - 92: {fileID: 2034107968} + - 124: {fileID: 2034107967} + - 81: {fileID: 2034107966} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &2034107966 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2034107965} + m_Enabled: 1 +--- !u!124 &2034107967 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2034107965} + m_Enabled: 1 +--- !u!92 &2034107968 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2034107965} + m_Enabled: 1 +--- !u!20 &2034107969 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2034107965} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!4 &2034107970 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2034107965} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 diff --git a/Assets/LuaFramework/ToLua/Examples/01_HelloWorld/HelloWorld.unity.meta b/Assets/LuaFramework/ToLua/Examples/01_HelloWorld/HelloWorld.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..545091dd6c5e16558871e787ba9498b0e642e2d7 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/01_HelloWorld/HelloWorld.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 7ce3f2dc80a0205428a5372f74800258 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/02_ScriptsFromFile.meta b/Assets/LuaFramework/ToLua/Examples/02_ScriptsFromFile.meta new file mode 100644 index 0000000000000000000000000000000000000000..8f16012dde3923d55e93e2411ebeb8bf8016458f --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/02_ScriptsFromFile.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 71ca7fe863de8dd4d8a6057d043df5e4 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/02_ScriptsFromFile/ScriptsFromFile.cs b/Assets/LuaFramework/ToLua/Examples/02_ScriptsFromFile/ScriptsFromFile.cs new file mode 100644 index 0000000000000000000000000000000000000000..9aee992ada0e34ea53b2df3074fc546cfccd4de2 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/02_ScriptsFromFile/ScriptsFromFile.cs @@ -0,0 +1,62 @@ +锘縰sing UnityEngine; +using System.Collections; +using LuaInterface; +using System; +using System.IO; + +//灞曠ずsearchpath 浣跨敤锛宺equire 涓 dofile 鍖哄埆 +public class ScriptsFromFile : MonoBehaviour +{ + LuaState lua = null; + private string strLog = ""; + + void Start () + { +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived += Log; +#else + Application.RegisterLogCallback(Log); +#endif + lua = new LuaState(); + lua.Start(); + //濡傛灉绉诲姩浜員oLua鐩綍锛岃嚜宸辨墜鍔ㄤ慨澶嶅惂锛屽彧鏄緥瀛愬氨涓嶅仛閰嶇疆浜 + string fullPath = Application.dataPath + "\\ToLua/Examples/02_ScriptsFromFile"; + lua.AddSearchPath(fullPath); + } + + void Log(string msg, string stackTrace, LogType type) + { + strLog += msg; + strLog += "\r\n"; + } + + void OnGUI() + { + GUI.Label(new Rect(100, Screen.height / 2 - 100, 600, 400), strLog); + + if (GUI.Button(new Rect(50, 50, 120, 45), "DoFile")) + { + strLog = ""; + lua.DoFile("ScriptsFromFile.lua"); + } + else if (GUI.Button(new Rect(50, 150, 120, 45), "Require")) + { + strLog = ""; + lua.Require("ScriptsFromFile"); + } + + lua.Collect(); + lua.CheckTop(); + } + + void OnApplicationQuit() + { + lua.Dispose(); + lua = null; +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived -= Log; +#else + Application.RegisterLogCallback(null); +#endif + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/02_ScriptsFromFile/ScriptsFromFile.cs.meta b/Assets/LuaFramework/ToLua/Examples/02_ScriptsFromFile/ScriptsFromFile.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..011101e26c8a51df38ad2d5d81ce0d301f61b6ca --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/02_ScriptsFromFile/ScriptsFromFile.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 17346dbce1e39bd4b8cb9cdf6b9249e7 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/02_ScriptsFromFile/ScriptsFromFile.lua b/Assets/LuaFramework/ToLua/Examples/02_ScriptsFromFile/ScriptsFromFile.lua new file mode 100644 index 0000000000000000000000000000000000000000..e5585bac02374d610644b9af01055766e416a4c8 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/02_ScriptsFromFile/ScriptsFromFile.lua @@ -0,0 +1,2 @@ +print("This is a script from a utf8 file") +print("tolua: 浣犲ソ! 銇撱倱銇仭銇! 鞎堧厱頃橃劯鞖!") diff --git a/Assets/LuaFramework/ToLua/Examples/02_ScriptsFromFile/ScriptsFromFile.lua.meta b/Assets/LuaFramework/ToLua/Examples/02_ScriptsFromFile/ScriptsFromFile.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..70dcbb31ae3ea97adc69bd037207ea5244566d05 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/02_ScriptsFromFile/ScriptsFromFile.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: fbc95a40dca6ccf448ff2a7f1905e751 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/02_ScriptsFromFile/ScriptsFromFile.unity b/Assets/LuaFramework/ToLua/Examples/02_ScriptsFromFile/ScriptsFromFile.unity new file mode 100644 index 0000000000000000000000000000000000000000..caf38a26c31164f3a0fe3070debc815b962f93e0 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/02_ScriptsFromFile/ScriptsFromFile.unity @@ -0,0 +1,212 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_GIWorkflowMode: 1 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 1 + m_BakeResolution: 50 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_LightmapSnapshot: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: .166666657 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &276284474 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 276284475} + - 114: {fileID: 276284476} + m_Layer: 0 + m_Name: ReadFile + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &276284475 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 276284474} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 +--- !u!114 &276284476 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 276284474} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 17346dbce1e39bd4b8cb9cdf6b9249e7, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &2034107965 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 2034107970} + - 20: {fileID: 2034107969} + - 92: {fileID: 2034107968} + - 124: {fileID: 2034107967} + - 81: {fileID: 2034107966} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &2034107966 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2034107965} + m_Enabled: 1 +--- !u!124 &2034107967 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2034107965} + m_Enabled: 1 +--- !u!92 &2034107968 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2034107965} + m_Enabled: 1 +--- !u!20 &2034107969 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2034107965} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!4 &2034107970 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2034107965} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 diff --git a/Assets/LuaFramework/ToLua/Examples/02_ScriptsFromFile/ScriptsFromFile.unity.meta b/Assets/LuaFramework/ToLua/Examples/02_ScriptsFromFile/ScriptsFromFile.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..0635758587feea2eb6f874a4d42df1f28bb4faa0 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/02_ScriptsFromFile/ScriptsFromFile.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: e011b54a109dd1c43b5ed71ca3590a32 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/03_CallLuaFunction.meta b/Assets/LuaFramework/ToLua/Examples/03_CallLuaFunction.meta new file mode 100644 index 0000000000000000000000000000000000000000..f60b5b28f4ab0479a14f1a3f48d8ec70091b27c1 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/03_CallLuaFunction.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 0b90da095ffcaa34891335989ba05ddf +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/03_CallLuaFunction/CallLuaFunction.cs b/Assets/LuaFramework/ToLua/Examples/03_CallLuaFunction/CallLuaFunction.cs new file mode 100644 index 0000000000000000000000000000000000000000..e829c0150edd71b6422ab827bee3454d2fb53b8b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/03_CallLuaFunction/CallLuaFunction.cs @@ -0,0 +1,96 @@ +锘縰sing UnityEngine; +using System.Collections; +using LuaInterface; +using System; + +public class CallLuaFunction : MonoBehaviour +{ + private string script = + @" function luaFunc(num) + return num + 1 + end + + test = {} + test.luaFunc = luaFunc + "; + + LuaFunction luaFunc = null; + LuaState lua = null; + string tips = null; + + void Start () + { +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived += ShowTips; +#else + Application.RegisterLogCallback(ShowTips); +#endif + new LuaResLoader(); + lua = new LuaState(); + lua.Start(); + DelegateFactory.Init(); + lua.DoString(script); + + //Get the function object + luaFunc = lua.GetFunction("test.luaFunc"); + + if (luaFunc != null) + { + int num = luaFunc.Invoke(123456); + Debugger.Log("generic call return: {0}", num); + + num = CallFunc(); + Debugger.Log("expansion call return: {0}", num); + + Func Func = luaFunc.ToDelegate>(); + num = Func(123456); + Debugger.Log("Delegate call return: {0}", num); + + num = lua.Invoke("test.luaFunc", 123456, true); + Debugger.Log("luastate call return: {0}", num); + } + + lua.CheckTop(); + } + + void ShowTips(string msg, string stackTrace, LogType type) + { + tips += msg; + tips += "\r\n"; + } + +#if !TEST_GC + void OnGUI() + { + GUI.Label(new Rect(Screen.width / 2 - 200, Screen.height / 2 - 150, 400, 300), tips); + } +#endif + + void OnDestroy() + { + if (luaFunc != null) + { + luaFunc.Dispose(); + luaFunc = null; + } + + lua.Dispose(); + lua = null; + +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived -= ShowTips; +#else + Application.RegisterLogCallback(null); +#endif + } + + int CallFunc() + { + luaFunc.BeginPCall(); + luaFunc.Push(123456); + luaFunc.PCall(); + int num = (int)luaFunc.CheckNumber(); + luaFunc.EndPCall(); + return num; + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/03_CallLuaFunction/CallLuaFunction.cs.meta b/Assets/LuaFramework/ToLua/Examples/03_CallLuaFunction/CallLuaFunction.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..35e07052f929ff1ef7e5ec047d508dfbfb417ba0 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/03_CallLuaFunction/CallLuaFunction.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 11338f45069e3e041b7c42b60897ce0a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/03_CallLuaFunction/CallLuaFunction.unity b/Assets/LuaFramework/ToLua/Examples/03_CallLuaFunction/CallLuaFunction.unity new file mode 100644 index 0000000000000000000000000000000000000000..b64f02ec6b8964ac48c83bb8565f684d26a77a12 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/03_CallLuaFunction/CallLuaFunction.unity @@ -0,0 +1,212 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_GIWorkflowMode: 1 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 1 + m_BakeResolution: 50 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_LightmapSnapshot: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: .166666657 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &1979477024 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1979477029} + - 20: {fileID: 1979477028} + - 92: {fileID: 1979477027} + - 124: {fileID: 1979477026} + - 81: {fileID: 1979477025} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1979477025 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1979477024} + m_Enabled: 1 +--- !u!124 &1979477026 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1979477024} + m_Enabled: 1 +--- !u!92 &1979477027 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1979477024} + m_Enabled: 1 +--- !u!20 &1979477028 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1979477024} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!4 &1979477029 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1979477024} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!1 &2039062674 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 2039062676} + - 114: {fileID: 2039062675} + m_Layer: 0 + m_Name: CallLuaFunction + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &2039062675 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2039062674} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 11338f45069e3e041b7c42b60897ce0a, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &2039062676 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2039062674} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 diff --git a/Assets/LuaFramework/ToLua/Examples/03_CallLuaFunction/CallLuaFunction.unity.meta b/Assets/LuaFramework/ToLua/Examples/03_CallLuaFunction/CallLuaFunction.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..eec9c903b18f7506851b7bf3cec19bef3d5ed130 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/03_CallLuaFunction/CallLuaFunction.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 9b95d9c7995843244812901527540c78 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/04_AccessingLuaVariables.meta b/Assets/LuaFramework/ToLua/Examples/04_AccessingLuaVariables.meta new file mode 100644 index 0000000000000000000000000000000000000000..fcb60f4172e1b67d67c187d83b79a003ac2992a7 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/04_AccessingLuaVariables.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 1b3a357bb0337ee438db20f82382e246 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/04_AccessingLuaVariables/AccessingLuaVariables.cs b/Assets/LuaFramework/ToLua/Examples/04_AccessingLuaVariables/AccessingLuaVariables.cs new file mode 100644 index 0000000000000000000000000000000000000000..08bf356dd31ed9602a84d5be21166614b12dd9f6 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/04_AccessingLuaVariables/AccessingLuaVariables.cs @@ -0,0 +1,97 @@ +锘縰sing UnityEngine; +using System.Collections.Generic; +using LuaInterface; + +public class AccessingLuaVariables : MonoBehaviour +{ + private string script = + @" + print('Objs2Spawn is: '..Objs2Spawn) + var2read = 42 + varTable = {1,2,3,4,5} + varTable.default = 1 + varTable.map = {} + varTable.map.name = 'map' + + meta = {name = 'meta'} + setmetatable(varTable, meta) + + function TestFunc(strs) + print('get func by variable') + end + "; + + void Start () + { +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived += ShowTips; +#else + Application.RegisterLogCallback(ShowTips); +#endif + new LuaResLoader(); + LuaState lua = new LuaState(); + lua.Start(); + lua["Objs2Spawn"] = 5; + lua.DoString(script); + + //閫氳繃LuaState璁块棶 + Debugger.Log("Read var from lua: {0}", lua["var2read"]); + Debugger.Log("Read table var from lua: {0}", lua["varTable.default"]); //LuaState 鎷嗕覆寮弔able + + LuaFunction func = lua["TestFunc"] as LuaFunction; + func.Call(); + func.Dispose(); + + //cache鎴怢uaTable杩涜璁块棶 + LuaTable table = lua.GetTable("varTable"); + Debugger.Log("Read varTable from lua, default: {0} name: {1}", table["default"], table["map.name"]); + table["map.name"] = "new"; //table 瀛楃涓插彧鑳芥槸key + Debugger.Log("Modify varTable name: {0}", table["map.name"]); + + table.AddTable("newmap"); + LuaTable table1 = (LuaTable)table["newmap"]; + table1["name"] = "table1"; + Debugger.Log("varTable.newmap name: {0}", table1["name"]); + table1.Dispose(); + + table1 = table.GetMetaTable(); + + if (table1 != null) + { + Debugger.Log("varTable metatable name: {0}", table1["name"]); + } + + object[] list = table.ToArray(); + + for (int i = 0; i < list.Length; i++) + { + Debugger.Log("varTable[{0}], is {1}", i, list[i]); + } + + table.Dispose(); + lua.CheckTop(); + lua.Dispose(); + } + + private void OnApplicationQuit() + { +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived -= ShowTips; +#else + Application.RegisterLogCallback(null); +#endif + } + + string tips = null; + + void ShowTips(string msg, string stackTrace, LogType type) + { + tips += msg; + tips += "\r\n"; + } + + void OnGUI() + { + GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 200, 600, 400), tips); + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/04_AccessingLuaVariables/AccessingLuaVariables.cs.meta b/Assets/LuaFramework/ToLua/Examples/04_AccessingLuaVariables/AccessingLuaVariables.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..ad57b727df5ba2af30a9f13dbb29250f638c9634 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/04_AccessingLuaVariables/AccessingLuaVariables.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3121aadbc8cdbeb488fdc0cfd1032ead +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/04_AccessingLuaVariables/AccessingLuaVariables.unity b/Assets/LuaFramework/ToLua/Examples/04_AccessingLuaVariables/AccessingLuaVariables.unity new file mode 100644 index 0000000000000000000000000000000000000000..e22160ffc423b02d4535b4fc6c051858c6cf4b84 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/04_AccessingLuaVariables/AccessingLuaVariables.unity @@ -0,0 +1,212 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_GIWorkflowMode: 1 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 1 + m_BakeResolution: 50 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_LightmapSnapshot: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: .166666657 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &66929426 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 66929427} + - 114: {fileID: 66929428} + m_Layer: 0 + m_Name: Variable + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &66929427 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 66929426} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 +--- !u!114 &66929428 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 66929426} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3121aadbc8cdbeb488fdc0cfd1032ead, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1276068095 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1276068100} + - 20: {fileID: 1276068099} + - 92: {fileID: 1276068098} + - 124: {fileID: 1276068097} + - 81: {fileID: 1276068096} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1276068096 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1276068095} + m_Enabled: 1 +--- !u!124 &1276068097 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1276068095} + m_Enabled: 1 +--- !u!92 &1276068098 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1276068095} + m_Enabled: 1 +--- !u!20 &1276068099 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1276068095} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!4 &1276068100 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1276068095} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 diff --git a/Assets/LuaFramework/ToLua/Examples/04_AccessingLuaVariables/AccessingLuaVariables.unity.meta b/Assets/LuaFramework/ToLua/Examples/04_AccessingLuaVariables/AccessingLuaVariables.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..9d85fd62331d7b7dac8cd9ed02bc78a6bfeee2de --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/04_AccessingLuaVariables/AccessingLuaVariables.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: b440f9ea3ca78884cbc8bd834a84ee54 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/05_LuaCoroutine.meta b/Assets/LuaFramework/ToLua/Examples/05_LuaCoroutine.meta new file mode 100644 index 0000000000000000000000000000000000000000..e940f5c706c191233d0f3ef8cadfccb1bf89897f --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/05_LuaCoroutine.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 4aab46dd051561242b5f1dd79f189a42 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/05_LuaCoroutine/LuaCoroutine.unity b/Assets/LuaFramework/ToLua/Examples/05_LuaCoroutine/LuaCoroutine.unity new file mode 100644 index 0000000000000000000000000000000000000000..1f91ededa1d1131f3d35a84d50501067e1f9c908 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/05_LuaCoroutine/LuaCoroutine.unity @@ -0,0 +1,213 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_GIWorkflowMode: 1 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 1 + m_BakeResolution: 50 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_LightmapSnapshot: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: .166666657 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &1463174690 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1463174692} + - 114: {fileID: 1463174691} + m_Layer: 0 + m_Name: coroutine + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1463174691 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1463174690} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3fdb28fb1b0a1eb4391deef05b03405d, type: 3} + m_Name: + m_EditorClassIdentifier: + luaFile: {fileID: 4900000, guid: 3e90f8f033d17114297577d8cde2677e, type: 3} +--- !u!4 &1463174692 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1463174690} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 +--- !u!1 &1613915606 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1613915611} + - 20: {fileID: 1613915610} + - 92: {fileID: 1613915609} + - 124: {fileID: 1613915608} + - 81: {fileID: 1613915607} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1613915607 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1613915606} + m_Enabled: 1 +--- !u!124 &1613915608 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1613915606} + m_Enabled: 1 +--- !u!92 &1613915609 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1613915606} + m_Enabled: 1 +--- !u!20 &1613915610 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1613915606} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!4 &1613915611 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1613915606} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 diff --git a/Assets/LuaFramework/ToLua/Examples/05_LuaCoroutine/LuaCoroutine.unity.meta b/Assets/LuaFramework/ToLua/Examples/05_LuaCoroutine/LuaCoroutine.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..1fe57b66649a564b6e9e11db470ad5bad53b24cb --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/05_LuaCoroutine/LuaCoroutine.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 811fd4e3aec57234ea72e1ed44701a9c +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/05_LuaCoroutine/TestCoroutine.cs b/Assets/LuaFramework/ToLua/Examples/05_LuaCoroutine/TestCoroutine.cs new file mode 100644 index 0000000000000000000000000000000000000000..b24d5a17d58437a9a41af4a2421e3f0827bd3edf --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/05_LuaCoroutine/TestCoroutine.cs @@ -0,0 +1,78 @@ +锘縰sing UnityEngine; +using System; +using System.Collections; +using LuaInterface; + +//渚嬪瓙5鍜6灞曠ず鐨勪袱濂楀崗鍚岀郴缁熷嬁浜ゅ弶浣跨敤锛屾涓烘帹鑽愭柟妗 +public class TestCoroutine : MonoBehaviour +{ + public TextAsset luaFile = null; + private LuaState lua = null; + private LuaLooper looper = null; + + void Awake () + { +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived += ShowTips; +#else + Application.RegisterLogCallback(ShowTips); +#endif + new LuaResLoader(); + lua = new LuaState(); + lua.Start(); + LuaBinder.Bind(lua); + DelegateFactory.Init(); + looper = gameObject.AddComponent(); + looper.luaState = lua; + + lua.DoString(luaFile.text, "TestLuaCoroutine.lua"); + LuaFunction f = lua.GetFunction("TestCortinue"); + f.Call(); + f.Dispose(); + f = null; + } + + void OnApplicationQuit() + { + looper.Destroy(); + lua.Dispose(); + lua = null; +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived -= ShowTips; +#else + Application.RegisterLogCallback(null); +#endif + } + + string tips = null; + + void ShowTips(string msg, string stackTrace, LogType type) + { + tips += msg; + tips += "\r\n"; + } + + void OnGUI() + { + GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 200, 600, 400), tips); + + if (GUI.Button(new Rect(50, 50, 120, 45), "Start Counter")) + { + tips = null; + LuaFunction func = lua.GetFunction("StartDelay"); + func.Call(); + func.Dispose(); + } + else if (GUI.Button(new Rect(50, 150, 120, 45), "Stop Counter")) + { + LuaFunction func = lua.GetFunction("StopDelay"); + func.Call(); + func.Dispose(); + } + else if (GUI.Button(new Rect(50, 250, 120, 45), "GC")) + { + lua.DoString("collectgarbage('collect')", "TestCoroutine.cs"); + Resources.UnloadUnusedAssets(); + } + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/05_LuaCoroutine/TestCoroutine.cs.meta b/Assets/LuaFramework/ToLua/Examples/05_LuaCoroutine/TestCoroutine.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..356c3019ae90be3cd5f12562929753bfd88ce423 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/05_LuaCoroutine/TestCoroutine.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3fdb28fb1b0a1eb4391deef05b03405d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/06_LuaCoroutine2.meta b/Assets/LuaFramework/ToLua/Examples/06_LuaCoroutine2.meta new file mode 100644 index 0000000000000000000000000000000000000000..c82340c84c9a3b013b351087fa19542593b7f94a --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/06_LuaCoroutine2.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 2bf03102ccd94cb45afe01e02bf19184 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/06_LuaCoroutine2/Coroutine.unity b/Assets/LuaFramework/ToLua/Examples/06_LuaCoroutine2/Coroutine.unity new file mode 100644 index 0000000000000000000000000000000000000000..7e188f2fbf2ed193c23095f31de0335b6dbbbb8c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/06_LuaCoroutine2/Coroutine.unity @@ -0,0 +1,212 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_GIWorkflowMode: 1 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 1 + m_BakeResolution: 50 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_LightmapSnapshot: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: .166666657 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &1668287759 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1668287764} + - 20: {fileID: 1668287763} + - 92: {fileID: 1668287762} + - 124: {fileID: 1668287761} + - 81: {fileID: 1668287760} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1668287760 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1668287759} + m_Enabled: 1 +--- !u!124 &1668287761 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1668287759} + m_Enabled: 1 +--- !u!92 &1668287762 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1668287759} + m_Enabled: 1 +--- !u!20 &1668287763 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1668287759} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!4 &1668287764 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1668287759} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!1 &1707651804 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1707651805} + - 114: {fileID: 1707651806} + m_Layer: 0 + m_Name: coroutine2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1707651805 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1707651804} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 +--- !u!114 &1707651806 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1707651804} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 252cf94b5db18424a94f00ddbd580ee0, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/LuaFramework/ToLua/Examples/06_LuaCoroutine2/Coroutine.unity.meta b/Assets/LuaFramework/ToLua/Examples/06_LuaCoroutine2/Coroutine.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..cd62c1284c20ee8c4527ef8149bb206f2bf792be --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/06_LuaCoroutine2/Coroutine.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 4db2739d8c3e5af4ca5647e7ded00f68 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/06_LuaCoroutine2/TestCoroutine2.cs b/Assets/LuaFramework/ToLua/Examples/06_LuaCoroutine2/TestCoroutine2.cs new file mode 100644 index 0000000000000000000000000000000000000000..c10a318da02083199943162f93c8c4323a3d8eab --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/06_LuaCoroutine2/TestCoroutine2.cs @@ -0,0 +1,128 @@ +锘縰sing UnityEngine; +using System.Collections; +using LuaInterface; + +//涓ゅ鍗忓悓鍕夸氦鍙変娇鐢紝绫籾nity鍘熺敓锛屽ぇ閲忎娇鐢ㄦ晥鐜囦綆 +public class TestCoroutine2 : LuaClient +{ + string script = + @" + function CoExample() + WaitForSeconds(1) + print('WaitForSeconds end time: '.. UnityEngine.Time.time) + WaitForFixedUpdate() + print('WaitForFixedUpdate end frameCount: '..UnityEngine.Time.frameCount) + WaitForEndOfFrame() + print('WaitForEndOfFrame end frameCount: '..UnityEngine.Time.frameCount) + Yield(null) + print('yield null end frameCount: '..UnityEngine.Time.frameCount) + Yield(0) + print('yield(0) end frameCime: '..UnityEngine.Time.frameCount) + local www = UnityEngine.WWW('http://www.baidu.com') + Yield(www) + print('yield(www) end time: '.. UnityEngine.Time.time) + local s = tolua.tolstring(www.bytes) + print(s:sub(1, 128)) + print('coroutine over') + end + + function TestCo() + StartCoroutine(CoExample) + end + + local coDelay = nil + + function Delay() + local c = 1 + + while true do + WaitForSeconds(1) + print('Count: '..c) + c = c + 1 + end + end + + function StartDelay() + coDelay = StartCoroutine(Delay) + end + + function StopDelay() + StopCoroutine(coDelay) + coDelay = nil + end + "; + + protected override LuaFileUtils InitLoader() + { + return new LuaResLoader(); + } + + protected override void OnLoadFinished() + { + base.OnLoadFinished(); + + luaState.DoString(script, "TestCoroutine2.cs"); + LuaFunction func = luaState.GetFunction("TestCo"); + func.Call(); + func.Dispose(); + func = null; + } + + //灞忚斀锛屼緥瀛愪笉闇瑕佽繍琛 + protected override void CallMain() { } + + bool beStart = false; + string tips = null; + + void Start() + { +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived += ShowTips; +#else + Application.RegisterLogCallback(ShowTips); +#endif + } + + void ShowTips(string msg, string stackTrace, LogType type) + { + tips += msg; + tips += "\r\n"; + } + + new void OnApplicationQuit() + { +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived -= ShowTips; +#else + Application.RegisterLogCallback(null); +#endif + base.OnApplicationQuit(); + } + + void OnGUI() + { + GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 200, 600, 400), tips); + + if (GUI.Button(new Rect(50, 50, 120, 45), "Start Counter")) + { + if (!beStart) + { + beStart = true; + tips = ""; + LuaFunction func = luaState.GetFunction("StartDelay"); + func.Call(); + func.Dispose(); + } + } + else if (GUI.Button(new Rect(50, 150, 120, 45), "Stop Counter")) + { + if (beStart) + { + beStart = false; + LuaFunction func = luaState.GetFunction("StopDelay"); + func.Call(); + func.Dispose(); + } + } + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/06_LuaCoroutine2/TestCoroutine2.cs.meta b/Assets/LuaFramework/ToLua/Examples/06_LuaCoroutine2/TestCoroutine2.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..99a80dbeac058b31776030131cad29ded9d0af11 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/06_LuaCoroutine2/TestCoroutine2.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 252cf94b5db18424a94f00ddbd580ee0 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/07_LuaThread.meta b/Assets/LuaFramework/ToLua/Examples/07_LuaThread.meta new file mode 100644 index 0000000000000000000000000000000000000000..5f93d4dbab568982cca3ec8bf9330b3721373407 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/07_LuaThread.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 34683a8c5207cb3438b3b06aa2ef38c8 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/07_LuaThread/TestLuaThread.cs b/Assets/LuaFramework/ToLua/Examples/07_LuaThread/TestLuaThread.cs new file mode 100644 index 0000000000000000000000000000000000000000..ccb71a84cd307b3432ddc4e32646f77241021912 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/07_LuaThread/TestLuaThread.cs @@ -0,0 +1,117 @@ +锘縰sing UnityEngine; +using System.Collections; +using LuaInterface; + +public class TestLuaThread : MonoBehaviour +{ + string script = + @" + function fib(n) + local a, b = 0, 1 + while n > 0 do + a, b = b, a + b + n = n - 1 + end + + return a + end + + function CoFunc(len) + print('Coroutine started') + local i = 0 + for i = 0, len, 1 do + local flag = coroutine.yield(fib(i)) + if not flag then + break + end + end + print('Coroutine ended') + end + + function Test() + local co = coroutine.create(CoFunc) + return co + end + "; + + LuaState state = null; + LuaThread thread = null; + string tips = null; + + void Start () + { +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived += ShowTips; +#else + Application.RegisterLogCallback(ShowTips); +#endif + new LuaResLoader(); + state = new LuaState(); + state.Start(); + state.LogGC = true; + state.DoString(script); + + LuaFunction func = state.GetFunction("Test"); + func.BeginPCall(); + func.PCall(); + thread = func.CheckLuaThread(); + thread.name = "LuaThread"; + func.EndPCall(); + func.Dispose(); + func = null; + + thread.Resume(10); + } + + void OnApplicationQuit() + { + if (thread != null) + { + thread.Dispose(); + thread = null; + } + + state.Dispose(); + state = null; +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived -= ShowTips; +#else + Application.RegisterLogCallback(null); +#endif + } + + void ShowTips(string msg, string stackTrace, LogType type) + { + tips += msg; + tips += "\r\n"; + } + + void Update() + { + state.CheckTop(); + state.Collect(); + } + + void OnGUI() + { + GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 200, 600, 400), tips); + + if (GUI.Button(new Rect(10, 50, 120, 40), "Resume Thead")) + { + int ret = -1; + + if (thread != null && thread.Resume(true, out ret) == (int)LuaThreadStatus.LUA_YIELD) + { + Debugger.Log("lua yield: " + ret); + } + } + else if (GUI.Button(new Rect(10, 150, 120, 40), "Close Thread")) + { + if (thread != null) + { + thread.Dispose(); + thread = null; + } + } + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/07_LuaThread/TestLuaThread.cs.meta b/Assets/LuaFramework/ToLua/Examples/07_LuaThread/TestLuaThread.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..323f3b7dee2e770f07fe8e20f1be38e12c25df42 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/07_LuaThread/TestLuaThread.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cd0d38a2cd6c8794ebb1150cc3678db6 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/07_LuaThread/TestThread.unity b/Assets/LuaFramework/ToLua/Examples/07_LuaThread/TestThread.unity new file mode 100644 index 0000000000000000000000000000000000000000..3528c041fa8e7dde5aacbdde3b880bfbcea84bcb --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/07_LuaThread/TestThread.unity @@ -0,0 +1,212 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_GIWorkflowMode: 1 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 1 + m_BakeResolution: 50 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_LightmapSnapshot: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: .166666657 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &955231624 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 955231629} + - 20: {fileID: 955231628} + - 92: {fileID: 955231627} + - 124: {fileID: 955231626} + - 81: {fileID: 955231625} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &955231625 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 955231624} + m_Enabled: 1 +--- !u!124 &955231626 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 955231624} + m_Enabled: 1 +--- !u!92 &955231627 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 955231624} + m_Enabled: 1 +--- !u!20 &955231628 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 955231624} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!4 &955231629 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 955231624} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!1 &2039255918 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 2039255920} + - 114: {fileID: 2039255919} + m_Layer: 0 + m_Name: TestThread + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &2039255919 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2039255918} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: cd0d38a2cd6c8794ebb1150cc3678db6, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &2039255920 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2039255918} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 diff --git a/Assets/LuaFramework/ToLua/Examples/07_LuaThread/TestThread.unity.meta b/Assets/LuaFramework/ToLua/Examples/07_LuaThread/TestThread.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..b051bc6752dccb3830e459643d3a6e254c928e6f --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/07_LuaThread/TestThread.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 4bc55bdc0d2bff34a9abc55c4eeebdc0 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/08_AccessingArray.meta b/Assets/LuaFramework/ToLua/Examples/08_AccessingArray.meta new file mode 100644 index 0000000000000000000000000000000000000000..7c878859cf74c4a2fa7e6d095a5c10cf94ac6b8a --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/08_AccessingArray.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: d74fee3fd9c8cb64e8d8083fb944a9c3 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/08_AccessingArray/AccessingArray.cs b/Assets/LuaFramework/ToLua/Examples/08_AccessingArray/AccessingArray.cs new file mode 100644 index 0000000000000000000000000000000000000000..cc5af48a6c22f720cb461c9072e62c79a3ee257c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/08_AccessingArray/AccessingArray.cs @@ -0,0 +1,98 @@ +锘縰sing UnityEngine; +using LuaInterface; + +public class AccessingArray : MonoBehaviour +{ + private string script = + @" + function TestArray(array) + local len = array.Length + + for i = 0, len - 1 do + print('Array: '..tostring(array[i])) + end + + local iter = array:GetEnumerator() + + while iter:MoveNext() do + print('iter: '..iter.Current) + end + + local t = array:ToTable() + + for i = 1, #t do + print('table: '.. tostring(t[i])) + end + + local pos = array:BinarySearch(3) + print('array BinarySearch: pos: '..pos..' value: '..array[pos]) + + pos = array:IndexOf(4) + print('array indexof bbb pos is: '..pos) + + return 1, '123', true + end + "; + + LuaState lua = null; + LuaFunction func = null; + string tips = null; + + void Start() + { +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived += ShowTips; +#else + Application.RegisterLogCallback(ShowTips); +#endif + new LuaResLoader(); + lua = new LuaState(); + lua.Start(); + lua.DoString(script, "AccessingArray.cs"); + tips = ""; + + int[] array = { 1, 2, 3, 4, 5}; + func = lua.GetFunction("TestArray"); + + func.BeginPCall(); + func.Push(array); + func.PCall(); + double arg1 = func.CheckNumber(); + string arg2 = func.CheckString(); + bool arg3 = func.CheckBoolean(); + Debugger.Log("return is {0} {1} {2}", arg1, arg2, arg3); + func.EndPCall(); + + //璋冪敤閫氱敤鍑芥暟闇瑕佽浆鎹竴涓嬬被鍨嬶紝閬垮厤鍙彉鍙傛暟鎷嗘垚澶氫釜鍙傛暟浼犻 + object[] objs = func.LazyCall((object)array); + + if (objs != null) + { + Debugger.Log("return is {0} {1} {2}", objs[0], objs[1], objs[2]); + } + + lua.CheckTop(); + } + + void ShowTips(string msg, string stackTrace, LogType type) + { + tips += msg; + tips += "\r\n"; + } + + void OnGUI() + { + GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 300, 600, 600), tips); + } + + void OnApplicationQuit() + { +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived -= ShowTips; +#else + Application.RegisterLogCallback(null); +#endif + func.Dispose(); + lua.Dispose(); + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/08_AccessingArray/AccessingArray.cs.meta b/Assets/LuaFramework/ToLua/Examples/08_AccessingArray/AccessingArray.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..bd9d4107af2c609658a09cd91b5f8c2d7ec3be23 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/08_AccessingArray/AccessingArray.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 82a287200877e9344a7e6b2d58dfe019 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/08_AccessingArray/AccessingArray.unity b/Assets/LuaFramework/ToLua/Examples/08_AccessingArray/AccessingArray.unity new file mode 100644 index 0000000000000000000000000000000000000000..f8b790ff9c0de39dc465e78c5f8cf16a4627011f --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/08_AccessingArray/AccessingArray.unity @@ -0,0 +1,212 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_GIWorkflowMode: 1 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 1 + m_BakeResolution: 50 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_LightmapSnapshot: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: .166666657 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &536310602 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 536310603} + - 114: {fileID: 536310604} + m_Layer: 0 + m_Name: AccessingArray + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &536310603 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 536310602} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 +--- !u!114 &536310604 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 536310602} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 82a287200877e9344a7e6b2d58dfe019, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1031693656 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1031693661} + - 20: {fileID: 1031693660} + - 92: {fileID: 1031693659} + - 124: {fileID: 1031693658} + - 81: {fileID: 1031693657} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1031693657 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1031693656} + m_Enabled: 1 +--- !u!124 &1031693658 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1031693656} + m_Enabled: 1 +--- !u!92 &1031693659 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1031693656} + m_Enabled: 1 +--- !u!20 &1031693660 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1031693656} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!4 &1031693661 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1031693656} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 diff --git a/Assets/LuaFramework/ToLua/Examples/08_AccessingArray/AccessingArray.unity.meta b/Assets/LuaFramework/ToLua/Examples/08_AccessingArray/AccessingArray.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..59fa5e7a85bfc715598a53d466eefa1626928691 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/08_AccessingArray/AccessingArray.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 3f3cdbddf148392458f85eed2085860c +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/09_Dictionary.meta b/Assets/LuaFramework/ToLua/Examples/09_Dictionary.meta new file mode 100644 index 0000000000000000000000000000000000000000..8baf032a9f7c867e3fb988847df5bfe6694e3f4a --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/09_Dictionary.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: d308146ac25b5a74d99ced6f74495105 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/09_Dictionary/System_Collections_Generic_Dictionary_int_TestAccountWrap.cs b/Assets/LuaFramework/ToLua/Examples/09_Dictionary/System_Collections_Generic_Dictionary_int_TestAccountWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..d1ed1e0bf188ed7a606944b850741768d5b7abfb --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/09_Dictionary/System_Collections_Generic_Dictionary_int_TestAccountWrap.cs @@ -0,0 +1,419 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class System_Collections_Generic_Dictionary_int_TestAccountWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(System.Collections.Generic.Dictionary), typeof(System.Object), "AccountMap"); + L.RegFunction(".geti", get_Item); + L.RegFunction("get_Item", get_Item); + L.RegFunction(".seti", set_Item); + L.RegFunction("set_Item", set_Item); + L.RegFunction("Add", Add); + L.RegFunction("Clear", Clear); + L.RegFunction("ContainsKey", ContainsKey); + L.RegFunction("ContainsValue", ContainsValue); + L.RegFunction("GetObjectData", GetObjectData); + L.RegFunction("OnDeserialization", OnDeserialization); + L.RegFunction("Remove", Remove); + L.RegFunction("TryGetValue", TryGetValue); + L.RegFunction("GetEnumerator", GetEnumerator); + L.RegFunction("New", _CreateSystem_Collections_Generic_Dictionary_int_TestAccount); + L.RegVar("this", _this, null); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("Count", get_Count, null); + L.RegVar("Comparer", get_Comparer, null); + L.RegVar("Keys", get_Keys, null); + L.RegVar("Values", get_Values, null); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateSystem_Collections_Generic_Dictionary_int_TestAccount(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + System.Collections.Generic.Dictionary obj = new System.Collections.Generic.Dictionary(); + ToLua.PushSealed(L, obj); + return 1; + } + else if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + System.Collections.Generic.Dictionary obj = new System.Collections.Generic.Dictionary(arg0); + ToLua.PushSealed(L, obj); + return 1; + } + else if (count == 1 && TypeChecker.CheckTypes>(L, 1)) + { + System.Collections.Generic.IDictionary arg0 = (System.Collections.Generic.IDictionary)ToLua.ToObject(L, 1); + System.Collections.Generic.Dictionary obj = new System.Collections.Generic.Dictionary(arg0); + ToLua.PushSealed(L, obj); + return 1; + } + else if (count == 1 && TypeChecker.CheckTypes>(L, 1)) + { + System.Collections.Generic.IEqualityComparer arg0 = (System.Collections.Generic.IEqualityComparer)ToLua.ToObject(L, 1); + System.Collections.Generic.Dictionary obj = new System.Collections.Generic.Dictionary(arg0); + ToLua.PushSealed(L, obj); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes>(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + System.Collections.Generic.IEqualityComparer arg1 = (System.Collections.Generic.IEqualityComparer)ToLua.ToObject(L, 2); + System.Collections.Generic.Dictionary obj = new System.Collections.Generic.Dictionary(arg0, arg1); + ToLua.PushSealed(L, obj); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes, System.Collections.Generic.IEqualityComparer>(L, 1)) + { + System.Collections.Generic.IDictionary arg0 = (System.Collections.Generic.IDictionary)ToLua.ToObject(L, 1); + System.Collections.Generic.IEqualityComparer arg1 = (System.Collections.Generic.IEqualityComparer)ToLua.ToObject(L, 2); + System.Collections.Generic.Dictionary obj = new System.Collections.Generic.Dictionary(arg0, arg1); + ToLua.PushSealed(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: System.Collections.Generic.Dictionary.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _get_this(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + System.Collections.Generic.Dictionary obj = (System.Collections.Generic.Dictionary)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + TestAccount o = obj[arg0]; + ToLua.PushSealed(L, o); + return 1; + + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _set_this(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + System.Collections.Generic.Dictionary obj = (System.Collections.Generic.Dictionary)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + TestAccount arg1 = (TestAccount)ToLua.CheckObject(L, 3, typeof(TestAccount)); + obj[arg0] = arg1; + return 0; + + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _this(IntPtr L) + { + try + { + LuaDLL.lua_pushvalue(L, 1); + LuaDLL.tolua_bindthis(L, _get_this, _set_this); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Item(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + System.Collections.Generic.Dictionary obj = (System.Collections.Generic.Dictionary)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + TestAccount o = obj[arg0]; + ToLua.PushSealed(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_Item(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + System.Collections.Generic.Dictionary obj = (System.Collections.Generic.Dictionary)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + TestAccount arg1 = (TestAccount)ToLua.CheckObject(L, 3, typeof(TestAccount)); + obj[arg0] = arg1; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Add(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + System.Collections.Generic.Dictionary obj = (System.Collections.Generic.Dictionary)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + TestAccount arg1 = (TestAccount)ToLua.CheckObject(L, 3, typeof(TestAccount)); + obj.Add(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Clear(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Collections.Generic.Dictionary obj = (System.Collections.Generic.Dictionary)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary)); + obj.Clear(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ContainsKey(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + System.Collections.Generic.Dictionary obj = (System.Collections.Generic.Dictionary)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + bool o = obj.ContainsKey(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ContainsValue(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + System.Collections.Generic.Dictionary obj = (System.Collections.Generic.Dictionary)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary)); + TestAccount arg0 = (TestAccount)ToLua.CheckObject(L, 2, typeof(TestAccount)); + bool o = obj.ContainsValue(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetObjectData(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + System.Collections.Generic.Dictionary obj = (System.Collections.Generic.Dictionary)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary)); + System.Runtime.Serialization.SerializationInfo arg0 = (System.Runtime.Serialization.SerializationInfo)ToLua.CheckObject(L, 2, typeof(System.Runtime.Serialization.SerializationInfo)); + System.Runtime.Serialization.StreamingContext arg1 = StackTraits.Check(L, 3); + obj.GetObjectData(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OnDeserialization(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + System.Collections.Generic.Dictionary obj = (System.Collections.Generic.Dictionary)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary)); + object arg0 = ToLua.ToVarObject(L, 2); + obj.OnDeserialization(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Remove(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + System.Collections.Generic.Dictionary obj = (System.Collections.Generic.Dictionary)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + bool o = obj.Remove(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TryGetValue(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + System.Collections.Generic.Dictionary obj = (System.Collections.Generic.Dictionary)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + TestAccount arg1 = null; + bool o = obj.TryGetValue(arg0, out arg1); + LuaDLL.lua_pushboolean(L, o); + ToLua.PushSealed(L, arg1); + return 2; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetEnumerator(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Collections.Generic.Dictionary obj = (System.Collections.Generic.Dictionary)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary)); + System.Collections.IEnumerator o = obj.GetEnumerator(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Count(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Collections.Generic.Dictionary obj = (System.Collections.Generic.Dictionary)o; + int ret = obj.Count; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index Count on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Comparer(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Collections.Generic.Dictionary obj = (System.Collections.Generic.Dictionary)o; + System.Collections.Generic.IEqualityComparer ret = obj.Comparer; + ToLua.PushObject(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index Comparer on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Keys(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Collections.Generic.Dictionary obj = (System.Collections.Generic.Dictionary)o; + System.Collections.Generic.Dictionary.KeyCollection ret = obj.Keys; + ToLua.PushSealed(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index Keys on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Values(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Collections.Generic.Dictionary obj = (System.Collections.Generic.Dictionary)o; + System.Collections.Generic.Dictionary.ValueCollection ret = obj.Values; + ToLua.PushSealed(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index Values on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Examples/09_Dictionary/System_Collections_Generic_Dictionary_int_TestAccountWrap.cs.meta b/Assets/LuaFramework/ToLua/Examples/09_Dictionary/System_Collections_Generic_Dictionary_int_TestAccountWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..f926f932f5645a1dd8d4f2bf5b02d2d19b895787 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/09_Dictionary/System_Collections_Generic_Dictionary_int_TestAccountWrap.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7eaa1793aebc03847bbeff73e29e711a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/09_Dictionary/System_Collections_Generic_Dictionary_int_TestAccount_KeyCollectionWrap.cs b/Assets/LuaFramework/ToLua/Examples/09_Dictionary/System_Collections_Generic_Dictionary_int_TestAccount_KeyCollectionWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..e57ee81dfe40827547b88dc64fb3e6ed08e38d15 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/09_Dictionary/System_Collections_Generic_Dictionary_int_TestAccount_KeyCollectionWrap.cs @@ -0,0 +1,97 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class System_Collections_Generic_Dictionary_int_TestAccount_KeyCollectionWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(System.Collections.Generic.Dictionary.KeyCollection), typeof(System.Object), "KeyCollection"); + L.RegFunction("CopyTo", CopyTo); + L.RegFunction("GetEnumerator", GetEnumerator); + L.RegFunction("New", _CreateSystem_Collections_Generic_Dictionary_int_TestAccount_KeyCollection); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("Count", get_Count, null); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateSystem_Collections_Generic_Dictionary_int_TestAccount_KeyCollection(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + System.Collections.Generic.Dictionary arg0 = (System.Collections.Generic.Dictionary)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary)); + System.Collections.Generic.Dictionary.KeyCollection obj = new System.Collections.Generic.Dictionary.KeyCollection(arg0); + ToLua.PushSealed(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: System.Collections.Generic.Dictionary.KeyCollection.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CopyTo(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + System.Collections.Generic.Dictionary.KeyCollection obj = (System.Collections.Generic.Dictionary.KeyCollection)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary.KeyCollection)); + int[] arg0 = ToLua.CheckNumberArray(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + obj.CopyTo(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetEnumerator(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Collections.Generic.Dictionary.KeyCollection obj = (System.Collections.Generic.Dictionary.KeyCollection)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary.KeyCollection)); + System.Collections.IEnumerator o = obj.GetEnumerator(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Count(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Collections.Generic.Dictionary.KeyCollection obj = (System.Collections.Generic.Dictionary.KeyCollection)o; + int ret = obj.Count; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index Count on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Examples/09_Dictionary/System_Collections_Generic_Dictionary_int_TestAccount_KeyCollectionWrap.cs.meta b/Assets/LuaFramework/ToLua/Examples/09_Dictionary/System_Collections_Generic_Dictionary_int_TestAccount_KeyCollectionWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..600fd3805e3bbbc13d428f1039bbeb88a09dc83f --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/09_Dictionary/System_Collections_Generic_Dictionary_int_TestAccount_KeyCollectionWrap.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ae6d6c27412c9fa4e815ef0f87e01cc2 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/09_Dictionary/System_Collections_Generic_Dictionary_int_TestAccount_ValueCollectionWrap.cs b/Assets/LuaFramework/ToLua/Examples/09_Dictionary/System_Collections_Generic_Dictionary_int_TestAccount_ValueCollectionWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..227e9a8a9d19112155715221495094c3f0fc8e41 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/09_Dictionary/System_Collections_Generic_Dictionary_int_TestAccount_ValueCollectionWrap.cs @@ -0,0 +1,97 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class System_Collections_Generic_Dictionary_int_TestAccount_ValueCollectionWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(System.Collections.Generic.Dictionary.ValueCollection), typeof(System.Object), "ValueCollection"); + L.RegFunction("CopyTo", CopyTo); + L.RegFunction("GetEnumerator", GetEnumerator); + L.RegFunction("New", _CreateSystem_Collections_Generic_Dictionary_int_TestAccount_ValueCollection); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("Count", get_Count, null); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateSystem_Collections_Generic_Dictionary_int_TestAccount_ValueCollection(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + System.Collections.Generic.Dictionary arg0 = (System.Collections.Generic.Dictionary)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary)); + System.Collections.Generic.Dictionary.ValueCollection obj = new System.Collections.Generic.Dictionary.ValueCollection(arg0); + ToLua.PushSealed(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: System.Collections.Generic.Dictionary.ValueCollection.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CopyTo(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + System.Collections.Generic.Dictionary.ValueCollection obj = (System.Collections.Generic.Dictionary.ValueCollection)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary.ValueCollection)); + TestAccount[] arg0 = ToLua.CheckObjectArray(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + obj.CopyTo(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetEnumerator(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Collections.Generic.Dictionary.ValueCollection obj = (System.Collections.Generic.Dictionary.ValueCollection)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary.ValueCollection)); + System.Collections.IEnumerator o = obj.GetEnumerator(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Count(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Collections.Generic.Dictionary.ValueCollection obj = (System.Collections.Generic.Dictionary.ValueCollection)o; + int ret = obj.Count; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index Count on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Examples/09_Dictionary/System_Collections_Generic_Dictionary_int_TestAccount_ValueCollectionWrap.cs.meta b/Assets/LuaFramework/ToLua/Examples/09_Dictionary/System_Collections_Generic_Dictionary_int_TestAccount_ValueCollectionWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..20445dfef0be60dab8648c47748f38965bafef78 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/09_Dictionary/System_Collections_Generic_Dictionary_int_TestAccount_ValueCollectionWrap.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c353ebccdf1714241a37253dd58c9309 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/09_Dictionary/System_Collections_Generic_KeyValuePair_int_TestAccountWrap.cs b/Assets/LuaFramework/ToLua/Examples/09_Dictionary/System_Collections_Generic_KeyValuePair_int_TestAccountWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..595273578bf9ef5892502349727b700053779b6a --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/09_Dictionary/System_Collections_Generic_KeyValuePair_int_TestAccountWrap.cs @@ -0,0 +1,105 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class System_Collections_Generic_KeyValuePair_int_TestAccountWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(System.Collections.Generic.KeyValuePair), null, "KeyValuePair_int_TestAccount"); + L.RegFunction("ToString", ToString); + L.RegFunction("New", _CreateSystem_Collections_Generic_KeyValuePair_int_TestAccount); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("Key", get_Key, null); + L.RegVar("Value", get_Value, null); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateSystem_Collections_Generic_KeyValuePair_int_TestAccount(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + TestAccount arg1 = (TestAccount)ToLua.CheckObject(L, 2, typeof(TestAccount)); + System.Collections.Generic.KeyValuePair obj = new System.Collections.Generic.KeyValuePair(arg0, arg1); + ToLua.PushValue(L, obj); + return 1; + } + else if (count == 0) + { + System.Collections.Generic.KeyValuePair obj = new System.Collections.Generic.KeyValuePair(); + ToLua.PushValue(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: System.Collections.Generic.KeyValuePair.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ToString(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Collections.Generic.KeyValuePair obj = (System.Collections.Generic.KeyValuePair)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.KeyValuePair)); + string o = obj.ToString(); + LuaDLL.lua_pushstring(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Key(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Collections.Generic.KeyValuePair obj = (System.Collections.Generic.KeyValuePair)o; + int ret = obj.Key; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index Key on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Value(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + System.Collections.Generic.KeyValuePair obj = (System.Collections.Generic.KeyValuePair)o; + TestAccount ret = obj.Value; + ToLua.PushSealed(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index Value on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Examples/09_Dictionary/System_Collections_Generic_KeyValuePair_int_TestAccountWrap.cs.meta b/Assets/LuaFramework/ToLua/Examples/09_Dictionary/System_Collections_Generic_KeyValuePair_int_TestAccountWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..9babe67ca769acc52a28d3eb909de60674a1eb57 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/09_Dictionary/System_Collections_Generic_KeyValuePair_int_TestAccountWrap.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e6f1375290fa13745bc07de7193ecc3e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/09_Dictionary/TestAccountWrap.cs b/Assets/LuaFramework/ToLua/Examples/09_Dictionary/TestAccountWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..0f051bd026278bd155428ccf7fb5b1b0bff02125 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/09_Dictionary/TestAccountWrap.cs @@ -0,0 +1,159 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class TestAccountWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(TestAccount), typeof(System.Object)); + L.RegFunction("New", _CreateTestAccount); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("id", get_id, set_id); + L.RegVar("name", get_name, set_name); + L.RegVar("sex", get_sex, set_sex); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateTestAccount(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + string arg1 = ToLua.CheckString(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + TestAccount obj = new TestAccount(arg0, arg1, arg2); + ToLua.PushSealed(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: TestAccount.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_id(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + TestAccount obj = (TestAccount)o; + int ret = obj.id; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index id on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_name(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + TestAccount obj = (TestAccount)o; + string ret = obj.name; + LuaDLL.lua_pushstring(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index name on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_sex(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + TestAccount obj = (TestAccount)o; + int ret = obj.sex; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index sex on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_id(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + TestAccount obj = (TestAccount)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.id = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index id on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_name(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + TestAccount obj = (TestAccount)o; + string arg0 = ToLua.CheckString(L, 2); + obj.name = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index name on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_sex(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + TestAccount obj = (TestAccount)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.sex = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index sex on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Examples/09_Dictionary/TestAccountWrap.cs.meta b/Assets/LuaFramework/ToLua/Examples/09_Dictionary/TestAccountWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..6cc88173b36df062aa23e353a0d3a522b748a3cb --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/09_Dictionary/TestAccountWrap.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b763e457bd5365e46bf64d146d0d5a3b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/09_Dictionary/UseDictionary.cs b/Assets/LuaFramework/ToLua/Examples/09_Dictionary/UseDictionary.cs new file mode 100644 index 0000000000000000000000000000000000000000..2de93ceb41bf03dacf68f23e0e14147805e21822 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/09_Dictionary/UseDictionary.cs @@ -0,0 +1,137 @@ +锘縰sing UnityEngine; +using System.Collections.Generic; +using LuaInterface; + +public sealed class TestAccount +{ + public int id; + public string name; + public int sex; + + public TestAccount(int id, string name, int sex) + { + this.id = id; + this.name = name; + this.sex = sex; + } +} + +public class UseDictionary : MonoBehaviour +{ + Dictionary map = new Dictionary(); + + string script = + @" + function TestDict(map) + local iter = map:GetEnumerator() + + while iter:MoveNext() do + local v = iter.Current.Value + print('id: '..v.id ..' name: '..v.name..' sex: '..v.sex) + end + + local flag, account = map:TryGetValue(1, nil) + + if flag then + print('TryGetValue result ok: '..account.name) + end + + local keys = map.Keys + iter = keys:GetEnumerator() + print('------------print dictionary keys---------------') + while iter:MoveNext() do + print(iter.Current) + end + print('----------------------over----------------------') + + local values = map.Values + iter = values:GetEnumerator() + print('------------print dictionary values---------------') + while iter:MoveNext() do + print(iter.Current.name) + end + print('----------------------over----------------------') + + print('kick '..map[2].name) + map:Remove(2) + iter = map:GetEnumerator() + + while iter:MoveNext() do + local v = iter.Current.Value + print('id: '..v.id ..' name: '..v.name..' sex: '..v.sex) + end + end + "; + + void Awake () + { +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived += ShowTips; +#else + Application.RegisterLogCallback(ShowTips); +#endif + new LuaResLoader(); + map.Add(1, new TestAccount(1, "姘存按", 0)); + map.Add(2, new TestAccount(2, "鐜嬩紵", 1)); + map.Add(3, new TestAccount(3, "鐜嬭姵", 0)); + + LuaState luaState = new LuaState(); + luaState.Start(); + BindMap(luaState); + + luaState.DoString(script, "UseDictionary.cs"); + LuaFunction func = luaState.GetFunction("TestDict"); + func.BeginPCall(); + func.Push(map); + func.PCall(); + func.EndPCall(); + + func.Dispose(); + func = null; + luaState.CheckTop(); + luaState.Dispose(); + luaState = null; + } + + void OnApplicationQuit() + { +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived -= ShowTips; +#else + Application.RegisterLogCallback(null); +#endif + } + + string tips = ""; + + void ShowTips(string msg, string stackTrace, LogType type) + { + tips += msg; + tips += "\r\n"; + } + + void OnGUI() + { + GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 200, 600, 400), tips); + } + + //绀轰緥鏂瑰紡锛屾柟渚垮垹闄わ紝姝e父瀵煎嚭鏃犻渶鎵嬪啓涓嬮潰浠g爜 + void BindMap(LuaState L) + { + L.BeginModule(null); + TestAccountWrap.Register(L); + L.BeginModule("System"); + L.BeginModule("Collections"); + L.BeginModule("Generic"); + System_Collections_Generic_Dictionary_int_TestAccountWrap.Register(L); + System_Collections_Generic_KeyValuePair_int_TestAccountWrap.Register(L); + L.BeginModule("Dictionary"); + System_Collections_Generic_Dictionary_int_TestAccount_KeyCollectionWrap.Register(L); + System_Collections_Generic_Dictionary_int_TestAccount_ValueCollectionWrap.Register(L); + L.EndModule(); + L.EndModule(); + L.EndModule(); + L.EndModule(); + L.EndModule(); + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/09_Dictionary/UseDictionary.cs.meta b/Assets/LuaFramework/ToLua/Examples/09_Dictionary/UseDictionary.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..0d0dece99046c89e420bf1e96025cd6d3eb92beb --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/09_Dictionary/UseDictionary.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 23454681bd34d36498eafe3bb988240d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/09_Dictionary/UseDictionary.unity b/Assets/LuaFramework/ToLua/Examples/09_Dictionary/UseDictionary.unity new file mode 100644 index 0000000000000000000000000000000000000000..b3e5f5e6d3e1e56202e89b161da85ea8837ad54b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/09_Dictionary/UseDictionary.unity @@ -0,0 +1,212 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_GIWorkflowMode: 1 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 1 + m_BakeResolution: 50 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_LightmapSnapshot: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: .166666657 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &1658410926 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1658410932} + - 20: {fileID: 1658410931} + - 92: {fileID: 1658410930} + - 124: {fileID: 1658410929} + - 81: {fileID: 1658410928} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1658410928 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1658410926} + m_Enabled: 1 +--- !u!124 &1658410929 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1658410926} + m_Enabled: 1 +--- !u!92 &1658410930 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1658410926} + m_Enabled: 1 +--- !u!20 &1658410931 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1658410926} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!4 &1658410932 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1658410926} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!1 &1735204460 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1735204462} + - 114: {fileID: 1735204461} + m_Layer: 0 + m_Name: Dict + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1735204461 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1735204460} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 23454681bd34d36498eafe3bb988240d, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &1735204462 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1735204460} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 diff --git a/Assets/LuaFramework/ToLua/Examples/09_Dictionary/UseDictionary.unity.meta b/Assets/LuaFramework/ToLua/Examples/09_Dictionary/UseDictionary.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..237d92ac53d5f9176bde74b3c3ba73758fcb7408 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/09_Dictionary/UseDictionary.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 5dc40f31458a9544aa74bcdad6d15d06 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/10_Enum.meta b/Assets/LuaFramework/ToLua/Examples/10_Enum.meta new file mode 100644 index 0000000000000000000000000000000000000000..534189a9738ba142398bf7acc86f1453a8703a14 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/10_Enum.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: fbe9c6c5abd052b488c851260cc2cb92 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/10_Enum/AccessingEnum.cs b/Assets/LuaFramework/ToLua/Examples/10_Enum/AccessingEnum.cs new file mode 100644 index 0000000000000000000000000000000000000000..8393a674ef5681dc016069714e82c3e6d25ae6af --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/10_Enum/AccessingEnum.cs @@ -0,0 +1,104 @@ +锘縰sing UnityEngine; +using System; +using LuaInterface; + +public class AccessingEnum : MonoBehaviour +{ + string script = + @" + space = nil + + function TestEnum(e) + print('Enum is:'..tostring(e)) + + if space:ToInt() == 0 then + print('enum ToInt() is ok') + end + + if not space:Equals(0) then + print('enum compare int is ok') + end + + if space == e then + print('enum compare enum is ok') + end + + local s = UnityEngine.Space.IntToEnum(0) + + if space == s then + print('IntToEnum change type is ok') + end + end + + function ChangeLightType(light, type) + print('change light type to '..tostring(type)) + light.type = type + end + "; + + LuaState state = null; + + void Start () + { +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived += ShowTips; +#else + Application.RegisterLogCallback(ShowTips); +#endif + new LuaResLoader(); + state = new LuaState(); + state.Start(); + LuaBinder.Bind(state); + + state.DoString(script); + state["space"] = Space.World; + + LuaFunction func = state.GetFunction("TestEnum"); + func.BeginPCall(); + func.Push(Space.World); + func.PCall(); + func.EndPCall(); + func.Dispose(); + func = null; + } + void OnApplicationQuit() + { + state.CheckTop(); + state.Dispose(); + state = null; + +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived -= ShowTips; +#else + Application.RegisterLogCallback(null); +#endif + } + + string tips = ""; + int count = 1; + + void ShowTips(string msg, string stackTrace, LogType type) + { + tips += msg; + tips += "\r\n"; + } + + void OnGUI() + { + GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 200, 600, 400), tips); + + if (GUI.Button(new Rect(0, 60, 120, 50), "ChangeType")) + { + GameObject go = GameObject.Find("/Light"); + Light light = go.GetComponent(); + LuaFunction func = state.GetFunction("ChangeLightType"); + func.BeginPCall(); + func.Push(light); + LightType type = (LightType)(count++ % 4); + func.Push(type); + func.PCall(); + func.EndPCall(); + func.Dispose(); + } + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/10_Enum/AccessingEnum.cs.meta b/Assets/LuaFramework/ToLua/Examples/10_Enum/AccessingEnum.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..ec2b07aef88dfab3e9f375ba41c91e9e92fa842a --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/10_Enum/AccessingEnum.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: acd101a7d0a84e64198674b06dba633d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/10_Enum/AccessingEnum.unity b/Assets/LuaFramework/ToLua/Examples/10_Enum/AccessingEnum.unity new file mode 100644 index 0000000000000000000000000000000000000000..a2c06a3fd907bca4e7cfc66d8b98a08c46c0274e --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/10_Enum/AccessingEnum.unity @@ -0,0 +1,345 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_GIWorkflowMode: 1 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 1 + m_BakeResolution: 50 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_LightmapSnapshot: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: .166666657 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &799176951 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 799176956} + - 20: {fileID: 799176955} + - 92: {fileID: 799176954} + - 124: {fileID: 799176953} + - 81: {fileID: 799176952} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &799176952 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 799176951} + m_Enabled: 1 +--- !u!124 &799176953 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 799176951} + m_Enabled: 1 +--- !u!92 &799176954 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 799176951} + m_Enabled: 1 +--- !u!20 &799176955 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 799176951} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!4 &799176956 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 799176951} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!1 &1461542856 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1461542858} + - 114: {fileID: 1461542857} + m_Layer: 0 + m_Name: TestEnum + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1461542857 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1461542856} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: acd101a7d0a84e64198674b06dba633d, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &1461542858 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1461542856} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 +--- !u!1 &2074809646 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 2074809648} + - 108: {fileID: 2074809647} + m_Layer: 0 + m_Name: Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &2074809647 +Light: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2074809646} + m_Enabled: 1 + serializedVersion: 6 + m_Type: 3 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Intensity: 4 + m_Range: 10 + m_SpotAngle: 80 + m_CookieSize: 10 + m_Shadows: + m_Type: 0 + m_Resolution: -1 + m_Strength: 1 + m_Bias: .0500000007 + m_NormalBias: .400000006 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 1 + m_BounceIntensity: 1 + m_ShadowRadius: 0 + m_ShadowAngle: 0 + m_AreaSize: {x: 1, y: 1} +--- !u!4 &2074809648 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2074809646} + m_LocalRotation: {x: .157639742, y: .121460624, z: .601967573, w: .773325384} + m_LocalPosition: {x: -3.0999999, y: -.00999999978, z: -2.5999999} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 +--- !u!1 &2082787424 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 2082787428} + - 33: {fileID: 2082787427} + - 65: {fileID: 2082787426} + - 23: {fileID: 2082787425} + m_Layer: 0 + m_Name: Cube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &2082787425 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2082787424} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_Materials: + - {fileID: 10302, guid: 0000000000000000f000000000000000, type: 0} + m_SubsetIndices: + m_StaticBatchRoot: {fileID: 0} + m_UseLightProbes: 0 + m_ReflectionProbeUsage: 1 + m_ProbeAnchor: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_ImportantGI: 0 + m_AutoUVMaxDistance: .5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingOrder: 0 +--- !u!65 &2082787426 +BoxCollider: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2082787424} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!33 &2082787427 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2082787424} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &2082787428 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2082787424} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 3 diff --git a/Assets/LuaFramework/ToLua/Examples/10_Enum/AccessingEnum.unity.meta b/Assets/LuaFramework/ToLua/Examples/10_Enum/AccessingEnum.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..60706bc6914ba9e709206a953bfa10a43bb18a29 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/10_Enum/AccessingEnum.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: a217aecbea099fd4cbb21c9795f57884 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/11_Delegate.meta b/Assets/LuaFramework/ToLua/Examples/11_Delegate.meta new file mode 100644 index 0000000000000000000000000000000000000000..4c2514dcb55e98c2ca053f0bc091cef55268474e --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/11_Delegate.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: bafe37b805a5b274aaee648a0b64bcb2 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/11_Delegate/TestDelegate.cs b/Assets/LuaFramework/ToLua/Examples/11_Delegate/TestDelegate.cs new file mode 100644 index 0000000000000000000000000000000000000000..f7f457055ae9de084a474800ad63fbd70c44d1ac --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/11_Delegate/TestDelegate.cs @@ -0,0 +1,344 @@ +锘縰sing UnityEngine; +using System; +using System.Collections.Generic; +using LuaInterface; + + +public class TestDelegate: MonoBehaviour +{ + private string script = + @" + function DoClick1(go) + print('click1 gameObject is '..go.name) + end + + function DoClick2(go) + print('click2 gameObject is '..go.name) + end + + function AddClick1(listener) + if listener.onClick then + listener.onClick = listener.onClick + DoClick1 + else + listener.onClick = DoClick1 + end + end + + function AddClick2(listener) + if listener.onClick then + listener.onClick = listener.onClick + DoClick2 + else + listener.onClick = DoClick2 + end + end + + function SetClick1(listener) + if listener.onClick then + listener.onClick:Destroy() + end + + listener.onClick = DoClick1 + end + + function RemoveClick1(listener) + if listener.onClick then + listener.onClick = listener.onClick - DoClick1 + else + print('empty delegate') + end + end + + function RemoveClick2(listener) + if listener.onClick then + listener.onClick = listener.onClick - DoClick2 + else + print('empty delegate') + end + end + + --娴嬭瘯閲嶈浇闂 + function TestOverride(listener) + listener:SetOnFinished(TestEventListener.OnClick(DoClick1)) + listener:SetOnFinished(TestEventListener.VoidDelegate(DoClick2)) + end + + function TestEvent() + print('this is a event') + end + + function AddEvent(listener) + listener.onClickEvent = listener.onClickEvent + TestEvent + end + + function RemoveEvent(listener) + listener.onClickEvent = listener.onClickEvent - TestEvent + end + + local t = {name = 'byself'} + + function t:TestSelffunc() + print('callback with self: '..self.name) + end + + function AddSelfClick(listener) + if listener.onClick then + listener.onClick = listener.onClick + TestEventListener.OnClick(t.TestSelffunc, t) + else + listener.onClick = TestEventListener.OnClick(t.TestSelffunc, t) + end + end + + function RemoveSelfClick(listener) + if listener.onClick then + listener.onClick = listener.onClick - TestEventListener.OnClick(t.TestSelffunc, t) + else + print('empty delegate') + end + end + "; + + LuaState state = null; + TestEventListener listener = null; + + LuaFunction SetClick1 = null; + LuaFunction AddClick1 = null; + LuaFunction AddClick2 = null; + LuaFunction RemoveClick1 = null; + LuaFunction RemoveClick2 = null; + LuaFunction TestOverride = null; + LuaFunction RemoveEvent = null; + LuaFunction AddEvent = null; + LuaFunction AddSelfClick = null; + LuaFunction RemoveSelfClick = null; + + //闇瑕佸垹闄ょ殑杞琇uaFunction涓哄鎵橈紝涓嶉渶瑕佸垹闄ょ殑鐩存帴鍔犳垨鑰呯瓑浜庡嵆鍙 + void Awake() + { +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived += ShowTips; +#else + Application.RegisterLogCallback(ShowTips); +#endif + new LuaResLoader(); + state = new LuaState(); + state.Start(); + LuaBinder.Bind(state); + Bind(state); + + state.LogGC = true; + state.DoString(script); + GameObject go = new GameObject("TestGo"); + listener = (TestEventListener)go.AddComponent(typeof(TestEventListener)); + + SetClick1 = state.GetFunction("SetClick1"); + AddClick1 = state.GetFunction("AddClick1"); + AddClick2 = state.GetFunction("AddClick2"); + RemoveClick1 = state.GetFunction("RemoveClick1"); + RemoveClick2 = state.GetFunction("RemoveClick2"); + TestOverride = state.GetFunction("TestOverride"); + AddEvent = state.GetFunction("AddEvent"); + RemoveEvent = state.GetFunction("RemoveEvent"); + + AddSelfClick = state.GetFunction("AddSelfClick"); + RemoveSelfClick = state.GetFunction("RemoveSelfClick"); + } + + void Bind(LuaState L) + { + L.BeginModule(null); + TestEventListenerWrap.Register(state); + L.EndModule(); + + DelegateFactory.dict.Add(typeof(TestEventListener.OnClick), TestEventListener_OnClick); + DelegateFactory.dict.Add(typeof(TestEventListener.VoidDelegate), TestEventListener_VoidDelegate); + + DelegateTraits.Init(TestEventListener_OnClick); + DelegateTraits.Init(TestEventListener_VoidDelegate); + } + + void CallLuaFunction(LuaFunction func) + { + tips = ""; + func.BeginPCall(); + func.Push(listener); + func.PCall(); + func.EndPCall(); + } + + //鑷姩鐢熸垚浠g爜鍚庢嫹璐濊繃鏉 + class TestEventListener_OnClick_Event : LuaDelegate + { + public TestEventListener_OnClick_Event(LuaFunction func) : base(func) { } + + public void Call(UnityEngine.GameObject param0) + { + func.BeginPCall(); + func.Push(param0); + func.PCall(); + func.EndPCall(); + } + } + + public static TestEventListener.OnClick TestEventListener_OnClick(LuaFunction func, LuaTable self, bool flag) + { + if (func == null) + { + TestEventListener.OnClick fn = delegate { }; + return fn; + } + + TestEventListener_OnClick_Event target = new TestEventListener_OnClick_Event(func); + TestEventListener.OnClick d = target.Call; + target.method = d.Method; + return d; + } + + class TestEventListener_VoidDelegate_Event : LuaDelegate + { + public TestEventListener_VoidDelegate_Event(LuaFunction func) : base(func) { } + + public void Call(UnityEngine.GameObject param0) + { + func.BeginPCall(); + func.Push(param0); + func.PCall(); + func.EndPCall(); + } + } + + public static TestEventListener.VoidDelegate TestEventListener_VoidDelegate(LuaFunction func, LuaTable self, bool flag) + { + if (func == null) + { + TestEventListener.VoidDelegate fn = delegate { }; + return fn; + } + + TestEventListener_VoidDelegate_Event target = new TestEventListener_VoidDelegate_Event(func); + TestEventListener.VoidDelegate d = target.Call; + target.method = d.Method; + return d; + } + + void OnGUI() + { + GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 200, 600, 400), tips); + + if (GUI.Button(new Rect(10, 10, 120, 40), " = OnClick1")) + { + CallLuaFunction(SetClick1); + } + else if (GUI.Button(new Rect(10, 60, 120, 40), " + Click1")) + { + CallLuaFunction(AddClick1); + } + else if (GUI.Button(new Rect(10, 110, 120, 40), " + Click2")) + { + CallLuaFunction(AddClick2); + } + else if (GUI.Button(new Rect(10, 160, 120, 40), " - Click1")) + { + CallLuaFunction(RemoveClick1); + } + else if (GUI.Button(new Rect(10, 210, 120, 40), " - Click2")) + { + CallLuaFunction(RemoveClick2); + } + else if (GUI.Button(new Rect(10, 260, 120, 40), "+ Click1 in C#")) + { + tips = ""; + LuaFunction func = state.GetFunction("DoClick1"); + TestEventListener.OnClick onClick = (TestEventListener.OnClick)DelegateTraits.Create(func); + listener.onClick += onClick; + } + else if (GUI.Button(new Rect(10, 310, 120, 40), " - Click1 in C#")) + { + tips = ""; + LuaFunction func = state.GetFunction("DoClick1"); + listener.onClick = (TestEventListener.OnClick)DelegateFactory.RemoveDelegate(listener.onClick, func); + func.Dispose(); + func = null; + } + else if (GUI.Button(new Rect(10, 360, 120, 40), "OnClick")) + { + if (listener.onClick != null) + { + listener.onClick(gameObject); + } + else + { + Debug.Log("empty delegate!!"); + } + } + else if (GUI.Button(new Rect(10, 410, 120, 40), "Override")) + { + CallLuaFunction(TestOverride); + } + else if (GUI.Button(new Rect(10, 460, 120, 40), "Force GC")) + { + //鑷姩gc log: collect lua reference name , id xxx in thread + state.LuaGC(LuaGCOptions.LUA_GCCOLLECT, 0); + GC.Collect(); + } + else if (GUI.Button(new Rect(10, 510, 120, 40), "event +")) + { + CallLuaFunction(AddEvent); + } + else if (GUI.Button(new Rect(10, 560, 120, 40), "event -")) + { + CallLuaFunction(RemoveEvent); + } + else if (GUI.Button(new Rect(10, 610, 120, 40), "event call")) + { + listener.OnClickEvent(gameObject); + } + else if (GUI.Button(new Rect(200, 10, 120, 40), "+self call")) + { + CallLuaFunction(AddSelfClick); + } + else if (GUI.Button(new Rect(200, 60, 120, 40), "-self call")) + { + CallLuaFunction(RemoveSelfClick); + } + } + + void Update() + { + state.Collect(); + state.CheckTop(); + } + + void SafeRelease(ref LuaFunction luaRef) + { + if (luaRef != null) + { + luaRef.Dispose(); + luaRef = null; + } + } + + string tips = ""; + + void ShowTips(string msg, string stackTrace, LogType type) + { + tips += msg; + tips += "\r\n"; + } + + void OnApplicationQuit() + { + SafeRelease(ref AddClick1); + SafeRelease(ref AddClick2); + SafeRelease(ref RemoveClick1); + SafeRelease(ref RemoveClick2); + SafeRelease(ref SetClick1); + SafeRelease(ref TestOverride); + state.Dispose(); + state = null; +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived -= ShowTips; +#else + Application.RegisterLogCallback(null); +#endif + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/11_Delegate/TestDelegate.cs.meta b/Assets/LuaFramework/ToLua/Examples/11_Delegate/TestDelegate.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..90064fe6debbb4da662f19f07f64110e7579e99d --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/11_Delegate/TestDelegate.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: aebc047d4185a4942b0220c97c91154e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/11_Delegate/TestEventListener.cs b/Assets/LuaFramework/ToLua/Examples/11_Delegate/TestEventListener.cs new file mode 100644 index 0000000000000000000000000000000000000000..040081f79c588d3b496b7fe55765adb138c1364b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/11_Delegate/TestEventListener.cs @@ -0,0 +1,31 @@ +锘縰sing UnityEngine; +using System; +using System.Collections; +using LuaInterface; + +public sealed class TestEventListener : MonoBehaviour +{ + public delegate void VoidDelegate(GameObject go); + public delegate void OnClick(GameObject go); + public OnClick onClick = delegate { }; + + public event OnClick onClickEvent = delegate { }; + + public Func TestFunc = null; + + public void SetOnFinished(OnClick click) + { + Debugger.Log("SetOnFinished OnClick"); + } + + public void SetOnFinished(VoidDelegate click) + { + Debugger.Log("SetOnFinished VoidDelegate"); + } + + [NoToLuaAttribute] + public void OnClickEvent(GameObject go) + { + onClickEvent(go); + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/11_Delegate/TestEventListener.cs.meta b/Assets/LuaFramework/ToLua/Examples/11_Delegate/TestEventListener.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..f09c20f16b0b3498a3f85bf73eba0f8ac22c9b2f --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/11_Delegate/TestEventListener.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b909bbc52f2fc814ab97a3b1038ec9ee +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/11_Delegate/TestEventListenerWrap.cs b/Assets/LuaFramework/ToLua/Examples/11_Delegate/TestEventListenerWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..38e6f6ba736fc2bd6be76332b66eda37ed2a569d --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/11_Delegate/TestEventListenerWrap.cs @@ -0,0 +1,244 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class TestEventListenerWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(TestEventListener), typeof(UnityEngine.MonoBehaviour)); + L.RegFunction("SetOnFinished", SetOnFinished); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("onClick", get_onClick, set_onClick); + L.RegVar("TestFunc", get_TestFunc, set_TestFunc); + L.RegVar("onClickEvent", get_onClickEvent, set_onClickEvent); + L.RegFunction("OnClick", TestEventListener_OnClick); + L.RegFunction("VoidDelegate", TestEventListener_VoidDelegate); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetOnFinished(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + TestEventListener obj = (TestEventListener)ToLua.CheckObject(L, 1, typeof(TestEventListener)); + TestEventListener.VoidDelegate arg0 = (TestEventListener.VoidDelegate)ToLua.ToObject(L, 2); + obj.SetOnFinished(arg0); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + TestEventListener obj = (TestEventListener)ToLua.CheckObject(L, 1, typeof(TestEventListener)); + TestEventListener.OnClick arg0 = (TestEventListener.OnClick)ToLua.ToObject(L, 2); + obj.SetOnFinished(arg0); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: TestEventListener.SetOnFinished"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_onClick(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + TestEventListener obj = (TestEventListener)o; + TestEventListener.OnClick ret = obj.onClick; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index onClick on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_TestFunc(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + TestEventListener obj = (TestEventListener)o; + System.Func ret = obj.TestFunc; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index TestFunc on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_onClickEvent(IntPtr L) + { + ToLua.Push(L, new EventObject(typeof(TestEventListener.OnClick))); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_onClick(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + TestEventListener obj = (TestEventListener)o; + TestEventListener.OnClick arg0 = (TestEventListener.OnClick)ToLua.CheckDelegate(L, 2); + obj.onClick = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index onClick on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_TestFunc(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + TestEventListener obj = (TestEventListener)o; + System.Func arg0 = (System.Func)ToLua.CheckDelegate>(L, 2); + obj.TestFunc = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index TestFunc on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_onClickEvent(IntPtr L) + { + try + { + TestEventListener obj = (TestEventListener)ToLua.CheckObject(L, 1, typeof(TestEventListener)); + EventObject arg0 = null; + + if (LuaDLL.lua_isuserdata(L, 2) != 0) + { + arg0 = (EventObject)ToLua.ToObject(L, 2); + } + else + { + return LuaDLL.luaL_throw(L, "The event 'TestEventListener.onClickEvent' can only appear on the left hand side of += or -= when used outside of the type 'TestEventListener'"); + } + + if (arg0.op == EventOp.Add) + { + TestEventListener.OnClick ev = (TestEventListener.OnClick)arg0.func; + obj.onClickEvent += ev; + } + else if (arg0.op == EventOp.Sub) + { + TestEventListener.OnClick ev = (TestEventListener.OnClick)arg0.func; + obj.onClickEvent -= ev; + } + + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TestEventListener_OnClick(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + LuaFunction func = ToLua.CheckLuaFunction(L, 1); + + if (count == 1) + { + Delegate arg1 = DelegateTraits.Create(func); + ToLua.Push(L, arg1); + } + else + { + LuaTable self = ToLua.CheckLuaTable(L, 2); + Delegate arg1 = DelegateTraits.Create(func, self); + ToLua.Push(L, arg1); + } + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TestEventListener_VoidDelegate(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + LuaFunction func = ToLua.CheckLuaFunction(L, 1); + + if (count == 1) + { + Delegate arg1 = DelegateTraits.Create(func); + ToLua.Push(L, arg1); + } + else + { + LuaTable self = ToLua.CheckLuaTable(L, 2); + Delegate arg1 = DelegateTraits.Create(func, self); + ToLua.Push(L, arg1); + } + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Examples/11_Delegate/TestEventListenerWrap.cs.meta b/Assets/LuaFramework/ToLua/Examples/11_Delegate/TestEventListenerWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..06e757dc1df4365d1c706597af67a6f3df7fdfbe --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/11_Delegate/TestEventListenerWrap.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1e84ecc8101f77e45bab712de82fed53 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/11_Delegate/UseDelegate.unity b/Assets/LuaFramework/ToLua/Examples/11_Delegate/UseDelegate.unity new file mode 100644 index 0000000000000000000000000000000000000000..329805dc1a36cd0bf623f6a425a31c0dd283810e --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/11_Delegate/UseDelegate.unity @@ -0,0 +1,212 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_GIWorkflowMode: 1 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 1 + m_BakeResolution: 50 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_LightmapSnapshot: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: .166666657 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &20154436 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 20154438} + - 114: {fileID: 20154437} + m_Layer: 0 + m_Name: TestDelegate + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &20154437 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 20154436} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: aebc047d4185a4942b0220c97c91154e, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &20154438 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 20154436} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 3.2560544, y: -.257246256, z: -3.07598209} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!1 &1980599004 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1980599009} + - 20: {fileID: 1980599008} + - 92: {fileID: 1980599007} + - 124: {fileID: 1980599006} + - 81: {fileID: 1980599005} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1980599005 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1980599004} + m_Enabled: 1 +--- !u!124 &1980599006 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1980599004} + m_Enabled: 1 +--- !u!92 &1980599007 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1980599004} + m_Enabled: 1 +--- !u!20 &1980599008 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1980599004} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!4 &1980599009 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1980599004} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 diff --git a/Assets/LuaFramework/ToLua/Examples/11_Delegate/UseDelegate.unity.meta b/Assets/LuaFramework/ToLua/Examples/11_Delegate/UseDelegate.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..9d4259689538d999f176fe6fba40eca15d8ab1a0 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/11_Delegate/UseDelegate.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 0c371c24024790e4fafc6efd6656ffa8 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/12_GameObject.meta b/Assets/LuaFramework/ToLua/Examples/12_GameObject.meta new file mode 100644 index 0000000000000000000000000000000000000000..558185d0b7b42150786bd9c0eaaf3ea57d57d84b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/12_GameObject.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: c05e0dc08239c724bba79944e7ccbcaa +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/12_GameObject/TestGameObject.cs b/Assets/LuaFramework/ToLua/Examples/12_GameObject/TestGameObject.cs new file mode 100644 index 0000000000000000000000000000000000000000..c127bdfb841bacd1d40b27c70b70e589530000f8 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/12_GameObject/TestGameObject.cs @@ -0,0 +1,75 @@ +锘縰sing UnityEngine; +using System.Collections; +using LuaInterface; + +public class TestGameObject: MonoBehaviour +{ + private string script = + @" + local Color = UnityEngine.Color + local GameObject = UnityEngine.GameObject + local ParticleSystem = UnityEngine.ParticleSystem + + function OnComplete() + print('OnComplete CallBack') + end + + local go = GameObject('go') + go:AddComponent(typeof(ParticleSystem)) + local node = go.transform + node.position = Vector3.one + print('gameObject is: '..tostring(go)) + --go.transform:DOPath({Vector3.zero, Vector3.one * 10}, 1, DG.Tweening.PathType.Linear, DG.Tweening.PathMode.Full3D, 10, nil) + --go.transform:DORotate(Vector3(0,0,360), 2, DG.Tweening.RotateMode.FastBeyond360):OnComplete(OnComplete) + GameObject.Destroy(go, 2) + go.name = '123' + --print('delay destroy gameobject is: '..go.name) + "; + + LuaState lua = null; + + void Start() + { +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived += ShowTips; +#else + Application.RegisterLogCallback(ShowTips); +#endif + new LuaResLoader(); + lua = new LuaState(); + lua.LogGC = true; + lua.Start(); + LuaBinder.Bind(lua); + lua.DoString(script, "TestGameObject.cs"); + } + + void Update() + { + lua.CheckTop(); + lua.Collect(); + } + + string tips = ""; + + void ShowTips(string msg, string stackTrace, LogType type) + { + tips += msg; + tips += "\r\n"; + } + + void OnApplicationQuit() + { + lua.Dispose(); + lua = null; +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived -= ShowTips; +#else + Application.RegisterLogCallback(null); +#endif + } + + void OnGUI() + { + GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 300, 600, 600), tips); + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/12_GameObject/TestGameObject.cs.meta b/Assets/LuaFramework/ToLua/Examples/12_GameObject/TestGameObject.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..4eb3042aacd6f078831e602cd41c709098066c57 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/12_GameObject/TestGameObject.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4a206b7d4dbb78541b0e1be49fa5d338 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/12_GameObject/TestGameObject.unity b/Assets/LuaFramework/ToLua/Examples/12_GameObject/TestGameObject.unity new file mode 100644 index 0000000000000000000000000000000000000000..94c3d9562733e89896c26f24275d5ba09bc445c8 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/12_GameObject/TestGameObject.unity @@ -0,0 +1,212 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_GIWorkflowMode: 1 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 1 + m_BakeResolution: 50 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_LightmapSnapshot: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: .166666657 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &1274897230 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1274897232} + - 114: {fileID: 1274897231} + m_Layer: 0 + m_Name: Test + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1274897231 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1274897230} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4a206b7d4dbb78541b0e1be49fa5d338, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &1274897232 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1274897230} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 +--- !u!1 &1979868300 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1979868305} + - 20: {fileID: 1979868304} + - 92: {fileID: 1979868303} + - 124: {fileID: 1979868302} + - 81: {fileID: 1979868301} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1979868301 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1979868300} + m_Enabled: 1 +--- !u!124 &1979868302 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1979868300} + m_Enabled: 1 +--- !u!92 &1979868303 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1979868300} + m_Enabled: 1 +--- !u!20 &1979868304 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1979868300} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!4 &1979868305 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1979868300} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 1, y: 1, z: 1} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 diff --git a/Assets/LuaFramework/ToLua/Examples/12_GameObject/TestGameObject.unity.meta b/Assets/LuaFramework/ToLua/Examples/12_GameObject/TestGameObject.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..6f829f5ce26612325f8bdac3c24e49bb060861fa --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/12_GameObject/TestGameObject.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: bd44e2bbf67026a4eb7a12cc132f5515 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/13_CustomLoader.meta b/Assets/LuaFramework/ToLua/Examples/13_CustomLoader.meta new file mode 100644 index 0000000000000000000000000000000000000000..405a0545c31569ceed1e1a31e87e22affd35a1c3 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/13_CustomLoader.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 9fc9a6d7d2170ce43bfdcb7197628a9d +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/13_CustomLoader/CustomLoader.unity b/Assets/LuaFramework/ToLua/Examples/13_CustomLoader/CustomLoader.unity new file mode 100644 index 0000000000000000000000000000000000000000..eb856525955d71b7bc38f62f60663d3e4340c6e4 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/13_CustomLoader/CustomLoader.unity @@ -0,0 +1,212 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_GIWorkflowMode: 1 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 1 + m_BakeResolution: 50 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_LightmapSnapshot: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: .166666657 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &189906012 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 189906014} + - 114: {fileID: 189906013} + m_Layer: 0 + m_Name: GameObject + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &189906013 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 189906012} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bc2267b374446b24faf55d67673d8e63, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &189906014 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 189906012} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 +--- !u!1 &840543572 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 840543577} + - 20: {fileID: 840543576} + - 92: {fileID: 840543575} + - 124: {fileID: 840543574} + - 81: {fileID: 840543573} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &840543573 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 840543572} + m_Enabled: 1 +--- !u!124 &840543574 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 840543572} + m_Enabled: 1 +--- !u!92 &840543575 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 840543572} + m_Enabled: 1 +--- !u!20 &840543576 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 840543572} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!4 &840543577 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 840543572} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 diff --git a/Assets/LuaFramework/ToLua/Examples/13_CustomLoader/CustomLoader.unity.meta b/Assets/LuaFramework/ToLua/Examples/13_CustomLoader/CustomLoader.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..40cfa84979addd161bd03bf5b3ee5d1dc1903154 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/13_CustomLoader/CustomLoader.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 64a15f71c3e8ada48bbf2dec47d8eb0d +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/13_CustomLoader/TestCustomLoader.cs b/Assets/LuaFramework/ToLua/Examples/13_CustomLoader/TestCustomLoader.cs new file mode 100644 index 0000000000000000000000000000000000000000..a76fb210e5128af3815b031347bee3bc61076956 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/13_CustomLoader/TestCustomLoader.cs @@ -0,0 +1,59 @@ +锘縰sing UnityEngine; +using System.IO; +using LuaInterface; + +//use menu Lua->Copy lua files to Resources. 涔嬪悗鎵嶈兘鍙戝竷鍒版墜鏈 +public class TestCustomLoader : LuaClient +{ + string tips = "Test custom loader"; + + protected override LuaFileUtils InitLoader() + { + return new LuaResLoader(); + } + + protected override void CallMain() + { + LuaFunction func = luaState.GetFunction("Test"); + func.Call(); + func.Dispose(); + } + + protected override void StartMain() + { + luaState.DoFile("TestLoader.lua"); + CallMain(); + } + + new void Awake() + { +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived += Logger; +#else + Application.RegisterLogCallback(Logger); +#endif + base.Awake(); + } + + new void OnApplicationQuit() + { + base.OnApplicationQuit(); + +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived -= Logger; +#else + Application.RegisterLogCallback(null); +#endif + } + + void Logger(string msg, string stackTrace, LogType type) + { + tips += msg; + tips += "\r\n"; + } + + void OnGUI() + { + GUI.Label(new Rect(Screen.width / 2 - 200, Screen.height / 2 - 200, 400, 400), tips); + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/13_CustomLoader/TestCustomLoader.cs.meta b/Assets/LuaFramework/ToLua/Examples/13_CustomLoader/TestCustomLoader.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..d4f8ab986f409048e4e44f4b78e792a0530a8cf3 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/13_CustomLoader/TestCustomLoader.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bc2267b374446b24faf55d67673d8e63 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/14_Out.meta b/Assets/LuaFramework/ToLua/Examples/14_Out.meta new file mode 100644 index 0000000000000000000000000000000000000000..a1697b184efe3048730674f8ec5f4d4a296e7197 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/14_Out.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: b9762f66a6f78d843b27a77925f63e3f +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/14_Out/TestOut.unity b/Assets/LuaFramework/ToLua/Examples/14_Out/TestOut.unity new file mode 100644 index 0000000000000000000000000000000000000000..01b1469c8e61a708ef6ca01e458fda9ea267392f --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/14_Out/TestOut.unity @@ -0,0 +1,285 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_GIWorkflowMode: 1 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 1 + m_BakeResolution: 50 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_LightmapSnapshot: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: .166666657 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &636591175 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 636591177} + - 114: {fileID: 636591176} + m_Layer: 0 + m_Name: TestOutArg + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &636591176 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 636591175} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: cb859a8f0bf518243b6fc7c57eeef886, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &636591177 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 636591175} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 +--- !u!1 &689647142 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 689647148} + - 20: {fileID: 689647147} + - 92: {fileID: 689647146} + - 124: {fileID: 689647145} + - 81: {fileID: 689647144} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &689647144 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 689647142} + m_Enabled: 1 +--- !u!124 &689647145 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 689647142} + m_Enabled: 1 +--- !u!92 &689647146 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 689647142} + m_Enabled: 1 +--- !u!20 &689647147 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 689647142} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!4 &689647148 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 689647142} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!1 &1716556095 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1716556099} + - 33: {fileID: 1716556098} + - 65: {fileID: 1716556097} + - 23: {fileID: 1716556096} + m_Layer: 0 + m_Name: Cube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &1716556096 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1716556095} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_Materials: + - {fileID: 10302, guid: 0000000000000000f000000000000000, type: 0} + m_SubsetIndices: + m_StaticBatchRoot: {fileID: 0} + m_UseLightProbes: 0 + m_ReflectionProbeUsage: 1 + m_ProbeAnchor: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_ImportantGI: 0 + m_AutoUVMaxDistance: .5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingOrder: 0 +--- !u!65 &1716556097 +BoxCollider: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1716556095} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!33 &1716556098 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1716556095} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1716556099 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1716556095} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 2, y: 2, z: 2} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 diff --git a/Assets/LuaFramework/ToLua/Examples/14_Out/TestOut.unity.meta b/Assets/LuaFramework/ToLua/Examples/14_Out/TestOut.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..6add7b5a65a34b63f5859c5f527eca633b0b91eb --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/14_Out/TestOut.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: c1cff06827ae69d45ba691b5714e066d +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/14_Out/TestOutArg.cs b/Assets/LuaFramework/ToLua/Examples/14_Out/TestOutArg.cs new file mode 100644 index 0000000000000000000000000000000000000000..5ad7cb4b5e1ac36c4e80ca57d8216cef72cf8edc --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/14_Out/TestOutArg.cs @@ -0,0 +1,95 @@ +锘縰sing UnityEngine; +using System.Collections; +using LuaInterface; +using System; + +public class TestOutArg : MonoBehaviour +{ + string script = + @" + local box = UnityEngine.BoxCollider + + function TestPick(ray) + local _layer = 2 ^ LayerMask.NameToLayer('Default') + local time = os.clock() + local flag, hit = UnityEngine.Physics.Raycast(ray, nil, 5000, _layer) + --local flag, hit = UnityEngine.Physics.Raycast(ray, RaycastHit.out, 5000, _layer) + + if flag then + print('pick from lua, point: '..tostring(hit.point)) + end + end + "; + + LuaState state = null; + LuaFunction func = null; + string tips = string.Empty; + + void Start () + { +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived += ShowTips; +#else + Application.RegisterLogCallback(ShowTips); +#endif + new LuaResLoader(); + state = new LuaState(); + LuaBinder.Bind(state); + state.Start(); + state.DoString(script, "TestOutArg.cs"); + func = state.GetFunction("TestPick"); + } + + void ShowTips(string msg, string stackTrace, LogType type) + { + tips += msg; + tips += "\r\n"; + } + + void OnApplicationQuit() + { +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived -= ShowTips; +#else + Application.RegisterLogCallback(null); +#endif + } + + private void OnGUI() + { + GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 300, 600, 600), tips); + } + + void Update() + { + if (Input.GetMouseButtonDown(0)) + { + Camera camera = Camera.main; + Ray ray = camera.ScreenPointToRay(Input.mousePosition); + RaycastHit hit; + bool flag = Physics.Raycast(ray, out hit, 5000, 1 << LayerMask.NameToLayer("Default")); + + if (flag) + { + Debugger.Log("pick from c#, point: [{0}, {1}, {2}]", hit.point.x, hit.point.y, hit.point.z); + } + + func.BeginPCall(); + func.Push(ray); + func.PCall(); + func.EndPCall(); + } + + state.CheckTop(); + state.Collect(); + } + + void OnDestroy() + { + func.Dispose(); + func = null; + + state.Dispose(); + state = null; + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/14_Out/TestOutArg.cs.meta b/Assets/LuaFramework/ToLua/Examples/14_Out/TestOutArg.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..b02adff44d455d815d913500d75965198257f378 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/14_Out/TestOutArg.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cb859a8f0bf518243b6fc7c57eeef886 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer.meta b/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer.meta new file mode 100644 index 0000000000000000000000000000000000000000..8d096f33bc193b0648476b90193fd94a78e9bcba --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: cac1317b8ab1d3a438e2fa736a69d7fe +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/ProtoBuffer.unity b/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/ProtoBuffer.unity new file mode 100644 index 0000000000000000000000000000000000000000..bc2420047ee5cba13330759b25334dc5746259f1 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/ProtoBuffer.unity @@ -0,0 +1,212 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_GIWorkflowMode: 1 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 1 + m_BakeResolution: 50 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_LightmapSnapshot: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: .166666657 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &1413981630 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1413981635} + - 20: {fileID: 1413981634} + - 92: {fileID: 1413981633} + - 124: {fileID: 1413981632} + - 81: {fileID: 1413981631} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1413981631 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1413981630} + m_Enabled: 1 +--- !u!124 &1413981632 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1413981630} + m_Enabled: 1 +--- !u!92 &1413981633 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1413981630} + m_Enabled: 1 +--- !u!20 &1413981634 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1413981630} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!4 &1413981635 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1413981630} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!1 &1623153660 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1623153662} + - 114: {fileID: 1623153661} + m_Layer: 0 + m_Name: TestProtoBuffer + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1623153661 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1623153660} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 07805e704145c3b47b7c511a16d66d99, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &1623153662 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1623153660} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 diff --git a/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/ProtoBuffer.unity.meta b/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/ProtoBuffer.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..1c7e6ca282ca46a3ab9b80de4935b167e25701ef --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/ProtoBuffer.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 1a4304ba0253d9241b8bf736a8607df6 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/TestProtoBuffer.cs b/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/TestProtoBuffer.cs new file mode 100644 index 0000000000000000000000000000000000000000..1c34b432cabea9d912c6b5ffe4919fa7f509908c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/TestProtoBuffer.cs @@ -0,0 +1,171 @@ +锘//#define USE_PROTOBUF_NET +using UnityEngine; +using System.Collections; +using LuaInterface; +using System; +using System.IO; + +#if USE_PROTOBUF_NET +using ProtoBuf; + +[ProtoContract] +class Header +{ + [ProtoMember(1, IsRequired = true)] + public int cmd { get; set; } + + [ProtoMember(2, IsRequired = true)] + public int seq { get; set; } +} + +[ProtoContract] +class Person +{ + [ProtoMember(1, IsRequired = true)] + public Header header { get; set; } + [ProtoMember(2, IsRequired = true)] + public long id { get; set; } + + [ProtoMember(3, IsRequired = true)] + public string name { get; set; } + + [ProtoMember(4, IsRequired = false)] + public int age { get; set; } + + [ProtoMember(5, IsRequired = false)] + public string email { get; set; } + + [ProtoMember(6, IsRequired = true)] + public int[] array; +} + +#endif + +public class TestProtoBuffer : LuaClient +{ + private string script = @" + local common_pb = require 'Protol.common_pb' + local person_pb = require 'Protol.person_pb' + + function Decoder() + local msg = person_pb.Person() + msg:ParseFromString(TestProtol.data) + --tostring 涓嶄細鎵撳嵃榛樿鍊 + print('person_pb decoder: '..tostring(msg)..'age: '..msg.age..'\nemail: '..msg.email) + end + + function Encoder() + local msg = person_pb.Person() + msg.header.cmd = 10010 + msg.header.seq = 1 + msg.id = '1223372036854775807' + msg.name = 'foo' + --鏁扮粍娣诲姞 + msg.array:append(1) + msg.array:append(2) + --extensions 娣诲姞 + local phone = msg.Extensions[person_pb.Phone.phones]:add() + phone.num = '13788888888' + phone.type = person_pb.Phone.MOBILE + local pb_data = msg:SerializeToString() + TestProtol.data = pb_data + end + "; + + private string tips = ""; + + //瀹為檯搴旂敤濡係ocket.Send(LuaStringBuffer buffer)鍑芥暟鍙戦佸崗璁, 鍦╨ua涓皟鐢⊿ocket.Send(pb_data) + //璇诲彇鍗忚 Socket.PeekMsgPacket() {return MsgPacket}; lua 涓紝鍙栧崗璁瓧鑺傛祦 MsgPack.data 涓 LuaStringBuffer绫诲瀷 + //msg = Socket.PeekMsgPacket() + //pb_data = msg.data + new void Awake() + { +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived += ShowTips; +#else + Application.RegisterLogCallback(ShowTips); +#endif + base.Awake(); + } + + protected override LuaFileUtils InitLoader() + { + return new LuaResLoader(); + } + + protected override void Bind() + { + base.Bind(); + + luaState.BeginModule(null); + TestProtolWrap.Register(luaState); + luaState.EndModule(); + } + + //灞忚斀锛屼緥瀛愪笉闇瑕佽繍琛 + protected override void CallMain() { } + + protected override void OnLoadFinished() + { + base.OnLoadFinished(); + luaState.DoString(script, "TestProtoBuffer.cs"); + +#if !USE_PROTOBUF_NET + LuaFunction func = luaState.GetFunction("Encoder"); + func.Call(); + func.Dispose(); + + func = luaState.GetFunction("Decoder"); + func.Call(); + func.Dispose(); + func = null; +#else + Person data = new Person(); + data.id = 1223372036854775807; + data.name = "foo"; + data.header = new Header(); + data.header.cmd = 10086; + data.header.seq = 1; + data.array = new int[2]; + data.array[0] = 1; + data.array[1] = 2; + MemoryStream stream = new MemoryStream(); + Serializer.Serialize(stream, data); + TestProtol.data = stream.ToArray(); + + LuaFunction func = luaState.GetFunction("Decoder"); + func.Call(); + func.Dispose(); + func = null; + + func = luaState.GetFunction("Encoder"); + func.Call(); + func.Dispose(); + func = null; + + stream = new MemoryStream(TestProtol.data); + data = Serializer.Deserialize(stream); + Debugger.Log("Decoder from lua int64 is: {0}, cmd: {1}", data.id, data.header.cmd); +#endif + } + + void ShowTips(string msg, string stackTrace, LogType type) + { + tips = tips + msg + "\r\n"; + } + + void OnGUI() + { + GUI.Label(new Rect(Screen.width / 2 - 250, Screen.height / 2 - 200, 500, 500), tips); + } + + new void OnApplicationQuit() + { + base.Destroy(); +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived -= ShowTips; +#else + Application.RegisterLogCallback(null); +#endif + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/TestProtoBuffer.cs.meta b/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/TestProtoBuffer.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..bb63190cfc4e5cdd8385597c6d3b33e8e64f7268 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/TestProtoBuffer.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 07805e704145c3b47b7c511a16d66d99 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/TestProtol.cs b/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/TestProtol.cs new file mode 100644 index 0000000000000000000000000000000000000000..a9ed54c928ebdf774a07d783985cadf0cd316375 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/TestProtol.cs @@ -0,0 +1,8 @@ +锘縰sing System; +using LuaInterface; + +public static class TestProtol +{ + [LuaByteBufferAttribute] + public static byte[] data; +} diff --git a/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/TestProtol.cs.meta b/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/TestProtol.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..3d48961566d8f4decf9b757ada500b5af0741b2f --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/TestProtol.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 486ec4f4b6496a94c85974a2e0c1bd78 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/TestProtolWrap.cs b/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/TestProtolWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..5001ad2d8f83b71ce273dba91cf57c532d24f6de --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/TestProtolWrap.cs @@ -0,0 +1,43 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class TestProtolWrap +{ + public static void Register(LuaState L) + { + L.BeginStaticLibs("TestProtol"); + L.RegVar("data", get_data, set_data); + L.EndStaticLibs(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_data(IntPtr L) + { + try + { + LuaDLL.tolua_pushlstring(L, TestProtol.data, TestProtol.data.Length); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_data(IntPtr L) + { + try + { + byte[] arg0 = ToLua.CheckByteBuffer(L, 2); + TestProtol.data = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/TestProtolWrap.cs.meta b/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/TestProtolWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..4b77558f590137703fd0b881381c2dff127cee49 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/TestProtolWrap.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 25408b0022185f34c9744c405ad5da65 +timeCreated: 1515038394 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/common.proto b/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/common.proto new file mode 100644 index 0000000000000000000000000000000000000000..00c7f29bfe7d6d8dac6fbb2df5b1dfa9541df952 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/common.proto @@ -0,0 +1,6 @@ + +message Header +{ + required int64 cmd = 1; + required int32 seq = 2; +} \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/common.proto.meta b/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/common.proto.meta new file mode 100644 index 0000000000000000000000000000000000000000..dd75751e19f82fd12675672d071a170f94b97f8d --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/common.proto.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 760d09f03acd6ed4e94516e3b7439c54 +timeCreated: 1498133645 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/person.proto b/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/person.proto new file mode 100644 index 0000000000000000000000000000000000000000..a9de1ff0e5406230a637947c52bdb67f0ab4e273 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/person.proto @@ -0,0 +1,26 @@ +import "common.proto"; + +message Person +{ + required Header header = 1; + required int64 id = 2; + required string name = 3; + optional int32 age = 4 [default = 18]; + optional string email = 5 [default = "topameng@qq.com"]; + repeated int32 array = 6; + + extensions 10 to max; +} + +message Phone +{ + extend Person { repeated Phone phones = 10;} + + enum PHONE_TYPE + { + MOBILE = 1; + HOME = 2; + } + optional string num = 1; + optional PHONE_TYPE type = 2; +} diff --git a/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/person.proto.meta b/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/person.proto.meta new file mode 100644 index 0000000000000000000000000000000000000000..4348bda8488652f1038822c557076be13cdadbfd --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/15_ProtoBuffer/person.proto.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: f84fe6c5b2078174bb56bed15abd687b +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/16_Int64.meta b/Assets/LuaFramework/ToLua/Examples/16_Int64.meta new file mode 100644 index 0000000000000000000000000000000000000000..b83e1b47f39441e6869392232ad8f09d2018e6da --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/16_Int64.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 56454d123fe4d2a47a2a1bf5e9a7399b +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/16_Int64/TestInt64.cs b/Assets/LuaFramework/ToLua/Examples/16_Int64/TestInt64.cs new file mode 100644 index 0000000000000000000000000000000000000000..e48f78970ce1131d5ce314c5c32344fdadb20018 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/16_Int64/TestInt64.cs @@ -0,0 +1,100 @@ +锘縰sing UnityEngine; +using System.Collections; +using System; +using LuaInterface; +using System.Collections.Generic; + + +public class TestInt64 : MonoBehaviour +{ + private string tips = ""; + + string script = + @" + function TestInt64(x) + x = 789 + x + assert(tostring(x) == '9223372036854775807') + local low, high = int64.tonum2(x) + print('x value is: '..tostring(x)..' low is: '.. low .. ' high is: '..high.. ' type is: '.. tolua.typename(x)) + local y = int64.new(1,2) + local z = int64.new(1,2) + + if y == z then + print('int64 equals is ok, value: '..int64.tostring(y)) + end + + x = int64.new(123) + + if int64.equals(x, 123) then + print('int64 equals to number ok') + else + print('int64 equals to number failed') + end + + x = int64.new('78962871035984074') + print('int64 is: '..tostring(x)) + + local str = tostring(int64.new(3605690779, 30459971)) + local n2 = int64.new(str) + local l, h = int64.tonum2(n2) + print(str..':'..tostring(n2)..' low:'..l..' high:'..h) + + print('----------------------------uint64-----------------------------') + x = uint64.new('18446744073709551615') + print('uint64 max is: '..tostring(x)) + l, h = uint64.tonum2(x) + str = tostring(uint64.new(l, h)) + print(str..':'..tostring(x)..' low:'..l..' high:'..h) + + return y + end + "; + + + void Start() + { +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived += ShowTips; +#else + Application.RegisterLogCallback(ShowTips); +#endif + new LuaResLoader(); + LuaState lua = new LuaState(); + lua.Start(); + lua.DoString(script, "TestInt64.cs"); + + LuaFunction func = lua.GetFunction("TestInt64"); + func.BeginPCall(); + func.Push(9223372036854775807 - 789); + func.PCall(); + long n64 = func.CheckLong(); + Debugger.Log("int64 return from lua is: {0}", n64); + func.EndPCall(); + func.Dispose(); + func = null; + + lua.CheckTop(); + lua.Dispose(); + lua = null; + } + + void ShowTips(string msg, string stackTrace, LogType type) + { + tips += msg; + tips += "\r\n"; + } + + void OnDestroy() + { +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived -= ShowTips; +#else + Application.RegisterLogCallback(null); +#endif + } + + void OnGUI() + { + GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 300, 600, 600), tips); + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/16_Int64/TestInt64.cs.meta b/Assets/LuaFramework/ToLua/Examples/16_Int64/TestInt64.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..ec1bec71cad75990cce122d1c9c837794f1b831d --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/16_Int64/TestInt64.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d2eb3e2c0caea144e8cbbb8de6ed33f8 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/16_Int64/TestInt64.unity b/Assets/LuaFramework/ToLua/Examples/16_Int64/TestInt64.unity new file mode 100644 index 0000000000000000000000000000000000000000..24346b905eb2fbde8b61c43eeb14797601c8fcc7 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/16_Int64/TestInt64.unity @@ -0,0 +1,212 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_GIWorkflowMode: 1 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 1 + m_BakeResolution: 50 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_LightmapSnapshot: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: .166666657 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &1477386082 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1477386087} + - 20: {fileID: 1477386086} + - 92: {fileID: 1477386085} + - 124: {fileID: 1477386084} + - 81: {fileID: 1477386083} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1477386083 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1477386082} + m_Enabled: 1 +--- !u!124 &1477386084 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1477386082} + m_Enabled: 1 +--- !u!92 &1477386085 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1477386082} + m_Enabled: 1 +--- !u!20 &1477386086 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1477386082} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!4 &1477386087 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1477386082} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!1 &1626522326 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1626522327} + - 114: {fileID: 1626522328} + m_Layer: 0 + m_Name: Test64 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1626522327 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1626522326} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 +--- !u!114 &1626522328 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1626522326} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d2eb3e2c0caea144e8cbbb8de6ed33f8, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/LuaFramework/ToLua/Examples/16_Int64/TestInt64.unity.meta b/Assets/LuaFramework/ToLua/Examples/16_Int64/TestInt64.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..e666e657c9faf21e4310d962c2db583c812e72d7 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/16_Int64/TestInt64.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 9f5fdf9606a2d854590fcbd3926005e4 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/17_Inherit.meta b/Assets/LuaFramework/ToLua/Examples/17_Inherit.meta new file mode 100644 index 0000000000000000000000000000000000000000..56c0fee7a5afe12c70cee5802c7361133eeb2e3b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/17_Inherit.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 49da3d0eb205def459dc639d92b7cc77 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/17_Inherit/Inherit.unity b/Assets/LuaFramework/ToLua/Examples/17_Inherit/Inherit.unity new file mode 100644 index 0000000000000000000000000000000000000000..8616ba5aa2dda0b317c165b015d3007333a74bb7 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/17_Inherit/Inherit.unity @@ -0,0 +1,240 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_GIWorkflowMode: 1 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 1 + m_BakeResolution: 50 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_LightmapSnapshot: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: .166666657 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &691340940 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 691340941} + - 114: {fileID: 691340942} + m_Layer: 0 + m_Name: GameObject + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &691340941 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 691340940} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 1, y: 2, z: 3} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2111708040} + m_Father: {fileID: 0} + m_RootOrder: 1 +--- !u!114 &691340942 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 691340940} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a9cb964bd30f70946ab3ba186316e134, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &798071901 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 798071906} + - 20: {fileID: 798071905} + - 92: {fileID: 798071904} + - 124: {fileID: 798071903} + - 81: {fileID: 798071902} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &798071902 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 798071901} + m_Enabled: 1 +--- !u!124 &798071903 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 798071901} + m_Enabled: 1 +--- !u!92 &798071904 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 798071901} + m_Enabled: 1 +--- !u!20 &798071905 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 798071901} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!4 &798071906 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 798071901} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!1 &2111708039 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 2111708040} + m_Layer: 0 + m_Name: child + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2111708040 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2111708039} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 691340941} + m_RootOrder: 0 diff --git a/Assets/LuaFramework/ToLua/Examples/17_Inherit/Inherit.unity.meta b/Assets/LuaFramework/ToLua/Examples/17_Inherit/Inherit.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..a91c0fe7e326c059694d2434c828e4e2936a44c5 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/17_Inherit/Inherit.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: a3cf1516f0a320b49a263c1fed026319 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/17_Inherit/TestInherit.cs b/Assets/LuaFramework/ToLua/Examples/17_Inherit/TestInherit.cs new file mode 100644 index 0000000000000000000000000000000000000000..bc6365348de836ab287d7d94190c30d798d31df4 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/17_Inherit/TestInherit.cs @@ -0,0 +1,123 @@ +锘縰sing UnityEngine; +using System.Collections; +using LuaInterface; + +public class TestInherit : MonoBehaviour +{ + private string script = + @" LuaTransform = + { + } + + function LuaTransform.Extend(u) + local t = {} + local _position = u.position + tolua.setpeer(u, t) + + t.__index = t + local get = tolua.initget(t) + local set = tolua.initset(t) + + local _base = u.base + + --閲嶅啓鍚屽悕灞炴ц幏鍙 + get.position = function(self) + return _position + end + + --閲嶅啓鍚屽悕灞炴ц缃 + set.position = function(self, v) + if _position ~= v then + _position = v + _base.position = v + end + end + + --閲嶅啓鍚屽悕鍑芥暟 + function t:Translate(...) + print('child Translate') + _base:Translate(...) + end + + return u + end + + + --鏃繚璇佹敮鎸佺户鎵垮嚱鏁帮紝鍙堟敮鎸乬o.transform == transform 杩欐牱鐨勬瘮杈 + function Test(node) + local v = Vector3.one + local transform = LuaTransform.Extend(node) + + local t = os.clock() + for i = 1, 200000 do + transform.position = transform.position + end + print('LuaTransform get set cost', os.clock() - t) + + transform:Translate(1,1,1) + + local child = transform:Find('child') + print('child is: ', tostring(child)) + + if child.parent == transform then + print('LuaTransform compare to userdata transform is ok') + end + + transform.xyz = 123 + transform.xyz = 456 + print('extern field xyz is: '.. transform.xyz) + end + "; + + LuaState lua = null; + + void Start () + { +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived += ShowTips; +#else + Application.RegisterLogCallback(ShowTips); +#endif + new LuaResLoader(); + lua = new LuaState(); + lua.Start(); + LuaBinder.Bind(lua); + lua.DoString(script, "TestInherit.cs"); + + float time = Time.realtimeSinceStartup; + + for (int i = 0; i < 200000; i++) + { + Vector3 v = transform.position; + transform.position = v; + } + + time = Time.realtimeSinceStartup - time; + Debugger.Log("c# Transform get set cost time: " + time); + lua.Call("Test", transform, true); + lua.Dispose(); + lua = null; + } + + string tips; + + void ShowTips(string msg, string stackTrace, LogType type) + { + tips += msg; + tips += "\r\n"; + } + + void OnDestroy() + { +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived -= ShowTips; +#else + Application.RegisterLogCallback(null); +#endif + } + + void OnGUI() + { + GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 300, 600, 600), tips); + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/17_Inherit/TestInherit.cs.meta b/Assets/LuaFramework/ToLua/Examples/17_Inherit/TestInherit.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..2865e136a41e3f6b2ebabf7dd554802e6fdb88b4 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/17_Inherit/TestInherit.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a9cb964bd30f70946ab3ba186316e134 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/18_Bundle.meta b/Assets/LuaFramework/ToLua/Examples/18_Bundle.meta new file mode 100644 index 0000000000000000000000000000000000000000..70eef1738516cb2db09f31ccf8d0d589ddccf8b8 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/18_Bundle.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 07aecff784dcab84393e4fad04c7b35d +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/18_Bundle/TesetAssetBundle.unity b/Assets/LuaFramework/ToLua/Examples/18_Bundle/TesetAssetBundle.unity new file mode 100644 index 0000000000000000000000000000000000000000..1ea5f07230dd25f5762492a10e32231f540ccba6 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/18_Bundle/TesetAssetBundle.unity @@ -0,0 +1,185 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_GIWorkflowMode: 1 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 1 + m_BakeResolution: 50 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_LightmapSnapshot: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: .166666657 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &374391092 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 374391097} + - 20: {fileID: 374391096} + - 92: {fileID: 374391095} + - 124: {fileID: 374391094} + - 81: {fileID: 374391093} + - 114: {fileID: 374391098} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &374391093 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 374391092} + m_Enabled: 1 +--- !u!124 &374391094 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 374391092} + m_Enabled: 1 +--- !u!92 &374391095 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 374391092} + m_Enabled: 1 +--- !u!20 &374391096 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 374391092} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!4 &374391097 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 374391092} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!114 &374391098 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 374391092} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d357c949a4510b146a6e82777d131d20, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/LuaFramework/ToLua/Examples/18_Bundle/TesetAssetBundle.unity.meta b/Assets/LuaFramework/ToLua/Examples/18_Bundle/TesetAssetBundle.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..b3d9b816ce641f98a3b60364b7b7141a108122df --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/18_Bundle/TesetAssetBundle.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 207ce505e47eb8542963d4972b45b05d +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/18_Bundle/TestABLoader.cs b/Assets/LuaFramework/ToLua/Examples/18_Bundle/TestABLoader.cs new file mode 100644 index 0000000000000000000000000000000000000000..a6bb23f931b59a5d3c3a3a05494330cb6e3d24a2 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/18_Bundle/TestABLoader.cs @@ -0,0 +1,135 @@ +锘縰sing UnityEngine; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using LuaInterface; +using System; + +//click Lua/Build lua bundle +public class TestABLoader : MonoBehaviour +{ + int bundleCount = int.MaxValue; + string tips = null; + + IEnumerator CoLoadBundle(string name, string path) + { + using (WWW www = new WWW(path)) + { + if (www == null) + { + Debugger.LogError(name + " bundle not exists"); + yield break; + } + + yield return www; + + if (www.error != null) + { + Debugger.LogError(string.Format("Read {0} failed: {1}", path, www.error)); + yield break; + } + + --bundleCount; + LuaFileUtils.Instance.AddSearchBundle(name, www.assetBundle); + www.Dispose(); + } + } + + IEnumerator LoadFinished() + { + while (bundleCount > 0) + { + yield return null; + } + + OnBundleLoad(); + } + + public IEnumerator LoadBundles() + { + string streamingPath = Application.streamingAssetsPath.Replace('\\', '/'); + +#if UNITY_5 || UNITY_2017 || UNITY_2018 +#if UNITY_ANDROID && !UNITY_EDITOR + string main = streamingPath + "/" + LuaConst.osDir + "/" + LuaConst.osDir; +#else + string main = "file:///" + streamingPath + "/" + LuaConst.osDir + "/" + LuaConst.osDir; +#endif + WWW www = new WWW(main); + yield return www; + + AssetBundleManifest manifest = (AssetBundleManifest)www.assetBundle.LoadAsset("AssetBundleManifest"); + List list = new List(manifest.GetAllAssetBundles()); +#else + //姝ゅ搴旇閰嶈〃鑾峰彇 + List list = new List() { "lua.unity3d", "lua_cjson.unity3d", "lua_system.unity3d", "lua_unityengine.unity3d", "lua_protobuf.unity3d", "lua_misc.unity3d", "lua_socket.unity3d", "lua_system_reflection.unity3d" }; +#endif + bundleCount = list.Count; + + for (int i = 0; i < list.Count; i++) + { + string str = list[i]; + +#if UNITY_ANDROID && !UNITY_EDITOR + string path = streamingPath + "/" + LuaConst.osDir + "/" + str; +#else + string path = "file:///" + streamingPath + "/" + LuaConst.osDir + "/" + str; +#endif + string name = Path.GetFileNameWithoutExtension(str); + StartCoroutine(CoLoadBundle(name, path)); + } + + yield return StartCoroutine(LoadFinished()); + } + + void Awake() + { +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived += ShowTips; +#else + Application.RegisterLogCallback(ShowTips); +#endif + LuaFileUtils file = new LuaFileUtils(); + file.beZip = true; +#if UNITY_ANDROID && UNITY_EDITOR + if (IntPtr.Size == 8) + { + throw new Exception("can't run this in unity5.x process for 64 bits, switch to pc platform, or run it in android mobile"); + } +#endif + StartCoroutine(LoadBundles()); + } + + void ShowTips(string msg, string stackTrace, LogType type) + { + tips += msg; + tips += "\r\n"; + } + + void OnGUI() + { + GUI.Label(new Rect(Screen.width / 2 - 200, Screen.height / 2 - 150, 400, 300), tips); + } + + void OnApplicationQuit() + { +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived -= ShowTips; +#else + Application.RegisterLogCallback(null); +#endif + } + + void OnBundleLoad() + { + LuaState state = new LuaState(); + state.Start(); + state.DoString("print('hello tolua#:'..tostring(Vector3.zero))"); + state.DoFile("Main.lua"); + LuaFunction func = state.GetFunction("Main"); + func.Call(); + func.Dispose(); + state.Dispose(); + state = null; + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/18_Bundle/TestABLoader.cs.meta b/Assets/LuaFramework/ToLua/Examples/18_Bundle/TestABLoader.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..85ab63df8d9ab2bc6cb1c1486a2b5cc79d3739da --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/18_Bundle/TestABLoader.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d357c949a4510b146a6e82777d131d20 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/19_cjson.meta b/Assets/LuaFramework/ToLua/Examples/19_cjson.meta new file mode 100644 index 0000000000000000000000000000000000000000..2f3208b80547c8f57cab8c88aff2a279850e0448 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/19_cjson.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 3c1a9e6cb95cdea4cbc97a336446abe8 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/19_cjson/TestCJson.cs b/Assets/LuaFramework/ToLua/Examples/19_cjson/TestCJson.cs new file mode 100644 index 0000000000000000000000000000000000000000..ddd2f8610bf409722ad2590a3ef8a55fa427da0c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/19_cjson/TestCJson.cs @@ -0,0 +1,74 @@ +锘縰sing UnityEngine; +using System.Collections; +using LuaInterface; + +public class TestCJson : LuaClient +{ + string script = @" + local json = require 'cjson' + + function Test(str) + local data = json.decode(str) + print(data.glossary.title) + s = json.encode(data) + print(s) + end +"; + protected override LuaFileUtils InitLoader() + { + return new LuaResLoader(); + } + + protected override void OpenLibs() + { + base.OpenLibs(); + OpenCJson(); + } + + protected override void OnLoadFinished() + { +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived += ShowTips; +#else + Application.RegisterLogCallback(ShowTips); +#endif + base.OnLoadFinished(); + + TextAsset text = (TextAsset)Resources.Load("jsonexample", typeof(TextAsset)); + string str = text.ToString(); + luaState.DoString(script); + LuaFunction func = luaState.GetFunction("Test"); + func.BeginPCall(); + func.Push(str); + func.PCall(); + func.EndPCall(); + func.Dispose(); + } + + //灞忚斀锛屼緥瀛愪笉闇瑕佽繍琛 + protected override void CallMain() { } + + string tips; + + void ShowTips(string msg, string stackTrace, LogType type) + { + tips += msg; + tips += "\r\n"; + } + + new void OnApplicationQuit() + { + base.OnApplicationQuit(); + +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived -= ShowTips; +#else + Application.RegisterLogCallback(null); +#endif + } + + void OnGUI() + { + GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 300, 600, 600), tips); + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/19_cjson/TestCJson.cs.meta b/Assets/LuaFramework/ToLua/Examples/19_cjson/TestCJson.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..504b592105287864d9571bc580482ce109e6cecf --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/19_cjson/TestCJson.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b3dab0c9b55ca0f44a0d3b8a50edf396 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/19_cjson/testcjson.unity b/Assets/LuaFramework/ToLua/Examples/19_cjson/testcjson.unity new file mode 100644 index 0000000000000000000000000000000000000000..0987678bf508fd56ce28fd761954df22214a56ea --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/19_cjson/testcjson.unity @@ -0,0 +1,212 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_GIWorkflowMode: 1 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 1 + m_BakeResolution: 50 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_LightmapSnapshot: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: .166666657 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &927911712 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 927911714} + - 114: {fileID: 927911713} + m_Layer: 0 + m_Name: TestCJson + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &927911713 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 927911712} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b3dab0c9b55ca0f44a0d3b8a50edf396, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &927911714 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 927911712} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 +--- !u!1 &1843803494 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1843803499} + - 20: {fileID: 1843803498} + - 92: {fileID: 1843803497} + - 124: {fileID: 1843803496} + - 81: {fileID: 1843803495} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1843803495 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1843803494} + m_Enabled: 1 +--- !u!124 &1843803496 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1843803494} + m_Enabled: 1 +--- !u!92 &1843803497 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1843803494} + m_Enabled: 1 +--- !u!20 &1843803498 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1843803494} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!4 &1843803499 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1843803494} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 diff --git a/Assets/LuaFramework/ToLua/Examples/19_cjson/testcjson.unity.meta b/Assets/LuaFramework/ToLua/Examples/19_cjson/testcjson.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..b031633e71bfaf2fa29aca8896debf8dff3bcabe --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/19_cjson/testcjson.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 0dbc965b474b6824db5cb79d380403e4 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/20_utf8.meta b/Assets/LuaFramework/ToLua/Examples/20_utf8.meta new file mode 100644 index 0000000000000000000000000000000000000000..27656c6462d5fbf65e975725a3976718966ae686 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/20_utf8.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 48896cd2daf4f4542ba776681732210a +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/20_utf8/TestUTF8.cs b/Assets/LuaFramework/ToLua/Examples/20_utf8/TestUTF8.cs new file mode 100644 index 0000000000000000000000000000000000000000..51c121936ed66593dcbaa4db4b307ed73a1f41c8 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/20_utf8/TestUTF8.cs @@ -0,0 +1,82 @@ +锘縰sing UnityEngine; +using LuaInterface; + +public class TestUTF8 : LuaClient +{ + string script = +@" + local utf8 = utf8 + + function Test() + local l1 = utf8.len('浣犲ソ') + local l2 = utf8.len('銇撱倱銇仭銇') + print('chinese string len is: '..l1..' japanese sting len: '..l2) + + local s = '閬嶅巻瀛楃涓' + + for i in utf8.byte_indices(s) do + local next = utf8.next(s, i) + print(s:sub(i, next and next -1)) + end + + local s1 = '澶╀笅椋庝簯鍑烘垜杈' + print('椋庝簯 count is: '..utf8.count(s1, '椋庝簯')) + s1 = s1:gsub('椋庝簯', '棰ㄩ洸') + + local function replace(s, i, j, repl_char) + if s:sub(i, j) == '杈' then + return repl_char + end + end + + print(utf8.replace(s1, replace, '杓')) + end +"; + + protected override LuaFileUtils InitLoader() + { + return new LuaResLoader(); + } + + //灞忚斀锛屼緥瀛愪笉闇瑕佽繍琛 + protected override void CallMain() { } + + protected override void OnLoadFinished() + { +#if UNITY_4_6 || UNITY_4_7 + Application.RegisterLogCallback(ShowTips); +#else + Application.logMessageReceived += ShowTips; +#endif + base.OnLoadFinished(); + luaState.DoString(script); + LuaFunction func = luaState.GetFunction("Test"); + func.Call(); + func.Dispose(); + func = null; + } + + string tips; + + void ShowTips(string msg, string stackTrace, LogType type) + { + tips += msg; + tips += "\r\n"; + } + + new void OnApplicationQuit() + { + base.OnApplicationQuit(); + +#if UNITY_4_6 || UNITY_4_7 + Application.RegisterLogCallback(null); +#else + Application.logMessageReceived -= ShowTips; +#endif + } + + void OnGUI() + { + GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 300, 600, 600), tips); + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/20_utf8/TestUTF8.cs.meta b/Assets/LuaFramework/ToLua/Examples/20_utf8/TestUTF8.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..31e61191ad111678ea3be79d5d28d5bce20a7a75 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/20_utf8/TestUTF8.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0c58b879bbb37ee4891c46ef87989f91 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/20_utf8/utf8.unity b/Assets/LuaFramework/ToLua/Examples/20_utf8/utf8.unity new file mode 100644 index 0000000000000000000000000000000000000000..dedb197da4f5a65fda0431e60875ae920fc8b403 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/20_utf8/utf8.unity @@ -0,0 +1,212 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_GIWorkflowMode: 1 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 1 + m_BakeResolution: 50 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_LightmapSnapshot: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: .166666657 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &867169804 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 867169809} + - 20: {fileID: 867169808} + - 92: {fileID: 867169807} + - 124: {fileID: 867169806} + - 81: {fileID: 867169805} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &867169805 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 867169804} + m_Enabled: 1 +--- !u!124 &867169806 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 867169804} + m_Enabled: 1 +--- !u!92 &867169807 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 867169804} + m_Enabled: 1 +--- !u!20 &867169808 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 867169804} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!4 &867169809 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 867169804} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!1 &979792077 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 979792079} + - 114: {fileID: 979792078} + m_Layer: 0 + m_Name: utf8 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &979792078 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 979792077} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0c58b879bbb37ee4891c46ef87989f91, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &979792079 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 979792077} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 diff --git a/Assets/LuaFramework/ToLua/Examples/20_utf8/utf8.unity.meta b/Assets/LuaFramework/ToLua/Examples/20_utf8/utf8.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..0a3edf8e8681cdf24428dfceb280fd073cd13a0d --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/20_utf8/utf8.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 74b6932cd0642734eb36e554528a9825 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/21_String.meta b/Assets/LuaFramework/ToLua/Examples/21_String.meta new file mode 100644 index 0000000000000000000000000000000000000000..19aaac3cf09f4cf936883831750dd44495303959 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/21_String.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: d7bfd51b922b87a4ba399b7f73540493 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/21_String/TestString.cs b/Assets/LuaFramework/ToLua/Examples/21_String/TestString.cs new file mode 100644 index 0000000000000000000000000000000000000000..ff956e1ec35f7b9647890399942d33246367b0eb --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/21_String/TestString.cs @@ -0,0 +1,71 @@ +锘縰sing UnityEngine; +using System.Collections; +using LuaInterface; +using System; +using System.Reflection; +using System.Text; + +public class TestString : LuaClient +{ + string script = +@" + function Test() + local str = System.String.New('鐢峰効褰撹嚜寮') + local index = str:IndexOfAny('鍎胯嚜') + print('and index is: '..index) + local buffer = str:ToCharArray() + print('str type is: '..type(str)..' buffer[0] is ' .. buffer[0]) + local luastr = tolua.tolstring(buffer) + print('lua string is: '..luastr..' type is: '..type(luastr)) + luastr = tolua.tolstring(str) + print('lua string is: '..luastr) + end +"; + + protected override LuaFileUtils InitLoader() + { + return new LuaResLoader(); + } + + //灞忚斀锛屼緥瀛愪笉闇瑕佽繍琛 + protected override void CallMain() { } + + protected override void OnLoadFinished() + { +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived += ShowTips; +#else + Application.RegisterLogCallback(ShowTips); +#endif + base.OnLoadFinished(); + luaState.DoString(script); + LuaFunction func = luaState.GetFunction("Test"); + func.Call(); + func.Dispose(); + func = null; + } + + string tips; + + void ShowTips(string msg, string stackTrace, LogType type) + { + tips += msg; + tips += "\r\n"; + } + + new void OnApplicationQuit() + { + base.OnApplicationQuit(); + +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived -= ShowTips; +#else + Application.RegisterLogCallback(null); +#endif + } + + void OnGUI() + { + GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 300, 600, 600), tips); + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/21_String/TestString.cs.meta b/Assets/LuaFramework/ToLua/Examples/21_String/TestString.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..7f28db822aebcc5ab13e7a81df09e9cc0ec21485 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/21_String/TestString.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 73dc7ee420beffa4b9db2334045dabba +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/21_String/TestString.unity b/Assets/LuaFramework/ToLua/Examples/21_String/TestString.unity new file mode 100644 index 0000000000000000000000000000000000000000..ddcc523394651f85d1661541cde0b2a6cd06fffa --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/21_String/TestString.unity @@ -0,0 +1,185 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_GIWorkflowMode: 1 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 1 + m_BakeResolution: 50 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_LightmapSnapshot: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: .166666657 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &1088011032 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1088011038} + - 20: {fileID: 1088011037} + - 92: {fileID: 1088011036} + - 124: {fileID: 1088011035} + - 81: {fileID: 1088011034} + - 114: {fileID: 1088011033} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1088011033 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1088011032} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 73dc7ee420beffa4b9db2334045dabba, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!81 &1088011034 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1088011032} + m_Enabled: 1 +--- !u!124 &1088011035 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1088011032} + m_Enabled: 1 +--- !u!92 &1088011036 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1088011032} + m_Enabled: 1 +--- !u!20 &1088011037 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1088011032} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!4 &1088011038 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1088011032} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 diff --git a/Assets/LuaFramework/ToLua/Examples/21_String/TestString.unity.meta b/Assets/LuaFramework/ToLua/Examples/21_String/TestString.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..b4f8e2eee452834fe5348b0cb7f363feb6bd9408 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/21_String/TestString.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 8e6bca3bb283b3247a8692ac6e03d4ff +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/22_Reflection.meta b/Assets/LuaFramework/ToLua/Examples/22_Reflection.meta new file mode 100644 index 0000000000000000000000000000000000000000..7223e6cd81320b716a3ca50065e17fddc4653334 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/22_Reflection.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 1160a89e211090a4ea787fb5145cc984 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/22_Reflection/TestReflection.cs b/Assets/LuaFramework/ToLua/Examples/22_Reflection/TestReflection.cs new file mode 100644 index 0000000000000000000000000000000000000000..04a23874e60f769f076570621029083bd2dc9393 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/22_Reflection/TestReflection.cs @@ -0,0 +1,144 @@ +锘縰sing UnityEngine; +using System.Collections.Generic; +using LuaInterface; +using System; +using System.Reflection; + + +public class TestReflection : LuaClient +{ + string script = +@" + require 'tolua.reflection' + tolua.loadassembly('Assembly-CSharp') + local BindingFlags = require 'System.Reflection.BindingFlags' + + function DoClick() + print('do click') + end + + function Test() + local t = typeof('TestExport') + local func = tolua.getmethod(t, 'TestReflection') + func:Call() + func:Destroy() + func = nil + + local objs = {Vector3.one, Vector3.zero} + local array = tolua.toarray(objs, typeof(Vector3)) + local obj = tolua.createinstance(t, array) + --local constructor = tolua.getconstructor(t, typeof(Vector3):MakeArrayType()) + --local obj = constructor:Call(array) + --constructor:Destroy() + + func = tolua.getmethod(t, 'Test', typeof('System.Int32'):MakeByRefType()) + local r, o = func:Call(obj, 123) + print(r..':'..o) + func:Destroy() + + local property = tolua.getproperty(t, 'Number') + local num = property:Get(obj, null) + print('object Number: '..num) + property:Set(obj, 456, null) + num = property:Get(obj, null) + property:Destroy() + print('object Number: '..num) + + local field = tolua.getfield(t, 'field') + num = field:Get(obj) + print('object field: '.. num) + field:Set(obj, 2048) + num = field:Get(obj) + field:Destroy() + print('object field: '.. num) + + field = tolua.getfield(t, 'OnClick') + local onClick = field:Get(obj) + onClick = onClick + DoClick + field:Set(obj, onClick) + local click = field:Get(obj) + click:DynamicInvoke() + field:Destroy() + click:Destroy() + end +"; + + string tips = null; + + protected override LuaFileUtils InitLoader() + { +#if UNITY_4_6 || UNITY_4_7 + Application.RegisterLogCallback(ShowTips); +#else + Application.logMessageReceived += ShowTips; +#endif + return new LuaResLoader(); + } + + //灞忚斀锛屼緥瀛愪笉闇瑕佽繍琛 + protected override void CallMain() { } + + void TestAction() + { + Debugger.Log("Test Action"); + } + + protected override void OnLoadFinished() + { + base.OnLoadFinished(); + + /*Type t = typeof(TestExport); + MethodInfo md = t.GetMethod("TestReflection"); + md.Invoke(null, null); + + Vector3[] array = new Vector3[] { Vector3.zero, Vector3.one }; + object obj = Activator.CreateInstance(t, array); + md = t.GetMethod("Test", new Type[] { typeof(int).MakeByRefType() }); + object o = 123; + object[] args = new object[] { o }; + object ret = md.Invoke(obj, args); + Debugger.Log(ret + " : " + args[0]); + + PropertyInfo p = t.GetProperty("Number"); + int num = (int)p.GetValue(obj, null); + Debugger.Log("object Number: {0}", num); + p.SetValue(obj, 456, null); + num = (int)p.GetValue(obj, null); + Debugger.Log("object Number: {0}", num); + + FieldInfo f = t.GetField("field"); + num = (int)f.GetValue(obj); + Debugger.Log("object field: {0}", num); + f.SetValue(obj, 2048); + num = (int)f.GetValue(obj); + Debugger.Log("object field: {0}", num);*/ + + luaState.CheckTop(); + luaState.DoString(script, "TestReflection.cs"); + LuaFunction func = luaState.GetFunction("Test"); + func.Call(); + func.Dispose(); + func = null; + } + + void ShowTips(string msg, string stackTrace, LogType type) + { + tips += msg; + tips += "\r\n"; + } + + new void OnApplicationQuit() + { +#if UNITY_4_6 || UNITY_4_7 + Application.RegisterLogCallback(ShowTips); +#else + Application.logMessageReceived += ShowTips; +#endif + Destroy(); + } + + void OnGUI() + { + GUI.Label(new Rect(Screen.width / 2 - 250, Screen.height / 2 - 150, 500, 300), tips); + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/22_Reflection/TestReflection.cs.meta b/Assets/LuaFramework/ToLua/Examples/22_Reflection/TestReflection.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..d23325cf8715290fd03fd013ee714367e9aac6ee --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/22_Reflection/TestReflection.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fab693360b2865f4a9121b9959993d29 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/22_Reflection/TestReflection.unity b/Assets/LuaFramework/ToLua/Examples/22_Reflection/TestReflection.unity new file mode 100644 index 0000000000000000000000000000000000000000..c6c842c66797fc055605865f5374bfbf734eed19 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/22_Reflection/TestReflection.unity @@ -0,0 +1,185 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_GIWorkflowMode: 1 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 1 + m_BakeResolution: 50 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_LightmapSnapshot: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: .166666657 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &1823211542 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1823211548} + - 20: {fileID: 1823211547} + - 92: {fileID: 1823211546} + - 124: {fileID: 1823211545} + - 81: {fileID: 1823211544} + - 114: {fileID: 1823211543} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1823211543 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1823211542} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fab693360b2865f4a9121b9959993d29, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!81 &1823211544 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1823211542} + m_Enabled: 1 +--- !u!124 &1823211545 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1823211542} + m_Enabled: 1 +--- !u!92 &1823211546 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1823211542} + m_Enabled: 1 +--- !u!20 &1823211547 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1823211542} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!4 &1823211548 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1823211542} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 diff --git a/Assets/LuaFramework/ToLua/Examples/22_Reflection/TestReflection.unity.meta b/Assets/LuaFramework/ToLua/Examples/22_Reflection/TestReflection.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..da3173908b89d15070d132e27a5b283136bb460c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/22_Reflection/TestReflection.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 0c297fdd08a27a54a96505801547f7b2 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/23_List.meta b/Assets/LuaFramework/ToLua/Examples/23_List.meta new file mode 100644 index 0000000000000000000000000000000000000000..73823e9af5a8097deae687a967d50fb24f44ec0b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/23_List.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 665099d7241e1a54fb217e3b172e21a7 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/23_List/UseList.cs b/Assets/LuaFramework/ToLua/Examples/23_List/UseList.cs new file mode 100644 index 0000000000000000000000000000000000000000..e500c2c86a555d7fe8d64669f187d8fecd0c1498 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/23_List/UseList.cs @@ -0,0 +1,193 @@ +锘縰sing UnityEngine; +using System.Collections; +using LuaInterface; +using System.Collections.Generic; +using System; + +//闇瑕佸鍑哄鎵樼被鍨嬪涓嬶細 +//System.Predicate +//System.Action +//System.Comparison +public class UseList : LuaClient +{ + private string script = + @" + function Exist2(v) + return v == 2 + end + + function IsEven(v) + return v % 2 == 0 + end + + function NotExist(v) + return false + end + + function Compare(a, b) + if a > b then + return 1 + elseif a == b then + return 0 + else + return -1 + end + end + + function Test(list, list1) + list:Add(123) + print('Add result: list[0] is '..list[0]) + list:AddRange(list1) + print(string.format('AddRange result: list[1] is %d, list[2] is %d', list[1], list[2])) + + local const = list:AsReadOnly() + print('AsReadOnley:'..const[0]) + + index = const:IndexOf(123) + + if index == 0 then + print('const IndexOf is ok') + end + + local pos = list:BinarySearch(1) + print('BinarySearch 1 result is: '..pos) + + if list:Contains(123) then + print('list Contain 123') + else + error('list Contains result fail') + end + + if list:Exists(Exist2) then + print('list exists 2') + else + error('list exists result fail') + end + + if list:Find(Exist2) then + print('list Find is ok') + else + print('list Find error') + end + + local fa = list:FindAll(IsEven) + + if fa.Count == 2 then + print('FindAll is ok') + end + + --娉ㄦ剰鎺ㄥ鍚庣殑濮旀墭澹版槑蹇呴』娉ㄥ唽, 杩欓噷鏄疭ystem.Predicate + local index = list:FindIndex(System.Predicate_int(Exist2)) + + if index == 2 then + print('FindIndex is ok') + end + + index = list:FindLastIndex(System.Predicate_int(Exist2)) + + if index == 2 then + print('FindLastIndex is ok') + end + + index = list:IndexOf(123) + + if index == 0 then + print('IndexOf is ok') + end + + index = list:LastIndexOf(123) + + if index == 0 then + print('LastIndexOf is ok') + end + + list:Remove(123) + + if list[0] ~= 123 then + print('Remove is ok') + end + + list:Insert(0, 123) + + if list[0] == 123 then + print('Insert is ok') + end + + list:RemoveAt(0) + + if list[0] ~= 123 then + print('RemoveAt is ok') + end + + list:Insert(0, 123) + list:ForEach(function(v) print('foreach: '..v) end) + local count = list.Count + + list:Sort(System.Comparison_int(Compare)) + print('--------------sort list over----------------------') + + for i = 0, count - 1 do + print('for:'..list[i]) + end + + list:Clear() + print('list Clear not count is '..list.Count) + end + "; + + + protected override LuaFileUtils InitLoader() + { + return new LuaResLoader(); + } + + //灞忚斀锛屼緥瀛愪笉闇瑕佽繍琛 + protected override void CallMain() { } + + protected override void OnLoadFinished() + { +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived += ShowTips; +#else + Application.RegisterLogCallback(ShowTips); +#endif + base.OnLoadFinished(); + luaState.DoString(script, "UseList.cs"); + List list1 = new List(); + list1.Add(1); + list1.Add(2); + list1.Add(4); + + LuaFunction func = luaState.GetFunction("Test"); + func.BeginPCall(); + func.Push(new List()); + func.Push(list1); + func.PCall(); + func.EndPCall(); + func.Dispose(); + func = null; + } + + string tips; + + void ShowTips(string msg, string stackTrace, LogType type) + { + tips += msg; + tips += "\r\n"; + } + + new void OnApplicationQuit() + { + base.OnApplicationQuit(); +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived -= ShowTips; +#else + Application.RegisterLogCallback(null); +#endif + } + + void OnGUI() + { + GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 300, 600, 600), tips); + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/23_List/UseList.cs.meta b/Assets/LuaFramework/ToLua/Examples/23_List/UseList.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..7ef08586f44f7de9db9026260edbfdffb08eb791 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/23_List/UseList.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8a4f97c41d925314c853a72d43fb5166 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/23_List/UseList.unity b/Assets/LuaFramework/ToLua/Examples/23_List/UseList.unity new file mode 100644 index 0000000000000000000000000000000000000000..bfba636dcaa91685ad38fc5302cb4174770be309 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/23_List/UseList.unity @@ -0,0 +1,185 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_GIWorkflowMode: 1 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 1 + m_BakeResolution: 50 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_LightmapSnapshot: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: .166666657 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &1137150139 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1137150145} + - 20: {fileID: 1137150144} + - 92: {fileID: 1137150143} + - 124: {fileID: 1137150142} + - 81: {fileID: 1137150141} + - 114: {fileID: 1137150140} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1137150140 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1137150139} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8a4f97c41d925314c853a72d43fb5166, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!81 &1137150141 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1137150139} + m_Enabled: 1 +--- !u!124 &1137150142 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1137150139} + m_Enabled: 1 +--- !u!92 &1137150143 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1137150139} + m_Enabled: 1 +--- !u!20 &1137150144 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1137150139} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!4 &1137150145 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1137150139} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 diff --git a/Assets/LuaFramework/ToLua/Examples/23_List/UseList.unity.meta b/Assets/LuaFramework/ToLua/Examples/23_List/UseList.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..1f9ca0ea6432f8ddbf07774065bd47fb57a203f3 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/23_List/UseList.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: a4f35714ff91744489f71618b0ae9fd8 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/24_Struct.meta b/Assets/LuaFramework/ToLua/Examples/24_Struct.meta new file mode 100644 index 0000000000000000000000000000000000000000..df11a8d93cd86f9972f7ed1bdbd773ea88cba764 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/24_Struct.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: a817b98d5c7d23e4c9c6afb6ac646cbe +folderAsset: yes +timeCreated: 1495007845 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Examples/24_Struct/PassStruct.cs b/Assets/LuaFramework/ToLua/Examples/24_Struct/PassStruct.cs new file mode 100644 index 0000000000000000000000000000000000000000..be9ec67d5046a90131127dbfadec09b81107ac76 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/24_Struct/PassStruct.cs @@ -0,0 +1,175 @@ +锘縰sing UnityEngine; +using LuaInterface; +using System; +using Debugger = LuaInterface.Debugger; + +namespace LuaInterface +{ + public partial struct LuaValueType + { + public const int Rect = 13; + } +} + +public class PassStruct : LuaClient +{ + private string script = + @" + Rect = {} + + function Rect.New(x,y,w,h) + local rt = {x = x, y = y, w = w, h = h} + setmetatable(rt, Rect) + return rt + end + + function Rect:Get() + return self.x, self.y, self.w, self.h + end + + Rect.__tostring = function(self) + return '(x:'..self.x..', y:'..self.y..', width:'..self.w..', height:'..self.h..')' + end + + function PrintRect(rt) + print(tostring(rt)) + return rt + end + + setmetatable(Rect, Rect) + AddValueType(Rect, 13) + "; + + void PushRect(IntPtr L, Rect rt) + { + LuaDLL.lua_getref(L, NewRect.GetReference()); + LuaDLL.lua_pushnumber(L, rt.xMin); + LuaDLL.lua_pushnumber(L, rt.yMin); + LuaDLL.lua_pushnumber(L, rt.width); + LuaDLL.lua_pushnumber(L, rt.height); + LuaDLL.lua_call(L, 4, 1); + } + + Rect ToRectValue(IntPtr L, int pos) + { + pos = LuaDLL.abs_index(L, pos); + LuaDLL.lua_getref(L, GetRect.GetReference()); + LuaDLL.lua_pushvalue(L, pos); + LuaDLL.lua_call(L, 1, 4); + float x = (float)LuaDLL.lua_tonumber(L, -4); + float y = (float)LuaDLL.lua_tonumber(L, -3); + float w = (float)LuaDLL.lua_tonumber(L, -2); + float h = (float)LuaDLL.lua_tonumber(L, -1); + LuaDLL.lua_pop(L, 4); + + return new Rect(x, y, w, h); + } + + Rect CheckRectValue(IntPtr L, int pos) + { + int type = LuaDLL.tolua_getvaluetype(L, pos); + + if (type != LuaValueType.Rect) + { + luaState.LuaTypeError(pos, "Rect", LuaValueTypeName.Get(type)); + return new Rect(); + } + + return ToRectValue(L, pos); + } + + bool CheckRectType(IntPtr L, int pos) + { + return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Rect; + } + + bool CheckNullRectType(IntPtr L, int pos) + { + LuaTypes luaType = LuaDLL.lua_type(L, pos); + + switch (luaType) + { + case LuaTypes.LUA_TNIL: + return true; + case LuaTypes.LUA_TTABLE: + return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Rect; + default: + return false; + } + } + + object ToRectTable(IntPtr L, int pos) + { + return ToRectValue(L, pos); + } + + string tips = null; + + void ShowTips(string msg, string stackTrace, LogType type) + { + tips += msg; + tips += "\r\n"; + } + + new void OnApplicationQuit() + { + base.OnApplicationQuit(); +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived -= ShowTips; +#else + Application.RegisterLogCallback(null); +#endif + } + + new void Awake() + { +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived += ShowTips; +#else + Application.RegisterLogCallback(ShowTips); +#endif + base.Awake(); + } + + protected override void OnLoadFinished() + { + base.OnLoadFinished(); + luaState.DoString(script, "PassStruct.cs"); + + NewRect = luaState.GetFunction("Rect.New"); + GetRect = luaState.GetFunction("Rect.Get"); + StackTraits.Init(PushRect, CheckRectValue, ToRectValue); //鏀寔鍘嬪叆lua浠ュ強浠巐ua鏍堣鍙 + TypeTraits.Init(CheckRectType); //鏀寔閲嶈浇鍑芥暟TypeCheck.CheckTypes + TypeTraits>.Init(CheckNullRectType); //鏀寔閲嶈浇鍑芥暟TypeCheck.CheckTypes + LuaValueTypeName.names[LuaValueType.Rect] = "Rect"; //CheckType澶辫触鎻愮ず鐨勫悕瀛 + TypeChecker.LuaValueTypeMap[LuaValueType.Rect] = typeof(Rect); //鐢ㄤ簬鏀寔绫诲瀷鍖归厤妫鏌ユ搷浣 + ToLua.ToVarMap[LuaValueType.Rect] = ToRectTable; //Rect浣滀负object璇诲彇 + ToLua.VarPushMap[typeof(Rect)] = (L, o) => { PushRect(L, (Rect)o); }; //Rect浣滀负object鍘嬪叆 + + //娴嬭瘯渚嬪瓙 + LuaFunction func = luaState.GetFunction("PrintRect"); + func.BeginPCall(); + func.PushValue(new Rect(10, 20, 120, 50)); + func.PCall(); + Rect rt = func.CheckValue(); + func.EndPCall(); + Debugger.Log(rt); + Debugger.Log(Vector3.one.ToString()); + } + + LuaFunction NewRect = null; + LuaFunction GetRect = null; + + protected override LuaFileUtils InitLoader() + { + return new LuaResLoader(); + } + + private void OnGUI() + { + GUI.Label(new Rect(Screen.width / 2 - 220, Screen.height / 2 - 200, 400, 400), tips); + } + + //灞忚斀锛屼緥瀛愪笉闇瑕佽繍琛 + protected override void CallMain() { } +} diff --git a/Assets/LuaFramework/ToLua/Examples/24_Struct/PassStruct.cs.meta b/Assets/LuaFramework/ToLua/Examples/24_Struct/PassStruct.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..8aa224198293fef32ebce0d1fd5827f6c1ad0389 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/24_Struct/PassStruct.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 51af02ba87a948543b788453b5bb790c +timeCreated: 1495007962 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Examples/24_Struct/Struct.unity b/Assets/LuaFramework/ToLua/Examples/24_Struct/Struct.unity new file mode 100644 index 0000000000000000000000000000000000000000..76955ab57c39b7181401fb38cd62ef671378ef79 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/24_Struct/Struct.unity @@ -0,0 +1,185 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_GIWorkflowMode: 1 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 1 + m_BakeResolution: 50 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_LightmapSnapshot: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: .166666657 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &99195644 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 99195650} + - 20: {fileID: 99195649} + - 124: {fileID: 99195648} + - 92: {fileID: 99195647} + - 81: {fileID: 99195646} + - 114: {fileID: 99195645} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &99195645 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 99195644} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 51af02ba87a948543b788453b5bb790c, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!81 &99195646 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 99195644} + m_Enabled: 1 +--- !u!92 &99195647 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 99195644} + m_Enabled: 1 +--- !u!124 &99195648 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 99195644} + m_Enabled: 1 +--- !u!20 &99195649 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 99195644} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!4 &99195650 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 99195644} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 diff --git a/Assets/LuaFramework/ToLua/Examples/24_Struct/Struct.unity.meta b/Assets/LuaFramework/ToLua/Examples/24_Struct/Struct.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..4db5e1767d2e51bec00e51182582a394b4e4e46d --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/24_Struct/Struct.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bab0d380ec96e4846bcd28c1d626d89f +timeCreated: 1495007901 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Examples/Performance.meta b/Assets/LuaFramework/ToLua/Examples/Performance.meta new file mode 100644 index 0000000000000000000000000000000000000000..1a05dfb015e1f55483d263c35da39538b101faea --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/Performance.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: f240c18ff8d4eb44390f8d949e2f6fbd +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/Performance/Performance.unity b/Assets/LuaFramework/ToLua/Examples/Performance/Performance.unity new file mode 100644 index 0000000000000000000000000000000000000000..86569d304ff7e5953c7e498e4735d2a21efa7b98 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/Performance/Performance.unity @@ -0,0 +1,89 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: .211999997, g: .226999998, b: .259000003, a: 1} + m_AmbientEquatorColor: {r: .114, g: .125, b: .133000001, a: 1} + m_AmbientGroundColor: {r: .0469999984, g: .0430000015, b: .0350000001, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_GIWorkflowMode: 1 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 2 + m_BakeResolution: 40 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_LightmapSnapshot: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: .166666672 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} diff --git a/Assets/LuaFramework/ToLua/Examples/Performance/Performance.unity.meta b/Assets/LuaFramework/ToLua/Examples/Performance/Performance.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..763d0dc32c4ab8ccea90233da428ec9fb32e903d --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/Performance/Performance.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 0693d19658479a642a7faaa61feb2c09 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/Performance/TestPerformance.cs b/Assets/LuaFramework/ToLua/Examples/Performance/TestPerformance.cs new file mode 100644 index 0000000000000000000000000000000000000000..4781031d27ec2176262b574c8a778ec34eed2526 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/Performance/TestPerformance.cs @@ -0,0 +1,233 @@ +锘縰sing System; +using UnityEngine; +using System.Collections.Generic; +using LuaInterface; +using System.Collections; +using System.Runtime.InteropServices; + +public class TestPerformance : MonoBehaviour +{ + LuaState state = null; + private string tips = ""; + + private void Start() + { +#if UNITY_4_6 || UNITY_4_7 + Application.RegisterLogCallback(ShowTips); +#else + Application.logMessageReceived += ShowTips; +#endif + new LuaResLoader(); + state = new LuaState(); + state.Start(); + LuaBinder.Bind(state); + state.DoFile("TestPerf.lua"); + } + + void ShowTips(string msg, string stackTrace, LogType type) + { + tips += msg; + tips += "\r\n"; + } + + void OnApplicationQuit() + { +#if UNITY_4_6 || UNITY_4_7 + Application.RegisterLogCallback(null); +#else + Application.logMessageReceived -= ShowTips; +#endif + state.Dispose(); + state = null; + } + + void OnGUI() + { + GUI.Label(new Rect(Screen.width / 2 - 220, Screen.height / 2 - 200, 400, 400), tips); + + if (GUI.Button(new Rect(50, 50, 120, 45), "Test1")) + { + float time = Time.realtimeSinceStartup; + + for (int i = 0; i < 200000; i++) + { + Vector3 v = transform.position; + transform.position = v + Vector3.one; + } + + time = Time.realtimeSinceStartup - time; + tips = ""; + Debugger.Log("c# Transform getset cost time: " + time); + transform.position = Vector3.zero; + + LuaFunction func = state.GetFunction("Test1"); + func.BeginPCall(); + func.Push(transform); + func.PCall(); + func.EndPCall(); + func.Dispose(); + func = null; + } + else if (GUI.Button(new Rect(50, 150, 120, 45), "Test2")) + { + float time = Time.realtimeSinceStartup; + + for (int i = 0; i < 200000; i++) + { + transform.Rotate(Vector3.up, 1); + } + + time = Time.realtimeSinceStartup - time; + tips = ""; + Debugger.Log("c# Transform.Rotate cost time: " + time); + + LuaFunction func = state.GetFunction("Test2"); + func.BeginPCall(); + func.Push(transform); + func.PCall(); + func.EndPCall(); + func.Dispose(); + func = null; + } + else if (GUI.Button(new Rect(50, 250, 120, 45), "Test3")) + { + float time = Time.realtimeSinceStartup; + + for (int i = 0; i < 2000000; i++) + { + new Vector3(i, i, i); + } + + time = Time.realtimeSinceStartup - time; + tips = ""; + Debugger.Log("c# new Vector3 cost time: " + time); + + LuaFunction func = state.GetFunction("Test3"); + func.Call(); + func.Dispose(); + func = null; + } + else if (GUI.Button(new Rect(50, 350, 120, 45), "Test4")) + { + float time = Time.realtimeSinceStartup; + + for (int i = 0; i < 20000; i++) + { + new GameObject(); + } + + time = Time.realtimeSinceStartup - time; + tips = ""; + Debugger.Log("c# new GameObject cost time: " + time); + + //鍏塯c浜 + LuaFunction func = state.GetFunction("Test4"); + func.Call(); + func.Dispose(); + func = null; + } + else if (GUI.Button(new Rect(50, 450, 120, 45), "Test5")) + { + int[] array = new int[1024]; + + for (int i = 0; i < 1024; i++) + { + array[i] = i; + } + + float time = Time.realtimeSinceStartup; + int total = 0; + + for (int j = 0; j < 100000; j++) + { + for (int i = 0; i < 1024; i++) + { + total += array[i]; + } + } + + time = Time.realtimeSinceStartup - time; + tips = ""; + Debugger.Log("Array cost time: " + time); + + List list = new List(array); + time = Time.realtimeSinceStartup; + total = 0; + + for (int j = 0; j < 100000; j++) + { + for (int i = 0; i < 1024; i++) + { + total += list[i]; + } + } + + time = Time.realtimeSinceStartup - time; + tips = ""; + Debugger.Log("Array cost time: " + time); + + LuaFunction func = state.GetFunction("TestTable"); + func.Call(); + func.Dispose(); + func = null; + } + else if (GUI.Button(new Rect(50, 550, 120, 40), "Test7")) + { + float time = Time.realtimeSinceStartup; + Vector3 v1 = Vector3.zero; + + for (int i = 0; i < 200000; i++) + { + Vector3 v = new Vector3(i,i,i); + v = Vector3.Normalize(v); + v1 = v + v1; + } + + time = Time.realtimeSinceStartup - time; + tips = ""; + Debugger.Log("Vector3 New Normalize cost: " + time); + LuaFunction func = state.GetFunction("Test7"); + func.Call(); + func.Dispose(); + func = null; + } + else if (GUI.Button(new Rect(250, 50, 120, 40), "Test8")) + { + float time = Time.realtimeSinceStartup; + + for (int i = 0; i < 200000; i++) + { + Quaternion q1 = Quaternion.Euler(i, i, i); + Quaternion q2 = Quaternion.Euler(i * 2, i * 2, i * 2); + Quaternion.Slerp(q1, q2, 0.5f); + } + + time = Time.realtimeSinceStartup - time; + tips = ""; + Debugger.Log("Quaternion Euler Slerp cost: " + time); + + LuaFunction func = state.GetFunction("Test8"); + func.Call(); + func.Dispose(); + func = null; + } + else if (GUI.Button(new Rect(250, 150, 120, 40), "Test9")) + { + tips = ""; + LuaFunction func = state.GetFunction("Test9"); + func.Call(); + func.Dispose(); + func = null; + } + else if (GUI.Button(new Rect(250, 250, 120, 40), "Quit")) + { + Application.Quit(); + } + + if (state != null) + { + state.CheckTop(); + state.Collect(); + } + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/Performance/TestPerformance.cs.meta b/Assets/LuaFramework/ToLua/Examples/Performance/TestPerformance.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..7ec0b412df78ed38e9b007cc2b65040c4efb7680 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/Performance/TestPerformance.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e3be970387cfeea42a1944adffc6fffc +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/README.md b/Assets/LuaFramework/ToLua/Examples/README.md new file mode 100644 index 0000000000000000000000000000000000000000..3993c0180e5e64f246db67b4ded6b6dc32da9343 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/README.md @@ -0,0 +1,305 @@ +## 渚嬪瓙1 +灞曠ず浜嗘渶灏忕殑tolua#鐜锛屼互鍙婃墽琛屼竴娈祃ua浠g爜鎿嶄綔浠g爜濡備笅锛 +``` csharp + LuaState lua = new LuaState(); + lua.Start(); + string hello = + @" + print('hello tolua#') + "; + + lua.DoString(hello, "HelloWorld.cs"); + lua.CheckTop(); + lua.Dispose(); + lua = null; +``` +LuaState灏佽浜嗗lua 涓昏鏁版嵁缁撴瀯 lua_State 鎸囬拡鐨勫悇绉嶅爢鏍堟搷浣溿
+涓鑸浜庡鎴风锛屾帹鑽愬彧鍒涘缓涓涓狶uaState瀵硅薄銆傚鏋滆浣跨敤澶歋tate闇瑕佸湪Unity涓缃叏灞瀹 MULTI_STATE
+* LuaState.Start 闇瑕佸湪tolua浠g爜鍔犺浇鍒板唴瀛樺悗璋冪敤銆傚鏋滀娇鐢╝ssetbunblde鍔犺浇lua鏂囦欢锛岃皟鐢⊿tart()涔嬪墠assetbundle蹇呴』鍔犺浇濂
+* LuaState.DoString 鎵ц涓娈祃ua浠g爜,闄や簡渚嬪瓙,姣旇緝灏戠敤杩欑鏂瑰紡鍔犺浇浠g爜,鏃犳硶閬垮厤浠g爜閲嶅鍔犺浇瑕嗙洊绛,闇璋冪敤鑰呰嚜宸变繚璇併傜浜屼釜鍙傛暟鐢ㄤ簬璋冭瘯淇℃伅,鎴栬卐rror娑堟伅(鐢ㄤ簬鎻愮ず鍑洪敊浠g爜鎵鍦ㄦ枃浠跺悕绉)
+* LuaState.CheckTop 妫鏌ユ槸鍚﹀爢鏍堟槸鍚﹀钩琛★紝涓鑸斁浜巙pdate涓紝c#涓换浣曚娇鐢╨ua鍫嗘爤鎿嶄綔锛岄兘闇瑕佽皟鐢ㄨ呰嚜宸卞钩琛″爢鏍堬紙鍙傝僉uaFunction浠ュ強LuaTable浠g爜锛, 褰揅heckTop鍑虹幇璀﹀憡鏃跺叾瀹炴棭宸茬粡绂诲紑浜嗗爢鏍堟搷浣滆寖鍥达紝杩欐槸闇鑷review浠g爜銆
+* LuaState.Dispose 閲婃斁LuaState 浠ュ強鍏惰祫婧愩
+> **娉ㄦ剰:** 姝や緥瀛愭棤娉曞彂甯冨埌鎵嬫満 + +## 渚嬪瓙2 +灞曠ず浜哾ofile璺焤equire鐨勫尯鍒, 浠g爜濡備笅: +``` csharp + LuaState lua = null; + + void Start () + { + lua = new LuaState(); + lua.Start(); + //濡傛灉绉诲姩浜員oLua鐩綍锛岄渶瑕佽嚜宸辨墜鍔紝杩欓噷鍙槸渚嬪瓙灏变笉鍋氶厤缃簡 + string fullPath = Application.dataPath + "/ToLua/Examples/02_ScriptsFromFile"; + lua.AddSearchPath(fullPath); + } + + void OnGUI() + { + if (GUI.Button(new Rect(50, 50, 120, 45), "DoFile")) + { + lua.DoFile("ScriptsFromFile.lua"); + } + else if (GUI.Button(new Rect(50, 150, 120, 45), "Require")) + { + lua.Require("ScriptsFromFile"); + } + + lua.Collect(); + lua.CheckTop(); + } + + void OnApplicationQuit() + { + lua.Dispose(); + lua = null; + } +``` +tolua#DoFile鍑芥暟,璺焞ua淇濇寔涓鑷磋涓,鑳藉娆℃墽琛屼竴涓枃浠躲倀olua#鍔犲叆浜嗘柊鐨凴equire鍑芥暟,鏃犺c#鍜宭ua璋佸厛require涓涓猯ua鏂囦欢, 閮借兘淇濊瘉鍔犺浇鍞竴鎬
+* LuaState.AddSearchPath 澧炲姞鎼滅储鐩綍, 杩欐牱DoFile璺烺equire鍑芥暟鍙互鍙敤鏂囦欢鍚,鏃犻渶鍐欏叏璺緞
+* LuaState.DoFile 鍔犺浇涓涓猯ua鏂囦欢, 娉ㄦ剰dofile闇瑕佹墿灞曞悕, 鍙弽澶嶆墽琛, 鍚庨潰鐨勫彉閲忎細瑕嗙洊涔嬪墠鐨凞oFile鍔犺浇鐨勫彉閲
+* LuaState.Require 鍚宭ua require(modname)鎿嶄綔, 鍔犺浇鎸囧畾妯″潡骞朵笖鎶婄粨鏋滃啓鍏ュ埌package.loaded涓,濡傛灉modname瀛樺湪, 鍒欑洿鎺ヨ繑鍥瀙ackage.loaded[modname]
+* LuaState.Collect 鍨冨溇鍥炴敹, 瀵逛簬琚嚜鍔╣c鐨凩uaFunction, LuaTable, 浠ュ強濮旀墭鍑忔帀鐨凩uaFunction, 寤惰繜鍒犻櫎鐨凮bject涔嬬被銆傜瓑绛夐渶瑕佸欢杩熷鐞嗙殑鍥炴敹, 閮藉湪杩欓噷鑷姩鎵ц
+ +> **娉ㄦ剰:** 铏界劧鏈夋枃浠跺姞杞,浣嗘渚嬪瓙鏃犳硶鍙戝竷鍒版墜鏈, 濡傛灉ToLua鐩綍涓嶅湪/Assets鐩綍涓, 闇瑕佷慨鏀逛唬鐮佷腑鐨勭洰褰曚綅缃
+ +## 渚嬪瓙3 LuaFunction +灞曠ず浜嗗浣曡皟鐢╨ua鐨勫嚱鏁, 涓昏浠g爜濡備笅: +``` csharp + private string script = + @" function luaFunc(num) + return num + 1 + end + + test = {} + test.luaFunc = luaFunc + "; + + LuaFunction luaFunc = null; + LuaState lua = null; + + void Start () + { + new LuaResLoader(); + lua = new LuaState(); + lua.Start(); + DelegateFactory.Init(); + lua.DoString(script); + + //Get the function object + luaFunc = lua.GetFunction("test.luaFunc"); + + if (func != null) + { + int num = luaFunc.Invoke(123456); + Debugger.Log("generic call return: {0}", num); + + num = CallFunc(); + Debugger.Log("expansion call return: {0}", num); + + Func Func = luaFunc.ToDelegate>(); + num = Func(123456); + Debugger.Log("Delegate call return: {0}", num); + + num = lua.Invoke("test.luaFunc", 123456, true); + Debugger.Log("luastate call return: {0}", num); + } + + lua.CheckTop(); + } + + void OnDestroy() + { + if (luaFunc != null) + { + luaFunc.Dispose(); + luaFunc = null; + } + + lua.Dispose(); + lua = null; + } + + int CallFunc() + { + luaFunc.BeginPCall(); + luaFunc.Push(123456); + luaFunc.PCall(); + int num = (int)luaFunc.CheckNumber(); + luaFunc.EndPCall(); + return num; + } +``` +tolua# 绠鍖栦簡lua鍑芥暟鐨勬搷浣滐紝閫氳繃LuaFunction灏佽(骞剁紦瀛)涓涓猯ua鍑芥暟锛屽苟鎻愪緵鍚勭鎿嶄綔, 寤鸿棰戠箒璋冪敤鍑芥暟浣跨敤鏃燝C鏂瑰紡銆
+* LuaState.GetLuaFunction 鑾峰彇骞剁紦瀛樹竴涓猯ua鍑芥暟, 姝ゅ嚱鏁版敮鎸佷覆寮忔搷浣, 濡"test.luaFunc"浠h〃test琛ㄤ腑鐨刲uaFunc鍑芥暟銆
+* LuaState.Invoke 涓存椂璋冪敤涓涓猯ua function骞惰繑鍥炰竴涓硷紝杩欎釜鎿嶄綔骞朵笉缂撳瓨lua function锛岄傚悎棰戠巼闈炲父浣庣殑鍑芥暟璋冪敤銆
+* LuaFunction.Call() 涓嶉渶瑕佽繑鍥炲肩殑鍑芥暟璋冪敤鎿嶄綔
+* LuaFunction.Invoke() 鏈変竴涓繑鍥炲肩殑鍑芥暟璋冪敤鎿嶄綔
+* LuaFunction.BeginPCall() 寮濮嬪嚱鏁拌皟鐢
+* LuaFunction.Push() 鍘嬪叆鍑芥暟璋冪敤闇瑕佺殑鍙傛暟锛岄氳繃浼楀鐨勯噸杞藉嚱鏁版潵瑙e喅鍙傛暟杞崲gc闂
+* LuaFunction.PCall() 璋冪敤lua鍑芥暟
+* LuaFunction.CheckNumber() 鎻愬彇鍑芥暟杩斿洖鍊, 骞舵鏌ヨ繑鍥炲间负lua number绫诲瀷
+* LuaFunction.EndPCall() 缁撴潫lua鍑芥暟璋冪敤, 娓呮鍑芥暟璋冪敤閫犳垚鐨勫爢鏍堝彉鍖
+* LuaFunction.Dispose() 閲婃斁LuaFunction, 閫掑噺寮曠敤璁℃暟锛屽鏋滃紩鐢ㄨ鏁颁负0, 鍒欎粠_R琛ㄥ垹闄よ鍑芥暟
+ +> **娉ㄦ剰:** 鏃犺Call杩樻槸PCall鍙浉褰撲簬lua涓殑鍑芥暟'.'璋冪敤銆
+璇锋敞鎰':'杩欑璇硶绯 self:call(...) == self.call(self, ...锛
+c# 涓渶瑕佹寜鍚庨潰鏂瑰紡璋冪敤, 鍗冲繀椤讳富鍔ㄤ紶鍏ョ涓涓弬鏁皊elf
+ +## 渚嬪瓙4 +灞曠ず浜嗗浣曡闂甽ua涓彉閲忥紝table鐨勬搷浣 +``` csharp + private string script = + @" + print('Objs2Spawn is: '..Objs2Spawn) + var2read = 42 + varTable = {1,2,3,4,5} + varTable.default = 1 + varTable.map = {} + varTable.map.name = 'map' + + meta = {name = 'meta'} + setmetatable(varTable, meta) + + function TestFunc(strs) + print('get func by variable') + end + "; + + void Start () + { + new LuaResLoader(); + LuaState lua = new LuaState(); + lua.Start(); + lua["Objs2Spawn"] = 5; + lua.DoString(script); + + //閫氳繃LuaState璁块棶 + Debugger.Log("Read var from lua: {0}", lua["var2read"]); + Debugger.Log("Read table var from lua: {0}", lua["varTable.default"]); //LuaState 鎷嗕覆寮弔able + + LuaFunction func = lua["TestFunc"] as LuaFunction; + func.Call(); + func.Dispose(); + + //cache鎴怢uaTable杩涜璁块棶 + LuaTable table = lua.GetTable("varTable"); + Debugger.Log("Read varTable from lua, default: {0} name: {1}", table["default"], table["map.name"]); + table["map.name"] = "new"; //table 瀛楃涓插彧鑳芥槸key + Debugger.Log("Modify varTable name: {0}", table["map.name"]); + + table.AddTable("newmap"); + LuaTable table1 = (LuaTable)table["newmap"]; + table1["name"] = "table1"; + Debugger.Log("varTable.newmap name: {0}", table1["name"]); + table1.Dispose(); + + table1 = table.GetMetaTable(); + + if (table1 != null) + { + Debugger.Log("varTable metatable name: {0}", table1["name"]); + } + + object[] list = table.ToArray(); + + for (int i = 0; i < list.Length; i++) + { + Debugger.Log("varTable[{0}], is {1}", i, list[i]); + } + + table.Dispose(); + lua.CheckTop(); + lua.Dispose(); + } +``` +* luaState["Objs2Spawn"] LuaState閫氳繃閲嶈浇this鎿嶄綔绗︼紝璁块棶lua _G琛ㄤ腑鐨勫彉閲廜bjs2Spawn
+* LuaState.GetTable 浠巐ua涓幏鍙栦竴涓猯ua table, 鍙互涓插紡璁块棶姣斿lua.GetTable("varTable.map.name") 绛変簬 varTable->map->name
+* LuaTable 鏀寔this鎿嶄綔绗︼紝浣嗘this涓嶆敮鎸佷覆寮忚闂傛瘮濡倀able["map.name"] "map.name" 鍙槸涓涓猭ey锛屼笉鏄痶able->map->name
+* LuaTable.GetMetaTable() 鍙互鑾峰彇褰撳墠table鐨刴etatable
+* LuaTable.ToArray() 鑾峰彇鏁扮粍琛ㄤ腑鐨勬墍鏈夊璞″瓨鍏ュ埌object[]琛ㄤ腑
+* LuaTable.AddTable(name) 鍦ㄥ綋鍓嶇殑table琛ㄤ腑娣诲姞涓涓悕瀛椾负name鐨勮〃
+* LuaTable.GetTable(key) 鑾峰彇t[key]鍊煎埌c#, 绫讳技浜 lua_gettable
+* LuaTable.SetTable(key, value) 绛変环浜巘[k] = v鐨勬搷浣, 绫讳技浜巐ua_settable
+* LuaTable.RawGet(key) 鑾峰彇t[key]鍊煎埌c#, 绫讳技浜 lua_rawget
+* LuaTable.RawSet(key, value) 绛変环浜巘[k] = v鐨勬搷浣, 绫讳技浜巐ua_rawset
+ +## 渚嬪瓙5 鍗忓悓涓 +灞曠ず浜嗗浣曚娇鐢╨ua鍗忓悓, lua 浠g爜濡備笅锛 +``` lua + function fib(n) + local a, b = 0, 1 + while n > 0 do + a, b = b, a + b + n = n - 1 + end + + return a + end + + function CoFunc() + print('Coroutine started') + for i = 1, 10, 1 do + print(fib(i)) + coroutine.wait(0.1) + end + print("current frameCount: "..Time.frameCount) + coroutine.step() + print("yield frameCount: "..Time.frameCount) + + local www = UnityEngine.WWW("http://www.baidu.com") + coroutine.www(www) + local s = tolua.tolstring(www.bytes) + print(s:sub(1, 128)) + print('Coroutine ended') + end + + function TestCortinue() + coroutine.start(CoFunc) + end + + local coDelay = nil + + function Delay() + local c = 1 + + while true do + coroutine.wait(1) + print("Count: "..c) + c = c + 1 + end + end + + function StartDelay() + coDelay = coroutine.start(Delay) + end + + function StopDelay() + coroutine.stop(coDelay) + end +``` +c#浠g爜濡備笅: +``` csharp + new LuaResLoader(); + lua = new LuaState(); + lua.Start(); + LuaBinder.Bind(lua); + DelegateFactory.Init(); + looper = gameObject.AddComponent(); + looper.luaState = lua; + + lua.DoString(luaFile.text, "TestLuaCoroutine.lua"); + LuaFunction f = lua.GetFunction("TestCortinue"); + f.Call(); + f.Dispose(); + f = null; +``` +* 蹇呴』鍚姩LuaLooper椹卞姩鍗忓悓锛岃繖閲屽皢涓涓猯ua鐨勫崐鍙屽伐鍗忓悓瑁呮崲涓虹被浼紆nity鐨勫叏鍙屽伐鍗忓悓
+* fib鍑芥暟璐熻矗璁$畻涓涓枑閭f尝濂憂
+* coroutine.start 鍚姩涓涓猯ua鍗忓悓
+* coroutine.wait 鍗忓悓涓瓑寰呬竴娈垫椂闂达紝鍗曚綅:绉
+* coroutine.step 鍗忓悓涓瓑寰呬竴甯.
+* coroutine.www 绛夊緟涓涓猈WW瀹屾垚.
+* tolua.tolstring 杞崲byte鏁扮粍涓簂ua瀛楃涓茬紦鍐
+* coroutine.stop 鍋滄涓涓鍦╨ua灏嗚鎵ц鐨勫崗鍚
\ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Examples/README.md.meta b/Assets/LuaFramework/ToLua/Examples/README.md.meta new file mode 100644 index 0000000000000000000000000000000000000000..304cf73ede9b331885c98e1dbb4c090d5050286f --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/README.md.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 9efe91d34eaff5a4ab3530e47ea50385 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/Resources.meta b/Assets/LuaFramework/ToLua/Examples/Resources.meta new file mode 100644 index 0000000000000000000000000000000000000000..4a326d6203ccca644eca1cf3728fc40c2df95a00 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/Resources.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: cd85633be4068ee4b8d8f4744a4a9386 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/Resources/Lua.meta b/Assets/LuaFramework/ToLua/Examples/Resources/Lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..fb3bb8850ba617840952a69404fd77da9411550f --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/Resources/Lua.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: d26bf1a8a6d42954eb332fd9957140d1 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/Resources/Lua/Protol.meta b/Assets/LuaFramework/ToLua/Examples/Resources/Lua/Protol.meta new file mode 100644 index 0000000000000000000000000000000000000000..3f8cccaa851030d3dfd3270c5035b356152bfcf3 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/Resources/Lua/Protol.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 0882b1dfb9d5f9e408ec017206a4946a +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/Resources/Lua/Protol/common_pb.lua.bytes b/Assets/LuaFramework/ToLua/Examples/Resources/Lua/Protol/common_pb.lua.bytes new file mode 100644 index 0000000000000000000000000000000000000000..0f01982743305c8cb58941f2fd0f45b0d1bf4ff6 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/Resources/Lua/Protol/common_pb.lua.bytes @@ -0,0 +1,38 @@ +--Generated By protoc-gen-lua Do not Edit +local protobuf = require "protobuf.protobuf" +module('Protol.common_pb') + +HEADER = protobuf.Descriptor(); +HEADER_CMD_FIELD = protobuf.FieldDescriptor(); +HEADER_SEQ_FIELD = protobuf.FieldDescriptor(); + +HEADER_CMD_FIELD.name = "cmd" +HEADER_CMD_FIELD.full_name = ".Header.cmd" +HEADER_CMD_FIELD.number = 1 +HEADER_CMD_FIELD.index = 0 +HEADER_CMD_FIELD.label = 2 +HEADER_CMD_FIELD.has_default_value = false +HEADER_CMD_FIELD.default_value = 0 +HEADER_CMD_FIELD.type = 5 +HEADER_CMD_FIELD.cpp_type = 1 + +HEADER_SEQ_FIELD.name = "seq" +HEADER_SEQ_FIELD.full_name = ".Header.seq" +HEADER_SEQ_FIELD.number = 2 +HEADER_SEQ_FIELD.index = 1 +HEADER_SEQ_FIELD.label = 2 +HEADER_SEQ_FIELD.has_default_value = false +HEADER_SEQ_FIELD.default_value = 0 +HEADER_SEQ_FIELD.type = 5 +HEADER_SEQ_FIELD.cpp_type = 1 + +HEADER.name = "Header" +HEADER.full_name = ".Header" +HEADER.nested_types = {} +HEADER.enum_types = {} +HEADER.fields = {HEADER_CMD_FIELD, HEADER_SEQ_FIELD} +HEADER.is_extendable = false +HEADER.extensions = {} + +Header = protobuf.Message(HEADER) + diff --git a/Assets/LuaFramework/ToLua/Examples/Resources/Lua/Protol/common_pb.lua.bytes.meta b/Assets/LuaFramework/ToLua/Examples/Resources/Lua/Protol/common_pb.lua.bytes.meta new file mode 100644 index 0000000000000000000000000000000000000000..e7d8aef34c6190e806c171b70c8b90da0915e3cb --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/Resources/Lua/Protol/common_pb.lua.bytes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: dae780f9dbb4a634bbc8605c0cd7bd13 +timeCreated: 1498123941 +licenseType: Pro +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Examples/Resources/Lua/Protol/person_pb.lua.bytes b/Assets/LuaFramework/ToLua/Examples/Resources/Lua/Protol/person_pb.lua.bytes new file mode 100644 index 0000000000000000000000000000000000000000..a4a870a6598500b814f3a600e6d8ea4a5b9c9c99 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/Resources/Lua/Protol/person_pb.lua.bytes @@ -0,0 +1,141 @@ +--Generated By protoc-gen-lua Do not Edit +local protobuf = require "protobuf.protobuf" +local common_pb = require("Protol.common_pb") +module('Protol.person_pb') + +PERSON = protobuf.Descriptor(); +PERSON_HEADER_FIELD = protobuf.FieldDescriptor(); +PERSON_ID_FIELD = protobuf.FieldDescriptor(); +PERSON_NAME_FIELD = protobuf.FieldDescriptor(); +PERSON_AGE_FIELD = protobuf.FieldDescriptor(); +PERSON_EMAIL_FIELD = protobuf.FieldDescriptor(); +PERSON_ARRAY_FIELD = protobuf.FieldDescriptor(); +PHONE = protobuf.Descriptor(); +PHONE_PHONE_TYPE = protobuf.EnumDescriptor(); +PHONE_PHONE_TYPE_MOBILE_ENUM = protobuf.EnumValueDescriptor(); +PHONE_PHONE_TYPE_HOME_ENUM = protobuf.EnumValueDescriptor(); +PHONE_NUM_FIELD = protobuf.FieldDescriptor(); +PHONE_TYPE_FIELD = protobuf.FieldDescriptor(); +PHONE_PHONES_FIELD = protobuf.FieldDescriptor(); + +PERSON_HEADER_FIELD.name = "header" +PERSON_HEADER_FIELD.full_name = ".Person.header" +PERSON_HEADER_FIELD.number = 1 +PERSON_HEADER_FIELD.index = 0 +PERSON_HEADER_FIELD.label = 2 +PERSON_HEADER_FIELD.has_default_value = false +PERSON_HEADER_FIELD.default_value = nil +PERSON_HEADER_FIELD.message_type = common_pb.HEADER +PERSON_HEADER_FIELD.type = 11 +PERSON_HEADER_FIELD.cpp_type = 10 + +PERSON_ID_FIELD.name = "id" +PERSON_ID_FIELD.full_name = ".Person.id" +PERSON_ID_FIELD.number = 2 +PERSON_ID_FIELD.index = 1 +PERSON_ID_FIELD.label = 2 +PERSON_ID_FIELD.has_default_value = false +PERSON_ID_FIELD.default_value = 0 +PERSON_ID_FIELD.type = 3 +PERSON_ID_FIELD.cpp_type = 2 + +PERSON_NAME_FIELD.name = "name" +PERSON_NAME_FIELD.full_name = ".Person.name" +PERSON_NAME_FIELD.number = 3 +PERSON_NAME_FIELD.index = 2 +PERSON_NAME_FIELD.label = 2 +PERSON_NAME_FIELD.has_default_value = false +PERSON_NAME_FIELD.default_value = "" +PERSON_NAME_FIELD.type = 9 +PERSON_NAME_FIELD.cpp_type = 9 + +PERSON_AGE_FIELD.name = "age" +PERSON_AGE_FIELD.full_name = ".Person.age" +PERSON_AGE_FIELD.number = 4 +PERSON_AGE_FIELD.index = 3 +PERSON_AGE_FIELD.label = 1 +PERSON_AGE_FIELD.has_default_value = true +PERSON_AGE_FIELD.default_value = 18 +PERSON_AGE_FIELD.type = 5 +PERSON_AGE_FIELD.cpp_type = 1 + +PERSON_EMAIL_FIELD.name = "email" +PERSON_EMAIL_FIELD.full_name = ".Person.email" +PERSON_EMAIL_FIELD.number = 5 +PERSON_EMAIL_FIELD.index = 4 +PERSON_EMAIL_FIELD.label = 1 +PERSON_EMAIL_FIELD.has_default_value = true +PERSON_EMAIL_FIELD.default_value = "topameng@qq.com" +PERSON_EMAIL_FIELD.type = 9 +PERSON_EMAIL_FIELD.cpp_type = 9 + +PERSON_ARRAY_FIELD.name = "array" +PERSON_ARRAY_FIELD.full_name = ".Person.array" +PERSON_ARRAY_FIELD.number = 6 +PERSON_ARRAY_FIELD.index = 5 +PERSON_ARRAY_FIELD.label = 3 +PERSON_ARRAY_FIELD.has_default_value = false +PERSON_ARRAY_FIELD.default_value = {} +PERSON_ARRAY_FIELD.type = 5 +PERSON_ARRAY_FIELD.cpp_type = 1 + +PERSON.name = "Person" +PERSON.full_name = ".Person" +PERSON.nested_types = {} +PERSON.enum_types = {} +PERSON.fields = {PERSON_HEADER_FIELD, PERSON_ID_FIELD, PERSON_NAME_FIELD, PERSON_AGE_FIELD, PERSON_EMAIL_FIELD, PERSON_ARRAY_FIELD} +PERSON.is_extendable = true +PERSON.extensions = {} +PHONE_PHONE_TYPE_MOBILE_ENUM.name = "MOBILE" +PHONE_PHONE_TYPE_MOBILE_ENUM.index = 0 +PHONE_PHONE_TYPE_MOBILE_ENUM.number = 1 +PHONE_PHONE_TYPE_HOME_ENUM.name = "HOME" +PHONE_PHONE_TYPE_HOME_ENUM.index = 1 +PHONE_PHONE_TYPE_HOME_ENUM.number = 2 +PHONE_PHONE_TYPE.name = "PHONE_TYPE" +PHONE_PHONE_TYPE.full_name = ".Phone.PHONE_TYPE" +PHONE_PHONE_TYPE.values = {PHONE_PHONE_TYPE_MOBILE_ENUM,PHONE_PHONE_TYPE_HOME_ENUM} +PHONE_NUM_FIELD.name = "num" +PHONE_NUM_FIELD.full_name = ".Phone.num" +PHONE_NUM_FIELD.number = 1 +PHONE_NUM_FIELD.index = 0 +PHONE_NUM_FIELD.label = 1 +PHONE_NUM_FIELD.has_default_value = false +PHONE_NUM_FIELD.default_value = "" +PHONE_NUM_FIELD.type = 9 +PHONE_NUM_FIELD.cpp_type = 9 + +PHONE_TYPE_FIELD.name = "type" +PHONE_TYPE_FIELD.full_name = ".Phone.type" +PHONE_TYPE_FIELD.number = 2 +PHONE_TYPE_FIELD.index = 1 +PHONE_TYPE_FIELD.label = 1 +PHONE_TYPE_FIELD.has_default_value = false +PHONE_TYPE_FIELD.default_value = nil +PHONE_TYPE_FIELD.enum_type = PHONE_PHONE_TYPE +PHONE_TYPE_FIELD.type = 14 +PHONE_TYPE_FIELD.cpp_type = 8 + +PHONE_PHONES_FIELD.name = "phones" +PHONE_PHONES_FIELD.full_name = ".Phone.phones" +PHONE_PHONES_FIELD.number = 10 +PHONE_PHONES_FIELD.index = 0 +PHONE_PHONES_FIELD.label = 3 +PHONE_PHONES_FIELD.has_default_value = false +PHONE_PHONES_FIELD.default_value = {} +PHONE_PHONES_FIELD.message_type = PHONE +PHONE_PHONES_FIELD.type = 11 +PHONE_PHONES_FIELD.cpp_type = 10 + +PHONE.name = "Phone" +PHONE.full_name = ".Phone" +PHONE.nested_types = {} +PHONE.enum_types = {PHONE_PHONE_TYPE} +PHONE.fields = {PHONE_NUM_FIELD, PHONE_TYPE_FIELD} +PHONE.is_extendable = false +PHONE.extensions = {PHONE_PHONES_FIELD} + +Person = protobuf.Message(PERSON) +Phone = protobuf.Message(PHONE) + +Person.RegisterExtension(PHONE_PHONES_FIELD) diff --git a/Assets/LuaFramework/ToLua/Examples/Resources/Lua/Protol/person_pb.lua.bytes.meta b/Assets/LuaFramework/ToLua/Examples/Resources/Lua/Protol/person_pb.lua.bytes.meta new file mode 100644 index 0000000000000000000000000000000000000000..6532d208f433cec1fbeca0a2359bd9337074ddc6 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/Resources/Lua/Protol/person_pb.lua.bytes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9a5684e0e56583c43b809876b457c953 +timeCreated: 1498113766 +licenseType: Pro +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Examples/Resources/Lua/TestErrorStack.lua.bytes b/Assets/LuaFramework/ToLua/Examples/Resources/Lua/TestErrorStack.lua.bytes new file mode 100644 index 0000000000000000000000000000000000000000..ecde5a07742041606f89752140a769ca8dab289e --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/Resources/Lua/TestErrorStack.lua.bytes @@ -0,0 +1,102 @@ +function Show() + error('this is error') +end + +function ShowStack(go) + TestStack.Test1(go) +end + +function Instantiate(obj) + local go = UnityEngine.Object.Instantiate(obj) + print(go.name) +end + +function TestRay(ray) + return Vector3.zero +end + +function PushLuaError() + TestStack.PushLuaError() +end + +function Test3() + TestStack.Test3() +end + +function Test4() + TestStack.Test4() +end + +function Test5() + TestStack.Test5() +end + +function SendMsgError(go) + go:SendMessage("OnSendMsg"); +end + +function resume(co, ...) + local r, msg = nil + local func = function(...) + r, msg = coroutine.resume(co, ...) + + if not r then + print('xxxxxxxxxxxxxxxxxxxxxx') + error(msg) + end + end + + pcall(func, ...) + return r, msg +end + +function Test6() + print('--------------------------') + --TestStack.Test6() + local co = coroutine.create(function() coroutine.yield() print('hahahahaha') TestStack.Test6(go) end) + coroutine.resume(co) + local r, msg = coroutine.resume(co) + print('go error') + print(msg) + print('--------------------------') +end + +function Test8() + TestArgError('123') +end + +_event = +{ + name = 'event' +} + +_event.__index = function(t, k) + return rawget(_event, k) +end + +setmetatable(_event, _event) + +function _event:Add(func, obj) + print('xxxxxxxxxxxxxxxxxxxxxxxxxx') +end + +_event.__call = function() + +end + +testev = {} +setmetatable(testev, _event) + +function TestCo(...) + local name = TestTableInCo(...) + print("table.name is: "..name) +end + +function TestCoTable() + local co = coroutine.create(TestCo) + local r, msg = coroutine.resume(co, testev) + + if not r then + print("TestCoTable: "..msg) + end +end \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Examples/Resources/Lua/TestErrorStack.lua.bytes.meta b/Assets/LuaFramework/ToLua/Examples/Resources/Lua/TestErrorStack.lua.bytes.meta new file mode 100644 index 0000000000000000000000000000000000000000..50181588cc492cc084ac931eeaa5daa553201abe --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/Resources/Lua/TestErrorStack.lua.bytes.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: a540e20118516b1449b2bb6293d1030a +TextScriptImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/Resources/Lua/TestLoader.lua.bytes b/Assets/LuaFramework/ToLua/Examples/Resources/Lua/TestLoader.lua.bytes new file mode 100644 index 0000000000000000000000000000000000000000..c7772d65bf5f8f775b7633af65058f14792b823b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/Resources/Lua/TestLoader.lua.bytes @@ -0,0 +1,6 @@ +print("This is a script from a utf8 file") +print("tolua: 浣犲ソ! 銇撱倱銇仭銇! 鞎堧厱頃橃劯鞖!") + +function Test() + print("this is lua file load by Resource.Load") +end \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Examples/Resources/Lua/TestLoader.lua.bytes.meta b/Assets/LuaFramework/ToLua/Examples/Resources/Lua/TestLoader.lua.bytes.meta new file mode 100644 index 0000000000000000000000000000000000000000..0755e404d3da804eecd7cc504f6afe26deb70ce6 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/Resources/Lua/TestLoader.lua.bytes.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: d249a195df84a8e448b95867fdc844df +TextScriptImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/Resources/Lua/TestLuaCoroutine.lua.bytes b/Assets/LuaFramework/ToLua/Examples/Resources/Lua/TestLuaCoroutine.lua.bytes new file mode 100644 index 0000000000000000000000000000000000000000..9a24ae80290ac63f4c1cfdcadff1361c4a90b95d --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/Resources/Lua/TestLuaCoroutine.lua.bytes @@ -0,0 +1,50 @@ +function fib(n) + local a, b = 0, 1 + while n > 0 do + a, b = b, a + b + n = n - 1 + end + + return a +end + +function CoFunc() + print('Coroutine started') + for i = 0, 10, 1 do + print(fib(i)) + coroutine.wait(0.1) + end + print("current frameCount: "..Time.frameCount) + coroutine.step() + print("yield frameCount: "..Time.frameCount) + + local www = UnityEngine.WWW("http://www.baidu.com") + coroutine.www(www) + local s = tolua.tolstring(www.bytes) + print(s:sub(1, 128)) + print('Coroutine ended') +end + +function TestCortinue() + coroutine.start(CoFunc) +end + +local coDelay = nil + +function Delay() + local c = 1 + + while true do + coroutine.wait(1) + print("Count: "..c) + c = c + 1 + end +end + +function StartDelay() + coDelay = coroutine.start(Delay) +end + +function StopDelay() + coroutine.stop(coDelay) +end diff --git a/Assets/LuaFramework/ToLua/Examples/Resources/Lua/TestLuaCoroutine.lua.bytes.meta b/Assets/LuaFramework/ToLua/Examples/Resources/Lua/TestLuaCoroutine.lua.bytes.meta new file mode 100644 index 0000000000000000000000000000000000000000..f25a534451ba9f715c8aa7a90af6e08ed8d103d1 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/Resources/Lua/TestLuaCoroutine.lua.bytes.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 3e90f8f033d17114297577d8cde2677e +TextScriptImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/Resources/Lua/TestPerf.lua.bytes b/Assets/LuaFramework/ToLua/Examples/Resources/Lua/TestPerf.lua.bytes new file mode 100644 index 0000000000000000000000000000000000000000..62801c1437f1482a66687d8c6655eeaa940f8c0c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/Resources/Lua/TestPerf.lua.bytes @@ -0,0 +1,141 @@ +local Vector3 = Vector3 +local Quaternion = Quaternion +local Normalize = Vector3.Normalize +--local verbo = require("jit.v") +--verbo.start() + +function Test1(transform) + local one = Vector3.one + local t = os.clock() + + for i = 1,200000 do + transform.position = transform.position + end + + t = os.clock() - t + print("Transform.position lua cost time: ", t) +end + +function Test2(transform) + local up = Vector3.up + local t = os.clock() + + for i = 1,200000 do + transform:Rotate(up, 1) + end + + t = os.clock() - t + print("Transform.Rotate lua cost time: ", t) +end + +function Test3() + local t = os.clock() + local New = Vector3.New + + for i = 1, 200000 do + local v = New(i, i, i) + end + + t = os.clock() - t + print("Vector3.New lua cost time: ", t) +end + +--浼氬瓨鍦ㄥぇ閲廹c鎿嶄綔 +function Test4() + local GameObject = UnityEngine.GameObject + local t = os.clock() + local go = GameObject.New() + local node = go.transform + + for i = 1,100000 do + --GameObject.New() + go = node.gameObject + end + + t = os.clock() - t + print("GameObject.New lua cost time: ", t) +end + +function Test5() + local t = os.clock() + local GameObject = UnityEngine.GameObject + local SkinnedMeshRenderer = UnityEngine.SkinnedMeshRenderer + local tp = typeof(SkinnedMeshRenderer) + + for i = 1,20000 do + local go = GameObject.New() + go:AddComponent(tp) + local c = go:GetComponent(tp) + c.castShadows=false + c.receiveShadows=false + end + + print("Test5 lua cost time: ", os.clock() - t) +end + +function Test6() + local t = os.clock() + + for i = 1,200000 do + local t = Input.GetTouch(0) + local p = Input.mousePosition + --Physics.RayCast + end + + print("lua cost time: ", os.clock() - t) +end + +function Test7() + local Vector3 = Vector3 + local t = os.clock() + + for i = 1, 200000 do + local v = Vector3.New(i,i,i) + Vector3.Normalize(v) + end + + print("lua Vector3 New Normalize cost time: ", os.clock() - t) +end + +function Test8() + local Quaternion = Quaternion + local t = os.clock() + + for i=1,200000 do + local q1 = Quaternion.Euler(i, i, i) + local q2 = Quaternion.Euler(i * 2, i * 2, i * 2) + Quaternion.Slerp(Quaternion.identity, q1, 0.5) + end + + print("Quaternion Euler Slerp const: ", os.clock() - t) +end + +function Test9() + local total = 0 + local t = os.clock() + + for i = 0, 1000000 do + total = total + i - (i/2) * (i + 3) / (i + 5) + end + + print("math cal cost: ", os.clock() - t) +end + +function TestTable() + local array = {} + + for i = 1, 1024 do + array[i] = i + end + + local total = 0 + local t = os.clock() + + for j = 1, 100000 do + for i = 1, 1024 do + total = total + array[i] + end + end + + print("Array cost time: ", os.clock() - t) +end diff --git a/Assets/LuaFramework/ToLua/Examples/Resources/Lua/TestPerf.lua.bytes.meta b/Assets/LuaFramework/ToLua/Examples/Resources/Lua/TestPerf.lua.bytes.meta new file mode 100644 index 0000000000000000000000000000000000000000..44fbcac18a5913f313f6d2336b82ab5104ed7345 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/Resources/Lua/TestPerf.lua.bytes.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 07657567fb0a4fe439b7e52f48d787e1 +TextScriptImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/Resources/Lua/ToLuaInjectionTestInjector.lua.bytes b/Assets/LuaFramework/ToLua/Examples/Resources/Lua/ToLuaInjectionTestInjector.lua.bytes new file mode 100644 index 0000000000000000000000000000000000000000..65f797406dbcf66e844527e0f95544a860f956fa --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/Resources/Lua/ToLuaInjectionTestInjector.lua.bytes @@ -0,0 +1,150 @@ +local ToLuaInjectionTestInjector = {} + +--ToLuaInjectionTestInjector[".ctor"] = function() + --璇锋敞鎰廡oLuaInjection.cs涓殑injectIgnoring瀛楁宸茬粡榛樿杩囨护鎺変簡Constructor锛屽鏋滆娴嬭瘯鏋勯犲嚱鏁扮殑娉ㄥ叆锛岃鍘绘帀InjectFilter.IgnoreConstructor杩欎釜杩囨护椤 + -- Only After Does Matter + --return function(self) + -- print("Lua Inject Constructor") + --end, LuaInterface.InjectType.After + ------------------------------------------------------- + --return function(self) + -- print("Lua Inject Constructor") + --end, LuaInterface.InjectType.Before + ------------------------------------------------------- +--end + +--ToLuaInjectionTestInjector[".ctor_bool"] = function() + --璇锋敞鎰廡oLuaInjection.cs涓殑injectIgnoring瀛楁宸茬粡榛樿杩囨护鎺変簡Constructor锛屽鏋滆娴嬭瘯鏋勯犲嚱鏁扮殑娉ㄥ叆锛岃鍘绘帀InjectFilter.IgnoreConstructor杩欎釜杩囨护椤 + -- Only After Does Matter + --return function(self, state) + -- print("Lua Inject Constructor_bool " .. tostring(state)) + --end, LuaInterface.InjectType.After +--end + +ToLuaInjectionTestInjector.set_PropertyTest = function() + return function (self, value) + print("Lua Inject Property set :" .. value) + end, LuaInterface.InjectType.After + ------------------------------------------------------- + --return function (self, value) + -- print("Lua Inject Property set :") + -- return {3} + --end, LuaInterface.InjectType.Replace + ------------------------------------------------------- +end + +ToLuaInjectionTestInjector.get_PropertyTest = function() + return function (self) + print("Lua Inject Property get :") + end, LuaInterface.InjectType.After + ------------------------------------------------------- + --return function (self) + -- print("Lua Inject Property get :") + --end, LuaInterface.InjectType.Before + ------------------------------------------------------- + --return function (self) + -- print("Lua Inject Property get :") + -- return 2 + --end, LuaInterface.InjectType.Replace + ------------------------------------------------------- +end + +ToLuaInjectionTestInjector.TestRef = function() + --return function (self, count) + -- print("Lua Inject TestRef ") + -- count = 10 + -- return { count , 3} + --end, LuaInterface.InjectType.After + ------------------------------------------------------- + --return function (self, count) + -- print("Lua Inject TestRef ") + -- count = 10 + -- return { count , 3} + --end, LuaInterface.InjectType.ReplaceWithPreInvokeBase + ------------------------------------------------------- + return function (self, count) + print("Lua Inject TestRef ") + count = 10 + return { count , 3} + end, LuaInterface.InjectType.ReplaceWithPostInvokeBase + ------------------------------------------------------- + --return function (self, count) + -- print("Lua Inject TestRef ") + -- count = 10 + -- return { count , 3} + --end, LuaInterface.InjectType.Replace + ------------------------------------------------------- + --return function (self, count) + -- print("Lua Inject TestRef ") + -- count = 10 + -- return { count , 3} + --end, LuaInterface.InjectType.Before + ------------------------------------------------------- +end + +ToLuaInjectionTestInjector.TestOverload_int_bool = function() + return function (self, count, state) + print("Lua Inject TestOverload_int_bool " .. tostring(state)) + end, LuaInterface.InjectType.After +end + +ToLuaInjectionTestInjector["TestOverload_int_bool&"] = function() + --return function (self, param1, param2) + -- print("Lua Inject TestOverload_int_bool& ") + -- return {false} + --end, LuaInterface.InjectType.After + ------------------------------------------------------- + --return function (self, param1, param2) + -- print("Lua Inject TestOverload_int_bool& ") + -- return {false} + --end, LuaInterface.InjectType.Before + ------------------------------------------------------- + return function (self, param1, param2) + print("Lua Inject TestOverload_int_bool& ") + return {false} + end, LuaInterface.InjectType.Replace + ------------------------------------------------------- +end + +ToLuaInjectionTestInjector.TestOverload_bool_int = function() + return function (self, param1, param2) + print("Lua Inject TestOverload_bool_int " .. param2) + end, LuaInterface.InjectType.After +end + +ToLuaInjectionTestInjector.TestCoroutine = function() + return function (self, delay, coroutineState) + print("Lua Inject TestCoroutine " .. coroutineState) + end, LuaInterface.InjectType.After + ------------------------------------------------------- + --return function (self, delay) + -- return WrapLuaCoroutine(function() + -- print("Lua Inject TestCoroutine Pulse" .. delay) + -- return false + -- end) + --end, LuaInterface.InjectType.Replace + ------------------------------------------------------- + --return function (self, delay) + -- local state = true + -- local cor + -- local function StartLuaCoroutine() + -- if cor == nil then + -- cor = coroutine.start(function() + -- print("Lua Coroutine Before") + -- coroutine.wait(delay) + -- state = false + -- print("Lua Coroutine After") + -- end) + -- end + -- end + -- + -- return WrapLuaCoroutine(function() + -- StartLuaCoroutine() + -- return state + -- end) + --end, LuaInterface.InjectType.Replace + ------------------------------------------------------- +end + +--InjectByName("ToLuaInjectionTest", ToLuaInjectionTestInjector) +InjectByModule(ToLuaInjectionTest, ToLuaInjectionTestInjector) \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Examples/Resources/Lua/ToLuaInjectionTestInjector.lua.bytes.meta b/Assets/LuaFramework/ToLua/Examples/Resources/Lua/ToLuaInjectionTestInjector.lua.bytes.meta new file mode 100644 index 0000000000000000000000000000000000000000..e3eb4251256836bb15c52a57ff96fc129bc8d805 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/Resources/Lua/ToLuaInjectionTestInjector.lua.bytes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4d4ade31977a9ce4f92428e0889cee1d +timeCreated: 1515036182 +licenseType: Pro +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Examples/Resources/jsonexample.json b/Assets/LuaFramework/ToLua/Examples/Resources/jsonexample.json new file mode 100644 index 0000000000000000000000000000000000000000..42486cec024e7cc7c2393e93a43f65f897db559b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/Resources/jsonexample.json @@ -0,0 +1,22 @@ +{ + "glossary": { + "title": "example glossary", + "GlossDiv": { + "title": "S", + "GlossList": { + "GlossEntry": { + "ID": "SGML", + "SortAs": "SGML", + "GlossTerm": "Standard Generalized Mark up Language", + "Acronym": "SGML", + "Abbrev": "ISO 8879:1986", + "GlossDef": { + "para": "A meta-markup language, used to create markup languages such as DocBook.", + "GlossSeeAlso": ["GML", "XML"] + }, + "GlossSee": "markup" + } + } + } + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/Resources/jsonexample.json.meta b/Assets/LuaFramework/ToLua/Examples/Resources/jsonexample.json.meta new file mode 100644 index 0000000000000000000000000000000000000000..dedc9a2b20ff3ada5b58374067b75751aad46dfe --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/Resources/jsonexample.json.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 7d7edaf98b78bd84297bb888bf41ed02 +TextScriptImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/TestErrorStack.meta b/Assets/LuaFramework/ToLua/Examples/TestErrorStack.meta new file mode 100644 index 0000000000000000000000000000000000000000..643b48e69e51fcea445f855257e340531638aaff --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestErrorStack.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 00b15eee8aab8d64e844fc53ee7395de +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestInstantiate.cs b/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestInstantiate.cs new file mode 100644 index 0000000000000000000000000000000000000000..b36a7fad39b49924c2cfb1f067f9a87886fde1df --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestInstantiate.cs @@ -0,0 +1,30 @@ +锘縰sing UnityEngine; +using System; +using LuaInterface; + +public class TestInstantiate : MonoBehaviour +{ + void Awake() + { + LuaState state = LuaState.Get(IntPtr.Zero); + + try + { + LuaFunction func = state.GetFunction("Show"); + func.BeginPCall(); + func.PCall(); + func.EndPCall(); + func.Dispose(); + func = null; + } + catch (Exception e) + { + state.ThrowLuaException(e); + } + } + + void Start() + { + Debugger.Log("start"); + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestInstantiate.cs.meta b/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestInstantiate.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..f8609b16d257c8df660ec981224b7e7153c27b9c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestInstantiate.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b3f31488b17b6394f8cc6e000f1001ab +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestInstantiate.prefab b/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestInstantiate.prefab new file mode 100644 index 0000000000000000000000000000000000000000..5c24551dc872ce768354516fff4dd8803b646869 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestInstantiate.prefab @@ -0,0 +1,52 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &176158 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 4: {fileID: 476158} + - 114: {fileID: 11499294} + m_Layer: 0 + m_Name: TestInstantiate + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &476158 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 176158} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!114 &11499294 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 176158} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b3f31488b17b6394f8cc6e000f1001ab, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 176158} + m_IsPrefabParent: 1 diff --git a/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestInstantiate.prefab.meta b/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestInstantiate.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..20bacfeaa7b055c466d3294593c2accbb962891c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestInstantiate.prefab.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: ec8a2f7e4eaf1c64e8393014e602047c +NativeFormatImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestInstantiate2.cs b/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestInstantiate2.cs new file mode 100644 index 0000000000000000000000000000000000000000..2c17ef4382cd0cacbaca310e1319aa563effb2b1 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestInstantiate2.cs @@ -0,0 +1,19 @@ +锘縰sing UnityEngine; +using System; +using LuaInterface; + +public class TestInstantiate2 : MonoBehaviour +{ + void Awake() + { + try + { + throw new Exception("Instantiate exception 2"); + } + catch (Exception e) + { + LuaState state = LuaState.Get(IntPtr.Zero); + state.ThrowLuaException(e); + } + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestInstantiate2.cs.meta b/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestInstantiate2.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..03f82c87ca5bee8afd778769fe9b4a245156b19e --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestInstantiate2.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 901668bc322ed714d9c7c74febc9bd8b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestInstantiate2.prefab b/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestInstantiate2.prefab new file mode 100644 index 0000000000000000000000000000000000000000..a2f6b957db17f1545f3a4cf61bf7451274c5ee4f --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestInstantiate2.prefab @@ -0,0 +1,52 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &176158 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 4: {fileID: 476158} + - 114: {fileID: 11499294} + m_Layer: 0 + m_Name: TestInstantiate2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &476158 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 176158} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!114 &11499294 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 176158} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 901668bc322ed714d9c7c74febc9bd8b, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 176158} + m_IsPrefabParent: 1 diff --git a/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestInstantiate2.prefab.meta b/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestInstantiate2.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..204d0c223ba37118005a535f1d110533f74a6faa --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestInstantiate2.prefab.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 0e472cc047eb20841bbb7c64dfeb0d78 +NativeFormatImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestLuaStack.cs b/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestLuaStack.cs new file mode 100644 index 0000000000000000000000000000000000000000..a491b73b3a2a5c4b4c048bd3b13fc8eeeb682355 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestLuaStack.cs @@ -0,0 +1,613 @@ +锘縰sing UnityEngine; +using System.Collections; +using LuaInterface; +using System; +using System.Runtime.InteropServices; + +//妫娴嬪悎鐞嗘姤閿 +public class TestLuaStack : MonoBehaviour +{ + public GameObject go = null; + public GameObject go2 = null; + public static LuaFunction show = null; + public static LuaFunction testRay = null; + public static LuaFunction showStack = null; + public static LuaFunction test4 = null; + + private static GameObject testGo = null; + private string tips = ""; + public static TestLuaStack Instance = null; + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Test1(IntPtr L) + { + try + { + show.BeginPCall(); + show.PCall(); + show.EndPCall(); + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + + return 0; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int PushLuaError(IntPtr L) + { + try + { + testRay.BeginPCall(); + testRay.Push(Instance); + testRay.PCall(); + testRay.EndPCall(); + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + + return 0; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Test3(IntPtr L) + { + try + { + testRay.BeginPCall(); + testRay.PCall(); + testRay.CheckRay(); + testRay.EndPCall(); + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + + return 0; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Test4(IntPtr L) + { + try + { + show.BeginPCall(); + show.PCall(); + show.EndPCall(); + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + + return 0; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Test5(IntPtr L) + { + try + { + test4.BeginPCall(); + test4.PCall(); + bool ret = test4.CheckBoolean(); + ret = !ret; + test4.EndPCall(); + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + + return 0; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Test6(IntPtr L) + { + try + { + throw new LuaException("this a lua exception"); + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TestOutOfBound(IntPtr L) + { + try + { + Transform transform = testGo.transform; + Transform node = transform.GetChild(20); + ToLua.Push(L, node); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TestArgError(IntPtr L) + { + try + { + LuaDLL.luaL_typerror(L, 1, "number"); + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + + return 0; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TestTableInCo(IntPtr L) + { + try + { + LuaTable table = ToLua.CheckLuaTable(L, 1); + string str = (string)table["name"]; + ToLua.Push(L, str); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TestCycle(IntPtr L) + { + try + { + LuaState state = LuaState.Get(L); + LuaFunction func = state.GetFunction("TestCycle"); + int c = (int)LuaDLL.luaL_checknumber(L, 1); + + if (c <= 2) + { + LuaDLL.lua_pushnumber(L, 1); + } + else + { + func.BeginPCall(); + func.Push(c - 1); + func.PCall(); + int n1 = (int)func.CheckNumber(); + func.EndPCall(); + + func.BeginPCall(); + func.Push(c - 2); + func.PCall(); + int n2 = (int)func.CheckNumber(); + func.EndPCall(); + + LuaDLL.lua_pushnumber(L, n1 + n2); + } + + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TestNull(IntPtr L) + { + try + { + GameObject go = (GameObject)ToLua.CheckObject(L, 1, typeof(GameObject)); + ToLua.Push(L, go.name); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TestAddComponent(IntPtr L) + { + try + { + GameObject go = (GameObject)ToLua.CheckObject(L, 1, typeof(GameObject)); + go.AddComponent(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + static void TestMul1() + { + throw new Exception("multi stack error"); + } + + static void TestMul0() + { + TestMul1(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TestMulStack(IntPtr L) + { + try + { + TestMul0(); + return 0; + } + catch (Exception e) + { + //Debugger.Log("xxxx" + e.StackTrace); + return LuaDLL.toluaL_exception(L, e); + } + } + + void OnSendMsg() + { + try + { + LuaFunction func = state.GetFunction("TestStack.Test6"); + func.BeginPCall(); + func.PCall(); + func.EndPCall(); + } + catch(Exception e) + { + state.ThrowLuaException(e); + } + } + + + LuaState state = null; + public TextAsset text = null; + + static Action TestDelegate = delegate { }; + + void Awake() + { +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived += ShowTips; +#else + Application.RegisterLogCallback(ShowTips); +#endif + Instance = this; + new LuaResLoader(); + testGo = gameObject; + state = new LuaState(); + state.Start(); + LuaBinder.Bind(state); + + state.BeginModule(null); + state.RegFunction("TestArgError", TestArgError); + state.RegFunction("TestTableInCo", TestTableInCo); + state.RegFunction("TestCycle", TestCycle); + state.RegFunction("TestNull", TestNull); + state.RegFunction("TestAddComponent", TestAddComponent); + state.RegFunction("TestOutOfBound", TestOutOfBound); + state.RegFunction("TestMulStack", TestMulStack); + state.BeginStaticLibs("TestStack"); + state.RegFunction("Test1", Test1); + state.RegFunction("PushLuaError", PushLuaError); + state.RegFunction("Test3", Test3); + state.RegFunction("Test4", Test4); + state.RegFunction("Test5", Test5); + state.RegFunction("Test6", Test6); + state.EndStaticLibs(); + state.EndModule(); + + //state.DoFile("TestErrorStack.lua"); + state.Require("TestErrorStack"); + show = state.GetFunction("Show"); + testRay = state.GetFunction("TestRay"); + + showStack = state.GetFunction("ShowStack"); + test4 = state.GetFunction("Test4"); + + TestDelegate += TestD1; + TestDelegate += TestD2; + } + + void Update() + { + state.CheckTop(); + } + + void OnApplicationQuit() + { +#if UNITY_5 || UNITY_2017 || UNITY_2018 + Application.logMessageReceived -= ShowTips; +#else + Application.RegisterLogCallback(null); +#endif + state.Dispose(); + state = null; + } + + void ShowTips(string msg, string stackTrace, LogType type) + { + tips += msg; + tips += "\r\n"; + + if (type == LogType.Error || type == LogType.Exception) + { + tips += stackTrace; + } + } + + void TestD1() + { + Debugger.Log("delegate 1"); + TestDelegate -= TestD2; + } + + void TestD2() + { + Debugger.Log("delegate 2"); + } + + void OnGUI() + { + GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 150, 800, 400), tips); + + if (GUI.Button(new Rect(10, 10, 120, 40), "Error1")) + { + tips = ""; + showStack.BeginPCall(); + showStack.Push(go); + showStack.PCall(); + showStack.EndPCall(); + showStack.Dispose(); + showStack = null; + } + else if (GUI.Button(new Rect(10, 60, 120, 40), "Instantiate Error")) + { + tips = ""; + LuaFunction func = state.GetFunction("Instantiate"); + func.BeginPCall(); + func.Push(go); + func.PCall(); + func.EndPCall(); + func.Dispose(); + } + else if (GUI.Button(new Rect(10, 110, 120, 40), "Check Error")) + { + tips = ""; + LuaFunction func = state.GetFunction("TestRay"); + func.BeginPCall(); + func.PCall(); + func.CheckRay(); //杩斿洖鍊煎嚭閿 + func.EndPCall(); + func.Dispose(); + } + else if (GUI.Button(new Rect(10, 160, 120, 40), "Push Error")) + { + tips = ""; + LuaFunction func = state.GetFunction("TestRay"); + func.BeginPCall(); + func.Push(Instance); + func.PCall(); + func.EndPCall(); + func.Dispose(); + } + else if (GUI.Button(new Rect(10, 210, 120, 40), "LuaPushError")) + { + //闇瑕佹敼lua鏂囦欢璁╁叾鍑洪敊 + tips = ""; + LuaFunction func = state.GetFunction("PushLuaError"); + func.BeginPCall(); + func.PCall(); + func.EndPCall(); + func.Dispose(); + } + else if (GUI.Button(new Rect(10, 260, 120, 40), "Check Error")) + { + tips = ""; + LuaFunction func = state.GetFunction("Test5"); + func.BeginPCall(); + func.PCall(); + func.EndPCall(); + func.Dispose(); + } + else if (GUI.Button(new Rect(10, 310, 120, 40), "Test Resume")) + { + tips = ""; + LuaFunction func = state.GetFunction("Test6"); + func.BeginPCall(); + func.PCall(); + func.EndPCall(); + func.Dispose(); + } + else if (GUI.Button(new Rect(10, 360, 120, 40), "out of bound")) + { + tips = ""; + LuaFunction func = state.GetFunction("TestOutOfBound"); + func.BeginPCall(); + func.PCall(); + func.EndPCall(); + func.Dispose(); + } + else if (GUI.Button(new Rect(10, 410, 120, 40), "TestArgError")) + { + tips = ""; + LuaFunction func = state.GetFunction("Test8"); + func.BeginPCall(); + func.PCall(); + func.EndPCall(); + func.Dispose(); + } + else if (GUI.Button(new Rect(10, 460, 120, 40), "TestFuncDispose")) + { + tips = ""; + LuaFunction func = state.GetFunction("Test8"); + func.Dispose(); + func.BeginPCall(); + func.PCall(); + func.EndPCall(); + func.Dispose(); + } + else if (GUI.Button(new Rect(10, 510, 120, 40), "SendMessage")) + { + tips = ""; + gameObject.SendMessage("OnSendMsg"); + } + else if (GUI.Button(new Rect(10, 560, 120, 40), "SendMessageInLua")) + { + LuaFunction func = state.GetFunction("SendMsgError"); + func.BeginPCall(); + func.Push(gameObject); + func.PCall(); + func.EndPCall(); + func.Dispose(); + } + else if (GUI.Button(new Rect(10, 610, 120, 40), "AddComponent")) + { + tips = ""; + LuaFunction func = state.GetFunction("TestAddComponent"); + func.BeginPCall(); + func.Push(gameObject); + func.PCall(); + func.EndPCall(); + func.Dispose(); + } + else if (GUI.Button(new Rect(210, 10, 120, 40), "TableGetSet")) + { + tips = ""; + LuaTable table = state.GetTable("testev"); + int top = state.LuaGetTop(); + + try + { + state.Push(table); + state.LuaGetField(-1, "Add"); + LuaFunction func = state.CheckLuaFunction(-1); + + if (func != null) + { + func.Call(); + func.Dispose(); + } + + state.LuaPop(1); + state.Push(123456); + state.LuaSetField(-2, "value"); + state.LuaGetField(-1, "value"); + int n = (int)state.LuaCheckNumber(-1); + Debugger.Log("value is: " + n); + + state.LuaPop(1); + + state.Push("Add"); + state.LuaGetTable(-2); + + func = state.CheckLuaFunction(-1); + + if (func != null) + { + func.Call(); + func.Dispose(); + } + + state.LuaPop(1); + + state.Push("look"); + state.Push(456789); + state.LuaSetTable(-3); + + state.LuaGetField(-1, "look"); + n = (int)state.LuaCheckNumber(-1); + Debugger.Log("look: " + n); + } + catch (Exception e) + { + state.LuaSetTop(top); + throw e; + } + + state.LuaSetTop(top); + } + else if (GUI.Button(new Rect(210, 60, 120, 40), "TestTableInCo")) + { + tips = ""; + LuaFunction func = state.GetFunction("TestCoTable"); + func.BeginPCall(); + func.PCall(); + func.EndPCall(); + func.Dispose(); + } + else if (GUI.Button(new Rect(210, 110, 120, 40), "Instantiate2 Error")) + { + tips = ""; + LuaFunction func = state.GetFunction("Instantiate"); + func.BeginPCall(); + func.Push(go2); + func.PCall(); + func.EndPCall(); + func.Dispose(); + } + else if (GUI.Button(new Rect(210, 160, 120, 40), "Instantiate3 Error")) + { + tips = ""; + UnityEngine.Object.Instantiate(go2); + } + else if (GUI.Button(new Rect(210, 210, 120, 40), "TestCycle")) + { + tips = ""; + int n = 20; + LuaFunction func = state.GetFunction("TestCycle"); + func.BeginPCall(); + func.Push(n); + func.PCall(); + int c = (int)func.CheckNumber(); + func.EndPCall(); + + Debugger.Log("Fib({0}) is {1}", n, c); + } + else if (GUI.Button(new Rect(210, 260, 120, 40), "TestNull")) + { + tips = ""; + Action action = ()=> + { + LuaFunction func = state.GetFunction("TestNull"); + func.BeginPCall(); + func.PushObject(null); + func.PCall(); + func.EndPCall(); + }; + + StartCoroutine(TestCo(action)); + } + else if (GUI.Button(new Rect(210, 310, 120, 40), "TestMulti")) + { + tips = ""; + LuaFunction func = state.GetFunction("TestMulStack"); + func.BeginPCall(); + func.PushObject(null); + func.PCall(); + func.EndPCall(); + } + } + + IEnumerator TestCo(Action action) + { + yield return new WaitForSeconds(0.1f); + action(); + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestLuaStack.cs.meta b/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestLuaStack.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..69d371a31e519752beb3cad9cca3a8ff59be7586 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestLuaStack.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b40a6eeee975862489a712e1a3d79ed1 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestLuaStack.unity b/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestLuaStack.unity new file mode 100644 index 0000000000000000000000000000000000000000..8ca7c202ec439185b2dee799706fd70b0fe31fa0 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestLuaStack.unity @@ -0,0 +1,215 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_GIWorkflowMode: 1 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 1 + m_BakeResolution: 50 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_LightmapSnapshot: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: .166666657 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &77713745 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 77713750} + - 20: {fileID: 77713749} + - 92: {fileID: 77713748} + - 124: {fileID: 77713747} + - 81: {fileID: 77713746} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &77713746 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 77713745} + m_Enabled: 1 +--- !u!124 &77713747 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 77713745} + m_Enabled: 1 +--- !u!92 &77713748 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 77713745} + m_Enabled: 1 +--- !u!20 &77713749 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 77713745} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!4 &77713750 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 77713745} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!1 &1378972055 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1378972057} + - 114: {fileID: 1378972056} + m_Layer: 0 + m_Name: TestError + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1378972056 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1378972055} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b40a6eeee975862489a712e1a3d79ed1, type: 3} + m_Name: + m_EditorClassIdentifier: + go: {fileID: 176158, guid: ec8a2f7e4eaf1c64e8393014e602047c, type: 2} + go2: {fileID: 176158, guid: 0e472cc047eb20841bbb7c64dfeb0d78, type: 2} + text: {fileID: 0} +--- !u!4 &1378972057 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1378972055} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 1, y: 2, z: 3} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 diff --git a/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestLuaStack.unity.meta b/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestLuaStack.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..58bc3997f7006e446ad23bb1734b95c56766f346 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestErrorStack/TestLuaStack.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 706020e5c3f37944995bfe00955fdd39 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/TestInjection.meta b/Assets/LuaFramework/ToLua/Examples/TestInjection.meta new file mode 100644 index 0000000000000000000000000000000000000000..6b49c96d41eb6ab780bdd8ff80e41451a3cd5329 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestInjection.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 38c5ccf43aa1bef4ab5def4faf0a5aba +folderAsset: yes +timeCreated: 1515035158 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Examples/TestInjection/BaseTestWrap.cs b/Assets/LuaFramework/ToLua/Examples/TestInjection/BaseTestWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..8afaa71b414bf98254520b887f8e298b85433bd8 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestInjection/BaseTestWrap.cs @@ -0,0 +1,98 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using System.Runtime.InteropServices; +using LuaInterface; + +public class BaseTestWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(BaseTest), typeof(System.Object)); + L.RegFunction("TestRef", TestRef); + L.RegFunction("New", _CreateBaseTest); + L.RegVar("PropertyTest", get_PropertyTest, set_PropertyTest); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateBaseTest(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + BaseTest obj = new BaseTest(); + ToLua.PushObject(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: BaseTest.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TestRef(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + BaseTest obj = (BaseTest)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int o = obj.TestRef(ref arg0); + LuaDLL.lua_pushinteger(L, o); + LuaDLL.lua_pushinteger(L, arg0); + return 2; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_PropertyTest(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + BaseTest obj = (BaseTest)o; + int ret = obj.PropertyTest; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index PropertyTest on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_PropertyTest(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + BaseTest obj = (BaseTest)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.PropertyTest = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index PropertyTest on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Examples/TestInjection/BaseTestWrap.cs.meta b/Assets/LuaFramework/ToLua/Examples/TestInjection/BaseTestWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..a83af24eba98e3b0f96b216ae0c48ca0534fd64e --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestInjection/BaseTestWrap.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 823570c1e66fe6e45b87a838ec075e76 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/TestInjection/TestInjection.cs b/Assets/LuaFramework/ToLua/Examples/TestInjection/TestInjection.cs new file mode 100644 index 0000000000000000000000000000000000000000..c27a80daf7907fdeda69a4ac2808526bf5623528 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestInjection/TestInjection.cs @@ -0,0 +1,194 @@ +锘縰sing UnityEngine; +using LuaInterface; +using System.Collections; + +[LuaInterface.NoToLua] +public class TestInjection : MonoBehaviour +{ + string tips = ""; + bool m_isMouseDown; + int m_fontSize = 28; + int m_logFontSize = 0; + float scaleThreshold; + LuaState luaState = null; + Color m_normalColor; + GUIStyle m_fontStyle; + GUIStyle m_windowStyle; + Rect m_windowRect; + Vector2 m_scrollViewPos; + Vector2 m_distance; + + // Use this for initialization + void Start() + { + InitGUI(); +#if UNITY_5 || UNITY_2017_1_OR_NEWER + Application.logMessageReceived += ShowTips; +#else + Application.RegisterLogCallback(ShowTips); +#endif + new LuaResLoader(); + luaState = new LuaState(); + luaState.Start(); + LuaBinder.Bind(luaState); + //For InjectByModule + ////////////////////////////////////////////////////// + luaState.BeginModule(null); + BaseTestWrap.Register(luaState); + ToLuaInjectionTestWrap.Register(luaState); + luaState.EndModule(); + ////////////////////////////////////////////////////// + +#if ENABLE_LUA_INJECTION +#if UNITY_EDITOR + if (UnityEditor.EditorPrefs.GetInt(Application.dataPath + "InjectStatus") == 1) + { +#else + if (true) + { +#endif + ///姝ゅRequire鏄ず渚嬩笓鐢紝鏆栨洿鏂扮殑lua浠g爜閮借鏀惧埌LuaInjectionBus.lua涓粺涓require + luaState.Require("ToLuaInjectionTestInjector"); + int counter = 0; + bool state = true; + ToLuaInjectionTest test = new ToLuaInjectionTest(true); + test = new ToLuaInjectionTest(); + StartCoroutine(test.TestCoroutine(0.3f)); + + test.TestOverload(1, state); + test.TestOverload(1, ref state); + Debug.Log("TestOverload ref result:" + state); + test.TestOverload(state, 1); + int refResult = test.TestRef(ref counter); + Debug.Log(string.Format("TestRef return result:{0}; ref result:{1}", refResult, counter)); + + Debug.Log("Property Get Test:" + test.PropertyTest); + test.PropertyTest = 2; + Debug.Log("Property Set Test:" + test.PropertyTest); + + System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); + sw.Start(); + for (int i = 0; i < 10000000; ++i) + { + test.NoInject(true, 1); + } + sw.Stop(); + long noInjectMethodCostTime = sw.ElapsedMilliseconds; + sw.Reset(); + sw.Start(); + for (int i = 0; i < 10000000; ++i) + { + test.Inject(true, 1); + } + sw.Stop(); + Debug.Log("time cost ratio:" + (double)sw.ElapsedMilliseconds / noInjectMethodCostTime); + } + else +#endif + { + Debug.LogError("鏌ョ湅鏄惁寮鍚簡瀹廍NABLE_LUA_INJECTION骞舵墽琛屼簡鑿滃崟鍛戒护鈥斺擻"Lua=>Inject All\""); + } + } + + void InitGUI() + { + m_windowRect.x = 0; + m_windowRect.y = 0; + m_windowRect.width = Screen.width; + m_windowRect.height = Screen.height; + + m_logFontSize = (int)(m_fontSize * Screen.width * Screen.height / (1280 * 720)); + m_normalColor = Color.white; + m_fontStyle = new GUIStyle(); + m_fontStyle.normal.textColor = m_normalColor; + m_fontStyle.fontSize = m_logFontSize; + + //璁剧疆绐楀彛棰滆壊 + m_windowStyle = new GUIStyle(); + Texture2D windowTexture = new Texture2D(1, 1); + windowTexture.SetPixel(0, 0, Color.black); + windowTexture.Apply(); + m_windowStyle.normal.background = windowTexture; + + scaleThreshold = Screen.width / 1100.0f; + } + + void OnApplicationQuit() + { +#if UNITY_5 || UNITY_2017_1_OR_NEWER + Application.logMessageReceived -= ShowTips; +#else + Application.RegisterLogCallback(null); +#endif + luaState.Dispose(); + luaState = null; + } + + Vector2 MousePoisition { get { return new Vector2(-Input.mousePosition.x, Input.mousePosition.y); } } + //榧犳爣鎷栨嫿鎺у埗 + private void MouseDragView(ref Vector2 viewPos) + { + if (Input.GetMouseButtonDown(0)) + { + m_distance = viewPos - MousePoisition; + m_isMouseDown = true; + } + else if (Input.GetMouseButtonUp(0)) + { + m_isMouseDown = false; + } + + if (m_isMouseDown) + { + viewPos = MousePoisition + m_distance; + } + } + + /// + /// 闈炲父绠闄嬬殑涓涓猯og绐楀彛锛屼笉瑕佺敤鍒伴」鐩腑锛屼粎鐢ㄦ潵绀轰緥 + /// + /// + void LogWindow(int id) + { + GUILayout.BeginHorizontal(); + if (GUILayout.Button("+", GUILayout.MinHeight(50 * scaleThreshold))) + { + m_logFontSize = Mathf.Min(64, ++m_logFontSize); + m_fontStyle.fontSize = m_logFontSize; + } + if (GUILayout.Button("-", GUILayout.MinHeight(50 * scaleThreshold))) + { + m_logFontSize = Mathf.Max(1, --m_logFontSize); + m_fontStyle.fontSize = m_logFontSize; + } + GUILayout.EndHorizontal(); + + m_scrollViewPos = GUILayout.BeginScrollView(m_scrollViewPos, false, false); + + MouseDragView(ref m_scrollViewPos); + + GUILayout.Label(tips, m_fontStyle); + GUILayout.Space(2); + GUILayout.EndScrollView(); + + GUILayout.BeginHorizontal(); + GUILayout.Label(string.Format("Font Size ({0})", m_logFontSize)); + GUILayout.EndHorizontal(); + } + + void OnGUI() + { + m_windowRect = GUI.Window(0, m_windowRect, LogWindow, "Log Window", m_windowStyle); + } + + void ShowTips(string msg, string stackTrace, LogType type) + { + tips += msg; + tips += "\r\n"; + + if (type == LogType.Error || type == LogType.Exception) + { + tips += stackTrace; + } + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/TestInjection/TestInjection.cs.meta b/Assets/LuaFramework/ToLua/Examples/TestInjection/TestInjection.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..e9703fe8b8fd8e9171d9284e8c597c02197e23c2 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestInjection/TestInjection.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f95133dba6f6a1a40936257b1a8b3dae +timeCreated: 1515035194 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Examples/TestInjection/TestInjection.unity b/Assets/LuaFramework/ToLua/Examples/TestInjection/TestInjection.unity new file mode 100644 index 0000000000000000000000000000000000000000..3649bc0063ef5ce00bb74e89d2271b6bde3c84ac --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestInjection/TestInjection.unity @@ -0,0 +1,128 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_GIWorkflowMode: 1 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 1 + m_BakeResolution: 50 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_LightmapSnapshot: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: .166666657 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &2080367394 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 2080367396} + - 114: {fileID: 2080367395} + m_Layer: 0 + m_Name: GameObject + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &2080367395 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2080367394} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f95133dba6f6a1a40936257b1a8b3dae, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &2080367396 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2080367394} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 diff --git a/Assets/LuaFramework/ToLua/Examples/TestInjection/TestInjection.unity.meta b/Assets/LuaFramework/ToLua/Examples/TestInjection/TestInjection.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..0524cff050caf65f80ac8ce83cd9dd3d551b0eed --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestInjection/TestInjection.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 05dc1e98babb44f47ad2a28a88b76380 +timeCreated: 1515035207 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Examples/TestInjection/ToLuaInjectionTest.cs b/Assets/LuaFramework/ToLua/Examples/TestInjection/ToLuaInjectionTest.cs new file mode 100644 index 0000000000000000000000000000000000000000..23dc89adf8a3aa9bc96377c6c8e0123c202a136e --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestInjection/ToLuaInjectionTest.cs @@ -0,0 +1,102 @@ +锘縰sing System.Collections; +using UnityEngine; + +public class BaseTest +{ + private int propertyTest; + + public virtual int TestRef(ref int count) + { + Debug.Log("CS:Base TestRef"); + ++count; + + return 1; + } + + public virtual int PropertyTest + { + get + { + Debug.Log("CS: Base PropertyTestGet"); + return propertyTest; + } + set + { + Debug.Log("CS: Base PropertyTestSet"); + propertyTest = value; + } + } +} + +public class ToLuaInjectionTest : BaseTest +{ + private int propertyTest; + + public ToLuaInjectionTest() + { + Debug.Log("CS:Constructor Test"); + } + + public ToLuaInjectionTest(bool state) + { + Debug.Log("CS:Constructor Test " + state); + } + + public override int PropertyTest + { + get + { + Debug.Log("CS:PropertyTestGet"); + return propertyTest; + } + set + { + Debug.Log("CS:PropertyTestSet"); + propertyTest = value; + } + } + + public override int TestRef(ref int count) + { + Debug.Log("CS:Override TestRef"); + ++count; + + return 2; + } + + public void TestOverload(int param1, bool param2) + { + Debug.Log("CS:TestOverload"); + } + + public void TestOverload(int param1, ref bool param2) + { + Debug.Log("CS:TestOverload"); + param2 = !param2; + } + + public void TestOverload(bool param1, int param2) + { + Debug.Log("CS:TestOverload"); + } + + [LuaInterface.NoToLua] + public void NoInject(bool param1, int param2) + { + int a = 0; + int b = ++a; + } + + public void Inject(bool param1, int param2) + { + int a = 0; + int b = ++a; + } + + public IEnumerator TestCoroutine(float delay) + { + Debug.Log("CS:TestCoroutine Run"); + yield return new WaitForSeconds(delay); + Debug.Log("CS:TestCoroutine End"); + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/TestInjection/ToLuaInjectionTest.cs.meta b/Assets/LuaFramework/ToLua/Examples/TestInjection/ToLuaInjectionTest.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..dfee21a8a058683b34a17bf417d1e94e8e261f95 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestInjection/ToLuaInjectionTest.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 80e29c43f1cea9d4988c36fd2f6c26c1 +timeCreated: 1514883665 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Examples/TestInjection/ToLuaInjectionTestWrap.cs b/Assets/LuaFramework/ToLua/Examples/TestInjection/ToLuaInjectionTestWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..c4165754e704d9da85272b7379a65743b88829af --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestInjection/ToLuaInjectionTestWrap.cs @@ -0,0 +1,168 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using System.Runtime.InteropServices; +using LuaInterface; + +public class ToLuaInjectionTestWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(ToLuaInjectionTest), typeof(BaseTest)); + L.RegFunction("TestRef", TestRef); + L.RegFunction("TestOverload", TestOverload); + L.RegFunction("TestCoroutine", TestCoroutine); + L.RegFunction("New", _CreateToLuaInjectionTest); + L.RegVar("PropertyTest", get_PropertyTest, set_PropertyTest); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateToLuaInjectionTest(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + ToLuaInjectionTest obj = new ToLuaInjectionTest(); + ToLua.PushObject(L, obj); + return 1; + } + else if (count == 1) + { + bool arg0 = LuaDLL.luaL_checkboolean(L, 1); + ToLuaInjectionTest obj = new ToLuaInjectionTest(arg0); + ToLua.PushObject(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: ToLuaInjectionTest.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TestRef(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + ToLuaInjectionTest obj = (ToLuaInjectionTest)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int o = obj.TestRef(ref arg0); + LuaDLL.lua_pushinteger(L, o); + LuaDLL.lua_pushinteger(L, arg0); + return 2; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TestOverload(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + ToLuaInjectionTest obj = (ToLuaInjectionTest)ToLua.CheckObject(L, 1); + bool arg0 = LuaDLL.lua_toboolean(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + obj.TestOverload(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + ToLuaInjectionTest obj = (ToLuaInjectionTest)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + bool arg1 = LuaDLL.lua_toboolean(L, 3); + obj.TestOverload(arg0, ref arg1); + LuaDLL.lua_pushboolean(L, arg1); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + ToLuaInjectionTest obj = (ToLuaInjectionTest)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + bool arg1 = LuaDLL.lua_toboolean(L, 3); + obj.TestOverload(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: ToLuaInjectionTest.TestOverload"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TestCoroutine(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + ToLuaInjectionTest obj = (ToLuaInjectionTest)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + System.Collections.IEnumerator o = obj.TestCoroutine(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_PropertyTest(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + ToLuaInjectionTest obj = (ToLuaInjectionTest)o; + int ret = obj.PropertyTest; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index PropertyTest on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_PropertyTest(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + ToLuaInjectionTest obj = (ToLuaInjectionTest)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.PropertyTest = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index PropertyTest on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Examples/TestInjection/ToLuaInjectionTestWrap.cs.meta b/Assets/LuaFramework/ToLua/Examples/TestInjection/ToLuaInjectionTestWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..c2b72fc45bdbc11840db75145926cbc3cb4de64e --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestInjection/ToLuaInjectionTestWrap.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 14459b5f9debe5f47b5a300b6f1acfe8 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/TestOverload.meta b/Assets/LuaFramework/ToLua/Examples/TestOverload.meta new file mode 100644 index 0000000000000000000000000000000000000000..cbe6da2435b5be57a0d81a724377e3270c242f95 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestOverload.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c47782a99562c02499fb1602381bfe8d +folderAsset: yes +timeCreated: 1486461631 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Examples/TestOverload/TestExportWrap.cs b/Assets/LuaFramework/ToLua/Examples/TestOverload/TestExportWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..e678096541a21aebe82b15fd17943d297815cf11 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestOverload/TestExportWrap.cs @@ -0,0 +1,857 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class TestExportWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(TestExport), typeof(System.Object)); + L.RegFunction(".geti", get_Item); + L.RegFunction("get_Item", get_Item); + L.RegFunction(".seti", set_Item); + L.RegFunction("set_Item", set_Item); + L.RegFunction("TestByteBuffer", TestByteBuffer); + L.RegFunction("Test", Test); + L.RegFunction("TestChar", TestChar); + L.RegFunction("Test33", Test33); + L.RegFunction("TestGeneric", TestGeneric); + L.RegFunction("TestEnum", TestEnum); + L.RegFunction("TestCheckParamNumber", TestCheckParamNumber); + L.RegFunction("TestCheckParamString", TestCheckParamString); + L.RegFunction("TestReflection", TestReflection); + L.RegFunction("TestRefGameObject", TestRefGameObject); + L.RegFunction("DoClick", DoClick); + L.RegFunction("TestNullable", TestNullable); + L.RegFunction("New", _CreateTestExport); + L.RegVar("this", _this, null); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("field", get_field, set_field); + L.RegVar("OnClick", get_OnClick, set_OnClick); + L.RegVar("OnRefEvent", get_OnRefEvent, set_OnRefEvent); + L.RegVar("buffer", get_buffer, set_buffer); + L.RegVar("Number", get_Number, set_Number); + L.RegFunction("TestBuffer", TestExport_TestBuffer); + L.RegFunction("TestRefEvent", TestExport_TestRefEvent); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateTestExport(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + TestExport obj = new TestExport(); + ToLua.PushSealed(L, obj); + return 1; + } + else if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + TestExport obj = new TestExport(arg0); + ToLua.PushSealed(L, obj); + return 1; + } + else if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Vector3[] arg0 = ToLua.ToStructArray(L, 1); + TestExport obj = new TestExport(arg0); + ToLua.PushSealed(L, obj); + return 1; + } + else if (count == 2) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + string arg1 = ToLua.CheckString(L, 2); + TestExport obj = new TestExport(arg0, arg1); + ToLua.PushSealed(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: TestExport.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _get_this(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + TestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int o = obj[arg0]; + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 3) + { + TestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport)); + char arg0 = (char)LuaDLL.luaL_checknumber(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + int o = obj[arg0, arg1]; + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to operator method: TestExport.this"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _set_this(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3) + { + TestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + obj[arg0] = arg1; + return 0; + } + else if (count == 4) + { + TestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport)); + char arg0 = (char)LuaDLL.luaL_checknumber(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); + obj[arg0, arg1] = arg2; + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to operator method: TestExport.this"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _this(IntPtr L) + { + try + { + LuaDLL.lua_pushvalue(L, 1); + LuaDLL.tolua_bindthis(L, _get_this, _set_this); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Item(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + int o = TestExport.get_Item(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + double arg0 = (double)LuaDLL.lua_tonumber(L, 1); + int o = TestExport.get_Item(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 2) + { + TestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int o = obj[arg0]; + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + int arg1 = (int)LuaDLL.lua_tonumber(L, 2); + int arg2 = (int)LuaDLL.lua_tonumber(L, 3); + int o = TestExport.get_Item(arg0, arg1, arg2); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + TestExport obj = (TestExport)ToLua.ToObject(L, 1); + char arg0 = (char)LuaDLL.lua_tonumber(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + int o = obj[arg0, arg1]; + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: TestExport.get_Item"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_Item(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + double arg0 = (double)LuaDLL.luaL_checknumber(L, 1); + int o = TestExport.set_Item(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 3) + { + TestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + obj[arg0] = arg1; + return 0; + } + else if (count == 4) + { + TestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport)); + char arg0 = (char)LuaDLL.luaL_checknumber(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); + obj[arg0, arg1] = arg2; + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: TestExport.set_Item"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TestByteBuffer(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + TestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport)); + TestExport.TestBuffer arg0 = (TestExport.TestBuffer)ToLua.CheckDelegate(L, 2); + obj.TestByteBuffer(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Test(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + TestExport obj = (TestExport)ToLua.ToObject(L, 1); + int o = obj.Test(); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes>(L, 1)) + { + TestExport obj = (TestExport)ToLua.ToObject(L, 1); + int arg0; + int o = obj.Test(out arg0); + LuaDLL.lua_pushinteger(L, o); + LuaDLL.lua_pushinteger(L, arg0); + return 2; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + TestExport obj = (TestExport)ToLua.ToObject(L, 1); + double arg0 = (double)LuaDLL.lua_tonumber(L, 2); + int o = obj.Test(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + TestExport obj = (TestExport)ToLua.ToObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + int o = obj.Test(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + string arg1 = ToLua.ToString(L, 2); + int o = TestExport.Test(arg0, arg1); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + TestExport obj = (TestExport)ToLua.ToObject(L, 1); + TestExport.Space arg0 = (TestExport.Space)ToLua.ToObject(L, 2); + int o = obj.Test(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + TestExport obj = (TestExport)ToLua.ToObject(L, 1); + bool arg0 = LuaDLL.lua_toboolean(L, 2); + int o = obj.Test(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + TestExport obj = (TestExport)ToLua.ToObject(L, 1); + int[,] arg0 = (int[,])ToLua.ToObject(L, 2); + int o = obj.Test(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + TestExport obj = (TestExport)ToLua.ToObject(L, 1); + object arg0 = ToLua.ToVarObject(L, 2); + int o = obj.Test(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + TestExport obj = (TestExport)ToLua.ToObject(L, 1); + string[] arg0 = ToLua.ToStringArray(L, 2); + bool arg1 = LuaDLL.lua_toboolean(L, 3); + int o = obj.Test(arg0, arg1); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + TestExport obj = (TestExport)ToLua.ToObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + int o = obj.Test(arg0, arg1); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + TestExport obj = (TestExport)ToLua.ToObject(L, 1); + object arg0 = ToLua.ToVarObject(L, 2); + string arg1 = ToLua.ToString(L, 3); + int o = obj.Test(arg0, arg1); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 1)) + { + TestExport obj = (TestExport)ToLua.ToObject(L, 1); + object arg0 = ToLua.ToVarObject(L, 2); + string arg1 = ToLua.ToString(L, 3); + int arg2 = (int)LuaDLL.lua_tonumber(L, 4); + int o = obj.Test(arg0, arg1, arg2); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (TypeChecker.CheckTypes(L, 1) && TypeChecker.CheckParamsType(L, 2, count - 1)) + { + TestExport obj = (TestExport)ToLua.ToObject(L, 1); + int[] arg0 = ToLua.ToParamsNumber(L, 2, count - 1); + int o = obj.Test(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (TypeChecker.CheckTypes(L, 1) && TypeChecker.CheckParamsType(L, 2, count - 1)) + { + TestExport obj = (TestExport)ToLua.ToObject(L, 1); + string[] arg0 = ToLua.ToParamsString(L, 2, count - 1); + int o = obj.Test(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (TypeChecker.CheckTypes(L, 1) && TypeChecker.CheckParamsType(L, 2, count - 1)) + { + TestExport obj = (TestExport)ToLua.ToObject(L, 1); + object[] arg0 = ToLua.ToParamsObject(L, 2, count - 1); + int o = obj.Test(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: TestExport.Test"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TestChar(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + TestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport)); + char arg0 = (char)LuaDLL.luaL_checknumber(L, 2); + int o = obj.Test(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Test33(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + TestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport)); + System.Action arg0 = (System.Action)ToLua.CheckDelegate>(L, 2); + int o = obj.Test33(ref arg0); + LuaDLL.lua_pushinteger(L, o); + ToLua.Push(L, arg0); + return 2; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TestGeneric(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + TestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport)); + UnityEngine.Component arg0 = (UnityEngine.Component)ToLua.CheckObject(L, 2); + int o = obj.TestGeneric(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TestEnum(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + TestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport)); + TestExport.Space arg0 = (TestExport.Space)ToLua.CheckObject(L, 2, typeof(TestExport.Space)); + int o = obj.TestEnum(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TestCheckParamNumber(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + TestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport)); + int[] arg0 = ToLua.CheckParamsNumber(L, 2, count - 1); + int o = obj.TestCheckParamNumber(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TestCheckParamString(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + TestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport)); + string[] arg0 = ToLua.CheckParamsString(L, 2, count - 1); + string o = obj.TestCheckParamString(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TestReflection(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 0); + TestExport.TestReflection(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TestRefGameObject(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + TestExport.TestRefGameObject(ref arg0); + ToLua.PushSealed(L, arg0); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int DoClick(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + TestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport)); + obj.DoClick(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TestNullable(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + TestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport)); + System.Nullable arg0 = ToLua.CheckNullable(L, 2); + System.Nullable o = obj.TestNullable(arg0); + ToLua.PusNullable(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_field(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + TestExport obj = (TestExport)o; + int ret = obj.field; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index field on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_OnClick(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + TestExport obj = (TestExport)o; + System.Action ret = obj.OnClick; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index OnClick on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_OnRefEvent(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + TestExport obj = (TestExport)o; + TestExport.TestRefEvent ret = obj.OnRefEvent; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index OnRefEvent on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_buffer(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + TestExport obj = (TestExport)o; + byte[] ret = obj.buffer; + LuaDLL.tolua_pushlstring(L, ret, ret.Length); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index buffer on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Number(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + TestExport obj = (TestExport)o; + int ret = obj.Number; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index Number on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_field(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + TestExport obj = (TestExport)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.field = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index field on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_OnClick(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + TestExport obj = (TestExport)o; + System.Action arg0 = (System.Action)ToLua.CheckDelegate(L, 2); + obj.OnClick = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index OnClick on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_OnRefEvent(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + TestExport obj = (TestExport)o; + TestExport.TestRefEvent arg0 = (TestExport.TestRefEvent)ToLua.CheckDelegate(L, 2); + obj.OnRefEvent = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index OnRefEvent on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_buffer(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + TestExport obj = (TestExport)o; + byte[] arg0 = ToLua.CheckByteBuffer(L, 2); + obj.buffer = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index buffer on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_Number(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + TestExport obj = (TestExport)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.Number = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index Number on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TestExport_TestBuffer(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + LuaFunction func = ToLua.CheckLuaFunction(L, 1); + + if (count == 1) + { + Delegate arg1 = DelegateTraits.Create(func); + ToLua.Push(L, arg1); + } + else + { + LuaTable self = ToLua.CheckLuaTable(L, 2); + Delegate arg1 = DelegateTraits.Create(func, self); + ToLua.Push(L, arg1); + } + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TestExport_TestRefEvent(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + LuaFunction func = ToLua.CheckLuaFunction(L, 1); + + if (count == 1) + { + Delegate arg1 = DelegateTraits.Create(func); + ToLua.Push(L, arg1); + } + else + { + LuaTable self = ToLua.CheckLuaTable(L, 2); + Delegate arg1 = DelegateTraits.Create(func, self); + ToLua.Push(L, arg1); + } + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Examples/TestOverload/TestExportWrap.cs.meta b/Assets/LuaFramework/ToLua/Examples/TestOverload/TestExportWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..2676dbaaf4c3b24a6eecd0efe51aea0dddcaf11d --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestOverload/TestExportWrap.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 93a993f96184f9043b307249752cde32 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/TestOverload/TestExport_SpaceWrap.cs b/Assets/LuaFramework/ToLua/Examples/TestOverload/TestExport_SpaceWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..b4bcf9cf1a6fcc6a41be62a05be68fdd2ae43f83 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestOverload/TestExport_SpaceWrap.cs @@ -0,0 +1,43 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class TestExport_SpaceWrap +{ + public static void Register(LuaState L) + { + L.BeginEnum(typeof(TestExport.Space)); + L.RegVar("World", get_World, null); + L.RegFunction("IntToEnum", IntToEnum); + L.EndEnum(); + TypeTraits.Check = CheckType; + StackTraits.Push = Push; + } + + static void Push(IntPtr L, TestExport.Space arg) + { + ToLua.Push(L, arg); + } + + static bool CheckType(IntPtr L, int pos) + { + return TypeChecker.CheckEnumType(typeof(TestExport.Space), L, pos); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_World(IntPtr L) + { + ToLua.Push(L, TestExport.Space.World); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IntToEnum(IntPtr L) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + TestExport.Space o = (TestExport.Space)arg0; + ToLua.Push(L, o); + return 1; + } +} + diff --git a/Assets/LuaFramework/ToLua/Examples/TestOverload/TestExport_SpaceWrap.cs.meta b/Assets/LuaFramework/ToLua/Examples/TestOverload/TestExport_SpaceWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..3bae65b7ad94d00851bc6cb7d42de6a8eaa2edb6 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestOverload/TestExport_SpaceWrap.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3e8176bbf31cef9418a3a1aa76f1f018 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/TestOverload/TestOverload.cs b/Assets/LuaFramework/ToLua/Examples/TestOverload/TestOverload.cs new file mode 100644 index 0000000000000000000000000000000000000000..83781afab50c262f50fe74dd3c08065b64b7d157 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestOverload/TestOverload.cs @@ -0,0 +1,334 @@ +锘縰sing UnityEngine; +using System.Collections; +using LuaInterface; +using System; +using System.Reflection; + +public class TestEnum +{ + public TestEnum() + { + + } + + public void Test(UnityEngine.Space e) + { + + } +} + +public sealed class TestExport +{ + [LuaByteBufferAttribute] + public delegate void TestBuffer(byte[] buffer); + + public enum Space + { + World = 1 + } + + public int field = 1024; + + public System.Action OnClick = delegate { }; + + public delegate void TestRefEvent(ref GameObject go); + + public TestRefEvent OnRefEvent; + + //public int Item { get; set; } + private int number = 123; + public int Number + { + get + { + return number; + } + + set + { + number = value; + } + } + + public int this[int pos] + { + get { return pos; } + set { Debugger.Log(value); } + } + + public int this[char index, int pos] + { + get { return 0; } + set { Debugger.Log(value); } + } + + [LuaByteBufferAttribute] + public byte[] buffer; + + public static int get_Item(string pos) { return 0; } + public static int get_Item(double pos) { return 0; } + public static int get_Item(int i, int j, int k) { return 0; } + + public static int set_Item(double pos) { return 0; } + + public void TestByteBuffer(TestBuffer tb) + { + + } + + public int Test(object o, string str) + { + Debugger.Log("call Test(object o, string str)"); + return 1; + } + + public int Test(object o, string str, int n) + { + Debugger.Log("call Test(object o, string str, int n)"); + return 111; + } + + [LuaRenameAttribute(Name = "TestChar")] + public int Test(char c) + { + Debugger.Log("call Test(char c)"); + return 2; + } + + public int Test() + { + return -1; + } + + public int Test(bool b) + { + Debugger.Log("call Test(bool b)"); + return 15; + } + + public int Test(int[,] objs) + { + Debugger.Log("call Test(int[,] objs)"); + return 16; + } + + public int Test(int i) + { + Debugger.Log("call Test(int i)"); + return 3; + } + + //鏈夎繖涓嚱鏁拌鎵旀帀涓婇潰涓や釜绮惧害涓嶅尮閰嶇殑锛屽洜涓簂ua鏄痙ouble + public int Test(double d) + { + Debugger.Log("call Test(double d)"); + return 4; + } + + public int Test(out int i) + { + i = 1024; + Debugger.Log("call Test(ref int i)"); + return 3; + } + + + public int Test(int i, int j) + { + Debugger.Log("call Test(int i, int j)"); + return 5; + } + + + public int Test(string str) + { + Debugger.Log("call Test(string str)"); + return 6; + } + + public static int Test(string str1, string str2) + { + Debugger.Log("call static Test(string str1, string str2)"); + return 7; + } + + public int Test(object o) + { + Debugger.Log("call Test(object o)"); + return 8; + } + + public int Test(params int[] objs) + { + Debugger.Log("call Test(params int[] objs)"); + return 12; + } + + public int Test(params string[] objs) + { + Debugger.Log("call Test(params int[] objs)"); + return 13; + } + + public int Test(string[] objs, bool flag) + { + Debugger.Log("call Test(string[] objs, bool flag)"); + return 20; + } + + public int Test(params object[] objs) + { + Debugger.Log("call Test(params object[] objs)"); + return 9; + } + + public int Test(Space e) + { + Debugger.Log("call Test(Space e)"); + return 10; + } + + public int Test33(ref System.Action action) + { + Debugger.Log("ref System.Action action"); + return 14; + } + + public int TestGeneric (T t) where T : Component + { + Debugger.Log("TestGeneric(T t) Call"); + return 11; + } + + public int TestEnum(Space e) + { + Debugger.Log("call TestEnum(Space e)"); + return 10; + } + + public int TestCheckParamNumber(params int[] ns) + { + Debugger.Log("call TestCheckParamNumber(params int[] ns)"); + int n = 0; + + for (int i = 0; i < ns.Length; i++) + { + n += ns[i]; + } + + return n; + } + + public string TestCheckParamString(params string[] ss) + { + Debugger.Log("call TestCheckParamNumber(params string[] ss)"); + string str = null; + + for (int i = 0; i < ss.Length; i++) + { + str += ss[i]; + } + + return str; + } + + public static void TestReflection() + { + Debugger.Log("call TestReflection()"); + } + + public static void TestRefGameObject(ref GameObject go) + { + + } + + public void DoClick() + { + OnClick(); + } + + public TestExport() + { + Debugger.Log("call TestExport()"); + } + + public TestExport(Vector3[] v) + { + Debugger.Log("call TestExport(params Vector3[] v)"); + } + + public TestExport(Vector3 v, string str) + { + Debugger.Log("call TestExport(Vector3 v, string str)"); + } + + public TestExport(Vector3 v) + { + Debugger.Log("call TestExport(Vector3 v)"); + } + + public Nullable TestNullable(Nullable v) + { + Debugger.Log("call TestNullable(Nullable v)"); + return v; + } +} + +public class TestOverload : MonoBehaviour +{ + private string script = +@" + require 'TestExport' + local out = require 'tolua.out' + local GameObject = UnityEngine.GameObject + + function Test(to) + assert(to:Test(1) == 4) + local flag, num = to:Test(out.int) + assert(flag == 3 and num == 1024, 'Test(out)') + assert(to:Test('hello') == 6, 'Test(string)') + assert(to:Test(System.Object.New()) == 8) + assert(to:Test(true) == 15) + assert(to:Test(123, 456) == 5) + assert(to:Test('123', '456') == 1) + assert(to:Test(System.Object.New(), '456') == 1) + assert(to:Test('123', 456) == 9) + assert(to:Test('123', System.Object.New()) == 9) + assert(to:Test(1,2,3) == 12) + assert(to:Test('hello') == 6) + assert(TestExport.Test('hello', 'world') == 7) + assert(to:TestGeneric(GameObject().transform) == 11) + assert(to:TestCheckParamNumber(1,2,3) == 6) + assert(to:TestCheckParamString('1', '2', '3') == '123') + assert(to:Test(TestExport.Space.World) == 10) + print(to.this:get(123)) + to.this:set(1, 456) + local v = to:TestNullable(Vector3.New(1,2,3)) + print(v.z) + end + "; + + void Awake () + { + LuaState state = new LuaState(); + state.Start(); + LuaBinder.Bind(state); + Bind(state); + state.DoString(script, "TestOverload.cs"); + + TestExport to = new TestExport(); + LuaFunction func = state.GetFunction("Test"); + func.Call(to); + state.Dispose(); + } + + void Bind(LuaState state) + { + state.BeginModule(null); + TestExportWrap.Register(state); + state.BeginModule("TestExport"); + TestExport_SpaceWrap.Register(state); + state.EndModule(); + state.EndModule(); + } +} diff --git a/Assets/LuaFramework/ToLua/Examples/TestOverload/TestOverload.cs.meta b/Assets/LuaFramework/ToLua/Examples/TestOverload/TestOverload.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..d38e9bc1a45ec820af1dbd585071ef6dbe7c949b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestOverload/TestOverload.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ccb167912a52c2f4e9f88a1bc02d5083 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Examples/TestOverload/TestOverload.unity b/Assets/LuaFramework/ToLua/Examples/TestOverload/TestOverload.unity new file mode 100644 index 0000000000000000000000000000000000000000..86569d304ff7e5953c7e498e4735d2a21efa7b98 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestOverload/TestOverload.unity @@ -0,0 +1,89 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: .211999997, g: .226999998, b: .259000003, a: 1} + m_AmbientEquatorColor: {r: .114, g: .125, b: .133000001, a: 1} + m_AmbientGroundColor: {r: .0469999984, g: .0430000015, b: .0350000001, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_GIWorkflowMode: 1 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 2 + m_BakeResolution: 40 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_LightmapSnapshot: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: .166666672 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} diff --git a/Assets/LuaFramework/ToLua/Examples/TestOverload/TestOverload.unity.meta b/Assets/LuaFramework/ToLua/Examples/TestOverload/TestOverload.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..f82e5b5d0e2b511fb1dc858580e4229f3d669099 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Examples/TestOverload/TestOverload.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 45830782541ee7a49b44eb5a02d7ecef +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Injection.meta b/Assets/LuaFramework/ToLua/Injection.meta new file mode 100644 index 0000000000000000000000000000000000000000..30b5972e0753fa954e1acd965991a2ce2851e3cc --- /dev/null +++ b/Assets/LuaFramework/ToLua/Injection.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 4621b1a494fd57b498ced8aae8d69afa +folderAsset: yes +timeCreated: 1526805314 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Injection/Editor.meta b/Assets/LuaFramework/ToLua/Injection/Editor.meta new file mode 100644 index 0000000000000000000000000000000000000000..9d92bb1e2555b7384cf569e768240f4fcaadb8f9 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Injection/Editor.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 408aa6da49448a544942370044596d77 +folderAsset: yes +timeCreated: 1515031012 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Injection/Editor/ToLuaInjection.cs b/Assets/LuaFramework/ToLua/Injection/Editor/ToLuaInjection.cs new file mode 100644 index 0000000000000000000000000000000000000000..1ac8a3003e2435e74d8f84d72214f18fffde2427 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Injection/Editor/ToLuaInjection.cs @@ -0,0 +1,1271 @@ +锘#if ENABLE_LUA_INJECTION +using System; +using System.IO; +using System.Xml; +using System.Text; +using System.Linq; +using UnityEngine; +using UnityEditor; +using Mono.Cecil; +using Mono.Cecil.Cil; +using Unity.CecilTools; +using Unity.CecilTools.Extensions; +using System.Reflection; +using LuaInterface; +using UnityEditor.Callbacks; +using System.Collections.Generic; +using MethodBody = Mono.Cecil.Cil.MethodBody; + +class InjectedMethodInfo +{ + public string methodFullSignature; + public string methodOverloadSignature; + public string methodPublishedName; + public string methodName; + public int methodIndex; +} + +[InitializeOnLoad] +public static class ToLuaInjection +{ + static int offset = 0; + static int methodCounter = 0; + static bool EnableSymbols = true; + static Instruction cursor; + static VariableDefinition flagDef; + static VariableDefinition funcDef; + static TypeReference intTypeRef; + static TypeReference injectFlagTypeRef; + static TypeReference noToLuaAttrTypeRef; + static TypeDefinition injectStationTypeDef; + static TypeDefinition luaFunctionTypeDef; + static TypeDefinition luaTableTypeDef; + static MethodReference injectFlagGetter; + static MethodReference injectedFuncGetter; + static HashSet dropTypeGroup = new HashSet(); + static HashSet injectableTypeGroup = new HashSet(); + static Dictionary resultTableGroup = new Dictionary(); + static SortedDictionary> bridgeInfo = new SortedDictionary>(); + static OpCode[] ldargs = new OpCode[] { OpCodes.Ldarg_0, OpCodes.Ldarg_1, OpCodes.Ldarg_2, OpCodes.Ldarg_3 }; + static OpCode[] ldcI4s = new OpCode[] { OpCodes.Ldc_I4_1, OpCodes.Ldc_I4_2, OpCodes.Ldc_I4_4, OpCodes.Ldc_I4_8 }; + const string assemblyPath = "./Library/ScriptAssemblies/Assembly-CSharp.dll"; + const InjectType injectType = InjectType.After | InjectType.Before | InjectType.Replace | InjectType.ReplaceWithPreInvokeBase | InjectType.ReplaceWithPostInvokeBase; + const InjectFilter injectIgnoring = InjectFilter.IgnoreGeneric | InjectFilter.IgnoreConstructor;// | InjectFilter.IgnoreNoToLuaAttr | InjectFilter.IgnoreProperty; + static HashSet dropGenericNameGroup = new HashSet + { + }; + static HashSet dropNamespaceGroup = new HashSet + { + "LuaInterface", + }; + static HashSet forceInjectTypeGroup = new HashSet + { + }; + + static ToLuaInjection() + { + LoadAndCheckAssembly(true); + InjectAll(); + + AppDomain.CurrentDomain.DomainUnload += DomainUnload; + } + + [PostProcessScene] + public static void InjectAll() + { + var injectionStatus = EditorPrefs.GetInt(Application.dataPath + "WaitForInjection", 0); + if (Application.isPlaying || EditorApplication.isCompiling || injectionStatus == 0) + { + return; + } + + bool bInjectInterupted = !LoadBlackList() || ToLuaMenu.UpdateMonoCecil(ref EnableSymbols) != 0 || !LoadBridgeEditorInfo(); + if (!bInjectInterupted) + { + CacheInjectableTypeGroup(); + Inject(); + + AssetDatabase.Refresh(); + } + } + + static void DomainUnload(object sender, System.EventArgs e) + { + Debug.Log("System_AppDomain_CurrentDomain_DomainUnload"); + if (BuildPipeline.isBuildingPlayer) + { + EditorPrefs.SetInt(Application.dataPath + "WaitForInjection", 1); + } + } + + [MenuItem("Lua/Inject All &i", false, 5)] + public static void InjectByMenu() + { + if (Application.isPlaying) + { + EditorUtility.DisplayDialog("璀﹀憡", "娓告垙杩愯杩囩▼涓棤娉曟搷浣", "纭畾"); + return; + } + + EditorPrefs.SetInt(Application.dataPath + "WaitForInjection", 1); + if (EditorApplication.isCompiling) + { + EditorUtility.DisplayDialog("璀﹀憡", "璇风瓑寰呯紪杈戝櫒缂栬瘧瀹屾垚", "纭畾"); + return; + } + + InjectAll(); + } + + static AssemblyDefinition LoadAndCheckAssembly(bool bPulse) + { + var assemblyReader = new ReaderParameters + { + ReadSymbols = EnableSymbols, + AssemblyResolver = GetAssemblyResolver() + }; + AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly(assemblyPath, assemblyReader); + + var alreadyInjected = assembly.CustomAttributes.Any((attr) => + { + return attr.AttributeType.FullName == "LuaInterface.UseDefinedAttribute"; + }); + EditorPrefs.SetInt(Application.dataPath + "InjectStatus", alreadyInjected ? 1 : 0); + + if (bPulse) + { + Clean(assembly); + } + + return assembly; + } + + static void Inject() + { + AssemblyDefinition assembly = null; + try + { + assembly = LoadAndCheckAssembly(false); + if (InjectPrepare(assembly)) + { + foreach (var module in assembly.Modules) + { + int cursor = 0; + int typesCount = module.Types.Count; + foreach (var type in module.Types) + { + ++cursor; + EditorUtility.DisplayProgressBar("Injecting:" + module.FullyQualifiedName, type.FullName, (float)cursor / typesCount); + if (!InjectProcess(assembly, type)) + { + EditorUtility.ClearProgressBar(); + return; + } + } + } + EditorUtility.ClearProgressBar(); + + UpdateInjectionCacheSize(); + ExportInjectionBridgeInfo(); + WriteInjectedAssembly(assembly, assemblyPath); + resultTableGroup.Clear(); + EditorApplication.Beep(); + Debug.Log("Lua Injection Finished!"); + EditorPrefs.SetInt(Application.dataPath + "InjectStatus", 1); + } + + EditorPrefs.SetInt(Application.dataPath + "WaitForInjection", 0); + } + catch (Exception e) + { + Debug.LogError(e.ToString()); + } + finally + { + if (assembly != null) + { + Clean(assembly); + } + } + } + + static bool InjectPrepare(AssemblyDefinition assembly) + { + bool alreadyInjected = EditorPrefs.GetInt(Application.dataPath + "InjectStatus") == 1; + if (alreadyInjected) + { + Debug.Log("Already Injected!"); + return false; + } + resultTableGroup.Clear(); + var injectAttrType = assembly.MainModule.Types.Single(type => type.FullName == "LuaInterface.UseDefinedAttribute"); + var attrCtorInfo = injectAttrType.Methods.Single(method => method.IsConstructor); + assembly.CustomAttributes.Add(new CustomAttribute(attrCtorInfo)); + + intTypeRef = assembly.MainModule.TypeSystem.Int32; + injectFlagTypeRef = assembly.MainModule.TypeSystem.Byte; + noToLuaAttrTypeRef = assembly.MainModule.Types.Single(type => type.FullName == "LuaInterface.NoToLuaAttribute"); + injectStationTypeDef = assembly.MainModule.Types.Single(type => type.FullName == "LuaInterface.LuaInjectionStation"); + luaFunctionTypeDef = assembly.MainModule.Types.Single(method => method.FullName == "LuaInterface.LuaFunction"); + luaTableTypeDef = assembly.MainModule.Types.Single(method => method.FullName == "LuaInterface.LuaTable"); + injectFlagGetter = injectStationTypeDef.Methods.Single(method => method.Name == "GetInjectFlag"); + injectedFuncGetter = injectStationTypeDef.Methods.Single(method => method.Name == "GetInjectionFunction"); + + return true; + } + + static BaseAssemblyResolver GetAssemblyResolver() + { + DefaultAssemblyResolver resolver = new DefaultAssemblyResolver(); + + AppDomain.CurrentDomain + .GetAssemblies() + .Select(assem => Path.GetDirectoryName(assem.ManifestModule.FullyQualifiedName)) + .Distinct() + .Foreach(dir => resolver.AddSearchDirectory(dir)); + + return resolver; + } + + static bool InjectProcess(AssemblyDefinition assembly, TypeDefinition type) + { + if (!DoesTypeInjectable(type)) + { + return true; + } + + foreach (var nestedType in type.NestedTypes) + { + if (!InjectProcess(assembly, nestedType)) + { + return false; + } + } + + foreach (var target in type.Methods) + { + if (target.IsGenericMethodDefinition()) + { + continue; + } + if (!DoesMethodInjectable(target)) + { + continue; + } + int methodIndex = AppendMethod(target); + if (methodIndex == -1) + { + return false; + } + + if (target.IsEnumerator()) + { + InjectCoroutine(assembly, target, methodIndex); + } + else + { + InjectMethod(assembly, target, methodIndex); + } + } + + return true; + } + + static void FillBegin(MethodDefinition target, int methodIndex) + { + MethodBody targetBody = target.Body; + ILProcessor il = targetBody.GetILProcessor(); + targetBody.InitLocals = true; + flagDef = new VariableDefinition(injectFlagTypeRef); + funcDef = new VariableDefinition(luaFunctionTypeDef); + targetBody.Variables.Add(flagDef); + targetBody.Variables.Add(funcDef); + + Instruction startInsertPos = targetBody.Instructions[0]; + il.InsertBefore(startInsertPos, il.Create(OpCodes.Ldc_I4, methodIndex)); + il.InsertBefore(startInsertPos, il.Create(OpCodes.Call, injectFlagGetter)); + il.InsertBefore(startInsertPos, il.Create(OpCodes.Stloc, flagDef)); + il.InsertBefore(startInsertPos, il.Create(OpCodes.Ldloc, flagDef)); + il.InsertBefore(startInsertPos, il.Create(OpCodes.Brfalse, startInsertPos)); + il.InsertBefore(startInsertPos, il.Create(OpCodes.Ldc_I4, methodIndex)); + il.InsertBefore(startInsertPos, il.Create(OpCodes.Call, injectedFuncGetter)); + il.InsertBefore(startInsertPos, il.Create(OpCodes.Stloc, funcDef)); + offset = targetBody.Instructions.IndexOf(startInsertPos); + } + +#region GenericMethod + static void InjectGenericMethod(AssemblyDefinition assembly, MethodDefinition target, int methodIndex) + { + } +#endregion GenericMethod + +#region Coroutine + static void InjectCoroutine(AssemblyDefinition assembly, MethodDefinition target, int methodIndex) + { + InjectType runtimeInjectType = GetMethodRuntimeInjectType(target); + if (runtimeInjectType == InjectType.None) + { + return; + } + + FillBegin(target, methodIndex); + FillReplaceCoroutine(target, runtimeInjectType & InjectType.Replace); + FillCoroutineMonitor(target, runtimeInjectType & (~InjectType.Replace), methodIndex); + } + + static void FillReplaceCoroutine(MethodDefinition target, InjectType runtimeInjectType) + { + if (runtimeInjectType == InjectType.None) + { + return; + } + + MethodBody targetBody = target.Body; + ILProcessor il = targetBody.GetILProcessor(); + cursor = GetMethodNextInsertPosition(target, null, false); + + if (cursor != null) + { + il.InsertBefore(cursor, il.Create(OpCodes.Ldloc, flagDef)); + il.InsertBefore(cursor, il.Create(ldcI4s[(int)InjectType.Replace / 2])); + il.InsertBefore(cursor, il.Create(OpCodes.Bne_Un, cursor)); + + il.InsertBefore(cursor, il.Create(OpCodes.Ldloc, funcDef)); + FillArgs(target, cursor, null); + il.InsertBefore(cursor, il.Create(OpCodes.Call, GetLuaMethodInvoker(target, false, false))); + il.InsertBefore(cursor, il.Create(OpCodes.Ret)); + } + } + + static void FillCoroutineMonitor(MethodDefinition target, InjectType runtimeInjectType, int methodIndex) + { + if (runtimeInjectType == InjectType.None) + { + return; + } + + MethodBody targetBody = target.Body; + FieldDefinition hostField = null; + var coroutineEntity = targetBody.Variables[0].VariableType.Resolve(); + if (!target.DeclaringType.NestedTypes.Any(type => coroutineEntity == type)) + { + return; + } + + cursor = GetMethodNextInsertPosition(target, cursor, true); + CopyCoroutineCreatorReference(target, coroutineEntity, ref hostField); + var coroutineCarrier = coroutineEntity.Methods.Single(method => method.Name == "MoveNext"); + CopyCreatorArgsToCarrier(target, coroutineCarrier); + FillBegin(coroutineCarrier, methodIndex); + var fillInjectInfoFunc = GetCoroutineInjectInfoFiller(target, hostField); + FillInjectMethod(coroutineCarrier, fillInjectInfoFunc, runtimeInjectType & InjectType.After); + FillInjectMethod(coroutineCarrier, fillInjectInfoFunc, runtimeInjectType & InjectType.Before); + } + + static Action GetCoroutineInjectInfoFiller(MethodDefinition coroutineCreator, FieldDefinition hostRef) + { + return (coroutineCarrier, runtimeInjectType) => + { + MethodBody targetBody = coroutineCarrier.Body; + ILProcessor il = targetBody.GetILProcessor(); + + il.InsertBefore(cursor, il.Create(OpCodes.Ldloc, funcDef)); + if (coroutineCreator.HasThis) + { + il.InsertBefore(cursor, il.Create(OpCodes.Ldarg_0)); + il.InsertBefore(cursor, il.Create(OpCodes.Ldfld, hostRef)); + } + CopyCarrierFieldsToArg(coroutineCreator, coroutineCarrier); + FillCoroutineState(coroutineCarrier); + + il.InsertBefore(cursor, il.Create(OpCodes.Call, GetLuaMethodInvoker(coroutineCreator, true, true))); + }; + } + + static void CopyCoroutineCreatorReference(MethodDefinition coroutineCreator, TypeDefinition coroutineCarrier, ref FieldDefinition hostField) + { + if (coroutineCreator.HasThis) + { + ILProcessor il = coroutineCreator.Body.GetILProcessor(); + + hostField = new FieldDefinition("__iHost", Mono.Cecil.FieldAttributes.Public, coroutineCreator.DeclaringType); + coroutineCarrier.Fields.Add(hostField); + il.InsertBefore(cursor, il.Create(OpCodes.Ldloc_0)); + il.InsertBefore(cursor, il.Create(OpCodes.Ldarg_0)); + il.InsertBefore(cursor, il.Create(OpCodes.Stfld, hostField)); + } + } + + static void CopyCreatorArgsToCarrier(MethodDefinition coroutineCreator, MethodDefinition coroutineCarrier) + { + ILProcessor il = coroutineCreator.Body.GetILProcessor(); + var carrierFields = coroutineCarrier.DeclaringType.Fields; + + coroutineCreator + .Parameters + .Foreach(param => + { + var name = "<$>" + param.Name; + if (!carrierFields.Any(field => field.Name == name)) + { + var hostArg = new FieldDefinition(name, Mono.Cecil.FieldAttributes.Public, param.ParameterType); + carrierFields.Add(hostArg); + il.InsertBefore(cursor, il.Create(OpCodes.Ldloc_0)); + il.InsertBefore(cursor, il.Create(OpCodes.Ldarg, param)); + il.InsertBefore(cursor, il.Create(OpCodes.Stfld, hostArg)); + } + }); + } + + static void CopyCarrierFieldsToArg(MethodDefinition coroutineCreator, MethodDefinition coroutineCarrier) + { + ILProcessor il = coroutineCarrier.Body.GetILProcessor(); + var carrierFields = coroutineCarrier.DeclaringType.Fields; + + coroutineCreator + .Parameters + .Select(param => "<$>" + param.Name) + .Foreach(name => + { + var arg = carrierFields.Single(field => field.Name == name); + il.InsertBefore(cursor, il.Create(OpCodes.Ldarg_0)); + il.InsertBefore(cursor, il.Create(OpCodes.Ldfld, arg)); + }); + } + + static void FillCoroutineState(MethodDefinition coroutineCarrier) + { + MethodBody targetBody = coroutineCarrier.Body; + ILProcessor il = targetBody.GetILProcessor(); + + il.InsertBefore(cursor, il.Create(OpCodes.Ldarg_0)); + var stateField = coroutineCarrier.DeclaringType.Fields.Single(field => field.Name == "$PC"); + il.InsertBefore(cursor, il.Create(OpCodes.Ldfld, stateField)); + } + +#endregion Coroutine + +#region NormalMethod + static void InjectMethod(AssemblyDefinition assembly, MethodDefinition target, int methodIndex) + { + FillBegin(target, methodIndex); + InjectType runtimeInjectType = GetMethodRuntimeInjectType(target); + FillInjectMethod(target, FillInjectInfo, runtimeInjectType & InjectType.After); + FillInjectMethod(target, FillInjectInfo, runtimeInjectType & (~InjectType.After)); + } + + static void FillInjectMethod(MethodDefinition target, Action fillInjectInfo, InjectType runtimeInjectType) + { + if (runtimeInjectType == InjectType.None) + { + return; + } + + MethodBody targetBody = target.Body; + ILProcessor il = targetBody.GetILProcessor(); + cursor = GetMethodNextInsertPosition(target, null, runtimeInjectType.HasFlag(InjectType.After)); + + while (cursor != null) + { + bool bAfterInject = runtimeInjectType == InjectType.After; + Instruction startPos = il.Create(OpCodes.Ldloc, flagDef); + if (bAfterInject) + { + /// Replace instruction with references reserved + Instruction endPos = il.Create(OpCodes.Ret); + int replaceIndex = targetBody.Instructions.IndexOf(cursor); + cursor.OpCode = startPos.OpCode; + cursor.Operand = startPos.Operand; + il.InsertAfter(targetBody.Instructions[replaceIndex], endPos); + cursor = targetBody.Instructions[replaceIndex + 1]; + } + else il.InsertBefore(cursor, startPos); + il.InsertBefore(cursor, il.Create(ldcI4s[(int)InjectType.After / 2])); + il.InsertBefore(cursor, il.Create(bAfterInject ? OpCodes.Bne_Un : OpCodes.Ble_Un, cursor)); + + fillInjectInfo(target, runtimeInjectType); + cursor = GetMethodNextInsertPosition(target, cursor, runtimeInjectType.HasFlag(InjectType.After)); + } + } + + static void FillInjectInfo(MethodDefinition target, InjectType runtimeInjectType) + { + FillBaseCall(target, runtimeInjectType, true); + FillLuaMethodCall(target, runtimeInjectType == InjectType.After); + FillBaseCall(target, runtimeInjectType, false); + FillJumpInfo(target, runtimeInjectType == InjectType.After); + } + + static void FillBaseCall(MethodDefinition target, InjectType runtimeInjectType, bool preCall) + { + MethodBody targetBody = target.Body; + ILProcessor il = targetBody.GetILProcessor(); + InjectType curBaseInjectType = preCall ? InjectType.ReplaceWithPreInvokeBase : InjectType.ReplaceWithPostInvokeBase; + + if (runtimeInjectType.HasFlag(curBaseInjectType)) + { + Instruction end = il.Create(OpCodes.Nop); + il.InsertBefore(cursor, end); + il.InsertBefore(end, il.Create(OpCodes.Ldloc, flagDef)); + il.InsertBefore(end, il.Create(OpCodes.Ldc_I4, (int)curBaseInjectType)); + il.InsertBefore(end, il.Create(OpCodes.Bne_Un, end)); + + FillArgs(target, end, PostProcessBaseMethodArg); + il.InsertBefore(end, il.Create(OpCodes.Call, target.GetBaseMethodInstance())); + if (!target.ReturnVoid()) + { + il.InsertBefore(end, il.Create(OpCodes.Pop)); + } + } + } + + static void FillLuaMethodCall(MethodDefinition target, bool bConfirmPopReturnValue) + { + ILProcessor il = target.Body.GetILProcessor(); + Instruction start = il.Create(OpCodes.Ldloc, funcDef); + + if (cursor.Previous.OpCode == OpCodes.Nop) + { + cursor.Previous.OpCode = start.OpCode; + cursor.Previous.Operand = start.Operand; + } + else + { + il.InsertBefore(cursor, start); + } + + FillArgs(target, cursor, ParseArgumentReference); + il.InsertBefore(cursor, il.Create(OpCodes.Call, GetLuaMethodInvoker(target, bConfirmPopReturnValue, false))); + + CacheResultTable(target, bConfirmPopReturnValue); + UpdatePassedByReferenceParams(target, bConfirmPopReturnValue); + } + + static void CacheResultTable(MethodDefinition target, bool bConfirmPopReturnValue) + { + ILProcessor il = target.Body.GetILProcessor(); + if (target.GotPassedByReferenceParam()) + { + il.InsertBefore(cursor, il.Create(OpCodes.Stloc, GetResultTable(target))); + } + } + + static VariableDefinition GetResultTable(MethodDefinition target) + { + VariableDefinition luaTable = null; + resultTableGroup.TryGetValue(target, out luaTable); + if (luaTable == null) + { + luaTable = new VariableDefinition(luaTableTypeDef); + target.Body.Variables.Add(luaTable); + resultTableGroup.Add(target, luaTable); + } + + return luaTable; + } + + static void UpdatePassedByReferenceParams(MethodDefinition target, bool bConfirmPopReturnValue) + { + if (!target.GotPassedByReferenceParam()) + { + return; + } + + int updateCount = 0; + ILProcessor il = target.Body.GetILProcessor(); + VariableDefinition luaTable = GetResultTable(target); + var rawGetGenericMethod = luaTableTypeDef.Methods.Single(method => method.Name == "RawGetIndex"); + + foreach (var param in target.Parameters) + { + if (!param.ParameterType.IsByReference) + { + continue; + } + + var paramType = ElementType.For(param.ParameterType); + il.InsertBefore(cursor, il.Create(OpCodes.Ldarg, param)); + il.InsertBefore(cursor, il.Create(OpCodes.Ldloc, luaTable)); + il.InsertBefore(cursor, il.Create(OpCodes.Ldc_I4, ++updateCount)); + il.InsertBefore(cursor, il.Create(OpCodes.Call, rawGetGenericMethod.MakeGenericMethod(paramType))); + if (paramType.IsValueType) + { + il.InsertBefore(cursor, il.Create(OpCodes.Stobj, paramType)); + } + else + { + il.InsertBefore(cursor, il.Create(OpCodes.Stind_Ref)); + } + } + + if (!bConfirmPopReturnValue && !target.ReturnVoid()) + { + il.InsertBefore(cursor, il.Create(OpCodes.Ldloc, luaTable)); + il.InsertBefore(cursor, il.Create(OpCodes.Ldc_I4, ++updateCount)); + il.InsertBefore(cursor, il.Create(OpCodes.Call, rawGetGenericMethod.MakeGenericMethod(target.ReturnType))); + } + } + + static void FillJumpInfo(MethodDefinition target, bool bConfirmPopReturnValue) + { + MethodBody targetBody = target.Body; + ILProcessor il = targetBody.GetILProcessor(); + + if (!bConfirmPopReturnValue) + { + Instruction retIns = il.Create(OpCodes.Ret); + if (!injectType.HasFlag(InjectType.Before)) + { + if (cursor.Previous.OpCode == OpCodes.Nop) + { + cursor.Previous.OpCode = retIns.OpCode; + cursor.Previous.Operand = retIns.Operand; + retIns = cursor.Previous; + } + else + { + il.InsertBefore(cursor, retIns); + } + } + else + { + Instruction start = il.Create(OpCodes.Ldloc, flagDef); + if (cursor.Previous.OpCode == OpCodes.Nop) + { + cursor.Previous.OpCode = start.OpCode; + cursor.Previous.Operand = start.Operand; + il.InsertAfter(cursor.Previous, retIns); + } + else + { + il.InsertBefore(cursor, retIns); + il.InsertBefore(retIns, start); + } + + Instruction popIns = il.Create(OpCodes.Pop); + bool bGotReturnValue = !target.ReturnVoid(); + if (bGotReturnValue) + { + il.InsertBefore(cursor, popIns); + } + il.InsertBefore(retIns, il.Create(ldcI4s[(int)InjectType.Before / 2])); + il.InsertBefore(retIns, il.Create(OpCodes.Ble_Un, bGotReturnValue ? popIns : cursor)); + } + } + else if (cursor.Previous.OpCode == OpCodes.Nop) + { + targetBody.Instructions.Remove(cursor.Previous); + } + } +#endregion NormalMethod + + static void FillArgs(MethodDefinition target, Instruction endPoint, Action parseReferenceProcess) + { + MethodBody targetBody = target.Body; + ILProcessor il = targetBody.GetILProcessor(); + int paramCount = target.Parameters.Count + (target.HasThis ? 1 : 0); + + for (int i = 0; i < paramCount; ++i) + { + if (i < ldargs.Length) + { + il.InsertBefore(endPoint, il.Create(ldargs[i])); + } + else if (i <= byte.MaxValue) + { + il.InsertBefore(endPoint, il.Create(OpCodes.Ldarg_S, (byte)i)); + } + else + { + il.InsertBefore(endPoint, il.Create(OpCodes.Ldarg, (short)i)); + } + + if (parseReferenceProcess != null) + { + parseReferenceProcess(target, endPoint, i); + } + } + } + + static void PostProcessBaseMethodArg(MethodDefinition target, Instruction endPoint, int paramIndex) + { + var declaringType = target.DeclaringType; + ILProcessor il = target.Body.GetILProcessor(); + if (paramIndex == 0 && declaringType.IsValueType) + { + il.InsertBefore(endPoint, il.Create(OpCodes.Ldobj, declaringType)); + il.InsertBefore(endPoint, il.Create(OpCodes.Box, declaringType)); + } + } + + static void ParseArgumentReference(MethodDefinition target, Instruction endPoint, int paramIndex) + { + ParameterDefinition param = null; + ILProcessor il = target.Body.GetILProcessor(); + + if (target.HasThis) + { + if (paramIndex > 0) + { + param = target.Parameters[paramIndex - 1]; + } + else if (target.DeclaringType.IsValueType) + { + il.InsertBefore(endPoint, il.Create(OpCodes.Ldobj, target.DeclaringType)); + } + } + else if (!target.HasThis) + { + param = target.Parameters[paramIndex]; + } + + if (param != null && param.ParameterType.IsByReference) + { + TypeReference paramType = ElementType.For(param.ParameterType); + if (paramType.IsValueType) + { + il.InsertBefore(endPoint, il.Create(OpCodes.Ldobj, paramType)); + } + else + { + il.InsertBefore(endPoint, il.Create(OpCodes.Ldind_Ref)); + } + } + } + + static Instruction GetMethodNextInsertPosition(MethodDefinition target, Instruction curPoint, bool bInsertBeforeRet) + { + MethodBody targetBody = target.Body; + if (target.IsConstructor || bInsertBeforeRet) + { + if (curPoint != null) + { + return targetBody.Instructions + .SkipWhile(ins => ins != curPoint) + .FirstOrDefault(ins => ins != curPoint && ins.OpCode == OpCodes.Ret); + } + else + { + return targetBody.Instructions + .FirstOrDefault(ins => ins.OpCode == OpCodes.Ret); + } + } + else + { + if (curPoint != null) return null; + else return targetBody.Instructions[offset]; + } + } + + static InjectType GetMethodRuntimeInjectType(MethodDefinition target) + { + InjectType type = injectType; + + //bool bOverrideParantMethodFlag = target.IsVirtual && target.IsReuseSlot; + var parantMethod = target.GetBaseMethodInstance(); + if (target.IsConstructor) + { + type &= ~InjectType.Before; + type &= ~InjectType.Replace; + type &= ~InjectType.ReplaceWithPostInvokeBase; + type &= ~InjectType.ReplaceWithPreInvokeBase; + } + else if (parantMethod == null || target.IsEnumerator()) + { + type &= ~InjectType.ReplaceWithPostInvokeBase; + type &= ~InjectType.ReplaceWithPreInvokeBase; + } + else if (!target.HasBody) + { + type &= ~InjectType.After; + type &= ~InjectType.Before; + } + + return type; + } + + static MethodReference GetLuaMethodInvoker(MethodDefinition prototypeMethod, bool bIgnoreReturnValue, bool bAppendCoroutineState) + { + MethodReference injectMethod = null; + + GetLuaInvoker(prototypeMethod, bIgnoreReturnValue, bAppendCoroutineState, ref injectMethod); + FillLuaInvokerGenericArguments(prototypeMethod, bIgnoreReturnValue, bAppendCoroutineState, ref injectMethod); + + return injectMethod; + } + + static void GetLuaInvoker(MethodDefinition prototypeMethod, bool bIgnoreReturnValue, bool bAppendCoroutineState, ref MethodReference invoker) + { + bool bRequireResult = prototypeMethod.GotPassedByReferenceParam() + || (!bIgnoreReturnValue && !prototypeMethod.ReturnVoid()); + string methodName = bRequireResult ? "Invoke" : "Call"; + int paramCount = prototypeMethod.Parameters.Count; + int paramExtraCount = prototypeMethod.HasThis ? 1 : 0; + paramExtraCount = bAppendCoroutineState ? paramExtraCount + 1 : paramExtraCount; + paramCount += paramExtraCount; + invoker = luaFunctionTypeDef.Methods.FirstOrDefault(method => + { + return method.Name == methodName && method.Parameters.Count == paramCount; + }); + + if (invoker == null) + { + Debug.Log(prototypeMethod.FullName + " Got too many parameters!!!Skipped!!!"); + } + } + + static void FillLuaInvokerGenericArguments(MethodDefinition prototypeMethod, bool bIgnoreReturnValue, bool bAppendCoroutineState, ref MethodReference invoker) + { + if (invoker.HasGenericParameters) + { + GenericInstanceMethod genericInjectMethod = new GenericInstanceMethod(invoker.CloneMethod()); + + if (prototypeMethod.HasThis) + { + genericInjectMethod.GenericArguments.Add(prototypeMethod.DeclaringType); + } + foreach (ParameterDefinition parameter in prototypeMethod.Parameters) + { + var paramType = parameter.ParameterType.IsByReference ? ElementType.For(parameter.ParameterType) : parameter.ParameterType; + genericInjectMethod.GenericArguments.Add(paramType); + } + if (bAppendCoroutineState) + { + genericInjectMethod.GenericArguments.Add(intTypeRef); + } + if (prototypeMethod.GotPassedByReferenceParam()) + { + genericInjectMethod.GenericArguments.Add(luaTableTypeDef); + } + else if (!bIgnoreReturnValue && !prototypeMethod.ReturnVoid()) + { + genericInjectMethod.GenericArguments.Add(prototypeMethod.ReturnType); + } + + invoker = genericInjectMethod; + } + } + + static void UpdateInjectionCacheSize() + { + var staticConstructor = injectStationTypeDef.Methods.Single((method) => + { + return method.Name == ".cctor"; + }); + + var il = staticConstructor.Body.GetILProcessor(); + Instruction loadStaticFieldIns = null; + loadStaticFieldIns = staticConstructor + .Body + .Instructions + .FirstOrDefault(ins => + { + return ins.OpCode == OpCodes.Ldsfld + && (ins.Operand as FieldReference).Name == "cacheSize"; + }); + + var loadCacheSizeIns = il.Create(OpCodes.Ldc_I4, methodCounter + 1); + il.InsertBefore(loadStaticFieldIns, loadCacheSizeIns); + il.InsertBefore(loadStaticFieldIns, il.Create(OpCodes.Stsfld, (loadStaticFieldIns.Operand as FieldReference))); + } + + static void WriteInjectedAssembly(AssemblyDefinition assembly, string assemblyPath) + { + var writerParameters = new WriterParameters { WriteSymbols = EnableSymbols }; + assembly.Write(assemblyPath, writerParameters); + } + + static void ExportInjectionBridgeInfo() + { + ExportInjectionPublishInfo(bridgeInfo); + ExportInjectionEditorInfo(bridgeInfo); + } + + static void ExportInjectionPublishInfo(SortedDictionary> data) + { + var temp = data.ToDictionary( + typeInfo => typeInfo.Key, + typeinfo => + { + return typeinfo.Value + .OrderBy(methodInfo => methodInfo.methodPublishedName) + .ToDictionary( + methodInfo => methodInfo.methodPublishedName, + methodInfo => methodInfo.methodIndex + ); + } + ); + + StringBuilder sb = StringBuilderCache.Acquire(); + sb.Append("return "); + ToLuaText.TransferDic(temp, sb); + sb.Remove(sb.Length - 1, 1); + File.WriteAllText(CustomSettings.baseLuaDir + "System/Injection/InjectionBridgeInfo.lua", StringBuilderCache.GetStringAndRelease(sb)); + } + + static int AppendMethod(MethodDefinition method) + { + string methodSignature = GetMethodSignature(method); + string methodFullSignature = method.FullName; + InjectedMethodInfo newInfo = new InjectedMethodInfo(); + string typeName = ToLuaInjectionHelper.GetTypeName(method.DeclaringType, true); + List typeMethodIndexGroup = null; + bridgeInfo.TryGetValue(typeName, out typeMethodIndexGroup); + + if (typeMethodIndexGroup == null) + { + typeMethodIndexGroup = new List(); + newInfo.methodPublishedName = method.Name; + bridgeInfo.Add(typeName, typeMethodIndexGroup); + } + else + { + InjectedMethodInfo existInfo = typeMethodIndexGroup.Find(info => info.methodOverloadSignature == methodSignature); + + if (existInfo == null) + { + existInfo = typeMethodIndexGroup.Find(info => info.methodName == method.Name); + if (existInfo != null) + { + newInfo.methodPublishedName = methodSignature; + existInfo.methodPublishedName = existInfo.methodOverloadSignature; + } + else + { + newInfo.methodPublishedName = method.Name; + } + } + else + { + if (existInfo.methodFullSignature != methodFullSignature) + { + Debug.LogError(typeName + "." + existInfo.methodPublishedName + " 绛惧悕璺熷巻鍙茬鍚嶄笉涓鑷达紝鏃犳硶澧為噺锛孖njection涓柇锛岃淇敼鍑芥暟绛惧悕銆佹垨鑰呯洿鎺ュ垹鎺塈njectionBridgeEditorInfo.xml锛堣鎿嶄綔浼氬鑷存棤娉曞吋瀹圭嚎涓婄増鐨勫寘浣擄紝闇瑕佸己鍒舵崲鍖咃級锛"); + EditorPrefs.SetInt(Application.dataPath + "WaitForInjection", 0); + return -1; + } + return existInfo.methodIndex; + } + } + + newInfo.methodName = method.Name; + newInfo.methodOverloadSignature = methodSignature; + newInfo.methodFullSignature = methodFullSignature; + newInfo.methodIndex = ++methodCounter; + typeMethodIndexGroup.Add(newInfo); + + return methodCounter; + } + + static string GetMethodSignature(MethodDefinition method) + { + StringBuilder paramsTypeNameBuilder = StringBuilderCache.Acquire(); + paramsTypeNameBuilder.Append(method.Name); + + foreach (var param in method.Parameters) + { + paramsTypeNameBuilder + .Append("_") + .Append(ToLuaInjectionHelper.GetTypeName(param.ParameterType)); + } + + return StringBuilderCache.GetStringAndRelease(paramsTypeNameBuilder); + } + + static void ExportInjectionEditorInfo(SortedDictionary> data) + { + string incrementalFilePath = CustomSettings.injectionFilesPath + "InjectionBridgeEditorInfo.xml"; + if (File.Exists(incrementalFilePath)) + { + File.Delete(incrementalFilePath); + } + + var doc = new XmlDocument(); + var fileInforRoot = doc.CreateElement("Root"); + doc.AppendChild(fileInforRoot); + + foreach (var type in data) + { + XmlElement typeNode = doc.CreateElement("Type"); + typeNode.SetAttribute("Name", type.Key); + + var sortedMethodsGroup = type.Value.OrderBy(info => info.methodPublishedName); + foreach (var method in sortedMethodsGroup) + { + XmlElement typeMethodNode = doc.CreateElement("Method"); + typeMethodNode.SetAttribute("Name", method.methodName); + typeMethodNode.SetAttribute("PublishedName", method.methodPublishedName); + typeMethodNode.SetAttribute("Signature", method.methodOverloadSignature); + typeMethodNode.SetAttribute("FullSignature", method.methodFullSignature); + typeMethodNode.SetAttribute("Index", method.methodIndex.ToString()); + typeNode.AppendChild(typeMethodNode); + } + + fileInforRoot.AppendChild(typeNode); + } + + doc.Save(incrementalFilePath); + } + + static bool LoadBridgeEditorInfo() + { + bridgeInfo.Clear(); + methodCounter = 0; + string incrementalFilePath = CustomSettings.injectionFilesPath + "InjectionBridgeEditorInfo.xml"; + if (!File.Exists(incrementalFilePath)) + { + return true; + } + + var doc = new XmlDocument(); + doc.Load(incrementalFilePath); + var fileInfoRoot = doc.FindChildByName("Root"); + if (fileInfoRoot == null) + { + return true; + } + + foreach (XmlNode typeChild in fileInfoRoot.ChildNodes) + { + List typeMethodInfo = new List(); + string typeName = typeChild.FindAttributeByName("Name").Value; + + foreach (XmlNode methodChild in typeChild.ChildNodes) + { + InjectedMethodInfo info = new InjectedMethodInfo(); + info.methodName = methodChild.FindAttributeByName("Name").Value; + info.methodPublishedName = methodChild.FindAttributeByName("PublishedName").Value; + info.methodOverloadSignature = methodChild.FindAttributeByName("Signature").Value; + info.methodFullSignature = methodChild.FindAttributeByName("FullSignature").Value; + info.methodIndex = int.Parse(methodChild.FindAttributeByName("Index").Value); + typeMethodInfo.Add(info); + methodCounter = Math.Max(methodCounter, info.methodIndex); + } + + bridgeInfo.Add(typeName, typeMethodInfo); + } + + return true; + } + + static void Clean(AssemblyDefinition assembly) + { + if (assembly.MainModule.SymbolReader != null) + { + assembly.MainModule.SymbolReader.Dispose(); + } + } + + static void CacheInjectableTypeGroup() + { + injectableTypeGroup.Clear(); + + Assembly assebly = Assembly.Load("Assembly-CSharp"); + foreach (Type t in assebly.GetTypes()) + { + if (DoesTypeInjectable(t)) + { + injectableTypeGroup.Add(t.FullName); + } + } + } + + static bool DoesTypeInjectable(Type type) + { + if (dropTypeGroup.Contains(type.FullName) || (type.DeclaringType != null && dropTypeGroup.Contains(type.DeclaringType.FullName))) + { + return false; + } + + if (type.IsGenericType) + { + Type genericTypeDefinition = type.GetGenericTypeDefinition(); + if (dropGenericNameGroup.Contains(genericTypeDefinition.FullName)) + { + return false; + } + } + + if (typeof(System.Delegate).IsAssignableFrom(type)) + { + return false; + } + + if (type.FullName.Contains("<") || type.IsInterface) + { + return false; + } + + if (!injectIgnoring.HasFlag(InjectFilter.IgnoreNoToLuaAttr)) + { + foreach (var attr in type.GetCustomAttributes(true)) + { + Type attrT = attr.GetType(); + if (attrT == typeof(LuaInterface.NoToLuaAttribute)) + { + return false; + } + } + } + + return true; + } + + static bool DoesTypeInjectable(TypeDefinition type) + { + if (dropNamespaceGroup.Contains(type.SafeNamespace())) + { + return false; + } + + if (!injectableTypeGroup.Contains(type.FullName.Replace("/", "+"))) + { + return false; + } + + if (injectIgnoring.HasFlag(InjectFilter.IgnoreConstructor) && type.Methods.Count == 1) + { + return false; + } + + if (!injectIgnoring.HasFlag(InjectFilter.IgnoreNoToLuaAttr)) + { + if (type.CustomAttributes.Any((attr) => attr.AttributeType == noToLuaAttrTypeRef)) + { + return false; + } + } + + return true; + } + + static bool DoesMethodInjectable(MethodDefinition method) + { + if (method.IsSpecialName) + { + if (method.Name == ".cctor") + { + return false; + } + + bool bIgnoreConstructor = injectIgnoring.HasFlag(InjectFilter.IgnoreConstructor) + || method.DeclaringType.IsAssignableTo("UnityEngine.MonoBehaviour") + || method.DeclaringType.IsAssignableTo("UnityEngine.ScriptableObject"); + if (method.IsConstructor) + { + if (bIgnoreConstructor) + { + return false; + } + } + else + { + ///Skip add_銆乺emove_銆乷p_銆丗inalize + if (!method.IsGetter && !method.IsSetter) + { + return false; + } + } + } + + if (method.Name.Contains("<") || method.IsUnmanaged || method.IsAbstract || method.IsPInvokeImpl || !method.HasBody) + { + return false; + } + + /// Skip Unsafe + if (method.Body.Variables.Any(var => var.VariableType.IsPointer) || method.Parameters.Any(param => param.ParameterType.IsPinned)) + { + return false; + } + + /// Hmm... Sometimes method.IsSpecialName Got False + if (method.Name == "Finalize") + { + return false; + } + + if ((method.IsGetter || method.IsSetter) && injectIgnoring.HasFlag(InjectFilter.IgnoreProperty)) + { + return false; + } + + if (!injectIgnoring.HasFlag(InjectFilter.IgnoreNoToLuaAttr)) + { + if (method.CustomAttributes.Any((attr) => attr.AttributeType == noToLuaAttrTypeRef)) + { + return false; + } + } + + if (method.ReturnType.IsAssignableTo("System.Collections.IEnumerable")) + { + return false; + } + + MethodReference luaInjector = null; + GetLuaInvoker(method, true, false, ref luaInjector); + if (luaInjector == null) + { + return false; + } + + return true; + } + + static bool LoadBlackList() + { + if (File.Exists(InjectionBlackListGenerator.blackListFilePath)) + { + dropTypeGroup.UnionWith(File.ReadAllLines(InjectionBlackListGenerator.blackListFilePath)); + dropTypeGroup.ExceptWith(forceInjectTypeGroup); + } + else + { + if (EditorUtility.DisplayDialog("璀﹀憡", "鐢变簬Injection浼氶澶栧鍔犱唬鐮侀噺锛屾晠鍙互鍏堣缃竴浜汭njection璺宠繃鐨勪唬鐮佺洰褰(姣斿NGUI鎻掍欢浠g爜鐩綍)锛屽噺灏戠敓鎴愮殑浠g爜閲", "璁剧疆榛戝悕鍗", "鍏ㄩ噺鐢熸垚")) + { + InjectionBlackListGenerator.Open(); + InjectionBlackListGenerator.onBlackListGenerated += InjectAll; + return false; + } + } + + return true; + } +} + +public static class SystemXMLExtension +{ + public static XmlNode FindChildByName(this XmlNode root, string childName) + { + var child = root.FirstChild; + while (child != null) + { + if (child.Name.Equals(childName)) + { + return child; + } + else + { + child = child.NextSibling; + } + } + + return null; + } + + public static XmlAttribute FindAttributeByName(this XmlNode node, string attributeName) + { + var attributeCollection = node.Attributes; + for (int i = 0; i < attributeCollection.Count; i++) + { + if (attributeCollection[i].Name.Equals(attributeName)) + { + return attributeCollection[i]; + } + } + + return null; + } +} + +#endif \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Injection/Editor/ToLuaInjection.cs.meta b/Assets/LuaFramework/ToLua/Injection/Editor/ToLuaInjection.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..b3dac41ecea8dcfdd6e5776c656378d581250736 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Injection/Editor/ToLuaInjection.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 576ad269863310b4aba201ae8896a3ef +timeCreated: 1512461674 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Injection/Editor/ToLuaInjectionHelper.cs b/Assets/LuaFramework/ToLua/Injection/Editor/ToLuaInjectionHelper.cs new file mode 100644 index 0000000000000000000000000000000000000000..4995694f2534c0202a0225a9b226589896dd976b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Injection/Editor/ToLuaInjectionHelper.cs @@ -0,0 +1,394 @@ +锘#if ENABLE_LUA_INJECTION +using System; +using System.Collections.Generic; +using Mono.Cecil; +using Mono.Cecil.Cil; +using Unity.CecilTools; +using System.Linq; + +[Flags] +public enum InjectFilter +{ + IgnoreConstructor = 1, + IgnoreProperty = 1 << 1, + IgnoreGeneric = 1 << 2, + IgnoreNoToLuaAttr = 1 << 3, +} + +public static class ToLuaInjectionHelper +{ + public static string GetArrayRank(TypeReference t) + { + ArrayType type = t as ArrayType; + int count = type.Rank; + + if (count == 1) + { + return "[]"; + } + + using (CString.Block()) + { + CString sb = CString.Alloc(64); + sb.Append('['); + + for (int i = 1; i < count; i++) + { + sb.Append(','); + } + + sb.Append(']'); + return sb.ToString(); + } + } + + public static string GetTypeName(TypeReference t, bool bFull = false) + { + if (t.IsArray) + { + string str = GetTypeName(ElementType.For(t)); + str += GetArrayRank(t); + return str; + } + else if (t.IsByReference) + { + //t = t.GetElementType(); + return GetTypeName(ElementType.For(t)) + "&"; + } + else if (t.IsGenericInstance) + { + return GetGenericName(t, bFull); + } + else if (t.MetadataType == MetadataType.Void) + { + return "void"; + } + else + { + string name = GetPrimitiveTypeStr(t, bFull); + return name.Replace('+', '.'); + } + } + + public static string[] GetGenericName(Mono.Collections.Generic.Collection types, int offset, int count, bool bFull) + { + string[] results = new string[count]; + + for (int i = 0; i < count; i++) + { + int pos = i + offset; + + if (types[pos].IsGenericInstance) + { + results[i] = GetGenericName(types[pos], bFull); + } + else + { + results[i] = GetTypeName(types[pos]); + } + } + + return results; + } + + public static MethodReference GetBaseMethodInstance(this MethodDefinition target) + { + MethodDefinition baseMethodDef = null; + var baseType = target.DeclaringType.BaseType; + + while (baseType != null) + { + if (baseType.MetadataToken.TokenType == TokenType.TypeRef) + { + break; + } + + var baseTypeDef = baseType.Resolve(); + baseMethodDef = baseTypeDef.Methods.FirstOrDefault(method => + { + return method.Name == target.Name + && target.Parameters + .Select(param => param.ParameterType.FullName) + .SequenceEqual(method.Parameters.Select(param => param.ParameterType.FullName)) + && method.ReturnType.FullName == target.ReturnType.FullName; + }); + + if (baseMethodDef != null && !baseMethodDef.IsAbstract) + { + if (baseType.IsGenericInstance) + { + MethodReference baseMethodRef = baseTypeDef.Module.Import(baseMethodDef); + var baseTypeInstance = (GenericInstanceType)baseType; + return baseMethodRef.MakeGenericMethod(baseTypeInstance.GenericArguments.ToArray()); + } + break; + } + else baseMethodDef = null; + + baseType = baseTypeDef.BaseType; + } + + return baseMethodDef; + } + + public static bool IsGenericTypeDefinition(this TypeReference type) + { + if (type.HasGenericParameters) + { + return true; + } + else if (type.IsByReference || type.IsArray) + { + return ElementType.For(type).IsGenericTypeDefinition(); + } + else if (type.IsNested) + { + var parent = type.DeclaringType; + while (parent != null) + { + if (parent.IsGenericTypeDefinition()) + { + return true; + } + + if (parent.IsNested) + { + parent = parent.DeclaringType; + } + else + { + break; + } + } + } + + return type.IsGenericParameter; + } + + public static bool IsGenericMethodDefinition(this MethodDefinition md) + { + if (md.HasGenericParameters +#if UNITY_5_2 || UNITY_5_3 || UNITY_5_3_OR_NEWER + || md.ContainsGenericParameter +#endif + ) + { + return true; + } + + if (md.DeclaringType != null && md.DeclaringType.IsGenericTypeDefinition()) + { + return true; + } + + if (md.ReturnType.IsGenericTypeDefinition()) + { + return true; + } + + foreach (var param in md.Parameters) + { + if (param.ParameterType.IsGenericTypeDefinition()) + { + return true; + } + } + + return false; + } + + public static bool GotPassedByReferenceParam(this MethodReference md) + { + return md.Parameters.Any(param => param.ParameterType.IsByReference); + } + + public static TypeReference MakeGenericType(this TypeReference self, params TypeReference[] arguments) + { + if (self.GenericParameters.Count != arguments.Length) + { + throw new ArgumentException(); + } + + var instance = new GenericInstanceType(self); + foreach (var argument in arguments) + { + instance.GenericArguments.Add(argument); + } + + return instance; + } + + public static MethodReference MakeGenericMethod(this MethodReference self, params TypeReference[] arguments) + { + if (self.DeclaringType.IsGenericTypeDefinition()) + { + return self.CloneMethod(self.DeclaringType.MakeGenericType(arguments)); + } + else + { + var genericInstanceMethod = new GenericInstanceMethod(self.CloneMethod()); + + foreach (var argument in arguments) + { + genericInstanceMethod.GenericArguments.Add(argument); + } + + return genericInstanceMethod; + } + } + + public static MethodReference CloneMethod(this MethodReference self, TypeReference declaringType = null) + { + var reference = new MethodReference(self.Name, self.ReturnType, declaringType ?? self.DeclaringType) + { + HasThis = self.HasThis, + ExplicitThis = self.ExplicitThis, + CallingConvention = self.CallingConvention, + }; + + foreach (ParameterDefinition parameterDef in self.Parameters) + { + reference.Parameters.Add(new ParameterDefinition(parameterDef.Name, parameterDef.Attributes, parameterDef.ParameterType)); + } + + foreach (GenericParameter genParamDef in self.GenericParameters) + { + reference.GenericParameters.Add(new GenericParameter(genParamDef.Name, reference)); + } + + return reference; + } + + public static bool IsEnumerator(this MethodDefinition md) + { + return md.ReturnType.FullName == "System.Collections.IEnumerator"; + } + + public static bool ReturnVoid(this MethodDefinition target) + { + return target.ReturnType.FullName == "System.Void"; + } + + public static bool HasFlag(this LuaInterface.InjectType flag, LuaInterface.InjectType destFlag) + { + return (flag & destFlag) == destFlag; + } + + public static bool HasFlag(this LuaInterface.InjectType flag, byte destFlag) + { + return ((byte)flag & destFlag) == destFlag; + } + + public static bool HasFlag(this InjectFilter flag, InjectFilter destFlag) + { + return (flag & destFlag) == destFlag; + } + + public static string GetPrimitiveTypeStr(TypeReference t, bool bFull) + { + switch (t.MetadataType) + { + case MetadataType.Single: + return "float"; + case MetadataType.String: + return "string"; + case MetadataType.Int32: + return "int"; + case MetadataType.Double: + return "double"; + case MetadataType.Boolean: + return "bool"; + case MetadataType.UInt32: + return "uint"; + case MetadataType.SByte: + return "sbyte"; + case MetadataType.Byte: + return "byte"; + case MetadataType.Int16: + return "short"; + case MetadataType.UInt16: + return "ushort"; + case MetadataType.Char: + return "char"; + case MetadataType.Int64: + return "long"; + case MetadataType.UInt64: + return "ulong"; + case MetadataType.Object: + return "object"; + default: + return bFull ? t.FullName.Replace("/", "+") : t.Name; + } + } + + static string CombineTypeStr(string space, string name) + { + if (string.IsNullOrEmpty(space)) + { + return name; + } + else + { + return space + "." + name; + } + } + + static string GetGenericName(TypeReference t, bool bFull) + { + GenericInstanceType type = t as GenericInstanceType; + var gArgs = type.GenericArguments; + + string typeName = bFull ? t.FullName.Replace("/", "+") : t.Name; + int count = gArgs.Count; + int pos = typeName.IndexOf("["); + + if (pos > 0) + { + typeName = typeName.Substring(0, pos); + } + + string str = null; + string name = null; + int offset = 0; + pos = typeName.IndexOf("+"); + + while (pos > 0) + { + str = typeName.Substring(0, pos); + typeName = typeName.Substring(pos + 1); + pos = str.IndexOf('`'); + + if (pos > 0) + { + count = (int)(str[pos + 1] - '0'); + str = str.Substring(0, pos); + str += "<" + string.Join(",", GetGenericName(gArgs, offset, count, bFull)) + ">"; + offset += count; + } + + name = CombineTypeStr(name, str); + pos = typeName.IndexOf("+"); + } + + str = typeName; + + if (offset < gArgs.Count) + { + pos = str.IndexOf('`'); + count = (int)(str[pos + 1] - '0'); + str = str.Substring(0, pos); + str += "<" + string.Join(",", GetGenericName(gArgs, offset, count, bFull)) + ">"; + } + + return CombineTypeStr(name, str); + } + + public static void Foreach(this IEnumerable source, Action callback) + { + foreach (var val in source) + { + callback(val); + } + } +} +#endif \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Injection/Editor/ToLuaInjectionHelper.cs.meta b/Assets/LuaFramework/ToLua/Injection/Editor/ToLuaInjectionHelper.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..2680d2854157128946054e0b486f1ddb86d8f6a9 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Injection/Editor/ToLuaInjectionHelper.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: dce8c9cb062a97740b01381922e799a1 +timeCreated: 1513238253 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Injection/Editor/ToLuaText.cs b/Assets/LuaFramework/ToLua/Injection/Editor/ToLuaText.cs new file mode 100644 index 0000000000000000000000000000000000000000..8c32facc6a141b9e87208091a63f3991997d976a --- /dev/null +++ b/Assets/LuaFramework/ToLua/Injection/Editor/ToLuaText.cs @@ -0,0 +1,222 @@ +锘縰sing System; +using System.Text; +using System.Reflection; +using System.Collections.Generic; + +public interface LuaSerialization +{ + bool Serialize(StringBuilder sb, int indent); + //void UnSerilize(IntPtr L); +} + +public static class ToLuaText +{ + static Type listTypeDefinition = typeof(List<>); + static Type dictionaryTypeDefinition = typeof(Dictionary<,>); + static MethodInfo customTransferGenericMethod; + static MethodInfo listTransferGenericMethod; + static MethodInfo arrayTransferGenericMethod; + static MethodInfo dictionaryTransferGenericMethod; + + static ToLuaText() + { + var classType = typeof(ToLuaText); + customTransferGenericMethod = classType.GetMethod("TransferCustomData", BindingFlags.Static | BindingFlags.NonPublic); + listTransferGenericMethod = classType.GetMethod("TransferList"); + arrayTransferGenericMethod = classType.GetMethod("TransferArray"); + dictionaryTransferGenericMethod = classType.GetMethod("TransferDic"); + } + + public static bool TransferList(List list, StringBuilder sb, int indent = 0) + { + return TransferArray(list.ToArray(), sb, indent); + } + + public static bool TransferArray(T[] array, StringBuilder sb, int indent = 0) + { + bool bSerializeSuc = false; + int validContentLength = sb.Length; + + NestBegin(sb, indent); + + if (array.Length <= 0) + { + bSerializeSuc = false; + WipeInvalidContent(sb, validContentLength); + return bSerializeSuc; + } + + foreach (var item in array) + { + if (SerializeData(sb, indent, item)) + bSerializeSuc = true; + } + + if (!IsCommonData(typeof(T))) + sb.Append("\n"); + else + sb.Remove(sb.Length - 2, 2);///绉婚櫎鏈鍚庝竴涓", "瀛楃缁,涓轰簡閮ㄥ垎婊¤冻寮鸿揩鐥 + + if (bSerializeSuc) + NestEnd(sb, indent); + else + WipeInvalidContent(sb, validContentLength); + + return bSerializeSuc; + } + + public static bool TransferDic(Dictionary dic, StringBuilder sb, int indent = 0) + { + var keyType = typeof(T); + bool bSerializeSuc = false; + int validContentLength = sb.Length; + + NestBegin(sb, indent); + + if (dic.Count <= 0/* || !IsDataTypeSerializable(keyType)*/) + { + bSerializeSuc = false; + WipeInvalidContent(sb, validContentLength); + return bSerializeSuc; + } + + string keyDataFormat = keyType == typeof(string) ? "[\"{0}\"] = " : "[{0}] = "; + + ++indent; + foreach (var item in dic) + { + int tempValidContentLength = sb.Length; + sb.Append("\n"); + AppendIndent(sb, indent); + /// 涓嶇鏄笉鏄嚜瀹氫箟鏁版嵁锛屽彧瑕乼ostring鑳界敤灏辫 + sb.AppendFormat(keyDataFormat, item.Key); + + if (SerializeData(sb, indent, item.Value)) + bSerializeSuc = true; + else + WipeInvalidContent(sb, tempValidContentLength); + } + --indent; + + sb.Append("\n"); + if (bSerializeSuc) + NestEnd(sb, indent); + else + WipeInvalidContent(sb, validContentLength); + + return bSerializeSuc; + } + + public static MethodInfo MakeGenericArrayTransferMethod(Type type) + { + return arrayTransferGenericMethod.MakeGenericMethod(new Type[] { type }); + } + + public static void AppendIndent(StringBuilder sb, int indent) + { + for (int i = 0; i < indent; ++i) + sb.Append("\t"); + } + + public static void AppendValue(Type valueType, string value, StringBuilder sb) + { + string dataFormat = valueType == typeof(string) ? "\"{0}\", " : "{0}, "; + sb.AppendFormat(dataFormat, value.Replace("\n", @"\n").Replace("\"", @"\""")); + } + + public static void WipeInvalidContent(StringBuilder sb, int validLength) + { + sb.Remove(validLength, sb.Length - validLength); + } + + static bool TransferCustomData(T data, StringBuilder sb, int indent = 0) where T : LuaSerialization + { + LuaSerialization serializor = data as LuaSerialization; + return serializor.Serialize(sb, indent); + } + + static bool SerializeNestData(StringBuilder sb, int indent, T data, MethodInfo transferMethod) + { + bool bSerializeSuc = false; + int validContentLength = sb.Length; + + if (transferMethod != null) + { + ++indent; + sb.Append("\n"); + bSerializeSuc = (bool)transferMethod.Invoke(null, new object[] { data, sb, indent }); + if (!bSerializeSuc) + WipeInvalidContent(sb, validContentLength); + --indent; + } + + return bSerializeSuc; + } + + static bool SerializeData(StringBuilder sb, int indent, T Data) + { + Type dataType = typeof(T); + bool bSerializeSuc = false; + + if (dataType.IsPrimitive || dataType == typeof(string)) + { + AppendValue(dataType, Data.ToString(), sb); + bSerializeSuc = true; + } + else + { + MethodInfo nestEleTranferMethod = GetCollectionTransferMethod(dataType); + bSerializeSuc = SerializeNestData(sb, indent, Data, nestEleTranferMethod); + } + + return bSerializeSuc; + } + + static MethodInfo GetCollectionTransferMethod(Type collectionType) + { + MethodInfo method = null; + + if (typeof(LuaSerialization).IsAssignableFrom(collectionType)) + method = customTransferGenericMethod.MakeGenericMethod(collectionType); + else if (collectionType.GetGenericTypeDefinition() == dictionaryTypeDefinition) + method = dictionaryTransferGenericMethod.MakeGenericMethod(collectionType.GetGenericArguments()); + else if (collectionType.GetGenericTypeDefinition() == listTypeDefinition) + method = listTransferGenericMethod.MakeGenericMethod(collectionType.GetGenericArguments()); + else if (collectionType.IsArray) + method = arrayTransferGenericMethod.MakeGenericMethod(new Type[] { collectionType.GetElementType() }); + + return method; + } + + static void NestBegin(StringBuilder sb, int indent) + { + AppendIndent(sb, indent); + sb.Append("{"); + } + + static void NestEnd(StringBuilder sb, int indent) + { + AppendIndent(sb, indent); + sb.Append("},"); + } + + static bool IsDataTypeSerializable(Type type) + { + if (type != typeof(int) && type != typeof(string)) + { + Console.ForegroundColor = ConsoleColor.Red; + Console.WriteLine(string.Format("Can't Serialize Specify Data Type : {0} To Lua", type)); + return false; + } + + return true; + } + + static bool IsCommonData(Type type) + { + if (type == typeof(string) || type.IsPrimitive) + return true; + + return false; + } +} diff --git a/Assets/LuaFramework/ToLua/Injection/Editor/ToLuaText.cs.meta b/Assets/LuaFramework/ToLua/Injection/Editor/ToLuaText.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..530c8081909fd0ba5fba6e9f048d7fea3d87e5ed --- /dev/null +++ b/Assets/LuaFramework/ToLua/Injection/Editor/ToLuaText.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5de9ab9717d9977429063071523fae1a +timeCreated: 1513060947 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Injection/Editor/ToluaInjectionBlackListPanel.cs b/Assets/LuaFramework/ToLua/Injection/Editor/ToluaInjectionBlackListPanel.cs new file mode 100644 index 0000000000000000000000000000000000000000..fe114d9c668f46068fae28e6ce4b17a31284474c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Injection/Editor/ToluaInjectionBlackListPanel.cs @@ -0,0 +1,380 @@ +锘縰sing System; +using System.Xml; +using System.IO; +using System.Linq; +using UnityEngine; +using UnityEditor; +using System.Reflection; +using UnityEditorInternal; +using System.Collections.Generic; +using System.Text.RegularExpressions; + +public class InjectionBlackListGenerator : EditorWindow +{ + public static string blackListFilePath = CustomSettings.injectionFilesPath + "InjectionBlackList.txt"; + public static Action onBlackListGenerated; + + static string pathsInfoSavedPath; + static HashSet specifiedDropType = new HashSet + { + }; + const string nestRegex = @" (?<= + (? paths; + ReorderableList pathUIList; + Vector2 scrollPosition = Vector2.zero; + HashSet blackList = new HashSet(); + Dictionary, string>> assetExtentions = new Dictionary, string>> + { + { "*.cs", SearchTypeInCSFile }, + { "*.dll", SearchTypeInAssembly }, + }; + +#if ENABLE_LUA_INJECTION + [MenuItem("Lua/Generate LuaInjection BlackList")] +#endif + public static void Open() + { + GetWindow("LuaInjection", true); + } + + void OnListHeaderGUI(Rect rect) + { + EditorGUI.LabelField(rect, "Scripts Path"); + } + + void OnListElementGUI(Rect rect, int index, bool isactive, bool isfocused) + { + const float GAP = 5; + + string info = paths[index]; + rect.y++; + + Rect r = rect; + r.width = 16; + r.height = 18; + r.xMin = r.xMax + GAP; + r.xMax = rect.xMax - 50 - GAP; + GUI.enabled = false; + info = GUI.TextField(r, info); + GUI.enabled = true; + + r.xMin = r.xMax + GAP; + r.width = 50; + if (GUI.Button(r, "Select")) + { + var path = SelectFolder(); + if (path != null) + { + paths[index] = path; + } + } + } + + string SelectFolder() + { + string dataPath = Application.dataPath; + string selectedPath = EditorUtility.OpenFolderPanel("Path", dataPath, ""); + if (!string.IsNullOrEmpty(selectedPath)) + { + return GetRelativePath(selectedPath); + } + return null; + } + + string GetRelativePath(string absolutePath) + { + if (absolutePath.StartsWith(Application.dataPath)) + { + return "Assets/" + absolutePath.Substring(Application.dataPath.Length + 1); + } + else + { + ShowNotification(new GUIContent("涓嶈兘鍦ˋssets鐩綍涔嬪!")); + } + return null; + } + + void AddNewPath() + { + string path = SelectFolder(); + if (!string.IsNullOrEmpty(path)) + { + paths.Add(path); + } + } + + void InitFilterListDrawer() + { + if (pathUIList != null) + { + return; + } + + pathUIList = new ReorderableList(paths, typeof(string)); + pathUIList.drawElementCallback = OnListElementGUI; + pathUIList.drawHeaderCallback = OnListHeaderGUI; + pathUIList.draggable = true; + pathUIList.elementHeight = 22; + pathUIList.onAddCallback = (list) => AddNewPath(); + } + + void OnGUI() + { + InitPathsInfo(); + InitFilterListDrawer(); + + bool execGenerate = false; + GUILayout.BeginHorizontal(EditorStyles.toolbar); + { + if (GUILayout.Button("Add", EditorStyles.toolbarButton)) + { + AddNewPath(); + } + if (GUILayout.Button("Save", EditorStyles.toolbarButton)) + { + SavePathsInfo(); + } + GUILayout.FlexibleSpace(); + if (GUILayout.Button("Generate", EditorStyles.toolbarButton)) + { + execGenerate = true; + } + } + GUILayout.EndHorizontal(); + + GUILayout.BeginVertical(); + { + scrollPosition = GUILayout.BeginScrollView(scrollPosition); + { + pathUIList.DoLayoutList(); + } + GUILayout.EndScrollView(); + } + GUILayout.EndVertical(); + + if (execGenerate) + { + Generate(); + Close(); + } + } + + void Generate() + { + if (paths.Count == 0) + { + EditorUtility.DisplayDialog("鎻愮ず", "娌℃湁閫変腑浠讳綍鍙烦杩囩殑璺緞", "纭畾"); + return; + } + blackList.Clear(); + + foreach (var path in paths) + { + foreach (var extention in assetExtentions) + { + var files = from fileName in Directory.GetFiles(path, extention.Key, SearchOption.AllDirectories) + let validFullFileName = fileName.Replace("\\", "/") + let bEditorScriptFile = validFullFileName.Contains("/Editor/") + //let bToluaGeneratedFile = validFullFileName.Contains("/GenerateWrapFiles/") + where !bEditorScriptFile /*&& !bToluaGeneratedFile*/ + select validFullFileName; + + int index = 0; + foreach (var fileFullPath in files) + { + EditorUtility.DisplayProgressBar("Searching", fileFullPath, (float)index / files.Count()); + extention.Value(blackList, fileFullPath); + ++index; + } + EditorUtility.ClearProgressBar(); + } + } + + blackList.UnionWith(specifiedDropType); + SaveBlackList(); + SavePathsInfo(); + + if (onBlackListGenerated != null) + { + onBlackListGenerated(); + } + onBlackListGenerated = null; + Debug.Log("BlackList Generated!!!"); + } + + static void SearchTypeInCSFile(HashSet typeSet, string fileFullPath) + { + var fileContent = File.ReadAllText(fileFullPath); + if (string.IsNullOrEmpty(fileContent)) + { + return; + } + + int nestCount = 0; + int lastTypeMatchedIndex = 0; + Stack nestIndexStack = new Stack(); + Stack nestStack = new Stack(); + + var matchResult = Regex.Match(fileContent, nestRegex, RegexOptions.IgnorePatternWhitespace); + while (matchResult.Success) + { + string typeName = matchResult.Value; + if (string.IsNullOrEmpty(typeName)) + { + matchResult = matchResult.NextMatch(); + continue; + } + + lastTypeMatchedIndex = nestIndexStack.Count > 0 ? nestIndexStack.Peek() : 0; + string matchSubString = fileContent.Substring(lastTypeMatchedIndex, matchResult.Index - lastTypeMatchedIndex); + var beginBraceMatchResult = Regex.Matches(matchSubString, "(?= nestCount) + { + if (compareTag == nestCount) + { + nestStack.Pop(); + } + if (compareTag > nestCount) + { + nestCount++; + } + nestIndexStack.Pop(); + } + else if (compareTag < nestCount && compareTag > 0) + { + int searchedStackCount = nestStack.Count - compareTag; + for (int i = 0; i < searchedStackCount; ++i) + { + nestStack.Pop(); + } + nestCount = nestStack.Count; + if (nestCount > 0) + { + nestIndexStack.Pop(); + } + } + + string prefix = ""; + foreach (var name in nestStack) + { + prefix = name + prefix; + } + string typeFullName = prefix + typeName; + if (!typeSet.Contains(typeFullName) && !bNamespaceMatched) + { + typeSet.Add(typeFullName); + } + + string nestTag = (bNamespaceMatched ? "." : "+"); + nestStack.Push(typeName + nestTag); + matchResult = matchResult.NextMatch(); + } + } + + static void SearchTypeInAssembly(HashSet typeSet, string assemblyPath) + { + Assembly assembly = null; + try + { + assembly = Assembly.LoadFile(assemblyPath); + } + catch { } + + if (assembly == null) + { + return; + } + + foreach (Type t in assembly.GetTypes()) + { + bool bNotPrimitiveType = t.IsClass || (t.IsValueType && !t.IsPrimitive && !t.IsEnum); + bool bCustomType = bNotPrimitiveType && !t.FullName.Contains("<"); + if (bCustomType && !typeSet.Contains(t.FullName) && !t.ContainsGenericParameters) + { + typeSet.Add(t.FullName); + } + } + } + + void InitPathsInfo() + { + if (pathsInfoSavedPath == null) + { + pathsInfoSavedPath = CustomSettings.injectionFilesPath + "LuaInjectionSkipPaths.txt"; + } + if (paths != null) + { + return; + } + + if (File.Exists(pathsInfoSavedPath)) + { + paths = new List(File.ReadAllLines(pathsInfoSavedPath)); + } + else + { + paths = new List(); + string toluaPath = GetRelativePath(CustomSettings.injectionFilesPath.Substring(0, CustomSettings.injectionFilesPath.Length - "Injection/".Length)); + paths.Add(toluaPath + "Core/"); + paths.Add(toluaPath + "Injection/"); + paths.Add(toluaPath + "Misc/"); + paths.Add(toluaPath + "Injection/"); + paths.Add(toluaPath + "Misc/"); + paths.Add(Application.dataPath + "/Plugins/"); + paths.Add(CustomSettings.toluaBaseType); + paths.Add(GetRelativePath(CustomSettings.saveDir)); + } + } + + void SavePathsInfo() + { + File.WriteAllLines(pathsInfoSavedPath, paths.ToArray()); + AssetDatabase.Refresh(); + } + + void SaveBlackList() + { + try + { + if (File.Exists(blackListFilePath)) + { + File.Delete(blackListFilePath); + } + File.WriteAllLines(blackListFilePath, blackList.ToArray()); + } + catch (Exception e) + { + Debug.LogError(e.ToString()); + } + + AssetDatabase.Refresh(); + } +} \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Injection/Editor/ToluaInjectionBlackListPanel.cs.meta b/Assets/LuaFramework/ToLua/Injection/Editor/ToluaInjectionBlackListPanel.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..4bc6f65a789d1836a6e64391aadce2ab9b8b1c5a --- /dev/null +++ b/Assets/LuaFramework/ToLua/Injection/Editor/ToluaInjectionBlackListPanel.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 55ebe04f71192174990387365881eac4 +timeCreated: 1512567263 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Injection/InjectionBlackList.txt b/Assets/LuaFramework/ToLua/Injection/InjectionBlackList.txt new file mode 100644 index 0000000000000000000000000000000000000000..0627216bae4183c16205a6f1c8dba3ba7c48dd72 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Injection/InjectionBlackList.txt @@ -0,0 +1,148 @@ +LuaInterface.MonoPInvokeCallbackAttribute +LuaInterface.NoToLuaAttribute +LuaInterface.UseDefinedAttribute +LuaInterface.OverrideDefinedAttribute +LuaInterface.LuaByteBufferAttribute +LuaInterface.LuaRenameAttribute +LuaInterface.LuaBaseRef +LuaInterface.LuaBeatEvent +LuaInterface.LuaIndexes +LuaInterface.LuaRIDX +LuaInterface.ToLuaFlags +LuaInterface.Lua_Debug +LuaInterface.LuaDLL +LuaInterface.LuaEvent +LuaInterface.LuaException +LuaInterface.LuaFileUtils +LuaInterface.LuaFunction +LuaInterface.LuaFunction+FuncData +LuaInterface.LuaMatchType +LuaInterface.LuaMethodCache +LuaInterface.GCRef +LuaInterface.LuaByteBuffer +LuaInterface.LuaOut +LuaInterface.NullObject +LuaInterface.nil +LuaInterface.LuaDelegate +LuaInterface.LuaMisc +LuaInterface.LuaInteger64 +LuaInterface.TouchBits +LuaInterface.RaycastBits +LuaInterface.EventObject +LuaInterface.LuaStackOp +LuaInterface.LuaState +LuaInterface.LuaStatePtr +LuaInterface.LuaStatic +LuaInterface.LuaTable +LuaInterface.LuaArrayTable +LuaInterface.LuaArrayTable+Enumerator +LuaInterface.LuaDictTable +LuaInterface.LuaDictTable+Enumerator +LuaInterface.LuaDictEntry +LuaInterface.LuaThread +LuaInterface.LuaUnityLibs +LuaInterface.LuaValueType +LuaInterface.LuaValueTypeName +LuaInterface.LuaObjectPool +LuaInterface.LuaObjectPool+PoolNode +LuaInterface.ObjectTranslator +LuaInterface.ObjectTranslator+DelayGC +LuaInterface.ObjectTranslator+CompareObject +LuaInterface.ToLua +LuaInterface.TypeChecker +LuaInterface.TypeTraits +LuaInterface.DelegateTraits +LuaInterface.StackTraits +LuaInterface.LuaInjectionStation +LuaClient +LuaCoroutine +LuaLooper +LuaProfiler +LuaResLoader +CString +ExtensionLibs +NumberFormatter +StringPool +CString+CStringBlock +NumberFormatter+CustomInfo +ConstStringTable +LuaInterface.Debugger +LuaInterface.ExtensionMethods +LuaInterface.StringBuilderCache +LuaInterface_EventObjectWrap +LuaInterface_LuaConstructorWrap +LuaInterface_LuaFieldWrap +LuaInterface_LuaMethodWrap +LuaInterface_LuaOutWrap +LuaInterface_LuaPropertyWrap +System_ArrayWrap +System_Collections_Generic_DictionaryWrap +System_Collections_Generic_Dictionary_KeyCollectionWrap +System_Collections_Generic_Dictionary_ValueCollectionWrap +System_Collections_Generic_KeyValuePairWrap +System_Collections_Generic_ListWrap +System_Collections_IEnumeratorWrap +System_Collections_ObjectModel_ReadOnlyCollectionWrap +System_DelegateWrap +System_EnumWrap +System_NullObjectWrap +System_ObjectWrap +System_StringWrap +System_TypeWrap +UnityEngine_CoroutineWrap +UnityEngine_ObjectWrap +DelegateFactory +LuaBinder +LuaInterface_DebuggerWrap +UnityEngine_AnimationBlendModeWrap +UnityEngine_AnimationClipWrap +UnityEngine_AnimationStateWrap +UnityEngine_AnimationWrap +UnityEngine_AnimatorWrap +UnityEngine_ApplicationWrap +UnityEngine_AssetBundleWrap +UnityEngine_AsyncOperationWrap +UnityEngine_AudioClipWrap +UnityEngine_AudioSourceWrap +UnityEngine_BehaviourWrap +UnityEngine_BlendWeightsWrap +UnityEngine_BoxColliderWrap +UnityEngine_CameraClearFlagsWrap +UnityEngine_CameraWrap +UnityEngine_CapsuleColliderWrap +UnityEngine_CharacterControllerWrap +UnityEngine_ColliderWrap +UnityEngine_ComponentWrap +UnityEngine_Experimental_Director_DirectorPlayerWrap +UnityEngine_GameObjectWrap +UnityEngine_InputWrap +UnityEngine_KeyCodeWrap +UnityEngine_LightTypeWrap +UnityEngine_LightWrap +UnityEngine_MaterialWrap +UnityEngine_MeshColliderWrap +UnityEngine_MeshRendererWrap +UnityEngine_MonoBehaviourWrap +UnityEngine_ParticleSystemWrap +UnityEngine_PhysicsWrap +UnityEngine_PlayModeWrap +UnityEngine_QualitySettingsWrap +UnityEngine_QueueModeWrap +UnityEngine_RendererWrap +UnityEngine_RenderSettingsWrap +UnityEngine_RenderTextureWrap +UnityEngine_ResourcesWrap +UnityEngine_RigidbodyWrap +UnityEngine_ScreenWrap +UnityEngine_ShaderWrap +UnityEngine_SkinnedMeshRendererWrap +UnityEngine_SleepTimeoutWrap +UnityEngine_SpaceWrap +UnityEngine_SphereColliderWrap +UnityEngine_Texture2DWrap +UnityEngine_TextureWrap +UnityEngine_TimeWrap +UnityEngine_TrackedReferenceWrap +UnityEngine_TransformWrap +UnityEngine_WrapModeWrap +UnityEngine_WWWWrap diff --git a/Assets/LuaFramework/ToLua/Injection/InjectionBlackList.txt.meta b/Assets/LuaFramework/ToLua/Injection/InjectionBlackList.txt.meta new file mode 100644 index 0000000000000000000000000000000000000000..354732e06f5b0863326d0ff5f21d0b63299b9205 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Injection/InjectionBlackList.txt.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 449a10dea407bc04ea1bbb6f9d42bbd8 +timeCreated: 1515037624 +licenseType: Pro +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Injection/InjectionBridgeEditorInfo.xml b/Assets/LuaFramework/ToLua/Injection/InjectionBridgeEditorInfo.xml new file mode 100644 index 0000000000000000000000000000000000000000..dae3d729fdf897053720a7a3ac593525a10cb63d --- /dev/null +++ b/Assets/LuaFramework/ToLua/Injection/InjectionBridgeEditorInfo.xml @@ -0,0 +1,532 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Injection/InjectionBridgeEditorInfo.xml.meta b/Assets/LuaFramework/ToLua/Injection/InjectionBridgeEditorInfo.xml.meta new file mode 100644 index 0000000000000000000000000000000000000000..ddb6072760bffbf13fadffb3d7e306f068285de9 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Injection/InjectionBridgeEditorInfo.xml.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7a03414dd6167d14db5ffeec44c8ebf9 +timeCreated: 1515037626 +licenseType: Pro +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Injection/LuaInjectionSkipPaths.txt b/Assets/LuaFramework/ToLua/Injection/LuaInjectionSkipPaths.txt new file mode 100644 index 0000000000000000000000000000000000000000..c9339a3eabb11baed0b0fe05974ae8b0c3d56f1f --- /dev/null +++ b/Assets/LuaFramework/ToLua/Injection/LuaInjectionSkipPaths.txt @@ -0,0 +1,8 @@ +Assets/ToLua/Core/ +Assets/ToLua/Injection/ +Assets/ToLua/Misc/ +Assets/ToLua/Injection/ +Assets/ToLua/Misc/ +H:/OpenSource/toluaSelf/Assets/Plugins/ +H:/OpenSource/toluaSelf/Assets/ToLua/BaseType/ +Assets/Source/Generate/ diff --git a/Assets/LuaFramework/ToLua/Injection/LuaInjectionSkipPaths.txt.meta b/Assets/LuaFramework/ToLua/Injection/LuaInjectionSkipPaths.txt.meta new file mode 100644 index 0000000000000000000000000000000000000000..af09f508cf9e8ef20218e1529064f4896ea0028b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Injection/LuaInjectionSkipPaths.txt.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4b40d8aec6722dd489e0cf5180707926 +timeCreated: 1515038066 +licenseType: Pro +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Injection/LuaInjectionStation.cs b/Assets/LuaFramework/ToLua/Injection/LuaInjectionStation.cs new file mode 100644 index 0000000000000000000000000000000000000000..6a22c79a05c162d6bc2084c6464fe6848ac9a883 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Injection/LuaInjectionStation.cs @@ -0,0 +1,71 @@ +锘縰sing System; +using System.Collections; +using System.Collections.Generic; + +namespace LuaInterface +{ + [Flags] + public enum InjectType + { + None = 0, + After = 1, + Before = 1 << 1, + Replace = 1 << 2, + ReplaceWithPreInvokeBase = 1 << 3, + ReplaceWithPostInvokeBase = 1 << 4 + } + + public class LuaInjectionStation + { + public const byte NOT_INJECTION_FLAG = 0; + public const byte INVALID_INJECTION_FLAG = byte.MaxValue; + + static int cacheSize; + static byte[] injectionFlagCache; + static LuaFunction[] injectFunctionCache; + + static LuaInjectionStation() + { + injectionFlagCache = new byte[cacheSize]; + injectFunctionCache = new LuaFunction[cacheSize]; + } + + [NoToLua] + public static byte GetInjectFlag(int index) + { + byte result = injectionFlagCache[index]; + + if (result == INVALID_INJECTION_FLAG) + { + return NOT_INJECTION_FLAG; + } + else if (result == NOT_INJECTION_FLAG) + { + /// Delay injection not supported + if (LuaState.GetInjectInitState(index)) + { + injectionFlagCache[index] = INVALID_INJECTION_FLAG; + } + } + + return result; + } + + [NoToLua] + public static LuaFunction GetInjectionFunction(int index) + { + return injectFunctionCache[index]; + } + + public static void CacheInjectFunction(int index, byte injectFlag, LuaFunction func) + { + if (index >= cacheSize) + { + return; + } + + injectFunctionCache[index] = func; + injectionFlagCache[index] = injectFlag; + } + } +} diff --git a/Assets/LuaFramework/ToLua/Injection/LuaInjectionStation.cs.meta b/Assets/LuaFramework/ToLua/Injection/LuaInjectionStation.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..02adcbbbad7f0b50578187f2030fb5e3ab8062ff --- /dev/null +++ b/Assets/LuaFramework/ToLua/Injection/LuaInjectionStation.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 50962a9cc65f2be42af0d2419c4bc074 +timeCreated: 1512461673 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Lua.meta b/Assets/LuaFramework/ToLua/Lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..3f99788231d4fb1c2ddc6b9d0f088efa65457c36 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 9b3be0814bb45e640973aea4f6303a33 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/Build.bat b/Assets/LuaFramework/ToLua/Lua/Build.bat new file mode 100644 index 0000000000000000000000000000000000000000..848589fa1dc7a28a4312ec3296de76debec0eda5 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/Build.bat @@ -0,0 +1,31 @@ +@echo off +cd /d %~dp0 +rd /s/q Out +mkdir jit +mkdir Out + +xcopy /Y /D ..\..\..\Luajit\jit jit +setlocal enabledelayedexpansion + +for /r %%i in (*.lua) do ( + set v=%%~dpi + call :loop + set v=!v:%~dp0=! + if not exist %~dp0out\!v! (mkdir %~dp0Out\!v!) + ) + +for /r %%i in (*.lua) do ( + set v=%%i + set v=!v:%~dp0=! + call :loop + ..\..\..\Luajit\luajit.exe -b -g !v! Out\!v!.bytes +) + +rd /s/q jit +rd /s/q .\Out\jit\ +xcopy /Y /D /S Out ..\..\StreamingAssets\Lua +setlocal disabledelayedexpansion + +:loop +if "!v:~-1!"==" " set "v=!v:~0,-1!" & goto loop + diff --git a/Assets/LuaFramework/ToLua/Lua/Build.bat.meta b/Assets/LuaFramework/ToLua/Lua/Build.bat.meta new file mode 100644 index 0000000000000000000000000000000000000000..001d579990b2e4af1c1db87c487dda8de32d4436 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/Build.bat.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: df27f3565c885a1419249346792d53b7 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/System.meta b/Assets/LuaFramework/ToLua/Lua/System.meta new file mode 100644 index 0000000000000000000000000000000000000000..5eccedc9b7687a7c3e4d51709acd88e7fa964e72 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/System.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: c23205cbb914d9943ba97091e50d9d34 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/System/Injection.meta b/Assets/LuaFramework/ToLua/Lua/System/Injection.meta new file mode 100644 index 0000000000000000000000000000000000000000..7710a1d36c0bf25605ffdbc5f17e7774e8a99307 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/System/Injection.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: cd35ae0a721aca5469a1dc038b2b6158 +folderAsset: yes +timeCreated: 1515034041 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Lua/System/Injection/InjectionBridgeInfo.lua b/Assets/LuaFramework/ToLua/Lua/System/Injection/InjectionBridgeInfo.lua new file mode 100644 index 0000000000000000000000000000000000000000..fe64a06d6a6b6a46e6b68512e0059432be6fb44f --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/System/Injection/InjectionBridgeInfo.lua @@ -0,0 +1,589 @@ +return { + ["AccessingArray"] = + { + ["OnApplicationQuit"] = 34, + ["OnGUI"] = 33, + ["ShowTips"] = 32, + ["Start"] = 31, + }, + ["AccessingEnum"] = + { + ["OnApplicationQuit"] = 90, + ["OnGUI"] = 92, + ["ShowTips"] = 91, + ["Start"] = 89, + }, + ["AccessingLuaVariables"] = + { + ["OnApplicationQuit"] = 12, + ["OnGUI"] = 14, + ["ShowTips"] = 13, + ["Start"] = 11, + }, + ["BaseTest"] = + { + [".ctor"] = 248, + ["get_PropertyTest"] = 407, + ["set_PropertyTest"] = 408, + ["TestRef"] = 249, + }, + ["BaseTestWrap"] = + { + ["_CreateBaseTest"] = 403, + ["get_PropertyTest"] = 405, + ["Register"] = 402, + ["set_PropertyTest"] = 406, + ["TestRef"] = 404, + }, + ["CallLuaFunction"] = + { + ["CallFunc"] = 10, + ["OnDestroy"] = 9, + ["OnGUI"] = 8, + ["ShowTips"] = 7, + ["Start"] = 6, + }, + ["HelloWorld"] = + { + ["Awake"] = 1, + }, + ["LuaInterface.LuaConstructor"] = + { + [".ctor"] = 342, + ["Call"] = 343, + ["Destroy"] = 344, + }, + ["LuaInterface.LuaField"] = + { + [".ctor"] = 345, + ["Get"] = 346, + ["Set"] = 347, + }, + ["LuaInterface.LuaMethod"] = + { + [".ctor"] = 348, + ["Call"] = 349, + ["Destroy"] = 350, + }, + ["LuaInterface.LuaProperty"] = + { + [".ctor"] = 351, + ["Get"] = 352, + ["Set"] = 353, + }, + ["LuaInterface.LuaReflection"] = + { + [".ctor"] = 354, + ["CreateInstance"] = 369, + ["Dispose"] = 371, + ["FindType"] = 358, + ["Get"] = 356, + ["GetConstructor"] = 363, + ["GetField"] = 368, + ["GetMethod"] = 361, + ["GetProperty"] = 366, + ["GetTypeMethod"] = 364, + ["LoadAssembly_IntPtr"] = 359, + ["LoadAssembly_string"] = 370, + ["OpenLibs"] = 355, + ["OpenReflectionLibs"] = 357, + ["PushLuaConstructor"] = 362, + ["PushLuaField"] = 367, + ["PushLuaMethod"] = 360, + ["PushLuaProperty"] = 365, + }, + ["LuaInterface_InjectTypeWrap"] = + { + [".ctor"] = 372, + ["CheckType"] = 375, + ["get_After"] = 377, + ["get_Before"] = 378, + ["get_None"] = 376, + ["get_Replace"] = 379, + ["get_ReplaceWithPostInvokeBase"] = 381, + ["get_ReplaceWithPreInvokeBase"] = 380, + ["IntToEnum"] = 383, + ["LazyVarWrap"] = 382, + ["Push"] = 374, + ["Register"] = 373, + }, + ["LuaInterface_LuaInjectionStationWrap"] = + { + [".ctor"] = 384, + ["_CreateLuaInterface_LuaInjectionStation"] = 386, + ["CacheInjectFunction"] = 389, + ["GetInjectFlag"] = 387, + ["GetInjectionFunction"] = 388, + ["LazyVarWrap"] = 391, + ["LazyWrap"] = 390, + ["Register"] = 385, + }, + ["LuaProfilerWrap"] = + { + [".ctor"] = 392, + ["BeginSample"] = 396, + ["Clear"] = 394, + ["EndSample"] = 397, + ["get_list"] = 398, + ["GetID"] = 395, + ["LazyVarWrap"] = 401, + ["LazyWrap"] = 400, + ["Register"] = 393, + ["set_list"] = 399, + }, + ["PassStruct"] = + { + ["Awake"] = 208, + ["CallMain"] = 212, + ["CheckNullRectType"] = 204, + ["CheckRectType"] = 203, + ["CheckRectValue"] = 202, + ["InitLoader"] = 210, + ["OnApplicationQuit"] = 207, + ["OnGUI"] = 211, + ["OnLoadFinished"] = 209, + ["PushRect"] = 200, + ["ShowTips"] = 206, + ["ToRectTable"] = 205, + ["ToRectValue"] = 201, + }, + ["ScriptsFromFile"] = + { + ["Log"] = 3, + ["OnApplicationQuit"] = 5, + ["OnGUI"] = 4, + ["Start"] = 2, + }, + ["System_Collections_Generic_Dictionary_int_TestAccount_KeyCollectionWrap"] = + { + [".ctor"] = 56, + ["_CreateSystem_Collections_Generic_Dictionary_int_TestAccount_KeyCollection"] = 58, + ["CopyTo"] = 59, + ["get_Count"] = 61, + ["GetEnumerator"] = 60, + ["Register"] = 57, + }, + ["System_Collections_Generic_Dictionary_int_TestAccount_ValueCollectionWrap"] = + { + [".ctor"] = 62, + ["_CreateSystem_Collections_Generic_Dictionary_int_TestAccount_ValueCollection"] = 64, + ["CopyTo"] = 65, + ["get_Count"] = 67, + ["GetEnumerator"] = 66, + ["Register"] = 63, + }, + ["System_Collections_Generic_Dictionary_int_TestAccountWrap"] = + { + [".ctor"] = 35, + ["_CreateSystem_Collections_Generic_Dictionary_int_TestAccount"] = 37, + ["_get_this"] = 38, + ["_set_this"] = 39, + ["_this"] = 40, + ["Add"] = 43, + ["Clear"] = 44, + ["ContainsKey"] = 45, + ["ContainsValue"] = 46, + ["get_Comparer"] = 53, + ["get_Count"] = 52, + ["get_Item"] = 41, + ["get_Keys"] = 54, + ["get_Values"] = 55, + ["GetEnumerator"] = 51, + ["GetObjectData"] = 47, + ["OnDeserialization"] = 48, + ["Register"] = 36, + ["Remove"] = 49, + ["set_Item"] = 42, + ["TryGetValue"] = 50, + }, + ["System_Collections_Generic_KeyValuePair_int_TestAccountWrap"] = + { + [".ctor"] = 68, + ["_CreateSystem_Collections_Generic_KeyValuePair_int_TestAccount"] = 70, + ["get_Key"] = 72, + ["get_Value"] = 73, + ["Register"] = 69, + ["ToString"] = 71, + }, + ["TestABLoader"] = + { + ["Awake"] = 163, + ["CoLoadBundle"] = 160, + ["LoadBundles"] = 162, + ["LoadFinished"] = 161, + ["OnApplicationQuit"] = 166, + ["OnBundleLoad"] = 167, + ["OnGUI"] = 165, + ["ShowTips"] = 164, + }, + ["TestAccount"] = + { + [".ctor"] = 83, + }, + ["TestAccountWrap"] = + { + [".ctor"] = 74, + ["_CreateTestAccount"] = 76, + ["get_id"] = 77, + ["get_name"] = 78, + ["get_sex"] = 79, + ["Register"] = 75, + ["set_id"] = 80, + ["set_name"] = 81, + ["set_sex"] = 82, + }, + ["TestCJson"] = + { + ["CallMain"] = 171, + ["InitLoader"] = 168, + ["OnApplicationQuit"] = 173, + ["OnGUI"] = 174, + ["OnLoadFinished"] = 170, + ["OpenLibs"] = 169, + ["ShowTips"] = 172, + }, + ["TestCoroutine"] = + { + ["Awake"] = 15, + ["OnApplicationQuit"] = 16, + ["OnGUI"] = 18, + ["ShowTips"] = 17, + }, + ["TestCoroutine2"] = + { + ["CallMain"] = 21, + ["InitLoader"] = 19, + ["OnApplicationQuit"] = 24, + ["OnGUI"] = 25, + ["OnLoadFinished"] = 20, + ["ShowTips"] = 23, + ["Start"] = 22, + }, + ["TestCustomLoader"] = + { + ["Awake"] = 130, + ["CallMain"] = 128, + ["InitLoader"] = 127, + ["Logger"] = 132, + ["OnApplicationQuit"] = 131, + ["OnGUI"] = 133, + ["StartMain"] = 129, + }, + ["TestDelegate"] = + { + ["Awake"] = 97, + ["Bind"] = 98, + ["CallLuaFunction"] = 99, + ["OnApplicationQuit"] = 106, + ["OnGUI"] = 102, + ["SafeRelease"] = 104, + ["ShowTips"] = 105, + ["TestEventListener_OnClick"] = 100, + ["TestEventListener_VoidDelegate"] = 101, + ["Update"] = 103, + }, + ["TestDelegate.TestEventListener_OnClick_Event"] = + { + [".ctor"] = 93, + ["Call"] = 94, + }, + ["TestDelegate.TestEventListener_VoidDelegate_Event"] = + { + [".ctor"] = 95, + ["Call"] = 96, + }, + ["TestEnum"] = + { + [".ctor"] = 297, + ["Test"] = 298, + }, + ["TestEventListener"] = + { + ["OnClickEvent"] = 109, + ["SetOnFinished_OnClick"] = 107, + ["SetOnFinished_VoidDelegate"] = 108, + }, + ["TestEventListenerWrap"] = + { + [".ctor"] = 110, + ["get_onClick"] = 114, + ["get_onClickEvent"] = 116, + ["get_TestFunc"] = 115, + ["op_Equality"] = 113, + ["Register"] = 111, + ["set_onClick"] = 117, + ["set_onClickEvent"] = 119, + ["set_TestFunc"] = 118, + ["SetOnFinished"] = 112, + ["TestEventListener_OnClick"] = 120, + ["TestEventListener_VoidDelegate"] = 121, + }, + ["TestExport"] = + { + [".ctor"] = 299, + [".ctor_Vector3"] = 302, + [".ctor_Vector3[]"] = 300, + [".ctor_Vector3_string"] = 301, + ["DoClick"] = 338, + ["get_Item_char_int"] = 307, + ["get_Item_double"] = 310, + ["get_Item_int"] = 305, + ["get_Item_int_int_int"] = 311, + ["get_Item_string"] = 309, + ["get_Number"] = 303, + ["set_Item_char_int_int"] = 308, + ["set_Item_double"] = 312, + ["set_Item_int_int"] = 306, + ["set_Number"] = 304, + ["Test"] = 317, + ["Test_bool"] = 318, + ["Test_char"] = 316, + ["Test_double"] = 321, + ["Test_int"] = 320, + ["Test_int&"] = 322, + ["Test_int[,]"] = 319, + ["Test_int[]"] = 327, + ["Test_int_int"] = 323, + ["Test_object"] = 326, + ["Test_object[]"] = 330, + ["Test_object_string"] = 314, + ["Test_object_string_int"] = 315, + ["Test_Space"] = 331, + ["Test_string"] = 324, + ["Test_string[]"] = 328, + ["Test_string[]_bool"] = 329, + ["Test_string_string"] = 325, + ["Test33"] = 332, + ["TestByteBuffer"] = 313, + ["TestCheckParamNumber"] = 334, + ["TestCheckParamString"] = 335, + ["TestEnum"] = 333, + ["TestNullable"] = 339, + ["TestRefGameObject"] = 337, + ["TestReflection"] = 336, + }, + ["TestExport_SpaceWrap"] = + { + [".ctor"] = 291, + ["CheckType"] = 294, + ["get_World"] = 295, + ["IntToEnum"] = 296, + ["Push"] = 293, + ["Register"] = 292, + }, + ["TestExportWrap"] = + { + [".ctor"] = 259, + ["_CreateTestExport"] = 261, + ["_get_this"] = 262, + ["_set_this"] = 263, + ["_this"] = 264, + ["DoClick"] = 277, + ["get_buffer"] = 282, + ["get_field"] = 279, + ["get_Item"] = 265, + ["get_Number"] = 283, + ["get_OnClick"] = 280, + ["get_OnRefEvent"] = 281, + ["Register"] = 260, + ["set_buffer"] = 287, + ["set_field"] = 284, + ["set_Item"] = 266, + ["set_Number"] = 288, + ["set_OnClick"] = 285, + ["set_OnRefEvent"] = 286, + ["Test"] = 268, + ["Test33"] = 270, + ["TestByteBuffer"] = 267, + ["TestChar"] = 269, + ["TestCheckParamNumber"] = 273, + ["TestCheckParamString"] = 274, + ["TestEnum"] = 272, + ["TestExport_TestBuffer"] = 289, + ["TestExport_TestRefEvent"] = 290, + ["TestGeneric"] = 271, + ["TestNullable"] = 278, + ["TestRefGameObject"] = 276, + ["TestReflection"] = 275, + }, + ["TestGameObject"] = + { + ["OnApplicationQuit"] = 125, + ["OnGUI"] = 126, + ["ShowTips"] = 124, + ["Start"] = 122, + ["Update"] = 123, + }, + ["TestInherit"] = + { + ["OnDestroy"] = 158, + ["OnGUI"] = 159, + ["ShowTips"] = 157, + ["Start"] = 156, + }, + ["TestInjection"] = + { + ["OnApplicationQuit"] = 245, + ["OnGUI"] = 246, + ["ShowTips"] = 247, + ["Start"] = 244, + }, + ["TestInstantiate"] = + { + ["Awake"] = 217, + ["Start"] = 218, + }, + ["TestInstantiate2"] = + { + ["Awake"] = 219, + }, + ["TestInt64"] = + { + ["OnDestroy"] = 154, + ["OnGUI"] = 155, + ["ShowTips"] = 153, + ["Start"] = 152, + }, + ["TestLuaStack"] = + { + ["Awake"] = 236, + ["OnApplicationQuit"] = 238, + ["OnGUI"] = 242, + ["OnSendMsg"] = 235, + ["PushLuaError"] = 221, + ["ShowTips"] = 239, + ["Test1"] = 220, + ["Test3"] = 222, + ["Test4"] = 223, + ["Test5"] = 224, + ["Test6"] = 225, + ["TestAddComponent"] = 231, + ["TestArgError"] = 227, + ["TestCo"] = 243, + ["TestCycle"] = 229, + ["TestD1"] = 240, + ["TestD2"] = 241, + ["TestMul0"] = 233, + ["TestMul1"] = 232, + ["TestMulStack"] = 234, + ["TestNull"] = 230, + ["TestOutOfBound"] = 226, + ["TestTableInCo"] = 228, + ["Update"] = 237, + }, + ["TestLuaThread"] = + { + ["OnApplicationQuit"] = 27, + ["OnGUI"] = 30, + ["ShowTips"] = 28, + ["Start"] = 26, + ["Update"] = 29, + }, + ["TestOutArg"] = + { + ["OnApplicationQuit"] = 136, + ["OnDestroy"] = 139, + ["OnGUI"] = 137, + ["ShowTips"] = 135, + ["Start"] = 134, + ["Update"] = 138, + }, + ["TestOverload"] = + { + ["Awake"] = 340, + ["Bind"] = 341, + }, + ["TestPerformance"] = + { + ["OnApplicationQuit"] = 215, + ["OnGUI"] = 216, + ["ShowTips"] = 214, + ["Start"] = 213, + }, + ["TestProtoBuffer"] = + { + ["Awake"] = 140, + ["Bind"] = 142, + ["CallMain"] = 143, + ["InitLoader"] = 141, + ["OnApplicationQuit"] = 147, + ["OnGUI"] = 146, + ["OnLoadFinished"] = 144, + ["ShowTips"] = 145, + }, + ["TestProtolWrap"] = + { + [".ctor"] = 148, + ["get_data"] = 150, + ["Register"] = 149, + ["set_data"] = 151, + }, + ["TestReflection"] = + { + ["CallMain"] = 188, + ["InitLoader"] = 187, + ["OnApplicationQuit"] = 192, + ["OnGUI"] = 193, + ["OnLoadFinished"] = 190, + ["ShowTips"] = 191, + ["TestAction"] = 189, + }, + ["TestString"] = + { + ["CallMain"] = 182, + ["InitLoader"] = 181, + ["OnApplicationQuit"] = 185, + ["OnGUI"] = 186, + ["OnLoadFinished"] = 183, + ["ShowTips"] = 184, + }, + ["TestUTF8"] = + { + ["CallMain"] = 176, + ["InitLoader"] = 175, + ["OnApplicationQuit"] = 179, + ["OnGUI"] = 180, + ["OnLoadFinished"] = 177, + ["ShowTips"] = 178, + }, + ["ToLuaInjectionTest"] = + { + [".ctor"] = 250, + [".ctor_bool"] = 251, + ["get_PropertyTest"] = 252, + ["Inject"] = 416, + ["set_PropertyTest"] = 253, + ["TestCoroutine"] = 258, + ["TestOverload_bool_int"] = 257, + ["TestOverload_int_bool"] = 255, + ["TestOverload_int_bool&"] = 256, + ["TestRef"] = 254, + }, + ["ToLuaInjectionTestWrap"] = + { + ["_CreateToLuaInjectionTest"] = 410, + ["get_PropertyTest"] = 414, + ["Register"] = 409, + ["set_PropertyTest"] = 415, + ["TestCoroutine"] = 413, + ["TestOverload"] = 412, + ["TestRef"] = 411, + }, + ["UseDictionary"] = + { + ["Awake"] = 84, + ["BindMap"] = 88, + ["OnApplicationQuit"] = 85, + ["OnGUI"] = 87, + ["ShowTips"] = 86, + }, + ["UseList"] = + { + ["CallMain"] = 195, + ["InitLoader"] = 194, + ["OnApplicationQuit"] = 198, + ["OnGUI"] = 199, + ["OnLoadFinished"] = 196, + ["ShowTips"] = 197, + }, +} \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Lua/System/Injection/InjectionBridgeInfo.lua.meta b/Assets/LuaFramework/ToLua/Lua/System/Injection/InjectionBridgeInfo.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..fe2b662f890efd6cf065fffd89de87a470dba8e2 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/System/Injection/InjectionBridgeInfo.lua.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ddd0929c7e5e87a43ac765a3d62c90a7 +timeCreated: 1514865200 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Lua/System/Injection/LuaInjectionBus.lua b/Assets/LuaFramework/ToLua/Lua/System/Injection/LuaInjectionBus.lua new file mode 100644 index 0000000000000000000000000000000000000000..3bf3726050b41e3c3b0206156977f41d3e2193ec --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/System/Injection/LuaInjectionBus.lua @@ -0,0 +1,25 @@ +--[[MIT License + +Copyright (c) 2018 Jonson + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE.]]-- + + +--Load All The Injectores +--require "System.Injection.ToLuaInjectionTestInjector" \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Lua/System/Injection/LuaInjectionBus.lua.meta b/Assets/LuaFramework/ToLua/Lua/System/Injection/LuaInjectionBus.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..53e9ab4639964c15edcb5fc10634ce3261c28ead --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/System/Injection/LuaInjectionBus.lua.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3f358679c92622642a844c157ce4fece +timeCreated: 1514865200 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Lua/System/Injection/LuaInjectionStation.lua b/Assets/LuaFramework/ToLua/Lua/System/Injection/LuaInjectionStation.lua new file mode 100644 index 0000000000000000000000000000000000000000..c3801f473ffd7519ed3ddd8d13a731bc2561892b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/System/Injection/LuaInjectionStation.lua @@ -0,0 +1,90 @@ +--[[ +--- File:LuaInjectionStation.lua +--- Created by Jonson +--- DateTime: 2018/1/2 10:24 +]]-- + +local pcall = pcall +local pairs = pairs +local error = error +local rawset = rawset +local rawget = rawget +local string = string +local tolua_tag = tolua_tag +local getmetatable = getmetatable +local CSLuaInjectStation +local bridgeInfo = require "System.Injection.InjectionBridgeInfo" + +local function Check(csModule) + local existmt = getmetatable(csModule) + if rawget(existmt, tolua_tag) ~= 1 then + error("Can't Inject") + end + + return existmt +end + +local function CacheCSLuaInjectStation() + if CSLuaInjectStation == nil then + CSLuaInjectStation = LuaInterface.LuaInjectionStation + end +end + +local function UpdateFunctionReference(metatable, injectInfo) + local oldIndexMetamethod = metatable.__index + local newMethodGroup = {} + for funcName, infoPipeline in pairs(injectInfo) do + local injectFunction, injectFlag = infoPipeline() + if injectFlag == LuaInterface.InjectType.Replace + or injectFlag == LuaInterface.InjectType.ReplaceWithPostInvokeBase + or injectFlag == LuaInterface.InjectType.ReplaceWithPreInvokeBase + then + rawset(newMethodGroup, funcName, injectFunction) + end + end + + metatable.__index = function(t, k) + --Ignore Overload Function + local injectFunc = rawget(newMethodGroup, k) + if injectFunc ~= nil then + return injectFunc + end + + local status, result = pcall(oldIndexMetamethod, t, k) + if status then + return result + else + error(result) + return nil + end + end +end + +function InjectByModule(csModule, injectInfo) + local mt = Check(csModule) + local moduleName = mt[".name"] + + InjectByName(moduleName, injectInfo) + UpdateFunctionReference(mt, injectInfo) +end + +--Won't Update Function Reference In Lua Env +function InjectByName(moduleName, injectInfo) + CacheCSLuaInjectStation() + local moduleBridgeInfo = rawget(bridgeInfo, moduleName) + if moduleBridgeInfo == nil then + error(string.format("Module %s Can't Inject", moduleName)) + end + + for funcName, infoPipeline in pairs(injectInfo) do + local injectFunction, injectFlag = infoPipeline() + local injectIndex = rawget(moduleBridgeInfo, funcName) + if injectIndex == nil then + error(string.format("Function %s Doesn't Exist In Module %s", funcName, moduleName)) + end + + CSLuaInjectStation.CacheInjectFunction(injectIndex, injectFlag:ToInt(), injectFunction) + end +end + +require "System.Injection.LuaInjectionBus" \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Lua/System/Injection/LuaInjectionStation.lua.meta b/Assets/LuaFramework/ToLua/Lua/System/Injection/LuaInjectionStation.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..8d509732410dc7e45cef5dc8758615cdace852ea --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/System/Injection/LuaInjectionStation.lua.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 78b8ba284d726bf48803904bd5ada5c4 +timeCreated: 1514865423 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Lua/System/Reflection.meta b/Assets/LuaFramework/ToLua/Lua/System/Reflection.meta new file mode 100644 index 0000000000000000000000000000000000000000..9767e466ac223713b9fc0d46f3e3a9302cb543df --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/System/Reflection.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: b31921aad5a29bf48b69fbad423de1be +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/System/Reflection/BindingFlags.lua b/Assets/LuaFramework/ToLua/Lua/System/Reflection/BindingFlags.lua new file mode 100644 index 0000000000000000000000000000000000000000..01cc21499692f2958ec09b431e4600f28689fbcd --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/System/Reflection/BindingFlags.lua @@ -0,0 +1,43 @@ +if System.Reflection == nil then + System.Reflection = {} +end + +local function GetMask(...) + local arg = {...} + local value = 0 + + for i = 1, #arg do + value = value + arg[i] + end + + return value +end + +local BindingFlags = +{ + Default = 0, + IgnoreCase = 1, + DeclaredOnly = 2, + Instance = 4, + Static = 8, + Public = 16, + NonPublic = 32, + FlattenHierarchy = 64, + InvokeMethod = 256, + CreateInstance = 512, + GetField = 1024, + SetField = 2048, + GetProperty = 4096, + SetProperty = 8192, + PutDispProperty = 16384, + PutRefDispProperty = 32768, + ExactBinding = 65536, + SuppressChangeType = 131072, + OptionalParamBinding = 262144, + IgnoreReturn = 16777216, +} + +System.Reflection.BindingFlags = BindingFlags +System.Reflection.BindingFlags.GetMask = GetMask + +return BindingFlags \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Lua/System/Reflection/BindingFlags.lua.meta b/Assets/LuaFramework/ToLua/Lua/System/Reflection/BindingFlags.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..e11ab8b67189b83c3cf87b3e52d71b463290afad --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/System/Reflection/BindingFlags.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 447334b96205b8040b534702d8d806c6 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/System/Timer.lua b/Assets/LuaFramework/ToLua/Lua/System/Timer.lua new file mode 100644 index 0000000000000000000000000000000000000000..145efddbaae6331ee803e80ce7acc39eed6a23d6 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/System/Timer.lua @@ -0,0 +1,184 @@ +-------------------------------------------------------------------------------- +-- Copyright (c) 2015 , 钂欏崰蹇(topameng) topameng@gmail.com +-- All rights reserved. +-- Use, modification and distribution are subject to the "MIT License" +-------------------------------------------------------------------------------- +local setmetatable = setmetatable +local UpdateBeat = UpdateBeat +local CoUpdateBeat = CoUpdateBeat +local Time = Time + +Timer = {} + +local Timer = Timer +local mt = {__index = Timer} + +--unscaled false 閲囩敤deltaTime璁℃椂锛宼rue 閲囩敤 unscaledDeltaTime璁℃椂 +function Timer.New(func, duration, loop, unscaled) + unscaled = unscaled or false and true + loop = loop or 1 + return setmetatable({func = func, duration = duration, time = duration, loop = loop, unscaled = unscaled, running = false}, mt) +end + +function Timer:Start() + self.running = true + + if not self.handle then + self.handle = UpdateBeat:CreateListener(self.Update, self) + end + + UpdateBeat:AddListener(self.handle) +end + +function Timer:Reset(func, duration, loop, unscaled) + self.duration = duration + self.loop = loop or 1 + self.unscaled = unscaled + self.func = func + self.time = duration +end + +function Timer:Stop() + self.running = false + + if self.handle then + UpdateBeat:RemoveListener(self.handle) + end +end + +function Timer:Update() + if not self.running then + return + end + + local delta = self.unscaled and Time.unscaledDeltaTime or Time.deltaTime + self.time = self.time - delta + + if self.time <= 0 then + self.func() + + if self.loop > 0 then + self.loop = self.loop - 1 + self.time = self.time + self.duration + end + + if self.loop == 0 then + self:Stop() + elseif self.loop < 0 then + self.time = self.time + self.duration + end + end +end + +--缁欏崗鍚屼娇鐢ㄧ殑甯ц鏁皌imer +FrameTimer = {} + +local FrameTimer = FrameTimer +local mt2 = {__index = FrameTimer} + +function FrameTimer.New(func, count, loop) + local c = Time.frameCount + count + loop = loop or 1 + return setmetatable({func = func, loop = loop, duration = count, count = c, running = false}, mt2) +end + +function FrameTimer:Reset(func, count, loop) + self.func = func + self.duration = count + self.loop = loop + self.count = Time.frameCount + count +end + +function FrameTimer:Start() + if not self.handle then + self.handle = CoUpdateBeat:CreateListener(self.Update, self) + end + + CoUpdateBeat:AddListener(self.handle) + self.running = true +end + +function FrameTimer:Stop() + self.running = false + + if self.handle then + CoUpdateBeat:RemoveListener(self.handle) + end +end + +function FrameTimer:Update() + if not self.running then + return + end + + if Time.frameCount >= self.count then + self.func() + + if self.loop > 0 then + self.loop = self.loop - 1 + end + + if self.loop == 0 then + self:Stop() + else + self.count = Time.frameCount + self.duration + end + end +end + +CoTimer = {} + +local CoTimer = CoTimer +local mt3 = {__index = CoTimer} + +function CoTimer.New(func, duration, loop) + loop = loop or 1 + return setmetatable({duration = duration, loop = loop, func = func, time = duration, running = false}, mt3) +end + +function CoTimer:Start() + if not self.handle then + self.handle = CoUpdateBeat:CreateListener(self.Update, self) + end + + self.running = true + CoUpdateBeat:AddListener(self.handle) +end + +function CoTimer:Reset(func, duration, loop) + self.duration = duration + self.loop = loop or 1 + self.func = func + self.time = duration +end + +function CoTimer:Stop() + self.running = false + + if self.handle then + CoUpdateBeat:RemoveListener(self.handle) + end +end + +function CoTimer:Update() + if not self.running then + return + end + + if self.time <= 0 then + self.func() + + if self.loop > 0 then + self.loop = self.loop - 1 + self.time = self.time + self.duration + end + + if self.loop == 0 then + self:Stop() + elseif self.loop < 0 then + self.time = self.time + self.duration + end + end + + self.time = self.time - Time.deltaTime +end \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Lua/System/Timer.lua.meta b/Assets/LuaFramework/ToLua/Lua/System/Timer.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..2a28e4069c24d5d9961a1f181791fce6ab9557d9 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/System/Timer.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: e891968e6d367cf4da81d8c24a52c358 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/System/ValueType.lua b/Assets/LuaFramework/ToLua/Lua/System/ValueType.lua new file mode 100644 index 0000000000000000000000000000000000000000..a3eb221e39b81a64e59ba7261538a87a26c87834 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/System/ValueType.lua @@ -0,0 +1,40 @@ +-------------------------------------------------------------------------------- +-- Copyright (c) 2015 - 2016 , 钂欏崰蹇(topameng) topameng@gmail.com +-- All rights reserved. +-- Use, modification and distribution are subject to the "MIT License" +-------------------------------------------------------------------------------- +local ValueType = {} + +ValueType[Vector3] = 1 +ValueType[Quaternion] = 2 +ValueType[Vector2] = 3 +ValueType[Color] = 4 +ValueType[Vector4] = 5 +ValueType[Ray] = 6 +ValueType[Bounds] = 7 +ValueType[Touch] = 8 +ValueType[LayerMask] = 9 +ValueType[RaycastHit] = 10 +ValueType[int64] = 11 +ValueType[uint64] = 12 + +local function GetValueType() + local getmetatable = getmetatable + local ValueType = ValueType + + return function(udata) + local meta = getmetatable(udata) + + if meta == nil then + return 0 + end + + return ValueType[meta] or 0 + end +end + +function AddValueType(table, type) + ValueType[table] = type +end + +GetLuaValueType = GetValueType() \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Lua/System/ValueType.lua.meta b/Assets/LuaFramework/ToLua/Lua/System/ValueType.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..830af70d24a7e2329eb573c011645434342d2e3b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/System/ValueType.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: fab9e4d6fcf702740a4c66965903ed1f +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/System/coroutine.lua b/Assets/LuaFramework/ToLua/Lua/System/coroutine.lua new file mode 100644 index 0000000000000000000000000000000000000000..534ced99336b6eb32ea5f4799d21760c4674db9e --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/System/coroutine.lua @@ -0,0 +1,151 @@ +-------------------------------------------------------------------------------- +-- Copyright (c) 2015 - 2016 , 钂欏崰蹇(topameng) topameng@gmail.com +-- All rights reserved. +-- Use, modification and distribution are subject to the "MIT License" +-------------------------------------------------------------------------------- +local create = coroutine.create +local running = coroutine.running +local resume = coroutine.resume +local yield = coroutine.yield +local error = error +local unpack = unpack +local debug = debug +local FrameTimer = FrameTimer +local CoTimer = CoTimer + +local comap = {} +local pool = {} +setmetatable(comap, {__mode = "kv"}) + +function coroutine.start(f, ...) + local co = create(f) + + if running() == nil then + local flag, msg = resume(co, ...) + + if not flag then + error(debug.traceback(co, msg)) + end + else + local args = {...} + local timer = nil + + local action = function() + comap[co] = nil + timer.func = nil + local flag, msg = resume(co, unpack(args)) + table.insert(pool, timer) + + if not flag then + timer:Stop() + error(debug.traceback(co, msg)) + end + end + + if #pool > 0 then + timer = table.remove(pool) + timer:Reset(action, 0, 1) + else + timer = FrameTimer.New(action, 0, 1) + end + + comap[co] = timer + timer:Start() + end + + return co +end + +function coroutine.wait(t, co, ...) + local args = {...} + co = co or running() + local timer = nil + + local action = function() + comap[co] = nil + timer.func = nil + local flag, msg = resume(co, unpack(args)) + + if not flag then + timer:Stop() + error(debug.traceback(co, msg)) + return + end + end + + timer = CoTimer.New(action, t, 1) + comap[co] = timer + timer:Start() + return yield() +end + +function coroutine.step(t, co, ...) + local args = {...} + co = co or running() + local timer = nil + + local action = function() + comap[co] = nil + timer.func = nil + local flag, msg = resume(co, unpack(args)) + table.insert(pool, timer) + + if not flag then + timer:Stop() + error(debug.traceback(co, msg)) + return + end + end + + if #pool > 0 then + timer = table.remove(pool) + timer:Reset(action, t or 1, 1) + else + timer = FrameTimer.New(action, t or 1, 1) + end + + comap[co] = timer + timer:Start() + return yield() +end + +function coroutine.www(www, co) + co = co or running() + local timer = nil + + local action = function() + if not www.isDone then + return + end + + comap[co] = nil + timer:Stop() + timer.func = nil + local flag, msg = resume(co) + table.insert(pool, timer) + + if not flag then + error(debug.traceback(co, msg)) + return + end + end + + if #pool > 0 then + timer = table.remove(pool) + timer:Reset(action, 1, -1) + else + timer = FrameTimer.New(action, 1, -1) + end + comap[co] = timer + timer:Start() + return yield() +end + +function coroutine.stop(co) + local timer = comap[co] + + if timer ~= nil then + comap[co] = nil + timer:Stop() + end +end diff --git a/Assets/LuaFramework/ToLua/Lua/System/coroutine.lua.meta b/Assets/LuaFramework/ToLua/Lua/System/coroutine.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..09077f7ea610d58ce7d1d773cd562affefc92879 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/System/coroutine.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 69692ffc56243fb4a8d655a208364fec +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/UnityEngine.meta b/Assets/LuaFramework/ToLua/Lua/UnityEngine.meta new file mode 100644 index 0000000000000000000000000000000000000000..03fbf794f8b0b1ccb7d8d0526f7403485385d82c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/UnityEngine.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: ec9654611f40bd64cb988c5f45494721 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/UnityEngine/Bounds.lua b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Bounds.lua new file mode 100644 index 0000000000000000000000000000000000000000..3d8021d95366f9a5544d594e3bfa07ab2fcbec5f --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Bounds.lua @@ -0,0 +1,190 @@ +-------------------------------------------------------------------------------- +-- Copyright (c) 2015 - 2016 , 钂欏崰蹇(topameng) topameng@gmail.com +-- All rights reserved. +-- Use, modification and distribution are subject to the "MIT License" +-------------------------------------------------------------------------------- +local rawget = rawget +local setmetatable = setmetatable +local type = type +local Vector3 = Vector3 +local zero = Vector3.zero + +local Bounds = +{ + center = Vector3.zero, + extents = Vector3.zero, +} + +local get = tolua.initget(Bounds) + +Bounds.__index = function(t,k) + local var = rawget(Bounds, k) + + if var == nil then + var = rawget(get, k) + + if var ~= nil then + return var(t) + end + end + + return var +end + +Bounds.__call = function(t, center, size) + return setmetatable({center = center, extents = size * 0.5}, Bounds) +end + +function Bounds.New(center, size) + return setmetatable({center = center, extents = size * 0.5}, Bounds) +end + +function Bounds:Get() + local size = self:GetSize() + return self.center, size +end + +function Bounds:GetSize() + return self.extents * 2 +end + +function Bounds:SetSize(value) + self.extents = value * 0.5 +end + +function Bounds:GetMin() + return self.center - self.extents +end + +function Bounds:SetMin(value) + self:SetMinMax(value, self:GetMax()) +end + +function Bounds:GetMax() + return self.center + self.extents +end + +function Bounds:SetMax(value) + self:SetMinMax(self:GetMin(), value) +end + +function Bounds:SetMinMax(min, max) + self.extents = (max - min) * 0.5 + self.center = min + self.extents +end + +function Bounds:Encapsulate(point) + self:SetMinMax(Vector3.Min(self:GetMin(), point), Vector3.Max(self:GetMax(), point)) +end + +function Bounds:Expand(amount) + if type(amount) == "number" then + amount = amount * 0.5 + self.extents:Add(Vector3.New(amount, amount, amount)) + else + self.extents:Add(amount * 0.5) + end +end + +function Bounds:Intersects(bounds) + local min = self:GetMin() + local max = self:GetMax() + + local min2 = bounds:GetMin() + local max2 = bounds:GetMax() + + return min.x <= max2.x and max.x >= min2.x and min.y <= max2.y and max.y >= min2.y and min.z <= max2.z and max.z >= min2.z +end + +function Bounds:Contains(p) + local min = self:GetMin() + local max = self:GetMax() + + if p.x < min.x or p.y < min.y or p.z < min.z or p.x > max.x or p.y > max.y or p.z > max.z then + return false + end + + return true +end + +function Bounds:IntersectRay(ray) + local tmin = -Mathf.Infinity + local tmax = Mathf.Infinity + + local t0, t1, f + local t = self:GetCenter () - ray:GetOrigin() + local p = {t.x, t.y, t.z} + t = self.extents + local extent = {t.x, t.y, t.z} + t = ray:GetDirection() + local dir = {t.x, t.y, t.z} + + for i = 1, 3 do + f = 1 / dir[i] + t0 = (p[i] + extent[i]) * f + t1 = (p[i] - extent[i]) * f + + if t0 < t1 then + if t0 > tmin then tmin = t0 end + if t1 < tmax then tmax = t1 end + if tmin > tmax then return false end + if tmax < 0 then return false end + else + if t1 > tmin then tmin = t1 end + if t0 < tmax then tmax = t0 end + if tmin > tmax then return false end + if tmax < 0 then return false end + end + end + + return true, tmin +end + +function Bounds:ClosestPoint(point) + local t = point - self:GetCenter() + local closest = {t.x, t.y, t.z} + local et = self.extents + local extent = {et.x, et.y, et.z} + local distance = 0 + local delta + + for i = 1, 3 do + if closest[i] < - extent[i] then + delta = closest[i] + extent[i] + distance = distance + delta * delta + closest[i] = -extent[i] + elseif closest[i] > extent[i] then + delta = closest[i] - extent[i] + distance = distance + delta * delta + closest[i] = extent[i] + end + end + + if distance == 0 then + return rkPoint, 0 + else + outPoint = closest + self:GetCenter() + return outPoint, distance + end +end + +function Bounds:Destroy() + self.center = nil + self.size = nil +end + +Bounds.__tostring = function(self) + return string.format("Center: %s, Extents %s", tostring(self.center), tostring(self.extents)) +end + +Bounds.__eq = function(a, b) + return a.center == b.center and a.extents == b.extents +end + +get.size = Bounds.GetSize +get.min = Bounds.GetMin +get.max = Bounds.GetMax + +UnityEngine.Bounds = Bounds +setmetatable(Bounds, Bounds) +return Bounds diff --git a/Assets/LuaFramework/ToLua/Lua/UnityEngine/Bounds.lua.meta b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Bounds.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..909d7d947a6776bcb828cfc911a8d5eba180512d --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Bounds.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 8643f0e46fe222e48919766d7b0c7c5f +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/UnityEngine/Color.lua b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Color.lua new file mode 100644 index 0000000000000000000000000000000000000000..236824297424b2d2a12af115d64aa449405b11da --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Color.lua @@ -0,0 +1,241 @@ +-------------------------------------------------------------------------------- +-- Copyright (c) 2015 - 2016 , 钂欏崰蹇(topameng) topameng@gmail.com +-- All rights reserved. +-- Use, modification and distribution are subject to the "MIT License" +-------------------------------------------------------------------------------- + +local rawget = rawget +local setmetatable = setmetatable +local type = type +local Mathf = Mathf + +local Color = {} +local get = tolua.initget(Color) + +Color.__index = function(t,k) + local var = rawget(Color, k) + + if var == nil then + var = rawget(get, k) + + if var ~= nil then + return var(t) + end + end + + return var +end + +Color.__call = function(t, r, g, b, a) + return setmetatable({r = r or 0, g = g or 0, b = b or 0, a = a or 1}, Color) +end + +function Color.New(r, g, b, a) + return setmetatable({r = r or 0, g = g or 0, b = b or 0, a = a or 1}, Color) +end + +function Color:Set(r, g, b, a) + self.r = r + self.g = g + self.b = b + self.a = a or 1 +end + +function Color:Get() + return self.r, self.g, self.b, self.a +end + +function Color:Equals(other) + return self.r == other.r and self.g == other.g and self.b == other.b and self.a == other.a +end + +function Color.Lerp(a, b, t) + t = Mathf.Clamp01(t) + return Color.New(a.r + t * (b.r - a.r), a.g + t * (b.g - a.g), a.b + t * (b.b - a.b), a.a + t * (b.a - a.a)) +end + +function Color.LerpUnclamped(a, b, t) + return Color.New(a.r + t * (b.r - a.r), a.g + t * (b.g - a.g), a.b + t * (b.b - a.b), a.a + t * (b.a - a.a)) +end + +function Color.HSVToRGB(H, S, V, hdr) + hdr = hdr and false or true + local white = Color.New(1,1,1,1) + + if S == 0 then + white.r = V + white.g = V + white.b = V + return white + end + + if V == 0 then + white.r = 0 + white.g = 0 + white.b = 0 + return white + end + + white.r = 0 + white.g = 0 + white.b = 0; + local num = S + local num2 = V + local f = H * 6; + local num4 = Mathf.Floor(f) + local num5 = f - num4 + local num6 = num2 * (1 - num) + local num7 = num2 * (1 - (num * num5)) + local num8 = num2 * (1 - (num * (1 - num5))) + local num9 = num4 + + local flag = num9 + 1 + + if flag == 0 then + white.r = num2 + white.g = num6 + white.b = num7 + elseif flag == 1 then + white.r = num2 + white.g = num8 + white.b = num6 + elseif flag == 2 then + white.r = num7 + white.g = num2 + white.b = num6 + elseif flag == 3 then + white.r = num6 + white.g = num2 + white.b = num8 + elseif flag == 4 then + white.r = num6 + white.g = num7 + white.b = num2 + elseif flag == 5 then + white.r = num8 + white.g = num6 + white.b = num2 + elseif flag == 6 then + white.r = num2 + white.g = num6 + white.b = num7 + elseif flag == 7 then + white.r = num2 + white.g = num8 + white.b = num6 + end + + if not hdr then + white.r = Mathf.Clamp(white.r, 0, 1) + white.g = Mathf.Clamp(white.g, 0, 1) + white.b = Mathf.Clamp(white.b, 0, 1) + end + + return white +end + +local function RGBToHSVHelper(offset, dominantcolor, colorone, colortwo) + local V = dominantcolor + + if V ~= 0 then + local num = 0 + + if colorone > colortwo then + num = colortwo + else + num = colorone + end + + local num2 = V - num + local H = 0 + local S = 0 + + if num2 ~= 0 then + S = num2 / V + H = offset + (colorone - colortwo) / num2 + else + S = 0 + H = offset + (colorone - colortwo) + end + + H = H / 6 + if H < 0 then H = H + 1 end + return H, S, V + end + + return 0, 0, V +end + +function Color.RGBToHSV(rgbColor) + if rgbColor.b > rgbColor.g and rgbColor.b > rgbColor.r then + return RGBToHSVHelper(4, rgbColor.b, rgbColor.r, rgbColor.g) + elseif rgbColor.g > rgbColor.r then + return RGBToHSVHelper(2, rgbColor.g, rgbColor.b, rgbColor.r) + else + return RGBToHSVHelper(0, rgbColor.r, rgbColor.g, rgbColor.b) + end +end + +function Color.GrayScale(a) + return 0.299 * a.r + 0.587 * a.g + 0.114 * a.b +end + +Color.__tostring = function(self) + return string.format("RGBA(%f,%f,%f,%f)", self.r, self.g, self.b, self.a) +end + +Color.__add = function(a, b) + return Color.New(a.r + b.r, a.g + b.g, a.b + b.b, a.a + b.a) +end + +Color.__sub = function(a, b) + return Color.New(a.r - b.r, a.g - b.g, a.b - b.b, a.a - b.a) +end + +Color.__mul = function(a, b) + if type(b) == "number" then + return Color.New(a.r * b, a.g * b, a.b * b, a.a * b) + elseif getmetatable(b) == Color then + return Color.New(a.r * b.r, a.g * b.g, a.b * b.b, a.a * b.a) + end +end + +Color.__div = function(a, d) + return Color.New(a.r / d, a.g / d, a.b / d, a.a / d) +end + +Color.__eq = function(a,b) + return a.r == b.r and a.g == b.g and a.b == b.b and a.a == b.a +end + +get.red = function() return Color.New(1,0,0,1) end +get.green = function() return Color.New(0,1,0,1) end +get.blue = function() return Color.New(0,0,1,1) end +get.white = function() return Color.New(1,1,1,1) end +get.black = function() return Color.New(0,0,0,1) end +get.yellow = function() return Color.New(1, 0.9215686, 0.01568628, 1) end +get.cyan = function() return Color.New(0,1,1,1) end +get.magenta = function() return Color.New(1,0,1,1) end +get.gray = function() return Color.New(0.5,0.5,0.5,1) end +get.clear = function() return Color.New(0,0,0,0) end + +get.gamma = function(c) + return Color.New(Mathf.LinearToGammaSpace(c.r), Mathf.LinearToGammaSpace(c.g), Mathf.LinearToGammaSpace(c.b), c.a) +end + +get.linear = function(c) + return Color.New(Mathf.GammaToLinearSpace(c.r), Mathf.GammaToLinearSpace(c.g), Mathf.GammaToLinearSpace(c.b), c.a) +end + +get.maxColorComponent = function(c) + return Mathf.Max(Mathf.Max(c.r, c.g), c.b) +end + +get.grayscale = Color.GrayScale + +UnityEngine.Color = Color +setmetatable(Color, Color) +return Color + + + diff --git a/Assets/LuaFramework/ToLua/Lua/UnityEngine/Color.lua.meta b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Color.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..9a99feda9eb27af386edbadbf04e78a4378fee6c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Color.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 54770d2645593c347ac25713a6d332e3 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/UnityEngine/LayerMask.lua b/Assets/LuaFramework/ToLua/Lua/UnityEngine/LayerMask.lua new file mode 100644 index 0000000000000000000000000000000000000000..42f99a49c30ac9ddc809b914c86120d7c38fa229 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/UnityEngine/LayerMask.lua @@ -0,0 +1,52 @@ +-------------------------------------------------------------------------------- +-- Copyright (c) 2015 - 2016 , 钂欏崰蹇(topameng) topameng@gmail.com +-- All rights reserved. +-- Use, modification and distribution are subject to the "MIT License" +-------------------------------------------------------------------------------- +local Layer = Layer +local rawget = rawget +local setmetatable = setmetatable + +local LayerMask = {} + +LayerMask.__index = function(t,k) + return rawget(LayerMask, k) +end + +LayerMask.__call = function(t,v) + return setmetatable({value = value or 0}, LayerMask) +end + +function LayerMask.New(value) + return setmetatable({value = value or 0}, LayerMask) +end + +function LayerMask:Get() + return self.value +end + +function LayerMask.NameToLayer(name) + return Layer[name] +end + +function LayerMask.GetMask(...) + local arg = {...} + local value = 0 + + for i = 1, #arg do + local n = LayerMask.NameToLayer(arg[i]) + + if n ~= nil then + value = value + 2 ^ n + end + end + + return value +end + +UnityEngine.LayerMask = LayerMask +setmetatable(LayerMask, LayerMask) +return LayerMask + + + diff --git a/Assets/LuaFramework/ToLua/Lua/UnityEngine/LayerMask.lua.meta b/Assets/LuaFramework/ToLua/Lua/UnityEngine/LayerMask.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..d41d0eb17afe150af83be407c719f3f62d35c085 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/UnityEngine/LayerMask.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 08700fd491ce4cf4ba55fd9832b9f9cf +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/UnityEngine/Mathf.lua b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Mathf.lua new file mode 100644 index 0000000000000000000000000000000000000000..5347fc0d048e35e329727ceb73f643c04e5801ad --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Mathf.lua @@ -0,0 +1,223 @@ +-------------------------------------------------------------------------------- +-- Copyright (c) 2015 - 2016 , 钂欏崰蹇(topameng) topameng@gmail.com +-- All rights reserved. +-- Use, modification and distribution are subject to the "MIT License" +-------------------------------------------------------------------------------- +local math = math +local floor = math.floor +local abs = math.abs +local Mathf = Mathf + +Mathf.Deg2Rad = math.rad(1) +Mathf.Epsilon = 1.4013e-45 +Mathf.Infinity = math.huge +Mathf.NegativeInfinity = -math.huge +Mathf.PI = math.pi +Mathf.Rad2Deg = math.deg(1) + +Mathf.Abs = math.abs +Mathf.Acos = math.acos +Mathf.Asin = math.asin +Mathf.Atan = math.atan +Mathf.Atan2 = math.atan2 +Mathf.Ceil = math.ceil +Mathf.Cos = math.cos +Mathf.Exp = math.exp +Mathf.Floor = math.floor +Mathf.Log = math.log +Mathf.Log10 = math.log10 +Mathf.Max = math.max +Mathf.Min = math.min +Mathf.Pow = math.pow +Mathf.Sin = math.sin +Mathf.Sqrt = math.sqrt +Mathf.Tan = math.tan +Mathf.Deg = math.deg +Mathf.Rad = math.rad +Mathf.Random = math.random + +function Mathf.Approximately(a, b) + return abs(b - a) < math.max(1e-6 * math.max(abs(a), abs(b)), 1.121039e-44) +end + +function Mathf.Clamp(value, min, max) + if value < min then + value = min + elseif value > max then + value = max + end + + return value +end + +function Mathf.Clamp01(value) + if value < 0 then + return 0 + elseif value > 1 then + return 1 + end + + return value +end + +function Mathf.DeltaAngle(current, target) + local num = Mathf.Repeat(target - current, 360) + + if num > 180 then + num = num - 360 + end + + return num +end + +function Mathf.Gamma(value, absmax, gamma) + local flag = false + + if value < 0 then + flag = true + end + + local num = abs(value) + + if num > absmax then + return (not flag) and num or -num + end + + local num2 = math.pow(num / absmax, gamma) * absmax + return (not flag) and num2 or -num2 +end + +function Mathf.InverseLerp(from, to, value) + if from < to then + if value < from then + return 0 + end + + if value > to then + return 1 + end + + value = value - from + value = value/(to - from) + return value + end + + if from <= to then + return 0 + end + + if value < to then + return 1 + end + + if value > from then + return 0 + end + + return 1 - ((value - to) / (from - to)) +end + +function Mathf.Lerp(from, to, t) + return from + (to - from) * Mathf.Clamp01(t) +end + +function Mathf.LerpAngle(a, b, t) + local num = Mathf.Repeat(b - a, 360) + + if num > 180 then + num = num - 360 + end + + return a + num * Mathf.Clamp01(t) +end + +function Mathf.LerpUnclamped(a, b, t) + return a + (b - a) * t; +end + +function Mathf.MoveTowards(current, target, maxDelta) + if abs(target - current) <= maxDelta then + return target + end + + return current + Mathf.Sign(target - current) * maxDelta +end + +function Mathf.MoveTowardsAngle(current, target, maxDelta) + target = current + Mathf.DeltaAngle(current, target) + return Mathf.MoveTowards(current, target, maxDelta) +end + +function Mathf.PingPong(t, length) + t = Mathf.Repeat(t, length * 2) + return length - abs(t - length) +end + +function Mathf.Repeat(t, length) + return t - (floor(t / length) * length) +end + +function Mathf.Round(num) + return floor(num + 0.5) +end + +function Mathf.Sign(num) + if num > 0 then + num = 1 + elseif num < 0 then + num = -1 + else + num = 0 + end + + return num +end + +function Mathf.SmoothDamp(current, target, currentVelocity, smoothTime, maxSpeed, deltaTime) + maxSpeed = maxSpeed or Mathf.Infinity + deltaTime = deltaTime or Time.deltaTime + smoothTime = Mathf.Max(0.0001, smoothTime) + local num = 2 / smoothTime + local num2 = num * deltaTime + local num3 = 1 / (1 + num2 + 0.48 * num2 * num2 + 0.235 * num2 * num2 * num2) + local num4 = current - target + local num5 = target + local max = maxSpeed * smoothTime + num4 = Mathf.Clamp(num4, -max, max) + target = current - num4 + local num7 = (currentVelocity + (num * num4)) * deltaTime + currentVelocity = (currentVelocity - num * num7) * num3 + local num8 = target + (num4 + num7) * num3 + + if (num5 > current) == (num8 > num5) then + num8 = num5 + currentVelocity = (num8 - num5) / deltaTime + end + + return num8,currentVelocity +end + +function Mathf.SmoothDampAngle(current, target, currentVelocity, smoothTime, maxSpeed, deltaTime) + deltaTime = deltaTime or Time.deltaTime + maxSpeed = maxSpeed or Mathf.Infinity + target = current + Mathf.DeltaAngle(current, target) + return Mathf.SmoothDamp(current, target, currentVelocity, smoothTime, maxSpeed, deltaTime) +end + + +function Mathf.SmoothStep(from, to, t) + t = Mathf.Clamp01(t) + t = -2 * t * t * t + 3 * t * t + return to * t + from * (1 - t) +end + +function Mathf.HorizontalAngle(dir) + return math.deg(math.atan2(dir.x, dir.z)) +end + +function Mathf.IsNan(number) + return not (number == number) +end + +UnityEngine.Mathf = Mathf +return Mathf \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Lua/UnityEngine/Mathf.lua.meta b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Mathf.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..2f022178a65a0ad5a7378ad420f48ab579f5dac2 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Mathf.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 5cfbc4fb807d4e444bd41df7de6c249e +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/UnityEngine/Plane.lua b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Plane.lua new file mode 100644 index 0000000000000000000000000000000000000000..58ec16eef6ca1638e005958a23b35ae506d88329 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Plane.lua @@ -0,0 +1,66 @@ +-------------------------------------------------------------------------------- +-- Copyright (c) 2015 - 2016 , 钂欏崰蹇(topameng) topameng@gmail.com +-- All rights reserved. +-- Use, modification and distribution are subject to the "MIT License" +-------------------------------------------------------------------------------- +local setmetatable = setmetatable +local Mathf = Mathf +local Vector3 = Vector3 + +local Plane = {} + +Plane.__index = function(t,k) + return rawget(Plane, k) +end + +Plane.__call = function(t,v) + return Plane.New(v) +end + +function Plane.New(normal, d) + return setmetatable({normal = normal:Normalize(), distance = d}, Plane) +end + +function Plane:Get() + return self.normal, self.distance +end + +function Plane:Raycast(ray) + local a = Vector3.Dot(ray.direction, self.normal) + local num2 = -Vector3.Dot(ray.origin, self.normal) - self.distance + + if Mathf.Approximately(a, 0) then + return false, 0 + end + + local enter = num2 / a + return enter > 0, enter +end + +function Plane:SetNormalAndPosition(inNormal, inPoint) + self.normal = inNormal:Normalize() + self.distance = -Vector3.Dot(inNormal, inPoint) +end + +function Plane:Set3Points(a, b, c) + self.normal = Vector3.Normalize(Vector3.Cross(b - a, c - a)) + self.distance = -Vector3.Dot(self.normal, a) +end + +function Plane:GetDistanceToPoint(inPt) + return Vector3.Dot(self.normal, inPt) + self.distance +end + +function Plane:GetSide(inPt) + return (Vector3.Dot(self.normal, inPt) + self.distance) > 0 +end + +function Plane:SameSide(inPt0, inPt1) + local distanceToPoint = self:GetDistanceToPoint(inPt0) + local num2 = self:GetDistanceToPoint(inPt1) + return (distanceToPoint > 0 and num2 > 0) or (distanceToPoint <= 0 and num2 <= 0) +end + +UnityEngine.Plane = Plane +setmetatable(Plane, Plane) +return Plane \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Lua/UnityEngine/Plane.lua.meta b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Plane.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..7dda6c2dc4d76312442ee52267d8c7c6873a52ed --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Plane.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: a3971497c90061f4d9c0e9a99b5bbcbe +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/UnityEngine/Profiler.lua b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Profiler.lua new file mode 100644 index 0000000000000000000000000000000000000000..e631452a29a87b51bbb6683edab6c94af528ccfd --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Profiler.lua @@ -0,0 +1,282 @@ +-------------------------------------------------------------------------------- +-- Copyright (c) 2015 - 2018 , 钂欏崰蹇(topameng) topameng@gmail.com +-- All rights reserved. +-- Use, modification and distribution are subject to the "MIT License" +-------------------------------------------------------------------------------- +local LuaProfiler = LuaProfiler +local vmdef = jit and require("jit.vmdef") + +--閫氳繃鏂囦欢鍚嶅拰琛屾暟鎸囧畾涓涓嚱鏁板悕瀛 +local ffnames = +{ + event = + { + [20] = "_xpcall.__call", + [142] = "event.__call", + }, + + slot = + { + [11] = "slot.__call", + }, + + MainScene = + { + [250] = "MainScene.Update" + } +} + +--涓嶉渶瑕丳rofiler鐨勫嚱鏁 +local blacklist = +{ + ["ipairs_aux"] = 1, + ["_xpcall.__call"] = 1, + ["unknow"] = 1, +} + +local profiler = +{ + mark = 1, + cache = 1, +} + +local stacktrace = {} + +function profiler:scan(t, name) + if self.mark[t] then + return + end + + self.mark[t] = true + + for k, v in pairs(t) do + if type(k) == "string" then + if type(v) == "function" then + local str = k + + if name then + str = name ..".".. str + end + + if not blacklist[str] and k ~= "__index" and k ~= "__newindex" then + self.cache[v] = {name = str, id = -1} + end + elseif type(v) == "table" and not self.mark[v] then + self:scan(v, k) + end + elseif name and k == tolua.gettag or k == tolua.settag then + self:scan(v, name) + end + end +end + +function profiler:scanlibs() + local t = package.loaded + self.mark[t] = true + + for k, v in pairs(t) do + if type(k) == "string" and type(v) == "table" then + self:scan(v, k) + local mt = getmetatable(v) + + if mt then + self:scan(mt, k) + end + end + end +end + +local function findstack(func) + local pos = #stacktrace + 1 + + for i, v in ipairs(stacktrace) do + if v == func then + pos = i + end + end + + return pos +end + +local function jitreturn(count) + local top = #stacktrace + + if top > 0 then + local ar = debug.getinfo (5, "f") + + if ar then + local func = ar.func + local index = findstack(func) + + if index > top then + ar = debug.getinfo(6, "f") + + if ar then + func = ar.func + index = findstack(func) or index + end + end + + for i = index + 1, top do + table.remove(stacktrace) + LuaProfiler.EndSample() + end + end + end +end + +local function BeginSample(name, func, cache) + jitreturn() + table.insert(stacktrace, func) + + if cache.id == -1 then + cache.name = name + cache.id = LuaProfiler.GetID(name) + end + + LuaProfiler.BeginSample(cache.id) +end + +local function BeginSampleNick(name, func, cache) + jitreturn() + table.insert(stacktrace, func) + local id = -1 + + if cache.nick == nil then + cache.nick = {} + end + + id = cache.nick[name] + + if not id then + id = LuaProfiler.GetID(name) + cache.nick[name] = id + end + + LuaProfiler.BeginSample(id) +end + +function profiler_hook(event, line) + if event == 'call' then + local name = nil + local func = debug.getinfo (2, 'f').func + local cache = profiler.cache[func] + + if cache then + name = cache.name + end + + if blacklist[name] then + return + end + + if name == "event.__call" then + local ar = debug.getinfo (2, 'n') + BeginSampleNick(ar.name or name, func, cache) + elseif name then + BeginSample(name, func, cache) + else + local ar = debug.getinfo (2, 'Sn') + local method = ar.name + local linedefined = ar.linedefined + + if not cache then + cache = {name = "unknow", id = -1} + profiler.cache[func] = cache + end + + if ar.short_src == "[C]" then + if method == "__index" or method == "__newindex" then + return + end + + local name = tostring(func) + local index = name:match("function: builtin#(%d+)") + + if not index then + if method then + name = method + BeginSample(method, func, cache) + elseif linedefined ~= -1 then + name = ar.short_src .. linedefined + BeginSample(name, func, cache) + end + else + name = vmdef.ffnames[tonumber(index)] + + if not blacklist[name] then + BeginSample(name, func, cache) + end + end + elseif linedefined ~= -1 or method then + local short_src = ar.short_src + method = method or linedefined + + local name = nil + name = short_src:match('([^/\\]+)%.%w+$') + name = name or short_src:match('([^/\\]+)$') + + local ffname = ffnames[name] + + if ffname then + name = ffname[linedefined] + else + name = name .. "." .. method + end + + if not name then + name = short_src .. "." .. method + end + + BeginSample(name, func, cache) + else + BeginSample(name, func, cache) + end + end + elseif event == "return" then + local top = #stacktrace + + if top == 0 then + return + end + + local ar = debug.getinfo (2, 'f') + + if ar.func == stacktrace[top] then + table.remove(stacktrace) + LuaProfiler.EndSample() + else + local index = findstack(ar.func) + if index > top then return end + + for i = index, top do + table.remove(stacktrace) + LuaProfiler.EndSample() + end + end + end +end + +function profiler:start() + self.mark = {} + self.cache = {__mode = "k"} + + self:scan(_G, nil) + self:scanlibs() + self.mark = nil + + debug.sethook(profiler_hook, 'cr', 0) +end + +function profiler:print() + for k, v in pairs(self.cache) do + print(v.name) + end +end + +function profiler:stop() + debug.sethook(nil) + self.cache = nil +end + +return profiler \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Lua/UnityEngine/Profiler.lua.meta b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Profiler.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..a6940f1946e5dd953329eb15d8ec974d09ab446e --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Profiler.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 37c51fa1e5d7c094f8620b364c731293 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/UnityEngine/Quaternion.lua b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Quaternion.lua new file mode 100644 index 0000000000000000000000000000000000000000..835e2d68592c6f45106d909629511cd04ef9be6c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Quaternion.lua @@ -0,0 +1,610 @@ +-------------------------------------------------------------------------------- +-- Copyright (c) 2015 , 钂欏崰蹇(topameng) topameng@gmail.com +-- All rights reserved. +-- Use, modification and distribution are subject to the "MIT License" +-------------------------------------------------------------------------------- +local math = math +local sin = math.sin +local cos = math.cos +local acos = math.acos +local asin = math.asin +local sqrt = math.sqrt +local min = math.min +local max = math.max +local sign = math.sign +local atan2 = math.atan2 +local clamp = Mathf.Clamp +local abs = math.abs +local setmetatable = setmetatable +local getmetatable = getmetatable +local rawget = rawget +local rawset = rawset +local Vector3 = Vector3 + +local rad2Deg = Mathf.Rad2Deg +local halfDegToRad = 0.5 * Mathf.Deg2Rad +local _forward = Vector3.forward +local _up = Vector3.up +local _next = { 2, 3, 1 } + +local Quaternion = {} +local get = tolua.initget(Quaternion) + +Quaternion.__index = function(t, k) + local var = rawget(Quaternion, k) + + if var == nil then + var = rawget(get, k) + + if var ~= nil then + return var(t) + end + end + + return var +end + +Quaternion.__newindex = function(t, name, k) + if name == "eulerAngles" then + t:SetEuler(k) + else + rawset(t, name, k) + end +end + +function Quaternion.New(x, y, z, w) + local t = {x = x or 0, y = y or 0, z = z or 0, w = w or 0} + setmetatable(t, Quaternion) + return t +end + +local _new = Quaternion.New + +Quaternion.__call = function(t, x, y, z, w) + local t = {x = x or 0, y = y or 0, z = z or 0, w = w or 0} + setmetatable(t, Quaternion) + return t +end + +function Quaternion:Set(x,y,z,w) + self.x = x or 0 + self.y = y or 0 + self.z = z or 0 + self.w = w or 0 +end + +function Quaternion:Clone() + return _new(self.x, self.y, self.z, self.w) +end + +function Quaternion:Get() + return self.x, self.y, self.z, self.w +end + +function Quaternion.Dot(a, b) + return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w +end + +function Quaternion.Angle(a, b) + local dot = Quaternion.Dot(a, b) + if dot < 0 then dot = -dot end + return acos(min(dot, 1)) * 2 * 57.29578 +end + +function Quaternion.AngleAxis(angle, axis) + local normAxis = axis:Normalize() + angle = angle * halfDegToRad + local s = sin(angle) + + local w = cos(angle) + local x = normAxis.x * s + local y = normAxis.y * s + local z = normAxis.z * s + + return _new(x,y,z,w) +end + +function Quaternion.Equals(a, b) + return a.x == b.x and a.y == b.y and a.z == b.z and a.w == b.w +end + +function Quaternion.Euler(x, y, z) + x = x * 0.0087266462599716 + y = y * 0.0087266462599716 + z = z * 0.0087266462599716 + + local sinX = sin(x) + x = cos(x) + local sinY = sin(y) + y = cos(y) + local sinZ = sin(z) + z = cos(z) + + local q = {x = y * sinX * z + sinY * x * sinZ, y = sinY * x * z - y * sinX * sinZ, z = y * x * sinZ - sinY * sinX * z, w = y * x * z + sinY * sinX * sinZ} + setmetatable(q, Quaternion) + return q +end + +function Quaternion:SetEuler(x, y, z) + if y == nil and z == nil then + y = x.y + z = x.z + x = x.x + end + + x = x * 0.0087266462599716 + y = y * 0.0087266462599716 + z = z * 0.0087266462599716 + + local sinX = sin(x) + local cosX = cos(x) + local sinY = sin(y) + local cosY = cos(y) + local sinZ = sin(z) + local cosZ = cos(z) + + self.w = cosY * cosX * cosZ + sinY * sinX * sinZ + self.x = cosY * sinX * cosZ + sinY * cosX * sinZ + self.y = sinY * cosX * cosZ - cosY * sinX * sinZ + self.z = cosY * cosX * sinZ - sinY * sinX * cosZ + + return self +end + +function Quaternion:Normalize() + local quat = self:Clone() + quat:SetNormalize() + return quat +end + +function Quaternion:SetNormalize() + local n = self.x * self.x + self.y * self.y + self.z * self.z + self.w * self.w + + if n ~= 1 and n > 0 then + n = 1 / sqrt(n) + self.x = self.x * n + self.y = self.y * n + self.z = self.z * n + self.w = self.w * n + end +end + +--浜х敓涓涓柊鐨勪粠from鍒皌o鐨勫洓鍏冩暟 +function Quaternion.FromToRotation(from, to) + local quat = Quaternion.New() + quat:SetFromToRotation(from, to) + return quat +end + +--璁剧疆褰撳墠鍥涘厓鏁颁负 from 鍒 to鐨勬棆杞, 娉ㄦ剰from鍜宼o鍚 forward骞宠浼氬悓unity涓嶄竴鑷 +function Quaternion:SetFromToRotation1(from, to) + local v0 = from:Normalize() + local v1 = to:Normalize() + local d = Vector3.Dot(v0, v1) + + if d > -1 + 1e-6 then + local s = sqrt((1+d) * 2) + local invs = 1 / s + local c = Vector3.Cross(v0, v1) * invs + self:Set(c.x, c.y, c.z, s * 0.5) + elseif d > 1 - 1e-6 then + return _new(0, 0, 0, 1) + else + local axis = Vector3.Cross(Vector3.right, v0) + + if axis:SqrMagnitude() < 1e-6 then + axis = Vector3.Cross(Vector3.forward, v0) + end + + self:Set(axis.x, axis.y, axis.z, 0) + return self + end + + return self +end + +local function MatrixToQuaternion(rot, quat) + local trace = rot[1][1] + rot[2][2] + rot[3][3] + + if trace > 0 then + local s = sqrt(trace + 1) + quat.w = 0.5 * s + s = 0.5 / s + quat.x = (rot[3][2] - rot[2][3]) * s + quat.y = (rot[1][3] - rot[3][1]) * s + quat.z = (rot[2][1] - rot[1][2]) * s + quat:SetNormalize() + else + local i = 1 + local q = {0, 0, 0} + + if rot[2][2] > rot[1][1] then + i = 2 + end + + if rot[3][3] > rot[i][i] then + i = 3 + end + + local j = _next[i] + local k = _next[j] + + local t = rot[i][i] - rot[j][j] - rot[k][k] + 1 + local s = 0.5 / sqrt(t) + q[i] = s * t + local w = (rot[k][j] - rot[j][k]) * s + q[j] = (rot[j][i] + rot[i][j]) * s + q[k] = (rot[k][i] + rot[i][k]) * s + + quat:Set(q[1], q[2], q[3], w) + quat:SetNormalize() + end +end + +function Quaternion:SetFromToRotation(from, to) + from = from:Normalize() + to = to:Normalize() + + local e = Vector3.Dot(from, to) + + if e > 1 - 1e-6 then + self:Set(0, 0, 0, 1) + elseif e < -1 + 1e-6 then + local left = {0, from.z, from.y} + local mag = left[2] * left[2] + left[3] * left[3] --+ left[1] * left[1] = 0 + + if mag < 1e-6 then + left[1] = -from.z + left[2] = 0 + left[3] = from.x + mag = left[1] * left[1] + left[3] * left[3] + end + + local invlen = 1/sqrt(mag) + left[1] = left[1] * invlen + left[2] = left[2] * invlen + left[3] = left[3] * invlen + + local up = {0, 0, 0} + up[1] = left[2] * from.z - left[3] * from.y + up[2] = left[3] * from.x - left[1] * from.z + up[3] = left[1] * from.y - left[2] * from.x + + + local fxx = -from.x * from.x + local fyy = -from.y * from.y + local fzz = -from.z * from.z + + local fxy = -from.x * from.y + local fxz = -from.x * from.z + local fyz = -from.y * from.z + + local uxx = up[1] * up[1] + local uyy = up[2] * up[2] + local uzz = up[3] * up[3] + local uxy = up[1] * up[2] + local uxz = up[1] * up[3] + local uyz = up[2] * up[3] + + local lxx = -left[1] * left[1] + local lyy = -left[2] * left[2] + local lzz = -left[3] * left[3] + local lxy = -left[1] * left[2] + local lxz = -left[1] * left[3] + local lyz = -left[2] * left[3] + + local rot = + { + {fxx + uxx + lxx, fxy + uxy + lxy, fxz + uxz + lxz}, + {fxy + uxy + lxy, fyy + uyy + lyy, fyz + uyz + lyz}, + {fxz + uxz + lxz, fyz + uyz + lyz, fzz + uzz + lzz}, + } + + MatrixToQuaternion(rot, self) + else + local v = Vector3.Cross(from, to) + local h = (1 - e) / Vector3.Dot(v, v) + + local hx = h * v.x + local hz = h * v.z + local hxy = hx * v.y + local hxz = hx * v.z + local hyz = hz * v.y + + local rot = + { + {e + hx*v.x, hxy - v.z, hxz + v.y}, + {hxy + v.z, e + h*v.y*v.y, hyz-v.x}, + {hxz - v.y, hyz + v.x, e + hz*v.z}, + } + + MatrixToQuaternion(rot, self) + end +end + +function Quaternion:Inverse() + local quat = Quaternion.New() + + quat.x = -self.x + quat.y = -self.y + quat.z = -self.z + quat.w = self.w + + return quat +end + +function Quaternion.Lerp(q1, q2, t) + t = clamp(t, 0, 1) + local q = {x = 0, y = 0, z = 0, w = 1} + + if Quaternion.Dot(q1, q2) < 0 then + q.x = q1.x + t * (-q2.x -q1.x) + q.y = q1.y + t * (-q2.y -q1.y) + q.z = q1.z + t * (-q2.z -q1.z) + q.w = q1.w + t * (-q2.w -q1.w) + else + q.x = q1.x + (q2.x - q1.x) * t + q.y = q1.y + (q2.y - q1.y) * t + q.z = q1.z + (q2.z - q1.z) * t + q.w = q1.w + (q2.w - q1.w) * t + end + + Quaternion.SetNormalize(q) + setmetatable(q, Quaternion) + return q +end + + +function Quaternion.LookRotation(forward, up) + local mag = forward:Magnitude() + if mag < 1e-6 then + error("error input forward to Quaternion.LookRotation"..tostring(forward)) + return nil + end + + forward = forward / mag + up = up or _up + local right = Vector3.Cross(up, forward) + right:SetNormalize() + up = Vector3.Cross(forward, right) + right = Vector3.Cross(up, forward) + +--[[ local quat = _new(0,0,0,1) + local rot = + { + {right.x, up.x, forward.x}, + {right.y, up.y, forward.y}, + {right.z, up.z, forward.z}, + } + + MatrixToQuaternion(rot, quat) + return quat--]] + + local t = right.x + up.y + forward.z + + if t > 0 then + local x, y, z, w + t = t + 1 + local s = 0.5 / sqrt(t) + w = s * t + x = (up.z - forward.y) * s + y = (forward.x - right.z) * s + z = (right.y - up.x) * s + + local ret = _new(x, y, z, w) + ret:SetNormalize() + return ret + else + local rot = + { + {right.x, up.x, forward.x}, + {right.y, up.y, forward.y}, + {right.z, up.z, forward.z}, + } + + local q = {0, 0, 0} + local i = 1 + + if up.y > right.x then + i = 2 + end + + if forward.z > rot[i][i] then + i = 3 + end + + local j = _next[i] + local k = _next[j] + + local t = rot[i][i] - rot[j][j] - rot[k][k] + 1 + local s = 0.5 / sqrt(t) + q[i] = s * t + local w = (rot[k][j] - rot[j][k]) * s + q[j] = (rot[j][i] + rot[i][j]) * s + q[k] = (rot[k][i] + rot[i][k]) * s + + local ret = _new(q[1], q[2], q[3], w) + ret:SetNormalize() + return ret + end +end + +function Quaternion:SetIdentity() + self.x = 0 + self.y = 0 + self.z = 0 + self.w = 1 +end + +local function UnclampedSlerp(q1, q2, t) + local dot = q1.x * q2.x + q1.y * q2.y + q1.z * q2.z + q1.w * q2.w + + if dot < 0 then + dot = -dot + q2 = setmetatable({x = -q2.x, y = -q2.y, z = -q2.z, w = -q2.w}, Quaternion) + end + + if dot < 0.95 then + local angle = acos(dot) + local invSinAngle = 1 / sin(angle) + local t1 = sin((1 - t) * angle) * invSinAngle + local t2 = sin(t * angle) * invSinAngle + q1 = {x = q1.x * t1 + q2.x * t2, y = q1.y * t1 + q2.y * t2, z = q1.z * t1 + q2.z * t2, w = q1.w * t1 + q2.w * t2} + setmetatable(q1, Quaternion) + return q1 + else + q1 = {x = q1.x + t * (q2.x - q1.x), y = q1.y + t * (q2.y - q1.y), z = q1.z + t * (q2.z - q1.z), w = q1.w + t * (q2.w - q1.w)} + Quaternion.SetNormalize(q1) + setmetatable(q1, Quaternion) + return q1 + end +end + + +function Quaternion.Slerp(from, to, t) + if t < 0 then + t = 0 + elseif t > 1 then + t = 1 + end + + return UnclampedSlerp(from, to, t) +end + +function Quaternion.RotateTowards(from, to, maxDegreesDelta) + local angle = Quaternion.Angle(from, to) + + if angle == 0 then + return to + end + + local t = min(1, maxDegreesDelta / angle) + return UnclampedSlerp(from, to, t) +end + +local function Approximately(f0, f1) + return abs(f0 - f1) < 1e-6 +end + +function Quaternion:ToAngleAxis() + local angle = 2 * acos(self.w) + + if Approximately(angle, 0) then + return angle * 57.29578, Vector3.New(1, 0, 0) + end + + local div = 1 / sqrt(1 - sqrt(self.w)) + return angle * 57.29578, Vector3.New(self.x * div, self.y * div, self.z * div) +end + +local pi = Mathf.PI +local half_pi = pi * 0.5 +local two_pi = 2 * pi +local negativeFlip = -0.0001 +local positiveFlip = two_pi - 0.0001 + +local function SanitizeEuler(euler) + if euler.x < negativeFlip then + euler.x = euler.x + two_pi + elseif euler.x > positiveFlip then + euler.x = euler.x - two_pi + end + + if euler.y < negativeFlip then + euler.y = euler.y + two_pi + elseif euler.y > positiveFlip then + euler.y = euler.y - two_pi + end + + if euler.z < negativeFlip then + euler.z = euler.z + two_pi + elseif euler.z > positiveFlip then + euler.z = euler.z + two_pi + end +end + +--from http://www.geometrictools.com/Documentation/EulerAngles.pdf +--Order of rotations: YXZ +function Quaternion:ToEulerAngles() + local x = self.x + local y = self.y + local z = self.z + local w = self.w + + local check = 2 * (y * z - w * x) + + if check < 0.999 then + if check > -0.999 then + local v = Vector3.New( -asin(check), + atan2(2 * (x * z + w * y), 1 - 2 * (x * x + y * y)), + atan2(2 * (x * y + w * z), 1 - 2 * (x * x + z * z))) + SanitizeEuler(v) + v:Mul(rad2Deg) + return v + else + local v = Vector3.New(half_pi, atan2(2 * (x * y - w * z), 1 - 2 * (y * y + z * z)), 0) + SanitizeEuler(v) + v:Mul(rad2Deg) + return v + end + else + local v = Vector3.New(-half_pi, atan2(-2 * (x * y - w * z), 1 - 2 * (y * y + z * z)), 0) + SanitizeEuler(v) + v:Mul(rad2Deg) + return v + end +end + +function Quaternion:Forward() + return self:MulVec3(_forward) +end + +function Quaternion.MulVec3(self, point) + local vec = Vector3.New() + + local num = self.x * 2 + local num2 = self.y * 2 + local num3 = self.z * 2 + local num4 = self.x * num + local num5 = self.y * num2 + local num6 = self.z * num3 + local num7 = self.x * num2 + local num8 = self.x * num3 + local num9 = self.y * num3 + local num10 = self.w * num + local num11 = self.w * num2 + local num12 = self.w * num3 + + vec.x = (((1 - (num5 + num6)) * point.x) + ((num7 - num12) * point.y)) + ((num8 + num11) * point.z) + vec.y = (((num7 + num12) * point.x) + ((1 - (num4 + num6)) * point.y)) + ((num9 - num10) * point.z) + vec.z = (((num8 - num11) * point.x) + ((num9 + num10) * point.y)) + ((1 - (num4 + num5)) * point.z) + + return vec +end + +Quaternion.__mul = function(lhs, rhs) + if Quaternion == getmetatable(rhs) then + return Quaternion.New((((lhs.w * rhs.x) + (lhs.x * rhs.w)) + (lhs.y * rhs.z)) - (lhs.z * rhs.y), (((lhs.w * rhs.y) + (lhs.y * rhs.w)) + (lhs.z * rhs.x)) - (lhs.x * rhs.z), (((lhs.w * rhs.z) + (lhs.z * rhs.w)) + (lhs.x * rhs.y)) - (lhs.y * rhs.x), (((lhs.w * rhs.w) - (lhs.x * rhs.x)) - (lhs.y * rhs.y)) - (lhs.z * rhs.z)) + elseif Vector3 == getmetatable(rhs) then + return lhs:MulVec3(rhs) + end +end + +Quaternion.__unm = function(q) + return Quaternion.New(-q.x, -q.y, -q.z, -q.w) +end + +Quaternion.__eq = function(lhs,rhs) + return Quaternion.Dot(lhs, rhs) > 0.999999 +end + +Quaternion.__tostring = function(self) + return "["..self.x..","..self.y..","..self.z..","..self.w.."]" +end + +get.identity = function() return _new(0, 0, 0, 1) end +get.eulerAngles = Quaternion.ToEulerAngles + +UnityEngine.Quaternion = Quaternion +setmetatable(Quaternion, Quaternion) +return Quaternion \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Lua/UnityEngine/Quaternion.lua.meta b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Quaternion.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..7d44fb39e15b56fdb2f353ec3e0efc311d32566c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Quaternion.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: bc8181e6244125146a87c5b83c380a92 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/UnityEngine/Ray.lua b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Ray.lua new file mode 100644 index 0000000000000000000000000000000000000000..dbd776e57a178f472b716cf879f4aafcae04e3a7 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Ray.lua @@ -0,0 +1,62 @@ +-------------------------------------------------------------------------------- +-- Copyright (c) 2015 - 2016 , 钂欏崰蹇(topameng) topameng@gmail.com +-- All rights reserved. +-- Use, modification and distribution are subject to the "MIT License" +-------------------------------------------------------------------------------- +local rawget = rawget +local setmetatable = setmetatable +local Vector3 = Vector3 + +local Ray = +{ + direction = Vector3.zero, + origin = Vector3.zero, +} + +local get = tolua.initget(Ray) + +Ray.__index = function(t,k) + local var = rawget(Ray, k) + + if var == nil then + var = rawget(get, k) + + if var ~= nil then + return var(t) + end + end + + return var +end + +Ray.__call = function(t, direction, origin) + return Ray.New(direction, origin) +end + +function Ray.New(direction, origin) + local ray = {} + ray.direction = direction:Normalize() + ray.origin = origin + setmetatable(ray, Ray) + return ray +end + +function Ray:GetPoint(distance) + local dir = self.direction * distance + dir:Add(self.origin) + return dir +end + +function Ray:Get() + local o = self.origin + local d = self.direction + return o.x, o.y, o.z, d.x, d.y, d.z +end + +Ray.__tostring = function(self) + return string.format("Origin:(%f,%f,%f),Dir:(%f,%f, %f)", self.origin.x, self.origin.y, self.origin.z, self.direction.x, self.direction.y, self.direction.z) +end + +UnityEngine.Ray = Ray +setmetatable(Ray, Ray) +return Ray \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Lua/UnityEngine/Ray.lua.meta b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Ray.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..b62e77fff6db9efd7b52dadd9ea47b2f407431b4 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Ray.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 436d981c3546acd44a03048767c0d85a +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/UnityEngine/RaycastHit.lua b/Assets/LuaFramework/ToLua/Lua/UnityEngine/RaycastHit.lua new file mode 100644 index 0000000000000000000000000000000000000000..8f51e123d9e69810333b4ed71b66fc45f3930b34 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/UnityEngine/RaycastHit.lua @@ -0,0 +1,81 @@ +-------------------------------------------------------------------------------- +-- Copyright (c) 2015 - 2016 , 钂欏崰蹇(topameng) topameng@gmail.com +-- All rights reserved. +-- Use, modification and distribution are subject to the "MIT License" +-------------------------------------------------------------------------------- +local rawget = rawget +local setmetatable = setmetatable + +RaycastBits = +{ + Collider = 1, + Normal = 2, + Point = 4, + Rigidbody = 8, + Transform = 16, + ALL = 31, +} + +local RaycastBits = RaycastBits +local RaycastHit = {} +local get = tolua.initget(RaycastHit) + +RaycastHit.__index = function(t,k) + local var = rawget(RaycastHit, k) + + if var == nil then + var = rawget(get, k) + + if var ~= nil then + return var(t) + end + end + + return var +end + +--c# 鍒涘缓 +function RaycastHit.New(collider, distance, normal, point, rigidbody, transform) + local hit = {collider = collider, distance = distance, normal = normal, point = point, rigidbody = rigidbody, transform = transform} + setmetatable(hit, RaycastHit) + return hit +end + +function RaycastHit:Init(collider, distance, normal, point, rigidbody, transform) + self.collider = collider + self.distance = distance + self.normal = normal + self.point = point + self.rigidbody = rigidbody + self.transform = transform +end + +function RaycastHit:Get() + return self.collider, self.distance, self.normal, self.point, self.rigidbody, self.transform +end + +function RaycastHit:Destroy() + self.collider = nil + self.rigidbody = nil + self.transform = nil +end + +function RaycastHit.GetMask(...) + local arg = {...} + local value = 0 + + for i = 1, #arg do + local n = RaycastBits[arg[i]] or 0 + + if n ~= 0 then + value = value + n + end + end + + if value == 0 then value = RaycastBits["all"] end + return value +end + +UnityEngine.RaycastHit = RaycastHit +setmetatable(RaycastHit, RaycastHit) +return RaycastHit \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Lua/UnityEngine/RaycastHit.lua.meta b/Assets/LuaFramework/ToLua/Lua/UnityEngine/RaycastHit.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..93589a0e3e5b0f50baf6a059500ffc9923f06d75 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/UnityEngine/RaycastHit.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 707a4e1a225007d45923200abf2c9c13 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/UnityEngine/Time.lua b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Time.lua new file mode 100644 index 0000000000000000000000000000000000000000..179601e35c5f8c578552a7d55e11233b9477562f --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Time.lua @@ -0,0 +1,126 @@ +-------------------------------------------------------------------------------- +-- Copyright (c) 2015 - 2016 , 钂欏崰蹇(topameng) topameng@gmail.com +-- All rights reserved. +-- Use, modification and distribution are subject to the "MIT License" +-------------------------------------------------------------------------------- +local rawget = rawget +local uTime = UnityEngine.Time +local gettime = tolua.gettime + +local _Time = +{ + deltaTime = 0, + fixedDeltaTime = 0, + maximumDeltaTime = 0.3333333, + fixedTime = 0, + frameCount = 1, + realtimeSinceStartup=0, + time = 0, + timeScale = 1, + timeSinceLevelLoad = 0, + unscaledDeltaTime = 0, + unscaledTime = 0, +} + +local _set = {} + +function _set.fixedDeltaTime(v) + _Time.fixedDeltaTime = v + uTime.fixedDeltaTime = v +end + +function _set.maximumDeltaTime(v) + _Time.maximumDeltaTime = v + uTime.maximumDeltaTime = v +end + +function _set.timeScale(v) + _Time.timeScale = v + uTime.timeScale = v +end + +function _set.captureFramerate(v) + _Time.captureFramerate = v + uTime.captureFramerate = v +end + +function _set.timeSinceLevelLoad(v) + _Time.timeSinceLevelLoad = v +end + +_Time.__index = function(t, k) + local var = rawget(_Time, k) + + if var then + return var + end + + return uTime.__index(uTime, k) +end + +_Time.__newindex = function(t, k, v) + local func = rawget(_set, k) + + if func then + return func(v) + end + + error(string.format("Property or indexer `UnityEngine.Time.%s' cannot be assigned to (it is read only)", k)) +end + +local Time = {} +local counter = 1 + +function Time:SetDeltaTime(deltaTime, unscaledDeltaTime) + local _Time = _Time + _Time.deltaTime = deltaTime + _Time.unscaledDeltaTime = unscaledDeltaTime + counter = counter - 1 + + if counter == 0 and uTime then + _Time.time = uTime.time + _Time.timeSinceLevelLoad = uTime.timeSinceLevelLoad + _Time.unscaledTime = uTime.unscaledTime + _Time.realtimeSinceStartup = uTime.realtimeSinceStartup + _Time.frameCount = uTime.frameCount + counter = 1000000 + else + _Time.time = _Time.time + deltaTime + _Time.realtimeSinceStartup = _Time.realtimeSinceStartup + unscaledDeltaTime + _Time.timeSinceLevelLoad = _Time.timeSinceLevelLoad + deltaTime + _Time.unscaledTime = _Time.unscaledTime + unscaledDeltaTime + end +end + +function Time:SetFixedDelta(fixedDeltaTime) + _Time.deltaTime = fixedDeltaTime + _Time.fixedDeltaTime = fixedDeltaTime + + _Time.fixedTime = _Time.fixedTime + fixedDeltaTime +end + +function Time:SetFrameCount() + _Time.frameCount = _Time.frameCount + 1 +end + +function Time:SetTimeScale(scale) + local last = _Time.timeScale + _Time.timeScale = scale + uTime.timeScale = scale + return last +end + +function Time:GetTimestamp() + return gettime() +end + +UnityEngine.Time = Time +setmetatable(Time, _Time) + +if uTime ~= nil then + _Time.maximumDeltaTime = uTime.maximumDeltaTime + _Time.timeScale = uTime.timeScale +end + + +return Time \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Lua/UnityEngine/Time.lua.meta b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Time.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..104868af6fa2170e09fd9ab0f72c12a1169e7b1f --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Time.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 0f2e1d9dee4ecaf4b8734c59f1c9f3b5 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/UnityEngine/Touch.lua b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Touch.lua new file mode 100644 index 0000000000000000000000000000000000000000..121c39832683ab75e6d58bb224395d48a484d989 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Touch.lua @@ -0,0 +1,89 @@ +-------------------------------------------------------------------------------- +-- Copyright (c) 2015 - 2016 , 钂欏崰蹇(topameng) topameng@gmail.com +-- All rights reserved. +-- Use, modification and distribution are subject to the "MIT License" +-------------------------------------------------------------------------------- +local zero = Vector2.zero +local rawget = rawget +local setmetatable = setmetatable + +TouchPhase = +{ + Began = 0, + Moved = 1, + Stationary = 2, + Ended = 3, + Canceled = 4, +} + +TouchBits = +{ + DeltaPosition = 1, + Position = 2, + RawPosition = 4, + ALL = 7, +} + +local TouchPhase = TouchPhase +local TouchBits = TouchBits +local Touch = {} +local get = tolua.initget(Touch) + +Touch.__index = function(t,k) + local var = rawget(Touch, k) + + if var == nil then + var = rawget(get, k) + + if var ~= nil then + return var(t) + end + end + + return var +end + +--c# 鍒涘缓 +function Touch.New(fingerId, position, rawPosition, deltaPosition, deltaTime, tapCount, phase) + return setmetatable({fingerId = fingerId or 0, position = position or zero, rawPosition = rawPosition or zero, deltaPosition = deltaPosition or zero, deltaTime = deltaTime or 0, tapCount = tapCount or 0, phase = phase or 0}, Touch) +end + +function Touch:Init(fingerId, position, rawPosition, deltaPosition, deltaTime, tapCount, phase) + self.fingerId = fingerId + self.position = position + self.rawPosition = rawPosition + self.deltaPosition = deltaPosition + self.deltaTime = deltaTime + self.tapCount = tapCount + self.phase = phase +end + +function Touch:Destroy() + self.position = nil + self.rawPosition = nil + self.deltaPosition = nil +end + +function Touch.GetMask(...) + local arg = {...} + local value = 0 + + for i = 1, #arg do + local n = TouchBits[arg[i]] or 0 + + if n ~= 0 then + value = value + n + end + end + + if value == 0 then value = TouchBits["all"] end + + return value +end + +UnityEngine.TouchPhase = TouchPhase +UnityEngine.Touch = Touch +setmetatable(Touch, Touch) +return Touch + + diff --git a/Assets/LuaFramework/ToLua/Lua/UnityEngine/Touch.lua.meta b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Touch.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..5340ad8d3724c8a630b3d663f941235a33f81dfa --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Touch.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 48ee0c1b8478eba4f9338e5ec4a14d40 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/UnityEngine/Vector2.lua b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Vector2.lua new file mode 100644 index 0000000000000000000000000000000000000000..1aed87c5591ac9eff7a7619f54d80ea83fcbfcf8 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Vector2.lua @@ -0,0 +1,313 @@ +-------------------------------------------------------------------------------- +-- Copyright (c) 2015 , 钂欏崰蹇(topameng) topameng@gmail.com +-- All rights reserved. +-- Use, modification and distribution are subject to the "MIT License" +-------------------------------------------------------------------------------- + +local sqrt = math.sqrt +local setmetatable = setmetatable +local rawget = rawget +local math = math +local acos = math.acos +local max = math.max + +local Vector2 = {} +local get = tolua.initget(Vector2) + +Vector2.__index = function(t,k) + local var = rawget(Vector2, k) + + if var == nil then + var = rawget(get, k) + + if var ~= nil then + return var(t) + end + end + + return var +end + +Vector2.__call = function(t, x, y) + return setmetatable({x = x or 0, y = y or 0}, Vector2) +end + +function Vector2.New(x, y) + return setmetatable({x = x or 0, y = y or 0}, Vector2) +end + +function Vector2:Set(x,y) + self.x = x or 0 + self.y = y or 0 +end + +function Vector2:Get() + return self.x, self.y +end + +function Vector2:SqrMagnitude() + return self.x * self.x + self.y * self.y +end + +function Vector2:Clone() + return setmetatable({x = self.x, y = self.y}, Vector2) +end + + +function Vector2.Normalize(v) + local x = v.x + local y = v.y + local magnitude = sqrt(x * x + y * y) + + if magnitude > 1e-05 then + x = x / magnitude + y = y / magnitude + else + x = 0 + y = 0 + end + + return setmetatable({x = x, y = y}, Vector2) +end + +function Vector2:SetNormalize() + local magnitude = sqrt(self.x * self.x + self.y * self.y) + + if magnitude > 1e-05 then + self.x = self.x / magnitude + self.y = self.y / magnitude + else + self.x = 0 + self.y = 0 + end + + return self +end + + +function Vector2.Dot(lhs, rhs) + return lhs.x * rhs.x + lhs.y * rhs.y +end + +function Vector2.Angle(from, to) + local x1,y1 = from.x, from.y + local d = sqrt(x1 * x1 + y1 * y1) + + if d > 1e-5 then + x1 = x1/d + y1 = y1/d + else + x1,y1 = 0,0 + end + + local x2,y2 = to.x, to.y + d = sqrt(x2 * x2 + y2 * y2) + + if d > 1e-5 then + x2 = x2/d + y2 = y2/d + else + x2,y2 = 0,0 + end + + d = x1 * x2 + y1 * y2 + + if d < -1 then + d = -1 + elseif d > 1 then + d = 1 + end + + return acos(d) * 57.29578 +end + +function Vector2.Magnitude(v) + return sqrt(v.x * v.x + v.y * v.y) +end + +function Vector2.Reflect(dir, normal) + local dx = dir.x + local dy = dir.y + local nx = normal.x + local ny = normal.y + local s = -2 * (dx * nx + dy * ny) + + return setmetatable({x = s * nx + dx, y = s * ny + dy}, Vector2) +end + +function Vector2.Distance(a, b) + return sqrt((a.x - b.x) ^ 2 + (a.y - b.y) ^ 2) +end + +function Vector2.Lerp(a, b, t) + if t < 0 then + t = 0 + elseif t > 1 then + t = 1 + end + + return setmetatable({x = a.x + (b.x - a.x) * t, y = a.y + (b.y - a.y) * t}, Vector2) +end + +function Vector2.LerpUnclamped(a, b, t) + return setmetatable({x = a.x + (b.x - a.x) * t, y = a.y + (b.y - a.y) * t}, Vector2) +end + +function Vector2.MoveTowards(current, target, maxDistanceDelta) + local cx = current.x + local cy = current.y + local x = target.x - cx + local y = target.y - cy + local s = x * x + y * y + + if s > maxDistanceDelta * maxDistanceDelta and s ~= 0 then + s = maxDistanceDelta / sqrt(s) + return setmetatable({x = cx + x * s, y = cy + y * s}, Vector2) + end + + return setmetatable({x = target.x, y = target.y}, Vector2) +end + +function Vector2.ClampMagnitude(v, maxLength) + local x = v.x + local y = v.y + local sqrMag = x * x + y * y + + if sqrMag > maxLength * maxLength then + local mag = maxLength / sqrt(sqrMag) + x = x * mag + y = y * mag + return setmetatable({x = x, y = y}, Vector2) + end + + return setmetatable({x = x, y = y}, Vector2) +end + +function Vector2.SmoothDamp(current, target, Velocity, smoothTime, maxSpeed, deltaTime) + deltaTime = deltaTime or Time.deltaTime + maxSpeed = maxSpeed or math.huge + smoothTime = math.max(0.0001, smoothTime) + + local num = 2 / smoothTime + local num2 = num * deltaTime + num2 = 1 / (1 + num2 + 0.48 * num2 * num2 + 0.235 * num2 * num2 * num2) + + local tx = target.x + local ty = target.y + local cx = current.x + local cy = current.y + local vecx = cx - tx + local vecy = cy - ty + local m = vecx * vecx + vecy * vecy + local n = maxSpeed * smoothTime + + if m > n * n then + m = n / sqrt(m) + vecx = vecx * m + vecy = vecy * m + end + + m = Velocity.x + n = Velocity.y + + local vec3x = (m + num * vecx) * deltaTime + local vec3y = (n + num * vecy) * deltaTime + Velocity.x = (m - num * vec3x) * num2 + Velocity.y = (n - num * vec3y) * num2 + m = cx - vecx + (vecx + vec3x) * num2 + n = cy - vecy + (vecy + vec3y) * num2 + + if (tx - cx) * (m - tx) + (ty - cy) * (n - ty) > 0 then + m = tx + n = ty + Velocity.x = 0 + Velocity.y = 0 + end + + return setmetatable({x = m, y = n}, Vector2), Velocity +end + +function Vector2.Max(a, b) + return setmetatable({x = math.max(a.x, b.x), y = math.max(a.y, b.y)}, Vector2) +end + +function Vector2.Min(a, b) + return setmetatable({x = math.min(a.x, b.x), y = math.min(a.y, b.y)}, Vector2) +end + +function Vector2.Scale(a, b) + return setmetatable({x = a.x * b.x, y = a.y * b.y}, Vector2) +end + +function Vector2:Div(d) + self.x = self.x / d + self.y = self.y / d + + return self +end + +function Vector2:Mul(d) + self.x = self.x * d + self.y = self.y * d + + return self +end + +function Vector2:Add(b) + self.x = self.x + b.x + self.y = self.y + b.y + + return self +end + +function Vector2:Sub(b) + self.x = self.x - b.x + self.y = self.y - b.y + + return +end + +Vector2.__tostring = function(self) + return string.format("(%f,%f)", self.x, self.y) +end + +Vector2.__div = function(va, d) + return setmetatable({x = va.x / d, y = va.y / d}, Vector2) +end + +Vector2.__mul = function(a, d) + if type(d) == "number" then + return setmetatable({x = a.x * d, y = a.y * d}, Vector2) + else + return setmetatable({x = a * d.x, y = a * d.y}, Vector2) + end +end + +Vector2.__add = function(a, b) + return setmetatable({x = a.x + b.x, y = a.y + b.y}, Vector2) +end + +Vector2.__sub = function(a, b) + return setmetatable({x = a.x - b.x, y = a.y - b.y}, Vector2) +end + +Vector2.__unm = function(v) + return setmetatable({x = -v.x, y = -v.y}, Vector2) +end + +Vector2.__eq = function(a,b) + return ((a.x - b.x) ^ 2 + (a.y - b.y) ^ 2) < 9.999999e-11 +end + +get.up = function() return setmetatable({x = 0, y = 1}, Vector2) end +get.right = function() return setmetatable({x = 1, y = 0}, Vector2) end +get.zero = function() return setmetatable({x = 0, y = 0}, Vector2) end +get.one = function() return setmetatable({x = 1, y = 1}, Vector2) end + +get.magnitude = Vector2.Magnitude +get.normalized = Vector2.Normalize +get.sqrMagnitude = Vector2.SqrMagnitude + +UnityEngine.Vector2 = Vector2 +setmetatable(Vector2, Vector2) +return Vector2 \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Lua/UnityEngine/Vector2.lua.meta b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Vector2.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..1716292f9448ebea121ae38081690c01b9e0b2f3 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Vector2.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: ebac0a3bf4e463249a78081c5cc3abcf +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/UnityEngine/Vector3.lua b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Vector3.lua new file mode 100644 index 0000000000000000000000000000000000000000..ba124a4bea0538f507365adfbe7cc5be0df14be7 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Vector3.lua @@ -0,0 +1,471 @@ +-------------------------------------------------------------------------------- +-- Copyright (c) 2015 , 钂欏崰蹇(topameng) topameng@gmail.com +-- All rights reserved. +-- Use, modification and distribution are subject to the "MIT License" +-------------------------------------------------------------------------------- +local math = math +local acos = math.acos +local sqrt = math.sqrt +local max = math.max +local min = math.min +local clamp = Mathf.Clamp +local cos = math.cos +local sin = math.sin +local abs = math.abs +local sign = Mathf.Sign +local setmetatable = setmetatable +local rawset = rawset +local rawget = rawget +local type = type + +local rad2Deg = 57.295779513082 +local deg2Rad = 0.017453292519943 + +local Vector3 = {} +local get = tolua.initget(Vector3) + +Vector3.__index = function(t,k) + local var = rawget(Vector3, k) + + if var == nil then + var = rawget(get, k) + + if var ~= nil then + return var(t) + end + end + + return var +end + +function Vector3.New(x, y, z) + local t = {x = x or 0, y = y or 0, z = z or 0} + setmetatable(t, Vector3) + return t +end + +local _new = Vector3.New + +Vector3.__call = function(t,x,y,z) + local t = {x = x or 0, y = y or 0, z = z or 0} + setmetatable(t, Vector3) + return t +end + +function Vector3:Set(x,y,z) + self.x = x or 0 + self.y = y or 0 + self.z = z or 0 +end + +function Vector3.Get(v) + return v.x, v.y, v.z +end + +function Vector3:Clone() + return setmetatable({x = self.x, y = self.y, z = self.z}, Vector3) +end + +function Vector3.Distance(va, vb) + return sqrt((va.x - vb.x)^2 + (va.y - vb.y)^2 + (va.z - vb.z)^2) +end + +function Vector3.Dot(lhs, rhs) + return lhs.x * rhs.x + lhs.y * rhs.y + lhs.z * rhs.z +end + +function Vector3.Lerp(from, to, t) + t = clamp(t, 0, 1) + return _new(from.x + (to.x - from.x) * t, from.y + (to.y - from.y) * t, from.z + (to.z - from.z) * t) +end + +function Vector3:Magnitude() + return sqrt(self.x * self.x + self.y * self.y + self.z * self.z) +end + +function Vector3.Max(lhs, rhs) + return _new(max(lhs.x, rhs.x), max(lhs.y, rhs.y), max(lhs.z, rhs.z)) +end + +function Vector3.Min(lhs, rhs) + return _new(min(lhs.x, rhs.x), min(lhs.y, rhs.y), min(lhs.z, rhs.z)) +end + +function Vector3.Normalize(v) + local x,y,z = v.x, v.y, v.z + local num = sqrt(x * x + y * y + z * z) + + if num > 1e-5 then + return setmetatable({x = x / num, y = y / num, z = z / num}, Vector3) + end + + return setmetatable({x = 0, y = 0, z = 0}, Vector3) +end + +function Vector3:SetNormalize() + local num = sqrt(self.x * self.x + self.y * self.y + self.z * self.z) + + if num > 1e-5 then + self.x = self.x / num + self.y = self.y / num + self.z = self.z /num + else + self.x = 0 + self.y = 0 + self.z = 0 + end + + return self +end + +function Vector3:SqrMagnitude() + return self.x * self.x + self.y * self.y + self.z * self.z +end + +local dot = Vector3.Dot + +function Vector3.Angle(from, to) + return acos(clamp(dot(from:Normalize(), to:Normalize()), -1, 1)) * rad2Deg +end + +function Vector3:ClampMagnitude(maxLength) + if self:SqrMagnitude() > (maxLength * maxLength) then + self:SetNormalize() + self:Mul(maxLength) + end + + return self +end + + +function Vector3.OrthoNormalize(va, vb, vc) + va:SetNormalize() + vb:Sub(vb:Project(va)) + vb:SetNormalize() + + if vc == nil then + return va, vb + end + + vc:Sub(vc:Project(va)) + vc:Sub(vc:Project(vb)) + vc:SetNormalize() + return va, vb, vc +end + +function Vector3.MoveTowards(current, target, maxDistanceDelta) + local delta = target - current + local sqrDelta = delta:SqrMagnitude() + local sqrDistance = maxDistanceDelta * maxDistanceDelta + + if sqrDelta > sqrDistance then + local magnitude = sqrt(sqrDelta) + + if magnitude > 1e-6 then + delta:Mul(maxDistanceDelta / magnitude) + delta:Add(current) + return delta + else + return current:Clone() + end + end + + return target:Clone() +end + +function ClampedMove(lhs, rhs, clampedDelta) + local delta = rhs - lhs + + if delta > 0 then + return lhs + min(delta, clampedDelta) + else + return lhs - min(-delta, clampedDelta) + end +end + +local overSqrt2 = 0.7071067811865475244008443621048490 + +local function OrthoNormalVector(vec) + local res = _new() + + if abs(vec.z) > overSqrt2 then + local a = vec.y * vec.y + vec.z * vec.z + local k = 1 / sqrt (a) + res.x = 0 + res.y = -vec.z * k + res.z = vec.y * k + else + local a = vec.x * vec.x + vec.y * vec.y + local k = 1 / sqrt (a) + res.x = -vec.y * k + res.y = vec.x * k + res.z = 0 + end + + return res +end + +function Vector3.RotateTowards(current, target, maxRadiansDelta, maxMagnitudeDelta) + local len1 = current:Magnitude() + local len2 = target:Magnitude() + + if len1 > 1e-6 and len2 > 1e-6 then + local from = current / len1 + local to = target / len2 + local cosom = dot(from, to) + + if cosom > 1 - 1e-6 then + return Vector3.MoveTowards (current, target, maxMagnitudeDelta) + elseif cosom < -1 + 1e-6 then + local axis = OrthoNormalVector(from) + local q = Quaternion.AngleAxis(maxRadiansDelta * rad2Deg, axis) + local rotated = q:MulVec3(from) + local delta = ClampedMove(len1, len2, maxMagnitudeDelta) + rotated:Mul(delta) + return rotated + else + local angle = acos(cosom) + local axis = Vector3.Cross(from, to) + axis:SetNormalize () + local q = Quaternion.AngleAxis(min(maxRadiansDelta, angle) * rad2Deg, axis) + local rotated = q:MulVec3(from) + local delta = ClampedMove(len1, len2, maxMagnitudeDelta) + rotated:Mul(delta) + return rotated + end + end + + return Vector3.MoveTowards(current, target, maxMagnitudeDelta) +end + +function Vector3.SmoothDamp(current, target, currentVelocity, smoothTime) + local maxSpeed = Mathf.Infinity + local deltaTime = Time.deltaTime + smoothTime = max(0.0001, smoothTime) + local num = 2 / smoothTime + local num2 = num * deltaTime + local num3 = 1 / (1 + num2 + 0.48 * num2 * num2 + 0.235 * num2 * num2 * num2) + local vector2 = target:Clone() + local maxLength = maxSpeed * smoothTime + local vector = current - target + vector:ClampMagnitude(maxLength) + target = current - vector + local vec3 = (currentVelocity + (vector * num)) * deltaTime + currentVelocity = (currentVelocity - (vec3 * num)) * num3 + local vector4 = target + (vector + vec3) * num3 + + if Vector3.Dot(vector2 - current, vector4 - vector2) > 0 then + vector4 = vector2 + currentVelocity:Set(0,0,0) + end + + return vector4, currentVelocity +end + +function Vector3.Scale(a, b) + local x = a.x * b.x + local y = a.y * b.y + local z = a.z * b.z + return _new(x, y, z) +end + +function Vector3.Cross(lhs, rhs) + local x = lhs.y * rhs.z - lhs.z * rhs.y + local y = lhs.z * rhs.x - lhs.x * rhs.z + local z = lhs.x * rhs.y - lhs.y * rhs.x + return _new(x,y,z) +end + +function Vector3:Equals(other) + return self.x == other.x and self.y == other.y and self.z == other.z +end + +function Vector3.Reflect(inDirection, inNormal) + local num = -2 * dot(inNormal, inDirection) + inNormal = inNormal * num + inNormal:Add(inDirection) + return inNormal +end + + +function Vector3.Project(vector, onNormal) + local num = onNormal:SqrMagnitude() + + if num < 1.175494e-38 then + return _new(0,0,0) + end + + local num2 = dot(vector, onNormal) + local v3 = onNormal:Clone() + v3:Mul(num2/num) + return v3 +end + +function Vector3.ProjectOnPlane(vector, planeNormal) + local v3 = Vector3.Project(vector, planeNormal) + v3:Mul(-1) + v3:Add(vector) + return v3 +end + +function Vector3.Slerp(from, to, t) + local omega, sinom, scale0, scale1 + + if t <= 0 then + return from:Clone() + elseif t >= 1 then + return to:Clone() + end + + local v2 = to:Clone() + local v1 = from:Clone() + local len2 = to:Magnitude() + local len1 = from:Magnitude() + v2:Div(len2) + v1:Div(len1) + + local len = (len2 - len1) * t + len1 + local cosom = v1.x * v2.x + v1.y * v2.y + v1.z * v2.z + + if cosom > 1 - 1e-6 then + scale0 = 1 - t + scale1 = t + elseif cosom < -1 + 1e-6 then + local axis = OrthoNormalVector(from) + local q = Quaternion.AngleAxis(180.0 * t, axis) + local v = q:MulVec3(from) + v:Mul(len) + return v + else + omega = acos(cosom) + sinom = sin(omega) + scale0 = sin((1 - t) * omega) / sinom + scale1 = sin(t * omega) / sinom + end + + v1:Mul(scale0) + v2:Mul(scale1) + v2:Add(v1) + v2:Mul(len) + return v2 +end + + +function Vector3:Mul(q) + if type(q) == "number" then + self.x = self.x * q + self.y = self.y * q + self.z = self.z * q + else + self:MulQuat(q) + end + + return self +end + +function Vector3:Div(d) + self.x = self.x / d + self.y = self.y / d + self.z = self.z / d + + return self +end + +function Vector3:Add(vb) + self.x = self.x + vb.x + self.y = self.y + vb.y + self.z = self.z + vb.z + + return self +end + +function Vector3:Sub(vb) + self.x = self.x - vb.x + self.y = self.y - vb.y + self.z = self.z - vb.z + + return self +end + +function Vector3:MulQuat(quat) + local num = quat.x * 2 + local num2 = quat.y * 2 + local num3 = quat.z * 2 + local num4 = quat.x * num + local num5 = quat.y * num2 + local num6 = quat.z * num3 + local num7 = quat.x * num2 + local num8 = quat.x * num3 + local num9 = quat.y * num3 + local num10 = quat.w * num + local num11 = quat.w * num2 + local num12 = quat.w * num3 + + local x = (((1 - (num5 + num6)) * self.x) + ((num7 - num12) * self.y)) + ((num8 + num11) * self.z) + local y = (((num7 + num12) * self.x) + ((1 - (num4 + num6)) * self.y)) + ((num9 - num10) * self.z) + local z = (((num8 - num11) * self.x) + ((num9 + num10) * self.y)) + ((1 - (num4 + num5)) * self.z) + + self:Set(x, y, z) + return self +end + +function Vector3.AngleAroundAxis (from, to, axis) + from = from - Vector3.Project(from, axis) + to = to - Vector3.Project(to, axis) + local angle = Vector3.Angle (from, to) + return angle * (Vector3.Dot (axis, Vector3.Cross (from, to)) < 0 and -1 or 1) +end + + +Vector3.__tostring = function(self) + return "["..self.x..","..self.y..","..self.z.."]" +end + +Vector3.__div = function(va, d) + return _new(va.x / d, va.y / d, va.z / d) +end + +Vector3.__mul = function(va, d) + if type(d) == "number" then + return _new(va.x * d, va.y * d, va.z * d) + else + local vec = va:Clone() + vec:MulQuat(d) + return vec + end +end + +Vector3.__add = function(va, vb) + return _new(va.x + vb.x, va.y + vb.y, va.z + vb.z) +end + +Vector3.__sub = function(va, vb) + return _new(va.x - vb.x, va.y - vb.y, va.z - vb.z) +end + +Vector3.__unm = function(va) + return _new(-va.x, -va.y, -va.z) +end + +Vector3.__eq = function(a,b) + local v = a - b + local delta = v:SqrMagnitude() + return delta < 1e-10 +end + +get.up = function() return _new(0,1,0) end +get.down = function() return _new(0,-1,0) end +get.right = function() return _new(1,0,0) end +get.left = function() return _new(-1,0,0) end +get.forward = function() return _new(0,0,1) end +get.back = function() return _new(0,0,-1) end +get.zero = function() return _new(0,0,0) end +get.one = function() return _new(1,1,1) end + +get.magnitude = Vector3.Magnitude +get.normalized = Vector3.Normalize +get.sqrMagnitude= Vector3.SqrMagnitude + +UnityEngine.Vector3 = Vector3 +setmetatable(Vector3, Vector3) +return Vector3 diff --git a/Assets/LuaFramework/ToLua/Lua/UnityEngine/Vector3.lua.meta b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Vector3.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..9ced5184f9f58434fba54e1d7ccc1251e381aa63 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Vector3.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 3697c841f98720444b380cc2756c17ea +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/UnityEngine/Vector4.lua b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Vector4.lua new file mode 100644 index 0000000000000000000000000000000000000000..95f8aef30d4e677279cc2ca9578ef0ffdff7e591 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Vector4.lua @@ -0,0 +1,204 @@ +-------------------------------------------------------------------------------- +-- Copyright (c) 2015 , 钂欏崰蹇(topameng) topameng@gmail.com +-- All rights reserved. +-- Use, modification and distribution are subject to the "MIT License" +-------------------------------------------------------------------------------- + +local clamp = Mathf.Clamp +local sqrt = Mathf.Sqrt +local min = Mathf.Min +local max = Mathf.Max +local setmetatable = setmetatable +local rawget = rawget + +local Vector4 = {} +local get = tolua.initget(Vector4) + +Vector4.__index = function(t,k) + local var = rawget(Vector4, k) + + if var == nil then + var = rawget(get, k) + + if var ~= nil then + return var(t) + end + end + + return var +end + +Vector4.__call = function(t, x, y, z, w) + return setmetatable({x = x or 0, y = y or 0, z = z or 0, w = w or 0}, Vector4) +end + +function Vector4.New(x, y, z, w) + return setmetatable({x = x or 0, y = y or 0, z = z or 0, w = w or 0}, Vector4) +end + +function Vector4:Set(x,y,z,w) + self.x = x or 0 + self.y = y or 0 + self.z = z or 0 + self.w = w or 0 +end + +function Vector4:Get() + return self.x, self.y, self.z, self.w +end + +function Vector4.Lerp(from, to, t) + t = clamp(t, 0, 1) + return Vector4.New(from.x + ((to.x - from.x) * t), from.y + ((to.y - from.y) * t), from.z + ((to.z - from.z) * t), from.w + ((to.w - from.w) * t)) +end + +function Vector4.MoveTowards(current, target, maxDistanceDelta) + local vector = target - current + local magnitude = vector:Magnitude() + + if magnitude > maxDistanceDelta and magnitude ~= 0 then + maxDistanceDelta = maxDistanceDelta / magnitude + vector:Mul(maxDistanceDelta) + vector:Add(current) + return vector + end + + return target +end + +function Vector4.Scale(a, b) + return Vector4.New(a.x * b.x, a.y * b.y, a.z * b.z, a.w * b.w) +end + +function Vector4:SetScale(scale) + self.x = self.x * scale.x + self.y = self.y * scale.y + self.z = self.z * scale.z + self.w = self.w * scale.w +end + +function Vector4:Normalize() + local v = vector4.New(self.x, self.y, self.z, self.w) + return v:SetNormalize() +end + +function Vector4:SetNormalize() + local num = self:Magnitude() + + if num == 1 then + return self + elseif num > 1e-05 then + self:Div(num) + else + self:Set(0,0,0,0) + end + + return self +end + +function Vector4:Div(d) + self.x = self.x / d + self.y = self.y / d + self.z = self.z / d + self.w = self.w / d + + return self +end + +function Vector4:Mul(d) + self.x = self.x * d + self.y = self.y * d + self.z = self.z * d + self.w = self.w * d + + return self +end + +function Vector4:Add(b) + self.x = self.x + b.x + self.y = self.y + b.y + self.z = self.z + b.z + self.w = self.w + b.w + + return self +end + +function Vector4:Sub(b) + self.x = self.x - b.x + self.y = self.y - b.y + self.z = self.z - b.z + self.w = self.w - b.w + + return self +end + +function Vector4.Dot(a, b) + return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w +end + +function Vector4.Project(a, b) + local s = Vector4.Dot(a, b) / Vector4.Dot(b, b) + return b * s +end + +function Vector4.Distance(a, b) + local v = a - b + return Vector4.Magnitude(v) +end + +function Vector4.Magnitude(a) + return sqrt(a.x * a.x + a.y * a.y + a.z * a.z + a.w * a.w) +end + +function Vector4.SqrMagnitude(a) + return a.x * a.x + a.y * a.y + a.z * a.z + a.w * a.w +end + +function Vector4.Min(lhs, rhs) + return Vector4.New(max(lhs.x, rhs.x), max(lhs.y, rhs.y), max(lhs.z, rhs.z), max(lhs.w, rhs.w)) +end + +function Vector4.Max(lhs, rhs) + return Vector4.New(min(lhs.x, rhs.x), min(lhs.y, rhs.y), min(lhs.z, rhs.z), min(lhs.w, rhs.w)) +end + +Vector4.__tostring = function(self) + return string.format("[%f,%f,%f,%f]", self.x, self.y, self.z, self.w) +end + +Vector4.__div = function(va, d) + return Vector4.New(va.x / d, va.y / d, va.z / d, va.w / d) +end + +Vector4.__mul = function(va, d) + return Vector4.New(va.x * d, va.y * d, va.z * d, va.w * d) +end + +Vector4.__add = function(va, vb) + return Vector4.New(va.x + vb.x, va.y + vb.y, va.z + vb.z, va.w + vb.w) +end + +Vector4.__sub = function(va, vb) + return Vector4.New(va.x - vb.x, va.y - vb.y, va.z - vb.z, va.w - vb.w) +end + +Vector4.__unm = function(va) + return Vector4.New(-va.x, -va.y, -va.z, -va.w) +end + +Vector4.__eq = function(va,vb) + local v = va - vb + local delta = Vector4.SqrMagnitude(v) + return delta < 1e-10 +end + +get.zero = function() return Vector4.New(0, 0, 0, 0) end +get.one = function() return Vector4.New(1, 1, 1, 1) end + +get.magnitude = Vector4.Magnitude +get.normalized = Vector4.Normalize +get.sqrMagnitude = Vector4.SqrMagnitude + +UnityEngine.Vector4 = Vector4 +setmetatable(Vector4, Vector4) +return Vector4 \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Lua/UnityEngine/Vector4.lua.meta b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Vector4.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..05bd3d77258ddb333926cdfdc3c441345adb8acb --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/UnityEngine/Vector4.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 7e294d4af7e55084dadac8ee7a76099d +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/cjson.meta b/Assets/LuaFramework/ToLua/Lua/cjson.meta new file mode 100644 index 0000000000000000000000000000000000000000..81b81d9bb0e21087a712a9bf6461798ed669049a --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/cjson.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 51fabff50886aea4ca5100ee3396939b +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/cjson/util.lua b/Assets/LuaFramework/ToLua/Lua/cjson/util.lua new file mode 100644 index 0000000000000000000000000000000000000000..6916dad04bf57748661029a09ee65a66c87294aa --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/cjson/util.lua @@ -0,0 +1,271 @@ +local json = require "cjson" + +-- Various common routines used by the Lua CJSON package +-- +-- Mark Pulford + +-- Determine with a Lua table can be treated as an array. +-- Explicitly returns "not an array" for very sparse arrays. +-- Returns: +-- -1 Not an array +-- 0 Empty table +-- >0 Highest index in the array +local function is_array(table) + local max = 0 + local count = 0 + for k, v in pairs(table) do + if type(k) == "number" then + if k > max then max = k end + count = count + 1 + else + return -1 + end + end + if max > count * 2 then + return -1 + end + + return max +end + +local serialise_value + +local function serialise_table(value, indent, depth) + local spacing, spacing2, indent2 + if indent then + spacing = "\n" .. indent + spacing2 = spacing .. " " + indent2 = indent .. " " + else + spacing, spacing2, indent2 = " ", " ", false + end + depth = depth + 1 + if depth > 50 then + return "Cannot serialise any further: too many nested tables" + end + + local max = is_array(value) + + local comma = false + local fragment = { "{" .. spacing2 } + if max > 0 then + -- Serialise array + for i = 1, max do + if comma then + table.insert(fragment, "," .. spacing2) + end + table.insert(fragment, serialise_value(value[i], indent2, depth)) + comma = true + end + elseif max < 0 then + -- Serialise table + for k, v in pairs(value) do + if comma then + table.insert(fragment, "," .. spacing2) + end + table.insert(fragment, + ("[%s] = %s"):format(serialise_value(k, indent2, depth), + serialise_value(v, indent2, depth))) + comma = true + end + end + table.insert(fragment, spacing .. "}") + + return table.concat(fragment) +end + +function serialise_value(value, indent, depth) + if indent == nil then indent = "" end + if depth == nil then depth = 0 end + + if value == json.null then + return "json.null" + elseif type(value) == "string" then + return ("%q"):format(value) + elseif type(value) == "nil" or type(value) == "number" or + type(value) == "boolean" then + return tostring(value) + elseif type(value) == "table" then + return serialise_table(value, indent, depth) + else + return "\"<" .. type(value) .. ">\"" + end +end + +local function file_load(filename) + local file + if filename == nil then + file = io.stdin + else + local err + file, err = io.open(filename, "rb") + if file == nil then + error(("Unable to read '%s': %s"):format(filename, err)) + end + end + local data = file:read("*a") + + if filename ~= nil then + file:close() + end + + if data == nil then + error("Failed to read " .. filename) + end + + return data +end + +local function file_save(filename, data) + local file + if filename == nil then + file = io.stdout + else + local err + file, err = io.open(filename, "wb") + if file == nil then + error(("Unable to write '%s': %s"):format(filename, err)) + end + end + file:write(data) + if filename ~= nil then + file:close() + end +end + +local function compare_values(val1, val2) + local type1 = type(val1) + local type2 = type(val2) + if type1 ~= type2 then + return false + end + + -- Check for NaN + if type1 == "number" and val1 ~= val1 and val2 ~= val2 then + return true + end + + if type1 ~= "table" then + return val1 == val2 + end + + -- check_keys stores all the keys that must be checked in val2 + local check_keys = {} + for k, _ in pairs(val1) do + check_keys[k] = true + end + + for k, v in pairs(val2) do + if not check_keys[k] then + return false + end + + if not compare_values(val1[k], val2[k]) then + return false + end + + check_keys[k] = nil + end + for k, _ in pairs(check_keys) do + -- Not the same if any keys from val1 were not found in val2 + return false + end + return true +end + +local test_count_pass = 0 +local test_count_total = 0 + +local function run_test_summary() + return test_count_pass, test_count_total +end + +local function run_test(testname, func, input, should_work, output) + local function status_line(name, status, value) + local statusmap = { [true] = ":success", [false] = ":error" } + if status ~= nil then + name = name .. statusmap[status] + end + print(("[%s] %s"):format(name, serialise_value(value, false))) + end + + local result = { pcall(func, unpack(input)) } + local success = table.remove(result, 1) + + local correct = false + if success == should_work and compare_values(result, output) then + correct = true + test_count_pass = test_count_pass + 1 + end + test_count_total = test_count_total + 1 + + local teststatus = { [true] = "PASS", [false] = "FAIL" } + print(("==> Test [%d] %s: %s"):format(test_count_total, testname, + teststatus[correct])) + + status_line("Input", nil, input) + if not correct then + status_line("Expected", should_work, output) + end + status_line("Received", success, result) + print() + + return correct, result +end + +local function run_test_group(tests) + local function run_helper(name, func, input) + if type(name) == "string" and #name > 0 then + print("==> " .. name) + end + -- Not a protected call, these functions should never generate errors. + func(unpack(input or {})) + print() + end + + for _, v in ipairs(tests) do + -- Run the helper if "should_work" is missing + if v[4] == nil then + run_helper(unpack(v)) + else + run_test(unpack(v)) + end + end +end + +-- Run a Lua script in a separate environment +local function run_script(script, env) + local env = env or {} + local func + + -- Use setfenv() if it exists, otherwise assume Lua 5.2 load() exists + if _G.setfenv then + func = loadstring(script) + if func then + setfenv(func, env) + end + else + func = load(script, nil, nil, env) + end + + if func == nil then + error("Invalid syntax.") + end + func() + + return env +end + +-- Export functions +return { + serialise_value = serialise_value, + file_load = file_load, + file_save = file_save, + compare_values = compare_values, + run_test_summary = run_test_summary, + run_test = run_test, + run_test_group = run_test_group, + run_script = run_script +} + +-- vi:ai et sw=4 ts=4: diff --git a/Assets/LuaFramework/ToLua/Lua/cjson/util.lua.meta b/Assets/LuaFramework/ToLua/Lua/cjson/util.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..840beca69811655e795681595f2c52a1d3d54b22 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/cjson/util.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: d6b21c50e0c10c840bb4965a6b03fdc1 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/event.lua b/Assets/LuaFramework/ToLua/Lua/event.lua new file mode 100644 index 0000000000000000000000000000000000000000..b054fb6dafdcd94693166901a64702c50f366a63 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/event.lua @@ -0,0 +1,221 @@ +-------------------------------------------------------------------------------- +-- Copyright (c) 2015 - 2016 , 钂欏崰蹇(topameng) topameng@gmail.com +-- All rights reserved. +-- Use, modification and distribution are subject to the "MIT License" +-------------------------------------------------------------------------------- + +local setmetatable = setmetatable +local xpcall = xpcall +local pcall = pcall +local assert = assert +local rawget = rawget +local error = error +local print = print +local traceback = tolua.traceback +local ilist = ilist + +local _xpcall = {} + +_xpcall.__call = function(self, ...) + if jit then + if nil == self.obj then + return xpcall(self.func, traceback, ...) + else + return xpcall(self.func, traceback, self.obj, ...) + end + else + local args = {...} + + if nil == self.obj then + local func = function() self.func(unpack(args)) end + return xpcall(func, traceback) + else + local func = function() self.func(self.obj, unpack(args)) end + return xpcall(func, traceback) + end + end +end + +_xpcall.__eq = function(lhs, rhs) + return lhs.func == rhs.func and lhs.obj == rhs.obj +end + +local function xfunctor(func, obj) + return setmetatable({func = func, obj = obj}, _xpcall) +end + +local _pcall = {} + +_pcall.__call = function(self, ...) + if nil == self.obj then + return pcall(self.func, ...) + else + return pcall(self.func, self.obj, ...) + end +end + +_pcall.__eq = function(lhs, rhs) + return lhs.func == rhs.func and lhs.obj == rhs.obj +end + +local function functor(func, obj) + return setmetatable({func = func, obj = obj}, _pcall) +end + +local _event = {} +_event.__index = _event + +--搴熷純 +function _event:Add(func, obj) + assert(func) + + if self.keepSafe then + func = xfunctor(func, obj) + else + func = functor(func, obj) + end + + if self.lock then + local node = {value = func, _prev = 0, _next = 0, removed = true} + table.insert(self.opList, function() self.list:pushnode(node) end) + return node + else + return self.list:push(func) + end +end + +--搴熷純 +function _event:Remove(func, obj) + for i, v in ilist(self.list) do + if v.func == func and v.obj == obj then + if self.lock then + table.insert(self.opList, function() self.list:remove(i) end) + else + self.list:remove(i) + end + break + end + end +end + +function _event:CreateListener(func, obj) + if self.keepSafe then + func = xfunctor(func, obj) + else + func = functor(func, obj) + end + + return {value = func, _prev = 0, _next = 0, removed = true} +end + +function _event:AddListener(handle) + assert(handle) + + if self.lock then + table.insert(self.opList, function() self.list:pushnode(handle) end) + else + self.list:pushnode(handle) + end +end + +function _event:RemoveListener(handle) + assert(handle) + + if self.lock then + table.insert(self.opList, function() self.list:remove(handle) end) + else + self.list:remove(handle) + end +end + +function _event:Count() + return self.list.length +end + +function _event:Clear() + self.list:clear() + self.opList = {} + self.lock = false + self.keepSafe = false + self.current = nil +end + +function _event:Dump() + local count = 0 + + for _, v in ilist(self.list) do + if v.obj then + print("update function:", v.func, "object name:", v.obj.name) + else + print("update function: ", v.func) + end + + count = count + 1 + end + + print("all function is:", count) +end + +_event.__call = function(self, ...) + local _list = self.list + self.lock = true + local ilist = ilist + + for i, f in ilist(_list) do + self.current = i + local flag, msg = f(...) + + if not flag then + _list:remove(i) + self.lock = false + error(msg) + end + end + + local opList = self.opList + self.lock = false + + for i, op in ipairs(opList) do + op() + opList[i] = nil + end +end + +function event(name, safe) + safe = safe or false + return setmetatable({name = name, keepSafe = safe, lock = false, opList = {}, list = list:new()}, _event) +end + +UpdateBeat = event("Update", true) +LateUpdateBeat = event("LateUpdate", true) +FixedUpdateBeat = event("FixedUpdate", true) +CoUpdateBeat = event("CoUpdate") --鍙湪鍗忓悓浣跨敤 + +local Time = Time +local UpdateBeat = UpdateBeat +local LateUpdateBeat = LateUpdateBeat +local FixedUpdateBeat = FixedUpdateBeat +local CoUpdateBeat = CoUpdateBeat + +--閫昏緫update +function Update(deltaTime, unscaledDeltaTime) + Time:SetDeltaTime(deltaTime, unscaledDeltaTime) + UpdateBeat() +end + +function LateUpdate() + LateUpdateBeat() + CoUpdateBeat() + Time:SetFrameCount() +end + +--鐗╃悊update +function FixedUpdate(fixedDeltaTime) + Time:SetFixedDelta(fixedDeltaTime) + FixedUpdateBeat() +end + +function PrintEvents() + UpdateBeat:Dump() + FixedUpdateBeat:Dump() +end \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Lua/event.lua.meta b/Assets/LuaFramework/ToLua/Lua/event.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..9ae60bc661cf2bb9f351190deb97849b77b5e8bd --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/event.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 3cb3ad8be0f474f4c997acf1b791b133 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/jit.meta b/Assets/LuaFramework/ToLua/Lua/jit.meta new file mode 100644 index 0000000000000000000000000000000000000000..f45c18c3f0105b116361d10ae9f025172c6e2cae --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 7b8761c25aba4304482c7fd87688285a +folderAsset: yes +timeCreated: 1492692752 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Lua/jit/bc.lua b/Assets/LuaFramework/ToLua/Lua/jit/bc.lua new file mode 100644 index 0000000000000000000000000000000000000000..193cf01f939df93a211dd4f5e7496c3f49c899af --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/bc.lua @@ -0,0 +1,190 @@ +---------------------------------------------------------------------------- +-- LuaJIT bytecode listing module. +-- +-- Copyright (C) 2005-2017 Mike Pall. All rights reserved. +-- Released under the MIT license. See Copyright Notice in luajit.h +---------------------------------------------------------------------------- +-- +-- This module lists the bytecode of a Lua function. If it's loaded by -jbc +-- it hooks into the parser and lists all functions of a chunk as they +-- are parsed. +-- +-- Example usage: +-- +-- luajit -jbc -e 'local x=0; for i=1,1e6 do x=x+i end; print(x)' +-- luajit -jbc=- foo.lua +-- luajit -jbc=foo.list foo.lua +-- +-- Default output is to stderr. To redirect the output to a file, pass a +-- filename as an argument (use '-' for stdout) or set the environment +-- variable LUAJIT_LISTFILE. The file is overwritten every time the module +-- is started. +-- +-- This module can also be used programmatically: +-- +-- local bc = require("jit.bc") +-- +-- local function foo() print("hello") end +-- +-- bc.dump(foo) --> -- BYTECODE -- [...] +-- print(bc.line(foo, 2)) --> 0002 KSTR 1 1 ; "hello" +-- +-- local out = { +-- -- Do something with each line: +-- write = function(t, ...) io.write(...) end, +-- close = function(t) end, +-- flush = function(t) end, +-- } +-- bc.dump(foo, out) +-- +------------------------------------------------------------------------------ + +-- Cache some library functions and objects. +local jit = require("jit") +assert(jit.version_num == 20100, "LuaJIT core/library version mismatch") +local jutil = require("jit.util") +local vmdef = require("jit.vmdef") +local bit = require("bit") +local sub, gsub, format = string.sub, string.gsub, string.format +local byte, band, shr = string.byte, bit.band, bit.rshift +local funcinfo, funcbc, funck = jutil.funcinfo, jutil.funcbc, jutil.funck +local funcuvname = jutil.funcuvname +local bcnames = vmdef.bcnames +local stdout, stderr = io.stdout, io.stderr + +------------------------------------------------------------------------------ + +local function ctlsub(c) + if c == "\n" then return "\\n" + elseif c == "\r" then return "\\r" + elseif c == "\t" then return "\\t" + else return format("\\%03d", byte(c)) + end +end + +-- Return one bytecode line. +local function bcline(func, pc, prefix) + local ins, m = funcbc(func, pc) + if not ins then return end + local ma, mb, mc = band(m, 7), band(m, 15*8), band(m, 15*128) + local a = band(shr(ins, 8), 0xff) + local oidx = 6*band(ins, 0xff) + local op = sub(bcnames, oidx+1, oidx+6) + local s = format("%04d %s %-6s %3s ", + pc, prefix or " ", op, ma == 0 and "" or a) + local d = shr(ins, 16) + if mc == 13*128 then -- BCMjump + return format("%s=> %04d\n", s, pc+d-0x7fff) + end + if mb ~= 0 then + d = band(d, 0xff) + elseif mc == 0 then + return s.."\n" + end + local kc + if mc == 10*128 then -- BCMstr + kc = funck(func, -d-1) + kc = format(#kc > 40 and '"%.40s"~' or '"%s"', gsub(kc, "%c", ctlsub)) + elseif mc == 9*128 then -- BCMnum + kc = funck(func, d) + if op == "TSETM " then kc = kc - 2^52 end + elseif mc == 12*128 then -- BCMfunc + local fi = funcinfo(funck(func, -d-1)) + if fi.ffid then + kc = vmdef.ffnames[fi.ffid] + else + kc = fi.loc + end + elseif mc == 5*128 then -- BCMuv + kc = funcuvname(func, d) + end + if ma == 5 then -- BCMuv + local ka = funcuvname(func, a) + if kc then kc = ka.." ; "..kc else kc = ka end + end + if mb ~= 0 then + local b = shr(ins, 24) + if kc then return format("%s%3d %3d ; %s\n", s, b, d, kc) end + return format("%s%3d %3d\n", s, b, d) + end + if kc then return format("%s%3d ; %s\n", s, d, kc) end + if mc == 7*128 and d > 32767 then d = d - 65536 end -- BCMlits + return format("%s%3d\n", s, d) +end + +-- Collect branch targets of a function. +local function bctargets(func) + local target = {} + for pc=1,1000000000 do + local ins, m = funcbc(func, pc) + if not ins then break end + if band(m, 15*128) == 13*128 then target[pc+shr(ins, 16)-0x7fff] = true end + end + return target +end + +-- Dump bytecode instructions of a function. +local function bcdump(func, out, all) + if not out then out = stdout end + local fi = funcinfo(func) + if all and fi.children then + for n=-1,-1000000000,-1 do + local k = funck(func, n) + if not k then break end + if type(k) == "proto" then bcdump(k, out, true) end + end + end + out:write(format("-- BYTECODE -- %s-%d\n", fi.loc, fi.lastlinedefined)) + local target = bctargets(func) + for pc=1,1000000000 do + local s = bcline(func, pc, target[pc] and "=>") + if not s then break end + out:write(s) + end + out:write("\n") + out:flush() +end + +------------------------------------------------------------------------------ + +-- Active flag and output file handle. +local active, out + +-- List handler. +local function h_list(func) + return bcdump(func, out) +end + +-- Detach list handler. +local function bclistoff() + if active then + active = false + jit.attach(h_list) + if out and out ~= stdout and out ~= stderr then out:close() end + out = nil + end +end + +-- Open the output file and attach list handler. +local function bcliston(outfile) + if active then bclistoff() end + if not outfile then outfile = os.getenv("LUAJIT_LISTFILE") end + if outfile then + out = outfile == "-" and stdout or assert(io.open(outfile, "w")) + else + out = stderr + end + jit.attach(h_list, "bc") + active = true +end + +-- Public module functions. +return { + line = bcline, + dump = bcdump, + targets = bctargets, + on = bcliston, + off = bclistoff, + start = bcliston -- For -j command line option. +} + diff --git a/Assets/LuaFramework/ToLua/Lua/jit/bc.lua.meta b/Assets/LuaFramework/ToLua/Lua/jit/bc.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..46bfa32e7f2b555a98e16369b42166a3040ae577 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/bc.lua.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5f0b5eb903971c641845b50fec99cc42 +timeCreated: 1492692752 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Lua/jit/bcsave.lua b/Assets/LuaFramework/ToLua/Lua/jit/bcsave.lua new file mode 100644 index 0000000000000000000000000000000000000000..c17c88e0ff1c4dd8823f81a2d39c0d0dab076a39 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/bcsave.lua @@ -0,0 +1,661 @@ +---------------------------------------------------------------------------- +-- LuaJIT module to save/list bytecode. +-- +-- Copyright (C) 2005-2017 Mike Pall. All rights reserved. +-- Released under the MIT license. See Copyright Notice in luajit.h +---------------------------------------------------------------------------- +-- +-- This module saves or lists the bytecode for an input file. +-- It's run by the -b command line option. +-- +------------------------------------------------------------------------------ + +local jit = require("jit") +assert(jit.version_num == 20100, "LuaJIT core/library version mismatch") +local bit = require("bit") + +-- Symbol name prefix for LuaJIT bytecode. +local LJBC_PREFIX = "luaJIT_BC_" + +------------------------------------------------------------------------------ + +local function usage() + io.stderr:write[[ +Save LuaJIT bytecode: luajit -b[options] input output + -l Only list bytecode. + -s Strip debug info (default). + -g Keep debug info. + -n name Set module name (default: auto-detect from input name). + -t type Set output file type (default: auto-detect from output name). + -a arch Override architecture for object files (default: native). + -o os Override OS for object files (default: native). + -e chunk Use chunk string as input. + -- Stop handling options. + - Use stdin as input and/or stdout as output. + +File types: c h obj o raw (default) +]] + os.exit(1) +end + +local function check(ok, ...) + if ok then return ok, ... end + io.stderr:write("luajit: ", ...) + io.stderr:write("\n") + os.exit(1) +end + +local function readfile(input) + if type(input) == "function" then return input end + if input == "-" then input = nil end + return check(loadfile(input)) +end + +local function savefile(name, mode) + if name == "-" then return io.stdout end + return check(io.open(name, mode)) +end + +------------------------------------------------------------------------------ + +local map_type = { + raw = "raw", c = "c", h = "h", o = "obj", obj = "obj", +} + +local map_arch = { + x86 = true, x64 = true, arm = true, arm64 = true, arm64be = true, + ppc = true, mips = true, mipsel = true, +} + +local map_os = { + linux = true, windows = true, osx = true, freebsd = true, netbsd = true, + openbsd = true, dragonfly = true, solaris = true, +} + +local function checkarg(str, map, err) + str = string.lower(str) + local s = check(map[str], "unknown ", err) + return s == true and str or s +end + +local function detecttype(str) + local ext = string.match(string.lower(str), "%.(%a+)$") + return map_type[ext] or "raw" +end + +local function checkmodname(str) + check(string.match(str, "^[%w_.%-]+$"), "bad module name") + return string.gsub(str, "[%.%-]", "_") +end + +local function detectmodname(str) + if type(str) == "string" then + local tail = string.match(str, "[^/\\]+$") + if tail then str = tail end + local head = string.match(str, "^(.*)%.[^.]*$") + if head then str = head end + str = string.match(str, "^[%w_.%-]+") + else + str = nil + end + check(str, "cannot derive module name, use -n name") + return string.gsub(str, "[%.%-]", "_") +end + +------------------------------------------------------------------------------ + +local function bcsave_tail(fp, output, s) + local ok, err = fp:write(s) + if ok and output ~= "-" then ok, err = fp:close() end + check(ok, "cannot write ", output, ": ", err) +end + +local function bcsave_raw(output, s) + local fp = savefile(output, "wb") + bcsave_tail(fp, output, s) +end + +local function bcsave_c(ctx, output, s) + local fp = savefile(output, "w") + if ctx.type == "c" then + fp:write(string.format([[ +#ifdef _cplusplus +extern "C" +#endif +#ifdef _WIN32 +__declspec(dllexport) +#endif +const unsigned char %s%s[] = { +]], LJBC_PREFIX, ctx.modname)) + else + fp:write(string.format([[ +#define %s%s_SIZE %d +static const unsigned char %s%s[] = { +]], LJBC_PREFIX, ctx.modname, #s, LJBC_PREFIX, ctx.modname)) + end + local t, n, m = {}, 0, 0 + for i=1,#s do + local b = tostring(string.byte(s, i)) + m = m + #b + 1 + if m > 78 then + fp:write(table.concat(t, ",", 1, n), ",\n") + n, m = 0, #b + 1 + end + n = n + 1 + t[n] = b + end + bcsave_tail(fp, output, table.concat(t, ",", 1, n).."\n};\n") +end + +local function bcsave_elfobj(ctx, output, s, ffi) + ffi.cdef[[ +typedef struct { + uint8_t emagic[4], eclass, eendian, eversion, eosabi, eabiversion, epad[7]; + uint16_t type, machine; + uint32_t version; + uint32_t entry, phofs, shofs; + uint32_t flags; + uint16_t ehsize, phentsize, phnum, shentsize, shnum, shstridx; +} ELF32header; +typedef struct { + uint8_t emagic[4], eclass, eendian, eversion, eosabi, eabiversion, epad[7]; + uint16_t type, machine; + uint32_t version; + uint64_t entry, phofs, shofs; + uint32_t flags; + uint16_t ehsize, phentsize, phnum, shentsize, shnum, shstridx; +} ELF64header; +typedef struct { + uint32_t name, type, flags, addr, ofs, size, link, info, align, entsize; +} ELF32sectheader; +typedef struct { + uint32_t name, type; + uint64_t flags, addr, ofs, size; + uint32_t link, info; + uint64_t align, entsize; +} ELF64sectheader; +typedef struct { + uint32_t name, value, size; + uint8_t info, other; + uint16_t sectidx; +} ELF32symbol; +typedef struct { + uint32_t name; + uint8_t info, other; + uint16_t sectidx; + uint64_t value, size; +} ELF64symbol; +typedef struct { + ELF32header hdr; + ELF32sectheader sect[6]; + ELF32symbol sym[2]; + uint8_t space[4096]; +} ELF32obj; +typedef struct { + ELF64header hdr; + ELF64sectheader sect[6]; + ELF64symbol sym[2]; + uint8_t space[4096]; +} ELF64obj; +]] + local symname = LJBC_PREFIX..ctx.modname + local is64, isbe = false, false + if ctx.arch == "x64" or ctx.arch == "arm64" or ctx.arch == "arm64be" then + is64 = true + elseif ctx.arch == "ppc" or ctx.arch == "mips" then + isbe = true + end + + -- Handle different host/target endianess. + local function f32(x) return x end + local f16, fofs = f32, f32 + if ffi.abi("be") ~= isbe then + f32 = bit.bswap + function f16(x) return bit.rshift(bit.bswap(x), 16) end + if is64 then + local two32 = ffi.cast("int64_t", 2^32) + function fofs(x) return bit.bswap(x)*two32 end + else + fofs = f32 + end + end + + -- Create ELF object and fill in header. + local o = ffi.new(is64 and "ELF64obj" or "ELF32obj") + local hdr = o.hdr + if ctx.os == "bsd" or ctx.os == "other" then -- Determine native hdr.eosabi. + local bf = assert(io.open("/bin/ls", "rb")) + local bs = bf:read(9) + bf:close() + ffi.copy(o, bs, 9) + check(hdr.emagic[0] == 127, "no support for writing native object files") + else + hdr.emagic = "\127ELF" + hdr.eosabi = ({ freebsd=9, netbsd=2, openbsd=12, solaris=6 })[ctx.os] or 0 + end + hdr.eclass = is64 and 2 or 1 + hdr.eendian = isbe and 2 or 1 + hdr.eversion = 1 + hdr.type = f16(1) + hdr.machine = f16(({ x86=3, x64=62, arm=40, arm64=183, arm64be=183, ppc=20, mips=8, mipsel=8 })[ctx.arch]) + if ctx.arch == "mips" or ctx.arch == "mipsel" then + hdr.flags = f32(0x50001006) + end + hdr.version = f32(1) + hdr.shofs = fofs(ffi.offsetof(o, "sect")) + hdr.ehsize = f16(ffi.sizeof(hdr)) + hdr.shentsize = f16(ffi.sizeof(o.sect[0])) + hdr.shnum = f16(6) + hdr.shstridx = f16(2) + + -- Fill in sections and symbols. + local sofs, ofs = ffi.offsetof(o, "space"), 1 + for i,name in ipairs{ + ".symtab", ".shstrtab", ".strtab", ".rodata", ".note.GNU-stack", + } do + local sect = o.sect[i] + sect.align = fofs(1) + sect.name = f32(ofs) + ffi.copy(o.space+ofs, name) + ofs = ofs + #name+1 + end + o.sect[1].type = f32(2) -- .symtab + o.sect[1].link = f32(3) + o.sect[1].info = f32(1) + o.sect[1].align = fofs(8) + o.sect[1].ofs = fofs(ffi.offsetof(o, "sym")) + o.sect[1].entsize = fofs(ffi.sizeof(o.sym[0])) + o.sect[1].size = fofs(ffi.sizeof(o.sym)) + o.sym[1].name = f32(1) + o.sym[1].sectidx = f16(4) + o.sym[1].size = fofs(#s) + o.sym[1].info = 17 + o.sect[2].type = f32(3) -- .shstrtab + o.sect[2].ofs = fofs(sofs) + o.sect[2].size = fofs(ofs) + o.sect[3].type = f32(3) -- .strtab + o.sect[3].ofs = fofs(sofs + ofs) + o.sect[3].size = fofs(#symname+1) + ffi.copy(o.space+ofs+1, symname) + ofs = ofs + #symname + 2 + o.sect[4].type = f32(1) -- .rodata + o.sect[4].flags = fofs(2) + o.sect[4].ofs = fofs(sofs + ofs) + o.sect[4].size = fofs(#s) + o.sect[5].type = f32(1) -- .note.GNU-stack + o.sect[5].ofs = fofs(sofs + ofs + #s) + + -- Write ELF object file. + local fp = savefile(output, "wb") + fp:write(ffi.string(o, ffi.sizeof(o)-4096+ofs)) + bcsave_tail(fp, output, s) +end + +local function bcsave_peobj(ctx, output, s, ffi) + ffi.cdef[[ +typedef struct { + uint16_t arch, nsects; + uint32_t time, symtabofs, nsyms; + uint16_t opthdrsz, flags; +} PEheader; +typedef struct { + char name[8]; + uint32_t vsize, vaddr, size, ofs, relocofs, lineofs; + uint16_t nreloc, nline; + uint32_t flags; +} PEsection; +typedef struct __attribute((packed)) { + union { + char name[8]; + uint32_t nameref[2]; + }; + uint32_t value; + int16_t sect; + uint16_t type; + uint8_t scl, naux; +} PEsym; +typedef struct __attribute((packed)) { + uint32_t size; + uint16_t nreloc, nline; + uint32_t cksum; + uint16_t assoc; + uint8_t comdatsel, unused[3]; +} PEsymaux; +typedef struct { + PEheader hdr; + PEsection sect[2]; + // Must be an even number of symbol structs. + PEsym sym0; + PEsymaux sym0aux; + PEsym sym1; + PEsymaux sym1aux; + PEsym sym2; + PEsym sym3; + uint32_t strtabsize; + uint8_t space[4096]; +} PEobj; +]] + local symname = LJBC_PREFIX..ctx.modname + local is64 = false + if ctx.arch == "x86" then + symname = "_"..symname + elseif ctx.arch == "x64" then + is64 = true + end + local symexport = " /EXPORT:"..symname..",DATA " + + -- The file format is always little-endian. Swap if the host is big-endian. + local function f32(x) return x end + local f16 = f32 + if ffi.abi("be") then + f32 = bit.bswap + function f16(x) return bit.rshift(bit.bswap(x), 16) end + end + + -- Create PE object and fill in header. + local o = ffi.new("PEobj") + local hdr = o.hdr + hdr.arch = f16(({ x86=0x14c, x64=0x8664, arm=0x1c0, ppc=0x1f2, mips=0x366, mipsel=0x366 })[ctx.arch]) + hdr.nsects = f16(2) + hdr.symtabofs = f32(ffi.offsetof(o, "sym0")) + hdr.nsyms = f32(6) + + -- Fill in sections and symbols. + o.sect[0].name = ".drectve" + o.sect[0].size = f32(#symexport) + o.sect[0].flags = f32(0x00100a00) + o.sym0.sect = f16(1) + o.sym0.scl = 3 + o.sym0.name = ".drectve" + o.sym0.naux = 1 + o.sym0aux.size = f32(#symexport) + o.sect[1].name = ".rdata" + o.sect[1].size = f32(#s) + o.sect[1].flags = f32(0x40300040) + o.sym1.sect = f16(2) + o.sym1.scl = 3 + o.sym1.name = ".rdata" + o.sym1.naux = 1 + o.sym1aux.size = f32(#s) + o.sym2.sect = f16(2) + o.sym2.scl = 2 + o.sym2.nameref[1] = f32(4) + o.sym3.sect = f16(-1) + o.sym3.scl = 2 + o.sym3.value = f32(1) + o.sym3.name = "@feat.00" -- Mark as SafeSEH compliant. + ffi.copy(o.space, symname) + local ofs = #symname + 1 + o.strtabsize = f32(ofs + 4) + o.sect[0].ofs = f32(ffi.offsetof(o, "space") + ofs) + ffi.copy(o.space + ofs, symexport) + ofs = ofs + #symexport + o.sect[1].ofs = f32(ffi.offsetof(o, "space") + ofs) + + -- Write PE object file. + local fp = savefile(output, "wb") + fp:write(ffi.string(o, ffi.sizeof(o)-4096+ofs)) + bcsave_tail(fp, output, s) +end + +local function bcsave_machobj(ctx, output, s, ffi) + ffi.cdef[[ +typedef struct +{ + uint32_t magic, cputype, cpusubtype, filetype, ncmds, sizeofcmds, flags; +} mach_header; +typedef struct +{ + mach_header; uint32_t reserved; +} mach_header_64; +typedef struct { + uint32_t cmd, cmdsize; + char segname[16]; + uint32_t vmaddr, vmsize, fileoff, filesize; + uint32_t maxprot, initprot, nsects, flags; +} mach_segment_command; +typedef struct { + uint32_t cmd, cmdsize; + char segname[16]; + uint64_t vmaddr, vmsize, fileoff, filesize; + uint32_t maxprot, initprot, nsects, flags; +} mach_segment_command_64; +typedef struct { + char sectname[16], segname[16]; + uint32_t addr, size; + uint32_t offset, align, reloff, nreloc, flags; + uint32_t reserved1, reserved2; +} mach_section; +typedef struct { + char sectname[16], segname[16]; + uint64_t addr, size; + uint32_t offset, align, reloff, nreloc, flags; + uint32_t reserved1, reserved2, reserved3; +} mach_section_64; +typedef struct { + uint32_t cmd, cmdsize, symoff, nsyms, stroff, strsize; +} mach_symtab_command; +typedef struct { + int32_t strx; + uint8_t type, sect; + int16_t desc; + uint32_t value; +} mach_nlist; +typedef struct { + uint32_t strx; + uint8_t type, sect; + uint16_t desc; + uint64_t value; +} mach_nlist_64; +typedef struct +{ + uint32_t magic, nfat_arch; +} mach_fat_header; +typedef struct +{ + uint32_t cputype, cpusubtype, offset, size, align; +} mach_fat_arch; +typedef struct { + struct { + mach_header hdr; + mach_segment_command seg; + mach_section sec; + mach_symtab_command sym; + } arch[1]; + mach_nlist sym_entry; + uint8_t space[4096]; +} mach_obj; +typedef struct { + struct { + mach_header_64 hdr; + mach_segment_command_64 seg; + mach_section_64 sec; + mach_symtab_command sym; + } arch[1]; + mach_nlist_64 sym_entry; + uint8_t space[4096]; +} mach_obj_64; +typedef struct { + mach_fat_header fat; + mach_fat_arch fat_arch[2]; + struct { + mach_header hdr; + mach_segment_command seg; + mach_section sec; + mach_symtab_command sym; + } arch[2]; + mach_nlist sym_entry; + uint8_t space[4096]; +} mach_fat_obj; +]] + local symname = '_'..LJBC_PREFIX..ctx.modname + local isfat, is64, align, mobj = false, false, 4, "mach_obj" + if ctx.arch == "x64" then + is64, align, mobj = true, 8, "mach_obj_64" + elseif ctx.arch == "arm" then + isfat, mobj = true, "mach_fat_obj" + elseif ctx.arch == "arm64" then + is64, align, isfat, mobj = true, 8, true, "mach_fat_obj" + else + check(ctx.arch == "x86", "unsupported architecture for OSX") + end + local function aligned(v, a) return bit.band(v+a-1, -a) end + local be32 = bit.bswap -- Mach-O FAT is BE, supported archs are LE. + + -- Create Mach-O object and fill in header. + local o = ffi.new(mobj) + local mach_size = aligned(ffi.offsetof(o, "space")+#symname+2, align) + local cputype = ({ x86={7}, x64={0x01000007}, arm={7,12}, arm64={0x01000007,0x0100000c} })[ctx.arch] + local cpusubtype = ({ x86={3}, x64={3}, arm={3,9}, arm64={3,0} })[ctx.arch] + if isfat then + o.fat.magic = be32(0xcafebabe) + o.fat.nfat_arch = be32(#cpusubtype) + end + + -- Fill in sections and symbols. + for i=0,#cpusubtype-1 do + local ofs = 0 + if isfat then + local a = o.fat_arch[i] + a.cputype = be32(cputype[i+1]) + a.cpusubtype = be32(cpusubtype[i+1]) + -- Subsequent slices overlap each other to share data. + ofs = ffi.offsetof(o, "arch") + i*ffi.sizeof(o.arch[0]) + a.offset = be32(ofs) + a.size = be32(mach_size-ofs+#s) + end + local a = o.arch[i] + a.hdr.magic = is64 and 0xfeedfacf or 0xfeedface + a.hdr.cputype = cputype[i+1] + a.hdr.cpusubtype = cpusubtype[i+1] + a.hdr.filetype = 1 + a.hdr.ncmds = 2 + a.hdr.sizeofcmds = ffi.sizeof(a.seg)+ffi.sizeof(a.sec)+ffi.sizeof(a.sym) + a.seg.cmd = is64 and 0x19 or 0x1 + a.seg.cmdsize = ffi.sizeof(a.seg)+ffi.sizeof(a.sec) + a.seg.vmsize = #s + a.seg.fileoff = mach_size-ofs + a.seg.filesize = #s + a.seg.maxprot = 1 + a.seg.initprot = 1 + a.seg.nsects = 1 + ffi.copy(a.sec.sectname, "__data") + ffi.copy(a.sec.segname, "__DATA") + a.sec.size = #s + a.sec.offset = mach_size-ofs + a.sym.cmd = 2 + a.sym.cmdsize = ffi.sizeof(a.sym) + a.sym.symoff = ffi.offsetof(o, "sym_entry")-ofs + a.sym.nsyms = 1 + a.sym.stroff = ffi.offsetof(o, "sym_entry")+ffi.sizeof(o.sym_entry)-ofs + a.sym.strsize = aligned(#symname+2, align) + end + o.sym_entry.type = 0xf + o.sym_entry.sect = 1 + o.sym_entry.strx = 1 + ffi.copy(o.space+1, symname) + + -- Write Macho-O object file. + local fp = savefile(output, "wb") + fp:write(ffi.string(o, mach_size)) + bcsave_tail(fp, output, s) +end + +local function bcsave_obj(ctx, output, s) + local ok, ffi = pcall(require, "ffi") + check(ok, "FFI library required to write this file type") + if ctx.os == "windows" then + return bcsave_peobj(ctx, output, s, ffi) + elseif ctx.os == "osx" then + return bcsave_machobj(ctx, output, s, ffi) + else + return bcsave_elfobj(ctx, output, s, ffi) + end +end + +------------------------------------------------------------------------------ + +local function bclist(input, output) + local f = readfile(input) + require("jit.bc").dump(f, savefile(output, "w"), true) +end + +local function bcsave(ctx, input, output) + local f = readfile(input) + local s = string.dump(f, ctx.strip) + local t = ctx.type + if not t then + t = detecttype(output) + ctx.type = t + end + if t == "raw" then + bcsave_raw(output, s) + else + if not ctx.modname then ctx.modname = detectmodname(input) end + if t == "obj" then + bcsave_obj(ctx, output, s) + else + bcsave_c(ctx, output, s) + end + end +end + +local function docmd(...) + local arg = {...} + local n = 1 + local list = false + local ctx = { + strip = true, arch = jit.arch, os = string.lower(jit.os), + type = false, modname = false, + } + while n <= #arg do + local a = arg[n] + if type(a) == "string" and string.sub(a, 1, 1) == "-" and a ~= "-" then + table.remove(arg, n) + if a == "--" then break end + for m=2,#a do + local opt = string.sub(a, m, m) + if opt == "l" then + list = true + elseif opt == "s" then + ctx.strip = true + elseif opt == "g" then + ctx.strip = false + else + if arg[n] == nil or m ~= #a then usage() end + if opt == "e" then + if n ~= 1 then usage() end + arg[1] = check(loadstring(arg[1])) + elseif opt == "n" then + ctx.modname = checkmodname(table.remove(arg, n)) + elseif opt == "t" then + ctx.type = checkarg(table.remove(arg, n), map_type, "file type") + elseif opt == "a" then + ctx.arch = checkarg(table.remove(arg, n), map_arch, "architecture") + elseif opt == "o" then + ctx.os = checkarg(table.remove(arg, n), map_os, "OS name") + else + usage() + end + end + end + else + n = n + 1 + end + end + if list then + if #arg == 0 or #arg > 2 then usage() end + bclist(arg[1], arg[2] or "-") + else + if #arg ~= 2 then usage() end + bcsave(ctx, arg[1], arg[2]) + end +end + +------------------------------------------------------------------------------ + +-- Public module functions. +return { + start = docmd -- Process -b command line option. +} + diff --git a/Assets/LuaFramework/ToLua/Lua/jit/bcsave.lua.meta b/Assets/LuaFramework/ToLua/Lua/jit/bcsave.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..4fae0b686325ec06ed026d2a646984fb82f5c0bd --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/bcsave.lua.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c57519f5e4f846c459de1f2eaa13da69 +timeCreated: 1492692752 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Lua/jit/dis_arm.lua b/Assets/LuaFramework/ToLua/Lua/jit/dis_arm.lua new file mode 100644 index 0000000000000000000000000000000000000000..c2dd776991fe3ade39a9c464e566a4132ca558e5 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/dis_arm.lua @@ -0,0 +1,689 @@ +---------------------------------------------------------------------------- +-- LuaJIT ARM disassembler module. +-- +-- Copyright (C) 2005-2017 Mike Pall. All rights reserved. +-- Released under the MIT license. See Copyright Notice in luajit.h +---------------------------------------------------------------------------- +-- This is a helper module used by the LuaJIT machine code dumper module. +-- +-- It disassembles most user-mode ARMv7 instructions +-- NYI: Advanced SIMD and VFP instructions. +------------------------------------------------------------------------------ + +local type = type +local sub, byte, format = string.sub, string.byte, string.format +local match, gmatch = string.match, string.gmatch +local concat = table.concat +local bit = require("bit") +local band, bor, ror, tohex = bit.band, bit.bor, bit.ror, bit.tohex +local lshift, rshift, arshift = bit.lshift, bit.rshift, bit.arshift + +------------------------------------------------------------------------------ +-- Opcode maps +------------------------------------------------------------------------------ + +local map_loadc = { + shift = 8, mask = 15, + [10] = { + shift = 20, mask = 1, + [0] = { + shift = 23, mask = 3, + [0] = "vmovFmDN", "vstmFNdr", + _ = { + shift = 21, mask = 1, + [0] = "vstrFdl", + { shift = 16, mask = 15, [13] = "vpushFdr", _ = "vstmdbFNdr", } + }, + }, + { + shift = 23, mask = 3, + [0] = "vmovFDNm", + { shift = 16, mask = 15, [13] = "vpopFdr", _ = "vldmFNdr", }, + _ = { + shift = 21, mask = 1, + [0] = "vldrFdl", "vldmdbFNdr", + }, + }, + }, + [11] = { + shift = 20, mask = 1, + [0] = { + shift = 23, mask = 3, + [0] = "vmovGmDN", "vstmGNdr", + _ = { + shift = 21, mask = 1, + [0] = "vstrGdl", + { shift = 16, mask = 15, [13] = "vpushGdr", _ = "vstmdbGNdr", } + }, + }, + { + shift = 23, mask = 3, + [0] = "vmovGDNm", + { shift = 16, mask = 15, [13] = "vpopGdr", _ = "vldmGNdr", }, + _ = { + shift = 21, mask = 1, + [0] = "vldrGdl", "vldmdbGNdr", + }, + }, + }, + _ = { + shift = 0, mask = 0 -- NYI ldc, mcrr, mrrc. + }, +} + +local map_vfps = { + shift = 6, mask = 0x2c001, + [0] = "vmlaF.dnm", "vmlsF.dnm", + [0x04000] = "vnmlsF.dnm", [0x04001] = "vnmlaF.dnm", + [0x08000] = "vmulF.dnm", [0x08001] = "vnmulF.dnm", + [0x0c000] = "vaddF.dnm", [0x0c001] = "vsubF.dnm", + [0x20000] = "vdivF.dnm", + [0x24000] = "vfnmsF.dnm", [0x24001] = "vfnmaF.dnm", + [0x28000] = "vfmaF.dnm", [0x28001] = "vfmsF.dnm", + [0x2c000] = "vmovF.dY", + [0x2c001] = { + shift = 7, mask = 0x1e01, + [0] = "vmovF.dm", "vabsF.dm", + [0x0200] = "vnegF.dm", [0x0201] = "vsqrtF.dm", + [0x0800] = "vcmpF.dm", [0x0801] = "vcmpeF.dm", + [0x0a00] = "vcmpzF.d", [0x0a01] = "vcmpzeF.d", + [0x0e01] = "vcvtG.dF.m", + [0x1000] = "vcvt.f32.u32Fdm", [0x1001] = "vcvt.f32.s32Fdm", + [0x1800] = "vcvtr.u32F.dm", [0x1801] = "vcvt.u32F.dm", + [0x1a00] = "vcvtr.s32F.dm", [0x1a01] = "vcvt.s32F.dm", + }, +} + +local map_vfpd = { + shift = 6, mask = 0x2c001, + [0] = "vmlaG.dnm", "vmlsG.dnm", + [0x04000] = "vnmlsG.dnm", [0x04001] = "vnmlaG.dnm", + [0x08000] = "vmulG.dnm", [0x08001] = "vnmulG.dnm", + [0x0c000] = "vaddG.dnm", [0x0c001] = "vsubG.dnm", + [0x20000] = "vdivG.dnm", + [0x24000] = "vfnmsG.dnm", [0x24001] = "vfnmaG.dnm", + [0x28000] = "vfmaG.dnm", [0x28001] = "vfmsG.dnm", + [0x2c000] = "vmovG.dY", + [0x2c001] = { + shift = 7, mask = 0x1e01, + [0] = "vmovG.dm", "vabsG.dm", + [0x0200] = "vnegG.dm", [0x0201] = "vsqrtG.dm", + [0x0800] = "vcmpG.dm", [0x0801] = "vcmpeG.dm", + [0x0a00] = "vcmpzG.d", [0x0a01] = "vcmpzeG.d", + [0x0e01] = "vcvtF.dG.m", + [0x1000] = "vcvt.f64.u32GdFm", [0x1001] = "vcvt.f64.s32GdFm", + [0x1800] = "vcvtr.u32FdG.m", [0x1801] = "vcvt.u32FdG.m", + [0x1a00] = "vcvtr.s32FdG.m", [0x1a01] = "vcvt.s32FdG.m", + }, +} + +local map_datac = { + shift = 24, mask = 1, + [0] = { + shift = 4, mask = 1, + [0] = { + shift = 8, mask = 15, + [10] = map_vfps, + [11] = map_vfpd, + -- NYI cdp, mcr, mrc. + }, + { + shift = 8, mask = 15, + [10] = { + shift = 20, mask = 15, + [0] = "vmovFnD", "vmovFDn", + [14] = "vmsrD", + [15] = { shift = 12, mask = 15, [15] = "vmrs", _ = "vmrsD", }, + }, + }, + }, + "svcT", +} + +local map_loadcu = { + shift = 0, mask = 0, -- NYI unconditional CP load/store. +} + +local map_datacu = { + shift = 0, mask = 0, -- NYI unconditional CP data. +} + +local map_simddata = { + shift = 0, mask = 0, -- NYI SIMD data. +} + +local map_simdload = { + shift = 0, mask = 0, -- NYI SIMD load/store, preload. +} + +local map_preload = { + shift = 0, mask = 0, -- NYI preload. +} + +local map_media = { + shift = 20, mask = 31, + [0] = false, + { --01 + shift = 5, mask = 7, + [0] = "sadd16DNM", "sasxDNM", "ssaxDNM", "ssub16DNM", + "sadd8DNM", false, false, "ssub8DNM", + }, + { --02 + shift = 5, mask = 7, + [0] = "qadd16DNM", "qasxDNM", "qsaxDNM", "qsub16DNM", + "qadd8DNM", false, false, "qsub8DNM", + }, + { --03 + shift = 5, mask = 7, + [0] = "shadd16DNM", "shasxDNM", "shsaxDNM", "shsub16DNM", + "shadd8DNM", false, false, "shsub8DNM", + }, + false, + { --05 + shift = 5, mask = 7, + [0] = "uadd16DNM", "uasxDNM", "usaxDNM", "usub16DNM", + "uadd8DNM", false, false, "usub8DNM", + }, + { --06 + shift = 5, mask = 7, + [0] = "uqadd16DNM", "uqasxDNM", "uqsaxDNM", "uqsub16DNM", + "uqadd8DNM", false, false, "uqsub8DNM", + }, + { --07 + shift = 5, mask = 7, + [0] = "uhadd16DNM", "uhasxDNM", "uhsaxDNM", "uhsub16DNM", + "uhadd8DNM", false, false, "uhsub8DNM", + }, + { --08 + shift = 5, mask = 7, + [0] = "pkhbtDNMU", false, "pkhtbDNMU", + { shift = 16, mask = 15, [15] = "sxtb16DMU", _ = "sxtab16DNMU", }, + "pkhbtDNMU", "selDNM", "pkhtbDNMU", + }, + false, + { --0a + shift = 5, mask = 7, + [0] = "ssatDxMu", "ssat16DxM", "ssatDxMu", + { shift = 16, mask = 15, [15] = "sxtbDMU", _ = "sxtabDNMU", }, + "ssatDxMu", false, "ssatDxMu", + }, + { --0b + shift = 5, mask = 7, + [0] = "ssatDxMu", "revDM", "ssatDxMu", + { shift = 16, mask = 15, [15] = "sxthDMU", _ = "sxtahDNMU", }, + "ssatDxMu", "rev16DM", "ssatDxMu", + }, + { --0c + shift = 5, mask = 7, + [3] = { shift = 16, mask = 15, [15] = "uxtb16DMU", _ = "uxtab16DNMU", }, + }, + false, + { --0e + shift = 5, mask = 7, + [0] = "usatDwMu", "usat16DwM", "usatDwMu", + { shift = 16, mask = 15, [15] = "uxtbDMU", _ = "uxtabDNMU", }, + "usatDwMu", false, "usatDwMu", + }, + { --0f + shift = 5, mask = 7, + [0] = "usatDwMu", "rbitDM", "usatDwMu", + { shift = 16, mask = 15, [15] = "uxthDMU", _ = "uxtahDNMU", }, + "usatDwMu", "revshDM", "usatDwMu", + }, + { --10 + shift = 12, mask = 15, + [15] = { + shift = 5, mask = 7, + "smuadNMS", "smuadxNMS", "smusdNMS", "smusdxNMS", + }, + _ = { + shift = 5, mask = 7, + [0] = "smladNMSD", "smladxNMSD", "smlsdNMSD", "smlsdxNMSD", + }, + }, + false, false, false, + { --14 + shift = 5, mask = 7, + [0] = "smlaldDNMS", "smlaldxDNMS", "smlsldDNMS", "smlsldxDNMS", + }, + { --15 + shift = 5, mask = 7, + [0] = { shift = 12, mask = 15, [15] = "smmulNMS", _ = "smmlaNMSD", }, + { shift = 12, mask = 15, [15] = "smmulrNMS", _ = "smmlarNMSD", }, + false, false, false, false, + "smmlsNMSD", "smmlsrNMSD", + }, + false, false, + { --18 + shift = 5, mask = 7, + [0] = { shift = 12, mask = 15, [15] = "usad8NMS", _ = "usada8NMSD", }, + }, + false, + { --1a + shift = 5, mask = 3, [2] = "sbfxDMvw", + }, + { --1b + shift = 5, mask = 3, [2] = "sbfxDMvw", + }, + { --1c + shift = 5, mask = 3, + [0] = { shift = 0, mask = 15, [15] = "bfcDvX", _ = "bfiDMvX", }, + }, + { --1d + shift = 5, mask = 3, + [0] = { shift = 0, mask = 15, [15] = "bfcDvX", _ = "bfiDMvX", }, + }, + { --1e + shift = 5, mask = 3, [2] = "ubfxDMvw", + }, + { --1f + shift = 5, mask = 3, [2] = "ubfxDMvw", + }, +} + +local map_load = { + shift = 21, mask = 9, + { + shift = 20, mask = 5, + [0] = "strtDL", "ldrtDL", [4] = "strbtDL", [5] = "ldrbtDL", + }, + _ = { + shift = 20, mask = 5, + [0] = "strDL", "ldrDL", [4] = "strbDL", [5] = "ldrbDL", + } +} + +local map_load1 = { + shift = 4, mask = 1, + [0] = map_load, map_media, +} + +local map_loadm = { + shift = 20, mask = 1, + [0] = { + shift = 23, mask = 3, + [0] = "stmdaNR", "stmNR", + { shift = 16, mask = 63, [45] = "pushR", _ = "stmdbNR", }, "stmibNR", + }, + { + shift = 23, mask = 3, + [0] = "ldmdaNR", { shift = 16, mask = 63, [61] = "popR", _ = "ldmNR", }, + "ldmdbNR", "ldmibNR", + }, +} + +local map_data = { + shift = 21, mask = 15, + [0] = "andDNPs", "eorDNPs", "subDNPs", "rsbDNPs", + "addDNPs", "adcDNPs", "sbcDNPs", "rscDNPs", + "tstNP", "teqNP", "cmpNP", "cmnNP", + "orrDNPs", "movDPs", "bicDNPs", "mvnDPs", +} + +local map_mul = { + shift = 21, mask = 7, + [0] = "mulNMSs", "mlaNMSDs", "umaalDNMS", "mlsDNMS", + "umullDNMSs", "umlalDNMSs", "smullDNMSs", "smlalDNMSs", +} + +local map_sync = { + shift = 20, mask = 15, -- NYI: brackets around N. R(D+1) for ldrexd/strexd. + [0] = "swpDMN", false, false, false, + "swpbDMN", false, false, false, + "strexDMN", "ldrexDN", "strexdDN", "ldrexdDN", + "strexbDMN", "ldrexbDN", "strexhDN", "ldrexhDN", +} + +local map_mulh = { + shift = 21, mask = 3, + [0] = { shift = 5, mask = 3, + [0] = "smlabbNMSD", "smlatbNMSD", "smlabtNMSD", "smlattNMSD", }, + { shift = 5, mask = 3, + [0] = "smlawbNMSD", "smulwbNMS", "smlawtNMSD", "smulwtNMS", }, + { shift = 5, mask = 3, + [0] = "smlalbbDNMS", "smlaltbDNMS", "smlalbtDNMS", "smlalttDNMS", }, + { shift = 5, mask = 3, + [0] = "smulbbNMS", "smultbNMS", "smulbtNMS", "smulttNMS", }, +} + +local map_misc = { + shift = 4, mask = 7, + -- NYI: decode PSR bits of msr. + [0] = { shift = 21, mask = 1, [0] = "mrsD", "msrM", }, + { shift = 21, mask = 3, "bxM", false, "clzDM", }, + { shift = 21, mask = 3, "bxjM", }, + { shift = 21, mask = 3, "blxM", }, + false, + { shift = 21, mask = 3, [0] = "qaddDMN", "qsubDMN", "qdaddDMN", "qdsubDMN", }, + false, + { shift = 21, mask = 3, "bkptK", }, +} + +local map_datar = { + shift = 4, mask = 9, + [9] = { + shift = 5, mask = 3, + [0] = { shift = 24, mask = 1, [0] = map_mul, map_sync, }, + { shift = 20, mask = 1, [0] = "strhDL", "ldrhDL", }, + { shift = 20, mask = 1, [0] = "ldrdDL", "ldrsbDL", }, + { shift = 20, mask = 1, [0] = "strdDL", "ldrshDL", }, + }, + _ = { + shift = 20, mask = 25, + [16] = { shift = 7, mask = 1, [0] = map_misc, map_mulh, }, + _ = { + shift = 0, mask = 0xffffffff, + [bor(0xe1a00000)] = "nop", + _ = map_data, + } + }, +} + +local map_datai = { + shift = 20, mask = 31, -- NYI: decode PSR bits of msr. Decode imm12. + [16] = "movwDW", [20] = "movtDW", + [18] = { shift = 0, mask = 0xf00ff, [0] = "nopv6", _ = "msrNW", }, + [22] = "msrNW", + _ = map_data, +} + +local map_branch = { + shift = 24, mask = 1, + [0] = "bB", "blB" +} + +local map_condins = { + [0] = map_datar, map_datai, map_load, map_load1, + map_loadm, map_branch, map_loadc, map_datac +} + +-- NYI: setend. +local map_uncondins = { + [0] = false, map_simddata, map_simdload, map_preload, + false, "blxB", map_loadcu, map_datacu, +} + +------------------------------------------------------------------------------ + +local map_gpr = { + [0] = "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", + "r8", "r9", "r10", "r11", "r12", "sp", "lr", "pc", +} + +local map_cond = { + [0] = "eq", "ne", "hs", "lo", "mi", "pl", "vs", "vc", + "hi", "ls", "ge", "lt", "gt", "le", "al", +} + +local map_shift = { [0] = "lsl", "lsr", "asr", "ror", } + +------------------------------------------------------------------------------ + +-- Output a nicely formatted line with an opcode and operands. +local function putop(ctx, text, operands) + local pos = ctx.pos + local extra = "" + if ctx.rel then + local sym = ctx.symtab[ctx.rel] + if sym then + extra = "\t->"..sym + elseif band(ctx.op, 0x0e000000) ~= 0x0a000000 then + extra = "\t; 0x"..tohex(ctx.rel) + end + end + if ctx.hexdump > 0 then + ctx.out(format("%08x %s %-5s %s%s\n", + ctx.addr+pos, tohex(ctx.op), text, concat(operands, ", "), extra)) + else + ctx.out(format("%08x %-5s %s%s\n", + ctx.addr+pos, text, concat(operands, ", "), extra)) + end + ctx.pos = pos + 4 +end + +-- Fallback for unknown opcodes. +local function unknown(ctx) + return putop(ctx, ".long", { "0x"..tohex(ctx.op) }) +end + +-- Format operand 2 of load/store opcodes. +local function fmtload(ctx, op, pos) + local base = map_gpr[band(rshift(op, 16), 15)] + local x, ofs + local ext = (band(op, 0x04000000) == 0) + if not ext and band(op, 0x02000000) == 0 then + ofs = band(op, 4095) + if band(op, 0x00800000) == 0 then ofs = -ofs end + if base == "pc" then ctx.rel = ctx.addr + pos + 8 + ofs end + ofs = "#"..ofs + elseif ext and band(op, 0x00400000) ~= 0 then + ofs = band(op, 15) + band(rshift(op, 4), 0xf0) + if band(op, 0x00800000) == 0 then ofs = -ofs end + if base == "pc" then ctx.rel = ctx.addr + pos + 8 + ofs end + ofs = "#"..ofs + else + ofs = map_gpr[band(op, 15)] + if ext or band(op, 0xfe0) == 0 then + elseif band(op, 0xfe0) == 0x60 then + ofs = format("%s, rrx", ofs) + else + local sh = band(rshift(op, 7), 31) + if sh == 0 then sh = 32 end + ofs = format("%s, %s #%d", ofs, map_shift[band(rshift(op, 5), 3)], sh) + end + if band(op, 0x00800000) == 0 then ofs = "-"..ofs end + end + if ofs == "#0" then + x = format("[%s]", base) + elseif band(op, 0x01000000) == 0 then + x = format("[%s], %s", base, ofs) + else + x = format("[%s, %s]", base, ofs) + end + if band(op, 0x01200000) == 0x01200000 then x = x.."!" end + return x +end + +-- Format operand 2 of vector load/store opcodes. +local function fmtvload(ctx, op, pos) + local base = map_gpr[band(rshift(op, 16), 15)] + local ofs = band(op, 255)*4 + if band(op, 0x00800000) == 0 then ofs = -ofs end + if base == "pc" then ctx.rel = ctx.addr + pos + 8 + ofs end + if ofs == 0 then + return format("[%s]", base) + else + return format("[%s, #%d]", base, ofs) + end +end + +local function fmtvr(op, vr, sh0, sh1) + if vr == "s" then + return format("s%d", 2*band(rshift(op, sh0), 15)+band(rshift(op, sh1), 1)) + else + return format("d%d", band(rshift(op, sh0), 15)+band(rshift(op, sh1-4), 16)) + end +end + +-- Disassemble a single instruction. +local function disass_ins(ctx) + local pos = ctx.pos + local b0, b1, b2, b3 = byte(ctx.code, pos+1, pos+4) + local op = bor(lshift(b3, 24), lshift(b2, 16), lshift(b1, 8), b0) + local operands = {} + local suffix = "" + local last, name, pat + local vr + ctx.op = op + ctx.rel = nil + + local cond = rshift(op, 28) + local opat + if cond == 15 then + opat = map_uncondins[band(rshift(op, 25), 7)] + else + if cond ~= 14 then suffix = map_cond[cond] end + opat = map_condins[band(rshift(op, 25), 7)] + end + while type(opat) ~= "string" do + if not opat then return unknown(ctx) end + opat = opat[band(rshift(op, opat.shift), opat.mask)] or opat._ + end + name, pat = match(opat, "^([a-z0-9]*)(.*)") + if sub(pat, 1, 1) == "." then + local s2, p2 = match(pat, "^([a-z0-9.]*)(.*)") + suffix = suffix..s2 + pat = p2 + end + + for p in gmatch(pat, ".") do + local x = nil + if p == "D" then + x = map_gpr[band(rshift(op, 12), 15)] + elseif p == "N" then + x = map_gpr[band(rshift(op, 16), 15)] + elseif p == "S" then + x = map_gpr[band(rshift(op, 8), 15)] + elseif p == "M" then + x = map_gpr[band(op, 15)] + elseif p == "d" then + x = fmtvr(op, vr, 12, 22) + elseif p == "n" then + x = fmtvr(op, vr, 16, 7) + elseif p == "m" then + x = fmtvr(op, vr, 0, 5) + elseif p == "P" then + if band(op, 0x02000000) ~= 0 then + x = ror(band(op, 255), 2*band(rshift(op, 8), 15)) + else + x = map_gpr[band(op, 15)] + if band(op, 0xff0) ~= 0 then + operands[#operands+1] = x + local s = map_shift[band(rshift(op, 5), 3)] + local r = nil + if band(op, 0xf90) == 0 then + if s == "ror" then s = "rrx" else r = "#32" end + elseif band(op, 0x10) == 0 then + r = "#"..band(rshift(op, 7), 31) + else + r = map_gpr[band(rshift(op, 8), 15)] + end + if name == "mov" then name = s; x = r + elseif r then x = format("%s %s", s, r) + else x = s end + end + end + elseif p == "L" then + x = fmtload(ctx, op, pos) + elseif p == "l" then + x = fmtvload(ctx, op, pos) + elseif p == "B" then + local addr = ctx.addr + pos + 8 + arshift(lshift(op, 8), 6) + if cond == 15 then addr = addr + band(rshift(op, 23), 2) end + ctx.rel = addr + x = "0x"..tohex(addr) + elseif p == "F" then + vr = "s" + elseif p == "G" then + vr = "d" + elseif p == "." then + suffix = suffix..(vr == "s" and ".f32" or ".f64") + elseif p == "R" then + if band(op, 0x00200000) ~= 0 and #operands == 1 then + operands[1] = operands[1].."!" + end + local t = {} + for i=0,15 do + if band(rshift(op, i), 1) == 1 then t[#t+1] = map_gpr[i] end + end + x = "{"..concat(t, ", ").."}" + elseif p == "r" then + if band(op, 0x00200000) ~= 0 and #operands == 2 then + operands[1] = operands[1].."!" + end + local s = tonumber(sub(last, 2)) + local n = band(op, 255) + if vr == "d" then n = rshift(n, 1) end + operands[#operands] = format("{%s-%s%d}", last, vr, s+n-1) + elseif p == "W" then + x = band(op, 0x0fff) + band(rshift(op, 4), 0xf000) + elseif p == "T" then + x = "#0x"..tohex(band(op, 0x00ffffff), 6) + elseif p == "U" then + x = band(rshift(op, 7), 31) + if x == 0 then x = nil end + elseif p == "u" then + x = band(rshift(op, 7), 31) + if band(op, 0x40) == 0 then + if x == 0 then x = nil else x = "lsl #"..x end + else + if x == 0 then x = "asr #32" else x = "asr #"..x end + end + elseif p == "v" then + x = band(rshift(op, 7), 31) + elseif p == "w" then + x = band(rshift(op, 16), 31) + elseif p == "x" then + x = band(rshift(op, 16), 31) + 1 + elseif p == "X" then + x = band(rshift(op, 16), 31) - last + 1 + elseif p == "Y" then + x = band(rshift(op, 12), 0xf0) + band(op, 0x0f) + elseif p == "K" then + x = "#0x"..tohex(band(rshift(op, 4), 0x0000fff0) + band(op, 15), 4) + elseif p == "s" then + if band(op, 0x00100000) ~= 0 then suffix = "s"..suffix end + else + assert(false) + end + if x then + last = x + if type(x) == "number" then x = "#"..x end + operands[#operands+1] = x + end + end + + return putop(ctx, name..suffix, operands) +end + +------------------------------------------------------------------------------ + +-- Disassemble a block of code. +local function disass_block(ctx, ofs, len) + if not ofs then ofs = 0 end + local stop = len and ofs+len or #ctx.code + ctx.pos = ofs + ctx.rel = nil + while ctx.pos < stop do disass_ins(ctx) end +end + +-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len). +local function create(code, addr, out) + local ctx = {} + ctx.code = code + ctx.addr = addr or 0 + ctx.out = out or io.write + ctx.symtab = {} + ctx.disass = disass_block + ctx.hexdump = 8 + return ctx +end + +-- Simple API: disassemble code (a string) at address and output via out. +local function disass(code, addr, out) + create(code, addr, out):disass() +end + +-- Return register name for RID. +local function regname(r) + if r < 16 then return map_gpr[r] end + return "d"..(r-16) +end + +-- Public module functions. +return { + create = create, + disass = disass, + regname = regname +} + diff --git a/Assets/LuaFramework/ToLua/Lua/jit/dis_arm.lua.meta b/Assets/LuaFramework/ToLua/Lua/jit/dis_arm.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..5dc5d9cae7f99016442dc4ada7a55bb93f64bc11 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/dis_arm.lua.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0ca08f899c4b9e9468fe93edcef60270 +timeCreated: 1492692752 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Lua/jit/dis_arm64.lua b/Assets/LuaFramework/ToLua/Lua/jit/dis_arm64.lua new file mode 100644 index 0000000000000000000000000000000000000000..a7173326acb77e341bf6b9e2f8d214f899e07f03 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/dis_arm64.lua @@ -0,0 +1,1216 @@ +---------------------------------------------------------------------------- +-- LuaJIT ARM64 disassembler module. +-- +-- Copyright (C) 2005-2017 Mike Pall. All rights reserved. +-- Released under the MIT license. See Copyright Notice in luajit.h +-- +-- Contributed by Djordje Kovacevic and Stefan Pejic from RT-RK.com. +-- Sponsored by Cisco Systems, Inc. +---------------------------------------------------------------------------- +-- This is a helper module used by the LuaJIT machine code dumper module. +-- +-- It disassembles most user-mode AArch64 instructions. +-- NYI: Advanced SIMD and VFP instructions. +------------------------------------------------------------------------------ + +local type = type +local sub, byte, format = string.sub, string.byte, string.format +local match, gmatch, gsub = string.match, string.gmatch, string.gsub +local concat = table.concat +local bit = require("bit") +local band, bor, bxor, tohex = bit.band, bit.bor, bit.bxor, bit.tohex +local lshift, rshift, arshift = bit.lshift, bit.rshift, bit.arshift +local ror = bit.ror + +------------------------------------------------------------------------------ +-- Opcode maps +------------------------------------------------------------------------------ + +local map_adr = { -- PC-relative addressing. + shift = 31, mask = 1, + [0] = "adrDBx", "adrpDBx" +} + +local map_addsubi = { -- Add/subtract immediate. + shift = 29, mask = 3, + [0] = "add|movDNIg", "adds|cmnD0NIg", "subDNIg", "subs|cmpD0NIg", +} + +local map_logi = { -- Logical immediate. + shift = 31, mask = 1, + [0] = { + shift = 22, mask = 1, + [0] = { + shift = 29, mask = 3, + [0] = "andDNig", "orr|movDN0ig", "eorDNig", "ands|tstD0Nig" + }, + false -- unallocated + }, + { + shift = 29, mask = 3, + [0] = "andDNig", "orr|movDN0ig", "eorDNig", "ands|tstD0Nig" + } +} + +local map_movwi = { -- Move wide immediate. + shift = 31, mask = 1, + [0] = { + shift = 22, mask = 1, + [0] = { + shift = 29, mask = 3, + [0] = "movnDWRg", false, "movz|movDYRg", "movkDWRg" + }, false -- unallocated + }, + { + shift = 29, mask = 3, + [0] = "movnDWRg", false, "movz|movDYRg", "movkDWRg" + }, +} + +local map_bitf = { -- Bitfield. + shift = 31, mask = 1, + [0] = { + shift = 22, mask = 1, + [0] = { + shift = 29, mask = 3, + [0] = "sbfm|sbfiz|sbfx|asr|sxtw|sxth|sxtbDN12w", + "bfm|bfi|bfxilDN13w", + "ubfm|ubfiz|ubfx|lsr|lsl|uxth|uxtbDN12w" + } + }, + { + shift = 22, mask = 1, + { + shift = 29, mask = 3, + [0] = "sbfm|sbfiz|sbfx|asr|sxtw|sxth|sxtbDN12x", + "bfm|bfi|bfxilDN13x", + "ubfm|ubfiz|ubfx|lsr|lsl|uxth|uxtbDN12x" + } + } +} + +local map_datai = { -- Data processing - immediate. + shift = 23, mask = 7, + [0] = map_adr, map_adr, map_addsubi, false, + map_logi, map_movwi, map_bitf, + { + shift = 15, mask = 0x1c0c1, + [0] = "extr|rorDNM4w", [0x10080] = "extr|rorDNM4x", + [0x10081] = "extr|rorDNM4x" + } +} + +local map_logsr = { -- Logical, shifted register. + shift = 31, mask = 1, + [0] = { + shift = 15, mask = 1, + [0] = { + shift = 29, mask = 3, + [0] = { + shift = 21, mask = 7, + [0] = "andDNMSg", "bicDNMSg", "andDNMSg", "bicDNMSg", + "andDNMSg", "bicDNMSg", "andDNMg", "bicDNMg" + }, + { + shift = 21, mask = 7, + [0] ="orr|movDN0MSg", "orn|mvnDN0MSg", "orr|movDN0MSg", "orn|mvnDN0MSg", + "orr|movDN0MSg", "orn|mvnDN0MSg", "orr|movDN0Mg", "orn|mvnDN0Mg" + }, + { + shift = 21, mask = 7, + [0] = "eorDNMSg", "eonDNMSg", "eorDNMSg", "eonDNMSg", + "eorDNMSg", "eonDNMSg", "eorDNMg", "eonDNMg" + }, + { + shift = 21, mask = 7, + [0] = "ands|tstD0NMSg", "bicsDNMSg", "ands|tstD0NMSg", "bicsDNMSg", + "ands|tstD0NMSg", "bicsDNMSg", "ands|tstD0NMg", "bicsDNMg" + } + }, + false -- unallocated + }, + { + shift = 29, mask = 3, + [0] = { + shift = 21, mask = 7, + [0] = "andDNMSg", "bicDNMSg", "andDNMSg", "bicDNMSg", + "andDNMSg", "bicDNMSg", "andDNMg", "bicDNMg" + }, + { + shift = 21, mask = 7, + [0] = "orr|movDN0MSg", "orn|mvnDN0MSg", "orr|movDN0MSg", "orn|mvnDN0MSg", + "orr|movDN0MSg", "orn|mvnDN0MSg", "orr|movDN0Mg", "orn|mvnDN0Mg" + }, + { + shift = 21, mask = 7, + [0] = "eorDNMSg", "eonDNMSg", "eorDNMSg", "eonDNMSg", + "eorDNMSg", "eonDNMSg", "eorDNMg", "eonDNMg" + }, + { + shift = 21, mask = 7, + [0] = "ands|tstD0NMSg", "bicsDNMSg", "ands|tstD0NMSg", "bicsDNMSg", + "ands|tstD0NMSg", "bicsDNMSg", "ands|tstD0NMg", "bicsDNMg" + } + } +} + +local map_assh = { + shift = 31, mask = 1, + [0] = { + shift = 15, mask = 1, + [0] = { + shift = 29, mask = 3, + [0] = { + shift = 22, mask = 3, + [0] = "addDNMSg", "addDNMSg", "addDNMSg", "addDNMg" + }, + { + shift = 22, mask = 3, + [0] = "adds|cmnD0NMSg", "adds|cmnD0NMSg", + "adds|cmnD0NMSg", "adds|cmnD0NMg" + }, + { + shift = 22, mask = 3, + [0] = "sub|negDN0MSg", "sub|negDN0MSg", "sub|negDN0MSg", "sub|negDN0Mg" + }, + { + shift = 22, mask = 3, + [0] = "subs|cmp|negsD0N0MzSg", "subs|cmp|negsD0N0MzSg", + "subs|cmp|negsD0N0MzSg", "subs|cmp|negsD0N0Mzg" + }, + }, + false -- unallocated + }, + { + shift = 29, mask = 3, + [0] = { + shift = 22, mask = 3, + [0] = "addDNMSg", "addDNMSg", "addDNMSg", "addDNMg" + }, + { + shift = 22, mask = 3, + [0] = "adds|cmnD0NMSg", "adds|cmnD0NMSg", "adds|cmnD0NMSg", + "adds|cmnD0NMg" + }, + { + shift = 22, mask = 3, + [0] = "sub|negDN0MSg", "sub|negDN0MSg", "sub|negDN0MSg", "sub|negDN0Mg" + }, + { + shift = 22, mask = 3, + [0] = "subs|cmp|negsD0N0MzSg", "subs|cmp|negsD0N0MzSg", + "subs|cmp|negsD0N0MzSg", "subs|cmp|negsD0N0Mzg" + } + } +} + +local map_addsubsh = { -- Add/subtract, shifted register. + shift = 22, mask = 3, + [0] = map_assh, map_assh, map_assh +} + +local map_addsubex = { -- Add/subtract, extended register. + shift = 22, mask = 3, + [0] = { + shift = 29, mask = 3, + [0] = "addDNMXg", "adds|cmnD0NMXg", "subDNMXg", "subs|cmpD0NMzXg", + } +} + +local map_addsubc = { -- Add/subtract, with carry. + shift = 10, mask = 63, + [0] = { + shift = 29, mask = 3, + [0] = "adcDNMg", "adcsDNMg", "sbc|ngcDN0Mg", "sbcs|ngcsDN0Mg", + } +} + +local map_ccomp = { + shift = 4, mask = 1, + [0] = { + shift = 10, mask = 3, + [0] = { -- Conditional compare register. + shift = 29, mask = 3, + "ccmnNMVCg", false, "ccmpNMVCg", + }, + [2] = { -- Conditional compare immediate. + shift = 29, mask = 3, + "ccmnN5VCg", false, "ccmpN5VCg", + } + } +} + +local map_csel = { -- Conditional select. + shift = 11, mask = 1, + [0] = { + shift = 10, mask = 1, + [0] = { + shift = 29, mask = 3, + [0] = "cselDNMzCg", false, "csinv|cinv|csetmDNMcg", false, + }, + { + shift = 29, mask = 3, + [0] = "csinc|cinc|csetDNMcg", false, "csneg|cnegDNMcg", false, + } + } +} + +local map_data1s = { -- Data processing, 1 source. + shift = 29, mask = 1, + [0] = { + shift = 31, mask = 1, + [0] = { + shift = 10, mask = 0x7ff, + [0] = "rbitDNg", "rev16DNg", "revDNw", false, "clzDNg", "clsDNg" + }, + { + shift = 10, mask = 0x7ff, + [0] = "rbitDNg", "rev16DNg", "rev32DNx", "revDNx", "clzDNg", "clsDNg" + } + } +} + +local map_data2s = { -- Data processing, 2 sources. + shift = 29, mask = 1, + [0] = { + shift = 10, mask = 63, + false, "udivDNMg", "sdivDNMg", false, false, false, false, "lslDNMg", + "lsrDNMg", "asrDNMg", "rorDNMg" + } +} + +local map_data3s = { -- Data processing, 3 sources. + shift = 29, mask = 7, + [0] = { + shift = 21, mask = 7, + [0] = { + shift = 15, mask = 1, + [0] = "madd|mulDNMA0g", "msub|mnegDNMA0g" + } + }, false, false, false, + { + shift = 15, mask = 1, + [0] = { + shift = 21, mask = 7, + [0] = "madd|mulDNMA0g", "smaddl|smullDxNMwA0x", "smulhDNMx", false, + false, "umaddl|umullDxNMwA0x", "umulhDNMx" + }, + { + shift = 21, mask = 7, + [0] = "msub|mnegDNMA0g", "smsubl|smneglDxNMwA0x", false, false, + false, "umsubl|umneglDxNMwA0x" + } + } +} + +local map_datar = { -- Data processing, register. + shift = 28, mask = 1, + [0] = { + shift = 24, mask = 1, + [0] = map_logsr, + { + shift = 21, mask = 1, + [0] = map_addsubsh, map_addsubex + } + }, + { + shift = 21, mask = 15, + [0] = map_addsubc, false, map_ccomp, false, map_csel, false, + { + shift = 30, mask = 1, + [0] = map_data2s, map_data1s + }, + false, map_data3s, map_data3s, map_data3s, map_data3s, map_data3s, + map_data3s, map_data3s, map_data3s + } +} + +local map_lrl = { -- Load register, literal. + shift = 26, mask = 1, + [0] = { + shift = 30, mask = 3, + [0] = "ldrDwB", "ldrDxB", "ldrswDxB" + }, + { + shift = 30, mask = 3, + [0] = "ldrDsB", "ldrDdB" + } +} + +local map_lsriind = { -- Load/store register, immediate pre/post-indexed. + shift = 30, mask = 3, + [0] = { + shift = 26, mask = 1, + [0] = { + shift = 22, mask = 3, + [0] = "strbDwzL", "ldrbDwzL", "ldrsbDxzL", "ldrsbDwzL" + } + }, + { + shift = 26, mask = 1, + [0] = { + shift = 22, mask = 3, + [0] = "strhDwzL", "ldrhDwzL", "ldrshDxzL", "ldrshDwzL" + } + }, + { + shift = 26, mask = 1, + [0] = { + shift = 22, mask = 3, + [0] = "strDwzL", "ldrDwzL", "ldrswDxzL" + }, + { + shift = 22, mask = 3, + [0] = "strDszL", "ldrDszL" + } + }, + { + shift = 26, mask = 1, + [0] = { + shift = 22, mask = 3, + [0] = "strDxzL", "ldrDxzL" + }, + { + shift = 22, mask = 3, + [0] = "strDdzL", "ldrDdzL" + } + } +} + +local map_lsriro = { + shift = 21, mask = 1, + [0] = { -- Load/store register immediate. + shift = 10, mask = 3, + [0] = { -- Unscaled immediate. + shift = 26, mask = 1, + [0] = { + shift = 30, mask = 3, + [0] = { + shift = 22, mask = 3, + [0] = "sturbDwK", "ldurbDwK" + }, + { + shift = 22, mask = 3, + [0] = "sturhDwK", "ldurhDwK" + }, + { + shift = 22, mask = 3, + [0] = "sturDwK", "ldurDwK" + }, + { + shift = 22, mask = 3, + [0] = "sturDxK", "ldurDxK" + } + } + }, map_lsriind, false, map_lsriind + }, + { -- Load/store register, register offset. + shift = 10, mask = 3, + [2] = { + shift = 26, mask = 1, + [0] = { + shift = 30, mask = 3, + [0] = { + shift = 22, mask = 3, + [0] = "strbDwO", "ldrbDwO", "ldrsbDxO", "ldrsbDwO" + }, + { + shift = 22, mask = 3, + [0] = "strhDwO", "ldrhDwO", "ldrshDxO", "ldrshDwO" + }, + { + shift = 22, mask = 3, + [0] = "strDwO", "ldrDwO", "ldrswDxO" + }, + { + shift = 22, mask = 3, + [0] = "strDxO", "ldrDxO" + } + }, + { + shift = 30, mask = 3, + [2] = { + shift = 22, mask = 3, + [0] = "strDsO", "ldrDsO" + }, + [3] = { + shift = 22, mask = 3, + [0] = "strDdO", "ldrDdO" + } + } + } + } +} + +local map_lsp = { -- Load/store register pair, offset. + shift = 22, mask = 1, + [0] = { + shift = 30, mask = 3, + [0] = { + shift = 26, mask = 1, + [0] = "stpDzAzwP", "stpDzAzsP", + }, + { + shift = 26, mask = 1, + "stpDzAzdP" + }, + { + shift = 26, mask = 1, + [0] = "stpDzAzxP" + } + }, + { + shift = 30, mask = 3, + [0] = { + shift = 26, mask = 1, + [0] = "ldpDzAzwP", "ldpDzAzsP", + }, + { + shift = 26, mask = 1, + [0] = "ldpswDAxP", "ldpDzAzdP" + }, + { + shift = 26, mask = 1, + [0] = "ldpDzAzxP" + } + } +} + +local map_ls = { -- Loads and stores. + shift = 24, mask = 0x31, + [0x10] = map_lrl, [0x30] = map_lsriro, + [0x20] = { + shift = 23, mask = 3, + map_lsp, map_lsp, map_lsp + }, + [0x21] = { + shift = 23, mask = 3, + map_lsp, map_lsp, map_lsp + }, + [0x31] = { + shift = 26, mask = 1, + [0] = { + shift = 30, mask = 3, + [0] = { + shift = 22, mask = 3, + [0] = "strbDwzU", "ldrbDwzU" + }, + { + shift = 22, mask = 3, + [0] = "strhDwzU", "ldrhDwzU" + }, + { + shift = 22, mask = 3, + [0] = "strDwzU", "ldrDwzU" + }, + { + shift = 22, mask = 3, + [0] = "strDxzU", "ldrDxzU" + } + }, + { + shift = 30, mask = 3, + [2] = { + shift = 22, mask = 3, + [0] = "strDszU", "ldrDszU" + }, + [3] = { + shift = 22, mask = 3, + [0] = "strDdzU", "ldrDdzU" + } + } + }, +} + +local map_datafp = { -- Data processing, SIMD and FP. + shift = 28, mask = 7, + { -- 001 + shift = 24, mask = 1, + [0] = { + shift = 21, mask = 1, + { + shift = 10, mask = 3, + [0] = { + shift = 12, mask = 1, + [0] = { + shift = 13, mask = 1, + [0] = { + shift = 14, mask = 1, + [0] = { + shift = 15, mask = 1, + [0] = { -- FP/int conversion. + shift = 31, mask = 1, + [0] = { + shift = 16, mask = 0xff, + [0x20] = "fcvtnsDwNs", [0x21] = "fcvtnuDwNs", + [0x22] = "scvtfDsNw", [0x23] = "ucvtfDsNw", + [0x24] = "fcvtasDwNs", [0x25] = "fcvtauDwNs", + [0x26] = "fmovDwNs", [0x27] = "fmovDsNw", + [0x28] = "fcvtpsDwNs", [0x29] = "fcvtpuDwNs", + [0x30] = "fcvtmsDwNs", [0x31] = "fcvtmuDwNs", + [0x38] = "fcvtzsDwNs", [0x39] = "fcvtzuDwNs", + [0x60] = "fcvtnsDwNd", [0x61] = "fcvtnuDwNd", + [0x62] = "scvtfDdNw", [0x63] = "ucvtfDdNw", + [0x64] = "fcvtasDwNd", [0x65] = "fcvtauDwNd", + [0x68] = "fcvtpsDwNd", [0x69] = "fcvtpuDwNd", + [0x70] = "fcvtmsDwNd", [0x71] = "fcvtmuDwNd", + [0x78] = "fcvtzsDwNd", [0x79] = "fcvtzuDwNd" + }, + { + shift = 16, mask = 0xff, + [0x20] = "fcvtnsDxNs", [0x21] = "fcvtnuDxNs", + [0x22] = "scvtfDsNx", [0x23] = "ucvtfDsNx", + [0x24] = "fcvtasDxNs", [0x25] = "fcvtauDxNs", + [0x28] = "fcvtpsDxNs", [0x29] = "fcvtpuDxNs", + [0x30] = "fcvtmsDxNs", [0x31] = "fcvtmuDxNs", + [0x38] = "fcvtzsDxNs", [0x39] = "fcvtzuDxNs", + [0x60] = "fcvtnsDxNd", [0x61] = "fcvtnuDxNd", + [0x62] = "scvtfDdNx", [0x63] = "ucvtfDdNx", + [0x64] = "fcvtasDxNd", [0x65] = "fcvtauDxNd", + [0x66] = "fmovDxNd", [0x67] = "fmovDdNx", + [0x68] = "fcvtpsDxNd", [0x69] = "fcvtpuDxNd", + [0x70] = "fcvtmsDxNd", [0x71] = "fcvtmuDxNd", + [0x78] = "fcvtzsDxNd", [0x79] = "fcvtzuDxNd" + } + } + }, + { -- FP data-processing, 1 source. + shift = 31, mask = 1, + [0] = { + shift = 22, mask = 3, + [0] = { + shift = 15, mask = 63, + [0] = "fmovDNf", "fabsDNf", "fnegDNf", + "fsqrtDNf", false, "fcvtDdNs", false, false, + "frintnDNf", "frintpDNf", "frintmDNf", "frintzDNf", + "frintaDNf", false, "frintxDNf", "frintiDNf", + }, + { + shift = 15, mask = 63, + [0] = "fmovDNf", "fabsDNf", "fnegDNf", + "fsqrtDNf", "fcvtDsNd", false, false, false, + "frintnDNf", "frintpDNf", "frintmDNf", "frintzDNf", + "frintaDNf", false, "frintxDNf", "frintiDNf", + } + } + } + }, + { -- FP compare. + shift = 31, mask = 1, + [0] = { + shift = 14, mask = 3, + [0] = { + shift = 23, mask = 1, + [0] = { + shift = 0, mask = 31, + [0] = "fcmpNMf", [8] = "fcmpNZf", + [16] = "fcmpeNMf", [24] = "fcmpeNZf", + } + } + } + } + }, + { -- FP immediate. + shift = 31, mask = 1, + [0] = { + shift = 5, mask = 31, + [0] = { + shift = 23, mask = 1, + [0] = "fmovDFf" + } + } + } + }, + { -- FP conditional compare. + shift = 31, mask = 1, + [0] = { + shift = 23, mask = 1, + [0] = { + shift = 4, mask = 1, + [0] = "fccmpNMVCf", "fccmpeNMVCf" + } + } + }, + { -- FP data-processing, 2 sources. + shift = 31, mask = 1, + [0] = { + shift = 23, mask = 1, + [0] = { + shift = 12, mask = 15, + [0] = "fmulDNMf", "fdivDNMf", "faddDNMf", "fsubDNMf", + "fmaxDNMf", "fminDNMf", "fmaxnmDNMf", "fminnmDNMf", + "fnmulDNMf" + } + } + }, + { -- FP conditional select. + shift = 31, mask = 1, + [0] = { + shift = 23, mask = 1, + [0] = "fcselDNMCf" + } + } + } + }, + { -- FP data-processing, 3 sources. + shift = 31, mask = 1, + [0] = { + shift = 15, mask = 1, + [0] = { + shift = 21, mask = 5, + [0] = "fmaddDNMAf", "fnmaddDNMAf" + }, + { + shift = 21, mask = 5, + [0] = "fmsubDNMAf", "fnmsubDNMAf" + } + } + } + } +} + +local map_br = { -- Branches, exception generating and system instructions. + shift = 29, mask = 7, + [0] = "bB", + { -- Compare & branch, immediate. + shift = 24, mask = 3, + [0] = "cbzDBg", "cbnzDBg", "tbzDTBw", "tbnzDTBw" + }, + { -- Conditional branch, immediate. + shift = 24, mask = 3, + [0] = { + shift = 4, mask = 1, + [0] = { + shift = 0, mask = 15, + [0] = "beqB", "bneB", "bhsB", "bloB", "bmiB", "bplB", "bvsB", "bvcB", + "bhiB", "blsB", "bgeB", "bltB", "bgtB", "bleB", "balB" + } + } + }, false, "blB", + { -- Compare & branch, immediate. + shift = 24, mask = 3, + [0] = "cbzDBg", "cbnzDBg", "tbzDTBx", "tbnzDTBx" + }, + { + shift = 24, mask = 3, + [0] = { -- Exception generation. + shift = 0, mask = 0xe0001f, + [0x200000] = "brkW" + }, + { -- System instructions. + shift = 0, mask = 0x3fffff, + [0x03201f] = "nop" + }, + { -- Unconditional branch, register. + shift = 0, mask = 0xfffc1f, + [0x1f0000] = "brNx", [0x3f0000] = "blrNx", + [0x5f0000] = "retNx" + }, + } +} + +local map_init = { + shift = 25, mask = 15, + [0] = false, false, false, false, map_ls, map_datar, map_ls, map_datafp, + map_datai, map_datai, map_br, map_br, map_ls, map_datar, map_ls, map_datafp +} + +------------------------------------------------------------------------------ + +local map_regs = { x = {}, w = {}, d = {}, s = {} } + +for i=0,30 do + map_regs.x[i] = "x"..i + map_regs.w[i] = "w"..i + map_regs.d[i] = "d"..i + map_regs.s[i] = "s"..i +end +map_regs.x[31] = "sp" +map_regs.w[31] = "wsp" +map_regs.d[31] = "d31" +map_regs.s[31] = "s31" + +local map_cond = { + [0] = "eq", "ne", "cs", "cc", "mi", "pl", "vs", "vc", + "hi", "ls", "ge", "lt", "gt", "le", "al", +} + +local map_shift = { [0] = "lsl", "lsr", "asr", } + +local map_extend = { + [0] = "uxtb", "uxth", "uxtw", "uxtx", "sxtb", "sxth", "sxtw", "sxtx", +} + +------------------------------------------------------------------------------ + +-- Output a nicely formatted line with an opcode and operands. +local function putop(ctx, text, operands) + local pos = ctx.pos + local extra = "" + if ctx.rel then + local sym = ctx.symtab[ctx.rel] + if sym then + extra = "\t->"..sym + end + end + if ctx.hexdump > 0 then + ctx.out(format("%08x %s %-5s %s%s\n", + ctx.addr+pos, tohex(ctx.op), text, concat(operands, ", "), extra)) + else + ctx.out(format("%08x %-5s %s%s\n", + ctx.addr+pos, text, concat(operands, ", "), extra)) + end + ctx.pos = pos + 4 +end + +-- Fallback for unknown opcodes. +local function unknown(ctx) + return putop(ctx, ".long", { "0x"..tohex(ctx.op) }) +end + +local function match_reg(p, pat, regnum) + return map_regs[match(pat, p.."%w-([xwds])")][regnum] +end + +local function fmt_hex32(x) + if x < 0 then + return tohex(x) + else + return format("%x", x) + end +end + +local imm13_rep = { 0x55555555, 0x11111111, 0x01010101, 0x00010001, 0x00000001 } + +local function decode_imm13(op) + local imms = band(rshift(op, 10), 63) + local immr = band(rshift(op, 16), 63) + if band(op, 0x00400000) == 0 then + local len = 5 + if imms >= 56 then + if imms >= 60 then len = 1 else len = 2 end + elseif imms >= 48 then len = 3 elseif imms >= 32 then len = 4 end + local l = lshift(1, len)-1 + local s = band(imms, l) + local r = band(immr, l) + local imm = ror(rshift(-1, 31-s), r) + if len ~= 5 then imm = band(imm, lshift(1, l)-1) + rshift(imm, 31-l) end + imm = imm * imm13_rep[len] + local ix = fmt_hex32(imm) + if rshift(op, 31) ~= 0 then + return ix..tohex(imm) + else + return ix + end + else + local lo, hi = -1, 0 + if imms < 32 then lo = rshift(-1, 31-imms) else hi = rshift(-1, 63-imms) end + if immr ~= 0 then + lo, hi = ror(lo, immr), ror(hi, immr) + local x = immr == 32 and 0 or band(bxor(lo, hi), lshift(-1, 32-immr)) + lo, hi = bxor(lo, x), bxor(hi, x) + if immr >= 32 then lo, hi = hi, lo end + end + if hi ~= 0 then + return fmt_hex32(hi)..tohex(lo) + else + return fmt_hex32(lo) + end + end +end + +local function parse_immpc(op, name) + if name == "b" or name == "bl" then + return arshift(lshift(op, 6), 4) + elseif name == "adr" or name == "adrp" then + local immlo = band(rshift(op, 29), 3) + local immhi = lshift(arshift(lshift(op, 8), 13), 2) + return bor(immhi, immlo) + elseif name == "tbz" or name == "tbnz" then + return lshift(arshift(lshift(op, 13), 18), 2) + else + return lshift(arshift(lshift(op, 8), 13), 2) + end +end + +local function parse_fpimm8(op) + local sign = band(op, 0x100000) == 0 and 1 or -1 + local exp = bxor(rshift(arshift(lshift(op, 12), 5), 24), 0x80) - 131 + local frac = 16+band(rshift(op, 13), 15) + return sign * frac * 2^exp +end + +local function prefer_bfx(sf, uns, imms, immr) + if imms < immr or imms == 31 or imms == 63 then + return false + end + if immr == 0 then + if sf == 0 and (imms == 7 or imms == 15) then + return false + end + if sf ~= 0 and uns == 0 and (imms == 7 or imms == 15 or imms == 31) then + return false + end + end + return true +end + +-- Disassemble a single instruction. +local function disass_ins(ctx) + local pos = ctx.pos + local b0, b1, b2, b3 = byte(ctx.code, pos+1, pos+4) + local op = bor(lshift(b3, 24), lshift(b2, 16), lshift(b1, 8), b0) + local operands = {} + local suffix = "" + local last, name, pat + local map_reg + ctx.op = op + ctx.rel = nil + last = nil + local opat + opat = map_init[band(rshift(op, 25), 15)] + while type(opat) ~= "string" do + if not opat then return unknown(ctx) end + opat = opat[band(rshift(op, opat.shift), opat.mask)] or opat._ + end + name, pat = match(opat, "^([a-z0-9]*)(.*)") + local altname, pat2 = match(pat, "|([a-z0-9_.|]*)(.*)") + if altname then pat = pat2 end + if sub(pat, 1, 1) == "." then + local s2, p2 = match(pat, "^([a-z0-9.]*)(.*)") + suffix = suffix..s2 + pat = p2 + end + + local rt = match(pat, "[gf]") + if rt then + if rt == "g" then + map_reg = band(op, 0x80000000) ~= 0 and map_regs.x or map_regs.w + else + map_reg = band(op, 0x400000) ~= 0 and map_regs.d or map_regs.s + end + end + + local second0, immr + + for p in gmatch(pat, ".") do + local x = nil + if p == "D" then + local regnum = band(op, 31) + x = rt and map_reg[regnum] or match_reg(p, pat, regnum) + elseif p == "N" then + local regnum = band(rshift(op, 5), 31) + x = rt and map_reg[regnum] or match_reg(p, pat, regnum) + elseif p == "M" then + local regnum = band(rshift(op, 16), 31) + x = rt and map_reg[regnum] or match_reg(p, pat, regnum) + elseif p == "A" then + local regnum = band(rshift(op, 10), 31) + x = rt and map_reg[regnum] or match_reg(p, pat, regnum) + elseif p == "B" then + local addr = ctx.addr + pos + parse_immpc(op, name) + ctx.rel = addr + x = "0x"..tohex(addr) + elseif p == "T" then + x = bor(band(rshift(op, 26), 32), band(rshift(op, 19), 31)) + elseif p == "V" then + x = band(op, 15) + elseif p == "C" then + x = map_cond[band(rshift(op, 12), 15)] + elseif p == "c" then + local rn = band(rshift(op, 5), 31) + local rm = band(rshift(op, 16), 31) + local cond = band(rshift(op, 12), 15) + local invc = bxor(cond, 1) + x = map_cond[cond] + if altname and cond ~= 14 and cond ~= 15 then + local a1, a2 = match(altname, "([^|]*)|(.*)") + if rn == rm then + local n = #operands + operands[n] = nil + x = map_cond[invc] + if rn ~= 31 then + if a1 then name = a1 else name = altname end + else + operands[n-1] = nil + name = a2 + end + end + end + elseif p == "W" then + x = band(rshift(op, 5), 0xffff) + elseif p == "Y" then + x = band(rshift(op, 5), 0xffff) + local hw = band(rshift(op, 21), 3) + if altname and (hw == 0 or x ~= 0) then + name = altname + end + elseif p == "L" then + local rn = map_regs.x[band(rshift(op, 5), 31)] + local imm9 = arshift(lshift(op, 11), 23) + if band(op, 0x800) ~= 0 then + x = "["..rn..", #"..imm9.."]!" + else + x = "["..rn.."], #"..imm9 + end + elseif p == "U" then + local rn = map_regs.x[band(rshift(op, 5), 31)] + local sz = band(rshift(op, 30), 3) + local imm12 = lshift(arshift(lshift(op, 10), 20), sz) + if imm12 ~= 0 then + x = "["..rn..", #"..imm12.."]" + else + x = "["..rn.."]" + end + elseif p == "K" then + local rn = map_regs.x[band(rshift(op, 5), 31)] + local imm9 = arshift(lshift(op, 11), 23) + if imm9 ~= 0 then + x = "["..rn..", #"..imm9.."]" + else + x = "["..rn.."]" + end + elseif p == "O" then + local rn, rm = map_regs.x[band(rshift(op, 5), 31)] + local m = band(rshift(op, 13), 1) + if m == 0 then + rm = map_regs.w[band(rshift(op, 16), 31)] + else + rm = map_regs.x[band(rshift(op, 16), 31)] + end + x = "["..rn..", "..rm + local opt = band(rshift(op, 13), 7) + local s = band(rshift(op, 12), 1) + local sz = band(rshift(op, 30), 3) + -- extension to be applied + if opt == 3 then + if s == 0 then x = x.."]" + else x = x..", lsl #"..sz.."]" end + elseif opt == 2 or opt == 6 or opt == 7 then + if s == 0 then x = x..", "..map_extend[opt].."]" + else x = x..", "..map_extend[opt].." #"..sz.."]" end + else + x = x.."]" + end + elseif p == "P" then + local opcv, sh = rshift(op, 26), 2 + if opcv >= 0x2a then sh = 4 elseif opcv >= 0x1b then sh = 3 end + local imm7 = lshift(arshift(lshift(op, 10), 25), sh) + local rn = map_regs.x[band(rshift(op, 5), 31)] + local ind = band(rshift(op, 23), 3) + if ind == 1 then + x = "["..rn.."], #"..imm7 + elseif ind == 2 then + if imm7 == 0 then + x = "["..rn.."]" + else + x = "["..rn..", #"..imm7.."]" + end + elseif ind == 3 then + x = "["..rn..", #"..imm7.."]!" + end + elseif p == "I" then + local shf = band(rshift(op, 22), 3) + local imm12 = band(rshift(op, 10), 0x0fff) + local rn, rd = band(rshift(op, 5), 31), band(op, 31) + if altname == "mov" and shf == 0 and imm12 == 0 and (rn == 31 or rd == 31) then + name = altname + x = nil + elseif shf == 0 then + x = imm12 + elseif shf == 1 then + x = imm12..", lsl #12" + end + elseif p == "i" then + x = "#0x"..decode_imm13(op) + elseif p == "1" then + immr = band(rshift(op, 16), 63) + x = immr + elseif p == "2" then + x = band(rshift(op, 10), 63) + if altname then + local a1, a2, a3, a4, a5, a6 = + match(altname, "([^|]*)|([^|]*)|([^|]*)|([^|]*)|([^|]*)|(.*)") + local sf = band(rshift(op, 26), 32) + local uns = band(rshift(op, 30), 1) + if prefer_bfx(sf, uns, x, immr) then + name = a2 + x = x - immr + 1 + elseif immr == 0 and x == 7 then + local n = #operands + operands[n] = nil + if sf ~= 0 then + operands[n-1] = gsub(operands[n-1], "x", "w") + end + last = operands[n-1] + name = a6 + x = nil + elseif immr == 0 and x == 15 then + local n = #operands + operands[n] = nil + if sf ~= 0 then + operands[n-1] = gsub(operands[n-1], "x", "w") + end + last = operands[n-1] + name = a5 + x = nil + elseif x == 31 or x == 63 then + if x == 31 and immr == 0 and name == "sbfm" then + name = a4 + local n = #operands + operands[n] = nil + if sf ~= 0 then + operands[n-1] = gsub(operands[n-1], "x", "w") + end + last = operands[n-1] + else + name = a3 + end + x = nil + elseif band(x, 31) ~= 31 and immr == x+1 and name == "ubfm" then + name = a4 + last = "#"..(sf+32 - immr) + operands[#operands] = last + x = nil + elseif x < immr then + name = a1 + last = "#"..(sf+32 - immr) + operands[#operands] = last + x = x + 1 + end + end + elseif p == "3" then + x = band(rshift(op, 10), 63) + if altname then + local a1, a2 = match(altname, "([^|]*)|(.*)") + if x < immr then + name = a1 + local sf = band(rshift(op, 26), 32) + last = "#"..(sf+32 - immr) + operands[#operands] = last + x = x + 1 + elseif x >= immr then + name = a2 + x = x - immr + 1 + end + end + elseif p == "4" then + x = band(rshift(op, 10), 63) + local rn = band(rshift(op, 5), 31) + local rm = band(rshift(op, 16), 31) + if altname and rn == rm then + local n = #operands + operands[n] = nil + last = operands[n-1] + name = altname + end + elseif p == "5" then + x = band(rshift(op, 16), 31) + elseif p == "S" then + x = band(rshift(op, 10), 63) + if x == 0 then x = nil + else x = map_shift[band(rshift(op, 22), 3)].." #"..x end + elseif p == "X" then + local opt = band(rshift(op, 13), 7) + -- Width specifier . + if opt ~= 3 and opt ~= 7 then + last = map_regs.w[band(rshift(op, 16), 31)] + operands[#operands] = last + end + x = band(rshift(op, 10), 7) + -- Extension. + if opt == 2 + band(rshift(op, 31), 1) and + band(rshift(op, second0 and 5 or 0), 31) == 31 then + if x == 0 then x = nil + else x = "lsl #"..x end + else + if x == 0 then x = map_extend[band(rshift(op, 13), 7)] + else x = map_extend[band(rshift(op, 13), 7)].." #"..x end + end + elseif p == "R" then + x = band(rshift(op,21), 3) + if x == 0 then x = nil + else x = "lsl #"..x*16 end + elseif p == "z" then + local n = #operands + if operands[n] == "sp" then operands[n] = "xzr" + elseif operands[n] == "wsp" then operands[n] = "wzr" + end + elseif p == "Z" then + x = 0 + elseif p == "F" then + x = parse_fpimm8(op) + elseif p == "g" or p == "f" or p == "x" or p == "w" or + p == "d" or p == "s" then + -- These are handled in D/N/M/A. + elseif p == "0" then + if last == "sp" or last == "wsp" then + local n = #operands + operands[n] = nil + last = operands[n-1] + if altname then + local a1, a2 = match(altname, "([^|]*)|(.*)") + if not a1 then + name = altname + elseif second0 then + name, altname = a2, a1 + else + name, altname = a1, a2 + end + end + end + second0 = true + else + assert(false) + end + if x then + last = x + if type(x) == "number" then x = "#"..x end + operands[#operands+1] = x + end + end + + return putop(ctx, name..suffix, operands) +end + +------------------------------------------------------------------------------ + +-- Disassemble a block of code. +local function disass_block(ctx, ofs, len) + if not ofs then ofs = 0 end + local stop = len and ofs+len or #ctx.code + ctx.pos = ofs + ctx.rel = nil + while ctx.pos < stop do disass_ins(ctx) end +end + +-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len). +local function create(code, addr, out) + local ctx = {} + ctx.code = code + ctx.addr = addr or 0 + ctx.out = out or io.write + ctx.symtab = {} + ctx.disass = disass_block + ctx.hexdump = 8 + return ctx +end + +-- Simple API: disassemble code (a string) at address and output via out. +local function disass(code, addr, out) + create(code, addr, out):disass() +end + +-- Return register name for RID. +local function regname(r) + if r < 32 then return map_regs.x[r] end + return map_regs.d[r-32] +end + +-- Public module functions. +return { + create = create, + disass = disass, + regname = regname +} + diff --git a/Assets/LuaFramework/ToLua/Lua/jit/dis_arm64.lua.meta b/Assets/LuaFramework/ToLua/Lua/jit/dis_arm64.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..c3795ff007fb1a1278165385fe56358192da3c0d --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/dis_arm64.lua.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b4d4c9abbcac24849b38a339a3bf4529 +timeCreated: 1494052836 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Lua/jit/dis_arm64be.lua b/Assets/LuaFramework/ToLua/Lua/jit/dis_arm64be.lua new file mode 100644 index 0000000000000000000000000000000000000000..7eb389e2fa597224c9b66b5029de41705c725ad4 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/dis_arm64be.lua @@ -0,0 +1,12 @@ +---------------------------------------------------------------------------- +-- LuaJIT ARM64BE disassembler wrapper module. +-- +-- Copyright (C) 2005-2017 Mike Pall. All rights reserved. +-- Released under the MIT license. See Copyright Notice in luajit.h +---------------------------------------------------------------------------- +-- ARM64 instructions are always little-endian. So just forward to the +-- common ARM64 disassembler module. All the interesting stuff is there. +------------------------------------------------------------------------------ + +return require((string.match(..., ".*%.") or "").."dis_arm64") + diff --git a/Assets/LuaFramework/ToLua/Lua/jit/dis_arm64be.lua.meta b/Assets/LuaFramework/ToLua/Lua/jit/dis_arm64be.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..48eadc9610fe592a699ad0edd50d56802793b50b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/dis_arm64be.lua.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9743f232842733e4c9e3b478b8adbffd +timeCreated: 1494052836 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Lua/jit/dis_mips.lua b/Assets/LuaFramework/ToLua/Lua/jit/dis_mips.lua new file mode 100644 index 0000000000000000000000000000000000000000..a12b8e62f3b532cf3e0a462ed69af9b5a1a3e044 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/dis_mips.lua @@ -0,0 +1,443 @@ +---------------------------------------------------------------------------- +-- LuaJIT MIPS disassembler module. +-- +-- Copyright (C) 2005-2017 Mike Pall. All rights reserved. +-- Released under the MIT/X license. See Copyright Notice in luajit.h +---------------------------------------------------------------------------- +-- This is a helper module used by the LuaJIT machine code dumper module. +-- +-- It disassembles all standard MIPS32R1/R2 instructions. +-- Default mode is big-endian, but see: dis_mipsel.lua +------------------------------------------------------------------------------ + +local type = type +local byte, format = string.byte, string.format +local match, gmatch = string.match, string.gmatch +local concat = table.concat +local bit = require("bit") +local band, bor, tohex = bit.band, bit.bor, bit.tohex +local lshift, rshift, arshift = bit.lshift, bit.rshift, bit.arshift + +------------------------------------------------------------------------------ +-- Primary and extended opcode maps +------------------------------------------------------------------------------ + +local map_movci = { shift = 16, mask = 1, [0] = "movfDSC", "movtDSC", } +local map_srl = { shift = 21, mask = 1, [0] = "srlDTA", "rotrDTA", } +local map_srlv = { shift = 6, mask = 1, [0] = "srlvDTS", "rotrvDTS", } + +local map_special = { + shift = 0, mask = 63, + [0] = { shift = 0, mask = -1, [0] = "nop", _ = "sllDTA" }, + map_movci, map_srl, "sraDTA", + "sllvDTS", false, map_srlv, "sravDTS", + "jrS", "jalrD1S", "movzDST", "movnDST", + "syscallY", "breakY", false, "sync", + "mfhiD", "mthiS", "mfloD", "mtloS", + "dsllvDST", false, "dsrlvDST", "dsravDST", + "multST", "multuST", "divST", "divuST", + "dmultST", "dmultuST", "ddivST", "ddivuST", + "addDST", "addu|moveDST0", "subDST", "subu|neguDS0T", + "andDST", "or|moveDST0", "xorDST", "nor|notDST0", + false, false, "sltDST", "sltuDST", + "daddDST", "dadduDST", "dsubDST", "dsubuDST", + "tgeSTZ", "tgeuSTZ", "tltSTZ", "tltuSTZ", + "teqSTZ", false, "tneSTZ", false, + "dsllDTA", false, "dsrlDTA", "dsraDTA", + "dsll32DTA", false, "dsrl32DTA", "dsra32DTA", +} + +local map_special2 = { + shift = 0, mask = 63, + [0] = "maddST", "madduST", "mulDST", false, + "msubST", "msubuST", + [32] = "clzDS", [33] = "cloDS", + [63] = "sdbbpY", +} + +local map_bshfl = { + shift = 6, mask = 31, + [2] = "wsbhDT", + [16] = "sebDT", + [24] = "sehDT", +} + +local map_dbshfl = { + shift = 6, mask = 31, + [2] = "dsbhDT", + [5] = "dshdDT", +} + +local map_special3 = { + shift = 0, mask = 63, + [0] = "extTSAK", [1] = "dextmTSAP", [3] = "dextTSAK", + [4] = "insTSAL", [6] = "dinsuTSEQ", [7] = "dinsTSAL", + [32] = map_bshfl, [36] = map_dbshfl, [59] = "rdhwrTD", +} + +local map_regimm = { + shift = 16, mask = 31, + [0] = "bltzSB", "bgezSB", "bltzlSB", "bgezlSB", + false, false, false, false, + "tgeiSI", "tgeiuSI", "tltiSI", "tltiuSI", + "teqiSI", false, "tneiSI", false, + "bltzalSB", "bgezalSB", "bltzallSB", "bgezallSB", + false, false, false, false, + false, false, false, false, + false, false, false, "synciSO", +} + +local map_cop0 = { + shift = 25, mask = 1, + [0] = { + shift = 21, mask = 15, + [0] = "mfc0TDW", [4] = "mtc0TDW", + [10] = "rdpgprDT", + [11] = { shift = 5, mask = 1, [0] = "diT0", "eiT0", }, + [14] = "wrpgprDT", + }, { + shift = 0, mask = 63, + [1] = "tlbr", [2] = "tlbwi", [6] = "tlbwr", [8] = "tlbp", + [24] = "eret", [31] = "deret", + [32] = "wait", + }, +} + +local map_cop1s = { + shift = 0, mask = 63, + [0] = "add.sFGH", "sub.sFGH", "mul.sFGH", "div.sFGH", + "sqrt.sFG", "abs.sFG", "mov.sFG", "neg.sFG", + "round.l.sFG", "trunc.l.sFG", "ceil.l.sFG", "floor.l.sFG", + "round.w.sFG", "trunc.w.sFG", "ceil.w.sFG", "floor.w.sFG", + false, + { shift = 16, mask = 1, [0] = "movf.sFGC", "movt.sFGC" }, + "movz.sFGT", "movn.sFGT", + false, "recip.sFG", "rsqrt.sFG", false, + false, false, false, false, + false, false, false, false, + false, "cvt.d.sFG", false, false, + "cvt.w.sFG", "cvt.l.sFG", "cvt.ps.sFGH", false, + false, false, false, false, + false, false, false, false, + "c.f.sVGH", "c.un.sVGH", "c.eq.sVGH", "c.ueq.sVGH", + "c.olt.sVGH", "c.ult.sVGH", "c.ole.sVGH", "c.ule.sVGH", + "c.sf.sVGH", "c.ngle.sVGH", "c.seq.sVGH", "c.ngl.sVGH", + "c.lt.sVGH", "c.nge.sVGH", "c.le.sVGH", "c.ngt.sVGH", +} + +local map_cop1d = { + shift = 0, mask = 63, + [0] = "add.dFGH", "sub.dFGH", "mul.dFGH", "div.dFGH", + "sqrt.dFG", "abs.dFG", "mov.dFG", "neg.dFG", + "round.l.dFG", "trunc.l.dFG", "ceil.l.dFG", "floor.l.dFG", + "round.w.dFG", "trunc.w.dFG", "ceil.w.dFG", "floor.w.dFG", + false, + { shift = 16, mask = 1, [0] = "movf.dFGC", "movt.dFGC" }, + "movz.dFGT", "movn.dFGT", + false, "recip.dFG", "rsqrt.dFG", false, + false, false, false, false, + false, false, false, false, + "cvt.s.dFG", false, false, false, + "cvt.w.dFG", "cvt.l.dFG", false, false, + false, false, false, false, + false, false, false, false, + "c.f.dVGH", "c.un.dVGH", "c.eq.dVGH", "c.ueq.dVGH", + "c.olt.dVGH", "c.ult.dVGH", "c.ole.dVGH", "c.ule.dVGH", + "c.df.dVGH", "c.ngle.dVGH", "c.deq.dVGH", "c.ngl.dVGH", + "c.lt.dVGH", "c.nge.dVGH", "c.le.dVGH", "c.ngt.dVGH", +} + +local map_cop1ps = { + shift = 0, mask = 63, + [0] = "add.psFGH", "sub.psFGH", "mul.psFGH", false, + false, "abs.psFG", "mov.psFG", "neg.psFG", + false, false, false, false, + false, false, false, false, + false, + { shift = 16, mask = 1, [0] = "movf.psFGC", "movt.psFGC" }, + "movz.psFGT", "movn.psFGT", + false, false, false, false, + false, false, false, false, + false, false, false, false, + "cvt.s.puFG", false, false, false, + false, false, false, false, + "cvt.s.plFG", false, false, false, + "pll.psFGH", "plu.psFGH", "pul.psFGH", "puu.psFGH", + "c.f.psVGH", "c.un.psVGH", "c.eq.psVGH", "c.ueq.psVGH", + "c.olt.psVGH", "c.ult.psVGH", "c.ole.psVGH", "c.ule.psVGH", + "c.psf.psVGH", "c.ngle.psVGH", "c.pseq.psVGH", "c.ngl.psVGH", + "c.lt.psVGH", "c.nge.psVGH", "c.le.psVGH", "c.ngt.psVGH", +} + +local map_cop1w = { + shift = 0, mask = 63, + [32] = "cvt.s.wFG", [33] = "cvt.d.wFG", +} + +local map_cop1l = { + shift = 0, mask = 63, + [32] = "cvt.s.lFG", [33] = "cvt.d.lFG", +} + +local map_cop1bc = { + shift = 16, mask = 3, + [0] = "bc1fCB", "bc1tCB", "bc1flCB", "bc1tlCB", +} + +local map_cop1 = { + shift = 21, mask = 31, + [0] = "mfc1TG", "dmfc1TG", "cfc1TG", "mfhc1TG", + "mtc1TG", "dmtc1TG", "ctc1TG", "mthc1TG", + map_cop1bc, false, false, false, + false, false, false, false, + map_cop1s, map_cop1d, false, false, + map_cop1w, map_cop1l, map_cop1ps, +} + +local map_cop1x = { + shift = 0, mask = 63, + [0] = "lwxc1FSX", "ldxc1FSX", false, false, + false, "luxc1FSX", false, false, + "swxc1FSX", "sdxc1FSX", false, false, + false, "suxc1FSX", false, "prefxMSX", + false, false, false, false, + false, false, false, false, + false, false, false, false, + false, false, "alnv.psFGHS", false, + "madd.sFRGH", "madd.dFRGH", false, false, + false, false, "madd.psFRGH", false, + "msub.sFRGH", "msub.dFRGH", false, false, + false, false, "msub.psFRGH", false, + "nmadd.sFRGH", "nmadd.dFRGH", false, false, + false, false, "nmadd.psFRGH", false, + "nmsub.sFRGH", "nmsub.dFRGH", false, false, + false, false, "nmsub.psFRGH", false, +} + +local map_pri = { + [0] = map_special, map_regimm, "jJ", "jalJ", + "beq|beqz|bST00B", "bne|bnezST0B", "blezSB", "bgtzSB", + "addiTSI", "addiu|liTS0I", "sltiTSI", "sltiuTSI", + "andiTSU", "ori|liTS0U", "xoriTSU", "luiTU", + map_cop0, map_cop1, false, map_cop1x, + "beql|beqzlST0B", "bnel|bnezlST0B", "blezlSB", "bgtzlSB", + "daddiTSI", "daddiuTSI", false, false, + map_special2, "jalxJ", false, map_special3, + "lbTSO", "lhTSO", "lwlTSO", "lwTSO", + "lbuTSO", "lhuTSO", "lwrTSO", false, + "sbTSO", "shTSO", "swlTSO", "swTSO", + false, false, "swrTSO", "cacheNSO", + "llTSO", "lwc1HSO", "lwc2TSO", "prefNSO", + false, "ldc1HSO", "ldc2TSO", "ldTSO", + "scTSO", "swc1HSO", "swc2TSO", false, + false, "sdc1HSO", "sdc2TSO", "sdTSO", +} + +------------------------------------------------------------------------------ + +local map_gpr = { + [0] = "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", + "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", + "r24", "r25", "r26", "r27", "r28", "sp", "r30", "ra", +} + +------------------------------------------------------------------------------ + +-- Output a nicely formatted line with an opcode and operands. +local function putop(ctx, text, operands) + local pos = ctx.pos + local extra = "" + if ctx.rel then + local sym = ctx.symtab[ctx.rel] + if sym then extra = "\t->"..sym end + end + if ctx.hexdump > 0 then + ctx.out(format("%08x %s %-7s %s%s\n", + ctx.addr+pos, tohex(ctx.op), text, concat(operands, ", "), extra)) + else + ctx.out(format("%08x %-7s %s%s\n", + ctx.addr+pos, text, concat(operands, ", "), extra)) + end + ctx.pos = pos + 4 +end + +-- Fallback for unknown opcodes. +local function unknown(ctx) + return putop(ctx, ".long", { "0x"..tohex(ctx.op) }) +end + +local function get_be(ctx) + local pos = ctx.pos + local b0, b1, b2, b3 = byte(ctx.code, pos+1, pos+4) + return bor(lshift(b0, 24), lshift(b1, 16), lshift(b2, 8), b3) +end + +local function get_le(ctx) + local pos = ctx.pos + local b0, b1, b2, b3 = byte(ctx.code, pos+1, pos+4) + return bor(lshift(b3, 24), lshift(b2, 16), lshift(b1, 8), b0) +end + +-- Disassemble a single instruction. +local function disass_ins(ctx) + local op = ctx:get() + local operands = {} + local last = nil + ctx.op = op + ctx.rel = nil + + local opat = map_pri[rshift(op, 26)] + while type(opat) ~= "string" do + if not opat then return unknown(ctx) end + opat = opat[band(rshift(op, opat.shift), opat.mask)] or opat._ + end + local name, pat = match(opat, "^([a-z0-9_.]*)(.*)") + local altname, pat2 = match(pat, "|([a-z0-9_.|]*)(.*)") + if altname then pat = pat2 end + + for p in gmatch(pat, ".") do + local x = nil + if p == "S" then + x = map_gpr[band(rshift(op, 21), 31)] + elseif p == "T" then + x = map_gpr[band(rshift(op, 16), 31)] + elseif p == "D" then + x = map_gpr[band(rshift(op, 11), 31)] + elseif p == "F" then + x = "f"..band(rshift(op, 6), 31) + elseif p == "G" then + x = "f"..band(rshift(op, 11), 31) + elseif p == "H" then + x = "f"..band(rshift(op, 16), 31) + elseif p == "R" then + x = "f"..band(rshift(op, 21), 31) + elseif p == "A" then + x = band(rshift(op, 6), 31) + elseif p == "E" then + x = band(rshift(op, 6), 31) + 32 + elseif p == "M" then + x = band(rshift(op, 11), 31) + elseif p == "N" then + x = band(rshift(op, 16), 31) + elseif p == "C" then + x = band(rshift(op, 18), 7) + if x == 0 then x = nil end + elseif p == "K" then + x = band(rshift(op, 11), 31) + 1 + elseif p == "P" then + x = band(rshift(op, 11), 31) + 33 + elseif p == "L" then + x = band(rshift(op, 11), 31) - last + 1 + elseif p == "Q" then + x = band(rshift(op, 11), 31) - last + 33 + elseif p == "I" then + x = arshift(lshift(op, 16), 16) + elseif p == "U" then + x = band(op, 0xffff) + elseif p == "O" then + local disp = arshift(lshift(op, 16), 16) + operands[#operands] = format("%d(%s)", disp, last) + elseif p == "X" then + local index = map_gpr[band(rshift(op, 16), 31)] + operands[#operands] = format("%s(%s)", index, last) + elseif p == "B" then + x = ctx.addr + ctx.pos + arshift(lshift(op, 16), 16)*4 + 4 + ctx.rel = x + x = format("0x%08x", x) + elseif p == "J" then + local a = ctx.addr + ctx.pos + x = a - band(a, 0x0fffffff) + band(op, 0x03ffffff)*4 + ctx.rel = x + x = format("0x%08x", x) + elseif p == "V" then + x = band(rshift(op, 8), 7) + if x == 0 then x = nil end + elseif p == "W" then + x = band(op, 7) + if x == 0 then x = nil end + elseif p == "Y" then + x = band(rshift(op, 6), 0x000fffff) + if x == 0 then x = nil end + elseif p == "Z" then + x = band(rshift(op, 6), 1023) + if x == 0 then x = nil end + elseif p == "0" then + if last == "r0" or last == 0 then + local n = #operands + operands[n] = nil + last = operands[n-1] + if altname then + local a1, a2 = match(altname, "([^|]*)|(.*)") + if a1 then name, altname = a1, a2 + else name = altname end + end + end + elseif p == "1" then + if last == "ra" then + operands[#operands] = nil + end + else + assert(false) + end + if x then operands[#operands+1] = x; last = x end + end + + return putop(ctx, name, operands) +end + +------------------------------------------------------------------------------ + +-- Disassemble a block of code. +local function disass_block(ctx, ofs, len) + if not ofs then ofs = 0 end + local stop = len and ofs+len or #ctx.code + stop = stop - stop % 4 + ctx.pos = ofs - ofs % 4 + ctx.rel = nil + while ctx.pos < stop do disass_ins(ctx) end +end + +-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len). +local function create(code, addr, out) + local ctx = {} + ctx.code = code + ctx.addr = addr or 0 + ctx.out = out or io.write + ctx.symtab = {} + ctx.disass = disass_block + ctx.hexdump = 8 + ctx.get = get_be + return ctx +end + +local function create_el(code, addr, out) + local ctx = create(code, addr, out) + ctx.get = get_le + return ctx +end + +-- Simple API: disassemble code (a string) at address and output via out. +local function disass(code, addr, out) + create(code, addr, out):disass() +end + +local function disass_el(code, addr, out) + create_el(code, addr, out):disass() +end + +-- Return register name for RID. +local function regname(r) + if r < 32 then return map_gpr[r] end + return "f"..(r-32) +end + +-- Public module functions. +return { + create = create, + create_el = create_el, + disass = disass, + disass_el = disass_el, + regname = regname +} + diff --git a/Assets/LuaFramework/ToLua/Lua/jit/dis_mips.lua.meta b/Assets/LuaFramework/ToLua/Lua/jit/dis_mips.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..c30888f50adab418877c680fe2b7012253fce9c3 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/dis_mips.lua.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 24d7d1c35dd3f7b4e8b37409571d4a8d +timeCreated: 1492692752 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Lua/jit/dis_mips64.lua b/Assets/LuaFramework/ToLua/Lua/jit/dis_mips64.lua new file mode 100644 index 0000000000000000000000000000000000000000..c4374928ab5f06b6758c35c8f37527e938463e31 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/dis_mips64.lua @@ -0,0 +1,17 @@ +---------------------------------------------------------------------------- +-- LuaJIT MIPS64 disassembler wrapper module. +-- +-- Copyright (C) 2005-2017 Mike Pall. All rights reserved. +-- Released under the MIT license. See Copyright Notice in luajit.h +---------------------------------------------------------------------------- +-- This module just exports the big-endian functions from the +-- MIPS disassembler module. All the interesting stuff is there. +------------------------------------------------------------------------------ + +local dis_mips = require((string.match(..., ".*%.") or "").."dis_mips") +return { + create = dis_mips.create, + disass = dis_mips.disass, + regname = dis_mips.regname +} + diff --git a/Assets/LuaFramework/ToLua/Lua/jit/dis_mips64.lua.meta b/Assets/LuaFramework/ToLua/Lua/jit/dis_mips64.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..aa2110cd42065a5cb36fb3a2df3fa891d29c975c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/dis_mips64.lua.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 45cd531eacd4e694585cb017ffc7df14 +timeCreated: 1494052836 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Lua/jit/dis_mips64el.lua b/Assets/LuaFramework/ToLua/Lua/jit/dis_mips64el.lua new file mode 100644 index 0000000000000000000000000000000000000000..2b1470af505f0b29ac28c33b56ed02bab698b968 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/dis_mips64el.lua @@ -0,0 +1,17 @@ +---------------------------------------------------------------------------- +-- LuaJIT MIPS64EL disassembler wrapper module. +-- +-- Copyright (C) 2005-2017 Mike Pall. All rights reserved. +-- Released under the MIT license. See Copyright Notice in luajit.h +---------------------------------------------------------------------------- +-- This module just exports the little-endian functions from the +-- MIPS disassembler module. All the interesting stuff is there. +------------------------------------------------------------------------------ + +local dis_mips = require((string.match(..., ".*%.") or "").."dis_mips") +return { + create = dis_mips.create_el, + disass = dis_mips.disass_el, + regname = dis_mips.regname +} + diff --git a/Assets/LuaFramework/ToLua/Lua/jit/dis_mips64el.lua.meta b/Assets/LuaFramework/ToLua/Lua/jit/dis_mips64el.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..d38ec18886eed670a4e9df017740f0deed6f8157 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/dis_mips64el.lua.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c933838018073f44d8b9cb738c3ef6f8 +timeCreated: 1494052836 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Lua/jit/dis_mipsel.lua b/Assets/LuaFramework/ToLua/Lua/jit/dis_mipsel.lua new file mode 100644 index 0000000000000000000000000000000000000000..f69b11f01fdd474a7ceb1688b3ca54dd99ce6f49 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/dis_mipsel.lua @@ -0,0 +1,17 @@ +---------------------------------------------------------------------------- +-- LuaJIT MIPSEL disassembler wrapper module. +-- +-- Copyright (C) 2005-2017 Mike Pall. All rights reserved. +-- Released under the MIT license. See Copyright Notice in luajit.h +---------------------------------------------------------------------------- +-- This module just exports the little-endian functions from the +-- MIPS disassembler module. All the interesting stuff is there. +------------------------------------------------------------------------------ + +local dis_mips = require((string.match(..., ".*%.") or "").."dis_mips") +return { + create = dis_mips.create_el, + disass = dis_mips.disass_el, + regname = dis_mips.regname +} + diff --git a/Assets/LuaFramework/ToLua/Lua/jit/dis_mipsel.lua.meta b/Assets/LuaFramework/ToLua/Lua/jit/dis_mipsel.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..6a5722190f07e170a1742c5b409cde62ddc5f7b3 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/dis_mipsel.lua.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7b8e829ec84bb8e4f8b56474c9812d02 +timeCreated: 1492692752 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Lua/jit/dis_ppc.lua b/Assets/LuaFramework/ToLua/Lua/jit/dis_ppc.lua new file mode 100644 index 0000000000000000000000000000000000000000..2aeb1b29244c99a3964c394ede8e6d6696813c13 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/dis_ppc.lua @@ -0,0 +1,591 @@ +---------------------------------------------------------------------------- +-- LuaJIT PPC disassembler module. +-- +-- Copyright (C) 2005-2017 Mike Pall. All rights reserved. +-- Released under the MIT/X license. See Copyright Notice in luajit.h +---------------------------------------------------------------------------- +-- This is a helper module used by the LuaJIT machine code dumper module. +-- +-- It disassembles all common, non-privileged 32/64 bit PowerPC instructions +-- plus the e500 SPE instructions and some Cell/Xenon extensions. +-- +-- NYI: VMX, VMX128 +------------------------------------------------------------------------------ + +local type = type +local byte, format = string.byte, string.format +local match, gmatch, gsub = string.match, string.gmatch, string.gsub +local concat = table.concat +local bit = require("bit") +local band, bor, tohex = bit.band, bit.bor, bit.tohex +local lshift, rshift, arshift = bit.lshift, bit.rshift, bit.arshift + +------------------------------------------------------------------------------ +-- Primary and extended opcode maps +------------------------------------------------------------------------------ + +local map_crops = { + shift = 1, mask = 1023, + [0] = "mcrfXX", + [33] = "crnor|crnotCCC=", [129] = "crandcCCC", + [193] = "crxor|crclrCCC%", [225] = "crnandCCC", + [257] = "crandCCC", [289] = "creqv|crsetCCC%", + [417] = "crorcCCC", [449] = "cror|crmoveCCC=", + [16] = "b_lrKB", [528] = "b_ctrKB", + [150] = "isync", +} + +local map_rlwinm = setmetatable({ + shift = 0, mask = -1, +}, +{ __index = function(t, x) + local rot = band(rshift(x, 11), 31) + local mb = band(rshift(x, 6), 31) + local me = band(rshift(x, 1), 31) + if mb == 0 and me == 31-rot then + return "slwiRR~A." + elseif me == 31 and mb == 32-rot then + return "srwiRR~-A." + else + return "rlwinmRR~AAA." + end + end +}) + +local map_rld = { + shift = 2, mask = 7, + [0] = "rldiclRR~HM.", "rldicrRR~HM.", "rldicRR~HM.", "rldimiRR~HM.", + { + shift = 1, mask = 1, + [0] = "rldclRR~RM.", "rldcrRR~RM.", + }, +} + +local map_ext = setmetatable({ + shift = 1, mask = 1023, + + [0] = "cmp_YLRR", [32] = "cmpl_YLRR", + [4] = "twARR", [68] = "tdARR", + + [8] = "subfcRRR.", [40] = "subfRRR.", + [104] = "negRR.", [136] = "subfeRRR.", + [200] = "subfzeRR.", [232] = "subfmeRR.", + [520] = "subfcoRRR.", [552] = "subfoRRR.", + [616] = "negoRR.", [648] = "subfeoRRR.", + [712] = "subfzeoRR.", [744] = "subfmeoRR.", + + [9] = "mulhduRRR.", [73] = "mulhdRRR.", [233] = "mulldRRR.", + [457] = "divduRRR.", [489] = "divdRRR.", + [745] = "mulldoRRR.", + [969] = "divduoRRR.", [1001] = "divdoRRR.", + + [10] = "addcRRR.", [138] = "addeRRR.", + [202] = "addzeRR.", [234] = "addmeRR.", [266] = "addRRR.", + [522] = "addcoRRR.", [650] = "addeoRRR.", + [714] = "addzeoRR.", [746] = "addmeoRR.", [778] = "addoRRR.", + + [11] = "mulhwuRRR.", [75] = "mulhwRRR.", [235] = "mullwRRR.", + [459] = "divwuRRR.", [491] = "divwRRR.", + [747] = "mullwoRRR.", + [971] = "divwouRRR.", [1003] = "divwoRRR.", + + [15] = "iselltRRR", [47] = "iselgtRRR", [79] = "iseleqRRR", + + [144] = { shift = 20, mask = 1, [0] = "mtcrfRZ~", "mtocrfRZ~", }, + [19] = { shift = 20, mask = 1, [0] = "mfcrR", "mfocrfRZ", }, + [371] = { shift = 11, mask = 1023, [392] = "mftbR", [424] = "mftbuR", }, + [339] = { + shift = 11, mask = 1023, + [32] = "mferR", [256] = "mflrR", [288] = "mfctrR", [16] = "mfspefscrR", + }, + [467] = { + shift = 11, mask = 1023, + [32] = "mtxerR", [256] = "mtlrR", [288] = "mtctrR", [16] = "mtspefscrR", + }, + + [20] = "lwarxRR0R", [84] = "ldarxRR0R", + + [21] = "ldxRR0R", [53] = "lduxRRR", + [149] = "stdxRR0R", [181] = "stduxRRR", + [341] = "lwaxRR0R", [373] = "lwauxRRR", + + [23] = "lwzxRR0R", [55] = "lwzuxRRR", + [87] = "lbzxRR0R", [119] = "lbzuxRRR", + [151] = "stwxRR0R", [183] = "stwuxRRR", + [215] = "stbxRR0R", [247] = "stbuxRRR", + [279] = "lhzxRR0R", [311] = "lhzuxRRR", + [343] = "lhaxRR0R", [375] = "lhauxRRR", + [407] = "sthxRR0R", [439] = "sthuxRRR", + + [54] = "dcbst-R0R", [86] = "dcbf-R0R", + [150] = "stwcxRR0R.", [214] = "stdcxRR0R.", + [246] = "dcbtst-R0R", [278] = "dcbt-R0R", + [310] = "eciwxRR0R", [438] = "ecowxRR0R", + [470] = "dcbi-RR", + + [598] = { + shift = 21, mask = 3, + [0] = "sync", "lwsync", "ptesync", + }, + [758] = "dcba-RR", + [854] = "eieio", [982] = "icbi-R0R", [1014] = "dcbz-R0R", + + [26] = "cntlzwRR~", [58] = "cntlzdRR~", + [122] = "popcntbRR~", + [154] = "prtywRR~", [186] = "prtydRR~", + + [28] = "andRR~R.", [60] = "andcRR~R.", [124] = "nor|notRR~R=.", + [284] = "eqvRR~R.", [316] = "xorRR~R.", + [412] = "orcRR~R.", [444] = "or|mrRR~R=.", [476] = "nandRR~R.", + [508] = "cmpbRR~R", + + [512] = "mcrxrX", + + [532] = "ldbrxRR0R", [660] = "stdbrxRR0R", + + [533] = "lswxRR0R", [597] = "lswiRR0A", + [661] = "stswxRR0R", [725] = "stswiRR0A", + + [534] = "lwbrxRR0R", [662] = "stwbrxRR0R", + [790] = "lhbrxRR0R", [918] = "sthbrxRR0R", + + [535] = "lfsxFR0R", [567] = "lfsuxFRR", + [599] = "lfdxFR0R", [631] = "lfduxFRR", + [663] = "stfsxFR0R", [695] = "stfsuxFRR", + [727] = "stfdxFR0R", [759] = "stfduxFR0R", + [855] = "lfiwaxFR0R", + [983] = "stfiwxFR0R", + + [24] = "slwRR~R.", + + [27] = "sldRR~R.", [536] = "srwRR~R.", + [792] = "srawRR~R.", [824] = "srawiRR~A.", + + [794] = "sradRR~R.", [826] = "sradiRR~H.", [827] = "sradiRR~H.", + [922] = "extshRR~.", [954] = "extsbRR~.", [986] = "extswRR~.", + + [539] = "srdRR~R.", +}, +{ __index = function(t, x) + if band(x, 31) == 15 then return "iselRRRC" end + end +}) + +local map_ld = { + shift = 0, mask = 3, + [0] = "ldRRE", "lduRRE", "lwaRRE", +} + +local map_std = { + shift = 0, mask = 3, + [0] = "stdRRE", "stduRRE", +} + +local map_fps = { + shift = 5, mask = 1, + { + shift = 1, mask = 15, + [0] = false, false, "fdivsFFF.", false, + "fsubsFFF.", "faddsFFF.", "fsqrtsF-F.", false, + "fresF-F.", "fmulsFF-F.", "frsqrtesF-F.", false, + "fmsubsFFFF~.", "fmaddsFFFF~.", "fnmsubsFFFF~.", "fnmaddsFFFF~.", + } +} + +local map_fpd = { + shift = 5, mask = 1, + [0] = { + shift = 1, mask = 1023, + [0] = "fcmpuXFF", [32] = "fcmpoXFF", [64] = "mcrfsXX", + [38] = "mtfsb1A.", [70] = "mtfsb0A.", [134] = "mtfsfiA>>-A>", + [8] = "fcpsgnFFF.", [40] = "fnegF-F.", [72] = "fmrF-F.", + [136] = "fnabsF-F.", [264] = "fabsF-F.", + [12] = "frspF-F.", + [14] = "fctiwF-F.", [15] = "fctiwzF-F.", + [583] = "mffsF.", [711] = "mtfsfZF.", + [392] = "frinF-F.", [424] = "frizF-F.", + [456] = "fripF-F.", [488] = "frimF-F.", + [814] = "fctidF-F.", [815] = "fctidzF-F.", [846] = "fcfidF-F.", + }, + { + shift = 1, mask = 15, + [0] = false, false, "fdivFFF.", false, + "fsubFFF.", "faddFFF.", "fsqrtF-F.", "fselFFFF~.", + "freF-F.", "fmulFF-F.", "frsqrteF-F.", false, + "fmsubFFFF~.", "fmaddFFFF~.", "fnmsubFFFF~.", "fnmaddFFFF~.", + } +} + +local map_spe = { + shift = 0, mask = 2047, + + [512] = "evaddwRRR", [514] = "evaddiwRAR~", + [516] = "evsubwRRR~", [518] = "evsubiwRAR~", + [520] = "evabsRR", [521] = "evnegRR", + [522] = "evextsbRR", [523] = "evextshRR", [524] = "evrndwRR", + [525] = "evcntlzwRR", [526] = "evcntlswRR", + + [527] = "brincRRR", + + [529] = "evandRRR", [530] = "evandcRRR", [534] = "evxorRRR", + [535] = "evor|evmrRRR=", [536] = "evnor|evnotRRR=", + [537] = "eveqvRRR", [539] = "evorcRRR", [542] = "evnandRRR", + + [544] = "evsrwuRRR", [545] = "evsrwsRRR", + [546] = "evsrwiuRRA", [547] = "evsrwisRRA", + [548] = "evslwRRR", [550] = "evslwiRRA", + [552] = "evrlwRRR", [553] = "evsplatiRS", + [554] = "evrlwiRRA", [555] = "evsplatfiRS", + [556] = "evmergehiRRR", [557] = "evmergeloRRR", + [558] = "evmergehiloRRR", [559] = "evmergelohiRRR", + + [560] = "evcmpgtuYRR", [561] = "evcmpgtsYRR", + [562] = "evcmpltuYRR", [563] = "evcmpltsYRR", + [564] = "evcmpeqYRR", + + [632] = "evselRRR", [633] = "evselRRRW", + [634] = "evselRRRW", [635] = "evselRRRW", + [636] = "evselRRRW", [637] = "evselRRRW", + [638] = "evselRRRW", [639] = "evselRRRW", + + [640] = "evfsaddRRR", [641] = "evfssubRRR", + [644] = "evfsabsRR", [645] = "evfsnabsRR", [646] = "evfsnegRR", + [648] = "evfsmulRRR", [649] = "evfsdivRRR", + [652] = "evfscmpgtYRR", [653] = "evfscmpltYRR", [654] = "evfscmpeqYRR", + [656] = "evfscfuiR-R", [657] = "evfscfsiR-R", + [658] = "evfscfufR-R", [659] = "evfscfsfR-R", + [660] = "evfsctuiR-R", [661] = "evfsctsiR-R", + [662] = "evfsctufR-R", [663] = "evfsctsfR-R", + [664] = "evfsctuizR-R", [666] = "evfsctsizR-R", + [668] = "evfststgtYRR", [669] = "evfststltYRR", [670] = "evfststeqYRR", + + [704] = "efsaddRRR", [705] = "efssubRRR", + [708] = "efsabsRR", [709] = "efsnabsRR", [710] = "efsnegRR", + [712] = "efsmulRRR", [713] = "efsdivRRR", + [716] = "efscmpgtYRR", [717] = "efscmpltYRR", [718] = "efscmpeqYRR", + [719] = "efscfdR-R", + [720] = "efscfuiR-R", [721] = "efscfsiR-R", + [722] = "efscfufR-R", [723] = "efscfsfR-R", + [724] = "efsctuiR-R", [725] = "efsctsiR-R", + [726] = "efsctufR-R", [727] = "efsctsfR-R", + [728] = "efsctuizR-R", [730] = "efsctsizR-R", + [732] = "efststgtYRR", [733] = "efststltYRR", [734] = "efststeqYRR", + + [736] = "efdaddRRR", [737] = "efdsubRRR", + [738] = "efdcfuidR-R", [739] = "efdcfsidR-R", + [740] = "efdabsRR", [741] = "efdnabsRR", [742] = "efdnegRR", + [744] = "efdmulRRR", [745] = "efddivRRR", + [746] = "efdctuidzR-R", [747] = "efdctsidzR-R", + [748] = "efdcmpgtYRR", [749] = "efdcmpltYRR", [750] = "efdcmpeqYRR", + [751] = "efdcfsR-R", + [752] = "efdcfuiR-R", [753] = "efdcfsiR-R", + [754] = "efdcfufR-R", [755] = "efdcfsfR-R", + [756] = "efdctuiR-R", [757] = "efdctsiR-R", + [758] = "efdctufR-R", [759] = "efdctsfR-R", + [760] = "efdctuizR-R", [762] = "efdctsizR-R", + [764] = "efdtstgtYRR", [765] = "efdtstltYRR", [766] = "efdtsteqYRR", + + [768] = "evlddxRR0R", [769] = "evlddRR8", + [770] = "evldwxRR0R", [771] = "evldwRR8", + [772] = "evldhxRR0R", [773] = "evldhRR8", + [776] = "evlhhesplatxRR0R", [777] = "evlhhesplatRR2", + [780] = "evlhhousplatxRR0R", [781] = "evlhhousplatRR2", + [782] = "evlhhossplatxRR0R", [783] = "evlhhossplatRR2", + [784] = "evlwhexRR0R", [785] = "evlwheRR4", + [788] = "evlwhouxRR0R", [789] = "evlwhouRR4", + [790] = "evlwhosxRR0R", [791] = "evlwhosRR4", + [792] = "evlwwsplatxRR0R", [793] = "evlwwsplatRR4", + [796] = "evlwhsplatxRR0R", [797] = "evlwhsplatRR4", + + [800] = "evstddxRR0R", [801] = "evstddRR8", + [802] = "evstdwxRR0R", [803] = "evstdwRR8", + [804] = "evstdhxRR0R", [805] = "evstdhRR8", + [816] = "evstwhexRR0R", [817] = "evstwheRR4", + [820] = "evstwhoxRR0R", [821] = "evstwhoRR4", + [824] = "evstwwexRR0R", [825] = "evstwweRR4", + [828] = "evstwwoxRR0R", [829] = "evstwwoRR4", + + [1027] = "evmhessfRRR", [1031] = "evmhossfRRR", [1032] = "evmheumiRRR", + [1033] = "evmhesmiRRR", [1035] = "evmhesmfRRR", [1036] = "evmhoumiRRR", + [1037] = "evmhosmiRRR", [1039] = "evmhosmfRRR", [1059] = "evmhessfaRRR", + [1063] = "evmhossfaRRR", [1064] = "evmheumiaRRR", [1065] = "evmhesmiaRRR", + [1067] = "evmhesmfaRRR", [1068] = "evmhoumiaRRR", [1069] = "evmhosmiaRRR", + [1071] = "evmhosmfaRRR", [1095] = "evmwhssfRRR", [1096] = "evmwlumiRRR", + [1100] = "evmwhumiRRR", [1101] = "evmwhsmiRRR", [1103] = "evmwhsmfRRR", + [1107] = "evmwssfRRR", [1112] = "evmwumiRRR", [1113] = "evmwsmiRRR", + [1115] = "evmwsmfRRR", [1127] = "evmwhssfaRRR", [1128] = "evmwlumiaRRR", + [1132] = "evmwhumiaRRR", [1133] = "evmwhsmiaRRR", [1135] = "evmwhsmfaRRR", + [1139] = "evmwssfaRRR", [1144] = "evmwumiaRRR", [1145] = "evmwsmiaRRR", + [1147] = "evmwsmfaRRR", + + [1216] = "evaddusiaawRR", [1217] = "evaddssiaawRR", + [1218] = "evsubfusiaawRR", [1219] = "evsubfssiaawRR", + [1220] = "evmraRR", + [1222] = "evdivwsRRR", [1223] = "evdivwuRRR", + [1224] = "evaddumiaawRR", [1225] = "evaddsmiaawRR", + [1226] = "evsubfumiaawRR", [1227] = "evsubfsmiaawRR", + + [1280] = "evmheusiaawRRR", [1281] = "evmhessiaawRRR", + [1283] = "evmhessfaawRRR", [1284] = "evmhousiaawRRR", + [1285] = "evmhossiaawRRR", [1287] = "evmhossfaawRRR", + [1288] = "evmheumiaawRRR", [1289] = "evmhesmiaawRRR", + [1291] = "evmhesmfaawRRR", [1292] = "evmhoumiaawRRR", + [1293] = "evmhosmiaawRRR", [1295] = "evmhosmfaawRRR", + [1320] = "evmhegumiaaRRR", [1321] = "evmhegsmiaaRRR", + [1323] = "evmhegsmfaaRRR", [1324] = "evmhogumiaaRRR", + [1325] = "evmhogsmiaaRRR", [1327] = "evmhogsmfaaRRR", + [1344] = "evmwlusiaawRRR", [1345] = "evmwlssiaawRRR", + [1352] = "evmwlumiaawRRR", [1353] = "evmwlsmiaawRRR", + [1363] = "evmwssfaaRRR", [1368] = "evmwumiaaRRR", + [1369] = "evmwsmiaaRRR", [1371] = "evmwsmfaaRRR", + [1408] = "evmheusianwRRR", [1409] = "evmhessianwRRR", + [1411] = "evmhessfanwRRR", [1412] = "evmhousianwRRR", + [1413] = "evmhossianwRRR", [1415] = "evmhossfanwRRR", + [1416] = "evmheumianwRRR", [1417] = "evmhesmianwRRR", + [1419] = "evmhesmfanwRRR", [1420] = "evmhoumianwRRR", + [1421] = "evmhosmianwRRR", [1423] = "evmhosmfanwRRR", + [1448] = "evmhegumianRRR", [1449] = "evmhegsmianRRR", + [1451] = "evmhegsmfanRRR", [1452] = "evmhogumianRRR", + [1453] = "evmhogsmianRRR", [1455] = "evmhogsmfanRRR", + [1472] = "evmwlusianwRRR", [1473] = "evmwlssianwRRR", + [1480] = "evmwlumianwRRR", [1481] = "evmwlsmianwRRR", + [1491] = "evmwssfanRRR", [1496] = "evmwumianRRR", + [1497] = "evmwsmianRRR", [1499] = "evmwsmfanRRR", +} + +local map_pri = { + [0] = false, false, "tdiARI", "twiARI", + map_spe, false, false, "mulliRRI", + "subficRRI", false, "cmpl_iYLRU", "cmp_iYLRI", + "addicRRI", "addic.RRI", "addi|liRR0I", "addis|lisRR0I", + "b_KBJ", "sc", "bKJ", map_crops, + "rlwimiRR~AAA.", map_rlwinm, false, "rlwnmRR~RAA.", + "oriNRR~U", "orisRR~U", "xoriRR~U", "xorisRR~U", + "andi.RR~U", "andis.RR~U", map_rld, map_ext, + "lwzRRD", "lwzuRRD", "lbzRRD", "lbzuRRD", + "stwRRD", "stwuRRD", "stbRRD", "stbuRRD", + "lhzRRD", "lhzuRRD", "lhaRRD", "lhauRRD", + "sthRRD", "sthuRRD", "lmwRRD", "stmwRRD", + "lfsFRD", "lfsuFRD", "lfdFRD", "lfduFRD", + "stfsFRD", "stfsuFRD", "stfdFRD", "stfduFRD", + false, false, map_ld, map_fps, + false, false, map_std, map_fpd, +} + +------------------------------------------------------------------------------ + +local map_gpr = { + [0] = "r0", "sp", "r2", "r3", "r4", "r5", "r6", "r7", + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", + "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", + "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", +} + +local map_cond = { [0] = "lt", "gt", "eq", "so", "ge", "le", "ne", "ns", } + +-- Format a condition bit. +local function condfmt(cond) + if cond <= 3 then + return map_cond[band(cond, 3)] + else + return format("4*cr%d+%s", rshift(cond, 2), map_cond[band(cond, 3)]) + end +end + +------------------------------------------------------------------------------ + +-- Output a nicely formatted line with an opcode and operands. +local function putop(ctx, text, operands) + local pos = ctx.pos + local extra = "" + if ctx.rel then + local sym = ctx.symtab[ctx.rel] + if sym then extra = "\t->"..sym end + end + if ctx.hexdump > 0 then + ctx.out(format("%08x %s %-7s %s%s\n", + ctx.addr+pos, tohex(ctx.op), text, concat(operands, ", "), extra)) + else + ctx.out(format("%08x %-7s %s%s\n", + ctx.addr+pos, text, concat(operands, ", "), extra)) + end + ctx.pos = pos + 4 +end + +-- Fallback for unknown opcodes. +local function unknown(ctx) + return putop(ctx, ".long", { "0x"..tohex(ctx.op) }) +end + +-- Disassemble a single instruction. +local function disass_ins(ctx) + local pos = ctx.pos + local b0, b1, b2, b3 = byte(ctx.code, pos+1, pos+4) + local op = bor(lshift(b0, 24), lshift(b1, 16), lshift(b2, 8), b3) + local operands = {} + local last = nil + local rs = 21 + ctx.op = op + ctx.rel = nil + + local opat = map_pri[rshift(b0, 2)] + while type(opat) ~= "string" do + if not opat then return unknown(ctx) end + opat = opat[band(rshift(op, opat.shift), opat.mask)] + end + local name, pat = match(opat, "^([a-z0-9_.]*)(.*)") + local altname, pat2 = match(pat, "|([a-z0-9_.]*)(.*)") + if altname then pat = pat2 end + + for p in gmatch(pat, ".") do + local x = nil + if p == "R" then + x = map_gpr[band(rshift(op, rs), 31)] + rs = rs - 5 + elseif p == "F" then + x = "f"..band(rshift(op, rs), 31) + rs = rs - 5 + elseif p == "A" then + x = band(rshift(op, rs), 31) + rs = rs - 5 + elseif p == "S" then + x = arshift(lshift(op, 27-rs), 27) + rs = rs - 5 + elseif p == "I" then + x = arshift(lshift(op, 16), 16) + elseif p == "U" then + x = band(op, 0xffff) + elseif p == "D" or p == "E" then + local disp = arshift(lshift(op, 16), 16) + if p == "E" then disp = band(disp, -4) end + if last == "r0" then last = "0" end + operands[#operands] = format("%d(%s)", disp, last) + elseif p >= "2" and p <= "8" then + local disp = band(rshift(op, rs), 31) * p + if last == "r0" then last = "0" end + operands[#operands] = format("%d(%s)", disp, last) + elseif p == "H" then + x = band(rshift(op, rs), 31) + lshift(band(op, 2), 4) + rs = rs - 5 + elseif p == "M" then + x = band(rshift(op, rs), 31) + band(op, 0x20) + elseif p == "C" then + x = condfmt(band(rshift(op, rs), 31)) + rs = rs - 5 + elseif p == "B" then + local bo = rshift(op, 21) + local cond = band(rshift(op, 16), 31) + local cn = "" + rs = rs - 10 + if band(bo, 4) == 0 then + cn = band(bo, 2) == 0 and "dnz" or "dz" + if band(bo, 0x10) == 0 then + cn = cn..(band(bo, 8) == 0 and "f" or "t") + end + if band(bo, 0x10) == 0 then x = condfmt(cond) end + name = name..(band(bo, 1) == band(rshift(op, 15), 1) and "-" or "+") + elseif band(bo, 0x10) == 0 then + cn = map_cond[band(cond, 3) + (band(bo, 8) == 0 and 4 or 0)] + if cond > 3 then x = "cr"..rshift(cond, 2) end + name = name..(band(bo, 1) == band(rshift(op, 15), 1) and "-" or "+") + end + name = gsub(name, "_", cn) + elseif p == "J" then + x = arshift(lshift(op, 27-rs), 29-rs)*4 + if band(op, 2) == 0 then x = ctx.addr + pos + x end + ctx.rel = x + x = "0x"..tohex(x) + elseif p == "K" then + if band(op, 1) ~= 0 then name = name.."l" end + if band(op, 2) ~= 0 then name = name.."a" end + elseif p == "X" or p == "Y" then + x = band(rshift(op, rs+2), 7) + if x == 0 and p == "Y" then x = nil else x = "cr"..x end + rs = rs - 5 + elseif p == "W" then + x = "cr"..band(op, 7) + elseif p == "Z" then + x = band(rshift(op, rs-4), 255) + rs = rs - 10 + elseif p == ">" then + operands[#operands] = rshift(operands[#operands], 1) + elseif p == "0" then + if last == "r0" then + operands[#operands] = nil + if altname then name = altname end + end + elseif p == "L" then + name = gsub(name, "_", band(op, 0x00200000) ~= 0 and "d" or "w") + elseif p == "." then + if band(op, 1) == 1 then name = name.."." end + elseif p == "N" then + if op == 0x60000000 then name = "nop"; break end + elseif p == "~" then + local n = #operands + operands[n-1], operands[n] = operands[n], operands[n-1] + elseif p == "=" then + local n = #operands + if last == operands[n-1] then + operands[n] = nil + name = altname + end + elseif p == "%" then + local n = #operands + if last == operands[n-1] and last == operands[n-2] then + operands[n] = nil + operands[n-1] = nil + name = altname + end + elseif p == "-" then + rs = rs - 5 + else + assert(false) + end + if x then operands[#operands+1] = x; last = x end + end + + return putop(ctx, name, operands) +end + +------------------------------------------------------------------------------ + +-- Disassemble a block of code. +local function disass_block(ctx, ofs, len) + if not ofs then ofs = 0 end + local stop = len and ofs+len or #ctx.code + stop = stop - stop % 4 + ctx.pos = ofs - ofs % 4 + ctx.rel = nil + while ctx.pos < stop do disass_ins(ctx) end +end + +-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len). +local function create(code, addr, out) + local ctx = {} + ctx.code = code + ctx.addr = addr or 0 + ctx.out = out or io.write + ctx.symtab = {} + ctx.disass = disass_block + ctx.hexdump = 8 + return ctx +end + +-- Simple API: disassemble code (a string) at address and output via out. +local function disass(code, addr, out) + create(code, addr, out):disass() +end + +-- Return register name for RID. +local function regname(r) + if r < 32 then return map_gpr[r] end + return "f"..(r-32) +end + +-- Public module functions. +return { + create = create, + disass = disass, + regname = regname +} + diff --git a/Assets/LuaFramework/ToLua/Lua/jit/dis_ppc.lua.meta b/Assets/LuaFramework/ToLua/Lua/jit/dis_ppc.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..5e3ab4736b54a05c281b3c52a0e94d6fd7cb7882 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/dis_ppc.lua.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1231975d3fb5f1b4995c9112ea3537f4 +timeCreated: 1492692752 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Lua/jit/dis_x64.lua b/Assets/LuaFramework/ToLua/Lua/jit/dis_x64.lua new file mode 100644 index 0000000000000000000000000000000000000000..d5714ee1f70937727b09c4b7ac630b7499a18b20 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/dis_x64.lua @@ -0,0 +1,17 @@ +---------------------------------------------------------------------------- +-- LuaJIT x64 disassembler wrapper module. +-- +-- Copyright (C) 2005-2017 Mike Pall. All rights reserved. +-- Released under the MIT license. See Copyright Notice in luajit.h +---------------------------------------------------------------------------- +-- This module just exports the 64 bit functions from the combined +-- x86/x64 disassembler module. All the interesting stuff is there. +------------------------------------------------------------------------------ + +local dis_x86 = require((string.match(..., ".*%.") or "").."dis_x86") +return { + create = dis_x86.create64, + disass = dis_x86.disass64, + regname = dis_x86.regname64 +} + diff --git a/Assets/LuaFramework/ToLua/Lua/jit/dis_x64.lua.meta b/Assets/LuaFramework/ToLua/Lua/jit/dis_x64.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..1e92e72338cd30b99ca5faaafa2691f66a51392d --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/dis_x64.lua.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b9997149317d8a6458002e31b320c212 +timeCreated: 1492692752 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Lua/jit/dis_x86.lua b/Assets/LuaFramework/ToLua/Lua/jit/dis_x86.lua new file mode 100644 index 0000000000000000000000000000000000000000..4371233d2b47accba02fb5e4e8c4df63f549eb5c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/dis_x86.lua @@ -0,0 +1,931 @@ +---------------------------------------------------------------------------- +-- LuaJIT x86/x64 disassembler module. +-- +-- Copyright (C) 2005-2017 Mike Pall. All rights reserved. +-- Released under the MIT license. See Copyright Notice in luajit.h +---------------------------------------------------------------------------- +-- This is a helper module used by the LuaJIT machine code dumper module. +-- +-- Sending small code snippets to an external disassembler and mixing the +-- output with our own stuff was too fragile. So I had to bite the bullet +-- and write yet another x86 disassembler. Oh well ... +-- +-- The output format is very similar to what ndisasm generates. But it has +-- been developed independently by looking at the opcode tables from the +-- Intel and AMD manuals. The supported instruction set is quite extensive +-- and reflects what a current generation Intel or AMD CPU implements in +-- 32 bit and 64 bit mode. Yes, this includes MMX, SSE, SSE2, SSE3, SSSE3, +-- SSE4.1, SSE4.2, SSE4a, AVX, AVX2 and even privileged and hypervisor +-- (VMX/SVM) instructions. +-- +-- Notes: +-- * The (useless) a16 prefix, 3DNow and pre-586 opcodes are unsupported. +-- * No attempt at optimization has been made -- it's fast enough for my needs. +------------------------------------------------------------------------------ + +local type = type +local sub, byte, format = string.sub, string.byte, string.format +local match, gmatch, gsub = string.match, string.gmatch, string.gsub +local lower, rep = string.lower, string.rep +local bit = require("bit") +local tohex = bit.tohex + +-- Map for 1st opcode byte in 32 bit mode. Ugly? Well ... read on. +local map_opc1_32 = { +--0x +[0]="addBmr","addVmr","addBrm","addVrm","addBai","addVai","push es","pop es", +"orBmr","orVmr","orBrm","orVrm","orBai","orVai","push cs","opc2*", +--1x +"adcBmr","adcVmr","adcBrm","adcVrm","adcBai","adcVai","push ss","pop ss", +"sbbBmr","sbbVmr","sbbBrm","sbbVrm","sbbBai","sbbVai","push ds","pop ds", +--2x +"andBmr","andVmr","andBrm","andVrm","andBai","andVai","es:seg","daa", +"subBmr","subVmr","subBrm","subVrm","subBai","subVai","cs:seg","das", +--3x +"xorBmr","xorVmr","xorBrm","xorVrm","xorBai","xorVai","ss:seg","aaa", +"cmpBmr","cmpVmr","cmpBrm","cmpVrm","cmpBai","cmpVai","ds:seg","aas", +--4x +"incVR","incVR","incVR","incVR","incVR","incVR","incVR","incVR", +"decVR","decVR","decVR","decVR","decVR","decVR","decVR","decVR", +--5x +"pushUR","pushUR","pushUR","pushUR","pushUR","pushUR","pushUR","pushUR", +"popUR","popUR","popUR","popUR","popUR","popUR","popUR","popUR", +--6x +"sz*pushaw,pusha","sz*popaw,popa","boundVrm","arplWmr", +"fs:seg","gs:seg","o16:","a16", +"pushUi","imulVrmi","pushBs","imulVrms", +"insb","insVS","outsb","outsVS", +--7x +"joBj","jnoBj","jbBj","jnbBj","jzBj","jnzBj","jbeBj","jaBj", +"jsBj","jnsBj","jpeBj","jpoBj","jlBj","jgeBj","jleBj","jgBj", +--8x +"arith!Bmi","arith!Vmi","arith!Bmi","arith!Vms", +"testBmr","testVmr","xchgBrm","xchgVrm", +"movBmr","movVmr","movBrm","movVrm", +"movVmg","leaVrm","movWgm","popUm", +--9x +"nop*xchgVaR|pause|xchgWaR|repne nop","xchgVaR","xchgVaR","xchgVaR", +"xchgVaR","xchgVaR","xchgVaR","xchgVaR", +"sz*cbw,cwde,cdqe","sz*cwd,cdq,cqo","call farViw","wait", +"sz*pushfw,pushf","sz*popfw,popf","sahf","lahf", +--Ax +"movBao","movVao","movBoa","movVoa", +"movsb","movsVS","cmpsb","cmpsVS", +"testBai","testVai","stosb","stosVS", +"lodsb","lodsVS","scasb","scasVS", +--Bx +"movBRi","movBRi","movBRi","movBRi","movBRi","movBRi","movBRi","movBRi", +"movVRI","movVRI","movVRI","movVRI","movVRI","movVRI","movVRI","movVRI", +--Cx +"shift!Bmu","shift!Vmu","retBw","ret","vex*3$lesVrm","vex*2$ldsVrm","movBmi","movVmi", +"enterBwu","leave","retfBw","retf","int3","intBu","into","iretVS", +--Dx +"shift!Bm1","shift!Vm1","shift!Bmc","shift!Vmc","aamBu","aadBu","salc","xlatb", +"fp*0","fp*1","fp*2","fp*3","fp*4","fp*5","fp*6","fp*7", +--Ex +"loopneBj","loopeBj","loopBj","sz*jcxzBj,jecxzBj,jrcxzBj", +"inBau","inVau","outBua","outVua", +"callVj","jmpVj","jmp farViw","jmpBj","inBad","inVad","outBda","outVda", +--Fx +"lock:","int1","repne:rep","rep:","hlt","cmc","testb!Bm","testv!Vm", +"clc","stc","cli","sti","cld","std","incb!Bm","incd!Vm", +} +assert(#map_opc1_32 == 255) + +-- Map for 1st opcode byte in 64 bit mode (overrides only). +local map_opc1_64 = setmetatable({ + [0x06]=false, [0x07]=false, [0x0e]=false, + [0x16]=false, [0x17]=false, [0x1e]=false, [0x1f]=false, + [0x27]=false, [0x2f]=false, [0x37]=false, [0x3f]=false, + [0x60]=false, [0x61]=false, [0x62]=false, [0x63]="movsxdVrDmt", [0x67]="a32:", + [0x40]="rex*", [0x41]="rex*b", [0x42]="rex*x", [0x43]="rex*xb", + [0x44]="rex*r", [0x45]="rex*rb", [0x46]="rex*rx", [0x47]="rex*rxb", + [0x48]="rex*w", [0x49]="rex*wb", [0x4a]="rex*wx", [0x4b]="rex*wxb", + [0x4c]="rex*wr", [0x4d]="rex*wrb", [0x4e]="rex*wrx", [0x4f]="rex*wrxb", + [0x82]=false, [0x9a]=false, [0xc4]="vex*3", [0xc5]="vex*2", [0xce]=false, + [0xd4]=false, [0xd5]=false, [0xd6]=false, [0xea]=false, +}, { __index = map_opc1_32 }) + +-- Map for 2nd opcode byte (0F xx). True CISC hell. Hey, I told you. +-- Prefix dependent MMX/SSE opcodes: (none)|rep|o16|repne, -|F3|66|F2 +local map_opc2 = { +--0x +[0]="sldt!Dmp","sgdt!Ump","larVrm","lslVrm",nil,"syscall","clts","sysret", +"invd","wbinvd",nil,"ud1",nil,"$prefetch!Bm","femms","3dnowMrmu", +--1x +"movupsXrm|movssXrvm|movupdXrm|movsdXrvm", +"movupsXmr|movssXmvr|movupdXmr|movsdXmvr", +"movhlpsXrm$movlpsXrm|movsldupXrm|movlpdXrm|movddupXrm", +"movlpsXmr||movlpdXmr", +"unpcklpsXrvm||unpcklpdXrvm", +"unpckhpsXrvm||unpckhpdXrvm", +"movlhpsXrm$movhpsXrm|movshdupXrm|movhpdXrm", +"movhpsXmr||movhpdXmr", +"$prefetcht!Bm","hintnopVm","hintnopVm","hintnopVm", +"hintnopVm","hintnopVm","hintnopVm","hintnopVm", +--2x +"movUmx$","movUmy$","movUxm$","movUym$","movUmz$",nil,"movUzm$",nil, +"movapsXrm||movapdXrm", +"movapsXmr||movapdXmr", +"cvtpi2psXrMm|cvtsi2ssXrvVmt|cvtpi2pdXrMm|cvtsi2sdXrvVmt", +"movntpsXmr|movntssXmr|movntpdXmr|movntsdXmr", +"cvttps2piMrXm|cvttss2siVrXm|cvttpd2piMrXm|cvttsd2siVrXm", +"cvtps2piMrXm|cvtss2siVrXm|cvtpd2piMrXm|cvtsd2siVrXm", +"ucomissXrm||ucomisdXrm", +"comissXrm||comisdXrm", +--3x +"wrmsr","rdtsc","rdmsr","rdpmc","sysenter","sysexit",nil,"getsec", +"opc3*38",nil,"opc3*3a",nil,nil,nil,nil,nil, +--4x +"cmovoVrm","cmovnoVrm","cmovbVrm","cmovnbVrm", +"cmovzVrm","cmovnzVrm","cmovbeVrm","cmovaVrm", +"cmovsVrm","cmovnsVrm","cmovpeVrm","cmovpoVrm", +"cmovlVrm","cmovgeVrm","cmovleVrm","cmovgVrm", +--5x +"movmskpsVrXm$||movmskpdVrXm$","sqrtpsXrm|sqrtssXrm|sqrtpdXrm|sqrtsdXrm", +"rsqrtpsXrm|rsqrtssXrvm","rcppsXrm|rcpssXrvm", +"andpsXrvm||andpdXrvm","andnpsXrvm||andnpdXrvm", +"orpsXrvm||orpdXrvm","xorpsXrvm||xorpdXrvm", +"addpsXrvm|addssXrvm|addpdXrvm|addsdXrvm","mulpsXrvm|mulssXrvm|mulpdXrvm|mulsdXrvm", +"cvtps2pdXrm|cvtss2sdXrvm|cvtpd2psXrm|cvtsd2ssXrvm", +"cvtdq2psXrm|cvttps2dqXrm|cvtps2dqXrm", +"subpsXrvm|subssXrvm|subpdXrvm|subsdXrvm","minpsXrvm|minssXrvm|minpdXrvm|minsdXrvm", +"divpsXrvm|divssXrvm|divpdXrvm|divsdXrvm","maxpsXrvm|maxssXrvm|maxpdXrvm|maxsdXrvm", +--6x +"punpcklbwPrvm","punpcklwdPrvm","punpckldqPrvm","packsswbPrvm", +"pcmpgtbPrvm","pcmpgtwPrvm","pcmpgtdPrvm","packuswbPrvm", +"punpckhbwPrvm","punpckhwdPrvm","punpckhdqPrvm","packssdwPrvm", +"||punpcklqdqXrvm","||punpckhqdqXrvm", +"movPrVSm","movqMrm|movdquXrm|movdqaXrm", +--7x +"pshufwMrmu|pshufhwXrmu|pshufdXrmu|pshuflwXrmu","pshiftw!Pvmu", +"pshiftd!Pvmu","pshiftq!Mvmu||pshiftdq!Xvmu", +"pcmpeqbPrvm","pcmpeqwPrvm","pcmpeqdPrvm","emms*|", +"vmreadUmr||extrqXmuu$|insertqXrmuu$","vmwriteUrm||extrqXrm$|insertqXrm$", +nil,nil, +"||haddpdXrvm|haddpsXrvm","||hsubpdXrvm|hsubpsXrvm", +"movVSmMr|movqXrm|movVSmXr","movqMmr|movdquXmr|movdqaXmr", +--8x +"joVj","jnoVj","jbVj","jnbVj","jzVj","jnzVj","jbeVj","jaVj", +"jsVj","jnsVj","jpeVj","jpoVj","jlVj","jgeVj","jleVj","jgVj", +--9x +"setoBm","setnoBm","setbBm","setnbBm","setzBm","setnzBm","setbeBm","setaBm", +"setsBm","setnsBm","setpeBm","setpoBm","setlBm","setgeBm","setleBm","setgBm", +--Ax +"push fs","pop fs","cpuid","btVmr","shldVmru","shldVmrc",nil,nil, +"push gs","pop gs","rsm","btsVmr","shrdVmru","shrdVmrc","fxsave!Dmp","imulVrm", +--Bx +"cmpxchgBmr","cmpxchgVmr","$lssVrm","btrVmr", +"$lfsVrm","$lgsVrm","movzxVrBmt","movzxVrWmt", +"|popcntVrm","ud2Dp","bt!Vmu","btcVmr", +"bsfVrm","bsrVrm|lzcntVrm|bsrWrm","movsxVrBmt","movsxVrWmt", +--Cx +"xaddBmr","xaddVmr", +"cmppsXrvmu|cmpssXrvmu|cmppdXrvmu|cmpsdXrvmu","$movntiVmr|", +"pinsrwPrvWmu","pextrwDrPmu", +"shufpsXrvmu||shufpdXrvmu","$cmpxchg!Qmp", +"bswapVR","bswapVR","bswapVR","bswapVR","bswapVR","bswapVR","bswapVR","bswapVR", +--Dx +"||addsubpdXrvm|addsubpsXrvm","psrlwPrvm","psrldPrvm","psrlqPrvm", +"paddqPrvm","pmullwPrvm", +"|movq2dqXrMm|movqXmr|movdq2qMrXm$","pmovmskbVrMm||pmovmskbVrXm", +"psubusbPrvm","psubuswPrvm","pminubPrvm","pandPrvm", +"paddusbPrvm","padduswPrvm","pmaxubPrvm","pandnPrvm", +--Ex +"pavgbPrvm","psrawPrvm","psradPrvm","pavgwPrvm", +"pmulhuwPrvm","pmulhwPrvm", +"|cvtdq2pdXrm|cvttpd2dqXrm|cvtpd2dqXrm","$movntqMmr||$movntdqXmr", +"psubsbPrvm","psubswPrvm","pminswPrvm","porPrvm", +"paddsbPrvm","paddswPrvm","pmaxswPrvm","pxorPrvm", +--Fx +"|||lddquXrm","psllwPrvm","pslldPrvm","psllqPrvm", +"pmuludqPrvm","pmaddwdPrvm","psadbwPrvm","maskmovqMrm||maskmovdquXrm$", +"psubbPrvm","psubwPrvm","psubdPrvm","psubqPrvm", +"paddbPrvm","paddwPrvm","padddPrvm","ud", +} +assert(map_opc2[255] == "ud") + +-- Map for three-byte opcodes. Can't wait for their next invention. +local map_opc3 = { +["38"] = { -- [66] 0f 38 xx +--0x +[0]="pshufbPrvm","phaddwPrvm","phadddPrvm","phaddswPrvm", +"pmaddubswPrvm","phsubwPrvm","phsubdPrvm","phsubswPrvm", +"psignbPrvm","psignwPrvm","psigndPrvm","pmulhrswPrvm", +"||permilpsXrvm","||permilpdXrvm",nil,nil, +--1x +"||pblendvbXrma",nil,nil,nil, +"||blendvpsXrma","||blendvpdXrma","||permpsXrvm","||ptestXrm", +"||broadcastssXrm","||broadcastsdXrm","||broadcastf128XrlXm",nil, +"pabsbPrm","pabswPrm","pabsdPrm",nil, +--2x +"||pmovsxbwXrm","||pmovsxbdXrm","||pmovsxbqXrm","||pmovsxwdXrm", +"||pmovsxwqXrm","||pmovsxdqXrm",nil,nil, +"||pmuldqXrvm","||pcmpeqqXrvm","||$movntdqaXrm","||packusdwXrvm", +"||maskmovpsXrvm","||maskmovpdXrvm","||maskmovpsXmvr","||maskmovpdXmvr", +--3x +"||pmovzxbwXrm","||pmovzxbdXrm","||pmovzxbqXrm","||pmovzxwdXrm", +"||pmovzxwqXrm","||pmovzxdqXrm","||permdXrvm","||pcmpgtqXrvm", +"||pminsbXrvm","||pminsdXrvm","||pminuwXrvm","||pminudXrvm", +"||pmaxsbXrvm","||pmaxsdXrvm","||pmaxuwXrvm","||pmaxudXrvm", +--4x +"||pmulddXrvm","||phminposuwXrm",nil,nil, +nil,"||psrlvVSXrvm","||psravdXrvm","||psllvVSXrvm", +--5x +[0x58] = "||pbroadcastdXrlXm",[0x59] = "||pbroadcastqXrlXm", +[0x5a] = "||broadcasti128XrlXm", +--7x +[0x78] = "||pbroadcastbXrlXm",[0x79] = "||pbroadcastwXrlXm", +--8x +[0x8c] = "||pmaskmovXrvVSm", +[0x8e] = "||pmaskmovVSmXvr", +--Dx +[0xdc] = "||aesencXrvm", [0xdd] = "||aesenclastXrvm", +[0xde] = "||aesdecXrvm", [0xdf] = "||aesdeclastXrvm", +--Fx +[0xf0] = "|||crc32TrBmt",[0xf1] = "|||crc32TrVmt", +[0xf7] = "| sarxVrmv| shlxVrmv| shrxVrmv", +}, + +["3a"] = { -- [66] 0f 3a xx +--0x +[0x00]="||permqXrmu","||permpdXrmu","||pblenddXrvmu",nil, +"||permilpsXrmu","||permilpdXrmu","||perm2f128Xrvmu",nil, +"||roundpsXrmu","||roundpdXrmu","||roundssXrvmu","||roundsdXrvmu", +"||blendpsXrvmu","||blendpdXrvmu","||pblendwXrvmu","palignrPrvmu", +--1x +nil,nil,nil,nil, +"||pextrbVmXru","||pextrwVmXru","||pextrVmSXru","||extractpsVmXru", +"||insertf128XrvlXmu","||extractf128XlXmYru",nil,nil, +nil,nil,nil,nil, +--2x +"||pinsrbXrvVmu","||insertpsXrvmu","||pinsrXrvVmuS",nil, +--3x +[0x38] = "||inserti128Xrvmu",[0x39] = "||extracti128XlXmYru", +--4x +[0x40] = "||dppsXrvmu", +[0x41] = "||dppdXrvmu", +[0x42] = "||mpsadbwXrvmu", +[0x44] = "||pclmulqdqXrvmu", +[0x46] = "||perm2i128Xrvmu", +[0x4a] = "||blendvpsXrvmb",[0x4b] = "||blendvpdXrvmb", +[0x4c] = "||pblendvbXrvmb", +--6x +[0x60] = "||pcmpestrmXrmu",[0x61] = "||pcmpestriXrmu", +[0x62] = "||pcmpistrmXrmu",[0x63] = "||pcmpistriXrmu", +[0xdf] = "||aeskeygenassistXrmu", +--Fx +[0xf0] = "||| rorxVrmu", +}, +} + +-- Map for VMX/SVM opcodes 0F 01 C0-FF (sgdt group with register operands). +local map_opcvm = { +[0xc1]="vmcall",[0xc2]="vmlaunch",[0xc3]="vmresume",[0xc4]="vmxoff", +[0xc8]="monitor",[0xc9]="mwait", +[0xd8]="vmrun",[0xd9]="vmmcall",[0xda]="vmload",[0xdb]="vmsave", +[0xdc]="stgi",[0xdd]="clgi",[0xde]="skinit",[0xdf]="invlpga", +[0xf8]="swapgs",[0xf9]="rdtscp", +} + +-- Map for FP opcodes. And you thought stack machines are simple? +local map_opcfp = { +-- D8-DF 00-BF: opcodes with a memory operand. +-- D8 +[0]="faddFm","fmulFm","fcomFm","fcompFm","fsubFm","fsubrFm","fdivFm","fdivrFm", +"fldFm",nil,"fstFm","fstpFm","fldenvVm","fldcwWm","fnstenvVm","fnstcwWm", +-- DA +"fiaddDm","fimulDm","ficomDm","ficompDm", +"fisubDm","fisubrDm","fidivDm","fidivrDm", +-- DB +"fildDm","fisttpDm","fistDm","fistpDm",nil,"fld twordFmp",nil,"fstp twordFmp", +-- DC +"faddGm","fmulGm","fcomGm","fcompGm","fsubGm","fsubrGm","fdivGm","fdivrGm", +-- DD +"fldGm","fisttpQm","fstGm","fstpGm","frstorDmp",nil,"fnsaveDmp","fnstswWm", +-- DE +"fiaddWm","fimulWm","ficomWm","ficompWm", +"fisubWm","fisubrWm","fidivWm","fidivrWm", +-- DF +"fildWm","fisttpWm","fistWm","fistpWm", +"fbld twordFmp","fildQm","fbstp twordFmp","fistpQm", +-- xx C0-FF: opcodes with a pseudo-register operand. +-- D8 +"faddFf","fmulFf","fcomFf","fcompFf","fsubFf","fsubrFf","fdivFf","fdivrFf", +-- D9 +"fldFf","fxchFf",{"fnop"},nil, +{"fchs","fabs",nil,nil,"ftst","fxam"}, +{"fld1","fldl2t","fldl2e","fldpi","fldlg2","fldln2","fldz"}, +{"f2xm1","fyl2x","fptan","fpatan","fxtract","fprem1","fdecstp","fincstp"}, +{"fprem","fyl2xp1","fsqrt","fsincos","frndint","fscale","fsin","fcos"}, +-- DA +"fcmovbFf","fcmoveFf","fcmovbeFf","fcmovuFf",nil,{nil,"fucompp"},nil,nil, +-- DB +"fcmovnbFf","fcmovneFf","fcmovnbeFf","fcmovnuFf", +{nil,nil,"fnclex","fninit"},"fucomiFf","fcomiFf",nil, +-- DC +"fadd toFf","fmul toFf",nil,nil, +"fsub toFf","fsubr toFf","fdivr toFf","fdiv toFf", +-- DD +"ffreeFf",nil,"fstFf","fstpFf","fucomFf","fucompFf",nil,nil, +-- DE +"faddpFf","fmulpFf",nil,{nil,"fcompp"}, +"fsubrpFf","fsubpFf","fdivrpFf","fdivpFf", +-- DF +nil,nil,nil,nil,{"fnstsw ax"},"fucomipFf","fcomipFf",nil, +} +assert(map_opcfp[126] == "fcomipFf") + +-- Map for opcode groups. The subkey is sp from the ModRM byte. +local map_opcgroup = { + arith = { "add", "or", "adc", "sbb", "and", "sub", "xor", "cmp" }, + shift = { "rol", "ror", "rcl", "rcr", "shl", "shr", "sal", "sar" }, + testb = { "testBmi", "testBmi", "not", "neg", "mul", "imul", "div", "idiv" }, + testv = { "testVmi", "testVmi", "not", "neg", "mul", "imul", "div", "idiv" }, + incb = { "inc", "dec" }, + incd = { "inc", "dec", "callUmp", "$call farDmp", + "jmpUmp", "$jmp farDmp", "pushUm" }, + sldt = { "sldt", "str", "lldt", "ltr", "verr", "verw" }, + sgdt = { "vm*$sgdt", "vm*$sidt", "$lgdt", "vm*$lidt", + "smsw", nil, "lmsw", "vm*$invlpg" }, + bt = { nil, nil, nil, nil, "bt", "bts", "btr", "btc" }, + cmpxchg = { nil, "sz*,cmpxchg8bQmp,cmpxchg16bXmp", nil, nil, + nil, nil, "vmptrld|vmxon|vmclear", "vmptrst" }, + pshiftw = { nil, nil, "psrlw", nil, "psraw", nil, "psllw" }, + pshiftd = { nil, nil, "psrld", nil, "psrad", nil, "pslld" }, + pshiftq = { nil, nil, "psrlq", nil, nil, nil, "psllq" }, + pshiftdq = { nil, nil, "psrlq", "psrldq", nil, nil, "psllq", "pslldq" }, + fxsave = { "$fxsave", "$fxrstor", "$ldmxcsr", "$stmxcsr", + nil, "lfenceDp$", "mfenceDp$", "sfenceDp$clflush" }, + prefetch = { "prefetch", "prefetchw" }, + prefetcht = { "prefetchnta", "prefetcht0", "prefetcht1", "prefetcht2" }, +} + +------------------------------------------------------------------------------ + +-- Maps for register names. +local map_regs = { + B = { "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh", + "r8b", "r9b", "r10b", "r11b", "r12b", "r13b", "r14b", "r15b" }, + B64 = { "al", "cl", "dl", "bl", "spl", "bpl", "sil", "dil", + "r8b", "r9b", "r10b", "r11b", "r12b", "r13b", "r14b", "r15b" }, + W = { "ax", "cx", "dx", "bx", "sp", "bp", "si", "di", + "r8w", "r9w", "r10w", "r11w", "r12w", "r13w", "r14w", "r15w" }, + D = { "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi", + "r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d" }, + Q = { "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi", + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15" }, + M = { "mm0", "mm1", "mm2", "mm3", "mm4", "mm5", "mm6", "mm7", + "mm0", "mm1", "mm2", "mm3", "mm4", "mm5", "mm6", "mm7" }, -- No x64 ext! + X = { "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7", + "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15" }, + Y = { "ymm0", "ymm1", "ymm2", "ymm3", "ymm4", "ymm5", "ymm6", "ymm7", + "ymm8", "ymm9", "ymm10", "ymm11", "ymm12", "ymm13", "ymm14", "ymm15" }, +} +local map_segregs = { "es", "cs", "ss", "ds", "fs", "gs", "segr6", "segr7" } + +-- Maps for size names. +local map_sz2n = { + B = 1, W = 2, D = 4, Q = 8, M = 8, X = 16, Y = 32, +} +local map_sz2prefix = { + B = "byte", W = "word", D = "dword", + Q = "qword", + M = "qword", X = "xword", Y = "yword", + F = "dword", G = "qword", -- No need for sizes/register names for these two. +} + +------------------------------------------------------------------------------ + +-- Output a nicely formatted line with an opcode and operands. +local function putop(ctx, text, operands) + local code, pos, hex = ctx.code, ctx.pos, "" + local hmax = ctx.hexdump + if hmax > 0 then + for i=ctx.start,pos-1 do + hex = hex..format("%02X", byte(code, i, i)) + end + if #hex > hmax then hex = sub(hex, 1, hmax)..". " + else hex = hex..rep(" ", hmax-#hex+2) end + end + if operands then text = text.." "..operands end + if ctx.o16 then text = "o16 "..text; ctx.o16 = false end + if ctx.a32 then text = "a32 "..text; ctx.a32 = false end + if ctx.rep then text = ctx.rep.." "..text; ctx.rep = false end + if ctx.rex then + local t = (ctx.rexw and "w" or "")..(ctx.rexr and "r" or "").. + (ctx.rexx and "x" or "")..(ctx.rexb and "b" or "").. + (ctx.vexl and "l" or "") + if ctx.vexv and ctx.vexv ~= 0 then t = t.."v"..ctx.vexv end + if t ~= "" then text = ctx.rex.."."..t.." "..gsub(text, "^ ", "") + elseif ctx.rex == "vex" then text = gsub("v"..text, "^v ", "") end + ctx.rexw = false; ctx.rexr = false; ctx.rexx = false; ctx.rexb = false + ctx.rex = false; ctx.vexl = false; ctx.vexv = false + end + if ctx.seg then + local text2, n = gsub(text, "%[", "["..ctx.seg..":") + if n == 0 then text = ctx.seg.." "..text else text = text2 end + ctx.seg = false + end + if ctx.lock then text = "lock "..text; ctx.lock = false end + local imm = ctx.imm + if imm then + local sym = ctx.symtab[imm] + if sym then text = text.."\t->"..sym end + end + ctx.out(format("%08x %s%s\n", ctx.addr+ctx.start, hex, text)) + ctx.mrm = false + ctx.vexv = false + ctx.start = pos + ctx.imm = nil +end + +-- Clear all prefix flags. +local function clearprefixes(ctx) + ctx.o16 = false; ctx.seg = false; ctx.lock = false; ctx.rep = false + ctx.rexw = false; ctx.rexr = false; ctx.rexx = false; ctx.rexb = false + ctx.rex = false; ctx.a32 = false; ctx.vexl = false +end + +-- Fallback for incomplete opcodes at the end. +local function incomplete(ctx) + ctx.pos = ctx.stop+1 + clearprefixes(ctx) + return putop(ctx, "(incomplete)") +end + +-- Fallback for unknown opcodes. +local function unknown(ctx) + clearprefixes(ctx) + return putop(ctx, "(unknown)") +end + +-- Return an immediate of the specified size. +local function getimm(ctx, pos, n) + if pos+n-1 > ctx.stop then return incomplete(ctx) end + local code = ctx.code + if n == 1 then + local b1 = byte(code, pos, pos) + return b1 + elseif n == 2 then + local b1, b2 = byte(code, pos, pos+1) + return b1+b2*256 + else + local b1, b2, b3, b4 = byte(code, pos, pos+3) + local imm = b1+b2*256+b3*65536+b4*16777216 + ctx.imm = imm + return imm + end +end + +-- Process pattern string and generate the operands. +local function putpat(ctx, name, pat) + local operands, regs, sz, mode, sp, rm, sc, rx, sdisp + local code, pos, stop, vexl = ctx.code, ctx.pos, ctx.stop, ctx.vexl + + -- Chars used: 1DFGIMPQRSTUVWXYabcdfgijlmoprstuvwxyz + for p in gmatch(pat, ".") do + local x = nil + if p == "V" or p == "U" then + if ctx.rexw then sz = "Q"; ctx.rexw = false + elseif ctx.o16 then sz = "W"; ctx.o16 = false + elseif p == "U" and ctx.x64 then sz = "Q" + else sz = "D" end + regs = map_regs[sz] + elseif p == "T" then + if ctx.rexw then sz = "Q"; ctx.rexw = false else sz = "D" end + regs = map_regs[sz] + elseif p == "B" then + sz = "B" + regs = ctx.rex and map_regs.B64 or map_regs.B + elseif match(p, "[WDQMXYFG]") then + sz = p + if sz == "X" and vexl then sz = "Y"; ctx.vexl = false end + regs = map_regs[sz] + elseif p == "P" then + sz = ctx.o16 and "X" or "M"; ctx.o16 = false + if sz == "X" and vexl then sz = "Y"; ctx.vexl = false end + regs = map_regs[sz] + elseif p == "S" then + name = name..lower(sz) + elseif p == "s" then + local imm = getimm(ctx, pos, 1); if not imm then return end + x = imm <= 127 and format("+0x%02x", imm) + or format("-0x%02x", 256-imm) + pos = pos+1 + elseif p == "u" then + local imm = getimm(ctx, pos, 1); if not imm then return end + x = format("0x%02x", imm) + pos = pos+1 + elseif p == "b" then + local imm = getimm(ctx, pos, 1); if not imm then return end + x = regs[imm/16+1] + pos = pos+1 + elseif p == "w" then + local imm = getimm(ctx, pos, 2); if not imm then return end + x = format("0x%x", imm) + pos = pos+2 + elseif p == "o" then -- [offset] + if ctx.x64 then + local imm1 = getimm(ctx, pos, 4); if not imm1 then return end + local imm2 = getimm(ctx, pos+4, 4); if not imm2 then return end + x = format("[0x%08x%08x]", imm2, imm1) + pos = pos+8 + else + local imm = getimm(ctx, pos, 4); if not imm then return end + x = format("[0x%08x]", imm) + pos = pos+4 + end + elseif p == "i" or p == "I" then + local n = map_sz2n[sz] + if n == 8 and ctx.x64 and p == "I" then + local imm1 = getimm(ctx, pos, 4); if not imm1 then return end + local imm2 = getimm(ctx, pos+4, 4); if not imm2 then return end + x = format("0x%08x%08x", imm2, imm1) + else + if n == 8 then n = 4 end + local imm = getimm(ctx, pos, n); if not imm then return end + if sz == "Q" and (imm < 0 or imm > 0x7fffffff) then + imm = (0xffffffff+1)-imm + x = format(imm > 65535 and "-0x%08x" or "-0x%x", imm) + else + x = format(imm > 65535 and "0x%08x" or "0x%x", imm) + end + end + pos = pos+n + elseif p == "j" then + local n = map_sz2n[sz] + if n == 8 then n = 4 end + local imm = getimm(ctx, pos, n); if not imm then return end + if sz == "B" and imm > 127 then imm = imm-256 + elseif imm > 2147483647 then imm = imm-4294967296 end + pos = pos+n + imm = imm + pos + ctx.addr + if imm > 4294967295 and not ctx.x64 then imm = imm-4294967296 end + ctx.imm = imm + if sz == "W" then + x = format("word 0x%04x", imm%65536) + elseif ctx.x64 then + local lo = imm % 0x1000000 + x = format("0x%02x%06x", (imm-lo) / 0x1000000, lo) + else + x = "0x"..tohex(imm) + end + elseif p == "R" then + local r = byte(code, pos-1, pos-1)%8 + if ctx.rexb then r = r + 8; ctx.rexb = false end + x = regs[r+1] + elseif p == "a" then x = regs[1] + elseif p == "c" then x = "cl" + elseif p == "d" then x = "dx" + elseif p == "1" then x = "1" + else + if not mode then + mode = ctx.mrm + if not mode then + if pos > stop then return incomplete(ctx) end + mode = byte(code, pos, pos) + pos = pos+1 + end + rm = mode%8; mode = (mode-rm)/8 + sp = mode%8; mode = (mode-sp)/8 + sdisp = "" + if mode < 3 then + if rm == 4 then + if pos > stop then return incomplete(ctx) end + sc = byte(code, pos, pos) + pos = pos+1 + rm = sc%8; sc = (sc-rm)/8 + rx = sc%8; sc = (sc-rx)/8 + if ctx.rexx then rx = rx + 8; ctx.rexx = false end + if rx == 4 then rx = nil end + end + if mode > 0 or rm == 5 then + local dsz = mode + if dsz ~= 1 then dsz = 4 end + local disp = getimm(ctx, pos, dsz); if not disp then return end + if mode == 0 then rm = nil end + if rm or rx or (not sc and ctx.x64 and not ctx.a32) then + if dsz == 1 and disp > 127 then + sdisp = format("-0x%x", 256-disp) + elseif disp >= 0 and disp <= 0x7fffffff then + sdisp = format("+0x%x", disp) + else + sdisp = format("-0x%x", (0xffffffff+1)-disp) + end + else + sdisp = format(ctx.x64 and not ctx.a32 and + not (disp >= 0 and disp <= 0x7fffffff) + and "0xffffffff%08x" or "0x%08x", disp) + end + pos = pos+dsz + end + end + if rm and ctx.rexb then rm = rm + 8; ctx.rexb = false end + if ctx.rexr then sp = sp + 8; ctx.rexr = false end + end + if p == "m" then + if mode == 3 then x = regs[rm+1] + else + local aregs = ctx.a32 and map_regs.D or ctx.aregs + local srm, srx = "", "" + if rm then srm = aregs[rm+1] + elseif not sc and ctx.x64 and not ctx.a32 then srm = "rip" end + ctx.a32 = false + if rx then + if rm then srm = srm.."+" end + srx = aregs[rx+1] + if sc > 0 then srx = srx.."*"..(2^sc) end + end + x = format("[%s%s%s]", srm, srx, sdisp) + end + if mode < 3 and + (not match(pat, "[aRrgp]") or match(pat, "t")) then -- Yuck. + x = map_sz2prefix[sz].." "..x + end + elseif p == "r" then x = regs[sp+1] + elseif p == "g" then x = map_segregs[sp+1] + elseif p == "p" then -- Suppress prefix. + elseif p == "f" then x = "st"..rm + elseif p == "x" then + if sp == 0 and ctx.lock and not ctx.x64 then + x = "CR8"; ctx.lock = false + else + x = "CR"..sp + end + elseif p == "v" then + if ctx.vexv then + x = regs[ctx.vexv+1]; ctx.vexv = false + end + elseif p == "y" then x = "DR"..sp + elseif p == "z" then x = "TR"..sp + elseif p == "l" then vexl = false + elseif p == "t" then + else + error("bad pattern `"..pat.."'") + end + end + if x then operands = operands and operands..", "..x or x end + end + ctx.pos = pos + return putop(ctx, name, operands) +end + +-- Forward declaration. +local map_act + +-- Fetch and cache MRM byte. +local function getmrm(ctx) + local mrm = ctx.mrm + if not mrm then + local pos = ctx.pos + if pos > ctx.stop then return nil end + mrm = byte(ctx.code, pos, pos) + ctx.pos = pos+1 + ctx.mrm = mrm + end + return mrm +end + +-- Dispatch to handler depending on pattern. +local function dispatch(ctx, opat, patgrp) + if not opat then return unknown(ctx) end + if match(opat, "%|") then -- MMX/SSE variants depending on prefix. + local p + if ctx.rep then + p = ctx.rep=="rep" and "%|([^%|]*)" or "%|[^%|]*%|[^%|]*%|([^%|]*)" + ctx.rep = false + elseif ctx.o16 then p = "%|[^%|]*%|([^%|]*)"; ctx.o16 = false + else p = "^[^%|]*" end + opat = match(opat, p) + if not opat then return unknown(ctx) end +-- ctx.rep = false; ctx.o16 = false + --XXX fails for 66 f2 0f 38 f1 06 crc32 eax,WORD PTR [esi] + --XXX remove in branches? + end + if match(opat, "%$") then -- reg$mem variants. + local mrm = getmrm(ctx); if not mrm then return incomplete(ctx) end + opat = match(opat, mrm >= 192 and "^[^%$]*" or "%$(.*)") + if opat == "" then return unknown(ctx) end + end + if opat == "" then return unknown(ctx) end + local name, pat = match(opat, "^([a-z0-9 ]*)(.*)") + if pat == "" and patgrp then pat = patgrp end + return map_act[sub(pat, 1, 1)](ctx, name, pat) +end + +-- Get a pattern from an opcode map and dispatch to handler. +local function dispatchmap(ctx, opcmap) + local pos = ctx.pos + local opat = opcmap[byte(ctx.code, pos, pos)] + pos = pos + 1 + ctx.pos = pos + return dispatch(ctx, opat) +end + +-- Map for action codes. The key is the first char after the name. +map_act = { + -- Simple opcodes without operands. + [""] = function(ctx, name, pat) + return putop(ctx, name) + end, + + -- Operand size chars fall right through. + B = putpat, W = putpat, D = putpat, Q = putpat, + V = putpat, U = putpat, T = putpat, + M = putpat, X = putpat, P = putpat, + F = putpat, G = putpat, Y = putpat, + + -- Collect prefixes. + [":"] = function(ctx, name, pat) + ctx[pat == ":" and name or sub(pat, 2)] = name + if ctx.pos - ctx.start > 5 then return unknown(ctx) end -- Limit #prefixes. + end, + + -- Chain to special handler specified by name. + ["*"] = function(ctx, name, pat) + return map_act[name](ctx, name, sub(pat, 2)) + end, + + -- Use named subtable for opcode group. + ["!"] = function(ctx, name, pat) + local mrm = getmrm(ctx); if not mrm then return incomplete(ctx) end + return dispatch(ctx, map_opcgroup[name][((mrm-(mrm%8))/8)%8+1], sub(pat, 2)) + end, + + -- o16,o32[,o64] variants. + sz = function(ctx, name, pat) + if ctx.o16 then ctx.o16 = false + else + pat = match(pat, ",(.*)") + if ctx.rexw then + local p = match(pat, ",(.*)") + if p then pat = p; ctx.rexw = false end + end + end + pat = match(pat, "^[^,]*") + return dispatch(ctx, pat) + end, + + -- Two-byte opcode dispatch. + opc2 = function(ctx, name, pat) + return dispatchmap(ctx, map_opc2) + end, + + -- Three-byte opcode dispatch. + opc3 = function(ctx, name, pat) + return dispatchmap(ctx, map_opc3[pat]) + end, + + -- VMX/SVM dispatch. + vm = function(ctx, name, pat) + return dispatch(ctx, map_opcvm[ctx.mrm]) + end, + + -- Floating point opcode dispatch. + fp = function(ctx, name, pat) + local mrm = getmrm(ctx); if not mrm then return incomplete(ctx) end + local rm = mrm%8 + local idx = pat*8 + ((mrm-rm)/8)%8 + if mrm >= 192 then idx = idx + 64 end + local opat = map_opcfp[idx] + if type(opat) == "table" then opat = opat[rm+1] end + return dispatch(ctx, opat) + end, + + -- REX prefix. + rex = function(ctx, name, pat) + if ctx.rex then return unknown(ctx) end -- Only 1 REX or VEX prefix allowed. + for p in gmatch(pat, ".") do ctx["rex"..p] = true end + ctx.rex = "rex" + end, + + -- VEX prefix. + vex = function(ctx, name, pat) + if ctx.rex then return unknown(ctx) end -- Only 1 REX or VEX prefix allowed. + ctx.rex = "vex" + local pos = ctx.pos + if ctx.mrm then + ctx.mrm = nil + pos = pos-1 + end + local b = byte(ctx.code, pos, pos) + if not b then return incomplete(ctx) end + pos = pos+1 + if b < 128 then ctx.rexr = true end + local m = 1 + if pat == "3" then + m = b%32; b = (b-m)/32 + local nb = b%2; b = (b-nb)/2 + if nb == 0 then ctx.rexb = true end + local nx = b%2 + if nx == 0 then ctx.rexx = true end + b = byte(ctx.code, pos, pos) + if not b then return incomplete(ctx) end + pos = pos+1 + if b >= 128 then ctx.rexw = true end + end + ctx.pos = pos + local map + if m == 1 then map = map_opc2 + elseif m == 2 then map = map_opc3["38"] + elseif m == 3 then map = map_opc3["3a"] + else return unknown(ctx) end + local p = b%4; b = (b-p)/4 + if p == 1 then ctx.o16 = "o16" + elseif p == 2 then ctx.rep = "rep" + elseif p == 3 then ctx.rep = "repne" end + local l = b%2; b = (b-l)/2 + if l ~= 0 then ctx.vexl = true end + ctx.vexv = (-1-b)%16 + return dispatchmap(ctx, map) + end, + + -- Special case for nop with REX prefix. + nop = function(ctx, name, pat) + return dispatch(ctx, ctx.rex and pat or "nop") + end, + + -- Special case for 0F 77. + emms = function(ctx, name, pat) + if ctx.rex ~= "vex" then + return putop(ctx, "emms") + elseif ctx.vexl then + ctx.vexl = false + return putop(ctx, "zeroall") + else + return putop(ctx, "zeroupper") + end + end, +} + +------------------------------------------------------------------------------ + +-- Disassemble a block of code. +local function disass_block(ctx, ofs, len) + if not ofs then ofs = 0 end + local stop = len and ofs+len or #ctx.code + ofs = ofs + 1 + ctx.start = ofs + ctx.pos = ofs + ctx.stop = stop + ctx.imm = nil + ctx.mrm = false + clearprefixes(ctx) + while ctx.pos <= stop do dispatchmap(ctx, ctx.map1) end + if ctx.pos ~= ctx.start then incomplete(ctx) end +end + +-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len). +local function create(code, addr, out) + local ctx = {} + ctx.code = code + ctx.addr = (addr or 0) - 1 + ctx.out = out or io.write + ctx.symtab = {} + ctx.disass = disass_block + ctx.hexdump = 16 + ctx.x64 = false + ctx.map1 = map_opc1_32 + ctx.aregs = map_regs.D + return ctx +end + +local function create64(code, addr, out) + local ctx = create(code, addr, out) + ctx.x64 = true + ctx.map1 = map_opc1_64 + ctx.aregs = map_regs.Q + return ctx +end + +-- Simple API: disassemble code (a string) at address and output via out. +local function disass(code, addr, out) + create(code, addr, out):disass() +end + +local function disass64(code, addr, out) + create64(code, addr, out):disass() +end + +-- Return register name for RID. +local function regname(r) + if r < 8 then return map_regs.D[r+1] end + return map_regs.X[r-7] +end + +local function regname64(r) + if r < 16 then return map_regs.Q[r+1] end + return map_regs.X[r-15] +end + +-- Public module functions. +return { + create = create, + create64 = create64, + disass = disass, + disass64 = disass64, + regname = regname, + regname64 = regname64 +} + diff --git a/Assets/LuaFramework/ToLua/Lua/jit/dis_x86.lua.meta b/Assets/LuaFramework/ToLua/Lua/jit/dis_x86.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..416e845750476d541dc16a93a77ae417c3faf7a1 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/dis_x86.lua.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3244c54564aeae24daa6a81b810b9d3f +timeCreated: 1492692752 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Lua/jit/dump.lua b/Assets/LuaFramework/ToLua/Lua/jit/dump.lua new file mode 100644 index 0000000000000000000000000000000000000000..2bea652bf81740c129029fcdcdad85e143fcd9f7 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/dump.lua @@ -0,0 +1,712 @@ +---------------------------------------------------------------------------- +-- LuaJIT compiler dump module. +-- +-- Copyright (C) 2005-2017 Mike Pall. All rights reserved. +-- Released under the MIT license. See Copyright Notice in luajit.h +---------------------------------------------------------------------------- +-- +-- This module can be used to debug the JIT compiler itself. It dumps the +-- code representations and structures used in various compiler stages. +-- +-- Example usage: +-- +-- luajit -jdump -e "local x=0; for i=1,1e6 do x=x+i end; print(x)" +-- luajit -jdump=im -e "for i=1,1000 do for j=1,1000 do end end" | less -R +-- luajit -jdump=is myapp.lua | less -R +-- luajit -jdump=-b myapp.lua +-- luajit -jdump=+aH,myapp.html myapp.lua +-- luajit -jdump=ixT,myapp.dump myapp.lua +-- +-- The first argument specifies the dump mode. The second argument gives +-- the output file name. Default output is to stdout, unless the environment +-- variable LUAJIT_DUMPFILE is set. The file is overwritten every time the +-- module is started. +-- +-- Different features can be turned on or off with the dump mode. If the +-- mode starts with a '+', the following features are added to the default +-- set of features; a '-' removes them. Otherwise the features are replaced. +-- +-- The following dump features are available (* marks the default): +-- +-- * t Print a line for each started, ended or aborted trace (see also -jv). +-- * b Dump the traced bytecode. +-- * i Dump the IR (intermediate representation). +-- r Augment the IR with register/stack slots. +-- s Dump the snapshot map. +-- * m Dump the generated machine code. +-- x Print each taken trace exit. +-- X Print each taken trace exit and the contents of all registers. +-- a Print the IR of aborted traces, too. +-- +-- The output format can be set with the following characters: +-- +-- T Plain text output. +-- A ANSI-colored text output +-- H Colorized HTML + CSS output. +-- +-- The default output format is plain text. It's set to ANSI-colored text +-- if the COLORTERM variable is set. Note: this is independent of any output +-- redirection, which is actually considered a feature. +-- +-- You probably want to use less -R to enjoy viewing ANSI-colored text from +-- a pipe or a file. Add this to your ~/.bashrc: export LESS="-R" +-- +------------------------------------------------------------------------------ + +-- Cache some library functions and objects. +local jit = require("jit") +assert(jit.version_num == 20100, "LuaJIT core/library version mismatch") +local jutil = require("jit.util") +local vmdef = require("jit.vmdef") +local funcinfo, funcbc = jutil.funcinfo, jutil.funcbc +local traceinfo, traceir, tracek = jutil.traceinfo, jutil.traceir, jutil.tracek +local tracemc, tracesnap = jutil.tracemc, jutil.tracesnap +local traceexitstub, ircalladdr = jutil.traceexitstub, jutil.ircalladdr +local bit = require("bit") +local band, shr, tohex = bit.band, bit.rshift, bit.tohex +local sub, gsub, format = string.sub, string.gsub, string.format +local byte, rep = string.byte, string.rep +local type, tostring = type, tostring +local stdout, stderr = io.stdout, io.stderr + +-- Load other modules on-demand. +local bcline, disass + +-- Active flag, output file handle and dump mode. +local active, out, dumpmode + +------------------------------------------------------------------------------ + +local symtabmt = { __index = false } +local symtab = {} +local nexitsym = 0 + +-- Fill nested symbol table with per-trace exit stub addresses. +local function fillsymtab_tr(tr, nexit) + local t = {} + symtabmt.__index = t + if jit.arch:sub(1, 4) == "mips" then + t[traceexitstub(tr, 0)] = "exit" + return + end + for i=0,nexit-1 do + local addr = traceexitstub(tr, i) + if addr < 0 then addr = addr + 2^32 end + t[addr] = tostring(i) + end + local addr = traceexitstub(tr, nexit) + if addr then t[addr] = "stack_check" end +end + +-- Fill symbol table with trace exit stub addresses. +local function fillsymtab(tr, nexit) + local t = symtab + if nexitsym == 0 then + local ircall = vmdef.ircall + for i=0,#ircall do + local addr = ircalladdr(i) + if addr ~= 0 then + if addr < 0 then addr = addr + 2^32 end + t[addr] = ircall[i] + end + end + end + if nexitsym == 1000000 then -- Per-trace exit stubs. + fillsymtab_tr(tr, nexit) + elseif nexit > nexitsym then -- Shared exit stubs. + for i=nexitsym,nexit-1 do + local addr = traceexitstub(i) + if addr == nil then -- Fall back to per-trace exit stubs. + fillsymtab_tr(tr, nexit) + setmetatable(symtab, symtabmt) + nexit = 1000000 + break + end + if addr < 0 then addr = addr + 2^32 end + t[addr] = tostring(i) + end + nexitsym = nexit + end + return t +end + +local function dumpwrite(s) + out:write(s) +end + +-- Disassemble machine code. +local function dump_mcode(tr) + local info = traceinfo(tr) + if not info then return end + local mcode, addr, loop = tracemc(tr) + if not mcode then return end + if not disass then disass = require("jit.dis_"..jit.arch) end + if addr < 0 then addr = addr + 2^32 end + out:write("---- TRACE ", tr, " mcode ", #mcode, "\n") + local ctx = disass.create(mcode, addr, dumpwrite) + ctx.hexdump = 0 + ctx.symtab = fillsymtab(tr, info.nexit) + if loop ~= 0 then + symtab[addr+loop] = "LOOP" + ctx:disass(0, loop) + out:write("->LOOP:\n") + ctx:disass(loop, #mcode-loop) + symtab[addr+loop] = nil + else + ctx:disass(0, #mcode) + end +end + +------------------------------------------------------------------------------ + +local irtype_text = { + [0] = "nil", + "fal", + "tru", + "lud", + "str", + "p32", + "thr", + "pro", + "fun", + "p64", + "cdt", + "tab", + "udt", + "flt", + "num", + "i8 ", + "u8 ", + "i16", + "u16", + "int", + "u32", + "i64", + "u64", + "sfp", +} + +local colortype_ansi = { + [0] = "%s", + "%s", + "%s", + "\027[36m%s\027[m", + "\027[32m%s\027[m", + "%s", + "\027[1m%s\027[m", + "%s", + "\027[1m%s\027[m", + "%s", + "\027[33m%s\027[m", + "\027[31m%s\027[m", + "\027[36m%s\027[m", + "\027[34m%s\027[m", + "\027[34m%s\027[m", + "\027[35m%s\027[m", + "\027[35m%s\027[m", + "\027[35m%s\027[m", + "\027[35m%s\027[m", + "\027[35m%s\027[m", + "\027[35m%s\027[m", + "\027[35m%s\027[m", + "\027[35m%s\027[m", + "\027[35m%s\027[m", +} + +local function colorize_text(s) + return s +end + +local function colorize_ansi(s, t) + return format(colortype_ansi[t], s) +end + +local irtype_ansi = setmetatable({}, + { __index = function(tab, t) + local s = colorize_ansi(irtype_text[t], t); tab[t] = s; return s; end }) + +local html_escape = { ["<"] = "<", [">"] = ">", ["&"] = "&", } + +local function colorize_html(s, t) + s = gsub(s, "[<>&]", html_escape) + return format('%s', irtype_text[t], s) +end + +local irtype_html = setmetatable({}, + { __index = function(tab, t) + local s = colorize_html(irtype_text[t], t); tab[t] = s; return s; end }) + +local header_html = [[ + +]] + +local colorize, irtype + +-- Lookup tables to convert some literals into names. +local litname = { + ["SLOAD "] = setmetatable({}, { __index = function(t, mode) + local s = "" + if band(mode, 1) ~= 0 then s = s.."P" end + if band(mode, 2) ~= 0 then s = s.."F" end + if band(mode, 4) ~= 0 then s = s.."T" end + if band(mode, 8) ~= 0 then s = s.."C" end + if band(mode, 16) ~= 0 then s = s.."R" end + if band(mode, 32) ~= 0 then s = s.."I" end + t[mode] = s + return s + end}), + ["XLOAD "] = { [0] = "", "R", "V", "RV", "U", "RU", "VU", "RVU", }, + ["CONV "] = setmetatable({}, { __index = function(t, mode) + local s = irtype[band(mode, 31)] + s = irtype[band(shr(mode, 5), 31)].."."..s + if band(mode, 0x800) ~= 0 then s = s.." sext" end + local c = shr(mode, 14) + if c == 2 then s = s.." index" elseif c == 3 then s = s.." check" end + t[mode] = s + return s + end}), + ["FLOAD "] = vmdef.irfield, + ["FREF "] = vmdef.irfield, + ["FPMATH"] = vmdef.irfpm, + ["BUFHDR"] = { [0] = "RESET", "APPEND" }, + ["TOSTR "] = { [0] = "INT", "NUM", "CHAR" }, +} + +local function ctlsub(c) + if c == "\n" then return "\\n" + elseif c == "\r" then return "\\r" + elseif c == "\t" then return "\\t" + else return format("\\%03d", byte(c)) + end +end + +local function fmtfunc(func, pc) + local fi = funcinfo(func, pc) + if fi.loc then + return fi.loc + elseif fi.ffid then + return vmdef.ffnames[fi.ffid] + elseif fi.addr then + return format("C:%x", fi.addr) + else + return "(?)" + end +end + +local function formatk(tr, idx, sn) + local k, t, slot = tracek(tr, idx) + local tn = type(k) + local s + if tn == "number" then + if band(sn or 0, 0x30000) ~= 0 then + s = band(sn, 0x20000) ~= 0 and "contpc" or "ftsz" + elseif k == 2^52+2^51 then + s = "bias" + else + s = format(0 < k and k < 0x1p-1026 and "%+a" or "%+.14g", k) + end + elseif tn == "string" then + s = format(#k > 20 and '"%.20s"~' or '"%s"', gsub(k, "%c", ctlsub)) + elseif tn == "function" then + s = fmtfunc(k) + elseif tn == "table" then + s = format("{%p}", k) + elseif tn == "userdata" then + if t == 12 then + s = format("userdata:%p", k) + else + s = format("[%p]", k) + if s == "[NULL]" then s = "NULL" end + end + elseif t == 21 then -- int64_t + s = sub(tostring(k), 1, -3) + if sub(s, 1, 1) ~= "-" then s = "+"..s end + elseif sn == 0x1057fff then -- SNAP(1, SNAP_FRAME | SNAP_NORESTORE, REF_NIL) + return "----" -- Special case for LJ_FR2 slot 1. + else + s = tostring(k) -- For primitives. + end + s = colorize(format("%-4s", s), t) + if slot then + s = format("%s @%d", s, slot) + end + return s +end + +local function printsnap(tr, snap) + local n = 2 + for s=0,snap[1]-1 do + local sn = snap[n] + if shr(sn, 24) == s then + n = n + 1 + local ref = band(sn, 0xffff) - 0x8000 -- REF_BIAS + if ref < 0 then + out:write(formatk(tr, ref, sn)) + elseif band(sn, 0x80000) ~= 0 then -- SNAP_SOFTFPNUM + out:write(colorize(format("%04d/%04d", ref, ref+1), 14)) + else + local m, ot, op1, op2 = traceir(tr, ref) + out:write(colorize(format("%04d", ref), band(ot, 31))) + end + out:write(band(sn, 0x10000) == 0 and " " or "|") -- SNAP_FRAME + else + out:write("---- ") + end + end + out:write("]\n") +end + +-- Dump snapshots (not interleaved with IR). +local function dump_snap(tr) + out:write("---- TRACE ", tr, " snapshots\n") + for i=0,1000000000 do + local snap = tracesnap(tr, i) + if not snap then break end + out:write(format("#%-3d %04d [ ", i, snap[0])) + printsnap(tr, snap) + end +end + +-- Return a register name or stack slot for a rid/sp location. +local function ridsp_name(ridsp, ins) + if not disass then disass = require("jit.dis_"..jit.arch) end + local rid, slot = band(ridsp, 0xff), shr(ridsp, 8) + if rid == 253 or rid == 254 then + return (slot == 0 or slot == 255) and " {sink" or format(" {%04d", ins-slot) + end + if ridsp > 255 then return format("[%x]", slot*4) end + if rid < 128 then return disass.regname(rid) end + return "" +end + +-- Dump CALL* function ref and return optional ctype. +local function dumpcallfunc(tr, ins) + local ctype + if ins > 0 then + local m, ot, op1, op2 = traceir(tr, ins) + if band(ot, 31) == 0 then -- nil type means CARG(func, ctype). + ins = op1 + ctype = formatk(tr, op2) + end + end + if ins < 0 then + out:write(format("[0x%x](", tonumber((tracek(tr, ins))))) + else + out:write(format("%04d (", ins)) + end + return ctype +end + +-- Recursively gather CALL* args and dump them. +local function dumpcallargs(tr, ins) + if ins < 0 then + out:write(formatk(tr, ins)) + else + local m, ot, op1, op2 = traceir(tr, ins) + local oidx = 6*shr(ot, 8) + local op = sub(vmdef.irnames, oidx+1, oidx+6) + if op == "CARG " then + dumpcallargs(tr, op1) + if op2 < 0 then + out:write(" ", formatk(tr, op2)) + else + out:write(" ", format("%04d", op2)) + end + else + out:write(format("%04d", ins)) + end + end +end + +-- Dump IR and interleaved snapshots. +local function dump_ir(tr, dumpsnap, dumpreg) + local info = traceinfo(tr) + if not info then return end + local nins = info.nins + out:write("---- TRACE ", tr, " IR\n") + local irnames = vmdef.irnames + local snapref = 65536 + local snap, snapno + if dumpsnap then + snap = tracesnap(tr, 0) + snapref = snap[0] + snapno = 0 + end + for ins=1,nins do + if ins >= snapref then + if dumpreg then + out:write(format(".... SNAP #%-3d [ ", snapno)) + else + out:write(format(".... SNAP #%-3d [ ", snapno)) + end + printsnap(tr, snap) + snapno = snapno + 1 + snap = tracesnap(tr, snapno) + snapref = snap and snap[0] or 65536 + end + local m, ot, op1, op2, ridsp = traceir(tr, ins) + local oidx, t = 6*shr(ot, 8), band(ot, 31) + local op = sub(irnames, oidx+1, oidx+6) + if op == "LOOP " then + if dumpreg then + out:write(format("%04d ------------ LOOP ------------\n", ins)) + else + out:write(format("%04d ------ LOOP ------------\n", ins)) + end + elseif op ~= "NOP " and op ~= "CARG " and + (dumpreg or op ~= "RENAME") then + local rid = band(ridsp, 255) + if dumpreg then + out:write(format("%04d %-6s", ins, ridsp_name(ridsp, ins))) + else + out:write(format("%04d ", ins)) + end + out:write(format("%s%s %s %s ", + (rid == 254 or rid == 253) and "}" or + (band(ot, 128) == 0 and " " or ">"), + band(ot, 64) == 0 and " " or "+", + irtype[t], op)) + local m1, m2 = band(m, 3), band(m, 3*4) + if sub(op, 1, 4) == "CALL" then + local ctype + if m2 == 1*4 then -- op2 == IRMlit + out:write(format("%-10s (", vmdef.ircall[op2])) + else + ctype = dumpcallfunc(tr, op2) + end + if op1 ~= -1 then dumpcallargs(tr, op1) end + out:write(")") + if ctype then out:write(" ctype ", ctype) end + elseif op == "CNEW " and op2 == -1 then + out:write(formatk(tr, op1)) + elseif m1 ~= 3 then -- op1 != IRMnone + if op1 < 0 then + out:write(formatk(tr, op1)) + else + out:write(format(m1 == 0 and "%04d" or "#%-3d", op1)) + end + if m2 ~= 3*4 then -- op2 != IRMnone + if m2 == 1*4 then -- op2 == IRMlit + local litn = litname[op] + if litn and litn[op2] then + out:write(" ", litn[op2]) + elseif op == "UREFO " or op == "UREFC " then + out:write(format(" #%-3d", shr(op2, 8))) + else + out:write(format(" #%-3d", op2)) + end + elseif op2 < 0 then + out:write(" ", formatk(tr, op2)) + else + out:write(format(" %04d", op2)) + end + end + end + out:write("\n") + end + end + if snap then + if dumpreg then + out:write(format(".... SNAP #%-3d [ ", snapno)) + else + out:write(format(".... SNAP #%-3d [ ", snapno)) + end + printsnap(tr, snap) + end +end + +------------------------------------------------------------------------------ + +local recprefix = "" +local recdepth = 0 + +-- Format trace error message. +local function fmterr(err, info) + if type(err) == "number" then + if type(info) == "function" then info = fmtfunc(info) end + err = format(vmdef.traceerr[err], info) + end + return err +end + +-- Dump trace states. +local function dump_trace(what, tr, func, pc, otr, oex) + if what == "stop" or (what == "abort" and dumpmode.a) then + if dumpmode.i then dump_ir(tr, dumpmode.s, dumpmode.r and what == "stop") + elseif dumpmode.s then dump_snap(tr) end + if dumpmode.m then dump_mcode(tr) end + end + if what == "start" then + if dumpmode.H then out:write('
\n') end
+    out:write("---- TRACE ", tr, " ", what)
+    if otr then out:write(" ", otr, "/", oex == -1 and "stitch" or oex) end
+    out:write(" ", fmtfunc(func, pc), "\n")
+  elseif what == "stop" or what == "abort" then
+    out:write("---- TRACE ", tr, " ", what)
+    if what == "abort" then
+      out:write(" ", fmtfunc(func, pc), " -- ", fmterr(otr, oex), "\n")
+    else
+      local info = traceinfo(tr)
+      local link, ltype = info.link, info.linktype
+      if link == tr or link == 0 then
+	out:write(" -> ", ltype, "\n")
+      elseif ltype == "root" then
+	out:write(" -> ", link, "\n")
+      else
+	out:write(" -> ", link, " ", ltype, "\n")
+      end
+    end
+    if dumpmode.H then out:write("
\n\n") else out:write("\n") end + else + if what == "flush" then symtab, nexitsym = {}, 0 end + out:write("---- TRACE ", what, "\n\n") + end + out:flush() +end + +-- Dump recorded bytecode. +local function dump_record(tr, func, pc, depth, callee) + if depth ~= recdepth then + recdepth = depth + recprefix = rep(" .", depth) + end + local line + if pc >= 0 then + line = bcline(func, pc, recprefix) + if dumpmode.H then line = gsub(line, "[<>&]", html_escape) end + else + line = "0000 "..recprefix.." FUNCC \n" + callee = func + end + if pc <= 0 then + out:write(sub(line, 1, -2), " ; ", fmtfunc(func), "\n") + else + out:write(line) + end + if pc >= 0 and band(funcbc(func, pc), 0xff) < 16 then -- ORDER BC + out:write(bcline(func, pc+1, recprefix)) -- Write JMP for cond. + end +end + +------------------------------------------------------------------------------ + +-- Dump taken trace exits. +local function dump_texit(tr, ex, ngpr, nfpr, ...) + out:write("---- TRACE ", tr, " exit ", ex, "\n") + if dumpmode.X then + local regs = {...} + if jit.arch == "x64" then + for i=1,ngpr do + out:write(format(" %016x", regs[i])) + if i % 4 == 0 then out:write("\n") end + end + else + for i=1,ngpr do + out:write(" ", tohex(regs[i])) + if i % 8 == 0 then out:write("\n") end + end + end + if jit.arch == "mips" or jit.arch == "mipsel" then + for i=1,nfpr,2 do + out:write(format(" %+17.14g", regs[ngpr+i])) + if i % 8 == 7 then out:write("\n") end + end + else + for i=1,nfpr do + out:write(format(" %+17.14g", regs[ngpr+i])) + if i % 4 == 0 then out:write("\n") end + end + end + end +end + +------------------------------------------------------------------------------ + +-- Detach dump handlers. +local function dumpoff() + if active then + active = false + jit.attach(dump_texit) + jit.attach(dump_record) + jit.attach(dump_trace) + if out and out ~= stdout and out ~= stderr then out:close() end + out = nil + end +end + +-- Open the output file and attach dump handlers. +local function dumpon(opt, outfile) + if active then dumpoff() end + + local term = os.getenv("TERM") + local colormode = (term and term:match("color") or os.getenv("COLORTERM")) and "A" or "T" + if opt then + opt = gsub(opt, "[TAH]", function(mode) colormode = mode; return ""; end) + end + + local m = { t=true, b=true, i=true, m=true, } + if opt and opt ~= "" then + local o = sub(opt, 1, 1) + if o ~= "+" and o ~= "-" then m = {} end + for i=1,#opt do m[sub(opt, i, i)] = (o ~= "-") end + end + dumpmode = m + + if m.t or m.b or m.i or m.s or m.m then + jit.attach(dump_trace, "trace") + end + if m.b then + jit.attach(dump_record, "record") + if not bcline then bcline = require("jit.bc").line end + end + if m.x or m.X then + jit.attach(dump_texit, "texit") + end + + if not outfile then outfile = os.getenv("LUAJIT_DUMPFILE") end + if outfile then + out = outfile == "-" and stdout or assert(io.open(outfile, "w")) + else + out = stdout + end + + m[colormode] = true + if colormode == "A" then + colorize = colorize_ansi + irtype = irtype_ansi + elseif colormode == "H" then + colorize = colorize_html + irtype = irtype_html + out:write(header_html) + else + colorize = colorize_text + irtype = irtype_text + end + + active = true +end + +-- Public module functions. +return { + on = dumpon, + off = dumpoff, + start = dumpon -- For -j command line option. +} + diff --git a/Assets/LuaFramework/ToLua/Lua/jit/dump.lua.meta b/Assets/LuaFramework/ToLua/Lua/jit/dump.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..9fe1f96a8309bb2e017c6d4097637f8a7656dc90 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/dump.lua.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4d03e3137c36cc2468b3fbc7d489f17e +timeCreated: 1492692752 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Lua/jit/p.lua b/Assets/LuaFramework/ToLua/Lua/jit/p.lua new file mode 100644 index 0000000000000000000000000000000000000000..7be105863d3bdacb778ee804abd07417b8dec4f7 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/p.lua @@ -0,0 +1,311 @@ +---------------------------------------------------------------------------- +-- LuaJIT profiler. +-- +-- Copyright (C) 2005-2017 Mike Pall. All rights reserved. +-- Released under the MIT license. See Copyright Notice in luajit.h +---------------------------------------------------------------------------- +-- +-- This module is a simple command line interface to the built-in +-- low-overhead profiler of LuaJIT. +-- +-- The lower-level API of the profiler is accessible via the "jit.profile" +-- module or the luaJIT_profile_* C API. +-- +-- Example usage: +-- +-- luajit -jp myapp.lua +-- luajit -jp=s myapp.lua +-- luajit -jp=-s myapp.lua +-- luajit -jp=vl myapp.lua +-- luajit -jp=G,profile.txt myapp.lua +-- +-- The following dump features are available: +-- +-- f Stack dump: function name, otherwise module:line. Default mode. +-- F Stack dump: ditto, but always prepend module. +-- l Stack dump: module:line. +-- stack dump depth (callee < caller). Default: 1. +-- - Inverse stack dump depth (caller > callee). +-- s Split stack dump after first stack level. Implies abs(depth) >= 2. +-- p Show full path for module names. +-- v Show VM states. Can be combined with stack dumps, e.g. vf or fv. +-- z Show zones. Can be combined with stack dumps, e.g. zf or fz. +-- r Show raw sample counts. Default: show percentages. +-- a Annotate excerpts from source code files. +-- A Annotate complete source code files. +-- G Produce raw output suitable for graphical tools (e.g. flame graphs). +-- m Minimum sample percentage to be shown. Default: 3. +-- i Sampling interval in milliseconds. Default: 10. +-- +---------------------------------------------------------------------------- + +-- Cache some library functions and objects. +local jit = require("jit") +assert(jit.version_num == 20100, "LuaJIT core/library version mismatch") +local profile = require("jit.profile") +local vmdef = require("jit.vmdef") +local math = math +local pairs, ipairs, tonumber, floor = pairs, ipairs, tonumber, math.floor +local sort, format = table.sort, string.format +local stdout = io.stdout +local zone -- Load jit.zone module on demand. + +-- Output file handle. +local out + +------------------------------------------------------------------------------ + +local prof_ud +local prof_states, prof_split, prof_min, prof_raw, prof_fmt, prof_depth +local prof_ann, prof_count1, prof_count2, prof_samples + +local map_vmmode = { + N = "Compiled", + I = "Interpreted", + C = "C code", + G = "Garbage Collector", + J = "JIT Compiler", +} + +-- Profiler callback. +local function prof_cb(th, samples, vmmode) + prof_samples = prof_samples + samples + local key_stack, key_stack2, key_state + -- Collect keys for sample. + if prof_states then + if prof_states == "v" then + key_state = map_vmmode[vmmode] or vmmode + else + key_state = zone:get() or "(none)" + end + end + if prof_fmt then + key_stack = profile.dumpstack(th, prof_fmt, prof_depth) + key_stack = key_stack:gsub("%[builtin#(%d+)%]", function(x) + return vmdef.ffnames[tonumber(x)] + end) + if prof_split == 2 then + local k1, k2 = key_stack:match("(.-) [<>] (.*)") + if k2 then key_stack, key_stack2 = k1, k2 end + elseif prof_split == 3 then + key_stack2 = profile.dumpstack(th, "l", 1) + end + end + -- Order keys. + local k1, k2 + if prof_split == 1 then + if key_state then + k1 = key_state + if key_stack then k2 = key_stack end + end + elseif key_stack then + k1 = key_stack + if key_stack2 then k2 = key_stack2 elseif key_state then k2 = key_state end + end + -- Coalesce samples in one or two levels. + if k1 then + local t1 = prof_count1 + t1[k1] = (t1[k1] or 0) + samples + if k2 then + local t2 = prof_count2 + local t3 = t2[k1] + if not t3 then t3 = {}; t2[k1] = t3 end + t3[k2] = (t3[k2] or 0) + samples + end + end +end + +------------------------------------------------------------------------------ + +-- Show top N list. +local function prof_top(count1, count2, samples, indent) + local t, n = {}, 0 + for k in pairs(count1) do + n = n + 1 + t[n] = k + end + sort(t, function(a, b) return count1[a] > count1[b] end) + for i=1,n do + local k = t[i] + local v = count1[k] + local pct = floor(v*100/samples + 0.5) + if pct < prof_min then break end + if not prof_raw then + out:write(format("%s%2d%% %s\n", indent, pct, k)) + elseif prof_raw == "r" then + out:write(format("%s%5d %s\n", indent, v, k)) + else + out:write(format("%s %d\n", k, v)) + end + if count2 then + local r = count2[k] + if r then + prof_top(r, nil, v, (prof_split == 3 or prof_split == 1) and " -- " or + (prof_depth < 0 and " -> " or " <- ")) + end + end + end +end + +-- Annotate source code +local function prof_annotate(count1, samples) + local files = {} + local ms = 0 + for k, v in pairs(count1) do + local pct = floor(v*100/samples + 0.5) + ms = math.max(ms, v) + if pct >= prof_min then + local file, line = k:match("^(.*):(%d+)$") + if not file then file = k; line = 0 end + local fl = files[file] + if not fl then fl = {}; files[file] = fl; files[#files+1] = file end + line = tonumber(line) + fl[line] = prof_raw and v or pct + end + end + sort(files) + local fmtv, fmtn = " %3d%% | %s\n", " | %s\n" + if prof_raw then + local n = math.max(5, math.ceil(math.log10(ms))) + fmtv = "%"..n.."d | %s\n" + fmtn = (" "):rep(n).." | %s\n" + end + local ann = prof_ann + for _, file in ipairs(files) do + local f0 = file:byte() + if f0 == 40 or f0 == 91 then + out:write(format("\n====== %s ======\n[Cannot annotate non-file]\n", file)) + break + end + local fp, err = io.open(file) + if not fp then + out:write(format("====== ERROR: %s: %s\n", file, err)) + break + end + out:write(format("\n====== %s ======\n", file)) + local fl = files[file] + local n, show = 1, false + if ann ~= 0 then + for i=1,ann do + if fl[i] then show = true; out:write("@@ 1 @@\n"); break end + end + end + for line in fp:lines() do + if line:byte() == 27 then + out:write("[Cannot annotate bytecode file]\n") + break + end + local v = fl[n] + if ann ~= 0 then + local v2 = fl[n+ann] + if show then + if v2 then show = n+ann elseif v then show = n + elseif show+ann < n then show = false end + elseif v2 then + show = n+ann + out:write(format("@@ %d @@\n", n)) + end + if not show then goto next end + end + if v then + out:write(format(fmtv, v, line)) + else + out:write(format(fmtn, line)) + end + ::next:: + n = n + 1 + end + fp:close() + end +end + +------------------------------------------------------------------------------ + +-- Finish profiling and dump result. +local function prof_finish() + if prof_ud then + profile.stop() + local samples = prof_samples + if samples == 0 then + if prof_raw ~= true then out:write("[No samples collected]\n") end + return + end + if prof_ann then + prof_annotate(prof_count1, samples) + else + prof_top(prof_count1, prof_count2, samples, "") + end + prof_count1 = nil + prof_count2 = nil + prof_ud = nil + end +end + +-- Start profiling. +local function prof_start(mode) + local interval = "" + mode = mode:gsub("i%d*", function(s) interval = s; return "" end) + prof_min = 3 + mode = mode:gsub("m(%d+)", function(s) prof_min = tonumber(s); return "" end) + prof_depth = 1 + mode = mode:gsub("%-?%d+", function(s) prof_depth = tonumber(s); return "" end) + local m = {} + for c in mode:gmatch(".") do m[c] = c end + prof_states = m.z or m.v + if prof_states == "z" then zone = require("jit.zone") end + local scope = m.l or m.f or m.F or (prof_states and "" or "f") + local flags = (m.p or "") + prof_raw = m.r + if m.s then + prof_split = 2 + if prof_depth == -1 or m["-"] then prof_depth = -2 + elseif prof_depth == 1 then prof_depth = 2 end + elseif mode:find("[fF].*l") then + scope = "l" + prof_split = 3 + else + prof_split = (scope == "" or mode:find("[zv].*[lfF]")) and 1 or 0 + end + prof_ann = m.A and 0 or (m.a and 3) + if prof_ann then + scope = "l" + prof_fmt = "pl" + prof_split = 0 + prof_depth = 1 + elseif m.G and scope ~= "" then + prof_fmt = flags..scope.."Z;" + prof_depth = -100 + prof_raw = true + prof_min = 0 + elseif scope == "" then + prof_fmt = false + else + local sc = prof_split == 3 and m.f or m.F or scope + prof_fmt = flags..sc..(prof_depth >= 0 and "Z < " or "Z > ") + end + prof_count1 = {} + prof_count2 = {} + prof_samples = 0 + profile.start(scope:lower()..interval, prof_cb) + prof_ud = newproxy(true) + getmetatable(prof_ud).__gc = prof_finish +end + +------------------------------------------------------------------------------ + +local function start(mode, outfile) + if not outfile then outfile = os.getenv("LUAJIT_PROFILEFILE") end + if outfile then + out = outfile == "-" and stdout or assert(io.open(outfile, "w")) + else + out = stdout + end + prof_start(mode or "f") +end + +-- Public module functions. +return { + start = start, -- For -j command line option. + stop = prof_finish +} + diff --git a/Assets/LuaFramework/ToLua/Lua/jit/p.lua.meta b/Assets/LuaFramework/ToLua/Lua/jit/p.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..47f2466f86a066bdadb55d63ff9921d074478623 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/p.lua.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 413d3a4d59c39ea48b62dbb8f1b361c3 +timeCreated: 1492692752 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Lua/jit/v.lua b/Assets/LuaFramework/ToLua/Lua/jit/v.lua new file mode 100644 index 0000000000000000000000000000000000000000..f87ed44de055a9bf502c130027532fb4a60f0560 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/v.lua @@ -0,0 +1,163 @@ +---------------------------------------------------------------------------- +-- Verbose mode of the LuaJIT compiler. +-- +-- Copyright (C) 2005-2017 Mike Pall. All rights reserved. +-- Released under the MIT license. See Copyright Notice in luajit.h +---------------------------------------------------------------------------- +-- +-- This module shows verbose information about the progress of the +-- JIT compiler. It prints one line for each generated trace. This module +-- is useful to see which code has been compiled or where the compiler +-- punts and falls back to the interpreter. +-- +-- Example usage: +-- +-- luajit -jv -e "for i=1,1000 do for j=1,1000 do end end" +-- luajit -jv=myapp.out myapp.lua +-- +-- Default output is to stderr. To redirect the output to a file, pass a +-- filename as an argument (use '-' for stdout) or set the environment +-- variable LUAJIT_VERBOSEFILE. The file is overwritten every time the +-- module is started. +-- +-- The output from the first example should look like this: +-- +-- [TRACE 1 (command line):1 loop] +-- [TRACE 2 (1/3) (command line):1 -> 1] +-- +-- The first number in each line is the internal trace number. Next are +-- the file name ('(command line)') and the line number (':1') where the +-- trace has started. Side traces also show the parent trace number and +-- the exit number where they are attached to in parentheses ('(1/3)'). +-- An arrow at the end shows where the trace links to ('-> 1'), unless +-- it loops to itself. +-- +-- In this case the inner loop gets hot and is traced first, generating +-- a root trace. Then the last exit from the 1st trace gets hot, too, +-- and triggers generation of the 2nd trace. The side trace follows the +-- path along the outer loop and *around* the inner loop, back to its +-- start, and then links to the 1st trace. Yes, this may seem unusual, +-- if you know how traditional compilers work. Trace compilers are full +-- of surprises like this -- have fun! :-) +-- +-- Aborted traces are shown like this: +-- +-- [TRACE --- foo.lua:44 -- leaving loop in root trace at foo:lua:50] +-- +-- Don't worry -- trace aborts are quite common, even in programs which +-- can be fully compiled. The compiler may retry several times until it +-- finds a suitable trace. +-- +-- Of course this doesn't work with features that are not-yet-implemented +-- (NYI error messages). The VM simply falls back to the interpreter. This +-- may not matter at all if the particular trace is not very high up in +-- the CPU usage profile. Oh, and the interpreter is quite fast, too. +-- +-- Also check out the -jdump module, which prints all the gory details. +-- +------------------------------------------------------------------------------ + +-- Cache some library functions and objects. +local jit = require("jit") +assert(jit.version_num == 20100, "LuaJIT core/library version mismatch") +local jutil = require("jit.util") +local vmdef = require("jit.vmdef") +local funcinfo, traceinfo = jutil.funcinfo, jutil.traceinfo +local type, format = type, string.format +local stdout, stderr = io.stdout, io.stderr + +-- Active flag and output file handle. +local active, out + +------------------------------------------------------------------------------ + +local startloc, startex + +local function fmtfunc(func, pc) + local fi = funcinfo(func, pc) + if fi.loc then + return fi.loc + elseif fi.ffid then + return vmdef.ffnames[fi.ffid] + elseif fi.addr then + return format("C:%x", fi.addr) + else + return "(?)" + end +end + +-- Format trace error message. +local function fmterr(err, info) + if type(err) == "number" then + if type(info) == "function" then info = fmtfunc(info) end + err = format(vmdef.traceerr[err], info) + end + return err +end + +-- Dump trace states. +local function dump_trace(what, tr, func, pc, otr, oex) + if what == "start" then + startloc = fmtfunc(func, pc) + startex = otr and "("..otr.."/"..(oex == -1 and "stitch" or oex)..") " or "" + else + if what == "abort" then + local loc = fmtfunc(func, pc) + if loc ~= startloc then + print(format("[TRACE --- %s%s -- %s at %s]\n", startex, startloc, fmterr(otr, oex), loc)) + else + print(format("[TRACE --- %s%s -- %s]\n", startex, startloc, fmterr(otr, oex))) + end + elseif what == "stop" then + local info = traceinfo(tr) + local link, ltype = info.link, info.linktype + if ltype == "interpreter" then + print(format("[TRACE %3s %s%s -- fallback to interpreter]\n", tr, startex, startloc)) + elseif ltype == "stitch" then + print(format("[TRACE %3s %s%s %s %s]\n", tr, startex, startloc, ltype, fmtfunc(func, pc))) + elseif link == tr or link == 0 then + print(format("[TRACE %3s %s%s %s]\n", tr, startex, startloc, ltype)) + elseif ltype == "root" then + print(format("[TRACE %3s %s%s -> %d]\n", tr, startex, startloc, link)) + else + print(format("[TRACE %3s %s%s -> %d %s]\n", tr, startex, startloc, link, ltype)) + end + else + print(format("[TRACE %s]\n", what)) + end + out:flush() + end +end + +------------------------------------------------------------------------------ + +-- Detach dump handlers. +local function dumpoff() + if active then + active = false + jit.attach(dump_trace) + if out and out ~= stdout and out ~= stderr then out:close() end + out = nil + end +end + +-- Open the output file and attach dump handlers. +local function dumpon(outfile) + if active then dumpoff() end + if not outfile then outfile = os.getenv("LUAJIT_VERBOSEFILE") end + if outfile then + out = outfile == "-" and stdout or assert(io.open(outfile, "w")) + else + out = stderr + end + jit.attach(dump_trace, "trace") + active = true +end + +-- Public module functions. +return { + on = dumpon, + off = dumpoff, + start = dumpon -- For -j command line option. +} + diff --git a/Assets/LuaFramework/ToLua/Lua/jit/v.lua.meta b/Assets/LuaFramework/ToLua/Lua/jit/v.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..e1a23c348512b4c5f28967b9f6f02dafa64ea18b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/v.lua.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e83d256a881de8f4ab20afb40ff611f7 +timeCreated: 1492692752 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Lua/jit/vmdef.lua b/Assets/LuaFramework/ToLua/Lua/jit/vmdef.lua new file mode 100644 index 0000000000000000000000000000000000000000..266011342a93b8f58282d627d8c01e5487e546a8 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/vmdef.lua @@ -0,0 +1,363 @@ +-- This is a generated file. DO NOT EDIT! + +return { + +bcnames = "ISLT ISGE ISLE ISGT ISEQV ISNEV ISEQS ISNES ISEQN ISNEN ISEQP ISNEP ISTC ISFC IST ISF ISTYPEISNUM MOV NOT UNM LEN ADDVN SUBVN MULVN DIVVN MODVN ADDNV SUBNV MULNV DIVNV MODNV ADDVV SUBVV MULVV DIVVV MODVV POW CAT KSTR KCDATAKSHORTKNUM KPRI KNIL UGET USETV USETS USETN USETP UCLO FNEW TNEW TDUP GGET GSET TGETV TGETS TGETB TGETR TSETV TSETS TSETB TSETM TSETR CALLM CALL CALLMTCALLT ITERC ITERN VARG ISNEXTRETM RET RET0 RET1 FORI JFORI FORL IFORL JFORL ITERL IITERLJITERLLOOP ILOOP JLOOP JMP FUNCF IFUNCFJFUNCFFUNCV IFUNCVJFUNCVFUNCC FUNCCW", + +irnames = "LT GE LE GT ULT UGE ULE UGT EQ NE ABC RETF NOP BASE PVAL GCSTEPHIOP LOOP USE PHI RENAMEPROF KPRI KINT KGC KPTR KKPTR KNULL KNUM KINT64KSLOT BNOT BSWAP BAND BOR BXOR BSHL BSHR BSAR BROL BROR ADD SUB MUL DIV MOD POW NEG ABS ATAN2 LDEXP MIN MAX FPMATHADDOV SUBOV MULOV AREF HREFK HREF NEWREFUREFO UREFC FREF STRREFLREF ALOAD HLOAD ULOAD FLOAD XLOAD SLOAD VLOAD ASTOREHSTOREUSTOREFSTOREXSTORESNEW XSNEW TNEW TDUP CNEW CNEWI BUFHDRBUFPUTBUFSTRTBAR OBAR XBAR CONV TOBIT TOSTR STRTO CALLN CALLA CALLL CALLS CALLXSCARG ", + +irfpm = { [0]="floor", "ceil", "trunc", "sqrt", "exp", "exp2", "log", "log2", "log10", "sin", "cos", "tan", "other", }, + +irfield = { [0]="str.len", "func.env", "func.pc", "func.ffid", "thread.env", "tab.meta", "tab.array", "tab.node", "tab.asize", "tab.hmask", "tab.nomm", "udata.meta", "udata.udtype", "udata.file", "cdata.ctypeid", "cdata.ptr", "cdata.int", "cdata.int64", "cdata.int64_4", }, + +ircall = { +[0]="lj_str_cmp", +"lj_str_find", +"lj_str_new", +"lj_strscan_num", +"lj_strfmt_int", +"lj_strfmt_num", +"lj_strfmt_char", +"lj_strfmt_putint", +"lj_strfmt_putnum", +"lj_strfmt_putquoted", +"lj_strfmt_putfxint", +"lj_strfmt_putfnum_int", +"lj_strfmt_putfnum_uint", +"lj_strfmt_putfnum", +"lj_strfmt_putfstr", +"lj_strfmt_putfchar", +"lj_buf_putmem", +"lj_buf_putstr", +"lj_buf_putchar", +"lj_buf_putstr_reverse", +"lj_buf_putstr_lower", +"lj_buf_putstr_upper", +"lj_buf_putstr_rep", +"lj_buf_puttab", +"lj_buf_tostr", +"lj_tab_new_ah", +"lj_tab_new1", +"lj_tab_dup", +"lj_tab_clear", +"lj_tab_newkey", +"lj_tab_len", +"lj_gc_step_jit", +"lj_gc_barrieruv", +"lj_mem_newgco", +"lj_math_random_step", +"lj_vm_modi", +"sinh", +"cosh", +"tanh", +"fputc", +"fwrite", +"fflush", +"lj_vm_floor", +"lj_vm_ceil", +"lj_vm_trunc", +"sqrt", +"exp", +"lj_vm_exp2", +"log", +"lj_vm_log2", +"log10", +"sin", +"cos", +"tan", +"lj_vm_powi", +"pow", +"atan2", +"ldexp", +"lj_vm_tobit", +"softfp_add", +"softfp_sub", +"softfp_mul", +"softfp_div", +"softfp_cmp", +"softfp_i2d", +"softfp_d2i", +"lj_vm_sfmin", +"lj_vm_sfmax", +"softfp_ui2d", +"softfp_f2d", +"softfp_d2ui", +"softfp_d2f", +"softfp_i2f", +"softfp_ui2f", +"softfp_f2i", +"softfp_f2ui", +"fp64_l2d", +"fp64_ul2d", +"fp64_l2f", +"fp64_ul2f", +"fp64_d2l", +"fp64_d2ul", +"fp64_f2l", +"fp64_f2ul", +"lj_carith_divi64", +"lj_carith_divu64", +"lj_carith_modi64", +"lj_carith_modu64", +"lj_carith_powi64", +"lj_carith_powu64", +"lj_cdata_newv", +"lj_cdata_setfin", +"strlen", +"memcpy", +"memset", +"lj_vm_errno", +"lj_carith_mul64", +"lj_carith_shl64", +"lj_carith_shr64", +"lj_carith_sar64", +"lj_carith_rol64", +"lj_carith_ror64", +}, + +traceerr = { +[0]="error thrown or hook called during recording", +"trace too short", +"trace too long", +"trace too deep", +"too many snapshots", +"blacklisted", +"retry recording", +"NYI: bytecode %d", +"leaving loop in root trace", +"inner loop in root trace", +"loop unroll limit reached", +"bad argument type", +"JIT compilation disabled for function", +"call unroll limit reached", +"down-recursion, restarting", +"NYI: unsupported variant of FastFunc %s", +"NYI: return to lower frame", +"store with nil or NaN key", +"missing metamethod", +"looping index lookup", +"NYI: mixed sparse/dense table", +"symbol not in cache", +"NYI: unsupported C type conversion", +"NYI: unsupported C function type", +"guard would always fail", +"too many PHIs", +"persistent type instability", +"failed to allocate mcode memory", +"machine code too long", +"hit mcode limit (retrying)", +"too many spill slots", +"inconsistent register allocation", +"NYI: cannot assemble IR instruction %d", +"NYI: PHI shuffling too complex", +"NYI: register coalescing too complex", +}, + +ffnames = { +[0]="Lua", +"C", +"assert", +"type", +"next", +"pairs", +"ipairs_aux", +"ipairs", +"getmetatable", +"setmetatable", +"getfenv", +"setfenv", +"rawget", +"rawset", +"rawequal", +"unpack", +"select", +"tonumber", +"tostring", +"error", +"pcall", +"xpcall", +"loadfile", +"load", +"loadstring", +"dofile", +"gcinfo", +"collectgarbage", +"newproxy", +"print", +"coroutine.status", +"coroutine.running", +"coroutine.isyieldable", +"coroutine.create", +"coroutine.yield", +"coroutine.resume", +"coroutine.wrap_aux", +"coroutine.wrap", +"math.abs", +"math.floor", +"math.ceil", +"math.sqrt", +"math.log10", +"math.exp", +"math.sin", +"math.cos", +"math.tan", +"math.asin", +"math.acos", +"math.atan", +"math.sinh", +"math.cosh", +"math.tanh", +"math.frexp", +"math.modf", +"math.log", +"math.atan2", +"math.pow", +"math.fmod", +"math.ldexp", +"math.min", +"math.max", +"math.random", +"math.randomseed", +"bit.tobit", +"bit.bnot", +"bit.bswap", +"bit.lshift", +"bit.rshift", +"bit.arshift", +"bit.rol", +"bit.ror", +"bit.band", +"bit.bor", +"bit.bxor", +"bit.tohex", +"string.byte", +"string.char", +"string.sub", +"string.rep", +"string.reverse", +"string.lower", +"string.upper", +"string.dump", +"string.find", +"string.match", +"string.gmatch_aux", +"string.gmatch", +"string.gsub", +"string.format", +"table.maxn", +"table.insert", +"table.concat", +"table.sort", +"table.new", +"table.clear", +"io.method.close", +"io.method.read", +"io.method.write", +"io.method.flush", +"io.method.seek", +"io.method.setvbuf", +"io.method.lines", +"io.method.__gc", +"io.method.__tostring", +"io.open", +"io.popen", +"io.tmpfile", +"io.close", +"io.read", +"io.write", +"io.flush", +"io.input", +"io.output", +"io.lines", +"io.type", +"os.execute", +"os.remove", +"os.rename", +"os.tmpname", +"os.getenv", +"os.exit", +"os.clock", +"os.date", +"os.time", +"os.difftime", +"os.setlocale", +"debug.getregistry", +"debug.getmetatable", +"debug.setmetatable", +"debug.getfenv", +"debug.setfenv", +"debug.getinfo", +"debug.getlocal", +"debug.setlocal", +"debug.getupvalue", +"debug.setupvalue", +"debug.upvalueid", +"debug.upvaluejoin", +"debug.sethook", +"debug.gethook", +"debug.debug", +"debug.traceback", +"jit.on", +"jit.off", +"jit.flush", +"jit.status", +"jit.attach", +"jit.util.funcinfo", +"jit.util.funcbc", +"jit.util.funck", +"jit.util.funcuvname", +"jit.util.traceinfo", +"jit.util.traceir", +"jit.util.tracek", +"jit.util.tracesnap", +"jit.util.tracemc", +"jit.util.traceexitstub", +"jit.util.ircalladdr", +"jit.opt.start", +"jit.profile.start", +"jit.profile.stop", +"jit.profile.dumpstack", +"ffi.meta.__index", +"ffi.meta.__newindex", +"ffi.meta.__eq", +"ffi.meta.__len", +"ffi.meta.__lt", +"ffi.meta.__le", +"ffi.meta.__concat", +"ffi.meta.__call", +"ffi.meta.__add", +"ffi.meta.__sub", +"ffi.meta.__mul", +"ffi.meta.__div", +"ffi.meta.__mod", +"ffi.meta.__pow", +"ffi.meta.__unm", +"ffi.meta.__tostring", +"ffi.meta.__pairs", +"ffi.meta.__ipairs", +"ffi.clib.__index", +"ffi.clib.__newindex", +"ffi.clib.__gc", +"ffi.callback.free", +"ffi.callback.set", +"ffi.cdef", +"ffi.new", +"ffi.cast", +"ffi.typeof", +"ffi.typeinfo", +"ffi.istype", +"ffi.sizeof", +"ffi.alignof", +"ffi.offsetof", +"ffi.errno", +"ffi.string", +"ffi.copy", +"ffi.fill", +"ffi.abi", +"ffi.metatype", +"ffi.gc", +"ffi.load", +}, + +} + diff --git a/Assets/LuaFramework/ToLua/Lua/jit/vmdef.lua.meta b/Assets/LuaFramework/ToLua/Lua/jit/vmdef.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..05a01a7f164ca3195f7529db731079d4979284a5 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/vmdef.lua.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e5d8aeae2f0a20e4396eefb2f2dc4268 +timeCreated: 1492693197 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Lua/jit/zone.lua b/Assets/LuaFramework/ToLua/Lua/jit/zone.lua new file mode 100644 index 0000000000000000000000000000000000000000..fa702c4e989089f9ef5ae078463b09c0a74091de --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/zone.lua @@ -0,0 +1,45 @@ +---------------------------------------------------------------------------- +-- LuaJIT profiler zones. +-- +-- Copyright (C) 2005-2017 Mike Pall. All rights reserved. +-- Released under the MIT license. See Copyright Notice in luajit.h +---------------------------------------------------------------------------- +-- +-- This module implements a simple hierarchical zone model. +-- +-- Example usage: +-- +-- local zone = require("jit.zone") +-- zone("AI") +-- ... +-- zone("A*") +-- ... +-- print(zone:get()) --> "A*" +-- ... +-- zone() +-- ... +-- print(zone:get()) --> "AI" +-- ... +-- zone() +-- +---------------------------------------------------------------------------- + +local remove = table.remove + +return setmetatable({ + flush = function(t) + for i=#t,1,-1 do t[i] = nil end + end, + get = function(t) + return t[#t] + end +}, { + __call = function(t, zone) + if zone then + t[#t+1] = zone + else + return (assert(remove(t), "empty zone stack")) + end + end +}) + diff --git a/Assets/LuaFramework/ToLua/Lua/jit/zone.lua.meta b/Assets/LuaFramework/ToLua/Lua/jit/zone.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..dd57808e5420372ac513ec60def15ee9b76b5e7b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/jit/zone.lua.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: af44e752354375746813d50c6d26b867 +timeCreated: 1492692752 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Lua/list.lua b/Assets/LuaFramework/ToLua/Lua/list.lua new file mode 100644 index 0000000000000000000000000000000000000000..0779627e802157656ac82cc48ae9ca243b843a6d --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/list.lua @@ -0,0 +1,180 @@ +-------------------------------------------------------------------------------- +-- Copyright (c) 2015 - 2016 , 钂欏崰蹇(topameng) topameng@gmail.com +-- All rights reserved. +-- Use, modification and distribution are subject to the "MIT License" +-------------------------------------------------------------------------------- +local setmetatable = setmetatable + +local list = {} +list.__index = list + +function list:new() + local t = {length = 0, _prev = 0, _next = 0} + t._prev = t + t._next = t + return setmetatable(t, list) +end + +function list:clear() + self._next = self + self._prev = self + self.length = 0 +end + +function list:push(value) + --assert(value) + local node = {value = value, _prev = 0, _next = 0, removed = false} + + self._prev._next = node + node._next = self + node._prev = self._prev + self._prev = node + + self.length = self.length + 1 + return node +end + +function list:pushnode(node) + if not node.removed then return end + + self._prev._next = node + node._next = self + node._prev = self._prev + self._prev = node + node.removed = false + self.length = self.length + 1 +end + +function list:pop() + local _prev = self._prev + self:remove(_prev) + return _prev.value +end + +function list:unshift(v) + local node = {value = v, _prev = 0, _next = 0, removed = false} + + self._next._prev = node + node._prev = self + node._next = self._next + self._next = node + + self.length = self.length + 1 + return node +end + +function list:shift() + local _next = self._next + self:remove(_next) + return _next.value +end + +function list:remove(iter) + if iter.removed then return end + + local _prev = iter._prev + local _next = iter._next + _next._prev = _prev + _prev._next = _next + + self.length = math.max(0, self.length - 1) + iter.removed = true +end + +function list:find(v, iter) + iter = iter or self + + repeat + if v == iter.value then + return iter + else + iter = iter._next + end + until iter == self + + return nil +end + +function list:findlast(v, iter) + iter = iter or self + + repeat + if v == iter.value then + return iter + end + + iter = iter._prev + until iter == self + + return nil +end + +function list:next(iter) + local _next = iter._next + if _next ~= self then + return _next, _next.value + end + + return nil +end + +function list:prev(iter) + local _prev = iter._prev + if _prev ~= self then + return _prev, _prev.value + end + + return nil +end + +function list:erase(v) + local iter = self:find(v) + + if iter then + self:remove(iter) + end +end + +function list:insert(v, iter) + if not iter then + return self:push(v) + end + + local node = {value = v, _next = 0, _prev = 0, removed = false} + + if iter._next then + iter._next._prev = node + node._next = iter._next + else + self.last = node + end + + node._prev = iter + iter._next = node + self.length = self.length + 1 + return node +end + +function list:head() + return self._next.value +end + +function list:tail() + return self._prev.value +end + +function list:clone() + local t = list:new() + + for i, v in list.next, self, self do + t:push(v) + end + + return t +end + +ilist = function(_list) return list.next, _list, _list end +rilist = function(_list) return list.prev, _list, _list end + +setmetatable(list, {__call = list.new}) +return list \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Lua/list.lua.meta b/Assets/LuaFramework/ToLua/Lua/list.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..3e473f17de04c823897bf8cf2fcf72887a6206f9 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/list.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: f0d0ca55b7df3414aafaf11a39c13378 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/lpeg.meta b/Assets/LuaFramework/ToLua/Lua/lpeg.meta new file mode 100644 index 0000000000000000000000000000000000000000..4b26360fe7496e6545a9a1cc23965ae212cdadbb --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/lpeg.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 58143f62c40fa4143903b5b1abc707fe +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/lpeg/re.lua b/Assets/LuaFramework/ToLua/Lua/lpeg/re.lua new file mode 100644 index 0000000000000000000000000000000000000000..f8e7c373ac5fbc557ef4917e61f5ecaf9367cfcf --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/lpeg/re.lua @@ -0,0 +1,262 @@ +-- $Id: re.lua,v 1.44 2013/03/26 20:11:40 roberto Exp $ + +-- imported functions and modules +local tonumber, type, print, error = tonumber, type, print, error +local setmetatable = setmetatable +local m = require"lpeg" + +-- 'm' will be used to parse expressions, and 'mm' will be used to +-- create expressions; that is, 're' runs on 'm', creating patterns +-- on 'mm' +local mm = m + +-- pattern's metatable +local mt = getmetatable(mm.P(0)) + + + +-- No more global accesses after this point +local version = _VERSION +if version == "Lua 5.2" then _ENV = nil end + + +local any = m.P(1) + + +-- Pre-defined names +local Predef = { nl = m.P"\n" } + + +local mem +local fmem +local gmem + + +local function updatelocale () + mm.locale(Predef) + Predef.a = Predef.alpha + Predef.c = Predef.cntrl + Predef.d = Predef.digit + Predef.g = Predef.graph + Predef.l = Predef.lower + Predef.p = Predef.punct + Predef.s = Predef.space + Predef.u = Predef.upper + Predef.w = Predef.alnum + Predef.x = Predef.xdigit + Predef.A = any - Predef.a + Predef.C = any - Predef.c + Predef.D = any - Predef.d + Predef.G = any - Predef.g + Predef.L = any - Predef.l + Predef.P = any - Predef.p + Predef.S = any - Predef.s + Predef.U = any - Predef.u + Predef.W = any - Predef.w + Predef.X = any - Predef.x + mem = {} -- restart memoization + fmem = {} + gmem = {} + local mt = {__mode = "v"} + setmetatable(mem, mt) + setmetatable(fmem, mt) + setmetatable(gmem, mt) +end + + +updatelocale() + + + +local I = m.P(function (s,i) print(i, s:sub(1, i-1)); return i end) + + +local function getdef (id, defs) + local c = defs and defs[id] + if not c then error("undefined name: " .. id) end + return c +end + + +local function patt_error (s, i) + local msg = (#s < i + 20) and s:sub(i) + or s:sub(i,i+20) .. "..." + msg = ("pattern error near '%s'"):format(msg) + error(msg, 2) +end + +local function mult (p, n) + local np = mm.P(true) + while n >= 1 do + if n%2 >= 1 then np = np * p end + p = p * p + n = n/2 + end + return np +end + +local function equalcap (s, i, c) + if type(c) ~= "string" then return nil end + local e = #c + i + if s:sub(i, e - 1) == c then return e else return nil end +end + + +local S = (Predef.space + "--" * (any - Predef.nl)^0)^0 + +local name = m.R("AZ", "az", "__") * m.R("AZ", "az", "__", "09")^0 + +local arrow = S * "<-" + +local seq_follow = m.P"/" + ")" + "}" + ":}" + "~}" + "|}" + (name * arrow) + -1 + +name = m.C(name) + + +-- a defined name only have meaning in a given environment +local Def = name * m.Carg(1) + +local num = m.C(m.R"09"^1) * S / tonumber + +local String = "'" * m.C((any - "'")^0) * "'" + + '"' * m.C((any - '"')^0) * '"' + + +local defined = "%" * Def / function (c,Defs) + local cat = Defs and Defs[c] or Predef[c] + if not cat then error ("name '" .. c .. "' undefined") end + return cat +end + +local Range = m.Cs(any * (m.P"-"/"") * (any - "]")) / mm.R + +local item = defined + Range + m.C(any) + +local Class = + "[" + * (m.C(m.P"^"^-1)) -- optional complement symbol + * m.Cf(item * (item - "]")^0, mt.__add) / + function (c, p) return c == "^" and any - p or p end + * "]" + +local function adddef (t, k, exp) + if t[k] then + error("'"..k.."' already defined as a rule") + else + t[k] = exp + end + return t +end + +local function firstdef (n, r) return adddef({n}, n, r) end + + +local function NT (n, b) + if not b then + error("rule '"..n.."' used outside a grammar") + else return mm.V(n) + end +end + + +local exp = m.P{ "Exp", + Exp = S * ( m.V"Grammar" + + m.Cf(m.V"Seq" * ("/" * S * m.V"Seq")^0, mt.__add) ); + Seq = m.Cf(m.Cc(m.P"") * m.V"Prefix"^0 , mt.__mul) + * (#seq_follow + patt_error); + Prefix = "&" * S * m.V"Prefix" / mt.__len + + "!" * S * m.V"Prefix" / mt.__unm + + m.V"Suffix"; + Suffix = m.Cf(m.V"Primary" * S * + ( ( m.P"+" * m.Cc(1, mt.__pow) + + m.P"*" * m.Cc(0, mt.__pow) + + m.P"?" * m.Cc(-1, mt.__pow) + + "^" * ( m.Cg(num * m.Cc(mult)) + + m.Cg(m.C(m.S"+-" * m.R"09"^1) * m.Cc(mt.__pow)) + ) + + "->" * S * ( m.Cg((String + num) * m.Cc(mt.__div)) + + m.P"{}" * m.Cc(nil, m.Ct) + + m.Cg(Def / getdef * m.Cc(mt.__div)) + ) + + "=>" * S * m.Cg(Def / getdef * m.Cc(m.Cmt)) + ) * S + )^0, function (a,b,f) return f(a,b) end ); + Primary = "(" * m.V"Exp" * ")" + + String / mm.P + + Class + + defined + + "{:" * (name * ":" + m.Cc(nil)) * m.V"Exp" * ":}" / + function (n, p) return mm.Cg(p, n) end + + "=" * name / function (n) return mm.Cmt(mm.Cb(n), equalcap) end + + m.P"{}" / mm.Cp + + "{~" * m.V"Exp" * "~}" / mm.Cs + + "{|" * m.V"Exp" * "|}" / mm.Ct + + "{" * m.V"Exp" * "}" / mm.C + + m.P"." * m.Cc(any) + + (name * -arrow + "<" * name * ">") * m.Cb("G") / NT; + Definition = name * arrow * m.V"Exp"; + Grammar = m.Cg(m.Cc(true), "G") * + m.Cf(m.V"Definition" / firstdef * m.Cg(m.V"Definition")^0, + adddef) / mm.P +} + +local pattern = S * m.Cg(m.Cc(false), "G") * exp / mm.P * (-any + patt_error) + + +local function compile (p, defs) + if mm.type(p) == "pattern" then return p end -- already compiled + local cp = pattern:match(p, 1, defs) + if not cp then error("incorrect pattern", 3) end + return cp +end + +local function match (s, p, i) + local cp = mem[p] + if not cp then + cp = compile(p) + mem[p] = cp + end + return cp:match(s, i or 1) +end + +local function find (s, p, i) + local cp = fmem[p] + if not cp then + cp = compile(p) / 0 + cp = mm.P{ mm.Cp() * cp * mm.Cp() + 1 * mm.V(1) } + fmem[p] = cp + end + local i, e = cp:match(s, i or 1) + if i then return i, e - 1 + else return i + end +end + +local function gsub (s, p, rep) + local g = gmem[p] or {} -- ensure gmem[p] is not collected while here + gmem[p] = g + local cp = g[rep] + if not cp then + cp = compile(p) + cp = mm.Cs((cp / rep + 1)^0) + g[rep] = cp + end + return cp:match(s) +end + + +-- exported names +local re = { + compile = compile, + match = match, + find = find, + gsub = gsub, + updatelocale = updatelocale, +} + +if version == "Lua 5.1" then + --I need this to work with strict.lua, sorry for breaking compatibility. + --_G.re = re +end + +return re diff --git a/Assets/LuaFramework/ToLua/Lua/lpeg/re.lua.meta b/Assets/LuaFramework/ToLua/Lua/lpeg/re.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..a81f87ae43d67a1941da9ce3bdc0fd94520b289c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/lpeg/re.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: b7e8b1ba4c06a4d4db879ad831cb62f1 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/ltn12.lua b/Assets/LuaFramework/ToLua/Lua/ltn12.lua new file mode 100644 index 0000000000000000000000000000000000000000..575c5a7f1bd5e5c5dd7d9d7640e2eb671ecc5ee8 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/ltn12.lua @@ -0,0 +1,309 @@ +----------------------------------------------------------------------------- +-- LTN12 - Filters, sources, sinks and pumps. +-- LuaSocket toolkit. +-- Author: Diego Nehab +----------------------------------------------------------------------------- + +----------------------------------------------------------------------------- +-- Declare module +----------------------------------------------------------------------------- +local string = require("string") +local table = require("table") +local unpack = unpack or table.unpack +local base = _G +local _M = {} +if module then -- heuristic for exporting a global package table + ltn12 = _M +end +local filter,source,sink,pump = {},{},{},{} + +_M.filter = filter +_M.source = source +_M.sink = sink +_M.pump = pump + +local unpack = unpack or table.unpack +local select = base.select + +-- 2048 seems to be better in windows... +_M.BLOCKSIZE = 2048 +_M._VERSION = "LTN12 1.0.3" + +----------------------------------------------------------------------------- +-- Filter stuff +----------------------------------------------------------------------------- +-- returns a high level filter that cycles a low-level filter +function filter.cycle(low, ctx, extra) + base.assert(low) + return function(chunk) + local ret + ret, ctx = low(ctx, chunk, extra) + return ret + end +end + +-- chains a bunch of filters together +-- (thanks to Wim Couwenberg) +function filter.chain(...) + local arg = {...} + local n = base.select('#',...) + local top, index = 1, 1 + local retry = "" + return function(chunk) + retry = chunk and retry + while true do + if index == top then + chunk = arg[index](chunk) + if chunk == "" or top == n then return chunk + elseif chunk then index = index + 1 + else + top = top+1 + index = top + end + else + chunk = arg[index](chunk or "") + if chunk == "" then + index = index - 1 + chunk = retry + elseif chunk then + if index == n then return chunk + else index = index + 1 end + else base.error("filter returned inappropriate nil") end + end + end + end +end + +----------------------------------------------------------------------------- +-- Source stuff +----------------------------------------------------------------------------- +-- create an empty source +local function empty() + return nil +end + +function source.empty() + return empty +end + +-- returns a source that just outputs an error +function source.error(err) + return function() + return nil, err + end +end + +-- creates a file source +function source.file(handle, io_err) + if handle then + return function() + local chunk = handle:read(_M.BLOCKSIZE) + if not chunk then handle:close() end + return chunk + end + else return source.error(io_err or "unable to open file") end +end + +-- turns a fancy source into a simple source +function source.simplify(src) + base.assert(src) + return function() + local chunk, err_or_new = src() + src = err_or_new or src + if not chunk then return nil, err_or_new + else return chunk end + end +end + +-- creates string source +function source.string(s) + if s then + local i = 1 + return function() + local chunk = string.sub(s, i, i+_M.BLOCKSIZE-1) + i = i + _M.BLOCKSIZE + if chunk ~= "" then return chunk + else return nil end + end + else return source.empty() end +end + +-- creates rewindable source +function source.rewind(src) + base.assert(src) + local t = {} + return function(chunk) + if not chunk then + chunk = table.remove(t) + if not chunk then return src() + else return chunk end + else + table.insert(t, chunk) + end + end +end + +-- chains a source with one or several filter(s) +function source.chain(src, f, ...) + if ... then f=filter.chain(f, ...) end + base.assert(src and f) + local last_in, last_out = "", "" + local state = "feeding" + local err + return function() + if not last_out then + base.error('source is empty!', 2) + end + while true do + if state == "feeding" then + last_in, err = src() + if err then return nil, err end + last_out = f(last_in) + if not last_out then + if last_in then + base.error('filter returned inappropriate nil') + else + return nil + end + elseif last_out ~= "" then + state = "eating" + if last_in then last_in = "" end + return last_out + end + else + last_out = f(last_in) + if last_out == "" then + if last_in == "" then + state = "feeding" + else + base.error('filter returned ""') + end + elseif not last_out then + if last_in then + base.error('filter returned inappropriate nil') + else + return nil + end + else + return last_out + end + end + end + end +end + +-- creates a source that produces contents of several sources, one after the +-- other, as if they were concatenated +-- (thanks to Wim Couwenberg) +function source.cat(...) + local arg = {...} + local src = table.remove(arg, 1) + return function() + while src do + local chunk, err = src() + if chunk then return chunk end + if err then return nil, err end + src = table.remove(arg, 1) + end + end +end + +----------------------------------------------------------------------------- +-- Sink stuff +----------------------------------------------------------------------------- +-- creates a sink that stores into a table +function sink.table(t) + t = t or {} + local f = function(chunk, err) + if chunk then table.insert(t, chunk) end + return 1 + end + return f, t +end + +-- turns a fancy sink into a simple sink +function sink.simplify(snk) + base.assert(snk) + return function(chunk, err) + local ret, err_or_new = snk(chunk, err) + if not ret then return nil, err_or_new end + snk = err_or_new or snk + return 1 + end +end + +-- creates a file sink +function sink.file(handle, io_err) + if handle then + return function(chunk, err) + if not chunk then + handle:close() + return 1 + else return handle:write(chunk) end + end + else return sink.error(io_err or "unable to open file") end +end + +-- creates a sink that discards data +local function null() + return 1 +end + +function sink.null() + return null +end + +-- creates a sink that just returns an error +function sink.error(err) + return function() + return nil, err + end +end + +-- chains a sink with one or several filter(s) +function sink.chain(f, snk, ...) + if ... then + local args = { f, snk, ... } + snk = table.remove(args, #args) + f = filter.chain(unpack(args)) + end + base.assert(f and snk) + return function(chunk, err) + if chunk ~= "" then + local filtered = f(chunk) + local done = chunk and "" + while true do + local ret, snkerr = snk(filtered, err) + if not ret then return nil, snkerr end + if filtered == done then return 1 end + filtered = f(done) + end + else return 1 end + end +end + +----------------------------------------------------------------------------- +-- Pump stuff +----------------------------------------------------------------------------- +-- pumps one chunk from the source to the sink +function pump.step(src, snk) + local chunk, src_err = src() + local ret, snk_err = snk(chunk, src_err) + if chunk and ret then return 1 + else return nil, src_err or snk_err end +end + +-- pumps all data from a source to a sink, using a step function +function pump.all(src, snk, step) + base.assert(src and snk) + step = step or pump.step + while true do + local ret, err = step(src, snk) + if not ret then + if err then return nil, err + else return 1 end + end + end +end + +return _M diff --git a/Assets/LuaFramework/ToLua/Lua/ltn12.lua.meta b/Assets/LuaFramework/ToLua/Lua/ltn12.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..f83a5d64d3124521c2b3d2e79ff456d724c955e9 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/ltn12.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 6f6ae256ba8bd244692e687b1b0ece95 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/mime.lua b/Assets/LuaFramework/ToLua/Lua/mime.lua new file mode 100644 index 0000000000000000000000000000000000000000..642cd9ca6e158fb34d6c5ac1fae5a5c481630db0 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/mime.lua @@ -0,0 +1,90 @@ +----------------------------------------------------------------------------- +-- MIME support for the Lua language. +-- Author: Diego Nehab +-- Conforming to RFCs 2045-2049 +----------------------------------------------------------------------------- + +----------------------------------------------------------------------------- +-- Declare module and import dependencies +----------------------------------------------------------------------------- +local base = _G +local ltn12 = require("ltn12") +local mime = require("mime.core") +local io = require("io") +local string = require("string") +local _M = mime + +-- encode, decode and wrap algorithm tables +local encodet, decodet, wrapt = {},{},{} + +_M.encodet = encodet +_M.decodet = decodet +_M.wrapt = wrapt + +-- creates a function that chooses a filter by name from a given table +local function choose(table) + return function(name, opt1, opt2) + if base.type(name) ~= "string" then + name, opt1, opt2 = "default", name, opt1 + end + local f = table[name or "nil"] + if not f then + base.error("unknown key (" .. base.tostring(name) .. ")", 3) + else return f(opt1, opt2) end + end +end + +-- define the encoding filters +encodet['base64'] = function() + return ltn12.filter.cycle(_M.b64, "") +end + +encodet['quoted-printable'] = function(mode) + return ltn12.filter.cycle(_M.qp, "", + (mode == "binary") and "=0D=0A" or "\r\n") +end + +-- define the decoding filters +decodet['base64'] = function() + return ltn12.filter.cycle(_M.unb64, "") +end + +decodet['quoted-printable'] = function() + return ltn12.filter.cycle(_M.unqp, "") +end + +local function format(chunk) + if chunk then + if chunk == "" then return "''" + else return string.len(chunk) end + else return "nil" end +end + +-- define the line-wrap filters +wrapt['text'] = function(length) + length = length or 76 + return ltn12.filter.cycle(_M.wrp, length, length) +end +wrapt['base64'] = wrapt['text'] +wrapt['default'] = wrapt['text'] + +wrapt['quoted-printable'] = function() + return ltn12.filter.cycle(_M.qpwrp, 76, 76) +end + +-- function that choose the encoding, decoding or wrap algorithm +_M.encode = choose(encodet) +_M.decode = choose(decodet) +_M.wrap = choose(wrapt) + +-- define the end-of-line normalization filter +function _M.normalize(marker) + return ltn12.filter.cycle(_M.eol, 0, marker) +end + +-- high level stuffing filter +function _M.stuff() + return ltn12.filter.cycle(_M.dot, 2) +end + +return _M \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Lua/mime.lua.meta b/Assets/LuaFramework/ToLua/Lua/mime.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..106f5fef5a196ebe1f28e7acf267a86c99a7e1d6 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/mime.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 78de065ed4e50984eba196a41070d017 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/misc.meta b/Assets/LuaFramework/ToLua/Lua/misc.meta new file mode 100644 index 0000000000000000000000000000000000000000..d6f813cf26b3f8ca95c9fc0a2a2f6a93e2c4d1c5 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/misc.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 08e54c61aaaa7c545b03c37c12e41df1 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/misc/functions.lua b/Assets/LuaFramework/ToLua/Lua/misc/functions.lua new file mode 100644 index 0000000000000000000000000000000000000000..5d89a67cc5b5a2cef45c582f2cf6c61a6b49d2af --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/misc/functions.lua @@ -0,0 +1,58 @@ +local require = require +local string = string +local table = table + +int64.zero = int64.new(0,0) +uint64.zero = uint64.new(0,0) + +function string.split(input, delimiter) + input = tostring(input) + delimiter = tostring(delimiter) + if (delimiter=='') then return false end + local pos,arr = 0, {} + -- for each divider found + for st,sp in function() return string.find(input, delimiter, pos, true) end do + table.insert(arr, string.sub(input, pos, st - 1)) + pos = sp + 1 + end + table.insert(arr, string.sub(input, pos)) + return arr +end + +function import(moduleName, currentModuleName) + local currentModuleNameParts + local moduleFullName = moduleName + local offset = 1 + + while true do + if string.byte(moduleName, offset) ~= 46 then -- . + moduleFullName = string.sub(moduleName, offset) + if currentModuleNameParts and #currentModuleNameParts > 0 then + moduleFullName = table.concat(currentModuleNameParts, ".") .. "." .. moduleFullName + end + break + end + offset = offset + 1 + + if not currentModuleNameParts then + if not currentModuleName then + local n,v = debug.getlocal(3, 1) + currentModuleName = v + end + + currentModuleNameParts = string.split(currentModuleName, ".") + end + table.remove(currentModuleNameParts, #currentModuleNameParts) + end + + return require(moduleFullName) +end + +--閲嶆柊require涓涓猯ua鏂囦欢锛屾浛浠g郴缁熸枃浠躲 +function reimport(name) + local package = package + package.loaded[name] = nil + package.preload[name] = nil + return require(name) +end + diff --git a/Assets/LuaFramework/ToLua/Lua/misc/functions.lua.meta b/Assets/LuaFramework/ToLua/Lua/misc/functions.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..8dc94ba589b6fcf0ecdb9f4899f4ef8d2966f077 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/misc/functions.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 7ad071edc48d0d8469028957a2df9c67 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/misc/misc.lua b/Assets/LuaFramework/ToLua/Lua/misc/misc.lua new file mode 100644 index 0000000000000000000000000000000000000000..4582ed5a9aa35e170c8304d4d10fff552229b5a4 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/misc/misc.lua @@ -0,0 +1,28 @@ +function import(moduleName, currentModuleName) + local currentModuleNameParts + local moduleFullName = moduleName + local offset = 1 + + while true do + if string.byte(moduleName, offset) ~= 46 then -- . + moduleFullName = string.sub(moduleName, offset) + if currentModuleNameParts and #currentModuleNameParts > 0 then + moduleFullName = table.concat(currentModuleNameParts, ".") .. "." .. moduleFullName + end + break + end + offset = offset + 1 + + if not currentModuleNameParts then + if not currentModuleName then + local n,v = debug.getlocal(3, 1) + currentModuleName = v + end + + currentModuleNameParts = string.split(currentModuleName, ".") + end + table.remove(currentModuleNameParts, #currentModuleNameParts) + end + + return require(moduleFullName) +end diff --git a/Assets/LuaFramework/ToLua/Lua/misc/misc.lua.meta b/Assets/LuaFramework/ToLua/Lua/misc/misc.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..2155528672b2b882aaed78a69a0b0a3305fa1012 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/misc/misc.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 65f0fec8c62c56a499fb800e5e7b5048 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/misc/strict.lua b/Assets/LuaFramework/ToLua/Lua/misc/strict.lua new file mode 100644 index 0000000000000000000000000000000000000000..033b2db99ad7d132ac8a4cbd32b7b49dd8632bd7 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/misc/strict.lua @@ -0,0 +1,40 @@ +-- +-- strict.lua +-- checks uses of undeclared global variables +-- All global variables must be 'declared' through a regular assignment +-- (even assigning nil will do) in a main chunk before being used +-- anywhere or assigned to inside a function. +-- +-- modified for better compatibility with LuaJIT, see: +-- http://www.freelists.org/post/luajit/strictlua-with-stripped-bytecode + +local getinfo, error, rawset, rawget = debug.getinfo, error, rawset, rawget + +local mt = getmetatable(_G) +if mt == nil then + mt = {} + setmetatable(_G, mt) +end + +mt.__declared = {} + +mt.__newindex = function (t, n, v) + if not mt.__declared[n] then + local info = getinfo(2, "S") + if info and info.linedefined > 0 then + error("assign to undeclared variable '"..n.."'", 2) + end + mt.__declared[n] = true + end + rawset(t, n, v) +end + +mt.__index = function (t, n) + if not mt.__declared[n] then + local info = getinfo(2, "S") + if info and info.linedefined > 0 then + error("variable '"..n.."' is not declared", 2) + end + end + return rawget(t, n) +end diff --git a/Assets/LuaFramework/ToLua/Lua/misc/strict.lua.meta b/Assets/LuaFramework/ToLua/Lua/misc/strict.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..28f8020d2c4ca5abdeb6431397e01b4774924204 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/misc/strict.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 4df6e3671aafc8e4d82fee6a2cf5948e +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/misc/utf8.lua b/Assets/LuaFramework/ToLua/Lua/misc/utf8.lua new file mode 100644 index 0000000000000000000000000000000000000000..66730a6e497d8f7254d9557d5601d9957b399054 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/misc/utf8.lua @@ -0,0 +1,306 @@ +local utf8 = {} + +--byte index of the next char after the char at byte index i, followed by a valid flag for the char at byte index i. +--nil if not found. invalid characters are iterated as 1-byte chars. +function utf8.next_raw(s, i) + if not i then + if #s == 0 then return nil end + return 1, true --fake flag (doesn't matter since this flag is not to be taken as full validation) + end + if i > #s then return end + local c = s:byte(i) + if c >= 0x00 and c <= 0x7F then + i = i + 1 + elseif c >= 0xC2 and c <= 0xDF then + i = i + 2 + elseif c >= 0xE0 and c <= 0xEF then + i = i + 3 + elseif c >= 0xF0 and c <= 0xF4 then + i = i + 4 + else --invalid + return i + 1, false + end + if i > #s then return end + return i, true +end + +--next() is the generic iterator and can be replaced for different semantics. next_raw() must preserve its semantics. +utf8.next = utf8.next_raw + +--iterate chars, returning the byte index where each char starts +function utf8.byte_indices(s, previ) + return utf8.next, s, previ +end + +--number of chars in string +function utf8.len(s) + assert(s, "bad argument #1 to 'len' (string expected, got nil)") + local len = 0 + for _ in utf8.byte_indices(s) do + len = len + 1 + end + return len +end + +--byte index given char index. nil if the index is outside the string. +function utf8.byte_index(s, target_ci) + if target_ci < 1 then return end + local ci = 0 + for i in utf8.byte_indices(s) do + ci = ci + 1 + if ci == target_ci then + return i + end + end + assert(target_ci > ci, "invalid index") +end + +--char index given byte index. nil if the index is outside the string. +function utf8.char_index(s, target_i) + if target_i < 1 or target_i > #s then return end + local ci = 0 + for i in utf8.byte_indices(s) do + ci = ci + 1 + if i == target_i then + return ci + end + end + error("invalid index") +end + +--byte index of the prev. char before the char at byte index i, which defaults to #s + 1. +--nil if the index is outside the 2..#s+1 range. +--NOTE: unlike next(), this is a O(N) operation! +function utf8.prev(s, nexti) + nexti = nexti or #s + 1 + if nexti <= 1 or nexti > #s + 1 then return end + local lasti, lastvalid = utf8.next(s) + for i, valid in utf8.byte_indices(s) do + if i == nexti then + return lasti, lastvalid + end + lasti, lastvalid = i, valid + end + if nexti == #s + 1 then + return lasti, lastvalid + end + error("invalid index") +end + +--iterate chars in reverse order, returning the byte index where each char starts. +function utf8.byte_indices_reverse(s, nexti) + if #s < 200 then + --using prev() is a O(N^2/2) operation, ok for small strings (200 chars need 40,000 iterations) + return utf8.prev, s, nexti + else + --store byte indices in a table and iterate them in reverse. + --this is 40x slower than byte_indices() but still fast at 2mil chars/second (but eats RAM and makes garbage). + local t = {} + for i in utf8.byte_indices(s) do + if nexti and i >= nexti then break end + table.insert(t, i) + end + local i = #t + 1 + return function() + i = i - 1 + return t[i] + end + end +end + +--sub based on char indices, which, unlike with standard string.sub(), can't be negative. +--start_ci can be 1..inf and end_ci can be 0..inf. end_ci can be nil meaning last char. +--if start_ci is out of range or end_ci < start_ci, the empty string is returned. +--if end_ci is out of range, it is considered to be the last position in the string. +function utf8.sub(s, start_ci, end_ci) + --assert for positive indices because we might implement negative indices in the future. + assert(start_ci >= 1) + assert(not end_ci or end_ci >= 0) + local ci = 0 + local start_i, end_i + for i in utf8.byte_indices(s) do + ci = ci + 1 + if ci == start_ci then + start_i = i + end + if ci == end_ci then + end_i = i + end + end + if not start_i then + assert(start_ci > ci, 'invalid index') + return '' + end + if end_ci and not end_i then + if end_ci < start_ci then + return '' + end + assert(end_ci > ci, 'invalid index') + end + return s:sub(start_i, end_i and end_i - 1) +end + +--check if a string contains a substring at byte index i without making garbage. +--nil if the index is out of range. true if searching for the empty string. +function utf8.contains(s, i, sub) + if i < 1 or i > #s then return nil end + for si = 1, #sub do + if s:byte(i + si - 1) ~= sub:byte(si) then + return false + end + end + return true +end + +--count the number of occurences of a substring in a string. the substring cannot be the empty string. +function utf8.count(s, sub) + assert(#sub > 0) + local count = 0 + local i = 1 + while i do + if utf8.contains(s, i, sub) then + count = count + 1 + i = i + #sub + if i > #s then break end + else + i = utf8.next(s, i) + end + end + return count +end + +--utf8 validation and sanitization + +--check if there's a valid utf8 codepoint at byte index i. valid ranges for each utf8 byte are: +-- byte 1 2 3 4 +-------------------------------------------- +-- 00 - 7F +-- C2 - DF 80 - BF +-- E0 A0 - BF 80 - BF +-- E1 - EC 80 - BF 80 - BF +-- ED 80 - 9F 80 - BF +-- EE - EF 80 - BF 80 - BF +-- F0 90 - BF 80 - BF 80 - BF +-- F1 - F3 80 - BF 80 - BF 80 - BF +-- F4 80 - 8F 80 - BF 80 - BF +function utf8.isvalid(s, i) + local c = s:byte(i) + if not c then + return false + elseif c >= 0x00 and c <= 0x7F then + return true + elseif c >= 0xC2 and c <= 0xDF then + local c2 = s:byte(i + 1) + return c2 and c2 >= 0x80 and c2 <= 0xBF + elseif c >= 0xE0 and c <= 0xEF then + local c2 = s:byte(i + 1) + local c3 = s:byte(i + 2) + if c == 0xE0 then + return c2 and c3 and + c2 >= 0xA0 and c2 <= 0xBF and + c3 >= 0x80 and c3 <= 0xBF + elseif c >= 0xE1 and c <= 0xEC then + return c2 and c3 and + c2 >= 0x80 and c2 <= 0xBF and + c3 >= 0x80 and c3 <= 0xBF + elseif c == 0xED then + return c2 and c3 and + c2 >= 0x80 and c2 <= 0x9F and + c3 >= 0x80 and c3 <= 0xBF + elseif c >= 0xEE and c <= 0xEF then + if c == 0xEF and c2 == 0xBF and (c3 == 0xBE or c3 == 0xBF) then + return false --uFFFE and uFFFF non-characters + end + return c2 and c3 and + c2 >= 0x80 and c2 <= 0xBF and + c3 >= 0x80 and c3 <= 0xBF + end + elseif c >= 0xF0 and c <= 0xF4 then + local c2 = s:byte(i + 1) + local c3 = s:byte(i + 2) + local c4 = s:byte(i + 3) + if c == 0xF0 then + return c2 and c3 and c4 and + c2 >= 0x90 and c2 <= 0xBF and + c3 >= 0x80 and c3 <= 0xBF and + c4 >= 0x80 and c4 <= 0xBF + elseif c >= 0xF1 and c <= 0xF3 then + return c2 and c3 and c4 and + c2 >= 0x80 and c2 <= 0xBF and + c3 >= 0x80 and c3 <= 0xBF and + c4 >= 0x80 and c4 <= 0xBF + elseif c == 0xF4 then + return c2 and c3 and c4 and + c2 >= 0x80 and c2 <= 0x8F and + c3 >= 0x80 and c3 <= 0xBF and + c4 >= 0x80 and c4 <= 0xBF + end + end + return false +end + +--byte index of the next valid utf8 char after the char at byte index i. +--nil if indices go out of range. invalid characters are skipped. +function utf8.next_valid(s, i) + local valid + i, valid = utf8.next_raw(s, i) + while i and (not valid or not utf8.isvalid(s, i)) do + i, valid = utf8.next(s, i) + end + return i +end + +--iterate valid chars, returning the byte index where each char starts +function utf8.valid_byte_indices(s) + return utf8.next_valid, s +end + +--assert that a string only contains valid utf8 characters +function utf8.validate(s) + for i, valid in utf8.byte_indices(s) do + if not valid or not utf8.isvalid(s, i) then + error(string.format('invalid utf8 char at #%d', i)) + end + end +end + +local function table_lookup(s, i, j, t) + return t[s:sub(i, j)] +end + +--replace characters in string based on a function f(s, i, j, ...) -> replacement_string | nil +function utf8.replace(s, f, ...) + if type(f) == 'table' then + return utf8.replace(s, table_lookup, f) + end + if s == '' then + return s + end + local t = {} + local lasti = 1 + for i in utf8.byte_indices(s) do + local nexti = utf8.next(s, i) or #s + 1 + local repl = f(s, i, nexti - 1, ...) + if repl then + table.insert(t, s:sub(lasti, i - 1)) + table.insert(t, repl) + lasti = nexti + end + end + table.insert(t, s:sub(lasti)) + return table.concat(t) +end + +local function replace_invalid(s, i, j, repl_char) + if not utf8.isvalid(s, i) then + return repl_char + end +end + +--replace invalid utf8 chars with a replacement char +function utf8.sanitize(s, repl_char) + repl_char = repl_char or '锟' --\uFFFD + return utf8.replace(s, replace_invalid, repl_char) +end + +return utf8 diff --git a/Assets/LuaFramework/ToLua/Lua/misc/utf8.lua.meta b/Assets/LuaFramework/ToLua/Lua/misc/utf8.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..e458b922fd76c2ec1e59ba7867a0c34dc7e3f101 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/misc/utf8.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: c7ac60fc5e653564588e60deb91863ee +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/protobuf.meta b/Assets/LuaFramework/ToLua/Lua/protobuf.meta new file mode 100644 index 0000000000000000000000000000000000000000..90ee1805b24428b6973400a36ef5ab351552c337 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/protobuf.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 588f81265fa730e41a5371957a46eb61 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/protobuf/containers.lua b/Assets/LuaFramework/ToLua/Lua/protobuf/containers.lua new file mode 100644 index 0000000000000000000000000000000000000000..9b5445ed24c746d335a8d59c057fe520f4b28d8b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/protobuf/containers.lua @@ -0,0 +1,78 @@ +-- +-------------------------------------------------------------------------------- +-- FILE: containers.lua +-- DESCRIPTION: protoc-gen-lua +-- Google's Protocol Buffers project, ported to lua. +-- https://code.google.com/p/protoc-gen-lua/ +-- +-- Copyright (c) 2010 , 鏋楀崜姣 (Zhuoyi Lin) netsnail@gmail.com +-- All rights reserved. +-- +-- Use, modification and distribution are subject to the "New BSD License" +-- as listed at . +-- +-- COMPANY: NetEase +-- CREATED: 2010骞08鏈02鏃 16鏃15鍒42绉 CST +-------------------------------------------------------------------------------- +-- +local setmetatable = setmetatable +local table = table +local rawset = rawset +local error = error + +module "protobuf.containers" + +local _RCFC_meta = { + add = function(self) + local value = self._message_descriptor._concrete_class() + local listener = self._listener + rawset(self, #self + 1, value) + value:_SetListener(listener) + if listener.dirty == false then + listener:Modified() + end + return value + end, + remove = function(self, key) + local listener = self._listener + table.remove(self, key) + listener:Modified() + end, + __newindex = function(self, key, value) + error("RepeatedCompositeFieldContainer Can't set value directly") + end +} +_RCFC_meta.__index = _RCFC_meta + +function RepeatedCompositeFieldContainer(listener, message_descriptor) + local o = { + _listener = listener, + _message_descriptor = message_descriptor + } + return setmetatable(o, _RCFC_meta) +end + +local _RSFC_meta = { + append = function(self, value) + self._type_checker(value) + rawset(self, #self + 1, value) + self._listener:Modified() + end, + remove = function(self, key) + table.remove(self, key) + self._listener:Modified() + end, + __newindex = function(self, key, value) + error("RepeatedCompositeFieldContainer Can't set value directly") + end +} +_RSFC_meta.__index = _RSFC_meta + +function RepeatedScalarFieldContainer(listener, type_checker) + local o = {} + o._listener = listener + o._type_checker = type_checker + return setmetatable(o, _RSFC_meta) +end + + diff --git a/Assets/LuaFramework/ToLua/Lua/protobuf/containers.lua.meta b/Assets/LuaFramework/ToLua/Lua/protobuf/containers.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..3296f86ba405f6aa02fc5cdbad1085151f4e3de5 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/protobuf/containers.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: b091e6d28e2ea5b469fa0ef87c372f3a +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/protobuf/decoder.lua b/Assets/LuaFramework/ToLua/Lua/protobuf/decoder.lua new file mode 100644 index 0000000000000000000000000000000000000000..12e3be3c6719a831a365042cced12cd74203e3af --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/protobuf/decoder.lua @@ -0,0 +1,340 @@ +-- +-------------------------------------------------------------------------------- +-- FILE: decoder.lua +-- DESCRIPTION: protoc-gen-lua +-- Google's Protocol Buffers project, ported to lua. +-- https://code.google.com/p/protoc-gen-lua/ +-- +-- Copyright (c) 2010 , 鏋楀崜姣 (Zhuoyi Lin) netsnail@gmail.com +-- All rights reserved. +-- +-- Use, modification and distribution are subject to the "New BSD License" +-- as listed at . +-- +-- COMPANY: NetEase +-- CREATED: 2010骞07鏈29鏃 19鏃30鍒51绉 CST +-------------------------------------------------------------------------------- +-- +local string = string +local table = table +local assert = assert +local ipairs = ipairs +local error = error +local print = print + +local pb = require "pb" +local encoder = require "protobuf.encoder" +local wire_format = require "protobuf.wire_format" +module "protobuf.decoder" + +local _DecodeVarint = pb.varint_decoder +local _DecodeSignedVarint = pb.signed_varint_decoder + +local _DecodeVarint32 = pb.varint_decoder +local _DecodeSignedVarint32 = pb.signed_varint_decoder + +local _DecodeVarint64 = pb.varint_decoder64 +local _DecodeSignedVarint64 = pb.signed_varint_decoder64 + +ReadTag = pb.read_tag + +local function _SimpleDecoder(wire_type, decode_value) + return function(field_number, is_repeated, is_packed, key, new_default) + if is_packed then + local DecodeVarint = _DecodeVarint + return function (buffer, pos, pend, message, field_dict) + local value = field_dict[key] + if value == nil then + value = new_default(message) + field_dict[key] = value + end + local endpoint + endpoint, pos = DecodeVarint(buffer, pos) + endpoint = endpoint + pos + if endpoint > pend then + error('Truncated message.') + end + local element + while pos < endpoint do + element, pos = decode_value(buffer, pos) + value[#value + 1] = element + end + if pos > endpoint then + value:remove(#value) + error('Packed element was truncated.') + end + return pos + end + elseif is_repeated then + local tag_bytes = encoder.TagBytes(field_number, wire_type) + local tag_len = #tag_bytes + local sub = string.sub + return function(buffer, pos, pend, message, field_dict) + local value = field_dict[key] + if value == nil then + value = new_default(message) + field_dict[key] = value + end + while 1 do + local element, new_pos = decode_value(buffer, pos) + value:append(element) + pos = new_pos + tag_len + if sub(buffer, new_pos+1, pos) ~= tag_bytes or new_pos >= pend then + if new_pos > pend then + error('Truncated message.') + end + return new_pos + end + end + end + else + return function (buffer, pos, pend, message, field_dict) + field_dict[key], pos = decode_value(buffer, pos) + if pos > pend then + field_dict[key] = nil + error('Truncated message.') + end + return pos + end + end + end +end + +local function _ModifiedDecoder(wire_type, decode_value, modify_value) + local InnerDecode = function (buffer, pos) + local result, new_pos = decode_value(buffer, pos) + return modify_value(result), new_pos + end + return _SimpleDecoder(wire_type, InnerDecode) +end + +local function _StructPackDecoder(wire_type, value_size, format) + local struct_unpack = pb.struct_unpack + + function InnerDecode(buffer, pos) + local new_pos = pos + value_size + local result = struct_unpack(format, buffer, pos) + return result, new_pos + end + return _SimpleDecoder(wire_type, InnerDecode) +end + +local function _Boolean(value) + return value ~= 0 +end + +Int32Decoder = _SimpleDecoder(wire_format.WIRETYPE_VARINT, _DecodeSignedVarint32) +EnumDecoder = Int32Decoder + +Int64Decoder = _SimpleDecoder(wire_format.WIRETYPE_VARINT, _DecodeSignedVarint64) + +UInt32Decoder = _SimpleDecoder(wire_format.WIRETYPE_VARINT, _DecodeVarint32) +UInt64Decoder = _SimpleDecoder(wire_format.WIRETYPE_VARINT, _DecodeVarint64) + +SInt32Decoder = _ModifiedDecoder(wire_format.WIRETYPE_VARINT, _DecodeVarint32, wire_format.ZigZagDecode32) +SInt64Decoder = _ModifiedDecoder(wire_format.WIRETYPE_VARINT, _DecodeVarint64, wire_format.ZigZagDecode64) + +Fixed32Decoder = _StructPackDecoder(wire_format.WIRETYPE_FIXED32, 4, string.byte('I')) +Fixed64Decoder = _StructPackDecoder(wire_format.WIRETYPE_FIXED64, 8, string.byte('Q')) +SFixed32Decoder = _StructPackDecoder(wire_format.WIRETYPE_FIXED32, 4, string.byte('i')) +SFixed64Decoder = _StructPackDecoder(wire_format.WIRETYPE_FIXED64, 8, string.byte('q')) +FloatDecoder = _StructPackDecoder(wire_format.WIRETYPE_FIXED32, 4, string.byte('f')) +DoubleDecoder = _StructPackDecoder(wire_format.WIRETYPE_FIXED64, 8, string.byte('d')) + + +BoolDecoder = _ModifiedDecoder(wire_format.WIRETYPE_VARINT, _DecodeVarint, _Boolean) + + +function StringDecoder(field_number, is_repeated, is_packed, key, new_default) + local DecodeVarint = _DecodeVarint + local sub = string.sub + -- local unicode = unicode + assert(not is_packed) + if is_repeated then + local tag_bytes = encoder.TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED) + local tag_len = #tag_bytes + return function (buffer, pos, pend, message, field_dict) + local value = field_dict[key] + if value == nil then + value = new_default(message) + field_dict[key] = value + end + while 1 do + local size, new_pos + size, pos = DecodeVarint(buffer, pos) + new_pos = pos + size + if new_pos > pend then + error('Truncated string.') + end + value:append(sub(buffer, pos+1, new_pos)) + pos = new_pos + tag_len + if sub(buffer, new_pos + 1, pos) ~= tag_bytes or new_pos == pend then + return new_pos + end + end + end + else + return function (buffer, pos, pend, message, field_dict) + local size, new_pos + size, pos = DecodeVarint(buffer, pos) + new_pos = pos + size + if new_pos > pend then + error('Truncated string.') + end + field_dict[key] = sub(buffer, pos + 1, new_pos) + return new_pos + end + end +end + +function BytesDecoder(field_number, is_repeated, is_packed, key, new_default) + local DecodeVarint = _DecodeVarint + local sub = string.sub + assert(not is_packed) + if is_repeated then + local tag_bytes = encoder.TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED) + local tag_len = #tag_bytes + return function (buffer, pos, pend, message, field_dict) + local value = field_dict[key] + if value == nil then + value = new_default(message) + field_dict[key] = value + end + while 1 do + local size, new_pos + size, pos = DecodeVarint(buffer, pos) + new_pos = pos + size + if new_pos > pend then + error('Truncated string.') + end + value:append(sub(buffer, pos + 1, new_pos)) + pos = new_pos + tag_len + if sub(buffer, new_pos + 1, pos) ~= tag_bytes or new_pos == pend then + return new_pos + end + end + end + else + return function(buffer, pos, pend, message, field_dict) + local size, new_pos + size, pos = DecodeVarint(buffer, pos) + new_pos = pos + size + if new_pos > pend then + error('Truncated string.') + end + field_dict[key] = sub(buffer, pos + 1, new_pos) + return new_pos + end + end +end + +function MessageDecoder(field_number, is_repeated, is_packed, key, new_default) + local DecodeVarint = _DecodeVarint + local sub = string.sub + + assert(not is_packed) + if is_repeated then + local tag_bytes = encoder.TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED) + local tag_len = #tag_bytes + return function (buffer, pos, pend, message, field_dict) + local value = field_dict[key] + if value == nil then + value = new_default(message) + field_dict[key] = value + end + while 1 do + local size, new_pos + size, pos = DecodeVarint(buffer, pos) + new_pos = pos + size + if new_pos > pend then + error('Truncated message.') + end + if value:add():_InternalParse(buffer, pos, new_pos) ~= new_pos then + error('Unexpected end-group tag.') + end + pos = new_pos + tag_len + if sub(buffer, new_pos + 1, pos) ~= tag_bytes or new_pos == pend then + return new_pos + end + end + end + else + return function (buffer, pos, pend, message, field_dict) + local value = field_dict[key] + if value == nil then + value = new_default(message) + field_dict[key] = value + end + local size, new_pos + size, pos = DecodeVarint(buffer, pos) + new_pos = pos + size + if new_pos > pend then + error('Truncated message.') + end + if value:_InternalParse(buffer, pos, new_pos) ~= new_pos then + error('Unexpected end-group tag.') + end + return new_pos + end + end +end + +function _SkipVarint(buffer, pos, pend) + local value + value, pos = _DecodeVarint(buffer, pos) + return pos +end + +function _SkipFixed64(buffer, pos, pend) + pos = pos + 8 + if pos > pend then + error('Truncated message.') + end + return pos +end + +function _SkipLengthDelimited(buffer, pos, pend) + local size + size, pos = _DecodeVarint(buffer, pos) + pos = pos + size + if pos > pend then + error('Truncated message.') + end + return pos +end + +function _SkipFixed32(buffer, pos, pend) + pos = pos + 4 + if pos > pend then + error('Truncated message.') + end + return pos +end + +function _RaiseInvalidWireType(buffer, pos, pend) + error('Tag had invalid wire type.') +end + +function _FieldSkipper() + WIRETYPE_TO_SKIPPER = { + _SkipVarint, + _SkipFixed64, + _SkipLengthDelimited, + _SkipGroup, + _EndGroup, + _SkipFixed32, + _RaiseInvalidWireType, + _RaiseInvalidWireType, + } + +-- wiretype_mask = wire_format.TAG_TYPE_MASK + local ord = string.byte + local sub = string.sub + + return function (buffer, pos, pend, tag_bytes) + local wire_type = ord(sub(tag_bytes, 1, 1)) % 8 + 1 + return WIRETYPE_TO_SKIPPER[wire_type](buffer, pos, pend) + end +end + +SkipField = _FieldSkipper() diff --git a/Assets/LuaFramework/ToLua/Lua/protobuf/decoder.lua.meta b/Assets/LuaFramework/ToLua/Lua/protobuf/decoder.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..0506bd2903eb87dd3053456466fe1e39b07f495d --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/protobuf/decoder.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 99e0d332d92e1c44ca56267a2b3bdcf9 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/protobuf/descriptor.lua b/Assets/LuaFramework/ToLua/Lua/protobuf/descriptor.lua new file mode 100644 index 0000000000000000000000000000000000000000..52c59f6d694aec840e0e8a7c9e601efe07a77f94 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/protobuf/descriptor.lua @@ -0,0 +1,64 @@ +-- +-------------------------------------------------------------------------------- +-- FILE: descriptor.lua +-- DESCRIPTION: protoc-gen-lua +-- Google's Protocol Buffers project, ported to lua. +-- https://code.google.com/p/protoc-gen-lua/ +-- +-- Copyright (c) 2010 , 鏋楀崜姣 (Zhuoyi Lin) netsnail@gmail.com +-- All rights reserved. +-- +-- Use, modification and distribution are subject to the "New BSD License" +-- as listed at . +-- +-- COMPANY: NetEase +-- CREATED: 2010骞08鏈11鏃 18鏃45鍒43绉 CST +-------------------------------------------------------------------------------- +-- + +module "protobuf.descriptor" + +FieldDescriptor = { + TYPE_DOUBLE = 1, + TYPE_FLOAT = 2, + TYPE_INT64 = 3, + TYPE_UINT64 = 4, + TYPE_INT32 = 5, + TYPE_FIXED64 = 6, + TYPE_FIXED32 = 7, + TYPE_BOOL = 8, + TYPE_STRING = 9, + TYPE_GROUP = 10, + TYPE_MESSAGE = 11, + TYPE_BYTES = 12, + TYPE_UINT32 = 13, + TYPE_ENUM = 14, + TYPE_SFIXED32 = 15, + TYPE_SFIXED64 = 16, + TYPE_SINT32 = 17, + TYPE_SINT64 = 18, + MAX_TYPE = 18, + + -- Must be consistent with C++ FieldDescriptor::CppType enum in + -- descriptor.h. + -- + CPPTYPE_INT32 = 1, + CPPTYPE_INT64 = 2, + CPPTYPE_UINT32 = 3, + CPPTYPE_UINT64 = 4, + CPPTYPE_DOUBLE = 5, + CPPTYPE_FLOAT = 6, + CPPTYPE_BOOL = 7, + CPPTYPE_ENUM = 8, + CPPTYPE_STRING = 9, + CPPTYPE_MESSAGE = 10, + MAX_CPPTYPE = 10, + + -- Must be consistent with C++ FieldDescriptor::Label enum in + -- descriptor.h. + -- + LABEL_OPTIONAL = 1, + LABEL_REQUIRED = 2, + LABEL_REPEATED = 3, + MAX_LABEL = 3 +} diff --git a/Assets/LuaFramework/ToLua/Lua/protobuf/descriptor.lua.meta b/Assets/LuaFramework/ToLua/Lua/protobuf/descriptor.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..62b13420b18e48d1615d88dab9f97532d9e1ef3b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/protobuf/descriptor.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: ec5270fc0e79e1140be77c303c4874c4 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/protobuf/encoder.lua b/Assets/LuaFramework/ToLua/Lua/protobuf/encoder.lua new file mode 100644 index 0000000000000000000000000000000000000000..959483cf99a267db1ab47b61fc515ea5dd447504 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/protobuf/encoder.lua @@ -0,0 +1,473 @@ +-- +-------------------------------------------------------------------------------- +-- FILE: encoder.lua +-- DESCRIPTION: protoc-gen-lua +-- Google's Protocol Buffers project, ported to lua. +-- https://code.google.com/p/protoc-gen-lua/ +-- +-- Copyright (c) 2010 , 鏋楀崜姣 (Zhuoyi Lin) netsnail@gmail.com +-- All rights reserved. +-- +-- Use, modification and distribution are subject to the "New BSD License" +-- as listed at . +-- +-- COMPANY: NetEase +-- CREATED: 2010骞07鏈29鏃 19鏃30鍒46绉 CST +-------------------------------------------------------------------------------- +-- +local string = string +local table = table +local ipairs = ipairs +local assert =assert + +local pb = require "pb" +local wire_format = require "protobuf.wire_format" +module "protobuf.encoder" + +function _VarintSize(value) + if value <= 0x7f then return 1 end + if value <= 0x3fff then return 2 end + if value <= 0x1fffff then return 3 end + if value <= 0xfffffff then return 4 end + if value <= 0x7ffffffff then return 5 end + if value <= 0x3ffffffffff then return 6 end + if value <= 0x1ffffffffffff then return 7 end + if value <= 0xffffffffffffff then return 8 end + if value <= 0x7fffffffffffffff then return 9 end + return 10 +end + +function _SignedVarintSize(value) + if value < 0 then return 10 end + if value <= 0x7f then return 1 end + if value <= 0x3fff then return 2 end + if value <= 0x1fffff then return 3 end + if value <= 0xfffffff then return 4 end + if value <= 0x7ffffffff then return 5 end + if value <= 0x3ffffffffff then return 6 end + if value <= 0x1ffffffffffff then return 7 end + if value <= 0xffffffffffffff then return 8 end + if value <= 0x7fffffffffffffff then return 9 end + return 10 +end + +function _TagSize(field_number) + return _VarintSize(wire_format.PackTag(field_number, 0)) +end + +function _SimpleSizer(compute_value_size) + return function(field_number, is_repeated, is_packed) + local tag_size = _TagSize(field_number) + if is_packed then + local VarintSize = _VarintSize + return function(value) + local result = 0 + for _, element in ipairs(value) do + result = result + compute_value_size(element) + end + return result + VarintSize(result) + tag_size + end + elseif is_repeated then + return function(value) + local result = tag_size * #value + for _, element in ipairs(value) do + result = result + compute_value_size(element) + end + return result + end + else + return function (value) + return tag_size + compute_value_size(value) + end + end + end +end + +function _ModifiedSizer(compute_value_size, modify_value) + return function (field_number, is_repeated, is_packed) + local tag_size = _TagSize(field_number) + if is_packed then + local VarintSize = _VarintSize + return function (value) + local result = 0 + for _, element in ipairs(value) do + result = result + compute_value_size(modify_value(element)) + end + return result + VarintSize(result) + tag_size + end + elseif is_repeated then + return function (value) + local result = tag_size * #value + for _, element in ipairs(value) do + result = result + compute_value_size(modify_value(element)) + end + return result + end + else + return function (value) + return tag_size + compute_value_size(modify_value(value)) + end + end + end +end + +function _FixedSizer(value_size) + return function (field_number, is_repeated, is_packed) + local tag_size = _TagSize(field_number) + if is_packed then + local VarintSize = _VarintSize + return function (value) + local result = #value * value_size + return result + VarintSize(result) + tag_size + end + elseif is_repeated then + local element_size = value_size + tag_size + return function(value) + return #value * element_size + end + else + local field_size = value_size + tag_size + return function (value) + return field_size + end + end + end +end + +Int32Sizer = _SimpleSizer(_SignedVarintSize) +Int64Sizer = _SimpleSizer(pb.signed_varint_size) +EnumSizer = Int32Sizer + +UInt32Sizer = _SimpleSizer(_VarintSize) +UInt64Sizer = _SimpleSizer(pb.varint_size) + +SInt32Sizer = _ModifiedSizer(_SignedVarintSize, wire_format.ZigZagEncode32) +SInt64Sizer = SInt32Sizer + +Fixed32Sizer = _FixedSizer(4) +SFixed32Sizer = Fixed32Sizer +FloatSizer = Fixed32Sizer + +Fixed64Sizer = _FixedSizer(8) +SFixed64Sizer = Fixed64Sizer +DoubleSizer = Fixed64Sizer + +BoolSizer = _FixedSizer(1) + + +function StringSizer(field_number, is_repeated, is_packed) + local tag_size = _TagSize(field_number) + local VarintSize = _VarintSize + assert(not is_packed) + if is_repeated then + return function(value) + local result = tag_size * #value + for _, element in ipairs(value) do + local l = #element + result = result + VarintSize(l) + l + end + return result + end + else + return function(value) + local l = #value + return tag_size + VarintSize(l) + l + end + end +end + +function BytesSizer(field_number, is_repeated, is_packed) + local tag_size = _TagSize(field_number) + local VarintSize = _VarintSize + assert(not is_packed) + if is_repeated then + return function (value) + local result = tag_size * #value + for _,element in ipairs(value) do + local l = #element + result = result + VarintSize(l) + l + end + return result + end + else + return function (value) + local l = #value + return tag_size + VarintSize(l) + l + end + end +end + +function MessageSizer(field_number, is_repeated, is_packed) + local tag_size = _TagSize(field_number) + local VarintSize = _VarintSize + assert(not is_packed) + if is_repeated then + return function(value) + local result = tag_size * #value + for _,element in ipairs(value) do + local l = element:ByteSize() + result = result + VarintSize(l) + l + end + return result + end + else + return function (value) + local l = value:ByteSize() + return tag_size + VarintSize(l) + l + end + end +end + + +-- ==================================================================== +-- Encoders! + +local _EncodeVarint = pb.varint_encoder +local _EncodeSignedVarint = pb.signed_varint_encoder +local _EncodeVarint64 = pb.varint_encoder64 +local _EncodeSignedVarint64 = pb.signed_varint_encoder64 + + +function _VarintBytes(value) + local out = {} + local write = function(value) + out[#out + 1 ] = value + end + _EncodeSignedVarint(write, value) + return table.concat(out) +end + +function TagBytes(field_number, wire_type) + return _VarintBytes(wire_format.PackTag(field_number, wire_type)) +end + +function _SimpleEncoder(wire_type, encode_value, compute_value_size) + return function(field_number, is_repeated, is_packed) + if is_packed then + local tag_bytes = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED) + local EncodeVarint = _EncodeVarint + return function(write, value) + write(tag_bytes) + local size = 0 + for _, element in ipairs(value) do + size = size + compute_value_size(element) + end + EncodeVarint(write, size) + for element in value do + encode_value(write, element) + end + end + elseif is_repeated then + local tag_bytes = TagBytes(field_number, wire_type) + return function(write, value) + for _, element in ipairs(value) do + write(tag_bytes) + encode_value(write, element) + end + end + else + local tag_bytes = TagBytes(field_number, wire_type) + return function(write, value) + write(tag_bytes) + encode_value(write, value) + end + end + end +end + +function _ModifiedEncoder(wire_type, encode_value, compute_value_size, modify_value) + return function (field_number, is_repeated, is_packed) + if is_packed then + local tag_bytes = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED) + local EncodeVarint = _EncodeVarint + return function (write, value) + write(tag_bytes) + local size = 0 + for _, element in ipairs(value) do + size = size + compute_value_size(modify_value(element)) + end + EncodeVarint(write, size) + for _, element in ipairs(value) do + encode_value(write, modify_value(element)) + end + end + elseif is_repeated then + local tag_bytes = TagBytes(field_number, wire_type) + return function (write, value) + for _, element in ipairs(value) do + write(tag_bytes) + encode_value(write, modify_value(element)) + end + end + else + local tag_bytes = TagBytes(field_number, wire_type) + return function (write, value) + write(tag_bytes) + encode_value(write, modify_value(value)) + end + end + end +end + +function _StructPackEncoder(wire_type, value_size, format) + return function(field_number, is_repeated, is_packed) + local struct_pack = pb.struct_pack + if is_packed then + local tag_bytes = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED) + local EncodeVarint = _EncodeVarint + return function (write, value) + write(tag_bytes) + EncodeVarint(write, #value * value_size) + for _, element in ipairs(value) do + struct_pack(write, format, element) + end + end + elseif is_repeated then + local tag_bytes = TagBytes(field_number, wire_type) + return function (write, value) + for _, element in ipairs(value) do + write(tag_bytes) + struct_pack(write, format, element) + end + end + else + local tag_bytes = TagBytes(field_number, wire_type) + return function (write, value) + write(tag_bytes) + struct_pack(write, format, value) + end + end + + end +end + +Int32Encoder = _SimpleEncoder(wire_format.WIRETYPE_VARINT, _EncodeSignedVarint, _SignedVarintSize) +Int64Encoder = _SimpleEncoder(wire_format.WIRETYPE_VARINT, _EncodeSignedVarint64, _SignedVarintSize) +EnumEncoder = Int32Encoder + +UInt32Encoder = _SimpleEncoder(wire_format.WIRETYPE_VARINT, _EncodeVarint, _VarintSize) +UInt64Encoder = _SimpleEncoder(wire_format.WIRETYPE_VARINT, _EncodeVarint64, _VarintSize) + +SInt32Encoder = _ModifiedEncoder( + wire_format.WIRETYPE_VARINT, _EncodeVarint, _VarintSize, + wire_format.ZigZagEncode32) + +SInt64Encoder = _ModifiedEncoder( + wire_format.WIRETYPE_VARINT, _EncodeVarint64, _VarintSize, + wire_format.ZigZagEncode64) + +Fixed32Encoder = _StructPackEncoder(wire_format.WIRETYPE_FIXED32, 4, string.byte('I')) +Fixed64Encoder = _StructPackEncoder(wire_format.WIRETYPE_FIXED64, 8, string.byte('Q')) +SFixed32Encoder = _StructPackEncoder(wire_format.WIRETYPE_FIXED32, 4, string.byte('i')) +SFixed64Encoder = _StructPackEncoder(wire_format.WIRETYPE_FIXED64, 8, string.byte('q')) +FloatEncoder = _StructPackEncoder(wire_format.WIRETYPE_FIXED32, 4, string.byte('f')) +DoubleEncoder = _StructPackEncoder(wire_format.WIRETYPE_FIXED64, 8, string.byte('d')) + + +function BoolEncoder(field_number, is_repeated, is_packed) + local false_byte = '\0' + local true_byte = '\1' + if is_packed then + local tag_bytes = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED) + local EncodeVarint = _EncodeVarint + return function (write, value) + write(tag_bytes) + EncodeVarint(write, #value) + for _, element in ipairs(value) do + if element then + write(true_byte) + else + write(false_byte) + end + end + end + elseif is_repeated then + local tag_bytes = TagBytes(field_number, wire_format.WIRETYPE_VARINT) + return function(write, value) + for _, element in ipairs(value) do + write(tag_bytes) + if element then + write(true_byte) + else + write(false_byte) + end + end + end + else + local tag_bytes = TagBytes(field_number, wire_format.WIRETYPE_VARINT) + return function (write, value) + write(tag_bytes) + if value then + return write(true_byte) + end + return write(false_byte) + end + end +end + +function StringEncoder(field_number, is_repeated, is_packed) + local tag = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED) + local EncodeVarint = _EncodeVarint + assert(not is_packed) + if is_repeated then + return function (write, value) + for _, element in ipairs(value) do +-- encoded = element.encode('utf-8') + write(tag) + EncodeVarint(write, #element) + write(element) + end + end + else + return function (write, value) +-- local encoded = value.encode('utf-8') + write(tag) + EncodeVarint(write, #value) + return write(value) + end + end +end + +function BytesEncoder(field_number, is_repeated, is_packed) + local tag = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED) + local EncodeVarint = _EncodeVarint + assert(not is_packed) + if is_repeated then + return function (write, value) + for _, element in ipairs(value) do + write(tag) + EncodeVarint(write, #element) + write(element) + end + end + else + return function(write, value) + write(tag) + EncodeVarint(write, #value) + return write(value) + end + end +end + + +function MessageEncoder(field_number, is_repeated, is_packed) + local tag = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED) + local EncodeVarint = _EncodeVarint + assert(not is_packed) + if is_repeated then + return function(write, value) + for _, element in ipairs(value) do + write(tag) + EncodeVarint(write, element:ByteSize()) + element:_InternalSerialize(write) + end + end + else + return function (write, value) + write(tag) + EncodeVarint(write, value:ByteSize()) + return value:_InternalSerialize(write) + end + end +end + diff --git a/Assets/LuaFramework/ToLua/Lua/protobuf/encoder.lua.meta b/Assets/LuaFramework/ToLua/Lua/protobuf/encoder.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..8b772c8d2a3a01f32b99a44060d90094aa595d24 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/protobuf/encoder.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 59c27d5459f0dfc4ab1077ce6f391ea9 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/protobuf/listener.lua b/Assets/LuaFramework/ToLua/Lua/protobuf/listener.lua new file mode 100644 index 0000000000000000000000000000000000000000..7d7f89db28315147c5b59eef4d96ecc7623f1761 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/protobuf/listener.lua @@ -0,0 +1,50 @@ +-- +-------------------------------------------------------------------------------- +-- FILE: listener.lua +-- DESCRIPTION: protoc-gen-lua +-- Google's Protocol Buffers project, ported to lua. +-- https://code.google.com/p/protoc-gen-lua/ +-- +-- Copyright (c) 2010 , 鏋楀崜姣 (Zhuoyi Lin) netsnail@gmail.com +-- All rights reserved. +-- +-- Use, modification and distribution are subject to the "New BSD License" +-- as listed at . +-- +-- COMPANY: NetEase +-- CREATED: 2010骞08鏈02鏃 17鏃35鍒25绉 CST +-------------------------------------------------------------------------------- +-- +local setmetatable = setmetatable + +module "protobuf.listener" + +local _null_listener = { + Modified = function() + end +} + +function NullMessageListener() + return _null_listener +end + +local _listener_meta = { + Modified = function(self) + if self.dirty then + return + end + if self._parent_message then + self._parent_message:_Modified() + end + end +} +_listener_meta.__index = _listener_meta + +function Listener(parent_message) + local o = {} + o.__mode = "v" + o._parent_message = parent_message + o.dirty = false + return setmetatable(o, _listener_meta) +end + diff --git a/Assets/LuaFramework/ToLua/Lua/protobuf/listener.lua.meta b/Assets/LuaFramework/ToLua/Lua/protobuf/listener.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..2161c812a2e8b4355cfa56159f9706b323d45f4a --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/protobuf/listener.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 7778f4f6aeddbee43984c5da8cc06953 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/protobuf/protobuf.lua b/Assets/LuaFramework/ToLua/Lua/protobuf/protobuf.lua new file mode 100644 index 0000000000000000000000000000000000000000..1235cf93abe9f39f760bb9beb013ab9ddb19f468 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/protobuf/protobuf.lua @@ -0,0 +1,960 @@ +-- +-------------------------------------------------------------------------------- +-- FILE: protobuf.lua +-- DESCRIPTION: protoc-gen-lua +-- Google's Protocol Buffers project, ported to lua. +-- https://code.google.com/p/protoc-gen-lua/ +-- +-- Copyright (c) 2010 , 鏋楀崜姣 (Zhuoyi Lin) netsnail@gmail.com +-- All rights reserved. +-- +-- Use, modification and distribution are subject to the "New BSD License" +-- as listed at . +-- +-- COMPANY: NetEase +-- CREATED: 2010骞07鏈29鏃 14鏃30鍒02绉 CST +-------------------------------------------------------------------------------- +-- + +local setmetatable = setmetatable +local rawset = rawset +local rawget = rawget +local error = error +local ipairs = ipairs +local pairs = pairs +local print = print +local table = table +local string = string +local tostring = tostring +local type = type + +local pb = require "pb" +local wire_format = require "protobuf.wire_format" +local type_checkers = require "protobuf.type_checkers" +local encoder = require "protobuf.encoder" +local decoder = require "protobuf.decoder" +local listener_mod = require "protobuf.listener" +local containers = require "protobuf.containers" +local descriptor = require "protobuf.descriptor" +local FieldDescriptor = descriptor.FieldDescriptor +local text_format = require "protobuf.text_format" + +module("protobuf.protobuf") + +local function make_descriptor(name, descriptor, usable_key) + local meta = { + __newindex = function(self, key, value) + if usable_key[key] then + rawset(self, key, value) + else + error("error key: "..key) + end + end + }; + meta.__index = meta + meta.__call = function() + return setmetatable({}, meta) + end + + _M[name] = setmetatable(descriptor, meta); +end + + +make_descriptor("Descriptor", {}, { + name = true, + full_name = true, + filename = true, + containing_type = true, + fields = true, + nested_types = true, + enum_types = true, + extensions = true, + options = true, + is_extendable = true, + extension_ranges = true, +}) + +make_descriptor("FieldDescriptor", FieldDescriptor, { + name = true, + full_name = true, + index = true, + number = true, + type = true, + cpp_type = true, + label = true, + has_default_value = true, + default_value = true, + containing_type = true, + message_type = true, + enum_type = true, + is_extension = true, + extension_scope = true, +}) + +make_descriptor("EnumDescriptor", {}, { + name = true, + full_name = true, + values = true, + containing_type = true, + options = true +}) + +make_descriptor("EnumValueDescriptor", {}, { + name = true, + index = true, + number = true, + type = true, + options = true +}) + +-- Maps from field type to expected wiretype. +local FIELD_TYPE_TO_WIRE_TYPE = { + [FieldDescriptor.TYPE_DOUBLE] = wire_format.WIRETYPE_FIXED64, + [FieldDescriptor.TYPE_FLOAT] = wire_format.WIRETYPE_FIXED32, + [FieldDescriptor.TYPE_INT64] = wire_format.WIRETYPE_VARINT, + [FieldDescriptor.TYPE_UINT64] = wire_format.WIRETYPE_VARINT, + [FieldDescriptor.TYPE_INT32] = wire_format.WIRETYPE_VARINT, + [FieldDescriptor.TYPE_FIXED64] = wire_format.WIRETYPE_FIXED64, + [FieldDescriptor.TYPE_FIXED32] = wire_format.WIRETYPE_FIXED32, + [FieldDescriptor.TYPE_BOOL] = wire_format.WIRETYPE_VARINT, + [FieldDescriptor.TYPE_STRING] = wire_format.WIRETYPE_LENGTH_DELIMITED, + [FieldDescriptor.TYPE_GROUP] = wire_format.WIRETYPE_START_GROUP, + [FieldDescriptor.TYPE_MESSAGE] = wire_format.WIRETYPE_LENGTH_DELIMITED, + [FieldDescriptor.TYPE_BYTES] = wire_format.WIRETYPE_LENGTH_DELIMITED, + [FieldDescriptor.TYPE_UINT32] = wire_format.WIRETYPE_VARINT, + [FieldDescriptor.TYPE_ENUM] = wire_format.WIRETYPE_VARINT, + [FieldDescriptor.TYPE_SFIXED32] = wire_format.WIRETYPE_FIXED32, + [FieldDescriptor.TYPE_SFIXED64] = wire_format.WIRETYPE_FIXED64, + [FieldDescriptor.TYPE_SINT32] = wire_format.WIRETYPE_VARINT, + [FieldDescriptor.TYPE_SINT64] = wire_format.WIRETYPE_VARINT +} + +local NON_PACKABLE_TYPES = { + [FieldDescriptor.TYPE_STRING] = true, + [FieldDescriptor.TYPE_GROUP] = true, + [FieldDescriptor.TYPE_MESSAGE] = true, + [FieldDescriptor.TYPE_BYTES] = true +} + +local _VALUE_CHECKERS = { + [FieldDescriptor.CPPTYPE_INT32] = type_checkers.Int32ValueChecker(), + [FieldDescriptor.CPPTYPE_INT64] = type_checkers.TypeChecker({string = true, number = true}), + [FieldDescriptor.CPPTYPE_UINT32] = type_checkers.Uint32ValueChecker(), + [FieldDescriptor.CPPTYPE_UINT64] = type_checkers.TypeChecker({string = true, number = true}), + [FieldDescriptor.CPPTYPE_DOUBLE] = type_checkers.TypeChecker({number = true}), + [FieldDescriptor.CPPTYPE_FLOAT] = type_checkers.TypeChecker({number = true}), + [FieldDescriptor.CPPTYPE_BOOL] = type_checkers.TypeChecker({boolean = true, bool = true, int=true}), + [FieldDescriptor.CPPTYPE_ENUM] = type_checkers.Int32ValueChecker(), + [FieldDescriptor.CPPTYPE_STRING] = type_checkers.TypeChecker({string = true}) +} + + +local TYPE_TO_BYTE_SIZE_FN = { + [FieldDescriptor.TYPE_DOUBLE] = wire_format.DoubleByteSize, + [FieldDescriptor.TYPE_FLOAT] = wire_format.FloatByteSize, + [FieldDescriptor.TYPE_INT64] = wire_format.Int64ByteSize, + [FieldDescriptor.TYPE_UINT64] = wire_format.UInt64ByteSize, + [FieldDescriptor.TYPE_INT32] = wire_format.Int32ByteSize, + [FieldDescriptor.TYPE_FIXED64] = wire_format.Fixed64ByteSize, + [FieldDescriptor.TYPE_FIXED32] = wire_format.Fixed32ByteSize, + [FieldDescriptor.TYPE_BOOL] = wire_format.BoolByteSize, + [FieldDescriptor.TYPE_STRING] = wire_format.StringByteSize, + [FieldDescriptor.TYPE_GROUP] = wire_format.GroupByteSize, + [FieldDescriptor.TYPE_MESSAGE] = wire_format.MessageByteSize, + [FieldDescriptor.TYPE_BYTES] = wire_format.BytesByteSize, + [FieldDescriptor.TYPE_UINT32] = wire_format.UInt32ByteSize, + [FieldDescriptor.TYPE_ENUM] = wire_format.EnumByteSize, + [FieldDescriptor.TYPE_SFIXED32] = wire_format.SFixed32ByteSize, + [FieldDescriptor.TYPE_SFIXED64] = wire_format.SFixed64ByteSize, + [FieldDescriptor.TYPE_SINT32] = wire_format.SInt32ByteSize, + [FieldDescriptor.TYPE_SINT64] = wire_format.SInt64ByteSize +} + +local TYPE_TO_ENCODER = { + [FieldDescriptor.TYPE_DOUBLE] = encoder.DoubleEncoder, + [FieldDescriptor.TYPE_FLOAT] = encoder.FloatEncoder, + [FieldDescriptor.TYPE_INT64] = encoder.Int64Encoder, + [FieldDescriptor.TYPE_UINT64] = encoder.UInt64Encoder, + [FieldDescriptor.TYPE_INT32] = encoder.Int32Encoder, + [FieldDescriptor.TYPE_FIXED64] = encoder.Fixed64Encoder, + [FieldDescriptor.TYPE_FIXED32] = encoder.Fixed32Encoder, + [FieldDescriptor.TYPE_BOOL] = encoder.BoolEncoder, + [FieldDescriptor.TYPE_STRING] = encoder.StringEncoder, + [FieldDescriptor.TYPE_GROUP] = encoder.GroupEncoder, + [FieldDescriptor.TYPE_MESSAGE] = encoder.MessageEncoder, + [FieldDescriptor.TYPE_BYTES] = encoder.BytesEncoder, + [FieldDescriptor.TYPE_UINT32] = encoder.UInt32Encoder, + [FieldDescriptor.TYPE_ENUM] = encoder.EnumEncoder, + [FieldDescriptor.TYPE_SFIXED32] = encoder.SFixed32Encoder, + [FieldDescriptor.TYPE_SFIXED64] = encoder.SFixed64Encoder, + [FieldDescriptor.TYPE_SINT32] = encoder.SInt32Encoder, + [FieldDescriptor.TYPE_SINT64] = encoder.SInt64Encoder +} + +local TYPE_TO_SIZER = { + [FieldDescriptor.TYPE_DOUBLE] = encoder.DoubleSizer, + [FieldDescriptor.TYPE_FLOAT] = encoder.FloatSizer, + [FieldDescriptor.TYPE_INT64] = encoder.Int64Sizer, + [FieldDescriptor.TYPE_UINT64] = encoder.UInt64Sizer, + [FieldDescriptor.TYPE_INT32] = encoder.Int32Sizer, + [FieldDescriptor.TYPE_FIXED64] = encoder.Fixed64Sizer, + [FieldDescriptor.TYPE_FIXED32] = encoder.Fixed32Sizer, + [FieldDescriptor.TYPE_BOOL] = encoder.BoolSizer, + [FieldDescriptor.TYPE_STRING] = encoder.StringSizer, + [FieldDescriptor.TYPE_GROUP] = encoder.GroupSizer, + [FieldDescriptor.TYPE_MESSAGE] = encoder.MessageSizer, + [FieldDescriptor.TYPE_BYTES] = encoder.BytesSizer, + [FieldDescriptor.TYPE_UINT32] = encoder.UInt32Sizer, + [FieldDescriptor.TYPE_ENUM] = encoder.EnumSizer, + [FieldDescriptor.TYPE_SFIXED32] = encoder.SFixed32Sizer, + [FieldDescriptor.TYPE_SFIXED64] = encoder.SFixed64Sizer, + [FieldDescriptor.TYPE_SINT32] = encoder.SInt32Sizer, + [FieldDescriptor.TYPE_SINT64] = encoder.SInt64Sizer +} + +local TYPE_TO_DECODER = { + [FieldDescriptor.TYPE_DOUBLE] = decoder.DoubleDecoder, + [FieldDescriptor.TYPE_FLOAT] = decoder.FloatDecoder, + [FieldDescriptor.TYPE_INT64] = decoder.Int64Decoder, + [FieldDescriptor.TYPE_UINT64] = decoder.UInt64Decoder, + [FieldDescriptor.TYPE_INT32] = decoder.Int32Decoder, + [FieldDescriptor.TYPE_FIXED64] = decoder.Fixed64Decoder, + [FieldDescriptor.TYPE_FIXED32] = decoder.Fixed32Decoder, + [FieldDescriptor.TYPE_BOOL] = decoder.BoolDecoder, + [FieldDescriptor.TYPE_STRING] = decoder.StringDecoder, + [FieldDescriptor.TYPE_GROUP] = decoder.GroupDecoder, + [FieldDescriptor.TYPE_MESSAGE] = decoder.MessageDecoder, + [FieldDescriptor.TYPE_BYTES] = decoder.BytesDecoder, + [FieldDescriptor.TYPE_UINT32] = decoder.UInt32Decoder, + [FieldDescriptor.TYPE_ENUM] = decoder.EnumDecoder, + [FieldDescriptor.TYPE_SFIXED32] = decoder.SFixed32Decoder, + [FieldDescriptor.TYPE_SFIXED64] = decoder.SFixed64Decoder, + [FieldDescriptor.TYPE_SINT32] = decoder.SInt32Decoder, + [FieldDescriptor.TYPE_SINT64] = decoder.SInt64Decoder +} + +local FIELD_TYPE_TO_WIRE_TYPE = { + [FieldDescriptor.TYPE_DOUBLE] = wire_format.WIRETYPE_FIXED64, + [FieldDescriptor.TYPE_FLOAT] = wire_format.WIRETYPE_FIXED32, + [FieldDescriptor.TYPE_INT64] = wire_format.WIRETYPE_VARINT, + [FieldDescriptor.TYPE_UINT64] = wire_format.WIRETYPE_VARINT, + [FieldDescriptor.TYPE_INT32] = wire_format.WIRETYPE_VARINT, + [FieldDescriptor.TYPE_FIXED64] = wire_format.WIRETYPE_FIXED64, + [FieldDescriptor.TYPE_FIXED32] = wire_format.WIRETYPE_FIXED32, + [FieldDescriptor.TYPE_BOOL] = wire_format.WIRETYPE_VARINT, + [FieldDescriptor.TYPE_STRING] = wire_format.WIRETYPE_LENGTH_DELIMITED, + [FieldDescriptor.TYPE_GROUP] = wire_format.WIRETYPE_START_GROUP, + [FieldDescriptor.TYPE_MESSAGE] = wire_format.WIRETYPE_LENGTH_DELIMITED, + [FieldDescriptor.TYPE_BYTES] = wire_format.WIRETYPE_LENGTH_DELIMITED, + [FieldDescriptor.TYPE_UINT32] = wire_format.WIRETYPE_VARINT, + [FieldDescriptor.TYPE_ENUM] = wire_format.WIRETYPE_VARINT, + [FieldDescriptor.TYPE_SFIXED32] = wire_format.WIRETYPE_FIXED32, + [FieldDescriptor.TYPE_SFIXED64] = wire_format.WIRETYPE_FIXED64, + [FieldDescriptor.TYPE_SINT32] = wire_format.WIRETYPE_VARINT, + [FieldDescriptor.TYPE_SINT64] = wire_format.WIRETYPE_VARINT +} + +local function IsTypePackable(field_type) + return NON_PACKABLE_TYPES[field_type] == nil +end + +local function GetTypeChecker(cpp_type, field_type) + if (cpp_type == FieldDescriptor.CPPTYPE_STRING and field_type == FieldDescriptor.TYPE_STRING) then + return type_checkers.UnicodeValueChecker() + end + return _VALUE_CHECKERS[cpp_type] +end + +local function _DefaultValueConstructorForField(field) + if field.label == FieldDescriptor.LABEL_REPEATED then + if type(field.default_value) ~= "table" or #(field.default_value) ~= 0 then + error('Repeated field default value not empty list:' .. tostring(field.default_value)) + end + if field.cpp_type == FieldDescriptor.CPPTYPE_MESSAGE then + local message_type = field.message_type + return function (message) + return containers.RepeatedCompositeFieldContainer(message._listener_for_children, message_type) + end + else + local type_checker = GetTypeChecker(field.cpp_type, field.type) + return function (message) + return containers.RepeatedScalarFieldContainer(message._listener_for_children, type_checker) + end + end + end + if field.cpp_type == FieldDescriptor.CPPTYPE_MESSAGE then + local message_type = field.message_type + return function (message) + result = message_type._concrete_class() + result._SetListener(message._listener_for_children) + return result + end + end + return function (message) + return field.default_value + end +end + +local function _AttachFieldHelpers(message_meta, field_descriptor) + local is_repeated = (field_descriptor.label == FieldDescriptor.LABEL_REPEATED) + local is_packed = (field_descriptor.has_options and field_descriptor.GetOptions().packed) + + rawset(field_descriptor, "_encoder", TYPE_TO_ENCODER[field_descriptor.type](field_descriptor.number, is_repeated, is_packed)) + rawset(field_descriptor, "_sizer", TYPE_TO_SIZER[field_descriptor.type](field_descriptor.number, is_repeated, is_packed)) + rawset(field_descriptor, "_default_constructor", _DefaultValueConstructorForField(field_descriptor)) + + local AddDecoder = function(wiretype, is_packed) + local tag_bytes = encoder.TagBytes(field_descriptor.number, wiretype) + message_meta._decoders_by_tag[tag_bytes] = TYPE_TO_DECODER[field_descriptor.type](field_descriptor.number, is_repeated, is_packed, field_descriptor, field_descriptor._default_constructor) + end + + AddDecoder(FIELD_TYPE_TO_WIRE_TYPE[field_descriptor.type], False) + if is_repeated and IsTypePackable(field_descriptor.type) then + AddDecoder(wire_format.WIRETYPE_LENGTH_DELIMITED, True) + end +end + +local function _AddEnumValues(descriptor, message_meta) + for _, enum_type in ipairs(descriptor.enum_types) do + for _, enum_value in ipairs(enum_type.values) do + message_meta._member[enum_value.name] = enum_value.number + end + end +end + +local function _InitMethod(message_meta) + return function() + local self = {} + self._cached_byte_size = 0 + self._cached_byte_size_dirty = false + self._fields = {} + self._is_present_in_parent = false + self._listener = listener_mod.NullMessageListener() + self._listener_for_children = listener_mod.Listener(self) + return setmetatable(self, message_meta) + end +end + +local function _AddPropertiesForRepeatedField(field, message_meta) + local property_name = field.name + + message_meta._getter[property_name] = function(self) + local field_value = self._fields[field] + if field_value == nil then + field_value = field._default_constructor(self) + self._fields[field] = field_value + + if not self._cached_byte_size_dirty then + message_meta._member._Modified(self) + end + end + return field_value + end + + message_meta._setter[property_name] = function(self) + error('Assignment not allowed to repeated field "' .. property_name .. '" in protocol message object.') + end +end + +local function _AddPropertiesForNonRepeatedCompositeField(field, message_meta) + local property_name = field.name + local message_type = field.message_type + + message_meta._getter[property_name] = function(self) + local field_value = self._fields[field] + if field_value == nil then + field_value = message_type._concrete_class() + field_value:_SetListener(self._listener_for_children) + self._fields[field] = field_value + + if not self._cached_byte_size_dirty then + message_meta._member._Modified(self) + end + end + return field_value + end + message_meta._setter[property_name] = function(self, new_value) + error('Assignment not allowed to composite field' .. property_name .. 'in protocol message object.' ) + end +end + +local function _AddPropertiesForNonRepeatedScalarField(field, message) + local property_name = field.name + local type_checker = GetTypeChecker(field.cpp_type, field.type) + local default_value = field.default_value + + message._getter[property_name] = function(self) + local value = self._fields[field] + if value ~= nil then + return self._fields[field] + else + return default_value + end + end + + message._setter[property_name] = function(self, new_value) + type_checker(new_value) + self._fields[field] = new_value + if not self._cached_byte_size_dirty then + message._member._Modified(self) + end + end +end + +local function _AddPropertiesForField(field, message_meta) + constant_name = field.name:upper() .. "_FIELD_NUMBER" + message_meta._member[constant_name] = field.number + + if field.label == FieldDescriptor.LABEL_REPEATED then + _AddPropertiesForRepeatedField(field, message_meta) + elseif field.cpp_type == FieldDescriptor.CPPTYPE_MESSAGE then + _AddPropertiesForNonRepeatedCompositeField(field, message_meta) + else + _AddPropertiesForNonRepeatedScalarField(field, message_meta) + end +end + +local _ED_meta = { + __index = function(self, extension_handle) + local _extended_message = rawget(self, "_extended_message") + local value = _extended_message._fields[extension_handle] + if value ~= nil then + return value + end + if extension_handle.label == FieldDescriptor.LABEL_REPEATED then + value = extension_handle._default_constructor(self._extended_message) + elseif extension_handle.cpp_type == FieldDescriptor.CPPTYPE_MESSAGE then + value = extension_handle.message_type._concrete_class() + value:_SetListener(_extended_message._listener_for_children) + else + return extension_handle.default_value + end + _extended_message._fields[extension_handle] = value + return value + end, + __newindex = function(self, extension_handle, value) + local _extended_message = rawget(self, "_extended_message") + if (extension_handle.label == FieldDescriptor.LABEL_REPEATED or + extension_handle.cpp_type == FieldDescriptor.CPPTYPE_MESSAGE) then + error('Cannot assign to extension "'.. extension_handle.full_name .. '" because it is a repeated or composite type.') + end + + local type_checker = GetTypeChecker(extension_handle.cpp_type, extension_handle.type) + type_checker.CheckValue(value) + _extended_message._fields[extension_handle] = value + _extended_message._Modified() + end +} + +local function _ExtensionDict(message) + local o = {} + o._extended_message = message + return setmetatable(o, _ED_meta) +end + +local function _AddPropertiesForFields(descriptor, message_meta) + for _, field in ipairs(descriptor.fields) do + _AddPropertiesForField(field, message_meta) + end + if descriptor.is_extendable then + message_meta._getter.Extensions = function(self) return _ExtensionDict(self) end + end +end + +local function _AddPropertiesForExtensions(descriptor, message_meta) + local extension_dict = descriptor._extensions_by_name + for extension_name, extension_field in pairs(extension_dict) do + local constant_name = string.upper(extension_name) .. "_FIELD_NUMBER" + message_meta._member[constant_name] = extension_field.number + end +end + +local function _AddStaticMethods(message_meta) + message_meta._member.RegisterExtension = function(extension_handle) + extension_handle.containing_type = message_meta._descriptor + _AttachFieldHelpers(message_meta, extension_handle) + + if message_meta._extensions_by_number[extension_handle.number] == nil then + message_meta._extensions_by_number[extension_handle.number] = extension_handle + else + error( + string.format('Extensions "%s" and "%s" both try to extend message type "%s" with field number %d.', + extension_handle.full_name, actual_handle.full_name, + message_meta._descriptor.full_name, extension_handle.number)) + end + message_meta._extensions_by_name[extension_handle.full_name] = extension_handle + end + + message_meta._member.FromString = function(s) + local message = message_meta._member.__call() + message.MergeFromString(s) + return message + end +end + +local function _IsPresent(descriptor, value) + if descriptor.label == FieldDescriptor.LABEL_REPEATED then + return value + elseif descriptor.cpp_type == FieldDescriptor.CPPTYPE_MESSAGE then + return value._is_present_in_parent + else + return true + end +end + +function sortFunc(a, b) + return a.index < b.index +end +function pairsByKeys (t, f) + local a = {} + for n in pairs(t) do table.insert(a, n) end + table.sort(a, f) + local i = 0 -- iterator variable + local iter = function () -- iterator function + i = i + 1 + if a[i] == nil then return nil + else return a[i], t[a[i]] + end + end + return iter +end + +local function _AddListFieldsMethod(message_descriptor, message_meta) + message_meta._member.ListFields = function (self) + local list_field = function(fields) + --local f, s, v = pairs(self._fields) + local f,s,v = pairsByKeys(self._fields, sortFunc) + local iter = function(a, i) + while true do + local descriptor, value = f(a, i) + if descriptor == nil then + return + elseif _IsPresent(descriptor, value) then + return descriptor, value + end + end + end + return iter, s, v + end + return list_field(self._fields) + end +end + +local function _AddHasFieldMethod(message_descriptor, message_meta) + local singular_fields = {} + for _, field in ipairs(message_descriptor.fields) do + if field.label ~= FieldDescriptor.LABEL_REPEATED then + singular_fields[field.name] = field + end + end + message_meta._member.HasField = function (self, field_name) + field = singular_fields[field_name] + if field == nil then + error('Protocol message has no singular "'.. field_name.. '" field.') + end + if field.cpp_type == FieldDescriptor.CPPTYPE_MESSAGE then + value = self._fields[field] + return value ~= nil and value._is_present_in_parent + else + local valueTmp = self._fields[field] + return valueTmp ~= nil + end + end +end + +local function _AddClearFieldMethod(message_descriptor, message_meta) + local singular_fields = {} + for _, field in ipairs(message_descriptor.fields) do + if field.label ~= FieldDescriptor.LABEL_REPEATED then + singular_fields[field.name] = field + end + end + + message_meta._member.ClearField = function(self, field_name) + field = singular_fields[field_name] + if field == nil then + error('Protocol message has no singular "'.. field_name.. '" field.') + end + + if self._fields[field] then + self._fields[field] = nil + end + message_meta._member._Modified(self) + end +end + +local function _AddClearExtensionMethod(message_meta) + message_meta._member.ClearExtension = function(self, extension_handle) + if self._fields[extension_handle] == nil then + self._fields[extension_handle] = nil + end + message_meta._member._Modified(self) + end +end + +local function _AddClearMethod(message_descriptor, message_meta) + message_meta._member.Clear = function(self) + self._fields = {} + message_meta._member._Modified(self) + end +end + +local function _AddStrMethod(message_meta) + local format = text_format.msg_format + message_meta.__tostring = function(self) + return format(self) + end +end + +local function _AddHasExtensionMethod(message_meta) + message_meta._member.HasExtension = function(self, extension_handle) + if extension_handle.label == FieldDescriptor.LABEL_REPEATED then + error(extension_handle.full_name .. ' is repeated.') + end + if extension_handle.cpp_type == FieldDescriptor.CPPTYPE_MESSAGE then + value = self._fields[extension_handle] + return value ~= nil and value._is_present_in_parent + else + return self._fields[extension_handle] + end + end +end + +local function _AddSetListenerMethod(message_meta) + message_meta._member._SetListener = function(self, listener) + if listener ~= nil then + self._listener = listener_mod.NullMessageListener() + else + self._listener = listener + end + end +end + +local function _AddByteSizeMethod(message_descriptor, message_meta) + message_meta._member.ByteSize = function(self) + --kaiser + --bug:杩欓噷鍦≧epeat瀛楁鐨勭粨鏋勪綋濡傛灉绗竴涓瓧娈典笉鏄痠nt鍙橀噺浼氫骇鐢焈cached_byte_size_dirty涓篺alse鑰屽鑷碽yte size涓0 + --濡傛灉bytesize涓0璁╁畠寮哄埗璁$畻byte size + if not self._cached_byte_size_dirty and self._cached_byte_size > 0 then + return self._cached_byte_size + end + local size = 0 + for field_descriptor, field_value in message_meta._member.ListFields(self) do + size = field_descriptor._sizer(field_value) + size + end + self._cached_byte_size = size + self._cached_byte_size_dirty = false + self._listener_for_children.dirty = false + return size + end +end + +local function _AddSerializeToStringMethod(message_descriptor, message_meta) + message_meta._member.SerializeToString = function(self) + if not message_meta._member.IsInitialized(self) then + error('Message is missing required fields: ' .. + table.concat(message_meta._member.FindInitializationErrors(self), ',')) + end + return message_meta._member.SerializePartialToString(self) + end + message_meta._member.SerializeToIOString = function(self, iostring) + if not message_meta._member.IsInitialized(self) then + error('Message is missing required fields: ' .. + table.concat(message_meta._member.FindInitializationErrors(self), ',')) + end + return message_meta._member.SerializePartialToIOString(self, iostring) + end +end + +local function _AddSerializePartialToStringMethod(message_descriptor, message_meta) + local concat = table.concat + local _internal_serialize = function(self, write_bytes) + for field_descriptor, field_value in message_meta._member.ListFields(self) do + field_descriptor._encoder(write_bytes, field_value) + end + end + + local _serialize_partial_to_iostring = function(self, iostring) + local w = iostring.write + local write = function(value) + w(iostring, value) + end + _internal_serialize(self, write) + return + end + + local _serialize_partial_to_string = function(self) + local out = {} + local write = function(value) + out[#out + 1] = value + end + _internal_serialize(self, write) + return concat(out) + end + + message_meta._member._InternalSerialize = _internal_serialize + message_meta._member.SerializePartialToIOString = _serialize_partial_to_iostring + message_meta._member.SerializePartialToString = _serialize_partial_to_string +end + + + +local function _AddMergeFromStringMethod(message_descriptor, message_meta) + local ReadTag = decoder.ReadTag + local SkipField = decoder.SkipField + local decoders_by_tag = message_meta._decoders_by_tag + + local _internal_parse = function(self, buffer, pos, pend) + message_meta._member._Modified(self) + local field_dict = self._fields + local tag_bytes, new_pos + local field_decoder + while pos ~= pend do + tag_bytes, new_pos = ReadTag(buffer, pos) + field_decoder = decoders_by_tag[tag_bytes] + if field_decoder == nil then + new_pos = SkipField(buffer, new_pos, pend, tag_bytes) + if new_pos == -1 then + return pos + end + pos = new_pos + else + pos = field_decoder(buffer, new_pos, pend, self, field_dict) + end + end + return pos + end + message_meta._member._InternalParse = _internal_parse + + local merge_from_string = function(self, serialized) + local length = #serialized + if _internal_parse(self, serialized, 0, length) ~= length then + error('Unexpected end-group tag.') + end + return length + end + message_meta._member.MergeFromString = merge_from_string + + message_meta._member.ParseFromString = function(self, serialized) + message_meta._member.Clear(self) + merge_from_string(self, serialized) + end +end + +local function _AddIsInitializedMethod(message_descriptor, message_meta) + local required_fields = {} + for _, field in ipairs(message_descriptor.fields) do + if field.label == FieldDescriptor.LABEL_REQUIRED then + required_fields[#required_fields + 1] = field + end + end + + message_meta._member.IsInitialized = function(self, errors) + for _, field in ipairs(required_fields) do + if self._fields[field] == nil or + (field.cpp_type == FieldDescriptor.CPPTYPE_MESSAGE and not self._fields[field]._is_present_in_parent) then + if errors ~= nil then + errors[#errors + 1] = message_meta._member.FindInitializationErrors(self) + end + return false + end + end + + for field, value in pairs(self._fields) do + if field.cpp_type == FieldDescriptor.CPPTYPE_MESSAGE then + if field.label == FieldDescriptor.LABEL_REPEATED then + for _, element in ipairs(value) do + if not element:IsInitialized() then + if errors ~= nil then + errors[#errors + 1] = message_meta._member.FindInitializationErrors(self) + end + return false + end + end + elseif value._is_present_in_parent and not value:IsInitialized() then + if errors ~= nil then + errors[#errors + 1] = message_meta._member.FindInitializationErrors(self) + end + return false + end + end + end + return true + end + + message_meta._member.FindInitializationErrors = function(self) + local errors = {} + + for _,field in ipairs(required_fields) do + if not message_meta._member.HasField(self, field.name) then + errors[#errors + 1] = field.name + end + end + + for field, value in message_meta._member.ListFields(self) do + if field.cpp_type == FieldDescriptor.CPPTYPE_MESSAGE then + if field.is_extension then + name = string.format("(%s)", field.full_name) + else + name = field.name + end + if field.label == FieldDescriptor.LABEL_REPEATED then + for i, element in ipairs(value) do + prefix = string.format("%s[%d].", name, i) + sub_errors = element:FindInitializationErrors() + for _, e in ipairs(sub_errors) do + errors[#errors + 1] = prefix .. e + end + end + else + prefix = name .. "." + sub_errors = value:FindInitializationErrors() + for _, e in ipairs(sub_errors) do + errors[#errors + 1] = prefix .. e + end + end + end + end + return errors + end +end + +local function _AddMergeFromMethod(message_meta) + local LABEL_REPEATED = FieldDescriptor.LABEL_REPEATED + local CPPTYPE_MESSAGE = FieldDescriptor.CPPTYPE_MESSAGE + + message_meta._member.MergeFrom = function (self, msg) + assert(msg ~= self) + message_meta._member._Modified(self) + + local fields = self._fields + + for field, value in pairs(msg._fields) do + if field.label == LABEL_REPEATED or field.cpp_type == CPPTYPE_MESSAGE then + field_value = fields[field] + if field_value == nil then + field_value = field._default_constructor(self) + fields[field] = field_value + end + field_value:MergeFrom(value) + else + self._fields[field] = value + end + end + end +end + +local function _AddMessageMethods(message_descriptor, message_meta) + _AddListFieldsMethod(message_descriptor, message_meta) + _AddHasFieldMethod(message_descriptor, message_meta) + _AddClearFieldMethod(message_descriptor, message_meta) + if message_descriptor.is_extendable then + _AddClearExtensionMethod(message_meta) + _AddHasExtensionMethod(message_meta) + end + _AddClearMethod(message_descriptor, message_meta) +-- _AddEqualsMethod(message_descriptor, message_meta) + _AddStrMethod(message_meta) + _AddSetListenerMethod(message_meta) + _AddByteSizeMethod(message_descriptor, message_meta) + _AddSerializeToStringMethod(message_descriptor, message_meta) + _AddSerializePartialToStringMethod(message_descriptor, message_meta) + _AddMergeFromStringMethod(message_descriptor, message_meta) + _AddIsInitializedMethod(message_descriptor, message_meta) + _AddMergeFromMethod(message_meta) +end + +local function _AddPrivateHelperMethods(message_meta) + local Modified = function (self) + if not self._cached_byte_size_dirty then + self._cached_byte_size_dirty = true + self._listener_for_children.dirty = true + self._is_present_in_parent = true + self._listener:Modified() + end + end + message_meta._member._Modified = Modified + message_meta._member.SetInParent = Modified +end + +local function property_getter(message_meta) + local getter = message_meta._getter + local member = message_meta._member + + return function (self, property) + local g = getter[property] + if g then + return g(self) + else + return member[property] + end + end +end + +local function property_setter(message_meta) + local setter = message_meta._setter + + return function (self, property, value) + local s = setter[property] + if s then + s(self, value) + else + error(property .. " not found") + end + end +end + +function _AddClassAttributesForNestedExtensions(descriptor, message_meta) + local extension_dict = descriptor._extensions_by_name + for extension_name, extension_field in pairs(extension_dict) do + message_meta._member[extension_name] = extension_field + end +end + +local function Message(descriptor) + local message_meta = {} + message_meta._decoders_by_tag = {} + rawset(descriptor, "_extensions_by_name", {}) + for _, k in ipairs(descriptor.extensions) do + descriptor._extensions_by_name[k.name] = k + end + rawset(descriptor, "_extensions_by_number", {}) + for _, k in ipairs(descriptor.extensions) do + descriptor._extensions_by_number[k.number] = k + end + message_meta._descriptor = descriptor + message_meta._extensions_by_name = {} + message_meta._extensions_by_number = {} + + message_meta._getter = {} + message_meta._setter = {} + message_meta._member = {} +-- message_meta._name = descriptor.full_name + + local ns = setmetatable({}, message_meta._member) + message_meta._member.__call = _InitMethod(message_meta) + message_meta._member.__index = message_meta._member + message_meta._member.type = ns + + if rawget(descriptor, "_concrete_class") == nil then + rawset(descriptor, "_concrete_class", ns) + for k, field in ipairs(descriptor.fields) do + _AttachFieldHelpers(message_meta, field) + end + end + _AddEnumValues(descriptor, message_meta) + _AddClassAttributesForNestedExtensions(descriptor, message_meta) + _AddPropertiesForFields(descriptor, message_meta) + _AddPropertiesForExtensions(descriptor, message_meta) + _AddStaticMethods(message_meta) + _AddMessageMethods(descriptor, message_meta) + _AddPrivateHelperMethods(message_meta) + + message_meta.__index = property_getter(message_meta) + message_meta.__newindex = property_setter(message_meta) + + return ns +end + +_M.Message = Message + diff --git a/Assets/LuaFramework/ToLua/Lua/protobuf/protobuf.lua.meta b/Assets/LuaFramework/ToLua/Lua/protobuf/protobuf.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..8891a0acf6a1f9f90a3630679d99b8b4a83bd1dd --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/protobuf/protobuf.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: afc64cedbe4a843499e187d95d272f06 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/protobuf/text_format.lua b/Assets/LuaFramework/ToLua/Lua/protobuf/text_format.lua new file mode 100644 index 0000000000000000000000000000000000000000..11b142390fd6c03c51d0b33da6a2488dd17c242e --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/protobuf/text_format.lua @@ -0,0 +1,79 @@ +-- +-------------------------------------------------------------------------------- +-- FILE: text_format.lua +-- DESCRIPTION: protoc-gen-lua +-- Google's Protocol Buffers project, ported to lua. +-- https://code.google.com/p/protoc-gen-lua/ +-- +-- Copyright (c) 2010 , 鏋楀崜姣 (Zhuoyi Lin) netsnail@gmail.com +-- All rights reserved. +-- +-- Use, modification and distribution are subject to the "New BSD License" +-- as listed at . +-- COMPANY: NetEase +-- CREATED: 2010骞08鏈05鏃 15鏃14鍒13绉 CST +-------------------------------------------------------------------------------- +-- +local string = string +local math = math +local print = print +local getmetatable = getmetatable +local table = table +local ipairs = ipairs +local tostring = tostring + +local descriptor = require "protobuf.descriptor" + +module "protobuf.text_format" + +function format(buffer) + local len = string.len( buffer ) + for i = 1, len, 16 do + local text = "" + for j = i, math.min( i + 16 - 1, len ) do + text = string.format( "%s %02x", text, string.byte( buffer, j ) ) + end + print( text ) + end +end + +local FieldDescriptor = descriptor.FieldDescriptor + +msg_format_indent = function(write, msg, indent) + for field, value in msg:ListFields() do + local print_field = function(field_value) + local name = field.name + write(string.rep(" ", indent)) + if field.type == FieldDescriptor.TYPE_MESSAGE then + local extensions = getmetatable(msg)._extensions_by_name + if extensions[field.full_name] then + write("[" .. name .. "] {\n") + else + write(name .. " {\n") + end + msg_format_indent(write, field_value, indent + 4) + write(string.rep(" ", indent)) + write("}\n") + else + write(string.format("%s: %s\n", name, tostring(field_value))) + end + end + if field.label == FieldDescriptor.LABEL_REPEATED then + for _, k in ipairs(value) do + print_field(k) + end + else + print_field(value) + end + end +end + +function msg_format(msg) + local out = {} + local write = function(value) + out[#out + 1] = value + end + msg_format_indent(write, msg, 0) + return table.concat(out) +end + diff --git a/Assets/LuaFramework/ToLua/Lua/protobuf/text_format.lua.meta b/Assets/LuaFramework/ToLua/Lua/protobuf/text_format.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..121832eb191f3a6337f1caf7453d0973b48b90d5 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/protobuf/text_format.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 11ebbcbb210e532448bcc1440a557d8f +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/protobuf/type_checkers.lua b/Assets/LuaFramework/ToLua/Lua/protobuf/type_checkers.lua new file mode 100644 index 0000000000000000000000000000000000000000..afb5084abe3d962825023416a5a936b8a76e8964 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/protobuf/type_checkers.lua @@ -0,0 +1,72 @@ +-- +-------------------------------------------------------------------------------- +-- FILE: type_checkers.lua +-- DESCRIPTION: protoc-gen-lua +-- Google's Protocol Buffers project, ported to lua. +-- https://code.google.com/p/protoc-gen-lua/ +-- +-- Copyright (c) 2010 , 鏋楀崜姣 (Zhuoyi Lin) netsnail@gmail.com +-- All rights reserved. +-- +-- Use, modification and distribution are subject to the "New BSD License" +-- as listed at . +-- +-- COMPANY: NetEase +-- CREATED: 2010骞07鏈29鏃 19鏃30鍒37绉 CST +-------------------------------------------------------------------------------- +-- + +local type = type +local error = error +local string = string + +module "protobuf.type_checkers" + +function TypeChecker(acceptable_types) + local acceptable_types = acceptable_types + + return function(proposed_value) + local t = type(proposed_value) + if acceptable_types[type(proposed_value)] == nil then + error(string.format('%s has type %s, but expected one of: %s', + proposed_value, type(proposed_value), acceptable_types)) + end + end +end + +function Int32ValueChecker() + local _MIN = -2147483648 + local _MAX = 2147483647 + return function(proposed_value) + if type(proposed_value) ~= 'number' then + error(string.format('%s has type %s, but expected one of: number', + proposed_value, type(proposed_value))) + end + if _MIN > proposed_value or proposed_value > _MAX then + error('Value out of range: ' .. proposed_value) + end + end +end + +function Uint32ValueChecker(IntValueChecker) + local _MIN = 0 + local _MAX = 0xffffffff + + return function(proposed_value) + if type(proposed_value) ~= 'number' then + error(string.format('%s has type %s, but expected one of: number', + proposed_value, type(proposed_value))) + end + if _MIN > proposed_value or proposed_value > _MAX then + error('Value out of range: ' .. proposed_value) + end + end +end + +function UnicodeValueChecker() + return function (proposed_value) + if type(proposed_value) ~= 'string' then + error(string.format('%s has type %s, but expected one of: string', proposed_value, type(proposed_value))) + end + end +end diff --git a/Assets/LuaFramework/ToLua/Lua/protobuf/type_checkers.lua.meta b/Assets/LuaFramework/ToLua/Lua/protobuf/type_checkers.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..ff7d827a134538e38571267676562b67bca6645b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/protobuf/type_checkers.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 38d553dac9a25c84c9c7d74608783a1b +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/protobuf/wire_format.lua b/Assets/LuaFramework/ToLua/Lua/protobuf/wire_format.lua new file mode 100644 index 0000000000000000000000000000000000000000..5e23b01a1b32bfc82b584067741ad738a90da577 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/protobuf/wire_format.lua @@ -0,0 +1,137 @@ +-- +-------------------------------------------------------------------------------- +-- FILE: wire_format.lua +-- DESCRIPTION: protoc-gen-lua +-- Google's Protocol Buffers project, ported to lua. +-- https://code.google.com/p/protoc-gen-lua/ +-- +-- Copyright (c) 2010 , 鏋楀崜姣 (Zhuoyi Lin) netsnail@gmail.com +-- All rights reserved. +-- +-- Use, modification and distribution are subject to the "New BSD License" +-- as listed at . +-- COMPANY: NetEase +-- CREATED: 2010骞07鏈30鏃 15鏃59鍒53绉 CST +-------------------------------------------------------------------------------- +-- + +local pb = require "pb" +module "protobuf.wire_format" + +WIRETYPE_VARINT = 0 +WIRETYPE_FIXED64 = 1 +WIRETYPE_LENGTH_DELIMITED = 2 +WIRETYPE_START_GROUP = 3 +WIRETYPE_END_GROUP = 4 +WIRETYPE_FIXED32 = 5 +_WIRETYPE_MAX = 5 + + +-- yeah, we don't need uint64 +local function _VarUInt64ByteSizeNoTag(uint64) + if uint64 <= 0x7f then return 1 end + if uint64 <= 0x3fff then return 2 end + if uint64 <= 0x1fffff then return 3 end + if uint64 <= 0xfffffff then return 4 end + return 5 +end + +function PackTag(field_number, wire_type) + return field_number * 8 + wire_type +end + +function UnpackTag(tag) + local wire_type = tag % 8 + return (tag - wire_type) / 8, wire_type +end + +ZigZagEncode32 = pb.zig_zag_encode32 +ZigZagDecode32 = pb.zig_zag_decode32 +ZigZagEncode64 = pb.zig_zag_encode64 +ZigZagDecode64 = pb.zig_zag_decode64 + +function Int32ByteSize(field_number, int32) + return Int64ByteSize(field_number, int32) +end + +function Int32ByteSizeNoTag(int32) + return _VarUInt64ByteSizeNoTag(int32) +end + +function Int64ByteSize(field_number, int64) + return UInt64ByteSize(field_number, int64) +end + +function UInt32ByteSize(field_number, uint32) + return UInt64ByteSize(field_number, uint32) +end + +function UInt64ByteSize(field_number, uint64) + return TagByteSize(field_number) + _VarUInt64ByteSizeNoTag(uint64) +end + +function SInt32ByteSize(field_number, int32) + return UInt32ByteSize(field_number, ZigZagEncode(int32)) +end + +function SInt64ByteSize(field_number, int64) + return UInt64ByteSize(field_number, ZigZagEncode(int64)) +end + +function Fixed32ByteSize(field_number, fixed32) + return TagByteSize(field_number) + 4 +end + +function Fixed64ByteSize(field_number, fixed64) + return TagByteSize(field_number) + 8 +end + +function SFixed32ByteSize(field_number, sfixed32) + return TagByteSize(field_number) + 4 +end + +function SFixed64ByteSize(field_number, sfixed64) + return TagByteSize(field_number) + 8 +end + +function FloatByteSize(field_number, flt) + return TagByteSize(field_number) + 4 +end + +function DoubleByteSize(field_number, double) + return TagByteSize(field_number) + 8 +end + +function BoolByteSize(field_number, b) + return TagByteSize(field_number) + 1 +end + +function EnumByteSize(field_number, enum) + return UInt32ByteSize(field_number, enum) +end + +function StringByteSize(field_number, string) + return BytesByteSize(field_number, string) +end + +function BytesByteSize(field_number, b) + return TagByteSize(field_number) + _VarUInt64ByteSizeNoTag(#b) + #b +end + +function MessageByteSize(field_number, message) + return TagByteSize(field_number) + _VarUInt64ByteSizeNoTag(message.ByteSize()) + message.ByteSize() +end + +function MessageSetItemByteSize(field_number, msg) + local total_size = 2 * TagByteSize(1) + TagByteSize(2) + TagByteSize(3) + total_size = total_size + _VarUInt64ByteSizeNoTag(field_number) + local message_size = msg.ByteSize() + total_size = total_size + _VarUInt64ByteSizeNoTag(message_size) + total_size = total_size + message_size + return total_size +end + +function TagByteSize(field_number) + return _VarUInt64ByteSizeNoTag(PackTag(field_number, 0)) +end + diff --git a/Assets/LuaFramework/ToLua/Lua/protobuf/wire_format.lua.meta b/Assets/LuaFramework/ToLua/Lua/protobuf/wire_format.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..b24c118e069368957539e41b70634ed9e6a703b1 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/protobuf/wire_format.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 02ba9c90e50e89e4da2ee869851300a0 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/slot.lua b/Assets/LuaFramework/ToLua/Lua/slot.lua new file mode 100644 index 0000000000000000000000000000000000000000..8498d890557baf0b74b65172e2c34893a4f1e602 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/slot.lua @@ -0,0 +1,26 @@ +-------------------------------------------------------------------------------- +-- Copyright (c) 2015 - 2016 , 钂欏崰蹇(topameng) topameng@gmail.com +-- All rights reserved. +-- Use, modification and distribution are subject to the "MIT License" +-------------------------------------------------------------------------------- +local setmetatable = setmetatable + +local _slot = {} +setmetatable(_slot, _slot) + +_slot.__call = function(self, ...) + if nil == self.obj then + return self.func(...) + else + return self.func(self.obj, ...) + end +end + +_slot.__eq = function (lhs, rhs) + return lhs.func == rhs.func and lhs.obj == rhs.obj +end + +--鍙敤浜 Timer 瀹氭椂鍣ㄥ洖璋冨嚱鏁. 渚嬪Timer.New(slot(self.func, self)) +function slot(func, obj) + return setmetatable({func = func, obj = obj}, _slot) +end \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Lua/slot.lua.meta b/Assets/LuaFramework/ToLua/Lua/slot.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..9b8ce84a1e339e0405de97d0adefde2f876e5cbd --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/slot.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 5040eeedfb5e1bf4b8a5294bba19ca0b +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/socket.lua b/Assets/LuaFramework/ToLua/Lua/socket.lua new file mode 100644 index 0000000000000000000000000000000000000000..d1c0b164924525c9821f0d6fc0fbf361afa6613b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/socket.lua @@ -0,0 +1,149 @@ +----------------------------------------------------------------------------- +-- LuaSocket helper module +-- Author: Diego Nehab +----------------------------------------------------------------------------- + +----------------------------------------------------------------------------- +-- Declare module and import dependencies +----------------------------------------------------------------------------- +local base = _G +local string = require("string") +local math = require("math") +local socket = require("socket.core") + +local _M = socket + +----------------------------------------------------------------------------- +-- Exported auxiliar functions +----------------------------------------------------------------------------- +function _M.connect4(address, port, laddress, lport) + return socket.connect(address, port, laddress, lport, "inet") +end + +function _M.connect6(address, port, laddress, lport) + return socket.connect(address, port, laddress, lport, "inet6") +end + +function _M.bind(host, port, backlog) + if host == "*" then host = "0.0.0.0" end + local addrinfo, err = socket.dns.getaddrinfo(host); + if not addrinfo then return nil, err end + local sock, res + err = "no info on address" + for i, alt in base.ipairs(addrinfo) do + if alt.family == "inet" then + sock, err = socket.tcp4() + else + sock, err = socket.tcp6() + end + if not sock then return nil, err end + sock:setoption("reuseaddr", true) + res, err = sock:bind(alt.addr, port) + if not res then + sock:close() + else + res, err = sock:listen(backlog) + if not res then + sock:close() + else + return sock + end + end + end + return nil, err +end + +_M.try = _M.newtry() + +function _M.choose(table) + return function(name, opt1, opt2) + if base.type(name) ~= "string" then + name, opt1, opt2 = "default", name, opt1 + end + local f = table[name or "nil"] + if not f then base.error("unknown key (".. base.tostring(name) ..")", 3) + else return f(opt1, opt2) end + end +end + +----------------------------------------------------------------------------- +-- Socket sources and sinks, conforming to LTN12 +----------------------------------------------------------------------------- +-- create namespaces inside LuaSocket namespace +local sourcet, sinkt = {}, {} +_M.sourcet = sourcet +_M.sinkt = sinkt + +_M.BLOCKSIZE = 2048 + +sinkt["close-when-done"] = function(sock) + return base.setmetatable({ + getfd = function() return sock:getfd() end, + dirty = function() return sock:dirty() end + }, { + __call = function(self, chunk, err) + if not chunk then + sock:close() + return 1 + else return sock:send(chunk) end + end + }) +end + +sinkt["keep-open"] = function(sock) + return base.setmetatable({ + getfd = function() return sock:getfd() end, + dirty = function() return sock:dirty() end + }, { + __call = function(self, chunk, err) + if chunk then return sock:send(chunk) + else return 1 end + end + }) +end + +sinkt["default"] = sinkt["keep-open"] + +_M.sink = _M.choose(sinkt) + +sourcet["by-length"] = function(sock, length) + return base.setmetatable({ + getfd = function() return sock:getfd() end, + dirty = function() return sock:dirty() end + }, { + __call = function() + if length <= 0 then return nil end + local size = math.min(socket.BLOCKSIZE, length) + local chunk, err = sock:receive(size) + if err then return nil, err end + length = length - string.len(chunk) + return chunk + end + }) +end + +sourcet["until-closed"] = function(sock) + local done + return base.setmetatable({ + getfd = function() return sock:getfd() end, + dirty = function() return sock:dirty() end + }, { + __call = function() + if done then return nil end + local chunk, err, partial = sock:receive(socket.BLOCKSIZE) + if not err then return chunk + elseif err == "closed" then + sock:close() + done = 1 + return partial + else return nil, err end + end + }) +end + + +sourcet["default"] = sourcet["until-closed"] + +_M.source = _M.choose(sourcet) + +return _M diff --git a/Assets/LuaFramework/ToLua/Lua/socket.lua.meta b/Assets/LuaFramework/ToLua/Lua/socket.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..4227462bc10c8e0632b93146978daa193d24deb0 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/socket.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 63c3bb6af007b6344af9a86ef0b7e225 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/socket.meta b/Assets/LuaFramework/ToLua/Lua/socket.meta new file mode 100644 index 0000000000000000000000000000000000000000..38f914870ec69e0f40887276fac03201cd2252c2 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/socket.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: d809aad390df7d54a95d719367731993 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/socket/ftp.lua b/Assets/LuaFramework/ToLua/Lua/socket/ftp.lua new file mode 100644 index 0000000000000000000000000000000000000000..637e6bc65c3723b7dd97ade3b1bc5d6f65f5e1e7 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/socket/ftp.lua @@ -0,0 +1,329 @@ +----------------------------------------------------------------------------- +-- FTP support for the Lua language +-- LuaSocket toolkit. +-- Author: Diego Nehab +----------------------------------------------------------------------------- + +----------------------------------------------------------------------------- +-- Declare module and import dependencies +----------------------------------------------------------------------------- +local base = _G +local table = require("table") +local string = require("string") +local math = require("math") +local socket = require("socket") +local url = require("socket.url") +local tp = require("socket.tp") +local ltn12 = require("ltn12") +socket.ftp = {} +local _M = socket.ftp +----------------------------------------------------------------------------- +-- Program constants +----------------------------------------------------------------------------- +-- timeout in seconds before the program gives up on a connection +_M.TIMEOUT = 60 +-- default port for ftp service +local PORT = 21 +-- this is the default anonymous password. used when no password is +-- provided in url. should be changed to your e-mail. +_M.USER = "ftp" +_M.PASSWORD = "anonymous@anonymous.org" + +----------------------------------------------------------------------------- +-- Low level FTP API +----------------------------------------------------------------------------- +local metat = { __index = {} } + +function _M.open(server, port, create) + local tp = socket.try(tp.connect(server, port or PORT, _M.TIMEOUT, create)) + local f = base.setmetatable({ tp = tp }, metat) + -- make sure everything gets closed in an exception + f.try = socket.newtry(function() f:close() end) + return f +end + +function metat.__index:portconnect() + self.try(self.server:settimeout(_M.TIMEOUT)) + self.data = self.try(self.server:accept()) + self.try(self.data:settimeout(_M.TIMEOUT)) +end + +function metat.__index:pasvconnect() + self.data = self.try(socket.tcp()) + self.try(self.data:settimeout(_M.TIMEOUT)) + self.try(self.data:connect(self.pasvt.address, self.pasvt.port)) +end + +function metat.__index:login(user, password) + self.try(self.tp:command("user", user or _M.USER)) + local code, reply = self.try(self.tp:check{"2..", 331}) + if code == 331 then + self.try(self.tp:command("pass", password or _M.PASSWORD)) + self.try(self.tp:check("2..")) + end + return 1 +end + +function metat.__index:pasv() + self.try(self.tp:command("pasv")) + local code, reply = self.try(self.tp:check("2..")) + local pattern = "(%d+)%D(%d+)%D(%d+)%D(%d+)%D(%d+)%D(%d+)" + local a, b, c, d, p1, p2 = socket.skip(2, string.find(reply, pattern)) + self.try(a and b and c and d and p1 and p2, reply) + self.pasvt = { + address = string.format("%d.%d.%d.%d", a, b, c, d), + port = p1*256 + p2 + } + if self.server then + self.server:close() + self.server = nil + end + return self.pasvt.address, self.pasvt.port +end + +function metat.__index:epsv() + self.try(self.tp:command("epsv")) + local code, reply = self.try(self.tp:check("229")) + local pattern = "%((.)(.-)%1(.-)%1(.-)%1%)" + local d, prt, address, port = string.match(reply, pattern) + self.try(port, "invalid epsv response") + self.pasvt = { + address = self.tp:getpeername(), + port = port + } + if self.server then + self.server:close() + self.server = nil + end + return self.pasvt.address, self.pasvt.port +end + + +function metat.__index:port(address, port) + self.pasvt = nil + if not address then + address, port = self.try(self.tp:getsockname()) + self.server = self.try(socket.bind(address, 0)) + address, port = self.try(self.server:getsockname()) + self.try(self.server:settimeout(_M.TIMEOUT)) + end + local pl = port % 256 + local ph = (port - pl)/256 + local arg = string.gsub(string.format("%s,%d,%d", address, ph, pl), "%.", ",") + self.try(self.tp:command("port", arg)) + self.try(self.tp:check("2..")) + return 1 +end + +function metat.__index:eprt(family, address, port) + self.pasvt = nil + if not address then + address, port = self.try(self.tp:getsockname()) + self.server = self.try(socket.bind(address, 0)) + address, port = self.try(self.server:getsockname()) + self.try(self.server:settimeout(_M.TIMEOUT)) + end + local arg = string.format("|%s|%s|%d|", family, address, port) + self.try(self.tp:command("eprt", arg)) + self.try(self.tp:check("2..")) + return 1 +end + + +function metat.__index:send(sendt) + self.try(self.pasvt or self.server, "need port or pasv first") + -- if there is a pasvt table, we already sent a PASV command + -- we just get the data connection into self.data + if self.pasvt then self:pasvconnect() end + -- get the transfer argument and command + local argument = sendt.argument or + url.unescape(string.gsub(sendt.path or "", "^[/\\]", "")) + if argument == "" then argument = nil end + local command = sendt.command or "stor" + -- send the transfer command and check the reply + self.try(self.tp:command(command, argument)) + local code, reply = self.try(self.tp:check{"2..", "1.."}) + -- if there is not a pasvt table, then there is a server + -- and we already sent a PORT command + if not self.pasvt then self:portconnect() end + -- get the sink, source and step for the transfer + local step = sendt.step or ltn12.pump.step + local readt = { self.tp } + local checkstep = function(src, snk) + -- check status in control connection while downloading + local readyt = socket.select(readt, nil, 0) + if readyt[tp] then code = self.try(self.tp:check("2..")) end + return step(src, snk) + end + local sink = socket.sink("close-when-done", self.data) + -- transfer all data and check error + self.try(ltn12.pump.all(sendt.source, sink, checkstep)) + if string.find(code, "1..") then self.try(self.tp:check("2..")) end + -- done with data connection + self.data:close() + -- find out how many bytes were sent + local sent = socket.skip(1, self.data:getstats()) + self.data = nil + return sent +end + +function metat.__index:receive(recvt) + self.try(self.pasvt or self.server, "need port or pasv first") + if self.pasvt then self:pasvconnect() end + local argument = recvt.argument or + url.unescape(string.gsub(recvt.path or "", "^[/\\]", "")) + if argument == "" then argument = nil end + local command = recvt.command or "retr" + self.try(self.tp:command(command, argument)) + local code,reply = self.try(self.tp:check{"1..", "2.."}) + if (code >= 200) and (code <= 299) then + recvt.sink(reply) + return 1 + end + if not self.pasvt then self:portconnect() end + local source = socket.source("until-closed", self.data) + local step = recvt.step or ltn12.pump.step + self.try(ltn12.pump.all(source, recvt.sink, step)) + if string.find(code, "1..") then self.try(self.tp:check("2..")) end + self.data:close() + self.data = nil + return 1 +end + +function metat.__index:cwd(dir) + self.try(self.tp:command("cwd", dir)) + self.try(self.tp:check(250)) + return 1 +end + +function metat.__index:type(type) + self.try(self.tp:command("type", type)) + self.try(self.tp:check(200)) + return 1 +end + +function metat.__index:greet() + local code = self.try(self.tp:check{"1..", "2.."}) + if string.find(code, "1..") then self.try(self.tp:check("2..")) end + return 1 +end + +function metat.__index:quit() + self.try(self.tp:command("quit")) + self.try(self.tp:check("2..")) + return 1 +end + +function metat.__index:close() + if self.data then self.data:close() end + if self.server then self.server:close() end + return self.tp:close() +end + +----------------------------------------------------------------------------- +-- High level FTP API +----------------------------------------------------------------------------- +local function override(t) + if t.url then + local u = url.parse(t.url) + for i,v in base.pairs(t) do + u[i] = v + end + return u + else return t end +end + +local function tput(putt) + putt = override(putt) + socket.try(putt.host, "missing hostname") + local f = _M.open(putt.host, putt.port, putt.create) + f:greet() + f:login(putt.user, putt.password) + if putt.type then f:type(putt.type) end + f:epsv() + local sent = f:send(putt) + f:quit() + f:close() + return sent +end + +local default = { + path = "/", + scheme = "ftp" +} + +local function genericform(u) + local t = socket.try(url.parse(u, default)) + socket.try(t.scheme == "ftp", "wrong scheme '" .. t.scheme .. "'") + socket.try(t.host, "missing hostname") + local pat = "^type=(.)$" + if t.params then + t.type = socket.skip(2, string.find(t.params, pat)) + socket.try(t.type == "a" or t.type == "i", + "invalid type '" .. t.type .. "'") + end + return t +end + +_M.genericform = genericform + +local function sput(u, body) + local putt = genericform(u) + putt.source = ltn12.source.string(body) + return tput(putt) +end + +_M.put = socket.protect(function(putt, body) + if base.type(putt) == "string" then return sput(putt, body) + else return tput(putt) end +end) + +local function tget(gett) + gett = override(gett) + socket.try(gett.host, "missing hostname") + local f = _M.open(gett.host, gett.port, gett.create) + f:greet() + f:login(gett.user, gett.password) + if gett.type then f:type(gett.type) end + f:epsv() + f:receive(gett) + f:quit() + return f:close() +end + +local function sget(u) + local gett = genericform(u) + local t = {} + gett.sink = ltn12.sink.table(t) + tget(gett) + return table.concat(t) +end + +_M.command = socket.protect(function(cmdt) + cmdt = override(cmdt) + socket.try(cmdt.host, "missing hostname") + socket.try(cmdt.command, "missing command") + local f = _M.open(cmdt.host, cmdt.port, cmdt.create) + f:greet() + f:login(cmdt.user, cmdt.password) + if type(cmdt.command) == "table" then + local argument = cmdt.argument or {} + local check = cmdt.check or {} + for i,cmd in ipairs(cmdt.command) do + f.try(f.tp:command(cmd, argument[i])) + if check[i] then f.try(f.tp:check(check[i])) end + end + else + f.try(f.tp:command(cmdt.command, cmdt.argument)) + if cmdt.check then f.try(f.tp:check(cmdt.check)) end + end + f:quit() + return f:close() +end) + +_M.get = socket.protect(function(gett) + if base.type(gett) == "string" then return sget(gett) + else return tget(gett) end +end) + +return _M diff --git a/Assets/LuaFramework/ToLua/Lua/socket/ftp.lua.meta b/Assets/LuaFramework/ToLua/Lua/socket/ftp.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..9853beb13d792d4873a778597d9e593417bf8de5 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/socket/ftp.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 7d703a862f37cfb42a2937b6f2cc9df6 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/socket/headers.lua b/Assets/LuaFramework/ToLua/Lua/socket/headers.lua new file mode 100644 index 0000000000000000000000000000000000000000..1eb8223b9ddf831457bf41348c1bcc1113cb0c55 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/socket/headers.lua @@ -0,0 +1,104 @@ +----------------------------------------------------------------------------- +-- Canonic header field capitalization +-- LuaSocket toolkit. +-- Author: Diego Nehab +----------------------------------------------------------------------------- +local socket = require("socket") +socket.headers = {} +local _M = socket.headers + +_M.canonic = { + ["accept"] = "Accept", + ["accept-charset"] = "Accept-Charset", + ["accept-encoding"] = "Accept-Encoding", + ["accept-language"] = "Accept-Language", + ["accept-ranges"] = "Accept-Ranges", + ["action"] = "Action", + ["alternate-recipient"] = "Alternate-Recipient", + ["age"] = "Age", + ["allow"] = "Allow", + ["arrival-date"] = "Arrival-Date", + ["authorization"] = "Authorization", + ["bcc"] = "Bcc", + ["cache-control"] = "Cache-Control", + ["cc"] = "Cc", + ["comments"] = "Comments", + ["connection"] = "Connection", + ["content-description"] = "Content-Description", + ["content-disposition"] = "Content-Disposition", + ["content-encoding"] = "Content-Encoding", + ["content-id"] = "Content-ID", + ["content-language"] = "Content-Language", + ["content-length"] = "Content-Length", + ["content-location"] = "Content-Location", + ["content-md5"] = "Content-MD5", + ["content-range"] = "Content-Range", + ["content-transfer-encoding"] = "Content-Transfer-Encoding", + ["content-type"] = "Content-Type", + ["cookie"] = "Cookie", + ["date"] = "Date", + ["diagnostic-code"] = "Diagnostic-Code", + ["dsn-gateway"] = "DSN-Gateway", + ["etag"] = "ETag", + ["expect"] = "Expect", + ["expires"] = "Expires", + ["final-log-id"] = "Final-Log-ID", + ["final-recipient"] = "Final-Recipient", + ["from"] = "From", + ["host"] = "Host", + ["if-match"] = "If-Match", + ["if-modified-since"] = "If-Modified-Since", + ["if-none-match"] = "If-None-Match", + ["if-range"] = "If-Range", + ["if-unmodified-since"] = "If-Unmodified-Since", + ["in-reply-to"] = "In-Reply-To", + ["keywords"] = "Keywords", + ["last-attempt-date"] = "Last-Attempt-Date", + ["last-modified"] = "Last-Modified", + ["location"] = "Location", + ["max-forwards"] = "Max-Forwards", + ["message-id"] = "Message-ID", + ["mime-version"] = "MIME-Version", + ["original-envelope-id"] = "Original-Envelope-ID", + ["original-recipient"] = "Original-Recipient", + ["pragma"] = "Pragma", + ["proxy-authenticate"] = "Proxy-Authenticate", + ["proxy-authorization"] = "Proxy-Authorization", + ["range"] = "Range", + ["received"] = "Received", + ["received-from-mta"] = "Received-From-MTA", + ["references"] = "References", + ["referer"] = "Referer", + ["remote-mta"] = "Remote-MTA", + ["reply-to"] = "Reply-To", + ["reporting-mta"] = "Reporting-MTA", + ["resent-bcc"] = "Resent-Bcc", + ["resent-cc"] = "Resent-Cc", + ["resent-date"] = "Resent-Date", + ["resent-from"] = "Resent-From", + ["resent-message-id"] = "Resent-Message-ID", + ["resent-reply-to"] = "Resent-Reply-To", + ["resent-sender"] = "Resent-Sender", + ["resent-to"] = "Resent-To", + ["retry-after"] = "Retry-After", + ["return-path"] = "Return-Path", + ["sender"] = "Sender", + ["server"] = "Server", + ["smtp-remote-recipient"] = "SMTP-Remote-Recipient", + ["status"] = "Status", + ["subject"] = "Subject", + ["te"] = "TE", + ["to"] = "To", + ["trailer"] = "Trailer", + ["transfer-encoding"] = "Transfer-Encoding", + ["upgrade"] = "Upgrade", + ["user-agent"] = "User-Agent", + ["vary"] = "Vary", + ["via"] = "Via", + ["warning"] = "Warning", + ["will-retry-until"] = "Will-Retry-Until", + ["www-authenticate"] = "WWW-Authenticate", + ["x-mailer"] = "X-Mailer", +} + +return _M \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Lua/socket/headers.lua.meta b/Assets/LuaFramework/ToLua/Lua/socket/headers.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..76c51a80849aef56130ae05c4712199c7f93d458 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/socket/headers.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 62876db61c32bf6499db08ea59ccff1f +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/socket/http.lua b/Assets/LuaFramework/ToLua/Lua/socket/http.lua new file mode 100644 index 0000000000000000000000000000000000000000..f2fff01c4e0170ff413deac194c601b45342bbde --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/socket/http.lua @@ -0,0 +1,381 @@ +----------------------------------------------------------------------------- +-- HTTP/1.1 client support for the Lua language. +-- LuaSocket toolkit. +-- Author: Diego Nehab +----------------------------------------------------------------------------- + +----------------------------------------------------------------------------- +-- Declare module and import dependencies +------------------------------------------------------------------------------- +local socket = require("socket") +local url = require("socket.url") +local ltn12 = require("ltn12") +local mime = require("mime") +local string = require("string") +local headers = require("socket.headers") +local base = _G +local table = require("table") +socket.http = {} +local _M = socket.http + +----------------------------------------------------------------------------- +-- Program constants +----------------------------------------------------------------------------- +-- connection timeout in seconds +_M.TIMEOUT = 60 +-- user agent field sent in request +_M.USERAGENT = socket._VERSION + +-- supported schemes +local SCHEMES = { ["http"] = true } +-- default port for document retrieval +local PORT = 80 + +----------------------------------------------------------------------------- +-- Reads MIME headers from a connection, unfolding where needed +----------------------------------------------------------------------------- +local function receiveheaders(sock, headers) + local line, name, value, err + headers = headers or {} + -- get first line + line, err = sock:receive() + if err then return nil, err end + -- headers go until a blank line is found + while line ~= "" do + -- get field-name and value + name, value = socket.skip(2, string.find(line, "^(.-):%s*(.*)")) + if not (name and value) then return nil, "malformed reponse headers" end + name = string.lower(name) + -- get next line (value might be folded) + line, err = sock:receive() + if err then return nil, err end + -- unfold any folded values + while string.find(line, "^%s") do + value = value .. line + line = sock:receive() + if err then return nil, err end + end + -- save pair in table + if headers[name] then headers[name] = headers[name] .. ", " .. value + else headers[name] = value end + end + return headers +end + +----------------------------------------------------------------------------- +-- Extra sources and sinks +----------------------------------------------------------------------------- +socket.sourcet["http-chunked"] = function(sock, headers) + return base.setmetatable({ + getfd = function() return sock:getfd() end, + dirty = function() return sock:dirty() end + }, { + __call = function() + -- get chunk size, skip extention + local line, err = sock:receive() + if err then return nil, err end + local size = base.tonumber(string.gsub(line, ";.*", ""), 16) + if not size then return nil, "invalid chunk size" end + -- was it the last chunk? + if size > 0 then + -- if not, get chunk and skip terminating CRLF + local chunk, err, part = sock:receive(size) + if chunk then sock:receive() end + return chunk, err + else + -- if it was, read trailers into headers table + headers, err = receiveheaders(sock, headers) + if not headers then return nil, err end + end + end + }) +end + +socket.sinkt["http-chunked"] = function(sock) + return base.setmetatable({ + getfd = function() return sock:getfd() end, + dirty = function() return sock:dirty() end + }, { + __call = function(self, chunk, err) + if not chunk then return sock:send("0\r\n\r\n") end + local size = string.format("%X\r\n", string.len(chunk)) + return sock:send(size .. chunk .. "\r\n") + end + }) +end + +----------------------------------------------------------------------------- +-- Low level HTTP API +----------------------------------------------------------------------------- +local metat = { __index = {} } + +function _M.open(host, port, create) + -- create socket with user connect function, or with default + local c = socket.try((create or socket.tcp)()) + local h = base.setmetatable({ c = c }, metat) + -- create finalized try + h.try = socket.newtry(function() h:close() end) + -- set timeout before connecting + h.try(c:settimeout(_M.TIMEOUT)) + h.try(c:connect(host, port or PORT)) + -- here everything worked + return h +end + +function metat.__index:sendrequestline(method, uri) + local reqline = string.format("%s %s HTTP/1.1\r\n", method or "GET", uri) + return self.try(self.c:send(reqline)) +end + +function metat.__index:sendheaders(tosend) + local canonic = headers.canonic + local h = "\r\n" + for f, v in base.pairs(tosend) do + h = (canonic[f] or f) .. ": " .. v .. "\r\n" .. h + end + self.try(self.c:send(h)) + return 1 +end + +function metat.__index:sendbody(headers, source, step) + source = source or ltn12.source.empty() + step = step or ltn12.pump.step + -- if we don't know the size in advance, send chunked and hope for the best + local mode = "http-chunked" + if headers["content-length"] then mode = "keep-open" end + return self.try(ltn12.pump.all(source, socket.sink(mode, self.c), step)) +end + +function metat.__index:receivestatusline() + local status = self.try(self.c:receive(5)) + -- identify HTTP/0.9 responses, which do not contain a status line + -- this is just a heuristic, but is what the RFC recommends + if status ~= "HTTP/" then return nil, status end + -- otherwise proceed reading a status line + status = self.try(self.c:receive("*l", status)) + local code = socket.skip(2, string.find(status, "HTTP/%d*%.%d* (%d%d%d)")) + return self.try(base.tonumber(code), status) +end + +function metat.__index:receiveheaders() + return self.try(receiveheaders(self.c)) +end + +function metat.__index:receivebody(headers, sink, step) + sink = sink or ltn12.sink.null() + step = step or ltn12.pump.step + local length = base.tonumber(headers["content-length"]) + local t = headers["transfer-encoding"] -- shortcut + local mode = "default" -- connection close + if t and t ~= "identity" then mode = "http-chunked" + elseif base.tonumber(headers["content-length"]) then mode = "by-length" end + return self.try(ltn12.pump.all(socket.source(mode, self.c, length), + sink, step)) +end + +function metat.__index:receive09body(status, sink, step) + local source = ltn12.source.rewind(socket.source("until-closed", self.c)) + source(status) + return self.try(ltn12.pump.all(source, sink, step)) +end + +function metat.__index:close() + return self.c:close() +end + +----------------------------------------------------------------------------- +-- High level HTTP API +----------------------------------------------------------------------------- +local function adjusturi(reqt) + local u = reqt + -- if there is a proxy, we need the full url. otherwise, just a part. + if not reqt.proxy and not _M.PROXY then + u = { + path = socket.try(reqt.path, "invalid path 'nil'"), + params = reqt.params, + query = reqt.query, + fragment = reqt.fragment + } + end + return url.build(u) +end + +local function adjustproxy(reqt) + local proxy = reqt.proxy or _M.PROXY + if proxy then + proxy = url.parse(proxy) + return proxy.host, proxy.port or 3128 + else + return reqt.host, reqt.port + end +end + +local function adjustheaders(reqt) + -- default headers + local host = string.gsub(reqt.authority, "^.-@", "") + local lower = { + ["user-agent"] = _M.USERAGENT, + ["host"] = host, + ["connection"] = "close, TE", + ["te"] = "trailers" + } + -- if we have authentication information, pass it along + if reqt.user and reqt.password then + lower["authorization"] = + "Basic " .. (mime.b64(reqt.user .. ":" .. reqt.password)) + end + -- if we have proxy authentication information, pass it along + local proxy = reqt.proxy or _M.PROXY + if proxy then + proxy = url.parse(proxy) + if proxy.user and proxy.password then + lower["proxy-authorization"] = + "Basic " .. (mime.b64(proxy.user .. ":" .. proxy.password)) + end + end + -- override with user headers + for i,v in base.pairs(reqt.headers or lower) do + lower[string.lower(i)] = v + end + return lower +end + +-- default url parts +local default = { + host = "", + port = PORT, + path ="/", + scheme = "http" +} + +local function adjustrequest(reqt) + -- parse url if provided + local nreqt = reqt.url and url.parse(reqt.url, default) or {} + -- explicit components override url + for i,v in base.pairs(reqt) do nreqt[i] = v end + if nreqt.port == "" then nreqt.port = PORT end + if not (nreqt.host and nreqt.host ~= "") then + socket.try(nil, "invalid host '" .. base.tostring(nreqt.host) .. "'") + end + -- compute uri if user hasn't overriden + nreqt.uri = reqt.uri or adjusturi(nreqt) + -- adjust headers in request + nreqt.headers = adjustheaders(nreqt) + -- ajust host and port if there is a proxy + nreqt.host, nreqt.port = adjustproxy(nreqt) + return nreqt +end + +local function shouldredirect(reqt, code, headers) + local location = headers.location + if not location then return false end + location = string.gsub(location, "%s", "") + if location == "" then return false end + local scheme = string.match(location, "^([%w][%w%+%-%.]*)%:") + if scheme and not SCHEMES[scheme] then return false end + return (reqt.redirect ~= false) and + (code == 301 or code == 302 or code == 303 or code == 307) and + (not reqt.method or reqt.method == "GET" or reqt.method == "HEAD") + and (not reqt.nredirects or reqt.nredirects < 5) +end + +local function shouldreceivebody(reqt, code) + if reqt.method == "HEAD" then return nil end + if code == 204 or code == 304 then return nil end + if code >= 100 and code < 200 then return nil end + return 1 +end + +-- forward declarations +local trequest, tredirect + +--[[local]] function tredirect(reqt, location) + local result, code, headers, status = trequest { + -- the RFC says the redirect URL has to be absolute, but some + -- servers do not respect that + url = url.absolute(reqt.url, location), + source = reqt.source, + sink = reqt.sink, + headers = reqt.headers, + proxy = reqt.proxy, + nredirects = (reqt.nredirects or 0) + 1, + create = reqt.create + } + -- pass location header back as a hint we redirected + headers = headers or {} + headers.location = headers.location or location + return result, code, headers, status +end + +--[[local]] function trequest(reqt) + -- we loop until we get what we want, or + -- until we are sure there is no way to get it + local nreqt = adjustrequest(reqt) + local h = _M.open(nreqt.host, nreqt.port, nreqt.create) + -- send request line and headers + h:sendrequestline(nreqt.method, nreqt.uri) + h:sendheaders(nreqt.headers) + -- if there is a body, send it + if nreqt.source then + h:sendbody(nreqt.headers, nreqt.source, nreqt.step) + end + local code, status = h:receivestatusline() + -- if it is an HTTP/0.9 server, simply get the body and we are done + if not code then + h:receive09body(status, nreqt.sink, nreqt.step) + return 1, 200 + end + local headers + -- ignore any 100-continue messages + while code == 100 do + headers = h:receiveheaders() + code, status = h:receivestatusline() + end + headers = h:receiveheaders() + -- at this point we should have a honest reply from the server + -- we can't redirect if we already used the source, so we report the error + if shouldredirect(nreqt, code, headers) and not nreqt.source then + h:close() + return tredirect(reqt, headers.location) + end + -- here we are finally done + if shouldreceivebody(nreqt, code) then + h:receivebody(headers, nreqt.sink, nreqt.step) + end + h:close() + return 1, code, headers, status +end + +-- turns an url and a body into a generic request +local function genericform(u, b) + local t = {} + local reqt = { + url = u, + sink = ltn12.sink.table(t), + target = t + } + if b then + reqt.source = ltn12.source.string(b) + reqt.headers = { + ["content-length"] = string.len(b), + ["content-type"] = "application/x-www-form-urlencoded" + } + reqt.method = "POST" + end + return reqt +end + +_M.genericform = genericform + +local function srequest(u, b) + local reqt = genericform(u, b) + local _, code, headers, status = trequest(reqt) + return table.concat(reqt.target), code, headers, status +end + +_M.request = socket.protect(function(reqt, body) + if base.type(reqt) == "string" then return srequest(reqt, body) + else return trequest(reqt) end +end) + +return _M diff --git a/Assets/LuaFramework/ToLua/Lua/socket/http.lua.meta b/Assets/LuaFramework/ToLua/Lua/socket/http.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..bd8f46ad26dbf2700d7ed2973e575f508d836268 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/socket/http.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 209e83764932d974287e82cda5febaf7 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/socket/mbox.lua b/Assets/LuaFramework/ToLua/Lua/socket/mbox.lua new file mode 100644 index 0000000000000000000000000000000000000000..ed9e7814e60d3686b01d8a88c49143e69ab54f2f --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/socket/mbox.lua @@ -0,0 +1,92 @@ +local _M = {} + +if module then + mbox = _M +end + +function _M.split_message(message_s) + local message = {} + message_s = string.gsub(message_s, "\r\n", "\n") + string.gsub(message_s, "^(.-\n)\n", function (h) message.headers = h end) + string.gsub(message_s, "^.-\n\n(.*)", function (b) message.body = b end) + if not message.body then + string.gsub(message_s, "^\n(.*)", function (b) message.body = b end) + end + if not message.headers and not message.body then + message.headers = message_s + end + return message.headers or "", message.body or "" +end + +function _M.split_headers(headers_s) + local headers = {} + headers_s = string.gsub(headers_s, "\r\n", "\n") + headers_s = string.gsub(headers_s, "\n[ ]+", " ") + string.gsub("\n" .. headers_s, "\n([^\n]+)", function (h) table.insert(headers, h) end) + return headers +end + +function _M.parse_header(header_s) + header_s = string.gsub(header_s, "\n[ ]+", " ") + header_s = string.gsub(header_s, "\n+", "") + local _, __, name, value = string.find(header_s, "([^%s:]-):%s*(.*)") + return name, value +end + +function _M.parse_headers(headers_s) + local headers_t = _M.split_headers(headers_s) + local headers = {} + for i = 1, #headers_t do + local name, value = _M.parse_header(headers_t[i]) + if name then + name = string.lower(name) + if headers[name] then + headers[name] = headers[name] .. ", " .. value + else headers[name] = value end + end + end + return headers +end + +function _M.parse_from(from) + local _, __, name, address = string.find(from, "^%s*(.-)%s*%<(.-)%>") + if not address then + _, __, address = string.find(from, "%s*(.+)%s*") + end + name = name or "" + address = address or "" + if name == "" then name = address end + name = string.gsub(name, '"', "") + return name, address +end + +function _M.split_mbox(mbox_s) + local mbox = {} + mbox_s = string.gsub(mbox_s, "\r\n", "\n") .."\n\nFrom \n" + local nj, i, j = 1, 1, 1 + while 1 do + i, nj = string.find(mbox_s, "\n\nFrom .-\n", j) + if not i then break end + local message = string.sub(mbox_s, j, i-1) + table.insert(mbox, message) + j = nj+1 + end + return mbox +end + +function _M.parse(mbox_s) + local mbox = _M.split_mbox(mbox_s) + for i = 1, #mbox do + mbox[i] = _M.parse_message(mbox[i]) + end + return mbox +end + +function _M.parse_message(message_s) + local message = {} + message.headers, message.body = _M.split_message(message_s) + message.headers = _M.parse_headers(message.headers) + return message +end + +return _M diff --git a/Assets/LuaFramework/ToLua/Lua/socket/mbox.lua.meta b/Assets/LuaFramework/ToLua/Lua/socket/mbox.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..54be4d5bd91339adec8f284e033ef9438486bb9d --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/socket/mbox.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: b179323d673f3f04996fc0b22c0817bb +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/socket/smtp.lua b/Assets/LuaFramework/ToLua/Lua/socket/smtp.lua new file mode 100644 index 0000000000000000000000000000000000000000..b113d0067731f91f547a6719872dbb879cb0020d --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/socket/smtp.lua @@ -0,0 +1,256 @@ +----------------------------------------------------------------------------- +-- SMTP client support for the Lua language. +-- LuaSocket toolkit. +-- Author: Diego Nehab +----------------------------------------------------------------------------- + +----------------------------------------------------------------------------- +-- Declare module and import dependencies +----------------------------------------------------------------------------- +local base = _G +local coroutine = require("coroutine") +local string = require("string") +local math = require("math") +local os = require("os") +local socket = require("socket") +local tp = require("socket.tp") +local ltn12 = require("ltn12") +local headers = require("socket.headers") +local mime = require("mime") + +socket.smtp = {} +local _M = socket.smtp + +----------------------------------------------------------------------------- +-- Program constants +----------------------------------------------------------------------------- +-- timeout for connection +_M.TIMEOUT = 60 +-- default server used to send e-mails +_M.SERVER = "localhost" +-- default port +_M.PORT = 25 +-- domain used in HELO command and default sendmail +-- If we are under a CGI, try to get from environment +_M.DOMAIN = os.getenv("SERVER_NAME") or "localhost" +-- default time zone (means we don't know) +_M.ZONE = "-0000" + +--------------------------------------------------------------------------- +-- Low level SMTP API +----------------------------------------------------------------------------- +local metat = { __index = {} } + +function metat.__index:greet(domain) + self.try(self.tp:check("2..")) + self.try(self.tp:command("EHLO", domain or _M.DOMAIN)) + return socket.skip(1, self.try(self.tp:check("2.."))) +end + +function metat.__index:mail(from) + self.try(self.tp:command("MAIL", "FROM:" .. from)) + return self.try(self.tp:check("2..")) +end + +function metat.__index:rcpt(to) + self.try(self.tp:command("RCPT", "TO:" .. to)) + return self.try(self.tp:check("2..")) +end + +function metat.__index:data(src, step) + self.try(self.tp:command("DATA")) + self.try(self.tp:check("3..")) + self.try(self.tp:source(src, step)) + self.try(self.tp:send("\r\n.\r\n")) + return self.try(self.tp:check("2..")) +end + +function metat.__index:quit() + self.try(self.tp:command("QUIT")) + return self.try(self.tp:check("2..")) +end + +function metat.__index:close() + return self.tp:close() +end + +function metat.__index:login(user, password) + self.try(self.tp:command("AUTH", "LOGIN")) + self.try(self.tp:check("3..")) + self.try(self.tp:send(mime.b64(user) .. "\r\n")) + self.try(self.tp:check("3..")) + self.try(self.tp:send(mime.b64(password) .. "\r\n")) + return self.try(self.tp:check("2..")) +end + +function metat.__index:plain(user, password) + local auth = "PLAIN " .. mime.b64("\0" .. user .. "\0" .. password) + self.try(self.tp:command("AUTH", auth)) + return self.try(self.tp:check("2..")) +end + +function metat.__index:auth(user, password, ext) + if not user or not password then return 1 end + if string.find(ext, "AUTH[^\n]+LOGIN") then + return self:login(user, password) + elseif string.find(ext, "AUTH[^\n]+PLAIN") then + return self:plain(user, password) + else + self.try(nil, "authentication not supported") + end +end + +-- send message or throw an exception +function metat.__index:send(mailt) + self:mail(mailt.from) + if base.type(mailt.rcpt) == "table" then + for i,v in base.ipairs(mailt.rcpt) do + self:rcpt(v) + end + else + self:rcpt(mailt.rcpt) + end + self:data(ltn12.source.chain(mailt.source, mime.stuff()), mailt.step) +end + +function _M.open(server, port, create) + local tp = socket.try(tp.connect(server or _M.SERVER, port or _M.PORT, + _M.TIMEOUT, create)) + local s = base.setmetatable({tp = tp}, metat) + -- make sure tp is closed if we get an exception + s.try = socket.newtry(function() + s:close() + end) + return s +end + +-- convert headers to lowercase +local function lower_headers(headers) + local lower = {} + for i,v in base.pairs(headers or lower) do + lower[string.lower(i)] = v + end + return lower +end + +--------------------------------------------------------------------------- +-- Multipart message source +----------------------------------------------------------------------------- +-- returns a hopefully unique mime boundary +local seqno = 0 +local function newboundary() + seqno = seqno + 1 + return string.format('%s%05d==%05u', os.date('%d%m%Y%H%M%S'), + math.random(0, 99999), seqno) +end + +-- send_message forward declaration +local send_message + +-- yield the headers all at once, it's faster +local function send_headers(tosend) + local canonic = headers.canonic + local h = "\r\n" + for f,v in base.pairs(tosend) do + h = (canonic[f] or f) .. ': ' .. v .. "\r\n" .. h + end + coroutine.yield(h) +end + +-- yield multipart message body from a multipart message table +local function send_multipart(mesgt) + -- make sure we have our boundary and send headers + local bd = newboundary() + local headers = lower_headers(mesgt.headers or {}) + headers['content-type'] = headers['content-type'] or 'multipart/mixed' + headers['content-type'] = headers['content-type'] .. + '; boundary="' .. bd .. '"' + send_headers(headers) + -- send preamble + if mesgt.body.preamble then + coroutine.yield(mesgt.body.preamble) + coroutine.yield("\r\n") + end + -- send each part separated by a boundary + for i, m in base.ipairs(mesgt.body) do + coroutine.yield("\r\n--" .. bd .. "\r\n") + send_message(m) + end + -- send last boundary + coroutine.yield("\r\n--" .. bd .. "--\r\n\r\n") + -- send epilogue + if mesgt.body.epilogue then + coroutine.yield(mesgt.body.epilogue) + coroutine.yield("\r\n") + end +end + +-- yield message body from a source +local function send_source(mesgt) + -- make sure we have a content-type + local headers = lower_headers(mesgt.headers or {}) + headers['content-type'] = headers['content-type'] or + 'text/plain; charset="iso-8859-1"' + send_headers(headers) + -- send body from source + while true do + local chunk, err = mesgt.body() + if err then coroutine.yield(nil, err) + elseif chunk then coroutine.yield(chunk) + else break end + end +end + +-- yield message body from a string +local function send_string(mesgt) + -- make sure we have a content-type + local headers = lower_headers(mesgt.headers or {}) + headers['content-type'] = headers['content-type'] or + 'text/plain; charset="iso-8859-1"' + send_headers(headers) + -- send body from string + coroutine.yield(mesgt.body) +end + +-- message source +function send_message(mesgt) + if base.type(mesgt.body) == "table" then send_multipart(mesgt) + elseif base.type(mesgt.body) == "function" then send_source(mesgt) + else send_string(mesgt) end +end + +-- set defaul headers +local function adjust_headers(mesgt) + local lower = lower_headers(mesgt.headers) + lower["date"] = lower["date"] or + os.date("!%a, %d %b %Y %H:%M:%S ") .. (mesgt.zone or _M.ZONE) + lower["x-mailer"] = lower["x-mailer"] or socket._VERSION + -- this can't be overriden + lower["mime-version"] = "1.0" + return lower +end + +function _M.message(mesgt) + mesgt.headers = adjust_headers(mesgt) + -- create and return message source + local co = coroutine.create(function() send_message(mesgt) end) + return function() + local ret, a, b = coroutine.resume(co) + if ret then return a, b + else return nil, a end + end +end + +--------------------------------------------------------------------------- +-- High level SMTP API +----------------------------------------------------------------------------- +_M.send = socket.protect(function(mailt) + local s = _M.open(mailt.server, mailt.port, mailt.create) + local ext = s:greet(mailt.domain) + s:auth(mailt.user, mailt.password, ext) + s:send(mailt) + s:quit() + return s:close() +end) + +return _M \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Lua/socket/smtp.lua.meta b/Assets/LuaFramework/ToLua/Lua/socket/smtp.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..7a2adb983098682b41dbd02392698f3352e0d60c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/socket/smtp.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 5fb16f8ece254ef4d9c196242b49a8ae +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/socket/tp.lua b/Assets/LuaFramework/ToLua/Lua/socket/tp.lua new file mode 100644 index 0000000000000000000000000000000000000000..b8ebc56d16a200322c107a6970e017ddf4e0273a --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/socket/tp.lua @@ -0,0 +1,134 @@ +----------------------------------------------------------------------------- +-- Unified SMTP/FTP subsystem +-- LuaSocket toolkit. +-- Author: Diego Nehab +----------------------------------------------------------------------------- + +----------------------------------------------------------------------------- +-- Declare module and import dependencies +----------------------------------------------------------------------------- +local base = _G +local string = require("string") +local socket = require("socket") +local ltn12 = require("ltn12") + +socket.tp = {} +local _M = socket.tp + +----------------------------------------------------------------------------- +-- Program constants +----------------------------------------------------------------------------- +_M.TIMEOUT = 60 + +----------------------------------------------------------------------------- +-- Implementation +----------------------------------------------------------------------------- +-- gets server reply (works for SMTP and FTP) +local function get_reply(c) + local code, current, sep + local line, err = c:receive() + local reply = line + if err then return nil, err end + code, sep = socket.skip(2, string.find(line, "^(%d%d%d)(.?)")) + if not code then return nil, "invalid server reply" end + if sep == "-" then -- reply is multiline + repeat + line, err = c:receive() + if err then return nil, err end + current, sep = socket.skip(2, string.find(line, "^(%d%d%d)(.?)")) + reply = reply .. "\n" .. line + -- reply ends with same code + until code == current and sep == " " + end + return code, reply +end + +-- metatable for sock object +local metat = { __index = {} } + +function metat.__index:getpeername() + return self.c:getpeername() +end + +function metat.__index:getsockname() + return self.c:getpeername() +end + +function metat.__index:check(ok) + local code, reply = get_reply(self.c) + if not code then return nil, reply end + if base.type(ok) ~= "function" then + if base.type(ok) == "table" then + for i, v in base.ipairs(ok) do + if string.find(code, v) then + return base.tonumber(code), reply + end + end + return nil, reply + else + if string.find(code, ok) then return base.tonumber(code), reply + else return nil, reply end + end + else return ok(base.tonumber(code), reply) end +end + +function metat.__index:command(cmd, arg) + cmd = string.upper(cmd) + if arg then + return self.c:send(cmd .. " " .. arg.. "\r\n") + else + return self.c:send(cmd .. "\r\n") + end +end + +function metat.__index:sink(snk, pat) + local chunk, err = self.c:receive(pat) + return snk(chunk, err) +end + +function metat.__index:send(data) + return self.c:send(data) +end + +function metat.__index:receive(pat) + return self.c:receive(pat) +end + +function metat.__index:getfd() + return self.c:getfd() +end + +function metat.__index:dirty() + return self.c:dirty() +end + +function metat.__index:getcontrol() + return self.c +end + +function metat.__index:source(source, step) + local sink = socket.sink("keep-open", self.c) + local ret, err = ltn12.pump.all(source, sink, step or ltn12.pump.step) + return ret, err +end + +-- closes the underlying c +function metat.__index:close() + self.c:close() + return 1 +end + +-- connect with server and return c object +function _M.connect(host, port, timeout, create) + local c, e = (create or socket.tcp)() + if not c then return nil, e end + c:settimeout(timeout or _M.TIMEOUT) + local r, e = c:connect(host, port) + if not r then + c:close() + return nil, e + end + return base.setmetatable({c = c}, metat) +end + +return _M diff --git a/Assets/LuaFramework/ToLua/Lua/socket/tp.lua.meta b/Assets/LuaFramework/ToLua/Lua/socket/tp.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..bd9f8ac691857fc8a7f91bd21f26a498fd875ea8 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/socket/tp.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: f81b525c8aa6ab6408db2989c91556cc +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/socket/url.lua b/Assets/LuaFramework/ToLua/Lua/socket/url.lua new file mode 100644 index 0000000000000000000000000000000000000000..fbd93d1dce3066817bd6a435ed0a2760a9ce971e --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/socket/url.lua @@ -0,0 +1,308 @@ +----------------------------------------------------------------------------- +-- URI parsing, composition and relative URL resolution +-- LuaSocket toolkit. +-- Author: Diego Nehab +----------------------------------------------------------------------------- + +----------------------------------------------------------------------------- +-- Declare module +----------------------------------------------------------------------------- +local string = require("string") +local base = _G +local table = require("table") +local socket = require("socket") + +socket.url = {} +local _M = socket.url + +----------------------------------------------------------------------------- +-- Module version +----------------------------------------------------------------------------- +_M._VERSION = "URL 1.0.3" + +----------------------------------------------------------------------------- +-- Encodes a string into its escaped hexadecimal representation +-- Input +-- s: binary string to be encoded +-- Returns +-- escaped representation of string binary +----------------------------------------------------------------------------- +function _M.escape(s) + return (string.gsub(s, "([^A-Za-z0-9_])", function(c) + return string.format("%%%02x", string.byte(c)) + end)) +end + +----------------------------------------------------------------------------- +-- Protects a path segment, to prevent it from interfering with the +-- url parsing. +-- Input +-- s: binary string to be encoded +-- Returns +-- escaped representation of string binary +----------------------------------------------------------------------------- +local function make_set(t) + local s = {} + for i,v in base.ipairs(t) do + s[t[i]] = 1 + end + return s +end + +-- these are allowed withing a path segment, along with alphanum +-- other characters must be escaped +local segment_set = make_set { + "-", "_", ".", "!", "~", "*", "'", "(", + ")", ":", "@", "&", "=", "+", "$", ",", +} + +local function protect_segment(s) + return string.gsub(s, "([^A-Za-z0-9_])", function (c) + if segment_set[c] then return c + else return string.format("%%%02x", string.byte(c)) end + end) +end + +----------------------------------------------------------------------------- +-- Encodes a string into its escaped hexadecimal representation +-- Input +-- s: binary string to be encoded +-- Returns +-- escaped representation of string binary +----------------------------------------------------------------------------- +function _M.unescape(s) + return (string.gsub(s, "%%(%x%x)", function(hex) + return string.char(base.tonumber(hex, 16)) + end)) +end + +----------------------------------------------------------------------------- +-- Builds a path from a base path and a relative path +-- Input +-- base_path +-- relative_path +-- Returns +-- corresponding absolute path +----------------------------------------------------------------------------- +local function absolute_path(base_path, relative_path) + if string.sub(relative_path, 1, 1) == "/" then return relative_path end + local path = string.gsub(base_path, "[^/]*$", "") + path = path .. relative_path + path = string.gsub(path, "([^/]*%./)", function (s) + if s ~= "./" then return s else return "" end + end) + path = string.gsub(path, "/%.$", "/") + local reduced + while reduced ~= path do + reduced = path + path = string.gsub(reduced, "([^/]*/%.%./)", function (s) + if s ~= "../../" then return "" else return s end + end) + end + path = string.gsub(reduced, "([^/]*/%.%.)$", function (s) + if s ~= "../.." then return "" else return s end + end) + return path +end + +----------------------------------------------------------------------------- +-- Parses a url and returns a table with all its parts according to RFC 2396 +-- The following grammar describes the names given to the URL parts +-- ::= :///;?# +-- ::= @: +-- ::= [:] +-- :: = {/} +-- Input +-- url: uniform resource locator of request +-- default: table with default values for each field +-- Returns +-- table with the following fields, where RFC naming conventions have +-- been preserved: +-- scheme, authority, userinfo, user, password, host, port, +-- path, params, query, fragment +-- Obs: +-- the leading '/' in {/} is considered part of +----------------------------------------------------------------------------- +function _M.parse(url, default) + -- initialize default parameters + local parsed = {} + for i,v in base.pairs(default or parsed) do parsed[i] = v end + -- empty url is parsed to nil + if not url or url == "" then return nil, "invalid url" end + -- remove whitespace + -- url = string.gsub(url, "%s", "") + -- get fragment + url = string.gsub(url, "#(.*)$", function(f) + parsed.fragment = f + return "" + end) + -- get scheme + url = string.gsub(url, "^([%w][%w%+%-%.]*)%:", + function(s) parsed.scheme = s; return "" end) + -- get authority + url = string.gsub(url, "^//([^/]*)", function(n) + parsed.authority = n + return "" + end) + -- get query string + url = string.gsub(url, "%?(.*)", function(q) + parsed.query = q + return "" + end) + -- get params + url = string.gsub(url, "%;(.*)", function(p) + parsed.params = p + return "" + end) + -- path is whatever was left + if url ~= "" then parsed.path = url end + local authority = parsed.authority + if not authority then return parsed end + authority = string.gsub(authority,"^([^@]*)@", + function(u) parsed.userinfo = u; return "" end) + authority = string.gsub(authority, ":([^:%]]*)$", + function(p) parsed.port = p; return "" end) + if authority ~= "" then + -- IPv6? + parsed.host = string.match(authority, "^%[(.+)%]$") or authority + end + local userinfo = parsed.userinfo + if not userinfo then return parsed end + userinfo = string.gsub(userinfo, ":([^:]*)$", + function(p) parsed.password = p; return "" end) + parsed.user = userinfo + return parsed +end + +----------------------------------------------------------------------------- +-- Rebuilds a parsed URL from its components. +-- Components are protected if any reserved or unallowed characters are found +-- Input +-- parsed: parsed URL, as returned by parse +-- Returns +-- a stringing with the corresponding URL +----------------------------------------------------------------------------- +function _M.build(parsed) + local ppath = _M.parse_path(parsed.path or "") + local url = _M.build_path(ppath) + if parsed.params then url = url .. ";" .. parsed.params end + if parsed.query then url = url .. "?" .. parsed.query end + local authority = parsed.authority + if parsed.host then + authority = parsed.host + if string.find(authority, ":") then -- IPv6? + authority = "[" .. authority .. "]" + end + if parsed.port then authority = authority .. ":" .. parsed.port end + local userinfo = parsed.userinfo + if parsed.user then + userinfo = parsed.user + if parsed.password then + userinfo = userinfo .. ":" .. parsed.password + end + end + if userinfo then authority = userinfo .. "@" .. authority end + end + if authority then url = "//" .. authority .. url end + if parsed.scheme then url = parsed.scheme .. ":" .. url end + if parsed.fragment then url = url .. "#" .. parsed.fragment end + -- url = string.gsub(url, "%s", "") + return url +end + +----------------------------------------------------------------------------- +-- Builds a absolute URL from a base and a relative URL according to RFC 2396 +-- Input +-- base_url +-- relative_url +-- Returns +-- corresponding absolute url +----------------------------------------------------------------------------- +function _M.absolute(base_url, relative_url) + local base_parsed + if base.type(base_url) == "table" then + base_parsed = base_url + base_url = _M.build(base_parsed) + else + base_parsed = _M.parse(base_url) + end + local relative_parsed = _M.parse(relative_url) + if not base_parsed then return relative_url + elseif not relative_parsed then return base_url + elseif relative_parsed.scheme then return relative_url + else + relative_parsed.scheme = base_parsed.scheme + if not relative_parsed.authority then + relative_parsed.authority = base_parsed.authority + if not relative_parsed.path then + relative_parsed.path = base_parsed.path + if not relative_parsed.params then + relative_parsed.params = base_parsed.params + if not relative_parsed.query then + relative_parsed.query = base_parsed.query + end + end + else + relative_parsed.path = absolute_path(base_parsed.path or "", + relative_parsed.path) + end + end + return _M.build(relative_parsed) + end +end + +----------------------------------------------------------------------------- +-- Breaks a path into its segments, unescaping the segments +-- Input +-- path +-- Returns +-- segment: a table with one entry per segment +----------------------------------------------------------------------------- +function _M.parse_path(path) + local parsed = {} + path = path or "" + --path = string.gsub(path, "%s", "") + string.gsub(path, "([^/]+)", function (s) table.insert(parsed, s) end) + for i = 1, #parsed do + parsed[i] = _M.unescape(parsed[i]) + end + if string.sub(path, 1, 1) == "/" then parsed.is_absolute = 1 end + if string.sub(path, -1, -1) == "/" then parsed.is_directory = 1 end + return parsed +end + +----------------------------------------------------------------------------- +-- Builds a path component from its segments, escaping protected characters. +-- Input +-- parsed: path segments +-- unsafe: if true, segments are not protected before path is built +-- Returns +-- path: corresponding path stringing +----------------------------------------------------------------------------- +function _M.build_path(parsed, unsafe) + local path = "" + local n = #parsed + if unsafe then + for i = 1, n-1 do + path = path .. parsed[i] + path = path .. "/" + end + if n > 0 then + path = path .. parsed[n] + if parsed.is_directory then path = path .. "/" end + end + else + for i = 1, n-1 do + path = path .. protect_segment(parsed[i]) + path = path .. "/" + end + if n > 0 then + path = path .. protect_segment(parsed[n]) + if parsed.is_directory then path = path .. "/" end + end + end + if parsed.is_absolute then path = "/" .. path end + return path +end + +return _M diff --git a/Assets/LuaFramework/ToLua/Lua/socket/url.lua.meta b/Assets/LuaFramework/ToLua/Lua/socket/url.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..66a98912bf5f50ffb0067ea76167740235a92fa6 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/socket/url.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: f52d8d21085d51c42b5e27aca557bcd9 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/tolua.lua b/Assets/LuaFramework/ToLua/Lua/tolua.lua new file mode 100644 index 0000000000000000000000000000000000000000..8fac8bdba79b223b86d56532d7012f819489c6b9 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/tolua.lua @@ -0,0 +1,45 @@ +-------------------------------------------------------------------------------- +-- Copyright (c) 2015 - 2016 , 钂欏崰蹇(topameng) topameng@gmail.com +-- All rights reserved. +-- Use, modification and distribution are subject to the "MIT License" +-------------------------------------------------------------------------------- +if jit then + if jit.opt then + jit.opt.start(3) + end + + print("ver"..jit.version_num.." jit: ", jit.status()) + print(string.format("os: %s, arch: %s", jit.os, jit.arch)) +end + +if DebugServerIp then + require("mobdebug").start(DebugServerIp) +end + +require "misc.functions" +Mathf = require "UnityEngine.Mathf" +Vector3 = require "UnityEngine.Vector3" +Quaternion = require "UnityEngine.Quaternion" +Vector2 = require "UnityEngine.Vector2" +Vector4 = require "UnityEngine.Vector4" +Color = require "UnityEngine.Color" +Ray = require "UnityEngine.Ray" +Bounds = require "UnityEngine.Bounds" +RaycastHit = require "UnityEngine.RaycastHit" +Touch = require "UnityEngine.Touch" +LayerMask = require "UnityEngine.LayerMask" +Plane = require "UnityEngine.Plane" +Time = reimport "UnityEngine.Time" + +list = require "list" +utf8 = require "misc.utf8" + +require "event" +require "typeof" +require "slot" +require "System.Timer" +require "System.coroutine" +require "System.ValueType" +require "System.Reflection.BindingFlags" + +--require "misc.strict" \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Lua/tolua.lua.meta b/Assets/LuaFramework/ToLua/Lua/tolua.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..5806dbd055a6949919d7ade9ffc542553e5c5f40 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/tolua.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 2dab8762e884a1c469dd11f6d2044a0f +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Lua/typeof.lua b/Assets/LuaFramework/ToLua/Lua/typeof.lua new file mode 100644 index 0000000000000000000000000000000000000000..42c8cd37f46427e23c31bad40f012353a8c4c193 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/typeof.lua @@ -0,0 +1,34 @@ +-------------------------------------------------------------------------------- +-- Copyright (c) 2015 - 2016 , 钂欏崰蹇(topameng) topameng@gmail.com +-- All rights reserved. +-- Use, modification and distribution are subject to the "MIT License" +-------------------------------------------------------------------------------- +local type = type +local types = {} +local _typeof = tolua.typeof +local _findtype = tolua.findtype + +function typeof(obj) + local t = type(obj) + local ret = nil + + if t == "table" then + ret = types[obj] + + if ret == nil then + ret = _typeof(obj) + types[obj] = ret + end + elseif t == "string" then + ret = types[obj] + + if ret == nil then + ret = _findtype(obj) + types[obj] = ret + end + else + error(debug.traceback("attemp to call typeof on type "..t)) + end + + return ret +end \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/Lua/typeof.lua.meta b/Assets/LuaFramework/ToLua/Lua/typeof.lua.meta new file mode 100644 index 0000000000000000000000000000000000000000..462ffb7a349237ccb42e1a5235978d1ba5c80b66 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Lua/typeof.lua.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: a7edd4f2975d3f54f8396b61d8b34944 +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Misc.meta b/Assets/LuaFramework/ToLua/Misc.meta new file mode 100644 index 0000000000000000000000000000000000000000..bf96cbbb3ff0afab6b0c849578e31c2cdcf94e07 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Misc.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 4ec2002202db97649bcdffe1705c0bdc +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Misc/LuaClient.cs b/Assets/LuaFramework/ToLua/Misc/LuaClient.cs new file mode 100644 index 0000000000000000000000000000000000000000..69e70a31ebb91b7f28db75db13559dee351c670c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Misc/LuaClient.cs @@ -0,0 +1,282 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +using UnityEngine; +using System.Collections.Generic; +using LuaInterface; +using System.Collections; +using System.IO; +using System; +#if UNITY_5_4_OR_NEWER +using UnityEngine.SceneManagement; +#endif + +public class LuaClient : MonoBehaviour +{ + public static LuaClient Instance + { + get; + protected set; + } + + protected LuaState luaState = null; + protected LuaLooper loop = null; + protected LuaFunction levelLoaded = null; + + protected bool openLuaSocket = false; + protected bool beZbStart = false; + + protected virtual LuaFileUtils InitLoader() + { + return LuaFileUtils.Instance; + } + + protected virtual void LoadLuaFiles() + { + OnLoadFinished(); + } + + protected virtual void OpenLibs() + { + luaState.OpenLibs(LuaDLL.luaopen_pb); + luaState.OpenLibs(LuaDLL.luaopen_struct); + luaState.OpenLibs(LuaDLL.luaopen_lpeg); +#if UNITY_STANDALONE_OSX || UNITY_EDITOR_OSX + luaState.OpenLibs(LuaDLL.luaopen_bit); +#endif + + if (LuaConst.openLuaSocket) + { + OpenLuaSocket(); + } + + if (LuaConst.openLuaDebugger) + { + OpenZbsDebugger(); + } + } + + public void OpenZbsDebugger(string ip = "localhost") + { + if (!Directory.Exists(LuaConst.zbsDir)) + { + Debugger.LogWarning("ZeroBraneStudio not install or LuaConst.zbsDir not right"); + return; + } + + if (!LuaConst.openLuaSocket) + { + OpenLuaSocket(); + } + + if (!string.IsNullOrEmpty(LuaConst.zbsDir)) + { + luaState.AddSearchPath(LuaConst.zbsDir); + } + + luaState.LuaDoString(string.Format("DebugServerIp = '{0}'", ip), "@LuaClient.cs"); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LuaOpen_Socket_Core(IntPtr L) + { + return LuaDLL.luaopen_socket_core(L); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LuaOpen_Mime_Core(IntPtr L) + { + return LuaDLL.luaopen_mime_core(L); + } + + protected void OpenLuaSocket() + { + LuaConst.openLuaSocket = true; + + luaState.BeginPreLoad(); + luaState.RegFunction("socket.core", LuaOpen_Socket_Core); + luaState.RegFunction("mime.core", LuaOpen_Mime_Core); + luaState.EndPreLoad(); + } + + //cjson 姣旇緝鐗规畩锛屽彧new浜嗕竴涓猼able锛屾病鏈夋敞鍐屽簱锛岃繖閲屾敞鍐屼竴涓 + protected void OpenCJson() + { + luaState.LuaGetField(LuaIndexes.LUA_REGISTRYINDEX, "_LOADED"); + luaState.OpenLibs(LuaDLL.luaopen_cjson); + luaState.LuaSetField(-2, "cjson"); + + luaState.OpenLibs(LuaDLL.luaopen_cjson_safe); + luaState.LuaSetField(-2, "cjson.safe"); + } + + protected virtual void CallMain() + { + LuaFunction main = luaState.GetFunction("Main"); + main.Call(); + main.Dispose(); + main = null; + } + + protected virtual void StartMain() + { + luaState.DoFile("Main.lua"); + levelLoaded = luaState.GetFunction("OnLevelWasLoaded"); + CallMain(); + } + + protected void StartLooper() + { + loop = gameObject.AddComponent(); + loop.luaState = luaState; + } + + protected virtual void Bind() + { + LuaBinder.Bind(luaState); + DelegateFactory.Init(); + LuaCoroutine.Register(luaState, this); + } + + protected void Init() + { + InitLoader(); + luaState = new LuaState(); + OpenLibs(); + luaState.LuaSetTop(0); + Bind(); + LoadLuaFiles(); + } + + protected void Awake() + { + Instance = this; + Init(); + +#if UNITY_5_4_OR_NEWER + SceneManager.sceneLoaded += OnSceneLoaded; +#endif + } + + protected virtual void OnLoadFinished() + { + luaState.Start(); + StartLooper(); + StartMain(); + } + + void OnLevelLoaded(int level) + { + if (levelLoaded != null) + { + levelLoaded.BeginPCall(); + levelLoaded.Push(level); + levelLoaded.PCall(); + levelLoaded.EndPCall(); + } + + if (luaState != null) + { + luaState.RefreshDelegateMap(); + } + } + +#if UNITY_5_4_OR_NEWER + void OnSceneLoaded(Scene scene, LoadSceneMode mode) + { + OnLevelLoaded(scene.buildIndex); + } +#else + protected void OnLevelWasLoaded(int level) + { + OnLevelLoaded(level); + } +#endif + + public virtual void Destroy() + { + if (luaState != null) + { +#if UNITY_5_4_OR_NEWER + SceneManager.sceneLoaded -= OnSceneLoaded; +#endif + luaState.Call("OnApplicationQuit", false); + DetachProfiler(); + LuaState state = luaState; + luaState = null; + + if (levelLoaded != null) + { + levelLoaded.Dispose(); + levelLoaded = null; + } + + if (loop != null) + { + loop.Destroy(); + loop = null; + } + + state.Dispose(); + Instance = null; + } + } + + protected void OnDestroy() + { + Destroy(); + } + + protected void OnApplicationQuit() + { + Destroy(); + } + + public static LuaState GetMainState() + { + return Instance.luaState; + } + + public LuaLooper GetLooper() + { + return loop; + } + + LuaTable profiler = null; + + public void AttachProfiler() + { + if (profiler == null) + { + profiler = luaState.Require("UnityEngine.Profiler"); + profiler.Call("start", profiler); + } + } + public void DetachProfiler() + { + if (profiler != null) + { + profiler.Call("stop", profiler); + profiler.Dispose(); + LuaProfiler.Clear(); + } + } +} diff --git a/Assets/LuaFramework/ToLua/Misc/LuaClient.cs.meta b/Assets/LuaFramework/ToLua/Misc/LuaClient.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..30be391e38e0beb1f2a999e636bb2564918cc809 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Misc/LuaClient.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3d41d4486c02e3e4ca1c1f12f7a48a95 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Misc/LuaCoroutine.cs b/Assets/LuaFramework/ToLua/Misc/LuaCoroutine.cs new file mode 100644 index 0000000000000000000000000000000000000000..98fa20c5ab94d4368388a9a534ea0285108b41bb --- /dev/null +++ b/Assets/LuaFramework/ToLua/Misc/LuaCoroutine.cs @@ -0,0 +1,290 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +using UnityEngine; +using LuaInterface; +using System; +using System.Collections; + +public static class LuaCoroutine +{ + private static MonoBehaviour mb = null; + private static string strCo = + @" + local _WaitForSeconds, _WaitForFixedUpdate, _WaitForEndOfFrame, _Yield, _StopCoroutine = WaitForSeconds, WaitForFixedUpdate, WaitForEndOfFrame, Yield, StopCoroutine + local error = error + local debug = debug + local coroutine = coroutine + local comap = {} + setmetatable(comap, {__mode = 'k'}) + + function _resume(co) + if comap[co] then + comap[co] = nil + local flag, msg = coroutine.resume(co) + + if not flag then + msg = debug.traceback(co, msg) + error(msg) + end + end + end + + function WaitForSeconds(t) + local co = coroutine.running() + local resume = function() + _resume(co) + end + + comap[co] = _WaitForSeconds(t, resume) + return coroutine.yield() + end + + function WaitForFixedUpdate() + local co = coroutine.running() + local resume = function() + _resume(co) + end + + comap[co] = _WaitForFixedUpdate(resume) + return coroutine.yield() + end + + function WaitForEndOfFrame() + local co = coroutine.running() + local resume = function() + _resume(co) + end + + comap[co] = _WaitForEndOfFrame(resume) + return coroutine.yield() + end + + function Yield(o) + local co = coroutine.running() + local resume = function() + _resume(co) + end + + comap[co] = _Yield(o, resume) + return coroutine.yield() + end + + function StartCoroutine(func) + local co = coroutine.create(func) + local flag, msg = coroutine.resume(co) + + if not flag then + msg = debug.traceback(co, msg) + error(msg) + end + + return co + end + + function StopCoroutine(co) + local _co = comap[co] + + if _co == nil then + return + end + + comap[co] = nil + _StopCoroutine(_co) + end + "; + + public static void Register(LuaState state, MonoBehaviour behaviour) + { + state.BeginModule(null); + state.RegFunction("WaitForSeconds", _WaitForSeconds); + state.RegFunction("WaitForFixedUpdate", WaitForFixedUpdate); + state.RegFunction("WaitForEndOfFrame", WaitForEndOfFrame); + state.RegFunction("Yield", Yield); + state.RegFunction("StopCoroutine", StopCoroutine); + state.RegFunction("WrapLuaCoroutine", WrapLuaCoroutine); + state.EndModule(); + + state.LuaDoString(strCo, "LuaCoroutine.cs"); + mb = behaviour; + } + + //鍙︿竴绉嶆柟寮忥紝闈炶剼鏈洖璋冩柟寮(鐢ㄨ剼鏈柟寮忔洿濂斤紝鍙伩鍏峫ua_yield寮傚父鍑虹幇鍦╟#鍑芥暟涓) + /*[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int WaitForSeconds(IntPtr L) + { + try + { + LuaState state = LuaState.Get(L); + LuaDLL.lua_pushthread(L); + LuaThread thread = ToLua.ToLuaThread(L, -1); + float sec = (float)LuaDLL.luaL_checknumber(L, 1); + mb.StartCoroutine(CoWaitForSeconds(sec, thread)); + return LuaDLL.lua_yield(L, 0); + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + static IEnumerator CoWaitForSeconds(float sec, LuaThread thread) + { + yield return new WaitForSeconds(sec); + thread.Resume(); + }*/ + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + private static int _WaitForSeconds(IntPtr L) + { + try + { + float sec = (float)LuaDLL.luaL_checknumber(L, 1); + LuaFunction func = ToLua.ToLuaFunction(L, 2); + Coroutine co = mb.StartCoroutine(CoWaitForSeconds(sec, func)); + ToLua.PushSealed(L, co); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + private static IEnumerator CoWaitForSeconds(float sec, LuaFunction func) + { + yield return new WaitForSeconds(sec); + func.Call(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + private static int WaitForFixedUpdate(IntPtr L) + { + try + { + LuaFunction func = ToLua.ToLuaFunction(L, 1); + Coroutine co = mb.StartCoroutine(CoWaitForFixedUpdate(func)); + ToLua.PushSealed(L, co); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + private static IEnumerator CoWaitForFixedUpdate(LuaFunction func) + { + yield return new WaitForFixedUpdate(); + func.Call(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + private static int WaitForEndOfFrame(IntPtr L) + { + try + { + LuaFunction func = ToLua.ToLuaFunction(L, 1); + Coroutine co = mb.StartCoroutine(CoWaitForEndOfFrame(func)); + ToLua.PushSealed(L, co); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + private static IEnumerator CoWaitForEndOfFrame(LuaFunction func) + { + yield return new WaitForEndOfFrame(); + func.Call(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + private static int Yield(IntPtr L) + { + try + { + object o = ToLua.ToVarObject(L, 1); + LuaFunction func = ToLua.ToLuaFunction(L, 2); + Coroutine co = mb.StartCoroutine(CoYield(o, func)); + ToLua.PushSealed(L, co); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + private static IEnumerator CoYield(object o, LuaFunction func) + { + if (o is IEnumerator) + { + yield return mb.StartCoroutine((IEnumerator)o); + } + else + { + yield return o; + } + + func.Call(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + private static int StopCoroutine(IntPtr L) + { + try + { + Coroutine co = (Coroutine)ToLua.CheckObject(L, 1, typeof(Coroutine)); + mb.StopCoroutine(co); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + private static int WrapLuaCoroutine(IntPtr L) + { + LuaFunction func = ToLua.ToLuaFunction(L, 1); + IEnumerator enumerator = CoWrap(func); + ToLua.Push(L, enumerator); + return 1; + } + + private static IEnumerator CoWrap(LuaFunction func) + { + if (func == null) + { + yield break; + } + + while (func.Invoke()) + { + yield return null; + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Misc/LuaCoroutine.cs.meta b/Assets/LuaFramework/ToLua/Misc/LuaCoroutine.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..5c9803496ad17e462eb6b9faef05bb6fa87be211 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Misc/LuaCoroutine.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 61c0f3aff91dfbd4097181bfb8c99d7f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Misc/LuaLooper.cs b/Assets/LuaFramework/ToLua/Misc/LuaLooper.cs new file mode 100644 index 0000000000000000000000000000000000000000..df818c9b323fb0235e6169fcaa200f3fb6090d58 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Misc/LuaLooper.cs @@ -0,0 +1,170 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +using System; +using UnityEngine; +using LuaInterface; + +public class LuaLooper : MonoBehaviour +{ + public LuaBeatEvent UpdateEvent + { + get; + private set; + } + + public LuaBeatEvent LateUpdateEvent + { + get; + private set; + } + + public LuaBeatEvent FixedUpdateEvent + { + get; + private set; + } + + public LuaState luaState = null; + + void Start() + { + try + { + UpdateEvent = GetEvent("UpdateBeat"); + LateUpdateEvent = GetEvent("LateUpdateBeat"); + FixedUpdateEvent = GetEvent("FixedUpdateBeat"); + } + catch (Exception e) + { + Destroy(this); + throw e; + } + } + + LuaBeatEvent GetEvent(string name) + { + LuaTable table = luaState.GetTable(name); + + if (table == null) + { + throw new LuaException(string.Format("Lua table {0} not exists", name)); + } + + LuaBeatEvent e = new LuaBeatEvent(table); + table.Dispose(); + table = null; + return e; + } + + void ThrowException() + { + string error = luaState.LuaToString(-1); + luaState.LuaPop(2); + throw new LuaException(error, LuaException.GetLastError()); + } + + void Update() + { +#if UNITY_EDITOR + if (luaState == null) + { + return; + } +#endif + if (luaState.LuaUpdate(Time.deltaTime, Time.unscaledDeltaTime) != 0) + { + ThrowException(); + } + + luaState.LuaPop(1); + luaState.Collect(); +#if UNITY_EDITOR + luaState.CheckTop(); +#endif + } + + void LateUpdate() + { +#if UNITY_EDITOR + if (luaState == null) + { + return; + } +#endif + if (luaState.LuaLateUpdate() != 0) + { + ThrowException(); + } + + luaState.LuaPop(1); + } + + void FixedUpdate() + { +#if UNITY_EDITOR + if (luaState == null) + { + return; + } +#endif + if (luaState.LuaFixedUpdate(Time.fixedDeltaTime) != 0) + { + ThrowException(); + } + + luaState.LuaPop(1); + } + + public void Destroy() + { + if (luaState != null) + { + if (UpdateEvent != null) + { + UpdateEvent.Dispose(); + UpdateEvent = null; + } + + if (LateUpdateEvent != null) + { + LateUpdateEvent.Dispose(); + LateUpdateEvent = null; + } + + if (FixedUpdateEvent != null) + { + FixedUpdateEvent.Dispose(); + FixedUpdateEvent = null; + } + + luaState = null; + } + } + + void OnDestroy() + { + if (luaState != null) + { + Destroy(); + } + } +} diff --git a/Assets/LuaFramework/ToLua/Misc/LuaLooper.cs.meta b/Assets/LuaFramework/ToLua/Misc/LuaLooper.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..0b1edc22cf4e8954928f414619c1bd8f78a6467c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Misc/LuaLooper.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d56dbfed903b80e498bb872845c17e7e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: -10 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Misc/LuaProfiler.cs b/Assets/LuaFramework/ToLua/Misc/LuaProfiler.cs new file mode 100644 index 0000000000000000000000000000000000000000..dc38eb4691bb8144cc3ddd920d1c0168093115f0 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Misc/LuaProfiler.cs @@ -0,0 +1,33 @@ +锘縰sing System.Collections.Generic; + +#if UNITY_5_5_OR_NEWER +using UnityEngine.Profiling; +#endif + +public static class LuaProfiler +{ + public static List list = new List(); + + public static void Clear() + { + list.Clear(); + } + + public static int GetID(string name) + { + int id = list.Count; + list.Add(name); + return id; + } + + public static void BeginSample(int id) + { + string name = list[id]; + Profiler.BeginSample(name); + } + + public static void EndSample() + { + Profiler.EndSample(); + } +} diff --git a/Assets/LuaFramework/ToLua/Misc/LuaProfiler.cs.meta b/Assets/LuaFramework/ToLua/Misc/LuaProfiler.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..9dc14de4a0ce950463c9162211148014a3881470 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Misc/LuaProfiler.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 29c635f2321c2dc48aea28e8e6accb7e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Misc/LuaResLoader.cs b/Assets/LuaFramework/ToLua/Misc/LuaResLoader.cs new file mode 100644 index 0000000000000000000000000000000000000000..b88e3001b55d8646a92715f596cfb7df2ed746b2 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Misc/LuaResLoader.cs @@ -0,0 +1,143 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +//浼樺厛璇诲彇persistentDataPath/绯荤粺/Lua 鐩綍涓嬬殑鏂囦欢锛堥粯璁や笅杞界洰褰曪級 +//鏈壘鍒版枃浠舵庤鍙 Resources/Lua 鐩綍涓嬫枃浠讹紙浠嶆病鏈変娇鐢↙uaFileUtil璇诲彇锛 +using UnityEngine; +using LuaInterface; +using System.IO; +using System.Text; + +public class LuaResLoader : LuaFileUtils +{ + public LuaResLoader() + { + instance = this; + beZip = false; + } + + public override byte[] ReadFile(string fileName) + { +#if !UNITY_EDITOR + byte[] buffer = ReadDownLoadFile(fileName); + + if (buffer == null) + { + buffer = ReadResourceFile(fileName); + } + + if (buffer == null) + { + buffer = base.ReadFile(fileName); + } +#else + byte[] buffer = base.ReadFile(fileName); + + if (buffer == null) + { + buffer = ReadResourceFile(fileName); + } + + if (buffer == null) + { + buffer = ReadDownLoadFile(fileName); + } +#endif + + return buffer; + } + + public override string FindFileError(string fileName) + { + if (Path.IsPathRooted(fileName)) + { + return fileName; + } + + if (Path.GetExtension(fileName) == ".lua") + { + fileName = fileName.Substring(0, fileName.Length - 4); + } + + using (CString.Block()) + { + CString sb = CString.Alloc(512); + + for (int i = 0; i < searchPaths.Count; i++) + { + sb.Append("\n\tno file '").Append(searchPaths[i]).Append('\''); + } + + sb.Append("\n\tno file './Resources/").Append(fileName).Append(".lua'") + .Append("\n\tno file '").Append(LuaConst.luaResDir).Append('/') + .Append(fileName).Append(".lua'"); + sb = sb.Replace("?", fileName); + + return sb.ToString(); + } + } + + byte[] ReadResourceFile(string fileName) + { + if (!fileName.EndsWith(".lua")) + { + fileName += ".lua"; + } + + byte[] buffer = null; + string path = "Lua/" + fileName; + TextAsset text = Resources.Load(path, typeof(TextAsset)) as TextAsset; + + if (text != null) + { + buffer = text.bytes; + Resources.UnloadAsset(text); + } + + return buffer; + } + + byte[] ReadDownLoadFile(string fileName) + { + if (!fileName.EndsWith(".lua")) + { + fileName += ".lua"; + } + + string path = fileName; + + if (!Path.IsPathRooted(fileName)) + { + path = string.Format("{0}/{1}", LuaConst.luaResDir, fileName); + } + + if (File.Exists(path)) + { +#if !UNITY_WEBPLAYER + return File.ReadAllBytes(path); +#else + throw new LuaException("can't run in web platform, please switch to other platform"); +#endif + } + + return null; + } +} diff --git a/Assets/LuaFramework/ToLua/Misc/LuaResLoader.cs.meta b/Assets/LuaFramework/ToLua/Misc/LuaResLoader.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..d87f78075dbbefc9311734f694d24359e87b6560 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Misc/LuaResLoader.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 61b6ccc77a2cfc341963b08eb6cb4dfc +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Reflection.meta b/Assets/LuaFramework/ToLua/Reflection.meta new file mode 100644 index 0000000000000000000000000000000000000000..314e0e808456f8318063b030f698a21f0d47ca79 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Reflection.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 674faa7cf920bda4d9b25ac74cdeb979 +folderAsset: yes +timeCreated: 1462550855 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Reflection/LuaConstructor.cs b/Assets/LuaFramework/ToLua/Reflection/LuaConstructor.cs new file mode 100644 index 0000000000000000000000000000000000000000..e43c728c9c92db4270300a42052b8fb3d364c9c2 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Reflection/LuaConstructor.cs @@ -0,0 +1,85 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Reflection; + +namespace LuaInterface +{ + public sealed class LuaConstructor + { + ConstructorInfo method = null; + List list = null; + + [NoToLuaAttribute] + public LuaConstructor(ConstructorInfo func, Type[] types) + { + method = func; + + if (types != null) + { + list = new List(types); + } + } + + public int Call(IntPtr L) + { + object[] args = null; + ToLua.CheckArgsCount(L, list.Count + 1); + + if (list.Count > 0) + { + args = new object[list.Count]; + + for (int i = 0; i < list.Count; i++) + { + bool isRef = list[i].IsByRef; + Type t0 = isRef ? list[i].GetElementType() : list[i]; + object o = ToLua.CheckVarObject(L, i + 2, t0); + args[i] = o; + } + } + + object ret = method.Invoke(args); + int count = 1; + ToLua.Push(L, ret); + + for (int i = 0; i < list.Count; i++) + { + if (list[i].IsByRef) + { + ++count; + ToLua.Push(L, args[i]); + } + } + + return count; + } + + public void Destroy() + { + method = null; + list.Clear(); + } + } +} diff --git a/Assets/LuaFramework/ToLua/Reflection/LuaConstructor.cs.meta b/Assets/LuaFramework/ToLua/Reflection/LuaConstructor.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..732483d851b95aa094cc63ee611617924b14343a --- /dev/null +++ b/Assets/LuaFramework/ToLua/Reflection/LuaConstructor.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5f277531b56c0944fb5d9af67defed02 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Reflection/LuaField.cs b/Assets/LuaFramework/ToLua/Reflection/LuaField.cs new file mode 100644 index 0000000000000000000000000000000000000000..dcb56290748555393b47420ffc84bf8acb694332 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Reflection/LuaField.cs @@ -0,0 +1,111 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +using System; +using System.Globalization; +using System.Reflection; + +namespace LuaInterface +{ + //浠h〃涓涓弽灏勫睘鎬 + public sealed class LuaField + { + FieldInfo field = null; + Type kclass = null; + + [NoToLuaAttribute] + public LuaField(FieldInfo info, Type t) + { + field = info; + kclass = t; + } + + public int Get(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + object arg0 = ToLua.CheckObject(L, 2, kclass); + object o = field.GetValue(arg0); + + if (o == null) + { + if (typeof(System.MulticastDelegate).IsAssignableFrom(field.FieldType)) + { + o = DelegateFactory.CreateDelegate(field.FieldType, null); + ToLua.Push(L, (Delegate)o); + } + else + { + LuaDLL.lua_pushnil(L); + } + } + else + { + ToLua.Push(L, o); + } + + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + public int Set(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3) + { + object arg0 = ToLua.CheckVarObject(L, 2, kclass); + object arg1 = ToLua.ToVarObject(L, 3); + if (arg1 != null) arg1 = TypeChecker.ChangeType(arg1, field.FieldType); + field.SetValue(arg0, arg1); + return 0; + } + else if (count == 6) + { + object arg0 = ToLua.CheckVarObject(L, 2, kclass); + object arg1 = ToLua.ToVarObject(L, 3); + if (arg1 != null) arg1 = TypeChecker.ChangeType(arg1, field.FieldType); + BindingFlags arg2 = (BindingFlags)LuaDLL.luaL_checknumber(L, 4); + Binder arg3 = (Binder)ToLua.CheckObject(L, 5, typeof(Binder)); + CultureInfo arg4 = (CultureInfo)ToLua.CheckObject(L, 6, typeof(CultureInfo)); + field.SetValue(arg0, arg1, arg2, arg3, arg4); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: LuaField.Set"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + } +} diff --git a/Assets/LuaFramework/ToLua/Reflection/LuaField.cs.meta b/Assets/LuaFramework/ToLua/Reflection/LuaField.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..186da6c7e6f247f88e8feffd181cc221b3d91e6a --- /dev/null +++ b/Assets/LuaFramework/ToLua/Reflection/LuaField.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ac0dd1f9fec2afa4e96fc2f583688c5a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Reflection/LuaMethod.cs b/Assets/LuaFramework/ToLua/Reflection/LuaMethod.cs new file mode 100644 index 0000000000000000000000000000000000000000..dbe8ade99fdb460079658d51e19883030c424693 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Reflection/LuaMethod.cs @@ -0,0 +1,102 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +using System; +using System.Collections.Generic; +using System.Reflection; + +namespace LuaInterface +{ + //浠h〃涓涓弽灏勫嚱鏁 + public sealed class LuaMethod + { + MethodInfo method = null; + List list = new List(); + Type kclass = null; + + [NoToLuaAttribute] + public LuaMethod(MethodInfo md, Type t, Type[] types) + { + method = md; + kclass = t; + + if (types != null) + { + list.AddRange(types); + } + } + + public int Call(IntPtr L) + { + object[] args = null; + object obj = null; + int offset = 1; + + if (!method.IsStatic) + { + offset += 1; + obj = ToLua.CheckObject(L, 2, kclass); + } + + ToLua.CheckArgsCount(L, list.Count + offset); + + if (list.Count > 0) + { + args = new object[list.Count]; + offset += 1; + + for (int i = 0; i < list.Count; i++) + { + bool isRef = list[i].IsByRef; + Type t0 = isRef ? list[i].GetElementType() : list[i]; + object o = ToLua.CheckVarObject(L, i + offset, t0); + args[i] = o; + } + } + + object ret = method.Invoke(obj, args); + int count = 0; + + if (method.ReturnType != typeof(void)) + { + ++count; + ToLua.Push(L, ret); + } + + for (int i = 0; i < list.Count; i++) + { + if (list[i].IsByRef) + { + ++count; + ToLua.Push(L, args[i]); + } + } + + return count; + } + + public void Destroy() + { + method = null; + list.Clear(); + } + } +} diff --git a/Assets/LuaFramework/ToLua/Reflection/LuaMethod.cs.meta b/Assets/LuaFramework/ToLua/Reflection/LuaMethod.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..2b89c2f03b39434e14c9c39546990be0aff1229c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Reflection/LuaMethod.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e50f0b4cc54866649975adb5d9801a3d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Reflection/LuaProperty.cs b/Assets/LuaFramework/ToLua/Reflection/LuaProperty.cs new file mode 100644 index 0000000000000000000000000000000000000000..49149e4cf9a495c71261a05f9ddbaa981e1f29cc --- /dev/null +++ b/Assets/LuaFramework/ToLua/Reflection/LuaProperty.cs @@ -0,0 +1,101 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +using System; +using System.Globalization; +using System.Reflection; + +namespace LuaInterface +{ + //浠h〃涓涓弽灏勫睘鎬 + public sealed class LuaProperty + { + PropertyInfo property = null; + Type kclass = null; + + [NoToLuaAttribute] + public LuaProperty(PropertyInfo prop, Type t) + { + property = prop; + kclass = t; + } + + public int Get(IntPtr L) + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3) + { + object arg0 = ToLua.CheckVarObject(L, 2, kclass); + object[] arg1 = ToLua.CheckObjectArray(L, 3); + object o = property.GetValue(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else if (count == 6) + { + object arg0 = ToLua.CheckVarObject(L, 2, kclass); + BindingFlags arg1 = (BindingFlags)LuaDLL.luaL_checknumber(L, 3); + Binder arg2 = (Binder)ToLua.CheckObject(L, 4, typeof(Binder)); + object[] arg3 = ToLua.CheckObjectArray(L, 5); + CultureInfo arg4 = (CultureInfo)ToLua.CheckObject(L, 6, typeof(CultureInfo)); + object o = property.GetValue(arg0, arg1, arg2, arg3, arg4); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: LuaInterface.LuaProperty.Get"); + } + } + + public int Set(IntPtr L) + { + int count = LuaDLL.lua_gettop(L); + + if (count == 4) + { + object arg0 = ToLua.CheckVarObject(L, 2, kclass); + object arg1 = ToLua.ToVarObject(L, 3); + if (arg1 != null) arg1 = TypeChecker.ChangeType(arg1, property.PropertyType); + object[] arg2 = ToLua.CheckObjectArray(L, 4); + property.SetValue(arg0, arg1, arg2); + return 0; + } + else if (count == 7) + { + object arg0 = ToLua.CheckVarObject(L, 2, kclass); + object arg1 = ToLua.ToVarObject(L, 3); + if (arg1 != null) arg1 = TypeChecker.ChangeType(arg1, property.PropertyType); + BindingFlags arg2 = (BindingFlags)LuaDLL.luaL_checknumber(L, 4); + Binder arg3 = (Binder)ToLua.CheckObject(L, 5, typeof(Binder)); + object[] arg4 = ToLua.CheckObjectArray(L, 6); + CultureInfo arg5 = (CultureInfo)ToLua.CheckObject(L, 7, typeof(CultureInfo)); + property.SetValue(arg0, arg1, arg2, arg3, arg4, arg5); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: LuaInterface.LuaProperty.Set"); + } + } + } +} diff --git a/Assets/LuaFramework/ToLua/Reflection/LuaProperty.cs.meta b/Assets/LuaFramework/ToLua/Reflection/LuaProperty.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..cbc60f90100e403ae46e76e0328dd9f1d728c1d1 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Reflection/LuaProperty.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 26952c90fb22bda4dbe945f2fa2224ff +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Reflection/LuaReflection.cs b/Assets/LuaFramework/ToLua/Reflection/LuaReflection.cs new file mode 100644 index 0000000000000000000000000000000000000000..51554ae19ce9d27a55dfbef2c67ca5722bec1ba1 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Reflection/LuaReflection.cs @@ -0,0 +1,554 @@ +锘/* +Copyright (c) 2015-2017 topameng(topameng@qq.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +using System; +using System.Collections.Generic; +using System.Reflection; + +namespace LuaInterface +{ + public class LuaReflection : IDisposable + { + public List list = new List(); +#if !MULTI_STATE + private static LuaReflection _reflection = null; +#endif + + public LuaReflection() + { +#if !MULTI_STATE + _reflection = this; +#endif + LoadAssembly("mscorlib"); + LoadAssembly("UnityEngine"); + //娉ㄩ噴閬垮厤鏀惧湪鎻掍欢鐩綍鏃犳硶鍔犺浇锛岄渶瑕佸彲浠巐ua浠g爜loadassembly + //LoadAssembly("Assembly-CSharp"); + } + + public static void OpenLibs(IntPtr L) + { + LuaDLL.lua_getglobal(L, "tolua"); + + LuaDLL.lua_pushstring(L, "findtype"); + LuaDLL.lua_pushcfunction(L, FindType); + LuaDLL.lua_rawset(L, -3); + + LuaDLL.lua_pushstring(L, "loadassembly"); + LuaDLL.tolua_pushcfunction(L, LoadAssembly); + LuaDLL.lua_rawset(L, -3); + + LuaDLL.lua_pushstring(L, "getmethod"); + LuaDLL.tolua_pushcfunction(L, GetMethod); + LuaDLL.lua_rawset(L, -3); + + LuaDLL.lua_pushstring(L, "getconstructor"); + LuaDLL.tolua_pushcfunction(L, GetConstructor); + LuaDLL.lua_rawset(L, -3); + + LuaDLL.lua_pushstring(L, "gettypemethod"); + LuaDLL.tolua_pushcfunction(L, GetTypeMethod); + LuaDLL.lua_rawset(L, -3); + + LuaDLL.lua_pushstring(L, "getfield"); + LuaDLL.tolua_pushcfunction(L, GetField); + LuaDLL.lua_rawset(L, -3); + + LuaDLL.lua_pushstring(L, "getproperty"); + LuaDLL.tolua_pushcfunction(L, GetProperty); + LuaDLL.lua_rawset(L, -3); + + LuaDLL.lua_pushstring(L, "createinstance"); + LuaDLL.tolua_pushcfunction(L, CreateInstance); + LuaDLL.lua_rawset(L, -3); + + LuaDLL.lua_pop(L, 1); + + LuaState state = LuaState.Get(L); + state.BeginPreLoad(); + state.AddPreLoad("tolua.reflection", OpenReflectionLibs); + state.EndPreLoad(); + } + + public static LuaReflection Get(IntPtr L) + { +#if !MULTI_STATE + return _reflection; +#else + return LuaState.GetReflection(L); +#endif + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OpenReflectionLibs(IntPtr L) + { + try + { + LuaState state = LuaState.Get(L); + state.BeginModule(null); + state.BeginModule("LuaInterface"); + LuaInterface_LuaMethodWrap.Register(state); + LuaInterface_LuaPropertyWrap.Register(state); + LuaInterface_LuaFieldWrap.Register(state); + LuaInterface_LuaConstructorWrap.Register(state); + state.EndModule(); + state.EndModule(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int FindType(IntPtr L) + { + string name = ToLua.CheckString(L, 1); + LuaReflection reflection = LuaReflection.Get(L); + List list = reflection.list; + Type t = null; + + for (int i = 0; i < list.Count; i++) + { + t = list[i].GetType(name); + + if (t != null) + { + break; + } + } + + ToLua.Push(L, t); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LoadAssembly(IntPtr L) + { + try + { + LuaReflection reflection = LuaReflection.Get(L); + string name = ToLua.CheckString(L, 1); + LuaDLL.lua_pushboolean(L, reflection.LoadAssembly(name)); + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + + return 1; + } + + static void PushLuaMethod(IntPtr L, MethodInfo md, Type t, Type[] types) + { + if (md != null) + { + LuaMethod lm = new LuaMethod(md, t, types); + ToLua.PushSealed(L, lm); + } + else + { + LuaDLL.lua_pushnil(L); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetMethod(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + Type t = ToLua.CheckMonoType(L, 1); + string name = ToLua.CheckString(L, 2); + Type[] types = null; + + if (count > 2) + { + types = new Type[count - 2]; + + for (int i = 3; i <= count; i++) + { + Type ti = ToLua.CheckMonoType(L, i); + if (ti == null) LuaDLL.luaL_typerror(L, i, "Type"); + types[i - 3] = ti; + } + } + + MethodInfo md = null; + + if (types == null) + { + md = t.GetMethod(name); + } + else + { + md = t.GetMethod(name, types); + } + + PushLuaMethod(L, md, t, types); + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + + return 1; + } + + static void PushLuaConstructor(IntPtr L, ConstructorInfo func, Type[] types) + { + if (func != null) + { + LuaConstructor lm = new LuaConstructor(func, types); + ToLua.PushSealed(L, lm); + } + else + { + LuaDLL.lua_pushnil(L); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetConstructor(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + Type t = (Type)ToLua.CheckObject(L, 1, typeof(Type)); + Type[] types = null; + + if (count > 1) + { + types = new Type[count - 1]; + + for (int i = 2; i <= count; i++) + { + Type ti = ToLua.CheckMonoType(L, i); + if (ti == null) LuaDLL.luaL_typerror(L, i, "Type"); + types[i - 2] = ti; + } + } + + ConstructorInfo ret = t.GetConstructor(types); + PushLuaConstructor(L, ret, types); + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetTypeMethod(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + Type obj = (Type)ToLua.ToObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + MethodInfo o = obj.GetMethod(arg0); + PushLuaMethod(L, o, obj, null); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + Type obj = (Type)ToLua.ToObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + Type[] arg1 = ToLua.ToObjectArray(L, 3); + MethodInfo o = obj.GetMethod(arg0, arg1); + PushLuaMethod(L, o, obj, arg1); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + Type obj = (Type)ToLua.ToObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + BindingFlags arg1 = (BindingFlags)LuaDLL.lua_tonumber(L, 3); + MethodInfo o = obj.GetMethod(arg0, arg1); + PushLuaMethod(L, o, obj, null); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 1)) + { + Type obj = (Type)ToLua.ToObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + Type[] arg1 = ToLua.ToObjectArray(L, 3); + ParameterModifier[] arg2 = ToLua.ToStructArray(L, 4); + MethodInfo o = obj.GetMethod(arg0, arg1, arg2); + PushLuaMethod(L, o, obj, arg1); + return 1; + } + else if (count == 6 && TypeChecker.CheckTypes (L, 1)) + { + System.Type obj = (System.Type)ToLua.ToObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + BindingFlags arg1 = (BindingFlags)LuaDLL.lua_tonumber(L, 3); + Binder arg2 = (Binder)ToLua.ToObject(L, 4); + Type[] arg3 = ToLua.ToObjectArray(L, 5); + ParameterModifier[] arg4 = ToLua.ToStructArray(L, 6); + MethodInfo o = obj.GetMethod(arg0, arg1, arg2, arg3, arg4); + PushLuaMethod(L, o, obj, arg3); + return 1; + } + else if (count == 7 && TypeChecker.CheckTypes (L, 1)) + { + Type obj = (Type)ToLua.ToObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + BindingFlags arg1 = (BindingFlags)LuaDLL.lua_tonumber(L, 3); + Binder arg2 = (Binder)ToLua.ToObject(L, 4); + CallingConventions arg3 = (CallingConventions)ToLua.ToObject(L, 5); + Type[] arg4 = ToLua.ToObjectArray(L, 6); + ParameterModifier[] arg5 = ToLua.ToStructArray(L, 7); + MethodInfo o = obj.GetMethod(arg0, arg1, arg2, arg3, arg4, arg5); + PushLuaMethod(L, o, obj, arg4); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: tolua.gettypemethod"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + static void PushLuaProperty(IntPtr L, PropertyInfo p, Type t) + { + if (p != null) + { + LuaProperty lp = new LuaProperty(p, t); + ToLua.PushSealed(L, lp); + } + else + { + LuaDLL.lua_pushnil(L); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetProperty(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + Type obj = (Type)ToLua.ToObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + PropertyInfo o = obj.GetProperty(arg0); + PushLuaProperty(L, o, obj); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + Type obj = (Type)ToLua.ToObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + Type[] arg1 = ToLua.ToObjectArray(L, 3); + PropertyInfo o = obj.GetProperty(arg0, arg1); + PushLuaProperty(L, o, obj); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + Type obj = (Type)ToLua.ToObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + Type arg1 = (Type)ToLua.ToObject(L, 3); + PropertyInfo o = obj.GetProperty(arg0, arg1); + PushLuaProperty(L, o, obj); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + Type obj = (Type)ToLua.ToObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + BindingFlags arg1 = (BindingFlags)LuaDLL.lua_tonumber(L, 3); + PropertyInfo o = obj.GetProperty(arg0, arg1); + PushLuaProperty(L, o, obj); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 1)) + { + Type obj = (Type)ToLua.ToObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + Type arg1 = (Type)ToLua.ToObject(L, 3); + Type[] arg2 = ToLua.ToObjectArray(L, 4); + PropertyInfo o = obj.GetProperty(arg0, arg1, arg2); + PushLuaProperty(L, o, obj); + return 1; + } + else if (count == 5 && TypeChecker.CheckTypes (L, 1)) + { + Type obj = (Type)ToLua.ToObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + Type arg1 = (Type)ToLua.ToObject(L, 3); + Type[] arg2 = ToLua.ToObjectArray(L, 4); + ParameterModifier[] arg3 = ToLua.ToStructArray(L, 5); + PropertyInfo o = obj.GetProperty(arg0, arg1, arg2, arg3); + PushLuaProperty(L, o, obj); + return 1; + } + else if (count == 7 && TypeChecker.CheckTypes (L, 1)) + { + Type obj = (Type)ToLua.ToObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + BindingFlags arg1 = (BindingFlags)LuaDLL.lua_tonumber(L, 3); + Binder arg2 = (Binder)ToLua.ToObject(L, 4); + Type arg3 = (Type)ToLua.ToObject(L, 5); + Type[] arg4 = ToLua.ToObjectArray(L, 6); + ParameterModifier[] arg5 = ToLua.ToStructArray(L, 7); + PropertyInfo o = obj.GetProperty(arg0, arg1, arg2, arg3, arg4, arg5); + PushLuaProperty(L, o, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: tolua.getproperty"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + static void PushLuaField(IntPtr L, FieldInfo f, Type t) + { + if (f != null) + { + LuaField lp = new LuaField(f, t); + ToLua.PushSealed(L, lp); + } + else + { + LuaDLL.lua_pushnil(L); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetField(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + Type obj = (System.Type)ToLua.ToObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + FieldInfo o = obj.GetField(arg0); + PushLuaField(L, o, obj); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + Type obj = (System.Type)ToLua.ToObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + BindingFlags arg1 = (BindingFlags)LuaDLL.lua_tonumber(L, 3); + FieldInfo o = obj.GetField(arg0, arg1); + PushLuaField(L, o, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: tolua.getfield"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CreateInstance(IntPtr L) + { + try + { + Type t = ToLua.CheckMonoType(L, 1); + if (t == null) LuaDLL.luaL_typerror(L, 1, "Type"); + int count = LuaDLL.lua_gettop(L); + object obj = null; + + if (count == 1) + { + obj = Activator.CreateInstance(t); + } + else + { + object[] args = new object[count - 1]; + + for (int i = 2; i <= count; i++) + { + args[i - 2] = ToLua.ToVarObject(L, i); + } + + obj = Activator.CreateInstance(t, args); + } + + ToLua.Push(L, obj); + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + + return 1; + } + + bool LoadAssembly(string name) + { + for (int i = 0; i < list.Count; i++) + { + if (list[i].GetName().Name == name) + { + return true; + } + } + + Assembly assembly = Assembly.Load(name); + + if (assembly == null) + { + assembly = Assembly.Load(AssemblyName.GetAssemblyName(name)); + } + + if (assembly != null && !list.Contains(assembly)) + { + list.Add(assembly); + } + + return assembly != null; + } + + public void Dispose() + { + list.Clear(); + } + } +} diff --git a/Assets/LuaFramework/ToLua/Reflection/LuaReflection.cs.meta b/Assets/LuaFramework/ToLua/Reflection/LuaReflection.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..c5bb12f092aec09b8ac03e0609b2d196d976ddfb --- /dev/null +++ b/Assets/LuaFramework/ToLua/Reflection/LuaReflection.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3faee4f867484814bb3f76d4a798219d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Source.meta b/Assets/LuaFramework/ToLua/Source.meta new file mode 100644 index 0000000000000000000000000000000000000000..203df3004724bb04f2996b9443342a4048e0ce4f --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: db55e48f816fba1409469da1390fc320 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Source/Generate.meta b/Assets/LuaFramework/ToLua/Source/Generate.meta new file mode 100644 index 0000000000000000000000000000000000000000..3c3a03eaf65902a4b48f61da3c86b067a7ba22c1 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: a0a78131d3329a6429aef18c841165dc +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/AnimationEventTriggerWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/AnimationEventTriggerWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..442df14f66f8b52651b67487851cdb6c8414620e --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/AnimationEventTriggerWrap.cs @@ -0,0 +1,90 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class AnimationEventTriggerWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(AnimationEventTrigger), typeof(UnityEngine.MonoBehaviour)); + L.RegFunction("AniMsgStr", AniMsgStr); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("aniEvent", get_aniEvent, set_aniEvent); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int AniMsgStr(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + AnimationEventTrigger obj = (AnimationEventTrigger)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + obj.AniMsgStr(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_aniEvent(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + AnimationEventTrigger obj = (AnimationEventTrigger)o; + System.Action ret = obj.aniEvent; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index aniEvent on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_aniEvent(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + AnimationEventTrigger obj = (AnimationEventTrigger)o; + System.Action arg0 = (System.Action)ToLua.CheckDelegate>(L, 2); + obj.aniEvent = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index aniEvent on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/AnimationEventTriggerWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/AnimationEventTriggerWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..2ad8551ca40e7decc66c74f248d004bd1dfc87e5 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/AnimationEventTriggerWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 850b6c5d5cbc8634a989c24c7fe09ca7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/BaseWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/BaseWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..a3e40fc54d5646bfe9a8dda6bfd4b41f11490d9f --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/BaseWrap.cs @@ -0,0 +1,33 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class BaseWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(Base), typeof(UnityEngine.MonoBehaviour)); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/BaseWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/BaseWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..8f1eeb6f6ea0a192d2ccfd9bd526badde91144eb --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/BaseWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 74b05228fdcf38843998e5c5e6483784 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/DelegateFactory.cs b/Assets/LuaFramework/ToLua/Source/Generate/DelegateFactory.cs new file mode 100644 index 0000000000000000000000000000000000000000..377c8899a81574d09de38d8c59376c89fdbf5e15 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/DelegateFactory.cs @@ -0,0 +1,1184 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using System.Collections.Generic; +using LuaInterface; + +public class DelegateFactory +{ + public delegate Delegate DelegateCreate(LuaFunction func, LuaTable self, bool flag); + public static Dictionary dict = new Dictionary(); + static DelegateFactory factory = new DelegateFactory(); + + public static void Init() + { + Register(); + } + + public static void Register() + { + dict.Clear(); + dict.Add(typeof(System.Action), factory.System_Action); + dict.Add(typeof(UnityEngine.Events.UnityAction), factory.UnityEngine_Events_UnityAction); + dict.Add(typeof(System.Predicate), factory.System_Predicate_int); + dict.Add(typeof(System.Action), factory.System_Action_int); + dict.Add(typeof(System.Comparison), factory.System_Comparison_int); + dict.Add(typeof(System.Func), factory.System_Func_int_int); + dict.Add(typeof(UnityEngine.Camera.CameraCallback), factory.UnityEngine_Camera_CameraCallback); + dict.Add(typeof(UnityEngine.Application.AdvertisingIdentifierCallback), factory.UnityEngine_Application_AdvertisingIdentifierCallback); + dict.Add(typeof(UnityEngine.Application.LowMemoryCallback), factory.UnityEngine_Application_LowMemoryCallback); + dict.Add(typeof(UnityEngine.Application.LogCallback), factory.UnityEngine_Application_LogCallback); + dict.Add(typeof(System.Action), factory.System_Action_bool); + dict.Add(typeof(System.Action), factory.System_Action_string); + dict.Add(typeof(System.Func), factory.System_Func_bool); + dict.Add(typeof(UnityEngine.AudioClip.PCMReaderCallback), factory.UnityEngine_AudioClip_PCMReaderCallback); + dict.Add(typeof(UnityEngine.AudioClip.PCMSetPositionCallback), factory.UnityEngine_AudioClip_PCMSetPositionCallback); + dict.Add(typeof(System.Action), factory.System_Action_UnityEngine_AsyncOperation); + dict.Add(typeof(UnityEngine.RectTransform.ReapplyDrivenProperties), factory.UnityEngine_RectTransform_ReapplyDrivenProperties); + + DelegateTraits.Init(factory.System_Action); + DelegateTraits.Init(factory.UnityEngine_Events_UnityAction); + DelegateTraits>.Init(factory.System_Predicate_int); + DelegateTraits>.Init(factory.System_Action_int); + DelegateTraits>.Init(factory.System_Comparison_int); + DelegateTraits>.Init(factory.System_Func_int_int); + DelegateTraits.Init(factory.UnityEngine_Camera_CameraCallback); + DelegateTraits.Init(factory.UnityEngine_Application_AdvertisingIdentifierCallback); + DelegateTraits.Init(factory.UnityEngine_Application_LowMemoryCallback); + DelegateTraits.Init(factory.UnityEngine_Application_LogCallback); + DelegateTraits>.Init(factory.System_Action_bool); + DelegateTraits>.Init(factory.System_Action_string); + DelegateTraits>.Init(factory.System_Func_bool); + DelegateTraits.Init(factory.UnityEngine_AudioClip_PCMReaderCallback); + DelegateTraits.Init(factory.UnityEngine_AudioClip_PCMSetPositionCallback); + DelegateTraits>.Init(factory.System_Action_UnityEngine_AsyncOperation); + DelegateTraits.Init(factory.UnityEngine_RectTransform_ReapplyDrivenProperties); + + TypeTraits.Init(factory.Check_System_Action); + TypeTraits.Init(factory.Check_UnityEngine_Events_UnityAction); + TypeTraits>.Init(factory.Check_System_Predicate_int); + TypeTraits>.Init(factory.Check_System_Action_int); + TypeTraits>.Init(factory.Check_System_Comparison_int); + TypeTraits>.Init(factory.Check_System_Func_int_int); + TypeTraits.Init(factory.Check_UnityEngine_Camera_CameraCallback); + TypeTraits.Init(factory.Check_UnityEngine_Application_AdvertisingIdentifierCallback); + TypeTraits.Init(factory.Check_UnityEngine_Application_LowMemoryCallback); + TypeTraits.Init(factory.Check_UnityEngine_Application_LogCallback); + TypeTraits>.Init(factory.Check_System_Action_bool); + TypeTraits>.Init(factory.Check_System_Action_string); + TypeTraits>.Init(factory.Check_System_Func_bool); + TypeTraits.Init(factory.Check_UnityEngine_AudioClip_PCMReaderCallback); + TypeTraits.Init(factory.Check_UnityEngine_AudioClip_PCMSetPositionCallback); + TypeTraits>.Init(factory.Check_System_Action_UnityEngine_AsyncOperation); + TypeTraits.Init(factory.Check_UnityEngine_RectTransform_ReapplyDrivenProperties); + + StackTraits.Push = factory.Push_System_Action; + StackTraits.Push = factory.Push_UnityEngine_Events_UnityAction; + StackTraits>.Push = factory.Push_System_Predicate_int; + StackTraits>.Push = factory.Push_System_Action_int; + StackTraits>.Push = factory.Push_System_Comparison_int; + StackTraits>.Push = factory.Push_System_Func_int_int; + StackTraits.Push = factory.Push_UnityEngine_Camera_CameraCallback; + StackTraits.Push = factory.Push_UnityEngine_Application_AdvertisingIdentifierCallback; + StackTraits.Push = factory.Push_UnityEngine_Application_LowMemoryCallback; + StackTraits.Push = factory.Push_UnityEngine_Application_LogCallback; + StackTraits>.Push = factory.Push_System_Action_bool; + StackTraits>.Push = factory.Push_System_Action_string; + StackTraits>.Push = factory.Push_System_Func_bool; + StackTraits.Push = factory.Push_UnityEngine_AudioClip_PCMReaderCallback; + StackTraits.Push = factory.Push_UnityEngine_AudioClip_PCMSetPositionCallback; + StackTraits>.Push = factory.Push_System_Action_UnityEngine_AsyncOperation; + StackTraits.Push = factory.Push_UnityEngine_RectTransform_ReapplyDrivenProperties; + } + + public static Delegate CreateDelegate(Type t, LuaFunction func = null) + { + DelegateCreate Create = null; + + if (!dict.TryGetValue(t, out Create)) + { + throw new LuaException(string.Format("Delegate {0} not register", LuaMisc.GetTypeName(t))); + } + + if (func != null) + { + LuaState state = func.GetLuaState(); + LuaDelegate target = state.GetLuaDelegate(func); + + if (target != null) + { + return Delegate.CreateDelegate(t, target, target.method); + } + else + { + Delegate d = Create(func, null, false); + target = d.Target as LuaDelegate; + state.AddLuaDelegate(target, func); + return d; + } + } + + return Create(null, null, false); + } + + public static Delegate CreateDelegate(Type t, LuaFunction func, LuaTable self) + { + DelegateCreate Create = null; + + if (!dict.TryGetValue(t, out Create)) + { + throw new LuaException(string.Format("Delegate {0} not register", LuaMisc.GetTypeName(t))); + } + + if (func != null) + { + LuaState state = func.GetLuaState(); + LuaDelegate target = state.GetLuaDelegate(func, self); + + if (target != null) + { + return Delegate.CreateDelegate(t, target, target.method); + } + else + { + Delegate d = Create(func, self, true); + target = d.Target as LuaDelegate; + state.AddLuaDelegate(target, func, self); + return d; + } + } + + return Create(null, null, true); + } + + public static Delegate RemoveDelegate(Delegate obj, LuaFunction func) + { + LuaState state = func.GetLuaState(); + Delegate[] ds = obj.GetInvocationList(); + + for (int i = 0; i < ds.Length; i++) + { + LuaDelegate ld = ds[i].Target as LuaDelegate; + + if (ld != null && ld.func == func) + { + obj = Delegate.Remove(obj, ds[i]); + state.DelayDispose(ld.func); + break; + } + } + + return obj; + } + + public static Delegate RemoveDelegate(Delegate obj, Delegate dg) + { + LuaDelegate remove = dg.Target as LuaDelegate; + + if (remove == null) + { + obj = Delegate.Remove(obj, dg); + return obj; + } + + LuaState state = remove.func.GetLuaState(); + Delegate[] ds = obj.GetInvocationList(); + + for (int i = 0; i < ds.Length; i++) + { + LuaDelegate ld = ds[i].Target as LuaDelegate; + + if (ld != null && ld == remove) + { + obj = Delegate.Remove(obj, ds[i]); + state.DelayDispose(ld.func); + state.DelayDispose(ld.self); + break; + } + } + + return obj; + } + + class System_Action_Event : LuaDelegate + { + public System_Action_Event(LuaFunction func) : base(func) { } + public System_Action_Event(LuaFunction func, LuaTable self) : base(func, self) { } + + public void Call() + { + func.Call(); + } + + public void CallWithSelf() + { + func.BeginPCall(); + func.Push(self); + func.PCall(); + func.EndPCall(); + } + } + + public System.Action System_Action(LuaFunction func, LuaTable self, bool flag) + { + if (func == null) + { + System.Action fn = delegate() { }; + return fn; + } + + if(!flag) + { + System_Action_Event target = new System_Action_Event(func); + System.Action d = target.Call; + target.method = d.Method; + return d; + } + else + { + System_Action_Event target = new System_Action_Event(func, self); + System.Action d = target.CallWithSelf; + target.method = d.Method; + return d; + } + } + + bool Check_System_Action(IntPtr L, int pos) + { + return TypeChecker.CheckDelegateType(typeof(System.Action), L, pos); + } + + void Push_System_Action(IntPtr L, System.Action o) + { + ToLua.Push(L, o); + } + + class UnityEngine_Events_UnityAction_Event : LuaDelegate + { + public UnityEngine_Events_UnityAction_Event(LuaFunction func) : base(func) { } + public UnityEngine_Events_UnityAction_Event(LuaFunction func, LuaTable self) : base(func, self) { } + + public void Call() + { + func.Call(); + } + + public void CallWithSelf() + { + func.BeginPCall(); + func.Push(self); + func.PCall(); + func.EndPCall(); + } + } + + public UnityEngine.Events.UnityAction UnityEngine_Events_UnityAction(LuaFunction func, LuaTable self, bool flag) + { + if (func == null) + { + UnityEngine.Events.UnityAction fn = delegate() { }; + return fn; + } + + if(!flag) + { + UnityEngine_Events_UnityAction_Event target = new UnityEngine_Events_UnityAction_Event(func); + UnityEngine.Events.UnityAction d = target.Call; + target.method = d.Method; + return d; + } + else + { + UnityEngine_Events_UnityAction_Event target = new UnityEngine_Events_UnityAction_Event(func, self); + UnityEngine.Events.UnityAction d = target.CallWithSelf; + target.method = d.Method; + return d; + } + } + + bool Check_UnityEngine_Events_UnityAction(IntPtr L, int pos) + { + return TypeChecker.CheckDelegateType(typeof(UnityEngine.Events.UnityAction), L, pos); + } + + void Push_UnityEngine_Events_UnityAction(IntPtr L, UnityEngine.Events.UnityAction o) + { + ToLua.Push(L, o); + } + + class System_Predicate_int_Event : LuaDelegate + { + public System_Predicate_int_Event(LuaFunction func) : base(func) { } + public System_Predicate_int_Event(LuaFunction func, LuaTable self) : base(func, self) { } + + public bool Call(int param0) + { + func.BeginPCall(); + func.Push(param0); + func.PCall(); + bool ret = func.CheckBoolean(); + func.EndPCall(); + return ret; + } + + public bool CallWithSelf(int param0) + { + func.BeginPCall(); + func.Push(self); + func.Push(param0); + func.PCall(); + bool ret = func.CheckBoolean(); + func.EndPCall(); + return ret; + } + } + + public System.Predicate System_Predicate_int(LuaFunction func, LuaTable self, bool flag) + { + if (func == null) + { + System.Predicate fn = delegate(int param0) { return false; }; + return fn; + } + + if(!flag) + { + System_Predicate_int_Event target = new System_Predicate_int_Event(func); + System.Predicate d = target.Call; + target.method = d.Method; + return d; + } + else + { + System_Predicate_int_Event target = new System_Predicate_int_Event(func, self); + System.Predicate d = target.CallWithSelf; + target.method = d.Method; + return d; + } + } + + bool Check_System_Predicate_int(IntPtr L, int pos) + { + return TypeChecker.CheckDelegateType(typeof(System.Predicate), L, pos); + } + + void Push_System_Predicate_int(IntPtr L, System.Predicate o) + { + ToLua.Push(L, o); + } + + class System_Action_int_Event : LuaDelegate + { + public System_Action_int_Event(LuaFunction func) : base(func) { } + public System_Action_int_Event(LuaFunction func, LuaTable self) : base(func, self) { } + + public void Call(int param0) + { + func.BeginPCall(); + func.Push(param0); + func.PCall(); + func.EndPCall(); + } + + public void CallWithSelf(int param0) + { + func.BeginPCall(); + func.Push(self); + func.Push(param0); + func.PCall(); + func.EndPCall(); + } + } + + public System.Action System_Action_int(LuaFunction func, LuaTable self, bool flag) + { + if (func == null) + { + System.Action fn = delegate(int param0) { }; + return fn; + } + + if(!flag) + { + System_Action_int_Event target = new System_Action_int_Event(func); + System.Action d = target.Call; + target.method = d.Method; + return d; + } + else + { + System_Action_int_Event target = new System_Action_int_Event(func, self); + System.Action d = target.CallWithSelf; + target.method = d.Method; + return d; + } + } + + bool Check_System_Action_int(IntPtr L, int pos) + { + return TypeChecker.CheckDelegateType(typeof(System.Action), L, pos); + } + + void Push_System_Action_int(IntPtr L, System.Action o) + { + ToLua.Push(L, o); + } + + class System_Comparison_int_Event : LuaDelegate + { + public System_Comparison_int_Event(LuaFunction func) : base(func) { } + public System_Comparison_int_Event(LuaFunction func, LuaTable self) : base(func, self) { } + + public int Call(int param0, int param1) + { + func.BeginPCall(); + func.Push(param0); + func.Push(param1); + func.PCall(); + int ret = (int)func.CheckNumber(); + func.EndPCall(); + return ret; + } + + public int CallWithSelf(int param0, int param1) + { + func.BeginPCall(); + func.Push(self); + func.Push(param0); + func.Push(param1); + func.PCall(); + int ret = (int)func.CheckNumber(); + func.EndPCall(); + return ret; + } + } + + public System.Comparison System_Comparison_int(LuaFunction func, LuaTable self, bool flag) + { + if (func == null) + { + System.Comparison fn = delegate(int param0, int param1) { return 0; }; + return fn; + } + + if(!flag) + { + System_Comparison_int_Event target = new System_Comparison_int_Event(func); + System.Comparison d = target.Call; + target.method = d.Method; + return d; + } + else + { + System_Comparison_int_Event target = new System_Comparison_int_Event(func, self); + System.Comparison d = target.CallWithSelf; + target.method = d.Method; + return d; + } + } + + bool Check_System_Comparison_int(IntPtr L, int pos) + { + return TypeChecker.CheckDelegateType(typeof(System.Comparison), L, pos); + } + + void Push_System_Comparison_int(IntPtr L, System.Comparison o) + { + ToLua.Push(L, o); + } + + class System_Func_int_int_Event : LuaDelegate + { + public System_Func_int_int_Event(LuaFunction func) : base(func) { } + public System_Func_int_int_Event(LuaFunction func, LuaTable self) : base(func, self) { } + + public int Call(int param0) + { + func.BeginPCall(); + func.Push(param0); + func.PCall(); + int ret = (int)func.CheckNumber(); + func.EndPCall(); + return ret; + } + + public int CallWithSelf(int param0) + { + func.BeginPCall(); + func.Push(self); + func.Push(param0); + func.PCall(); + int ret = (int)func.CheckNumber(); + func.EndPCall(); + return ret; + } + } + + public System.Func System_Func_int_int(LuaFunction func, LuaTable self, bool flag) + { + if (func == null) + { + System.Func fn = delegate(int param0) { return 0; }; + return fn; + } + + if(!flag) + { + System_Func_int_int_Event target = new System_Func_int_int_Event(func); + System.Func d = target.Call; + target.method = d.Method; + return d; + } + else + { + System_Func_int_int_Event target = new System_Func_int_int_Event(func, self); + System.Func d = target.CallWithSelf; + target.method = d.Method; + return d; + } + } + + bool Check_System_Func_int_int(IntPtr L, int pos) + { + return TypeChecker.CheckDelegateType(typeof(System.Func), L, pos); + } + + void Push_System_Func_int_int(IntPtr L, System.Func o) + { + ToLua.Push(L, o); + } + + class UnityEngine_Camera_CameraCallback_Event : LuaDelegate + { + public UnityEngine_Camera_CameraCallback_Event(LuaFunction func) : base(func) { } + public UnityEngine_Camera_CameraCallback_Event(LuaFunction func, LuaTable self) : base(func, self) { } + + public void Call(UnityEngine.Camera param0) + { + func.BeginPCall(); + func.PushSealed(param0); + func.PCall(); + func.EndPCall(); + } + + public void CallWithSelf(UnityEngine.Camera param0) + { + func.BeginPCall(); + func.Push(self); + func.PushSealed(param0); + func.PCall(); + func.EndPCall(); + } + } + + public UnityEngine.Camera.CameraCallback UnityEngine_Camera_CameraCallback(LuaFunction func, LuaTable self, bool flag) + { + if (func == null) + { + UnityEngine.Camera.CameraCallback fn = delegate(UnityEngine.Camera param0) { }; + return fn; + } + + if(!flag) + { + UnityEngine_Camera_CameraCallback_Event target = new UnityEngine_Camera_CameraCallback_Event(func); + UnityEngine.Camera.CameraCallback d = target.Call; + target.method = d.Method; + return d; + } + else + { + UnityEngine_Camera_CameraCallback_Event target = new UnityEngine_Camera_CameraCallback_Event(func, self); + UnityEngine.Camera.CameraCallback d = target.CallWithSelf; + target.method = d.Method; + return d; + } + } + + bool Check_UnityEngine_Camera_CameraCallback(IntPtr L, int pos) + { + return TypeChecker.CheckDelegateType(typeof(UnityEngine.Camera.CameraCallback), L, pos); + } + + void Push_UnityEngine_Camera_CameraCallback(IntPtr L, UnityEngine.Camera.CameraCallback o) + { + ToLua.Push(L, o); + } + + class UnityEngine_Application_AdvertisingIdentifierCallback_Event : LuaDelegate + { + public UnityEngine_Application_AdvertisingIdentifierCallback_Event(LuaFunction func) : base(func) { } + public UnityEngine_Application_AdvertisingIdentifierCallback_Event(LuaFunction func, LuaTable self) : base(func, self) { } + + public void Call(string param0, bool param1, string param2) + { + func.BeginPCall(); + func.Push(param0); + func.Push(param1); + func.Push(param2); + func.PCall(); + func.EndPCall(); + } + + public void CallWithSelf(string param0, bool param1, string param2) + { + func.BeginPCall(); + func.Push(self); + func.Push(param0); + func.Push(param1); + func.Push(param2); + func.PCall(); + func.EndPCall(); + } + } + + public UnityEngine.Application.AdvertisingIdentifierCallback UnityEngine_Application_AdvertisingIdentifierCallback(LuaFunction func, LuaTable self, bool flag) + { + if (func == null) + { + UnityEngine.Application.AdvertisingIdentifierCallback fn = delegate(string param0, bool param1, string param2) { }; + return fn; + } + + if(!flag) + { + UnityEngine_Application_AdvertisingIdentifierCallback_Event target = new UnityEngine_Application_AdvertisingIdentifierCallback_Event(func); + UnityEngine.Application.AdvertisingIdentifierCallback d = target.Call; + target.method = d.Method; + return d; + } + else + { + UnityEngine_Application_AdvertisingIdentifierCallback_Event target = new UnityEngine_Application_AdvertisingIdentifierCallback_Event(func, self); + UnityEngine.Application.AdvertisingIdentifierCallback d = target.CallWithSelf; + target.method = d.Method; + return d; + } + } + + bool Check_UnityEngine_Application_AdvertisingIdentifierCallback(IntPtr L, int pos) + { + return TypeChecker.CheckDelegateType(typeof(UnityEngine.Application.AdvertisingIdentifierCallback), L, pos); + } + + void Push_UnityEngine_Application_AdvertisingIdentifierCallback(IntPtr L, UnityEngine.Application.AdvertisingIdentifierCallback o) + { + ToLua.Push(L, o); + } + + class UnityEngine_Application_LowMemoryCallback_Event : LuaDelegate + { + public UnityEngine_Application_LowMemoryCallback_Event(LuaFunction func) : base(func) { } + public UnityEngine_Application_LowMemoryCallback_Event(LuaFunction func, LuaTable self) : base(func, self) { } + + public void Call() + { + func.Call(); + } + + public void CallWithSelf() + { + func.BeginPCall(); + func.Push(self); + func.PCall(); + func.EndPCall(); + } + } + + public UnityEngine.Application.LowMemoryCallback UnityEngine_Application_LowMemoryCallback(LuaFunction func, LuaTable self, bool flag) + { + if (func == null) + { + UnityEngine.Application.LowMemoryCallback fn = delegate() { }; + return fn; + } + + if(!flag) + { + UnityEngine_Application_LowMemoryCallback_Event target = new UnityEngine_Application_LowMemoryCallback_Event(func); + UnityEngine.Application.LowMemoryCallback d = target.Call; + target.method = d.Method; + return d; + } + else + { + UnityEngine_Application_LowMemoryCallback_Event target = new UnityEngine_Application_LowMemoryCallback_Event(func, self); + UnityEngine.Application.LowMemoryCallback d = target.CallWithSelf; + target.method = d.Method; + return d; + } + } + + bool Check_UnityEngine_Application_LowMemoryCallback(IntPtr L, int pos) + { + return TypeChecker.CheckDelegateType(typeof(UnityEngine.Application.LowMemoryCallback), L, pos); + } + + void Push_UnityEngine_Application_LowMemoryCallback(IntPtr L, UnityEngine.Application.LowMemoryCallback o) + { + ToLua.Push(L, o); + } + + class UnityEngine_Application_LogCallback_Event : LuaDelegate + { + public UnityEngine_Application_LogCallback_Event(LuaFunction func) : base(func) { } + public UnityEngine_Application_LogCallback_Event(LuaFunction func, LuaTable self) : base(func, self) { } + + public void Call(string param0, string param1, UnityEngine.LogType param2) + { + func.BeginPCall(); + func.Push(param0); + func.Push(param1); + func.Push(param2); + func.PCall(); + func.EndPCall(); + } + + public void CallWithSelf(string param0, string param1, UnityEngine.LogType param2) + { + func.BeginPCall(); + func.Push(self); + func.Push(param0); + func.Push(param1); + func.Push(param2); + func.PCall(); + func.EndPCall(); + } + } + + public UnityEngine.Application.LogCallback UnityEngine_Application_LogCallback(LuaFunction func, LuaTable self, bool flag) + { + if (func == null) + { + UnityEngine.Application.LogCallback fn = delegate(string param0, string param1, UnityEngine.LogType param2) { }; + return fn; + } + + if(!flag) + { + UnityEngine_Application_LogCallback_Event target = new UnityEngine_Application_LogCallback_Event(func); + UnityEngine.Application.LogCallback d = target.Call; + target.method = d.Method; + return d; + } + else + { + UnityEngine_Application_LogCallback_Event target = new UnityEngine_Application_LogCallback_Event(func, self); + UnityEngine.Application.LogCallback d = target.CallWithSelf; + target.method = d.Method; + return d; + } + } + + bool Check_UnityEngine_Application_LogCallback(IntPtr L, int pos) + { + return TypeChecker.CheckDelegateType(typeof(UnityEngine.Application.LogCallback), L, pos); + } + + void Push_UnityEngine_Application_LogCallback(IntPtr L, UnityEngine.Application.LogCallback o) + { + ToLua.Push(L, o); + } + + class System_Action_bool_Event : LuaDelegate + { + public System_Action_bool_Event(LuaFunction func) : base(func) { } + public System_Action_bool_Event(LuaFunction func, LuaTable self) : base(func, self) { } + + public void Call(bool param0) + { + func.BeginPCall(); + func.Push(param0); + func.PCall(); + func.EndPCall(); + } + + public void CallWithSelf(bool param0) + { + func.BeginPCall(); + func.Push(self); + func.Push(param0); + func.PCall(); + func.EndPCall(); + } + } + + public System.Action System_Action_bool(LuaFunction func, LuaTable self, bool flag) + { + if (func == null) + { + System.Action fn = delegate(bool param0) { }; + return fn; + } + + if(!flag) + { + System_Action_bool_Event target = new System_Action_bool_Event(func); + System.Action d = target.Call; + target.method = d.Method; + return d; + } + else + { + System_Action_bool_Event target = new System_Action_bool_Event(func, self); + System.Action d = target.CallWithSelf; + target.method = d.Method; + return d; + } + } + + bool Check_System_Action_bool(IntPtr L, int pos) + { + return TypeChecker.CheckDelegateType(typeof(System.Action), L, pos); + } + + void Push_System_Action_bool(IntPtr L, System.Action o) + { + ToLua.Push(L, o); + } + + class System_Action_string_Event : LuaDelegate + { + public System_Action_string_Event(LuaFunction func) : base(func) { } + public System_Action_string_Event(LuaFunction func, LuaTable self) : base(func, self) { } + + public void Call(string param0) + { + func.BeginPCall(); + func.Push(param0); + func.PCall(); + func.EndPCall(); + } + + public void CallWithSelf(string param0) + { + func.BeginPCall(); + func.Push(self); + func.Push(param0); + func.PCall(); + func.EndPCall(); + } + } + + public System.Action System_Action_string(LuaFunction func, LuaTable self, bool flag) + { + if (func == null) + { + System.Action fn = delegate(string param0) { }; + return fn; + } + + if(!flag) + { + System_Action_string_Event target = new System_Action_string_Event(func); + System.Action d = target.Call; + target.method = d.Method; + return d; + } + else + { + System_Action_string_Event target = new System_Action_string_Event(func, self); + System.Action d = target.CallWithSelf; + target.method = d.Method; + return d; + } + } + + bool Check_System_Action_string(IntPtr L, int pos) + { + return TypeChecker.CheckDelegateType(typeof(System.Action), L, pos); + } + + void Push_System_Action_string(IntPtr L, System.Action o) + { + ToLua.Push(L, o); + } + + class System_Func_bool_Event : LuaDelegate + { + public System_Func_bool_Event(LuaFunction func) : base(func) { } + public System_Func_bool_Event(LuaFunction func, LuaTable self) : base(func, self) { } + + public bool Call() + { + func.BeginPCall(); + func.PCall(); + bool ret = func.CheckBoolean(); + func.EndPCall(); + return ret; + } + + public bool CallWithSelf() + { + func.BeginPCall(); + func.Push(self); + func.PCall(); + bool ret = func.CheckBoolean(); + func.EndPCall(); + return ret; + } + } + + public System.Func System_Func_bool(LuaFunction func, LuaTable self, bool flag) + { + if (func == null) + { + System.Func fn = delegate() { return false; }; + return fn; + } + + if(!flag) + { + System_Func_bool_Event target = new System_Func_bool_Event(func); + System.Func d = target.Call; + target.method = d.Method; + return d; + } + else + { + System_Func_bool_Event target = new System_Func_bool_Event(func, self); + System.Func d = target.CallWithSelf; + target.method = d.Method; + return d; + } + } + + bool Check_System_Func_bool(IntPtr L, int pos) + { + return TypeChecker.CheckDelegateType(typeof(System.Func), L, pos); + } + + void Push_System_Func_bool(IntPtr L, System.Func o) + { + ToLua.Push(L, o); + } + + class UnityEngine_AudioClip_PCMReaderCallback_Event : LuaDelegate + { + public UnityEngine_AudioClip_PCMReaderCallback_Event(LuaFunction func) : base(func) { } + public UnityEngine_AudioClip_PCMReaderCallback_Event(LuaFunction func, LuaTable self) : base(func, self) { } + + public void Call(float[] param0) + { + func.BeginPCall(); + func.Push(param0); + func.PCall(); + func.EndPCall(); + } + + public void CallWithSelf(float[] param0) + { + func.BeginPCall(); + func.Push(self); + func.Push(param0); + func.PCall(); + func.EndPCall(); + } + } + + public UnityEngine.AudioClip.PCMReaderCallback UnityEngine_AudioClip_PCMReaderCallback(LuaFunction func, LuaTable self, bool flag) + { + if (func == null) + { + UnityEngine.AudioClip.PCMReaderCallback fn = delegate(float[] param0) { }; + return fn; + } + + if(!flag) + { + UnityEngine_AudioClip_PCMReaderCallback_Event target = new UnityEngine_AudioClip_PCMReaderCallback_Event(func); + UnityEngine.AudioClip.PCMReaderCallback d = target.Call; + target.method = d.Method; + return d; + } + else + { + UnityEngine_AudioClip_PCMReaderCallback_Event target = new UnityEngine_AudioClip_PCMReaderCallback_Event(func, self); + UnityEngine.AudioClip.PCMReaderCallback d = target.CallWithSelf; + target.method = d.Method; + return d; + } + } + + bool Check_UnityEngine_AudioClip_PCMReaderCallback(IntPtr L, int pos) + { + return TypeChecker.CheckDelegateType(typeof(UnityEngine.AudioClip.PCMReaderCallback), L, pos); + } + + void Push_UnityEngine_AudioClip_PCMReaderCallback(IntPtr L, UnityEngine.AudioClip.PCMReaderCallback o) + { + ToLua.Push(L, o); + } + + class UnityEngine_AudioClip_PCMSetPositionCallback_Event : LuaDelegate + { + public UnityEngine_AudioClip_PCMSetPositionCallback_Event(LuaFunction func) : base(func) { } + public UnityEngine_AudioClip_PCMSetPositionCallback_Event(LuaFunction func, LuaTable self) : base(func, self) { } + + public void Call(int param0) + { + func.BeginPCall(); + func.Push(param0); + func.PCall(); + func.EndPCall(); + } + + public void CallWithSelf(int param0) + { + func.BeginPCall(); + func.Push(self); + func.Push(param0); + func.PCall(); + func.EndPCall(); + } + } + + public UnityEngine.AudioClip.PCMSetPositionCallback UnityEngine_AudioClip_PCMSetPositionCallback(LuaFunction func, LuaTable self, bool flag) + { + if (func == null) + { + UnityEngine.AudioClip.PCMSetPositionCallback fn = delegate(int param0) { }; + return fn; + } + + if(!flag) + { + UnityEngine_AudioClip_PCMSetPositionCallback_Event target = new UnityEngine_AudioClip_PCMSetPositionCallback_Event(func); + UnityEngine.AudioClip.PCMSetPositionCallback d = target.Call; + target.method = d.Method; + return d; + } + else + { + UnityEngine_AudioClip_PCMSetPositionCallback_Event target = new UnityEngine_AudioClip_PCMSetPositionCallback_Event(func, self); + UnityEngine.AudioClip.PCMSetPositionCallback d = target.CallWithSelf; + target.method = d.Method; + return d; + } + } + + bool Check_UnityEngine_AudioClip_PCMSetPositionCallback(IntPtr L, int pos) + { + return TypeChecker.CheckDelegateType(typeof(UnityEngine.AudioClip.PCMSetPositionCallback), L, pos); + } + + void Push_UnityEngine_AudioClip_PCMSetPositionCallback(IntPtr L, UnityEngine.AudioClip.PCMSetPositionCallback o) + { + ToLua.Push(L, o); + } + + class System_Action_UnityEngine_AsyncOperation_Event : LuaDelegate + { + public System_Action_UnityEngine_AsyncOperation_Event(LuaFunction func) : base(func) { } + public System_Action_UnityEngine_AsyncOperation_Event(LuaFunction func, LuaTable self) : base(func, self) { } + + public void Call(UnityEngine.AsyncOperation param0) + { + func.BeginPCall(); + func.PushObject(param0); + func.PCall(); + func.EndPCall(); + } + + public void CallWithSelf(UnityEngine.AsyncOperation param0) + { + func.BeginPCall(); + func.Push(self); + func.PushObject(param0); + func.PCall(); + func.EndPCall(); + } + } + + public System.Action System_Action_UnityEngine_AsyncOperation(LuaFunction func, LuaTable self, bool flag) + { + if (func == null) + { + System.Action fn = delegate(UnityEngine.AsyncOperation param0) { }; + return fn; + } + + if(!flag) + { + System_Action_UnityEngine_AsyncOperation_Event target = new System_Action_UnityEngine_AsyncOperation_Event(func); + System.Action d = target.Call; + target.method = d.Method; + return d; + } + else + { + System_Action_UnityEngine_AsyncOperation_Event target = new System_Action_UnityEngine_AsyncOperation_Event(func, self); + System.Action d = target.CallWithSelf; + target.method = d.Method; + return d; + } + } + + bool Check_System_Action_UnityEngine_AsyncOperation(IntPtr L, int pos) + { + return TypeChecker.CheckDelegateType(typeof(System.Action), L, pos); + } + + void Push_System_Action_UnityEngine_AsyncOperation(IntPtr L, System.Action o) + { + ToLua.Push(L, o); + } + + class UnityEngine_RectTransform_ReapplyDrivenProperties_Event : LuaDelegate + { + public UnityEngine_RectTransform_ReapplyDrivenProperties_Event(LuaFunction func) : base(func) { } + public UnityEngine_RectTransform_ReapplyDrivenProperties_Event(LuaFunction func, LuaTable self) : base(func, self) { } + + public void Call(UnityEngine.RectTransform param0) + { + func.BeginPCall(); + func.PushSealed(param0); + func.PCall(); + func.EndPCall(); + } + + public void CallWithSelf(UnityEngine.RectTransform param0) + { + func.BeginPCall(); + func.Push(self); + func.PushSealed(param0); + func.PCall(); + func.EndPCall(); + } + } + + public UnityEngine.RectTransform.ReapplyDrivenProperties UnityEngine_RectTransform_ReapplyDrivenProperties(LuaFunction func, LuaTable self, bool flag) + { + if (func == null) + { + UnityEngine.RectTransform.ReapplyDrivenProperties fn = delegate(UnityEngine.RectTransform param0) { }; + return fn; + } + + if(!flag) + { + UnityEngine_RectTransform_ReapplyDrivenProperties_Event target = new UnityEngine_RectTransform_ReapplyDrivenProperties_Event(func); + UnityEngine.RectTransform.ReapplyDrivenProperties d = target.Call; + target.method = d.Method; + return d; + } + else + { + UnityEngine_RectTransform_ReapplyDrivenProperties_Event target = new UnityEngine_RectTransform_ReapplyDrivenProperties_Event(func, self); + UnityEngine.RectTransform.ReapplyDrivenProperties d = target.CallWithSelf; + target.method = d.Method; + return d; + } + } + + bool Check_UnityEngine_RectTransform_ReapplyDrivenProperties(IntPtr L, int pos) + { + return TypeChecker.CheckDelegateType(typeof(UnityEngine.RectTransform.ReapplyDrivenProperties), L, pos); + } + + void Push_UnityEngine_RectTransform_ReapplyDrivenProperties(IntPtr L, UnityEngine.RectTransform.ReapplyDrivenProperties o) + { + ToLua.Push(L, o); + } + +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/DelegateFactory.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/DelegateFactory.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..306b0d504ab8cb4b153ea532bb3b7a280d631165 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/DelegateFactory.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4b601554b6e73074a99764aab89026c9 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/GameLoggerWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/GameLoggerWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..36f44594ed1f57e2cc96e8e612fff9a3390cc124 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/GameLoggerWrap.cs @@ -0,0 +1,440 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class GameLoggerWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(GameLogger), typeof(System.Object)); + L.RegFunction("Init", Init); + L.RegFunction("Log", Log); + L.RegFunction("LogFormat", LogFormat); + L.RegFunction("LogWithColor", LogWithColor); + L.RegFunction("LogRed", LogRed); + L.RegFunction("LogGreen", LogGreen); + L.RegFunction("LogYellow", LogYellow); + L.RegFunction("LogCyan", LogCyan); + L.RegFunction("LogFormatWithColor", LogFormatWithColor); + L.RegFunction("LogWarning", LogWarning); + L.RegFunction("LogError", LogError); + L.RegFunction("New", _CreateGameLogger); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("s_debugLogEnable", get_s_debugLogEnable, set_s_debugLogEnable); + L.RegVar("s_warningLogEnable", get_s_warningLogEnable, set_s_warningLogEnable); + L.RegVar("s_errorLogEnable", get_s_errorLogEnable, set_s_errorLogEnable); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateGameLogger(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + GameLogger obj = new GameLogger(); + ToLua.PushObject(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: GameLogger.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Init(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 0); + GameLogger.Init(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Log(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + object arg0 = ToLua.ToVarObject(L, 1); + GameLogger.Log(arg0); + return 0; + } + else if (count == 2) + { + object arg0 = ToLua.ToVarObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.CheckObject(L, 2); + GameLogger.Log(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: GameLogger.Log"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LogFormat(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + string arg0 = ToLua.CheckString(L, 1); + object[] arg1 = ToLua.ToParamsObject(L, 2, count - 1); + GameLogger.LogFormat(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LogWithColor(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + object arg0 = ToLua.ToVarObject(L, 1); + string arg1 = ToLua.CheckString(L, 2); + GameLogger.LogWithColor(arg0, arg1); + return 0; + } + else if (count == 3) + { + object arg0 = ToLua.ToVarObject(L, 1); + string arg1 = ToLua.CheckString(L, 2); + UnityEngine.Object arg2 = (UnityEngine.Object)ToLua.CheckObject(L, 3); + GameLogger.LogWithColor(arg0, arg1, arg2); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: GameLogger.LogWithColor"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LogRed(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + object arg0 = ToLua.ToVarObject(L, 1); + GameLogger.LogRed(arg0); + return 0; + } + else if (count == 2) + { + object arg0 = ToLua.ToVarObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.CheckObject(L, 2); + GameLogger.LogRed(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: GameLogger.LogRed"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LogGreen(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + object arg0 = ToLua.ToVarObject(L, 1); + GameLogger.LogGreen(arg0); + return 0; + } + else if (count == 2) + { + object arg0 = ToLua.ToVarObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.CheckObject(L, 2); + GameLogger.LogGreen(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: GameLogger.LogGreen"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LogYellow(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + object arg0 = ToLua.ToVarObject(L, 1); + GameLogger.LogYellow(arg0); + return 0; + } + else if (count == 2) + { + object arg0 = ToLua.ToVarObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.CheckObject(L, 2); + GameLogger.LogYellow(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: GameLogger.LogYellow"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LogCyan(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + object arg0 = ToLua.ToVarObject(L, 1); + GameLogger.LogCyan(arg0); + return 0; + } + else if (count == 2) + { + object arg0 = ToLua.ToVarObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.CheckObject(L, 2); + GameLogger.LogCyan(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: GameLogger.LogCyan"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LogFormatWithColor(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + string arg0 = ToLua.CheckString(L, 1); + string arg1 = ToLua.CheckString(L, 2); + object[] arg2 = ToLua.ToParamsObject(L, 3, count - 2); + GameLogger.LogFormatWithColor(arg0, arg1, arg2); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LogWarning(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + object arg0 = ToLua.ToVarObject(L, 1); + GameLogger.LogWarning(arg0); + return 0; + } + else if (count == 2) + { + object arg0 = ToLua.ToVarObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.CheckObject(L, 2); + GameLogger.LogWarning(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: GameLogger.LogWarning"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LogError(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + object arg0 = ToLua.ToVarObject(L, 1); + GameLogger.LogError(arg0); + return 0; + } + else if (count == 2) + { + object arg0 = ToLua.ToVarObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.CheckObject(L, 2); + GameLogger.LogError(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: GameLogger.LogError"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_s_debugLogEnable(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, GameLogger.s_debugLogEnable); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_s_warningLogEnable(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, GameLogger.s_warningLogEnable); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_s_errorLogEnable(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, GameLogger.s_errorLogEnable); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_s_debugLogEnable(IntPtr L) + { + try + { + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + GameLogger.s_debugLogEnable = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_s_warningLogEnable(IntPtr L) + { + try + { + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + GameLogger.s_warningLogEnable = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_s_errorLogEnable(IntPtr L) + { + try + { + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + GameLogger.s_errorLogEnable = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/GameLoggerWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/GameLoggerWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..8fa6d2ef5fabe82f5e07ed152663d7429fee8ff4 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/GameLoggerWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 69c24b779be6f3642be25f3dd4f205c8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/LuaBinder.cs b/Assets/LuaFramework/ToLua/Source/Generate/LuaBinder.cs new file mode 100644 index 0000000000000000000000000000000000000000..1cc1a514214580f5310ec6cb295fb34af5f4f73a --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/LuaBinder.cs @@ -0,0 +1,792 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using UnityEngine; +using LuaInterface; + +public static class LuaBinder +{ + public static void Bind(LuaState L) + { + float t = Time.realtimeSinceStartup; + L.BeginModule(null); + LuaInterface_DebuggerWrap.Register(L); + LuaProfilerWrap.Register(L); + GameLoggerWrap.Register(L); + PanelMgrWrap.Register(L); + ResourceMgrWrap.Register(L); + PrefabObjBinderWrap.Register(L); + VersionMgrWrap.Register(L); + AnimationEventTriggerWrap.Register(L); + ManagerWrap.Register(L); + BaseWrap.Register(L); + L.BeginModule("LuaInterface"); + LuaInterface_LuaInjectionStationWrap.Register(L); + LuaInterface_InjectTypeWrap.Register(L); + L.EndModule(); + L.BeginModule("UnityEngine"); + UnityEngine_ComponentWrap.Register(L); + UnityEngine_TransformWrap.Register(L); + UnityEngine_MaterialWrap.Register(L); + UnityEngine_CameraWrap.Register(L); + UnityEngine_AudioSourceWrap.Register(L); + UnityEngine_BehaviourWrap.Register(L); + UnityEngine_MonoBehaviourWrap.Register(L); + UnityEngine_GameObjectWrap.Register(L); + UnityEngine_TrackedReferenceWrap.Register(L); + UnityEngine_ApplicationWrap.Register(L); + UnityEngine_PhysicsWrap.Register(L); + UnityEngine_ColliderWrap.Register(L); + UnityEngine_TimeWrap.Register(L); + UnityEngine_TextureWrap.Register(L); + UnityEngine_Texture2DWrap.Register(L); + UnityEngine_ShaderWrap.Register(L); + UnityEngine_RendererWrap.Register(L); + UnityEngine_WWWWrap.Register(L); + UnityEngine_ScreenWrap.Register(L); + UnityEngine_CameraClearFlagsWrap.Register(L); + UnityEngine_AudioClipWrap.Register(L); + UnityEngine_AssetBundleWrap.Register(L); + UnityEngine_AsyncOperationWrap.Register(L); + UnityEngine_LightTypeWrap.Register(L); + UnityEngine_SleepTimeoutWrap.Register(L); + UnityEngine_AnimatorWrap.Register(L); + UnityEngine_InputWrap.Register(L); + UnityEngine_KeyCodeWrap.Register(L); + UnityEngine_SkinnedMeshRendererWrap.Register(L); + UnityEngine_SpaceWrap.Register(L); + UnityEngine_AnimationBlendModeWrap.Register(L); + UnityEngine_QueueModeWrap.Register(L); + UnityEngine_PlayModeWrap.Register(L); + UnityEngine_WrapModeWrap.Register(L); + UnityEngine_RenderSettingsWrap.Register(L); + UnityEngine_ResourcesWrap.Register(L); + UnityEngine_RectTransformWrap.Register(L); + UnityEngine_PlayerPrefsWrap.Register(L); + UnityEngine_AudioBehaviourWrap.Register(L); + L.BeginModule("UI"); + UnityEngine_UI_TextWrap.Register(L); + UnityEngine_UI_ButtonWrap.Register(L); + UnityEngine_UI_ToggleWrap.Register(L); + UnityEngine_UI_ImageWrap.Register(L); + UnityEngine_UI_RawImageWrap.Register(L); + UnityEngine_UI_MaskableGraphicWrap.Register(L); + UnityEngine_UI_GraphicWrap.Register(L); + UnityEngine_UI_SelectableWrap.Register(L); + L.EndModule(); + L.BeginModule("EventSystems"); + UnityEngine_EventSystems_UIBehaviourWrap.Register(L); + L.EndModule(); + L.BeginModule("Events"); + L.RegFunction("UnityAction", UnityEngine_Events_UnityAction); + L.EndModule(); + L.BeginModule("Camera"); + L.RegFunction("CameraCallback", UnityEngine_Camera_CameraCallback); + L.EndModule(); + L.BeginModule("Application"); + L.RegFunction("AdvertisingIdentifierCallback", UnityEngine_Application_AdvertisingIdentifierCallback); + L.RegFunction("LowMemoryCallback", UnityEngine_Application_LowMemoryCallback); + L.RegFunction("LogCallback", UnityEngine_Application_LogCallback); + L.EndModule(); + L.BeginModule("AudioClip"); + L.RegFunction("PCMReaderCallback", UnityEngine_AudioClip_PCMReaderCallback); + L.RegFunction("PCMSetPositionCallback", UnityEngine_AudioClip_PCMSetPositionCallback); + L.EndModule(); + L.BeginModule("RectTransform"); + L.RegFunction("ReapplyDrivenProperties", UnityEngine_RectTransform_ReapplyDrivenProperties); + L.EndModule(); + L.EndModule(); + L.BeginModule("LuaFramework"); + LuaFramework_UtilWrap.Register(L); + LuaFramework_AppConstWrap.Register(L); + LuaFramework_LuaHelperWrap.Register(L); + LuaFramework_ByteBufferWrap.Register(L); + LuaFramework_GameManagerWrap.Register(L); + LuaFramework_LuaManagerWrap.Register(L); + LuaFramework_NetworkManagerWrap.Register(L); + L.EndModule(); + L.BeginModule("System"); + L.RegFunction("Action", System_Action); + L.RegFunction("Predicate_int", System_Predicate_int); + L.RegFunction("Action_int", System_Action_int); + L.RegFunction("Comparison_int", System_Comparison_int); + L.RegFunction("Func_int_int", System_Func_int_int); + L.RegFunction("Action_bool", System_Action_bool); + L.RegFunction("Action_string", System_Action_string); + L.RegFunction("Func_bool", System_Func_bool); + L.RegFunction("Action_UnityEngine_AsyncOperation", System_Action_UnityEngine_AsyncOperation); + L.EndModule(); + L.EndModule(); + L.BeginPreLoad(); + L.AddPreLoad("UnityEngine.BoxCollider", LuaOpen_UnityEngine_BoxCollider, typeof(UnityEngine.BoxCollider)); + L.AddPreLoad("UnityEngine.MeshCollider", LuaOpen_UnityEngine_MeshCollider, typeof(UnityEngine.MeshCollider)); + L.AddPreLoad("UnityEngine.SphereCollider", LuaOpen_UnityEngine_SphereCollider, typeof(UnityEngine.SphereCollider)); + L.AddPreLoad("UnityEngine.CharacterController", LuaOpen_UnityEngine_CharacterController, typeof(UnityEngine.CharacterController)); + L.AddPreLoad("UnityEngine.CapsuleCollider", LuaOpen_UnityEngine_CapsuleCollider, typeof(UnityEngine.CapsuleCollider)); + L.AddPreLoad("UnityEngine.Animation", LuaOpen_UnityEngine_Animation, typeof(UnityEngine.Animation)); + L.AddPreLoad("UnityEngine.AnimationClip", LuaOpen_UnityEngine_AnimationClip, typeof(UnityEngine.AnimationClip)); + L.AddPreLoad("UnityEngine.AnimationState", LuaOpen_UnityEngine_AnimationState, typeof(UnityEngine.AnimationState)); + L.AddPreLoad("UnityEngine.SkinWeights", LuaOpen_UnityEngine_SkinWeights, typeof(UnityEngine.SkinWeights)); + L.AddPreLoad("UnityEngine.RenderTexture", LuaOpen_UnityEngine_RenderTexture, typeof(UnityEngine.RenderTexture)); + L.AddPreLoad("UnityEngine.Rigidbody", LuaOpen_UnityEngine_Rigidbody, typeof(UnityEngine.Rigidbody)); + L.EndPreLoad(); + Debugger.Log("Register lua type cost time: {0}", Time.realtimeSinceStartup - t); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int UnityEngine_Events_UnityAction(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + LuaFunction func = ToLua.CheckLuaFunction(L, 1); + + if (count == 1) + { + Delegate arg1 = DelegateTraits.Create(func); + ToLua.Push(L, arg1); + } + else + { + LuaTable self = ToLua.CheckLuaTable(L, 2); + Delegate arg1 = DelegateTraits.Create(func, self); + ToLua.Push(L, arg1); + } + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int UnityEngine_Camera_CameraCallback(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + LuaFunction func = ToLua.CheckLuaFunction(L, 1); + + if (count == 1) + { + Delegate arg1 = DelegateTraits.Create(func); + ToLua.Push(L, arg1); + } + else + { + LuaTable self = ToLua.CheckLuaTable(L, 2); + Delegate arg1 = DelegateTraits.Create(func, self); + ToLua.Push(L, arg1); + } + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int UnityEngine_Application_AdvertisingIdentifierCallback(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + LuaFunction func = ToLua.CheckLuaFunction(L, 1); + + if (count == 1) + { + Delegate arg1 = DelegateTraits.Create(func); + ToLua.Push(L, arg1); + } + else + { + LuaTable self = ToLua.CheckLuaTable(L, 2); + Delegate arg1 = DelegateTraits.Create(func, self); + ToLua.Push(L, arg1); + } + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int UnityEngine_Application_LowMemoryCallback(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + LuaFunction func = ToLua.CheckLuaFunction(L, 1); + + if (count == 1) + { + Delegate arg1 = DelegateTraits.Create(func); + ToLua.Push(L, arg1); + } + else + { + LuaTable self = ToLua.CheckLuaTable(L, 2); + Delegate arg1 = DelegateTraits.Create(func, self); + ToLua.Push(L, arg1); + } + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int UnityEngine_Application_LogCallback(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + LuaFunction func = ToLua.CheckLuaFunction(L, 1); + + if (count == 1) + { + Delegate arg1 = DelegateTraits.Create(func); + ToLua.Push(L, arg1); + } + else + { + LuaTable self = ToLua.CheckLuaTable(L, 2); + Delegate arg1 = DelegateTraits.Create(func, self); + ToLua.Push(L, arg1); + } + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int UnityEngine_AudioClip_PCMReaderCallback(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + LuaFunction func = ToLua.CheckLuaFunction(L, 1); + + if (count == 1) + { + Delegate arg1 = DelegateTraits.Create(func); + ToLua.Push(L, arg1); + } + else + { + LuaTable self = ToLua.CheckLuaTable(L, 2); + Delegate arg1 = DelegateTraits.Create(func, self); + ToLua.Push(L, arg1); + } + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int UnityEngine_AudioClip_PCMSetPositionCallback(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + LuaFunction func = ToLua.CheckLuaFunction(L, 1); + + if (count == 1) + { + Delegate arg1 = DelegateTraits.Create(func); + ToLua.Push(L, arg1); + } + else + { + LuaTable self = ToLua.CheckLuaTable(L, 2); + Delegate arg1 = DelegateTraits.Create(func, self); + ToLua.Push(L, arg1); + } + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int UnityEngine_RectTransform_ReapplyDrivenProperties(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + LuaFunction func = ToLua.CheckLuaFunction(L, 1); + + if (count == 1) + { + Delegate arg1 = DelegateTraits.Create(func); + ToLua.Push(L, arg1); + } + else + { + LuaTable self = ToLua.CheckLuaTable(L, 2); + Delegate arg1 = DelegateTraits.Create(func, self); + ToLua.Push(L, arg1); + } + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int System_Action(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + LuaFunction func = ToLua.CheckLuaFunction(L, 1); + + if (count == 1) + { + Delegate arg1 = DelegateTraits.Create(func); + ToLua.Push(L, arg1); + } + else + { + LuaTable self = ToLua.CheckLuaTable(L, 2); + Delegate arg1 = DelegateTraits.Create(func, self); + ToLua.Push(L, arg1); + } + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int System_Predicate_int(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + LuaFunction func = ToLua.CheckLuaFunction(L, 1); + + if (count == 1) + { + Delegate arg1 = DelegateTraits>.Create(func); + ToLua.Push(L, arg1); + } + else + { + LuaTable self = ToLua.CheckLuaTable(L, 2); + Delegate arg1 = DelegateTraits>.Create(func, self); + ToLua.Push(L, arg1); + } + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int System_Action_int(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + LuaFunction func = ToLua.CheckLuaFunction(L, 1); + + if (count == 1) + { + Delegate arg1 = DelegateTraits>.Create(func); + ToLua.Push(L, arg1); + } + else + { + LuaTable self = ToLua.CheckLuaTable(L, 2); + Delegate arg1 = DelegateTraits>.Create(func, self); + ToLua.Push(L, arg1); + } + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int System_Comparison_int(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + LuaFunction func = ToLua.CheckLuaFunction(L, 1); + + if (count == 1) + { + Delegate arg1 = DelegateTraits>.Create(func); + ToLua.Push(L, arg1); + } + else + { + LuaTable self = ToLua.CheckLuaTable(L, 2); + Delegate arg1 = DelegateTraits>.Create(func, self); + ToLua.Push(L, arg1); + } + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int System_Func_int_int(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + LuaFunction func = ToLua.CheckLuaFunction(L, 1); + + if (count == 1) + { + Delegate arg1 = DelegateTraits>.Create(func); + ToLua.Push(L, arg1); + } + else + { + LuaTable self = ToLua.CheckLuaTable(L, 2); + Delegate arg1 = DelegateTraits>.Create(func, self); + ToLua.Push(L, arg1); + } + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int System_Action_bool(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + LuaFunction func = ToLua.CheckLuaFunction(L, 1); + + if (count == 1) + { + Delegate arg1 = DelegateTraits>.Create(func); + ToLua.Push(L, arg1); + } + else + { + LuaTable self = ToLua.CheckLuaTable(L, 2); + Delegate arg1 = DelegateTraits>.Create(func, self); + ToLua.Push(L, arg1); + } + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int System_Action_string(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + LuaFunction func = ToLua.CheckLuaFunction(L, 1); + + if (count == 1) + { + Delegate arg1 = DelegateTraits>.Create(func); + ToLua.Push(L, arg1); + } + else + { + LuaTable self = ToLua.CheckLuaTable(L, 2); + Delegate arg1 = DelegateTraits>.Create(func, self); + ToLua.Push(L, arg1); + } + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int System_Func_bool(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + LuaFunction func = ToLua.CheckLuaFunction(L, 1); + + if (count == 1) + { + Delegate arg1 = DelegateTraits>.Create(func); + ToLua.Push(L, arg1); + } + else + { + LuaTable self = ToLua.CheckLuaTable(L, 2); + Delegate arg1 = DelegateTraits>.Create(func, self); + ToLua.Push(L, arg1); + } + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int System_Action_UnityEngine_AsyncOperation(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + LuaFunction func = ToLua.CheckLuaFunction(L, 1); + + if (count == 1) + { + Delegate arg1 = DelegateTraits>.Create(func); + ToLua.Push(L, arg1); + } + else + { + LuaTable self = ToLua.CheckLuaTable(L, 2); + Delegate arg1 = DelegateTraits>.Create(func, self); + ToLua.Push(L, arg1); + } + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LuaOpen_UnityEngine_BoxCollider(IntPtr L) + { + try + { + LuaState state = LuaState.Get(L); + state.BeginPreModule("UnityEngine"); + UnityEngine_BoxColliderWrap.Register(state); + int reference = state.GetMetaReference(typeof(UnityEngine.BoxCollider)); + state.EndPreModule(L, reference); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LuaOpen_UnityEngine_MeshCollider(IntPtr L) + { + try + { + LuaState state = LuaState.Get(L); + state.BeginPreModule("UnityEngine"); + UnityEngine_MeshColliderWrap.Register(state); + int reference = state.GetMetaReference(typeof(UnityEngine.MeshCollider)); + state.EndPreModule(L, reference); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LuaOpen_UnityEngine_SphereCollider(IntPtr L) + { + try + { + LuaState state = LuaState.Get(L); + state.BeginPreModule("UnityEngine"); + UnityEngine_SphereColliderWrap.Register(state); + int reference = state.GetMetaReference(typeof(UnityEngine.SphereCollider)); + state.EndPreModule(L, reference); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LuaOpen_UnityEngine_CharacterController(IntPtr L) + { + try + { + LuaState state = LuaState.Get(L); + state.BeginPreModule("UnityEngine"); + UnityEngine_CharacterControllerWrap.Register(state); + int reference = state.GetMetaReference(typeof(UnityEngine.CharacterController)); + state.EndPreModule(L, reference); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LuaOpen_UnityEngine_CapsuleCollider(IntPtr L) + { + try + { + LuaState state = LuaState.Get(L); + state.BeginPreModule("UnityEngine"); + UnityEngine_CapsuleColliderWrap.Register(state); + int reference = state.GetMetaReference(typeof(UnityEngine.CapsuleCollider)); + state.EndPreModule(L, reference); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LuaOpen_UnityEngine_Animation(IntPtr L) + { + try + { + LuaState state = LuaState.Get(L); + state.BeginPreModule("UnityEngine"); + UnityEngine_AnimationWrap.Register(state); + int reference = state.GetMetaReference(typeof(UnityEngine.Animation)); + state.EndPreModule(L, reference); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LuaOpen_UnityEngine_AnimationClip(IntPtr L) + { + try + { + LuaState state = LuaState.Get(L); + state.BeginPreModule("UnityEngine"); + UnityEngine_AnimationClipWrap.Register(state); + int reference = state.GetMetaReference(typeof(UnityEngine.AnimationClip)); + state.EndPreModule(L, reference); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LuaOpen_UnityEngine_AnimationState(IntPtr L) + { + try + { + LuaState state = LuaState.Get(L); + state.BeginPreModule("UnityEngine"); + UnityEngine_AnimationStateWrap.Register(state); + int reference = state.GetMetaReference(typeof(UnityEngine.AnimationState)); + state.EndPreModule(L, reference); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LuaOpen_UnityEngine_SkinWeights(IntPtr L) + { + try + { + LuaState state = LuaState.Get(L); + state.BeginPreModule("UnityEngine"); + UnityEngine_SkinWeightsWrap.Register(state); + int reference = state.GetMetaReference(typeof(UnityEngine.SkinWeights)); + state.EndPreModule(L, reference); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LuaOpen_UnityEngine_RenderTexture(IntPtr L) + { + try + { + LuaState state = LuaState.Get(L); + state.BeginPreModule("UnityEngine"); + UnityEngine_RenderTextureWrap.Register(state); + int reference = state.GetMetaReference(typeof(UnityEngine.RenderTexture)); + state.EndPreModule(L, reference); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LuaOpen_UnityEngine_Rigidbody(IntPtr L) + { + try + { + LuaState state = LuaState.Get(L); + state.BeginPreModule("UnityEngine"); + UnityEngine_RigidbodyWrap.Register(state); + int reference = state.GetMetaReference(typeof(UnityEngine.Rigidbody)); + state.EndPreModule(L, reference); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/LuaBinder.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/LuaBinder.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..cf7a224331ce561f9ff74e412927f769ea97dfe8 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/LuaBinder.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9621a0179b692cd46b020b1de545ebed +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_AppConstWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_AppConstWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..1a5e2609a49d01cb364b53a180ab830d3ccfd602 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_AppConstWrap.cs @@ -0,0 +1,102 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class LuaFramework_AppConstWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(LuaFramework.AppConst), typeof(System.Object)); + L.RegFunction("New", _CreateLuaFramework_AppConst); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegConstant("LuaBundleMode", 0); + L.RegConstant("GameFrameRate", 30); + L.RegVar("AssetDir", get_AssetDir, null); + L.RegVar("WebUrl", get_WebUrl, null); + L.RegVar("SocketAddress", get_SocketAddress, null); + L.RegConstant("SocketPort", 0); + L.RegVar("FrameworkRoot", get_FrameworkRoot, null); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateLuaFramework_AppConst(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + LuaFramework.AppConst obj = new LuaFramework.AppConst(); + ToLua.PushObject(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: LuaFramework.AppConst.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_AssetDir(IntPtr L) + { + try + { + LuaDLL.lua_pushstring(L, LuaFramework.AppConst.AssetDir); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_WebUrl(IntPtr L) + { + try + { + LuaDLL.lua_pushstring(L, LuaFramework.AppConst.WebUrl); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_SocketAddress(IntPtr L) + { + try + { + LuaDLL.lua_pushstring(L, LuaFramework.AppConst.SocketAddress); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_FrameworkRoot(IntPtr L) + { + try + { + LuaDLL.lua_pushstring(L, LuaFramework.AppConst.FrameworkRoot); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_AppConstWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_AppConstWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..a9e3d48df8357c6052300fc87a62777663836f27 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_AppConstWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 12053727c4d4eb54eaf50a17dd95022c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_ByteBufferWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_ByteBufferWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..4a91bf5ceacb49c54db324932b35ffd489d12aad --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_ByteBufferWrap.cs @@ -0,0 +1,422 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class LuaFramework_ByteBufferWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(LuaFramework.ByteBuffer), typeof(System.Object)); + L.RegFunction("Close", Close); + L.RegFunction("WriteByte", WriteByte); + L.RegFunction("WriteInt", WriteInt); + L.RegFunction("WriteShort", WriteShort); + L.RegFunction("WriteLong", WriteLong); + L.RegFunction("WriteFloat", WriteFloat); + L.RegFunction("WriteDouble", WriteDouble); + L.RegFunction("WriteString", WriteString); + L.RegFunction("WriteBytes", WriteBytes); + L.RegFunction("WriteBuffer", WriteBuffer); + L.RegFunction("ReadByte", ReadByte); + L.RegFunction("ReadInt", ReadInt); + L.RegFunction("ReadShort", ReadShort); + L.RegFunction("ReadLong", ReadLong); + L.RegFunction("ReadFloat", ReadFloat); + L.RegFunction("ReadDouble", ReadDouble); + L.RegFunction("ReadString", ReadString); + L.RegFunction("ReadBytes", ReadBytes); + L.RegFunction("ReadBuffer", ReadBuffer); + L.RegFunction("ToBytes", ToBytes); + L.RegFunction("Flush", Flush); + L.RegFunction("New", _CreateLuaFramework_ByteBuffer); + L.RegFunction("__tostring", ToLua.op_ToString); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateLuaFramework_ByteBuffer(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + LuaFramework.ByteBuffer obj = new LuaFramework.ByteBuffer(); + ToLua.PushObject(L, obj); + return 1; + } + else if (count == 1) + { + byte[] arg0 = ToLua.CheckByteBuffer(L, 1); + LuaFramework.ByteBuffer obj = new LuaFramework.ByteBuffer(arg0); + ToLua.PushObject(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: LuaFramework.ByteBuffer.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Close(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + LuaFramework.ByteBuffer obj = (LuaFramework.ByteBuffer)ToLua.CheckObject(L, 1); + obj.Close(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int WriteByte(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + LuaFramework.ByteBuffer obj = (LuaFramework.ByteBuffer)ToLua.CheckObject(L, 1); + byte arg0 = (byte)LuaDLL.luaL_checknumber(L, 2); + obj.WriteByte(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int WriteInt(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + LuaFramework.ByteBuffer obj = (LuaFramework.ByteBuffer)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.WriteInt(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int WriteShort(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + LuaFramework.ByteBuffer obj = (LuaFramework.ByteBuffer)ToLua.CheckObject(L, 1); + ushort arg0 = (ushort)LuaDLL.luaL_checknumber(L, 2); + obj.WriteShort(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int WriteLong(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + LuaFramework.ByteBuffer obj = (LuaFramework.ByteBuffer)ToLua.CheckObject(L, 1); + long arg0 = LuaDLL.tolua_checkint64(L, 2); + obj.WriteLong(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int WriteFloat(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + LuaFramework.ByteBuffer obj = (LuaFramework.ByteBuffer)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.WriteFloat(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int WriteDouble(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + LuaFramework.ByteBuffer obj = (LuaFramework.ByteBuffer)ToLua.CheckObject(L, 1); + double arg0 = (double)LuaDLL.luaL_checknumber(L, 2); + obj.WriteDouble(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int WriteString(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + LuaFramework.ByteBuffer obj = (LuaFramework.ByteBuffer)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + obj.WriteString(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int WriteBytes(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + LuaFramework.ByteBuffer obj = (LuaFramework.ByteBuffer)ToLua.CheckObject(L, 1); + byte[] arg0 = ToLua.CheckByteBuffer(L, 2); + obj.WriteBytes(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int WriteBuffer(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + LuaFramework.ByteBuffer obj = (LuaFramework.ByteBuffer)ToLua.CheckObject(L, 1); + LuaByteBuffer arg0 = new LuaByteBuffer(ToLua.CheckByteBuffer(L, 2)); + obj.WriteBuffer(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ReadByte(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + LuaFramework.ByteBuffer obj = (LuaFramework.ByteBuffer)ToLua.CheckObject(L, 1); + byte o = obj.ReadByte(); + LuaDLL.lua_pushnumber(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ReadInt(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + LuaFramework.ByteBuffer obj = (LuaFramework.ByteBuffer)ToLua.CheckObject(L, 1); + int o = obj.ReadInt(); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ReadShort(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + LuaFramework.ByteBuffer obj = (LuaFramework.ByteBuffer)ToLua.CheckObject(L, 1); + ushort o = obj.ReadShort(); + LuaDLL.lua_pushnumber(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ReadLong(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + LuaFramework.ByteBuffer obj = (LuaFramework.ByteBuffer)ToLua.CheckObject(L, 1); + long o = obj.ReadLong(); + LuaDLL.tolua_pushint64(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ReadFloat(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + LuaFramework.ByteBuffer obj = (LuaFramework.ByteBuffer)ToLua.CheckObject(L, 1); + float o = obj.ReadFloat(); + LuaDLL.lua_pushnumber(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ReadDouble(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + LuaFramework.ByteBuffer obj = (LuaFramework.ByteBuffer)ToLua.CheckObject(L, 1); + double o = obj.ReadDouble(); + LuaDLL.lua_pushnumber(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ReadString(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + LuaFramework.ByteBuffer obj = (LuaFramework.ByteBuffer)ToLua.CheckObject(L, 1); + string o = obj.ReadString(); + LuaDLL.lua_pushstring(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ReadBytes(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + LuaFramework.ByteBuffer obj = (LuaFramework.ByteBuffer)ToLua.CheckObject(L, 1); + byte[] o = obj.ReadBytes(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ReadBuffer(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + LuaFramework.ByteBuffer obj = (LuaFramework.ByteBuffer)ToLua.CheckObject(L, 1); + LuaInterface.LuaByteBuffer o = obj.ReadBuffer(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ToBytes(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + LuaFramework.ByteBuffer obj = (LuaFramework.ByteBuffer)ToLua.CheckObject(L, 1); + byte[] o = obj.ToBytes(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Flush(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + LuaFramework.ByteBuffer obj = (LuaFramework.ByteBuffer)ToLua.CheckObject(L, 1); + obj.Flush(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_ByteBufferWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_ByteBufferWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..42f6d832907020e73e6ebc987704a349dd3f1d9b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_ByteBufferWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7b2d883bd4302e6468bfceafb2289e5b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_GameManagerWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_GameManagerWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..0e65bb82842f15ceadbf1697ad976bfaa05c33f6 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_GameManagerWrap.cs @@ -0,0 +1,33 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class LuaFramework_GameManagerWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(LuaFramework.GameManager), typeof(Manager)); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_GameManagerWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_GameManagerWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..ba92d663e8c0015b15c2cffbf30ea4eea812a038 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_GameManagerWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 91f32d4e453520f4e9a8f721fced8f04 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_LuaHelperWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_LuaHelperWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..6879c15a0ffb903a757a4b49d0c72e019e56db1e --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_LuaHelperWrap.cs @@ -0,0 +1,101 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class LuaFramework_LuaHelperWrap +{ + public static void Register(LuaState L) + { + L.BeginStaticLibs("LuaHelper"); + L.RegFunction("GetType", GetType); + L.RegFunction("GetNetManager", GetNetManager); + L.RegFunction("GetLuaManager", GetLuaManager); + L.RegFunction("OnCallLuaFunc", OnCallLuaFunc); + L.RegFunction("OnJsonCallFunc", OnJsonCallFunc); + L.EndStaticLibs(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetType(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + System.Type o = LuaFramework.LuaHelper.GetType(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetNetManager(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 0); + LuaFramework.NetworkManager o = LuaFramework.LuaHelper.GetNetManager(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetLuaManager(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 0); + LuaFramework.LuaManager o = LuaFramework.LuaHelper.GetLuaManager(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OnCallLuaFunc(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + LuaByteBuffer arg0 = new LuaByteBuffer(ToLua.CheckByteBuffer(L, 1)); + LuaFunction arg1 = ToLua.CheckLuaFunction(L, 2); + LuaFramework.LuaHelper.OnCallLuaFunc(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OnJsonCallFunc(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + string arg0 = ToLua.CheckString(L, 1); + LuaFunction arg1 = ToLua.CheckLuaFunction(L, 2); + LuaFramework.LuaHelper.OnJsonCallFunc(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_LuaHelperWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_LuaHelperWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..aa4389710e77e40a832e8b3f0c87264e612649d5 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_LuaHelperWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 19f13cf7fe07ada4e9b1a887078f6d89 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_LuaManagerWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_LuaManagerWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..7b44f877658cdb7529e1b048c62bfd7311c3e048 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_LuaManagerWrap.cs @@ -0,0 +1,158 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class LuaFramework_LuaManagerWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(LuaFramework.LuaManager), typeof(Manager)); + L.RegFunction("InitStart", InitStart); + L.RegFunction("DoFile", DoFile); + L.RegFunction("CallFunction", CallFunction); + L.RegFunction("GetFunction", GetFunction); + L.RegFunction("LuaGC", LuaGC); + L.RegFunction("Close", Close); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int InitStart(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + LuaFramework.LuaManager obj = (LuaFramework.LuaManager)ToLua.CheckObject(L, 1); + obj.InitStart(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int DoFile(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + LuaFramework.LuaManager obj = (LuaFramework.LuaManager)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + obj.DoFile(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CallFunction(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + LuaFramework.LuaManager obj = (LuaFramework.LuaManager)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + object[] arg1 = ToLua.ToParamsObject(L, 3, count - 2); + object[] o = obj.CallFunction(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetFunction(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + LuaFramework.LuaManager obj = (LuaFramework.LuaManager)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + LuaInterface.LuaFunction o = obj.GetFunction(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 3) + { + LuaFramework.LuaManager obj = (LuaFramework.LuaManager)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + bool arg1 = LuaDLL.luaL_checkboolean(L, 3); + LuaInterface.LuaFunction o = obj.GetFunction(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: LuaFramework.LuaManager.GetFunction"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LuaGC(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + LuaFramework.LuaManager obj = (LuaFramework.LuaManager)ToLua.CheckObject(L, 1); + obj.LuaGC(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Close(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + LuaFramework.LuaManager obj = (LuaFramework.LuaManager)ToLua.CheckObject(L, 1); + obj.Close(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_LuaManagerWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_LuaManagerWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..158c13b86d5e28c65382004968bc6885ddbcacde --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_LuaManagerWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 42db24912c4e38b40af756674d512d55 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_NetworkManagerWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_NetworkManagerWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..2385d511a6de73085157d11c302ec9c2cb5c0485 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_NetworkManagerWrap.cs @@ -0,0 +1,180 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class LuaFramework_NetworkManagerWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(LuaFramework.NetworkManager), typeof(Manager)); + L.RegFunction("OnInit", OnInit); + L.RegFunction("Unload", Unload); + L.RegFunction("CallMethod", CallMethod); + L.RegFunction("AddEvent", AddEvent); + L.RegFunction("SendConnect", SendConnect); + L.RegFunction("SendMessage", SendMessage); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OnInit(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + LuaFramework.NetworkManager obj = (LuaFramework.NetworkManager)ToLua.CheckObject(L, 1); + obj.OnInit(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Unload(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + LuaFramework.NetworkManager obj = (LuaFramework.NetworkManager)ToLua.CheckObject(L, 1); + obj.Unload(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CallMethod(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + LuaFramework.NetworkManager obj = (LuaFramework.NetworkManager)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + object[] arg1 = ToLua.ToParamsObject(L, 3, count - 2); + object[] o = obj.CallMethod(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int AddEvent(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + LuaFramework.ByteBuffer arg1 = (LuaFramework.ByteBuffer)ToLua.CheckObject(L, 2); + LuaFramework.NetworkManager.AddEvent(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SendConnect(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + LuaFramework.NetworkManager obj = (LuaFramework.NetworkManager)ToLua.CheckObject(L, 1); + obj.SendConnect(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SendMessage(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + LuaFramework.NetworkManager obj = (LuaFramework.NetworkManager)ToLua.CheckObject(L, 1); + LuaFramework.ByteBuffer arg0 = (LuaFramework.ByteBuffer)ToLua.ToObject(L, 2); + obj.SendMessage(arg0); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + LuaFramework.NetworkManager obj = (LuaFramework.NetworkManager)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + obj.SendMessage(arg0); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 3)) + { + LuaFramework.NetworkManager obj = (LuaFramework.NetworkManager)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + UnityEngine.SendMessageOptions arg1 = (UnityEngine.SendMessageOptions)ToLua.ToObject(L, 3); + obj.SendMessage(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 3)) + { + LuaFramework.NetworkManager obj = (LuaFramework.NetworkManager)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + object arg1 = ToLua.ToVarObject(L, 3); + obj.SendMessage(arg0, arg1); + return 0; + } + else if (count == 4) + { + LuaFramework.NetworkManager obj = (LuaFramework.NetworkManager)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + object arg1 = ToLua.ToVarObject(L, 3); + UnityEngine.SendMessageOptions arg2 = (UnityEngine.SendMessageOptions)ToLua.CheckObject(L, 4, typeof(UnityEngine.SendMessageOptions)); + obj.SendMessage(arg0, arg1, arg2); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: LuaFramework.NetworkManager.SendMessage"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_NetworkManagerWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_NetworkManagerWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..7080659d591880732593334a10206d8bb02ed2dd --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_NetworkManagerWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5e8db245196c8d64c84634e02befa1df +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_UtilWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_UtilWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..45dfd91317e8db5349d99149df984deb07a981ac --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_UtilWrap.cs @@ -0,0 +1,473 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class LuaFramework_UtilWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(LuaFramework.Util), typeof(System.Object)); + L.RegFunction("Int", Int); + L.RegFunction("Float", Float); + L.RegFunction("Long", Long); + L.RegFunction("Random", Random); + L.RegFunction("Uid", Uid); + L.RegFunction("GetTime", GetTime); + L.RegFunction("Child", Child); + L.RegFunction("Peer", Peer); + L.RegFunction("md5", md5); + L.RegFunction("md5file", md5file); + L.RegFunction("ClearChild", ClearChild); + L.RegFunction("ClearMemory", ClearMemory); + L.RegFunction("GetFileText", GetFileText); + L.RegFunction("AppContentPath", AppContentPath); + L.RegFunction("Log", Log); + L.RegFunction("LogWarning", LogWarning); + L.RegFunction("LogError", LogError); + L.RegFunction("CheckRuntimeFile", CheckRuntimeFile); + L.RegFunction("CallMethod", CallMethod); + L.RegFunction("RecordStartTime", RecordStartTime); + L.RegFunction("EndRecordTime", EndRecordTime); + L.RegFunction("New", _CreateLuaFramework_Util); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("NetAvailable", get_NetAvailable, null); + L.RegVar("IsWifi", get_IsWifi, null); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateLuaFramework_Util(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + LuaFramework.Util obj = new LuaFramework.Util(); + ToLua.PushObject(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: LuaFramework.Util.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Int(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + object arg0 = ToLua.ToVarObject(L, 1); + int o = LuaFramework.Util.Int(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Float(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + object arg0 = ToLua.ToVarObject(L, 1); + float o = LuaFramework.Util.Float(arg0); + LuaDLL.lua_pushnumber(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Long(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + object arg0 = ToLua.ToVarObject(L, 1); + long o = LuaFramework.Util.Long(arg0); + LuaDLL.tolua_pushint64(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Random(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 1); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 2); + float o = LuaFramework.Util.Random(arg0, arg1); + LuaDLL.lua_pushnumber(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Uid(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + string o = LuaFramework.Util.Uid(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetTime(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 0); + long o = LuaFramework.Util.GetTime(); + LuaDLL.tolua_pushint64(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Child(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.ToObject(L, 1); + string arg1 = ToLua.ToString(L, 2); + UnityEngine.GameObject o = LuaFramework.Util.Child(arg0, arg1); + ToLua.PushSealed(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.ToObject(L, 1); + string arg1 = ToLua.ToString(L, 2); + UnityEngine.GameObject o = LuaFramework.Util.Child(arg0, arg1); + ToLua.PushSealed(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: LuaFramework.Util.Child"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Peer(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.ToObject(L, 1); + string arg1 = ToLua.ToString(L, 2); + UnityEngine.GameObject o = LuaFramework.Util.Peer(arg0, arg1); + ToLua.PushSealed(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.ToObject(L, 1); + string arg1 = ToLua.ToString(L, 2); + UnityEngine.GameObject o = LuaFramework.Util.Peer(arg0, arg1); + ToLua.PushSealed(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: LuaFramework.Util.Peer"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int md5(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + string o = LuaFramework.Util.md5(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int md5file(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + string o = LuaFramework.Util.md5file(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ClearChild(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + LuaFramework.Util.ClearChild(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ClearMemory(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 0); + LuaFramework.Util.ClearMemory(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetFileText(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + string o = LuaFramework.Util.GetFileText(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int AppContentPath(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 0); + string o = LuaFramework.Util.AppContentPath(); + LuaDLL.lua_pushstring(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Log(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + LuaFramework.Util.Log(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LogWarning(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + LuaFramework.Util.LogWarning(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LogError(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + LuaFramework.Util.LogError(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CheckRuntimeFile(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 0); + int o = LuaFramework.Util.CheckRuntimeFile(); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CallMethod(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + string arg0 = ToLua.CheckString(L, 1); + string arg1 = ToLua.CheckString(L, 2); + object[] arg2 = ToLua.ToParamsObject(L, 3, count - 2); + object[] o = LuaFramework.Util.CallMethod(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int RecordStartTime(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + LuaFramework.Util.RecordStartTime(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int EndRecordTime(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + LuaFramework.Util.EndRecordTime(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_NetAvailable(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, LuaFramework.Util.NetAvailable); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_IsWifi(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, LuaFramework.Util.IsWifi); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_UtilWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_UtilWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..e2c85351a04998ed8f3aa691c1fc7dbe59547527 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/LuaFramework_UtilWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ef35a3688a7059548b9223356735d56d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/LuaInterface_DebuggerWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/LuaInterface_DebuggerWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..151219ac32477c311f37349892fb402b26f0aef6 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/LuaInterface_DebuggerWrap.cs @@ -0,0 +1,321 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class LuaInterface_DebuggerWrap +{ + public static void Register(LuaState L) + { + L.BeginStaticLibs("Debugger"); + L.RegFunction("Log", Log); + L.RegFunction("LogWarning", LogWarning); + L.RegFunction("LogError", LogError); + L.RegFunction("LogException", LogException); + L.RegVar("useLog", get_useLog, set_useLog); + L.RegVar("threadStack", get_threadStack, set_threadStack); + L.RegVar("logger", get_logger, set_logger); + L.EndStaticLibs(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Log(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + LuaInterface.Debugger.Log(arg0); + return 0; + } + else if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + object arg0 = ToLua.ToVarObject(L, 1); + LuaInterface.Debugger.Log(arg0); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + object arg1 = ToLua.ToVarObject(L, 2); + LuaInterface.Debugger.Log(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + object arg1 = ToLua.ToVarObject(L, 2); + object arg2 = ToLua.ToVarObject(L, 3); + LuaInterface.Debugger.Log(arg0, arg1, arg2); + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + object arg1 = ToLua.ToVarObject(L, 2); + object arg2 = ToLua.ToVarObject(L, 3); + object arg3 = ToLua.ToVarObject(L, 4); + LuaInterface.Debugger.Log(arg0, arg1, arg2, arg3); + return 0; + } + else if (TypeChecker.CheckTypes(L, 1) && TypeChecker.CheckParamsType(L, 2, count - 1)) + { + string arg0 = ToLua.ToString(L, 1); + object[] arg1 = ToLua.ToParamsObject(L, 2, count - 1); + LuaInterface.Debugger.Log(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: LuaInterface.Debugger.Log"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LogWarning(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + LuaInterface.Debugger.LogWarning(arg0); + return 0; + } + else if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + object arg0 = ToLua.ToVarObject(L, 1); + LuaInterface.Debugger.LogWarning(arg0); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + object arg1 = ToLua.ToVarObject(L, 2); + LuaInterface.Debugger.LogWarning(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + object arg1 = ToLua.ToVarObject(L, 2); + object arg2 = ToLua.ToVarObject(L, 3); + LuaInterface.Debugger.LogWarning(arg0, arg1, arg2); + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + object arg1 = ToLua.ToVarObject(L, 2); + object arg2 = ToLua.ToVarObject(L, 3); + object arg3 = ToLua.ToVarObject(L, 4); + LuaInterface.Debugger.LogWarning(arg0, arg1, arg2, arg3); + return 0; + } + else if (TypeChecker.CheckTypes(L, 1) && TypeChecker.CheckParamsType(L, 2, count - 1)) + { + string arg0 = ToLua.ToString(L, 1); + object[] arg1 = ToLua.ToParamsObject(L, 2, count - 1); + LuaInterface.Debugger.LogWarning(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: LuaInterface.Debugger.LogWarning"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LogError(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + LuaInterface.Debugger.LogError(arg0); + return 0; + } + else if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + object arg0 = ToLua.ToVarObject(L, 1); + LuaInterface.Debugger.LogError(arg0); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + object arg1 = ToLua.ToVarObject(L, 2); + LuaInterface.Debugger.LogError(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + object arg1 = ToLua.ToVarObject(L, 2); + object arg2 = ToLua.ToVarObject(L, 3); + LuaInterface.Debugger.LogError(arg0, arg1, arg2); + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + object arg1 = ToLua.ToVarObject(L, 2); + object arg2 = ToLua.ToVarObject(L, 3); + object arg3 = ToLua.ToVarObject(L, 4); + LuaInterface.Debugger.LogError(arg0, arg1, arg2, arg3); + return 0; + } + else if (TypeChecker.CheckTypes(L, 1) && TypeChecker.CheckParamsType(L, 2, count - 1)) + { + string arg0 = ToLua.ToString(L, 1); + object[] arg1 = ToLua.ToParamsObject(L, 2, count - 1); + LuaInterface.Debugger.LogError(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: LuaInterface.Debugger.LogError"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LogException(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + System.Exception arg0 = (System.Exception)ToLua.CheckObject(L, 1); + LuaInterface.Debugger.LogException(arg0); + return 0; + } + else if (count == 2) + { + string arg0 = ToLua.CheckString(L, 1); + System.Exception arg1 = (System.Exception)ToLua.CheckObject(L, 2); + LuaInterface.Debugger.LogException(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: LuaInterface.Debugger.LogException"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_useLog(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, LuaInterface.Debugger.useLog); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_threadStack(IntPtr L) + { + try + { + LuaDLL.lua_pushstring(L, LuaInterface.Debugger.threadStack); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_logger(IntPtr L) + { + try + { + ToLua.PushObject(L, LuaInterface.Debugger.logger); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_useLog(IntPtr L) + { + try + { + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + LuaInterface.Debugger.useLog = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_threadStack(IntPtr L) + { + try + { + string arg0 = ToLua.CheckString(L, 2); + LuaInterface.Debugger.threadStack = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_logger(IntPtr L) + { + try + { + LuaInterface.ILogger arg0 = (LuaInterface.ILogger)ToLua.CheckObject(L, 2); + LuaInterface.Debugger.logger = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/LuaInterface_DebuggerWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/LuaInterface_DebuggerWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..dd42fa818e7232aa18cf22a7b6d2350f3ed80836 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/LuaInterface_DebuggerWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cfe9c15f63351ff40833a16961ae3370 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/LuaInterface_InjectTypeWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/LuaInterface_InjectTypeWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..96d2f0c74415acc11267114432c5dc58b70af5e6 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/LuaInterface_InjectTypeWrap.cs @@ -0,0 +1,83 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class LuaInterface_InjectTypeWrap +{ + public static void Register(LuaState L) + { + L.BeginEnum(typeof(LuaInterface.InjectType)); + L.RegVar("None", get_None, null); + L.RegVar("After", get_After, null); + L.RegVar("Before", get_Before, null); + L.RegVar("Replace", get_Replace, null); + L.RegVar("ReplaceWithPreInvokeBase", get_ReplaceWithPreInvokeBase, null); + L.RegVar("ReplaceWithPostInvokeBase", get_ReplaceWithPostInvokeBase, null); + L.RegFunction("IntToEnum", IntToEnum); + L.EndEnum(); + TypeTraits.Check = CheckType; + StackTraits.Push = Push; + } + + static void Push(IntPtr L, LuaInterface.InjectType arg) + { + ToLua.Push(L, arg); + } + + static bool CheckType(IntPtr L, int pos) + { + return TypeChecker.CheckEnumType(typeof(LuaInterface.InjectType), L, pos); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_None(IntPtr L) + { + ToLua.Push(L, LuaInterface.InjectType.None); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_After(IntPtr L) + { + ToLua.Push(L, LuaInterface.InjectType.After); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Before(IntPtr L) + { + ToLua.Push(L, LuaInterface.InjectType.Before); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Replace(IntPtr L) + { + ToLua.Push(L, LuaInterface.InjectType.Replace); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_ReplaceWithPreInvokeBase(IntPtr L) + { + ToLua.Push(L, LuaInterface.InjectType.ReplaceWithPreInvokeBase); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_ReplaceWithPostInvokeBase(IntPtr L) + { + ToLua.Push(L, LuaInterface.InjectType.ReplaceWithPostInvokeBase); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IntToEnum(IntPtr L) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + LuaInterface.InjectType o = (LuaInterface.InjectType)arg0; + ToLua.Push(L, o); + return 1; + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/LuaInterface_InjectTypeWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/LuaInterface_InjectTypeWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..f2f150b09c71f81db38b234342e429b28da1d700 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/LuaInterface_InjectTypeWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a9e6be05b5e816142b4eb946da639417 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/LuaInterface_LuaInjectionStationWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/LuaInterface_LuaInjectionStationWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..6226b180e0fd4b81f6ae0932d669f8be18a4f524 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/LuaInterface_LuaInjectionStationWrap.cs @@ -0,0 +1,60 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class LuaInterface_LuaInjectionStationWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(LuaInterface.LuaInjectionStation), typeof(System.Object)); + L.RegFunction("CacheInjectFunction", CacheInjectFunction); + L.RegFunction("New", _CreateLuaInterface_LuaInjectionStation); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegConstant("NOT_INJECTION_FLAG", 0); + L.RegConstant("INVALID_INJECTION_FLAG", 255); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateLuaInterface_LuaInjectionStation(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + LuaInterface.LuaInjectionStation obj = new LuaInterface.LuaInjectionStation(); + ToLua.PushObject(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: LuaInterface.LuaInjectionStation.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CacheInjectFunction(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + byte arg1 = (byte)LuaDLL.luaL_checknumber(L, 2); + LuaFunction arg2 = ToLua.CheckLuaFunction(L, 3); + LuaInterface.LuaInjectionStation.CacheInjectFunction(arg0, arg1, arg2); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/LuaInterface_LuaInjectionStationWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/LuaInterface_LuaInjectionStationWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..33e032863c2f10cb8c721c8e22b9e6ab0f32aefc --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/LuaInterface_LuaInjectionStationWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 522e22a845bf79544a8874add6345910 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/LuaProfilerWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/LuaProfilerWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..4c97798084e2832e3c018cdb39da22c5cc000f8b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/LuaProfilerWrap.cs @@ -0,0 +1,110 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class LuaProfilerWrap +{ + public static void Register(LuaState L) + { + L.BeginStaticLibs("LuaProfiler"); + L.RegFunction("Clear", Clear); + L.RegFunction("GetID", GetID); + L.RegFunction("BeginSample", BeginSample); + L.RegFunction("EndSample", EndSample); + L.RegVar("list", get_list, set_list); + L.EndStaticLibs(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Clear(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 0); + LuaProfiler.Clear(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetID(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + int o = LuaProfiler.GetID(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int BeginSample(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + LuaProfiler.BeginSample(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int EndSample(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 0); + LuaProfiler.EndSample(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_list(IntPtr L) + { + try + { + ToLua.PushSealed(L, LuaProfiler.list); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_list(IntPtr L) + { + try + { + System.Collections.Generic.List arg0 = (System.Collections.Generic.List)ToLua.CheckObject(L, 2, typeof(System.Collections.Generic.List)); + LuaProfiler.list = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/LuaProfilerWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/LuaProfilerWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..6c59a3ec159199dd82db34d78ffea1f03f956be2 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/LuaProfilerWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4e4b8d8c159ffc34f9429b2bf212bc83 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/ManagerWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/ManagerWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..2550adda6d229ff987eb68c6246172e68bd7bdf6 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/ManagerWrap.cs @@ -0,0 +1,33 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class ManagerWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(Manager), typeof(Base)); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/ManagerWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/ManagerWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..d0392e66feec7e4af16ad8aa4adbe8103dec0b9d --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/ManagerWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 19eda49cf563ec3449e037d276a73425 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/PanelMgrWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/PanelMgrWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..63534ec1dd13beea337bf0270c412d68155bf3ff --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/PanelMgrWrap.cs @@ -0,0 +1,145 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class PanelMgrWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(PanelMgr), typeof(System.Object)); + L.RegFunction("Init", Init); + L.RegFunction("ShowPanel", ShowPanel); + L.RegFunction("InstantiateUI", InstantiateUI); + L.RegFunction("HidePanel", HidePanel); + L.RegFunction("HideAllPanels", HideAllPanels); + L.RegFunction("New", _CreatePanelMgr); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("instance", get_instance, null); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreatePanelMgr(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + PanelMgr obj = new PanelMgr(); + ToLua.PushObject(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: PanelMgr.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Init(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + PanelMgr obj = (PanelMgr)ToLua.CheckObject(L, 1); + obj.Init(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ShowPanel(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + PanelMgr obj = (PanelMgr)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + BasePanel o = obj.ShowPanel(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int InstantiateUI(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + PanelMgr obj = (PanelMgr)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.GameObject o = obj.InstantiateUI(arg0); + ToLua.PushSealed(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int HidePanel(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + PanelMgr obj = (PanelMgr)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + obj.HidePanel(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int HideAllPanels(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + PanelMgr obj = (PanelMgr)ToLua.CheckObject(L, 1); + obj.HideAllPanels(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_instance(IntPtr L) + { + try + { + ToLua.PushObject(L, PanelMgr.instance); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/PanelMgrWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/PanelMgrWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..2904055f99fd5dfda30165fdd255f59168dee0b7 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/PanelMgrWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 584f5f58602edae4aae504d5f31fc978 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/PrefabObjBinderWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/PrefabObjBinderWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..86877033eebcedf13055537717037e588b22bc78 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/PrefabObjBinderWrap.cs @@ -0,0 +1,151 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class PrefabObjBinderWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(PrefabObjBinder), typeof(UnityEngine.MonoBehaviour)); + L.RegFunction("GetObj", GetObj); + L.RegFunction("SetBtnClick", SetBtnClick); + L.RegFunction("SetText", SetText); + L.RegFunction("SetToggle", SetToggle); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("items", get_items, set_items); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetObj(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + PrefabObjBinder obj = (PrefabObjBinder)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + UnityEngine.Object o = obj.GetObj(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetBtnClick(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + PrefabObjBinder obj = (PrefabObjBinder)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + System.Action arg1 = (System.Action)ToLua.CheckDelegate(L, 3); + UnityEngine.UI.Button o = obj.SetBtnClick(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetText(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + PrefabObjBinder obj = (PrefabObjBinder)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + string arg1 = ToLua.CheckString(L, 3); + UnityEngine.UI.Text o = obj.SetText(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetToggle(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + PrefabObjBinder obj = (PrefabObjBinder)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + System.Action arg1 = (System.Action)ToLua.CheckDelegate>(L, 3); + UnityEngine.UI.Toggle o = obj.SetToggle(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_items(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + PrefabObjBinder obj = (PrefabObjBinder)o; + PrefabObjBinder.Item[] ret = obj.items; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index items on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_items(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + PrefabObjBinder obj = (PrefabObjBinder)o; + PrefabObjBinder.Item[] arg0 = ToLua.CheckObjectArray(L, 2); + obj.items = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index items on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/PrefabObjBinderWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/PrefabObjBinderWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..60a648704466b90681beeeb648c9ce7225cf28b2 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/PrefabObjBinderWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 40cb8a487b0e4844bb415dab4762e9c4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/ResourceMgrWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/ResourceMgrWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..31d4ace3ce7f2a61fd710b7f46d4d3f8fcdc37b5 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/ResourceMgrWrap.cs @@ -0,0 +1,146 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class ResourceMgrWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(ResourceMgr), typeof(System.Object)); + L.RegFunction("PreloadBaseBundle", PreloadBaseBundle); + L.RegFunction("PreloadLuaBundles", PreloadLuaBundles); + L.RegFunction("LoadCfgFile", LoadCfgFile); + L.RegFunction("GetAssetBundle", GetAssetBundle); + L.RegFunction("New", _CreateResourceMgr); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("updatePath", get_updatePath, null); + L.RegVar("instance", get_instance, null); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateResourceMgr(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + ResourceMgr obj = new ResourceMgr(); + ToLua.PushObject(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: ResourceMgr.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int PreloadBaseBundle(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + ResourceMgr obj = (ResourceMgr)ToLua.CheckObject(L, 1); + obj.PreloadBaseBundle(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int PreloadLuaBundles(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + ResourceMgr obj = (ResourceMgr)ToLua.CheckObject(L, 1); + obj.PreloadLuaBundles(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LoadCfgFile(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + ResourceMgr obj = (ResourceMgr)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + string o = obj.LoadCfgFile(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetAssetBundle(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + ResourceMgr obj = (ResourceMgr)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + UnityEngine.AssetBundle o = obj.GetAssetBundle(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_updatePath(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + ResourceMgr obj = (ResourceMgr)o; + string ret = obj.updatePath; + LuaDLL.lua_pushstring(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index updatePath on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_instance(IntPtr L) + { + try + { + ToLua.PushObject(L, ResourceMgr.instance); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/ResourceMgrWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/ResourceMgrWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..2dee0b902868a388be030fd26a57d99f6c62eff7 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/ResourceMgrWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6d1cd3704199bfd48b539e32aa8f82aa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AnimationBlendModeWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AnimationBlendModeWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..95d63866257caae865ded21ce99f03d9a2b40e3e --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AnimationBlendModeWrap.cs @@ -0,0 +1,51 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_AnimationBlendModeWrap +{ + public static void Register(LuaState L) + { + L.BeginEnum(typeof(UnityEngine.AnimationBlendMode)); + L.RegVar("Blend", get_Blend, null); + L.RegVar("Additive", get_Additive, null); + L.RegFunction("IntToEnum", IntToEnum); + L.EndEnum(); + TypeTraits.Check = CheckType; + StackTraits.Push = Push; + } + + static void Push(IntPtr L, UnityEngine.AnimationBlendMode arg) + { + ToLua.Push(L, arg); + } + + static bool CheckType(IntPtr L, int pos) + { + return TypeChecker.CheckEnumType(typeof(UnityEngine.AnimationBlendMode), L, pos); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Blend(IntPtr L) + { + ToLua.Push(L, UnityEngine.AnimationBlendMode.Blend); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Additive(IntPtr L) + { + ToLua.Push(L, UnityEngine.AnimationBlendMode.Additive); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IntToEnum(IntPtr L) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + UnityEngine.AnimationBlendMode o = (UnityEngine.AnimationBlendMode)arg0; + ToLua.Push(L, o); + return 1; + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AnimationBlendModeWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AnimationBlendModeWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..3badb489fc39660c8e3980244fcd2f51ad75ab7d --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AnimationBlendModeWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 341549ee1a47bb74fb898038a53f26ee +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AnimationClipWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AnimationClipWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..3d23a73702ea46dfc37a89d45f62e3f01c279393 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AnimationClipWrap.cs @@ -0,0 +1,485 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_AnimationClipWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.AnimationClip), typeof(UnityEngine.Object)); + L.RegFunction("SampleAnimation", SampleAnimation); + L.RegFunction("SetCurve", SetCurve); + L.RegFunction("EnsureQuaternionContinuity", EnsureQuaternionContinuity); + L.RegFunction("ClearCurves", ClearCurves); + L.RegFunction("AddEvent", AddEvent); + L.RegFunction("New", _CreateUnityEngine_AnimationClip); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("length", get_length, null); + L.RegVar("frameRate", get_frameRate, set_frameRate); + L.RegVar("wrapMode", get_wrapMode, set_wrapMode); + L.RegVar("localBounds", get_localBounds, set_localBounds); + L.RegVar("legacy", get_legacy, set_legacy); + L.RegVar("humanMotion", get_humanMotion, null); + L.RegVar("empty", get_empty, null); + L.RegVar("hasGenericRootTransform", get_hasGenericRootTransform, null); + L.RegVar("hasMotionFloatCurves", get_hasMotionFloatCurves, null); + L.RegVar("hasMotionCurves", get_hasMotionCurves, null); + L.RegVar("hasRootCurves", get_hasRootCurves, null); + L.RegVar("events", get_events, set_events); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateUnityEngine_AnimationClip(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + UnityEngine.AnimationClip obj = new UnityEngine.AnimationClip(); + ToLua.PushSealed(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.AnimationClip.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SampleAnimation(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.AnimationClip obj = (UnityEngine.AnimationClip)ToLua.CheckObject(L, 1, typeof(UnityEngine.AnimationClip)); + UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.CheckObject(L, 2, typeof(UnityEngine.GameObject)); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + obj.SampleAnimation(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetCurve(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 5); + UnityEngine.AnimationClip obj = (UnityEngine.AnimationClip)ToLua.CheckObject(L, 1, typeof(UnityEngine.AnimationClip)); + string arg0 = ToLua.CheckString(L, 2); + System.Type arg1 = ToLua.CheckMonoType(L, 3); + string arg2 = ToLua.CheckString(L, 4); + UnityEngine.AnimationCurve arg3 = (UnityEngine.AnimationCurve)ToLua.CheckObject(L, 5); + obj.SetCurve(arg0, arg1, arg2, arg3); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int EnsureQuaternionContinuity(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.AnimationClip obj = (UnityEngine.AnimationClip)ToLua.CheckObject(L, 1, typeof(UnityEngine.AnimationClip)); + obj.EnsureQuaternionContinuity(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ClearCurves(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.AnimationClip obj = (UnityEngine.AnimationClip)ToLua.CheckObject(L, 1, typeof(UnityEngine.AnimationClip)); + obj.ClearCurves(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int AddEvent(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.AnimationClip obj = (UnityEngine.AnimationClip)ToLua.CheckObject(L, 1, typeof(UnityEngine.AnimationClip)); + UnityEngine.AnimationEvent arg0 = (UnityEngine.AnimationEvent)ToLua.CheckObject(L, 2, typeof(UnityEngine.AnimationEvent)); + obj.AddEvent(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_length(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationClip obj = (UnityEngine.AnimationClip)o; + float ret = obj.length; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index length on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_frameRate(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationClip obj = (UnityEngine.AnimationClip)o; + float ret = obj.frameRate; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index frameRate on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_wrapMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationClip obj = (UnityEngine.AnimationClip)o; + UnityEngine.WrapMode ret = obj.wrapMode; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index wrapMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_localBounds(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationClip obj = (UnityEngine.AnimationClip)o; + UnityEngine.Bounds ret = obj.localBounds; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index localBounds on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_legacy(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationClip obj = (UnityEngine.AnimationClip)o; + bool ret = obj.legacy; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index legacy on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_humanMotion(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationClip obj = (UnityEngine.AnimationClip)o; + bool ret = obj.humanMotion; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index humanMotion on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_empty(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationClip obj = (UnityEngine.AnimationClip)o; + bool ret = obj.empty; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index empty on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_hasGenericRootTransform(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationClip obj = (UnityEngine.AnimationClip)o; + bool ret = obj.hasGenericRootTransform; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index hasGenericRootTransform on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_hasMotionFloatCurves(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationClip obj = (UnityEngine.AnimationClip)o; + bool ret = obj.hasMotionFloatCurves; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index hasMotionFloatCurves on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_hasMotionCurves(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationClip obj = (UnityEngine.AnimationClip)o; + bool ret = obj.hasMotionCurves; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index hasMotionCurves on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_hasRootCurves(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationClip obj = (UnityEngine.AnimationClip)o; + bool ret = obj.hasRootCurves; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index hasRootCurves on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_events(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationClip obj = (UnityEngine.AnimationClip)o; + UnityEngine.AnimationEvent[] ret = obj.events; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index events on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_frameRate(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationClip obj = (UnityEngine.AnimationClip)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.frameRate = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index frameRate on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_wrapMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationClip obj = (UnityEngine.AnimationClip)o; + UnityEngine.WrapMode arg0 = (UnityEngine.WrapMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.WrapMode)); + obj.wrapMode = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index wrapMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_localBounds(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationClip obj = (UnityEngine.AnimationClip)o; + UnityEngine.Bounds arg0 = ToLua.ToBounds(L, 2); + obj.localBounds = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index localBounds on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_legacy(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationClip obj = (UnityEngine.AnimationClip)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.legacy = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index legacy on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_events(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationClip obj = (UnityEngine.AnimationClip)o; + UnityEngine.AnimationEvent[] arg0 = ToLua.CheckObjectArray(L, 2); + obj.events = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index events on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AnimationClipWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AnimationClipWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..5dac64473af5f7705d37d16dccff9e729fa281ea --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AnimationClipWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c3cf642fd4700a340a7c57f8085e1978 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AnimationStateWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AnimationStateWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..1a90848b66a3c7afd8f83a5d3dbe988d3eae02b0 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AnimationStateWrap.cs @@ -0,0 +1,540 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_AnimationStateWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.AnimationState), typeof(UnityEngine.TrackedReference)); + L.RegFunction("AddMixingTransform", AddMixingTransform); + L.RegFunction("RemoveMixingTransform", RemoveMixingTransform); + L.RegFunction("New", _CreateUnityEngine_AnimationState); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("enabled", get_enabled, set_enabled); + L.RegVar("weight", get_weight, set_weight); + L.RegVar("wrapMode", get_wrapMode, set_wrapMode); + L.RegVar("time", get_time, set_time); + L.RegVar("normalizedTime", get_normalizedTime, set_normalizedTime); + L.RegVar("speed", get_speed, set_speed); + L.RegVar("normalizedSpeed", get_normalizedSpeed, set_normalizedSpeed); + L.RegVar("length", get_length, null); + L.RegVar("layer", get_layer, set_layer); + L.RegVar("clip", get_clip, null); + L.RegVar("name", get_name, set_name); + L.RegVar("blendMode", get_blendMode, set_blendMode); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateUnityEngine_AnimationState(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + UnityEngine.AnimationState obj = new UnityEngine.AnimationState(); + ToLua.PushSealed(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.AnimationState.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int AddMixingTransform(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.AnimationState obj = (UnityEngine.AnimationState)ToLua.CheckObject(L, 1, typeof(UnityEngine.AnimationState)); + UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.CheckObject(L, 2); + obj.AddMixingTransform(arg0); + return 0; + } + else if (count == 3) + { + UnityEngine.AnimationState obj = (UnityEngine.AnimationState)ToLua.CheckObject(L, 1, typeof(UnityEngine.AnimationState)); + UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.CheckObject(L, 2); + bool arg1 = LuaDLL.luaL_checkboolean(L, 3); + obj.AddMixingTransform(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.AnimationState.AddMixingTransform"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int RemoveMixingTransform(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.AnimationState obj = (UnityEngine.AnimationState)ToLua.CheckObject(L, 1, typeof(UnityEngine.AnimationState)); + UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.CheckObject(L, 2); + obj.RemoveMixingTransform(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.TrackedReference arg0 = (UnityEngine.TrackedReference)ToLua.ToObject(L, 1); + UnityEngine.TrackedReference arg1 = (UnityEngine.TrackedReference)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_enabled(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationState obj = (UnityEngine.AnimationState)o; + bool ret = obj.enabled; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index enabled on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_weight(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationState obj = (UnityEngine.AnimationState)o; + float ret = obj.weight; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index weight on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_wrapMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationState obj = (UnityEngine.AnimationState)o; + UnityEngine.WrapMode ret = obj.wrapMode; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index wrapMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_time(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationState obj = (UnityEngine.AnimationState)o; + float ret = obj.time; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index time on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_normalizedTime(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationState obj = (UnityEngine.AnimationState)o; + float ret = obj.normalizedTime; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index normalizedTime on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_speed(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationState obj = (UnityEngine.AnimationState)o; + float ret = obj.speed; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index speed on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_normalizedSpeed(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationState obj = (UnityEngine.AnimationState)o; + float ret = obj.normalizedSpeed; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index normalizedSpeed on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_length(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationState obj = (UnityEngine.AnimationState)o; + float ret = obj.length; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index length on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_layer(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationState obj = (UnityEngine.AnimationState)o; + int ret = obj.layer; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index layer on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_clip(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationState obj = (UnityEngine.AnimationState)o; + UnityEngine.AnimationClip ret = obj.clip; + ToLua.PushSealed(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index clip on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_name(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationState obj = (UnityEngine.AnimationState)o; + string ret = obj.name; + LuaDLL.lua_pushstring(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index name on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_blendMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationState obj = (UnityEngine.AnimationState)o; + UnityEngine.AnimationBlendMode ret = obj.blendMode; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index blendMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_enabled(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationState obj = (UnityEngine.AnimationState)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.enabled = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index enabled on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_weight(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationState obj = (UnityEngine.AnimationState)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.weight = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index weight on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_wrapMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationState obj = (UnityEngine.AnimationState)o; + UnityEngine.WrapMode arg0 = (UnityEngine.WrapMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.WrapMode)); + obj.wrapMode = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index wrapMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_time(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationState obj = (UnityEngine.AnimationState)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.time = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index time on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_normalizedTime(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationState obj = (UnityEngine.AnimationState)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.normalizedTime = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index normalizedTime on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_speed(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationState obj = (UnityEngine.AnimationState)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.speed = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index speed on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_normalizedSpeed(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationState obj = (UnityEngine.AnimationState)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.normalizedSpeed = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index normalizedSpeed on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_layer(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationState obj = (UnityEngine.AnimationState)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.layer = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index layer on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_name(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationState obj = (UnityEngine.AnimationState)o; + string arg0 = ToLua.CheckString(L, 2); + obj.name = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index name on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_blendMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AnimationState obj = (UnityEngine.AnimationState)o; + UnityEngine.AnimationBlendMode arg0 = (UnityEngine.AnimationBlendMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.AnimationBlendMode)); + obj.blendMode = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index blendMode on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AnimationStateWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AnimationStateWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..1d53af94d69fe4ed1b8b85e27ee8d1699ee7c161 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AnimationStateWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9240afffb600b4445ba7408b91c2ee92 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AnimationWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AnimationWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..9a50e4f62283ae001a13b7e8d665796d17dcb8dd --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AnimationWrap.cs @@ -0,0 +1,860 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_AnimationWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.Animation), typeof(UnityEngine.Behaviour)); + L.RegFunction("Stop", Stop); + L.RegFunction("Rewind", Rewind); + L.RegFunction("Sample", Sample); + L.RegFunction("IsPlaying", IsPlaying); + L.RegFunction("get_Item", get_Item); + L.RegFunction("Play", Play); + L.RegFunction("CrossFade", CrossFade); + L.RegFunction("Blend", Blend); + L.RegFunction("CrossFadeQueued", CrossFadeQueued); + L.RegFunction("PlayQueued", PlayQueued); + L.RegFunction("AddClip", AddClip); + L.RegFunction("RemoveClip", RemoveClip); + L.RegFunction("GetClipCount", GetClipCount); + L.RegFunction("SyncLayer", SyncLayer); + L.RegFunction("GetEnumerator", GetEnumerator); + L.RegFunction("GetClip", GetClip); + L.RegFunction("New", _CreateUnityEngine_Animation); + L.RegVar("this", _this, null); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("clip", get_clip, set_clip); + L.RegVar("playAutomatically", get_playAutomatically, set_playAutomatically); + L.RegVar("wrapMode", get_wrapMode, set_wrapMode); + L.RegVar("isPlaying", get_isPlaying, null); + L.RegVar("animatePhysics", get_animatePhysics, set_animatePhysics); + L.RegVar("cullingType", get_cullingType, set_cullingType); + L.RegVar("localBounds", get_localBounds, set_localBounds); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateUnityEngine_Animation(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + UnityEngine.Animation obj = new UnityEngine.Animation(); + ToLua.PushSealed(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.Animation.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _get_this(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + string arg0 = ToLua.CheckString(L, 2); + UnityEngine.AnimationState o = obj[arg0]; + ToLua.PushSealed(L, o); + return 1; + + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _this(IntPtr L) + { + try + { + LuaDLL.lua_pushvalue(L, 1); + LuaDLL.tolua_bindthis(L, _get_this, null); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Stop(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + obj.Stop(); + return 0; + } + else if (count == 2) + { + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + string arg0 = ToLua.CheckString(L, 2); + obj.Stop(arg0); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Animation.Stop"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Rewind(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + obj.Rewind(); + return 0; + } + else if (count == 2) + { + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + string arg0 = ToLua.CheckString(L, 2); + obj.Rewind(arg0); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Animation.Rewind"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Sample(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + obj.Sample(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IsPlaying(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + string arg0 = ToLua.CheckString(L, 2); + bool o = obj.IsPlaying(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Item(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + string arg0 = ToLua.CheckString(L, 2); + UnityEngine.AnimationState o = obj[arg0]; + ToLua.PushSealed(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Play(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + bool o = obj.Play(); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + UnityEngine.PlayMode arg0 = (UnityEngine.PlayMode)ToLua.ToObject(L, 2); + bool o = obj.Play(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + string arg0 = ToLua.ToString(L, 2); + bool o = obj.Play(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + string arg0 = ToLua.CheckString(L, 2); + UnityEngine.PlayMode arg1 = (UnityEngine.PlayMode)ToLua.CheckObject(L, 3, typeof(UnityEngine.PlayMode)); + bool o = obj.Play(arg0, arg1); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Animation.Play"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CrossFade(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + string arg0 = ToLua.CheckString(L, 2); + obj.CrossFade(arg0); + return 0; + } + else if (count == 3) + { + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + string arg0 = ToLua.CheckString(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + obj.CrossFade(arg0, arg1); + return 0; + } + else if (count == 4) + { + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + string arg0 = ToLua.CheckString(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.PlayMode arg2 = (UnityEngine.PlayMode)ToLua.CheckObject(L, 4, typeof(UnityEngine.PlayMode)); + obj.CrossFade(arg0, arg1, arg2); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Animation.CrossFade"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Blend(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + string arg0 = ToLua.CheckString(L, 2); + obj.Blend(arg0); + return 0; + } + else if (count == 3) + { + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + string arg0 = ToLua.CheckString(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + obj.Blend(arg0, arg1); + return 0; + } + else if (count == 4) + { + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + string arg0 = ToLua.CheckString(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + obj.Blend(arg0, arg1, arg2); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Animation.Blend"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CrossFadeQueued(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + string arg0 = ToLua.CheckString(L, 2); + UnityEngine.AnimationState o = obj.CrossFadeQueued(arg0); + ToLua.PushSealed(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + string arg0 = ToLua.CheckString(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.AnimationState o = obj.CrossFadeQueued(arg0, arg1); + ToLua.PushSealed(L, o); + return 1; + } + else if (count == 4) + { + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + string arg0 = ToLua.CheckString(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.QueueMode arg2 = (UnityEngine.QueueMode)ToLua.CheckObject(L, 4, typeof(UnityEngine.QueueMode)); + UnityEngine.AnimationState o = obj.CrossFadeQueued(arg0, arg1, arg2); + ToLua.PushSealed(L, o); + return 1; + } + else if (count == 5) + { + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + string arg0 = ToLua.CheckString(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.QueueMode arg2 = (UnityEngine.QueueMode)ToLua.CheckObject(L, 4, typeof(UnityEngine.QueueMode)); + UnityEngine.PlayMode arg3 = (UnityEngine.PlayMode)ToLua.CheckObject(L, 5, typeof(UnityEngine.PlayMode)); + UnityEngine.AnimationState o = obj.CrossFadeQueued(arg0, arg1, arg2, arg3); + ToLua.PushSealed(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Animation.CrossFadeQueued"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int PlayQueued(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + string arg0 = ToLua.CheckString(L, 2); + UnityEngine.AnimationState o = obj.PlayQueued(arg0); + ToLua.PushSealed(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + string arg0 = ToLua.CheckString(L, 2); + UnityEngine.QueueMode arg1 = (UnityEngine.QueueMode)ToLua.CheckObject(L, 3, typeof(UnityEngine.QueueMode)); + UnityEngine.AnimationState o = obj.PlayQueued(arg0, arg1); + ToLua.PushSealed(L, o); + return 1; + } + else if (count == 4) + { + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + string arg0 = ToLua.CheckString(L, 2); + UnityEngine.QueueMode arg1 = (UnityEngine.QueueMode)ToLua.CheckObject(L, 3, typeof(UnityEngine.QueueMode)); + UnityEngine.PlayMode arg2 = (UnityEngine.PlayMode)ToLua.CheckObject(L, 4, typeof(UnityEngine.PlayMode)); + UnityEngine.AnimationState o = obj.PlayQueued(arg0, arg1, arg2); + ToLua.PushSealed(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Animation.PlayQueued"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int AddClip(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3) + { + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + UnityEngine.AnimationClip arg0 = (UnityEngine.AnimationClip)ToLua.CheckObject(L, 2, typeof(UnityEngine.AnimationClip)); + string arg1 = ToLua.CheckString(L, 3); + obj.AddClip(arg0, arg1); + return 0; + } + else if (count == 5) + { + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + UnityEngine.AnimationClip arg0 = (UnityEngine.AnimationClip)ToLua.CheckObject(L, 2, typeof(UnityEngine.AnimationClip)); + string arg1 = ToLua.CheckString(L, 3); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 5); + obj.AddClip(arg0, arg1, arg2, arg3); + return 0; + } + else if (count == 6) + { + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + UnityEngine.AnimationClip arg0 = (UnityEngine.AnimationClip)ToLua.CheckObject(L, 2, typeof(UnityEngine.AnimationClip)); + string arg1 = ToLua.CheckString(L, 3); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 5); + bool arg4 = LuaDLL.luaL_checkboolean(L, 6); + obj.AddClip(arg0, arg1, arg2, arg3, arg4); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Animation.AddClip"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int RemoveClip(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + UnityEngine.AnimationClip arg0 = (UnityEngine.AnimationClip)ToLua.ToObject(L, 2); + obj.RemoveClip(arg0); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + string arg0 = ToLua.ToString(L, 2); + obj.RemoveClip(arg0); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Animation.RemoveClip"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetClipCount(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + int o = obj.GetClipCount(); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SyncLayer(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.SyncLayer(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetEnumerator(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + System.Collections.IEnumerator o = obj.GetEnumerator(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetClip(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); + string arg0 = ToLua.CheckString(L, 2); + UnityEngine.AnimationClip o = obj.GetClip(arg0); + ToLua.PushSealed(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_clip(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animation obj = (UnityEngine.Animation)o; + UnityEngine.AnimationClip ret = obj.clip; + ToLua.PushSealed(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index clip on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_playAutomatically(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animation obj = (UnityEngine.Animation)o; + bool ret = obj.playAutomatically; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index playAutomatically on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_wrapMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animation obj = (UnityEngine.Animation)o; + UnityEngine.WrapMode ret = obj.wrapMode; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index wrapMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isPlaying(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animation obj = (UnityEngine.Animation)o; + bool ret = obj.isPlaying; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isPlaying on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_animatePhysics(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animation obj = (UnityEngine.Animation)o; + bool ret = obj.animatePhysics; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index animatePhysics on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_cullingType(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animation obj = (UnityEngine.Animation)o; + UnityEngine.AnimationCullingType ret = obj.cullingType; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index cullingType on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_localBounds(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animation obj = (UnityEngine.Animation)o; + UnityEngine.Bounds ret = obj.localBounds; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index localBounds on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_clip(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animation obj = (UnityEngine.Animation)o; + UnityEngine.AnimationClip arg0 = (UnityEngine.AnimationClip)ToLua.CheckObject(L, 2, typeof(UnityEngine.AnimationClip)); + obj.clip = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index clip on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_playAutomatically(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animation obj = (UnityEngine.Animation)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.playAutomatically = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index playAutomatically on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_wrapMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animation obj = (UnityEngine.Animation)o; + UnityEngine.WrapMode arg0 = (UnityEngine.WrapMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.WrapMode)); + obj.wrapMode = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index wrapMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_animatePhysics(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animation obj = (UnityEngine.Animation)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.animatePhysics = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index animatePhysics on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_cullingType(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animation obj = (UnityEngine.Animation)o; + UnityEngine.AnimationCullingType arg0 = (UnityEngine.AnimationCullingType)ToLua.CheckObject(L, 2, typeof(UnityEngine.AnimationCullingType)); + obj.cullingType = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index cullingType on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_localBounds(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animation obj = (UnityEngine.Animation)o; + UnityEngine.Bounds arg0 = ToLua.ToBounds(L, 2); + obj.localBounds = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index localBounds on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AnimationWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AnimationWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..7ef65982073305a2e1556b01c75756718872e83f --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AnimationWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dae0d0f715172cf4495f882f669d7df9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AnimatorWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AnimatorWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..738b8b122d2df8f180a9e834820d41a072fa821c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AnimatorWrap.cs @@ -0,0 +1,2863 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_AnimatorWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.Animator), typeof(UnityEngine.Behaviour)); + L.RegFunction("GetFloat", GetFloat); + L.RegFunction("SetFloat", SetFloat); + L.RegFunction("GetBool", GetBool); + L.RegFunction("SetBool", SetBool); + L.RegFunction("GetInteger", GetInteger); + L.RegFunction("SetInteger", SetInteger); + L.RegFunction("SetTrigger", SetTrigger); + L.RegFunction("ResetTrigger", ResetTrigger); + L.RegFunction("IsParameterControlledByCurve", IsParameterControlledByCurve); + L.RegFunction("GetIKPosition", GetIKPosition); + L.RegFunction("SetIKPosition", SetIKPosition); + L.RegFunction("GetIKRotation", GetIKRotation); + L.RegFunction("SetIKRotation", SetIKRotation); + L.RegFunction("GetIKPositionWeight", GetIKPositionWeight); + L.RegFunction("SetIKPositionWeight", SetIKPositionWeight); + L.RegFunction("GetIKRotationWeight", GetIKRotationWeight); + L.RegFunction("SetIKRotationWeight", SetIKRotationWeight); + L.RegFunction("GetIKHintPosition", GetIKHintPosition); + L.RegFunction("SetIKHintPosition", SetIKHintPosition); + L.RegFunction("GetIKHintPositionWeight", GetIKHintPositionWeight); + L.RegFunction("SetIKHintPositionWeight", SetIKHintPositionWeight); + L.RegFunction("SetLookAtPosition", SetLookAtPosition); + L.RegFunction("SetLookAtWeight", SetLookAtWeight); + L.RegFunction("SetBoneLocalRotation", SetBoneLocalRotation); + L.RegFunction("GetBehaviours", GetBehaviours); + L.RegFunction("GetLayerName", GetLayerName); + L.RegFunction("GetLayerIndex", GetLayerIndex); + L.RegFunction("GetLayerWeight", GetLayerWeight); + L.RegFunction("SetLayerWeight", SetLayerWeight); + L.RegFunction("GetCurrentAnimatorStateInfo", GetCurrentAnimatorStateInfo); + L.RegFunction("GetNextAnimatorStateInfo", GetNextAnimatorStateInfo); + L.RegFunction("GetAnimatorTransitionInfo", GetAnimatorTransitionInfo); + L.RegFunction("GetCurrentAnimatorClipInfoCount", GetCurrentAnimatorClipInfoCount); + L.RegFunction("GetNextAnimatorClipInfoCount", GetNextAnimatorClipInfoCount); + L.RegFunction("GetCurrentAnimatorClipInfo", GetCurrentAnimatorClipInfo); + L.RegFunction("GetNextAnimatorClipInfo", GetNextAnimatorClipInfo); + L.RegFunction("IsInTransition", IsInTransition); + L.RegFunction("GetParameter", GetParameter); + L.RegFunction("MatchTarget", MatchTarget); + L.RegFunction("InterruptMatchTarget", InterruptMatchTarget); + L.RegFunction("CrossFadeInFixedTime", CrossFadeInFixedTime); + L.RegFunction("WriteDefaultValues", WriteDefaultValues); + L.RegFunction("CrossFade", CrossFade); + L.RegFunction("PlayInFixedTime", PlayInFixedTime); + L.RegFunction("Play", Play); + L.RegFunction("SetTarget", SetTarget); + L.RegFunction("GetBoneTransform", GetBoneTransform); + L.RegFunction("StartPlayback", StartPlayback); + L.RegFunction("StopPlayback", StopPlayback); + L.RegFunction("StartRecording", StartRecording); + L.RegFunction("StopRecording", StopRecording); + L.RegFunction("HasState", HasState); + L.RegFunction("StringToHash", StringToHash); + L.RegFunction("Update", Update); + L.RegFunction("Rebind", Rebind); + L.RegFunction("ApplyBuiltinRootMotion", ApplyBuiltinRootMotion); + L.RegFunction("New", _CreateUnityEngine_Animator); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("isOptimizable", get_isOptimizable, null); + L.RegVar("isHuman", get_isHuman, null); + L.RegVar("hasRootMotion", get_hasRootMotion, null); + L.RegVar("humanScale", get_humanScale, null); + L.RegVar("isInitialized", get_isInitialized, null); + L.RegVar("deltaPosition", get_deltaPosition, null); + L.RegVar("deltaRotation", get_deltaRotation, null); + L.RegVar("velocity", get_velocity, null); + L.RegVar("angularVelocity", get_angularVelocity, null); + L.RegVar("rootPosition", get_rootPosition, set_rootPosition); + L.RegVar("rootRotation", get_rootRotation, set_rootRotation); + L.RegVar("applyRootMotion", get_applyRootMotion, set_applyRootMotion); + L.RegVar("updateMode", get_updateMode, set_updateMode); + L.RegVar("hasTransformHierarchy", get_hasTransformHierarchy, null); + L.RegVar("gravityWeight", get_gravityWeight, null); + L.RegVar("bodyPosition", get_bodyPosition, set_bodyPosition); + L.RegVar("bodyRotation", get_bodyRotation, set_bodyRotation); + L.RegVar("stabilizeFeet", get_stabilizeFeet, set_stabilizeFeet); + L.RegVar("layerCount", get_layerCount, null); + L.RegVar("parameters", get_parameters, null); + L.RegVar("parameterCount", get_parameterCount, null); + L.RegVar("feetPivotActive", get_feetPivotActive, set_feetPivotActive); + L.RegVar("pivotWeight", get_pivotWeight, null); + L.RegVar("pivotPosition", get_pivotPosition, null); + L.RegVar("isMatchingTarget", get_isMatchingTarget, null); + L.RegVar("speed", get_speed, set_speed); + L.RegVar("targetPosition", get_targetPosition, null); + L.RegVar("targetRotation", get_targetRotation, null); + L.RegVar("cullingMode", get_cullingMode, set_cullingMode); + L.RegVar("playbackTime", get_playbackTime, set_playbackTime); + L.RegVar("recorderStartTime", get_recorderStartTime, set_recorderStartTime); + L.RegVar("recorderStopTime", get_recorderStopTime, set_recorderStopTime); + L.RegVar("recorderMode", get_recorderMode, null); + L.RegVar("runtimeAnimatorController", get_runtimeAnimatorController, set_runtimeAnimatorController); + L.RegVar("hasBoundPlayables", get_hasBoundPlayables, null); + L.RegVar("avatar", get_avatar, set_avatar); + L.RegVar("playableGraph", get_playableGraph, null); + L.RegVar("layersAffectMassCenter", get_layersAffectMassCenter, set_layersAffectMassCenter); + L.RegVar("leftFeetBottomHeight", get_leftFeetBottomHeight, null); + L.RegVar("rightFeetBottomHeight", get_rightFeetBottomHeight, null); + L.RegVar("logWarnings", get_logWarnings, set_logWarnings); + L.RegVar("fireEvents", get_fireEvents, set_fireEvents); + L.RegVar("keepAnimatorControllerStateOnDisable", get_keepAnimatorControllerStateOnDisable, set_keepAnimatorControllerStateOnDisable); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateUnityEngine_Animator(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + UnityEngine.Animator obj = new UnityEngine.Animator(); + ToLua.Push(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.Animator.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetFloat(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + float o = obj.GetFloat(arg0); + LuaDLL.lua_pushnumber(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + float o = obj.GetFloat(arg0); + LuaDLL.lua_pushnumber(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Animator.GetFloat"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetFloat(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + float arg1 = (float)LuaDLL.lua_tonumber(L, 3); + obj.SetFloat(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + float arg1 = (float)LuaDLL.lua_tonumber(L, 3); + obj.SetFloat(arg0, arg1); + return 0; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + float arg1 = (float)LuaDLL.lua_tonumber(L, 3); + float arg2 = (float)LuaDLL.lua_tonumber(L, 4); + float arg3 = (float)LuaDLL.lua_tonumber(L, 5); + obj.SetFloat(arg0, arg1, arg2, arg3); + return 0; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + float arg1 = (float)LuaDLL.lua_tonumber(L, 3); + float arg2 = (float)LuaDLL.lua_tonumber(L, 4); + float arg3 = (float)LuaDLL.lua_tonumber(L, 5); + obj.SetFloat(arg0, arg1, arg2, arg3); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Animator.SetFloat"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetBool(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + bool o = obj.GetBool(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + bool o = obj.GetBool(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Animator.GetBool"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetBool(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + bool arg1 = LuaDLL.lua_toboolean(L, 3); + obj.SetBool(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + bool arg1 = LuaDLL.lua_toboolean(L, 3); + obj.SetBool(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Animator.SetBool"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetInteger(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + int o = obj.GetInteger(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + int o = obj.GetInteger(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Animator.GetInteger"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetInteger(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + obj.SetInteger(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + obj.SetInteger(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Animator.SetInteger"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetTrigger(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + obj.SetTrigger(arg0); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + obj.SetTrigger(arg0); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Animator.SetTrigger"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ResetTrigger(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + obj.ResetTrigger(arg0); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + obj.ResetTrigger(arg0); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Animator.ResetTrigger"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IsParameterControlledByCurve(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + bool o = obj.IsParameterControlledByCurve(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + bool o = obj.IsParameterControlledByCurve(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Animator.IsParameterControlledByCurve"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetIKPosition(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + UnityEngine.AvatarIKGoal arg0 = (UnityEngine.AvatarIKGoal)ToLua.CheckObject(L, 2, typeof(UnityEngine.AvatarIKGoal)); + UnityEngine.Vector3 o = obj.GetIKPosition(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetIKPosition(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + UnityEngine.AvatarIKGoal arg0 = (UnityEngine.AvatarIKGoal)ToLua.CheckObject(L, 2, typeof(UnityEngine.AvatarIKGoal)); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 3); + obj.SetIKPosition(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetIKRotation(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + UnityEngine.AvatarIKGoal arg0 = (UnityEngine.AvatarIKGoal)ToLua.CheckObject(L, 2, typeof(UnityEngine.AvatarIKGoal)); + UnityEngine.Quaternion o = obj.GetIKRotation(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetIKRotation(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + UnityEngine.AvatarIKGoal arg0 = (UnityEngine.AvatarIKGoal)ToLua.CheckObject(L, 2, typeof(UnityEngine.AvatarIKGoal)); + UnityEngine.Quaternion arg1 = ToLua.ToQuaternion(L, 3); + obj.SetIKRotation(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetIKPositionWeight(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + UnityEngine.AvatarIKGoal arg0 = (UnityEngine.AvatarIKGoal)ToLua.CheckObject(L, 2, typeof(UnityEngine.AvatarIKGoal)); + float o = obj.GetIKPositionWeight(arg0); + LuaDLL.lua_pushnumber(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetIKPositionWeight(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + UnityEngine.AvatarIKGoal arg0 = (UnityEngine.AvatarIKGoal)ToLua.CheckObject(L, 2, typeof(UnityEngine.AvatarIKGoal)); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + obj.SetIKPositionWeight(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetIKRotationWeight(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + UnityEngine.AvatarIKGoal arg0 = (UnityEngine.AvatarIKGoal)ToLua.CheckObject(L, 2, typeof(UnityEngine.AvatarIKGoal)); + float o = obj.GetIKRotationWeight(arg0); + LuaDLL.lua_pushnumber(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetIKRotationWeight(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + UnityEngine.AvatarIKGoal arg0 = (UnityEngine.AvatarIKGoal)ToLua.CheckObject(L, 2, typeof(UnityEngine.AvatarIKGoal)); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + obj.SetIKRotationWeight(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetIKHintPosition(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + UnityEngine.AvatarIKHint arg0 = (UnityEngine.AvatarIKHint)ToLua.CheckObject(L, 2, typeof(UnityEngine.AvatarIKHint)); + UnityEngine.Vector3 o = obj.GetIKHintPosition(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetIKHintPosition(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + UnityEngine.AvatarIKHint arg0 = (UnityEngine.AvatarIKHint)ToLua.CheckObject(L, 2, typeof(UnityEngine.AvatarIKHint)); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 3); + obj.SetIKHintPosition(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetIKHintPositionWeight(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + UnityEngine.AvatarIKHint arg0 = (UnityEngine.AvatarIKHint)ToLua.CheckObject(L, 2, typeof(UnityEngine.AvatarIKHint)); + float o = obj.GetIKHintPositionWeight(arg0); + LuaDLL.lua_pushnumber(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetIKHintPositionWeight(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + UnityEngine.AvatarIKHint arg0 = (UnityEngine.AvatarIKHint)ToLua.CheckObject(L, 2, typeof(UnityEngine.AvatarIKHint)); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + obj.SetIKHintPositionWeight(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetLookAtPosition(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + obj.SetLookAtPosition(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetLookAtWeight(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.SetLookAtWeight(arg0); + return 0; + } + else if (count == 3) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + obj.SetLookAtWeight(arg0, arg1); + return 0; + } + else if (count == 4) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + obj.SetLookAtWeight(arg0, arg1, arg2); + return 0; + } + else if (count == 5) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + float arg3 = (float)LuaDLL.luaL_checknumber(L, 5); + obj.SetLookAtWeight(arg0, arg1, arg2, arg3); + return 0; + } + else if (count == 6) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + float arg3 = (float)LuaDLL.luaL_checknumber(L, 5); + float arg4 = (float)LuaDLL.luaL_checknumber(L, 6); + obj.SetLookAtWeight(arg0, arg1, arg2, arg3, arg4); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Animator.SetLookAtWeight"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetBoneLocalRotation(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + UnityEngine.HumanBodyBones arg0 = (UnityEngine.HumanBodyBones)ToLua.CheckObject(L, 2, typeof(UnityEngine.HumanBodyBones)); + UnityEngine.Quaternion arg1 = ToLua.ToQuaternion(L, 3); + obj.SetBoneLocalRotation(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetBehaviours(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.StateMachineBehaviour[] o = obj.GetBehaviours(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetLayerName(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + string o = obj.GetLayerName(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetLayerIndex(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + int o = obj.GetLayerIndex(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetLayerWeight(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + float o = obj.GetLayerWeight(arg0); + LuaDLL.lua_pushnumber(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetLayerWeight(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + obj.SetLayerWeight(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetCurrentAnimatorStateInfo(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.AnimatorStateInfo o = obj.GetCurrentAnimatorStateInfo(arg0); + ToLua.PushValue(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetNextAnimatorStateInfo(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.AnimatorStateInfo o = obj.GetNextAnimatorStateInfo(arg0); + ToLua.PushValue(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetAnimatorTransitionInfo(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.AnimatorTransitionInfo o = obj.GetAnimatorTransitionInfo(arg0); + ToLua.PushValue(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetCurrentAnimatorClipInfoCount(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int o = obj.GetCurrentAnimatorClipInfoCount(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetNextAnimatorClipInfoCount(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int o = obj.GetNextAnimatorClipInfoCount(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetCurrentAnimatorClipInfo(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.AnimatorClipInfo[] o = obj.GetCurrentAnimatorClipInfo(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.CheckObject(L, 3, typeof(System.Collections.Generic.List)); + obj.GetCurrentAnimatorClipInfo(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Animator.GetCurrentAnimatorClipInfo"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetNextAnimatorClipInfo(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.AnimatorClipInfo[] o = obj.GetNextAnimatorClipInfo(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.CheckObject(L, 3, typeof(System.Collections.Generic.List)); + obj.GetNextAnimatorClipInfo(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Animator.GetNextAnimatorClipInfo"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IsInTransition(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + bool o = obj.IsInTransition(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetParameter(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.AnimatorControllerParameter o = obj.GetParameter(arg0); + ToLua.PushObject(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int MatchTarget(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 6) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Quaternion arg1 = ToLua.ToQuaternion(L, 3); + UnityEngine.AvatarTarget arg2 = (UnityEngine.AvatarTarget)ToLua.CheckObject(L, 4, typeof(UnityEngine.AvatarTarget)); + UnityEngine.MatchTargetWeightMask arg3 = StackTraits.Check(L, 5); + float arg4 = (float)LuaDLL.luaL_checknumber(L, 6); + obj.MatchTarget(arg0, arg1, arg2, arg3, arg4); + return 0; + } + else if (count == 7) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Quaternion arg1 = ToLua.ToQuaternion(L, 3); + UnityEngine.AvatarTarget arg2 = (UnityEngine.AvatarTarget)ToLua.CheckObject(L, 4, typeof(UnityEngine.AvatarTarget)); + UnityEngine.MatchTargetWeightMask arg3 = StackTraits.Check(L, 5); + float arg4 = (float)LuaDLL.luaL_checknumber(L, 6); + float arg5 = (float)LuaDLL.luaL_checknumber(L, 7); + obj.MatchTarget(arg0, arg1, arg2, arg3, arg4, arg5); + return 0; + } + else if (count == 8) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Quaternion arg1 = ToLua.ToQuaternion(L, 3); + UnityEngine.AvatarTarget arg2 = (UnityEngine.AvatarTarget)ToLua.CheckObject(L, 4, typeof(UnityEngine.AvatarTarget)); + UnityEngine.MatchTargetWeightMask arg3 = StackTraits.Check(L, 5); + float arg4 = (float)LuaDLL.luaL_checknumber(L, 6); + float arg5 = (float)LuaDLL.luaL_checknumber(L, 7); + bool arg6 = LuaDLL.luaL_checkboolean(L, 8); + obj.MatchTarget(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Animator.MatchTarget"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int InterruptMatchTarget(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + obj.InterruptMatchTarget(); + return 0; + } + else if (count == 2) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.InterruptMatchTarget(arg0); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Animator.InterruptMatchTarget"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CrossFadeInFixedTime(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + float arg1 = (float)LuaDLL.lua_tonumber(L, 3); + obj.CrossFadeInFixedTime(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + float arg1 = (float)LuaDLL.lua_tonumber(L, 3); + obj.CrossFadeInFixedTime(arg0, arg1); + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + float arg1 = (float)LuaDLL.lua_tonumber(L, 3); + int arg2 = (int)LuaDLL.lua_tonumber(L, 4); + obj.CrossFadeInFixedTime(arg0, arg1, arg2); + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + float arg1 = (float)LuaDLL.lua_tonumber(L, 3); + int arg2 = (int)LuaDLL.lua_tonumber(L, 4); + obj.CrossFadeInFixedTime(arg0, arg1, arg2); + return 0; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + float arg1 = (float)LuaDLL.lua_tonumber(L, 3); + int arg2 = (int)LuaDLL.lua_tonumber(L, 4); + float arg3 = (float)LuaDLL.lua_tonumber(L, 5); + obj.CrossFadeInFixedTime(arg0, arg1, arg2, arg3); + return 0; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + float arg1 = (float)LuaDLL.lua_tonumber(L, 3); + int arg2 = (int)LuaDLL.lua_tonumber(L, 4); + float arg3 = (float)LuaDLL.lua_tonumber(L, 5); + obj.CrossFadeInFixedTime(arg0, arg1, arg2, arg3); + return 0; + } + else if (count == 6 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + float arg1 = (float)LuaDLL.lua_tonumber(L, 3); + int arg2 = (int)LuaDLL.lua_tonumber(L, 4); + float arg3 = (float)LuaDLL.lua_tonumber(L, 5); + float arg4 = (float)LuaDLL.lua_tonumber(L, 6); + obj.CrossFadeInFixedTime(arg0, arg1, arg2, arg3, arg4); + return 0; + } + else if (count == 6 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + float arg1 = (float)LuaDLL.lua_tonumber(L, 3); + int arg2 = (int)LuaDLL.lua_tonumber(L, 4); + float arg3 = (float)LuaDLL.lua_tonumber(L, 5); + float arg4 = (float)LuaDLL.lua_tonumber(L, 6); + obj.CrossFadeInFixedTime(arg0, arg1, arg2, arg3, arg4); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Animator.CrossFadeInFixedTime"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int WriteDefaultValues(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + obj.WriteDefaultValues(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CrossFade(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + float arg1 = (float)LuaDLL.lua_tonumber(L, 3); + obj.CrossFade(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + float arg1 = (float)LuaDLL.lua_tonumber(L, 3); + obj.CrossFade(arg0, arg1); + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + float arg1 = (float)LuaDLL.lua_tonumber(L, 3); + int arg2 = (int)LuaDLL.lua_tonumber(L, 4); + obj.CrossFade(arg0, arg1, arg2); + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + float arg1 = (float)LuaDLL.lua_tonumber(L, 3); + int arg2 = (int)LuaDLL.lua_tonumber(L, 4); + obj.CrossFade(arg0, arg1, arg2); + return 0; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + float arg1 = (float)LuaDLL.lua_tonumber(L, 3); + int arg2 = (int)LuaDLL.lua_tonumber(L, 4); + float arg3 = (float)LuaDLL.lua_tonumber(L, 5); + obj.CrossFade(arg0, arg1, arg2, arg3); + return 0; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + float arg1 = (float)LuaDLL.lua_tonumber(L, 3); + int arg2 = (int)LuaDLL.lua_tonumber(L, 4); + float arg3 = (float)LuaDLL.lua_tonumber(L, 5); + obj.CrossFade(arg0, arg1, arg2, arg3); + return 0; + } + else if (count == 6 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + float arg1 = (float)LuaDLL.lua_tonumber(L, 3); + int arg2 = (int)LuaDLL.lua_tonumber(L, 4); + float arg3 = (float)LuaDLL.lua_tonumber(L, 5); + float arg4 = (float)LuaDLL.lua_tonumber(L, 6); + obj.CrossFade(arg0, arg1, arg2, arg3, arg4); + return 0; + } + else if (count == 6 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + float arg1 = (float)LuaDLL.lua_tonumber(L, 3); + int arg2 = (int)LuaDLL.lua_tonumber(L, 4); + float arg3 = (float)LuaDLL.lua_tonumber(L, 5); + float arg4 = (float)LuaDLL.lua_tonumber(L, 6); + obj.CrossFade(arg0, arg1, arg2, arg3, arg4); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Animator.CrossFade"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int PlayInFixedTime(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + obj.PlayInFixedTime(arg0); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + obj.PlayInFixedTime(arg0); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + obj.PlayInFixedTime(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + obj.PlayInFixedTime(arg0, arg1); + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + float arg2 = (float)LuaDLL.lua_tonumber(L, 4); + obj.PlayInFixedTime(arg0, arg1, arg2); + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + float arg2 = (float)LuaDLL.lua_tonumber(L, 4); + obj.PlayInFixedTime(arg0, arg1, arg2); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Animator.PlayInFixedTime"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Play(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + obj.Play(arg0); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + obj.Play(arg0); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + obj.Play(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + obj.Play(arg0, arg1); + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + float arg2 = (float)LuaDLL.lua_tonumber(L, 4); + obj.Play(arg0, arg1, arg2); + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + float arg2 = (float)LuaDLL.lua_tonumber(L, 4); + obj.Play(arg0, arg1, arg2); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Animator.Play"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetTarget(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + UnityEngine.AvatarTarget arg0 = (UnityEngine.AvatarTarget)ToLua.CheckObject(L, 2, typeof(UnityEngine.AvatarTarget)); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + obj.SetTarget(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetBoneTransform(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + UnityEngine.HumanBodyBones arg0 = (UnityEngine.HumanBodyBones)ToLua.CheckObject(L, 2, typeof(UnityEngine.HumanBodyBones)); + UnityEngine.Transform o = obj.GetBoneTransform(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int StartPlayback(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + obj.StartPlayback(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int StopPlayback(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + obj.StopPlayback(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int StartRecording(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.StartRecording(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int StopRecording(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + obj.StopRecording(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int HasState(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + bool o = obj.HasState(arg0, arg1); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int StringToHash(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + int o = UnityEngine.Animator.StringToHash(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Update(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.Update(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Rebind(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + obj.Rebind(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ApplyBuiltinRootMotion(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)ToLua.CheckObject(L, 1); + obj.ApplyBuiltinRootMotion(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isOptimizable(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + bool ret = obj.isOptimizable; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isOptimizable on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isHuman(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + bool ret = obj.isHuman; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isHuman on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_hasRootMotion(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + bool ret = obj.hasRootMotion; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index hasRootMotion on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_humanScale(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + float ret = obj.humanScale; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index humanScale on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isInitialized(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + bool ret = obj.isInitialized; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isInitialized on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_deltaPosition(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + UnityEngine.Vector3 ret = obj.deltaPosition; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index deltaPosition on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_deltaRotation(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + UnityEngine.Quaternion ret = obj.deltaRotation; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index deltaRotation on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_velocity(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + UnityEngine.Vector3 ret = obj.velocity; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index velocity on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_angularVelocity(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + UnityEngine.Vector3 ret = obj.angularVelocity; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index angularVelocity on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_rootPosition(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + UnityEngine.Vector3 ret = obj.rootPosition; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index rootPosition on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_rootRotation(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + UnityEngine.Quaternion ret = obj.rootRotation; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index rootRotation on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_applyRootMotion(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + bool ret = obj.applyRootMotion; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index applyRootMotion on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_updateMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + UnityEngine.AnimatorUpdateMode ret = obj.updateMode; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index updateMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_hasTransformHierarchy(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + bool ret = obj.hasTransformHierarchy; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index hasTransformHierarchy on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_gravityWeight(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + float ret = obj.gravityWeight; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index gravityWeight on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_bodyPosition(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + UnityEngine.Vector3 ret = obj.bodyPosition; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index bodyPosition on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_bodyRotation(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + UnityEngine.Quaternion ret = obj.bodyRotation; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index bodyRotation on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_stabilizeFeet(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + bool ret = obj.stabilizeFeet; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index stabilizeFeet on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_layerCount(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + int ret = obj.layerCount; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index layerCount on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_parameters(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + UnityEngine.AnimatorControllerParameter[] ret = obj.parameters; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index parameters on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_parameterCount(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + int ret = obj.parameterCount; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index parameterCount on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_feetPivotActive(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + float ret = obj.feetPivotActive; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index feetPivotActive on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_pivotWeight(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + float ret = obj.pivotWeight; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index pivotWeight on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_pivotPosition(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + UnityEngine.Vector3 ret = obj.pivotPosition; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index pivotPosition on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isMatchingTarget(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + bool ret = obj.isMatchingTarget; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isMatchingTarget on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_speed(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + float ret = obj.speed; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index speed on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_targetPosition(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + UnityEngine.Vector3 ret = obj.targetPosition; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index targetPosition on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_targetRotation(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + UnityEngine.Quaternion ret = obj.targetRotation; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index targetRotation on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_cullingMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + UnityEngine.AnimatorCullingMode ret = obj.cullingMode; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index cullingMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_playbackTime(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + float ret = obj.playbackTime; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index playbackTime on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_recorderStartTime(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + float ret = obj.recorderStartTime; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index recorderStartTime on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_recorderStopTime(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + float ret = obj.recorderStopTime; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index recorderStopTime on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_recorderMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + UnityEngine.AnimatorRecorderMode ret = obj.recorderMode; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index recorderMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_runtimeAnimatorController(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + UnityEngine.RuntimeAnimatorController ret = obj.runtimeAnimatorController; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index runtimeAnimatorController on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_hasBoundPlayables(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + bool ret = obj.hasBoundPlayables; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index hasBoundPlayables on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_avatar(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + UnityEngine.Avatar ret = obj.avatar; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index avatar on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_playableGraph(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + UnityEngine.Playables.PlayableGraph ret = obj.playableGraph; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index playableGraph on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_layersAffectMassCenter(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + bool ret = obj.layersAffectMassCenter; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index layersAffectMassCenter on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_leftFeetBottomHeight(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + float ret = obj.leftFeetBottomHeight; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index leftFeetBottomHeight on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_rightFeetBottomHeight(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + float ret = obj.rightFeetBottomHeight; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index rightFeetBottomHeight on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_logWarnings(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + bool ret = obj.logWarnings; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index logWarnings on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_fireEvents(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + bool ret = obj.fireEvents; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index fireEvents on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_keepAnimatorControllerStateOnDisable(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + bool ret = obj.keepAnimatorControllerStateOnDisable; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index keepAnimatorControllerStateOnDisable on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_rootPosition(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + obj.rootPosition = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index rootPosition on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_rootRotation(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + UnityEngine.Quaternion arg0 = ToLua.ToQuaternion(L, 2); + obj.rootRotation = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index rootRotation on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_applyRootMotion(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.applyRootMotion = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index applyRootMotion on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_updateMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + UnityEngine.AnimatorUpdateMode arg0 = (UnityEngine.AnimatorUpdateMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.AnimatorUpdateMode)); + obj.updateMode = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index updateMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_bodyPosition(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + obj.bodyPosition = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index bodyPosition on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_bodyRotation(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + UnityEngine.Quaternion arg0 = ToLua.ToQuaternion(L, 2); + obj.bodyRotation = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index bodyRotation on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_stabilizeFeet(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.stabilizeFeet = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index stabilizeFeet on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_feetPivotActive(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.feetPivotActive = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index feetPivotActive on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_speed(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.speed = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index speed on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_cullingMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + UnityEngine.AnimatorCullingMode arg0 = (UnityEngine.AnimatorCullingMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.AnimatorCullingMode)); + obj.cullingMode = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index cullingMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_playbackTime(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.playbackTime = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index playbackTime on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_recorderStartTime(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.recorderStartTime = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index recorderStartTime on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_recorderStopTime(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.recorderStopTime = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index recorderStopTime on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_runtimeAnimatorController(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + UnityEngine.RuntimeAnimatorController arg0 = (UnityEngine.RuntimeAnimatorController)ToLua.CheckObject(L, 2); + obj.runtimeAnimatorController = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index runtimeAnimatorController on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_avatar(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + UnityEngine.Avatar arg0 = (UnityEngine.Avatar)ToLua.CheckObject(L, 2); + obj.avatar = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index avatar on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_layersAffectMassCenter(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.layersAffectMassCenter = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index layersAffectMassCenter on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_logWarnings(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.logWarnings = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index logWarnings on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_fireEvents(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.fireEvents = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index fireEvents on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_keepAnimatorControllerStateOnDisable(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Animator obj = (UnityEngine.Animator)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.keepAnimatorControllerStateOnDisable = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index keepAnimatorControllerStateOnDisable on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AnimatorWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AnimatorWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..a51d72affc2148ffb398e20a75e446d3c168e954 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AnimatorWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3ad690c654507b74696356d395ae7512 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ApplicationWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ApplicationWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..67826cf7f6c21300ee83bb17a73b3bf49ae383e3 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ApplicationWrap.cs @@ -0,0 +1,1234 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_ApplicationWrap +{ + public static void Register(LuaState L) + { + L.BeginStaticLibs("Application"); + L.RegFunction("Quit", Quit); + L.RegFunction("Unload", Unload); + L.RegFunction("CanStreamedLevelBeLoaded", CanStreamedLevelBeLoaded); + L.RegFunction("IsPlaying", IsPlaying); + L.RegFunction("GetBuildTags", GetBuildTags); + L.RegFunction("SetBuildTags", SetBuildTags); + L.RegFunction("HasProLicense", HasProLicense); + L.RegFunction("RequestAdvertisingIdentifierAsync", RequestAdvertisingIdentifierAsync); + L.RegFunction("OpenURL", OpenURL); + L.RegFunction("GetStackTraceLogType", GetStackTraceLogType); + L.RegFunction("SetStackTraceLogType", SetStackTraceLogType); + L.RegFunction("RequestUserAuthorization", RequestUserAuthorization); + L.RegFunction("HasUserAuthorization", HasUserAuthorization); + L.RegVar("isPlaying", get_isPlaying, null); + L.RegVar("isFocused", get_isFocused, null); + L.RegVar("buildGUID", get_buildGUID, null); + L.RegVar("runInBackground", get_runInBackground, set_runInBackground); + L.RegVar("isBatchMode", get_isBatchMode, null); + L.RegVar("dataPath", get_dataPath, null); + L.RegVar("streamingAssetsPath", get_streamingAssetsPath, null); + L.RegVar("persistentDataPath", get_persistentDataPath, null); + L.RegVar("temporaryCachePath", get_temporaryCachePath, null); + L.RegVar("absoluteURL", get_absoluteURL, null); + L.RegVar("unityVersion", get_unityVersion, null); + L.RegVar("version", get_version, null); + L.RegVar("installerName", get_installerName, null); + L.RegVar("identifier", get_identifier, null); + L.RegVar("installMode", get_installMode, null); + L.RegVar("sandboxType", get_sandboxType, null); + L.RegVar("productName", get_productName, null); + L.RegVar("companyName", get_companyName, null); + L.RegVar("cloudProjectId", get_cloudProjectId, null); + L.RegVar("targetFrameRate", get_targetFrameRate, set_targetFrameRate); + L.RegVar("consoleLogPath", get_consoleLogPath, null); + L.RegVar("backgroundLoadingPriority", get_backgroundLoadingPriority, set_backgroundLoadingPriority); + L.RegVar("genuine", get_genuine, null); + L.RegVar("genuineCheckAvailable", get_genuineCheckAvailable, null); + L.RegVar("platform", get_platform, null); + L.RegVar("isMobilePlatform", get_isMobilePlatform, null); + L.RegVar("isConsolePlatform", get_isConsolePlatform, null); + L.RegVar("systemLanguage", get_systemLanguage, null); + L.RegVar("internetReachability", get_internetReachability, null); + L.RegVar("isEditor", get_isEditor, null); + L.RegVar("lowMemory", get_lowMemory, set_lowMemory); + L.RegVar("logMessageReceived", get_logMessageReceived, set_logMessageReceived); + L.RegVar("logMessageReceivedThreaded", get_logMessageReceivedThreaded, set_logMessageReceivedThreaded); + L.RegVar("onBeforeRender", get_onBeforeRender, set_onBeforeRender); + L.RegVar("focusChanged", get_focusChanged, set_focusChanged); + L.RegVar("deepLinkActivated", get_deepLinkActivated, set_deepLinkActivated); + L.RegVar("wantsToQuit", get_wantsToQuit, set_wantsToQuit); + L.RegVar("quitting", get_quitting, set_quitting); + L.RegVar("unloading", get_unloading, set_unloading); + L.RegFunction("AdvertisingIdentifierCallback", UnityEngine_Application_AdvertisingIdentifierCallback); + L.RegFunction("LogCallback", UnityEngine_Application_LogCallback); + L.RegFunction("LowMemoryCallback", UnityEngine_Application_LowMemoryCallback); + L.EndStaticLibs(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Quit(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + UnityEngine.Application.Quit(); + return 0; + } + else if (count == 1) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + UnityEngine.Application.Quit(arg0); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Application.Quit"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Unload(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 0); + UnityEngine.Application.Unload(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CanStreamedLevelBeLoaded(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + bool o = UnityEngine.Application.CanStreamedLevelBeLoaded(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + bool o = UnityEngine.Application.CanStreamedLevelBeLoaded(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Application.CanStreamedLevelBeLoaded"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IsPlaying(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject(L, 1); + bool o = UnityEngine.Application.IsPlaying(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetBuildTags(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 0); + string[] o = UnityEngine.Application.GetBuildTags(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetBuildTags(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string[] arg0 = ToLua.CheckStringArray(L, 1); + UnityEngine.Application.SetBuildTags(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int HasProLicense(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 0); + bool o = UnityEngine.Application.HasProLicense(); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int RequestAdvertisingIdentifierAsync(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Application.AdvertisingIdentifierCallback arg0 = (UnityEngine.Application.AdvertisingIdentifierCallback)ToLua.CheckDelegate(L, 1); + bool o = UnityEngine.Application.RequestAdvertisingIdentifierAsync(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OpenURL(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + UnityEngine.Application.OpenURL(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetStackTraceLogType(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.LogType arg0 = (UnityEngine.LogType)ToLua.CheckObject(L, 1, typeof(UnityEngine.LogType)); + UnityEngine.StackTraceLogType o = UnityEngine.Application.GetStackTraceLogType(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetStackTraceLogType(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.LogType arg0 = (UnityEngine.LogType)ToLua.CheckObject(L, 1, typeof(UnityEngine.LogType)); + UnityEngine.StackTraceLogType arg1 = (UnityEngine.StackTraceLogType)ToLua.CheckObject(L, 2, typeof(UnityEngine.StackTraceLogType)); + UnityEngine.Application.SetStackTraceLogType(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int RequestUserAuthorization(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UserAuthorization arg0 = (UnityEngine.UserAuthorization)ToLua.CheckObject(L, 1, typeof(UnityEngine.UserAuthorization)); + UnityEngine.AsyncOperation o = UnityEngine.Application.RequestUserAuthorization(arg0); + ToLua.PushObject(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int HasUserAuthorization(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UserAuthorization arg0 = (UnityEngine.UserAuthorization)ToLua.CheckObject(L, 1, typeof(UnityEngine.UserAuthorization)); + bool o = UnityEngine.Application.HasUserAuthorization(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isPlaying(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Application.isPlaying); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isFocused(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Application.isFocused); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_buildGUID(IntPtr L) + { + try + { + LuaDLL.lua_pushstring(L, UnityEngine.Application.buildGUID); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_runInBackground(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Application.runInBackground); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isBatchMode(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Application.isBatchMode); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_dataPath(IntPtr L) + { + try + { + LuaDLL.lua_pushstring(L, UnityEngine.Application.dataPath); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_streamingAssetsPath(IntPtr L) + { + try + { + LuaDLL.lua_pushstring(L, UnityEngine.Application.streamingAssetsPath); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_persistentDataPath(IntPtr L) + { + try + { + LuaDLL.lua_pushstring(L, UnityEngine.Application.persistentDataPath); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_temporaryCachePath(IntPtr L) + { + try + { + LuaDLL.lua_pushstring(L, UnityEngine.Application.temporaryCachePath); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_absoluteURL(IntPtr L) + { + try + { + LuaDLL.lua_pushstring(L, UnityEngine.Application.absoluteURL); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_unityVersion(IntPtr L) + { + try + { + LuaDLL.lua_pushstring(L, UnityEngine.Application.unityVersion); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_version(IntPtr L) + { + try + { + LuaDLL.lua_pushstring(L, UnityEngine.Application.version); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_installerName(IntPtr L) + { + try + { + LuaDLL.lua_pushstring(L, UnityEngine.Application.installerName); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_identifier(IntPtr L) + { + try + { + LuaDLL.lua_pushstring(L, UnityEngine.Application.identifier); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_installMode(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.Application.installMode); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_sandboxType(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.Application.sandboxType); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_productName(IntPtr L) + { + try + { + LuaDLL.lua_pushstring(L, UnityEngine.Application.productName); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_companyName(IntPtr L) + { + try + { + LuaDLL.lua_pushstring(L, UnityEngine.Application.companyName); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_cloudProjectId(IntPtr L) + { + try + { + LuaDLL.lua_pushstring(L, UnityEngine.Application.cloudProjectId); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_targetFrameRate(IntPtr L) + { + try + { + LuaDLL.lua_pushinteger(L, UnityEngine.Application.targetFrameRate); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_consoleLogPath(IntPtr L) + { + try + { + LuaDLL.lua_pushstring(L, UnityEngine.Application.consoleLogPath); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_backgroundLoadingPriority(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.Application.backgroundLoadingPriority); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_genuine(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Application.genuine); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_genuineCheckAvailable(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Application.genuineCheckAvailable); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_platform(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.Application.platform); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isMobilePlatform(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Application.isMobilePlatform); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isConsolePlatform(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Application.isConsolePlatform); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_systemLanguage(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.Application.systemLanguage); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_internetReachability(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.Application.internetReachability); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isEditor(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Application.isEditor); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_lowMemory(IntPtr L) + { + ToLua.Push(L, new EventObject(typeof(UnityEngine.Application.LowMemoryCallback))); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_logMessageReceived(IntPtr L) + { + ToLua.Push(L, new EventObject(typeof(UnityEngine.Application.LogCallback))); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_logMessageReceivedThreaded(IntPtr L) + { + ToLua.Push(L, new EventObject(typeof(UnityEngine.Application.LogCallback))); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_onBeforeRender(IntPtr L) + { + ToLua.Push(L, new EventObject(typeof(UnityEngine.Events.UnityAction))); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_focusChanged(IntPtr L) + { + ToLua.Push(L, new EventObject(typeof(System.Action))); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_deepLinkActivated(IntPtr L) + { + ToLua.Push(L, new EventObject(typeof(System.Action))); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_wantsToQuit(IntPtr L) + { + ToLua.Push(L, new EventObject(typeof(System.Func))); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_quitting(IntPtr L) + { + ToLua.Push(L, new EventObject(typeof(System.Action))); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_unloading(IntPtr L) + { + ToLua.Push(L, new EventObject(typeof(System.Action))); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_runInBackground(IntPtr L) + { + try + { + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + UnityEngine.Application.runInBackground = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_targetFrameRate(IntPtr L) + { + try + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Application.targetFrameRate = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_backgroundLoadingPriority(IntPtr L) + { + try + { + UnityEngine.ThreadPriority arg0 = (UnityEngine.ThreadPriority)ToLua.CheckObject(L, 2, typeof(UnityEngine.ThreadPriority)); + UnityEngine.Application.backgroundLoadingPriority = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_lowMemory(IntPtr L) + { + try + { + EventObject arg0 = null; + + if (LuaDLL.lua_isuserdata(L, 2) != 0) + { + arg0 = (EventObject)ToLua.ToObject(L, 2); + } + else + { + return LuaDLL.luaL_throw(L, "The event 'UnityEngine.Application.lowMemory' can only appear on the left hand side of += or -= when used outside of the type 'UnityEngine.Application'"); + } + + if (arg0.op == EventOp.Add) + { + UnityEngine.Application.LowMemoryCallback ev = (UnityEngine.Application.LowMemoryCallback)arg0.func; + UnityEngine.Application.lowMemory += ev; + } + else if (arg0.op == EventOp.Sub) + { + UnityEngine.Application.LowMemoryCallback ev = (UnityEngine.Application.LowMemoryCallback)arg0.func; + UnityEngine.Application.lowMemory -= ev; + } + + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_logMessageReceived(IntPtr L) + { + try + { + EventObject arg0 = null; + + if (LuaDLL.lua_isuserdata(L, 2) != 0) + { + arg0 = (EventObject)ToLua.ToObject(L, 2); + } + else + { + return LuaDLL.luaL_throw(L, "The event 'UnityEngine.Application.logMessageReceived' can only appear on the left hand side of += or -= when used outside of the type 'UnityEngine.Application'"); + } + + if (arg0.op == EventOp.Add) + { + UnityEngine.Application.LogCallback ev = (UnityEngine.Application.LogCallback)arg0.func; + UnityEngine.Application.logMessageReceived += ev; + } + else if (arg0.op == EventOp.Sub) + { + UnityEngine.Application.LogCallback ev = (UnityEngine.Application.LogCallback)arg0.func; + UnityEngine.Application.logMessageReceived -= ev; + } + + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_logMessageReceivedThreaded(IntPtr L) + { + try + { + EventObject arg0 = null; + + if (LuaDLL.lua_isuserdata(L, 2) != 0) + { + arg0 = (EventObject)ToLua.ToObject(L, 2); + } + else + { + return LuaDLL.luaL_throw(L, "The event 'UnityEngine.Application.logMessageReceivedThreaded' can only appear on the left hand side of += or -= when used outside of the type 'UnityEngine.Application'"); + } + + if (arg0.op == EventOp.Add) + { + UnityEngine.Application.LogCallback ev = (UnityEngine.Application.LogCallback)arg0.func; + UnityEngine.Application.logMessageReceivedThreaded += ev; + } + else if (arg0.op == EventOp.Sub) + { + UnityEngine.Application.LogCallback ev = (UnityEngine.Application.LogCallback)arg0.func; + UnityEngine.Application.logMessageReceivedThreaded -= ev; + } + + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_onBeforeRender(IntPtr L) + { + try + { + EventObject arg0 = null; + + if (LuaDLL.lua_isuserdata(L, 2) != 0) + { + arg0 = (EventObject)ToLua.ToObject(L, 2); + } + else + { + return LuaDLL.luaL_throw(L, "The event 'UnityEngine.Application.onBeforeRender' can only appear on the left hand side of += or -= when used outside of the type 'UnityEngine.Application'"); + } + + if (arg0.op == EventOp.Add) + { + UnityEngine.Events.UnityAction ev = (UnityEngine.Events.UnityAction)arg0.func; + UnityEngine.Application.onBeforeRender += ev; + } + else if (arg0.op == EventOp.Sub) + { + UnityEngine.Events.UnityAction ev = (UnityEngine.Events.UnityAction)arg0.func; + UnityEngine.Application.onBeforeRender -= ev; + } + + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_focusChanged(IntPtr L) + { + try + { + EventObject arg0 = null; + + if (LuaDLL.lua_isuserdata(L, 2) != 0) + { + arg0 = (EventObject)ToLua.ToObject(L, 2); + } + else + { + return LuaDLL.luaL_throw(L, "The event 'UnityEngine.Application.focusChanged' can only appear on the left hand side of += or -= when used outside of the type 'UnityEngine.Application'"); + } + + if (arg0.op == EventOp.Add) + { + System.Action ev = (System.Action)arg0.func; + UnityEngine.Application.focusChanged += ev; + } + else if (arg0.op == EventOp.Sub) + { + System.Action ev = (System.Action)arg0.func; + UnityEngine.Application.focusChanged -= ev; + } + + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_deepLinkActivated(IntPtr L) + { + try + { + EventObject arg0 = null; + + if (LuaDLL.lua_isuserdata(L, 2) != 0) + { + arg0 = (EventObject)ToLua.ToObject(L, 2); + } + else + { + return LuaDLL.luaL_throw(L, "The event 'UnityEngine.Application.deepLinkActivated' can only appear on the left hand side of += or -= when used outside of the type 'UnityEngine.Application'"); + } + + if (arg0.op == EventOp.Add) + { + System.Action ev = (System.Action)arg0.func; + UnityEngine.Application.deepLinkActivated += ev; + } + else if (arg0.op == EventOp.Sub) + { + System.Action ev = (System.Action)arg0.func; + UnityEngine.Application.deepLinkActivated -= ev; + } + + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_wantsToQuit(IntPtr L) + { + try + { + EventObject arg0 = null; + + if (LuaDLL.lua_isuserdata(L, 2) != 0) + { + arg0 = (EventObject)ToLua.ToObject(L, 2); + } + else + { + return LuaDLL.luaL_throw(L, "The event 'UnityEngine.Application.wantsToQuit' can only appear on the left hand side of += or -= when used outside of the type 'UnityEngine.Application'"); + } + + if (arg0.op == EventOp.Add) + { + System.Func ev = (System.Func)arg0.func; + UnityEngine.Application.wantsToQuit += ev; + } + else if (arg0.op == EventOp.Sub) + { + System.Func ev = (System.Func)arg0.func; + UnityEngine.Application.wantsToQuit -= ev; + } + + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_quitting(IntPtr L) + { + try + { + EventObject arg0 = null; + + if (LuaDLL.lua_isuserdata(L, 2) != 0) + { + arg0 = (EventObject)ToLua.ToObject(L, 2); + } + else + { + return LuaDLL.luaL_throw(L, "The event 'UnityEngine.Application.quitting' can only appear on the left hand side of += or -= when used outside of the type 'UnityEngine.Application'"); + } + + if (arg0.op == EventOp.Add) + { + System.Action ev = (System.Action)arg0.func; + UnityEngine.Application.quitting += ev; + } + else if (arg0.op == EventOp.Sub) + { + System.Action ev = (System.Action)arg0.func; + UnityEngine.Application.quitting -= ev; + } + + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_unloading(IntPtr L) + { + try + { + EventObject arg0 = null; + + if (LuaDLL.lua_isuserdata(L, 2) != 0) + { + arg0 = (EventObject)ToLua.ToObject(L, 2); + } + else + { + return LuaDLL.luaL_throw(L, "The event 'UnityEngine.Application.unloading' can only appear on the left hand side of += or -= when used outside of the type 'UnityEngine.Application'"); + } + + if (arg0.op == EventOp.Add) + { + System.Action ev = (System.Action)arg0.func; + UnityEngine.Application.unloading += ev; + } + else if (arg0.op == EventOp.Sub) + { + System.Action ev = (System.Action)arg0.func; + UnityEngine.Application.unloading -= ev; + } + + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int UnityEngine_Application_AdvertisingIdentifierCallback(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + LuaFunction func = ToLua.CheckLuaFunction(L, 1); + + if (count == 1) + { + Delegate arg1 = DelegateTraits.Create(func); + ToLua.Push(L, arg1); + } + else + { + LuaTable self = ToLua.CheckLuaTable(L, 2); + Delegate arg1 = DelegateTraits.Create(func, self); + ToLua.Push(L, arg1); + } + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int UnityEngine_Application_LogCallback(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + LuaFunction func = ToLua.CheckLuaFunction(L, 1); + + if (count == 1) + { + Delegate arg1 = DelegateTraits.Create(func); + ToLua.Push(L, arg1); + } + else + { + LuaTable self = ToLua.CheckLuaTable(L, 2); + Delegate arg1 = DelegateTraits.Create(func, self); + ToLua.Push(L, arg1); + } + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int UnityEngine_Application_LowMemoryCallback(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + LuaFunction func = ToLua.CheckLuaFunction(L, 1); + + if (count == 1) + { + Delegate arg1 = DelegateTraits.Create(func); + ToLua.Push(L, arg1); + } + else + { + LuaTable self = ToLua.CheckLuaTable(L, 2); + Delegate arg1 = DelegateTraits.Create(func, self); + ToLua.Push(L, arg1); + } + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ApplicationWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ApplicationWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..1594c54bd31c3785fee66f59d0cf0ee09447b3ae --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ApplicationWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fe2db3982f78b7f45901134af8f446f2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AssetBundleWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AssetBundleWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..9259eead918b1c21b107270c7e97c8f674801e86 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AssetBundleWrap.cs @@ -0,0 +1,680 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_AssetBundleWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.AssetBundle), typeof(UnityEngine.Object)); + L.RegFunction("UnloadAllAssetBundles", UnloadAllAssetBundles); + L.RegFunction("GetAllLoadedAssetBundles", GetAllLoadedAssetBundles); + L.RegFunction("LoadFromFileAsync", LoadFromFileAsync); + L.RegFunction("LoadFromFile", LoadFromFile); + L.RegFunction("LoadFromMemoryAsync", LoadFromMemoryAsync); + L.RegFunction("LoadFromMemory", LoadFromMemory); + L.RegFunction("LoadFromStreamAsync", LoadFromStreamAsync); + L.RegFunction("LoadFromStream", LoadFromStream); + L.RegFunction("Contains", Contains); + L.RegFunction("LoadAsset", LoadAsset); + L.RegFunction("LoadAssetAsync", LoadAssetAsync); + L.RegFunction("LoadAssetWithSubAssets", LoadAssetWithSubAssets); + L.RegFunction("LoadAssetWithSubAssetsAsync", LoadAssetWithSubAssetsAsync); + L.RegFunction("LoadAllAssets", LoadAllAssets); + L.RegFunction("LoadAllAssetsAsync", LoadAllAssetsAsync); + L.RegFunction("Unload", Unload); + L.RegFunction("UnloadAsync", UnloadAsync); + L.RegFunction("GetAllAssetNames", GetAllAssetNames); + L.RegFunction("GetAllScenePaths", GetAllScenePaths); + L.RegFunction("RecompressAssetBundleAsync", RecompressAssetBundleAsync); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("isStreamedSceneAssetBundle", get_isStreamedSceneAssetBundle, null); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int UnloadAllAssetBundles(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + bool arg0 = LuaDLL.luaL_checkboolean(L, 1); + UnityEngine.AssetBundle.UnloadAllAssetBundles(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetAllLoadedAssetBundles(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 0); + System.Collections.Generic.IEnumerable o = UnityEngine.AssetBundle.GetAllLoadedAssetBundles(); + ToLua.PushObject(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LoadFromFileAsync(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + string arg0 = ToLua.CheckString(L, 1); + UnityEngine.AssetBundleCreateRequest o = UnityEngine.AssetBundle.LoadFromFileAsync(arg0); + ToLua.PushObject(L, o); + return 1; + } + else if (count == 2) + { + string arg0 = ToLua.CheckString(L, 1); + uint arg1 = (uint)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.AssetBundleCreateRequest o = UnityEngine.AssetBundle.LoadFromFileAsync(arg0, arg1); + ToLua.PushObject(L, o); + return 1; + } + else if (count == 3) + { + string arg0 = ToLua.CheckString(L, 1); + uint arg1 = (uint)LuaDLL.luaL_checknumber(L, 2); + ulong arg2 = LuaDLL.tolua_checkuint64(L, 3); + UnityEngine.AssetBundleCreateRequest o = UnityEngine.AssetBundle.LoadFromFileAsync(arg0, arg1, arg2); + ToLua.PushObject(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.AssetBundle.LoadFromFileAsync"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LoadFromFile(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + string arg0 = ToLua.CheckString(L, 1); + UnityEngine.AssetBundle o = UnityEngine.AssetBundle.LoadFromFile(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 2) + { + string arg0 = ToLua.CheckString(L, 1); + uint arg1 = (uint)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.AssetBundle o = UnityEngine.AssetBundle.LoadFromFile(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else if (count == 3) + { + string arg0 = ToLua.CheckString(L, 1); + uint arg1 = (uint)LuaDLL.luaL_checknumber(L, 2); + ulong arg2 = LuaDLL.tolua_checkuint64(L, 3); + UnityEngine.AssetBundle o = UnityEngine.AssetBundle.LoadFromFile(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.AssetBundle.LoadFromFile"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LoadFromMemoryAsync(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + byte[] arg0 = ToLua.CheckByteBuffer(L, 1); + UnityEngine.AssetBundleCreateRequest o = UnityEngine.AssetBundle.LoadFromMemoryAsync(arg0); + ToLua.PushObject(L, o); + return 1; + } + else if (count == 2) + { + byte[] arg0 = ToLua.CheckByteBuffer(L, 1); + uint arg1 = (uint)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.AssetBundleCreateRequest o = UnityEngine.AssetBundle.LoadFromMemoryAsync(arg0, arg1); + ToLua.PushObject(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.AssetBundle.LoadFromMemoryAsync"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LoadFromMemory(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + byte[] arg0 = ToLua.CheckByteBuffer(L, 1); + UnityEngine.AssetBundle o = UnityEngine.AssetBundle.LoadFromMemory(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 2) + { + byte[] arg0 = ToLua.CheckByteBuffer(L, 1); + uint arg1 = (uint)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.AssetBundle o = UnityEngine.AssetBundle.LoadFromMemory(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.AssetBundle.LoadFromMemory"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LoadFromStreamAsync(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + System.IO.Stream arg0 = (System.IO.Stream)ToLua.CheckObject(L, 1); + UnityEngine.AssetBundleCreateRequest o = UnityEngine.AssetBundle.LoadFromStreamAsync(arg0); + ToLua.PushObject(L, o); + return 1; + } + else if (count == 2) + { + System.IO.Stream arg0 = (System.IO.Stream)ToLua.CheckObject(L, 1); + uint arg1 = (uint)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.AssetBundleCreateRequest o = UnityEngine.AssetBundle.LoadFromStreamAsync(arg0, arg1); + ToLua.PushObject(L, o); + return 1; + } + else if (count == 3) + { + System.IO.Stream arg0 = (System.IO.Stream)ToLua.CheckObject(L, 1); + uint arg1 = (uint)LuaDLL.luaL_checknumber(L, 2); + uint arg2 = (uint)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.AssetBundleCreateRequest o = UnityEngine.AssetBundle.LoadFromStreamAsync(arg0, arg1, arg2); + ToLua.PushObject(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.AssetBundle.LoadFromStreamAsync"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LoadFromStream(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + System.IO.Stream arg0 = (System.IO.Stream)ToLua.CheckObject(L, 1); + UnityEngine.AssetBundle o = UnityEngine.AssetBundle.LoadFromStream(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 2) + { + System.IO.Stream arg0 = (System.IO.Stream)ToLua.CheckObject(L, 1); + uint arg1 = (uint)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.AssetBundle o = UnityEngine.AssetBundle.LoadFromStream(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else if (count == 3) + { + System.IO.Stream arg0 = (System.IO.Stream)ToLua.CheckObject(L, 1); + uint arg1 = (uint)LuaDLL.luaL_checknumber(L, 2); + uint arg2 = (uint)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.AssetBundle o = UnityEngine.AssetBundle.LoadFromStream(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.AssetBundle.LoadFromStream"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Contains(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.AssetBundle obj = (UnityEngine.AssetBundle)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + bool o = obj.Contains(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LoadAsset(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.AssetBundle obj = (UnityEngine.AssetBundle)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + UnityEngine.Object o = obj.LoadAsset(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.AssetBundle obj = (UnityEngine.AssetBundle)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + System.Type arg1 = ToLua.CheckMonoType(L, 3); + UnityEngine.Object o = obj.LoadAsset(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.AssetBundle.LoadAsset"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LoadAssetAsync(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.AssetBundle obj = (UnityEngine.AssetBundle)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + UnityEngine.AssetBundleRequest o = obj.LoadAssetAsync(arg0); + ToLua.PushObject(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.AssetBundle obj = (UnityEngine.AssetBundle)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + System.Type arg1 = ToLua.CheckMonoType(L, 3); + UnityEngine.AssetBundleRequest o = obj.LoadAssetAsync(arg0, arg1); + ToLua.PushObject(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.AssetBundle.LoadAssetAsync"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LoadAssetWithSubAssets(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.AssetBundle obj = (UnityEngine.AssetBundle)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + UnityEngine.Object[] o = obj.LoadAssetWithSubAssets(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.AssetBundle obj = (UnityEngine.AssetBundle)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + System.Type arg1 = ToLua.CheckMonoType(L, 3); + UnityEngine.Object[] o = obj.LoadAssetWithSubAssets(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.AssetBundle.LoadAssetWithSubAssets"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LoadAssetWithSubAssetsAsync(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.AssetBundle obj = (UnityEngine.AssetBundle)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + UnityEngine.AssetBundleRequest o = obj.LoadAssetWithSubAssetsAsync(arg0); + ToLua.PushObject(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.AssetBundle obj = (UnityEngine.AssetBundle)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + System.Type arg1 = ToLua.CheckMonoType(L, 3); + UnityEngine.AssetBundleRequest o = obj.LoadAssetWithSubAssetsAsync(arg0, arg1); + ToLua.PushObject(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.AssetBundle.LoadAssetWithSubAssetsAsync"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LoadAllAssets(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.AssetBundle obj = (UnityEngine.AssetBundle)ToLua.CheckObject(L, 1); + UnityEngine.Object[] o = obj.LoadAllAssets(); + ToLua.Push(L, o); + return 1; + } + else if (count == 2) + { + UnityEngine.AssetBundle obj = (UnityEngine.AssetBundle)ToLua.CheckObject(L, 1); + System.Type arg0 = ToLua.CheckMonoType(L, 2); + UnityEngine.Object[] o = obj.LoadAllAssets(arg0); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.AssetBundle.LoadAllAssets"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LoadAllAssetsAsync(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.AssetBundle obj = (UnityEngine.AssetBundle)ToLua.CheckObject(L, 1); + UnityEngine.AssetBundleRequest o = obj.LoadAllAssetsAsync(); + ToLua.PushObject(L, o); + return 1; + } + else if (count == 2) + { + UnityEngine.AssetBundle obj = (UnityEngine.AssetBundle)ToLua.CheckObject(L, 1); + System.Type arg0 = ToLua.CheckMonoType(L, 2); + UnityEngine.AssetBundleRequest o = obj.LoadAllAssetsAsync(arg0); + ToLua.PushObject(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.AssetBundle.LoadAllAssetsAsync"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Unload(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.AssetBundle obj = (UnityEngine.AssetBundle)ToLua.CheckObject(L, 1); + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.Unload(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int UnloadAsync(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.AssetBundle obj = (UnityEngine.AssetBundle)ToLua.CheckObject(L, 1); + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + UnityEngine.AsyncOperation o = obj.UnloadAsync(arg0); + ToLua.PushObject(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetAllAssetNames(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.AssetBundle obj = (UnityEngine.AssetBundle)ToLua.CheckObject(L, 1); + string[] o = obj.GetAllAssetNames(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetAllScenePaths(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.AssetBundle obj = (UnityEngine.AssetBundle)ToLua.CheckObject(L, 1); + string[] o = obj.GetAllScenePaths(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int RecompressAssetBundleAsync(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3) + { + string arg0 = ToLua.CheckString(L, 1); + string arg1 = ToLua.CheckString(L, 2); + UnityEngine.BuildCompression arg2 = StackTraits.Check(L, 3); + UnityEngine.AssetBundleRecompressOperation o = UnityEngine.AssetBundle.RecompressAssetBundleAsync(arg0, arg1, arg2); + ToLua.PushObject(L, o); + return 1; + } + else if (count == 4) + { + string arg0 = ToLua.CheckString(L, 1); + string arg1 = ToLua.CheckString(L, 2); + UnityEngine.BuildCompression arg2 = StackTraits.Check(L, 3); + uint arg3 = (uint)LuaDLL.luaL_checknumber(L, 4); + UnityEngine.AssetBundleRecompressOperation o = UnityEngine.AssetBundle.RecompressAssetBundleAsync(arg0, arg1, arg2, arg3); + ToLua.PushObject(L, o); + return 1; + } + else if (count == 5) + { + string arg0 = ToLua.CheckString(L, 1); + string arg1 = ToLua.CheckString(L, 2); + UnityEngine.BuildCompression arg2 = StackTraits.Check(L, 3); + uint arg3 = (uint)LuaDLL.luaL_checknumber(L, 4); + UnityEngine.ThreadPriority arg4 = (UnityEngine.ThreadPriority)ToLua.CheckObject(L, 5, typeof(UnityEngine.ThreadPriority)); + UnityEngine.AssetBundleRecompressOperation o = UnityEngine.AssetBundle.RecompressAssetBundleAsync(arg0, arg1, arg2, arg3, arg4); + ToLua.PushObject(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.AssetBundle.RecompressAssetBundleAsync"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isStreamedSceneAssetBundle(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AssetBundle obj = (UnityEngine.AssetBundle)o; + bool ret = obj.isStreamedSceneAssetBundle; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isStreamedSceneAssetBundle on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AssetBundleWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AssetBundleWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..de930bf2f085002f343f9f09117812b3333ade1c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AssetBundleWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 63294b6abfd1ea04d99f731889397867 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AsyncOperationWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AsyncOperationWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..c1229eff28dc82bf3554faf1c3a7ca7dc00191d6 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AsyncOperationWrap.cs @@ -0,0 +1,201 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_AsyncOperationWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.AsyncOperation), typeof(System.Object)); + L.RegFunction("New", _CreateUnityEngine_AsyncOperation); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("isDone", get_isDone, null); + L.RegVar("progress", get_progress, null); + L.RegVar("priority", get_priority, set_priority); + L.RegVar("allowSceneActivation", get_allowSceneActivation, set_allowSceneActivation); + L.RegVar("completed", get_completed, set_completed); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateUnityEngine_AsyncOperation(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + UnityEngine.AsyncOperation obj = new UnityEngine.AsyncOperation(); + ToLua.PushObject(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.AsyncOperation.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isDone(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AsyncOperation obj = (UnityEngine.AsyncOperation)o; + bool ret = obj.isDone; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isDone on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_progress(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AsyncOperation obj = (UnityEngine.AsyncOperation)o; + float ret = obj.progress; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index progress on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_priority(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AsyncOperation obj = (UnityEngine.AsyncOperation)o; + int ret = obj.priority; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index priority on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_allowSceneActivation(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AsyncOperation obj = (UnityEngine.AsyncOperation)o; + bool ret = obj.allowSceneActivation; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index allowSceneActivation on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_completed(IntPtr L) + { + ToLua.Push(L, new EventObject(typeof(System.Action))); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_priority(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AsyncOperation obj = (UnityEngine.AsyncOperation)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.priority = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index priority on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_allowSceneActivation(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AsyncOperation obj = (UnityEngine.AsyncOperation)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.allowSceneActivation = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index allowSceneActivation on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_completed(IntPtr L) + { + try + { + UnityEngine.AsyncOperation obj = (UnityEngine.AsyncOperation)ToLua.CheckObject(L, 1, typeof(UnityEngine.AsyncOperation)); + EventObject arg0 = null; + + if (LuaDLL.lua_isuserdata(L, 2) != 0) + { + arg0 = (EventObject)ToLua.ToObject(L, 2); + } + else + { + return LuaDLL.luaL_throw(L, "The event 'UnityEngine.AsyncOperation.completed' can only appear on the left hand side of += or -= when used outside of the type 'UnityEngine.AsyncOperation'"); + } + + if (arg0.op == EventOp.Add) + { + System.Action ev = (System.Action)arg0.func; + obj.completed += ev; + } + else if (arg0.op == EventOp.Sub) + { + System.Action ev = (System.Action)arg0.func; + obj.completed -= ev; + } + + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AsyncOperationWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AsyncOperationWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..ee77504d932a2041e006534723fc77aec56e0d88 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AsyncOperationWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d8131cae71c43f94295522dd6f0bc88d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AudioBehaviourWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AudioBehaviourWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..4f71d5d94f2a9703fd399286a6f4171e9ff795a5 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AudioBehaviourWrap.cs @@ -0,0 +1,58 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_AudioBehaviourWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.AudioBehaviour), typeof(UnityEngine.Behaviour)); + L.RegFunction("New", _CreateUnityEngine_AudioBehaviour); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateUnityEngine_AudioBehaviour(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + UnityEngine.AudioBehaviour obj = new UnityEngine.AudioBehaviour(); + ToLua.Push(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.AudioBehaviour.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AudioBehaviourWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AudioBehaviourWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..0e441371d3887b4571854c4585f39a7cfe4df100 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AudioBehaviourWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6f7b70ef389be054c9223c84db83a999 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AudioClipWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AudioClipWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..ad43ddf092c2abee78985791819b7033bef939e2 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AudioClipWrap.cs @@ -0,0 +1,400 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_AudioClipWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.AudioClip), typeof(UnityEngine.Object)); + L.RegFunction("LoadAudioData", LoadAudioData); + L.RegFunction("UnloadAudioData", UnloadAudioData); + L.RegFunction("GetData", GetData); + L.RegFunction("SetData", SetData); + L.RegFunction("Create", Create); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("length", get_length, null); + L.RegVar("samples", get_samples, null); + L.RegVar("channels", get_channels, null); + L.RegVar("frequency", get_frequency, null); + L.RegVar("loadType", get_loadType, null); + L.RegVar("preloadAudioData", get_preloadAudioData, null); + L.RegVar("ambisonic", get_ambisonic, null); + L.RegVar("loadInBackground", get_loadInBackground, null); + L.RegVar("loadState", get_loadState, null); + L.RegFunction("PCMReaderCallback", UnityEngine_AudioClip_PCMReaderCallback); + L.RegFunction("PCMSetPositionCallback", UnityEngine_AudioClip_PCMSetPositionCallback); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LoadAudioData(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.AudioClip obj = (UnityEngine.AudioClip)ToLua.CheckObject(L, 1, typeof(UnityEngine.AudioClip)); + bool o = obj.LoadAudioData(); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int UnloadAudioData(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.AudioClip obj = (UnityEngine.AudioClip)ToLua.CheckObject(L, 1, typeof(UnityEngine.AudioClip)); + bool o = obj.UnloadAudioData(); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetData(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.AudioClip obj = (UnityEngine.AudioClip)ToLua.CheckObject(L, 1, typeof(UnityEngine.AudioClip)); + float[] arg0 = ToLua.CheckNumberArray(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + bool o = obj.GetData(arg0, arg1); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetData(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.AudioClip obj = (UnityEngine.AudioClip)ToLua.CheckObject(L, 1, typeof(UnityEngine.AudioClip)); + float[] arg0 = ToLua.CheckNumberArray(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + bool o = obj.SetData(arg0, arg1); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Create(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 5) + { + string arg0 = ToLua.CheckString(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 4); + bool arg4 = LuaDLL.luaL_checkboolean(L, 5); + UnityEngine.AudioClip o = UnityEngine.AudioClip.Create(arg0, arg1, arg2, arg3, arg4); + ToLua.PushSealed(L, o); + return 1; + } + else if (count == 6) + { + string arg0 = ToLua.CheckString(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 4); + bool arg4 = LuaDLL.luaL_checkboolean(L, 5); + UnityEngine.AudioClip.PCMReaderCallback arg5 = (UnityEngine.AudioClip.PCMReaderCallback)ToLua.CheckDelegate(L, 6); + UnityEngine.AudioClip o = UnityEngine.AudioClip.Create(arg0, arg1, arg2, arg3, arg4, arg5); + ToLua.PushSealed(L, o); + return 1; + } + else if (count == 7) + { + string arg0 = ToLua.CheckString(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 4); + bool arg4 = LuaDLL.luaL_checkboolean(L, 5); + UnityEngine.AudioClip.PCMReaderCallback arg5 = (UnityEngine.AudioClip.PCMReaderCallback)ToLua.CheckDelegate(L, 6); + UnityEngine.AudioClip.PCMSetPositionCallback arg6 = (UnityEngine.AudioClip.PCMSetPositionCallback)ToLua.CheckDelegate(L, 7); + UnityEngine.AudioClip o = UnityEngine.AudioClip.Create(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + ToLua.PushSealed(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.AudioClip.Create"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_length(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioClip obj = (UnityEngine.AudioClip)o; + float ret = obj.length; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index length on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_samples(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioClip obj = (UnityEngine.AudioClip)o; + int ret = obj.samples; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index samples on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_channels(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioClip obj = (UnityEngine.AudioClip)o; + int ret = obj.channels; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index channels on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_frequency(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioClip obj = (UnityEngine.AudioClip)o; + int ret = obj.frequency; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index frequency on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_loadType(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioClip obj = (UnityEngine.AudioClip)o; + UnityEngine.AudioClipLoadType ret = obj.loadType; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index loadType on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_preloadAudioData(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioClip obj = (UnityEngine.AudioClip)o; + bool ret = obj.preloadAudioData; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index preloadAudioData on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_ambisonic(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioClip obj = (UnityEngine.AudioClip)o; + bool ret = obj.ambisonic; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index ambisonic on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_loadInBackground(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioClip obj = (UnityEngine.AudioClip)o; + bool ret = obj.loadInBackground; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index loadInBackground on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_loadState(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioClip obj = (UnityEngine.AudioClip)o; + UnityEngine.AudioDataLoadState ret = obj.loadState; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index loadState on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int UnityEngine_AudioClip_PCMReaderCallback(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + LuaFunction func = ToLua.CheckLuaFunction(L, 1); + + if (count == 1) + { + Delegate arg1 = DelegateTraits.Create(func); + ToLua.Push(L, arg1); + } + else + { + LuaTable self = ToLua.CheckLuaTable(L, 2); + Delegate arg1 = DelegateTraits.Create(func, self); + ToLua.Push(L, arg1); + } + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int UnityEngine_AudioClip_PCMSetPositionCallback(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + LuaFunction func = ToLua.CheckLuaFunction(L, 1); + + if (count == 1) + { + Delegate arg1 = DelegateTraits.Create(func); + ToLua.Push(L, arg1); + } + else + { + LuaTable self = ToLua.CheckLuaTable(L, 2); + Delegate arg1 = DelegateTraits.Create(func, self); + ToLua.Push(L, arg1); + } + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AudioClipWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AudioClipWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..c2a0cdf34b005dd6bbf2809a1d2ebf35fc2f0e6b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AudioClipWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6adddaa75c205a643a322a5c1d2d662a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AudioSourceWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AudioSourceWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..bff8ca7c0efb0b4d8322164fd30ced9c8728322c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AudioSourceWrap.cs @@ -0,0 +1,1494 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_AudioSourceWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.AudioSource), typeof(UnityEngine.AudioBehaviour)); + L.RegFunction("Play", Play); + L.RegFunction("PlayDelayed", PlayDelayed); + L.RegFunction("PlayScheduled", PlayScheduled); + L.RegFunction("PlayOneShot", PlayOneShot); + L.RegFunction("SetScheduledStartTime", SetScheduledStartTime); + L.RegFunction("SetScheduledEndTime", SetScheduledEndTime); + L.RegFunction("Stop", Stop); + L.RegFunction("Pause", Pause); + L.RegFunction("UnPause", UnPause); + L.RegFunction("PlayClipAtPoint", PlayClipAtPoint); + L.RegFunction("SetCustomCurve", SetCustomCurve); + L.RegFunction("GetCustomCurve", GetCustomCurve); + L.RegFunction("GetOutputData", GetOutputData); + L.RegFunction("GetSpectrumData", GetSpectrumData); + L.RegFunction("SetSpatializerFloat", SetSpatializerFloat); + L.RegFunction("GetSpatializerFloat", GetSpatializerFloat); + L.RegFunction("GetAmbisonicDecoderFloat", GetAmbisonicDecoderFloat); + L.RegFunction("SetAmbisonicDecoderFloat", SetAmbisonicDecoderFloat); + L.RegFunction("New", _CreateUnityEngine_AudioSource); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("volume", get_volume, set_volume); + L.RegVar("pitch", get_pitch, set_pitch); + L.RegVar("time", get_time, set_time); + L.RegVar("timeSamples", get_timeSamples, set_timeSamples); + L.RegVar("clip", get_clip, set_clip); + L.RegVar("outputAudioMixerGroup", get_outputAudioMixerGroup, set_outputAudioMixerGroup); + L.RegVar("isPlaying", get_isPlaying, null); + L.RegVar("isVirtual", get_isVirtual, null); + L.RegVar("loop", get_loop, set_loop); + L.RegVar("ignoreListenerVolume", get_ignoreListenerVolume, set_ignoreListenerVolume); + L.RegVar("playOnAwake", get_playOnAwake, set_playOnAwake); + L.RegVar("ignoreListenerPause", get_ignoreListenerPause, set_ignoreListenerPause); + L.RegVar("velocityUpdateMode", get_velocityUpdateMode, set_velocityUpdateMode); + L.RegVar("panStereo", get_panStereo, set_panStereo); + L.RegVar("spatialBlend", get_spatialBlend, set_spatialBlend); + L.RegVar("spatialize", get_spatialize, set_spatialize); + L.RegVar("spatializePostEffects", get_spatializePostEffects, set_spatializePostEffects); + L.RegVar("reverbZoneMix", get_reverbZoneMix, set_reverbZoneMix); + L.RegVar("bypassEffects", get_bypassEffects, set_bypassEffects); + L.RegVar("bypassListenerEffects", get_bypassListenerEffects, set_bypassListenerEffects); + L.RegVar("bypassReverbZones", get_bypassReverbZones, set_bypassReverbZones); + L.RegVar("dopplerLevel", get_dopplerLevel, set_dopplerLevel); + L.RegVar("spread", get_spread, set_spread); + L.RegVar("priority", get_priority, set_priority); + L.RegVar("mute", get_mute, set_mute); + L.RegVar("minDistance", get_minDistance, set_minDistance); + L.RegVar("maxDistance", get_maxDistance, set_maxDistance); + L.RegVar("rolloffMode", get_rolloffMode, set_rolloffMode); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateUnityEngine_AudioSource(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + UnityEngine.AudioSource obj = new UnityEngine.AudioSource(); + ToLua.PushSealed(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.AudioSource.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Play(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)ToLua.CheckObject(L, 1, typeof(UnityEngine.AudioSource)); + obj.Play(); + return 0; + } + else if (count == 2) + { + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)ToLua.CheckObject(L, 1, typeof(UnityEngine.AudioSource)); + ulong arg0 = LuaDLL.tolua_checkuint64(L, 2); + obj.Play(arg0); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.AudioSource.Play"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int PlayDelayed(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)ToLua.CheckObject(L, 1, typeof(UnityEngine.AudioSource)); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.PlayDelayed(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int PlayScheduled(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)ToLua.CheckObject(L, 1, typeof(UnityEngine.AudioSource)); + double arg0 = (double)LuaDLL.luaL_checknumber(L, 2); + obj.PlayScheduled(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int PlayOneShot(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)ToLua.CheckObject(L, 1, typeof(UnityEngine.AudioSource)); + UnityEngine.AudioClip arg0 = (UnityEngine.AudioClip)ToLua.CheckObject(L, 2, typeof(UnityEngine.AudioClip)); + obj.PlayOneShot(arg0); + return 0; + } + else if (count == 3) + { + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)ToLua.CheckObject(L, 1, typeof(UnityEngine.AudioSource)); + UnityEngine.AudioClip arg0 = (UnityEngine.AudioClip)ToLua.CheckObject(L, 2, typeof(UnityEngine.AudioClip)); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + obj.PlayOneShot(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.AudioSource.PlayOneShot"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetScheduledStartTime(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)ToLua.CheckObject(L, 1, typeof(UnityEngine.AudioSource)); + double arg0 = (double)LuaDLL.luaL_checknumber(L, 2); + obj.SetScheduledStartTime(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetScheduledEndTime(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)ToLua.CheckObject(L, 1, typeof(UnityEngine.AudioSource)); + double arg0 = (double)LuaDLL.luaL_checknumber(L, 2); + obj.SetScheduledEndTime(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Stop(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)ToLua.CheckObject(L, 1, typeof(UnityEngine.AudioSource)); + obj.Stop(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Pause(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)ToLua.CheckObject(L, 1, typeof(UnityEngine.AudioSource)); + obj.Pause(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int UnPause(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)ToLua.CheckObject(L, 1, typeof(UnityEngine.AudioSource)); + obj.UnPause(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int PlayClipAtPoint(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.AudioClip arg0 = (UnityEngine.AudioClip)ToLua.CheckObject(L, 1, typeof(UnityEngine.AudioClip)); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.AudioSource.PlayClipAtPoint(arg0, arg1); + return 0; + } + else if (count == 3) + { + UnityEngine.AudioClip arg0 = (UnityEngine.AudioClip)ToLua.CheckObject(L, 1, typeof(UnityEngine.AudioClip)); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.AudioSource.PlayClipAtPoint(arg0, arg1, arg2); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.AudioSource.PlayClipAtPoint"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetCustomCurve(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)ToLua.CheckObject(L, 1, typeof(UnityEngine.AudioSource)); + UnityEngine.AudioSourceCurveType arg0 = (UnityEngine.AudioSourceCurveType)ToLua.CheckObject(L, 2, typeof(UnityEngine.AudioSourceCurveType)); + UnityEngine.AnimationCurve arg1 = (UnityEngine.AnimationCurve)ToLua.CheckObject(L, 3); + obj.SetCustomCurve(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetCustomCurve(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)ToLua.CheckObject(L, 1, typeof(UnityEngine.AudioSource)); + UnityEngine.AudioSourceCurveType arg0 = (UnityEngine.AudioSourceCurveType)ToLua.CheckObject(L, 2, typeof(UnityEngine.AudioSourceCurveType)); + UnityEngine.AnimationCurve o = obj.GetCustomCurve(arg0); + ToLua.PushObject(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetOutputData(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)ToLua.CheckObject(L, 1, typeof(UnityEngine.AudioSource)); + float[] arg0 = ToLua.CheckNumberArray(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + obj.GetOutputData(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetSpectrumData(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 4); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)ToLua.CheckObject(L, 1, typeof(UnityEngine.AudioSource)); + float[] arg0 = ToLua.CheckNumberArray(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.FFTWindow arg2 = (UnityEngine.FFTWindow)ToLua.CheckObject(L, 4, typeof(UnityEngine.FFTWindow)); + obj.GetSpectrumData(arg0, arg1, arg2); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetSpatializerFloat(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)ToLua.CheckObject(L, 1, typeof(UnityEngine.AudioSource)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + bool o = obj.SetSpatializerFloat(arg0, arg1); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetSpatializerFloat(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)ToLua.CheckObject(L, 1, typeof(UnityEngine.AudioSource)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + float arg1; + bool o = obj.GetSpatializerFloat(arg0, out arg1); + LuaDLL.lua_pushboolean(L, o); + LuaDLL.lua_pushnumber(L, arg1); + return 2; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetAmbisonicDecoderFloat(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)ToLua.CheckObject(L, 1, typeof(UnityEngine.AudioSource)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + float arg1; + bool o = obj.GetAmbisonicDecoderFloat(arg0, out arg1); + LuaDLL.lua_pushboolean(L, o); + LuaDLL.lua_pushnumber(L, arg1); + return 2; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetAmbisonicDecoderFloat(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)ToLua.CheckObject(L, 1, typeof(UnityEngine.AudioSource)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + bool o = obj.SetAmbisonicDecoderFloat(arg0, arg1); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_volume(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + float ret = obj.volume; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index volume on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_pitch(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + float ret = obj.pitch; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index pitch on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_time(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + float ret = obj.time; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index time on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_timeSamples(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + int ret = obj.timeSamples; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index timeSamples on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_clip(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + UnityEngine.AudioClip ret = obj.clip; + ToLua.PushSealed(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index clip on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_outputAudioMixerGroup(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + UnityEngine.Audio.AudioMixerGroup ret = obj.outputAudioMixerGroup; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index outputAudioMixerGroup on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isPlaying(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + bool ret = obj.isPlaying; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isPlaying on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isVirtual(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + bool ret = obj.isVirtual; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isVirtual on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_loop(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + bool ret = obj.loop; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index loop on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_ignoreListenerVolume(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + bool ret = obj.ignoreListenerVolume; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index ignoreListenerVolume on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_playOnAwake(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + bool ret = obj.playOnAwake; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index playOnAwake on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_ignoreListenerPause(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + bool ret = obj.ignoreListenerPause; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index ignoreListenerPause on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_velocityUpdateMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + UnityEngine.AudioVelocityUpdateMode ret = obj.velocityUpdateMode; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index velocityUpdateMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_panStereo(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + float ret = obj.panStereo; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index panStereo on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_spatialBlend(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + float ret = obj.spatialBlend; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index spatialBlend on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_spatialize(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + bool ret = obj.spatialize; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index spatialize on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_spatializePostEffects(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + bool ret = obj.spatializePostEffects; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index spatializePostEffects on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_reverbZoneMix(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + float ret = obj.reverbZoneMix; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index reverbZoneMix on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_bypassEffects(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + bool ret = obj.bypassEffects; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index bypassEffects on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_bypassListenerEffects(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + bool ret = obj.bypassListenerEffects; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index bypassListenerEffects on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_bypassReverbZones(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + bool ret = obj.bypassReverbZones; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index bypassReverbZones on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_dopplerLevel(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + float ret = obj.dopplerLevel; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index dopplerLevel on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_spread(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + float ret = obj.spread; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index spread on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_priority(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + int ret = obj.priority; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index priority on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_mute(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + bool ret = obj.mute; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index mute on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_minDistance(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + float ret = obj.minDistance; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index minDistance on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_maxDistance(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + float ret = obj.maxDistance; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index maxDistance on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_rolloffMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + UnityEngine.AudioRolloffMode ret = obj.rolloffMode; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index rolloffMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_volume(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.volume = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index volume on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_pitch(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.pitch = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index pitch on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_time(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.time = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index time on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_timeSamples(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.timeSamples = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index timeSamples on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_clip(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + UnityEngine.AudioClip arg0 = (UnityEngine.AudioClip)ToLua.CheckObject(L, 2, typeof(UnityEngine.AudioClip)); + obj.clip = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index clip on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_outputAudioMixerGroup(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + UnityEngine.Audio.AudioMixerGroup arg0 = (UnityEngine.Audio.AudioMixerGroup)ToLua.CheckObject(L, 2); + obj.outputAudioMixerGroup = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index outputAudioMixerGroup on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_loop(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.loop = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index loop on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_ignoreListenerVolume(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.ignoreListenerVolume = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index ignoreListenerVolume on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_playOnAwake(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.playOnAwake = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index playOnAwake on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_ignoreListenerPause(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.ignoreListenerPause = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index ignoreListenerPause on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_velocityUpdateMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + UnityEngine.AudioVelocityUpdateMode arg0 = (UnityEngine.AudioVelocityUpdateMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.AudioVelocityUpdateMode)); + obj.velocityUpdateMode = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index velocityUpdateMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_panStereo(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.panStereo = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index panStereo on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_spatialBlend(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.spatialBlend = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index spatialBlend on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_spatialize(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.spatialize = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index spatialize on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_spatializePostEffects(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.spatializePostEffects = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index spatializePostEffects on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_reverbZoneMix(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.reverbZoneMix = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index reverbZoneMix on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_bypassEffects(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.bypassEffects = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index bypassEffects on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_bypassListenerEffects(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.bypassListenerEffects = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index bypassListenerEffects on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_bypassReverbZones(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.bypassReverbZones = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index bypassReverbZones on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_dopplerLevel(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.dopplerLevel = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index dopplerLevel on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_spread(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.spread = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index spread on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_priority(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.priority = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index priority on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_mute(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.mute = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index mute on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_minDistance(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.minDistance = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index minDistance on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_maxDistance(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.maxDistance = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index maxDistance on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_rolloffMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.AudioSource obj = (UnityEngine.AudioSource)o; + UnityEngine.AudioRolloffMode arg0 = (UnityEngine.AudioRolloffMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.AudioRolloffMode)); + obj.rolloffMode = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index rolloffMode on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AudioSourceWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AudioSourceWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..f0de174b246b85b1d8e3926ffed90e141aa3fe68 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_AudioSourceWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 739b4e443c6b5a64a81440d4a165aceb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_BehaviourWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_BehaviourWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..38c4d452fbfb304199ac8564f86b658188168b57 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_BehaviourWrap.cs @@ -0,0 +1,117 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_BehaviourWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.Behaviour), typeof(UnityEngine.Component)); + L.RegFunction("New", _CreateUnityEngine_Behaviour); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("enabled", get_enabled, set_enabled); + L.RegVar("isActiveAndEnabled", get_isActiveAndEnabled, null); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateUnityEngine_Behaviour(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + UnityEngine.Behaviour obj = new UnityEngine.Behaviour(); + ToLua.Push(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.Behaviour.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_enabled(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Behaviour obj = (UnityEngine.Behaviour)o; + bool ret = obj.enabled; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index enabled on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isActiveAndEnabled(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Behaviour obj = (UnityEngine.Behaviour)o; + bool ret = obj.isActiveAndEnabled; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isActiveAndEnabled on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_enabled(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Behaviour obj = (UnityEngine.Behaviour)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.enabled = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index enabled on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_BehaviourWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_BehaviourWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..7d01ee084ef2ec84453b152abe8f33a4b337d878 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_BehaviourWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3b58e287ecce0b146a00c2323f42e394 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_BoxColliderWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_BoxColliderWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..d56516c0a8f40df9f6ac0c58d658c8aeb51667c6 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_BoxColliderWrap.cs @@ -0,0 +1,136 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_BoxColliderWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.BoxCollider), typeof(UnityEngine.Collider)); + L.RegFunction("New", _CreateUnityEngine_BoxCollider); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("center", get_center, set_center); + L.RegVar("size", get_size, set_size); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateUnityEngine_BoxCollider(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + UnityEngine.BoxCollider obj = new UnityEngine.BoxCollider(); + ToLua.Push(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.BoxCollider.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_center(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.BoxCollider obj = (UnityEngine.BoxCollider)o; + UnityEngine.Vector3 ret = obj.center; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index center on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_size(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.BoxCollider obj = (UnityEngine.BoxCollider)o; + UnityEngine.Vector3 ret = obj.size; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index size on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_center(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.BoxCollider obj = (UnityEngine.BoxCollider)o; + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + obj.center = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index center on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_size(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.BoxCollider obj = (UnityEngine.BoxCollider)o; + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + obj.size = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index size on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_BoxColliderWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_BoxColliderWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..06244945c8518c958cb093c8f9316660bd7d5f6c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_BoxColliderWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2fe79d91be89b9a4e92516f2f9fa159c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_CameraClearFlagsWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_CameraClearFlagsWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..ecd9d0d833da660871f1c38b66a54db2f586c58d --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_CameraClearFlagsWrap.cs @@ -0,0 +1,75 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_CameraClearFlagsWrap +{ + public static void Register(LuaState L) + { + L.BeginEnum(typeof(UnityEngine.CameraClearFlags)); + L.RegVar("Skybox", get_Skybox, null); + L.RegVar("Color", get_Color, null); + L.RegVar("SolidColor", get_SolidColor, null); + L.RegVar("Depth", get_Depth, null); + L.RegVar("Nothing", get_Nothing, null); + L.RegFunction("IntToEnum", IntToEnum); + L.EndEnum(); + TypeTraits.Check = CheckType; + StackTraits.Push = Push; + } + + static void Push(IntPtr L, UnityEngine.CameraClearFlags arg) + { + ToLua.Push(L, arg); + } + + static bool CheckType(IntPtr L, int pos) + { + return TypeChecker.CheckEnumType(typeof(UnityEngine.CameraClearFlags), L, pos); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Skybox(IntPtr L) + { + ToLua.Push(L, UnityEngine.CameraClearFlags.Skybox); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Color(IntPtr L) + { + ToLua.Push(L, UnityEngine.CameraClearFlags.Color); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_SolidColor(IntPtr L) + { + ToLua.Push(L, UnityEngine.CameraClearFlags.SolidColor); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Depth(IntPtr L) + { + ToLua.Push(L, UnityEngine.CameraClearFlags.Depth); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Nothing(IntPtr L) + { + ToLua.Push(L, UnityEngine.CameraClearFlags.Nothing); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IntToEnum(IntPtr L) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + UnityEngine.CameraClearFlags o = (UnityEngine.CameraClearFlags)arg0; + ToLua.Push(L, o); + return 1; + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_CameraClearFlagsWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_CameraClearFlagsWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..dea645703af1c156027f725cb96a7dc19054897f --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_CameraClearFlagsWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 76a9fd4ebeb78e24cb2156099966d69f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_CameraWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_CameraWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..be1dc5bd1246fee0c8d71dc4024fd54e4d3b64ed --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_CameraWrap.cs @@ -0,0 +1,3319 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_CameraWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.Camera), typeof(UnityEngine.Behaviour)); + L.RegFunction("Reset", Reset); + L.RegFunction("ResetTransparencySortSettings", ResetTransparencySortSettings); + L.RegFunction("ResetAspect", ResetAspect); + L.RegFunction("ResetCullingMatrix", ResetCullingMatrix); + L.RegFunction("SetReplacementShader", SetReplacementShader); + L.RegFunction("ResetReplacementShader", ResetReplacementShader); + L.RegFunction("GetGateFittedFieldOfView", GetGateFittedFieldOfView); + L.RegFunction("GetGateFittedLensShift", GetGateFittedLensShift); + L.RegFunction("SetTargetBuffers", SetTargetBuffers); + L.RegFunction("ResetWorldToCameraMatrix", ResetWorldToCameraMatrix); + L.RegFunction("ResetProjectionMatrix", ResetProjectionMatrix); + L.RegFunction("CalculateObliqueMatrix", CalculateObliqueMatrix); + L.RegFunction("WorldToScreenPoint", WorldToScreenPoint); + L.RegFunction("WorldToViewportPoint", WorldToViewportPoint); + L.RegFunction("ViewportToWorldPoint", ViewportToWorldPoint); + L.RegFunction("ScreenToWorldPoint", ScreenToWorldPoint); + L.RegFunction("ScreenToViewportPoint", ScreenToViewportPoint); + L.RegFunction("ViewportToScreenPoint", ViewportToScreenPoint); + L.RegFunction("ViewportPointToRay", ViewportPointToRay); + L.RegFunction("ScreenPointToRay", ScreenPointToRay); + L.RegFunction("CalculateFrustumCorners", CalculateFrustumCorners); + L.RegFunction("CalculateProjectionMatrixFromPhysicalProperties", CalculateProjectionMatrixFromPhysicalProperties); + L.RegFunction("FocalLengthToFieldOfView", FocalLengthToFieldOfView); + L.RegFunction("FieldOfViewToFocalLength", FieldOfViewToFocalLength); + L.RegFunction("HorizontalToVerticalFieldOfView", HorizontalToVerticalFieldOfView); + L.RegFunction("VerticalToHorizontalFieldOfView", VerticalToHorizontalFieldOfView); + L.RegFunction("GetStereoNonJitteredProjectionMatrix", GetStereoNonJitteredProjectionMatrix); + L.RegFunction("GetStereoViewMatrix", GetStereoViewMatrix); + L.RegFunction("CopyStereoDeviceProjectionMatrixToNonJittered", CopyStereoDeviceProjectionMatrixToNonJittered); + L.RegFunction("GetStereoProjectionMatrix", GetStereoProjectionMatrix); + L.RegFunction("SetStereoProjectionMatrix", SetStereoProjectionMatrix); + L.RegFunction("ResetStereoProjectionMatrices", ResetStereoProjectionMatrices); + L.RegFunction("SetStereoViewMatrix", SetStereoViewMatrix); + L.RegFunction("ResetStereoViewMatrices", ResetStereoViewMatrices); + L.RegFunction("GetAllCameras", GetAllCameras); + L.RegFunction("RenderToCubemap", RenderToCubemap); + L.RegFunction("Render", Render); + L.RegFunction("RenderWithShader", RenderWithShader); + L.RegFunction("RenderDontRestore", RenderDontRestore); + L.RegFunction("SubmitRenderRequests", SubmitRenderRequests); + L.RegFunction("SetupCurrent", SetupCurrent); + L.RegFunction("CopyFrom", CopyFrom); + L.RegFunction("RemoveCommandBuffers", RemoveCommandBuffers); + L.RegFunction("RemoveAllCommandBuffers", RemoveAllCommandBuffers); + L.RegFunction("AddCommandBuffer", AddCommandBuffer); + L.RegFunction("AddCommandBufferAsync", AddCommandBufferAsync); + L.RegFunction("RemoveCommandBuffer", RemoveCommandBuffer); + L.RegFunction("GetCommandBuffers", GetCommandBuffers); + L.RegFunction("TryGetCullingParameters", TryGetCullingParameters); + L.RegFunction("New", _CreateUnityEngine_Camera); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("onPreCull", get_onPreCull, set_onPreCull); + L.RegVar("onPreRender", get_onPreRender, set_onPreRender); + L.RegVar("onPostRender", get_onPostRender, set_onPostRender); + L.RegVar("nearClipPlane", get_nearClipPlane, set_nearClipPlane); + L.RegVar("farClipPlane", get_farClipPlane, set_farClipPlane); + L.RegVar("fieldOfView", get_fieldOfView, set_fieldOfView); + L.RegVar("renderingPath", get_renderingPath, set_renderingPath); + L.RegVar("actualRenderingPath", get_actualRenderingPath, null); + L.RegVar("allowHDR", get_allowHDR, set_allowHDR); + L.RegVar("allowMSAA", get_allowMSAA, set_allowMSAA); + L.RegVar("allowDynamicResolution", get_allowDynamicResolution, set_allowDynamicResolution); + L.RegVar("forceIntoRenderTexture", get_forceIntoRenderTexture, set_forceIntoRenderTexture); + L.RegVar("orthographicSize", get_orthographicSize, set_orthographicSize); + L.RegVar("orthographic", get_orthographic, set_orthographic); + L.RegVar("opaqueSortMode", get_opaqueSortMode, set_opaqueSortMode); + L.RegVar("transparencySortMode", get_transparencySortMode, set_transparencySortMode); + L.RegVar("transparencySortAxis", get_transparencySortAxis, set_transparencySortAxis); + L.RegVar("depth", get_depth, set_depth); + L.RegVar("aspect", get_aspect, set_aspect); + L.RegVar("velocity", get_velocity, null); + L.RegVar("cullingMask", get_cullingMask, set_cullingMask); + L.RegVar("eventMask", get_eventMask, set_eventMask); + L.RegVar("layerCullSpherical", get_layerCullSpherical, set_layerCullSpherical); + L.RegVar("cameraType", get_cameraType, set_cameraType); + L.RegVar("overrideSceneCullingMask", get_overrideSceneCullingMask, set_overrideSceneCullingMask); + L.RegVar("layerCullDistances", get_layerCullDistances, set_layerCullDistances); + L.RegVar("useOcclusionCulling", get_useOcclusionCulling, set_useOcclusionCulling); + L.RegVar("cullingMatrix", get_cullingMatrix, set_cullingMatrix); + L.RegVar("backgroundColor", get_backgroundColor, set_backgroundColor); + L.RegVar("clearFlags", get_clearFlags, set_clearFlags); + L.RegVar("depthTextureMode", get_depthTextureMode, set_depthTextureMode); + L.RegVar("clearStencilAfterLightingPass", get_clearStencilAfterLightingPass, set_clearStencilAfterLightingPass); + L.RegVar("usePhysicalProperties", get_usePhysicalProperties, set_usePhysicalProperties); + L.RegVar("sensorSize", get_sensorSize, set_sensorSize); + L.RegVar("lensShift", get_lensShift, set_lensShift); + L.RegVar("focalLength", get_focalLength, set_focalLength); + L.RegVar("gateFit", get_gateFit, set_gateFit); + L.RegVar("rect", get_rect, set_rect); + L.RegVar("pixelRect", get_pixelRect, set_pixelRect); + L.RegVar("pixelWidth", get_pixelWidth, null); + L.RegVar("pixelHeight", get_pixelHeight, null); + L.RegVar("scaledPixelWidth", get_scaledPixelWidth, null); + L.RegVar("scaledPixelHeight", get_scaledPixelHeight, null); + L.RegVar("targetTexture", get_targetTexture, set_targetTexture); + L.RegVar("activeTexture", get_activeTexture, null); + L.RegVar("targetDisplay", get_targetDisplay, set_targetDisplay); + L.RegVar("cameraToWorldMatrix", get_cameraToWorldMatrix, null); + L.RegVar("worldToCameraMatrix", get_worldToCameraMatrix, set_worldToCameraMatrix); + L.RegVar("projectionMatrix", get_projectionMatrix, set_projectionMatrix); + L.RegVar("nonJitteredProjectionMatrix", get_nonJitteredProjectionMatrix, set_nonJitteredProjectionMatrix); + L.RegVar("useJitteredProjectionMatrixForTransparentRendering", get_useJitteredProjectionMatrixForTransparentRendering, set_useJitteredProjectionMatrixForTransparentRendering); + L.RegVar("previousViewProjectionMatrix", get_previousViewProjectionMatrix, null); + L.RegVar("main", get_main, null); + L.RegVar("current", get_current, null); + L.RegVar("scene", get_scene, set_scene); + L.RegVar("stereoEnabled", get_stereoEnabled, null); + L.RegVar("stereoSeparation", get_stereoSeparation, set_stereoSeparation); + L.RegVar("stereoConvergence", get_stereoConvergence, set_stereoConvergence); + L.RegVar("areVRStereoViewMatricesWithinSingleCullTolerance", get_areVRStereoViewMatricesWithinSingleCullTolerance, null); + L.RegVar("stereoTargetEye", get_stereoTargetEye, set_stereoTargetEye); + L.RegVar("stereoActiveEye", get_stereoActiveEye, null); + L.RegVar("allCamerasCount", get_allCamerasCount, null); + L.RegVar("allCameras", get_allCameras, null); + L.RegVar("commandBufferCount", get_commandBufferCount, null); + L.RegFunction("CameraCallback", UnityEngine_Camera_CameraCallback); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateUnityEngine_Camera(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + UnityEngine.Camera obj = new UnityEngine.Camera(); + ToLua.PushSealed(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.Camera.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Reset(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + obj.Reset(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ResetTransparencySortSettings(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + obj.ResetTransparencySortSettings(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ResetAspect(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + obj.ResetAspect(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ResetCullingMatrix(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + obj.ResetCullingMatrix(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetReplacementShader(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Shader arg0 = (UnityEngine.Shader)ToLua.CheckObject(L, 2, typeof(UnityEngine.Shader)); + string arg1 = ToLua.CheckString(L, 3); + obj.SetReplacementShader(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ResetReplacementShader(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + obj.ResetReplacementShader(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetGateFittedFieldOfView(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + float o = obj.GetGateFittedFieldOfView(); + LuaDLL.lua_pushnumber(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetGateFittedLensShift(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Vector2 o = obj.GetGateFittedLensShift(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetTargetBuffers(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.RenderBuffer arg0 = StackTraits.To(L, 2); + UnityEngine.RenderBuffer arg1 = StackTraits.To(L, 3); + obj.SetTargetBuffers(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.RenderBuffer[] arg0 = ToLua.ToStructArray(L, 2); + UnityEngine.RenderBuffer arg1 = StackTraits.To(L, 3); + obj.SetTargetBuffers(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Camera.SetTargetBuffers"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ResetWorldToCameraMatrix(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + obj.ResetWorldToCameraMatrix(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ResetProjectionMatrix(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + obj.ResetProjectionMatrix(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CalculateObliqueMatrix(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Vector4 arg0 = ToLua.ToVector4(L, 2); + UnityEngine.Matrix4x4 o = obj.CalculateObliqueMatrix(arg0); + ToLua.PushValue(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int WorldToScreenPoint(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 o = obj.WorldToScreenPoint(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Camera.MonoOrStereoscopicEye arg1 = (UnityEngine.Camera.MonoOrStereoscopicEye)ToLua.CheckObject(L, 3, typeof(UnityEngine.Camera.MonoOrStereoscopicEye)); + UnityEngine.Vector3 o = obj.WorldToScreenPoint(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Camera.WorldToScreenPoint"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int WorldToViewportPoint(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 o = obj.WorldToViewportPoint(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Camera.MonoOrStereoscopicEye arg1 = (UnityEngine.Camera.MonoOrStereoscopicEye)ToLua.CheckObject(L, 3, typeof(UnityEngine.Camera.MonoOrStereoscopicEye)); + UnityEngine.Vector3 o = obj.WorldToViewportPoint(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Camera.WorldToViewportPoint"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ViewportToWorldPoint(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 o = obj.ViewportToWorldPoint(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Camera.MonoOrStereoscopicEye arg1 = (UnityEngine.Camera.MonoOrStereoscopicEye)ToLua.CheckObject(L, 3, typeof(UnityEngine.Camera.MonoOrStereoscopicEye)); + UnityEngine.Vector3 o = obj.ViewportToWorldPoint(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Camera.ViewportToWorldPoint"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ScreenToWorldPoint(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 o = obj.ScreenToWorldPoint(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Camera.MonoOrStereoscopicEye arg1 = (UnityEngine.Camera.MonoOrStereoscopicEye)ToLua.CheckObject(L, 3, typeof(UnityEngine.Camera.MonoOrStereoscopicEye)); + UnityEngine.Vector3 o = obj.ScreenToWorldPoint(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Camera.ScreenToWorldPoint"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ScreenToViewportPoint(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 o = obj.ScreenToViewportPoint(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ViewportToScreenPoint(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 o = obj.ViewportToScreenPoint(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ViewportPointToRay(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Ray o = obj.ViewportPointToRay(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Camera.MonoOrStereoscopicEye arg1 = (UnityEngine.Camera.MonoOrStereoscopicEye)ToLua.CheckObject(L, 3, typeof(UnityEngine.Camera.MonoOrStereoscopicEye)); + UnityEngine.Ray o = obj.ViewportPointToRay(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Camera.ViewportPointToRay"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ScreenPointToRay(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Ray o = obj.ScreenPointToRay(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Camera.MonoOrStereoscopicEye arg1 = (UnityEngine.Camera.MonoOrStereoscopicEye)ToLua.CheckObject(L, 3, typeof(UnityEngine.Camera.MonoOrStereoscopicEye)); + UnityEngine.Ray o = obj.ScreenPointToRay(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Camera.ScreenPointToRay"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CalculateFrustumCorners(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 5); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Rect arg0 = StackTraits.Check(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Camera.MonoOrStereoscopicEye arg2 = (UnityEngine.Camera.MonoOrStereoscopicEye)ToLua.CheckObject(L, 4, typeof(UnityEngine.Camera.MonoOrStereoscopicEye)); + UnityEngine.Vector3[] arg3 = ToLua.CheckStructArray(L, 5); + obj.CalculateFrustumCorners(arg0, arg1, arg2, arg3); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CalculateProjectionMatrixFromPhysicalProperties(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 6) + { + UnityEngine.Matrix4x4 arg0; + float arg1 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Vector2 arg2 = ToLua.ToVector2(L, 3); + UnityEngine.Vector2 arg3 = ToLua.ToVector2(L, 4); + float arg4 = (float)LuaDLL.luaL_checknumber(L, 5); + float arg5 = (float)LuaDLL.luaL_checknumber(L, 6); + UnityEngine.Camera.CalculateProjectionMatrixFromPhysicalProperties(out arg0, arg1, arg2, arg3, arg4, arg5); + ToLua.PushValue(L, arg0); + return 1; + } + else if (count == 7) + { + UnityEngine.Matrix4x4 arg0; + float arg1 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Vector2 arg2 = ToLua.ToVector2(L, 3); + UnityEngine.Vector2 arg3 = ToLua.ToVector2(L, 4); + float arg4 = (float)LuaDLL.luaL_checknumber(L, 5); + float arg5 = (float)LuaDLL.luaL_checknumber(L, 6); + UnityEngine.Camera.GateFitParameters arg6 = StackTraits.Check(L, 7); + UnityEngine.Camera.CalculateProjectionMatrixFromPhysicalProperties(out arg0, arg1, arg2, arg3, arg4, arg5, arg6); + ToLua.PushValue(L, arg0); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Camera.CalculateProjectionMatrixFromPhysicalProperties"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int FocalLengthToFieldOfView(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 1); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 2); + float o = UnityEngine.Camera.FocalLengthToFieldOfView(arg0, arg1); + LuaDLL.lua_pushnumber(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int FieldOfViewToFocalLength(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 1); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 2); + float o = UnityEngine.Camera.FieldOfViewToFocalLength(arg0, arg1); + LuaDLL.lua_pushnumber(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int HorizontalToVerticalFieldOfView(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 1); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 2); + float o = UnityEngine.Camera.HorizontalToVerticalFieldOfView(arg0, arg1); + LuaDLL.lua_pushnumber(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int VerticalToHorizontalFieldOfView(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 1); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 2); + float o = UnityEngine.Camera.VerticalToHorizontalFieldOfView(arg0, arg1); + LuaDLL.lua_pushnumber(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetStereoNonJitteredProjectionMatrix(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Camera.StereoscopicEye arg0 = (UnityEngine.Camera.StereoscopicEye)ToLua.CheckObject(L, 2, typeof(UnityEngine.Camera.StereoscopicEye)); + UnityEngine.Matrix4x4 o = obj.GetStereoNonJitteredProjectionMatrix(arg0); + ToLua.PushValue(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetStereoViewMatrix(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Camera.StereoscopicEye arg0 = (UnityEngine.Camera.StereoscopicEye)ToLua.CheckObject(L, 2, typeof(UnityEngine.Camera.StereoscopicEye)); + UnityEngine.Matrix4x4 o = obj.GetStereoViewMatrix(arg0); + ToLua.PushValue(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CopyStereoDeviceProjectionMatrixToNonJittered(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Camera.StereoscopicEye arg0 = (UnityEngine.Camera.StereoscopicEye)ToLua.CheckObject(L, 2, typeof(UnityEngine.Camera.StereoscopicEye)); + obj.CopyStereoDeviceProjectionMatrixToNonJittered(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetStereoProjectionMatrix(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Camera.StereoscopicEye arg0 = (UnityEngine.Camera.StereoscopicEye)ToLua.CheckObject(L, 2, typeof(UnityEngine.Camera.StereoscopicEye)); + UnityEngine.Matrix4x4 o = obj.GetStereoProjectionMatrix(arg0); + ToLua.PushValue(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetStereoProjectionMatrix(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Camera.StereoscopicEye arg0 = (UnityEngine.Camera.StereoscopicEye)ToLua.CheckObject(L, 2, typeof(UnityEngine.Camera.StereoscopicEye)); + UnityEngine.Matrix4x4 arg1 = StackTraits.Check(L, 3); + obj.SetStereoProjectionMatrix(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ResetStereoProjectionMatrices(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + obj.ResetStereoProjectionMatrices(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetStereoViewMatrix(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Camera.StereoscopicEye arg0 = (UnityEngine.Camera.StereoscopicEye)ToLua.CheckObject(L, 2, typeof(UnityEngine.Camera.StereoscopicEye)); + UnityEngine.Matrix4x4 arg1 = StackTraits.Check(L, 3); + obj.SetStereoViewMatrix(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ResetStereoViewMatrices(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + obj.ResetStereoViewMatrices(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetAllCameras(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Camera[] arg0 = ToLua.CheckObjectArray(L, 1); + int o = UnityEngine.Camera.GetAllCameras(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int RenderToCubemap(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Cubemap arg0 = (UnityEngine.Cubemap)ToLua.ToObject(L, 2); + bool o = obj.RenderToCubemap(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.RenderTexture arg0 = (UnityEngine.RenderTexture)ToLua.ToObject(L, 2); + bool o = obj.RenderToCubemap(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Cubemap arg0 = (UnityEngine.Cubemap)ToLua.ToObject(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + bool o = obj.RenderToCubemap(arg0, arg1); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.RenderTexture arg0 = (UnityEngine.RenderTexture)ToLua.ToObject(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + bool o = obj.RenderToCubemap(arg0, arg1); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 4) + { + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.RenderTexture arg0 = (UnityEngine.RenderTexture)ToLua.CheckObject(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Camera.MonoOrStereoscopicEye arg2 = (UnityEngine.Camera.MonoOrStereoscopicEye)ToLua.CheckObject(L, 4, typeof(UnityEngine.Camera.MonoOrStereoscopicEye)); + bool o = obj.RenderToCubemap(arg0, arg1, arg2); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Camera.RenderToCubemap"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Render(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + obj.Render(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int RenderWithShader(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Shader arg0 = (UnityEngine.Shader)ToLua.CheckObject(L, 2, typeof(UnityEngine.Shader)); + string arg1 = ToLua.CheckString(L, 3); + obj.RenderWithShader(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int RenderDontRestore(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + obj.RenderDontRestore(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SubmitRenderRequests(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + System.Collections.Generic.List arg0 = (System.Collections.Generic.List)ToLua.CheckObject(L, 2, typeof(System.Collections.Generic.List)); + obj.SubmitRenderRequests(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetupCurrent(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Camera arg0 = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Camera.SetupCurrent(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CopyFrom(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Camera arg0 = (UnityEngine.Camera)ToLua.CheckObject(L, 2, typeof(UnityEngine.Camera)); + obj.CopyFrom(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int RemoveCommandBuffers(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Rendering.CameraEvent arg0 = (UnityEngine.Rendering.CameraEvent)ToLua.CheckObject(L, 2, typeof(UnityEngine.Rendering.CameraEvent)); + obj.RemoveCommandBuffers(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int RemoveAllCommandBuffers(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + obj.RemoveAllCommandBuffers(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int AddCommandBuffer(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Rendering.CameraEvent arg0 = (UnityEngine.Rendering.CameraEvent)ToLua.CheckObject(L, 2, typeof(UnityEngine.Rendering.CameraEvent)); + UnityEngine.Rendering.CommandBuffer arg1 = (UnityEngine.Rendering.CommandBuffer)ToLua.CheckObject(L, 3); + obj.AddCommandBuffer(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int AddCommandBufferAsync(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 4); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Rendering.CameraEvent arg0 = (UnityEngine.Rendering.CameraEvent)ToLua.CheckObject(L, 2, typeof(UnityEngine.Rendering.CameraEvent)); + UnityEngine.Rendering.CommandBuffer arg1 = (UnityEngine.Rendering.CommandBuffer)ToLua.CheckObject(L, 3); + UnityEngine.Rendering.ComputeQueueType arg2 = (UnityEngine.Rendering.ComputeQueueType)ToLua.CheckObject(L, 4, typeof(UnityEngine.Rendering.ComputeQueueType)); + obj.AddCommandBufferAsync(arg0, arg1, arg2); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int RemoveCommandBuffer(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Rendering.CameraEvent arg0 = (UnityEngine.Rendering.CameraEvent)ToLua.CheckObject(L, 2, typeof(UnityEngine.Rendering.CameraEvent)); + UnityEngine.Rendering.CommandBuffer arg1 = (UnityEngine.Rendering.CommandBuffer)ToLua.CheckObject(L, 3); + obj.RemoveCommandBuffer(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetCommandBuffers(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Rendering.CameraEvent arg0 = (UnityEngine.Rendering.CameraEvent)ToLua.CheckObject(L, 2, typeof(UnityEngine.Rendering.CameraEvent)); + UnityEngine.Rendering.CommandBuffer[] o = obj.GetCommandBuffers(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TryGetCullingParameters(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + UnityEngine.Rendering.ScriptableCullingParameters arg0; + bool o = obj.TryGetCullingParameters(out arg0); + LuaDLL.lua_pushboolean(L, o); + ToLua.PushValue(L, arg0); + return 2; + } + else if (count == 3) + { + UnityEngine.Camera obj = (UnityEngine.Camera)ToLua.CheckObject(L, 1, typeof(UnityEngine.Camera)); + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + UnityEngine.Rendering.ScriptableCullingParameters arg1; + bool o = obj.TryGetCullingParameters(arg0, out arg1); + LuaDLL.lua_pushboolean(L, o); + ToLua.PushValue(L, arg1); + return 2; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Camera.TryGetCullingParameters"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_onPreCull(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.Camera.onPreCull); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_onPreRender(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.Camera.onPreRender); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_onPostRender(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.Camera.onPostRender); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_nearClipPlane(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + float ret = obj.nearClipPlane; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index nearClipPlane on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_farClipPlane(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + float ret = obj.farClipPlane; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index farClipPlane on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_fieldOfView(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + float ret = obj.fieldOfView; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index fieldOfView on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_renderingPath(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.RenderingPath ret = obj.renderingPath; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index renderingPath on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_actualRenderingPath(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.RenderingPath ret = obj.actualRenderingPath; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index actualRenderingPath on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_allowHDR(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + bool ret = obj.allowHDR; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index allowHDR on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_allowMSAA(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + bool ret = obj.allowMSAA; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index allowMSAA on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_allowDynamicResolution(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + bool ret = obj.allowDynamicResolution; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index allowDynamicResolution on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_forceIntoRenderTexture(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + bool ret = obj.forceIntoRenderTexture; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index forceIntoRenderTexture on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_orthographicSize(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + float ret = obj.orthographicSize; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index orthographicSize on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_orthographic(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + bool ret = obj.orthographic; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index orthographic on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_opaqueSortMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.Rendering.OpaqueSortMode ret = obj.opaqueSortMode; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index opaqueSortMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_transparencySortMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.TransparencySortMode ret = obj.transparencySortMode; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index transparencySortMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_transparencySortAxis(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.Vector3 ret = obj.transparencySortAxis; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index transparencySortAxis on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_depth(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + float ret = obj.depth; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index depth on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_aspect(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + float ret = obj.aspect; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index aspect on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_velocity(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.Vector3 ret = obj.velocity; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index velocity on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_cullingMask(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + int ret = obj.cullingMask; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index cullingMask on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_eventMask(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + int ret = obj.eventMask; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index eventMask on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_layerCullSpherical(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + bool ret = obj.layerCullSpherical; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index layerCullSpherical on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_cameraType(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.CameraType ret = obj.cameraType; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index cameraType on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_overrideSceneCullingMask(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + ulong ret = obj.overrideSceneCullingMask; + LuaDLL.tolua_pushuint64(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index overrideSceneCullingMask on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_layerCullDistances(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + float[] ret = obj.layerCullDistances; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index layerCullDistances on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_useOcclusionCulling(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + bool ret = obj.useOcclusionCulling; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index useOcclusionCulling on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_cullingMatrix(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.Matrix4x4 ret = obj.cullingMatrix; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index cullingMatrix on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_backgroundColor(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.Color ret = obj.backgroundColor; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index backgroundColor on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_clearFlags(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.CameraClearFlags ret = obj.clearFlags; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index clearFlags on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_depthTextureMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.DepthTextureMode ret = obj.depthTextureMode; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index depthTextureMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_clearStencilAfterLightingPass(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + bool ret = obj.clearStencilAfterLightingPass; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index clearStencilAfterLightingPass on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_usePhysicalProperties(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + bool ret = obj.usePhysicalProperties; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index usePhysicalProperties on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_sensorSize(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.Vector2 ret = obj.sensorSize; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index sensorSize on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_lensShift(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.Vector2 ret = obj.lensShift; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index lensShift on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_focalLength(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + float ret = obj.focalLength; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index focalLength on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_gateFit(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.Camera.GateFitMode ret = obj.gateFit; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index gateFit on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_rect(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.Rect ret = obj.rect; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index rect on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_pixelRect(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.Rect ret = obj.pixelRect; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index pixelRect on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_pixelWidth(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + int ret = obj.pixelWidth; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index pixelWidth on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_pixelHeight(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + int ret = obj.pixelHeight; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index pixelHeight on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_scaledPixelWidth(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + int ret = obj.scaledPixelWidth; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index scaledPixelWidth on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_scaledPixelHeight(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + int ret = obj.scaledPixelHeight; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index scaledPixelHeight on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_targetTexture(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.RenderTexture ret = obj.targetTexture; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index targetTexture on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_activeTexture(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.RenderTexture ret = obj.activeTexture; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index activeTexture on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_targetDisplay(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + int ret = obj.targetDisplay; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index targetDisplay on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_cameraToWorldMatrix(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.Matrix4x4 ret = obj.cameraToWorldMatrix; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index cameraToWorldMatrix on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_worldToCameraMatrix(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.Matrix4x4 ret = obj.worldToCameraMatrix; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index worldToCameraMatrix on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_projectionMatrix(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.Matrix4x4 ret = obj.projectionMatrix; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index projectionMatrix on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_nonJitteredProjectionMatrix(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.Matrix4x4 ret = obj.nonJitteredProjectionMatrix; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index nonJitteredProjectionMatrix on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_useJitteredProjectionMatrixForTransparentRendering(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + bool ret = obj.useJitteredProjectionMatrixForTransparentRendering; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index useJitteredProjectionMatrixForTransparentRendering on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_previousViewProjectionMatrix(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.Matrix4x4 ret = obj.previousViewProjectionMatrix; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index previousViewProjectionMatrix on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_main(IntPtr L) + { + try + { + ToLua.PushSealed(L, UnityEngine.Camera.main); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_current(IntPtr L) + { + try + { + ToLua.PushSealed(L, UnityEngine.Camera.current); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_scene(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.SceneManagement.Scene ret = obj.scene; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index scene on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_stereoEnabled(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + bool ret = obj.stereoEnabled; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index stereoEnabled on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_stereoSeparation(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + float ret = obj.stereoSeparation; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index stereoSeparation on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_stereoConvergence(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + float ret = obj.stereoConvergence; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index stereoConvergence on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_areVRStereoViewMatricesWithinSingleCullTolerance(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + bool ret = obj.areVRStereoViewMatricesWithinSingleCullTolerance; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index areVRStereoViewMatricesWithinSingleCullTolerance on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_stereoTargetEye(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.StereoTargetEyeMask ret = obj.stereoTargetEye; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index stereoTargetEye on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_stereoActiveEye(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.Camera.MonoOrStereoscopicEye ret = obj.stereoActiveEye; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index stereoActiveEye on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_allCamerasCount(IntPtr L) + { + try + { + LuaDLL.lua_pushinteger(L, UnityEngine.Camera.allCamerasCount); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_allCameras(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.Camera.allCameras); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_commandBufferCount(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + int ret = obj.commandBufferCount; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index commandBufferCount on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_onPreCull(IntPtr L) + { + try + { + UnityEngine.Camera.CameraCallback arg0 = (UnityEngine.Camera.CameraCallback)ToLua.CheckDelegate(L, 2); + UnityEngine.Camera.onPreCull = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_onPreRender(IntPtr L) + { + try + { + UnityEngine.Camera.CameraCallback arg0 = (UnityEngine.Camera.CameraCallback)ToLua.CheckDelegate(L, 2); + UnityEngine.Camera.onPreRender = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_onPostRender(IntPtr L) + { + try + { + UnityEngine.Camera.CameraCallback arg0 = (UnityEngine.Camera.CameraCallback)ToLua.CheckDelegate(L, 2); + UnityEngine.Camera.onPostRender = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_nearClipPlane(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.nearClipPlane = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index nearClipPlane on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_farClipPlane(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.farClipPlane = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index farClipPlane on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_fieldOfView(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.fieldOfView = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index fieldOfView on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_renderingPath(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.RenderingPath arg0 = (UnityEngine.RenderingPath)ToLua.CheckObject(L, 2, typeof(UnityEngine.RenderingPath)); + obj.renderingPath = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index renderingPath on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_allowHDR(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.allowHDR = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index allowHDR on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_allowMSAA(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.allowMSAA = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index allowMSAA on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_allowDynamicResolution(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.allowDynamicResolution = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index allowDynamicResolution on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_forceIntoRenderTexture(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.forceIntoRenderTexture = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index forceIntoRenderTexture on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_orthographicSize(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.orthographicSize = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index orthographicSize on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_orthographic(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.orthographic = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index orthographic on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_opaqueSortMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.Rendering.OpaqueSortMode arg0 = (UnityEngine.Rendering.OpaqueSortMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.Rendering.OpaqueSortMode)); + obj.opaqueSortMode = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index opaqueSortMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_transparencySortMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.TransparencySortMode arg0 = (UnityEngine.TransparencySortMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.TransparencySortMode)); + obj.transparencySortMode = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index transparencySortMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_transparencySortAxis(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + obj.transparencySortAxis = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index transparencySortAxis on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_depth(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.depth = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index depth on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_aspect(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.aspect = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index aspect on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_cullingMask(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.cullingMask = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index cullingMask on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_eventMask(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.eventMask = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index eventMask on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_layerCullSpherical(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.layerCullSpherical = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index layerCullSpherical on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_cameraType(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.CameraType arg0 = (UnityEngine.CameraType)ToLua.CheckObject(L, 2, typeof(UnityEngine.CameraType)); + obj.cameraType = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index cameraType on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_overrideSceneCullingMask(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + ulong arg0 = LuaDLL.tolua_checkuint64(L, 2); + obj.overrideSceneCullingMask = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index overrideSceneCullingMask on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_layerCullDistances(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + float[] arg0 = ToLua.CheckNumberArray(L, 2); + obj.layerCullDistances = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index layerCullDistances on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_useOcclusionCulling(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.useOcclusionCulling = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index useOcclusionCulling on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_cullingMatrix(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.Matrix4x4 arg0 = StackTraits.Check(L, 2); + obj.cullingMatrix = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index cullingMatrix on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_backgroundColor(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.Color arg0 = ToLua.ToColor(L, 2); + obj.backgroundColor = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index backgroundColor on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_clearFlags(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.CameraClearFlags arg0 = (UnityEngine.CameraClearFlags)ToLua.CheckObject(L, 2, typeof(UnityEngine.CameraClearFlags)); + obj.clearFlags = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index clearFlags on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_depthTextureMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.DepthTextureMode arg0 = (UnityEngine.DepthTextureMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.DepthTextureMode)); + obj.depthTextureMode = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index depthTextureMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_clearStencilAfterLightingPass(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.clearStencilAfterLightingPass = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index clearStencilAfterLightingPass on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_usePhysicalProperties(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.usePhysicalProperties = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index usePhysicalProperties on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_sensorSize(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.Vector2 arg0 = ToLua.ToVector2(L, 2); + obj.sensorSize = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index sensorSize on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_lensShift(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.Vector2 arg0 = ToLua.ToVector2(L, 2); + obj.lensShift = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index lensShift on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_focalLength(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.focalLength = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index focalLength on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_gateFit(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.Camera.GateFitMode arg0 = (UnityEngine.Camera.GateFitMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.Camera.GateFitMode)); + obj.gateFit = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index gateFit on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_rect(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.Rect arg0 = StackTraits.Check(L, 2); + obj.rect = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index rect on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_pixelRect(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.Rect arg0 = StackTraits.Check(L, 2); + obj.pixelRect = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index pixelRect on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_targetTexture(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.RenderTexture arg0 = (UnityEngine.RenderTexture)ToLua.CheckObject(L, 2); + obj.targetTexture = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index targetTexture on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_targetDisplay(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.targetDisplay = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index targetDisplay on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_worldToCameraMatrix(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.Matrix4x4 arg0 = StackTraits.Check(L, 2); + obj.worldToCameraMatrix = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index worldToCameraMatrix on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_projectionMatrix(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.Matrix4x4 arg0 = StackTraits.Check(L, 2); + obj.projectionMatrix = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index projectionMatrix on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_nonJitteredProjectionMatrix(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.Matrix4x4 arg0 = StackTraits.Check(L, 2); + obj.nonJitteredProjectionMatrix = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index nonJitteredProjectionMatrix on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_useJitteredProjectionMatrixForTransparentRendering(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.useJitteredProjectionMatrixForTransparentRendering = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index useJitteredProjectionMatrixForTransparentRendering on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_scene(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.SceneManagement.Scene arg0 = StackTraits.Check(L, 2); + obj.scene = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index scene on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_stereoSeparation(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.stereoSeparation = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index stereoSeparation on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_stereoConvergence(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.stereoConvergence = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index stereoConvergence on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_stereoTargetEye(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Camera obj = (UnityEngine.Camera)o; + UnityEngine.StereoTargetEyeMask arg0 = (UnityEngine.StereoTargetEyeMask)ToLua.CheckObject(L, 2, typeof(UnityEngine.StereoTargetEyeMask)); + obj.stereoTargetEye = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index stereoTargetEye on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int UnityEngine_Camera_CameraCallback(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + LuaFunction func = ToLua.CheckLuaFunction(L, 1); + + if (count == 1) + { + Delegate arg1 = DelegateTraits.Create(func); + ToLua.Push(L, arg1); + } + else + { + LuaTable self = ToLua.CheckLuaTable(L, 2); + Delegate arg1 = DelegateTraits.Create(func, self); + ToLua.Push(L, arg1); + } + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_CameraWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_CameraWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..f462d045e269a17a24f1e47a66d1e26bc3021977 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_CameraWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b6e9af49eb274004fa2cbd551f27d6a6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_CapsuleColliderWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_CapsuleColliderWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..9377845f4163dfca0d9d85647e1819e28f08c1cd --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_CapsuleColliderWrap.cs @@ -0,0 +1,214 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_CapsuleColliderWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.CapsuleCollider), typeof(UnityEngine.Collider)); + L.RegFunction("New", _CreateUnityEngine_CapsuleCollider); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("center", get_center, set_center); + L.RegVar("radius", get_radius, set_radius); + L.RegVar("height", get_height, set_height); + L.RegVar("direction", get_direction, set_direction); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateUnityEngine_CapsuleCollider(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + UnityEngine.CapsuleCollider obj = new UnityEngine.CapsuleCollider(); + ToLua.Push(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.CapsuleCollider.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_center(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.CapsuleCollider obj = (UnityEngine.CapsuleCollider)o; + UnityEngine.Vector3 ret = obj.center; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index center on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_radius(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.CapsuleCollider obj = (UnityEngine.CapsuleCollider)o; + float ret = obj.radius; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index radius on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_height(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.CapsuleCollider obj = (UnityEngine.CapsuleCollider)o; + float ret = obj.height; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index height on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_direction(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.CapsuleCollider obj = (UnityEngine.CapsuleCollider)o; + int ret = obj.direction; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index direction on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_center(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.CapsuleCollider obj = (UnityEngine.CapsuleCollider)o; + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + obj.center = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index center on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_radius(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.CapsuleCollider obj = (UnityEngine.CapsuleCollider)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.radius = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index radius on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_height(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.CapsuleCollider obj = (UnityEngine.CapsuleCollider)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.height = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index height on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_direction(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.CapsuleCollider obj = (UnityEngine.CapsuleCollider)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.direction = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index direction on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_CapsuleColliderWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_CapsuleColliderWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..df5e84fd182a261c62f92a6928f85b5c03dc2c6b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_CapsuleColliderWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6bbf103148b34e84babe956ffecdc104 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_CharacterControllerWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_CharacterControllerWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..286c63b44dc3a9a2bc763599c2db00798eb86ec4 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_CharacterControllerWrap.cs @@ -0,0 +1,507 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_CharacterControllerWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.CharacterController), typeof(UnityEngine.Collider)); + L.RegFunction("SimpleMove", SimpleMove); + L.RegFunction("Move", Move); + L.RegFunction("New", _CreateUnityEngine_CharacterController); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("velocity", get_velocity, null); + L.RegVar("isGrounded", get_isGrounded, null); + L.RegVar("collisionFlags", get_collisionFlags, null); + L.RegVar("radius", get_radius, set_radius); + L.RegVar("height", get_height, set_height); + L.RegVar("center", get_center, set_center); + L.RegVar("slopeLimit", get_slopeLimit, set_slopeLimit); + L.RegVar("stepOffset", get_stepOffset, set_stepOffset); + L.RegVar("skinWidth", get_skinWidth, set_skinWidth); + L.RegVar("minMoveDistance", get_minMoveDistance, set_minMoveDistance); + L.RegVar("detectCollisions", get_detectCollisions, set_detectCollisions); + L.RegVar("enableOverlapRecovery", get_enableOverlapRecovery, set_enableOverlapRecovery); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateUnityEngine_CharacterController(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + UnityEngine.CharacterController obj = new UnityEngine.CharacterController(); + ToLua.Push(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.CharacterController.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SimpleMove(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.CharacterController obj = (UnityEngine.CharacterController)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + bool o = obj.SimpleMove(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Move(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.CharacterController obj = (UnityEngine.CharacterController)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.CollisionFlags o = obj.Move(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_velocity(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.CharacterController obj = (UnityEngine.CharacterController)o; + UnityEngine.Vector3 ret = obj.velocity; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index velocity on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isGrounded(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.CharacterController obj = (UnityEngine.CharacterController)o; + bool ret = obj.isGrounded; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isGrounded on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_collisionFlags(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.CharacterController obj = (UnityEngine.CharacterController)o; + UnityEngine.CollisionFlags ret = obj.collisionFlags; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index collisionFlags on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_radius(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.CharacterController obj = (UnityEngine.CharacterController)o; + float ret = obj.radius; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index radius on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_height(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.CharacterController obj = (UnityEngine.CharacterController)o; + float ret = obj.height; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index height on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_center(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.CharacterController obj = (UnityEngine.CharacterController)o; + UnityEngine.Vector3 ret = obj.center; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index center on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_slopeLimit(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.CharacterController obj = (UnityEngine.CharacterController)o; + float ret = obj.slopeLimit; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index slopeLimit on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_stepOffset(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.CharacterController obj = (UnityEngine.CharacterController)o; + float ret = obj.stepOffset; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index stepOffset on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_skinWidth(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.CharacterController obj = (UnityEngine.CharacterController)o; + float ret = obj.skinWidth; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index skinWidth on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_minMoveDistance(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.CharacterController obj = (UnityEngine.CharacterController)o; + float ret = obj.minMoveDistance; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index minMoveDistance on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_detectCollisions(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.CharacterController obj = (UnityEngine.CharacterController)o; + bool ret = obj.detectCollisions; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index detectCollisions on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_enableOverlapRecovery(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.CharacterController obj = (UnityEngine.CharacterController)o; + bool ret = obj.enableOverlapRecovery; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index enableOverlapRecovery on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_radius(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.CharacterController obj = (UnityEngine.CharacterController)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.radius = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index radius on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_height(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.CharacterController obj = (UnityEngine.CharacterController)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.height = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index height on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_center(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.CharacterController obj = (UnityEngine.CharacterController)o; + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + obj.center = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index center on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_slopeLimit(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.CharacterController obj = (UnityEngine.CharacterController)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.slopeLimit = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index slopeLimit on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_stepOffset(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.CharacterController obj = (UnityEngine.CharacterController)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.stepOffset = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index stepOffset on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_skinWidth(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.CharacterController obj = (UnityEngine.CharacterController)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.skinWidth = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index skinWidth on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_minMoveDistance(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.CharacterController obj = (UnityEngine.CharacterController)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.minMoveDistance = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index minMoveDistance on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_detectCollisions(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.CharacterController obj = (UnityEngine.CharacterController)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.detectCollisions = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index detectCollisions on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_enableOverlapRecovery(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.CharacterController obj = (UnityEngine.CharacterController)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.enableOverlapRecovery = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index enableOverlapRecovery on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_CharacterControllerWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_CharacterControllerWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..565b9d7f37990ef117b3bb693baeceb101245a4e --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_CharacterControllerWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f5f3c209d1dc28641a16102476ce5083 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ColliderWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ColliderWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..d7bd3cda9905c7a1e93facaf46be29c205db7440 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ColliderWrap.cs @@ -0,0 +1,373 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_ColliderWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.Collider), typeof(UnityEngine.Component)); + L.RegFunction("ClosestPoint", ClosestPoint); + L.RegFunction("Raycast", Raycast); + L.RegFunction("ClosestPointOnBounds", ClosestPointOnBounds); + L.RegFunction("New", _CreateUnityEngine_Collider); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("enabled", get_enabled, set_enabled); + L.RegVar("attachedRigidbody", get_attachedRigidbody, null); + L.RegVar("attachedArticulationBody", get_attachedArticulationBody, null); + L.RegVar("isTrigger", get_isTrigger, set_isTrigger); + L.RegVar("contactOffset", get_contactOffset, set_contactOffset); + L.RegVar("bounds", get_bounds, null); + L.RegVar("sharedMaterial", get_sharedMaterial, set_sharedMaterial); + L.RegVar("material", get_material, set_material); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateUnityEngine_Collider(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + UnityEngine.Collider obj = new UnityEngine.Collider(); + ToLua.Push(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.Collider.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ClosestPoint(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Collider obj = (UnityEngine.Collider)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 o = obj.ClosestPoint(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Raycast(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 4); + UnityEngine.Collider obj = (UnityEngine.Collider)ToLua.CheckObject(L, 1); + UnityEngine.Ray arg0 = ToLua.ToRay(L, 2); + UnityEngine.RaycastHit arg1; + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + bool o = obj.Raycast(arg0, out arg1, arg2); + LuaDLL.lua_pushboolean(L, o); + if (o) ToLua.Push(L, arg1); else LuaDLL.lua_pushnil(L); + return 2; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ClosestPointOnBounds(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Collider obj = (UnityEngine.Collider)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 o = obj.ClosestPointOnBounds(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_enabled(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Collider obj = (UnityEngine.Collider)o; + bool ret = obj.enabled; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index enabled on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_attachedRigidbody(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Collider obj = (UnityEngine.Collider)o; + UnityEngine.Rigidbody ret = obj.attachedRigidbody; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index attachedRigidbody on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_attachedArticulationBody(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Collider obj = (UnityEngine.Collider)o; + UnityEngine.ArticulationBody ret = obj.attachedArticulationBody; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index attachedArticulationBody on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isTrigger(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Collider obj = (UnityEngine.Collider)o; + bool ret = obj.isTrigger; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isTrigger on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_contactOffset(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Collider obj = (UnityEngine.Collider)o; + float ret = obj.contactOffset; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index contactOffset on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_bounds(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Collider obj = (UnityEngine.Collider)o; + UnityEngine.Bounds ret = obj.bounds; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index bounds on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_sharedMaterial(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Collider obj = (UnityEngine.Collider)o; + UnityEngine.PhysicMaterial ret = obj.sharedMaterial; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index sharedMaterial on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_material(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Collider obj = (UnityEngine.Collider)o; + UnityEngine.PhysicMaterial ret = obj.material; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index material on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_enabled(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Collider obj = (UnityEngine.Collider)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.enabled = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index enabled on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_isTrigger(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Collider obj = (UnityEngine.Collider)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.isTrigger = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isTrigger on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_contactOffset(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Collider obj = (UnityEngine.Collider)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.contactOffset = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index contactOffset on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_sharedMaterial(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Collider obj = (UnityEngine.Collider)o; + UnityEngine.PhysicMaterial arg0 = (UnityEngine.PhysicMaterial)ToLua.CheckObject(L, 2); + obj.sharedMaterial = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index sharedMaterial on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_material(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Collider obj = (UnityEngine.Collider)o; + UnityEngine.PhysicMaterial arg0 = (UnityEngine.PhysicMaterial)ToLua.CheckObject(L, 2); + obj.material = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index material on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ColliderWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ColliderWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..2ec2625f7f922dda7bc8865804caca1dc4287afa --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ColliderWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 53862a5891eb42641aa54b0227eb0842 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ComponentWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ComponentWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..128f4400efdd3a40342e0f3f9293837529861081 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ComponentWrap.cs @@ -0,0 +1,527 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_ComponentWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.Component), typeof(UnityEngine.Object)); + L.RegFunction("GetComponent", GetComponent); + L.RegFunction("TryGetComponent", TryGetComponent); + L.RegFunction("GetComponentInChildren", GetComponentInChildren); + L.RegFunction("GetComponentsInChildren", GetComponentsInChildren); + L.RegFunction("GetComponentInParent", GetComponentInParent); + L.RegFunction("GetComponentsInParent", GetComponentsInParent); + L.RegFunction("GetComponents", GetComponents); + L.RegFunction("CompareTag", CompareTag); + L.RegFunction("SendMessageUpwards", SendMessageUpwards); + L.RegFunction("SendMessage", SendMessage); + L.RegFunction("BroadcastMessage", BroadcastMessage); + L.RegFunction("New", _CreateUnityEngine_Component); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("transform", get_transform, null); + L.RegVar("gameObject", get_gameObject, null); + L.RegVar("tag", get_tag, set_tag); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateUnityEngine_Component(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + UnityEngine.Component obj = new UnityEngine.Component(); + ToLua.Push(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.Component.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetComponent(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Component obj = (UnityEngine.Component)ToLua.CheckObject(L, 1); + System.Type arg0 = (System.Type)ToLua.ToObject(L, 2); + UnityEngine.Component o = obj.GetComponent(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Component obj = (UnityEngine.Component)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.Component o = obj.GetComponent(arg0); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Component.GetComponent"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TryGetComponent(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.Component obj = (UnityEngine.Component)ToLua.CheckObject(L, 1); + System.Type arg0 = ToLua.CheckMonoType(L, 2); + UnityEngine.Component arg1 = null; + bool o = obj.TryGetComponent(arg0, out arg1); + LuaDLL.lua_pushboolean(L, o); + ToLua.Push(L, arg1); + return 2; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetComponentInChildren(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Component obj = (UnityEngine.Component)ToLua.CheckObject(L, 1); + System.Type arg0 = ToLua.CheckMonoType(L, 2); + UnityEngine.Component o = obj.GetComponentInChildren(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.Component obj = (UnityEngine.Component)ToLua.CheckObject(L, 1); + System.Type arg0 = ToLua.CheckMonoType(L, 2); + bool arg1 = LuaDLL.luaL_checkboolean(L, 3); + UnityEngine.Component o = obj.GetComponentInChildren(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Component.GetComponentInChildren"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetComponentsInChildren(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Component obj = (UnityEngine.Component)ToLua.CheckObject(L, 1); + System.Type arg0 = ToLua.CheckMonoType(L, 2); + UnityEngine.Component[] o = obj.GetComponentsInChildren(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.Component obj = (UnityEngine.Component)ToLua.CheckObject(L, 1); + System.Type arg0 = ToLua.CheckMonoType(L, 2); + bool arg1 = LuaDLL.luaL_checkboolean(L, 3); + UnityEngine.Component[] o = obj.GetComponentsInChildren(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Component.GetComponentsInChildren"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetComponentInParent(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Component obj = (UnityEngine.Component)ToLua.CheckObject(L, 1); + System.Type arg0 = ToLua.CheckMonoType(L, 2); + UnityEngine.Component o = obj.GetComponentInParent(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetComponentsInParent(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Component obj = (UnityEngine.Component)ToLua.CheckObject(L, 1); + System.Type arg0 = ToLua.CheckMonoType(L, 2); + UnityEngine.Component[] o = obj.GetComponentsInParent(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.Component obj = (UnityEngine.Component)ToLua.CheckObject(L, 1); + System.Type arg0 = ToLua.CheckMonoType(L, 2); + bool arg1 = LuaDLL.luaL_checkboolean(L, 3); + UnityEngine.Component[] o = obj.GetComponentsInParent(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Component.GetComponentsInParent"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetComponents(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Component obj = (UnityEngine.Component)ToLua.CheckObject(L, 1); + System.Type arg0 = ToLua.CheckMonoType(L, 2); + UnityEngine.Component[] o = obj.GetComponents(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.Component obj = (UnityEngine.Component)ToLua.CheckObject(L, 1); + System.Type arg0 = ToLua.CheckMonoType(L, 2); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.CheckObject(L, 3, typeof(System.Collections.Generic.List)); + obj.GetComponents(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Component.GetComponents"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CompareTag(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Component obj = (UnityEngine.Component)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + bool o = obj.CompareTag(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SendMessageUpwards(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Component obj = (UnityEngine.Component)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + obj.SendMessageUpwards(arg0); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 3)) + { + UnityEngine.Component obj = (UnityEngine.Component)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + UnityEngine.SendMessageOptions arg1 = (UnityEngine.SendMessageOptions)ToLua.ToObject(L, 3); + obj.SendMessageUpwards(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 3)) + { + UnityEngine.Component obj = (UnityEngine.Component)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + object arg1 = ToLua.ToVarObject(L, 3); + obj.SendMessageUpwards(arg0, arg1); + return 0; + } + else if (count == 4) + { + UnityEngine.Component obj = (UnityEngine.Component)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + object arg1 = ToLua.ToVarObject(L, 3); + UnityEngine.SendMessageOptions arg2 = (UnityEngine.SendMessageOptions)ToLua.CheckObject(L, 4, typeof(UnityEngine.SendMessageOptions)); + obj.SendMessageUpwards(arg0, arg1, arg2); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Component.SendMessageUpwards"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SendMessage(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Component obj = (UnityEngine.Component)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + obj.SendMessage(arg0); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 3)) + { + UnityEngine.Component obj = (UnityEngine.Component)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + UnityEngine.SendMessageOptions arg1 = (UnityEngine.SendMessageOptions)ToLua.ToObject(L, 3); + obj.SendMessage(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 3)) + { + UnityEngine.Component obj = (UnityEngine.Component)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + object arg1 = ToLua.ToVarObject(L, 3); + obj.SendMessage(arg0, arg1); + return 0; + } + else if (count == 4) + { + UnityEngine.Component obj = (UnityEngine.Component)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + object arg1 = ToLua.ToVarObject(L, 3); + UnityEngine.SendMessageOptions arg2 = (UnityEngine.SendMessageOptions)ToLua.CheckObject(L, 4, typeof(UnityEngine.SendMessageOptions)); + obj.SendMessage(arg0, arg1, arg2); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Component.SendMessage"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int BroadcastMessage(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Component obj = (UnityEngine.Component)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + obj.BroadcastMessage(arg0); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 3)) + { + UnityEngine.Component obj = (UnityEngine.Component)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + UnityEngine.SendMessageOptions arg1 = (UnityEngine.SendMessageOptions)ToLua.ToObject(L, 3); + obj.BroadcastMessage(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 3)) + { + UnityEngine.Component obj = (UnityEngine.Component)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + object arg1 = ToLua.ToVarObject(L, 3); + obj.BroadcastMessage(arg0, arg1); + return 0; + } + else if (count == 4) + { + UnityEngine.Component obj = (UnityEngine.Component)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + object arg1 = ToLua.ToVarObject(L, 3); + UnityEngine.SendMessageOptions arg2 = (UnityEngine.SendMessageOptions)ToLua.CheckObject(L, 4, typeof(UnityEngine.SendMessageOptions)); + obj.BroadcastMessage(arg0, arg1, arg2); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Component.BroadcastMessage"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_transform(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Component obj = (UnityEngine.Component)o; + UnityEngine.Transform ret = obj.transform; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index transform on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_gameObject(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Component obj = (UnityEngine.Component)o; + UnityEngine.GameObject ret = obj.gameObject; + ToLua.PushSealed(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index gameObject on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_tag(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Component obj = (UnityEngine.Component)o; + string ret = obj.tag; + LuaDLL.lua_pushstring(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index tag on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_tag(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Component obj = (UnityEngine.Component)o; + string arg0 = ToLua.CheckString(L, 2); + obj.tag = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index tag on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ComponentWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ComponentWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..779f7ca5d655522940b4a7e0f8a200499215e598 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ComponentWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 56e4a223885815f438c527b65b77e193 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_EventSystems_UIBehaviourWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_EventSystems_UIBehaviourWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..086851a5223bc7d3745c69e3466f370723ea734a --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_EventSystems_UIBehaviourWrap.cs @@ -0,0 +1,69 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_EventSystems_UIBehaviourWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.EventSystems.UIBehaviour), typeof(UnityEngine.MonoBehaviour)); + L.RegFunction("IsActive", IsActive); + L.RegFunction("IsDestroyed", IsDestroyed); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IsActive(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.EventSystems.UIBehaviour obj = (UnityEngine.EventSystems.UIBehaviour)ToLua.CheckObject(L, 1); + bool o = obj.IsActive(); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IsDestroyed(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.EventSystems.UIBehaviour obj = (UnityEngine.EventSystems.UIBehaviour)ToLua.CheckObject(L, 1); + bool o = obj.IsDestroyed(); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_EventSystems_UIBehaviourWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_EventSystems_UIBehaviourWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..56b43a194082a47abe0c8f74c637f1a5650d331b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_EventSystems_UIBehaviourWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6e1543e11b87f7045b850af1179a5956 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_GameObjectWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_GameObjectWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..4c1df5ddfd283c0a867bcd371edf5dbcce634fc4 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_GameObjectWrap.cs @@ -0,0 +1,1004 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_GameObjectWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.GameObject), typeof(UnityEngine.Object)); + L.RegFunction("CreatePrimitive", CreatePrimitive); + L.RegFunction("GetComponent", GetComponent); + L.RegFunction("GetComponentInChildren", GetComponentInChildren); + L.RegFunction("GetComponentInParent", GetComponentInParent); + L.RegFunction("GetComponents", GetComponents); + L.RegFunction("GetComponentsInChildren", GetComponentsInChildren); + L.RegFunction("GetComponentsInParent", GetComponentsInParent); + L.RegFunction("TryGetComponent", TryGetComponent); + L.RegFunction("FindWithTag", FindWithTag); + L.RegFunction("SetActive", SetActive); + L.RegFunction("CompareTag", CompareTag); + L.RegFunction("FindGameObjectWithTag", FindGameObjectWithTag); + L.RegFunction("FindGameObjectsWithTag", FindGameObjectsWithTag); + L.RegFunction("Find", Find); + L.RegFunction("AddComponent", AddComponent); + L.RegFunction("BroadcastMessage", BroadcastMessage); + L.RegFunction("SendMessageUpwards", SendMessageUpwards); + L.RegFunction("SendMessage", SendMessage); + L.RegFunction("New", _CreateUnityEngine_GameObject); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("transform", get_transform, null); + L.RegVar("layer", get_layer, set_layer); + L.RegVar("activeSelf", get_activeSelf, null); + L.RegVar("activeInHierarchy", get_activeInHierarchy, null); + L.RegVar("isStatic", get_isStatic, set_isStatic); + L.RegVar("tag", get_tag, set_tag); + L.RegVar("scene", get_scene, null); + L.RegVar("sceneCullingMask", get_sceneCullingMask, null); + L.RegVar("gameObject", get_gameObject, null); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateUnityEngine_GameObject(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + UnityEngine.GameObject obj = new UnityEngine.GameObject(); + ToLua.PushSealed(L, obj); + return 1; + } + else if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + UnityEngine.GameObject obj = new UnityEngine.GameObject(arg0); + ToLua.PushSealed(L, obj); + return 1; + } + else if (TypeChecker.CheckTypes(L, 1) && TypeChecker.CheckParamsType(L, 2, count - 1)) + { + string arg0 = ToLua.ToString(L, 1); + System.Type[] arg1 = ToLua.ToParamsObject(L, 2, count - 1); + UnityEngine.GameObject obj = new UnityEngine.GameObject(arg0, arg1); + ToLua.PushSealed(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.GameObject.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CreatePrimitive(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.PrimitiveType arg0 = (UnityEngine.PrimitiveType)ToLua.CheckObject(L, 1, typeof(UnityEngine.PrimitiveType)); + UnityEngine.GameObject o = UnityEngine.GameObject.CreatePrimitive(arg0); + ToLua.PushSealed(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetComponent(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + System.Type arg0 = (System.Type)ToLua.ToObject(L, 2); + UnityEngine.Component o = obj.GetComponent(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.Component o = obj.GetComponent(arg0); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.GameObject.GetComponent"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetComponentInChildren(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + System.Type arg0 = ToLua.CheckMonoType(L, 2); + UnityEngine.Component o = obj.GetComponentInChildren(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + System.Type arg0 = ToLua.CheckMonoType(L, 2); + bool arg1 = LuaDLL.luaL_checkboolean(L, 3); + UnityEngine.Component o = obj.GetComponentInChildren(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.GameObject.GetComponentInChildren"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetComponentInParent(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + System.Type arg0 = ToLua.CheckMonoType(L, 2); + UnityEngine.Component o = obj.GetComponentInParent(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + System.Type arg0 = ToLua.CheckMonoType(L, 2); + bool arg1 = LuaDLL.luaL_checkboolean(L, 3); + UnityEngine.Component o = obj.GetComponentInParent(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.GameObject.GetComponentInParent"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetComponents(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + System.Type arg0 = ToLua.CheckMonoType(L, 2); + UnityEngine.Component[] o = obj.GetComponents(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + System.Type arg0 = ToLua.CheckMonoType(L, 2); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.CheckObject(L, 3, typeof(System.Collections.Generic.List)); + obj.GetComponents(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.GameObject.GetComponents"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetComponentsInChildren(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + System.Type arg0 = ToLua.CheckMonoType(L, 2); + UnityEngine.Component[] o = obj.GetComponentsInChildren(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + System.Type arg0 = ToLua.CheckMonoType(L, 2); + bool arg1 = LuaDLL.luaL_checkboolean(L, 3); + UnityEngine.Component[] o = obj.GetComponentsInChildren(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.GameObject.GetComponentsInChildren"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetComponentsInParent(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + System.Type arg0 = ToLua.CheckMonoType(L, 2); + UnityEngine.Component[] o = obj.GetComponentsInParent(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + System.Type arg0 = ToLua.CheckMonoType(L, 2); + bool arg1 = LuaDLL.luaL_checkboolean(L, 3); + UnityEngine.Component[] o = obj.GetComponentsInParent(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.GameObject.GetComponentsInParent"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TryGetComponent(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + System.Type arg0 = ToLua.CheckMonoType(L, 2); + UnityEngine.Component arg1 = null; + bool o = obj.TryGetComponent(arg0, out arg1); + LuaDLL.lua_pushboolean(L, o); + ToLua.Push(L, arg1); + return 2; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int FindWithTag(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + UnityEngine.GameObject o = UnityEngine.GameObject.FindWithTag(arg0); + ToLua.PushSealed(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetActive(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.SetActive(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CompareTag(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + string arg0 = ToLua.CheckString(L, 2); + bool o = obj.CompareTag(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int FindGameObjectWithTag(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + UnityEngine.GameObject o = UnityEngine.GameObject.FindGameObjectWithTag(arg0); + ToLua.PushSealed(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int FindGameObjectsWithTag(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + UnityEngine.GameObject[] o = UnityEngine.GameObject.FindGameObjectsWithTag(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Find(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + UnityEngine.GameObject o = UnityEngine.GameObject.Find(arg0); + ToLua.PushSealed(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int AddComponent(IntPtr L) + { + IntPtr L0 = LuaException.L; + + try + { + ++LuaException.InstantiateCount; + LuaException.L = L; + ToLua.CheckArgsCount(L, 2); + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + System.Type arg0 = ToLua.CheckMonoType(L, 2); + UnityEngine.Component o = obj.AddComponent(arg0); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + + ToLua.Push(L, o); + LuaException.L = L0; + --LuaException.InstantiateCount; + return 1; + } + catch (Exception e) + { + LuaException.L = L0; + --LuaException.InstantiateCount; + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int BroadcastMessage(IntPtr L) + { + IntPtr L0 = LuaException.L; + + try + { + ++LuaException.SendMsgCount; + LuaException.L = L; + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + string arg0 = ToLua.ToString(L, 2); + obj.BroadcastMessage(arg0); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + + --LuaException.SendMsgCount; + LuaException.L = L0; + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.SendMessageOptions arg1 = (UnityEngine.SendMessageOptions)ToLua.ToObject(L, 3); + obj.BroadcastMessage(arg0, arg1); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + + --LuaException.SendMsgCount; + LuaException.L = L0; + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + string arg0 = ToLua.ToString(L, 2); + object arg1 = ToLua.ToVarObject(L, 3); + obj.BroadcastMessage(arg0, arg1); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + + --LuaException.SendMsgCount; + LuaException.L = L0; + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + string arg0 = ToLua.ToString(L, 2); + object arg1 = ToLua.ToVarObject(L, 3); + UnityEngine.SendMessageOptions arg2 = (UnityEngine.SendMessageOptions)ToLua.ToObject(L, 4); + obj.BroadcastMessage(arg0, arg1, arg2); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + + --LuaException.SendMsgCount; + LuaException.L = L0; + return 0; + } + else + { + --LuaException.SendMsgCount; + LuaException.L = L0; + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.GameObject.BroadcastMessage"); + } + } + catch (Exception e) + { + --LuaException.SendMsgCount; + LuaException.L = L0; + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SendMessageUpwards(IntPtr L) + { + IntPtr L0 = LuaException.L; + + try + { + ++LuaException.SendMsgCount; + LuaException.L = L; + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + string arg0 = ToLua.ToString(L, 2); + obj.SendMessageUpwards(arg0); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + + --LuaException.SendMsgCount; + LuaException.L = L0; + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.SendMessageOptions arg1 = (UnityEngine.SendMessageOptions)ToLua.ToObject(L, 3); + obj.SendMessageUpwards(arg0, arg1); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + + --LuaException.SendMsgCount; + LuaException.L = L0; + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + string arg0 = ToLua.ToString(L, 2); + object arg1 = ToLua.ToVarObject(L, 3); + obj.SendMessageUpwards(arg0, arg1); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + + --LuaException.SendMsgCount; + LuaException.L = L0; + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + string arg0 = ToLua.ToString(L, 2); + object arg1 = ToLua.ToVarObject(L, 3); + UnityEngine.SendMessageOptions arg2 = (UnityEngine.SendMessageOptions)ToLua.ToObject(L, 4); + obj.SendMessageUpwards(arg0, arg1, arg2); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + + --LuaException.SendMsgCount; + LuaException.L = L0; + return 0; + } + else + { + --LuaException.SendMsgCount; + LuaException.L = L0; + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.GameObject.SendMessageUpwards"); + } + } + catch (Exception e) + { + --LuaException.SendMsgCount; + LuaException.L = L0; + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SendMessage(IntPtr L) + { + IntPtr L0 = LuaException.L; + + try + { + ++LuaException.SendMsgCount; + LuaException.L = L; + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + string arg0 = ToLua.ToString(L, 2); + obj.SendMessage(arg0); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + + --LuaException.SendMsgCount; + LuaException.L = L0; + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.SendMessageOptions arg1 = (UnityEngine.SendMessageOptions)ToLua.ToObject(L, 3); + obj.SendMessage(arg0, arg1); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + + --LuaException.SendMsgCount; + LuaException.L = L0; + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + string arg0 = ToLua.ToString(L, 2); + object arg1 = ToLua.ToVarObject(L, 3); + obj.SendMessage(arg0, arg1); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + + --LuaException.SendMsgCount; + LuaException.L = L0; + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject)); + string arg0 = ToLua.ToString(L, 2); + object arg1 = ToLua.ToVarObject(L, 3); + UnityEngine.SendMessageOptions arg2 = (UnityEngine.SendMessageOptions)ToLua.ToObject(L, 4); + obj.SendMessage(arg0, arg1, arg2); + + if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1))) + { + string error = LuaDLL.lua_tostring(L, -1); + LuaDLL.lua_pop(L, 1); + throw new LuaException(error, LuaException.GetLastError()); + } + + --LuaException.SendMsgCount; + LuaException.L = L0; + return 0; + } + else + { + --LuaException.SendMsgCount; + LuaException.L = L0; + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.GameObject.SendMessage"); + } + } + catch(Exception e) + { + --LuaException.SendMsgCount; + LuaException.L = L0; + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_transform(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.GameObject obj = (UnityEngine.GameObject)o; + UnityEngine.Transform ret = obj.transform; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index transform on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_layer(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.GameObject obj = (UnityEngine.GameObject)o; + int ret = obj.layer; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index layer on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_activeSelf(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.GameObject obj = (UnityEngine.GameObject)o; + bool ret = obj.activeSelf; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index activeSelf on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_activeInHierarchy(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.GameObject obj = (UnityEngine.GameObject)o; + bool ret = obj.activeInHierarchy; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index activeInHierarchy on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isStatic(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.GameObject obj = (UnityEngine.GameObject)o; + bool ret = obj.isStatic; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isStatic on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_tag(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.GameObject obj = (UnityEngine.GameObject)o; + string ret = obj.tag; + LuaDLL.lua_pushstring(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index tag on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_scene(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.GameObject obj = (UnityEngine.GameObject)o; + UnityEngine.SceneManagement.Scene ret = obj.scene; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index scene on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_sceneCullingMask(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.GameObject obj = (UnityEngine.GameObject)o; + ulong ret = obj.sceneCullingMask; + LuaDLL.tolua_pushuint64(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index sceneCullingMask on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_gameObject(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.GameObject obj = (UnityEngine.GameObject)o; + UnityEngine.GameObject ret = obj.gameObject; + ToLua.PushSealed(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index gameObject on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_layer(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.GameObject obj = (UnityEngine.GameObject)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.layer = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index layer on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_isStatic(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.GameObject obj = (UnityEngine.GameObject)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.isStatic = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isStatic on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_tag(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.GameObject obj = (UnityEngine.GameObject)o; + string arg0 = ToLua.CheckString(L, 2); + obj.tag = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index tag on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_GameObjectWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_GameObjectWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..d547a3d46eace83e1b6e6770117e360fe30afdfe --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_GameObjectWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: eff912696adc3d9429cd8e502641c96b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_InputWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_InputWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..e7fb9b339aaeb748e21a21317a02d8ce562fce58 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_InputWrap.cs @@ -0,0 +1,805 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_InputWrap +{ + public static void Register(LuaState L) + { + L.BeginStaticLibs("Input"); + L.RegFunction("GetAxis", GetAxis); + L.RegFunction("GetAxisRaw", GetAxisRaw); + L.RegFunction("GetButton", GetButton); + L.RegFunction("GetButtonDown", GetButtonDown); + L.RegFunction("GetButtonUp", GetButtonUp); + L.RegFunction("GetMouseButton", GetMouseButton); + L.RegFunction("GetMouseButtonDown", GetMouseButtonDown); + L.RegFunction("GetMouseButtonUp", GetMouseButtonUp); + L.RegFunction("ResetInputAxes", ResetInputAxes); + L.RegFunction("GetJoystickNames", GetJoystickNames); + L.RegFunction("GetAccelerationEvent", GetAccelerationEvent); + L.RegFunction("GetKey", GetKey); + L.RegFunction("GetKeyUp", GetKeyUp); + L.RegFunction("GetKeyDown", GetKeyDown); + L.RegFunction("GetTouch", GetTouch); + L.RegVar("simulateMouseWithTouches", get_simulateMouseWithTouches, set_simulateMouseWithTouches); + L.RegVar("anyKey", get_anyKey, null); + L.RegVar("anyKeyDown", get_anyKeyDown, null); + L.RegVar("inputString", get_inputString, null); + L.RegVar("mousePosition", get_mousePosition, null); + L.RegVar("mouseScrollDelta", get_mouseScrollDelta, null); + L.RegVar("imeCompositionMode", get_imeCompositionMode, set_imeCompositionMode); + L.RegVar("compositionString", get_compositionString, null); + L.RegVar("imeIsSelected", get_imeIsSelected, null); + L.RegVar("compositionCursorPos", get_compositionCursorPos, set_compositionCursorPos); + L.RegVar("mousePresent", get_mousePresent, null); + L.RegVar("touchCount", get_touchCount, null); + L.RegVar("touchPressureSupported", get_touchPressureSupported, null); + L.RegVar("stylusTouchSupported", get_stylusTouchSupported, null); + L.RegVar("touchSupported", get_touchSupported, null); + L.RegVar("multiTouchEnabled", get_multiTouchEnabled, set_multiTouchEnabled); + L.RegVar("deviceOrientation", get_deviceOrientation, null); + L.RegVar("acceleration", get_acceleration, null); + L.RegVar("compensateSensors", get_compensateSensors, set_compensateSensors); + L.RegVar("accelerationEventCount", get_accelerationEventCount, null); + L.RegVar("backButtonLeavesApp", get_backButtonLeavesApp, set_backButtonLeavesApp); + L.RegVar("location", get_location, null); + L.RegVar("compass", get_compass, null); + L.RegVar("gyro", get_gyro, null); + L.RegVar("touches", get_touches, null); + L.RegVar("accelerationEvents", get_accelerationEvents, null); + L.EndStaticLibs(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetAxis(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + float o = UnityEngine.Input.GetAxis(arg0); + LuaDLL.lua_pushnumber(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetAxisRaw(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + float o = UnityEngine.Input.GetAxisRaw(arg0); + LuaDLL.lua_pushnumber(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetButton(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + bool o = UnityEngine.Input.GetButton(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetButtonDown(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + bool o = UnityEngine.Input.GetButtonDown(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetButtonUp(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + bool o = UnityEngine.Input.GetButtonUp(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetMouseButton(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + bool o = UnityEngine.Input.GetMouseButton(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetMouseButtonDown(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + bool o = UnityEngine.Input.GetMouseButtonDown(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetMouseButtonUp(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + bool o = UnityEngine.Input.GetMouseButtonUp(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ResetInputAxes(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 0); + UnityEngine.Input.ResetInputAxes(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetJoystickNames(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 0); + string[] o = UnityEngine.Input.GetJoystickNames(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetAccelerationEvent(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + UnityEngine.AccelerationEvent o = UnityEngine.Input.GetAccelerationEvent(arg0); + ToLua.PushValue(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetKey(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.KeyCode arg0 = (UnityEngine.KeyCode)ToLua.ToObject(L, 1); + bool o = UnityEngine.Input.GetKey(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + bool o = UnityEngine.Input.GetKey(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Input.GetKey"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetKeyUp(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.KeyCode arg0 = (UnityEngine.KeyCode)ToLua.ToObject(L, 1); + bool o = UnityEngine.Input.GetKeyUp(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + bool o = UnityEngine.Input.GetKeyUp(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Input.GetKeyUp"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetKeyDown(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.KeyCode arg0 = (UnityEngine.KeyCode)ToLua.ToObject(L, 1); + bool o = UnityEngine.Input.GetKeyDown(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + bool o = UnityEngine.Input.GetKeyDown(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Input.GetKeyDown"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetTouch(IntPtr L) + { + try + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = LuaDLL.luaL_optinteger(L, 2, TouchBits.ALL); + UnityEngine.Touch o = UnityEngine.Input.GetTouch(arg0); + ToLua.Push(L, o, arg1); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_simulateMouseWithTouches(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Input.simulateMouseWithTouches); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_anyKey(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Input.anyKey); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_anyKeyDown(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Input.anyKeyDown); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_inputString(IntPtr L) + { + try + { + LuaDLL.lua_pushstring(L, UnityEngine.Input.inputString); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_mousePosition(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.Input.mousePosition); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_mouseScrollDelta(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.Input.mouseScrollDelta); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_imeCompositionMode(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.Input.imeCompositionMode); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_compositionString(IntPtr L) + { + try + { + LuaDLL.lua_pushstring(L, UnityEngine.Input.compositionString); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_imeIsSelected(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Input.imeIsSelected); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_compositionCursorPos(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.Input.compositionCursorPos); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_mousePresent(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Input.mousePresent); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_touchCount(IntPtr L) + { + try + { + LuaDLL.lua_pushinteger(L, UnityEngine.Input.touchCount); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_touchPressureSupported(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Input.touchPressureSupported); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_stylusTouchSupported(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Input.stylusTouchSupported); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_touchSupported(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Input.touchSupported); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_multiTouchEnabled(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Input.multiTouchEnabled); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_deviceOrientation(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.Input.deviceOrientation); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_acceleration(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.Input.acceleration); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_compensateSensors(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Input.compensateSensors); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_accelerationEventCount(IntPtr L) + { + try + { + LuaDLL.lua_pushinteger(L, UnityEngine.Input.accelerationEventCount); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_backButtonLeavesApp(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Input.backButtonLeavesApp); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_location(IntPtr L) + { + try + { + ToLua.PushObject(L, UnityEngine.Input.location); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_compass(IntPtr L) + { + try + { + ToLua.PushObject(L, UnityEngine.Input.compass); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_gyro(IntPtr L) + { + try + { + ToLua.PushObject(L, UnityEngine.Input.gyro); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_touches(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.Input.touches); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_accelerationEvents(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.Input.accelerationEvents); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_simulateMouseWithTouches(IntPtr L) + { + try + { + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + UnityEngine.Input.simulateMouseWithTouches = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_imeCompositionMode(IntPtr L) + { + try + { + UnityEngine.IMECompositionMode arg0 = (UnityEngine.IMECompositionMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.IMECompositionMode)); + UnityEngine.Input.imeCompositionMode = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_compositionCursorPos(IntPtr L) + { + try + { + UnityEngine.Vector2 arg0 = ToLua.ToVector2(L, 2); + UnityEngine.Input.compositionCursorPos = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_multiTouchEnabled(IntPtr L) + { + try + { + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + UnityEngine.Input.multiTouchEnabled = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_compensateSensors(IntPtr L) + { + try + { + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + UnityEngine.Input.compensateSensors = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_backButtonLeavesApp(IntPtr L) + { + try + { + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + UnityEngine.Input.backButtonLeavesApp = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_InputWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_InputWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..e880afc34c35ea19d62b1e705ccac956e262d525 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_InputWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1bf9b77565c56c6489864e0559ace341 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_KeyCodeWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_KeyCodeWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..9f27f736b816774c2e9fcc1160996db383059835 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_KeyCodeWrap.cs @@ -0,0 +1,2643 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_KeyCodeWrap +{ + public static void Register(LuaState L) + { + L.BeginEnum(typeof(UnityEngine.KeyCode)); + L.RegVar("None", get_None, null); + L.RegVar("Backspace", get_Backspace, null); + L.RegVar("Delete", get_Delete, null); + L.RegVar("Tab", get_Tab, null); + L.RegVar("Clear", get_Clear, null); + L.RegVar("Return", get_Return, null); + L.RegVar("Pause", get_Pause, null); + L.RegVar("Escape", get_Escape, null); + L.RegVar("Space", get_Space, null); + L.RegVar("Keypad0", get_Keypad0, null); + L.RegVar("Keypad1", get_Keypad1, null); + L.RegVar("Keypad2", get_Keypad2, null); + L.RegVar("Keypad3", get_Keypad3, null); + L.RegVar("Keypad4", get_Keypad4, null); + L.RegVar("Keypad5", get_Keypad5, null); + L.RegVar("Keypad6", get_Keypad6, null); + L.RegVar("Keypad7", get_Keypad7, null); + L.RegVar("Keypad8", get_Keypad8, null); + L.RegVar("Keypad9", get_Keypad9, null); + L.RegVar("KeypadPeriod", get_KeypadPeriod, null); + L.RegVar("KeypadDivide", get_KeypadDivide, null); + L.RegVar("KeypadMultiply", get_KeypadMultiply, null); + L.RegVar("KeypadMinus", get_KeypadMinus, null); + L.RegVar("KeypadPlus", get_KeypadPlus, null); + L.RegVar("KeypadEnter", get_KeypadEnter, null); + L.RegVar("KeypadEquals", get_KeypadEquals, null); + L.RegVar("UpArrow", get_UpArrow, null); + L.RegVar("DownArrow", get_DownArrow, null); + L.RegVar("RightArrow", get_RightArrow, null); + L.RegVar("LeftArrow", get_LeftArrow, null); + L.RegVar("Insert", get_Insert, null); + L.RegVar("Home", get_Home, null); + L.RegVar("End", get_End, null); + L.RegVar("PageUp", get_PageUp, null); + L.RegVar("PageDown", get_PageDown, null); + L.RegVar("F1", get_F1, null); + L.RegVar("F2", get_F2, null); + L.RegVar("F3", get_F3, null); + L.RegVar("F4", get_F4, null); + L.RegVar("F5", get_F5, null); + L.RegVar("F6", get_F6, null); + L.RegVar("F7", get_F7, null); + L.RegVar("F8", get_F8, null); + L.RegVar("F9", get_F9, null); + L.RegVar("F10", get_F10, null); + L.RegVar("F11", get_F11, null); + L.RegVar("F12", get_F12, null); + L.RegVar("F13", get_F13, null); + L.RegVar("F14", get_F14, null); + L.RegVar("F15", get_F15, null); + L.RegVar("Alpha0", get_Alpha0, null); + L.RegVar("Alpha1", get_Alpha1, null); + L.RegVar("Alpha2", get_Alpha2, null); + L.RegVar("Alpha3", get_Alpha3, null); + L.RegVar("Alpha4", get_Alpha4, null); + L.RegVar("Alpha5", get_Alpha5, null); + L.RegVar("Alpha6", get_Alpha6, null); + L.RegVar("Alpha7", get_Alpha7, null); + L.RegVar("Alpha8", get_Alpha8, null); + L.RegVar("Alpha9", get_Alpha9, null); + L.RegVar("Exclaim", get_Exclaim, null); + L.RegVar("DoubleQuote", get_DoubleQuote, null); + L.RegVar("Hash", get_Hash, null); + L.RegVar("Dollar", get_Dollar, null); + L.RegVar("Percent", get_Percent, null); + L.RegVar("Ampersand", get_Ampersand, null); + L.RegVar("Quote", get_Quote, null); + L.RegVar("LeftParen", get_LeftParen, null); + L.RegVar("RightParen", get_RightParen, null); + L.RegVar("Asterisk", get_Asterisk, null); + L.RegVar("Plus", get_Plus, null); + L.RegVar("Comma", get_Comma, null); + L.RegVar("Minus", get_Minus, null); + L.RegVar("Period", get_Period, null); + L.RegVar("Slash", get_Slash, null); + L.RegVar("Colon", get_Colon, null); + L.RegVar("Semicolon", get_Semicolon, null); + L.RegVar("Less", get_Less, null); + L.RegVar("Equals", get_Equals, null); + L.RegVar("Greater", get_Greater, null); + L.RegVar("Question", get_Question, null); + L.RegVar("At", get_At, null); + L.RegVar("LeftBracket", get_LeftBracket, null); + L.RegVar("Backslash", get_Backslash, null); + L.RegVar("RightBracket", get_RightBracket, null); + L.RegVar("Caret", get_Caret, null); + L.RegVar("Underscore", get_Underscore, null); + L.RegVar("BackQuote", get_BackQuote, null); + L.RegVar("A", get_A, null); + L.RegVar("B", get_B, null); + L.RegVar("C", get_C, null); + L.RegVar("D", get_D, null); + L.RegVar("E", get_E, null); + L.RegVar("F", get_F, null); + L.RegVar("G", get_G, null); + L.RegVar("H", get_H, null); + L.RegVar("I", get_I, null); + L.RegVar("J", get_J, null); + L.RegVar("K", get_K, null); + L.RegVar("L", get_L, null); + L.RegVar("M", get_M, null); + L.RegVar("N", get_N, null); + L.RegVar("O", get_O, null); + L.RegVar("P", get_P, null); + L.RegVar("Q", get_Q, null); + L.RegVar("R", get_R, null); + L.RegVar("S", get_S, null); + L.RegVar("T", get_T, null); + L.RegVar("U", get_U, null); + L.RegVar("V", get_V, null); + L.RegVar("W", get_W, null); + L.RegVar("X", get_X, null); + L.RegVar("Y", get_Y, null); + L.RegVar("Z", get_Z, null); + L.RegVar("LeftCurlyBracket", get_LeftCurlyBracket, null); + L.RegVar("Pipe", get_Pipe, null); + L.RegVar("RightCurlyBracket", get_RightCurlyBracket, null); + L.RegVar("Tilde", get_Tilde, null); + L.RegVar("Numlock", get_Numlock, null); + L.RegVar("CapsLock", get_CapsLock, null); + L.RegVar("ScrollLock", get_ScrollLock, null); + L.RegVar("RightShift", get_RightShift, null); + L.RegVar("LeftShift", get_LeftShift, null); + L.RegVar("RightControl", get_RightControl, null); + L.RegVar("LeftControl", get_LeftControl, null); + L.RegVar("RightAlt", get_RightAlt, null); + L.RegVar("LeftAlt", get_LeftAlt, null); + L.RegVar("LeftCommand", get_LeftCommand, null); + L.RegVar("LeftApple", get_LeftApple, null); + L.RegVar("LeftWindows", get_LeftWindows, null); + L.RegVar("RightCommand", get_RightCommand, null); + L.RegVar("RightApple", get_RightApple, null); + L.RegVar("RightWindows", get_RightWindows, null); + L.RegVar("AltGr", get_AltGr, null); + L.RegVar("Help", get_Help, null); + L.RegVar("Print", get_Print, null); + L.RegVar("SysReq", get_SysReq, null); + L.RegVar("Break", get_Break, null); + L.RegVar("Menu", get_Menu, null); + L.RegVar("Mouse0", get_Mouse0, null); + L.RegVar("Mouse1", get_Mouse1, null); + L.RegVar("Mouse2", get_Mouse2, null); + L.RegVar("Mouse3", get_Mouse3, null); + L.RegVar("Mouse4", get_Mouse4, null); + L.RegVar("Mouse5", get_Mouse5, null); + L.RegVar("Mouse6", get_Mouse6, null); + L.RegVar("JoystickButton0", get_JoystickButton0, null); + L.RegVar("JoystickButton1", get_JoystickButton1, null); + L.RegVar("JoystickButton2", get_JoystickButton2, null); + L.RegVar("JoystickButton3", get_JoystickButton3, null); + L.RegVar("JoystickButton4", get_JoystickButton4, null); + L.RegVar("JoystickButton5", get_JoystickButton5, null); + L.RegVar("JoystickButton6", get_JoystickButton6, null); + L.RegVar("JoystickButton7", get_JoystickButton7, null); + L.RegVar("JoystickButton8", get_JoystickButton8, null); + L.RegVar("JoystickButton9", get_JoystickButton9, null); + L.RegVar("JoystickButton10", get_JoystickButton10, null); + L.RegVar("JoystickButton11", get_JoystickButton11, null); + L.RegVar("JoystickButton12", get_JoystickButton12, null); + L.RegVar("JoystickButton13", get_JoystickButton13, null); + L.RegVar("JoystickButton14", get_JoystickButton14, null); + L.RegVar("JoystickButton15", get_JoystickButton15, null); + L.RegVar("JoystickButton16", get_JoystickButton16, null); + L.RegVar("JoystickButton17", get_JoystickButton17, null); + L.RegVar("JoystickButton18", get_JoystickButton18, null); + L.RegVar("JoystickButton19", get_JoystickButton19, null); + L.RegVar("Joystick1Button0", get_Joystick1Button0, null); + L.RegVar("Joystick1Button1", get_Joystick1Button1, null); + L.RegVar("Joystick1Button2", get_Joystick1Button2, null); + L.RegVar("Joystick1Button3", get_Joystick1Button3, null); + L.RegVar("Joystick1Button4", get_Joystick1Button4, null); + L.RegVar("Joystick1Button5", get_Joystick1Button5, null); + L.RegVar("Joystick1Button6", get_Joystick1Button6, null); + L.RegVar("Joystick1Button7", get_Joystick1Button7, null); + L.RegVar("Joystick1Button8", get_Joystick1Button8, null); + L.RegVar("Joystick1Button9", get_Joystick1Button9, null); + L.RegVar("Joystick1Button10", get_Joystick1Button10, null); + L.RegVar("Joystick1Button11", get_Joystick1Button11, null); + L.RegVar("Joystick1Button12", get_Joystick1Button12, null); + L.RegVar("Joystick1Button13", get_Joystick1Button13, null); + L.RegVar("Joystick1Button14", get_Joystick1Button14, null); + L.RegVar("Joystick1Button15", get_Joystick1Button15, null); + L.RegVar("Joystick1Button16", get_Joystick1Button16, null); + L.RegVar("Joystick1Button17", get_Joystick1Button17, null); + L.RegVar("Joystick1Button18", get_Joystick1Button18, null); + L.RegVar("Joystick1Button19", get_Joystick1Button19, null); + L.RegVar("Joystick2Button0", get_Joystick2Button0, null); + L.RegVar("Joystick2Button1", get_Joystick2Button1, null); + L.RegVar("Joystick2Button2", get_Joystick2Button2, null); + L.RegVar("Joystick2Button3", get_Joystick2Button3, null); + L.RegVar("Joystick2Button4", get_Joystick2Button4, null); + L.RegVar("Joystick2Button5", get_Joystick2Button5, null); + L.RegVar("Joystick2Button6", get_Joystick2Button6, null); + L.RegVar("Joystick2Button7", get_Joystick2Button7, null); + L.RegVar("Joystick2Button8", get_Joystick2Button8, null); + L.RegVar("Joystick2Button9", get_Joystick2Button9, null); + L.RegVar("Joystick2Button10", get_Joystick2Button10, null); + L.RegVar("Joystick2Button11", get_Joystick2Button11, null); + L.RegVar("Joystick2Button12", get_Joystick2Button12, null); + L.RegVar("Joystick2Button13", get_Joystick2Button13, null); + L.RegVar("Joystick2Button14", get_Joystick2Button14, null); + L.RegVar("Joystick2Button15", get_Joystick2Button15, null); + L.RegVar("Joystick2Button16", get_Joystick2Button16, null); + L.RegVar("Joystick2Button17", get_Joystick2Button17, null); + L.RegVar("Joystick2Button18", get_Joystick2Button18, null); + L.RegVar("Joystick2Button19", get_Joystick2Button19, null); + L.RegVar("Joystick3Button0", get_Joystick3Button0, null); + L.RegVar("Joystick3Button1", get_Joystick3Button1, null); + L.RegVar("Joystick3Button2", get_Joystick3Button2, null); + L.RegVar("Joystick3Button3", get_Joystick3Button3, null); + L.RegVar("Joystick3Button4", get_Joystick3Button4, null); + L.RegVar("Joystick3Button5", get_Joystick3Button5, null); + L.RegVar("Joystick3Button6", get_Joystick3Button6, null); + L.RegVar("Joystick3Button7", get_Joystick3Button7, null); + L.RegVar("Joystick3Button8", get_Joystick3Button8, null); + L.RegVar("Joystick3Button9", get_Joystick3Button9, null); + L.RegVar("Joystick3Button10", get_Joystick3Button10, null); + L.RegVar("Joystick3Button11", get_Joystick3Button11, null); + L.RegVar("Joystick3Button12", get_Joystick3Button12, null); + L.RegVar("Joystick3Button13", get_Joystick3Button13, null); + L.RegVar("Joystick3Button14", get_Joystick3Button14, null); + L.RegVar("Joystick3Button15", get_Joystick3Button15, null); + L.RegVar("Joystick3Button16", get_Joystick3Button16, null); + L.RegVar("Joystick3Button17", get_Joystick3Button17, null); + L.RegVar("Joystick3Button18", get_Joystick3Button18, null); + L.RegVar("Joystick3Button19", get_Joystick3Button19, null); + L.RegVar("Joystick4Button0", get_Joystick4Button0, null); + L.RegVar("Joystick4Button1", get_Joystick4Button1, null); + L.RegVar("Joystick4Button2", get_Joystick4Button2, null); + L.RegVar("Joystick4Button3", get_Joystick4Button3, null); + L.RegVar("Joystick4Button4", get_Joystick4Button4, null); + L.RegVar("Joystick4Button5", get_Joystick4Button5, null); + L.RegVar("Joystick4Button6", get_Joystick4Button6, null); + L.RegVar("Joystick4Button7", get_Joystick4Button7, null); + L.RegVar("Joystick4Button8", get_Joystick4Button8, null); + L.RegVar("Joystick4Button9", get_Joystick4Button9, null); + L.RegVar("Joystick4Button10", get_Joystick4Button10, null); + L.RegVar("Joystick4Button11", get_Joystick4Button11, null); + L.RegVar("Joystick4Button12", get_Joystick4Button12, null); + L.RegVar("Joystick4Button13", get_Joystick4Button13, null); + L.RegVar("Joystick4Button14", get_Joystick4Button14, null); + L.RegVar("Joystick4Button15", get_Joystick4Button15, null); + L.RegVar("Joystick4Button16", get_Joystick4Button16, null); + L.RegVar("Joystick4Button17", get_Joystick4Button17, null); + L.RegVar("Joystick4Button18", get_Joystick4Button18, null); + L.RegVar("Joystick4Button19", get_Joystick4Button19, null); + L.RegVar("Joystick5Button0", get_Joystick5Button0, null); + L.RegVar("Joystick5Button1", get_Joystick5Button1, null); + L.RegVar("Joystick5Button2", get_Joystick5Button2, null); + L.RegVar("Joystick5Button3", get_Joystick5Button3, null); + L.RegVar("Joystick5Button4", get_Joystick5Button4, null); + L.RegVar("Joystick5Button5", get_Joystick5Button5, null); + L.RegVar("Joystick5Button6", get_Joystick5Button6, null); + L.RegVar("Joystick5Button7", get_Joystick5Button7, null); + L.RegVar("Joystick5Button8", get_Joystick5Button8, null); + L.RegVar("Joystick5Button9", get_Joystick5Button9, null); + L.RegVar("Joystick5Button10", get_Joystick5Button10, null); + L.RegVar("Joystick5Button11", get_Joystick5Button11, null); + L.RegVar("Joystick5Button12", get_Joystick5Button12, null); + L.RegVar("Joystick5Button13", get_Joystick5Button13, null); + L.RegVar("Joystick5Button14", get_Joystick5Button14, null); + L.RegVar("Joystick5Button15", get_Joystick5Button15, null); + L.RegVar("Joystick5Button16", get_Joystick5Button16, null); + L.RegVar("Joystick5Button17", get_Joystick5Button17, null); + L.RegVar("Joystick5Button18", get_Joystick5Button18, null); + L.RegVar("Joystick5Button19", get_Joystick5Button19, null); + L.RegVar("Joystick6Button0", get_Joystick6Button0, null); + L.RegVar("Joystick6Button1", get_Joystick6Button1, null); + L.RegVar("Joystick6Button2", get_Joystick6Button2, null); + L.RegVar("Joystick6Button3", get_Joystick6Button3, null); + L.RegVar("Joystick6Button4", get_Joystick6Button4, null); + L.RegVar("Joystick6Button5", get_Joystick6Button5, null); + L.RegVar("Joystick6Button6", get_Joystick6Button6, null); + L.RegVar("Joystick6Button7", get_Joystick6Button7, null); + L.RegVar("Joystick6Button8", get_Joystick6Button8, null); + L.RegVar("Joystick6Button9", get_Joystick6Button9, null); + L.RegVar("Joystick6Button10", get_Joystick6Button10, null); + L.RegVar("Joystick6Button11", get_Joystick6Button11, null); + L.RegVar("Joystick6Button12", get_Joystick6Button12, null); + L.RegVar("Joystick6Button13", get_Joystick6Button13, null); + L.RegVar("Joystick6Button14", get_Joystick6Button14, null); + L.RegVar("Joystick6Button15", get_Joystick6Button15, null); + L.RegVar("Joystick6Button16", get_Joystick6Button16, null); + L.RegVar("Joystick6Button17", get_Joystick6Button17, null); + L.RegVar("Joystick6Button18", get_Joystick6Button18, null); + L.RegVar("Joystick6Button19", get_Joystick6Button19, null); + L.RegVar("Joystick7Button0", get_Joystick7Button0, null); + L.RegVar("Joystick7Button1", get_Joystick7Button1, null); + L.RegVar("Joystick7Button2", get_Joystick7Button2, null); + L.RegVar("Joystick7Button3", get_Joystick7Button3, null); + L.RegVar("Joystick7Button4", get_Joystick7Button4, null); + L.RegVar("Joystick7Button5", get_Joystick7Button5, null); + L.RegVar("Joystick7Button6", get_Joystick7Button6, null); + L.RegVar("Joystick7Button7", get_Joystick7Button7, null); + L.RegVar("Joystick7Button8", get_Joystick7Button8, null); + L.RegVar("Joystick7Button9", get_Joystick7Button9, null); + L.RegVar("Joystick7Button10", get_Joystick7Button10, null); + L.RegVar("Joystick7Button11", get_Joystick7Button11, null); + L.RegVar("Joystick7Button12", get_Joystick7Button12, null); + L.RegVar("Joystick7Button13", get_Joystick7Button13, null); + L.RegVar("Joystick7Button14", get_Joystick7Button14, null); + L.RegVar("Joystick7Button15", get_Joystick7Button15, null); + L.RegVar("Joystick7Button16", get_Joystick7Button16, null); + L.RegVar("Joystick7Button17", get_Joystick7Button17, null); + L.RegVar("Joystick7Button18", get_Joystick7Button18, null); + L.RegVar("Joystick7Button19", get_Joystick7Button19, null); + L.RegVar("Joystick8Button0", get_Joystick8Button0, null); + L.RegVar("Joystick8Button1", get_Joystick8Button1, null); + L.RegVar("Joystick8Button2", get_Joystick8Button2, null); + L.RegVar("Joystick8Button3", get_Joystick8Button3, null); + L.RegVar("Joystick8Button4", get_Joystick8Button4, null); + L.RegVar("Joystick8Button5", get_Joystick8Button5, null); + L.RegVar("Joystick8Button6", get_Joystick8Button6, null); + L.RegVar("Joystick8Button7", get_Joystick8Button7, null); + L.RegVar("Joystick8Button8", get_Joystick8Button8, null); + L.RegVar("Joystick8Button9", get_Joystick8Button9, null); + L.RegVar("Joystick8Button10", get_Joystick8Button10, null); + L.RegVar("Joystick8Button11", get_Joystick8Button11, null); + L.RegVar("Joystick8Button12", get_Joystick8Button12, null); + L.RegVar("Joystick8Button13", get_Joystick8Button13, null); + L.RegVar("Joystick8Button14", get_Joystick8Button14, null); + L.RegVar("Joystick8Button15", get_Joystick8Button15, null); + L.RegVar("Joystick8Button16", get_Joystick8Button16, null); + L.RegVar("Joystick8Button17", get_Joystick8Button17, null); + L.RegVar("Joystick8Button18", get_Joystick8Button18, null); + L.RegVar("Joystick8Button19", get_Joystick8Button19, null); + L.RegFunction("IntToEnum", IntToEnum); + L.EndEnum(); + TypeTraits.Check = CheckType; + StackTraits.Push = Push; + } + + static void Push(IntPtr L, UnityEngine.KeyCode arg) + { + ToLua.Push(L, arg); + } + + static bool CheckType(IntPtr L, int pos) + { + return TypeChecker.CheckEnumType(typeof(UnityEngine.KeyCode), L, pos); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_None(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.None); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Backspace(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Backspace); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Delete(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Delete); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Tab(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Tab); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Clear(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Clear); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Return(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Return); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Pause(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Pause); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Escape(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Escape); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Space(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Space); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Keypad0(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Keypad0); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Keypad1(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Keypad1); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Keypad2(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Keypad2); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Keypad3(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Keypad3); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Keypad4(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Keypad4); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Keypad5(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Keypad5); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Keypad6(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Keypad6); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Keypad7(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Keypad7); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Keypad8(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Keypad8); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Keypad9(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Keypad9); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_KeypadPeriod(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.KeypadPeriod); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_KeypadDivide(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.KeypadDivide); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_KeypadMultiply(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.KeypadMultiply); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_KeypadMinus(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.KeypadMinus); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_KeypadPlus(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.KeypadPlus); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_KeypadEnter(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.KeypadEnter); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_KeypadEquals(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.KeypadEquals); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_UpArrow(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.UpArrow); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_DownArrow(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.DownArrow); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_RightArrow(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.RightArrow); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_LeftArrow(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.LeftArrow); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Insert(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Insert); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Home(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Home); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_End(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.End); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_PageUp(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.PageUp); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_PageDown(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.PageDown); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_F1(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.F1); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_F2(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.F2); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_F3(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.F3); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_F4(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.F4); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_F5(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.F5); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_F6(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.F6); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_F7(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.F7); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_F8(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.F8); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_F9(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.F9); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_F10(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.F10); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_F11(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.F11); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_F12(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.F12); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_F13(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.F13); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_F14(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.F14); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_F15(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.F15); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Alpha0(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Alpha0); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Alpha1(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Alpha1); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Alpha2(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Alpha2); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Alpha3(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Alpha3); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Alpha4(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Alpha4); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Alpha5(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Alpha5); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Alpha6(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Alpha6); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Alpha7(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Alpha7); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Alpha8(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Alpha8); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Alpha9(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Alpha9); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Exclaim(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Exclaim); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_DoubleQuote(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.DoubleQuote); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Hash(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Hash); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Dollar(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Dollar); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Percent(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Percent); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Ampersand(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Ampersand); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Quote(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Quote); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_LeftParen(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.LeftParen); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_RightParen(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.RightParen); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Asterisk(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Asterisk); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Plus(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Plus); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Comma(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Comma); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Minus(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Minus); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Period(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Period); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Slash(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Slash); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Colon(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Colon); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Semicolon(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Semicolon); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Less(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Less); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Equals(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Equals); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Greater(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Greater); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Question(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Question); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_At(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.At); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_LeftBracket(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.LeftBracket); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Backslash(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Backslash); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_RightBracket(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.RightBracket); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Caret(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Caret); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Underscore(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Underscore); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_BackQuote(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.BackQuote); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_A(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.A); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_B(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.B); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_C(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.C); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_D(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.D); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_E(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.E); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_F(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.F); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_G(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.G); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_H(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.H); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_I(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.I); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_J(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.J); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_K(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.K); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_L(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.L); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_M(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.M); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_N(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.N); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_O(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.O); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_P(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.P); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Q(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Q); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_R(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.R); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_S(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.S); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_T(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.T); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_U(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.U); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_V(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.V); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_W(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.W); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_X(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.X); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Y(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Y); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Z(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Z); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_LeftCurlyBracket(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.LeftCurlyBracket); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Pipe(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Pipe); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_RightCurlyBracket(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.RightCurlyBracket); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Tilde(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Tilde); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Numlock(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Numlock); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_CapsLock(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.CapsLock); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_ScrollLock(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.ScrollLock); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_RightShift(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.RightShift); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_LeftShift(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.LeftShift); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_RightControl(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.RightControl); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_LeftControl(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.LeftControl); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_RightAlt(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.RightAlt); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_LeftAlt(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.LeftAlt); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_LeftCommand(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.LeftCommand); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_LeftApple(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.LeftApple); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_LeftWindows(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.LeftWindows); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_RightCommand(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.RightCommand); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_RightApple(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.RightApple); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_RightWindows(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.RightWindows); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_AltGr(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.AltGr); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Help(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Help); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Print(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Print); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_SysReq(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.SysReq); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Break(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Break); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Menu(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Menu); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Mouse0(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Mouse0); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Mouse1(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Mouse1); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Mouse2(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Mouse2); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Mouse3(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Mouse3); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Mouse4(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Mouse4); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Mouse5(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Mouse5); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Mouse6(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Mouse6); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_JoystickButton0(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.JoystickButton0); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_JoystickButton1(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.JoystickButton1); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_JoystickButton2(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.JoystickButton2); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_JoystickButton3(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.JoystickButton3); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_JoystickButton4(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.JoystickButton4); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_JoystickButton5(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.JoystickButton5); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_JoystickButton6(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.JoystickButton6); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_JoystickButton7(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.JoystickButton7); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_JoystickButton8(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.JoystickButton8); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_JoystickButton9(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.JoystickButton9); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_JoystickButton10(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.JoystickButton10); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_JoystickButton11(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.JoystickButton11); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_JoystickButton12(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.JoystickButton12); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_JoystickButton13(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.JoystickButton13); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_JoystickButton14(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.JoystickButton14); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_JoystickButton15(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.JoystickButton15); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_JoystickButton16(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.JoystickButton16); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_JoystickButton17(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.JoystickButton17); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_JoystickButton18(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.JoystickButton18); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_JoystickButton19(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.JoystickButton19); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick1Button0(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick1Button0); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick1Button1(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick1Button1); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick1Button2(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick1Button2); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick1Button3(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick1Button3); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick1Button4(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick1Button4); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick1Button5(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick1Button5); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick1Button6(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick1Button6); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick1Button7(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick1Button7); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick1Button8(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick1Button8); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick1Button9(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick1Button9); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick1Button10(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick1Button10); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick1Button11(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick1Button11); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick1Button12(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick1Button12); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick1Button13(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick1Button13); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick1Button14(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick1Button14); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick1Button15(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick1Button15); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick1Button16(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick1Button16); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick1Button17(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick1Button17); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick1Button18(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick1Button18); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick1Button19(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick1Button19); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick2Button0(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick2Button0); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick2Button1(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick2Button1); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick2Button2(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick2Button2); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick2Button3(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick2Button3); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick2Button4(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick2Button4); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick2Button5(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick2Button5); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick2Button6(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick2Button6); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick2Button7(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick2Button7); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick2Button8(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick2Button8); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick2Button9(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick2Button9); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick2Button10(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick2Button10); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick2Button11(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick2Button11); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick2Button12(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick2Button12); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick2Button13(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick2Button13); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick2Button14(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick2Button14); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick2Button15(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick2Button15); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick2Button16(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick2Button16); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick2Button17(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick2Button17); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick2Button18(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick2Button18); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick2Button19(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick2Button19); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick3Button0(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick3Button0); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick3Button1(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick3Button1); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick3Button2(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick3Button2); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick3Button3(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick3Button3); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick3Button4(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick3Button4); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick3Button5(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick3Button5); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick3Button6(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick3Button6); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick3Button7(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick3Button7); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick3Button8(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick3Button8); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick3Button9(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick3Button9); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick3Button10(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick3Button10); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick3Button11(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick3Button11); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick3Button12(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick3Button12); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick3Button13(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick3Button13); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick3Button14(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick3Button14); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick3Button15(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick3Button15); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick3Button16(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick3Button16); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick3Button17(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick3Button17); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick3Button18(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick3Button18); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick3Button19(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick3Button19); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick4Button0(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick4Button0); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick4Button1(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick4Button1); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick4Button2(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick4Button2); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick4Button3(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick4Button3); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick4Button4(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick4Button4); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick4Button5(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick4Button5); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick4Button6(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick4Button6); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick4Button7(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick4Button7); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick4Button8(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick4Button8); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick4Button9(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick4Button9); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick4Button10(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick4Button10); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick4Button11(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick4Button11); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick4Button12(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick4Button12); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick4Button13(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick4Button13); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick4Button14(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick4Button14); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick4Button15(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick4Button15); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick4Button16(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick4Button16); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick4Button17(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick4Button17); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick4Button18(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick4Button18); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick4Button19(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick4Button19); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick5Button0(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick5Button0); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick5Button1(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick5Button1); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick5Button2(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick5Button2); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick5Button3(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick5Button3); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick5Button4(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick5Button4); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick5Button5(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick5Button5); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick5Button6(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick5Button6); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick5Button7(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick5Button7); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick5Button8(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick5Button8); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick5Button9(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick5Button9); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick5Button10(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick5Button10); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick5Button11(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick5Button11); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick5Button12(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick5Button12); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick5Button13(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick5Button13); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick5Button14(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick5Button14); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick5Button15(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick5Button15); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick5Button16(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick5Button16); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick5Button17(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick5Button17); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick5Button18(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick5Button18); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick5Button19(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick5Button19); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick6Button0(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick6Button0); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick6Button1(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick6Button1); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick6Button2(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick6Button2); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick6Button3(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick6Button3); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick6Button4(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick6Button4); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick6Button5(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick6Button5); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick6Button6(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick6Button6); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick6Button7(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick6Button7); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick6Button8(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick6Button8); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick6Button9(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick6Button9); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick6Button10(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick6Button10); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick6Button11(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick6Button11); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick6Button12(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick6Button12); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick6Button13(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick6Button13); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick6Button14(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick6Button14); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick6Button15(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick6Button15); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick6Button16(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick6Button16); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick6Button17(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick6Button17); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick6Button18(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick6Button18); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick6Button19(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick6Button19); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick7Button0(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick7Button0); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick7Button1(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick7Button1); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick7Button2(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick7Button2); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick7Button3(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick7Button3); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick7Button4(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick7Button4); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick7Button5(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick7Button5); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick7Button6(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick7Button6); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick7Button7(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick7Button7); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick7Button8(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick7Button8); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick7Button9(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick7Button9); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick7Button10(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick7Button10); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick7Button11(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick7Button11); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick7Button12(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick7Button12); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick7Button13(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick7Button13); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick7Button14(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick7Button14); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick7Button15(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick7Button15); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick7Button16(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick7Button16); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick7Button17(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick7Button17); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick7Button18(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick7Button18); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick7Button19(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick7Button19); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick8Button0(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick8Button0); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick8Button1(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick8Button1); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick8Button2(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick8Button2); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick8Button3(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick8Button3); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick8Button4(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick8Button4); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick8Button5(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick8Button5); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick8Button6(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick8Button6); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick8Button7(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick8Button7); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick8Button8(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick8Button8); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick8Button9(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick8Button9); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick8Button10(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick8Button10); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick8Button11(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick8Button11); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick8Button12(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick8Button12); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick8Button13(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick8Button13); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick8Button14(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick8Button14); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick8Button15(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick8Button15); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick8Button16(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick8Button16); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick8Button17(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick8Button17); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick8Button18(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick8Button18); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Joystick8Button19(IntPtr L) + { + ToLua.Push(L, UnityEngine.KeyCode.Joystick8Button19); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IntToEnum(IntPtr L) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + UnityEngine.KeyCode o = (UnityEngine.KeyCode)arg0; + ToLua.Push(L, o); + return 1; + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_KeyCodeWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_KeyCodeWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..03431c1558181505d17b076926ba633eeca6f273 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_KeyCodeWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 61a88b8c26b95b04d8feca02ff3c0789 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_LightTypeWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_LightTypeWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..28e5c34e62f0958d88ae284407e36125feb7ffbf --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_LightTypeWrap.cs @@ -0,0 +1,83 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_LightTypeWrap +{ + public static void Register(LuaState L) + { + L.BeginEnum(typeof(UnityEngine.LightType)); + L.RegVar("Spot", get_Spot, null); + L.RegVar("Directional", get_Directional, null); + L.RegVar("Point", get_Point, null); + L.RegVar("Area", get_Area, null); + L.RegVar("Rectangle", get_Rectangle, null); + L.RegVar("Disc", get_Disc, null); + L.RegFunction("IntToEnum", IntToEnum); + L.EndEnum(); + TypeTraits.Check = CheckType; + StackTraits.Push = Push; + } + + static void Push(IntPtr L, UnityEngine.LightType arg) + { + ToLua.Push(L, arg); + } + + static bool CheckType(IntPtr L, int pos) + { + return TypeChecker.CheckEnumType(typeof(UnityEngine.LightType), L, pos); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Spot(IntPtr L) + { + ToLua.Push(L, UnityEngine.LightType.Spot); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Directional(IntPtr L) + { + ToLua.Push(L, UnityEngine.LightType.Directional); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Point(IntPtr L) + { + ToLua.Push(L, UnityEngine.LightType.Point); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Area(IntPtr L) + { + ToLua.Push(L, UnityEngine.LightType.Area); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Rectangle(IntPtr L) + { + ToLua.Push(L, UnityEngine.LightType.Rectangle); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Disc(IntPtr L) + { + ToLua.Push(L, UnityEngine.LightType.Disc); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IntToEnum(IntPtr L) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + UnityEngine.LightType o = (UnityEngine.LightType)arg0; + ToLua.Push(L, o); + return 1; + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_LightTypeWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_LightTypeWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..4bec1adfccaed883b80f752608f709d1c2a50d43 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_LightTypeWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a85c11c091695754687a8dc475c8e65a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_MaterialWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_MaterialWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..c43017a39643d6162c6363d2c8c2acada44ebd90 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_MaterialWrap.cs @@ -0,0 +1,2321 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_MaterialWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.Material), typeof(UnityEngine.Object)); + L.RegFunction("HasProperty", HasProperty); + L.RegFunction("HasFloat", HasFloat); + L.RegFunction("HasInt", HasInt); + L.RegFunction("HasInteger", HasInteger); + L.RegFunction("HasTexture", HasTexture); + L.RegFunction("HasMatrix", HasMatrix); + L.RegFunction("HasVector", HasVector); + L.RegFunction("HasColor", HasColor); + L.RegFunction("HasBuffer", HasBuffer); + L.RegFunction("HasConstantBuffer", HasConstantBuffer); + L.RegFunction("EnableKeyword", EnableKeyword); + L.RegFunction("DisableKeyword", DisableKeyword); + L.RegFunction("IsKeywordEnabled", IsKeywordEnabled); + L.RegFunction("SetShaderPassEnabled", SetShaderPassEnabled); + L.RegFunction("GetShaderPassEnabled", GetShaderPassEnabled); + L.RegFunction("GetPassName", GetPassName); + L.RegFunction("FindPass", FindPass); + L.RegFunction("SetOverrideTag", SetOverrideTag); + L.RegFunction("GetTag", GetTag); + L.RegFunction("Lerp", Lerp); + L.RegFunction("SetPass", SetPass); + L.RegFunction("CopyPropertiesFromMaterial", CopyPropertiesFromMaterial); + L.RegFunction("ComputeCRC", ComputeCRC); + L.RegFunction("GetTexturePropertyNames", GetTexturePropertyNames); + L.RegFunction("GetTexturePropertyNameIDs", GetTexturePropertyNameIDs); + L.RegFunction("SetInt", SetInt); + L.RegFunction("SetFloat", SetFloat); + L.RegFunction("SetInteger", SetInteger); + L.RegFunction("SetColor", SetColor); + L.RegFunction("SetVector", SetVector); + L.RegFunction("SetMatrix", SetMatrix); + L.RegFunction("SetTexture", SetTexture); + L.RegFunction("SetBuffer", SetBuffer); + L.RegFunction("SetConstantBuffer", SetConstantBuffer); + L.RegFunction("SetFloatArray", SetFloatArray); + L.RegFunction("SetColorArray", SetColorArray); + L.RegFunction("SetVectorArray", SetVectorArray); + L.RegFunction("SetMatrixArray", SetMatrixArray); + L.RegFunction("GetInt", GetInt); + L.RegFunction("GetFloat", GetFloat); + L.RegFunction("GetInteger", GetInteger); + L.RegFunction("GetColor", GetColor); + L.RegFunction("GetVector", GetVector); + L.RegFunction("GetMatrix", GetMatrix); + L.RegFunction("GetTexture", GetTexture); + L.RegFunction("GetFloatArray", GetFloatArray); + L.RegFunction("GetColorArray", GetColorArray); + L.RegFunction("GetVectorArray", GetVectorArray); + L.RegFunction("GetMatrixArray", GetMatrixArray); + L.RegFunction("SetTextureOffset", SetTextureOffset); + L.RegFunction("SetTextureScale", SetTextureScale); + L.RegFunction("GetTextureOffset", GetTextureOffset); + L.RegFunction("GetTextureScale", GetTextureScale); + L.RegFunction("New", _CreateUnityEngine_Material); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("shader", get_shader, set_shader); + L.RegVar("color", get_color, set_color); + L.RegVar("mainTexture", get_mainTexture, set_mainTexture); + L.RegVar("mainTextureOffset", get_mainTextureOffset, set_mainTextureOffset); + L.RegVar("mainTextureScale", get_mainTextureScale, set_mainTextureScale); + L.RegVar("renderQueue", get_renderQueue, set_renderQueue); + L.RegVar("globalIlluminationFlags", get_globalIlluminationFlags, set_globalIlluminationFlags); + L.RegVar("doubleSidedGI", get_doubleSidedGI, set_doubleSidedGI); + L.RegVar("enableInstancing", get_enableInstancing, set_enableInstancing); + L.RegVar("passCount", get_passCount, null); + L.RegVar("shaderKeywords", get_shaderKeywords, set_shaderKeywords); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateUnityEngine_Material(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Shader arg0 = (UnityEngine.Shader)ToLua.ToObject(L, 1); + UnityEngine.Material obj = new UnityEngine.Material(arg0); + ToLua.Push(L, obj); + return 1; + } + else if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Material arg0 = (UnityEngine.Material)ToLua.ToObject(L, 1); + UnityEngine.Material obj = new UnityEngine.Material(arg0); + ToLua.Push(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.Material.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int HasProperty(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + bool o = obj.HasProperty(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + bool o = obj.HasProperty(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.HasProperty"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int HasFloat(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + bool o = obj.HasFloat(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + bool o = obj.HasFloat(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.HasFloat"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int HasInt(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + bool o = obj.HasInt(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + bool o = obj.HasInt(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.HasInt"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int HasInteger(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + bool o = obj.HasInteger(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + bool o = obj.HasInteger(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.HasInteger"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int HasTexture(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + bool o = obj.HasTexture(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + bool o = obj.HasTexture(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.HasTexture"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int HasMatrix(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + bool o = obj.HasMatrix(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + bool o = obj.HasMatrix(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.HasMatrix"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int HasVector(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + bool o = obj.HasVector(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + bool o = obj.HasVector(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.HasVector"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int HasColor(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + bool o = obj.HasColor(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + bool o = obj.HasColor(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.HasColor"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int HasBuffer(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + bool o = obj.HasBuffer(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + bool o = obj.HasBuffer(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.HasBuffer"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int HasConstantBuffer(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + bool o = obj.HasConstantBuffer(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + bool o = obj.HasConstantBuffer(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.HasConstantBuffer"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int EnableKeyword(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + obj.EnableKeyword(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int DisableKeyword(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + obj.DisableKeyword(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IsKeywordEnabled(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + bool o = obj.IsKeywordEnabled(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetShaderPassEnabled(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + bool arg1 = LuaDLL.luaL_checkboolean(L, 3); + obj.SetShaderPassEnabled(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetShaderPassEnabled(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + bool o = obj.GetShaderPassEnabled(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetPassName(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + string o = obj.GetPassName(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int FindPass(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + int o = obj.FindPass(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetOverrideTag(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + string arg1 = ToLua.CheckString(L, 3); + obj.SetOverrideTag(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetTag(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + bool arg1 = LuaDLL.luaL_checkboolean(L, 3); + string o = obj.GetTag(arg0, arg1); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else if (count == 4) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + bool arg1 = LuaDLL.luaL_checkboolean(L, 3); + string arg2 = ToLua.CheckString(L, 4); + string o = obj.GetTag(arg0, arg1, arg2); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.GetTag"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Lerp(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 4); + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + UnityEngine.Material arg0 = (UnityEngine.Material)ToLua.CheckObject(L, 2); + UnityEngine.Material arg1 = (UnityEngine.Material)ToLua.CheckObject(L, 3); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + obj.Lerp(arg0, arg1, arg2); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetPass(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + bool o = obj.SetPass(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CopyPropertiesFromMaterial(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + UnityEngine.Material arg0 = (UnityEngine.Material)ToLua.CheckObject(L, 2); + obj.CopyPropertiesFromMaterial(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ComputeCRC(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int o = obj.ComputeCRC(); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetTexturePropertyNames(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string[] o = obj.GetTexturePropertyNames(); + ToLua.Push(L, o); + return 1; + } + else if (count == 2) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + System.Collections.Generic.List arg0 = (System.Collections.Generic.List)ToLua.CheckObject(L, 2, typeof(System.Collections.Generic.List)); + obj.GetTexturePropertyNames(arg0); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.GetTexturePropertyNames"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetTexturePropertyNameIDs(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int[] o = obj.GetTexturePropertyNameIDs(); + ToLua.Push(L, o); + return 1; + } + else if (count == 2) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + System.Collections.Generic.List arg0 = (System.Collections.Generic.List)ToLua.CheckObject(L, 2, typeof(System.Collections.Generic.List)); + obj.GetTexturePropertyNameIDs(arg0); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.GetTexturePropertyNameIDs"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetInt(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + obj.SetInt(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + obj.SetInt(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.SetInt"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetFloat(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + float arg1 = (float)LuaDLL.lua_tonumber(L, 3); + obj.SetFloat(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + float arg1 = (float)LuaDLL.lua_tonumber(L, 3); + obj.SetFloat(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.SetFloat"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetInteger(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + obj.SetInteger(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + int arg1 = (int)LuaDLL.lua_tonumber(L, 3); + obj.SetInteger(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.SetInteger"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetColor(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.Color arg1 = ToLua.ToColor(L, 3); + obj.SetColor(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Color arg1 = ToLua.ToColor(L, 3); + obj.SetColor(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.SetColor"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetVector(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.Vector4 arg1 = ToLua.ToVector4(L, 3); + obj.SetVector(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Vector4 arg1 = ToLua.ToVector4(L, 3); + obj.SetVector(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.SetVector"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetMatrix(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.Matrix4x4 arg1 = StackTraits.To(L, 3); + obj.SetMatrix(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Matrix4x4 arg1 = StackTraits.To(L, 3); + obj.SetMatrix(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.SetMatrix"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetTexture(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.Texture arg1 = (UnityEngine.Texture)ToLua.ToObject(L, 3); + obj.SetTexture(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Texture arg1 = (UnityEngine.Texture)ToLua.ToObject(L, 3); + obj.SetTexture(arg0, arg1); + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.RenderTexture arg1 = (UnityEngine.RenderTexture)ToLua.ToObject(L, 3); + UnityEngine.Rendering.RenderTextureSubElement arg2 = (UnityEngine.Rendering.RenderTextureSubElement)ToLua.ToObject(L, 4); + obj.SetTexture(arg0, arg1, arg2); + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + UnityEngine.RenderTexture arg1 = (UnityEngine.RenderTexture)ToLua.ToObject(L, 3); + UnityEngine.Rendering.RenderTextureSubElement arg2 = (UnityEngine.Rendering.RenderTextureSubElement)ToLua.ToObject(L, 4); + obj.SetTexture(arg0, arg1, arg2); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.SetTexture"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetBuffer(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.ComputeBuffer arg1 = (UnityEngine.ComputeBuffer)ToLua.ToObject(L, 3); + obj.SetBuffer(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + UnityEngine.ComputeBuffer arg1 = (UnityEngine.ComputeBuffer)ToLua.ToObject(L, 3); + obj.SetBuffer(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.GraphicsBuffer arg1 = (UnityEngine.GraphicsBuffer)ToLua.ToObject(L, 3); + obj.SetBuffer(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + UnityEngine.GraphicsBuffer arg1 = (UnityEngine.GraphicsBuffer)ToLua.ToObject(L, 3); + obj.SetBuffer(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.SetBuffer"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetConstantBuffer(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 5 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.ComputeBuffer arg1 = (UnityEngine.ComputeBuffer)ToLua.ToObject(L, 3); + int arg2 = (int)LuaDLL.lua_tonumber(L, 4); + int arg3 = (int)LuaDLL.lua_tonumber(L, 5); + obj.SetConstantBuffer(arg0, arg1, arg2, arg3); + return 0; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + UnityEngine.ComputeBuffer arg1 = (UnityEngine.ComputeBuffer)ToLua.ToObject(L, 3); + int arg2 = (int)LuaDLL.lua_tonumber(L, 4); + int arg3 = (int)LuaDLL.lua_tonumber(L, 5); + obj.SetConstantBuffer(arg0, arg1, arg2, arg3); + return 0; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.GraphicsBuffer arg1 = (UnityEngine.GraphicsBuffer)ToLua.ToObject(L, 3); + int arg2 = (int)LuaDLL.lua_tonumber(L, 4); + int arg3 = (int)LuaDLL.lua_tonumber(L, 5); + obj.SetConstantBuffer(arg0, arg1, arg2, arg3); + return 0; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + UnityEngine.GraphicsBuffer arg1 = (UnityEngine.GraphicsBuffer)ToLua.ToObject(L, 3); + int arg2 = (int)LuaDLL.lua_tonumber(L, 4); + int arg3 = (int)LuaDLL.lua_tonumber(L, 5); + obj.SetConstantBuffer(arg0, arg1, arg2, arg3); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.SetConstantBuffer"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetFloatArray(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3 && TypeChecker.CheckTypes>(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.ToObject(L, 3); + obj.SetFloatArray(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes>(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.ToObject(L, 3); + obj.SetFloatArray(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + float[] arg1 = ToLua.ToNumberArray(L, 3); + obj.SetFloatArray(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + float[] arg1 = ToLua.ToNumberArray(L, 3); + obj.SetFloatArray(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.SetFloatArray"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetColorArray(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3 && TypeChecker.CheckTypes>(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.ToObject(L, 3); + obj.SetColorArray(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes>(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.ToObject(L, 3); + obj.SetColorArray(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.Color[] arg1 = ToLua.ToStructArray(L, 3); + obj.SetColorArray(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Color[] arg1 = ToLua.ToStructArray(L, 3); + obj.SetColorArray(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.SetColorArray"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetVectorArray(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3 && TypeChecker.CheckTypes>(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.ToObject(L, 3); + obj.SetVectorArray(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes>(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.ToObject(L, 3); + obj.SetVectorArray(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.Vector4[] arg1 = ToLua.ToStructArray(L, 3); + obj.SetVectorArray(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Vector4[] arg1 = ToLua.ToStructArray(L, 3); + obj.SetVectorArray(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.SetVectorArray"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetMatrixArray(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3 && TypeChecker.CheckTypes>(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.ToObject(L, 3); + obj.SetMatrixArray(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes>(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.ToObject(L, 3); + obj.SetMatrixArray(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.Matrix4x4[] arg1 = ToLua.ToStructArray(L, 3); + obj.SetMatrixArray(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Matrix4x4[] arg1 = ToLua.ToStructArray(L, 3); + obj.SetMatrixArray(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.SetMatrixArray"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetInt(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + int o = obj.GetInt(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + int o = obj.GetInt(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.GetInt"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetFloat(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + float o = obj.GetFloat(arg0); + LuaDLL.lua_pushnumber(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + float o = obj.GetFloat(arg0); + LuaDLL.lua_pushnumber(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.GetFloat"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetInteger(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + int o = obj.GetInteger(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + int o = obj.GetInteger(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.GetInteger"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetColor(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.Color o = obj.GetColor(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Color o = obj.GetColor(arg0); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.GetColor"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetVector(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.Vector4 o = obj.GetVector(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Vector4 o = obj.GetVector(arg0); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.GetVector"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetMatrix(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.Matrix4x4 o = obj.GetMatrix(arg0); + ToLua.PushValue(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Matrix4x4 o = obj.GetMatrix(arg0); + ToLua.PushValue(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.GetMatrix"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetTexture(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.Texture o = obj.GetTexture(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Texture o = obj.GetTexture(arg0); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.GetTexture"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetFloatArray(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + float[] o = obj.GetFloatArray(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + float[] o = obj.GetFloatArray(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes>(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.ToObject(L, 3); + obj.GetFloatArray(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes>(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.ToObject(L, 3); + obj.GetFloatArray(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.GetFloatArray"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetColorArray(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.Color[] o = obj.GetColorArray(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Color[] o = obj.GetColorArray(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes>(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.ToObject(L, 3); + obj.GetColorArray(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes>(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.ToObject(L, 3); + obj.GetColorArray(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.GetColorArray"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetVectorArray(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.Vector4[] o = obj.GetVectorArray(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Vector4[] o = obj.GetVectorArray(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes>(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.ToObject(L, 3); + obj.GetVectorArray(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes>(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.ToObject(L, 3); + obj.GetVectorArray(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.GetVectorArray"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetMatrixArray(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.Matrix4x4[] o = obj.GetMatrixArray(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Matrix4x4[] o = obj.GetMatrixArray(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes>(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.ToObject(L, 3); + obj.GetMatrixArray(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes>(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.ToObject(L, 3); + obj.GetMatrixArray(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.GetMatrixArray"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetTextureOffset(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.Vector2 arg1 = ToLua.ToVector2(L, 3); + obj.SetTextureOffset(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Vector2 arg1 = ToLua.ToVector2(L, 3); + obj.SetTextureOffset(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.SetTextureOffset"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetTextureScale(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.Vector2 arg1 = ToLua.ToVector2(L, 3); + obj.SetTextureScale(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Vector2 arg1 = ToLua.ToVector2(L, 3); + obj.SetTextureScale(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.SetTextureScale"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetTextureOffset(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.Vector2 o = obj.GetTextureOffset(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Vector2 o = obj.GetTextureOffset(arg0); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.GetTextureOffset"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetTextureScale(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.Vector2 o = obj.GetTextureScale(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Vector2 o = obj.GetTextureScale(arg0); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.GetTextureScale"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_shader(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Material obj = (UnityEngine.Material)o; + UnityEngine.Shader ret = obj.shader; + ToLua.PushSealed(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index shader on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_color(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Material obj = (UnityEngine.Material)o; + UnityEngine.Color ret = obj.color; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index color on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_mainTexture(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Material obj = (UnityEngine.Material)o; + UnityEngine.Texture ret = obj.mainTexture; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index mainTexture on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_mainTextureOffset(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Material obj = (UnityEngine.Material)o; + UnityEngine.Vector2 ret = obj.mainTextureOffset; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index mainTextureOffset on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_mainTextureScale(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Material obj = (UnityEngine.Material)o; + UnityEngine.Vector2 ret = obj.mainTextureScale; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index mainTextureScale on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_renderQueue(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Material obj = (UnityEngine.Material)o; + int ret = obj.renderQueue; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index renderQueue on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_globalIlluminationFlags(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Material obj = (UnityEngine.Material)o; + UnityEngine.MaterialGlobalIlluminationFlags ret = obj.globalIlluminationFlags; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index globalIlluminationFlags on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_doubleSidedGI(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Material obj = (UnityEngine.Material)o; + bool ret = obj.doubleSidedGI; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index doubleSidedGI on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_enableInstancing(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Material obj = (UnityEngine.Material)o; + bool ret = obj.enableInstancing; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index enableInstancing on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_passCount(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Material obj = (UnityEngine.Material)o; + int ret = obj.passCount; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index passCount on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_shaderKeywords(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Material obj = (UnityEngine.Material)o; + string[] ret = obj.shaderKeywords; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index shaderKeywords on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_shader(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Material obj = (UnityEngine.Material)o; + UnityEngine.Shader arg0 = (UnityEngine.Shader)ToLua.CheckObject(L, 2, typeof(UnityEngine.Shader)); + obj.shader = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index shader on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_color(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Material obj = (UnityEngine.Material)o; + UnityEngine.Color arg0 = ToLua.ToColor(L, 2); + obj.color = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index color on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_mainTexture(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Material obj = (UnityEngine.Material)o; + UnityEngine.Texture arg0 = (UnityEngine.Texture)ToLua.CheckObject(L, 2); + obj.mainTexture = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index mainTexture on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_mainTextureOffset(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Material obj = (UnityEngine.Material)o; + UnityEngine.Vector2 arg0 = ToLua.ToVector2(L, 2); + obj.mainTextureOffset = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index mainTextureOffset on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_mainTextureScale(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Material obj = (UnityEngine.Material)o; + UnityEngine.Vector2 arg0 = ToLua.ToVector2(L, 2); + obj.mainTextureScale = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index mainTextureScale on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_renderQueue(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Material obj = (UnityEngine.Material)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.renderQueue = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index renderQueue on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_globalIlluminationFlags(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Material obj = (UnityEngine.Material)o; + UnityEngine.MaterialGlobalIlluminationFlags arg0 = (UnityEngine.MaterialGlobalIlluminationFlags)ToLua.CheckObject(L, 2, typeof(UnityEngine.MaterialGlobalIlluminationFlags)); + obj.globalIlluminationFlags = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index globalIlluminationFlags on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_doubleSidedGI(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Material obj = (UnityEngine.Material)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.doubleSidedGI = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index doubleSidedGI on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_enableInstancing(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Material obj = (UnityEngine.Material)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.enableInstancing = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index enableInstancing on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_shaderKeywords(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Material obj = (UnityEngine.Material)o; + string[] arg0 = ToLua.CheckStringArray(L, 2); + obj.shaderKeywords = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index shaderKeywords on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_MaterialWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_MaterialWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..ab3195eb54799fa8cd53e544f8388069a89c60fb --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_MaterialWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7976359e331f22847a44e5cd5df8e3c3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_MeshColliderWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_MeshColliderWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..4c94d69f57f8b7ce7924c87d33a85c9b59bcb1bf --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_MeshColliderWrap.cs @@ -0,0 +1,175 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_MeshColliderWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.MeshCollider), typeof(UnityEngine.Collider)); + L.RegFunction("New", _CreateUnityEngine_MeshCollider); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("sharedMesh", get_sharedMesh, set_sharedMesh); + L.RegVar("convex", get_convex, set_convex); + L.RegVar("cookingOptions", get_cookingOptions, set_cookingOptions); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateUnityEngine_MeshCollider(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + UnityEngine.MeshCollider obj = new UnityEngine.MeshCollider(); + ToLua.Push(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.MeshCollider.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_sharedMesh(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.MeshCollider obj = (UnityEngine.MeshCollider)o; + UnityEngine.Mesh ret = obj.sharedMesh; + ToLua.PushSealed(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index sharedMesh on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_convex(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.MeshCollider obj = (UnityEngine.MeshCollider)o; + bool ret = obj.convex; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index convex on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_cookingOptions(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.MeshCollider obj = (UnityEngine.MeshCollider)o; + UnityEngine.MeshColliderCookingOptions ret = obj.cookingOptions; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index cookingOptions on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_sharedMesh(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.MeshCollider obj = (UnityEngine.MeshCollider)o; + UnityEngine.Mesh arg0 = (UnityEngine.Mesh)ToLua.CheckObject(L, 2, typeof(UnityEngine.Mesh)); + obj.sharedMesh = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index sharedMesh on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_convex(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.MeshCollider obj = (UnityEngine.MeshCollider)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.convex = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index convex on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_cookingOptions(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.MeshCollider obj = (UnityEngine.MeshCollider)o; + UnityEngine.MeshColliderCookingOptions arg0 = (UnityEngine.MeshColliderCookingOptions)ToLua.CheckObject(L, 2, typeof(UnityEngine.MeshColliderCookingOptions)); + obj.cookingOptions = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index cookingOptions on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_MeshColliderWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_MeshColliderWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..d4abd8db290d8088bf275b2118e2f866d27d176b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_MeshColliderWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: aaf50e5199bc8244ba5dc6f058be3803 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_MonoBehaviourWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_MonoBehaviourWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..5d8ee09c2ee7ec9a3b9752ea3e41cd1dfccd6918 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_MonoBehaviourWrap.cs @@ -0,0 +1,295 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_MonoBehaviourWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.MonoBehaviour), typeof(UnityEngine.Behaviour)); + L.RegFunction("IsInvoking", IsInvoking); + L.RegFunction("CancelInvoke", CancelInvoke); + L.RegFunction("Invoke", Invoke); + L.RegFunction("InvokeRepeating", InvokeRepeating); + L.RegFunction("StartCoroutine", StartCoroutine); + L.RegFunction("StopCoroutine", StopCoroutine); + L.RegFunction("StopAllCoroutines", StopAllCoroutines); + L.RegFunction("print", print); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("useGUILayout", get_useGUILayout, set_useGUILayout); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IsInvoking(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.MonoBehaviour obj = (UnityEngine.MonoBehaviour)ToLua.CheckObject(L, 1); + bool o = obj.IsInvoking(); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 2) + { + UnityEngine.MonoBehaviour obj = (UnityEngine.MonoBehaviour)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + bool o = obj.IsInvoking(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.MonoBehaviour.IsInvoking"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CancelInvoke(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.MonoBehaviour obj = (UnityEngine.MonoBehaviour)ToLua.CheckObject(L, 1); + obj.CancelInvoke(); + return 0; + } + else if (count == 2) + { + UnityEngine.MonoBehaviour obj = (UnityEngine.MonoBehaviour)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + obj.CancelInvoke(arg0); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.MonoBehaviour.CancelInvoke"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Invoke(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.MonoBehaviour obj = (UnityEngine.MonoBehaviour)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + obj.Invoke(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int InvokeRepeating(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 4); + UnityEngine.MonoBehaviour obj = (UnityEngine.MonoBehaviour)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + obj.InvokeRepeating(arg0, arg1, arg2); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int StartCoroutine(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.MonoBehaviour obj = (UnityEngine.MonoBehaviour)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + UnityEngine.Coroutine o = obj.StartCoroutine(arg0); + ToLua.PushSealed(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.MonoBehaviour obj = (UnityEngine.MonoBehaviour)ToLua.CheckObject(L, 1); + System.Collections.IEnumerator arg0 = (System.Collections.IEnumerator)ToLua.ToObject(L, 2); + UnityEngine.Coroutine o = obj.StartCoroutine(arg0); + ToLua.PushSealed(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.MonoBehaviour obj = (UnityEngine.MonoBehaviour)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + object arg1 = ToLua.ToVarObject(L, 3); + UnityEngine.Coroutine o = obj.StartCoroutine(arg0, arg1); + ToLua.PushSealed(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.MonoBehaviour.StartCoroutine"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int StopCoroutine(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.MonoBehaviour obj = (UnityEngine.MonoBehaviour)ToLua.CheckObject(L, 1); + System.Collections.IEnumerator arg0 = (System.Collections.IEnumerator)ToLua.ToObject(L, 2); + obj.StopCoroutine(arg0); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.MonoBehaviour obj = (UnityEngine.MonoBehaviour)ToLua.CheckObject(L, 1); + UnityEngine.Coroutine arg0 = (UnityEngine.Coroutine)ToLua.ToObject(L, 2); + obj.StopCoroutine(arg0); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.MonoBehaviour obj = (UnityEngine.MonoBehaviour)ToLua.CheckObject(L, 1); + string arg0 = ToLua.ToString(L, 2); + obj.StopCoroutine(arg0); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.MonoBehaviour.StopCoroutine"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int StopAllCoroutines(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.MonoBehaviour obj = (UnityEngine.MonoBehaviour)ToLua.CheckObject(L, 1); + obj.StopAllCoroutines(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int print(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + object arg0 = ToLua.ToVarObject(L, 1); + UnityEngine.MonoBehaviour.print(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_useGUILayout(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.MonoBehaviour obj = (UnityEngine.MonoBehaviour)o; + bool ret = obj.useGUILayout; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index useGUILayout on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_useGUILayout(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.MonoBehaviour obj = (UnityEngine.MonoBehaviour)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.useGUILayout = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index useGUILayout on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_MonoBehaviourWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_MonoBehaviourWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..a4210f9e09d89d0a1f54b13688db50f3606b150c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_MonoBehaviourWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 84d1ce7dd7f77e245aacb54b894255f8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_PhysicsWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_PhysicsWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..20b64883247b7b1d8e62e40a740e1aa664838f0b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_PhysicsWrap.cs @@ -0,0 +1,2582 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_PhysicsWrap +{ + public static void Register(LuaState L) + { + L.BeginStaticLibs("Physics"); + L.RegFunction("IgnoreCollision", IgnoreCollision); + L.RegFunction("IgnoreLayerCollision", IgnoreLayerCollision); + L.RegFunction("GetIgnoreLayerCollision", GetIgnoreLayerCollision); + L.RegFunction("GetIgnoreCollision", GetIgnoreCollision); + L.RegFunction("Raycast", Raycast); + L.RegFunction("Linecast", Linecast); + L.RegFunction("CapsuleCast", CapsuleCast); + L.RegFunction("SphereCast", SphereCast); + L.RegFunction("BoxCast", BoxCast); + L.RegFunction("RaycastAll", RaycastAll); + L.RegFunction("RaycastNonAlloc", RaycastNonAlloc); + L.RegFunction("CapsuleCastAll", CapsuleCastAll); + L.RegFunction("SphereCastAll", SphereCastAll); + L.RegFunction("OverlapCapsule", OverlapCapsule); + L.RegFunction("OverlapSphere", OverlapSphere); + L.RegFunction("Simulate", Simulate); + L.RegFunction("SyncTransforms", SyncTransforms); + L.RegFunction("ComputePenetration", ComputePenetration); + L.RegFunction("ClosestPoint", ClosestPoint); + L.RegFunction("OverlapSphereNonAlloc", OverlapSphereNonAlloc); + L.RegFunction("CheckSphere", CheckSphere); + L.RegFunction("CapsuleCastNonAlloc", CapsuleCastNonAlloc); + L.RegFunction("SphereCastNonAlloc", SphereCastNonAlloc); + L.RegFunction("CheckCapsule", CheckCapsule); + L.RegFunction("CheckBox", CheckBox); + L.RegFunction("OverlapBox", OverlapBox); + L.RegFunction("OverlapBoxNonAlloc", OverlapBoxNonAlloc); + L.RegFunction("BoxCastNonAlloc", BoxCastNonAlloc); + L.RegFunction("BoxCastAll", BoxCastAll); + L.RegFunction("OverlapCapsuleNonAlloc", OverlapCapsuleNonAlloc); + L.RegFunction("RebuildBroadphaseRegions", RebuildBroadphaseRegions); + L.RegFunction("BakeMesh", BakeMesh); + L.RegConstant("IgnoreRaycastLayer", 4); + L.RegConstant("DefaultRaycastLayers", -5); + L.RegConstant("AllLayers", -1); + L.RegVar("gravity", get_gravity, set_gravity); + L.RegVar("defaultContactOffset", get_defaultContactOffset, set_defaultContactOffset); + L.RegVar("sleepThreshold", get_sleepThreshold, set_sleepThreshold); + L.RegVar("queriesHitTriggers", get_queriesHitTriggers, set_queriesHitTriggers); + L.RegVar("queriesHitBackfaces", get_queriesHitBackfaces, set_queriesHitBackfaces); + L.RegVar("bounceThreshold", get_bounceThreshold, set_bounceThreshold); + L.RegVar("defaultMaxDepenetrationVelocity", get_defaultMaxDepenetrationVelocity, set_defaultMaxDepenetrationVelocity); + L.RegVar("defaultSolverIterations", get_defaultSolverIterations, set_defaultSolverIterations); + L.RegVar("defaultSolverVelocityIterations", get_defaultSolverVelocityIterations, set_defaultSolverVelocityIterations); + L.RegVar("defaultMaxAngularSpeed", get_defaultMaxAngularSpeed, set_defaultMaxAngularSpeed); + L.RegVar("defaultPhysicsScene", get_defaultPhysicsScene, null); + L.RegVar("autoSimulation", get_autoSimulation, set_autoSimulation); + L.RegVar("autoSyncTransforms", get_autoSyncTransforms, set_autoSyncTransforms); + L.RegVar("reuseCollisionCallbacks", get_reuseCollisionCallbacks, set_reuseCollisionCallbacks); + L.RegVar("interCollisionDistance", get_interCollisionDistance, set_interCollisionDistance); + L.RegVar("interCollisionStiffness", get_interCollisionStiffness, set_interCollisionStiffness); + L.RegVar("interCollisionSettingsToggle", get_interCollisionSettingsToggle, set_interCollisionSettingsToggle); + L.RegVar("clothGravity", get_clothGravity, set_clothGravity); + L.EndStaticLibs(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IgnoreCollision(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Collider arg0 = (UnityEngine.Collider)ToLua.CheckObject(L, 1); + UnityEngine.Collider arg1 = (UnityEngine.Collider)ToLua.CheckObject(L, 2); + UnityEngine.Physics.IgnoreCollision(arg0, arg1); + return 0; + } + else if (count == 3) + { + UnityEngine.Collider arg0 = (UnityEngine.Collider)ToLua.CheckObject(L, 1); + UnityEngine.Collider arg1 = (UnityEngine.Collider)ToLua.CheckObject(L, 2); + bool arg2 = LuaDLL.luaL_checkboolean(L, 3); + UnityEngine.Physics.IgnoreCollision(arg0, arg1, arg2); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Physics.IgnoreCollision"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IgnoreLayerCollision(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Physics.IgnoreLayerCollision(arg0, arg1); + return 0; + } + else if (count == 3) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + bool arg2 = LuaDLL.luaL_checkboolean(L, 3); + UnityEngine.Physics.IgnoreLayerCollision(arg0, arg1, arg2); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Physics.IgnoreLayerCollision"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetIgnoreLayerCollision(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + bool o = UnityEngine.Physics.GetIgnoreLayerCollision(arg0, arg1); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetIgnoreCollision(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Collider arg0 = (UnityEngine.Collider)ToLua.CheckObject(L, 1); + UnityEngine.Collider arg1 = (UnityEngine.Collider)ToLua.CheckObject(L, 2); + bool o = UnityEngine.Physics.GetIgnoreCollision(arg0, arg1); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Raycast(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + bool o = UnityEngine.Physics.Raycast(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + bool o = UnityEngine.Physics.Raycast(arg0, arg1); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + float arg1 = (float)LuaDLL.lua_tonumber(L, 2); + bool o = UnityEngine.Physics.Raycast(arg0, arg1); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes>(L, 1)) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + UnityEngine.RaycastHit arg1; + bool o = UnityEngine.Physics.Raycast(arg0, out arg1); + LuaDLL.lua_pushboolean(L, o); + if (o) ToLua.Push(L, arg1); else LuaDLL.lua_pushnil(L); + return 2; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.lua_tonumber(L, 3); + bool o = UnityEngine.Physics.Raycast(arg0, arg1, arg2); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes>(L, 1)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.RaycastHit arg2; + bool o = UnityEngine.Physics.Raycast(arg0, arg1, out arg2); + LuaDLL.lua_pushboolean(L, o); + if (o) ToLua.Push(L, arg2); else LuaDLL.lua_pushnil(L); + return 2; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + float arg1 = (float)LuaDLL.lua_tonumber(L, 2); + int arg2 = (int)LuaDLL.lua_tonumber(L, 3); + bool o = UnityEngine.Physics.Raycast(arg0, arg1, arg2); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes, float>(L, 1)) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + UnityEngine.RaycastHit arg1; + float arg2 = (float)LuaDLL.lua_tonumber(L, 3); + bool o = UnityEngine.Physics.Raycast(arg0, out arg1, arg2); + LuaDLL.lua_pushboolean(L, o); + if (o) ToLua.Push(L, arg1); else LuaDLL.lua_pushnil(L); + return 2; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.lua_tonumber(L, 3); + int arg3 = (int)LuaDLL.lua_tonumber(L, 4); + bool o = UnityEngine.Physics.Raycast(arg0, arg1, arg2, arg3); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes, float>(L, 1)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.RaycastHit arg2; + float arg3 = (float)LuaDLL.lua_tonumber(L, 4); + bool o = UnityEngine.Physics.Raycast(arg0, arg1, out arg2, arg3); + LuaDLL.lua_pushboolean(L, o); + if (o) ToLua.Push(L, arg2); else LuaDLL.lua_pushnil(L); + return 2; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + float arg1 = (float)LuaDLL.lua_tonumber(L, 2); + int arg2 = (int)LuaDLL.lua_tonumber(L, 3); + UnityEngine.QueryTriggerInteraction arg3 = (UnityEngine.QueryTriggerInteraction)ToLua.ToObject(L, 4); + bool o = UnityEngine.Physics.Raycast(arg0, arg1, arg2, arg3); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes, float, int>(L, 1)) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + UnityEngine.RaycastHit arg1; + float arg2 = (float)LuaDLL.lua_tonumber(L, 3); + int arg3 = (int)LuaDLL.lua_tonumber(L, 4); + bool o = UnityEngine.Physics.Raycast(arg0, out arg1, arg2, arg3); + LuaDLL.lua_pushboolean(L, o); + if (o) ToLua.Push(L, arg1); else LuaDLL.lua_pushnil(L); + return 2; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.lua_tonumber(L, 3); + int arg3 = (int)LuaDLL.lua_tonumber(L, 4); + UnityEngine.QueryTriggerInteraction arg4 = (UnityEngine.QueryTriggerInteraction)ToLua.ToObject(L, 5); + bool o = UnityEngine.Physics.Raycast(arg0, arg1, arg2, arg3, arg4); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 5 && TypeChecker.CheckTypes, float, int>(L, 1)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.RaycastHit arg2; + float arg3 = (float)LuaDLL.lua_tonumber(L, 4); + int arg4 = (int)LuaDLL.lua_tonumber(L, 5); + bool o = UnityEngine.Physics.Raycast(arg0, arg1, out arg2, arg3, arg4); + LuaDLL.lua_pushboolean(L, o); + if (o) ToLua.Push(L, arg2); else LuaDLL.lua_pushnil(L); + return 2; + } + else if (count == 5 && TypeChecker.CheckTypes, float, int, UnityEngine.QueryTriggerInteraction>(L, 1)) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + UnityEngine.RaycastHit arg1; + float arg2 = (float)LuaDLL.lua_tonumber(L, 3); + int arg3 = (int)LuaDLL.lua_tonumber(L, 4); + UnityEngine.QueryTriggerInteraction arg4 = (UnityEngine.QueryTriggerInteraction)ToLua.ToObject(L, 5); + bool o = UnityEngine.Physics.Raycast(arg0, out arg1, arg2, arg3, arg4); + LuaDLL.lua_pushboolean(L, o); + if (o) ToLua.Push(L, arg1); else LuaDLL.lua_pushnil(L); + return 2; + } + else if (count == 6) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.RaycastHit arg2; + float arg3 = (float)LuaDLL.luaL_checknumber(L, 4); + int arg4 = (int)LuaDLL.luaL_checknumber(L, 5); + UnityEngine.QueryTriggerInteraction arg5 = (UnityEngine.QueryTriggerInteraction)ToLua.CheckObject(L, 6, typeof(UnityEngine.QueryTriggerInteraction)); + bool o = UnityEngine.Physics.Raycast(arg0, arg1, out arg2, arg3, arg4, arg5); + LuaDLL.lua_pushboolean(L, o); + if (o) ToLua.Push(L, arg2); else LuaDLL.lua_pushnil(L); + return 2; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Physics.Raycast"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Linecast(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + bool o = UnityEngine.Physics.Linecast(arg0, arg1); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 3)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + int arg2 = (int)LuaDLL.lua_tonumber(L, 3); + bool o = UnityEngine.Physics.Linecast(arg0, arg1, arg2); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes>(L, 3)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.RaycastHit arg2; + bool o = UnityEngine.Physics.Linecast(arg0, arg1, out arg2); + LuaDLL.lua_pushboolean(L, o); + ToLua.Push(L, arg2); + return 2; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 3)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + int arg2 = (int)LuaDLL.lua_tonumber(L, 3); + UnityEngine.QueryTriggerInteraction arg3 = (UnityEngine.QueryTriggerInteraction)ToLua.ToObject(L, 4); + bool o = UnityEngine.Physics.Linecast(arg0, arg1, arg2, arg3); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes, int>(L, 3)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.RaycastHit arg2; + int arg3 = (int)LuaDLL.lua_tonumber(L, 4); + bool o = UnityEngine.Physics.Linecast(arg0, arg1, out arg2, arg3); + LuaDLL.lua_pushboolean(L, o); + ToLua.Push(L, arg2); + return 2; + } + else if (count == 5) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.RaycastHit arg2; + int arg3 = (int)LuaDLL.luaL_checknumber(L, 4); + UnityEngine.QueryTriggerInteraction arg4 = (UnityEngine.QueryTriggerInteraction)ToLua.CheckObject(L, 5, typeof(UnityEngine.QueryTriggerInteraction)); + bool o = UnityEngine.Physics.Linecast(arg0, arg1, out arg2, arg3, arg4); + LuaDLL.lua_pushboolean(L, o); + ToLua.Push(L, arg2); + return 2; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Physics.Linecast"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CapsuleCast(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 4) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Vector3 arg3 = ToLua.ToVector3(L, 4); + bool o = UnityEngine.Physics.CapsuleCast(arg0, arg1, arg2, arg3); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 5)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Vector3 arg3 = ToLua.ToVector3(L, 4); + float arg4 = (float)LuaDLL.lua_tonumber(L, 5); + bool o = UnityEngine.Physics.CapsuleCast(arg0, arg1, arg2, arg3, arg4); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 5 && TypeChecker.CheckTypes>(L, 5)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Vector3 arg3 = ToLua.ToVector3(L, 4); + UnityEngine.RaycastHit arg4; + bool o = UnityEngine.Physics.CapsuleCast(arg0, arg1, arg2, arg3, out arg4); + LuaDLL.lua_pushboolean(L, o); + ToLua.Push(L, arg4); + return 2; + } + else if (count == 6 && TypeChecker.CheckTypes(L, 5)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Vector3 arg3 = ToLua.ToVector3(L, 4); + float arg4 = (float)LuaDLL.lua_tonumber(L, 5); + int arg5 = (int)LuaDLL.lua_tonumber(L, 6); + bool o = UnityEngine.Physics.CapsuleCast(arg0, arg1, arg2, arg3, arg4, arg5); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 6 && TypeChecker.CheckTypes, float>(L, 5)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Vector3 arg3 = ToLua.ToVector3(L, 4); + UnityEngine.RaycastHit arg4; + float arg5 = (float)LuaDLL.lua_tonumber(L, 6); + bool o = UnityEngine.Physics.CapsuleCast(arg0, arg1, arg2, arg3, out arg4, arg5); + LuaDLL.lua_pushboolean(L, o); + ToLua.Push(L, arg4); + return 2; + } + else if (count == 7 && TypeChecker.CheckTypes(L, 5)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Vector3 arg3 = ToLua.ToVector3(L, 4); + float arg4 = (float)LuaDLL.lua_tonumber(L, 5); + int arg5 = (int)LuaDLL.lua_tonumber(L, 6); + UnityEngine.QueryTriggerInteraction arg6 = (UnityEngine.QueryTriggerInteraction)ToLua.ToObject(L, 7); + bool o = UnityEngine.Physics.CapsuleCast(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 7 && TypeChecker.CheckTypes, float, int>(L, 5)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Vector3 arg3 = ToLua.ToVector3(L, 4); + UnityEngine.RaycastHit arg4; + float arg5 = (float)LuaDLL.lua_tonumber(L, 6); + int arg6 = (int)LuaDLL.lua_tonumber(L, 7); + bool o = UnityEngine.Physics.CapsuleCast(arg0, arg1, arg2, arg3, out arg4, arg5, arg6); + LuaDLL.lua_pushboolean(L, o); + ToLua.Push(L, arg4); + return 2; + } + else if (count == 8) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Vector3 arg3 = ToLua.ToVector3(L, 4); + UnityEngine.RaycastHit arg4; + float arg5 = (float)LuaDLL.luaL_checknumber(L, 6); + int arg6 = (int)LuaDLL.luaL_checknumber(L, 7); + UnityEngine.QueryTriggerInteraction arg7 = (UnityEngine.QueryTriggerInteraction)ToLua.CheckObject(L, 8, typeof(UnityEngine.QueryTriggerInteraction)); + bool o = UnityEngine.Physics.CapsuleCast(arg0, arg1, arg2, arg3, out arg4, arg5, arg6, arg7); + LuaDLL.lua_pushboolean(L, o); + ToLua.Push(L, arg4); + return 2; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Physics.CapsuleCast"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SphereCast(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 2); + bool o = UnityEngine.Physics.SphereCast(arg0, arg1); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 3)) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 2); + float arg2 = (float)LuaDLL.lua_tonumber(L, 3); + bool o = UnityEngine.Physics.SphereCast(arg0, arg1, arg2); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes>(L, 3)) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.RaycastHit arg2; + bool o = UnityEngine.Physics.SphereCast(arg0, arg1, out arg2); + LuaDLL.lua_pushboolean(L, o); + ToLua.Push(L, arg2); + return 2; + } + else if (count == 4 && TypeChecker.CheckTypes>(L, 1)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + float arg1 = (float)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + UnityEngine.RaycastHit arg3; + bool o = UnityEngine.Physics.SphereCast(arg0, arg1, arg2, out arg3); + LuaDLL.lua_pushboolean(L, o); + ToLua.Push(L, arg3); + return 2; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + float arg1 = (float)LuaDLL.lua_tonumber(L, 2); + float arg2 = (float)LuaDLL.lua_tonumber(L, 3); + int arg3 = (int)LuaDLL.lua_tonumber(L, 4); + bool o = UnityEngine.Physics.SphereCast(arg0, arg1, arg2, arg3); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes, float>(L, 1)) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + float arg1 = (float)LuaDLL.lua_tonumber(L, 2); + UnityEngine.RaycastHit arg2; + float arg3 = (float)LuaDLL.lua_tonumber(L, 4); + bool o = UnityEngine.Physics.SphereCast(arg0, arg1, out arg2, arg3); + LuaDLL.lua_pushboolean(L, o); + ToLua.Push(L, arg2); + return 2; + } + else if (count == 5 && TypeChecker.CheckTypes, float>(L, 1)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + float arg1 = (float)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + UnityEngine.RaycastHit arg3; + float arg4 = (float)LuaDLL.lua_tonumber(L, 5); + bool o = UnityEngine.Physics.SphereCast(arg0, arg1, arg2, out arg3, arg4); + LuaDLL.lua_pushboolean(L, o); + ToLua.Push(L, arg3); + return 2; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + float arg1 = (float)LuaDLL.lua_tonumber(L, 2); + float arg2 = (float)LuaDLL.lua_tonumber(L, 3); + int arg3 = (int)LuaDLL.lua_tonumber(L, 4); + UnityEngine.QueryTriggerInteraction arg4 = (UnityEngine.QueryTriggerInteraction)ToLua.ToObject(L, 5); + bool o = UnityEngine.Physics.SphereCast(arg0, arg1, arg2, arg3, arg4); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 5 && TypeChecker.CheckTypes, float, int>(L, 1)) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + float arg1 = (float)LuaDLL.lua_tonumber(L, 2); + UnityEngine.RaycastHit arg2; + float arg3 = (float)LuaDLL.lua_tonumber(L, 4); + int arg4 = (int)LuaDLL.lua_tonumber(L, 5); + bool o = UnityEngine.Physics.SphereCast(arg0, arg1, out arg2, arg3, arg4); + LuaDLL.lua_pushboolean(L, o); + ToLua.Push(L, arg2); + return 2; + } + else if (count == 6 && TypeChecker.CheckTypes, float, int>(L, 1)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + float arg1 = (float)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + UnityEngine.RaycastHit arg3; + float arg4 = (float)LuaDLL.lua_tonumber(L, 5); + int arg5 = (int)LuaDLL.lua_tonumber(L, 6); + bool o = UnityEngine.Physics.SphereCast(arg0, arg1, arg2, out arg3, arg4, arg5); + LuaDLL.lua_pushboolean(L, o); + ToLua.Push(L, arg3); + return 2; + } + else if (count == 6 && TypeChecker.CheckTypes, float, int, UnityEngine.QueryTriggerInteraction>(L, 1)) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + float arg1 = (float)LuaDLL.lua_tonumber(L, 2); + UnityEngine.RaycastHit arg2; + float arg3 = (float)LuaDLL.lua_tonumber(L, 4); + int arg4 = (int)LuaDLL.lua_tonumber(L, 5); + UnityEngine.QueryTriggerInteraction arg5 = (UnityEngine.QueryTriggerInteraction)ToLua.ToObject(L, 6); + bool o = UnityEngine.Physics.SphereCast(arg0, arg1, out arg2, arg3, arg4, arg5); + LuaDLL.lua_pushboolean(L, o); + ToLua.Push(L, arg2); + return 2; + } + else if (count == 7) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + UnityEngine.RaycastHit arg3; + float arg4 = (float)LuaDLL.luaL_checknumber(L, 5); + int arg5 = (int)LuaDLL.luaL_checknumber(L, 6); + UnityEngine.QueryTriggerInteraction arg6 = (UnityEngine.QueryTriggerInteraction)ToLua.CheckObject(L, 7, typeof(UnityEngine.QueryTriggerInteraction)); + bool o = UnityEngine.Physics.SphereCast(arg0, arg1, arg2, out arg3, arg4, arg5, arg6); + LuaDLL.lua_pushboolean(L, o); + ToLua.Push(L, arg3); + return 2; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Physics.SphereCast"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int BoxCast(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + bool o = UnityEngine.Physics.BoxCast(arg0, arg1, arg2); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 4)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + UnityEngine.Quaternion arg3 = ToLua.ToQuaternion(L, 4); + bool o = UnityEngine.Physics.BoxCast(arg0, arg1, arg2, arg3); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes>(L, 4)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + UnityEngine.RaycastHit arg3; + bool o = UnityEngine.Physics.BoxCast(arg0, arg1, arg2, out arg3); + LuaDLL.lua_pushboolean(L, o); + ToLua.Push(L, arg3); + return 2; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 4)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + UnityEngine.Quaternion arg3 = ToLua.ToQuaternion(L, 4); + float arg4 = (float)LuaDLL.lua_tonumber(L, 5); + bool o = UnityEngine.Physics.BoxCast(arg0, arg1, arg2, arg3, arg4); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 5 && TypeChecker.CheckTypes, UnityEngine.Quaternion>(L, 4)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + UnityEngine.RaycastHit arg3; + UnityEngine.Quaternion arg4 = ToLua.ToQuaternion(L, 5); + bool o = UnityEngine.Physics.BoxCast(arg0, arg1, arg2, out arg3, arg4); + LuaDLL.lua_pushboolean(L, o); + ToLua.Push(L, arg3); + return 2; + } + else if (count == 6 && TypeChecker.CheckTypes(L, 4)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + UnityEngine.Quaternion arg3 = ToLua.ToQuaternion(L, 4); + float arg4 = (float)LuaDLL.lua_tonumber(L, 5); + int arg5 = (int)LuaDLL.lua_tonumber(L, 6); + bool o = UnityEngine.Physics.BoxCast(arg0, arg1, arg2, arg3, arg4, arg5); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 6 && TypeChecker.CheckTypes, UnityEngine.Quaternion, float>(L, 4)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + UnityEngine.RaycastHit arg3; + UnityEngine.Quaternion arg4 = ToLua.ToQuaternion(L, 5); + float arg5 = (float)LuaDLL.lua_tonumber(L, 6); + bool o = UnityEngine.Physics.BoxCast(arg0, arg1, arg2, out arg3, arg4, arg5); + LuaDLL.lua_pushboolean(L, o); + ToLua.Push(L, arg3); + return 2; + } + else if (count == 7 && TypeChecker.CheckTypes(L, 4)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + UnityEngine.Quaternion arg3 = ToLua.ToQuaternion(L, 4); + float arg4 = (float)LuaDLL.lua_tonumber(L, 5); + int arg5 = (int)LuaDLL.lua_tonumber(L, 6); + UnityEngine.QueryTriggerInteraction arg6 = (UnityEngine.QueryTriggerInteraction)ToLua.ToObject(L, 7); + bool o = UnityEngine.Physics.BoxCast(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 7 && TypeChecker.CheckTypes, UnityEngine.Quaternion, float, int>(L, 4)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + UnityEngine.RaycastHit arg3; + UnityEngine.Quaternion arg4 = ToLua.ToQuaternion(L, 5); + float arg5 = (float)LuaDLL.lua_tonumber(L, 6); + int arg6 = (int)LuaDLL.lua_tonumber(L, 7); + bool o = UnityEngine.Physics.BoxCast(arg0, arg1, arg2, out arg3, arg4, arg5, arg6); + LuaDLL.lua_pushboolean(L, o); + ToLua.Push(L, arg3); + return 2; + } + else if (count == 8) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + UnityEngine.RaycastHit arg3; + UnityEngine.Quaternion arg4 = ToLua.ToQuaternion(L, 5); + float arg5 = (float)LuaDLL.luaL_checknumber(L, 6); + int arg6 = (int)LuaDLL.luaL_checknumber(L, 7); + UnityEngine.QueryTriggerInteraction arg7 = (UnityEngine.QueryTriggerInteraction)ToLua.CheckObject(L, 8, typeof(UnityEngine.QueryTriggerInteraction)); + bool o = UnityEngine.Physics.BoxCast(arg0, arg1, arg2, out arg3, arg4, arg5, arg6, arg7); + LuaDLL.lua_pushboolean(L, o); + ToLua.Push(L, arg3); + return 2; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Physics.BoxCast"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int RaycastAll(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + UnityEngine.RaycastHit[] o = UnityEngine.Physics.RaycastAll(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.RaycastHit[] o = UnityEngine.Physics.RaycastAll(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + float arg1 = (float)LuaDLL.lua_tonumber(L, 2); + UnityEngine.RaycastHit[] o = UnityEngine.Physics.RaycastAll(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.lua_tonumber(L, 3); + UnityEngine.RaycastHit[] o = UnityEngine.Physics.RaycastAll(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + float arg1 = (float)LuaDLL.lua_tonumber(L, 2); + int arg2 = (int)LuaDLL.lua_tonumber(L, 3); + UnityEngine.RaycastHit[] o = UnityEngine.Physics.RaycastAll(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.lua_tonumber(L, 3); + int arg3 = (int)LuaDLL.lua_tonumber(L, 4); + UnityEngine.RaycastHit[] o = UnityEngine.Physics.RaycastAll(arg0, arg1, arg2, arg3); + ToLua.Push(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + float arg1 = (float)LuaDLL.lua_tonumber(L, 2); + int arg2 = (int)LuaDLL.lua_tonumber(L, 3); + UnityEngine.QueryTriggerInteraction arg3 = (UnityEngine.QueryTriggerInteraction)ToLua.ToObject(L, 4); + UnityEngine.RaycastHit[] o = UnityEngine.Physics.RaycastAll(arg0, arg1, arg2, arg3); + ToLua.Push(L, o); + return 1; + } + else if (count == 5) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 3); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 4); + UnityEngine.QueryTriggerInteraction arg4 = (UnityEngine.QueryTriggerInteraction)ToLua.CheckObject(L, 5, typeof(UnityEngine.QueryTriggerInteraction)); + UnityEngine.RaycastHit[] o = UnityEngine.Physics.RaycastAll(arg0, arg1, arg2, arg3, arg4); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Physics.RaycastAll"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int RaycastNonAlloc(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + UnityEngine.RaycastHit[] arg1 = ToLua.CheckStructArray(L, 2); + int o = UnityEngine.Physics.RaycastNonAlloc(arg0, arg1); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + UnityEngine.RaycastHit[] arg1 = ToLua.ToStructArray(L, 2); + float arg2 = (float)LuaDLL.lua_tonumber(L, 3); + int o = UnityEngine.Physics.RaycastNonAlloc(arg0, arg1, arg2); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.RaycastHit[] arg2 = ToLua.ToStructArray(L, 3); + int o = UnityEngine.Physics.RaycastNonAlloc(arg0, arg1, arg2); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + UnityEngine.RaycastHit[] arg1 = ToLua.ToStructArray(L, 2); + float arg2 = (float)LuaDLL.lua_tonumber(L, 3); + int arg3 = (int)LuaDLL.lua_tonumber(L, 4); + int o = UnityEngine.Physics.RaycastNonAlloc(arg0, arg1, arg2, arg3); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.RaycastHit[] arg2 = ToLua.ToStructArray(L, 3); + float arg3 = (float)LuaDLL.lua_tonumber(L, 4); + int o = UnityEngine.Physics.RaycastNonAlloc(arg0, arg1, arg2, arg3); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + UnityEngine.RaycastHit[] arg1 = ToLua.ToStructArray(L, 2); + float arg2 = (float)LuaDLL.lua_tonumber(L, 3); + int arg3 = (int)LuaDLL.lua_tonumber(L, 4); + UnityEngine.QueryTriggerInteraction arg4 = (UnityEngine.QueryTriggerInteraction)ToLua.ToObject(L, 5); + int o = UnityEngine.Physics.RaycastNonAlloc(arg0, arg1, arg2, arg3, arg4); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.RaycastHit[] arg2 = ToLua.ToStructArray(L, 3); + float arg3 = (float)LuaDLL.lua_tonumber(L, 4); + int arg4 = (int)LuaDLL.lua_tonumber(L, 5); + int o = UnityEngine.Physics.RaycastNonAlloc(arg0, arg1, arg2, arg3, arg4); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 6) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.RaycastHit[] arg2 = ToLua.CheckStructArray(L, 3); + float arg3 = (float)LuaDLL.luaL_checknumber(L, 4); + int arg4 = (int)LuaDLL.luaL_checknumber(L, 5); + UnityEngine.QueryTriggerInteraction arg5 = (UnityEngine.QueryTriggerInteraction)ToLua.CheckObject(L, 6, typeof(UnityEngine.QueryTriggerInteraction)); + int o = UnityEngine.Physics.RaycastNonAlloc(arg0, arg1, arg2, arg3, arg4, arg5); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Physics.RaycastNonAlloc"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CapsuleCastAll(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 4) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Vector3 arg3 = ToLua.ToVector3(L, 4); + UnityEngine.RaycastHit[] o = UnityEngine.Physics.CapsuleCastAll(arg0, arg1, arg2, arg3); + ToLua.Push(L, o); + return 1; + } + else if (count == 5) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Vector3 arg3 = ToLua.ToVector3(L, 4); + float arg4 = (float)LuaDLL.luaL_checknumber(L, 5); + UnityEngine.RaycastHit[] o = UnityEngine.Physics.CapsuleCastAll(arg0, arg1, arg2, arg3, arg4); + ToLua.Push(L, o); + return 1; + } + else if (count == 6) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Vector3 arg3 = ToLua.ToVector3(L, 4); + float arg4 = (float)LuaDLL.luaL_checknumber(L, 5); + int arg5 = (int)LuaDLL.luaL_checknumber(L, 6); + UnityEngine.RaycastHit[] o = UnityEngine.Physics.CapsuleCastAll(arg0, arg1, arg2, arg3, arg4, arg5); + ToLua.Push(L, o); + return 1; + } + else if (count == 7) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Vector3 arg3 = ToLua.ToVector3(L, 4); + float arg4 = (float)LuaDLL.luaL_checknumber(L, 5); + int arg5 = (int)LuaDLL.luaL_checknumber(L, 6); + UnityEngine.QueryTriggerInteraction arg6 = (UnityEngine.QueryTriggerInteraction)ToLua.CheckObject(L, 7, typeof(UnityEngine.QueryTriggerInteraction)); + UnityEngine.RaycastHit[] o = UnityEngine.Physics.CapsuleCastAll(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Physics.CapsuleCastAll"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SphereCastAll(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.RaycastHit[] o = UnityEngine.Physics.SphereCastAll(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + float arg1 = (float)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + UnityEngine.RaycastHit[] o = UnityEngine.Physics.SphereCastAll(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + float arg1 = (float)LuaDLL.lua_tonumber(L, 2); + float arg2 = (float)LuaDLL.lua_tonumber(L, 3); + UnityEngine.RaycastHit[] o = UnityEngine.Physics.SphereCastAll(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + float arg1 = (float)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + float arg3 = (float)LuaDLL.lua_tonumber(L, 4); + UnityEngine.RaycastHit[] o = UnityEngine.Physics.SphereCastAll(arg0, arg1, arg2, arg3); + ToLua.Push(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + float arg1 = (float)LuaDLL.lua_tonumber(L, 2); + float arg2 = (float)LuaDLL.lua_tonumber(L, 3); + int arg3 = (int)LuaDLL.lua_tonumber(L, 4); + UnityEngine.RaycastHit[] o = UnityEngine.Physics.SphereCastAll(arg0, arg1, arg2, arg3); + ToLua.Push(L, o); + return 1; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + float arg1 = (float)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + float arg3 = (float)LuaDLL.lua_tonumber(L, 4); + int arg4 = (int)LuaDLL.lua_tonumber(L, 5); + UnityEngine.RaycastHit[] o = UnityEngine.Physics.SphereCastAll(arg0, arg1, arg2, arg3, arg4); + ToLua.Push(L, o); + return 1; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + float arg1 = (float)LuaDLL.lua_tonumber(L, 2); + float arg2 = (float)LuaDLL.lua_tonumber(L, 3); + int arg3 = (int)LuaDLL.lua_tonumber(L, 4); + UnityEngine.QueryTriggerInteraction arg4 = (UnityEngine.QueryTriggerInteraction)ToLua.ToObject(L, 5); + UnityEngine.RaycastHit[] o = UnityEngine.Physics.SphereCastAll(arg0, arg1, arg2, arg3, arg4); + ToLua.Push(L, o); + return 1; + } + else if (count == 6) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + float arg3 = (float)LuaDLL.luaL_checknumber(L, 4); + int arg4 = (int)LuaDLL.luaL_checknumber(L, 5); + UnityEngine.QueryTriggerInteraction arg5 = (UnityEngine.QueryTriggerInteraction)ToLua.CheckObject(L, 6, typeof(UnityEngine.QueryTriggerInteraction)); + UnityEngine.RaycastHit[] o = UnityEngine.Physics.SphereCastAll(arg0, arg1, arg2, arg3, arg4, arg5); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Physics.SphereCastAll"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OverlapCapsule(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Collider[] o = UnityEngine.Physics.OverlapCapsule(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else if (count == 4) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 3); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 4); + UnityEngine.Collider[] o = UnityEngine.Physics.OverlapCapsule(arg0, arg1, arg2, arg3); + ToLua.Push(L, o); + return 1; + } + else if (count == 5) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 3); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 4); + UnityEngine.QueryTriggerInteraction arg4 = (UnityEngine.QueryTriggerInteraction)ToLua.CheckObject(L, 5, typeof(UnityEngine.QueryTriggerInteraction)); + UnityEngine.Collider[] o = UnityEngine.Physics.OverlapCapsule(arg0, arg1, arg2, arg3, arg4); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Physics.OverlapCapsule"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OverlapSphere(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Collider[] o = UnityEngine.Physics.OverlapSphere(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Collider[] o = UnityEngine.Physics.OverlapSphere(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else if (count == 4) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.QueryTriggerInteraction arg3 = (UnityEngine.QueryTriggerInteraction)ToLua.CheckObject(L, 4, typeof(UnityEngine.QueryTriggerInteraction)); + UnityEngine.Collider[] o = UnityEngine.Physics.OverlapSphere(arg0, arg1, arg2, arg3); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Physics.OverlapSphere"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Simulate(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 1); + UnityEngine.Physics.Simulate(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SyncTransforms(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 0); + UnityEngine.Physics.SyncTransforms(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ComputePenetration(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 8); + UnityEngine.Collider arg0 = (UnityEngine.Collider)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Quaternion arg2 = ToLua.ToQuaternion(L, 3); + UnityEngine.Collider arg3 = (UnityEngine.Collider)ToLua.CheckObject(L, 4); + UnityEngine.Vector3 arg4 = ToLua.ToVector3(L, 5); + UnityEngine.Quaternion arg5 = ToLua.ToQuaternion(L, 6); + UnityEngine.Vector3 arg6; + float arg7; + bool o = UnityEngine.Physics.ComputePenetration(arg0, arg1, arg2, arg3, arg4, arg5, out arg6, out arg7); + LuaDLL.lua_pushboolean(L, o); + ToLua.Push(L, arg6); + LuaDLL.lua_pushnumber(L, arg7); + return 3; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ClosestPoint(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 4); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Collider arg1 = (UnityEngine.Collider)ToLua.CheckObject(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + UnityEngine.Quaternion arg3 = ToLua.ToQuaternion(L, 4); + UnityEngine.Vector3 o = UnityEngine.Physics.ClosestPoint(arg0, arg1, arg2, arg3); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OverlapSphereNonAlloc(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Collider[] arg2 = ToLua.CheckObjectArray(L, 3); + int o = UnityEngine.Physics.OverlapSphereNonAlloc(arg0, arg1, arg2); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 4) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Collider[] arg2 = ToLua.CheckObjectArray(L, 3); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 4); + int o = UnityEngine.Physics.OverlapSphereNonAlloc(arg0, arg1, arg2, arg3); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 5) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Collider[] arg2 = ToLua.CheckObjectArray(L, 3); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 4); + UnityEngine.QueryTriggerInteraction arg4 = (UnityEngine.QueryTriggerInteraction)ToLua.CheckObject(L, 5, typeof(UnityEngine.QueryTriggerInteraction)); + int o = UnityEngine.Physics.OverlapSphereNonAlloc(arg0, arg1, arg2, arg3, arg4); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Physics.OverlapSphereNonAlloc"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CheckSphere(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 2); + bool o = UnityEngine.Physics.CheckSphere(arg0, arg1); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + bool o = UnityEngine.Physics.CheckSphere(arg0, arg1, arg2); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 4) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.QueryTriggerInteraction arg3 = (UnityEngine.QueryTriggerInteraction)ToLua.CheckObject(L, 4, typeof(UnityEngine.QueryTriggerInteraction)); + bool o = UnityEngine.Physics.CheckSphere(arg0, arg1, arg2, arg3); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Physics.CheckSphere"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CapsuleCastNonAlloc(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 5) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Vector3 arg3 = ToLua.ToVector3(L, 4); + UnityEngine.RaycastHit[] arg4 = ToLua.CheckStructArray(L, 5); + int o = UnityEngine.Physics.CapsuleCastNonAlloc(arg0, arg1, arg2, arg3, arg4); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 6) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Vector3 arg3 = ToLua.ToVector3(L, 4); + UnityEngine.RaycastHit[] arg4 = ToLua.CheckStructArray(L, 5); + float arg5 = (float)LuaDLL.luaL_checknumber(L, 6); + int o = UnityEngine.Physics.CapsuleCastNonAlloc(arg0, arg1, arg2, arg3, arg4, arg5); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 7) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Vector3 arg3 = ToLua.ToVector3(L, 4); + UnityEngine.RaycastHit[] arg4 = ToLua.CheckStructArray(L, 5); + float arg5 = (float)LuaDLL.luaL_checknumber(L, 6); + int arg6 = (int)LuaDLL.luaL_checknumber(L, 7); + int o = UnityEngine.Physics.CapsuleCastNonAlloc(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 8) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Vector3 arg3 = ToLua.ToVector3(L, 4); + UnityEngine.RaycastHit[] arg4 = ToLua.CheckStructArray(L, 5); + float arg5 = (float)LuaDLL.luaL_checknumber(L, 6); + int arg6 = (int)LuaDLL.luaL_checknumber(L, 7); + UnityEngine.QueryTriggerInteraction arg7 = (UnityEngine.QueryTriggerInteraction)ToLua.CheckObject(L, 8, typeof(UnityEngine.QueryTriggerInteraction)); + int o = UnityEngine.Physics.CapsuleCastNonAlloc(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Physics.CapsuleCastNonAlloc"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SphereCastNonAlloc(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.RaycastHit[] arg2 = ToLua.CheckStructArray(L, 3); + int o = UnityEngine.Physics.SphereCastNonAlloc(arg0, arg1, arg2); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + float arg1 = (float)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + UnityEngine.RaycastHit[] arg3 = ToLua.ToStructArray(L, 4); + int o = UnityEngine.Physics.SphereCastNonAlloc(arg0, arg1, arg2, arg3); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + float arg1 = (float)LuaDLL.lua_tonumber(L, 2); + UnityEngine.RaycastHit[] arg2 = ToLua.ToStructArray(L, 3); + float arg3 = (float)LuaDLL.lua_tonumber(L, 4); + int o = UnityEngine.Physics.SphereCastNonAlloc(arg0, arg1, arg2, arg3); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + float arg1 = (float)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + UnityEngine.RaycastHit[] arg3 = ToLua.ToStructArray(L, 4); + float arg4 = (float)LuaDLL.lua_tonumber(L, 5); + int o = UnityEngine.Physics.SphereCastNonAlloc(arg0, arg1, arg2, arg3, arg4); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + float arg1 = (float)LuaDLL.lua_tonumber(L, 2); + UnityEngine.RaycastHit[] arg2 = ToLua.ToStructArray(L, 3); + float arg3 = (float)LuaDLL.lua_tonumber(L, 4); + int arg4 = (int)LuaDLL.lua_tonumber(L, 5); + int o = UnityEngine.Physics.SphereCastNonAlloc(arg0, arg1, arg2, arg3, arg4); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 6 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + float arg1 = (float)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + UnityEngine.RaycastHit[] arg3 = ToLua.ToStructArray(L, 4); + float arg4 = (float)LuaDLL.lua_tonumber(L, 5); + int arg5 = (int)LuaDLL.lua_tonumber(L, 6); + int o = UnityEngine.Physics.SphereCastNonAlloc(arg0, arg1, arg2, arg3, arg4, arg5); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 6 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.Ray arg0 = ToLua.ToRay(L, 1); + float arg1 = (float)LuaDLL.lua_tonumber(L, 2); + UnityEngine.RaycastHit[] arg2 = ToLua.ToStructArray(L, 3); + float arg3 = (float)LuaDLL.lua_tonumber(L, 4); + int arg4 = (int)LuaDLL.lua_tonumber(L, 5); + UnityEngine.QueryTriggerInteraction arg5 = (UnityEngine.QueryTriggerInteraction)ToLua.ToObject(L, 6); + int o = UnityEngine.Physics.SphereCastNonAlloc(arg0, arg1, arg2, arg3, arg4, arg5); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 7) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + UnityEngine.RaycastHit[] arg3 = ToLua.CheckStructArray(L, 4); + float arg4 = (float)LuaDLL.luaL_checknumber(L, 5); + int arg5 = (int)LuaDLL.luaL_checknumber(L, 6); + UnityEngine.QueryTriggerInteraction arg6 = (UnityEngine.QueryTriggerInteraction)ToLua.CheckObject(L, 7, typeof(UnityEngine.QueryTriggerInteraction)); + int o = UnityEngine.Physics.SphereCastNonAlloc(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Physics.SphereCastNonAlloc"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CheckCapsule(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 3); + bool o = UnityEngine.Physics.CheckCapsule(arg0, arg1, arg2); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 4) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 3); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 4); + bool o = UnityEngine.Physics.CheckCapsule(arg0, arg1, arg2, arg3); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 5) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 3); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 4); + UnityEngine.QueryTriggerInteraction arg4 = (UnityEngine.QueryTriggerInteraction)ToLua.CheckObject(L, 5, typeof(UnityEngine.QueryTriggerInteraction)); + bool o = UnityEngine.Physics.CheckCapsule(arg0, arg1, arg2, arg3, arg4); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Physics.CheckCapsule"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CheckBox(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + bool o = UnityEngine.Physics.CheckBox(arg0, arg1); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Quaternion arg2 = ToLua.ToQuaternion(L, 3); + bool o = UnityEngine.Physics.CheckBox(arg0, arg1, arg2); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 4) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Quaternion arg2 = ToLua.ToQuaternion(L, 3); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 4); + bool o = UnityEngine.Physics.CheckBox(arg0, arg1, arg2, arg3); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 5) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Quaternion arg2 = ToLua.ToQuaternion(L, 3); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 4); + UnityEngine.QueryTriggerInteraction arg4 = (UnityEngine.QueryTriggerInteraction)ToLua.CheckObject(L, 5, typeof(UnityEngine.QueryTriggerInteraction)); + bool o = UnityEngine.Physics.CheckBox(arg0, arg1, arg2, arg3, arg4); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Physics.CheckBox"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OverlapBox(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Collider[] o = UnityEngine.Physics.OverlapBox(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Quaternion arg2 = ToLua.ToQuaternion(L, 3); + UnityEngine.Collider[] o = UnityEngine.Physics.OverlapBox(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else if (count == 4) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Quaternion arg2 = ToLua.ToQuaternion(L, 3); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 4); + UnityEngine.Collider[] o = UnityEngine.Physics.OverlapBox(arg0, arg1, arg2, arg3); + ToLua.Push(L, o); + return 1; + } + else if (count == 5) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Quaternion arg2 = ToLua.ToQuaternion(L, 3); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 4); + UnityEngine.QueryTriggerInteraction arg4 = (UnityEngine.QueryTriggerInteraction)ToLua.CheckObject(L, 5, typeof(UnityEngine.QueryTriggerInteraction)); + UnityEngine.Collider[] o = UnityEngine.Physics.OverlapBox(arg0, arg1, arg2, arg3, arg4); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Physics.OverlapBox"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OverlapBoxNonAlloc(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Collider[] arg2 = ToLua.CheckObjectArray(L, 3); + int o = UnityEngine.Physics.OverlapBoxNonAlloc(arg0, arg1, arg2); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 4) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Collider[] arg2 = ToLua.CheckObjectArray(L, 3); + UnityEngine.Quaternion arg3 = ToLua.ToQuaternion(L, 4); + int o = UnityEngine.Physics.OverlapBoxNonAlloc(arg0, arg1, arg2, arg3); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 5) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Collider[] arg2 = ToLua.CheckObjectArray(L, 3); + UnityEngine.Quaternion arg3 = ToLua.ToQuaternion(L, 4); + int arg4 = (int)LuaDLL.luaL_checknumber(L, 5); + int o = UnityEngine.Physics.OverlapBoxNonAlloc(arg0, arg1, arg2, arg3, arg4); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 6) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Collider[] arg2 = ToLua.CheckObjectArray(L, 3); + UnityEngine.Quaternion arg3 = ToLua.ToQuaternion(L, 4); + int arg4 = (int)LuaDLL.luaL_checknumber(L, 5); + UnityEngine.QueryTriggerInteraction arg5 = (UnityEngine.QueryTriggerInteraction)ToLua.CheckObject(L, 6, typeof(UnityEngine.QueryTriggerInteraction)); + int o = UnityEngine.Physics.OverlapBoxNonAlloc(arg0, arg1, arg2, arg3, arg4, arg5); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Physics.OverlapBoxNonAlloc"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int BoxCastNonAlloc(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 4) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + UnityEngine.RaycastHit[] arg3 = ToLua.CheckStructArray(L, 4); + int o = UnityEngine.Physics.BoxCastNonAlloc(arg0, arg1, arg2, arg3); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 5) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + UnityEngine.RaycastHit[] arg3 = ToLua.CheckStructArray(L, 4); + UnityEngine.Quaternion arg4 = ToLua.ToQuaternion(L, 5); + int o = UnityEngine.Physics.BoxCastNonAlloc(arg0, arg1, arg2, arg3, arg4); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 6) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + UnityEngine.RaycastHit[] arg3 = ToLua.CheckStructArray(L, 4); + UnityEngine.Quaternion arg4 = ToLua.ToQuaternion(L, 5); + float arg5 = (float)LuaDLL.luaL_checknumber(L, 6); + int o = UnityEngine.Physics.BoxCastNonAlloc(arg0, arg1, arg2, arg3, arg4, arg5); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 7) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + UnityEngine.RaycastHit[] arg3 = ToLua.CheckStructArray(L, 4); + UnityEngine.Quaternion arg4 = ToLua.ToQuaternion(L, 5); + float arg5 = (float)LuaDLL.luaL_checknumber(L, 6); + int arg6 = (int)LuaDLL.luaL_checknumber(L, 7); + int o = UnityEngine.Physics.BoxCastNonAlloc(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 8) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + UnityEngine.RaycastHit[] arg3 = ToLua.CheckStructArray(L, 4); + UnityEngine.Quaternion arg4 = ToLua.ToQuaternion(L, 5); + float arg5 = (float)LuaDLL.luaL_checknumber(L, 6); + int arg6 = (int)LuaDLL.luaL_checknumber(L, 7); + UnityEngine.QueryTriggerInteraction arg7 = (UnityEngine.QueryTriggerInteraction)ToLua.CheckObject(L, 8, typeof(UnityEngine.QueryTriggerInteraction)); + int o = UnityEngine.Physics.BoxCastNonAlloc(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Physics.BoxCastNonAlloc"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int BoxCastAll(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + UnityEngine.RaycastHit[] o = UnityEngine.Physics.BoxCastAll(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else if (count == 4) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + UnityEngine.Quaternion arg3 = ToLua.ToQuaternion(L, 4); + UnityEngine.RaycastHit[] o = UnityEngine.Physics.BoxCastAll(arg0, arg1, arg2, arg3); + ToLua.Push(L, o); + return 1; + } + else if (count == 5) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + UnityEngine.Quaternion arg3 = ToLua.ToQuaternion(L, 4); + float arg4 = (float)LuaDLL.luaL_checknumber(L, 5); + UnityEngine.RaycastHit[] o = UnityEngine.Physics.BoxCastAll(arg0, arg1, arg2, arg3, arg4); + ToLua.Push(L, o); + return 1; + } + else if (count == 6) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + UnityEngine.Quaternion arg3 = ToLua.ToQuaternion(L, 4); + float arg4 = (float)LuaDLL.luaL_checknumber(L, 5); + int arg5 = (int)LuaDLL.luaL_checknumber(L, 6); + UnityEngine.RaycastHit[] o = UnityEngine.Physics.BoxCastAll(arg0, arg1, arg2, arg3, arg4, arg5); + ToLua.Push(L, o); + return 1; + } + else if (count == 7) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3); + UnityEngine.Quaternion arg3 = ToLua.ToQuaternion(L, 4); + float arg4 = (float)LuaDLL.luaL_checknumber(L, 5); + int arg5 = (int)LuaDLL.luaL_checknumber(L, 6); + UnityEngine.QueryTriggerInteraction arg6 = (UnityEngine.QueryTriggerInteraction)ToLua.CheckObject(L, 7, typeof(UnityEngine.QueryTriggerInteraction)); + UnityEngine.RaycastHit[] o = UnityEngine.Physics.BoxCastAll(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Physics.BoxCastAll"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OverlapCapsuleNonAlloc(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 4) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Collider[] arg3 = ToLua.CheckObjectArray(L, 4); + int o = UnityEngine.Physics.OverlapCapsuleNonAlloc(arg0, arg1, arg2, arg3); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 5) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Collider[] arg3 = ToLua.CheckObjectArray(L, 4); + int arg4 = (int)LuaDLL.luaL_checknumber(L, 5); + int o = UnityEngine.Physics.OverlapCapsuleNonAlloc(arg0, arg1, arg2, arg3, arg4); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 6) + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Collider[] arg3 = ToLua.CheckObjectArray(L, 4); + int arg4 = (int)LuaDLL.luaL_checknumber(L, 5); + UnityEngine.QueryTriggerInteraction arg5 = (UnityEngine.QueryTriggerInteraction)ToLua.CheckObject(L, 6, typeof(UnityEngine.QueryTriggerInteraction)); + int o = UnityEngine.Physics.OverlapCapsuleNonAlloc(arg0, arg1, arg2, arg3, arg4, arg5); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Physics.OverlapCapsuleNonAlloc"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int RebuildBroadphaseRegions(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Bounds arg0 = ToLua.ToBounds(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Physics.RebuildBroadphaseRegions(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int BakeMesh(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + bool arg1 = LuaDLL.luaL_checkboolean(L, 2); + UnityEngine.Physics.BakeMesh(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_gravity(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.Physics.gravity); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_defaultContactOffset(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.Physics.defaultContactOffset); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_sleepThreshold(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.Physics.sleepThreshold); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_queriesHitTriggers(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Physics.queriesHitTriggers); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_queriesHitBackfaces(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Physics.queriesHitBackfaces); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_bounceThreshold(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.Physics.bounceThreshold); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_defaultMaxDepenetrationVelocity(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.Physics.defaultMaxDepenetrationVelocity); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_defaultSolverIterations(IntPtr L) + { + try + { + LuaDLL.lua_pushinteger(L, UnityEngine.Physics.defaultSolverIterations); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_defaultSolverVelocityIterations(IntPtr L) + { + try + { + LuaDLL.lua_pushinteger(L, UnityEngine.Physics.defaultSolverVelocityIterations); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_defaultMaxAngularSpeed(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.Physics.defaultMaxAngularSpeed); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_defaultPhysicsScene(IntPtr L) + { + try + { + ToLua.PushValue(L, UnityEngine.Physics.defaultPhysicsScene); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_autoSimulation(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Physics.autoSimulation); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_autoSyncTransforms(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Physics.autoSyncTransforms); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_reuseCollisionCallbacks(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Physics.reuseCollisionCallbacks); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_interCollisionDistance(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.Physics.interCollisionDistance); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_interCollisionStiffness(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.Physics.interCollisionStiffness); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_interCollisionSettingsToggle(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Physics.interCollisionSettingsToggle); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_clothGravity(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.Physics.clothGravity); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_gravity(IntPtr L) + { + try + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Physics.gravity = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_defaultContactOffset(IntPtr L) + { + try + { + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Physics.defaultContactOffset = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_sleepThreshold(IntPtr L) + { + try + { + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Physics.sleepThreshold = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_queriesHitTriggers(IntPtr L) + { + try + { + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + UnityEngine.Physics.queriesHitTriggers = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_queriesHitBackfaces(IntPtr L) + { + try + { + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + UnityEngine.Physics.queriesHitBackfaces = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_bounceThreshold(IntPtr L) + { + try + { + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Physics.bounceThreshold = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_defaultMaxDepenetrationVelocity(IntPtr L) + { + try + { + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Physics.defaultMaxDepenetrationVelocity = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_defaultSolverIterations(IntPtr L) + { + try + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Physics.defaultSolverIterations = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_defaultSolverVelocityIterations(IntPtr L) + { + try + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Physics.defaultSolverVelocityIterations = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_defaultMaxAngularSpeed(IntPtr L) + { + try + { + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Physics.defaultMaxAngularSpeed = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_autoSimulation(IntPtr L) + { + try + { + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + UnityEngine.Physics.autoSimulation = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_autoSyncTransforms(IntPtr L) + { + try + { + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + UnityEngine.Physics.autoSyncTransforms = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_reuseCollisionCallbacks(IntPtr L) + { + try + { + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + UnityEngine.Physics.reuseCollisionCallbacks = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_interCollisionDistance(IntPtr L) + { + try + { + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Physics.interCollisionDistance = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_interCollisionStiffness(IntPtr L) + { + try + { + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Physics.interCollisionStiffness = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_interCollisionSettingsToggle(IntPtr L) + { + try + { + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + UnityEngine.Physics.interCollisionSettingsToggle = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_clothGravity(IntPtr L) + { + try + { + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Physics.clothGravity = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_PhysicsWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_PhysicsWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..3752d19751fe0081da836e4da0039bbdca0f3a74 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_PhysicsWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6206bc8490d467442b7f2be9dbac314d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_PlayModeWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_PlayModeWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..cb00cdbcdfbd94a9c5ab27cab15ac1d00a4bf165 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_PlayModeWrap.cs @@ -0,0 +1,51 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_PlayModeWrap +{ + public static void Register(LuaState L) + { + L.BeginEnum(typeof(UnityEngine.PlayMode)); + L.RegVar("StopSameLayer", get_StopSameLayer, null); + L.RegVar("StopAll", get_StopAll, null); + L.RegFunction("IntToEnum", IntToEnum); + L.EndEnum(); + TypeTraits.Check = CheckType; + StackTraits.Push = Push; + } + + static void Push(IntPtr L, UnityEngine.PlayMode arg) + { + ToLua.Push(L, arg); + } + + static bool CheckType(IntPtr L, int pos) + { + return TypeChecker.CheckEnumType(typeof(UnityEngine.PlayMode), L, pos); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_StopSameLayer(IntPtr L) + { + ToLua.Push(L, UnityEngine.PlayMode.StopSameLayer); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_StopAll(IntPtr L) + { + ToLua.Push(L, UnityEngine.PlayMode.StopAll); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IntToEnum(IntPtr L) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + UnityEngine.PlayMode o = (UnityEngine.PlayMode)arg0; + ToLua.Push(L, o); + return 1; + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_PlayModeWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_PlayModeWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..5b7edbe8f7e6005b95092959a58fbefaf820af14 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_PlayModeWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0b2db9835c0e7fa42be7e55cd1717c68 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_PlayerPrefsWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_PlayerPrefsWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..21fcb5075942869be9687f61dbfb14545a282470 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_PlayerPrefsWrap.cs @@ -0,0 +1,262 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_PlayerPrefsWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.PlayerPrefs), typeof(System.Object)); + L.RegFunction("SetInt", SetInt); + L.RegFunction("GetInt", GetInt); + L.RegFunction("SetFloat", SetFloat); + L.RegFunction("GetFloat", GetFloat); + L.RegFunction("SetString", SetString); + L.RegFunction("GetString", GetString); + L.RegFunction("HasKey", HasKey); + L.RegFunction("DeleteKey", DeleteKey); + L.RegFunction("DeleteAll", DeleteAll); + L.RegFunction("Save", Save); + L.RegFunction("New", _CreateUnityEngine_PlayerPrefs); + L.RegFunction("__tostring", ToLua.op_ToString); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateUnityEngine_PlayerPrefs(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + UnityEngine.PlayerPrefs obj = new UnityEngine.PlayerPrefs(); + ToLua.PushObject(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.PlayerPrefs.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetInt(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + string arg0 = ToLua.CheckString(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.PlayerPrefs.SetInt(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetInt(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + string arg0 = ToLua.CheckString(L, 1); + int o = UnityEngine.PlayerPrefs.GetInt(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 2) + { + string arg0 = ToLua.CheckString(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + int o = UnityEngine.PlayerPrefs.GetInt(arg0, arg1); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.PlayerPrefs.GetInt"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetFloat(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + string arg0 = ToLua.CheckString(L, 1); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.PlayerPrefs.SetFloat(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetFloat(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + string arg0 = ToLua.CheckString(L, 1); + float o = UnityEngine.PlayerPrefs.GetFloat(arg0); + LuaDLL.lua_pushnumber(L, o); + return 1; + } + else if (count == 2) + { + string arg0 = ToLua.CheckString(L, 1); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 2); + float o = UnityEngine.PlayerPrefs.GetFloat(arg0, arg1); + LuaDLL.lua_pushnumber(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.PlayerPrefs.GetFloat"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetString(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + string arg0 = ToLua.CheckString(L, 1); + string arg1 = ToLua.CheckString(L, 2); + UnityEngine.PlayerPrefs.SetString(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetString(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + string arg0 = ToLua.CheckString(L, 1); + string o = UnityEngine.PlayerPrefs.GetString(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else if (count == 2) + { + string arg0 = ToLua.CheckString(L, 1); + string arg1 = ToLua.CheckString(L, 2); + string o = UnityEngine.PlayerPrefs.GetString(arg0, arg1); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.PlayerPrefs.GetString"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int HasKey(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + bool o = UnityEngine.PlayerPrefs.HasKey(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int DeleteKey(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + UnityEngine.PlayerPrefs.DeleteKey(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int DeleteAll(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 0); + UnityEngine.PlayerPrefs.DeleteAll(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Save(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 0); + UnityEngine.PlayerPrefs.Save(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_PlayerPrefsWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_PlayerPrefsWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..27391240838dedd536a22171116c16f39885eb7e --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_PlayerPrefsWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 931a74361936fee488a6c6e3e0dc71ca +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_QueueModeWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_QueueModeWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..e831d93ab193fcd392b0456d4c17f5bd62ade3c1 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_QueueModeWrap.cs @@ -0,0 +1,51 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_QueueModeWrap +{ + public static void Register(LuaState L) + { + L.BeginEnum(typeof(UnityEngine.QueueMode)); + L.RegVar("CompleteOthers", get_CompleteOthers, null); + L.RegVar("PlayNow", get_PlayNow, null); + L.RegFunction("IntToEnum", IntToEnum); + L.EndEnum(); + TypeTraits.Check = CheckType; + StackTraits.Push = Push; + } + + static void Push(IntPtr L, UnityEngine.QueueMode arg) + { + ToLua.Push(L, arg); + } + + static bool CheckType(IntPtr L, int pos) + { + return TypeChecker.CheckEnumType(typeof(UnityEngine.QueueMode), L, pos); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_CompleteOthers(IntPtr L) + { + ToLua.Push(L, UnityEngine.QueueMode.CompleteOthers); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_PlayNow(IntPtr L) + { + ToLua.Push(L, UnityEngine.QueueMode.PlayNow); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IntToEnum(IntPtr L) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + UnityEngine.QueueMode o = (UnityEngine.QueueMode)arg0; + ToLua.Push(L, o); + return 1; + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_QueueModeWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_QueueModeWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..fca23c6b0bfc5170b7f3c6f1206a00881197e552 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_QueueModeWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 77be481170b00744f83f0e8d4995e4ab +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_RectTransformWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_RectTransformWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..2fafa6c17742ecc3c39c26dd1243323e921e0321 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_RectTransformWrap.cs @@ -0,0 +1,605 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_RectTransformWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.RectTransform), typeof(UnityEngine.Transform)); + L.RegFunction("ForceUpdateRectTransforms", ForceUpdateRectTransforms); + L.RegFunction("GetLocalCorners", GetLocalCorners); + L.RegFunction("GetWorldCorners", GetWorldCorners); + L.RegFunction("SetInsetAndSizeFromParentEdge", SetInsetAndSizeFromParentEdge); + L.RegFunction("SetSizeWithCurrentAnchors", SetSizeWithCurrentAnchors); + L.RegFunction("New", _CreateUnityEngine_RectTransform); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("rect", get_rect, null); + L.RegVar("anchorMin", get_anchorMin, set_anchorMin); + L.RegVar("anchorMax", get_anchorMax, set_anchorMax); + L.RegVar("anchoredPosition", get_anchoredPosition, set_anchoredPosition); + L.RegVar("sizeDelta", get_sizeDelta, set_sizeDelta); + L.RegVar("pivot", get_pivot, set_pivot); + L.RegVar("anchoredPosition3D", get_anchoredPosition3D, set_anchoredPosition3D); + L.RegVar("offsetMin", get_offsetMin, set_offsetMin); + L.RegVar("offsetMax", get_offsetMax, set_offsetMax); + L.RegVar("drivenByObject", get_drivenByObject, null); + L.RegVar("reapplyDrivenProperties", get_reapplyDrivenProperties, set_reapplyDrivenProperties); + L.RegFunction("ReapplyDrivenProperties", UnityEngine_RectTransform_ReapplyDrivenProperties); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateUnityEngine_RectTransform(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + UnityEngine.RectTransform obj = new UnityEngine.RectTransform(); + ToLua.PushSealed(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.RectTransform.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ForceUpdateRectTransforms(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.RectTransform obj = (UnityEngine.RectTransform)ToLua.CheckObject(L, 1, typeof(UnityEngine.RectTransform)); + obj.ForceUpdateRectTransforms(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetLocalCorners(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.RectTransform obj = (UnityEngine.RectTransform)ToLua.CheckObject(L, 1, typeof(UnityEngine.RectTransform)); + UnityEngine.Vector3[] arg0 = new UnityEngine.Vector3[4]; + obj.GetLocalCorners(arg0); + ToLua.Push(L, arg0); + return 1; + } + else if (count == 2) + { + UnityEngine.RectTransform obj = (UnityEngine.RectTransform)ToLua.CheckObject(L, 1, typeof(UnityEngine.RectTransform)); + UnityEngine.Vector3[] arg0 = ToLua.CheckStructArray(L, 2); + obj.GetLocalCorners(arg0); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.RectTransform.GetLocalCorners"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetWorldCorners(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.RectTransform obj = (UnityEngine.RectTransform)ToLua.CheckObject(L, 1, typeof(UnityEngine.RectTransform)); + UnityEngine.Vector3[] arg0 = new UnityEngine.Vector3[4]; + obj.GetWorldCorners(arg0); + ToLua.Push(L, arg0); + return 1; + } + else if (count == 2) + { + UnityEngine.RectTransform obj = (UnityEngine.RectTransform)ToLua.CheckObject(L, 1, typeof(UnityEngine.RectTransform)); + UnityEngine.Vector3[] arg0 = ToLua.CheckStructArray(L, 2); + obj.GetWorldCorners(arg0); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.RectTransform.GetWorldCorners"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetInsetAndSizeFromParentEdge(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 4); + UnityEngine.RectTransform obj = (UnityEngine.RectTransform)ToLua.CheckObject(L, 1, typeof(UnityEngine.RectTransform)); + UnityEngine.RectTransform.Edge arg0 = (UnityEngine.RectTransform.Edge)ToLua.CheckObject(L, 2, typeof(UnityEngine.RectTransform.Edge)); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + obj.SetInsetAndSizeFromParentEdge(arg0, arg1, arg2); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetSizeWithCurrentAnchors(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.RectTransform obj = (UnityEngine.RectTransform)ToLua.CheckObject(L, 1, typeof(UnityEngine.RectTransform)); + UnityEngine.RectTransform.Axis arg0 = (UnityEngine.RectTransform.Axis)ToLua.CheckObject(L, 2, typeof(UnityEngine.RectTransform.Axis)); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + obj.SetSizeWithCurrentAnchors(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_rect(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RectTransform obj = (UnityEngine.RectTransform)o; + UnityEngine.Rect ret = obj.rect; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index rect on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_anchorMin(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RectTransform obj = (UnityEngine.RectTransform)o; + UnityEngine.Vector2 ret = obj.anchorMin; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index anchorMin on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_anchorMax(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RectTransform obj = (UnityEngine.RectTransform)o; + UnityEngine.Vector2 ret = obj.anchorMax; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index anchorMax on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_anchoredPosition(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RectTransform obj = (UnityEngine.RectTransform)o; + UnityEngine.Vector2 ret = obj.anchoredPosition; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index anchoredPosition on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_sizeDelta(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RectTransform obj = (UnityEngine.RectTransform)o; + UnityEngine.Vector2 ret = obj.sizeDelta; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index sizeDelta on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_pivot(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RectTransform obj = (UnityEngine.RectTransform)o; + UnityEngine.Vector2 ret = obj.pivot; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index pivot on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_anchoredPosition3D(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RectTransform obj = (UnityEngine.RectTransform)o; + UnityEngine.Vector3 ret = obj.anchoredPosition3D; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index anchoredPosition3D on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_offsetMin(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RectTransform obj = (UnityEngine.RectTransform)o; + UnityEngine.Vector2 ret = obj.offsetMin; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index offsetMin on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_offsetMax(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RectTransform obj = (UnityEngine.RectTransform)o; + UnityEngine.Vector2 ret = obj.offsetMax; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index offsetMax on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_drivenByObject(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RectTransform obj = (UnityEngine.RectTransform)o; + UnityEngine.Object ret = obj.drivenByObject; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index drivenByObject on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_reapplyDrivenProperties(IntPtr L) + { + ToLua.Push(L, new EventObject(typeof(UnityEngine.RectTransform.ReapplyDrivenProperties))); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_anchorMin(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RectTransform obj = (UnityEngine.RectTransform)o; + UnityEngine.Vector2 arg0 = ToLua.ToVector2(L, 2); + obj.anchorMin = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index anchorMin on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_anchorMax(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RectTransform obj = (UnityEngine.RectTransform)o; + UnityEngine.Vector2 arg0 = ToLua.ToVector2(L, 2); + obj.anchorMax = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index anchorMax on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_anchoredPosition(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RectTransform obj = (UnityEngine.RectTransform)o; + UnityEngine.Vector2 arg0 = ToLua.ToVector2(L, 2); + obj.anchoredPosition = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index anchoredPosition on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_sizeDelta(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RectTransform obj = (UnityEngine.RectTransform)o; + UnityEngine.Vector2 arg0 = ToLua.ToVector2(L, 2); + obj.sizeDelta = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index sizeDelta on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_pivot(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RectTransform obj = (UnityEngine.RectTransform)o; + UnityEngine.Vector2 arg0 = ToLua.ToVector2(L, 2); + obj.pivot = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index pivot on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_anchoredPosition3D(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RectTransform obj = (UnityEngine.RectTransform)o; + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + obj.anchoredPosition3D = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index anchoredPosition3D on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_offsetMin(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RectTransform obj = (UnityEngine.RectTransform)o; + UnityEngine.Vector2 arg0 = ToLua.ToVector2(L, 2); + obj.offsetMin = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index offsetMin on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_offsetMax(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RectTransform obj = (UnityEngine.RectTransform)o; + UnityEngine.Vector2 arg0 = ToLua.ToVector2(L, 2); + obj.offsetMax = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index offsetMax on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_reapplyDrivenProperties(IntPtr L) + { + try + { + EventObject arg0 = null; + + if (LuaDLL.lua_isuserdata(L, 2) != 0) + { + arg0 = (EventObject)ToLua.ToObject(L, 2); + } + else + { + return LuaDLL.luaL_throw(L, "The event 'UnityEngine.RectTransform.reapplyDrivenProperties' can only appear on the left hand side of += or -= when used outside of the type 'UnityEngine.RectTransform'"); + } + + if (arg0.op == EventOp.Add) + { + UnityEngine.RectTransform.ReapplyDrivenProperties ev = (UnityEngine.RectTransform.ReapplyDrivenProperties)arg0.func; + UnityEngine.RectTransform.reapplyDrivenProperties += ev; + } + else if (arg0.op == EventOp.Sub) + { + UnityEngine.RectTransform.ReapplyDrivenProperties ev = (UnityEngine.RectTransform.ReapplyDrivenProperties)arg0.func; + UnityEngine.RectTransform.reapplyDrivenProperties -= ev; + } + + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int UnityEngine_RectTransform_ReapplyDrivenProperties(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + LuaFunction func = ToLua.CheckLuaFunction(L, 1); + + if (count == 1) + { + Delegate arg1 = DelegateTraits.Create(func); + ToLua.Push(L, arg1); + } + else + { + LuaTable self = ToLua.CheckLuaTable(L, 2); + Delegate arg1 = DelegateTraits.Create(func, self); + ToLua.Push(L, arg1); + } + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_RectTransformWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_RectTransformWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..871c53dd0077189cacb7ea7506700bc6a3be1bd9 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_RectTransformWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c5eb2d77767cd2b44bec4faecb2e0bd0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_RenderSettingsWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_RenderSettingsWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..5fed5e44ca97ac737313df84ff8032b225df266f --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_RenderSettingsWrap.cs @@ -0,0 +1,752 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_RenderSettingsWrap +{ + public static void Register(LuaState L) + { + L.BeginStaticLibs("RenderSettings"); + L.RegFunction("__eq", op_Equality); + L.RegVar("fog", get_fog, set_fog); + L.RegVar("fogStartDistance", get_fogStartDistance, set_fogStartDistance); + L.RegVar("fogEndDistance", get_fogEndDistance, set_fogEndDistance); + L.RegVar("fogMode", get_fogMode, set_fogMode); + L.RegVar("fogColor", get_fogColor, set_fogColor); + L.RegVar("fogDensity", get_fogDensity, set_fogDensity); + L.RegVar("ambientMode", get_ambientMode, set_ambientMode); + L.RegVar("ambientSkyColor", get_ambientSkyColor, set_ambientSkyColor); + L.RegVar("ambientEquatorColor", get_ambientEquatorColor, set_ambientEquatorColor); + L.RegVar("ambientGroundColor", get_ambientGroundColor, set_ambientGroundColor); + L.RegVar("ambientIntensity", get_ambientIntensity, set_ambientIntensity); + L.RegVar("ambientLight", get_ambientLight, set_ambientLight); + L.RegVar("subtractiveShadowColor", get_subtractiveShadowColor, set_subtractiveShadowColor); + L.RegVar("skybox", get_skybox, set_skybox); + L.RegVar("sun", get_sun, set_sun); + L.RegVar("ambientProbe", get_ambientProbe, set_ambientProbe); + L.RegVar("customReflection", get_customReflection, set_customReflection); + L.RegVar("reflectionIntensity", get_reflectionIntensity, set_reflectionIntensity); + L.RegVar("reflectionBounces", get_reflectionBounces, set_reflectionBounces); + L.RegVar("defaultReflectionMode", get_defaultReflectionMode, set_defaultReflectionMode); + L.RegVar("defaultReflectionResolution", get_defaultReflectionResolution, set_defaultReflectionResolution); + L.RegVar("haloStrength", get_haloStrength, set_haloStrength); + L.RegVar("flareStrength", get_flareStrength, set_flareStrength); + L.RegVar("flareFadeSpeed", get_flareFadeSpeed, set_flareFadeSpeed); + L.EndStaticLibs(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_fog(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.RenderSettings.fog); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_fogStartDistance(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.RenderSettings.fogStartDistance); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_fogEndDistance(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.RenderSettings.fogEndDistance); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_fogMode(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.RenderSettings.fogMode); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_fogColor(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.RenderSettings.fogColor); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_fogDensity(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.RenderSettings.fogDensity); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_ambientMode(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.RenderSettings.ambientMode); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_ambientSkyColor(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.RenderSettings.ambientSkyColor); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_ambientEquatorColor(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.RenderSettings.ambientEquatorColor); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_ambientGroundColor(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.RenderSettings.ambientGroundColor); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_ambientIntensity(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.RenderSettings.ambientIntensity); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_ambientLight(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.RenderSettings.ambientLight); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_subtractiveShadowColor(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.RenderSettings.subtractiveShadowColor); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_skybox(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.RenderSettings.skybox); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_sun(IntPtr L) + { + try + { + ToLua.PushSealed(L, UnityEngine.RenderSettings.sun); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_ambientProbe(IntPtr L) + { + try + { + ToLua.PushValue(L, UnityEngine.RenderSettings.ambientProbe); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_customReflection(IntPtr L) + { + try + { + ToLua.PushSealed(L, UnityEngine.RenderSettings.customReflection); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_reflectionIntensity(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.RenderSettings.reflectionIntensity); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_reflectionBounces(IntPtr L) + { + try + { + LuaDLL.lua_pushinteger(L, UnityEngine.RenderSettings.reflectionBounces); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_defaultReflectionMode(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.RenderSettings.defaultReflectionMode); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_defaultReflectionResolution(IntPtr L) + { + try + { + LuaDLL.lua_pushinteger(L, UnityEngine.RenderSettings.defaultReflectionResolution); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_haloStrength(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.RenderSettings.haloStrength); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_flareStrength(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.RenderSettings.flareStrength); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_flareFadeSpeed(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.RenderSettings.flareFadeSpeed); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_fog(IntPtr L) + { + try + { + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + UnityEngine.RenderSettings.fog = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_fogStartDistance(IntPtr L) + { + try + { + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.RenderSettings.fogStartDistance = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_fogEndDistance(IntPtr L) + { + try + { + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.RenderSettings.fogEndDistance = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_fogMode(IntPtr L) + { + try + { + UnityEngine.FogMode arg0 = (UnityEngine.FogMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.FogMode)); + UnityEngine.RenderSettings.fogMode = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_fogColor(IntPtr L) + { + try + { + UnityEngine.Color arg0 = ToLua.ToColor(L, 2); + UnityEngine.RenderSettings.fogColor = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_fogDensity(IntPtr L) + { + try + { + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.RenderSettings.fogDensity = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_ambientMode(IntPtr L) + { + try + { + UnityEngine.Rendering.AmbientMode arg0 = (UnityEngine.Rendering.AmbientMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.Rendering.AmbientMode)); + UnityEngine.RenderSettings.ambientMode = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_ambientSkyColor(IntPtr L) + { + try + { + UnityEngine.Color arg0 = ToLua.ToColor(L, 2); + UnityEngine.RenderSettings.ambientSkyColor = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_ambientEquatorColor(IntPtr L) + { + try + { + UnityEngine.Color arg0 = ToLua.ToColor(L, 2); + UnityEngine.RenderSettings.ambientEquatorColor = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_ambientGroundColor(IntPtr L) + { + try + { + UnityEngine.Color arg0 = ToLua.ToColor(L, 2); + UnityEngine.RenderSettings.ambientGroundColor = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_ambientIntensity(IntPtr L) + { + try + { + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.RenderSettings.ambientIntensity = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_ambientLight(IntPtr L) + { + try + { + UnityEngine.Color arg0 = ToLua.ToColor(L, 2); + UnityEngine.RenderSettings.ambientLight = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_subtractiveShadowColor(IntPtr L) + { + try + { + UnityEngine.Color arg0 = ToLua.ToColor(L, 2); + UnityEngine.RenderSettings.subtractiveShadowColor = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_skybox(IntPtr L) + { + try + { + UnityEngine.Material arg0 = (UnityEngine.Material)ToLua.CheckObject(L, 2); + UnityEngine.RenderSettings.skybox = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_sun(IntPtr L) + { + try + { + UnityEngine.Light arg0 = (UnityEngine.Light)ToLua.CheckObject(L, 2, typeof(UnityEngine.Light)); + UnityEngine.RenderSettings.sun = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_ambientProbe(IntPtr L) + { + try + { + UnityEngine.Rendering.SphericalHarmonicsL2 arg0 = StackTraits.Check(L, 2); + UnityEngine.RenderSettings.ambientProbe = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_customReflection(IntPtr L) + { + try + { + UnityEngine.Cubemap arg0 = (UnityEngine.Cubemap)ToLua.CheckObject(L, 2, typeof(UnityEngine.Cubemap)); + UnityEngine.RenderSettings.customReflection = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_reflectionIntensity(IntPtr L) + { + try + { + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.RenderSettings.reflectionIntensity = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_reflectionBounces(IntPtr L) + { + try + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.RenderSettings.reflectionBounces = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_defaultReflectionMode(IntPtr L) + { + try + { + UnityEngine.Rendering.DefaultReflectionMode arg0 = (UnityEngine.Rendering.DefaultReflectionMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.Rendering.DefaultReflectionMode)); + UnityEngine.RenderSettings.defaultReflectionMode = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_defaultReflectionResolution(IntPtr L) + { + try + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.RenderSettings.defaultReflectionResolution = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_haloStrength(IntPtr L) + { + try + { + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.RenderSettings.haloStrength = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_flareStrength(IntPtr L) + { + try + { + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.RenderSettings.flareStrength = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_flareFadeSpeed(IntPtr L) + { + try + { + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.RenderSettings.flareFadeSpeed = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_RenderSettingsWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_RenderSettingsWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..7ccd2aad7a4b1702ab215633e825434e89a84acb --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_RenderSettingsWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 50d8ce567d3623d4eb8de63faf537d08 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_RenderTextureWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_RenderTextureWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..04ab83061d75677a5d897ab47e86afa23a25eeb4 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_RenderTextureWrap.cs @@ -0,0 +1,1348 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_RenderTextureWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.RenderTexture), typeof(UnityEngine.Texture)); + L.RegFunction("GetNativeDepthBufferPtr", GetNativeDepthBufferPtr); + L.RegFunction("DiscardContents", DiscardContents); + L.RegFunction("ResolveAntiAliasedSurface", ResolveAntiAliasedSurface); + L.RegFunction("SetGlobalShaderProperty", SetGlobalShaderProperty); + L.RegFunction("Create", Create); + L.RegFunction("Release", Release); + L.RegFunction("IsCreated", IsCreated); + L.RegFunction("GenerateMips", GenerateMips); + L.RegFunction("ConvertToEquirect", ConvertToEquirect); + L.RegFunction("SupportsStencil", SupportsStencil); + L.RegFunction("ReleaseTemporary", ReleaseTemporary); + L.RegFunction("GetTemporary", GetTemporary); + L.RegFunction("New", _CreateUnityEngine_RenderTexture); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("width", get_width, set_width); + L.RegVar("height", get_height, set_height); + L.RegVar("dimension", get_dimension, set_dimension); + L.RegVar("graphicsFormat", get_graphicsFormat, set_graphicsFormat); + L.RegVar("useMipMap", get_useMipMap, set_useMipMap); + L.RegVar("sRGB", get_sRGB, null); + L.RegVar("vrUsage", get_vrUsage, set_vrUsage); + L.RegVar("memorylessMode", get_memorylessMode, set_memorylessMode); + L.RegVar("format", get_format, set_format); + L.RegVar("stencilFormat", get_stencilFormat, set_stencilFormat); + L.RegVar("autoGenerateMips", get_autoGenerateMips, set_autoGenerateMips); + L.RegVar("volumeDepth", get_volumeDepth, set_volumeDepth); + L.RegVar("antiAliasing", get_antiAliasing, set_antiAliasing); + L.RegVar("bindTextureMS", get_bindTextureMS, set_bindTextureMS); + L.RegVar("enableRandomWrite", get_enableRandomWrite, set_enableRandomWrite); + L.RegVar("useDynamicScale", get_useDynamicScale, set_useDynamicScale); + L.RegVar("isPowerOfTwo", get_isPowerOfTwo, set_isPowerOfTwo); + L.RegVar("active", get_active, set_active); + L.RegVar("colorBuffer", get_colorBuffer, null); + L.RegVar("depthBuffer", get_depthBuffer, null); + L.RegVar("depth", get_depth, set_depth); + L.RegVar("descriptor", get_descriptor, set_descriptor); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateUnityEngine_RenderTexture(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.RenderTextureDescriptor arg0 = StackTraits.To(L, 1); + UnityEngine.RenderTexture obj = new UnityEngine.RenderTexture(arg0); + ToLua.Push(L, obj); + return 1; + } + else if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + UnityEngine.RenderTexture arg0 = (UnityEngine.RenderTexture)ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = new UnityEngine.RenderTexture(arg0); + ToLua.Push(L, obj); + return 1; + } + else if (count == 3) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.RenderTexture obj = new UnityEngine.RenderTexture(arg0, arg1, arg2); + ToLua.Push(L, obj); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 4)) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Experimental.Rendering.DefaultFormat arg3 = (UnityEngine.Experimental.Rendering.DefaultFormat)ToLua.ToObject(L, 4); + UnityEngine.RenderTexture obj = new UnityEngine.RenderTexture(arg0, arg1, arg2, arg3); + ToLua.Push(L, obj); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 4)) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Experimental.Rendering.GraphicsFormat arg3 = (UnityEngine.Experimental.Rendering.GraphicsFormat)ToLua.ToObject(L, 4); + UnityEngine.RenderTexture obj = new UnityEngine.RenderTexture(arg0, arg1, arg2, arg3); + ToLua.Push(L, obj); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 4)) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.RenderTextureFormat arg3 = (UnityEngine.RenderTextureFormat)ToLua.ToObject(L, 4); + UnityEngine.RenderTexture obj = new UnityEngine.RenderTexture(arg0, arg1, arg2, arg3); + ToLua.Push(L, obj); + return 1; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 4)) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Experimental.Rendering.GraphicsFormat arg3 = (UnityEngine.Experimental.Rendering.GraphicsFormat)ToLua.ToObject(L, 4); + int arg4 = (int)LuaDLL.lua_tonumber(L, 5); + UnityEngine.RenderTexture obj = new UnityEngine.RenderTexture(arg0, arg1, arg2, arg3, arg4); + ToLua.Push(L, obj); + return 1; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 4)) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.RenderTextureFormat arg3 = (UnityEngine.RenderTextureFormat)ToLua.ToObject(L, 4); + UnityEngine.RenderTextureReadWrite arg4 = (UnityEngine.RenderTextureReadWrite)ToLua.ToObject(L, 5); + UnityEngine.RenderTexture obj = new UnityEngine.RenderTexture(arg0, arg1, arg2, arg3, arg4); + ToLua.Push(L, obj); + return 1; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 4)) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.RenderTextureFormat arg3 = (UnityEngine.RenderTextureFormat)ToLua.ToObject(L, 4); + int arg4 = (int)LuaDLL.lua_tonumber(L, 5); + UnityEngine.RenderTexture obj = new UnityEngine.RenderTexture(arg0, arg1, arg2, arg3, arg4); + ToLua.Push(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.RenderTexture.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetNativeDepthBufferPtr(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)ToLua.CheckObject(L, 1); + System.IntPtr o = obj.GetNativeDepthBufferPtr(); + LuaDLL.lua_pushlightuserdata(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int DiscardContents(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)ToLua.CheckObject(L, 1); + obj.DiscardContents(); + return 0; + } + else if (count == 3) + { + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)ToLua.CheckObject(L, 1); + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + bool arg1 = LuaDLL.luaL_checkboolean(L, 3); + obj.DiscardContents(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.RenderTexture.DiscardContents"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ResolveAntiAliasedSurface(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)ToLua.CheckObject(L, 1); + obj.ResolveAntiAliasedSurface(); + return 0; + } + else if (count == 2) + { + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)ToLua.CheckObject(L, 1); + UnityEngine.RenderTexture arg0 = (UnityEngine.RenderTexture)ToLua.CheckObject(L, 2); + obj.ResolveAntiAliasedSurface(arg0); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.RenderTexture.ResolveAntiAliasedSurface"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetGlobalShaderProperty(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + obj.SetGlobalShaderProperty(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Create(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)ToLua.CheckObject(L, 1); + bool o = obj.Create(); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Release(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)ToLua.CheckObject(L, 1); + obj.Release(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IsCreated(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)ToLua.CheckObject(L, 1); + bool o = obj.IsCreated(); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GenerateMips(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)ToLua.CheckObject(L, 1); + obj.GenerateMips(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ConvertToEquirect(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)ToLua.CheckObject(L, 1); + UnityEngine.RenderTexture arg0 = (UnityEngine.RenderTexture)ToLua.CheckObject(L, 2); + obj.ConvertToEquirect(arg0); + return 0; + } + else if (count == 3) + { + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)ToLua.CheckObject(L, 1); + UnityEngine.RenderTexture arg0 = (UnityEngine.RenderTexture)ToLua.CheckObject(L, 2); + UnityEngine.Camera.MonoOrStereoscopicEye arg1 = (UnityEngine.Camera.MonoOrStereoscopicEye)ToLua.CheckObject(L, 3, typeof(UnityEngine.Camera.MonoOrStereoscopicEye)); + obj.ConvertToEquirect(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.RenderTexture.ConvertToEquirect"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SupportsStencil(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.RenderTexture arg0 = (UnityEngine.RenderTexture)ToLua.CheckObject(L, 1); + bool o = UnityEngine.RenderTexture.SupportsStencil(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ReleaseTemporary(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.RenderTexture arg0 = (UnityEngine.RenderTexture)ToLua.CheckObject(L, 1); + UnityEngine.RenderTexture.ReleaseTemporary(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetTemporary(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.RenderTextureDescriptor arg0 = StackTraits.Check(L, 1); + UnityEngine.RenderTexture o = UnityEngine.RenderTexture.GetTemporary(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 2) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.RenderTexture o = UnityEngine.RenderTexture.GetTemporary(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else if (count == 3) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.RenderTexture o = UnityEngine.RenderTexture.GetTemporary(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 4)) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Experimental.Rendering.GraphicsFormat arg3 = (UnityEngine.Experimental.Rendering.GraphicsFormat)ToLua.ToObject(L, 4); + UnityEngine.RenderTexture o = UnityEngine.RenderTexture.GetTemporary(arg0, arg1, arg2, arg3); + ToLua.Push(L, o); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 4)) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.RenderTextureFormat arg3 = (UnityEngine.RenderTextureFormat)ToLua.ToObject(L, 4); + UnityEngine.RenderTexture o = UnityEngine.RenderTexture.GetTemporary(arg0, arg1, arg2, arg3); + ToLua.Push(L, o); + return 1; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 4)) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Experimental.Rendering.GraphicsFormat arg3 = (UnityEngine.Experimental.Rendering.GraphicsFormat)ToLua.ToObject(L, 4); + int arg4 = (int)LuaDLL.lua_tonumber(L, 5); + UnityEngine.RenderTexture o = UnityEngine.RenderTexture.GetTemporary(arg0, arg1, arg2, arg3, arg4); + ToLua.Push(L, o); + return 1; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 4)) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.RenderTextureFormat arg3 = (UnityEngine.RenderTextureFormat)ToLua.ToObject(L, 4); + UnityEngine.RenderTextureReadWrite arg4 = (UnityEngine.RenderTextureReadWrite)ToLua.ToObject(L, 5); + UnityEngine.RenderTexture o = UnityEngine.RenderTexture.GetTemporary(arg0, arg1, arg2, arg3, arg4); + ToLua.Push(L, o); + return 1; + } + else if (count == 6 && TypeChecker.CheckTypes(L, 4)) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Experimental.Rendering.GraphicsFormat arg3 = (UnityEngine.Experimental.Rendering.GraphicsFormat)ToLua.ToObject(L, 4); + int arg4 = (int)LuaDLL.lua_tonumber(L, 5); + UnityEngine.RenderTextureMemoryless arg5 = (UnityEngine.RenderTextureMemoryless)ToLua.ToObject(L, 6); + UnityEngine.RenderTexture o = UnityEngine.RenderTexture.GetTemporary(arg0, arg1, arg2, arg3, arg4, arg5); + ToLua.Push(L, o); + return 1; + } + else if (count == 6 && TypeChecker.CheckTypes(L, 4)) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.RenderTextureFormat arg3 = (UnityEngine.RenderTextureFormat)ToLua.ToObject(L, 4); + UnityEngine.RenderTextureReadWrite arg4 = (UnityEngine.RenderTextureReadWrite)ToLua.ToObject(L, 5); + int arg5 = (int)LuaDLL.lua_tonumber(L, 6); + UnityEngine.RenderTexture o = UnityEngine.RenderTexture.GetTemporary(arg0, arg1, arg2, arg3, arg4, arg5); + ToLua.Push(L, o); + return 1; + } + else if (count == 7 && TypeChecker.CheckTypes(L, 4)) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Experimental.Rendering.GraphicsFormat arg3 = (UnityEngine.Experimental.Rendering.GraphicsFormat)ToLua.ToObject(L, 4); + int arg4 = (int)LuaDLL.lua_tonumber(L, 5); + UnityEngine.RenderTextureMemoryless arg5 = (UnityEngine.RenderTextureMemoryless)ToLua.ToObject(L, 6); + UnityEngine.VRTextureUsage arg6 = (UnityEngine.VRTextureUsage)ToLua.ToObject(L, 7); + UnityEngine.RenderTexture o = UnityEngine.RenderTexture.GetTemporary(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + ToLua.Push(L, o); + return 1; + } + else if (count == 7 && TypeChecker.CheckTypes(L, 4)) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.RenderTextureFormat arg3 = (UnityEngine.RenderTextureFormat)ToLua.ToObject(L, 4); + UnityEngine.RenderTextureReadWrite arg4 = (UnityEngine.RenderTextureReadWrite)ToLua.ToObject(L, 5); + int arg5 = (int)LuaDLL.lua_tonumber(L, 6); + UnityEngine.RenderTextureMemoryless arg6 = (UnityEngine.RenderTextureMemoryless)ToLua.ToObject(L, 7); + UnityEngine.RenderTexture o = UnityEngine.RenderTexture.GetTemporary(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + ToLua.Push(L, o); + return 1; + } + else if (count == 8 && TypeChecker.CheckTypes(L, 4)) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Experimental.Rendering.GraphicsFormat arg3 = (UnityEngine.Experimental.Rendering.GraphicsFormat)ToLua.ToObject(L, 4); + int arg4 = (int)LuaDLL.lua_tonumber(L, 5); + UnityEngine.RenderTextureMemoryless arg5 = (UnityEngine.RenderTextureMemoryless)ToLua.ToObject(L, 6); + UnityEngine.VRTextureUsage arg6 = (UnityEngine.VRTextureUsage)ToLua.ToObject(L, 7); + bool arg7 = LuaDLL.lua_toboolean(L, 8); + UnityEngine.RenderTexture o = UnityEngine.RenderTexture.GetTemporary(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); + ToLua.Push(L, o); + return 1; + } + else if (count == 8 && TypeChecker.CheckTypes(L, 4)) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.RenderTextureFormat arg3 = (UnityEngine.RenderTextureFormat)ToLua.ToObject(L, 4); + UnityEngine.RenderTextureReadWrite arg4 = (UnityEngine.RenderTextureReadWrite)ToLua.ToObject(L, 5); + int arg5 = (int)LuaDLL.lua_tonumber(L, 6); + UnityEngine.RenderTextureMemoryless arg6 = (UnityEngine.RenderTextureMemoryless)ToLua.ToObject(L, 7); + UnityEngine.VRTextureUsage arg7 = (UnityEngine.VRTextureUsage)ToLua.ToObject(L, 8); + UnityEngine.RenderTexture o = UnityEngine.RenderTexture.GetTemporary(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); + ToLua.Push(L, o); + return 1; + } + else if (count == 9) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.RenderTextureFormat arg3 = (UnityEngine.RenderTextureFormat)ToLua.CheckObject(L, 4, typeof(UnityEngine.RenderTextureFormat)); + UnityEngine.RenderTextureReadWrite arg4 = (UnityEngine.RenderTextureReadWrite)ToLua.CheckObject(L, 5, typeof(UnityEngine.RenderTextureReadWrite)); + int arg5 = (int)LuaDLL.luaL_checknumber(L, 6); + UnityEngine.RenderTextureMemoryless arg6 = (UnityEngine.RenderTextureMemoryless)ToLua.CheckObject(L, 7, typeof(UnityEngine.RenderTextureMemoryless)); + UnityEngine.VRTextureUsage arg7 = (UnityEngine.VRTextureUsage)ToLua.CheckObject(L, 8, typeof(UnityEngine.VRTextureUsage)); + bool arg8 = LuaDLL.luaL_checkboolean(L, 9); + UnityEngine.RenderTexture o = UnityEngine.RenderTexture.GetTemporary(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.RenderTexture.GetTemporary"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_width(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + int ret = obj.width; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index width on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_height(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + int ret = obj.height; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index height on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_dimension(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + UnityEngine.Rendering.TextureDimension ret = obj.dimension; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index dimension on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_graphicsFormat(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + UnityEngine.Experimental.Rendering.GraphicsFormat ret = obj.graphicsFormat; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index graphicsFormat on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_useMipMap(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + bool ret = obj.useMipMap; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index useMipMap on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_sRGB(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + bool ret = obj.sRGB; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index sRGB on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_vrUsage(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + UnityEngine.VRTextureUsage ret = obj.vrUsage; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index vrUsage on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_memorylessMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + UnityEngine.RenderTextureMemoryless ret = obj.memorylessMode; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index memorylessMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_format(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + UnityEngine.RenderTextureFormat ret = obj.format; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index format on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_stencilFormat(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + UnityEngine.Experimental.Rendering.GraphicsFormat ret = obj.stencilFormat; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index stencilFormat on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_autoGenerateMips(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + bool ret = obj.autoGenerateMips; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index autoGenerateMips on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_volumeDepth(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + int ret = obj.volumeDepth; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index volumeDepth on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_antiAliasing(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + int ret = obj.antiAliasing; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index antiAliasing on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_bindTextureMS(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + bool ret = obj.bindTextureMS; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index bindTextureMS on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_enableRandomWrite(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + bool ret = obj.enableRandomWrite; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index enableRandomWrite on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_useDynamicScale(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + bool ret = obj.useDynamicScale; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index useDynamicScale on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isPowerOfTwo(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + bool ret = obj.isPowerOfTwo; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isPowerOfTwo on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_active(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.RenderTexture.active); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_colorBuffer(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + UnityEngine.RenderBuffer ret = obj.colorBuffer; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index colorBuffer on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_depthBuffer(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + UnityEngine.RenderBuffer ret = obj.depthBuffer; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index depthBuffer on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_depth(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + int ret = obj.depth; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index depth on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_descriptor(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + UnityEngine.RenderTextureDescriptor ret = obj.descriptor; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index descriptor on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_width(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.width = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index width on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_height(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.height = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index height on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_dimension(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + UnityEngine.Rendering.TextureDimension arg0 = (UnityEngine.Rendering.TextureDimension)ToLua.CheckObject(L, 2, typeof(UnityEngine.Rendering.TextureDimension)); + obj.dimension = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index dimension on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_graphicsFormat(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + UnityEngine.Experimental.Rendering.GraphicsFormat arg0 = (UnityEngine.Experimental.Rendering.GraphicsFormat)ToLua.CheckObject(L, 2, typeof(UnityEngine.Experimental.Rendering.GraphicsFormat)); + obj.graphicsFormat = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index graphicsFormat on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_useMipMap(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.useMipMap = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index useMipMap on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_vrUsage(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + UnityEngine.VRTextureUsage arg0 = (UnityEngine.VRTextureUsage)ToLua.CheckObject(L, 2, typeof(UnityEngine.VRTextureUsage)); + obj.vrUsage = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index vrUsage on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_memorylessMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + UnityEngine.RenderTextureMemoryless arg0 = (UnityEngine.RenderTextureMemoryless)ToLua.CheckObject(L, 2, typeof(UnityEngine.RenderTextureMemoryless)); + obj.memorylessMode = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index memorylessMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_format(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + UnityEngine.RenderTextureFormat arg0 = (UnityEngine.RenderTextureFormat)ToLua.CheckObject(L, 2, typeof(UnityEngine.RenderTextureFormat)); + obj.format = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index format on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_stencilFormat(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + UnityEngine.Experimental.Rendering.GraphicsFormat arg0 = (UnityEngine.Experimental.Rendering.GraphicsFormat)ToLua.CheckObject(L, 2, typeof(UnityEngine.Experimental.Rendering.GraphicsFormat)); + obj.stencilFormat = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index stencilFormat on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_autoGenerateMips(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.autoGenerateMips = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index autoGenerateMips on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_volumeDepth(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.volumeDepth = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index volumeDepth on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_antiAliasing(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.antiAliasing = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index antiAliasing on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_bindTextureMS(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.bindTextureMS = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index bindTextureMS on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_enableRandomWrite(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.enableRandomWrite = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index enableRandomWrite on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_useDynamicScale(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.useDynamicScale = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index useDynamicScale on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_isPowerOfTwo(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.isPowerOfTwo = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isPowerOfTwo on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_active(IntPtr L) + { + try + { + UnityEngine.RenderTexture arg0 = (UnityEngine.RenderTexture)ToLua.CheckObject(L, 2); + UnityEngine.RenderTexture.active = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_depth(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.depth = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index depth on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_descriptor(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o; + UnityEngine.RenderTextureDescriptor arg0 = StackTraits.Check(L, 2); + obj.descriptor = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index descriptor on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_RenderTextureWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_RenderTextureWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..69e193bd509728093dbf1dfacc31d0481291453c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_RenderTextureWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 66856cee50e7bd94e8ca3e9c6214f749 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_RendererWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_RendererWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..ac0182af38b7cce3482a00cef01125379b640390 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_RendererWrap.cs @@ -0,0 +1,1273 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_RendererWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.Renderer), typeof(UnityEngine.Component)); + L.RegFunction("HasPropertyBlock", HasPropertyBlock); + L.RegFunction("SetPropertyBlock", SetPropertyBlock); + L.RegFunction("GetPropertyBlock", GetPropertyBlock); + L.RegFunction("GetMaterials", GetMaterials); + L.RegFunction("GetSharedMaterials", GetSharedMaterials); + L.RegFunction("GetClosestReflectionProbes", GetClosestReflectionProbes); + L.RegFunction("New", _CreateUnityEngine_Renderer); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("bounds", get_bounds, null); + L.RegVar("enabled", get_enabled, set_enabled); + L.RegVar("isVisible", get_isVisible, null); + L.RegVar("shadowCastingMode", get_shadowCastingMode, set_shadowCastingMode); + L.RegVar("receiveShadows", get_receiveShadows, set_receiveShadows); + L.RegVar("forceRenderingOff", get_forceRenderingOff, set_forceRenderingOff); + L.RegVar("staticShadowCaster", get_staticShadowCaster, set_staticShadowCaster); + L.RegVar("motionVectorGenerationMode", get_motionVectorGenerationMode, set_motionVectorGenerationMode); + L.RegVar("lightProbeUsage", get_lightProbeUsage, set_lightProbeUsage); + L.RegVar("reflectionProbeUsage", get_reflectionProbeUsage, set_reflectionProbeUsage); + L.RegVar("renderingLayerMask", get_renderingLayerMask, set_renderingLayerMask); + L.RegVar("rendererPriority", get_rendererPriority, set_rendererPriority); + L.RegVar("rayTracingMode", get_rayTracingMode, set_rayTracingMode); + L.RegVar("sortingLayerName", get_sortingLayerName, set_sortingLayerName); + L.RegVar("sortingLayerID", get_sortingLayerID, set_sortingLayerID); + L.RegVar("sortingOrder", get_sortingOrder, set_sortingOrder); + L.RegVar("allowOcclusionWhenDynamic", get_allowOcclusionWhenDynamic, set_allowOcclusionWhenDynamic); + L.RegVar("isPartOfStaticBatch", get_isPartOfStaticBatch, null); + L.RegVar("worldToLocalMatrix", get_worldToLocalMatrix, null); + L.RegVar("localToWorldMatrix", get_localToWorldMatrix, null); + L.RegVar("lightProbeProxyVolumeOverride", get_lightProbeProxyVolumeOverride, set_lightProbeProxyVolumeOverride); + L.RegVar("probeAnchor", get_probeAnchor, set_probeAnchor); + L.RegVar("lightmapIndex", get_lightmapIndex, set_lightmapIndex); + L.RegVar("realtimeLightmapIndex", get_realtimeLightmapIndex, set_realtimeLightmapIndex); + L.RegVar("lightmapScaleOffset", get_lightmapScaleOffset, set_lightmapScaleOffset); + L.RegVar("realtimeLightmapScaleOffset", get_realtimeLightmapScaleOffset, set_realtimeLightmapScaleOffset); + L.RegVar("materials", get_materials, set_materials); + L.RegVar("material", get_material, set_material); + L.RegVar("sharedMaterial", get_sharedMaterial, set_sharedMaterial); + L.RegVar("sharedMaterials", get_sharedMaterials, set_sharedMaterials); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateUnityEngine_Renderer(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + UnityEngine.Renderer obj = new UnityEngine.Renderer(); + ToLua.Push(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.Renderer.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int HasPropertyBlock(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)ToLua.CheckObject(L, 1); + bool o = obj.HasPropertyBlock(); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetPropertyBlock(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Renderer obj = (UnityEngine.Renderer)ToLua.CheckObject(L, 1); + UnityEngine.MaterialPropertyBlock arg0 = (UnityEngine.MaterialPropertyBlock)ToLua.CheckObject(L, 2, typeof(UnityEngine.MaterialPropertyBlock)); + obj.SetPropertyBlock(arg0); + return 0; + } + else if (count == 3) + { + UnityEngine.Renderer obj = (UnityEngine.Renderer)ToLua.CheckObject(L, 1); + UnityEngine.MaterialPropertyBlock arg0 = (UnityEngine.MaterialPropertyBlock)ToLua.CheckObject(L, 2, typeof(UnityEngine.MaterialPropertyBlock)); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + obj.SetPropertyBlock(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Renderer.SetPropertyBlock"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetPropertyBlock(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Renderer obj = (UnityEngine.Renderer)ToLua.CheckObject(L, 1); + UnityEngine.MaterialPropertyBlock arg0 = (UnityEngine.MaterialPropertyBlock)ToLua.CheckObject(L, 2, typeof(UnityEngine.MaterialPropertyBlock)); + obj.GetPropertyBlock(arg0); + return 0; + } + else if (count == 3) + { + UnityEngine.Renderer obj = (UnityEngine.Renderer)ToLua.CheckObject(L, 1); + UnityEngine.MaterialPropertyBlock arg0 = (UnityEngine.MaterialPropertyBlock)ToLua.CheckObject(L, 2, typeof(UnityEngine.MaterialPropertyBlock)); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + obj.GetPropertyBlock(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Renderer.GetPropertyBlock"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetMaterials(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Renderer obj = (UnityEngine.Renderer)ToLua.CheckObject(L, 1); + System.Collections.Generic.List arg0 = (System.Collections.Generic.List)ToLua.CheckObject(L, 2, typeof(System.Collections.Generic.List)); + obj.GetMaterials(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetSharedMaterials(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Renderer obj = (UnityEngine.Renderer)ToLua.CheckObject(L, 1); + System.Collections.Generic.List arg0 = (System.Collections.Generic.List)ToLua.CheckObject(L, 2, typeof(System.Collections.Generic.List)); + obj.GetSharedMaterials(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetClosestReflectionProbes(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Renderer obj = (UnityEngine.Renderer)ToLua.CheckObject(L, 1); + System.Collections.Generic.List arg0 = (System.Collections.Generic.List)ToLua.CheckObject(L, 2, typeof(System.Collections.Generic.List)); + obj.GetClosestReflectionProbes(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_bounds(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + UnityEngine.Bounds ret = obj.bounds; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index bounds on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_enabled(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + bool ret = obj.enabled; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index enabled on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isVisible(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + bool ret = obj.isVisible; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isVisible on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_shadowCastingMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + UnityEngine.Rendering.ShadowCastingMode ret = obj.shadowCastingMode; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index shadowCastingMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_receiveShadows(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + bool ret = obj.receiveShadows; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index receiveShadows on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_forceRenderingOff(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + bool ret = obj.forceRenderingOff; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index forceRenderingOff on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_staticShadowCaster(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + bool ret = obj.staticShadowCaster; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index staticShadowCaster on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_motionVectorGenerationMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + UnityEngine.MotionVectorGenerationMode ret = obj.motionVectorGenerationMode; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index motionVectorGenerationMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_lightProbeUsage(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + UnityEngine.Rendering.LightProbeUsage ret = obj.lightProbeUsage; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index lightProbeUsage on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_reflectionProbeUsage(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + UnityEngine.Rendering.ReflectionProbeUsage ret = obj.reflectionProbeUsage; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index reflectionProbeUsage on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_renderingLayerMask(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + uint ret = obj.renderingLayerMask; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index renderingLayerMask on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_rendererPriority(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + int ret = obj.rendererPriority; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index rendererPriority on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_rayTracingMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + UnityEngine.Experimental.Rendering.RayTracingMode ret = obj.rayTracingMode; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index rayTracingMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_sortingLayerName(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + string ret = obj.sortingLayerName; + LuaDLL.lua_pushstring(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index sortingLayerName on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_sortingLayerID(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + int ret = obj.sortingLayerID; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index sortingLayerID on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_sortingOrder(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + int ret = obj.sortingOrder; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index sortingOrder on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_allowOcclusionWhenDynamic(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + bool ret = obj.allowOcclusionWhenDynamic; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index allowOcclusionWhenDynamic on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isPartOfStaticBatch(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + bool ret = obj.isPartOfStaticBatch; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isPartOfStaticBatch on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_worldToLocalMatrix(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + UnityEngine.Matrix4x4 ret = obj.worldToLocalMatrix; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index worldToLocalMatrix on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_localToWorldMatrix(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + UnityEngine.Matrix4x4 ret = obj.localToWorldMatrix; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index localToWorldMatrix on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_lightProbeProxyVolumeOverride(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + UnityEngine.GameObject ret = obj.lightProbeProxyVolumeOverride; + ToLua.PushSealed(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index lightProbeProxyVolumeOverride on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_probeAnchor(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + UnityEngine.Transform ret = obj.probeAnchor; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index probeAnchor on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_lightmapIndex(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + int ret = obj.lightmapIndex; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index lightmapIndex on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_realtimeLightmapIndex(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + int ret = obj.realtimeLightmapIndex; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index realtimeLightmapIndex on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_lightmapScaleOffset(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + UnityEngine.Vector4 ret = obj.lightmapScaleOffset; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index lightmapScaleOffset on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_realtimeLightmapScaleOffset(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + UnityEngine.Vector4 ret = obj.realtimeLightmapScaleOffset; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index realtimeLightmapScaleOffset on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_materials(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + UnityEngine.Material[] ret = obj.materials; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index materials on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_material(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + UnityEngine.Material ret = obj.material; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index material on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_sharedMaterial(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + UnityEngine.Material ret = obj.sharedMaterial; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index sharedMaterial on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_sharedMaterials(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + UnityEngine.Material[] ret = obj.sharedMaterials; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index sharedMaterials on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_enabled(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.enabled = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index enabled on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_shadowCastingMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + UnityEngine.Rendering.ShadowCastingMode arg0 = (UnityEngine.Rendering.ShadowCastingMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.Rendering.ShadowCastingMode)); + obj.shadowCastingMode = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index shadowCastingMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_receiveShadows(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.receiveShadows = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index receiveShadows on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_forceRenderingOff(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.forceRenderingOff = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index forceRenderingOff on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_staticShadowCaster(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.staticShadowCaster = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index staticShadowCaster on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_motionVectorGenerationMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + UnityEngine.MotionVectorGenerationMode arg0 = (UnityEngine.MotionVectorGenerationMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.MotionVectorGenerationMode)); + obj.motionVectorGenerationMode = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index motionVectorGenerationMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_lightProbeUsage(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + UnityEngine.Rendering.LightProbeUsage arg0 = (UnityEngine.Rendering.LightProbeUsage)ToLua.CheckObject(L, 2, typeof(UnityEngine.Rendering.LightProbeUsage)); + obj.lightProbeUsage = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index lightProbeUsage on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_reflectionProbeUsage(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + UnityEngine.Rendering.ReflectionProbeUsage arg0 = (UnityEngine.Rendering.ReflectionProbeUsage)ToLua.CheckObject(L, 2, typeof(UnityEngine.Rendering.ReflectionProbeUsage)); + obj.reflectionProbeUsage = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index reflectionProbeUsage on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_renderingLayerMask(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + uint arg0 = (uint)LuaDLL.luaL_checknumber(L, 2); + obj.renderingLayerMask = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index renderingLayerMask on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_rendererPriority(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.rendererPriority = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index rendererPriority on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_rayTracingMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + UnityEngine.Experimental.Rendering.RayTracingMode arg0 = (UnityEngine.Experimental.Rendering.RayTracingMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.Experimental.Rendering.RayTracingMode)); + obj.rayTracingMode = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index rayTracingMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_sortingLayerName(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + string arg0 = ToLua.CheckString(L, 2); + obj.sortingLayerName = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index sortingLayerName on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_sortingLayerID(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.sortingLayerID = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index sortingLayerID on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_sortingOrder(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.sortingOrder = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index sortingOrder on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_allowOcclusionWhenDynamic(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.allowOcclusionWhenDynamic = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index allowOcclusionWhenDynamic on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_lightProbeProxyVolumeOverride(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.CheckObject(L, 2, typeof(UnityEngine.GameObject)); + obj.lightProbeProxyVolumeOverride = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index lightProbeProxyVolumeOverride on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_probeAnchor(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.CheckObject(L, 2); + obj.probeAnchor = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index probeAnchor on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_lightmapIndex(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.lightmapIndex = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index lightmapIndex on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_realtimeLightmapIndex(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.realtimeLightmapIndex = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index realtimeLightmapIndex on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_lightmapScaleOffset(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + UnityEngine.Vector4 arg0 = ToLua.ToVector4(L, 2); + obj.lightmapScaleOffset = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index lightmapScaleOffset on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_realtimeLightmapScaleOffset(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + UnityEngine.Vector4 arg0 = ToLua.ToVector4(L, 2); + obj.realtimeLightmapScaleOffset = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index realtimeLightmapScaleOffset on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_materials(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + UnityEngine.Material[] arg0 = ToLua.CheckObjectArray(L, 2); + obj.materials = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index materials on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_material(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + UnityEngine.Material arg0 = (UnityEngine.Material)ToLua.CheckObject(L, 2); + obj.material = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index material on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_sharedMaterial(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + UnityEngine.Material arg0 = (UnityEngine.Material)ToLua.CheckObject(L, 2); + obj.sharedMaterial = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index sharedMaterial on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_sharedMaterials(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Renderer obj = (UnityEngine.Renderer)o; + UnityEngine.Material[] arg0 = ToLua.CheckObjectArray(L, 2); + obj.sharedMaterials = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index sharedMaterials on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_RendererWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_RendererWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..45522c608e2bbc2e42eb13381d0eecbf90cb63a1 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_RendererWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b12c56d9807f0c24ba028366a8773e5b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ResourcesWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ResourcesWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..ec689726a395d384093d5c4b4fbb04b5bfd3943f --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ResourcesWrap.cs @@ -0,0 +1,222 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_ResourcesWrap +{ + public static void Register(LuaState L) + { + L.BeginStaticLibs("Resources"); + L.RegFunction("FindObjectsOfTypeAll", FindObjectsOfTypeAll); + L.RegFunction("Load", Load); + L.RegFunction("LoadAsync", LoadAsync); + L.RegFunction("LoadAll", LoadAll); + L.RegFunction("GetBuiltinResource", GetBuiltinResource); + L.RegFunction("UnloadAsset", UnloadAsset); + L.RegFunction("UnloadUnusedAssets", UnloadUnusedAssets); + L.RegFunction("InstanceIDToObject", InstanceIDToObject); + L.RegFunction("InstanceIDToObjectList", InstanceIDToObjectList); + L.EndStaticLibs(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int FindObjectsOfTypeAll(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + System.Type arg0 = ToLua.CheckMonoType(L, 1); + UnityEngine.Object[] o = UnityEngine.Resources.FindObjectsOfTypeAll(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Load(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + string arg0 = ToLua.CheckString(L, 1); + UnityEngine.Object o = UnityEngine.Resources.Load(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 2) + { + string arg0 = ToLua.CheckString(L, 1); + System.Type arg1 = ToLua.CheckMonoType(L, 2); + UnityEngine.Object o = UnityEngine.Resources.Load(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Resources.Load"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LoadAsync(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + string arg0 = ToLua.CheckString(L, 1); + UnityEngine.ResourceRequest o = UnityEngine.Resources.LoadAsync(arg0); + ToLua.PushObject(L, o); + return 1; + } + else if (count == 2) + { + string arg0 = ToLua.CheckString(L, 1); + System.Type arg1 = ToLua.CheckMonoType(L, 2); + UnityEngine.ResourceRequest o = UnityEngine.Resources.LoadAsync(arg0, arg1); + ToLua.PushObject(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Resources.LoadAsync"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LoadAll(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + string arg0 = ToLua.CheckString(L, 1); + UnityEngine.Object[] o = UnityEngine.Resources.LoadAll(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 2) + { + string arg0 = ToLua.CheckString(L, 1); + System.Type arg1 = ToLua.CheckMonoType(L, 2); + UnityEngine.Object[] o = UnityEngine.Resources.LoadAll(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Resources.LoadAll"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetBuiltinResource(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + System.Type arg0 = ToLua.CheckMonoType(L, 1); + string arg1 = ToLua.CheckString(L, 2); + UnityEngine.Object o = UnityEngine.Resources.GetBuiltinResource(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int UnloadAsset(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject(L, 1); + UnityEngine.Resources.UnloadAsset(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int UnloadUnusedAssets(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 0); + UnityEngine.AsyncOperation o = UnityEngine.Resources.UnloadUnusedAssets(); + ToLua.PushObject(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int InstanceIDToObject(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + UnityEngine.Object o = UnityEngine.Resources.InstanceIDToObject(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int InstanceIDToObjectList(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + Unity.Collections.NativeArray arg0 = StackTraits>.Check(L, 1); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.CheckObject(L, 2, typeof(System.Collections.Generic.List)); + UnityEngine.Resources.InstanceIDToObjectList(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ResourcesWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ResourcesWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..fe6caa0113d634ddb84af7b074349fb9cc023128 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ResourcesWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a1db47c2d84f71c498cee22b2ffc3cc9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_RigidbodyWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_RigidbodyWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..5eb481e09b10104547b0c63b0c300c313cb9f070 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_RigidbodyWrap.cs @@ -0,0 +1,1528 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_RigidbodyWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.Rigidbody), typeof(UnityEngine.Component)); + L.RegFunction("SetDensity", SetDensity); + L.RegFunction("MovePosition", MovePosition); + L.RegFunction("MoveRotation", MoveRotation); + L.RegFunction("Sleep", Sleep); + L.RegFunction("IsSleeping", IsSleeping); + L.RegFunction("WakeUp", WakeUp); + L.RegFunction("ResetCenterOfMass", ResetCenterOfMass); + L.RegFunction("ResetInertiaTensor", ResetInertiaTensor); + L.RegFunction("GetRelativePointVelocity", GetRelativePointVelocity); + L.RegFunction("GetPointVelocity", GetPointVelocity); + L.RegFunction("AddForce", AddForce); + L.RegFunction("AddRelativeForce", AddRelativeForce); + L.RegFunction("AddTorque", AddTorque); + L.RegFunction("AddRelativeTorque", AddRelativeTorque); + L.RegFunction("AddForceAtPosition", AddForceAtPosition); + L.RegFunction("AddExplosionForce", AddExplosionForce); + L.RegFunction("ClosestPointOnBounds", ClosestPointOnBounds); + L.RegFunction("SweepTest", SweepTest); + L.RegFunction("SweepTestAll", SweepTestAll); + L.RegFunction("New", _CreateUnityEngine_Rigidbody); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("velocity", get_velocity, set_velocity); + L.RegVar("angularVelocity", get_angularVelocity, set_angularVelocity); + L.RegVar("drag", get_drag, set_drag); + L.RegVar("angularDrag", get_angularDrag, set_angularDrag); + L.RegVar("mass", get_mass, set_mass); + L.RegVar("useGravity", get_useGravity, set_useGravity); + L.RegVar("maxDepenetrationVelocity", get_maxDepenetrationVelocity, set_maxDepenetrationVelocity); + L.RegVar("isKinematic", get_isKinematic, set_isKinematic); + L.RegVar("freezeRotation", get_freezeRotation, set_freezeRotation); + L.RegVar("constraints", get_constraints, set_constraints); + L.RegVar("collisionDetectionMode", get_collisionDetectionMode, set_collisionDetectionMode); + L.RegVar("centerOfMass", get_centerOfMass, set_centerOfMass); + L.RegVar("worldCenterOfMass", get_worldCenterOfMass, null); + L.RegVar("inertiaTensorRotation", get_inertiaTensorRotation, set_inertiaTensorRotation); + L.RegVar("inertiaTensor", get_inertiaTensor, set_inertiaTensor); + L.RegVar("detectCollisions", get_detectCollisions, set_detectCollisions); + L.RegVar("position", get_position, set_position); + L.RegVar("rotation", get_rotation, set_rotation); + L.RegVar("interpolation", get_interpolation, set_interpolation); + L.RegVar("solverIterations", get_solverIterations, set_solverIterations); + L.RegVar("sleepThreshold", get_sleepThreshold, set_sleepThreshold); + L.RegVar("maxAngularVelocity", get_maxAngularVelocity, set_maxAngularVelocity); + L.RegVar("solverVelocityIterations", get_solverVelocityIterations, set_solverVelocityIterations); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateUnityEngine_Rigidbody(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + UnityEngine.Rigidbody obj = new UnityEngine.Rigidbody(); + ToLua.Push(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.Rigidbody.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetDensity(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.SetDensity(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int MovePosition(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + obj.MovePosition(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int MoveRotation(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + UnityEngine.Quaternion arg0 = ToLua.ToQuaternion(L, 2); + obj.MoveRotation(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Sleep(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + obj.Sleep(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IsSleeping(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + bool o = obj.IsSleeping(); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int WakeUp(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + obj.WakeUp(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ResetCenterOfMass(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + obj.ResetCenterOfMass(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ResetInertiaTensor(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + obj.ResetInertiaTensor(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetRelativePointVelocity(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 o = obj.GetRelativePointVelocity(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetPointVelocity(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 o = obj.GetPointVelocity(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int AddForce(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + obj.AddForce(arg0); + return 0; + } + else if (count == 3) + { + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.ForceMode arg1 = (UnityEngine.ForceMode)ToLua.CheckObject(L, 3, typeof(UnityEngine.ForceMode)); + obj.AddForce(arg0, arg1); + return 0; + } + else if (count == 4) + { + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + obj.AddForce(arg0, arg1, arg2); + return 0; + } + else if (count == 5) + { + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + UnityEngine.ForceMode arg3 = (UnityEngine.ForceMode)ToLua.CheckObject(L, 5, typeof(UnityEngine.ForceMode)); + obj.AddForce(arg0, arg1, arg2, arg3); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Rigidbody.AddForce"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int AddRelativeForce(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + obj.AddRelativeForce(arg0); + return 0; + } + else if (count == 3) + { + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.ForceMode arg1 = (UnityEngine.ForceMode)ToLua.CheckObject(L, 3, typeof(UnityEngine.ForceMode)); + obj.AddRelativeForce(arg0, arg1); + return 0; + } + else if (count == 4) + { + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + obj.AddRelativeForce(arg0, arg1, arg2); + return 0; + } + else if (count == 5) + { + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + UnityEngine.ForceMode arg3 = (UnityEngine.ForceMode)ToLua.CheckObject(L, 5, typeof(UnityEngine.ForceMode)); + obj.AddRelativeForce(arg0, arg1, arg2, arg3); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Rigidbody.AddRelativeForce"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int AddTorque(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + obj.AddTorque(arg0); + return 0; + } + else if (count == 3) + { + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.ForceMode arg1 = (UnityEngine.ForceMode)ToLua.CheckObject(L, 3, typeof(UnityEngine.ForceMode)); + obj.AddTorque(arg0, arg1); + return 0; + } + else if (count == 4) + { + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + obj.AddTorque(arg0, arg1, arg2); + return 0; + } + else if (count == 5) + { + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + UnityEngine.ForceMode arg3 = (UnityEngine.ForceMode)ToLua.CheckObject(L, 5, typeof(UnityEngine.ForceMode)); + obj.AddTorque(arg0, arg1, arg2, arg3); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Rigidbody.AddTorque"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int AddRelativeTorque(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + obj.AddRelativeTorque(arg0); + return 0; + } + else if (count == 3) + { + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.ForceMode arg1 = (UnityEngine.ForceMode)ToLua.CheckObject(L, 3, typeof(UnityEngine.ForceMode)); + obj.AddRelativeTorque(arg0, arg1); + return 0; + } + else if (count == 4) + { + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + obj.AddRelativeTorque(arg0, arg1, arg2); + return 0; + } + else if (count == 5) + { + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + UnityEngine.ForceMode arg3 = (UnityEngine.ForceMode)ToLua.CheckObject(L, 5, typeof(UnityEngine.ForceMode)); + obj.AddRelativeTorque(arg0, arg1, arg2, arg3); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Rigidbody.AddRelativeTorque"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int AddForceAtPosition(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3) + { + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 3); + obj.AddForceAtPosition(arg0, arg1); + return 0; + } + else if (count == 4) + { + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 3); + UnityEngine.ForceMode arg2 = (UnityEngine.ForceMode)ToLua.CheckObject(L, 4, typeof(UnityEngine.ForceMode)); + obj.AddForceAtPosition(arg0, arg1, arg2); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Rigidbody.AddForceAtPosition"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int AddExplosionForce(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 4) + { + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 3); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + obj.AddExplosionForce(arg0, arg1, arg2); + return 0; + } + else if (count == 5) + { + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 3); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + float arg3 = (float)LuaDLL.luaL_checknumber(L, 5); + obj.AddExplosionForce(arg0, arg1, arg2, arg3); + return 0; + } + else if (count == 6) + { + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 3); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + float arg3 = (float)LuaDLL.luaL_checknumber(L, 5); + UnityEngine.ForceMode arg4 = (UnityEngine.ForceMode)ToLua.CheckObject(L, 6, typeof(UnityEngine.ForceMode)); + obj.AddExplosionForce(arg0, arg1, arg2, arg3, arg4); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Rigidbody.AddExplosionForce"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ClosestPointOnBounds(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 o = obj.ClosestPointOnBounds(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SweepTest(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3) + { + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.RaycastHit arg1; + bool o = obj.SweepTest(arg0, out arg1); + LuaDLL.lua_pushboolean(L, o); + ToLua.Push(L, arg1); + return 2; + } + else if (count == 4) + { + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.RaycastHit arg1; + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + bool o = obj.SweepTest(arg0, out arg1, arg2); + LuaDLL.lua_pushboolean(L, o); + ToLua.Push(L, arg1); + return 2; + } + else if (count == 5) + { + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.RaycastHit arg1; + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + UnityEngine.QueryTriggerInteraction arg3 = (UnityEngine.QueryTriggerInteraction)ToLua.CheckObject(L, 5, typeof(UnityEngine.QueryTriggerInteraction)); + bool o = obj.SweepTest(arg0, out arg1, arg2, arg3); + LuaDLL.lua_pushboolean(L, o); + ToLua.Push(L, arg1); + return 2; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Rigidbody.SweepTest"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SweepTestAll(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.RaycastHit[] o = obj.SweepTestAll(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.RaycastHit[] o = obj.SweepTestAll(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else if (count == 4) + { + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.QueryTriggerInteraction arg2 = (UnityEngine.QueryTriggerInteraction)ToLua.CheckObject(L, 4, typeof(UnityEngine.QueryTriggerInteraction)); + UnityEngine.RaycastHit[] o = obj.SweepTestAll(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Rigidbody.SweepTestAll"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_velocity(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + UnityEngine.Vector3 ret = obj.velocity; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index velocity on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_angularVelocity(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + UnityEngine.Vector3 ret = obj.angularVelocity; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index angularVelocity on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_drag(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + float ret = obj.drag; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index drag on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_angularDrag(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + float ret = obj.angularDrag; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index angularDrag on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_mass(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + float ret = obj.mass; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index mass on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_useGravity(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + bool ret = obj.useGravity; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index useGravity on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_maxDepenetrationVelocity(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + float ret = obj.maxDepenetrationVelocity; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index maxDepenetrationVelocity on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isKinematic(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + bool ret = obj.isKinematic; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isKinematic on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_freezeRotation(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + bool ret = obj.freezeRotation; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index freezeRotation on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_constraints(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + UnityEngine.RigidbodyConstraints ret = obj.constraints; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index constraints on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_collisionDetectionMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + UnityEngine.CollisionDetectionMode ret = obj.collisionDetectionMode; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index collisionDetectionMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_centerOfMass(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + UnityEngine.Vector3 ret = obj.centerOfMass; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index centerOfMass on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_worldCenterOfMass(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + UnityEngine.Vector3 ret = obj.worldCenterOfMass; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index worldCenterOfMass on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_inertiaTensorRotation(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + UnityEngine.Quaternion ret = obj.inertiaTensorRotation; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index inertiaTensorRotation on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_inertiaTensor(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + UnityEngine.Vector3 ret = obj.inertiaTensor; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index inertiaTensor on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_detectCollisions(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + bool ret = obj.detectCollisions; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index detectCollisions on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_position(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + UnityEngine.Vector3 ret = obj.position; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index position on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_rotation(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + UnityEngine.Quaternion ret = obj.rotation; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index rotation on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_interpolation(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + UnityEngine.RigidbodyInterpolation ret = obj.interpolation; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index interpolation on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_solverIterations(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + int ret = obj.solverIterations; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index solverIterations on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_sleepThreshold(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + float ret = obj.sleepThreshold; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index sleepThreshold on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_maxAngularVelocity(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + float ret = obj.maxAngularVelocity; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index maxAngularVelocity on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_solverVelocityIterations(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + int ret = obj.solverVelocityIterations; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index solverVelocityIterations on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_velocity(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + obj.velocity = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index velocity on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_angularVelocity(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + obj.angularVelocity = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index angularVelocity on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_drag(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.drag = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index drag on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_angularDrag(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.angularDrag = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index angularDrag on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_mass(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.mass = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index mass on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_useGravity(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.useGravity = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index useGravity on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_maxDepenetrationVelocity(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.maxDepenetrationVelocity = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index maxDepenetrationVelocity on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_isKinematic(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.isKinematic = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isKinematic on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_freezeRotation(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.freezeRotation = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index freezeRotation on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_constraints(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + UnityEngine.RigidbodyConstraints arg0 = (UnityEngine.RigidbodyConstraints)ToLua.CheckObject(L, 2, typeof(UnityEngine.RigidbodyConstraints)); + obj.constraints = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index constraints on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_collisionDetectionMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + UnityEngine.CollisionDetectionMode arg0 = (UnityEngine.CollisionDetectionMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.CollisionDetectionMode)); + obj.collisionDetectionMode = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index collisionDetectionMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_centerOfMass(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + obj.centerOfMass = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index centerOfMass on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_inertiaTensorRotation(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + UnityEngine.Quaternion arg0 = ToLua.ToQuaternion(L, 2); + obj.inertiaTensorRotation = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index inertiaTensorRotation on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_inertiaTensor(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + obj.inertiaTensor = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index inertiaTensor on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_detectCollisions(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.detectCollisions = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index detectCollisions on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_position(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + obj.position = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index position on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_rotation(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + UnityEngine.Quaternion arg0 = ToLua.ToQuaternion(L, 2); + obj.rotation = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index rotation on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_interpolation(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + UnityEngine.RigidbodyInterpolation arg0 = (UnityEngine.RigidbodyInterpolation)ToLua.CheckObject(L, 2, typeof(UnityEngine.RigidbodyInterpolation)); + obj.interpolation = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index interpolation on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_solverIterations(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.solverIterations = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index solverIterations on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_sleepThreshold(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.sleepThreshold = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index sleepThreshold on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_maxAngularVelocity(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.maxAngularVelocity = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index maxAngularVelocity on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_solverVelocityIterations(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.solverVelocityIterations = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index solverVelocityIterations on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_RigidbodyWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_RigidbodyWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..1f746708d68c6508cf943502bd1376f43180c85c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_RigidbodyWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 213c22ff30dae9647a07fcfad0b52885 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ScreenWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ScreenWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..870a114909e1b080d67fdfa82d7083f0242e5f62 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ScreenWrap.cs @@ -0,0 +1,441 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_ScreenWrap +{ + public static void Register(LuaState L) + { + L.BeginStaticLibs("Screen"); + L.RegFunction("SetResolution", SetResolution); + L.RegVar("width", get_width, null); + L.RegVar("height", get_height, null); + L.RegVar("dpi", get_dpi, null); + L.RegVar("currentResolution", get_currentResolution, null); + L.RegVar("resolutions", get_resolutions, null); + L.RegVar("fullScreen", get_fullScreen, set_fullScreen); + L.RegVar("fullScreenMode", get_fullScreenMode, set_fullScreenMode); + L.RegVar("safeArea", get_safeArea, null); + L.RegVar("cutouts", get_cutouts, null); + L.RegVar("autorotateToPortrait", get_autorotateToPortrait, set_autorotateToPortrait); + L.RegVar("autorotateToPortraitUpsideDown", get_autorotateToPortraitUpsideDown, set_autorotateToPortraitUpsideDown); + L.RegVar("autorotateToLandscapeLeft", get_autorotateToLandscapeLeft, set_autorotateToLandscapeLeft); + L.RegVar("autorotateToLandscapeRight", get_autorotateToLandscapeRight, set_autorotateToLandscapeRight); + L.RegVar("orientation", get_orientation, set_orientation); + L.RegVar("sleepTimeout", get_sleepTimeout, set_sleepTimeout); + L.RegVar("brightness", get_brightness, set_brightness); + L.EndStaticLibs(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetResolution(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3 && TypeChecker.CheckTypes(L, 3)) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.FullScreenMode arg2 = (UnityEngine.FullScreenMode)ToLua.ToObject(L, 3); + UnityEngine.Screen.SetResolution(arg0, arg1, arg2); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 3)) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + bool arg2 = LuaDLL.lua_toboolean(L, 3); + UnityEngine.Screen.SetResolution(arg0, arg1, arg2); + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 3)) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.FullScreenMode arg2 = (UnityEngine.FullScreenMode)ToLua.ToObject(L, 3); + int arg3 = (int)LuaDLL.lua_tonumber(L, 4); + UnityEngine.Screen.SetResolution(arg0, arg1, arg2, arg3); + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 3)) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + bool arg2 = LuaDLL.lua_toboolean(L, 3); + int arg3 = (int)LuaDLL.lua_tonumber(L, 4); + UnityEngine.Screen.SetResolution(arg0, arg1, arg2, arg3); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Screen.SetResolution"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_width(IntPtr L) + { + try + { + LuaDLL.lua_pushinteger(L, UnityEngine.Screen.width); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_height(IntPtr L) + { + try + { + LuaDLL.lua_pushinteger(L, UnityEngine.Screen.height); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_dpi(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.Screen.dpi); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_currentResolution(IntPtr L) + { + try + { + ToLua.PushValue(L, UnityEngine.Screen.currentResolution); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_resolutions(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.Screen.resolutions); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_fullScreen(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Screen.fullScreen); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_fullScreenMode(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.Screen.fullScreenMode); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_safeArea(IntPtr L) + { + try + { + ToLua.PushValue(L, UnityEngine.Screen.safeArea); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_cutouts(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.Screen.cutouts); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_autorotateToPortrait(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Screen.autorotateToPortrait); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_autorotateToPortraitUpsideDown(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Screen.autorotateToPortraitUpsideDown); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_autorotateToLandscapeLeft(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Screen.autorotateToLandscapeLeft); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_autorotateToLandscapeRight(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Screen.autorotateToLandscapeRight); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_orientation(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.Screen.orientation); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_sleepTimeout(IntPtr L) + { + try + { + LuaDLL.lua_pushinteger(L, UnityEngine.Screen.sleepTimeout); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_brightness(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.Screen.brightness); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_fullScreen(IntPtr L) + { + try + { + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + UnityEngine.Screen.fullScreen = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_fullScreenMode(IntPtr L) + { + try + { + UnityEngine.FullScreenMode arg0 = (UnityEngine.FullScreenMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.FullScreenMode)); + UnityEngine.Screen.fullScreenMode = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_autorotateToPortrait(IntPtr L) + { + try + { + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + UnityEngine.Screen.autorotateToPortrait = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_autorotateToPortraitUpsideDown(IntPtr L) + { + try + { + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + UnityEngine.Screen.autorotateToPortraitUpsideDown = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_autorotateToLandscapeLeft(IntPtr L) + { + try + { + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + UnityEngine.Screen.autorotateToLandscapeLeft = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_autorotateToLandscapeRight(IntPtr L) + { + try + { + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + UnityEngine.Screen.autorotateToLandscapeRight = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_orientation(IntPtr L) + { + try + { + UnityEngine.ScreenOrientation arg0 = (UnityEngine.ScreenOrientation)ToLua.CheckObject(L, 2, typeof(UnityEngine.ScreenOrientation)); + UnityEngine.Screen.orientation = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_sleepTimeout(IntPtr L) + { + try + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Screen.sleepTimeout = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_brightness(IntPtr L) + { + try + { + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Screen.brightness = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ScreenWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ScreenWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..a0bd0dd6511e5cfde591c92e6871e8e48a705dd5 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ScreenWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7effbee4715b46f4a9b14c351ca86903 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ShaderWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ShaderWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..313a4aeb1f189227ab6b428c5302ca078af692a0 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ShaderWrap.cs @@ -0,0 +1,1466 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_ShaderWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.Shader), typeof(UnityEngine.Object)); + L.RegFunction("Find", Find); + L.RegFunction("EnableKeyword", EnableKeyword); + L.RegFunction("DisableKeyword", DisableKeyword); + L.RegFunction("IsKeywordEnabled", IsKeywordEnabled); + L.RegFunction("WarmupAllShaders", WarmupAllShaders); + L.RegFunction("PropertyToID", PropertyToID); + L.RegFunction("GetDependency", GetDependency); + L.RegFunction("FindPassTagValue", FindPassTagValue); + L.RegFunction("SetGlobalInt", SetGlobalInt); + L.RegFunction("SetGlobalFloat", SetGlobalFloat); + L.RegFunction("SetGlobalInteger", SetGlobalInteger); + L.RegFunction("SetGlobalVector", SetGlobalVector); + L.RegFunction("SetGlobalColor", SetGlobalColor); + L.RegFunction("SetGlobalMatrix", SetGlobalMatrix); + L.RegFunction("SetGlobalTexture", SetGlobalTexture); + L.RegFunction("SetGlobalBuffer", SetGlobalBuffer); + L.RegFunction("SetGlobalConstantBuffer", SetGlobalConstantBuffer); + L.RegFunction("SetGlobalFloatArray", SetGlobalFloatArray); + L.RegFunction("SetGlobalVectorArray", SetGlobalVectorArray); + L.RegFunction("SetGlobalMatrixArray", SetGlobalMatrixArray); + L.RegFunction("GetGlobalInt", GetGlobalInt); + L.RegFunction("GetGlobalFloat", GetGlobalFloat); + L.RegFunction("GetGlobalInteger", GetGlobalInteger); + L.RegFunction("GetGlobalVector", GetGlobalVector); + L.RegFunction("GetGlobalColor", GetGlobalColor); + L.RegFunction("GetGlobalMatrix", GetGlobalMatrix); + L.RegFunction("GetGlobalTexture", GetGlobalTexture); + L.RegFunction("GetGlobalFloatArray", GetGlobalFloatArray); + L.RegFunction("GetGlobalVectorArray", GetGlobalVectorArray); + L.RegFunction("GetGlobalMatrixArray", GetGlobalMatrixArray); + L.RegFunction("GetPropertyCount", GetPropertyCount); + L.RegFunction("FindPropertyIndex", FindPropertyIndex); + L.RegFunction("GetPropertyName", GetPropertyName); + L.RegFunction("GetPropertyNameId", GetPropertyNameId); + L.RegFunction("GetPropertyType", GetPropertyType); + L.RegFunction("GetPropertyDescription", GetPropertyDescription); + L.RegFunction("GetPropertyFlags", GetPropertyFlags); + L.RegFunction("GetPropertyAttributes", GetPropertyAttributes); + L.RegFunction("GetPropertyDefaultFloatValue", GetPropertyDefaultFloatValue); + L.RegFunction("GetPropertyDefaultVectorValue", GetPropertyDefaultVectorValue); + L.RegFunction("GetPropertyRangeLimits", GetPropertyRangeLimits); + L.RegFunction("GetPropertyTextureDimension", GetPropertyTextureDimension); + L.RegFunction("GetPropertyTextureDefaultName", GetPropertyTextureDefaultName); + L.RegFunction("FindTextureStack", FindTextureStack); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("maximumLOD", get_maximumLOD, set_maximumLOD); + L.RegVar("globalMaximumLOD", get_globalMaximumLOD, set_globalMaximumLOD); + L.RegVar("isSupported", get_isSupported, null); + L.RegVar("globalRenderPipeline", get_globalRenderPipeline, set_globalRenderPipeline); + L.RegVar("renderQueue", get_renderQueue, null); + L.RegVar("passCount", get_passCount, null); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Find(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + UnityEngine.Shader o = UnityEngine.Shader.Find(arg0); + ToLua.PushSealed(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int EnableKeyword(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + UnityEngine.Shader.EnableKeyword(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int DisableKeyword(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + UnityEngine.Shader.DisableKeyword(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IsKeywordEnabled(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + bool o = UnityEngine.Shader.IsKeywordEnabled(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int WarmupAllShaders(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 0); + UnityEngine.Shader.WarmupAllShaders(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int PropertyToID(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + string arg0 = ToLua.CheckString(L, 1); + int o = UnityEngine.Shader.PropertyToID(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetDependency(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Shader obj = (UnityEngine.Shader)ToLua.CheckObject(L, 1, typeof(UnityEngine.Shader)); + string arg0 = ToLua.CheckString(L, 2); + UnityEngine.Shader o = obj.GetDependency(arg0); + ToLua.PushSealed(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int FindPassTagValue(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.Shader obj = (UnityEngine.Shader)ToLua.CheckObject(L, 1, typeof(UnityEngine.Shader)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Rendering.ShaderTagId arg1 = StackTraits.Check(L, 3); + UnityEngine.Rendering.ShaderTagId o = obj.FindPassTagValue(arg0, arg1); + ToLua.PushValue(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetGlobalInt(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + int arg1 = (int)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Shader.SetGlobalInt(arg0, arg1); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + int arg1 = (int)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Shader.SetGlobalInt(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Shader.SetGlobalInt"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetGlobalFloat(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + float arg1 = (float)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Shader.SetGlobalFloat(arg0, arg1); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + float arg1 = (float)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Shader.SetGlobalFloat(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Shader.SetGlobalFloat"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetGlobalInteger(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + int arg1 = (int)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Shader.SetGlobalInteger(arg0, arg1); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + int arg1 = (int)LuaDLL.lua_tonumber(L, 2); + UnityEngine.Shader.SetGlobalInteger(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Shader.SetGlobalInteger"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetGlobalVector(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + UnityEngine.Vector4 arg1 = ToLua.ToVector4(L, 2); + UnityEngine.Shader.SetGlobalVector(arg0, arg1); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + UnityEngine.Vector4 arg1 = ToLua.ToVector4(L, 2); + UnityEngine.Shader.SetGlobalVector(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Shader.SetGlobalVector"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetGlobalColor(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + UnityEngine.Color arg1 = ToLua.ToColor(L, 2); + UnityEngine.Shader.SetGlobalColor(arg0, arg1); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + UnityEngine.Color arg1 = ToLua.ToColor(L, 2); + UnityEngine.Shader.SetGlobalColor(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Shader.SetGlobalColor"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetGlobalMatrix(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + UnityEngine.Matrix4x4 arg1 = StackTraits.To(L, 2); + UnityEngine.Shader.SetGlobalMatrix(arg0, arg1); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + UnityEngine.Matrix4x4 arg1 = StackTraits.To(L, 2); + UnityEngine.Shader.SetGlobalMatrix(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Shader.SetGlobalMatrix"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetGlobalTexture(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + UnityEngine.Texture arg1 = (UnityEngine.Texture)ToLua.ToObject(L, 2); + UnityEngine.Shader.SetGlobalTexture(arg0, arg1); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + UnityEngine.Texture arg1 = (UnityEngine.Texture)ToLua.ToObject(L, 2); + UnityEngine.Shader.SetGlobalTexture(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + UnityEngine.RenderTexture arg1 = (UnityEngine.RenderTexture)ToLua.ToObject(L, 2); + UnityEngine.Rendering.RenderTextureSubElement arg2 = (UnityEngine.Rendering.RenderTextureSubElement)ToLua.ToObject(L, 3); + UnityEngine.Shader.SetGlobalTexture(arg0, arg1, arg2); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + UnityEngine.RenderTexture arg1 = (UnityEngine.RenderTexture)ToLua.ToObject(L, 2); + UnityEngine.Rendering.RenderTextureSubElement arg2 = (UnityEngine.Rendering.RenderTextureSubElement)ToLua.ToObject(L, 3); + UnityEngine.Shader.SetGlobalTexture(arg0, arg1, arg2); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Shader.SetGlobalTexture"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetGlobalBuffer(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + UnityEngine.ComputeBuffer arg1 = (UnityEngine.ComputeBuffer)ToLua.ToObject(L, 2); + UnityEngine.Shader.SetGlobalBuffer(arg0, arg1); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + UnityEngine.ComputeBuffer arg1 = (UnityEngine.ComputeBuffer)ToLua.ToObject(L, 2); + UnityEngine.Shader.SetGlobalBuffer(arg0, arg1); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + UnityEngine.GraphicsBuffer arg1 = (UnityEngine.GraphicsBuffer)ToLua.ToObject(L, 2); + UnityEngine.Shader.SetGlobalBuffer(arg0, arg1); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + UnityEngine.GraphicsBuffer arg1 = (UnityEngine.GraphicsBuffer)ToLua.ToObject(L, 2); + UnityEngine.Shader.SetGlobalBuffer(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Shader.SetGlobalBuffer"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetGlobalConstantBuffer(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 4 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + UnityEngine.ComputeBuffer arg1 = (UnityEngine.ComputeBuffer)ToLua.ToObject(L, 2); + int arg2 = (int)LuaDLL.lua_tonumber(L, 3); + int arg3 = (int)LuaDLL.lua_tonumber(L, 4); + UnityEngine.Shader.SetGlobalConstantBuffer(arg0, arg1, arg2, arg3); + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + UnityEngine.ComputeBuffer arg1 = (UnityEngine.ComputeBuffer)ToLua.ToObject(L, 2); + int arg2 = (int)LuaDLL.lua_tonumber(L, 3); + int arg3 = (int)LuaDLL.lua_tonumber(L, 4); + UnityEngine.Shader.SetGlobalConstantBuffer(arg0, arg1, arg2, arg3); + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + UnityEngine.GraphicsBuffer arg1 = (UnityEngine.GraphicsBuffer)ToLua.ToObject(L, 2); + int arg2 = (int)LuaDLL.lua_tonumber(L, 3); + int arg3 = (int)LuaDLL.lua_tonumber(L, 4); + UnityEngine.Shader.SetGlobalConstantBuffer(arg0, arg1, arg2, arg3); + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + UnityEngine.GraphicsBuffer arg1 = (UnityEngine.GraphicsBuffer)ToLua.ToObject(L, 2); + int arg2 = (int)LuaDLL.lua_tonumber(L, 3); + int arg3 = (int)LuaDLL.lua_tonumber(L, 4); + UnityEngine.Shader.SetGlobalConstantBuffer(arg0, arg1, arg2, arg3); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Shader.SetGlobalConstantBuffer"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetGlobalFloatArray(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes>(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.ToObject(L, 2); + UnityEngine.Shader.SetGlobalFloatArray(arg0, arg1); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes>(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.ToObject(L, 2); + UnityEngine.Shader.SetGlobalFloatArray(arg0, arg1); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + float[] arg1 = ToLua.ToNumberArray(L, 2); + UnityEngine.Shader.SetGlobalFloatArray(arg0, arg1); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + float[] arg1 = ToLua.ToNumberArray(L, 2); + UnityEngine.Shader.SetGlobalFloatArray(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Shader.SetGlobalFloatArray"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetGlobalVectorArray(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes>(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.ToObject(L, 2); + UnityEngine.Shader.SetGlobalVectorArray(arg0, arg1); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes>(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.ToObject(L, 2); + UnityEngine.Shader.SetGlobalVectorArray(arg0, arg1); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + UnityEngine.Vector4[] arg1 = ToLua.ToStructArray(L, 2); + UnityEngine.Shader.SetGlobalVectorArray(arg0, arg1); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + UnityEngine.Vector4[] arg1 = ToLua.ToStructArray(L, 2); + UnityEngine.Shader.SetGlobalVectorArray(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Shader.SetGlobalVectorArray"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetGlobalMatrixArray(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes>(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.ToObject(L, 2); + UnityEngine.Shader.SetGlobalMatrixArray(arg0, arg1); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes>(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.ToObject(L, 2); + UnityEngine.Shader.SetGlobalMatrixArray(arg0, arg1); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + UnityEngine.Matrix4x4[] arg1 = ToLua.ToStructArray(L, 2); + UnityEngine.Shader.SetGlobalMatrixArray(arg0, arg1); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + UnityEngine.Matrix4x4[] arg1 = ToLua.ToStructArray(L, 2); + UnityEngine.Shader.SetGlobalMatrixArray(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Shader.SetGlobalMatrixArray"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetGlobalInt(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + int o = UnityEngine.Shader.GetGlobalInt(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + int o = UnityEngine.Shader.GetGlobalInt(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Shader.GetGlobalInt"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetGlobalFloat(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + float o = UnityEngine.Shader.GetGlobalFloat(arg0); + LuaDLL.lua_pushnumber(L, o); + return 1; + } + else if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + float o = UnityEngine.Shader.GetGlobalFloat(arg0); + LuaDLL.lua_pushnumber(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Shader.GetGlobalFloat"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetGlobalInteger(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + int o = UnityEngine.Shader.GetGlobalInteger(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + int o = UnityEngine.Shader.GetGlobalInteger(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Shader.GetGlobalInteger"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetGlobalVector(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + UnityEngine.Vector4 o = UnityEngine.Shader.GetGlobalVector(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + UnityEngine.Vector4 o = UnityEngine.Shader.GetGlobalVector(arg0); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Shader.GetGlobalVector"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetGlobalColor(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + UnityEngine.Color o = UnityEngine.Shader.GetGlobalColor(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + UnityEngine.Color o = UnityEngine.Shader.GetGlobalColor(arg0); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Shader.GetGlobalColor"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetGlobalMatrix(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + UnityEngine.Matrix4x4 o = UnityEngine.Shader.GetGlobalMatrix(arg0); + ToLua.PushValue(L, o); + return 1; + } + else if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + UnityEngine.Matrix4x4 o = UnityEngine.Shader.GetGlobalMatrix(arg0); + ToLua.PushValue(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Shader.GetGlobalMatrix"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetGlobalTexture(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + UnityEngine.Texture o = UnityEngine.Shader.GetGlobalTexture(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + UnityEngine.Texture o = UnityEngine.Shader.GetGlobalTexture(arg0); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Shader.GetGlobalTexture"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetGlobalFloatArray(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + float[] o = UnityEngine.Shader.GetGlobalFloatArray(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + float[] o = UnityEngine.Shader.GetGlobalFloatArray(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes>(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.ToObject(L, 2); + UnityEngine.Shader.GetGlobalFloatArray(arg0, arg1); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes>(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.ToObject(L, 2); + UnityEngine.Shader.GetGlobalFloatArray(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Shader.GetGlobalFloatArray"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetGlobalVectorArray(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + UnityEngine.Vector4[] o = UnityEngine.Shader.GetGlobalVectorArray(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + UnityEngine.Vector4[] o = UnityEngine.Shader.GetGlobalVectorArray(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes>(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.ToObject(L, 2); + UnityEngine.Shader.GetGlobalVectorArray(arg0, arg1); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes>(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.ToObject(L, 2); + UnityEngine.Shader.GetGlobalVectorArray(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Shader.GetGlobalVectorArray"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetGlobalMatrixArray(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + UnityEngine.Matrix4x4[] o = UnityEngine.Shader.GetGlobalMatrixArray(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 1 && TypeChecker.CheckTypes(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + UnityEngine.Matrix4x4[] o = UnityEngine.Shader.GetGlobalMatrixArray(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes>(L, 1)) + { + string arg0 = ToLua.ToString(L, 1); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.ToObject(L, 2); + UnityEngine.Shader.GetGlobalMatrixArray(arg0, arg1); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes>(L, 1)) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + System.Collections.Generic.List arg1 = (System.Collections.Generic.List)ToLua.ToObject(L, 2); + UnityEngine.Shader.GetGlobalMatrixArray(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Shader.GetGlobalMatrixArray"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetPropertyCount(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Shader obj = (UnityEngine.Shader)ToLua.CheckObject(L, 1, typeof(UnityEngine.Shader)); + int o = obj.GetPropertyCount(); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int FindPropertyIndex(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Shader obj = (UnityEngine.Shader)ToLua.CheckObject(L, 1, typeof(UnityEngine.Shader)); + string arg0 = ToLua.CheckString(L, 2); + int o = obj.FindPropertyIndex(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetPropertyName(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Shader obj = (UnityEngine.Shader)ToLua.CheckObject(L, 1, typeof(UnityEngine.Shader)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + string o = obj.GetPropertyName(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetPropertyNameId(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Shader obj = (UnityEngine.Shader)ToLua.CheckObject(L, 1, typeof(UnityEngine.Shader)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int o = obj.GetPropertyNameId(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetPropertyType(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Shader obj = (UnityEngine.Shader)ToLua.CheckObject(L, 1, typeof(UnityEngine.Shader)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Rendering.ShaderPropertyType o = obj.GetPropertyType(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetPropertyDescription(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Shader obj = (UnityEngine.Shader)ToLua.CheckObject(L, 1, typeof(UnityEngine.Shader)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + string o = obj.GetPropertyDescription(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetPropertyFlags(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Shader obj = (UnityEngine.Shader)ToLua.CheckObject(L, 1, typeof(UnityEngine.Shader)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Rendering.ShaderPropertyFlags o = obj.GetPropertyFlags(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetPropertyAttributes(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Shader obj = (UnityEngine.Shader)ToLua.CheckObject(L, 1, typeof(UnityEngine.Shader)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + string[] o = obj.GetPropertyAttributes(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetPropertyDefaultFloatValue(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Shader obj = (UnityEngine.Shader)ToLua.CheckObject(L, 1, typeof(UnityEngine.Shader)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + float o = obj.GetPropertyDefaultFloatValue(arg0); + LuaDLL.lua_pushnumber(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetPropertyDefaultVectorValue(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Shader obj = (UnityEngine.Shader)ToLua.CheckObject(L, 1, typeof(UnityEngine.Shader)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Vector4 o = obj.GetPropertyDefaultVectorValue(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetPropertyRangeLimits(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Shader obj = (UnityEngine.Shader)ToLua.CheckObject(L, 1, typeof(UnityEngine.Shader)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Vector2 o = obj.GetPropertyRangeLimits(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetPropertyTextureDimension(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Shader obj = (UnityEngine.Shader)ToLua.CheckObject(L, 1, typeof(UnityEngine.Shader)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Rendering.TextureDimension o = obj.GetPropertyTextureDimension(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetPropertyTextureDefaultName(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Shader obj = (UnityEngine.Shader)ToLua.CheckObject(L, 1, typeof(UnityEngine.Shader)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + string o = obj.GetPropertyTextureDefaultName(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int FindTextureStack(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 4); + UnityEngine.Shader obj = (UnityEngine.Shader)ToLua.CheckObject(L, 1, typeof(UnityEngine.Shader)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + string arg1 = null; + int arg2; + bool o = obj.FindTextureStack(arg0, out arg1, out arg2); + LuaDLL.lua_pushboolean(L, o); + LuaDLL.lua_pushstring(L, arg1); + LuaDLL.lua_pushinteger(L, arg2); + return 3; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_maximumLOD(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Shader obj = (UnityEngine.Shader)o; + int ret = obj.maximumLOD; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index maximumLOD on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_globalMaximumLOD(IntPtr L) + { + try + { + LuaDLL.lua_pushinteger(L, UnityEngine.Shader.globalMaximumLOD); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isSupported(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Shader obj = (UnityEngine.Shader)o; + bool ret = obj.isSupported; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isSupported on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_globalRenderPipeline(IntPtr L) + { + try + { + LuaDLL.lua_pushstring(L, UnityEngine.Shader.globalRenderPipeline); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_renderQueue(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Shader obj = (UnityEngine.Shader)o; + int ret = obj.renderQueue; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index renderQueue on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_passCount(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Shader obj = (UnityEngine.Shader)o; + int ret = obj.passCount; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index passCount on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_maximumLOD(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Shader obj = (UnityEngine.Shader)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.maximumLOD = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index maximumLOD on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_globalMaximumLOD(IntPtr L) + { + try + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Shader.globalMaximumLOD = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_globalRenderPipeline(IntPtr L) + { + try + { + string arg0 = ToLua.CheckString(L, 2); + UnityEngine.Shader.globalRenderPipeline = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ShaderWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ShaderWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..6d1769bfafb58a6c6e6b401d2cbac2d32856f7bb --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_ShaderWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4ffb9b1da112d5d40ba6d1635990593d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_SkinWeightsWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_SkinWeightsWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..e1cb1130aac57f40bc0539f544da29fa52f3bceb --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_SkinWeightsWrap.cs @@ -0,0 +1,67 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_SkinWeightsWrap +{ + public static void Register(LuaState L) + { + L.BeginEnum(typeof(UnityEngine.SkinWeights)); + L.RegVar("OneBone", get_OneBone, null); + L.RegVar("TwoBones", get_TwoBones, null); + L.RegVar("FourBones", get_FourBones, null); + L.RegVar("Unlimited", get_Unlimited, null); + L.RegFunction("IntToEnum", IntToEnum); + L.EndEnum(); + TypeTraits.Check = CheckType; + StackTraits.Push = Push; + } + + static void Push(IntPtr L, UnityEngine.SkinWeights arg) + { + ToLua.Push(L, arg); + } + + static bool CheckType(IntPtr L, int pos) + { + return TypeChecker.CheckEnumType(typeof(UnityEngine.SkinWeights), L, pos); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_OneBone(IntPtr L) + { + ToLua.Push(L, UnityEngine.SkinWeights.OneBone); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_TwoBones(IntPtr L) + { + ToLua.Push(L, UnityEngine.SkinWeights.TwoBones); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_FourBones(IntPtr L) + { + ToLua.Push(L, UnityEngine.SkinWeights.FourBones); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Unlimited(IntPtr L) + { + ToLua.Push(L, UnityEngine.SkinWeights.Unlimited); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IntToEnum(IntPtr L) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + UnityEngine.SkinWeights o = (UnityEngine.SkinWeights)arg0; + ToLua.Push(L, o); + return 1; + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_SkinWeightsWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_SkinWeightsWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..56fbd52470a3550f3be4b08fc662ed916848d12e --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_SkinWeightsWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 079cd7e2ffd2eba4096e50b0c0b3b4ff +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_SkinnedMeshRendererWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_SkinnedMeshRendererWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..6f1c8b325c014daafe2ed8567f61116c664033bd --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_SkinnedMeshRendererWrap.cs @@ -0,0 +1,442 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_SkinnedMeshRendererWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.SkinnedMeshRenderer), typeof(UnityEngine.Renderer)); + L.RegFunction("GetBlendShapeWeight", GetBlendShapeWeight); + L.RegFunction("SetBlendShapeWeight", SetBlendShapeWeight); + L.RegFunction("BakeMesh", BakeMesh); + L.RegFunction("New", _CreateUnityEngine_SkinnedMeshRenderer); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("quality", get_quality, set_quality); + L.RegVar("updateWhenOffscreen", get_updateWhenOffscreen, set_updateWhenOffscreen); + L.RegVar("forceMatrixRecalculationPerRender", get_forceMatrixRecalculationPerRender, set_forceMatrixRecalculationPerRender); + L.RegVar("rootBone", get_rootBone, set_rootBone); + L.RegVar("bones", get_bones, set_bones); + L.RegVar("sharedMesh", get_sharedMesh, set_sharedMesh); + L.RegVar("skinnedMotionVectors", get_skinnedMotionVectors, set_skinnedMotionVectors); + L.RegVar("localBounds", get_localBounds, set_localBounds); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateUnityEngine_SkinnedMeshRenderer(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + UnityEngine.SkinnedMeshRenderer obj = new UnityEngine.SkinnedMeshRenderer(); + ToLua.Push(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.SkinnedMeshRenderer.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetBlendShapeWeight(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.SkinnedMeshRenderer obj = (UnityEngine.SkinnedMeshRenderer)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + float o = obj.GetBlendShapeWeight(arg0); + LuaDLL.lua_pushnumber(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetBlendShapeWeight(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.SkinnedMeshRenderer obj = (UnityEngine.SkinnedMeshRenderer)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + obj.SetBlendShapeWeight(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int BakeMesh(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.SkinnedMeshRenderer obj = (UnityEngine.SkinnedMeshRenderer)ToLua.CheckObject(L, 1); + UnityEngine.Mesh arg0 = (UnityEngine.Mesh)ToLua.CheckObject(L, 2, typeof(UnityEngine.Mesh)); + obj.BakeMesh(arg0); + return 0; + } + else if (count == 3) + { + UnityEngine.SkinnedMeshRenderer obj = (UnityEngine.SkinnedMeshRenderer)ToLua.CheckObject(L, 1); + UnityEngine.Mesh arg0 = (UnityEngine.Mesh)ToLua.CheckObject(L, 2, typeof(UnityEngine.Mesh)); + bool arg1 = LuaDLL.luaL_checkboolean(L, 3); + obj.BakeMesh(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.SkinnedMeshRenderer.BakeMesh"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_quality(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.SkinnedMeshRenderer obj = (UnityEngine.SkinnedMeshRenderer)o; + UnityEngine.SkinQuality ret = obj.quality; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index quality on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_updateWhenOffscreen(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.SkinnedMeshRenderer obj = (UnityEngine.SkinnedMeshRenderer)o; + bool ret = obj.updateWhenOffscreen; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index updateWhenOffscreen on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_forceMatrixRecalculationPerRender(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.SkinnedMeshRenderer obj = (UnityEngine.SkinnedMeshRenderer)o; + bool ret = obj.forceMatrixRecalculationPerRender; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index forceMatrixRecalculationPerRender on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_rootBone(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.SkinnedMeshRenderer obj = (UnityEngine.SkinnedMeshRenderer)o; + UnityEngine.Transform ret = obj.rootBone; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index rootBone on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_bones(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.SkinnedMeshRenderer obj = (UnityEngine.SkinnedMeshRenderer)o; + UnityEngine.Transform[] ret = obj.bones; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index bones on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_sharedMesh(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.SkinnedMeshRenderer obj = (UnityEngine.SkinnedMeshRenderer)o; + UnityEngine.Mesh ret = obj.sharedMesh; + ToLua.PushSealed(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index sharedMesh on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_skinnedMotionVectors(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.SkinnedMeshRenderer obj = (UnityEngine.SkinnedMeshRenderer)o; + bool ret = obj.skinnedMotionVectors; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index skinnedMotionVectors on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_localBounds(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.SkinnedMeshRenderer obj = (UnityEngine.SkinnedMeshRenderer)o; + UnityEngine.Bounds ret = obj.localBounds; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index localBounds on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_quality(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.SkinnedMeshRenderer obj = (UnityEngine.SkinnedMeshRenderer)o; + UnityEngine.SkinQuality arg0 = (UnityEngine.SkinQuality)ToLua.CheckObject(L, 2, typeof(UnityEngine.SkinQuality)); + obj.quality = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index quality on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_updateWhenOffscreen(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.SkinnedMeshRenderer obj = (UnityEngine.SkinnedMeshRenderer)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.updateWhenOffscreen = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index updateWhenOffscreen on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_forceMatrixRecalculationPerRender(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.SkinnedMeshRenderer obj = (UnityEngine.SkinnedMeshRenderer)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.forceMatrixRecalculationPerRender = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index forceMatrixRecalculationPerRender on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_rootBone(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.SkinnedMeshRenderer obj = (UnityEngine.SkinnedMeshRenderer)o; + UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.CheckObject(L, 2); + obj.rootBone = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index rootBone on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_bones(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.SkinnedMeshRenderer obj = (UnityEngine.SkinnedMeshRenderer)o; + UnityEngine.Transform[] arg0 = ToLua.CheckObjectArray(L, 2); + obj.bones = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index bones on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_sharedMesh(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.SkinnedMeshRenderer obj = (UnityEngine.SkinnedMeshRenderer)o; + UnityEngine.Mesh arg0 = (UnityEngine.Mesh)ToLua.CheckObject(L, 2, typeof(UnityEngine.Mesh)); + obj.sharedMesh = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index sharedMesh on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_skinnedMotionVectors(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.SkinnedMeshRenderer obj = (UnityEngine.SkinnedMeshRenderer)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.skinnedMotionVectors = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index skinnedMotionVectors on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_localBounds(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.SkinnedMeshRenderer obj = (UnityEngine.SkinnedMeshRenderer)o; + UnityEngine.Bounds arg0 = ToLua.ToBounds(L, 2); + obj.localBounds = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index localBounds on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_SkinnedMeshRendererWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_SkinnedMeshRendererWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..ac016eb2b3dc44edc41c5351d803df21801c7302 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_SkinnedMeshRendererWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3c3e774f702639149a11556dcd4430b6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_SleepTimeoutWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_SleepTimeoutWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..f766587b773b6d06340c75191c38e38958e07487 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_SleepTimeoutWrap.cs @@ -0,0 +1,15 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_SleepTimeoutWrap +{ + public static void Register(LuaState L) + { + L.BeginStaticLibs("SleepTimeout"); + L.RegConstant("NeverSleep", -1); + L.RegConstant("SystemSetting", -2); + L.EndStaticLibs(); + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_SleepTimeoutWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_SleepTimeoutWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..e04e12f3cced5e415c41b9e1017bf6f4baadb9ba --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_SleepTimeoutWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fc495d339570f05499018ee71e19e44f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_SpaceWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_SpaceWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..2525748edf33702d2556af0db4a669ff58e6640d --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_SpaceWrap.cs @@ -0,0 +1,51 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_SpaceWrap +{ + public static void Register(LuaState L) + { + L.BeginEnum(typeof(UnityEngine.Space)); + L.RegVar("World", get_World, null); + L.RegVar("Self", get_Self, null); + L.RegFunction("IntToEnum", IntToEnum); + L.EndEnum(); + TypeTraits.Check = CheckType; + StackTraits.Push = Push; + } + + static void Push(IntPtr L, UnityEngine.Space arg) + { + ToLua.Push(L, arg); + } + + static bool CheckType(IntPtr L, int pos) + { + return TypeChecker.CheckEnumType(typeof(UnityEngine.Space), L, pos); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_World(IntPtr L) + { + ToLua.Push(L, UnityEngine.Space.World); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Self(IntPtr L) + { + ToLua.Push(L, UnityEngine.Space.Self); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IntToEnum(IntPtr L) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + UnityEngine.Space o = (UnityEngine.Space)arg0; + ToLua.Push(L, o); + return 1; + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_SpaceWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_SpaceWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..79c59a9b594c49c192f52c7ce1d529c6df09c5e3 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_SpaceWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 77c3698b6a37a4a41a2f88100db76c82 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_SphereColliderWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_SphereColliderWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..8c2b055569a7999e6010e2c0c7228a24e6278997 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_SphereColliderWrap.cs @@ -0,0 +1,136 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_SphereColliderWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.SphereCollider), typeof(UnityEngine.Collider)); + L.RegFunction("New", _CreateUnityEngine_SphereCollider); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("center", get_center, set_center); + L.RegVar("radius", get_radius, set_radius); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateUnityEngine_SphereCollider(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + UnityEngine.SphereCollider obj = new UnityEngine.SphereCollider(); + ToLua.Push(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.SphereCollider.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_center(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.SphereCollider obj = (UnityEngine.SphereCollider)o; + UnityEngine.Vector3 ret = obj.center; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index center on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_radius(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.SphereCollider obj = (UnityEngine.SphereCollider)o; + float ret = obj.radius; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index radius on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_center(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.SphereCollider obj = (UnityEngine.SphereCollider)o; + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + obj.center = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index center on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_radius(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.SphereCollider obj = (UnityEngine.SphereCollider)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.radius = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index radius on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_SphereColliderWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_SphereColliderWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..3d0da5e5a1470b6b4e9b88bbe3264cf1c26cd1aa --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_SphereColliderWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b0e659fb84b6e4849ae9bb503aa6b49d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_Texture2DWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_Texture2DWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..4b61a44dc196bded3b8ad997b99bf31ea80ea8a5 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_Texture2DWrap.cs @@ -0,0 +1,1151 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_Texture2DWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.Texture2D), typeof(UnityEngine.Texture)); + L.RegFunction("Compress", Compress); + L.RegFunction("ClearRequestedMipmapLevel", ClearRequestedMipmapLevel); + L.RegFunction("IsRequestedMipmapLevelLoaded", IsRequestedMipmapLevelLoaded); + L.RegFunction("ClearMinimumMipmapLevel", ClearMinimumMipmapLevel); + L.RegFunction("UpdateExternalTexture", UpdateExternalTexture); + L.RegFunction("GetRawTextureData", GetRawTextureData); + L.RegFunction("GetPixels", GetPixels); + L.RegFunction("GetPixels32", GetPixels32); + L.RegFunction("PackTextures", PackTextures); + L.RegFunction("CreateExternalTexture", CreateExternalTexture); + L.RegFunction("SetPixel", SetPixel); + L.RegFunction("SetPixels", SetPixels); + L.RegFunction("GetPixel", GetPixel); + L.RegFunction("GetPixelBilinear", GetPixelBilinear); + L.RegFunction("LoadRawTextureData", LoadRawTextureData); + L.RegFunction("Apply", Apply); + L.RegFunction("Resize", Resize); + L.RegFunction("ReadPixels", ReadPixels); + L.RegFunction("GenerateAtlas", GenerateAtlas); + L.RegFunction("SetPixels32", SetPixels32); + L.RegFunction("New", _CreateUnityEngine_Texture2D); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("format", get_format, null); + L.RegVar("whiteTexture", get_whiteTexture, null); + L.RegVar("blackTexture", get_blackTexture, null); + L.RegVar("redTexture", get_redTexture, null); + L.RegVar("grayTexture", get_grayTexture, null); + L.RegVar("linearGrayTexture", get_linearGrayTexture, null); + L.RegVar("normalTexture", get_normalTexture, null); + L.RegVar("isReadable", get_isReadable, null); + L.RegVar("vtOnly", get_vtOnly, null); + L.RegVar("streamingMipmaps", get_streamingMipmaps, null); + L.RegVar("streamingMipmapsPriority", get_streamingMipmapsPriority, null); + L.RegVar("requestedMipmapLevel", get_requestedMipmapLevel, set_requestedMipmapLevel); + L.RegVar("minimumMipmapLevel", get_minimumMipmapLevel, set_minimumMipmapLevel); + L.RegVar("calculatedMipmapLevel", get_calculatedMipmapLevel, null); + L.RegVar("desiredMipmapLevel", get_desiredMipmapLevel, null); + L.RegVar("loadingMipmapLevel", get_loadingMipmapLevel, null); + L.RegVar("loadedMipmapLevel", get_loadedMipmapLevel, null); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateUnityEngine_Texture2D(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Texture2D obj = new UnityEngine.Texture2D(arg0, arg1); + ToLua.PushSealed(L, obj); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 3)) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Experimental.Rendering.DefaultFormat arg2 = (UnityEngine.Experimental.Rendering.DefaultFormat)ToLua.ToObject(L, 3); + UnityEngine.Experimental.Rendering.TextureCreationFlags arg3 = (UnityEngine.Experimental.Rendering.TextureCreationFlags)ToLua.ToObject(L, 4); + UnityEngine.Texture2D obj = new UnityEngine.Texture2D(arg0, arg1, arg2, arg3); + ToLua.PushSealed(L, obj); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 3)) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Experimental.Rendering.GraphicsFormat arg2 = (UnityEngine.Experimental.Rendering.GraphicsFormat)ToLua.ToObject(L, 3); + UnityEngine.Experimental.Rendering.TextureCreationFlags arg3 = (UnityEngine.Experimental.Rendering.TextureCreationFlags)ToLua.ToObject(L, 4); + UnityEngine.Texture2D obj = new UnityEngine.Texture2D(arg0, arg1, arg2, arg3); + ToLua.PushSealed(L, obj); + return 1; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 3)) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.TextureFormat arg2 = (UnityEngine.TextureFormat)ToLua.ToObject(L, 3); + bool arg3 = LuaDLL.lua_toboolean(L, 4); + UnityEngine.Texture2D obj = new UnityEngine.Texture2D(arg0, arg1, arg2, arg3); + ToLua.PushSealed(L, obj); + return 1; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 3)) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Experimental.Rendering.GraphicsFormat arg2 = (UnityEngine.Experimental.Rendering.GraphicsFormat)ToLua.ToObject(L, 3); + int arg3 = (int)LuaDLL.lua_tonumber(L, 4); + UnityEngine.Experimental.Rendering.TextureCreationFlags arg4 = (UnityEngine.Experimental.Rendering.TextureCreationFlags)ToLua.ToObject(L, 5); + UnityEngine.Texture2D obj = new UnityEngine.Texture2D(arg0, arg1, arg2, arg3, arg4); + ToLua.PushSealed(L, obj); + return 1; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 3)) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.TextureFormat arg2 = (UnityEngine.TextureFormat)ToLua.ToObject(L, 3); + int arg3 = (int)LuaDLL.lua_tonumber(L, 4); + bool arg4 = LuaDLL.lua_toboolean(L, 5); + UnityEngine.Texture2D obj = new UnityEngine.Texture2D(arg0, arg1, arg2, arg3, arg4); + ToLua.PushSealed(L, obj); + return 1; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 3)) + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.TextureFormat arg2 = (UnityEngine.TextureFormat)ToLua.ToObject(L, 3); + bool arg3 = LuaDLL.lua_toboolean(L, 4); + bool arg4 = LuaDLL.lua_toboolean(L, 5); + UnityEngine.Texture2D obj = new UnityEngine.Texture2D(arg0, arg1, arg2, arg3, arg4); + ToLua.PushSealed(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.Texture2D.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Compress(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.Compress(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ClearRequestedMipmapLevel(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + obj.ClearRequestedMipmapLevel(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IsRequestedMipmapLevelLoaded(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + bool o = obj.IsRequestedMipmapLevelLoaded(); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ClearMinimumMipmapLevel(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + obj.ClearMinimumMipmapLevel(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int UpdateExternalTexture(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + System.IntPtr arg0 = ToLua.CheckIntPtr(L, 2); + obj.UpdateExternalTexture(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetRawTextureData(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + byte[] o = obj.GetRawTextureData(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetPixels(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + UnityEngine.Color[] o = obj.GetPixels(); + ToLua.Push(L, o); + return 1; + } + else if (count == 2) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Color[] o = obj.GetPixels(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 5) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 5); + UnityEngine.Color[] o = obj.GetPixels(arg0, arg1, arg2, arg3); + ToLua.Push(L, o); + return 1; + } + else if (count == 6) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 5); + int arg4 = (int)LuaDLL.luaL_checknumber(L, 6); + UnityEngine.Color[] o = obj.GetPixels(arg0, arg1, arg2, arg3, arg4); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Texture2D.GetPixels"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetPixels32(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + UnityEngine.Color32[] o = obj.GetPixels32(); + ToLua.Push(L, o); + return 1; + } + else if (count == 2) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Color32[] o = obj.GetPixels32(arg0); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Texture2D.GetPixels32"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int PackTextures(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + UnityEngine.Texture2D[] arg0 = ToLua.CheckObjectArray(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Rect[] o = obj.PackTextures(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else if (count == 4) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + UnityEngine.Texture2D[] arg0 = ToLua.CheckObjectArray(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); + UnityEngine.Rect[] o = obj.PackTextures(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else if (count == 5) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + UnityEngine.Texture2D[] arg0 = ToLua.CheckObjectArray(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); + bool arg3 = LuaDLL.luaL_checkboolean(L, 5); + UnityEngine.Rect[] o = obj.PackTextures(arg0, arg1, arg2, arg3); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Texture2D.PackTextures"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CreateExternalTexture(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 6); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.TextureFormat arg2 = (UnityEngine.TextureFormat)ToLua.CheckObject(L, 3, typeof(UnityEngine.TextureFormat)); + bool arg3 = LuaDLL.luaL_checkboolean(L, 4); + bool arg4 = LuaDLL.luaL_checkboolean(L, 5); + System.IntPtr arg5 = ToLua.CheckIntPtr(L, 6); + UnityEngine.Texture2D o = UnityEngine.Texture2D.CreateExternalTexture(arg0, arg1, arg2, arg3, arg4, arg5); + ToLua.PushSealed(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetPixel(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 4) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Color arg2 = ToLua.ToColor(L, 4); + obj.SetPixel(arg0, arg1, arg2); + return 0; + } + else if (count == 5) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Color arg2 = ToLua.ToColor(L, 4); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 5); + obj.SetPixel(arg0, arg1, arg2, arg3); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Texture2D.SetPixel"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetPixels(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + UnityEngine.Color[] arg0 = ToLua.CheckStructArray(L, 2); + obj.SetPixels(arg0); + return 0; + } + else if (count == 3) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + UnityEngine.Color[] arg0 = ToLua.CheckStructArray(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + obj.SetPixels(arg0, arg1); + return 0; + } + else if (count == 6) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 5); + UnityEngine.Color[] arg4 = ToLua.CheckStructArray(L, 6); + obj.SetPixels(arg0, arg1, arg2, arg3, arg4); + return 0; + } + else if (count == 7) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 5); + UnityEngine.Color[] arg4 = ToLua.CheckStructArray(L, 6); + int arg5 = (int)LuaDLL.luaL_checknumber(L, 7); + obj.SetPixels(arg0, arg1, arg2, arg3, arg4, arg5); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Texture2D.SetPixels"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetPixel(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Color o = obj.GetPixel(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else if (count == 4) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); + UnityEngine.Color o = obj.GetPixel(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Texture2D.GetPixel"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetPixelBilinear(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Color o = obj.GetPixelBilinear(arg0, arg1); + ToLua.Push(L, o); + return 1; + } + else if (count == 4) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); + UnityEngine.Color o = obj.GetPixelBilinear(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Texture2D.GetPixelBilinear"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LoadRawTextureData(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + byte[] arg0 = ToLua.CheckByteBuffer(L, 2); + obj.LoadRawTextureData(arg0); + return 0; + } + else if (count == 3) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + System.IntPtr arg0 = ToLua.CheckIntPtr(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + obj.LoadRawTextureData(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Texture2D.LoadRawTextureData"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Apply(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + obj.Apply(); + return 0; + } + else if (count == 2) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.Apply(arg0); + return 0; + } + else if (count == 3) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + bool arg1 = LuaDLL.luaL_checkboolean(L, 3); + obj.Apply(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Texture2D.Apply"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Resize(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 3) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + bool o = obj.Resize(arg0, arg1); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 4)) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.TextureFormat arg2 = (UnityEngine.TextureFormat)ToLua.ToObject(L, 4); + bool arg3 = LuaDLL.lua_toboolean(L, 5); + bool o = obj.Resize(arg0, arg1, arg2, arg3); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 4)) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + UnityEngine.Experimental.Rendering.GraphicsFormat arg2 = (UnityEngine.Experimental.Rendering.GraphicsFormat)ToLua.ToObject(L, 4); + bool arg3 = LuaDLL.lua_toboolean(L, 5); + bool o = obj.Resize(arg0, arg1, arg2, arg3); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Texture2D.Resize"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int ReadPixels(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 4) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + UnityEngine.Rect arg0 = StackTraits.Check(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); + obj.ReadPixels(arg0, arg1, arg2); + return 0; + } + else if (count == 5) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + UnityEngine.Rect arg0 = StackTraits.Check(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); + bool arg3 = LuaDLL.luaL_checkboolean(L, 5); + obj.ReadPixels(arg0, arg1, arg2, arg3); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Texture2D.ReadPixels"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GenerateAtlas(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 4); + UnityEngine.Vector2[] arg0 = ToLua.CheckStructArray(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); + System.Collections.Generic.List arg3 = (System.Collections.Generic.List)ToLua.CheckObject(L, 4, typeof(System.Collections.Generic.List)); + bool o = UnityEngine.Texture2D.GenerateAtlas(arg0, arg1, arg2, arg3); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetPixels32(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + UnityEngine.Color32[] arg0 = ToLua.CheckStructArray(L, 2); + obj.SetPixels32(arg0); + return 0; + } + else if (count == 3) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + UnityEngine.Color32[] arg0 = ToLua.CheckStructArray(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + obj.SetPixels32(arg0, arg1); + return 0; + } + else if (count == 6) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 5); + UnityEngine.Color32[] arg4 = ToLua.CheckStructArray(L, 6); + obj.SetPixels32(arg0, arg1, arg2, arg3, arg4); + return 0; + } + else if (count == 7) + { + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); + int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); + int arg3 = (int)LuaDLL.luaL_checknumber(L, 5); + UnityEngine.Color32[] arg4 = ToLua.CheckStructArray(L, 6); + int arg5 = (int)LuaDLL.luaL_checknumber(L, 7); + obj.SetPixels32(arg0, arg1, arg2, arg3, arg4, arg5); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Texture2D.SetPixels32"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_format(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)o; + UnityEngine.TextureFormat ret = obj.format; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index format on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_whiteTexture(IntPtr L) + { + try + { + ToLua.PushSealed(L, UnityEngine.Texture2D.whiteTexture); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_blackTexture(IntPtr L) + { + try + { + ToLua.PushSealed(L, UnityEngine.Texture2D.blackTexture); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_redTexture(IntPtr L) + { + try + { + ToLua.PushSealed(L, UnityEngine.Texture2D.redTexture); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_grayTexture(IntPtr L) + { + try + { + ToLua.PushSealed(L, UnityEngine.Texture2D.grayTexture); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_linearGrayTexture(IntPtr L) + { + try + { + ToLua.PushSealed(L, UnityEngine.Texture2D.linearGrayTexture); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_normalTexture(IntPtr L) + { + try + { + ToLua.PushSealed(L, UnityEngine.Texture2D.normalTexture); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isReadable(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)o; + bool ret = obj.isReadable; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isReadable on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_vtOnly(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)o; + bool ret = obj.vtOnly; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index vtOnly on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_streamingMipmaps(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)o; + bool ret = obj.streamingMipmaps; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index streamingMipmaps on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_streamingMipmapsPriority(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)o; + int ret = obj.streamingMipmapsPriority; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index streamingMipmapsPriority on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_requestedMipmapLevel(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)o; + int ret = obj.requestedMipmapLevel; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index requestedMipmapLevel on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_minimumMipmapLevel(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)o; + int ret = obj.minimumMipmapLevel; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index minimumMipmapLevel on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_calculatedMipmapLevel(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)o; + int ret = obj.calculatedMipmapLevel; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index calculatedMipmapLevel on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_desiredMipmapLevel(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)o; + int ret = obj.desiredMipmapLevel; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index desiredMipmapLevel on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_loadingMipmapLevel(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)o; + int ret = obj.loadingMipmapLevel; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index loadingMipmapLevel on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_loadedMipmapLevel(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)o; + int ret = obj.loadedMipmapLevel; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index loadedMipmapLevel on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_requestedMipmapLevel(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.requestedMipmapLevel = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index requestedMipmapLevel on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_minimumMipmapLevel(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture2D obj = (UnityEngine.Texture2D)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.minimumMipmapLevel = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index minimumMipmapLevel on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_Texture2DWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_Texture2DWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..1105702b6b54a381f5680a4af1074e0c9a2c5ec1 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_Texture2DWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c270f02cdc40681479137108d3fcba3b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_TextureWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_TextureWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..1b2012ea94763c0a9a3d82bcfbd60f6fedcf6489 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_TextureWrap.cs @@ -0,0 +1,922 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_TextureWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.Texture), typeof(UnityEngine.Object)); + L.RegFunction("SetGlobalAnisotropicFilteringLimits", SetGlobalAnisotropicFilteringLimits); + L.RegFunction("GetNativeTexturePtr", GetNativeTexturePtr); + L.RegFunction("IncrementUpdateCount", IncrementUpdateCount); + L.RegFunction("SetStreamingTextureMaterialDebugProperties", SetStreamingTextureMaterialDebugProperties); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("GenerateAllMips", get_GenerateAllMips, null); + L.RegVar("masterTextureLimit", get_masterTextureLimit, set_masterTextureLimit); + L.RegVar("mipmapCount", get_mipmapCount, null); + L.RegVar("anisotropicFiltering", get_anisotropicFiltering, set_anisotropicFiltering); + L.RegVar("graphicsFormat", get_graphicsFormat, null); + L.RegVar("width", get_width, set_width); + L.RegVar("height", get_height, set_height); + L.RegVar("dimension", get_dimension, set_dimension); + L.RegVar("isReadable", get_isReadable, null); + L.RegVar("wrapMode", get_wrapMode, set_wrapMode); + L.RegVar("wrapModeU", get_wrapModeU, set_wrapModeU); + L.RegVar("wrapModeV", get_wrapModeV, set_wrapModeV); + L.RegVar("wrapModeW", get_wrapModeW, set_wrapModeW); + L.RegVar("filterMode", get_filterMode, set_filterMode); + L.RegVar("anisoLevel", get_anisoLevel, set_anisoLevel); + L.RegVar("mipMapBias", get_mipMapBias, set_mipMapBias); + L.RegVar("texelSize", get_texelSize, null); + L.RegVar("updateCount", get_updateCount, null); + L.RegVar("totalTextureMemory", get_totalTextureMemory, null); + L.RegVar("desiredTextureMemory", get_desiredTextureMemory, null); + L.RegVar("targetTextureMemory", get_targetTextureMemory, null); + L.RegVar("currentTextureMemory", get_currentTextureMemory, null); + L.RegVar("nonStreamingTextureMemory", get_nonStreamingTextureMemory, null); + L.RegVar("streamingMipmapUploadCount", get_streamingMipmapUploadCount, null); + L.RegVar("streamingRendererCount", get_streamingRendererCount, null); + L.RegVar("streamingTextureCount", get_streamingTextureCount, null); + L.RegVar("nonStreamingTextureCount", get_nonStreamingTextureCount, null); + L.RegVar("streamingTexturePendingLoadCount", get_streamingTexturePendingLoadCount, null); + L.RegVar("streamingTextureLoadingCount", get_streamingTextureLoadingCount, null); + L.RegVar("streamingTextureForceLoadAll", get_streamingTextureForceLoadAll, set_streamingTextureForceLoadAll); + L.RegVar("streamingTextureDiscardUnusedMips", get_streamingTextureDiscardUnusedMips, set_streamingTextureDiscardUnusedMips); + L.RegVar("allowThreadedTextureCreation", get_allowThreadedTextureCreation, set_allowThreadedTextureCreation); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetGlobalAnisotropicFilteringLimits(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); + int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Texture.SetGlobalAnisotropicFilteringLimits(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetNativeTexturePtr(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Texture obj = (UnityEngine.Texture)ToLua.CheckObject(L, 1); + System.IntPtr o = obj.GetNativeTexturePtr(); + LuaDLL.lua_pushlightuserdata(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IncrementUpdateCount(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Texture obj = (UnityEngine.Texture)ToLua.CheckObject(L, 1); + obj.IncrementUpdateCount(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetStreamingTextureMaterialDebugProperties(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 0); + UnityEngine.Texture.SetStreamingTextureMaterialDebugProperties(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_GenerateAllMips(IntPtr L) + { + try + { + LuaDLL.lua_pushinteger(L, UnityEngine.Texture.GenerateAllMips); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_masterTextureLimit(IntPtr L) + { + try + { + LuaDLL.lua_pushinteger(L, UnityEngine.Texture.masterTextureLimit); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_mipmapCount(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture obj = (UnityEngine.Texture)o; + int ret = obj.mipmapCount; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index mipmapCount on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_anisotropicFiltering(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.Texture.anisotropicFiltering); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_graphicsFormat(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture obj = (UnityEngine.Texture)o; + UnityEngine.Experimental.Rendering.GraphicsFormat ret = obj.graphicsFormat; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index graphicsFormat on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_width(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture obj = (UnityEngine.Texture)o; + int ret = obj.width; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index width on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_height(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture obj = (UnityEngine.Texture)o; + int ret = obj.height; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index height on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_dimension(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture obj = (UnityEngine.Texture)o; + UnityEngine.Rendering.TextureDimension ret = obj.dimension; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index dimension on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isReadable(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture obj = (UnityEngine.Texture)o; + bool ret = obj.isReadable; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isReadable on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_wrapMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture obj = (UnityEngine.Texture)o; + UnityEngine.TextureWrapMode ret = obj.wrapMode; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index wrapMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_wrapModeU(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture obj = (UnityEngine.Texture)o; + UnityEngine.TextureWrapMode ret = obj.wrapModeU; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index wrapModeU on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_wrapModeV(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture obj = (UnityEngine.Texture)o; + UnityEngine.TextureWrapMode ret = obj.wrapModeV; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index wrapModeV on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_wrapModeW(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture obj = (UnityEngine.Texture)o; + UnityEngine.TextureWrapMode ret = obj.wrapModeW; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index wrapModeW on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_filterMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture obj = (UnityEngine.Texture)o; + UnityEngine.FilterMode ret = obj.filterMode; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index filterMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_anisoLevel(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture obj = (UnityEngine.Texture)o; + int ret = obj.anisoLevel; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index anisoLevel on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_mipMapBias(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture obj = (UnityEngine.Texture)o; + float ret = obj.mipMapBias; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index mipMapBias on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_texelSize(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture obj = (UnityEngine.Texture)o; + UnityEngine.Vector2 ret = obj.texelSize; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index texelSize on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_updateCount(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture obj = (UnityEngine.Texture)o; + uint ret = obj.updateCount; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index updateCount on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_totalTextureMemory(IntPtr L) + { + try + { + LuaDLL.tolua_pushuint64(L, UnityEngine.Texture.totalTextureMemory); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_desiredTextureMemory(IntPtr L) + { + try + { + LuaDLL.tolua_pushuint64(L, UnityEngine.Texture.desiredTextureMemory); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_targetTextureMemory(IntPtr L) + { + try + { + LuaDLL.tolua_pushuint64(L, UnityEngine.Texture.targetTextureMemory); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_currentTextureMemory(IntPtr L) + { + try + { + LuaDLL.tolua_pushuint64(L, UnityEngine.Texture.currentTextureMemory); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_nonStreamingTextureMemory(IntPtr L) + { + try + { + LuaDLL.tolua_pushuint64(L, UnityEngine.Texture.nonStreamingTextureMemory); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_streamingMipmapUploadCount(IntPtr L) + { + try + { + LuaDLL.tolua_pushuint64(L, UnityEngine.Texture.streamingMipmapUploadCount); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_streamingRendererCount(IntPtr L) + { + try + { + LuaDLL.tolua_pushuint64(L, UnityEngine.Texture.streamingRendererCount); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_streamingTextureCount(IntPtr L) + { + try + { + LuaDLL.tolua_pushuint64(L, UnityEngine.Texture.streamingTextureCount); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_nonStreamingTextureCount(IntPtr L) + { + try + { + LuaDLL.tolua_pushuint64(L, UnityEngine.Texture.nonStreamingTextureCount); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_streamingTexturePendingLoadCount(IntPtr L) + { + try + { + LuaDLL.tolua_pushuint64(L, UnityEngine.Texture.streamingTexturePendingLoadCount); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_streamingTextureLoadingCount(IntPtr L) + { + try + { + LuaDLL.tolua_pushuint64(L, UnityEngine.Texture.streamingTextureLoadingCount); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_streamingTextureForceLoadAll(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Texture.streamingTextureForceLoadAll); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_streamingTextureDiscardUnusedMips(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Texture.streamingTextureDiscardUnusedMips); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_allowThreadedTextureCreation(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Texture.allowThreadedTextureCreation); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_masterTextureLimit(IntPtr L) + { + try + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Texture.masterTextureLimit = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_anisotropicFiltering(IntPtr L) + { + try + { + UnityEngine.AnisotropicFiltering arg0 = (UnityEngine.AnisotropicFiltering)ToLua.CheckObject(L, 2, typeof(UnityEngine.AnisotropicFiltering)); + UnityEngine.Texture.anisotropicFiltering = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_width(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture obj = (UnityEngine.Texture)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.width = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index width on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_height(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture obj = (UnityEngine.Texture)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.height = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index height on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_dimension(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture obj = (UnityEngine.Texture)o; + UnityEngine.Rendering.TextureDimension arg0 = (UnityEngine.Rendering.TextureDimension)ToLua.CheckObject(L, 2, typeof(UnityEngine.Rendering.TextureDimension)); + obj.dimension = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index dimension on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_wrapMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture obj = (UnityEngine.Texture)o; + UnityEngine.TextureWrapMode arg0 = (UnityEngine.TextureWrapMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.TextureWrapMode)); + obj.wrapMode = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index wrapMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_wrapModeU(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture obj = (UnityEngine.Texture)o; + UnityEngine.TextureWrapMode arg0 = (UnityEngine.TextureWrapMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.TextureWrapMode)); + obj.wrapModeU = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index wrapModeU on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_wrapModeV(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture obj = (UnityEngine.Texture)o; + UnityEngine.TextureWrapMode arg0 = (UnityEngine.TextureWrapMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.TextureWrapMode)); + obj.wrapModeV = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index wrapModeV on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_wrapModeW(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture obj = (UnityEngine.Texture)o; + UnityEngine.TextureWrapMode arg0 = (UnityEngine.TextureWrapMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.TextureWrapMode)); + obj.wrapModeW = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index wrapModeW on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_filterMode(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture obj = (UnityEngine.Texture)o; + UnityEngine.FilterMode arg0 = (UnityEngine.FilterMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.FilterMode)); + obj.filterMode = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index filterMode on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_anisoLevel(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture obj = (UnityEngine.Texture)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.anisoLevel = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index anisoLevel on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_mipMapBias(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Texture obj = (UnityEngine.Texture)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.mipMapBias = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index mipMapBias on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_streamingTextureForceLoadAll(IntPtr L) + { + try + { + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + UnityEngine.Texture.streamingTextureForceLoadAll = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_streamingTextureDiscardUnusedMips(IntPtr L) + { + try + { + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + UnityEngine.Texture.streamingTextureDiscardUnusedMips = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_allowThreadedTextureCreation(IntPtr L) + { + try + { + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + UnityEngine.Texture.allowThreadedTextureCreation = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_TextureWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_TextureWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..d8e71d5a5ef5fc25b6a1f19c82359dddcafb9b8d --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_TextureWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 91f5ae8240f74dd40bc04d63972530e8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_TimeWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_TimeWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..6876bafdb6ac0c2ad639a1a783130b8ffbe041ee --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_TimeWrap.cs @@ -0,0 +1,478 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_TimeWrap +{ + public static void Register(LuaState L) + { + L.BeginStaticLibs("Time"); + L.RegVar("time", get_time, null); + L.RegVar("timeAsDouble", get_timeAsDouble, null); + L.RegVar("timeSinceLevelLoad", get_timeSinceLevelLoad, null); + L.RegVar("timeSinceLevelLoadAsDouble", get_timeSinceLevelLoadAsDouble, null); + L.RegVar("deltaTime", get_deltaTime, null); + L.RegVar("fixedTime", get_fixedTime, null); + L.RegVar("fixedTimeAsDouble", get_fixedTimeAsDouble, null); + L.RegVar("unscaledTime", get_unscaledTime, null); + L.RegVar("unscaledTimeAsDouble", get_unscaledTimeAsDouble, null); + L.RegVar("fixedUnscaledTime", get_fixedUnscaledTime, null); + L.RegVar("fixedUnscaledTimeAsDouble", get_fixedUnscaledTimeAsDouble, null); + L.RegVar("unscaledDeltaTime", get_unscaledDeltaTime, null); + L.RegVar("fixedUnscaledDeltaTime", get_fixedUnscaledDeltaTime, null); + L.RegVar("fixedDeltaTime", get_fixedDeltaTime, set_fixedDeltaTime); + L.RegVar("maximumDeltaTime", get_maximumDeltaTime, set_maximumDeltaTime); + L.RegVar("smoothDeltaTime", get_smoothDeltaTime, null); + L.RegVar("maximumParticleDeltaTime", get_maximumParticleDeltaTime, set_maximumParticleDeltaTime); + L.RegVar("timeScale", get_timeScale, set_timeScale); + L.RegVar("frameCount", get_frameCount, null); + L.RegVar("renderedFrameCount", get_renderedFrameCount, null); + L.RegVar("realtimeSinceStartup", get_realtimeSinceStartup, null); + L.RegVar("realtimeSinceStartupAsDouble", get_realtimeSinceStartupAsDouble, null); + L.RegVar("captureDeltaTime", get_captureDeltaTime, set_captureDeltaTime); + L.RegVar("captureFramerate", get_captureFramerate, set_captureFramerate); + L.RegVar("inFixedTimeStep", get_inFixedTimeStep, null); + L.EndStaticLibs(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_time(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.Time.time); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_timeAsDouble(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.Time.timeAsDouble); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_timeSinceLevelLoad(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.Time.timeSinceLevelLoad); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_timeSinceLevelLoadAsDouble(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.Time.timeSinceLevelLoadAsDouble); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_deltaTime(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.Time.deltaTime); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_fixedTime(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.Time.fixedTime); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_fixedTimeAsDouble(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.Time.fixedTimeAsDouble); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_unscaledTime(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.Time.unscaledTime); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_unscaledTimeAsDouble(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.Time.unscaledTimeAsDouble); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_fixedUnscaledTime(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.Time.fixedUnscaledTime); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_fixedUnscaledTimeAsDouble(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.Time.fixedUnscaledTimeAsDouble); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_unscaledDeltaTime(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.Time.unscaledDeltaTime); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_fixedUnscaledDeltaTime(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.Time.fixedUnscaledDeltaTime); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_fixedDeltaTime(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.Time.fixedDeltaTime); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_maximumDeltaTime(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.Time.maximumDeltaTime); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_smoothDeltaTime(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.Time.smoothDeltaTime); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_maximumParticleDeltaTime(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.Time.maximumParticleDeltaTime); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_timeScale(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.Time.timeScale); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_frameCount(IntPtr L) + { + try + { + LuaDLL.lua_pushinteger(L, UnityEngine.Time.frameCount); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_renderedFrameCount(IntPtr L) + { + try + { + LuaDLL.lua_pushinteger(L, UnityEngine.Time.renderedFrameCount); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_realtimeSinceStartup(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.Time.realtimeSinceStartup); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_realtimeSinceStartupAsDouble(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.Time.realtimeSinceStartupAsDouble); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_captureDeltaTime(IntPtr L) + { + try + { + LuaDLL.lua_pushnumber(L, UnityEngine.Time.captureDeltaTime); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_captureFramerate(IntPtr L) + { + try + { + LuaDLL.lua_pushinteger(L, UnityEngine.Time.captureFramerate); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_inFixedTimeStep(IntPtr L) + { + try + { + LuaDLL.lua_pushboolean(L, UnityEngine.Time.inFixedTimeStep); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_fixedDeltaTime(IntPtr L) + { + try + { + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Time.fixedDeltaTime = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_maximumDeltaTime(IntPtr L) + { + try + { + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Time.maximumDeltaTime = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_maximumParticleDeltaTime(IntPtr L) + { + try + { + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Time.maximumParticleDeltaTime = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_timeScale(IntPtr L) + { + try + { + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Time.timeScale = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_captureDeltaTime(IntPtr L) + { + try + { + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Time.captureDeltaTime = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_captureFramerate(IntPtr L) + { + try + { + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Time.captureFramerate = arg0; + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_TimeWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_TimeWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..24e16bc701fabb94ad926beda201a628b1307511 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_TimeWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8bd1ce88d02dfec4fb7f9545170955af +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_TrackedReferenceWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_TrackedReferenceWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..b7801baf60473c19b97e564fc66e9ce0b1b849ba --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_TrackedReferenceWrap.cs @@ -0,0 +1,70 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_TrackedReferenceWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.TrackedReference), typeof(System.Object)); + L.RegFunction("Equals", Equals); + L.RegFunction("GetHashCode", GetHashCode); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.TrackedReference arg0 = (UnityEngine.TrackedReference)ToLua.ToObject(L, 1); + UnityEngine.TrackedReference arg1 = (UnityEngine.TrackedReference)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Equals(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.TrackedReference obj = (UnityEngine.TrackedReference)ToLua.CheckObject(L, 1); + object arg0 = ToLua.ToVarObject(L, 2); + bool o = obj != null ? obj.Equals(arg0) : arg0 == null; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetHashCode(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.TrackedReference obj = (UnityEngine.TrackedReference)ToLua.CheckObject(L, 1); + int o = obj.GetHashCode(); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_TrackedReferenceWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_TrackedReferenceWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..dce588723bc6f1224da80dfd0f7aef7e0d9c53a6 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_TrackedReferenceWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 11ce23dcd0ab5e5409fdb553fcb29053 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_TransformWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_TransformWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..38f6f539229163b5cf6ea35dcfcc87b1a52d8eec --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_TransformWrap.cs @@ -0,0 +1,1307 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_TransformWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.Transform), typeof(UnityEngine.Component)); + L.RegFunction("SetParent", SetParent); + L.RegFunction("SetPositionAndRotation", SetPositionAndRotation); + L.RegFunction("Translate", Translate); + L.RegFunction("Rotate", Rotate); + L.RegFunction("RotateAround", RotateAround); + L.RegFunction("LookAt", LookAt); + L.RegFunction("TransformDirection", TransformDirection); + L.RegFunction("InverseTransformDirection", InverseTransformDirection); + L.RegFunction("TransformVector", TransformVector); + L.RegFunction("InverseTransformVector", InverseTransformVector); + L.RegFunction("TransformPoint", TransformPoint); + L.RegFunction("InverseTransformPoint", InverseTransformPoint); + L.RegFunction("DetachChildren", DetachChildren); + L.RegFunction("SetAsFirstSibling", SetAsFirstSibling); + L.RegFunction("SetAsLastSibling", SetAsLastSibling); + L.RegFunction("SetSiblingIndex", SetSiblingIndex); + L.RegFunction("GetSiblingIndex", GetSiblingIndex); + L.RegFunction("Find", Find); + L.RegFunction("IsChildOf", IsChildOf); + L.RegFunction("GetEnumerator", GetEnumerator); + L.RegFunction("GetChild", GetChild); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("position", get_position, set_position); + L.RegVar("localPosition", get_localPosition, set_localPosition); + L.RegVar("eulerAngles", get_eulerAngles, set_eulerAngles); + L.RegVar("localEulerAngles", get_localEulerAngles, set_localEulerAngles); + L.RegVar("right", get_right, set_right); + L.RegVar("up", get_up, set_up); + L.RegVar("forward", get_forward, set_forward); + L.RegVar("rotation", get_rotation, set_rotation); + L.RegVar("localRotation", get_localRotation, set_localRotation); + L.RegVar("localScale", get_localScale, set_localScale); + L.RegVar("parent", get_parent, set_parent); + L.RegVar("worldToLocalMatrix", get_worldToLocalMatrix, null); + L.RegVar("localToWorldMatrix", get_localToWorldMatrix, null); + L.RegVar("root", get_root, null); + L.RegVar("childCount", get_childCount, null); + L.RegVar("lossyScale", get_lossyScale, null); + L.RegVar("hasChanged", get_hasChanged, set_hasChanged); + L.RegVar("hierarchyCapacity", get_hierarchyCapacity, set_hierarchyCapacity); + L.RegVar("hierarchyCount", get_hierarchyCount, null); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetParent(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.CheckObject(L, 2); + obj.SetParent(arg0); + return 0; + } + else if (count == 3) + { + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.CheckObject(L, 2); + bool arg1 = LuaDLL.luaL_checkboolean(L, 3); + obj.SetParent(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Transform.SetParent"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetPositionAndRotation(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Quaternion arg1 = ToLua.ToQuaternion(L, 3); + obj.SetPositionAndRotation(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Translate(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + obj.Translate(arg0); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 3)) + { + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Space arg1 = (UnityEngine.Space)ToLua.ToObject(L, 3); + obj.Translate(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 3)) + { + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Transform arg1 = (UnityEngine.Transform)ToLua.ToObject(L, 3); + obj.Translate(arg0, arg1); + return 0; + } + else if (count == 4) + { + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + obj.Translate(arg0, arg1, arg2); + return 0; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 5)) + { + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + UnityEngine.Space arg3 = (UnityEngine.Space)ToLua.ToObject(L, 5); + obj.Translate(arg0, arg1, arg2, arg3); + return 0; + } + else if (count == 5 && TypeChecker.CheckTypes(L, 5)) + { + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + UnityEngine.Transform arg3 = (UnityEngine.Transform)ToLua.ToObject(L, 5); + obj.Translate(arg0, arg1, arg2, arg3); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Transform.Translate"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Rotate(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + obj.Rotate(arg0); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 3)) + { + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Space arg1 = (UnityEngine.Space)ToLua.ToObject(L, 3); + obj.Rotate(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 3)) + { + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + float arg1 = (float)LuaDLL.lua_tonumber(L, 3); + obj.Rotate(arg0, arg1); + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.lua_tonumber(L, 2); + float arg1 = (float)LuaDLL.lua_tonumber(L, 3); + float arg2 = (float)LuaDLL.lua_tonumber(L, 4); + obj.Rotate(arg0, arg1, arg2); + return 0; + } + else if (count == 4 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + float arg1 = (float)LuaDLL.lua_tonumber(L, 3); + UnityEngine.Space arg2 = (UnityEngine.Space)ToLua.ToObject(L, 4); + obj.Rotate(arg0, arg1, arg2); + return 0; + } + else if (count == 5) + { + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + UnityEngine.Space arg3 = (UnityEngine.Space)ToLua.CheckObject(L, 5, typeof(UnityEngine.Space)); + obj.Rotate(arg0, arg1, arg2, arg3); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Transform.Rotate"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int RotateAround(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 4); + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 3); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + obj.RotateAround(arg0, arg1, arg2); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LookAt(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.ToObject(L, 2); + obj.LookAt(arg0); + return 0; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + obj.LookAt(arg0); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.ToObject(L, 2); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 3); + obj.LookAt(arg0, arg1); + return 0; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 3); + obj.LookAt(arg0, arg1); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Transform.LookAt"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TransformDirection(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 o = obj.TransformDirection(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 4) + { + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + UnityEngine.Vector3 o = obj.TransformDirection(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Transform.TransformDirection"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int InverseTransformDirection(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 o = obj.InverseTransformDirection(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 4) + { + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + UnityEngine.Vector3 o = obj.InverseTransformDirection(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Transform.InverseTransformDirection"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TransformVector(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 o = obj.TransformVector(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 4) + { + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + UnityEngine.Vector3 o = obj.TransformVector(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Transform.TransformVector"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int InverseTransformVector(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 o = obj.InverseTransformVector(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 4) + { + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + UnityEngine.Vector3 o = obj.InverseTransformVector(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Transform.InverseTransformVector"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int TransformPoint(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 o = obj.TransformPoint(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 4) + { + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + UnityEngine.Vector3 o = obj.TransformPoint(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Transform.TransformPoint"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int InverseTransformPoint(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2) + { + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.Vector3 o = obj.InverseTransformPoint(arg0); + ToLua.Push(L, o); + return 1; + } + else if (count == 4) + { + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + float arg2 = (float)LuaDLL.luaL_checknumber(L, 4); + UnityEngine.Vector3 o = obj.InverseTransformPoint(arg0, arg1, arg2); + ToLua.Push(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Transform.InverseTransformPoint"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int DetachChildren(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + obj.DetachChildren(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetAsFirstSibling(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + obj.SetAsFirstSibling(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetAsLastSibling(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + obj.SetAsLastSibling(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetSiblingIndex(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.SetSiblingIndex(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetSiblingIndex(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + int o = obj.GetSiblingIndex(); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Find(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + UnityEngine.Transform o = obj.Find(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IsChildOf(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.CheckObject(L, 2); + bool o = obj.IsChildOf(arg0); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetEnumerator(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + System.Collections.IEnumerator o = obj.GetEnumerator(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetChild(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Transform obj = (UnityEngine.Transform)ToLua.CheckObject(L, 1); + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + UnityEngine.Transform o = obj.GetChild(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_position(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + UnityEngine.Vector3 ret = obj.position; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index position on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_localPosition(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + UnityEngine.Vector3 ret = obj.localPosition; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index localPosition on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_eulerAngles(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + UnityEngine.Vector3 ret = obj.eulerAngles; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index eulerAngles on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_localEulerAngles(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + UnityEngine.Vector3 ret = obj.localEulerAngles; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index localEulerAngles on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_right(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + UnityEngine.Vector3 ret = obj.right; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index right on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_up(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + UnityEngine.Vector3 ret = obj.up; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index up on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_forward(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + UnityEngine.Vector3 ret = obj.forward; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index forward on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_rotation(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + UnityEngine.Quaternion ret = obj.rotation; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index rotation on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_localRotation(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + UnityEngine.Quaternion ret = obj.localRotation; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index localRotation on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_localScale(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + UnityEngine.Vector3 ret = obj.localScale; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index localScale on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_parent(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + UnityEngine.Transform ret = obj.parent; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index parent on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_worldToLocalMatrix(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + UnityEngine.Matrix4x4 ret = obj.worldToLocalMatrix; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index worldToLocalMatrix on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_localToWorldMatrix(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + UnityEngine.Matrix4x4 ret = obj.localToWorldMatrix; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index localToWorldMatrix on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_root(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + UnityEngine.Transform ret = obj.root; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index root on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_childCount(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + int ret = obj.childCount; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index childCount on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_lossyScale(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + UnityEngine.Vector3 ret = obj.lossyScale; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index lossyScale on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_hasChanged(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + bool ret = obj.hasChanged; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index hasChanged on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_hierarchyCapacity(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + int ret = obj.hierarchyCapacity; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index hierarchyCapacity on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_hierarchyCount(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + int ret = obj.hierarchyCount; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index hierarchyCount on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_position(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + obj.position = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index position on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_localPosition(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + obj.localPosition = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index localPosition on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_eulerAngles(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + obj.eulerAngles = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index eulerAngles on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_localEulerAngles(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + obj.localEulerAngles = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index localEulerAngles on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_right(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + obj.right = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index right on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_up(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + obj.up = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index up on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_forward(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + obj.forward = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index forward on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_rotation(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + UnityEngine.Quaternion arg0 = ToLua.ToQuaternion(L, 2); + obj.rotation = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index rotation on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_localRotation(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + UnityEngine.Quaternion arg0 = ToLua.ToQuaternion(L, 2); + obj.localRotation = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index localRotation on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_localScale(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + obj.localScale = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index localScale on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_parent(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.CheckObject(L, 2); + obj.parent = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index parent on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_hasChanged(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.hasChanged = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index hasChanged on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_hierarchyCapacity(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.Transform obj = (UnityEngine.Transform)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.hierarchyCapacity = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index hierarchyCapacity on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_TransformWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_TransformWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..fff4964e2aca49dac88f9a1c8116cb96d2cfc02c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_TransformWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 89eddd3403082234e930b7b17f2beda1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_ButtonWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_ButtonWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..7dbdd42ea25b28e4854151b77f451b40e7b41df5 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_ButtonWrap.cs @@ -0,0 +1,108 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_UI_ButtonWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.UI.Button), typeof(UnityEngine.UI.Selectable)); + L.RegFunction("OnPointerClick", OnPointerClick); + L.RegFunction("OnSubmit", OnSubmit); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("onClick", get_onClick, set_onClick); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OnPointerClick(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.Button obj = (UnityEngine.UI.Button)ToLua.CheckObject(L, 1); + UnityEngine.EventSystems.PointerEventData arg0 = (UnityEngine.EventSystems.PointerEventData)ToLua.CheckObject(L, 2); + obj.OnPointerClick(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OnSubmit(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.Button obj = (UnityEngine.UI.Button)ToLua.CheckObject(L, 1); + UnityEngine.EventSystems.BaseEventData arg0 = (UnityEngine.EventSystems.BaseEventData)ToLua.CheckObject(L, 2); + obj.OnSubmit(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_onClick(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Button obj = (UnityEngine.UI.Button)o; + UnityEngine.UI.Button.ButtonClickedEvent ret = obj.onClick; + ToLua.PushObject(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index onClick on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_onClick(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Button obj = (UnityEngine.UI.Button)o; + UnityEngine.UI.Button.ButtonClickedEvent arg0 = (UnityEngine.UI.Button.ButtonClickedEvent)ToLua.CheckObject(L, 2); + obj.onClick = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index onClick on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_ButtonWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_ButtonWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..c2733812aaeaf97bd32ce9da6712911411c91698 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_ButtonWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 989f022a2a4fb944daea581e4e36a7d8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_GraphicWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_GraphicWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..42b42e6c6c3c01e1059b736c74a9c3e6e29877d2 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_GraphicWrap.cs @@ -0,0 +1,723 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_UI_GraphicWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.UI.Graphic), typeof(UnityEngine.EventSystems.UIBehaviour)); + L.RegFunction("SetAllDirty", SetAllDirty); + L.RegFunction("SetLayoutDirty", SetLayoutDirty); + L.RegFunction("SetVerticesDirty", SetVerticesDirty); + L.RegFunction("SetMaterialDirty", SetMaterialDirty); + L.RegFunction("OnCullingChanged", OnCullingChanged); + L.RegFunction("Rebuild", Rebuild); + L.RegFunction("LayoutComplete", LayoutComplete); + L.RegFunction("GraphicUpdateComplete", GraphicUpdateComplete); + L.RegFunction("SetNativeSize", SetNativeSize); + L.RegFunction("Raycast", Raycast); + L.RegFunction("PixelAdjustPoint", PixelAdjustPoint); + L.RegFunction("GetPixelAdjustedRect", GetPixelAdjustedRect); + L.RegFunction("CrossFadeColor", CrossFadeColor); + L.RegFunction("CrossFadeAlpha", CrossFadeAlpha); + L.RegFunction("RegisterDirtyLayoutCallback", RegisterDirtyLayoutCallback); + L.RegFunction("UnregisterDirtyLayoutCallback", UnregisterDirtyLayoutCallback); + L.RegFunction("RegisterDirtyVerticesCallback", RegisterDirtyVerticesCallback); + L.RegFunction("UnregisterDirtyVerticesCallback", UnregisterDirtyVerticesCallback); + L.RegFunction("RegisterDirtyMaterialCallback", RegisterDirtyMaterialCallback); + L.RegFunction("UnregisterDirtyMaterialCallback", UnregisterDirtyMaterialCallback); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("defaultGraphicMaterial", get_defaultGraphicMaterial, null); + L.RegVar("color", get_color, set_color); + L.RegVar("raycastTarget", get_raycastTarget, set_raycastTarget); + L.RegVar("raycastPadding", get_raycastPadding, set_raycastPadding); + L.RegVar("depth", get_depth, null); + L.RegVar("rectTransform", get_rectTransform, null); + L.RegVar("canvas", get_canvas, null); + L.RegVar("canvasRenderer", get_canvasRenderer, null); + L.RegVar("defaultMaterial", get_defaultMaterial, null); + L.RegVar("material", get_material, set_material); + L.RegVar("materialForRendering", get_materialForRendering, null); + L.RegVar("mainTexture", get_mainTexture, null); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetAllDirty(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)ToLua.CheckObject(L, 1); + obj.SetAllDirty(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetLayoutDirty(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)ToLua.CheckObject(L, 1); + obj.SetLayoutDirty(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetVerticesDirty(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)ToLua.CheckObject(L, 1); + obj.SetVerticesDirty(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetMaterialDirty(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)ToLua.CheckObject(L, 1); + obj.SetMaterialDirty(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OnCullingChanged(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)ToLua.CheckObject(L, 1); + obj.OnCullingChanged(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Rebuild(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)ToLua.CheckObject(L, 1); + UnityEngine.UI.CanvasUpdate arg0 = (UnityEngine.UI.CanvasUpdate)ToLua.CheckObject(L, 2, typeof(UnityEngine.UI.CanvasUpdate)); + obj.Rebuild(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LayoutComplete(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)ToLua.CheckObject(L, 1); + obj.LayoutComplete(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GraphicUpdateComplete(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)ToLua.CheckObject(L, 1); + obj.GraphicUpdateComplete(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetNativeSize(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)ToLua.CheckObject(L, 1); + obj.SetNativeSize(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Raycast(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)ToLua.CheckObject(L, 1); + UnityEngine.Vector2 arg0 = ToLua.ToVector2(L, 2); + UnityEngine.Camera arg1 = (UnityEngine.Camera)ToLua.CheckObject(L, 3, typeof(UnityEngine.Camera)); + bool o = obj.Raycast(arg0, arg1); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int PixelAdjustPoint(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)ToLua.CheckObject(L, 1); + UnityEngine.Vector2 arg0 = ToLua.ToVector2(L, 2); + UnityEngine.Vector2 o = obj.PixelAdjustPoint(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetPixelAdjustedRect(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)ToLua.CheckObject(L, 1); + UnityEngine.Rect o = obj.GetPixelAdjustedRect(); + ToLua.PushValue(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CrossFadeColor(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 5) + { + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)ToLua.CheckObject(L, 1); + UnityEngine.Color arg0 = ToLua.ToColor(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + bool arg2 = LuaDLL.luaL_checkboolean(L, 4); + bool arg3 = LuaDLL.luaL_checkboolean(L, 5); + obj.CrossFadeColor(arg0, arg1, arg2, arg3); + return 0; + } + else if (count == 6) + { + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)ToLua.CheckObject(L, 1); + UnityEngine.Color arg0 = ToLua.ToColor(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + bool arg2 = LuaDLL.luaL_checkboolean(L, 4); + bool arg3 = LuaDLL.luaL_checkboolean(L, 5); + bool arg4 = LuaDLL.luaL_checkboolean(L, 6); + obj.CrossFadeColor(arg0, arg1, arg2, arg3, arg4); + return 0; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.UI.Graphic.CrossFadeColor"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CrossFadeAlpha(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 4); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)ToLua.CheckObject(L, 1); + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); + bool arg2 = LuaDLL.luaL_checkboolean(L, 4); + obj.CrossFadeAlpha(arg0, arg1, arg2); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int RegisterDirtyLayoutCallback(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)ToLua.CheckObject(L, 1); + UnityEngine.Events.UnityAction arg0 = (UnityEngine.Events.UnityAction)ToLua.CheckDelegate(L, 2); + obj.RegisterDirtyLayoutCallback(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int UnregisterDirtyLayoutCallback(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)ToLua.CheckObject(L, 1); + UnityEngine.Events.UnityAction arg0 = (UnityEngine.Events.UnityAction)ToLua.CheckDelegate(L, 2); + obj.UnregisterDirtyLayoutCallback(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int RegisterDirtyVerticesCallback(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)ToLua.CheckObject(L, 1); + UnityEngine.Events.UnityAction arg0 = (UnityEngine.Events.UnityAction)ToLua.CheckDelegate(L, 2); + obj.RegisterDirtyVerticesCallback(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int UnregisterDirtyVerticesCallback(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)ToLua.CheckObject(L, 1); + UnityEngine.Events.UnityAction arg0 = (UnityEngine.Events.UnityAction)ToLua.CheckDelegate(L, 2); + obj.UnregisterDirtyVerticesCallback(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int RegisterDirtyMaterialCallback(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)ToLua.CheckObject(L, 1); + UnityEngine.Events.UnityAction arg0 = (UnityEngine.Events.UnityAction)ToLua.CheckDelegate(L, 2); + obj.RegisterDirtyMaterialCallback(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int UnregisterDirtyMaterialCallback(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)ToLua.CheckObject(L, 1); + UnityEngine.Events.UnityAction arg0 = (UnityEngine.Events.UnityAction)ToLua.CheckDelegate(L, 2); + obj.UnregisterDirtyMaterialCallback(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_defaultGraphicMaterial(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.UI.Graphic.defaultGraphicMaterial); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_color(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)o; + UnityEngine.Color ret = obj.color; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index color on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_raycastTarget(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)o; + bool ret = obj.raycastTarget; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index raycastTarget on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_raycastPadding(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)o; + UnityEngine.Vector4 ret = obj.raycastPadding; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index raycastPadding on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_depth(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)o; + int ret = obj.depth; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index depth on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_rectTransform(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)o; + UnityEngine.RectTransform ret = obj.rectTransform; + ToLua.PushSealed(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index rectTransform on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_canvas(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)o; + UnityEngine.Canvas ret = obj.canvas; + ToLua.PushSealed(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index canvas on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_canvasRenderer(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)o; + UnityEngine.CanvasRenderer ret = obj.canvasRenderer; + ToLua.PushSealed(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index canvasRenderer on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_defaultMaterial(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)o; + UnityEngine.Material ret = obj.defaultMaterial; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index defaultMaterial on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_material(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)o; + UnityEngine.Material ret = obj.material; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index material on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_materialForRendering(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)o; + UnityEngine.Material ret = obj.materialForRendering; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index materialForRendering on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_mainTexture(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)o; + UnityEngine.Texture ret = obj.mainTexture; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index mainTexture on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_color(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)o; + UnityEngine.Color arg0 = ToLua.ToColor(L, 2); + obj.color = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index color on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_raycastTarget(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.raycastTarget = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index raycastTarget on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_raycastPadding(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)o; + UnityEngine.Vector4 arg0 = ToLua.ToVector4(L, 2); + obj.raycastPadding = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index raycastPadding on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_material(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)o; + UnityEngine.Material arg0 = (UnityEngine.Material)ToLua.CheckObject(L, 2); + obj.material = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index material on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_GraphicWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_GraphicWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..0039e5aec6979e751a89899ab6c5a70180218782 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_GraphicWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7deb1240d5a1eeb478a4a4121be32d66 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_ImageWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_ImageWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..42ee425bdc64c39dab13ab379bb3bdc440392734 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_ImageWrap.cs @@ -0,0 +1,877 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_UI_ImageWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.UI.Image), typeof(UnityEngine.UI.MaskableGraphic)); + L.RegFunction("DisableSpriteOptimizations", DisableSpriteOptimizations); + L.RegFunction("OnBeforeSerialize", OnBeforeSerialize); + L.RegFunction("OnAfterDeserialize", OnAfterDeserialize); + L.RegFunction("SetNativeSize", SetNativeSize); + L.RegFunction("CalculateLayoutInputHorizontal", CalculateLayoutInputHorizontal); + L.RegFunction("CalculateLayoutInputVertical", CalculateLayoutInputVertical); + L.RegFunction("IsRaycastLocationValid", IsRaycastLocationValid); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("sprite", get_sprite, set_sprite); + L.RegVar("overrideSprite", get_overrideSprite, set_overrideSprite); + L.RegVar("type", get_type, set_type); + L.RegVar("preserveAspect", get_preserveAspect, set_preserveAspect); + L.RegVar("fillCenter", get_fillCenter, set_fillCenter); + L.RegVar("fillMethod", get_fillMethod, set_fillMethod); + L.RegVar("fillAmount", get_fillAmount, set_fillAmount); + L.RegVar("fillClockwise", get_fillClockwise, set_fillClockwise); + L.RegVar("fillOrigin", get_fillOrigin, set_fillOrigin); + L.RegVar("alphaHitTestMinimumThreshold", get_alphaHitTestMinimumThreshold, set_alphaHitTestMinimumThreshold); + L.RegVar("useSpriteMesh", get_useSpriteMesh, set_useSpriteMesh); + L.RegVar("defaultETC1GraphicMaterial", get_defaultETC1GraphicMaterial, null); + L.RegVar("mainTexture", get_mainTexture, null); + L.RegVar("hasBorder", get_hasBorder, null); + L.RegVar("pixelsPerUnitMultiplier", get_pixelsPerUnitMultiplier, set_pixelsPerUnitMultiplier); + L.RegVar("pixelsPerUnit", get_pixelsPerUnit, null); + L.RegVar("material", get_material, set_material); + L.RegVar("minWidth", get_minWidth, null); + L.RegVar("preferredWidth", get_preferredWidth, null); + L.RegVar("flexibleWidth", get_flexibleWidth, null); + L.RegVar("minHeight", get_minHeight, null); + L.RegVar("preferredHeight", get_preferredHeight, null); + L.RegVar("flexibleHeight", get_flexibleHeight, null); + L.RegVar("layoutPriority", get_layoutPriority, null); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int DisableSpriteOptimizations(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)ToLua.CheckObject(L, 1); + obj.DisableSpriteOptimizations(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OnBeforeSerialize(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)ToLua.CheckObject(L, 1); + obj.OnBeforeSerialize(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OnAfterDeserialize(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)ToLua.CheckObject(L, 1); + obj.OnAfterDeserialize(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetNativeSize(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)ToLua.CheckObject(L, 1); + obj.SetNativeSize(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CalculateLayoutInputHorizontal(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)ToLua.CheckObject(L, 1); + obj.CalculateLayoutInputHorizontal(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CalculateLayoutInputVertical(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)ToLua.CheckObject(L, 1); + obj.CalculateLayoutInputVertical(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IsRaycastLocationValid(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)ToLua.CheckObject(L, 1); + UnityEngine.Vector2 arg0 = ToLua.ToVector2(L, 2); + UnityEngine.Camera arg1 = (UnityEngine.Camera)ToLua.CheckObject(L, 3, typeof(UnityEngine.Camera)); + bool o = obj.IsRaycastLocationValid(arg0, arg1); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_sprite(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + UnityEngine.Sprite ret = obj.sprite; + ToLua.PushSealed(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index sprite on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_overrideSprite(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + UnityEngine.Sprite ret = obj.overrideSprite; + ToLua.PushSealed(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index overrideSprite on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_type(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + UnityEngine.UI.Image.Type ret = obj.type; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index type on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_preserveAspect(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + bool ret = obj.preserveAspect; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index preserveAspect on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_fillCenter(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + bool ret = obj.fillCenter; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index fillCenter on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_fillMethod(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + UnityEngine.UI.Image.FillMethod ret = obj.fillMethod; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index fillMethod on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_fillAmount(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + float ret = obj.fillAmount; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index fillAmount on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_fillClockwise(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + bool ret = obj.fillClockwise; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index fillClockwise on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_fillOrigin(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + int ret = obj.fillOrigin; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index fillOrigin on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_alphaHitTestMinimumThreshold(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + float ret = obj.alphaHitTestMinimumThreshold; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index alphaHitTestMinimumThreshold on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_useSpriteMesh(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + bool ret = obj.useSpriteMesh; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index useSpriteMesh on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_defaultETC1GraphicMaterial(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.UI.Image.defaultETC1GraphicMaterial); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_mainTexture(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + UnityEngine.Texture ret = obj.mainTexture; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index mainTexture on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_hasBorder(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + bool ret = obj.hasBorder; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index hasBorder on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_pixelsPerUnitMultiplier(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + float ret = obj.pixelsPerUnitMultiplier; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index pixelsPerUnitMultiplier on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_pixelsPerUnit(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + float ret = obj.pixelsPerUnit; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index pixelsPerUnit on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_material(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + UnityEngine.Material ret = obj.material; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index material on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_minWidth(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + float ret = obj.minWidth; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index minWidth on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_preferredWidth(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + float ret = obj.preferredWidth; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index preferredWidth on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_flexibleWidth(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + float ret = obj.flexibleWidth; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index flexibleWidth on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_minHeight(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + float ret = obj.minHeight; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index minHeight on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_preferredHeight(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + float ret = obj.preferredHeight; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index preferredHeight on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_flexibleHeight(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + float ret = obj.flexibleHeight; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index flexibleHeight on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_layoutPriority(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + int ret = obj.layoutPriority; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index layoutPriority on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_sprite(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + UnityEngine.Sprite arg0 = (UnityEngine.Sprite)ToLua.CheckObject(L, 2, typeof(UnityEngine.Sprite)); + obj.sprite = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index sprite on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_overrideSprite(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + UnityEngine.Sprite arg0 = (UnityEngine.Sprite)ToLua.CheckObject(L, 2, typeof(UnityEngine.Sprite)); + obj.overrideSprite = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index overrideSprite on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_type(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + UnityEngine.UI.Image.Type arg0 = (UnityEngine.UI.Image.Type)ToLua.CheckObject(L, 2, typeof(UnityEngine.UI.Image.Type)); + obj.type = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index type on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_preserveAspect(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.preserveAspect = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index preserveAspect on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_fillCenter(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.fillCenter = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index fillCenter on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_fillMethod(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + UnityEngine.UI.Image.FillMethod arg0 = (UnityEngine.UI.Image.FillMethod)ToLua.CheckObject(L, 2, typeof(UnityEngine.UI.Image.FillMethod)); + obj.fillMethod = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index fillMethod on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_fillAmount(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.fillAmount = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index fillAmount on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_fillClockwise(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.fillClockwise = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index fillClockwise on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_fillOrigin(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.fillOrigin = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index fillOrigin on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_alphaHitTestMinimumThreshold(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.alphaHitTestMinimumThreshold = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index alphaHitTestMinimumThreshold on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_useSpriteMesh(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.useSpriteMesh = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index useSpriteMesh on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_pixelsPerUnitMultiplier(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.pixelsPerUnitMultiplier = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index pixelsPerUnitMultiplier on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_material(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Image obj = (UnityEngine.UI.Image)o; + UnityEngine.Material arg0 = (UnityEngine.Material)ToLua.CheckObject(L, 2); + obj.material = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index material on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_ImageWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_ImageWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..d2ebac9c663744e465b56a9357db5b996dda2aeb --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_ImageWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a0632488ca31e6a489a2c530eae65c3e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_MaskableGraphicWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_MaskableGraphicWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..22bb40965f577d36e5eda9846ceecfdc45fb6ee0 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_MaskableGraphicWrap.cs @@ -0,0 +1,259 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_UI_MaskableGraphicWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.UI.MaskableGraphic), typeof(UnityEngine.UI.Graphic)); + L.RegFunction("GetModifiedMaterial", GetModifiedMaterial); + L.RegFunction("Cull", Cull); + L.RegFunction("SetClipRect", SetClipRect); + L.RegFunction("SetClipSoftness", SetClipSoftness); + L.RegFunction("RecalculateClipping", RecalculateClipping); + L.RegFunction("RecalculateMasking", RecalculateMasking); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("onCullStateChanged", get_onCullStateChanged, set_onCullStateChanged); + L.RegVar("maskable", get_maskable, set_maskable); + L.RegVar("isMaskingGraphic", get_isMaskingGraphic, set_isMaskingGraphic); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetModifiedMaterial(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.MaskableGraphic obj = (UnityEngine.UI.MaskableGraphic)ToLua.CheckObject(L, 1); + UnityEngine.Material arg0 = (UnityEngine.Material)ToLua.CheckObject(L, 2); + UnityEngine.Material o = obj.GetModifiedMaterial(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Cull(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.UI.MaskableGraphic obj = (UnityEngine.UI.MaskableGraphic)ToLua.CheckObject(L, 1); + UnityEngine.Rect arg0 = StackTraits.Check(L, 2); + bool arg1 = LuaDLL.luaL_checkboolean(L, 3); + obj.Cull(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetClipRect(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + UnityEngine.UI.MaskableGraphic obj = (UnityEngine.UI.MaskableGraphic)ToLua.CheckObject(L, 1); + UnityEngine.Rect arg0 = StackTraits.Check(L, 2); + bool arg1 = LuaDLL.luaL_checkboolean(L, 3); + obj.SetClipRect(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetClipSoftness(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.MaskableGraphic obj = (UnityEngine.UI.MaskableGraphic)ToLua.CheckObject(L, 1); + UnityEngine.Vector2 arg0 = ToLua.ToVector2(L, 2); + obj.SetClipSoftness(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int RecalculateClipping(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.MaskableGraphic obj = (UnityEngine.UI.MaskableGraphic)ToLua.CheckObject(L, 1); + obj.RecalculateClipping(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int RecalculateMasking(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.MaskableGraphic obj = (UnityEngine.UI.MaskableGraphic)ToLua.CheckObject(L, 1); + obj.RecalculateMasking(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_onCullStateChanged(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.MaskableGraphic obj = (UnityEngine.UI.MaskableGraphic)o; + UnityEngine.UI.MaskableGraphic.CullStateChangedEvent ret = obj.onCullStateChanged; + ToLua.PushObject(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index onCullStateChanged on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_maskable(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.MaskableGraphic obj = (UnityEngine.UI.MaskableGraphic)o; + bool ret = obj.maskable; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index maskable on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isMaskingGraphic(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.MaskableGraphic obj = (UnityEngine.UI.MaskableGraphic)o; + bool ret = obj.isMaskingGraphic; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isMaskingGraphic on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_onCullStateChanged(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.MaskableGraphic obj = (UnityEngine.UI.MaskableGraphic)o; + UnityEngine.UI.MaskableGraphic.CullStateChangedEvent arg0 = (UnityEngine.UI.MaskableGraphic.CullStateChangedEvent)ToLua.CheckObject(L, 2); + obj.onCullStateChanged = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index onCullStateChanged on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_maskable(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.MaskableGraphic obj = (UnityEngine.UI.MaskableGraphic)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.maskable = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index maskable on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_isMaskingGraphic(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.MaskableGraphic obj = (UnityEngine.UI.MaskableGraphic)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.isMaskingGraphic = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isMaskingGraphic on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_MaskableGraphicWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_MaskableGraphicWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..63a365d8b93491bf12fef1006260aed686e7749c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_MaskableGraphicWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4b91e3b8a2864a146969f74806b159d6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_RawImageWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_RawImageWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..e9bdcd410cfa11ec78740110f5c88886291bc5a9 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_RawImageWrap.cs @@ -0,0 +1,148 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_UI_RawImageWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.UI.RawImage), typeof(UnityEngine.UI.MaskableGraphic)); + L.RegFunction("SetNativeSize", SetNativeSize); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("mainTexture", get_mainTexture, null); + L.RegVar("texture", get_texture, set_texture); + L.RegVar("uvRect", get_uvRect, set_uvRect); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetNativeSize(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.RawImage obj = (UnityEngine.UI.RawImage)ToLua.CheckObject(L, 1); + obj.SetNativeSize(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_mainTexture(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.RawImage obj = (UnityEngine.UI.RawImage)o; + UnityEngine.Texture ret = obj.mainTexture; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index mainTexture on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_texture(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.RawImage obj = (UnityEngine.UI.RawImage)o; + UnityEngine.Texture ret = obj.texture; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index texture on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_uvRect(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.RawImage obj = (UnityEngine.UI.RawImage)o; + UnityEngine.Rect ret = obj.uvRect; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index uvRect on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_texture(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.RawImage obj = (UnityEngine.UI.RawImage)o; + UnityEngine.Texture arg0 = (UnityEngine.Texture)ToLua.CheckObject(L, 2); + obj.texture = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index texture on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_uvRect(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.RawImage obj = (UnityEngine.UI.RawImage)o; + UnityEngine.Rect arg0 = StackTraits.Check(L, 2); + obj.uvRect = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index uvRect on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_RawImageWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_RawImageWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..3be888bd2981ffce963b8362a2ac7d5524d99192 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_RawImageWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: db4360e1ef16c5341ace52de698425a3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_SelectableWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_SelectableWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..ac7a16e8e2e69a247d172ff74c72ffe0789cec3d --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_SelectableWrap.cs @@ -0,0 +1,665 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_UI_SelectableWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.UI.Selectable), typeof(UnityEngine.EventSystems.UIBehaviour)); + L.RegFunction("AllSelectablesNoAlloc", AllSelectablesNoAlloc); + L.RegFunction("IsInteractable", IsInteractable); + L.RegFunction("FindSelectable", FindSelectable); + L.RegFunction("FindSelectableOnLeft", FindSelectableOnLeft); + L.RegFunction("FindSelectableOnRight", FindSelectableOnRight); + L.RegFunction("FindSelectableOnUp", FindSelectableOnUp); + L.RegFunction("FindSelectableOnDown", FindSelectableOnDown); + L.RegFunction("OnMove", OnMove); + L.RegFunction("OnPointerDown", OnPointerDown); + L.RegFunction("OnPointerUp", OnPointerUp); + L.RegFunction("OnPointerEnter", OnPointerEnter); + L.RegFunction("OnPointerExit", OnPointerExit); + L.RegFunction("OnSelect", OnSelect); + L.RegFunction("OnDeselect", OnDeselect); + L.RegFunction("Select", Select); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("allSelectablesArray", get_allSelectablesArray, null); + L.RegVar("allSelectableCount", get_allSelectableCount, null); + L.RegVar("navigation", get_navigation, set_navigation); + L.RegVar("transition", get_transition, set_transition); + L.RegVar("colors", get_colors, set_colors); + L.RegVar("spriteState", get_spriteState, set_spriteState); + L.RegVar("animationTriggers", get_animationTriggers, set_animationTriggers); + L.RegVar("targetGraphic", get_targetGraphic, set_targetGraphic); + L.RegVar("interactable", get_interactable, set_interactable); + L.RegVar("image", get_image, set_image); + L.RegVar("animator", get_animator, null); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int AllSelectablesNoAlloc(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.Selectable[] arg0 = ToLua.CheckObjectArray(L, 1); + int o = UnityEngine.UI.Selectable.AllSelectablesNoAlloc(arg0); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IsInteractable(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)ToLua.CheckObject(L, 1); + bool o = obj.IsInteractable(); + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int FindSelectable(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)ToLua.CheckObject(L, 1); + UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); + UnityEngine.UI.Selectable o = obj.FindSelectable(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int FindSelectableOnLeft(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)ToLua.CheckObject(L, 1); + UnityEngine.UI.Selectable o = obj.FindSelectableOnLeft(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int FindSelectableOnRight(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)ToLua.CheckObject(L, 1); + UnityEngine.UI.Selectable o = obj.FindSelectableOnRight(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int FindSelectableOnUp(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)ToLua.CheckObject(L, 1); + UnityEngine.UI.Selectable o = obj.FindSelectableOnUp(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int FindSelectableOnDown(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)ToLua.CheckObject(L, 1); + UnityEngine.UI.Selectable o = obj.FindSelectableOnDown(); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OnMove(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)ToLua.CheckObject(L, 1); + UnityEngine.EventSystems.AxisEventData arg0 = (UnityEngine.EventSystems.AxisEventData)ToLua.CheckObject(L, 2); + obj.OnMove(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OnPointerDown(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)ToLua.CheckObject(L, 1); + UnityEngine.EventSystems.PointerEventData arg0 = (UnityEngine.EventSystems.PointerEventData)ToLua.CheckObject(L, 2); + obj.OnPointerDown(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OnPointerUp(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)ToLua.CheckObject(L, 1); + UnityEngine.EventSystems.PointerEventData arg0 = (UnityEngine.EventSystems.PointerEventData)ToLua.CheckObject(L, 2); + obj.OnPointerUp(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OnPointerEnter(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)ToLua.CheckObject(L, 1); + UnityEngine.EventSystems.PointerEventData arg0 = (UnityEngine.EventSystems.PointerEventData)ToLua.CheckObject(L, 2); + obj.OnPointerEnter(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OnPointerExit(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)ToLua.CheckObject(L, 1); + UnityEngine.EventSystems.PointerEventData arg0 = (UnityEngine.EventSystems.PointerEventData)ToLua.CheckObject(L, 2); + obj.OnPointerExit(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OnSelect(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)ToLua.CheckObject(L, 1); + UnityEngine.EventSystems.BaseEventData arg0 = (UnityEngine.EventSystems.BaseEventData)ToLua.CheckObject(L, 2); + obj.OnSelect(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OnDeselect(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)ToLua.CheckObject(L, 1); + UnityEngine.EventSystems.BaseEventData arg0 = (UnityEngine.EventSystems.BaseEventData)ToLua.CheckObject(L, 2); + obj.OnDeselect(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Select(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)ToLua.CheckObject(L, 1); + obj.Select(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_allSelectablesArray(IntPtr L) + { + try + { + ToLua.Push(L, UnityEngine.UI.Selectable.allSelectablesArray); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_allSelectableCount(IntPtr L) + { + try + { + LuaDLL.lua_pushinteger(L, UnityEngine.UI.Selectable.allSelectableCount); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_navigation(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)o; + UnityEngine.UI.Navigation ret = obj.navigation; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index navigation on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_transition(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)o; + UnityEngine.UI.Selectable.Transition ret = obj.transition; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index transition on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_colors(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)o; + UnityEngine.UI.ColorBlock ret = obj.colors; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index colors on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_spriteState(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)o; + UnityEngine.UI.SpriteState ret = obj.spriteState; + ToLua.PushValue(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index spriteState on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_animationTriggers(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)o; + UnityEngine.UI.AnimationTriggers ret = obj.animationTriggers; + ToLua.PushObject(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index animationTriggers on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_targetGraphic(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)o; + UnityEngine.UI.Graphic ret = obj.targetGraphic; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index targetGraphic on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_interactable(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)o; + bool ret = obj.interactable; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index interactable on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_image(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)o; + UnityEngine.UI.Image ret = obj.image; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index image on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_animator(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)o; + UnityEngine.Animator ret = obj.animator; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index animator on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_navigation(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)o; + UnityEngine.UI.Navigation arg0 = StackTraits.Check(L, 2); + obj.navigation = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index navigation on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_transition(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)o; + UnityEngine.UI.Selectable.Transition arg0 = (UnityEngine.UI.Selectable.Transition)ToLua.CheckObject(L, 2, typeof(UnityEngine.UI.Selectable.Transition)); + obj.transition = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index transition on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_colors(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)o; + UnityEngine.UI.ColorBlock arg0 = StackTraits.Check(L, 2); + obj.colors = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index colors on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_spriteState(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)o; + UnityEngine.UI.SpriteState arg0 = StackTraits.Check(L, 2); + obj.spriteState = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index spriteState on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_animationTriggers(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)o; + UnityEngine.UI.AnimationTriggers arg0 = (UnityEngine.UI.AnimationTriggers)ToLua.CheckObject(L, 2); + obj.animationTriggers = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index animationTriggers on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_targetGraphic(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)o; + UnityEngine.UI.Graphic arg0 = (UnityEngine.UI.Graphic)ToLua.CheckObject(L, 2); + obj.targetGraphic = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index targetGraphic on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_interactable(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.interactable = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index interactable on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_image(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)o; + UnityEngine.UI.Image arg0 = (UnityEngine.UI.Image)ToLua.CheckObject(L, 2); + obj.image = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index image on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_SelectableWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_SelectableWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..2dc4d0624060dff894b5c3c6deaa04ada017037c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_SelectableWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 221db589424a2dd47986a12ca233cee1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_TextWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_TextWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..630b01102915592bd979576891c68fe906477a8c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_TextWrap.cs @@ -0,0 +1,848 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_UI_TextWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.UI.Text), typeof(UnityEngine.UI.MaskableGraphic)); + L.RegFunction("FontTextureChanged", FontTextureChanged); + L.RegFunction("GetGenerationSettings", GetGenerationSettings); + L.RegFunction("GetTextAnchorPivot", GetTextAnchorPivot); + L.RegFunction("CalculateLayoutInputHorizontal", CalculateLayoutInputHorizontal); + L.RegFunction("CalculateLayoutInputVertical", CalculateLayoutInputVertical); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("cachedTextGenerator", get_cachedTextGenerator, null); + L.RegVar("cachedTextGeneratorForLayout", get_cachedTextGeneratorForLayout, null); + L.RegVar("mainTexture", get_mainTexture, null); + L.RegVar("font", get_font, set_font); + L.RegVar("text", get_text, set_text); + L.RegVar("supportRichText", get_supportRichText, set_supportRichText); + L.RegVar("resizeTextForBestFit", get_resizeTextForBestFit, set_resizeTextForBestFit); + L.RegVar("resizeTextMinSize", get_resizeTextMinSize, set_resizeTextMinSize); + L.RegVar("resizeTextMaxSize", get_resizeTextMaxSize, set_resizeTextMaxSize); + L.RegVar("alignment", get_alignment, set_alignment); + L.RegVar("alignByGeometry", get_alignByGeometry, set_alignByGeometry); + L.RegVar("fontSize", get_fontSize, set_fontSize); + L.RegVar("horizontalOverflow", get_horizontalOverflow, set_horizontalOverflow); + L.RegVar("verticalOverflow", get_verticalOverflow, set_verticalOverflow); + L.RegVar("lineSpacing", get_lineSpacing, set_lineSpacing); + L.RegVar("fontStyle", get_fontStyle, set_fontStyle); + L.RegVar("pixelsPerUnit", get_pixelsPerUnit, null); + L.RegVar("minWidth", get_minWidth, null); + L.RegVar("preferredWidth", get_preferredWidth, null); + L.RegVar("flexibleWidth", get_flexibleWidth, null); + L.RegVar("minHeight", get_minHeight, null); + L.RegVar("preferredHeight", get_preferredHeight, null); + L.RegVar("flexibleHeight", get_flexibleHeight, null); + L.RegVar("layoutPriority", get_layoutPriority, null); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int FontTextureChanged(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)ToLua.CheckObject(L, 1); + obj.FontTextureChanged(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetGenerationSettings(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)ToLua.CheckObject(L, 1); + UnityEngine.Vector2 arg0 = ToLua.ToVector2(L, 2); + UnityEngine.TextGenerationSettings o = obj.GetGenerationSettings(arg0); + ToLua.PushValue(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetTextAnchorPivot(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.TextAnchor arg0 = (UnityEngine.TextAnchor)ToLua.CheckObject(L, 1, typeof(UnityEngine.TextAnchor)); + UnityEngine.Vector2 o = UnityEngine.UI.Text.GetTextAnchorPivot(arg0); + ToLua.Push(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CalculateLayoutInputHorizontal(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)ToLua.CheckObject(L, 1); + obj.CalculateLayoutInputHorizontal(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CalculateLayoutInputVertical(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)ToLua.CheckObject(L, 1); + obj.CalculateLayoutInputVertical(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_cachedTextGenerator(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + UnityEngine.TextGenerator ret = obj.cachedTextGenerator; + ToLua.PushSealed(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index cachedTextGenerator on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_cachedTextGeneratorForLayout(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + UnityEngine.TextGenerator ret = obj.cachedTextGeneratorForLayout; + ToLua.PushSealed(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index cachedTextGeneratorForLayout on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_mainTexture(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + UnityEngine.Texture ret = obj.mainTexture; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index mainTexture on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_font(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + UnityEngine.Font ret = obj.font; + ToLua.PushSealed(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index font on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_text(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + string ret = obj.text; + LuaDLL.lua_pushstring(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index text on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_supportRichText(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + bool ret = obj.supportRichText; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index supportRichText on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_resizeTextForBestFit(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + bool ret = obj.resizeTextForBestFit; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index resizeTextForBestFit on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_resizeTextMinSize(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + int ret = obj.resizeTextMinSize; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index resizeTextMinSize on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_resizeTextMaxSize(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + int ret = obj.resizeTextMaxSize; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index resizeTextMaxSize on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_alignment(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + UnityEngine.TextAnchor ret = obj.alignment; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index alignment on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_alignByGeometry(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + bool ret = obj.alignByGeometry; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index alignByGeometry on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_fontSize(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + int ret = obj.fontSize; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index fontSize on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_horizontalOverflow(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + UnityEngine.HorizontalWrapMode ret = obj.horizontalOverflow; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index horizontalOverflow on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_verticalOverflow(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + UnityEngine.VerticalWrapMode ret = obj.verticalOverflow; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index verticalOverflow on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_lineSpacing(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + float ret = obj.lineSpacing; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index lineSpacing on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_fontStyle(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + UnityEngine.FontStyle ret = obj.fontStyle; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index fontStyle on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_pixelsPerUnit(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + float ret = obj.pixelsPerUnit; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index pixelsPerUnit on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_minWidth(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + float ret = obj.minWidth; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index minWidth on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_preferredWidth(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + float ret = obj.preferredWidth; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index preferredWidth on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_flexibleWidth(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + float ret = obj.flexibleWidth; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index flexibleWidth on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_minHeight(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + float ret = obj.minHeight; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index minHeight on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_preferredHeight(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + float ret = obj.preferredHeight; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index preferredHeight on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_flexibleHeight(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + float ret = obj.flexibleHeight; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index flexibleHeight on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_layoutPriority(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + int ret = obj.layoutPriority; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index layoutPriority on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_font(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + UnityEngine.Font arg0 = (UnityEngine.Font)ToLua.CheckObject(L, 2, typeof(UnityEngine.Font)); + obj.font = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index font on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_text(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + string arg0 = ToLua.CheckString(L, 2); + obj.text = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index text on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_supportRichText(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.supportRichText = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index supportRichText on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_resizeTextForBestFit(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.resizeTextForBestFit = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index resizeTextForBestFit on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_resizeTextMinSize(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.resizeTextMinSize = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index resizeTextMinSize on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_resizeTextMaxSize(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.resizeTextMaxSize = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index resizeTextMaxSize on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_alignment(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + UnityEngine.TextAnchor arg0 = (UnityEngine.TextAnchor)ToLua.CheckObject(L, 2, typeof(UnityEngine.TextAnchor)); + obj.alignment = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index alignment on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_alignByGeometry(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.alignByGeometry = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index alignByGeometry on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_fontSize(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); + obj.fontSize = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index fontSize on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_horizontalOverflow(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + UnityEngine.HorizontalWrapMode arg0 = (UnityEngine.HorizontalWrapMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.HorizontalWrapMode)); + obj.horizontalOverflow = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index horizontalOverflow on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_verticalOverflow(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + UnityEngine.VerticalWrapMode arg0 = (UnityEngine.VerticalWrapMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.VerticalWrapMode)); + obj.verticalOverflow = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index verticalOverflow on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_lineSpacing(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); + obj.lineSpacing = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index lineSpacing on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_fontStyle(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Text obj = (UnityEngine.UI.Text)o; + UnityEngine.FontStyle arg0 = (UnityEngine.FontStyle)ToLua.CheckObject(L, 2, typeof(UnityEngine.FontStyle)); + obj.fontStyle = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index fontStyle on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_TextWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_TextWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..217ebc94524dbbbea2e4e275026f15ecb07bd454 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_TextWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4edce4039dd0cdf498b77eed809fcccb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_ToggleWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_ToggleWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..1e9f7283d669ce49e35ad3fb2214d0b638e5e7ff --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_ToggleWrap.cs @@ -0,0 +1,334 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_UI_ToggleWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.UI.Toggle), typeof(UnityEngine.UI.Selectable)); + L.RegFunction("Rebuild", Rebuild); + L.RegFunction("LayoutComplete", LayoutComplete); + L.RegFunction("GraphicUpdateComplete", GraphicUpdateComplete); + L.RegFunction("SetIsOnWithoutNotify", SetIsOnWithoutNotify); + L.RegFunction("OnPointerClick", OnPointerClick); + L.RegFunction("OnSubmit", OnSubmit); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("toggleTransition", get_toggleTransition, set_toggleTransition); + L.RegVar("graphic", get_graphic, set_graphic); + L.RegVar("onValueChanged", get_onValueChanged, set_onValueChanged); + L.RegVar("group", get_group, set_group); + L.RegVar("isOn", get_isOn, set_isOn); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Rebuild(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.Toggle obj = (UnityEngine.UI.Toggle)ToLua.CheckObject(L, 1); + UnityEngine.UI.CanvasUpdate arg0 = (UnityEngine.UI.CanvasUpdate)ToLua.CheckObject(L, 2, typeof(UnityEngine.UI.CanvasUpdate)); + obj.Rebuild(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LayoutComplete(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.Toggle obj = (UnityEngine.UI.Toggle)ToLua.CheckObject(L, 1); + obj.LayoutComplete(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GraphicUpdateComplete(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.UI.Toggle obj = (UnityEngine.UI.Toggle)ToLua.CheckObject(L, 1); + obj.GraphicUpdateComplete(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int SetIsOnWithoutNotify(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.Toggle obj = (UnityEngine.UI.Toggle)ToLua.CheckObject(L, 1); + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.SetIsOnWithoutNotify(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OnPointerClick(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.Toggle obj = (UnityEngine.UI.Toggle)ToLua.CheckObject(L, 1); + UnityEngine.EventSystems.PointerEventData arg0 = (UnityEngine.EventSystems.PointerEventData)ToLua.CheckObject(L, 2); + obj.OnPointerClick(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OnSubmit(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.UI.Toggle obj = (UnityEngine.UI.Toggle)ToLua.CheckObject(L, 1); + UnityEngine.EventSystems.BaseEventData arg0 = (UnityEngine.EventSystems.BaseEventData)ToLua.CheckObject(L, 2); + obj.OnSubmit(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_toggleTransition(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Toggle obj = (UnityEngine.UI.Toggle)o; + UnityEngine.UI.Toggle.ToggleTransition ret = obj.toggleTransition; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index toggleTransition on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_graphic(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Toggle obj = (UnityEngine.UI.Toggle)o; + UnityEngine.UI.Graphic ret = obj.graphic; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index graphic on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_onValueChanged(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Toggle obj = (UnityEngine.UI.Toggle)o; + UnityEngine.UI.Toggle.ToggleEvent ret = obj.onValueChanged; + ToLua.PushObject(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index onValueChanged on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_group(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Toggle obj = (UnityEngine.UI.Toggle)o; + UnityEngine.UI.ToggleGroup ret = obj.group; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index group on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isOn(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Toggle obj = (UnityEngine.UI.Toggle)o; + bool ret = obj.isOn; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isOn on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_toggleTransition(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Toggle obj = (UnityEngine.UI.Toggle)o; + UnityEngine.UI.Toggle.ToggleTransition arg0 = (UnityEngine.UI.Toggle.ToggleTransition)ToLua.CheckObject(L, 2, typeof(UnityEngine.UI.Toggle.ToggleTransition)); + obj.toggleTransition = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index toggleTransition on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_graphic(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Toggle obj = (UnityEngine.UI.Toggle)o; + UnityEngine.UI.Graphic arg0 = (UnityEngine.UI.Graphic)ToLua.CheckObject(L, 2); + obj.graphic = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index graphic on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_onValueChanged(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Toggle obj = (UnityEngine.UI.Toggle)o; + UnityEngine.UI.Toggle.ToggleEvent arg0 = (UnityEngine.UI.Toggle.ToggleEvent)ToLua.CheckObject(L, 2); + obj.onValueChanged = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index onValueChanged on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_group(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Toggle obj = (UnityEngine.UI.Toggle)o; + UnityEngine.UI.ToggleGroup arg0 = (UnityEngine.UI.ToggleGroup)ToLua.CheckObject(L, 2); + obj.group = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index group on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_isOn(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.UI.Toggle obj = (UnityEngine.UI.Toggle)o; + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + obj.isOn = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isOn on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_ToggleWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_ToggleWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..bd810ee120a8b645016e07b7805e1f5f154bf89c --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_UI_ToggleWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f24a06ba091229a42b53d3a2fd1ddfe2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_WWWWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_WWWWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..5ed35c20978dfb325fa08abfaf18e418acdea57b --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_WWWWrap.cs @@ -0,0 +1,633 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_WWWWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(UnityEngine.WWW), typeof(System.Object)); + L.RegFunction("EscapeURL", EscapeURL); + L.RegFunction("UnEscapeURL", UnEscapeURL); + L.RegFunction("LoadFromCacheOrDownload", LoadFromCacheOrDownload); + L.RegFunction("LoadImageIntoTexture", LoadImageIntoTexture); + L.RegFunction("Dispose", Dispose); + L.RegFunction("GetAudioClip", GetAudioClip); + L.RegFunction("GetAudioClipCompressed", GetAudioClipCompressed); + L.RegFunction("New", _CreateUnityEngine_WWW); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("assetBundle", get_assetBundle, null); + L.RegVar("bytes", get_bytes, null); + L.RegVar("bytesDownloaded", get_bytesDownloaded, null); + L.RegVar("error", get_error, null); + L.RegVar("isDone", get_isDone, null); + L.RegVar("progress", get_progress, null); + L.RegVar("responseHeaders", get_responseHeaders, null); + L.RegVar("text", get_text, null); + L.RegVar("texture", get_texture, null); + L.RegVar("textureNonReadable", get_textureNonReadable, null); + L.RegVar("threadPriority", get_threadPriority, set_threadPriority); + L.RegVar("uploadProgress", get_uploadProgress, null); + L.RegVar("url", get_url, null); + L.RegVar("keepWaiting", get_keepWaiting, null); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateUnityEngine_WWW(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + string arg0 = ToLua.CheckString(L, 1); + UnityEngine.WWW obj = new UnityEngine.WWW(arg0); + ToLua.PushObject(L, obj); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + string arg0 = ToLua.CheckString(L, 1); + UnityEngine.WWWForm arg1 = (UnityEngine.WWWForm)ToLua.ToObject(L, 2); + UnityEngine.WWW obj = new UnityEngine.WWW(arg0, arg1); + ToLua.PushObject(L, obj); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + string arg0 = ToLua.CheckString(L, 1); + byte[] arg1 = ToLua.CheckByteBuffer(L, 2); + UnityEngine.WWW obj = new UnityEngine.WWW(arg0, arg1); + ToLua.PushObject(L, obj); + return 1; + } + else if (count == 3) + { + string arg0 = ToLua.CheckString(L, 1); + byte[] arg1 = ToLua.CheckByteBuffer(L, 2); + System.Collections.Generic.Dictionary arg2 = (System.Collections.Generic.Dictionary)ToLua.CheckObject(L, 3, typeof(System.Collections.Generic.Dictionary)); + UnityEngine.WWW obj = new UnityEngine.WWW(arg0, arg1, arg2); + ToLua.PushObject(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.WWW.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int EscapeURL(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + string arg0 = ToLua.CheckString(L, 1); + string o = UnityEngine.WWW.EscapeURL(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else if (count == 2) + { + string arg0 = ToLua.CheckString(L, 1); + System.Text.Encoding arg1 = (System.Text.Encoding)ToLua.CheckObject(L, 2); + string o = UnityEngine.WWW.EscapeURL(arg0, arg1); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.WWW.EscapeURL"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int UnEscapeURL(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + string arg0 = ToLua.CheckString(L, 1); + string o = UnityEngine.WWW.UnEscapeURL(arg0); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else if (count == 2) + { + string arg0 = ToLua.CheckString(L, 1); + System.Text.Encoding arg1 = (System.Text.Encoding)ToLua.CheckObject(L, 2); + string o = UnityEngine.WWW.UnEscapeURL(arg0, arg1); + LuaDLL.lua_pushstring(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.WWW.UnEscapeURL"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LoadFromCacheOrDownload(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + string arg0 = ToLua.CheckString(L, 1); + int arg1 = (int)LuaDLL.lua_tonumber(L, 2); + UnityEngine.WWW o = UnityEngine.WWW.LoadFromCacheOrDownload(arg0, arg1); + ToLua.PushObject(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + string arg0 = ToLua.CheckString(L, 1); + UnityEngine.Hash128 arg1 = StackTraits.To(L, 2); + UnityEngine.WWW o = UnityEngine.WWW.LoadFromCacheOrDownload(arg0, arg1); + ToLua.PushObject(L, o); + return 1; + } + else if (count == 2 && TypeChecker.CheckTypes(L, 2)) + { + string arg0 = ToLua.CheckString(L, 1); + UnityEngine.CachedAssetBundle arg1 = StackTraits.To(L, 2); + UnityEngine.WWW o = UnityEngine.WWW.LoadFromCacheOrDownload(arg0, arg1); + ToLua.PushObject(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + string arg0 = ToLua.CheckString(L, 1); + int arg1 = (int)LuaDLL.lua_tonumber(L, 2); + uint arg2 = (uint)LuaDLL.lua_tonumber(L, 3); + UnityEngine.WWW o = UnityEngine.WWW.LoadFromCacheOrDownload(arg0, arg1, arg2); + ToLua.PushObject(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + string arg0 = ToLua.CheckString(L, 1); + UnityEngine.Hash128 arg1 = StackTraits.To(L, 2); + uint arg2 = (uint)LuaDLL.lua_tonumber(L, 3); + UnityEngine.WWW o = UnityEngine.WWW.LoadFromCacheOrDownload(arg0, arg1, arg2); + ToLua.PushObject(L, o); + return 1; + } + else if (count == 3 && TypeChecker.CheckTypes(L, 2)) + { + string arg0 = ToLua.CheckString(L, 1); + UnityEngine.CachedAssetBundle arg1 = StackTraits.To(L, 2); + uint arg2 = (uint)LuaDLL.lua_tonumber(L, 3); + UnityEngine.WWW o = UnityEngine.WWW.LoadFromCacheOrDownload(arg0, arg1, arg2); + ToLua.PushObject(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.WWW.LoadFromCacheOrDownload"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int LoadImageIntoTexture(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.WWW obj = (UnityEngine.WWW)ToLua.CheckObject(L, 1); + UnityEngine.Texture2D arg0 = (UnityEngine.Texture2D)ToLua.CheckObject(L, 2, typeof(UnityEngine.Texture2D)); + obj.LoadImageIntoTexture(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Dispose(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + UnityEngine.WWW obj = (UnityEngine.WWW)ToLua.CheckObject(L, 1); + obj.Dispose(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetAudioClip(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.WWW obj = (UnityEngine.WWW)ToLua.CheckObject(L, 1); + UnityEngine.AudioClip o = obj.GetAudioClip(); + ToLua.PushSealed(L, o); + return 1; + } + else if (count == 2) + { + UnityEngine.WWW obj = (UnityEngine.WWW)ToLua.CheckObject(L, 1); + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + UnityEngine.AudioClip o = obj.GetAudioClip(arg0); + ToLua.PushSealed(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.WWW obj = (UnityEngine.WWW)ToLua.CheckObject(L, 1); + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + bool arg1 = LuaDLL.luaL_checkboolean(L, 3); + UnityEngine.AudioClip o = obj.GetAudioClip(arg0, arg1); + ToLua.PushSealed(L, o); + return 1; + } + else if (count == 4) + { + UnityEngine.WWW obj = (UnityEngine.WWW)ToLua.CheckObject(L, 1); + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + bool arg1 = LuaDLL.luaL_checkboolean(L, 3); + UnityEngine.AudioType arg2 = (UnityEngine.AudioType)ToLua.CheckObject(L, 4, typeof(UnityEngine.AudioType)); + UnityEngine.AudioClip o = obj.GetAudioClip(arg0, arg1, arg2); + ToLua.PushSealed(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.WWW.GetAudioClip"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int GetAudioClipCompressed(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 1) + { + UnityEngine.WWW obj = (UnityEngine.WWW)ToLua.CheckObject(L, 1); + UnityEngine.AudioClip o = obj.GetAudioClipCompressed(); + ToLua.PushSealed(L, o); + return 1; + } + else if (count == 2) + { + UnityEngine.WWW obj = (UnityEngine.WWW)ToLua.CheckObject(L, 1); + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + UnityEngine.AudioClip o = obj.GetAudioClipCompressed(arg0); + ToLua.PushSealed(L, o); + return 1; + } + else if (count == 3) + { + UnityEngine.WWW obj = (UnityEngine.WWW)ToLua.CheckObject(L, 1); + bool arg0 = LuaDLL.luaL_checkboolean(L, 2); + UnityEngine.AudioType arg1 = (UnityEngine.AudioType)ToLua.CheckObject(L, 3, typeof(UnityEngine.AudioType)); + UnityEngine.AudioClip o = obj.GetAudioClipCompressed(arg0, arg1); + ToLua.PushSealed(L, o); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.WWW.GetAudioClipCompressed"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_assetBundle(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.WWW obj = (UnityEngine.WWW)o; + UnityEngine.AssetBundle ret = obj.assetBundle; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index assetBundle on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_bytes(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.WWW obj = (UnityEngine.WWW)o; + byte[] ret = obj.bytes; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index bytes on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_bytesDownloaded(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.WWW obj = (UnityEngine.WWW)o; + int ret = obj.bytesDownloaded; + LuaDLL.lua_pushinteger(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index bytesDownloaded on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_error(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.WWW obj = (UnityEngine.WWW)o; + string ret = obj.error; + LuaDLL.lua_pushstring(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index error on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_isDone(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.WWW obj = (UnityEngine.WWW)o; + bool ret = obj.isDone; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index isDone on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_progress(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.WWW obj = (UnityEngine.WWW)o; + float ret = obj.progress; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index progress on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_responseHeaders(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.WWW obj = (UnityEngine.WWW)o; + System.Collections.Generic.Dictionary ret = obj.responseHeaders; + ToLua.PushSealed(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index responseHeaders on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_text(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.WWW obj = (UnityEngine.WWW)o; + string ret = obj.text; + LuaDLL.lua_pushstring(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index text on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_texture(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.WWW obj = (UnityEngine.WWW)o; + UnityEngine.Texture2D ret = obj.texture; + ToLua.PushSealed(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index texture on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_textureNonReadable(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.WWW obj = (UnityEngine.WWW)o; + UnityEngine.Texture2D ret = obj.textureNonReadable; + ToLua.PushSealed(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index textureNonReadable on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_threadPriority(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.WWW obj = (UnityEngine.WWW)o; + UnityEngine.ThreadPriority ret = obj.threadPriority; + ToLua.Push(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index threadPriority on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_uploadProgress(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.WWW obj = (UnityEngine.WWW)o; + float ret = obj.uploadProgress; + LuaDLL.lua_pushnumber(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index uploadProgress on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_url(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.WWW obj = (UnityEngine.WWW)o; + string ret = obj.url; + LuaDLL.lua_pushstring(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index url on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_keepWaiting(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.WWW obj = (UnityEngine.WWW)o; + bool ret = obj.keepWaiting; + LuaDLL.lua_pushboolean(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index keepWaiting on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int set_threadPriority(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + UnityEngine.WWW obj = (UnityEngine.WWW)o; + UnityEngine.ThreadPriority arg0 = (UnityEngine.ThreadPriority)ToLua.CheckObject(L, 2, typeof(UnityEngine.ThreadPriority)); + obj.threadPriority = arg0; + return 0; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index threadPriority on a nil value"); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_WWWWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_WWWWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..ae7cee68588d3a54d75e38bd01098bbbeb3a9e79 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_WWWWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2175f29f61081ff4dbc0ed7324e4deb0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_WrapModeWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_WrapModeWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..38f2b08492f81e06a894a0ed92fbec01a712e6d0 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_WrapModeWrap.cs @@ -0,0 +1,83 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class UnityEngine_WrapModeWrap +{ + public static void Register(LuaState L) + { + L.BeginEnum(typeof(UnityEngine.WrapMode)); + L.RegVar("Once", get_Once, null); + L.RegVar("Loop", get_Loop, null); + L.RegVar("PingPong", get_PingPong, null); + L.RegVar("Default", get_Default, null); + L.RegVar("ClampForever", get_ClampForever, null); + L.RegVar("Clamp", get_Clamp, null); + L.RegFunction("IntToEnum", IntToEnum); + L.EndEnum(); + TypeTraits.Check = CheckType; + StackTraits.Push = Push; + } + + static void Push(IntPtr L, UnityEngine.WrapMode arg) + { + ToLua.Push(L, arg); + } + + static bool CheckType(IntPtr L, int pos) + { + return TypeChecker.CheckEnumType(typeof(UnityEngine.WrapMode), L, pos); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Once(IntPtr L) + { + ToLua.Push(L, UnityEngine.WrapMode.Once); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Loop(IntPtr L) + { + ToLua.Push(L, UnityEngine.WrapMode.Loop); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_PingPong(IntPtr L) + { + ToLua.Push(L, UnityEngine.WrapMode.PingPong); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Default(IntPtr L) + { + ToLua.Push(L, UnityEngine.WrapMode.Default); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_ClampForever(IntPtr L) + { + ToLua.Push(L, UnityEngine.WrapMode.ClampForever); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_Clamp(IntPtr L) + { + ToLua.Push(L, UnityEngine.WrapMode.Clamp); + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int IntToEnum(IntPtr L) + { + int arg0 = (int)LuaDLL.lua_tonumber(L, 1); + UnityEngine.WrapMode o = (UnityEngine.WrapMode)arg0; + ToLua.Push(L, o); + return 1; + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_WrapModeWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_WrapModeWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..41deaf53341eb96b83995a0c460eb5eb270290c0 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/UnityEngine_WrapModeWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 78193aa44eda9d8419fef278f9a1cd74 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/VersionMgrWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/VersionMgrWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..90a149013f9c5a2653f842a7192c43fcac32e17f --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/VersionMgrWrap.cs @@ -0,0 +1,165 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class VersionMgrWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(VersionMgr), typeof(System.Object)); + L.RegFunction("Init", Init); + L.RegFunction("UpdateResVersion", UpdateResVersion); + L.RegFunction("DeleteCacheResVersion", DeleteCacheResVersion); + L.RegFunction("CompareVersion", CompareVersion); + L.RegFunction("New", _CreateVersionMgr); + L.RegFunction("__tostring", ToLua.op_ToString); + L.RegVar("appVersion", get_appVersion, null); + L.RegVar("resVersion", get_resVersion, null); + L.RegVar("instance", get_instance, null); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _CreateVersionMgr(IntPtr L) + { + try + { + int count = LuaDLL.lua_gettop(L); + + if (count == 0) + { + VersionMgr obj = new VersionMgr(); + ToLua.PushObject(L, obj); + return 1; + } + else + { + return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: VersionMgr.New"); + } + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int Init(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + VersionMgr obj = (VersionMgr)ToLua.CheckObject(L, 1); + obj.Init(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int UpdateResVersion(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + VersionMgr obj = (VersionMgr)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + obj.UpdateResVersion(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int DeleteCacheResVersion(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 1); + VersionMgr obj = (VersionMgr)ToLua.CheckObject(L, 1); + obj.DeleteCacheResVersion(); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int CompareVersion(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + string arg0 = ToLua.CheckString(L, 1); + string arg1 = ToLua.CheckString(L, 2); + int o = VersionMgr.CompareVersion(arg0, arg1); + LuaDLL.lua_pushinteger(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_appVersion(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + VersionMgr obj = (VersionMgr)o; + string ret = obj.appVersion; + LuaDLL.lua_pushstring(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index appVersion on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_resVersion(IntPtr L) + { + object o = null; + + try + { + o = ToLua.ToObject(L, 1); + VersionMgr obj = (VersionMgr)o; + string ret = obj.resVersion; + LuaDLL.lua_pushstring(L, ret); + return 1; + } + catch(Exception e) + { + return LuaDLL.toluaL_exception(L, e, o, "attempt to index resVersion on a nil value"); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int get_instance(IntPtr L) + { + try + { + ToLua.PushObject(L, VersionMgr.instance); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/VersionMgrWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/VersionMgrWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..79150426c64395e5ae0d9ccd61b5e03d24a35617 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/VersionMgrWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 56078462e70d16f4395370e0074028d5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/Generate/ViewWrap.cs b/Assets/LuaFramework/ToLua/Source/Generate/ViewWrap.cs new file mode 100644 index 0000000000000000000000000000000000000000..032875f644cbccd0adc60bcf19ffe33704b0a414 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/ViewWrap.cs @@ -0,0 +1,51 @@ +锘//this source code was auto-generated by tolua#, do not modify it +using System; +using LuaInterface; + +public class ViewWrap +{ + public static void Register(LuaState L) + { + L.BeginClass(typeof(View), typeof(Base)); + L.RegFunction("OnMessage", OnMessage); + L.RegFunction("__eq", op_Equality); + L.RegFunction("__tostring", ToLua.op_ToString); + L.EndClass(); + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int OnMessage(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + View obj = (View)ToLua.CheckObject(L, 1); + IMessage arg0 = (IMessage)ToLua.CheckObject(L, 2); + obj.OnMessage(arg0); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int op_Equality(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 2); + UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); + UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); + bool o = arg0 == arg1; + LuaDLL.lua_pushboolean(L, o); + return 1; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } +} + diff --git a/Assets/LuaFramework/ToLua/Source/Generate/ViewWrap.cs.meta b/Assets/LuaFramework/ToLua/Source/Generate/ViewWrap.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..b38b41ea9aec8732af0d5b5a48a5317b9943a8f5 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/Generate/ViewWrap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1bf9a6ca841078043840bc00af5c7af3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/LuaFramework/ToLua/Source/LuaConst.cs b/Assets/LuaFramework/ToLua/Source/LuaConst.cs new file mode 100644 index 0000000000000000000000000000000000000000..bca11f3b768ce203ee0b32f4085af8a434108fde --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/LuaConst.cs @@ -0,0 +1,30 @@ +锘縰sing UnityEngine; + +public static class LuaConst +{ + public static string luaDir = Application.dataPath + "/LuaFramework/Lua"; //lua閫昏緫浠g爜鐩綍 + public static string toluaDir = Application.dataPath + "/LuaFramework/ToLua/Lua"; //tolua lua鏂囦欢鐩綍 + +#if UNITY_STANDALONE + public static string osDir = "Win"; +#elif UNITY_ANDROID + public static string osDir = "Android"; +#elif UNITY_IPHONE + public static string osDir = "iOS"; +#else + public static string osDir = ""; +#endif + + public static string luaResDir = string.Format("{0}/{1}/Lua", Application.persistentDataPath, osDir); //鎵嬫満杩愯鏃秎ua鏂囦欢涓嬭浇鐩綍 + +#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN + public static string zbsDir = "D:/ZeroBraneStudio/lualibs/mobdebug"; //ZeroBraneStudio鐩綍 +#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX + public static string zbsDir = "/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/lualibs/mobdebug"; +#else + public static string zbsDir = luaResDir + "/mobdebug/"; +#endif + + public static bool openLuaSocket = true; //鏄惁鎵撳紑Lua Socket搴 + public static bool openLuaDebugger = false; //鏄惁杩炴帴lua璋冭瘯鍣 +} diff --git a/Assets/LuaFramework/ToLua/Source/LuaConst.cs.meta b/Assets/LuaFramework/ToLua/Source/LuaConst.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..7cf4b664e2f23dc3044c615cdf24167bad9bc540 --- /dev/null +++ b/Assets/LuaFramework/ToLua/Source/LuaConst.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 35b0c8bef181f2d4dacd3c860eb546a7 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/LuaFramework/ToLua/readme.txt b/Assets/LuaFramework/ToLua/readme.txt new file mode 100644 index 0000000000000000000000000000000000000000..bbcf3ceafd0d3adf15a1f9adc23e4e5f70057bd5 --- /dev/null +++ b/Assets/LuaFramework/ToLua/readme.txt @@ -0,0 +1,13 @@ +锘縯olua# 1.01 +- FIX: 5.x AssetBundle.Load鍑芥暟搴熷純闂. +- FIX: 淇妯$増绫诲鍑哄懡鍚嶇┖闂撮棶棰 +- FIX: pblua protobuf鍗忚tostring鍗℃闂 +- FIX: Array index 涓嶅啀妫娴媙ull鍙傛暟 +- FIX: LuaInteger64 閲嶈浇鍑芥暟鍖归厤妫娴嬮棶棰 +- NEW: 鎸囧畾RenderSettings涓洪潤鎬佺被 +- NEW: LuaFunction杞鎵樺嚱鏁版敮鎸佸彲鍙樺弬鏁板垪琛 +- NEW: Wrap鍑芥暟鍑洪敊鍚屾椂闄勫姞c#寮傚父鍫嗘爤 +tolua# 1.02 +- New: c# event +=鍜-=鎿嶄綔鏀寔 +- New: 娣诲姞 mac 鍜 ios 杩愯搴 +- Opt: 浼樺寲list鍙屽悜閾捐〃 \ No newline at end of file diff --git a/Assets/LuaFramework/ToLua/readme.txt.meta b/Assets/LuaFramework/ToLua/readme.txt.meta new file mode 100644 index 0000000000000000000000000000000000000000..bb96fd78dbbe96e1d176c05608065d1f82aa0991 --- /dev/null +++ b/Assets/LuaFramework/ToLua/readme.txt.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: c85b2c9de573bc54881ca0c2427016cd +TextScriptImporter: + userData: diff --git a/Assets/Plugins.meta b/Assets/Plugins.meta new file mode 100644 index 0000000000000000000000000000000000000000..ab7c8e09ff1e9a531aedd9d5d63c7fad66d801f0 --- /dev/null +++ b/Assets/Plugins.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 644aec5d63676df4193b416f5dd1e179 +folderAsset: yes +timeCreated: 1453125833 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/.DS_Store b/Assets/Plugins/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..aa54a14fe8c9e9088f399fe70b88a3241ad14663 Binary files /dev/null and b/Assets/Plugins/.DS_Store differ diff --git a/Assets/Plugins/Android.meta b/Assets/Plugins/Android.meta new file mode 100644 index 0000000000000000000000000000000000000000..c785fd3540ecc43cfe8e2e3650e99ddb94d1aefc --- /dev/null +++ b/Assets/Plugins/Android.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 729c01aec7bba814d88608249c8a170b +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/Plugins/Android/libs.meta b/Assets/Plugins/Android/libs.meta new file mode 100644 index 0000000000000000000000000000000000000000..128af8388f87794339eae78898e1266efd5f1e35 --- /dev/null +++ b/Assets/Plugins/Android/libs.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 72b436146481b3f40b05eb161ca7f39c +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/Plugins/Android/libs/armeabi-v7a.meta b/Assets/Plugins/Android/libs/armeabi-v7a.meta new file mode 100644 index 0000000000000000000000000000000000000000..e0ec585d318f06001a5e0994fc121350500602f2 --- /dev/null +++ b/Assets/Plugins/Android/libs/armeabi-v7a.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 034154e518117d842b99fd1f19efa3a3 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/Plugins/Android/libs/armeabi-v7a/libtolua.so b/Assets/Plugins/Android/libs/armeabi-v7a/libtolua.so new file mode 100644 index 0000000000000000000000000000000000000000..0e74ac3205d9a68afc610f89f1dfb71f145eb644 Binary files /dev/null and b/Assets/Plugins/Android/libs/armeabi-v7a/libtolua.so differ diff --git a/Assets/Plugins/Android/libs/armeabi-v7a/libtolua.so.meta b/Assets/Plugins/Android/libs/armeabi-v7a/libtolua.so.meta new file mode 100644 index 0000000000000000000000000000000000000000..6439e9dd61e4b9d93d4c964654171bd2d96cc912 --- /dev/null +++ b/Assets/Plugins/Android/libs/armeabi-v7a/libtolua.so.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 4fb9a29f65e536b4293f7f9affd19158 +DefaultImporter: + userData: diff --git a/Assets/Plugins/Android/libs/x86.meta b/Assets/Plugins/Android/libs/x86.meta new file mode 100644 index 0000000000000000000000000000000000000000..85ecc6ef835ead2decb31845c97a904d2b7bf816 --- /dev/null +++ b/Assets/Plugins/Android/libs/x86.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: d76e3311efeac224996b0cb7a06a7a3a +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/Plugins/Android/libs/x86/libtolua.so b/Assets/Plugins/Android/libs/x86/libtolua.so new file mode 100644 index 0000000000000000000000000000000000000000..1640f639911d20ed9b3ce40ead04a31092b5acf9 Binary files /dev/null and b/Assets/Plugins/Android/libs/x86/libtolua.so differ diff --git a/Assets/Plugins/Android/libs/x86/libtolua.so.meta b/Assets/Plugins/Android/libs/x86/libtolua.so.meta new file mode 100644 index 0000000000000000000000000000000000000000..63946b792ba197cf3fd7fd6f280c57ad246c6019 --- /dev/null +++ b/Assets/Plugins/Android/libs/x86/libtolua.so.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 3bf04aa9e8715d047898e94157e2decd +DefaultImporter: + userData: diff --git a/Assets/Plugins/CString.dll b/Assets/Plugins/CString.dll new file mode 100644 index 0000000000000000000000000000000000000000..9c67e2322680fb0a8f9804fd295a17c165901514 Binary files /dev/null and b/Assets/Plugins/CString.dll differ diff --git a/Assets/Plugins/CString.dll.meta b/Assets/Plugins/CString.dll.meta new file mode 100644 index 0000000000000000000000000000000000000000..a9055a796f06f7a44333d26fbad86e5b2b469708 --- /dev/null +++ b/Assets/Plugins/CString.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: 4f630c0f54674a246a65918d24eeab8a +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Debugger.dll b/Assets/Plugins/Debugger.dll new file mode 100644 index 0000000000000000000000000000000000000000..7c7cf8871efbf279ff773293e867aa09d8670815 Binary files /dev/null and b/Assets/Plugins/Debugger.dll differ diff --git a/Assets/Plugins/Debugger.dll.meta b/Assets/Plugins/Debugger.dll.meta new file mode 100644 index 0000000000000000000000000000000000000000..4e2b93c2250a6c7c477fb7b2f112b31b66d83c1e --- /dev/null +++ b/Assets/Plugins/Debugger.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: c33668af923d0aa4ebd48ebe80ef943a +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Ionic.Zip.Unity.dll b/Assets/Plugins/Ionic.Zip.Unity.dll new file mode 100644 index 0000000000000000000000000000000000000000..71ae13b98364183b93c78ad204b83bc5a1898684 Binary files /dev/null and b/Assets/Plugins/Ionic.Zip.Unity.dll differ diff --git a/Assets/Plugins/Ionic.Zip.Unity.dll.meta b/Assets/Plugins/Ionic.Zip.Unity.dll.meta new file mode 100644 index 0000000000000000000000000000000000000000..2c7c596526e06357b13b35ada8f78d9de5f89a4c --- /dev/null +++ b/Assets/Plugins/Ionic.Zip.Unity.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: 596ef93d8be8acf44883362e7d5c2204 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/iOS.meta b/Assets/Plugins/iOS.meta new file mode 100644 index 0000000000000000000000000000000000000000..5e1f10480a93f3f721b7e7963fb138140a0c8609 --- /dev/null +++ b/Assets/Plugins/iOS.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 48e42b60abfb25b488c56d81b63e4646 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/Plugins/iOS/.DS_Store b/Assets/Plugins/iOS/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 Binary files /dev/null and b/Assets/Plugins/iOS/.DS_Store differ diff --git a/Assets/Plugins/iOS/libtolua.a b/Assets/Plugins/iOS/libtolua.a new file mode 100644 index 0000000000000000000000000000000000000000..10c70b39bbba67a900d7f997c3f5784fe6bd72ca Binary files /dev/null and b/Assets/Plugins/iOS/libtolua.a differ diff --git a/Assets/Plugins/iOS/libtolua.a.meta b/Assets/Plugins/iOS/libtolua.a.meta new file mode 100644 index 0000000000000000000000000000000000000000..d39ae686136c704b377ec0a0a4f4eaae274d30a2 --- /dev/null +++ b/Assets/Plugins/iOS/libtolua.a.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 8492849dccfbfce4485d383c0ce84651 +DefaultImporter: + userData: diff --git a/Assets/Plugins/tolua.bundle.meta b/Assets/Plugins/tolua.bundle.meta new file mode 100644 index 0000000000000000000000000000000000000000..94b6e587162ed45a92fa6e7075424496a769fc73 --- /dev/null +++ b/Assets/Plugins/tolua.bundle.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: d67965ea35e33fa4f8179bc8f4f3ce74 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/Plugins/tolua.bundle/Contents.meta b/Assets/Plugins/tolua.bundle/Contents.meta new file mode 100644 index 0000000000000000000000000000000000000000..59e103e20341e39fdd05b2e8145fb21f1cc32c97 --- /dev/null +++ b/Assets/Plugins/tolua.bundle/Contents.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 0268dd48105753c49a78ed114d6a398e +folderAsset: yes +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/tolua.bundle/Contents/Info.plist b/Assets/Plugins/tolua.bundle/Contents/Info.plist new file mode 100644 index 0000000000000000000000000000000000000000..87308b4b3f2e9556ef2425f39373e0f154edba26 --- /dev/null +++ b/Assets/Plugins/tolua.bundle/Contents/Info.plist @@ -0,0 +1,64 @@ + + + + + BuildMachineOSBuild + 16F73 + CFBundleDevelopmentRegion + English + CFBundleExecutable + tolua + CFBundleIdentifier + ameng.tolua + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + tolua + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleSupportedPlatforms + + MacOSX + + CFBundleVersion + 1 + CFPlugInDynamicRegisterFunction + + CFPlugInDynamicRegistration + NO + CFPlugInFactories + + 00000000-0000-0000-0000-000000000000 + MyFactoryFunction + + CFPlugInTypes + + 00000000-0000-0000-0000-000000000000 + + 00000000-0000-0000-0000-000000000000 + + + CFPlugInUnloadFunction + + DTCompiler + com.apple.compilers.llvm.clang.1_0 + DTPlatformBuild + 8E3004b + DTPlatformVersion + GM + DTSDKBuild + 16E185 + DTSDKName + macosx10.12 + DTXcode + 0833 + DTXcodeBuild + 8E3004b + NSHumanReadableCopyright + Copyright 漏 2013 xlcw games. All rights reserved. + + diff --git a/Assets/Plugins/tolua.bundle/Contents/Info.plist.meta b/Assets/Plugins/tolua.bundle/Contents/Info.plist.meta new file mode 100644 index 0000000000000000000000000000000000000000..997c7ba83d772b40d21b2caf5c043f10b2dfe4b2 --- /dev/null +++ b/Assets/Plugins/tolua.bundle/Contents/Info.plist.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 81a8c861624bbed45b70b29beb4a90ea +timeCreated: 1454253412 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/tolua.bundle/Contents/MacOS.meta b/Assets/Plugins/tolua.bundle/Contents/MacOS.meta new file mode 100644 index 0000000000000000000000000000000000000000..84f17b65eb2eeecf95670dda40941f30696cea9e --- /dev/null +++ b/Assets/Plugins/tolua.bundle/Contents/MacOS.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f47ce9b3acaa3ad4e93c7d3977c574f0 +folderAsset: yes +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/tolua.bundle/Contents/MacOS/tolua b/Assets/Plugins/tolua.bundle/Contents/MacOS/tolua new file mode 100644 index 0000000000000000000000000000000000000000..fc919705bcbc5cbfc06c394569d092030ec2db9c Binary files /dev/null and b/Assets/Plugins/tolua.bundle/Contents/MacOS/tolua differ diff --git a/Assets/Plugins/tolua.bundle/Contents/MacOS/tolua.meta b/Assets/Plugins/tolua.bundle/Contents/MacOS/tolua.meta new file mode 100644 index 0000000000000000000000000000000000000000..01ebd32adaaef5d5948bea9d4f98cee7866d6b86 --- /dev/null +++ b/Assets/Plugins/tolua.bundle/Contents/MacOS/tolua.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6873e7aba8a271643862740896b03cf2 +timeCreated: 1454253412 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/x86.meta b/Assets/Plugins/x86.meta new file mode 100644 index 0000000000000000000000000000000000000000..de2cb109ce65e7e18ab7580000d98f3923ee3cce --- /dev/null +++ b/Assets/Plugins/x86.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 8b0b0c4ffe67d2f4292c5211de91e55f +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/Plugins/x86/tolua.dll b/Assets/Plugins/x86/tolua.dll new file mode 100644 index 0000000000000000000000000000000000000000..48a46b9dc59e1e77e663b307ab2652378f5916c6 Binary files /dev/null and b/Assets/Plugins/x86/tolua.dll differ diff --git a/Assets/Plugins/x86/tolua.dll.meta b/Assets/Plugins/x86/tolua.dll.meta new file mode 100644 index 0000000000000000000000000000000000000000..182bda26c5fe2fd0dd7c176a3917e19e544916a1 --- /dev/null +++ b/Assets/Plugins/x86/tolua.dll.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: f3b9938f609831e41b7ffc0f4108166b +DefaultImporter: + userData: diff --git a/Assets/Plugins/x86_64.meta b/Assets/Plugins/x86_64.meta new file mode 100644 index 0000000000000000000000000000000000000000..3956c3a4ea4362a82358365b37fce8664d20cf67 --- /dev/null +++ b/Assets/Plugins/x86_64.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 7ea0a8e1f899b1148badb9e92b431566 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Assets/Plugins/x86_64/tolua.dll b/Assets/Plugins/x86_64/tolua.dll new file mode 100644 index 0000000000000000000000000000000000000000..5d332f3ee977369caa7c66115be06a9bea4e6c7d Binary files /dev/null and b/Assets/Plugins/x86_64/tolua.dll differ diff --git a/Assets/Plugins/x86_64/tolua.dll.meta b/Assets/Plugins/x86_64/tolua.dll.meta new file mode 100644 index 0000000000000000000000000000000000000000..58dcf749ca4a38e86eb2d435f92567c5a96039a6 --- /dev/null +++ b/Assets/Plugins/x86_64/tolua.dll.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 82bce848ef6ade348a8220c2ada7da08 +DefaultImporter: + userData: diff --git a/Assets/RawAssets.meta b/Assets/RawAssets.meta new file mode 100644 index 0000000000000000000000000000000000000000..a0cee77c0ad248dc288fdb610dbe3d522e9f62a8 --- /dev/null +++ b/Assets/RawAssets.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 21a51c319ab41804ba53519f464e2622 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RawAssets/Animations.meta b/Assets/RawAssets/Animations.meta new file mode 100644 index 0000000000000000000000000000000000000000..3528b6bb6ba77a153a085074ff8e22373b5465ca --- /dev/null +++ b/Assets/RawAssets/Animations.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4df6afa33e56a3c4e9333e752ce7020e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RawAssets/Animations/PanelAppear.anim b/Assets/RawAssets/Animations/PanelAppear.anim new file mode 100644 index 0000000000000000000000000000000000000000..47886fac87832e7fb92ab339222ecb080b36607a --- /dev/null +++ b/Assets/RawAssets/Animations/PanelAppear.anim @@ -0,0 +1,241 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: PanelAppear + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: {x: 0, y: 0, z: 0} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 0.23333333 + value: {x: 1.1, y: 1.1, z: 1.1} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 0.3 + value: {x: 1, y: 1, z: 1} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 0.75 + value: {x: 1, y: 1, z: 1} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + path: bg + m_FloatCurves: [] + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 3318017825 + attribute: 3 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 0.75 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 0 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.23333333 + value: 1.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.3 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.75 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalScale.x + path: bg + classID: 224 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.23333333 + value: 1.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.3 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.75 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalScale.y + path: bg + classID: 224 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.23333333 + value: 1.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.3 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.75 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalScale.z + path: bg + classID: 224 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/RawAssets/Animations/PanelAppear.anim.meta b/Assets/RawAssets/Animations/PanelAppear.anim.meta new file mode 100644 index 0000000000000000000000000000000000000000..07da0cd5a4abd5778e2349397bf2043c644f3816 --- /dev/null +++ b/Assets/RawAssets/Animations/PanelAppear.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3e1123d07c53e1348816c3ff0a2df6ad +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RawAssets/Animations/PanelAppear.controller b/Assets/RawAssets/Animations/PanelAppear.controller new file mode 100644 index 0000000000000000000000000000000000000000..b7334cbe401888923b8b7f74d660f5ffba762962 --- /dev/null +++ b/Assets/RawAssets/Animations/PanelAppear.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: PanelAppear + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 3639685075904473284} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1107 &3639685075904473284 +AnimatorStateMachine: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 5422678085948338366} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 5422678085948338366} +--- !u!1102 &5422678085948338366 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: DevPanel + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 3e1123d07c53e1348816c3ff0a2df6ad, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: diff --git a/Assets/RawAssets/Animations/PanelAppear.controller.meta b/Assets/RawAssets/Animations/PanelAppear.controller.meta new file mode 100644 index 0000000000000000000000000000000000000000..054639b71d6e731f5dbe2d43996687af68dac2d7 --- /dev/null +++ b/Assets/RawAssets/Animations/PanelAppear.controller.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a0acff4cee9b7f24e89898dadaa0d80b +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RawAssets/Animations/TipsFly.anim b/Assets/RawAssets/Animations/TipsFly.anim new file mode 100644 index 0000000000000000000000000000000000000000..509df9b0bc3de311e927af7589c31bc701cc84af --- /dev/null +++ b/Assets/RawAssets/Animations/TipsFly.anim @@ -0,0 +1,276 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: TipsFly + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: -50.14 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.21666667 + value: 25 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.0166667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.3666667 + value: 73.28 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_AnchoredPosition.y + path: + classID: 224 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.21666667 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.0166667 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.3666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_Alpha + path: + classID: 225 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 538195251 + script: {fileID: 0} + typeID: 224 + customType: 28 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 1574349066 + script: {fileID: 0} + typeID: 225 + customType: 0 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1.3666667 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 0 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: -50.14 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.21666667 + value: 25 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.0166667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.3666667 + value: 73.28 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_AnchoredPosition.y + path: + classID: 224 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.21666667 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.0166667 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.3666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_Alpha + path: + classID: 225 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: + - time: 1.3666667 + functionName: AniMsgStr + data: finish + objectReferenceParameter: {fileID: 0} + floatParameter: 0 + intParameter: 0 + messageOptions: 0 diff --git a/Assets/RawAssets/Animations/TipsFly.anim.meta b/Assets/RawAssets/Animations/TipsFly.anim.meta new file mode 100644 index 0000000000000000000000000000000000000000..7237aa4adfbd6cb6b0c420714d99d8feca738ac1 --- /dev/null +++ b/Assets/RawAssets/Animations/TipsFly.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f1e82734e665c0f4b8f109c39258c444 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RawAssets/Animations/TipsFly.controller b/Assets/RawAssets/Animations/TipsFly.controller new file mode 100644 index 0000000000000000000000000000000000000000..8e99e889cad78261fd29858e4f2918bcddd2c213 --- /dev/null +++ b/Assets/RawAssets/Animations/TipsFly.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: TipsFly + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 7140314726582187330} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1107 &7140314726582187330 +AnimatorStateMachine: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 8657440228437385282} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 8657440228437385282} +--- !u!1102 &8657440228437385282 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: TipsFly + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: f1e82734e665c0f4b8f109c39258c444, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: diff --git a/Assets/RawAssets/Animations/TipsFly.controller.meta b/Assets/RawAssets/Animations/TipsFly.controller.meta new file mode 100644 index 0000000000000000000000000000000000000000..d74b50e59672b67816b870beed184efe863e4bef --- /dev/null +++ b/Assets/RawAssets/Animations/TipsFly.controller.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: dc7057b8525f5e444ba01ee1b2b1c550 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RawAssets/Fonts.meta b/Assets/RawAssets/Fonts.meta new file mode 100644 index 0000000000000000000000000000000000000000..7c52c09931a8aaaafb0c5544f9adf8cb87a62cef --- /dev/null +++ b/Assets/RawAssets/Fonts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 45f2b657a45201d4fae75cf0c42808b2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git "a/Assets/RawAssets/Fonts/\345\255\227\345\210\266\345\214\272\345\226\234\350\204\211\344\275\223.ttf" "b/Assets/RawAssets/Fonts/\345\255\227\345\210\266\345\214\272\345\226\234\350\204\211\344\275\223.ttf" new file mode 100644 index 0000000000000000000000000000000000000000..d3528404936bb618ccd948fd31c1330e366a4359 Binary files /dev/null and "b/Assets/RawAssets/Fonts/\345\255\227\345\210\266\345\214\272\345\226\234\350\204\211\344\275\223.ttf" differ diff --git "a/Assets/RawAssets/Fonts/\345\255\227\345\210\266\345\214\272\345\226\234\350\204\211\344\275\223.ttf.meta" "b/Assets/RawAssets/Fonts/\345\255\227\345\210\266\345\214\272\345\226\234\350\204\211\344\275\223.ttf.meta" new file mode 100644 index 0000000000000000000000000000000000000000..229d6585a08fc8ddec0cf7cc690fba7df8ad60d7 --- /dev/null +++ "b/Assets/RawAssets/Fonts/\345\255\227\345\210\266\345\214\272\345\226\234\350\204\211\344\275\223.ttf.meta" @@ -0,0 +1,21 @@ +fileFormatVersion: 2 +guid: 8cc0d7bd50a4d8f41abb328cec3f642f +TrueTypeFontImporter: + externalObjects: {} + serializedVersion: 4 + fontSize: 16 + forceTextureCase: -2 + characterSpacing: 0 + characterPadding: 1 + includeFontData: 1 + fontNames: + - ZiZhiQuXiMaiTi + fallbackFontReferences: [] + customCharacters: + fontRenderingMode: 0 + ascentCalculationMode: 1 + useLegacyBoundsCalculation: 0 + shouldRoundAdvanceValue: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RawAssets/Textures.meta b/Assets/RawAssets/Textures.meta new file mode 100644 index 0000000000000000000000000000000000000000..aa1bc33d1ddbf45d3a7b265021d8220b19627fcf --- /dev/null +++ b/Assets/RawAssets/Textures.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ac54ffe6c83de5a4dace062140815ac4 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RawAssets/Textures/account.png b/Assets/RawAssets/Textures/account.png new file mode 100644 index 0000000000000000000000000000000000000000..3c6db02c467363a04fed5abcb0907a9632476fad Binary files /dev/null and b/Assets/RawAssets/Textures/account.png differ diff --git a/Assets/RawAssets/Textures/account.png.meta b/Assets/RawAssets/Textures/account.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..bfaedffd7cb81d8f5208cb54d915e180b6fa2884 --- /dev/null +++ b/Assets/RawAssets/Textures/account.png.meta @@ -0,0 +1,96 @@ +fileFormatVersion: 2 +guid: 61c1f706b19533b45bba68b3caacdd39 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RawAssets/Textures/btn.png b/Assets/RawAssets/Textures/btn.png new file mode 100644 index 0000000000000000000000000000000000000000..4e34c106fc9e1ce0ca34a63cdd733f04442a704c Binary files /dev/null and b/Assets/RawAssets/Textures/btn.png differ diff --git a/Assets/RawAssets/Textures/btn.png.meta b/Assets/RawAssets/Textures/btn.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..6cbedce7af6f5f7e2a1905b431d03e5847648040 --- /dev/null +++ b/Assets/RawAssets/Textures/btn.png.meta @@ -0,0 +1,96 @@ +fileFormatVersion: 2 +guid: 679881943af014a4eaa06972bd740f32 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 25, y: 0, z: 25, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RawAssets/Textures/close.png b/Assets/RawAssets/Textures/close.png new file mode 100644 index 0000000000000000000000000000000000000000..1b6d70aa3dd3abbdd3d3b4510b5e3ec21645f0bb Binary files /dev/null and b/Assets/RawAssets/Textures/close.png differ diff --git a/Assets/RawAssets/Textures/close.png.meta b/Assets/RawAssets/Textures/close.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..71f4d6ea4f70a4d5ace34e4ab59c6c1c66a5a8f3 --- /dev/null +++ b/Assets/RawAssets/Textures/close.png.meta @@ -0,0 +1,96 @@ +fileFormatVersion: 2 +guid: 29dbb24aa8cfdd842b05e2263edf32fe +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RawAssets/Textures/dui.png b/Assets/RawAssets/Textures/dui.png new file mode 100644 index 0000000000000000000000000000000000000000..4aa6aca8f9fe0ee2c83d3046ce95339e6c2ee84c Binary files /dev/null and b/Assets/RawAssets/Textures/dui.png differ diff --git a/Assets/RawAssets/Textures/dui.png.meta b/Assets/RawAssets/Textures/dui.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..6532a5b4e823d728d2fd93c07cdf66f7ce814ae9 --- /dev/null +++ b/Assets/RawAssets/Textures/dui.png.meta @@ -0,0 +1,96 @@ +fileFormatVersion: 2 +guid: 309e92e7f2e056c4ab7a518c5b2ed61f +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RawAssets/Textures/frame.png b/Assets/RawAssets/Textures/frame.png new file mode 100644 index 0000000000000000000000000000000000000000..3a9cceb575c702a1441fed4eda89fe7e72d63749 Binary files /dev/null and b/Assets/RawAssets/Textures/frame.png differ diff --git a/Assets/RawAssets/Textures/frame.png.meta b/Assets/RawAssets/Textures/frame.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..0ee07866065d6d6225443b384a09179b69a5988f --- /dev/null +++ b/Assets/RawAssets/Textures/frame.png.meta @@ -0,0 +1,96 @@ +fileFormatVersion: 2 +guid: e6fc4d1a32513d64b987ea15d99cf3c9 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 7, y: 7, z: 7, w: 7} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RawAssets/Textures/guanzhu.png b/Assets/RawAssets/Textures/guanzhu.png new file mode 100644 index 0000000000000000000000000000000000000000..c2e08db5cab8d62e8c41c71b31bdd274734ae3f3 Binary files /dev/null and b/Assets/RawAssets/Textures/guanzhu.png differ diff --git a/Assets/RawAssets/Textures/guanzhu.png.meta b/Assets/RawAssets/Textures/guanzhu.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..8d4d215c5cb67258b43f88053a7d3bd729605a2a --- /dev/null +++ b/Assets/RawAssets/Textures/guanzhu.png.meta @@ -0,0 +1,96 @@ +fileFormatVersion: 2 +guid: e588197f5d9db114dabf74a3d4c8b967 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RawAssets/Textures/like.png b/Assets/RawAssets/Textures/like.png new file mode 100644 index 0000000000000000000000000000000000000000..f1dc5649287ef7c7400262c6bbd06a353219d2a3 Binary files /dev/null and b/Assets/RawAssets/Textures/like.png differ diff --git a/Assets/RawAssets/Textures/like.png.meta b/Assets/RawAssets/Textures/like.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..7ed1dbb43f828738c8ea1ec7495dbe373ed48b2c --- /dev/null +++ b/Assets/RawAssets/Textures/like.png.meta @@ -0,0 +1,96 @@ +fileFormatVersion: 2 +guid: dfa52f43425978e489c788838a99092b +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RawAssets/Textures/out.png b/Assets/RawAssets/Textures/out.png new file mode 100644 index 0000000000000000000000000000000000000000..dee59beddc2c48a59d9a0e1ab008505ec93b2184 Binary files /dev/null and b/Assets/RawAssets/Textures/out.png differ diff --git a/Assets/RawAssets/Textures/out.png.meta b/Assets/RawAssets/Textures/out.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..78b101a3d4a0202517d2c2a800ce19d2bd9d98c1 --- /dev/null +++ b/Assets/RawAssets/Textures/out.png.meta @@ -0,0 +1,96 @@ +fileFormatVersion: 2 +guid: fec64a66745a219459654b9bbe5e06b8 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RawAssets/Textures/pwd.png b/Assets/RawAssets/Textures/pwd.png new file mode 100644 index 0000000000000000000000000000000000000000..bf5515ea67d88ec562e3faf6fc6caa2dbb0e43be Binary files /dev/null and b/Assets/RawAssets/Textures/pwd.png differ diff --git a/Assets/RawAssets/Textures/pwd.png.meta b/Assets/RawAssets/Textures/pwd.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..cbefb1f5d12118fe6eb04bc7a1a0bcc084db5eb7 --- /dev/null +++ b/Assets/RawAssets/Textures/pwd.png.meta @@ -0,0 +1,96 @@ +fileFormatVersion: 2 +guid: ede2bf3c6e8fcd345a1fd494c190f020 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RawAssets/Textures/shoucang.png b/Assets/RawAssets/Textures/shoucang.png new file mode 100644 index 0000000000000000000000000000000000000000..ad6d747307df9be13ca2beb20ae5fb2e160893c9 Binary files /dev/null and b/Assets/RawAssets/Textures/shoucang.png differ diff --git a/Assets/RawAssets/Textures/shoucang.png.meta b/Assets/RawAssets/Textures/shoucang.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..51dc2876bb69d46eee8379d2ef03b596197d4364 --- /dev/null +++ b/Assets/RawAssets/Textures/shoucang.png.meta @@ -0,0 +1,96 @@ +fileFormatVersion: 2 +guid: c9d2c9c87e8a3ba4eaac921312ad1512 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RawAssets/Textures/slider.png b/Assets/RawAssets/Textures/slider.png new file mode 100644 index 0000000000000000000000000000000000000000..39722fcac5d489f7381d27da8bc16d512aeac5a6 Binary files /dev/null and b/Assets/RawAssets/Textures/slider.png differ diff --git a/Assets/RawAssets/Textures/slider.png.meta b/Assets/RawAssets/Textures/slider.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..df3f69cd9c7d2f43547a3a99086ebaf1fcd3f1fa --- /dev/null +++ b/Assets/RawAssets/Textures/slider.png.meta @@ -0,0 +1,96 @@ +fileFormatVersion: 2 +guid: 39f15389aac6ab54fb0a0e64186596e9 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 38, y: 47, z: 38, w: 47} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources.meta b/Assets/Resources.meta new file mode 100644 index 0000000000000000000000000000000000000000..14acfbce5b856cb220dd8239dd61ce444825d728 --- /dev/null +++ b/Assets/Resources.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a23982d192e9fac48b179066b1d4c13c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/version.bytes b/Assets/Resources/version.bytes new file mode 100644 index 0000000000000000000000000000000000000000..34191124d599aceabff0e170df524f86bc296dc3 --- /dev/null +++ b/Assets/Resources/version.bytes @@ -0,0 +1 @@ +{"app_version":"1.0.0.1","res_version":"1.0.0.1"} \ No newline at end of file diff --git a/Assets/Resources/version.bytes.meta b/Assets/Resources/version.bytes.meta new file mode 100644 index 0000000000000000000000000000000000000000..0459e60c2dc40598083cb95022baa7fd9953d623 --- /dev/null +++ b/Assets/Resources/version.bytes.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: dce6b319b082d4b41a4df6a650dc1082 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes.meta b/Assets/Scenes.meta new file mode 100644 index 0000000000000000000000000000000000000000..149e2e9fed4026a38a7c72cd048a10c5047f936b --- /dev/null +++ b/Assets/Scenes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 04918bdbba0eed14aafb7620ba9f3a29 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity new file mode 100644 index 0000000000000000000000000000000000000000..9599539709a6826ba724782523a0fad1f319f3c5 --- /dev/null +++ b/Assets/Scenes/Main.unity @@ -0,0 +1,667 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} + m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} + m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 1 + m_BakeResolution: 50 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 0 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 0 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 1024 + m_ReflectionCompression: 2 + m_MixedBakeMode: 1 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 512 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 0 + m_PVRDenoiserTypeDirect: 0 + m_PVRDenoiserTypeIndirect: 0 + m_PVRDenoiserTypeAO: 0 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 0 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 1965632179} +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666666 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &347587867 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 347587868} + - component: {fileID: 347587871} + - component: {fileID: 347587870} + - component: {fileID: 347587869} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &347587868 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 347587867} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!114 &347587869 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 347587867} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &347587870 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 347587867} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 1 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 1280, y: 720} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!223 &347587871 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 347587867} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 1 + m_Camera: {fileID: 1101727797} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 25 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!1 &379554406 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 379554410} + - component: {fileID: 379554409} + - component: {fileID: 379554408} + - component: {fileID: 379554407} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &379554407 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 379554406} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2d49b7c1bcd2e07499844da127be038d, type: 3} + m_Name: + m_EditorClassIdentifier: + m_ForceModuleActive: 0 +--- !u!114 &379554408 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 379554406} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!114 &379554409 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 379554406} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 5 +--- !u!4 &379554410 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 379554406} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &413256833 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 413256835} + - component: {fileID: 413256834} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &413256834 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 413256833} + m_Enabled: 1 + serializedVersion: 10 + m_Type: 1 + m_Shape: 0 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + m_CookieSize: 10 + m_Shadows: + m_Type: 0 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_UseViewFrustumForShadowCasterCull: 1 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &413256835 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 413256833} + m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} + m_LocalPosition: {x: 0.419936, y: -0.12984751, z: -0.06300008} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!1 &1101727793 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1101727798} + - component: {fileID: 1101727797} + - component: {fileID: 1101727796} + m_Layer: 0 + m_Name: UICamera + m_TagString: GuiCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!124 &1101727796 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1101727793} + m_Enabled: 1 +--- !u!20 &1101727797 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1101727793} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 3 + m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0.019607844} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: -1000 + far clip plane: 1000 + field of view: 60 + orthographic: 1 + orthographic size: 5 + m_Depth: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 32 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1101727798 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1101727793} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.013888889, y: 0.013888889, z: 0.013888889} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1342778138 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1342778141} + - component: {fileID: 1342778140} + - component: {fileID: 1342778139} + m_Layer: 0 + m_Name: Main Camera + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1342778139 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1342778138} + m_Enabled: 1 +--- !u!20 &1342778140 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1342778138} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 2 + m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 23 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1342778141 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1342778138} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1594091349 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1594091350} + - component: {fileID: 1594091351} + m_Layer: 0 + m_Name: GameManager + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1594091350 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1594091349} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1594091351 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1594091349} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c13baae76dc25164fbbeec8317b29af0, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!850595691 &1965632179 +LightingSettings: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Settings.lighting + serializedVersion: 3 + m_GIWorkflowMode: 1 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_RealtimeEnvironmentLighting: 1 + m_BounceScale: 1 + m_AlbedoBoost: 1 + m_IndirectOutputScale: 1 + m_UsingShadowmask: 0 + m_BakeBackend: 0 + m_LightmapMaxSize: 1024 + m_BakeResolution: 50 + m_Padding: 2 + m_TextureCompression: 0 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 0 + m_CompAOExponentDirect: 0 + m_ExtractAO: 0 + m_MixedBakeMode: 1 + m_LightmapsBakeMode: 1 + m_FilterMode: 1 + m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0} + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_RealtimeResolution: 1 + m_ForceWhiteAlbedo: 0 + m_ForceUpdates: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_FinalGatherFiltering: 1 + m_PVRCulling: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVREnvironmentSampleCount: 512 + m_PVREnvironmentReferencePointCount: 2048 + m_LightProbeSampleCountMultiplier: 4 + m_PVRBounces: 2 + m_PVRMinBounces: 2 + m_PVREnvironmentMIS: 0 + m_PVRFilteringMode: 0 + m_PVRDenoiserTypeDirect: 0 + m_PVRDenoiserTypeIndirect: 0 + m_PVRDenoiserTypeAO: 0 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 diff --git a/Assets/Scenes/Main.unity.meta b/Assets/Scenes/Main.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..344a2c597fcbfa42058e22e22d6f845728fdb962 --- /dev/null +++ b/Assets/Scenes/Main.unity.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 75eee5e7009aba84192cfcdff8590f2a +DefaultImporter: + userData: diff --git a/Assets/Scripts.meta b/Assets/Scripts.meta new file mode 100644 index 0000000000000000000000000000000000000000..43c3228c2024605a61e274d5fa68ce6388df76c0 --- /dev/null +++ b/Assets/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d03659aa111993e46b76a8ef792ee1e6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/3rd.meta b/Assets/Scripts/3rd.meta new file mode 100644 index 0000000000000000000000000000000000000000..faf6ba0a40547a69e39ec69131c8069b37192e75 --- /dev/null +++ b/Assets/Scripts/3rd.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 262e4fcbaf3bdad42bf0be4dc19eeadf +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/3rd/LitJson.meta b/Assets/Scripts/3rd/LitJson.meta new file mode 100644 index 0000000000000000000000000000000000000000..fd3a281cd3bd0ddeadd030e24d27108f9f595555 --- /dev/null +++ b/Assets/Scripts/3rd/LitJson.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: eac58aff25a6ecb41a8030cd20bea029 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/3rd/LitJson/AssemblyInfo.cs.in b/Assets/Scripts/3rd/LitJson/AssemblyInfo.cs.in new file mode 100644 index 0000000000000000000000000000000000000000..2cd1f90a44b086ac09c665a1ca5160f767a320ba --- /dev/null +++ b/Assets/Scripts/3rd/LitJson/AssemblyInfo.cs.in @@ -0,0 +1,18 @@ +using System; +using System.Reflection; +using System.Runtime.CompilerServices; + + +[assembly: CLSCompliant (true)] + +[assembly: AssemblyTitle ("LitJson")] +[assembly: AssemblyDescription ("LitJSON library")] +[assembly: AssemblyConfiguration ("")] +[assembly: AssemblyCompany ("")] +[assembly: AssemblyProduct ("LitJSON")] +[assembly: AssemblyCopyright ( + "The authors disclaim copyright to this source code")] +[assembly: AssemblyTrademark ("")] +[assembly: AssemblyCulture ("")] + +[assembly: AssemblyVersion ("@ASSEMBLY_VERSION@")] diff --git a/Assets/Scripts/3rd/LitJson/AssemblyInfo.cs.in.meta b/Assets/Scripts/3rd/LitJson/AssemblyInfo.cs.in.meta new file mode 100644 index 0000000000000000000000000000000000000000..3ade5f2bea77d6e9502b645741fc42510daa385f --- /dev/null +++ b/Assets/Scripts/3rd/LitJson/AssemblyInfo.cs.in.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: e6a313b40479b1b458f50d8d26d7f867 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/3rd/LitJson/IJsonWrapper.cs b/Assets/Scripts/3rd/LitJson/IJsonWrapper.cs new file mode 100644 index 0000000000000000000000000000000000000000..9b7e2d164b783c2b99cbdd05d99970ccedcf4b3e --- /dev/null +++ b/Assets/Scripts/3rd/LitJson/IJsonWrapper.cs @@ -0,0 +1,60 @@ +#region Header +/** + * IJsonWrapper.cs + * Interface that represents a type capable of handling all kinds of JSON + * data. This is mainly used when mapping objects through JsonMapper, and + * it's implemented by JsonData. + * + * The authors disclaim copyright to this source code. For more details, see + * the COPYING file included with this distribution. + **/ +#endregion + + +using System.Collections; +using System.Collections.Specialized; + + +namespace LitJson +{ + public enum JsonType + { + None, + + Object, + Array, + String, + Int, + Long, + Double, + Boolean + } + + public interface IJsonWrapper : IList, IOrderedDictionary + { + bool IsArray { get; } + bool IsBoolean { get; } + bool IsDouble { get; } + bool IsInt { get; } + bool IsLong { get; } + bool IsObject { get; } + bool IsString { get; } + + bool GetBoolean (); + double GetDouble (); + int GetInt (); + JsonType GetJsonType (); + long GetLong (); + string GetString (); + + void SetBoolean (bool val); + void SetDouble (double val); + void SetInt (int val); + void SetJsonType (JsonType type); + void SetLong (long val); + void SetString (string val); + + string ToJson (); + void ToJson (JsonWriter writer); + } +} diff --git a/Assets/Scripts/3rd/LitJson/IJsonWrapper.cs.meta b/Assets/Scripts/3rd/LitJson/IJsonWrapper.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..ab6854db08b056193e3f8e2a6d6d8c4c48737c95 --- /dev/null +++ b/Assets/Scripts/3rd/LitJson/IJsonWrapper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 80dfee05c6838df438e5aad0ea456d01 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/3rd/LitJson/JsonData.cs b/Assets/Scripts/3rd/LitJson/JsonData.cs new file mode 100644 index 0000000000000000000000000000000000000000..e89e4b14c48e0c9969f30cbeda642cfd19c0820f --- /dev/null +++ b/Assets/Scripts/3rd/LitJson/JsonData.cs @@ -0,0 +1,1059 @@ +#region Header +/** + * JsonData.cs + * Generic type to hold JSON data (objects, arrays, and so on). This is + * the default type returned by JsonMapper.ToObject(). + * + * The authors disclaim copyright to this source code. For more details, see + * the COPYING file included with this distribution. + **/ +#endregion + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.IO; + + +namespace LitJson +{ + public class JsonData : IJsonWrapper, IEquatable + { + #region Fields + private IList inst_array; + private bool inst_boolean; + private double inst_double; + private int inst_int; + private long inst_long; + private IDictionary inst_object; + private string inst_string; + private string json; + private JsonType type; + + // Used to implement the IOrderedDictionary interface + private IList> object_list; + #endregion + + + #region Properties + public int Count { + get { return EnsureCollection ().Count; } + } + + public bool IsArray { + get { return type == JsonType.Array; } + } + + public bool IsBoolean { + get { return type == JsonType.Boolean; } + } + + public bool IsDouble { + get { return type == JsonType.Double; } + } + + public bool IsInt { + get { return type == JsonType.Int; } + } + + public bool IsLong { + get { return type == JsonType.Long; } + } + + public bool IsObject { + get { return type == JsonType.Object; } + } + + public bool IsString { + get { return type == JsonType.String; } + } + + public ICollection Keys { + get { EnsureDictionary (); return inst_object.Keys; } + } + + /// + /// Determines whether the json contains an element that has the specified key. + /// + /// The key to locate in the json. + /// true if the json contains an element that has the specified key; otherwise, false. + public Boolean ContainsKey(String key) { + EnsureDictionary(); + return this.inst_object.Keys.Contains(key); + } + #endregion + + + #region ICollection Properties + int ICollection.Count { + get { + return Count; + } + } + + bool ICollection.IsSynchronized { + get { + return EnsureCollection ().IsSynchronized; + } + } + + object ICollection.SyncRoot { + get { + return EnsureCollection ().SyncRoot; + } + } + #endregion + + + #region IDictionary Properties + bool IDictionary.IsFixedSize { + get { + return EnsureDictionary ().IsFixedSize; + } + } + + bool IDictionary.IsReadOnly { + get { + return EnsureDictionary ().IsReadOnly; + } + } + + ICollection IDictionary.Keys { + get { + EnsureDictionary (); + IList keys = new List (); + + foreach (KeyValuePair entry in + object_list) { + keys.Add (entry.Key); + } + + return (ICollection) keys; + } + } + + ICollection IDictionary.Values { + get { + EnsureDictionary (); + IList values = new List (); + + foreach (KeyValuePair entry in + object_list) { + values.Add (entry.Value); + } + + return (ICollection) values; + } + } + #endregion + + + + #region IJsonWrapper Properties + bool IJsonWrapper.IsArray { + get { return IsArray; } + } + + bool IJsonWrapper.IsBoolean { + get { return IsBoolean; } + } + + bool IJsonWrapper.IsDouble { + get { return IsDouble; } + } + + bool IJsonWrapper.IsInt { + get { return IsInt; } + } + + bool IJsonWrapper.IsLong { + get { return IsLong; } + } + + bool IJsonWrapper.IsObject { + get { return IsObject; } + } + + bool IJsonWrapper.IsString { + get { return IsString; } + } + #endregion + + + #region IList Properties + bool IList.IsFixedSize { + get { + return EnsureList ().IsFixedSize; + } + } + + bool IList.IsReadOnly { + get { + return EnsureList ().IsReadOnly; + } + } + #endregion + + + #region IDictionary Indexer + object IDictionary.this[object key] { + get { + return EnsureDictionary ()[key]; + } + + set { + if (! (key is String)) + throw new ArgumentException ( + "The key has to be a string"); + + JsonData data = ToJsonData (value); + + this[(string) key] = data; + } + } + #endregion + + + #region IOrderedDictionary Indexer + object IOrderedDictionary.this[int idx] { + get { + EnsureDictionary (); + return object_list[idx].Value; + } + + set { + EnsureDictionary (); + JsonData data = ToJsonData (value); + + KeyValuePair old_entry = object_list[idx]; + + inst_object[old_entry.Key] = data; + + KeyValuePair entry = + new KeyValuePair (old_entry.Key, data); + + object_list[idx] = entry; + } + } + #endregion + + + #region IList Indexer + object IList.this[int index] { + get { + return EnsureList ()[index]; + } + + set { + EnsureList (); + JsonData data = ToJsonData (value); + + this[index] = data; + } + } + #endregion + + + #region Public Indexers + public JsonData this[string prop_name] { + get { + EnsureDictionary (); + return inst_object[prop_name]; + } + + set { + EnsureDictionary (); + + KeyValuePair entry = + new KeyValuePair (prop_name, value); + + if (inst_object.ContainsKey (prop_name)) { + for (int i = 0; i < object_list.Count; i++) { + if (object_list[i].Key == prop_name) { + object_list[i] = entry; + break; + } + } + } else + object_list.Add (entry); + + inst_object[prop_name] = value; + + json = null; + } + } + + public JsonData this[int index] { + get { + EnsureCollection (); + + if (type == JsonType.Array) + return inst_array[index]; + + return object_list[index].Value; + } + + set { + EnsureCollection (); + + if (type == JsonType.Array) + inst_array[index] = value; + else { + KeyValuePair entry = object_list[index]; + KeyValuePair new_entry = + new KeyValuePair (entry.Key, value); + + object_list[index] = new_entry; + inst_object[entry.Key] = value; + } + + json = null; + } + } + #endregion + + + #region Constructors + public JsonData () + { + } + + public JsonData (bool boolean) + { + type = JsonType.Boolean; + inst_boolean = boolean; + } + + public JsonData (double number) + { + type = JsonType.Double; + inst_double = number; + } + + public JsonData (int number) + { + type = JsonType.Int; + inst_int = number; + } + + public JsonData (long number) + { + type = JsonType.Long; + inst_long = number; + } + + public JsonData (object obj) + { + if (obj is Boolean) { + type = JsonType.Boolean; + inst_boolean = (bool) obj; + return; + } + + if (obj is Double) { + type = JsonType.Double; + inst_double = (double) obj; + return; + } + + if (obj is Int32) { + type = JsonType.Int; + inst_int = (int) obj; + return; + } + + if (obj is Int64) { + type = JsonType.Long; + inst_long = (long) obj; + return; + } + + if (obj is String) { + type = JsonType.String; + inst_string = (string) obj; + return; + } + + throw new ArgumentException ( + "Unable to wrap the given object with JsonData"); + } + + public JsonData (string str) + { + type = JsonType.String; + inst_string = str; + } + #endregion + + + #region Implicit Conversions + public static implicit operator JsonData (Boolean data) + { + return new JsonData (data); + } + + public static implicit operator JsonData (Double data) + { + return new JsonData (data); + } + + public static implicit operator JsonData (Int32 data) + { + return new JsonData (data); + } + + public static implicit operator JsonData (Int64 data) + { + return new JsonData (data); + } + + public static implicit operator JsonData (String data) + { + return new JsonData (data); + } + #endregion + + + #region Explicit Conversions + public static explicit operator Boolean (JsonData data) + { + if (data.type != JsonType.Boolean) + throw new InvalidCastException ( + "Instance of JsonData doesn't hold a double"); + + return data.inst_boolean; + } + + public static explicit operator Double (JsonData data) + { + if (data.type != JsonType.Double) + throw new InvalidCastException ( + "Instance of JsonData doesn't hold a double"); + + return data.inst_double; + } + + public static explicit operator Int32(JsonData data) + { + if (data.type != JsonType.Int && data.type != JsonType.Long) + { + throw new InvalidCastException( + "Instance of JsonData doesn't hold an int"); + } + + // cast may truncate data... but that's up to the user to consider + return data.type == JsonType.Int ? data.inst_int : (int)data.inst_long; + } + + public static explicit operator Int64(JsonData data) + { + if (data.type != JsonType.Long && data.type != JsonType.Int) + { + throw new InvalidCastException( + "Instance of JsonData doesn't hold a long"); + } + + return data.type == JsonType.Long ? data.inst_long : data.inst_int; + } + + public static explicit operator String (JsonData data) + { + if (data.type != JsonType.String) + throw new InvalidCastException ( + "Instance of JsonData doesn't hold a string"); + + return data.inst_string; + } + #endregion + + + #region ICollection Methods + void ICollection.CopyTo (Array array, int index) + { + EnsureCollection ().CopyTo (array, index); + } + #endregion + + + #region IDictionary Methods + void IDictionary.Add (object key, object value) + { + JsonData data = ToJsonData (value); + + EnsureDictionary ().Add (key, data); + + KeyValuePair entry = + new KeyValuePair ((string) key, data); + object_list.Add (entry); + + json = null; + } + + void IDictionary.Clear () + { + EnsureDictionary ().Clear (); + object_list.Clear (); + json = null; + } + + bool IDictionary.Contains (object key) + { + return EnsureDictionary ().Contains (key); + } + + IDictionaryEnumerator IDictionary.GetEnumerator () + { + return ((IOrderedDictionary) this).GetEnumerator (); + } + + void IDictionary.Remove (object key) + { + EnsureDictionary ().Remove (key); + + for (int i = 0; i < object_list.Count; i++) { + if (object_list[i].Key == (string) key) { + object_list.RemoveAt (i); + break; + } + } + + json = null; + } + #endregion + + + #region IEnumerable Methods + IEnumerator IEnumerable.GetEnumerator () + { + return EnsureCollection ().GetEnumerator (); + } + #endregion + + + #region IJsonWrapper Methods + bool IJsonWrapper.GetBoolean () + { + if (type != JsonType.Boolean) + throw new InvalidOperationException ( + "JsonData instance doesn't hold a boolean"); + + return inst_boolean; + } + + double IJsonWrapper.GetDouble () + { + if (type != JsonType.Double) + throw new InvalidOperationException ( + "JsonData instance doesn't hold a double"); + + return inst_double; + } + + int IJsonWrapper.GetInt () + { + if (type != JsonType.Int) + throw new InvalidOperationException ( + "JsonData instance doesn't hold an int"); + + return inst_int; + } + + long IJsonWrapper.GetLong () + { + if (type != JsonType.Long) + throw new InvalidOperationException ( + "JsonData instance doesn't hold a long"); + + return inst_long; + } + + string IJsonWrapper.GetString () + { + if (type != JsonType.String) + throw new InvalidOperationException ( + "JsonData instance doesn't hold a string"); + + return inst_string; + } + + void IJsonWrapper.SetBoolean (bool val) + { + type = JsonType.Boolean; + inst_boolean = val; + json = null; + } + + void IJsonWrapper.SetDouble (double val) + { + type = JsonType.Double; + inst_double = val; + json = null; + } + + void IJsonWrapper.SetInt (int val) + { + type = JsonType.Int; + inst_int = val; + json = null; + } + + void IJsonWrapper.SetLong (long val) + { + type = JsonType.Long; + inst_long = val; + json = null; + } + + void IJsonWrapper.SetString (string val) + { + type = JsonType.String; + inst_string = val; + json = null; + } + + string IJsonWrapper.ToJson () + { + return ToJson (); + } + + void IJsonWrapper.ToJson (JsonWriter writer) + { + ToJson (writer); + } + #endregion + + + #region IList Methods + int IList.Add (object value) + { + return Add (value); + } + + void IList.Clear () + { + EnsureList ().Clear (); + json = null; + } + + bool IList.Contains (object value) + { + return EnsureList ().Contains (value); + } + + int IList.IndexOf (object value) + { + return EnsureList ().IndexOf (value); + } + + void IList.Insert (int index, object value) + { + EnsureList ().Insert (index, value); + json = null; + } + + void IList.Remove (object value) + { + EnsureList ().Remove (value); + json = null; + } + + void IList.RemoveAt (int index) + { + EnsureList ().RemoveAt (index); + json = null; + } + #endregion + + + #region IOrderedDictionary Methods + IDictionaryEnumerator IOrderedDictionary.GetEnumerator () + { + EnsureDictionary (); + + return new OrderedDictionaryEnumerator ( + object_list.GetEnumerator ()); + } + + void IOrderedDictionary.Insert (int idx, object key, object value) + { + string property = (string) key; + JsonData data = ToJsonData (value); + + this[property] = data; + + KeyValuePair entry = + new KeyValuePair (property, data); + + object_list.Insert (idx, entry); + } + + void IOrderedDictionary.RemoveAt (int idx) + { + EnsureDictionary (); + + inst_object.Remove (object_list[idx].Key); + object_list.RemoveAt (idx); + } + #endregion + + + #region Private Methods + private ICollection EnsureCollection () + { + if (type == JsonType.Array) + return (ICollection) inst_array; + + if (type == JsonType.Object) + return (ICollection) inst_object; + + throw new InvalidOperationException ( + "The JsonData instance has to be initialized first"); + } + + private IDictionary EnsureDictionary () + { + if (type == JsonType.Object) + return (IDictionary) inst_object; + + if (type != JsonType.None) + throw new InvalidOperationException ( + "Instance of JsonData is not a dictionary"); + + type = JsonType.Object; + inst_object = new Dictionary (); + object_list = new List> (); + + return (IDictionary) inst_object; + } + + private IList EnsureList () + { + if (type == JsonType.Array) + return (IList) inst_array; + + if (type != JsonType.None) + throw new InvalidOperationException ( + "Instance of JsonData is not a list"); + + type = JsonType.Array; + inst_array = new List (); + + return (IList) inst_array; + } + + private JsonData ToJsonData (object obj) + { + if (obj == null) + return null; + + if (obj is JsonData) + return (JsonData) obj; + + return new JsonData (obj); + } + + private static void WriteJson (IJsonWrapper obj, JsonWriter writer) + { + if (obj == null) { + writer.Write (null); + return; + } + + if (obj.IsString) { + writer.Write (obj.GetString ()); + return; + } + + if (obj.IsBoolean) { + writer.Write (obj.GetBoolean ()); + return; + } + + if (obj.IsDouble) { + writer.Write (obj.GetDouble ()); + return; + } + + if (obj.IsInt) { + writer.Write (obj.GetInt ()); + return; + } + + if (obj.IsLong) { + writer.Write (obj.GetLong ()); + return; + } + + if (obj.IsArray) { + writer.WriteArrayStart (); + foreach (object elem in (IList) obj) + WriteJson ((JsonData) elem, writer); + writer.WriteArrayEnd (); + + return; + } + + if (obj.IsObject) { + writer.WriteObjectStart (); + + foreach (DictionaryEntry entry in ((IDictionary) obj)) { + writer.WritePropertyName ((string) entry.Key); + WriteJson ((JsonData) entry.Value, writer); + } + writer.WriteObjectEnd (); + + return; + } + } + #endregion + + + public int Add (object value) + { + JsonData data = ToJsonData (value); + + json = null; + + return EnsureList ().Add (data); + } + + public bool Remove(object obj) + { + json = null; + if(IsObject) + { + JsonData value = null; + if (inst_object.TryGetValue((string)obj, out value)) + return inst_object.Remove((string)obj) && object_list.Remove(new KeyValuePair((string)obj, value)); + else + throw new KeyNotFoundException("The specified key was not found in the JsonData object."); + } + if(IsArray) + { + return inst_array.Remove(ToJsonData(obj)); + } + throw new InvalidOperationException ( + "Instance of JsonData is not an object or a list."); + } + + public void Clear () + { + if (IsObject) { + ((IDictionary) this).Clear (); + return; + } + + if (IsArray) { + ((IList) this).Clear (); + return; + } + } + + public bool Equals (JsonData x) + { + if (x == null) + return false; + + if (x.type != this.type) + { + // further check to see if this is a long to int comparison + if ((x.type != JsonType.Int && x.type != JsonType.Long) + || (this.type != JsonType.Int && this.type != JsonType.Long)) + { + return false; + } + } + + switch (this.type) { + case JsonType.None: + return true; + + case JsonType.Object: + return this.inst_object.Equals (x.inst_object); + + case JsonType.Array: + return this.inst_array.Equals (x.inst_array); + + case JsonType.String: + return this.inst_string.Equals (x.inst_string); + + case JsonType.Int: + { + if (x.IsLong) + { + if (x.inst_long < Int32.MinValue || x.inst_long > Int32.MaxValue) + return false; + return this.inst_int.Equals((int)x.inst_long); + } + return this.inst_int.Equals(x.inst_int); + } + + case JsonType.Long: + { + if (x.IsInt) + { + if (this.inst_long < Int32.MinValue || this.inst_long > Int32.MaxValue) + return false; + return x.inst_int.Equals((int)this.inst_long); + } + return this.inst_long.Equals(x.inst_long); + } + + case JsonType.Double: + return this.inst_double.Equals (x.inst_double); + + case JsonType.Boolean: + return this.inst_boolean.Equals (x.inst_boolean); + } + + return false; + } + + public JsonType GetJsonType () + { + return type; + } + + public void SetJsonType (JsonType type) + { + if (this.type == type) + return; + + switch (type) { + case JsonType.None: + break; + + case JsonType.Object: + inst_object = new Dictionary (); + object_list = new List> (); + break; + + case JsonType.Array: + inst_array = new List (); + break; + + case JsonType.String: + inst_string = default (String); + break; + + case JsonType.Int: + inst_int = default (Int32); + break; + + case JsonType.Long: + inst_long = default (Int64); + break; + + case JsonType.Double: + inst_double = default (Double); + break; + + case JsonType.Boolean: + inst_boolean = default (Boolean); + break; + } + + this.type = type; + } + + public string ToJson () + { + if (json != null) + return json; + + StringWriter sw = new StringWriter (); + JsonWriter writer = new JsonWriter (sw); + writer.Validate = false; + + WriteJson (this, writer); + json = sw.ToString (); + + return json; + } + + public void ToJson (JsonWriter writer) + { + bool old_validate = writer.Validate; + + writer.Validate = false; + + WriteJson (this, writer); + + writer.Validate = old_validate; + } + + public override string ToString () + { + switch (type) { + case JsonType.Array: + return "JsonData array"; + + case JsonType.Boolean: + return inst_boolean.ToString (); + + case JsonType.Double: + return inst_double.ToString (); + + case JsonType.Int: + return inst_int.ToString (); + + case JsonType.Long: + return inst_long.ToString (); + + case JsonType.Object: + return "JsonData object"; + + case JsonType.String: + return inst_string; + } + + return "Uninitialized JsonData"; + } + } + + + internal class OrderedDictionaryEnumerator : IDictionaryEnumerator + { + IEnumerator> list_enumerator; + + + public object Current { + get { return Entry; } + } + + public DictionaryEntry Entry { + get { + KeyValuePair curr = list_enumerator.Current; + return new DictionaryEntry (curr.Key, curr.Value); + } + } + + public object Key { + get { return list_enumerator.Current.Key; } + } + + public object Value { + get { return list_enumerator.Current.Value; } + } + + + public OrderedDictionaryEnumerator ( + IEnumerator> enumerator) + { + list_enumerator = enumerator; + } + + + public bool MoveNext () + { + return list_enumerator.MoveNext (); + } + + public void Reset () + { + list_enumerator.Reset (); + } + } +} diff --git a/Assets/Scripts/3rd/LitJson/JsonData.cs.meta b/Assets/Scripts/3rd/LitJson/JsonData.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..e9e637faf20251888a0488a451f721c9e7e460dc --- /dev/null +++ b/Assets/Scripts/3rd/LitJson/JsonData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b1d6f86e47c5cf3468c361720bab7e9e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/3rd/LitJson/JsonException.cs b/Assets/Scripts/3rd/LitJson/JsonException.cs new file mode 100644 index 0000000000000000000000000000000000000000..4efd8905db88248e429d8752ed1abdc8bd6e0ca3 --- /dev/null +++ b/Assets/Scripts/3rd/LitJson/JsonException.cs @@ -0,0 +1,65 @@ +#region Header +/** + * JsonException.cs + * Base class throwed by LitJSON when a parsing error occurs. + * + * The authors disclaim copyright to this source code. For more details, see + * the COPYING file included with this distribution. + **/ +#endregion + + +using System; + + +namespace LitJson +{ + public class JsonException : +#if NETSTANDARD1_5 + Exception +#else + ApplicationException +#endif + { + public JsonException () : base () + { + } + + internal JsonException (ParserToken token) : + base (String.Format ( + "Invalid token '{0}' in input string", token)) + { + } + + internal JsonException (ParserToken token, + Exception inner_exception) : + base (String.Format ( + "Invalid token '{0}' in input string", token), + inner_exception) + { + } + + internal JsonException (int c) : + base (String.Format ( + "Invalid character '{0}' in input string", (char) c)) + { + } + + internal JsonException (int c, Exception inner_exception) : + base (String.Format ( + "Invalid character '{0}' in input string", (char) c), + inner_exception) + { + } + + + public JsonException (string message) : base (message) + { + } + + public JsonException (string message, Exception inner_exception) : + base (message, inner_exception) + { + } + } +} diff --git a/Assets/Scripts/3rd/LitJson/JsonException.cs.meta b/Assets/Scripts/3rd/LitJson/JsonException.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..a2d08edc26cccd63dd164c93dcaccae602aa1500 --- /dev/null +++ b/Assets/Scripts/3rd/LitJson/JsonException.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a0bd8126161951a4c8e18ae0d75801a5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/3rd/LitJson/JsonMapper.cs b/Assets/Scripts/3rd/LitJson/JsonMapper.cs new file mode 100644 index 0000000000000000000000000000000000000000..99946cfda1ef3ef2043f3180ed0b0dd8f620ae19 --- /dev/null +++ b/Assets/Scripts/3rd/LitJson/JsonMapper.cs @@ -0,0 +1,987 @@ +#region Header +/** + * JsonMapper.cs + * JSON to .Net object and object to JSON conversions. + * + * The authors disclaim copyright to this source code. For more details, see + * the COPYING file included with this distribution. + **/ +#endregion + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Reflection; + + +namespace LitJson +{ + internal struct PropertyMetadata + { + public MemberInfo Info; + public bool IsField; + public Type Type; + } + + + internal struct ArrayMetadata + { + private Type element_type; + private bool is_array; + private bool is_list; + + + public Type ElementType { + get { + if (element_type == null) + return typeof (JsonData); + + return element_type; + } + + set { element_type = value; } + } + + public bool IsArray { + get { return is_array; } + set { is_array = value; } + } + + public bool IsList { + get { return is_list; } + set { is_list = value; } + } + } + + + internal struct ObjectMetadata + { + private Type element_type; + private bool is_dictionary; + + private IDictionary properties; + + + public Type ElementType { + get { + if (element_type == null) + return typeof (JsonData); + + return element_type; + } + + set { element_type = value; } + } + + public bool IsDictionary { + get { return is_dictionary; } + set { is_dictionary = value; } + } + + public IDictionary Properties { + get { return properties; } + set { properties = value; } + } + } + + + internal delegate void ExporterFunc (object obj, JsonWriter writer); + public delegate void ExporterFunc (T obj, JsonWriter writer); + + internal delegate object ImporterFunc (object input); + public delegate TValue ImporterFunc (TJson input); + + public delegate IJsonWrapper WrapperFactory (); + + + public class JsonMapper + { + #region Fields + private static readonly int max_nesting_depth; + + private static readonly IFormatProvider datetime_format; + + private static readonly IDictionary base_exporters_table; + private static readonly IDictionary custom_exporters_table; + + private static readonly IDictionary> base_importers_table; + private static readonly IDictionary> custom_importers_table; + + private static readonly IDictionary array_metadata; + private static readonly object array_metadata_lock = new Object (); + + private static readonly IDictionary> conv_ops; + private static readonly object conv_ops_lock = new Object (); + + private static readonly IDictionary object_metadata; + private static readonly object object_metadata_lock = new Object (); + + private static readonly IDictionary> type_properties; + private static readonly object type_properties_lock = new Object (); + + private static readonly JsonWriter static_writer; + private static readonly object static_writer_lock = new Object (); + #endregion + + + #region Constructors + static JsonMapper () + { + max_nesting_depth = 100; + + array_metadata = new Dictionary (); + conv_ops = new Dictionary> (); + object_metadata = new Dictionary (); + type_properties = new Dictionary> (); + + static_writer = new JsonWriter (); + + datetime_format = DateTimeFormatInfo.InvariantInfo; + + base_exporters_table = new Dictionary (); + custom_exporters_table = new Dictionary (); + + base_importers_table = new Dictionary> (); + custom_importers_table = new Dictionary> (); + + RegisterBaseExporters (); + RegisterBaseImporters (); + } + #endregion + + + #region Private Methods + private static void AddArrayMetadata (Type type) + { + if (array_metadata.ContainsKey (type)) + return; + + ArrayMetadata data = new ArrayMetadata (); + + data.IsArray = type.IsArray; + + if (type.GetInterface ("System.Collections.IList") != null) + data.IsList = true; + + foreach (PropertyInfo p_info in type.GetProperties ()) { + if (p_info.Name != "Item") + continue; + + ParameterInfo[] parameters = p_info.GetIndexParameters (); + + if (parameters.Length != 1) + continue; + + if (parameters[0].ParameterType == typeof (int)) + data.ElementType = p_info.PropertyType; + } + + lock (array_metadata_lock) { + try { + array_metadata.Add (type, data); + } catch (ArgumentException) { + return; + } + } + } + + private static void AddObjectMetadata (Type type) + { + if (object_metadata.ContainsKey (type)) + return; + + ObjectMetadata data = new ObjectMetadata (); + + if (type.GetInterface ("System.Collections.IDictionary") != null) + data.IsDictionary = true; + + data.Properties = new Dictionary (); + + foreach (PropertyInfo p_info in type.GetProperties ()) { + if (p_info.Name == "Item") { + ParameterInfo[] parameters = p_info.GetIndexParameters (); + + if (parameters.Length != 1) + continue; + + if (parameters[0].ParameterType == typeof (string)) + data.ElementType = p_info.PropertyType; + + continue; + } + + PropertyMetadata p_data = new PropertyMetadata (); + p_data.Info = p_info; + p_data.Type = p_info.PropertyType; + + data.Properties.Add (p_info.Name, p_data); + } + + foreach (FieldInfo f_info in type.GetFields ()) { + PropertyMetadata p_data = new PropertyMetadata (); + p_data.Info = f_info; + p_data.IsField = true; + p_data.Type = f_info.FieldType; + + data.Properties.Add (f_info.Name, p_data); + } + + lock (object_metadata_lock) { + try { + object_metadata.Add (type, data); + } catch (ArgumentException) { + return; + } + } + } + + private static void AddTypeProperties (Type type) + { + if (type_properties.ContainsKey (type)) + return; + + IList props = new List (); + + foreach (PropertyInfo p_info in type.GetProperties ()) { + if (p_info.Name == "Item") + continue; + + PropertyMetadata p_data = new PropertyMetadata (); + p_data.Info = p_info; + p_data.IsField = false; + props.Add (p_data); + } + + foreach (FieldInfo f_info in type.GetFields ()) { + PropertyMetadata p_data = new PropertyMetadata (); + p_data.Info = f_info; + p_data.IsField = true; + + props.Add (p_data); + } + + lock (type_properties_lock) { + try { + type_properties.Add (type, props); + } catch (ArgumentException) { + return; + } + } + } + + private static MethodInfo GetConvOp (Type t1, Type t2) + { + lock (conv_ops_lock) { + if (! conv_ops.ContainsKey (t1)) + conv_ops.Add (t1, new Dictionary ()); + } + + if (conv_ops[t1].ContainsKey (t2)) + return conv_ops[t1][t2]; + + MethodInfo op = t1.GetMethod ( + "op_Implicit", new Type[] { t2 }); + + lock (conv_ops_lock) { + try { + conv_ops[t1].Add (t2, op); + } catch (ArgumentException) { + return conv_ops[t1][t2]; + } + } + + return op; + } + + private static object ReadValue (Type inst_type, JsonReader reader) + { + reader.Read (); + + if (reader.Token == JsonToken.ArrayEnd) + return null; + + Type underlying_type = Nullable.GetUnderlyingType(inst_type); + Type value_type = underlying_type ?? inst_type; + + if (reader.Token == JsonToken.Null) { + #if NETSTANDARD1_5 + if (inst_type.IsClass() || underlying_type != null) { + return null; + } + #else + if (inst_type.IsClass || underlying_type != null) { + return null; + } + #endif + + throw new JsonException (String.Format ( + "Can't assign null to an instance of type {0}", + inst_type)); + } + + if (reader.Token == JsonToken.Double || + reader.Token == JsonToken.Int || + reader.Token == JsonToken.Long || + reader.Token == JsonToken.String || + reader.Token == JsonToken.Boolean) { + + Type json_type = reader.Value.GetType (); + + if (value_type.IsAssignableFrom (json_type)) + return reader.Value; + + // If there's a custom importer that fits, use it + if (custom_importers_table.ContainsKey (json_type) && + custom_importers_table[json_type].ContainsKey ( + value_type)) { + + ImporterFunc importer = + custom_importers_table[json_type][value_type]; + + return importer (reader.Value); + } + + // Maybe there's a base importer that works + if (base_importers_table.ContainsKey (json_type) && + base_importers_table[json_type].ContainsKey ( + value_type)) { + + ImporterFunc importer = + base_importers_table[json_type][value_type]; + + return importer (reader.Value); + } + + // Maybe it's an enum + #if NETSTANDARD1_5 + if (value_type.IsEnum()) + return Enum.ToObject (value_type, reader.Value); + #else + if (value_type.IsEnum) + return Enum.ToObject (value_type, reader.Value); + #endif + // Try using an implicit conversion operator + MethodInfo conv_op = GetConvOp (value_type, json_type); + + if (conv_op != null) + return conv_op.Invoke (null, + new object[] { reader.Value }); + + // No luck + throw new JsonException (String.Format ( + "Can't assign value '{0}' (type {1}) to type {2}", + reader.Value, json_type, inst_type)); + } + + object instance = null; + + if (reader.Token == JsonToken.ArrayStart) { + + AddArrayMetadata (inst_type); + ArrayMetadata t_data = array_metadata[inst_type]; + + if (! t_data.IsArray && ! t_data.IsList) + throw new JsonException (String.Format ( + "Type {0} can't act as an array", + inst_type)); + + IList list; + Type elem_type; + + if (! t_data.IsArray) { + list = (IList) Activator.CreateInstance (inst_type); + elem_type = t_data.ElementType; + } else { + list = new ArrayList (); + elem_type = inst_type.GetElementType (); + } + + list.Clear(); + + while (true) { + object item = ReadValue (elem_type, reader); + if (item == null && reader.Token == JsonToken.ArrayEnd) + break; + + list.Add (item); + } + + if (t_data.IsArray) { + int n = list.Count; + instance = Array.CreateInstance (elem_type, n); + + for (int i = 0; i < n; i++) + ((Array) instance).SetValue (list[i], i); + } else + instance = list; + + } else if (reader.Token == JsonToken.ObjectStart) { + AddObjectMetadata (value_type); + ObjectMetadata t_data = object_metadata[value_type]; + + instance = Activator.CreateInstance (value_type); + + while (true) { + reader.Read (); + + if (reader.Token == JsonToken.ObjectEnd) + break; + + string property = (string) reader.Value; + + if (t_data.Properties.ContainsKey (property)) { + PropertyMetadata prop_data = + t_data.Properties[property]; + + if (prop_data.IsField) { + ((FieldInfo) prop_data.Info).SetValue ( + instance, ReadValue (prop_data.Type, reader)); + } else { + PropertyInfo p_info = + (PropertyInfo) prop_data.Info; + + if (p_info.CanWrite) + p_info.SetValue ( + instance, + ReadValue (prop_data.Type, reader), + null); + else + ReadValue (prop_data.Type, reader); + } + + } else { + if (! t_data.IsDictionary) { + + if (! reader.SkipNonMembers) { + throw new JsonException (String.Format ( + "The type {0} doesn't have the " + + "property '{1}'", + inst_type, property)); + } else { + ReadSkip (reader); + continue; + } + } + + ((IDictionary) instance).Add ( + property, ReadValue ( + t_data.ElementType, reader)); + } + + } + + } + + return instance; + } + + private static IJsonWrapper ReadValue (WrapperFactory factory, + JsonReader reader) + { + reader.Read (); + + if (reader.Token == JsonToken.ArrayEnd || + reader.Token == JsonToken.Null) + return null; + + IJsonWrapper instance = factory (); + + if (reader.Token == JsonToken.String) { + instance.SetString ((string) reader.Value); + return instance; + } + + if (reader.Token == JsonToken.Double) { + instance.SetDouble ((double) reader.Value); + return instance; + } + + if (reader.Token == JsonToken.Int) { + instance.SetInt ((int) reader.Value); + return instance; + } + + if (reader.Token == JsonToken.Long) { + instance.SetLong ((long) reader.Value); + return instance; + } + + if (reader.Token == JsonToken.Boolean) { + instance.SetBoolean ((bool) reader.Value); + return instance; + } + + if (reader.Token == JsonToken.ArrayStart) { + instance.SetJsonType (JsonType.Array); + + while (true) { + IJsonWrapper item = ReadValue (factory, reader); + if (item == null && reader.Token == JsonToken.ArrayEnd) + break; + + ((IList) instance).Add (item); + } + } + else if (reader.Token == JsonToken.ObjectStart) { + instance.SetJsonType (JsonType.Object); + + while (true) { + reader.Read (); + + if (reader.Token == JsonToken.ObjectEnd) + break; + + string property = (string) reader.Value; + + ((IDictionary) instance)[property] = ReadValue ( + factory, reader); + } + + } + + return instance; + } + + private static void ReadSkip (JsonReader reader) + { + ToWrapper ( + delegate { return new JsonMockWrapper (); }, reader); + } + + private static void RegisterBaseExporters () + { + base_exporters_table[typeof (byte)] = + delegate (object obj, JsonWriter writer) { + writer.Write (Convert.ToInt32 ((byte) obj)); + }; + + base_exporters_table[typeof (char)] = + delegate (object obj, JsonWriter writer) { + writer.Write (Convert.ToString ((char) obj)); + }; + + base_exporters_table[typeof (DateTime)] = + delegate (object obj, JsonWriter writer) { + writer.Write (Convert.ToString ((DateTime) obj, + datetime_format)); + }; + + base_exporters_table[typeof (decimal)] = + delegate (object obj, JsonWriter writer) { + writer.Write ((decimal) obj); + }; + + base_exporters_table[typeof (sbyte)] = + delegate (object obj, JsonWriter writer) { + writer.Write (Convert.ToInt32 ((sbyte) obj)); + }; + + base_exporters_table[typeof (short)] = + delegate (object obj, JsonWriter writer) { + writer.Write (Convert.ToInt32 ((short) obj)); + }; + + base_exporters_table[typeof (ushort)] = + delegate (object obj, JsonWriter writer) { + writer.Write (Convert.ToInt32 ((ushort) obj)); + }; + + base_exporters_table[typeof (uint)] = + delegate (object obj, JsonWriter writer) { + writer.Write (Convert.ToUInt64 ((uint) obj)); + }; + + base_exporters_table[typeof (ulong)] = + delegate (object obj, JsonWriter writer) { + writer.Write ((ulong) obj); + }; + + base_exporters_table[typeof(DateTimeOffset)] = + delegate (object obj, JsonWriter writer) { + writer.Write(((DateTimeOffset)obj).ToString("yyyy-MM-ddTHH:mm:ss.fffffffzzz", datetime_format)); + }; + } + + private static void RegisterBaseImporters () + { + ImporterFunc importer; + + importer = delegate (object input) { + return Convert.ToByte ((int) input); + }; + RegisterImporter (base_importers_table, typeof (int), + typeof (byte), importer); + + importer = delegate (object input) { + return Convert.ToUInt64 ((int) input); + }; + RegisterImporter (base_importers_table, typeof (int), + typeof (ulong), importer); + + importer = delegate (object input) { + return Convert.ToInt64((int)input); + }; + RegisterImporter(base_importers_table, typeof(int), + typeof(long), importer); + + importer = delegate (object input) { + return Convert.ToSByte ((int) input); + }; + RegisterImporter (base_importers_table, typeof (int), + typeof (sbyte), importer); + + importer = delegate (object input) { + return Convert.ToInt16 ((int) input); + }; + RegisterImporter (base_importers_table, typeof (int), + typeof (short), importer); + + importer = delegate (object input) { + return Convert.ToUInt16 ((int) input); + }; + RegisterImporter (base_importers_table, typeof (int), + typeof (ushort), importer); + + importer = delegate (object input) { + return Convert.ToUInt32 ((int) input); + }; + RegisterImporter (base_importers_table, typeof (int), + typeof (uint), importer); + + importer = delegate (object input) { + return Convert.ToSingle ((int) input); + }; + RegisterImporter (base_importers_table, typeof (int), + typeof (float), importer); + + importer = delegate (object input) { + return Convert.ToDouble ((int) input); + }; + RegisterImporter (base_importers_table, typeof (int), + typeof (double), importer); + + importer = delegate (object input) { + return Convert.ToDecimal ((double) input); + }; + RegisterImporter (base_importers_table, typeof (double), + typeof (decimal), importer); + + importer = delegate (object input) { + return Convert.ToSingle((double)input); + }; + RegisterImporter(base_importers_table, typeof(double), + typeof(float), importer); + + importer = delegate (object input) { + return Convert.ToUInt32 ((long) input); + }; + RegisterImporter (base_importers_table, typeof (long), + typeof (uint), importer); + + importer = delegate (object input) { + return Convert.ToChar ((string) input); + }; + RegisterImporter (base_importers_table, typeof (string), + typeof (char), importer); + + importer = delegate (object input) { + return Convert.ToDateTime ((string) input, datetime_format); + }; + RegisterImporter (base_importers_table, typeof (string), + typeof (DateTime), importer); + + importer = delegate (object input) { + return DateTimeOffset.Parse((string)input, datetime_format); + }; + RegisterImporter(base_importers_table, typeof(string), + typeof(DateTimeOffset), importer); + } + + private static void RegisterImporter ( + IDictionary> table, + Type json_type, Type value_type, ImporterFunc importer) + { + if (! table.ContainsKey (json_type)) + table.Add (json_type, new Dictionary ()); + + table[json_type][value_type] = importer; + } + + private static void WriteValue (object obj, JsonWriter writer, + bool writer_is_private, + int depth) + { + if (depth > max_nesting_depth) + throw new JsonException ( + String.Format ("Max allowed object depth reached while " + + "trying to export from type {0}", + obj.GetType ())); + + if (obj == null) { + writer.Write (null); + return; + } + + if (obj is IJsonWrapper) { + if (writer_is_private) + writer.TextWriter.Write (((IJsonWrapper) obj).ToJson ()); + else + ((IJsonWrapper) obj).ToJson (writer); + + return; + } + + if (obj is String) { + writer.Write ((string) obj); + return; + } + + if (obj is Double) { + writer.Write ((double) obj); + return; + } + + if (obj is Single) + { + writer.Write((float)obj); + return; + } + + if (obj is Int32) { + writer.Write ((int) obj); + return; + } + + if (obj is Boolean) { + writer.Write ((bool) obj); + return; + } + + if (obj is Int64) { + writer.Write ((long) obj); + return; + } + + if (obj is Array) { + writer.WriteArrayStart (); + + foreach (object elem in (Array) obj) + WriteValue (elem, writer, writer_is_private, depth + 1); + + writer.WriteArrayEnd (); + + return; + } + + if (obj is IList) { + writer.WriteArrayStart (); + foreach (object elem in (IList) obj) + WriteValue (elem, writer, writer_is_private, depth + 1); + writer.WriteArrayEnd (); + + return; + } + + if (obj is IDictionary dictionary) { + writer.WriteObjectStart (); + foreach (DictionaryEntry entry in dictionary) { + var propertyName = entry.Key is string key ? + key + : Convert.ToString(entry.Key, CultureInfo.InvariantCulture); + writer.WritePropertyName (propertyName); + WriteValue (entry.Value, writer, writer_is_private, + depth + 1); + } + writer.WriteObjectEnd (); + + return; + } + + Type obj_type = obj.GetType (); + + // See if there's a custom exporter for the object + if (custom_exporters_table.ContainsKey (obj_type)) { + ExporterFunc exporter = custom_exporters_table[obj_type]; + exporter (obj, writer); + + return; + } + + // If not, maybe there's a base exporter + if (base_exporters_table.ContainsKey (obj_type)) { + ExporterFunc exporter = base_exporters_table[obj_type]; + exporter (obj, writer); + + return; + } + + // Last option, let's see if it's an enum + if (obj is Enum) { + Type e_type = Enum.GetUnderlyingType (obj_type); + + if (e_type == typeof (long)) + writer.Write ((long) obj); + else if (e_type == typeof (uint)) + writer.Write ((uint) obj); + else if (e_type == typeof (ulong)) + writer.Write ((ulong) obj); + else if (e_type == typeof(ushort)) + writer.Write ((ushort)obj); + else if (e_type == typeof(short)) + writer.Write ((short)obj); + else if (e_type == typeof(byte)) + writer.Write ((byte)obj); + else if (e_type == typeof(sbyte)) + writer.Write ((sbyte)obj); + else + writer.Write ((int) obj); + + return; + } + + // Okay, so it looks like the input should be exported as an + // object + AddTypeProperties (obj_type); + IList props = type_properties[obj_type]; + + writer.WriteObjectStart (); + foreach (PropertyMetadata p_data in props) { + if (p_data.IsField) { + writer.WritePropertyName (p_data.Info.Name); + WriteValue (((FieldInfo) p_data.Info).GetValue (obj), + writer, writer_is_private, depth + 1); + } + else { + PropertyInfo p_info = (PropertyInfo) p_data.Info; + + if (p_info.CanRead) { + writer.WritePropertyName (p_data.Info.Name); + WriteValue (p_info.GetValue (obj, null), + writer, writer_is_private, depth + 1); + } + } + } + writer.WriteObjectEnd (); + } + #endregion + + + public static string ToJson (object obj) + { + lock (static_writer_lock) { + static_writer.Reset (); + + WriteValue (obj, static_writer, true, 0); + + return static_writer.ToString (); + } + } + + public static void ToJson (object obj, JsonWriter writer) + { + WriteValue (obj, writer, false, 0); + } + + public static JsonData ToObject (JsonReader reader) + { + return (JsonData) ToWrapper ( + delegate { return new JsonData (); }, reader); + } + + public static JsonData ToObject (TextReader reader) + { + JsonReader json_reader = new JsonReader (reader); + + return (JsonData) ToWrapper ( + delegate { return new JsonData (); }, json_reader); + } + + public static JsonData ToObject (string json) + { + return (JsonData) ToWrapper ( + delegate { return new JsonData (); }, json); + } + + public static T ToObject (JsonReader reader) + { + return (T) ReadValue (typeof (T), reader); + } + + public static T ToObject (TextReader reader) + { + JsonReader json_reader = new JsonReader (reader); + + return (T) ReadValue (typeof (T), json_reader); + } + + public static T ToObject (string json) + { + JsonReader reader = new JsonReader (json); + + return (T) ReadValue (typeof (T), reader); + } + + public static object ToObject(string json, Type ConvertType ) + { + JsonReader reader = new JsonReader(json); + + return ReadValue(ConvertType, reader); + } + + public static IJsonWrapper ToWrapper (WrapperFactory factory, + JsonReader reader) + { + return ReadValue (factory, reader); + } + + public static IJsonWrapper ToWrapper (WrapperFactory factory, + string json) + { + JsonReader reader = new JsonReader (json); + + return ReadValue (factory, reader); + } + + public static void RegisterExporter (ExporterFunc exporter) + { + ExporterFunc exporter_wrapper = + delegate (object obj, JsonWriter writer) { + exporter ((T) obj, writer); + }; + + custom_exporters_table[typeof (T)] = exporter_wrapper; + } + + public static void RegisterImporter ( + ImporterFunc importer) + { + ImporterFunc importer_wrapper = + delegate (object input) { + return importer ((TJson) input); + }; + + RegisterImporter (custom_importers_table, typeof (TJson), + typeof (TValue), importer_wrapper); + } + + public static void UnregisterExporters () + { + custom_exporters_table.Clear (); + } + + public static void UnregisterImporters () + { + custom_importers_table.Clear (); + } + } +} diff --git a/Assets/Scripts/3rd/LitJson/JsonMapper.cs.meta b/Assets/Scripts/3rd/LitJson/JsonMapper.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..4a586f233aa566c914f3889b6a45bedccb0688b6 --- /dev/null +++ b/Assets/Scripts/3rd/LitJson/JsonMapper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 03de159fba6f94843a8a6fec8dd4508c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/3rd/LitJson/JsonMockWrapper.cs b/Assets/Scripts/3rd/LitJson/JsonMockWrapper.cs new file mode 100644 index 0000000000000000000000000000000000000000..dfe7adb74d05989761396c1bf74376e249e54a77 --- /dev/null +++ b/Assets/Scripts/3rd/LitJson/JsonMockWrapper.cs @@ -0,0 +1,105 @@ +#region Header +/** + * JsonMockWrapper.cs + * Mock object implementing IJsonWrapper, to facilitate actions like + * skipping data more efficiently. + * + * The authors disclaim copyright to this source code. For more details, see + * the COPYING file included with this distribution. + **/ +#endregion + + +using System; +using System.Collections; +using System.Collections.Specialized; + + +namespace LitJson +{ + public class JsonMockWrapper : IJsonWrapper + { + public bool IsArray { get { return false; } } + public bool IsBoolean { get { return false; } } + public bool IsDouble { get { return false; } } + public bool IsInt { get { return false; } } + public bool IsLong { get { return false; } } + public bool IsObject { get { return false; } } + public bool IsString { get { return false; } } + + public bool GetBoolean () { return false; } + public double GetDouble () { return 0.0; } + public int GetInt () { return 0; } + public JsonType GetJsonType () { return JsonType.None; } + public long GetLong () { return 0L; } + public string GetString () { return ""; } + + public void SetBoolean (bool val) {} + public void SetDouble (double val) {} + public void SetInt (int val) {} + public void SetJsonType (JsonType type) {} + public void SetLong (long val) {} + public void SetString (string val) {} + + public string ToJson () { return ""; } + public void ToJson (JsonWriter writer) {} + + + bool IList.IsFixedSize { get { return true; } } + bool IList.IsReadOnly { get { return true; } } + + object IList.this[int index] { + get { return null; } + set {} + } + + int IList.Add (object value) { return 0; } + void IList.Clear () {} + bool IList.Contains (object value) { return false; } + int IList.IndexOf (object value) { return -1; } + void IList.Insert (int i, object v) {} + void IList.Remove (object value) {} + void IList.RemoveAt (int index) {} + + + int ICollection.Count { get { return 0; } } + bool ICollection.IsSynchronized { get { return false; } } + object ICollection.SyncRoot { get { return null; } } + + void ICollection.CopyTo (Array array, int index) {} + + + IEnumerator IEnumerable.GetEnumerator () { return null; } + + + bool IDictionary.IsFixedSize { get { return true; } } + bool IDictionary.IsReadOnly { get { return true; } } + + ICollection IDictionary.Keys { get { return null; } } + ICollection IDictionary.Values { get { return null; } } + + object IDictionary.this[object key] { + get { return null; } + set {} + } + + void IDictionary.Add (object k, object v) {} + void IDictionary.Clear () {} + bool IDictionary.Contains (object key) { return false; } + void IDictionary.Remove (object key) {} + + IDictionaryEnumerator IDictionary.GetEnumerator () { return null; } + + + object IOrderedDictionary.this[int idx] { + get { return null; } + set {} + } + + IDictionaryEnumerator IOrderedDictionary.GetEnumerator () { + return null; + } + void IOrderedDictionary.Insert (int i, object k, object v) {} + void IOrderedDictionary.RemoveAt (int i) {} + } +} diff --git a/Assets/Scripts/3rd/LitJson/JsonMockWrapper.cs.meta b/Assets/Scripts/3rd/LitJson/JsonMockWrapper.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..89de3881bb40f07f915003a22aae5ec2f5a5735c --- /dev/null +++ b/Assets/Scripts/3rd/LitJson/JsonMockWrapper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8daf382cdbc211541b6593380f7f09c3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/3rd/LitJson/JsonReader.cs b/Assets/Scripts/3rd/LitJson/JsonReader.cs new file mode 100644 index 0000000000000000000000000000000000000000..e47eabc5ef38d17b0d8837bdbbb38d675e7a81a8 --- /dev/null +++ b/Assets/Scripts/3rd/LitJson/JsonReader.cs @@ -0,0 +1,478 @@ +#region Header +/** + * JsonReader.cs + * Stream-like access to JSON text. + * + * The authors disclaim copyright to this source code. For more details, see + * the COPYING file included with this distribution. + **/ +#endregion + + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Text; + + +namespace LitJson +{ + public enum JsonToken + { + None, + + ObjectStart, + PropertyName, + ObjectEnd, + + ArrayStart, + ArrayEnd, + + Int, + Long, + Double, + + String, + + Boolean, + Null + } + + + public class JsonReader + { + #region Fields + private static readonly IDictionary> parse_table; + + private Stack automaton_stack; + private int current_input; + private int current_symbol; + private bool end_of_json; + private bool end_of_input; + private Lexer lexer; + private bool parser_in_string; + private bool parser_return; + private bool read_started; + private TextReader reader; + private bool reader_is_owned; + private bool skip_non_members; + private object token_value; + private JsonToken token; + #endregion + + + #region Public Properties + public bool AllowComments { + get { return lexer.AllowComments; } + set { lexer.AllowComments = value; } + } + + public bool AllowSingleQuotedStrings { + get { return lexer.AllowSingleQuotedStrings; } + set { lexer.AllowSingleQuotedStrings = value; } + } + + public bool SkipNonMembers { + get { return skip_non_members; } + set { skip_non_members = value; } + } + + public bool EndOfInput { + get { return end_of_input; } + } + + public bool EndOfJson { + get { return end_of_json; } + } + + public JsonToken Token { + get { return token; } + } + + public object Value { + get { return token_value; } + } + #endregion + + + #region Constructors + static JsonReader () + { + parse_table = PopulateParseTable (); + } + + public JsonReader (string json_text) : + this (new StringReader (json_text), true) + { + } + + public JsonReader (TextReader reader) : + this (reader, false) + { + } + + private JsonReader (TextReader reader, bool owned) + { + if (reader == null) + throw new ArgumentNullException ("reader"); + + parser_in_string = false; + parser_return = false; + + read_started = false; + automaton_stack = new Stack (); + automaton_stack.Push ((int) ParserToken.End); + automaton_stack.Push ((int) ParserToken.Text); + + lexer = new Lexer (reader); + + end_of_input = false; + end_of_json = false; + + skip_non_members = true; + + this.reader = reader; + reader_is_owned = owned; + } + #endregion + + + #region Static Methods + private static IDictionary> PopulateParseTable () + { + // See section A.2. of the manual for details + IDictionary> parse_table = new Dictionary> (); + + TableAddRow (parse_table, ParserToken.Array); + TableAddCol (parse_table, ParserToken.Array, '[', + '[', + (int) ParserToken.ArrayPrime); + + TableAddRow (parse_table, ParserToken.ArrayPrime); + TableAddCol (parse_table, ParserToken.ArrayPrime, '"', + (int) ParserToken.Value, + + (int) ParserToken.ValueRest, + ']'); + TableAddCol (parse_table, ParserToken.ArrayPrime, '[', + (int) ParserToken.Value, + (int) ParserToken.ValueRest, + ']'); + TableAddCol (parse_table, ParserToken.ArrayPrime, ']', + ']'); + TableAddCol (parse_table, ParserToken.ArrayPrime, '{', + (int) ParserToken.Value, + (int) ParserToken.ValueRest, + ']'); + TableAddCol (parse_table, ParserToken.ArrayPrime, (int) ParserToken.Number, + (int) ParserToken.Value, + (int) ParserToken.ValueRest, + ']'); + TableAddCol (parse_table, ParserToken.ArrayPrime, (int) ParserToken.True, + (int) ParserToken.Value, + (int) ParserToken.ValueRest, + ']'); + TableAddCol (parse_table, ParserToken.ArrayPrime, (int) ParserToken.False, + (int) ParserToken.Value, + (int) ParserToken.ValueRest, + ']'); + TableAddCol (parse_table, ParserToken.ArrayPrime, (int) ParserToken.Null, + (int) ParserToken.Value, + (int) ParserToken.ValueRest, + ']'); + + TableAddRow (parse_table, ParserToken.Object); + TableAddCol (parse_table, ParserToken.Object, '{', + '{', + (int) ParserToken.ObjectPrime); + + TableAddRow (parse_table, ParserToken.ObjectPrime); + TableAddCol (parse_table, ParserToken.ObjectPrime, '"', + (int) ParserToken.Pair, + (int) ParserToken.PairRest, + '}'); + TableAddCol (parse_table, ParserToken.ObjectPrime, '}', + '}'); + + TableAddRow (parse_table, ParserToken.Pair); + TableAddCol (parse_table, ParserToken.Pair, '"', + (int) ParserToken.String, + ':', + (int) ParserToken.Value); + + TableAddRow (parse_table, ParserToken.PairRest); + TableAddCol (parse_table, ParserToken.PairRest, ',', + ',', + (int) ParserToken.Pair, + (int) ParserToken.PairRest); + TableAddCol (parse_table, ParserToken.PairRest, '}', + (int) ParserToken.Epsilon); + + TableAddRow (parse_table, ParserToken.String); + TableAddCol (parse_table, ParserToken.String, '"', + '"', + (int) ParserToken.CharSeq, + '"'); + + TableAddRow (parse_table, ParserToken.Text); + TableAddCol (parse_table, ParserToken.Text, '[', + (int) ParserToken.Array); + TableAddCol (parse_table, ParserToken.Text, '{', + (int) ParserToken.Object); + + TableAddRow (parse_table, ParserToken.Value); + TableAddCol (parse_table, ParserToken.Value, '"', + (int) ParserToken.String); + TableAddCol (parse_table, ParserToken.Value, '[', + (int) ParserToken.Array); + TableAddCol (parse_table, ParserToken.Value, '{', + (int) ParserToken.Object); + TableAddCol (parse_table, ParserToken.Value, (int) ParserToken.Number, + (int) ParserToken.Number); + TableAddCol (parse_table, ParserToken.Value, (int) ParserToken.True, + (int) ParserToken.True); + TableAddCol (parse_table, ParserToken.Value, (int) ParserToken.False, + (int) ParserToken.False); + TableAddCol (parse_table, ParserToken.Value, (int) ParserToken.Null, + (int) ParserToken.Null); + + TableAddRow (parse_table, ParserToken.ValueRest); + TableAddCol (parse_table, ParserToken.ValueRest, ',', + ',', + (int) ParserToken.Value, + (int) ParserToken.ValueRest); + TableAddCol (parse_table, ParserToken.ValueRest, ']', + (int) ParserToken.Epsilon); + + return parse_table; + } + + private static void TableAddCol (IDictionary> parse_table, ParserToken row, int col, + params int[] symbols) + { + parse_table[(int) row].Add (col, symbols); + } + + private static void TableAddRow (IDictionary> parse_table, ParserToken rule) + { + parse_table.Add ((int) rule, new Dictionary ()); + } + #endregion + + + #region Private Methods + private void ProcessNumber (string number) + { + if (number.IndexOf ('.') != -1 || + number.IndexOf ('e') != -1 || + number.IndexOf ('E') != -1) { + + double n_double; + if (double.TryParse (number, NumberStyles.Any, CultureInfo.InvariantCulture, out n_double)) { + token = JsonToken.Double; + token_value = n_double; + + return; + } + } + + int n_int32; + if (int.TryParse (number, NumberStyles.Integer, CultureInfo.InvariantCulture, out n_int32)) { + token = JsonToken.Int; + token_value = n_int32; + + return; + } + + long n_int64; + if (long.TryParse (number, NumberStyles.Integer, CultureInfo.InvariantCulture, out n_int64)) { + token = JsonToken.Long; + token_value = n_int64; + + return; + } + + ulong n_uint64; + if (ulong.TryParse(number, NumberStyles.Integer, CultureInfo.InvariantCulture, out n_uint64)) + { + token = JsonToken.Long; + token_value = n_uint64; + + return; + } + + // Shouldn't happen, but just in case, return something + token = JsonToken.Int; + token_value = 0; + } + + private void ProcessSymbol () + { + if (current_symbol == '[') { + token = JsonToken.ArrayStart; + parser_return = true; + + } else if (current_symbol == ']') { + token = JsonToken.ArrayEnd; + parser_return = true; + + } else if (current_symbol == '{') { + token = JsonToken.ObjectStart; + parser_return = true; + + } else if (current_symbol == '}') { + token = JsonToken.ObjectEnd; + parser_return = true; + + } else if (current_symbol == '"') { + if (parser_in_string) { + parser_in_string = false; + + parser_return = true; + + } else { + if (token == JsonToken.None) + token = JsonToken.String; + + parser_in_string = true; + } + + } else if (current_symbol == (int) ParserToken.CharSeq) { + token_value = lexer.StringValue; + + } else if (current_symbol == (int) ParserToken.False) { + token = JsonToken.Boolean; + token_value = false; + parser_return = true; + + } else if (current_symbol == (int) ParserToken.Null) { + token = JsonToken.Null; + parser_return = true; + + } else if (current_symbol == (int) ParserToken.Number) { + ProcessNumber (lexer.StringValue); + + parser_return = true; + + } else if (current_symbol == (int) ParserToken.Pair) { + token = JsonToken.PropertyName; + + } else if (current_symbol == (int) ParserToken.True) { + token = JsonToken.Boolean; + token_value = true; + parser_return = true; + + } + } + + private bool ReadToken () + { + if (end_of_input) + return false; + + lexer.NextToken (); + + if (lexer.EndOfInput) { + Close (); + + return false; + } + + current_input = lexer.Token; + + return true; + } + #endregion + + + public void Close () + { + if (end_of_input) + return; + + end_of_input = true; + end_of_json = true; + + if (reader_is_owned) + { + using(reader){} + } + + reader = null; + } + + public bool Read () + { + if (end_of_input) + return false; + + if (end_of_json) { + end_of_json = false; + automaton_stack.Clear (); + automaton_stack.Push ((int) ParserToken.End); + automaton_stack.Push ((int) ParserToken.Text); + } + + parser_in_string = false; + parser_return = false; + + token = JsonToken.None; + token_value = null; + + if (! read_started) { + read_started = true; + + if (! ReadToken ()) + return false; + } + + + int[] entry_symbols; + + while (true) { + if (parser_return) { + if (automaton_stack.Peek () == (int) ParserToken.End) + end_of_json = true; + + return true; + } + + current_symbol = automaton_stack.Pop (); + + ProcessSymbol (); + + if (current_symbol == current_input) { + if (! ReadToken ()) { + if (automaton_stack.Peek () != (int) ParserToken.End) + throw new JsonException ( + "Input doesn't evaluate to proper JSON text"); + + if (parser_return) + return true; + + return false; + } + + continue; + } + + try { + + entry_symbols = + parse_table[current_symbol][current_input]; + + } catch (KeyNotFoundException e) { + throw new JsonException ((ParserToken) current_input, e); + } + + if (entry_symbols[0] == (int) ParserToken.Epsilon) + continue; + + for (int i = entry_symbols.Length - 1; i >= 0; i--) + automaton_stack.Push (entry_symbols[i]); + } + } + + } +} diff --git a/Assets/Scripts/3rd/LitJson/JsonReader.cs.meta b/Assets/Scripts/3rd/LitJson/JsonReader.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..a704974ef0ca2ea6cdd0f9066c61c8ac1c6ae34e --- /dev/null +++ b/Assets/Scripts/3rd/LitJson/JsonReader.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9a971b2638ee0644f9dd5800b95d6fe6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/3rd/LitJson/JsonWriter.cs b/Assets/Scripts/3rd/LitJson/JsonWriter.cs new file mode 100644 index 0000000000000000000000000000000000000000..4bfaaac85e124d5f62ff2d8b435cb071f11e7cd2 --- /dev/null +++ b/Assets/Scripts/3rd/LitJson/JsonWriter.cs @@ -0,0 +1,484 @@ +#region Header +/** + * JsonWriter.cs + * Stream-like facility to output JSON text. + * + * The authors disclaim copyright to this source code. For more details, see + * the COPYING file included with this distribution. + **/ +#endregion + + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Text; + + +namespace LitJson +{ + internal enum Condition + { + InArray, + InObject, + NotAProperty, + Property, + Value + } + + internal class WriterContext + { + public int Count; + public bool InArray; + public bool InObject; + public bool ExpectingValue; + public int Padding; + } + + public class JsonWriter + { + #region Fields + private static readonly NumberFormatInfo number_format; + + private WriterContext context; + private Stack ctx_stack; + private bool has_reached_end; + private char[] hex_seq; + private int indentation; + private int indent_value; + private StringBuilder inst_string_builder; + private bool pretty_print; + private bool validate; + private bool lower_case_properties; + private TextWriter writer; + #endregion + + + #region Properties + public int IndentValue { + get { return indent_value; } + set { + indentation = (indentation / indent_value) * value; + indent_value = value; + } + } + + public bool PrettyPrint { + get { return pretty_print; } + set { pretty_print = value; } + } + + public TextWriter TextWriter { + get { return writer; } + } + + public bool Validate { + get { return validate; } + set { validate = value; } + } + + public bool LowerCaseProperties { + get { return lower_case_properties; } + set { lower_case_properties = value; } + } + #endregion + + + #region Constructors + static JsonWriter () + { + number_format = NumberFormatInfo.InvariantInfo; + } + + public JsonWriter () + { + inst_string_builder = new StringBuilder (); + writer = new StringWriter (inst_string_builder); + + Init (); + } + + public JsonWriter (StringBuilder sb) : + this (new StringWriter (sb)) + { + } + + public JsonWriter (TextWriter writer) + { + if (writer == null) + throw new ArgumentNullException ("writer"); + + this.writer = writer; + + Init (); + } + #endregion + + + #region Private Methods + private void DoValidation (Condition cond) + { + if (! context.ExpectingValue) + context.Count++; + + if (! validate) + return; + + if (has_reached_end) + throw new JsonException ( + "A complete JSON symbol has already been written"); + + switch (cond) { + case Condition.InArray: + if (! context.InArray) + throw new JsonException ( + "Can't close an array here"); + break; + + case Condition.InObject: + if (! context.InObject || context.ExpectingValue) + throw new JsonException ( + "Can't close an object here"); + break; + + case Condition.NotAProperty: + if (context.InObject && ! context.ExpectingValue) + throw new JsonException ( + "Expected a property"); + break; + + case Condition.Property: + if (! context.InObject || context.ExpectingValue) + throw new JsonException ( + "Can't add a property here"); + break; + + case Condition.Value: + if (! context.InArray && + (! context.InObject || ! context.ExpectingValue)) + throw new JsonException ( + "Can't add a value here"); + + break; + } + } + + private void Init () + { + has_reached_end = false; + hex_seq = new char[4]; + indentation = 0; + indent_value = 4; + pretty_print = false; + validate = true; + lower_case_properties = false; + + ctx_stack = new Stack (); + context = new WriterContext (); + ctx_stack.Push (context); + } + + private static void IntToHex (int n, char[] hex) + { + int num; + + for (int i = 0; i < 4; i++) { + num = n % 16; + + if (num < 10) + hex[3 - i] = (char) ('0' + num); + else + hex[3 - i] = (char) ('A' + (num - 10)); + + n >>= 4; + } + } + + private void Indent () + { + if (pretty_print) + indentation += indent_value; + } + + + private void Put (string str) + { + if (pretty_print && ! context.ExpectingValue) + for (int i = 0; i < indentation; i++) + writer.Write (' '); + + writer.Write (str); + } + + private void PutNewline () + { + PutNewline (true); + } + + private void PutNewline (bool add_comma) + { + if (add_comma && ! context.ExpectingValue && + context.Count > 1) + writer.Write (','); + + if (pretty_print && ! context.ExpectingValue) + writer.Write (Environment.NewLine); + } + + private void PutString (string str) + { + Put (String.Empty); + + writer.Write ('"'); + + int n = str.Length; + for (int i = 0; i < n; i++) { + switch (str[i]) { + case '\n': + writer.Write ("\\n"); + continue; + + case '\r': + writer.Write ("\\r"); + continue; + + case '\t': + writer.Write ("\\t"); + continue; + + case '"': + case '\\': + writer.Write ('\\'); + writer.Write (str[i]); + continue; + + case '\f': + writer.Write ("\\f"); + continue; + + case '\b': + writer.Write ("\\b"); + continue; + } + + if ((int) str[i] >= 32 && (int) str[i] <= 126) { + writer.Write (str[i]); + continue; + } + + // Default, turn into a \uXXXX sequence + IntToHex ((int) str[i], hex_seq); + writer.Write ("\\u"); + writer.Write (hex_seq); + } + + writer.Write ('"'); + } + + private void Unindent () + { + if (pretty_print) + indentation -= indent_value; + } + #endregion + + + public override string ToString () + { + if (inst_string_builder == null) + return String.Empty; + + return inst_string_builder.ToString (); + } + + public void Reset () + { + has_reached_end = false; + + ctx_stack.Clear (); + context = new WriterContext (); + ctx_stack.Push (context); + + if (inst_string_builder != null) + inst_string_builder.Remove (0, inst_string_builder.Length); + } + + public void Write (bool boolean) + { + DoValidation (Condition.Value); + PutNewline (); + + Put (boolean ? "true" : "false"); + + context.ExpectingValue = false; + } + + public void Write (decimal number) + { + DoValidation (Condition.Value); + PutNewline (); + + Put (Convert.ToString (number, number_format)); + + context.ExpectingValue = false; + } + + public void Write (double number) + { + DoValidation (Condition.Value); + PutNewline (); + + string str = Convert.ToString (number, number_format); + Put (str); + + if (str.IndexOf ('.') == -1 && + str.IndexOf ('E') == -1) + writer.Write (".0"); + + context.ExpectingValue = false; + } + + public void Write(float number) + { + DoValidation(Condition.Value); + PutNewline(); + + string str = Convert.ToString(number, number_format); + Put(str); + + context.ExpectingValue = false; + } + + public void Write (int number) + { + DoValidation (Condition.Value); + PutNewline (); + + Put (Convert.ToString (number, number_format)); + + context.ExpectingValue = false; + } + + public void Write (long number) + { + DoValidation (Condition.Value); + PutNewline (); + + Put (Convert.ToString (number, number_format)); + + context.ExpectingValue = false; + } + + public void Write (string str) + { + DoValidation (Condition.Value); + PutNewline (); + + if (str == null) + Put ("null"); + else + PutString (str); + + context.ExpectingValue = false; + } + + [CLSCompliant(false)] + public void Write (ulong number) + { + DoValidation (Condition.Value); + PutNewline (); + + Put (Convert.ToString (number, number_format)); + + context.ExpectingValue = false; + } + + public void WriteArrayEnd () + { + DoValidation (Condition.InArray); + PutNewline (false); + + ctx_stack.Pop (); + if (ctx_stack.Count == 1) + has_reached_end = true; + else { + context = ctx_stack.Peek (); + context.ExpectingValue = false; + } + + Unindent (); + Put ("]"); + } + + public void WriteArrayStart () + { + DoValidation (Condition.NotAProperty); + PutNewline (); + + Put ("["); + + context = new WriterContext (); + context.InArray = true; + ctx_stack.Push (context); + + Indent (); + } + + public void WriteObjectEnd () + { + DoValidation (Condition.InObject); + PutNewline (false); + + ctx_stack.Pop (); + if (ctx_stack.Count == 1) + has_reached_end = true; + else { + context = ctx_stack.Peek (); + context.ExpectingValue = false; + } + + Unindent (); + Put ("}"); + } + + public void WriteObjectStart () + { + DoValidation (Condition.NotAProperty); + PutNewline (); + + Put ("{"); + + context = new WriterContext (); + context.InObject = true; + ctx_stack.Push (context); + + Indent (); + } + + public void WritePropertyName (string property_name) + { + DoValidation (Condition.Property); + PutNewline (); + string propertyName = (property_name == null || !lower_case_properties) + ? property_name + : property_name.ToLowerInvariant(); + + PutString (propertyName); + + if (pretty_print) { + if (propertyName.Length > context.Padding) + context.Padding = propertyName.Length; + + for (int i = context.Padding - propertyName.Length; + i >= 0; i--) + writer.Write (' '); + + writer.Write (": "); + } else + writer.Write (':'); + + context.ExpectingValue = true; + } + } +} diff --git a/Assets/Scripts/3rd/LitJson/JsonWriter.cs.meta b/Assets/Scripts/3rd/LitJson/JsonWriter.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..ae5f07a6a2a3a2a35f0141c7605f2c07b66187a1 --- /dev/null +++ b/Assets/Scripts/3rd/LitJson/JsonWriter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7c3df5184f2034f4b9b4b8fb125ce1c2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/3rd/LitJson/Lexer.cs b/Assets/Scripts/3rd/LitJson/Lexer.cs new file mode 100644 index 0000000000000000000000000000000000000000..cb62d5506fc0974b00f8a22f0292df6c781c03a3 --- /dev/null +++ b/Assets/Scripts/3rd/LitJson/Lexer.cs @@ -0,0 +1,912 @@ +#region Header +/** + * Lexer.cs + * JSON lexer implementation based on a finite state machine. + * + * The authors disclaim copyright to this source code. For more details, see + * the COPYING file included with this distribution. + **/ +#endregion + + +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; + + +namespace LitJson +{ + internal class FsmContext + { + public bool Return; + public int NextState; + public Lexer L; + public int StateStack; + } + + + internal class Lexer + { + #region Fields + private delegate bool StateHandler (FsmContext ctx); + + private static readonly int[] fsm_return_table; + private static readonly StateHandler[] fsm_handler_table; + + private bool allow_comments; + private bool allow_single_quoted_strings; + private bool end_of_input; + private FsmContext fsm_context; + private int input_buffer; + private int input_char; + private TextReader reader; + private int state; + private StringBuilder string_buffer; + private string string_value; + private int token; + private int unichar; + #endregion + + + #region Properties + public bool AllowComments { + get { return allow_comments; } + set { allow_comments = value; } + } + + public bool AllowSingleQuotedStrings { + get { return allow_single_quoted_strings; } + set { allow_single_quoted_strings = value; } + } + + public bool EndOfInput { + get { return end_of_input; } + } + + public int Token { + get { return token; } + } + + public string StringValue { + get { return string_value; } + } + #endregion + + + #region Constructors + static Lexer () + { + PopulateFsmTables (out fsm_handler_table, out fsm_return_table); + } + + public Lexer (TextReader reader) + { + allow_comments = true; + allow_single_quoted_strings = true; + + input_buffer = 0; + string_buffer = new StringBuilder (128); + state = 1; + end_of_input = false; + this.reader = reader; + + fsm_context = new FsmContext (); + fsm_context.L = this; + } + #endregion + + + #region Static Methods + private static int HexValue (int digit) + { + switch (digit) { + case 'a': + case 'A': + return 10; + + case 'b': + case 'B': + return 11; + + case 'c': + case 'C': + return 12; + + case 'd': + case 'D': + return 13; + + case 'e': + case 'E': + return 14; + + case 'f': + case 'F': + return 15; + + default: + return digit - '0'; + } + } + + private static void PopulateFsmTables (out StateHandler[] fsm_handler_table, out int[] fsm_return_table) + { + // See section A.1. of the manual for details of the finite + // state machine. + fsm_handler_table = new StateHandler[28] { + State1, + State2, + State3, + State4, + State5, + State6, + State7, + State8, + State9, + State10, + State11, + State12, + State13, + State14, + State15, + State16, + State17, + State18, + State19, + State20, + State21, + State22, + State23, + State24, + State25, + State26, + State27, + State28 + }; + + fsm_return_table = new int[28] { + (int) ParserToken.Char, + 0, + (int) ParserToken.Number, + (int) ParserToken.Number, + 0, + (int) ParserToken.Number, + 0, + (int) ParserToken.Number, + 0, + 0, + (int) ParserToken.True, + 0, + 0, + 0, + (int) ParserToken.False, + 0, + 0, + (int) ParserToken.Null, + (int) ParserToken.CharSeq, + (int) ParserToken.Char, + 0, + 0, + (int) ParserToken.CharSeq, + (int) ParserToken.Char, + 0, + 0, + 0, + 0 + }; + } + + private static char ProcessEscChar (int esc_char) + { + switch (esc_char) { + case '"': + case '\'': + case '\\': + case '/': + return Convert.ToChar (esc_char); + + case 'n': + return '\n'; + + case 't': + return '\t'; + + case 'r': + return '\r'; + + case 'b': + return '\b'; + + case 'f': + return '\f'; + + default: + // Unreachable + return '?'; + } + } + + private static bool State1 (FsmContext ctx) + { + while (ctx.L.GetChar ()) { + if (ctx.L.input_char == ' ' || + ctx.L.input_char >= '\t' && ctx.L.input_char <= '\r') + continue; + + if (ctx.L.input_char >= '1' && ctx.L.input_char <= '9') { + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + ctx.NextState = 3; + return true; + } + + switch (ctx.L.input_char) { + case '"': + ctx.NextState = 19; + ctx.Return = true; + return true; + + case ',': + case ':': + case '[': + case ']': + case '{': + case '}': + ctx.NextState = 1; + ctx.Return = true; + return true; + + case '-': + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + ctx.NextState = 2; + return true; + + case '0': + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + ctx.NextState = 4; + return true; + + case 'f': + ctx.NextState = 12; + return true; + + case 'n': + ctx.NextState = 16; + return true; + + case 't': + ctx.NextState = 9; + return true; + + case '\'': + if (! ctx.L.allow_single_quoted_strings) + return false; + + ctx.L.input_char = '"'; + ctx.NextState = 23; + ctx.Return = true; + return true; + + case '/': + if (! ctx.L.allow_comments) + return false; + + ctx.NextState = 25; + return true; + + default: + return false; + } + } + + return true; + } + + private static bool State2 (FsmContext ctx) + { + ctx.L.GetChar (); + + if (ctx.L.input_char >= '1' && ctx.L.input_char<= '9') { + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + ctx.NextState = 3; + return true; + } + + switch (ctx.L.input_char) { + case '0': + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + ctx.NextState = 4; + return true; + + default: + return false; + } + } + + private static bool State3 (FsmContext ctx) + { + while (ctx.L.GetChar ()) { + if (ctx.L.input_char >= '0' && ctx.L.input_char <= '9') { + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + continue; + } + + if (ctx.L.input_char == ' ' || + ctx.L.input_char >= '\t' && ctx.L.input_char <= '\r') { + ctx.Return = true; + ctx.NextState = 1; + return true; + } + + switch (ctx.L.input_char) { + case ',': + case ']': + case '}': + ctx.L.UngetChar (); + ctx.Return = true; + ctx.NextState = 1; + return true; + + case '.': + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + ctx.NextState = 5; + return true; + + case 'e': + case 'E': + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + ctx.NextState = 7; + return true; + + default: + return false; + } + } + return true; + } + + private static bool State4 (FsmContext ctx) + { + ctx.L.GetChar (); + + if (ctx.L.input_char == ' ' || + ctx.L.input_char >= '\t' && ctx.L.input_char <= '\r') { + ctx.Return = true; + ctx.NextState = 1; + return true; + } + + switch (ctx.L.input_char) { + case ',': + case ']': + case '}': + ctx.L.UngetChar (); + ctx.Return = true; + ctx.NextState = 1; + return true; + + case '.': + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + ctx.NextState = 5; + return true; + + case 'e': + case 'E': + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + ctx.NextState = 7; + return true; + + default: + return false; + } + } + + private static bool State5 (FsmContext ctx) + { + ctx.L.GetChar (); + + if (ctx.L.input_char >= '0' && ctx.L.input_char <= '9') { + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + ctx.NextState = 6; + return true; + } + + return false; + } + + private static bool State6 (FsmContext ctx) + { + while (ctx.L.GetChar ()) { + if (ctx.L.input_char >= '0' && ctx.L.input_char <= '9') { + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + continue; + } + + if (ctx.L.input_char == ' ' || + ctx.L.input_char >= '\t' && ctx.L.input_char <= '\r') { + ctx.Return = true; + ctx.NextState = 1; + return true; + } + + switch (ctx.L.input_char) { + case ',': + case ']': + case '}': + ctx.L.UngetChar (); + ctx.Return = true; + ctx.NextState = 1; + return true; + + case 'e': + case 'E': + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + ctx.NextState = 7; + return true; + + default: + return false; + } + } + + return true; + } + + private static bool State7 (FsmContext ctx) + { + ctx.L.GetChar (); + + if (ctx.L.input_char >= '0' && ctx.L.input_char<= '9') { + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + ctx.NextState = 8; + return true; + } + + switch (ctx.L.input_char) { + case '+': + case '-': + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + ctx.NextState = 8; + return true; + + default: + return false; + } + } + + private static bool State8 (FsmContext ctx) + { + while (ctx.L.GetChar ()) { + if (ctx.L.input_char >= '0' && ctx.L.input_char<= '9') { + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + continue; + } + + if (ctx.L.input_char == ' ' || + ctx.L.input_char >= '\t' && ctx.L.input_char<= '\r') { + ctx.Return = true; + ctx.NextState = 1; + return true; + } + + switch (ctx.L.input_char) { + case ',': + case ']': + case '}': + ctx.L.UngetChar (); + ctx.Return = true; + ctx.NextState = 1; + return true; + + default: + return false; + } + } + + return true; + } + + private static bool State9 (FsmContext ctx) + { + ctx.L.GetChar (); + + switch (ctx.L.input_char) { + case 'r': + ctx.NextState = 10; + return true; + + default: + return false; + } + } + + private static bool State10 (FsmContext ctx) + { + ctx.L.GetChar (); + + switch (ctx.L.input_char) { + case 'u': + ctx.NextState = 11; + return true; + + default: + return false; + } + } + + private static bool State11 (FsmContext ctx) + { + ctx.L.GetChar (); + + switch (ctx.L.input_char) { + case 'e': + ctx.Return = true; + ctx.NextState = 1; + return true; + + default: + return false; + } + } + + private static bool State12 (FsmContext ctx) + { + ctx.L.GetChar (); + + switch (ctx.L.input_char) { + case 'a': + ctx.NextState = 13; + return true; + + default: + return false; + } + } + + private static bool State13 (FsmContext ctx) + { + ctx.L.GetChar (); + + switch (ctx.L.input_char) { + case 'l': + ctx.NextState = 14; + return true; + + default: + return false; + } + } + + private static bool State14 (FsmContext ctx) + { + ctx.L.GetChar (); + + switch (ctx.L.input_char) { + case 's': + ctx.NextState = 15; + return true; + + default: + return false; + } + } + + private static bool State15 (FsmContext ctx) + { + ctx.L.GetChar (); + + switch (ctx.L.input_char) { + case 'e': + ctx.Return = true; + ctx.NextState = 1; + return true; + + default: + return false; + } + } + + private static bool State16 (FsmContext ctx) + { + ctx.L.GetChar (); + + switch (ctx.L.input_char) { + case 'u': + ctx.NextState = 17; + return true; + + default: + return false; + } + } + + private static bool State17 (FsmContext ctx) + { + ctx.L.GetChar (); + + switch (ctx.L.input_char) { + case 'l': + ctx.NextState = 18; + return true; + + default: + return false; + } + } + + private static bool State18 (FsmContext ctx) + { + ctx.L.GetChar (); + + switch (ctx.L.input_char) { + case 'l': + ctx.Return = true; + ctx.NextState = 1; + return true; + + default: + return false; + } + } + + private static bool State19 (FsmContext ctx) + { + while (ctx.L.GetChar ()) { + switch (ctx.L.input_char) { + case '"': + ctx.L.UngetChar (); + ctx.Return = true; + ctx.NextState = 20; + return true; + + case '\\': + ctx.StateStack = 19; + ctx.NextState = 21; + return true; + + default: + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + continue; + } + } + + return true; + } + + private static bool State20 (FsmContext ctx) + { + ctx.L.GetChar (); + + switch (ctx.L.input_char) { + case '"': + ctx.Return = true; + ctx.NextState = 1; + return true; + + default: + return false; + } + } + + private static bool State21 (FsmContext ctx) + { + ctx.L.GetChar (); + + switch (ctx.L.input_char) { + case 'u': + ctx.NextState = 22; + return true; + + case '"': + case '\'': + case '/': + case '\\': + case 'b': + case 'f': + case 'n': + case 'r': + case 't': + ctx.L.string_buffer.Append ( + ProcessEscChar (ctx.L.input_char)); + ctx.NextState = ctx.StateStack; + return true; + + default: + return false; + } + } + + private static bool State22 (FsmContext ctx) + { + int counter = 0; + int mult = 4096; + + ctx.L.unichar = 0; + + while (ctx.L.GetChar ()) { + + if (ctx.L.input_char >= '0' && ctx.L.input_char <= '9' || + ctx.L.input_char >= 'A' && ctx.L.input_char <= 'F' || + ctx.L.input_char >= 'a' && ctx.L.input_char <= 'f') { + + ctx.L.unichar += HexValue (ctx.L.input_char) * mult; + + counter++; + mult /= 16; + + if (counter == 4) { + ctx.L.string_buffer.Append ( + Convert.ToChar (ctx.L.unichar)); + ctx.NextState = ctx.StateStack; + return true; + } + + continue; + } + + return false; + } + + return true; + } + + private static bool State23 (FsmContext ctx) + { + while (ctx.L.GetChar ()) { + switch (ctx.L.input_char) { + case '\'': + ctx.L.UngetChar (); + ctx.Return = true; + ctx.NextState = 24; + return true; + + case '\\': + ctx.StateStack = 23; + ctx.NextState = 21; + return true; + + default: + ctx.L.string_buffer.Append ((char) ctx.L.input_char); + continue; + } + } + + return true; + } + + private static bool State24 (FsmContext ctx) + { + ctx.L.GetChar (); + + switch (ctx.L.input_char) { + case '\'': + ctx.L.input_char = '"'; + ctx.Return = true; + ctx.NextState = 1; + return true; + + default: + return false; + } + } + + private static bool State25 (FsmContext ctx) + { + ctx.L.GetChar (); + + switch (ctx.L.input_char) { + case '*': + ctx.NextState = 27; + return true; + + case '/': + ctx.NextState = 26; + return true; + + default: + return false; + } + } + + private static bool State26 (FsmContext ctx) + { + while (ctx.L.GetChar ()) { + if (ctx.L.input_char == '\n') { + ctx.NextState = 1; + return true; + } + } + + return true; + } + + private static bool State27 (FsmContext ctx) + { + while (ctx.L.GetChar ()) { + if (ctx.L.input_char == '*') { + ctx.NextState = 28; + return true; + } + } + + return true; + } + + private static bool State28 (FsmContext ctx) + { + while (ctx.L.GetChar ()) { + if (ctx.L.input_char == '*') + continue; + + if (ctx.L.input_char == '/') { + ctx.NextState = 1; + return true; + } + + ctx.NextState = 27; + return true; + } + + return true; + } + #endregion + + + private bool GetChar () + { + if ((input_char = NextChar ()) != -1) + return true; + + end_of_input = true; + return false; + } + + private int NextChar () + { + if (input_buffer != 0) { + int tmp = input_buffer; + input_buffer = 0; + + return tmp; + } + + return reader.Read (); + } + + public bool NextToken () + { + StateHandler handler; + fsm_context.Return = false; + + while (true) { + handler = fsm_handler_table[state - 1]; + + if (! handler (fsm_context)) + throw new JsonException (input_char); + + if (end_of_input) + return false; + + if (fsm_context.Return) { + string_value = string_buffer.ToString (); + string_buffer.Remove (0, string_buffer.Length); + token = fsm_return_table[state - 1]; + + if (token == (int) ParserToken.Char) + token = input_char; + + state = fsm_context.NextState; + + return true; + } + + state = fsm_context.NextState; + } + } + + private void UngetChar () + { + input_buffer = input_char; + } + } +} diff --git a/Assets/Scripts/3rd/LitJson/Lexer.cs.meta b/Assets/Scripts/3rd/LitJson/Lexer.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..a34a659bb93cb19a2bfcdf947cc0846dbc97f612 --- /dev/null +++ b/Assets/Scripts/3rd/LitJson/Lexer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b6cbff856c5a14b47930e12f91229895 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/3rd/LitJson/LitJSON.csproj b/Assets/Scripts/3rd/LitJson/LitJSON.csproj new file mode 100644 index 0000000000000000000000000000000000000000..0ae3c9133ca06f4e844f90ea654833b7c221b644 --- /dev/null +++ b/Assets/Scripts/3rd/LitJson/LitJSON.csproj @@ -0,0 +1,59 @@ + + + + netstandard2.0;net45;netstandard1.5;net40;net35;net20 + + + + false + embedded + true + + + + + + + + + + LitJson + A .Net library to handle conversions from and to JSON (JavaScript Object Notation) strings. Written in C#, and it鈥檚 intended to be small, fast and easy to use. +It's quick and lean, without external dependencies. + The authors disclaim copyright to this source code. + Leonardo Boshell, Mattias Karlsson and contributors + Leonardo Boshell, Mattias Karlsson and contributors + Unlicense + litjson.png + https://github.com/LitJSON/litjson + git + JSON;Serializer + true + + + + + + + + $(DefineConstants);LEGACY + C:\Windows\Microsoft.NET\Framework\v2.0.50727 + + + + $(DefineConstants);LEGACY + C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client + + + + $(DefineConstants);LEGACY + + + + + + + + + + diff --git a/Assets/Scripts/3rd/LitJson/LitJSON.csproj.meta b/Assets/Scripts/3rd/LitJson/LitJSON.csproj.meta new file mode 100644 index 0000000000000000000000000000000000000000..415a0eac4bb2fe284ea61c8f8ded264a0df8103e --- /dev/null +++ b/Assets/Scripts/3rd/LitJson/LitJSON.csproj.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: aebf3ab45c3638d4289eb9448d6d81cf +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/3rd/LitJson/Netstandard15Polyfill.cs b/Assets/Scripts/3rd/LitJson/Netstandard15Polyfill.cs new file mode 100644 index 0000000000000000000000000000000000000000..55b02a21b4c0396b369126c36bff77ece894c7b0 --- /dev/null +++ b/Assets/Scripts/3rd/LitJson/Netstandard15Polyfill.cs @@ -0,0 +1,24 @@ +#if NETSTANDARD1_5 +using System; +using System.Reflection; +namespace LitJson +{ + internal static class Netstandard15Polyfill + { + internal static Type GetInterface(this Type type, string name) + { + return type.GetTypeInfo().GetInterface(name); + } + + internal static bool IsClass(this Type type) + { + return type.GetTypeInfo().IsClass; + } + + internal static bool IsEnum(this Type type) + { + return type.GetTypeInfo().IsEnum; + } + } +} +#endif \ No newline at end of file diff --git a/Assets/Scripts/3rd/LitJson/Netstandard15Polyfill.cs.meta b/Assets/Scripts/3rd/LitJson/Netstandard15Polyfill.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..0fd751c3d280d4d0f789b9b1b4c4c4934915ffdd --- /dev/null +++ b/Assets/Scripts/3rd/LitJson/Netstandard15Polyfill.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: aeca4865abc10b043ba5d8b855e6dd45 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/3rd/LitJson/ParserToken.cs b/Assets/Scripts/3rd/LitJson/ParserToken.cs new file mode 100644 index 0000000000000000000000000000000000000000..e23d477b2f75ec025ddfdd7ad898c7fbda84f406 --- /dev/null +++ b/Assets/Scripts/3rd/LitJson/ParserToken.cs @@ -0,0 +1,44 @@ +#region Header +/** + * ParserToken.cs + * Internal representation of the tokens used by the lexer and the parser. + * + * The authors disclaim copyright to this source code. For more details, see + * the COPYING file included with this distribution. + **/ +#endregion + + +namespace LitJson +{ + internal enum ParserToken + { + // Lexer tokens (see section A.1.1. of the manual) + None = System.Char.MaxValue + 1, + Number, + True, + False, + Null, + CharSeq, + // Single char + Char, + + // Parser Rules (see section A.2.1 of the manual) + Text, + Object, + ObjectPrime, + Pair, + PairRest, + Array, + ArrayPrime, + Value, + ValueRest, + String, + + // End of input + End, + + // The empty rule + Epsilon + } +} diff --git a/Assets/Scripts/3rd/LitJson/ParserToken.cs.meta b/Assets/Scripts/3rd/LitJson/ParserToken.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..0c37d024ff8ad551619c6b7225f4057ee8b0e414 --- /dev/null +++ b/Assets/Scripts/3rd/LitJson/ParserToken.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8dbddd4662233644cb315e47b6ffc134 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/3rd/LitJson/litjson.png b/Assets/Scripts/3rd/LitJson/litjson.png new file mode 100644 index 0000000000000000000000000000000000000000..a4c15e5bbd11ae56f6707941c9e5dedfad044e95 Binary files /dev/null and b/Assets/Scripts/3rd/LitJson/litjson.png differ diff --git a/Assets/Scripts/3rd/LitJson/litjson.png.meta b/Assets/Scripts/3rd/LitJson/litjson.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..ccd1620dd259c8255cdd36bd5af651dd5a176b53 --- /dev/null +++ b/Assets/Scripts/3rd/LitJson/litjson.png.meta @@ -0,0 +1,92 @@ +fileFormatVersion: 2 +guid: fb5a8f5c9f4a0b947a9cc04b620e8e54 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: -1 + wrapV: -1 + wrapW: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Log.meta b/Assets/Scripts/Log.meta new file mode 100644 index 0000000000000000000000000000000000000000..520ce917af8251bfa537a07d7904deececd63122 --- /dev/null +++ b/Assets/Scripts/Log.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f9a196c5d328e3f4b90e847bba783994 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Log/GameLogger.cs b/Assets/Scripts/Log/GameLogger.cs new file mode 100644 index 0000000000000000000000000000000000000000..bd499ba2bb8c0df2b9095ce08032440705a3c13b --- /dev/null +++ b/Assets/Scripts/Log/GameLogger.cs @@ -0,0 +1,272 @@ +/// +/// 封装Debug日志打印,实现日志开关控制、彩色日志打印、日志文件存储等功能 +/// 作者:林新发 博客:https://blog.csdn.net/linxinfa +/// + +using UnityEngine; +using System.Text; +using System.IO; + +public class GameLogger +{ + // 普通调试日志开关 + public static bool s_debugLogEnable = true; + // 警告日志开关 + public static bool s_warningLogEnable = true; + // 错误日志开关 + public static bool s_errorLogEnable = true; + + // 使用StringBuilder来优化字符串的重复构造 + private static StringBuilder s_logStr = new StringBuilder(); + // 日志文件存储位置 + private static string s_logFileSavePath; + + /// + /// 初始化,在游戏启动的入口脚本的Awake函数中调用GameLogger.Init + /// + public static void Init() + { + // 日期 + var t = System.DateTime.Now.ToString("yyyyMMddhhmmss"); + +#if UNITY_STANDALONE || UNITY_EDITOR + var logDir = string.Format("{0}/../gamelog/", Application.dataPath); +#else + var logDir = string.Format("{0}/gamelog/", Application.persistentDataPath); +#endif + if (!Directory.Exists(logDir)) + Directory.CreateDirectory(logDir); + s_logFileSavePath = string.Format("{0}/output_{1}.txt", logDir, t); + Application.logMessageReceived += OnLogCallBack; + } + + /// + /// 打印日志回调 + /// + /// 日志文本 + /// 调用堆栈 + /// 日志类型 + private static void OnLogCallBack(string condition, string stackTrace, LogType type) + { + s_logStr.Append(condition); + s_logStr.Append("\n"); + if(type == LogType.Error || type == LogType.Exception) + { + s_logStr.Append(stackTrace); + s_logStr.Append("\n"); + } + + if (s_logStr.Length <= 0) return; + if (!File.Exists(s_logFileSavePath)) + { + var fs = File.Create(s_logFileSavePath); + fs.Close(); + } + using (var sw = File.AppendText(s_logFileSavePath)) + { + sw.WriteLine(s_logStr.ToString()); + } + s_logStr.Remove(0, s_logStr.Length); + } + + /// + /// 普通调试日志 + /// + public static void Log(object message, Object context = null) + { + if (!s_debugLogEnable) return; + Debug.Log(message, context); + } + + /// + /// 格式化打印日志 + /// + /// 例:"a is {0}, b is {1}" + /// 可变参数,根据format的格式传入匹配的参数,例:a, b + public static void LogFormat(string format, params object[] args) + { + if (!s_debugLogEnable) return; + Debug.LogFormat(format, args); + } + + /// + /// 带颜色的日志 + /// + /// + /// 颜色值,例:green, yellow,#ff0000 + /// 上下文对象 + public static void LogWithColor(object message, string color, Object context = null) + { + if (!s_debugLogEnable) return; + Debug.Log(FmtColor(color, message), context); + } + + /// + /// 红色日志 + /// + public static void LogRed(object message, Object context = null) + { + if (!s_debugLogEnable) return; + Debug.Log(FmtColor("red", message), context); + } + + /// + /// 绿色日志 + /// + public static void LogGreen(object message, Object context = null) + { + if (!s_debugLogEnable) return; + Debug.Log(FmtColor("#00ff00", message), context); + } + + /// + /// 黄色日志 + /// + public static void LogYellow(object message, Object context = null) + { + if (!s_debugLogEnable) return; + Debug.Log(FmtColor("yellow", message), context); + } + + /// + /// 青蓝色日志 + /// + public static void LogCyan(object message, Object context = null) + { + if (!s_debugLogEnable) return; + Debug.Log(FmtColor("#00ffff", message), context); + } + + /// + /// 带颜色的格式化日志打印 + /// + public static void LogFormatWithColor(string format, string color, params object[] args) + { + if (!s_debugLogEnable) return; + Debug.LogFormat((string)FmtColor(color, format), args); + } + + /// + /// 警告日志 + /// + public static void LogWarning(object message, Object context = null) + { + if (!s_warningLogEnable) return; + Debug.LogWarning(message, context); + } + + /// + /// 错误日志 + /// + public static void LogError(object message, Object context = null) + { + if (!s_errorLogEnable) return; + Debug.LogError(message, context); + } + + /// + /// 格式化颜色日志 + /// + private static object FmtColor(string color, object obj) + { + if (obj is string) + { +#if !UNITY_EDITOR + return obj; +#else + return FmtColor(color, (string)obj); +#endif + } + else + { +#if !UNITY_EDITOR + return obj; +#else + return string.Format("{1}", color, obj); +#endif + } + } + + /// + /// 格式化颜色日志 + /// + private static object FmtColor(string color, string msg) + { +#if !UNITY_EDITOR + return msg; +#else + int p = msg.IndexOf('\n'); + if (p >= 0) p = msg.IndexOf('\n', p + 1);// 可以同时显示两行 + if (p < 0 || p >= msg.Length - 1) return string.Format("{1}", color, msg); + if (p > 2 && msg[p - 1] == '\r') p--; + return string.Format("{1}{2}", color, msg.Substring(0, p), msg.Substring(p)); +#endif + } + +#region 解决日志双击溯源问题 +#if UNITY_EDITOR + [UnityEditor.Callbacks.OnOpenAssetAttribute(0)] + static bool OnOpenAsset(int instanceID, int line) + { + string stackTrace = GetStackTrace(); + if (!string.IsNullOrEmpty(stackTrace) && stackTrace.Contains("GameLogger:Log")) + { + // 使用正则表达式匹配at的哪个脚本的哪一行 + var matches = System.Text.RegularExpressions.Regex.Match(stackTrace, @"\(at (.+)\)", + System.Text.RegularExpressions.RegexOptions.IgnoreCase); + string pathLine = ""; + while (matches.Success) + { + pathLine = matches.Groups[1].Value; + + if (!pathLine.Contains("GameLogger.cs")) + { + int splitIndex = pathLine.LastIndexOf(":"); + // 脚本路径 + string path = pathLine.Substring(0, splitIndex); + // 行号 + line = System.Convert.ToInt32(pathLine.Substring(splitIndex + 1)); + string fullPath = Application.dataPath.Substring(0, Application.dataPath.LastIndexOf("Assets")); + fullPath = fullPath + path; + // 跳转到目标代码的特定行 + UnityEditorInternal.InternalEditorUtility.OpenFileAtLineExternal(fullPath.Replace('/', '\\'), line); + break; + } + matches = matches.NextMatch(); + } + return true; + } + return false; + } + + /// + /// 获取当前日志窗口选中的日志的堆栈信息 + /// + /// + static string GetStackTrace() + { + // 通过反射获取ConsoleWindow类 + var ConsoleWindowType = typeof(UnityEditor.EditorWindow).Assembly.GetType("UnityEditor.ConsoleWindow"); + // 获取窗口实例 + var fieldInfo = ConsoleWindowType.GetField("ms_ConsoleWindow", + System.Reflection.BindingFlags.Static | + System.Reflection.BindingFlags.NonPublic); + var consoleInstance = fieldInfo.GetValue(null); + if (consoleInstance != null) + { + if ((object)UnityEditor.EditorWindow.focusedWindow == consoleInstance) + { + // 获取m_ActiveText成员 + fieldInfo = ConsoleWindowType.GetField("m_ActiveText", + System.Reflection.BindingFlags.Instance | + System.Reflection.BindingFlags.NonPublic); + // 获取m_ActiveText的值 + string activeText = fieldInfo.GetValue(consoleInstance).ToString(); + return activeText; + } + } + return null; + } +#endif +#endregion 解决日志双击溯源问题 +} diff --git a/Assets/Scripts/Log/GameLogger.cs.meta b/Assets/Scripts/Log/GameLogger.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..a909823ab410a118157aa2fc2948037dcac238ee --- /dev/null +++ b/Assets/Scripts/Log/GameLogger.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ded7e0bb998e4194ca81d6debf09da61 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Logic.meta b/Assets/Scripts/Logic.meta new file mode 100644 index 0000000000000000000000000000000000000000..3e05d43b7239db5ed53938430e187984b2882c00 --- /dev/null +++ b/Assets/Scripts/Logic.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0cf4adc8231b2a24db5c1048e0252869 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Logic/Encrypt.meta b/Assets/Scripts/Logic/Encrypt.meta new file mode 100644 index 0000000000000000000000000000000000000000..02b043ef1cf07a4a4186b0eecb2cc91bb22c8fd1 --- /dev/null +++ b/Assets/Scripts/Logic/Encrypt.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d86b51fa5b83c554f825d62587a5f30a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Logic/Encrypt/AESEncrypt.cs b/Assets/Scripts/Logic/Encrypt/AESEncrypt.cs new file mode 100644 index 0000000000000000000000000000000000000000..0b5c2f6cc046856df2c86f1a5f597fc543c3ccc2 --- /dev/null +++ b/Assets/Scripts/Logic/Encrypt/AESEncrypt.cs @@ -0,0 +1,60 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using System.Text; +using System.Security.Cryptography; + +/// +/// AES加密解密 +/// +public class AESEncrypt +{ + /// + /// 默认密钥-密钥的长度必须是32 + /// + private const string PUBLIC_KEY = "Hello_I_am_linxinfa.WelcomeUnity"; + + /// + /// 默认向量 + /// + private const string IV = "abcdefghijklmnop"; + + /// + /// AES加密 + /// + /// 需要加密的字符串 + /// 32位密钥 + /// 加密后的字符串 + public static byte[] Encrypt(byte[] toEncryptArray) + { + byte[] keyArray = Encoding.UTF8.GetBytes(PUBLIC_KEY); + var rijndael = new RijndaelManaged(); + rijndael.Key = keyArray; + rijndael.Mode = CipherMode.ECB; + rijndael.Padding = PaddingMode.PKCS7; + rijndael.IV = Encoding.UTF8.GetBytes(IV); + ICryptoTransform cTransform = rijndael.CreateEncryptor(); + byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length); + return resultArray; + } + + /// + /// AES解密 + /// + /// 需要解密的字符串 + /// 32位密钥 + /// 解密后的字符串 + public static byte[] Decrypt(byte[] toDecryptArray) + { + byte[] keyArray = Encoding.UTF8.GetBytes(PUBLIC_KEY); + + var rijndael = new RijndaelManaged(); + rijndael.Key = keyArray; + rijndael.Mode = CipherMode.ECB; + rijndael.Padding = PaddingMode.PKCS7; + rijndael.IV = Encoding.UTF8.GetBytes(IV); + ICryptoTransform cTransform = rijndael.CreateDecryptor(); + byte[] resultArray = cTransform.TransformFinalBlock(toDecryptArray, 0, toDecryptArray.Length); + return resultArray; + } +} diff --git a/Assets/Scripts/Logic/Encrypt/AESEncrypt.cs.meta b/Assets/Scripts/Logic/Encrypt/AESEncrypt.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..8a7269eefa57183ce67bae24212935e9dda62757 --- /dev/null +++ b/Assets/Scripts/Logic/Encrypt/AESEncrypt.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5b0c8d724069a1a45829f56cce3d562c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Logic/Extension.meta b/Assets/Scripts/Logic/Extension.meta new file mode 100644 index 0000000000000000000000000000000000000000..789ffff88546e40239334824a15269ea52bae42a --- /dev/null +++ b/Assets/Scripts/Logic/Extension.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7a137d13dc4fb6f40b492f4f9ef5b1af +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Logic/Extension/UnityExtension.cs b/Assets/Scripts/Logic/Extension/UnityExtension.cs new file mode 100644 index 0000000000000000000000000000000000000000..69c95ef2b6b916b13bf51de826287a2d9d9ab55d --- /dev/null +++ b/Assets/Scripts/Logic/Extension/UnityExtension.cs @@ -0,0 +1,18 @@ + +using UnityEngine; + +/// +/// Unity拓展 +/// +static public class UnityExtension +{ + public static T GetOrAddComponent(this GameObject go) where T : Component + { + T t = go.GetComponent(); + if (null == t) + { + t = go.AddComponent(); + } + return t; + } +} diff --git a/Assets/Scripts/Logic/Extension/UnityExtension.cs.meta b/Assets/Scripts/Logic/Extension/UnityExtension.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..3868d1a45d6dd539bf117703dbf2d010acbdf6b9 --- /dev/null +++ b/Assets/Scripts/Logic/Extension/UnityExtension.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b3eebddd3abeb4342a5369e5a565486b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Logic/HotUpdate.meta b/Assets/Scripts/Logic/HotUpdate.meta new file mode 100644 index 0000000000000000000000000000000000000000..51debbd1c62434f68beb263de8c8d6d3509638aa --- /dev/null +++ b/Assets/Scripts/Logic/HotUpdate.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: afc5a6b98a23d504f91ef3e8b2b30549 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Logic/HotUpdate/Downloader.cs b/Assets/Scripts/Logic/HotUpdate/Downloader.cs new file mode 100644 index 0000000000000000000000000000000000000000..6bcd3570f51b2e05a2fffec4574d48a81755a719 --- /dev/null +++ b/Assets/Scripts/Logic/HotUpdate/Downloader.cs @@ -0,0 +1,171 @@ +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Net; +using UnityEngine; +using System.Threading; + + +/// +/// 下载器 +/// +public class Downloader +{ + private Stream m_fs, m_ns; + private int m_readSize; + private byte[] m_buff; + private HotUpdater.PackInfo m_packInfo; + + + /// + /// 下载状态 + /// + public DownloadState state { get; private set; } + /// + /// 当前已下载的大小 + /// + public long curDownloadSize { get; private set; } + + /// + /// 停止线程 + /// + private bool m_stopThread = false; + private Thread m_thread; + + + public void Start(HotUpdater.PackInfo packInfo) + { + m_buff = new byte[1024*4]; + state = DownloadState.Ready; + m_packInfo = packInfo; + var httpReq = HttpWebRequest.Create(m_packInfo.url) as HttpWebRequest; + httpReq.Timeout = 5000; + // 以md5作为文件名保存文件 + var savePath = Application.persistentDataPath + "/" + m_packInfo.md5; + GameLogger.LogGreen("Downloader Start, savePath: " + savePath); + m_fs = new FileStream(savePath, FileMode.OpenOrCreate, FileAccess.Write); + curDownloadSize = m_fs.Length; + if (curDownloadSize == m_packInfo.size) + { + state = DownloadState.End; + Dispose(); + return; + } + else if (curDownloadSize > m_packInfo.size) + { + // 下载的文件超过了实际大小,删掉重新下载 + curDownloadSize = 0; + m_fs.Close(); + File.Delete(savePath); + m_fs = new FileStream(savePath, FileMode.Create, FileAccess.Write); + } + else if (curDownloadSize > 0) + { + GameLogger.LogGreen("检测到上次文件下载未结束,断点续传,上次已下载大小: " + curDownloadSize); + // 设置本地文件流的起始位置 + m_fs.Seek(curDownloadSize, SeekOrigin.Current); + // 设置远程访问文件流的起始位置 + httpReq.AddRange(curDownloadSize); + } + + HttpWebResponse response; + try + { + response = (HttpWebResponse)httpReq.GetResponse(); + } + catch (System.Exception e) + { + GameLogger.LogError(e); + state = DownloadState.ConnectionError; + return; + } + + GameLogger.Log("response.StatusCode: " + response.StatusCode); + if (response.StatusCode != HttpStatusCode.PartialContent) + { + if (File.Exists(savePath)) + { + m_fs.Close(); + m_fs = null; + curDownloadSize = 0; + File.Delete(savePath); + } + m_fs = new FileStream(savePath, FileMode.Create, FileAccess.Write); + } + + m_ns = response.GetResponseStream(); + + // 开启一个独立的写文件线程 + if (null == m_thread) + { + m_stopThread = false; + m_thread = new Thread(WriteThread); + m_thread.Start(); + } + } + + + /// + /// 写文件线程 + /// + private void WriteThread() + { + state = DownloadState.Ing; + while (!m_stopThread) + { + try + { + var readSize = m_ns.Read(m_buff, 0, m_buff.Length); + if (readSize > 0) + { + m_fs.Write(m_buff, 0, readSize); + curDownloadSize += readSize; + Thread.Sleep(0); + } + else + { + // 完毕 + m_stopThread = true; + state = DownloadState.End; + Dispose(); + } + } + catch (System.Exception e) + { + // 下载出错 + state = DownloadState.DataProcessingError; + Dispose(); + } + } + } + + /// + /// 清理 + /// + public void Dispose() + { + m_stopThread = true; + if (null != m_fs) + { + m_fs.Close(); + m_fs = null; + } + if (null != m_ns) + { + m_ns.Close(); + m_ns = null; + } + m_packInfo = null; + m_buff = null; + } + + + public enum DownloadState + { + Ready, + Ing, + ConnectionError, + DataProcessingError, + End, + } +} diff --git a/Assets/Scripts/Logic/HotUpdate/Downloader.cs.meta b/Assets/Scripts/Logic/HotUpdate/Downloader.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..4f818b152a9f3c0e73340ddf55a72bb51fbb8278 --- /dev/null +++ b/Assets/Scripts/Logic/HotUpdate/Downloader.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a5320d1f1f35ec344832d540cfe4eaf6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Logic/HotUpdate/HotUpdater.cs b/Assets/Scripts/Logic/HotUpdate/HotUpdater.cs new file mode 100644 index 0000000000000000000000000000000000000000..504a347ec2f554eff957d505ca4be9a1ee23bbe5 --- /dev/null +++ b/Assets/Scripts/Logic/HotUpdate/HotUpdater.cs @@ -0,0 +1,430 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Networking; +using LuaFramework; +using System; +using LitJson; +using System.Security.Cryptography.X509Certificates; +using System.Net.Security; +using System.Net; +using System.IO; +using Ionic.Zip; + + +/// +/// 热更新逻辑 +/// +public class HotUpdater +{ + /// + /// app整包强制更新 + /// + public Action actionForceFullAppUpdate; + /// + /// app整包非强制更新 + /// + public Action actionWeakFullAppUpdate; + /// + /// 没有任何更新 + /// + public Action actionNothongUpdate; + /// + /// 全部热更包下载完毕 + /// + public Action actionAllDownloadDone; + /// + /// 错误提示 + /// + public Action actionShowErrorTips; + + /// + /// 更新提示语 + /// + public Action actionUpdateTipsText; + + public Action actionUpdateProgress; + private DownloadingInfo m_downloadingInfo; + + + /// + /// 需要整包更新 + /// + private bool m_needFullAppUpdate; + /// + /// 是否强制更新 + /// + private bool m_hasNextUpdateBtn; + /// + /// 整包更新的URL + /// + private string m_fullAppUpdateUrl; + /// + /// 相同app版本号的res更新(res版本号增加) + /// + private bool m_sameAppVerResUpdate; + private List m_packList = new List(); + /// + /// 下载器 + /// + private Downloader m_downloader; + + private IEnumerator m_onDownloadItr; + + private int m_curPackIndex = 0; + + public void Init() + { + // 解决HTTPS证书问题 + ServicePointManager.ServerCertificateValidationCallback = MyRemoteCertificateValidationCallback; + } + + public void Start() + { + m_needFullAppUpdate = false; + m_hasNextUpdateBtn = true; + m_fullAppUpdateUrl = null; + m_sameAppVerResUpdate = false; + m_packList.Clear(); + m_downloadingInfo = new DownloadingInfo(); + + // 请求更新列表 + var updateInfos = ReqUpdateInfo(); + if (null != updateInfos) + { + // 对更新列表进行排序 + SortUpdateInfo(ref updateInfos); + // 计算实际需要下载的增量包列表 + CalculateUpdatePackList(updateInfos); + // 需要整包更新 + if (m_needFullAppUpdate) + { + if (m_hasNextUpdateBtn) + { + // 可以不强制更新整包,有【下次】按钮 + actionWeakFullAppUpdate?.Invoke(); + } + else + { + // 必须整包更新,强制,没有【下次】按钮 + actionForceFullAppUpdate?.Invoke(); + } + } + else if (m_sameAppVerResUpdate) + { + // 有同app版本的res增量包更新 + m_curPackIndex = 0; + StartDownloadResPack(); + } + else + { + // 没有任何更新 + actionNothongUpdate?.Invoke(); + } + } + } + + /// + /// 请求更新信息 + /// + private List ReqUpdateInfo() + { + UnityWebRequest uwr = UnityWebRequest.Get(AppConst.WebUrl + "update_list.json"); + var request = uwr.SendWebRequest(); + while (!request.isDone) { } + if (!string.IsNullOrEmpty(uwr.error)) + { + // Debug.LogError(uwr.error); + actionShowErrorTips.Invoke(uwr.result); + return null; + } + + Debug.Log(uwr.downloadHandler.text); + return JsonMapper.ToObject>(uwr.downloadHandler.text); + } + + private void SortUpdateInfo(ref List updateInfos) + { + // 逆序排序,版本号大的排前面 + updateInfos.Sort((a, b) => + { + return VersionMgr.CompareVersion(b.appVersion, a.appVersion); + }); + } + + /// + /// 分析更新类型 + /// + public void CalculateUpdatePackList(List updateInfos) + { + string bigestAppVer = "0.0.0.0"; + m_hasNextUpdateBtn = false; + foreach (var info in updateInfos) + { + if (VersionMgr.CompareVersion(info.appVersion, VersionMgr.instance.appVersion) > 0) + { + m_needFullAppUpdate = true; + if (VersionMgr.CompareVersion(info.appVersion, bigestAppVer) > 0) + { + bigestAppVer = info.appVersion; + m_fullAppUpdateUrl = info.appUrl; + } + } + if (VersionMgr.CompareVersion(info.appVersion, VersionMgr.instance.appVersion) == 0) + { + m_hasNextUpdateBtn = true; + foreach (var pack in info.updateList) + { + if (VersionMgr.CompareVersion(pack.resVersion, VersionMgr.instance.resVersion) > 0) + { + m_sameAppVerResUpdate = true; + m_packList.Add(pack); + } + } + } + } + GameLogger.Log("m_packList.Count: " + m_packList.Count); + } + + + public void DoFullAppUpdate() + { + // 跳到应用商店 + Application.OpenURL(m_fullAppUpdateUrl); + } + + /// + /// 跳过大版本更新 + /// + public void DoNextTime() + { + // 不更新整包,执行res热更 + if (m_sameAppVerResUpdate) + { + m_curPackIndex = 0; + StartDownloadResPack(); + } + else + { + actionNothongUpdate?.Invoke(); + } + } + + private void StartDownloadResPack(bool next = false) + { + actionUpdateTipsText?.Invoke("正在下载更新包,请稍等..."); + if (next) + ++m_curPackIndex; + if (m_curPackIndex > m_packList.Count - 1) + { + GameLogger.Log("全部热更包下载完毕"); + actionAllDownloadDone?.Invoke(); + return; + } + + // 排序,确保版本号小的先下载 + m_packList.Sort((a, b) => + { + return VersionMgr.CompareVersion(a.resVersion, b.resVersion); + }); + var packInfo = m_packList[m_curPackIndex]; + GameLogger.Log("开始下载: " + packInfo.ToString()); + m_downloadingInfo.totalPackCount = m_packList.Count; + m_downloadingInfo.packIndex = m_curPackIndex; + m_downloadingInfo.targetDownloadSize = packInfo.size; + m_downloader = new Downloader(); + m_downloader.Start(packInfo); + } + + public void Update() + { + if (null != m_downloader) + { + switch (m_downloader.state) + { + case Downloader.DownloadState.End: + { + m_downloader = null; + m_onDownloadItr = OnDownloadEnd(); + } + break; + case Downloader.DownloadState.Ing: + { + OnDownloading(); + } + break; + case Downloader.DownloadState.ConnectionError: + { + m_downloader = null; + OnDownloadError(UnityWebRequest.Result.ConnectionError); + } + break; + case Downloader.DownloadState.DataProcessingError: + + { + m_downloader = null; + OnDownloadError(UnityWebRequest.Result.DataProcessingError); + } + break; + } + } + RunCoroutine(); + } + + private void RunCoroutine() + { + if (null != m_onDownloadItr && !m_onDownloadItr.MoveNext()) + { + m_onDownloadItr = null; + } + } + + private IEnumerator OnDownloadEnd() + { + var packInfo = m_packList[m_curPackIndex]; + GameLogger.Log("下载完毕: " + packInfo.url); + actionUpdateTipsText?.Invoke("正在校验文件,请稍等..."); + yield return null; + + var filePath = Application.persistentDataPath + "/" + packInfo.md5; + var md5Ok = CheckMd5(filePath, packInfo.md5); + if (!md5Ok) + { + DeleteFile(filePath); + Debug.LogError("MD5校验不通过,重新下载"); + m_downloader = new Downloader(); + m_downloader.Start(m_packList[m_curPackIndex]); + } + else + { + // 解压zip + actionUpdateTipsText?.Invoke("正在解压文件,请稍等..."); + yield return null; + GameLogger.LogGreen("解压文件:" + filePath); + int index = 0; + using (ZipFile zip = new ZipFile(filePath)) + { + var cnt = zip.Count; + foreach (var entity in zip) + { + ++index; + entity.Extract(Application.persistentDataPath + "/update/", ExtractExistingFileAction.OverwriteSilently); + actionUpdateProgress?.Invoke((float)index / cnt); + yield return null; + } + } + // 删除zip + DeleteFile(filePath); + // 更新版本号 + VersionMgr.instance.UpdateResVersion(packInfo.resVersion); + // 请求下载下一个zip + StartDownloadResPack(true); + } + } + + + /// + /// 下载中 + /// + private void OnDownloading() + { + // 更新进度条 + m_downloadingInfo.curDownloadSize = m_downloader.curDownloadSize; + var value = (float)m_downloadingInfo.curDownloadSize / m_downloadingInfo.targetDownloadSize; + actionUpdateProgress?.Invoke(value); + } + + /// + /// 下载异常 + /// + private void OnDownloadError(UnityWebRequest.Result result) + { + actionShowErrorTips?.Invoke(result); + } + + /// + /// 删除文件 + /// + private void DeleteFile(string filePath) + { + GameLogger.LogGreen("删除文件:" + filePath); + if (File.Exists(filePath)) + File.Delete(filePath); + } + + /// + /// 检测MD5 + /// + /// 要检测的文件路径 + /// 目标MD5 + /// + private bool CheckMd5(string filePath, string md5) + { + var localMd5 = LuaFramework.Util.md5file(filePath); + var ok = localMd5.Equals(md5); + GameLogger.LogGreen("MD5校验,ok: " + ok); + return ok; + } + + /// + /// 解决HTTPS证书问题 + /// + private bool MyRemoteCertificateValidationCallback(System.Object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) + { + if (sslPolicyErrors == SslPolicyErrors.None) return true; + bool isOk = true; + for (int i = 0; i < chain.ChainStatus.Length; i++) + { + if (chain.ChainStatus[i].Status != X509ChainStatusFlags.RevocationStatusUnknown) + { + chain.ChainPolicy.RevocationFlag = X509RevocationFlag.EntireChain; + chain.ChainPolicy.RevocationMode = X509RevocationMode.Online; + chain.ChainPolicy.UrlRetrievalTimeout = new TimeSpan(0, 1, 0); + chain.ChainPolicy.VerificationFlags = X509VerificationFlags.AllFlags; + bool chainIsValid = chain.Build((X509Certificate2)certificate); + if (!chainIsValid) + { + isOk = false; + break; + } + } + } + return isOk; + } + + public void Dispose() + { + if (null != m_downloader) + m_downloader.Dispose(); + } + + public class UpdateInfo + { + public string appVersion; + public string appUrl; + public List updateList; + } + + public class PackInfo + { + public string resVersion; + public string md5; + public int size; + public string url; + + public override string ToString() + { + return string.Format("resVersion: {0}, md5: {1}, size: {2}, url: {3}", resVersion, md5, size, url); + } + } + + public struct DownloadingInfo + { + public long curDownloadSize; + public long targetDownloadSize; + public int packIndex; + public int totalPackCount; + } +} + + diff --git a/Assets/Scripts/Logic/HotUpdate/HotUpdater.cs.meta b/Assets/Scripts/Logic/HotUpdate/HotUpdater.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..949ca178535247123268239a041fc22f3d64a60d --- /dev/null +++ b/Assets/Scripts/Logic/HotUpdate/HotUpdater.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0482c974c9a7cdd4e8eae436c53019bb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Logic/PrefabObjBinder.cs b/Assets/Scripts/Logic/PrefabObjBinder.cs new file mode 100644 index 0000000000000000000000000000000000000000..498da6bb0919240032867b0623380abe6769be9b --- /dev/null +++ b/Assets/Scripts/Logic/PrefabObjBinder.cs @@ -0,0 +1,86 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UObject = UnityEngine.Object; +using System; +using UnityEngine.UI; + +public class PrefabObjBinder : MonoBehaviour +{ + [System.Serializable] + public class Item + { + public string name; + public UObject obj; + } + + public Item[] items = new Item[0]; + + private Dictionary m_itemsDic = new Dictionary(); + + public UObject GetObj(string name) + { + if (0 == m_itemsDic.Count) + { + for (int i = 0, len = items.Length; i < len; ++i) + { + m_itemsDic[items[i].name] = items[i]; + } + } + if (m_itemsDic.ContainsKey(name)) + { + return m_itemsDic[name].obj; + } + return null; + } + + public T GetObj(string name) where T : UObject + { + return GetObj(name) as T; + } + + public Button SetBtnClick(string name, Action cb) + { + var obj = GetObj(name); + if (null == obj) + { + Debug.LogError("SetClick Error, null == obj, name:" + name); + return null; + } + var btn = obj as Button; + btn.onClick.AddListener(() => + { + cb?.Invoke(); + }); + return btn; + } + + public Text SetText(string name, string text) + { + var obj = GetObj(name); + if (null == obj) + { + Debug.LogError("SetText Error, null == obj, name:" + name); + return null; + } + var txt = obj as Text; + txt.text = text; + return txt; + } + + public Toggle SetToggle(string name, Action cb) + { + var obj = GetObj(name); + if (null == obj) + { + Debug.LogError("SetToggle Error, null == obj, name:" + name); + return null; + } + var tgl = obj as Toggle; + tgl.onValueChanged.AddListener((v) => + { + cb?.Invoke(v); + }); + return tgl; + } +} diff --git a/Assets/Scripts/Logic/PrefabObjBinder.cs.meta b/Assets/Scripts/Logic/PrefabObjBinder.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..e4f86dbce266ec6f8d9afd5e01c539c3c43bbdcd --- /dev/null +++ b/Assets/Scripts/Logic/PrefabObjBinder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f8e912e7ed686944bbbe9f5fd3960bdd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Logic/Resources.meta b/Assets/Scripts/Logic/Resources.meta new file mode 100644 index 0000000000000000000000000000000000000000..f12eb3a1d773ac5c3f055345c655967cef3b2567 --- /dev/null +++ b/Assets/Scripts/Logic/Resources.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7781ea19a4da0a0438074b42075662e7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Logic/Resources/ResourceMgr.cs b/Assets/Scripts/Logic/Resources/ResourceMgr.cs new file mode 100644 index 0000000000000000000000000000000000000000..0d96ef8ab64863d84b4aff1afa3bff353b852ec2 --- /dev/null +++ b/Assets/Scripts/Logic/Resources/ResourceMgr.cs @@ -0,0 +1,153 @@ +using System.Collections.Generic; +using UnityEngine; +using UObject = UnityEngine.Object; +using System.IO; + +public class ResourceMgr +{ + /// + /// 预加载基础的Bundle资源 + /// + public void PreloadBaseBundle() + { + LoadAssetBundle("baseres.bundle"); + } + + /// + /// 预加载lua的AssetBundle + /// + public void PreloadLuaBundles() + { + if (File.Exists(updatePath + "/lua_update.bundle")) + LoadAssetBundle("lua_update.bundle"); + LoadAssetBundle("lua.bundle"); + } + + public T LoadAsset(int resId) where T : UObject + { + var resCfg = ResourcesCfg.instance.GetResCfg(resId); + return LoadAsset(resCfg.editor_path); + } + + public T LoadAsset(string resPath) where T : UObject + { + if (m_assets.ContainsKey(resPath)) + return m_assets[resPath] as T; + + T obj = null; +#if UNITY_EDITOR + obj = UnityEditor.AssetDatabase.LoadAssetAtPath("Assets/GameRes/" + resPath); +#else + // resources.bytes的第一级目录为AssetBundle + var abName = resPath.Substring(0, resPath.IndexOf("/")).ToLower() + ".bundle"; + var fname = Path.GetFileName(resPath); + AssetBundle ab = null; + if(File.Exists(updatePath + "/" + fname)) + { + // 热更的资源,是一个独立的AssetBundle文件,以fname为文件名 + ab = LoadAssetBundle(fname); + } + else + { + ab = LoadAssetBundle(abName); + } + if (null != ab) + { + var assetName = fname.Substring(0, fname.IndexOf(".")); + obj = ab.LoadAsset(assetName); + } +#endif + + if (null != obj) + m_assets[resPath] = obj; + return obj; + } + + private AssetBundle LoadAssetBundle(string abName) + { + if (m_bundles.ContainsKey(abName)) + return m_bundles[abName]; + + + AssetBundle bundle = null; + if (File.Exists(updatePath + "/" + abName)) + { + // 优先从update目录(热更新目录)中查找资源 + bundle = AssetBundle.LoadFromFile(updatePath + "/" + abName); + } + else + { + bundle = AssetBundle.LoadFromFile(Application.streamingAssetsPath + "/res/" + abName); + } + + /* + // 如果对AssetBundle做了加密处理,则需要使用流式读取,进行解密后再通过AssetBundle.LoadFromMemory加载AssetBundle + byte[] stream = null; + stream = File.ReadAllBytes(path + "/" + abName); + // TOOD 对stream做解密 + + var bundle = AssetBundle.LoadFromMemory(stream); + */ + + if (null != bundle) + { + m_bundles[abName] = bundle; + } + return bundle; + } + + + + public string LoadCfgFile(string cfgFileName) + { + TextAsset asset = null; +#if UNITY_EDITOR + asset = UnityEditor.AssetDatabase.LoadAssetAtPath("Assets/GameRes/Config/" + cfgFileName); +#else + var bundle = LoadAssetBundle("normal_cfg.bundle"); + if (null != bundle) + asset = bundle.LoadAsset(cfgFileName); +#endif + if (null != asset) + { + return asset.text; + } + else + { + Debug.LogError("AssetBundleMgr.LoadCfgFile Error, null == asset, cfgFileName: " + cfgFileName); + return null; + } + } + + public AssetBundle GetAssetBundle(string abName) + { + if (m_bundles.ContainsKey(abName)) + { + return m_bundles[abName]; + } + Debug.LogError("GetAssetBundle Error, not contains: " + abName); + return null; + } + + private Dictionary m_bundles = new Dictionary(); + private Dictionary m_assets = new Dictionary(); + + public string updatePath + { + get + { + return Application.persistentDataPath + "/update/"; + } + } + + private static ResourceMgr s_instance; + public static ResourceMgr instance + { + get + { + if (null == s_instance) + s_instance = new ResourceMgr(); + return s_instance; + } + } +} diff --git a/Assets/Scripts/Logic/Resources/ResourceMgr.cs.meta b/Assets/Scripts/Logic/Resources/ResourceMgr.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..9b546d0fd107a86c718b25b7477fac590cfca3a1 --- /dev/null +++ b/Assets/Scripts/Logic/Resources/ResourceMgr.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: baeb396d8aa13704ba1be1514128c7e8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Logic/Resources/ResourcesCfg.cs b/Assets/Scripts/Logic/Resources/ResourcesCfg.cs new file mode 100644 index 0000000000000000000000000000000000000000..4f54787a74aea39e8acc63bf88327821eaad3e6b --- /dev/null +++ b/Assets/Scripts/Logic/Resources/ResourcesCfg.cs @@ -0,0 +1,53 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using LitJson; + +public class ResourcesCfg +{ + public void LoadCfg() + { + var text = ResourceMgr.instance.LoadCfgFile("resources.bytes"); + var list = JsonMapper.ToObject>(text); + for (int i = 0, cnt = list.Count; i < cnt; ++i) + { + var item = list[i]; + if(!m_resCfg.ContainsKey(item.id)) + { + m_resCfg.Add(item.id, item); + } + else + { + Debug.LogError("resources.bytes 有资源id重复, id: " + item.id); + } + } + } + + public ResourcesCfgItem GetResCfg(int resId) + { + if (m_resCfg.ContainsKey(resId)) + return m_resCfg[resId]; + GameLogger.LogError("ResourcesCfg.GetResCfg Error, resId: " + resId); + return null; + } + + private Dictionary m_resCfg = new Dictionary(); + + + private static ResourcesCfg s_instance; + public static ResourcesCfg instance + { + get + { + if (null == s_instance) + s_instance = new ResourcesCfg(); + return s_instance; + } + } +} + +public class ResourcesCfgItem +{ + public int id; + public string editor_path; +} diff --git a/Assets/Scripts/Logic/Resources/ResourcesCfg.cs.meta b/Assets/Scripts/Logic/Resources/ResourcesCfg.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..5054bedd342583c6e7f79837335a1d929c3cbf89 --- /dev/null +++ b/Assets/Scripts/Logic/Resources/ResourcesCfg.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 955210268ed53494f981568275ebfbf6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Logic/UI.meta b/Assets/Scripts/Logic/UI.meta new file mode 100644 index 0000000000000000000000000000000000000000..931bb43aa61f18806a65cc86ce79bb827336b4d4 --- /dev/null +++ b/Assets/Scripts/Logic/UI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 27af308ba7bb818489098a9457970c9a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Logic/UI/BasePanel.cs b/Assets/Scripts/Logic/UI/BasePanel.cs new file mode 100644 index 0000000000000000000000000000000000000000..aeedcb720bcaa78390d4fb9fc3af0b53b73cc06d --- /dev/null +++ b/Assets/Scripts/Logic/UI/BasePanel.cs @@ -0,0 +1,50 @@ +using UnityEngine; +using LuaFramework; +using LuaInterface; + +public class BasePanel : MonoBehaviour +{ + private LuaFunction onShow; + private LuaFunction onHide; + private LuaFunction onUpdate; + private LuaFunction onRegistEvent; + private LuaFunction onUnRegistEvet; + private string panelName; + public GameObject panelObj { get; private set; } + + public void Initialize(string panelName, GameObject panelObj) + { + this.panelName = panelName; + this.panelObj = panelObj; + LuaManager luaMgr = LuaHelper.GetLuaManager(); + if (null != luaMgr) + { + onShow = luaMgr.GetFunction(panelName + ".OnShow", false); + onHide = luaMgr.GetFunction(panelName + ".OnHide", false); + onUpdate = luaMgr.GetFunction(panelName + ".OnUpdate", false); + } + + } + + public void Show() + { + if (null != onShow) + { + onShow.Call(panelObj); + } + } + + public void Hide() + { + Destroy(this.panelObj); + Util.ClearMemory(); + if (null != onHide) + onHide.Call(); + } + + private void Update() + { + if (null != onUpdate) + onUpdate.Call(); + } +} diff --git a/Assets/Scripts/Logic/UI/BasePanel.cs.meta b/Assets/Scripts/Logic/UI/BasePanel.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..78b873513141947ec0a745919d46ea440da33e27 --- /dev/null +++ b/Assets/Scripts/Logic/UI/BasePanel.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a2dd9ef447a76644380b24b63387eb95 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Logic/UI/PanelMgr.cs b/Assets/Scripts/Logic/UI/PanelMgr.cs new file mode 100644 index 0000000000000000000000000000000000000000..ff4bb5848c2faa902fafa3ad6bf195f661d96147 --- /dev/null +++ b/Assets/Scripts/Logic/UI/PanelMgr.cs @@ -0,0 +1,92 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + + +public class PanelMgr +{ + public void Init() + { + m_rootCanvas = GameObject.Find("Canvas").transform; + } + + public BasePanel ShowPanel(string panelName, int resId) + { + if (null != panelName && m_panels.ContainsKey(panelName)) + return m_panels[panelName]; + + var resCfg = ResourcesCfg.instance.GetResCfg(resId); + if(null != resCfg) + { + return ShowPanel(panelName, resCfg.editor_path); + } + else + { + Debug.LogError("ShowPanel Error, null == resCfg, resId: " + resId); + return null; + } + } + + public T ShowPanel(string panelName, string resPath) where T :BasePanel + { + if (null != panelName && m_panels.ContainsKey(panelName)) + return m_panels[panelName] as T; + var prefab = ResourceMgr.instance.LoadAsset(resPath); + var go = Object.Instantiate(prefab); + go.transform.SetParent(m_rootCanvas, false); + var panel = go.GetOrAddComponent(); + panel.Initialize(panelName, go); + if (null != panelName) + m_panels.Add(panelName, panel); + panel.Show(); + return panel; + } + + public GameObject InstantiateUI(int resId) + { + var resCfg = ResourcesCfg.instance.GetResCfg(resId); + if (null == resCfg) + { + return null; + } + var prefab = ResourceMgr.instance.LoadAsset(resCfg.editor_path); + if (null == prefab) + return null; + var uiObj = Object.Instantiate(prefab); + uiObj.transform.SetParent(m_rootCanvas, false); + return uiObj; + } + + public void HidePanel(string panelName) + { + if (m_panels.ContainsKey(panelName)) + { + m_panels[panelName].Hide(); + m_panels.Remove(panelName); + } + } + + public void HideAllPanels() + { + foreach(var panel in m_panels.Values) + { + panel.Hide(); + } + m_panels.Clear(); + } + + private Transform m_rootCanvas; + + private Dictionary m_panels = new Dictionary(); + + private static PanelMgr s_instance; + public static PanelMgr instance + { + get + { + if (null == s_instance) + s_instance = new PanelMgr(); + return s_instance; + } + } +} diff --git a/Assets/Scripts/Logic/UI/PanelMgr.cs.meta b/Assets/Scripts/Logic/UI/PanelMgr.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..d858944dc5bdd803ae299e2331d043b2900a1e68 --- /dev/null +++ b/Assets/Scripts/Logic/UI/PanelMgr.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 34f0894be393cf742805c4366cdd0e95 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Logic/Version.meta b/Assets/Scripts/Logic/Version.meta new file mode 100644 index 0000000000000000000000000000000000000000..fb9200d331d9e4c5db696846fe45f840f7bc5da0 --- /dev/null +++ b/Assets/Scripts/Logic/Version.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b38e07b416ddf0944bdd2a6092a26ad7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Logic/Version/VersionMgr.cs b/Assets/Scripts/Logic/Version/VersionMgr.cs new file mode 100644 index 0000000000000000000000000000000000000000..fb7a805d8ebca182aa79a24a8a8f78a507a7b589 --- /dev/null +++ b/Assets/Scripts/Logic/Version/VersionMgr.cs @@ -0,0 +1,125 @@ +using UnityEngine; +using LitJson; +using System.IO; +public class VersionMgr +{ + + public void Init() + { + // 从文件中读取版本号 + var versionText = Resources.Load("version").text; + var jsonData = JsonMapper.ToObject(versionText); + appVersion = jsonData["app_version"].ToString(); + resVersion = jsonData["res_version"].ToString(); + + // 从缓存中读取资源版本号 + var cacheResVersion = ReadCacheResVersion(); + + // 如果缓存的版本号比文件中的版本号大,以缓存的为准(因为热更新会增加缓存的资源版本号) + if (CompareVersion(cacheResVersion, resVersion) > 0) + { + resVersion = cacheResVersion; + } + GameLogger.Log("appVersion: " + appVersion + ", resVersion: " + resVersion); + } + + /// + /// 读取缓存的资源版本号 + /// + private string ReadCacheResVersion() + { + if (File.Exists(cacheResVersionFile)) + { + using (var f = File.OpenRead(cacheResVersionFile)) + { + using (var sr = new StreamReader(f)) + { + return sr.ReadToEnd(); + } + } + } + return "0.0.0.0"; + } + + /// + /// 更新资源版本号 + /// + public void UpdateResVersion(string resVersion) + { + this.resVersion = resVersion; + var dir = Path.GetDirectoryName(cacheResVersionFile); + if (Directory.Exists(dir)) + Directory.CreateDirectory(dir); + using (var f = File.OpenWrite(cacheResVersionFile)) + { + using(StreamWriter sw = new StreamWriter(f)) + { + sw.Write(resVersion); + } + } + GameLogger.LogGreen("更新本地缓存版本号:" + resVersion); + } + + /// + /// 删除缓存的资源版本号 + /// + public void DeleteCacheResVersion() + { + if(File.Exists(cacheResVersionFile)) + { + File.Delete(cacheResVersionFile); + } + } + + /// + /// 对比两个版本号的大小 + /// + /// 版本号1 + /// 版本号2 + /// 1:v1比v2大,0:v1等于v2,-1:v1小于v2 + public static int CompareVersion(string v1, string v2) + { + if (v1 == v2) return 0; + string[] v1Array = v1.Split('.'); + string[] v2Array = v2.Split('.'); + for (int i = 0, len = v1Array.Length; i < len; ++i) + { + if (int.Parse(v1Array[i]) < int.Parse(v2Array[i])) + return -1; + else if (int.Parse(v1Array[i]) > int.Parse(v2Array[i])) + return 1; + } + return 0; + } + + /// + /// 游戏版本号 + /// + public string appVersion { get; private set; } + /// + /// 资源版本号(热更新增加这个版本号) + /// + public string resVersion { get; private set; } + + /// + /// 热更新版本号 + /// + private string cacheResVersionFile + { + get + { + return Application.persistentDataPath + "/update/version.txt"; + } + } + + private static VersionMgr s_instance; + public static VersionMgr instance + { + get + { + if (null == s_instance) + s_instance = new VersionMgr(); + return s_instance; + } + } +} diff --git a/Assets/Scripts/Logic/Version/VersionMgr.cs.meta b/Assets/Scripts/Logic/Version/VersionMgr.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..865006b7a19056b625f3c126fd0d8f6f6b175af8 --- /dev/null +++ b/Assets/Scripts/Logic/Version/VersionMgr.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5360427f0b7a1f4458d14b285e993c57 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Main.cs b/Assets/Scripts/Main.cs new file mode 100644 index 0000000000000000000000000000000000000000..fe229db41b47d36dfda9c0f97471b34dc19de7b1 --- /dev/null +++ b/Assets/Scripts/Main.cs @@ -0,0 +1,41 @@ +锘縰sing UnityEngine; + +/// +/// 娓告垙鍏ュ彛鑴氭湰 +/// +public class Main : MonoBehaviour +{ + + private void Awake() + { + // 鍒濆鍖栦竴浜涘繀瑕佺殑绠$悊鍣 + GameLogger.Init(); + VersionMgr.instance.Init(); + PanelMgr.instance.Init(); + + // 棰勫姞杞藉熀纭鐨凚undle + ResourceMgr.instance.PreloadBaseBundle(); + + // 鏄剧ず鏇存柊鐣岄潰 + UpdatePanel.Create(()=> + { + // 鏇存柊瀹屾瘯 + AfterHotUpdate(); + }); + } + + /// + /// 鐑洿鏂板悗 + /// + private void AfterHotUpdate() + { + Debug.Log("AfterHotUpdate"); + + ResourcesCfg.instance.LoadCfg(); + // 棰勫姞杞絃ua鐨凙ssetBundle + ResourceMgr.instance.PreloadLuaBundles(); + + // 鍚姩lua妗嗘灦 + AppFacade.Instance.StartUp(); + } +} \ No newline at end of file diff --git a/Assets/Scripts/Main.cs.meta b/Assets/Scripts/Main.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..f8f0e6f022cc9b5de97e463e19a9edfde491fbc8 --- /dev/null +++ b/Assets/Scripts/Main.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c13baae76dc25164fbbeec8317b29af0 +timeCreated: 1436459273 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/View.meta b/Assets/Scripts/View.meta new file mode 100644 index 0000000000000000000000000000000000000000..b649ae7d3bb32ea9e500bfdf30093c6f8882d4e9 --- /dev/null +++ b/Assets/Scripts/View.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: efacf07fb74be1a498b629738ee05161 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/View/Animation.meta b/Assets/Scripts/View/Animation.meta new file mode 100644 index 0000000000000000000000000000000000000000..a5cc5c9fbaf715c16baa359073b6bce55e399f08 --- /dev/null +++ b/Assets/Scripts/View/Animation.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 182a1aa26ec092d418c2cf36751d419a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/View/Animation/AnimationEventTrigger.cs b/Assets/Scripts/View/Animation/AnimationEventTrigger.cs new file mode 100644 index 0000000000000000000000000000000000000000..e72fd7736e441383131724f29e51e72ef2e84c84 --- /dev/null +++ b/Assets/Scripts/View/Animation/AnimationEventTrigger.cs @@ -0,0 +1,15 @@ +using UnityEngine; +using System; + +/// +/// 动画事件触发器 +/// +public class AnimationEventTrigger : MonoBehaviour +{ + public Action aniEvent; + + public void AniMsgStr(string msg) + { + aniEvent?.Invoke(msg); + } +} diff --git a/Assets/Scripts/View/Animation/AnimationEventTrigger.cs.meta b/Assets/Scripts/View/Animation/AnimationEventTrigger.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..6604b2be50226832871cb2700dd0b8d2f0dfeea9 --- /dev/null +++ b/Assets/Scripts/View/Animation/AnimationEventTrigger.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 72ba7ff7cd38d6b4b8574d33eb3e82eb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/View/UI.meta b/Assets/Scripts/View/UI.meta new file mode 100644 index 0000000000000000000000000000000000000000..79918a6a1e0bd53d36def20e02c5e849963e9e00 --- /dev/null +++ b/Assets/Scripts/View/UI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 74ca4e106ef35c742aa672496e0dcb13 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/View/UI/UpdatePanel.cs b/Assets/Scripts/View/UI/UpdatePanel.cs new file mode 100644 index 0000000000000000000000000000000000000000..57549e1b215b508aef3e45d05dfc9e3d30bde677 --- /dev/null +++ b/Assets/Scripts/View/UI/UpdatePanel.cs @@ -0,0 +1,161 @@ +using UnityEngine; +using UnityEngine.UI; +using System; +using UnityEngine.Networking; + +public class UpdatePanel : BasePanel +{ + private Text m_versionText; + private Slider m_progressSlider; + private Text m_progressText; + private Text m_tipsText; + private GameObject m_appUpdateDlg; + private Button m_nextBtn; + private Button m_fullAppUpdateBtn; + private GameObject m_errorTipsDlg; + private Text m_errorText; + private Button m_retryBtn; + + + + private HotUpdater m_hotUpdater; + private Action m_cb; + + public static void Create(Action cb) + { + var panel = PanelMgr.instance.ShowPanel("UpdatePanel", "BaseRes/UpdatePanel.prefab"); + panel.m_cb = cb; + } + + void Awake() + { + var uiBinder = gameObject.GetComponent(); + m_versionText = uiBinder.GetObj("versionText"); + m_progressSlider = uiBinder.GetObj("progressSlider"); + m_progressText = uiBinder.GetObj("progressText"); + m_tipsText = uiBinder.GetObj("tipsText"); + m_appUpdateDlg = uiBinder.GetObj("appUpdateDlg"); + m_nextBtn = uiBinder.GetObj