├── .gitattributes ├── prj ├── ProjectSettings │ ├── ProjectVersion.txt │ ├── ClusterInputManager.asset │ ├── NetworkManager.asset │ ├── EditorBuildSettings.asset │ ├── TimeManager.asset │ ├── AudioManager.asset │ ├── EditorSettings.asset │ ├── TagManager.asset │ ├── DynamicsManager.asset │ ├── UnityConnectSettings.asset │ ├── NavMeshAreas.asset │ ├── Physics2DSettings.asset │ ├── GraphicsSettings.asset │ ├── QualitySettings.asset │ ├── InputManager.asset │ └── ProjectSettings.asset └── Assets │ ├── Examples │ ├── Icons │ │ ├── icon.png │ │ └── icon.png.meta │ ├── Scenes │ │ └── Example.unity.meta │ ├── Icons.meta │ ├── Scenes.meta │ ├── Scripts.meta │ └── Scripts │ │ ├── Example.cs.meta │ │ └── Example.cs │ ├── Plugins │ ├── x86 │ │ ├── my_basic.dll │ │ └── my_basic.dll.meta │ ├── x86_64 │ │ ├── my_basic.dll │ │ └── my_basic.dll.meta │ ├── MyCodeEditor │ │ ├── Consola.ttf │ │ ├── MsgBox.prefab.meta │ │ ├── MyCodeEditor.prefab.meta │ │ ├── MsgBox.cs.meta │ │ ├── my_basic.cs.meta │ │ ├── Interpreter.cs.meta │ │ ├── MyCodeEditor.cs.meta │ │ ├── MyCodeHead.cs.meta │ │ ├── MyCodeInput.cs.meta │ │ ├── MyCodeLine.cs.meta │ │ ├── MyCodeUtils.cs.meta │ │ ├── Consola.ttf.meta │ │ ├── MyCodeInput.cs │ │ ├── MsgBox.cs │ │ ├── MyCodeLine.cs │ │ ├── MyCodeHead.cs │ │ ├── MyCodeUtils.cs │ │ ├── Interpreter.cs │ │ ├── MsgBox.prefab │ │ ├── MyCodeEditor.cs │ │ └── my_basic.cs │ ├── mac │ │ ├── my_basic.bundle │ │ │ ├── Contents │ │ │ │ ├── MacOS │ │ │ │ │ ├── my_basic │ │ │ │ │ └── my_basic.meta │ │ │ │ ├── Info.plist.meta │ │ │ │ ├── _CodeSignature │ │ │ │ │ ├── CodeResources.meta │ │ │ │ │ └── CodeResources │ │ │ │ ├── MacOS.meta │ │ │ │ ├── _CodeSignature.meta │ │ │ │ └── Info.plist │ │ │ └── Contents.meta │ │ └── my_basic.bundle.meta │ ├── mac.meta │ ├── x86.meta │ ├── x86_64.meta │ └── MyCodeEditor.meta │ ├── Examples.meta │ └── Plugins.meta ├── bin ├── my_basic_code_editor_unity_Data │ ├── app.info │ ├── level0 │ ├── level0.resS │ ├── Mono │ │ ├── mono.dll │ │ ├── MonoPosixHelper.dll │ │ └── etc │ │ │ └── mono │ │ │ ├── browscap.ini │ │ │ ├── config │ │ │ ├── 2.0 │ │ │ ├── Browsers │ │ │ │ └── Compat.browser │ │ │ ├── settings.map │ │ │ └── web.config │ │ │ └── 1.0 │ │ │ └── machine.config │ ├── Managed │ │ ├── System.dll │ │ ├── mscorlib.dll │ │ ├── System.Core.dll │ │ ├── UnityEngine.dll │ │ ├── Assembly-CSharp.dll │ │ ├── Mono.Security.dll │ │ ├── UnityEngine.UI.dll │ │ ├── UnityEngine.dll.mdb │ │ ├── UnityEngine.Networking.dll │ │ ├── Assembly-CSharp-firstpass.dll │ │ └── UnityEngine.PlaymodeTestsRunner.dll │ ├── globalgamemanagers │ ├── Plugins │ │ └── my_basic.dll │ ├── sharedassets0.assets │ ├── globalgamemanagers.assets │ ├── sharedassets0.assets.resS │ └── Resources │ │ ├── unity_builtin_extra │ │ └── unity default resources └── my_basic_code_editor_unity.exe ├── img ├── curd.png ├── edit.png ├── exe.png ├── file.png ├── phone.jpg ├── run.png └── config.png ├── pkg └── my_basic_code_editor_unity.unitypackage ├── .gitignore ├── LICENSE └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | *.aspx linguist-vendored 2 | -------------------------------------------------------------------------------- /prj/ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 5.5.0f3 2 | -------------------------------------------------------------------------------- /bin/my_basic_code_editor_unity_Data/app.info: -------------------------------------------------------------------------------- 1 | Wang Renxin 2 | my_code_editor -------------------------------------------------------------------------------- /img/curd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/img/curd.png -------------------------------------------------------------------------------- /img/edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/img/edit.png -------------------------------------------------------------------------------- /img/exe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/img/exe.png -------------------------------------------------------------------------------- /img/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/img/file.png -------------------------------------------------------------------------------- /img/phone.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/img/phone.jpg -------------------------------------------------------------------------------- /img/run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/img/run.png -------------------------------------------------------------------------------- /img/config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/img/config.png -------------------------------------------------------------------------------- /bin/my_basic_code_editor_unity.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/bin/my_basic_code_editor_unity.exe -------------------------------------------------------------------------------- /prj/Assets/Examples/Icons/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/prj/Assets/Examples/Icons/icon.png -------------------------------------------------------------------------------- /prj/Assets/Plugins/x86/my_basic.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/prj/Assets/Plugins/x86/my_basic.dll -------------------------------------------------------------------------------- /prj/Assets/Plugins/x86_64/my_basic.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/prj/Assets/Plugins/x86_64/my_basic.dll -------------------------------------------------------------------------------- /bin/my_basic_code_editor_unity_Data/level0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/bin/my_basic_code_editor_unity_Data/level0 -------------------------------------------------------------------------------- /pkg/my_basic_code_editor_unity.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/pkg/my_basic_code_editor_unity.unitypackage -------------------------------------------------------------------------------- /prj/Assets/Plugins/MyCodeEditor/Consola.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/prj/Assets/Plugins/MyCodeEditor/Consola.ttf -------------------------------------------------------------------------------- /bin/my_basic_code_editor_unity_Data/level0.resS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/bin/my_basic_code_editor_unity_Data/level0.resS -------------------------------------------------------------------------------- /bin/my_basic_code_editor_unity_Data/Mono/mono.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/bin/my_basic_code_editor_unity_Data/Mono/mono.dll -------------------------------------------------------------------------------- /bin/my_basic_code_editor_unity_Data/Managed/System.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/bin/my_basic_code_editor_unity_Data/Managed/System.dll -------------------------------------------------------------------------------- /bin/my_basic_code_editor_unity_Data/globalgamemanagers: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/bin/my_basic_code_editor_unity_Data/globalgamemanagers -------------------------------------------------------------------------------- /bin/my_basic_code_editor_unity_Data/Managed/mscorlib.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/bin/my_basic_code_editor_unity_Data/Managed/mscorlib.dll -------------------------------------------------------------------------------- /bin/my_basic_code_editor_unity_Data/Plugins/my_basic.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/bin/my_basic_code_editor_unity_Data/Plugins/my_basic.dll -------------------------------------------------------------------------------- /bin/my_basic_code_editor_unity_Data/sharedassets0.assets: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/bin/my_basic_code_editor_unity_Data/sharedassets0.assets -------------------------------------------------------------------------------- /bin/my_basic_code_editor_unity_Data/Managed/System.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/bin/my_basic_code_editor_unity_Data/Managed/System.Core.dll -------------------------------------------------------------------------------- /bin/my_basic_code_editor_unity_Data/Managed/UnityEngine.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/bin/my_basic_code_editor_unity_Data/Managed/UnityEngine.dll -------------------------------------------------------------------------------- /bin/my_basic_code_editor_unity_Data/Mono/MonoPosixHelper.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/bin/my_basic_code_editor_unity_Data/Mono/MonoPosixHelper.dll -------------------------------------------------------------------------------- /prj/ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /bin/my_basic_code_editor_unity_Data/Managed/Assembly-CSharp.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/bin/my_basic_code_editor_unity_Data/Managed/Assembly-CSharp.dll -------------------------------------------------------------------------------- /bin/my_basic_code_editor_unity_Data/Managed/Mono.Security.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/bin/my_basic_code_editor_unity_Data/Managed/Mono.Security.dll -------------------------------------------------------------------------------- /bin/my_basic_code_editor_unity_Data/Managed/UnityEngine.UI.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/bin/my_basic_code_editor_unity_Data/Managed/UnityEngine.UI.dll -------------------------------------------------------------------------------- /bin/my_basic_code_editor_unity_Data/Managed/UnityEngine.dll.mdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/bin/my_basic_code_editor_unity_Data/Managed/UnityEngine.dll.mdb -------------------------------------------------------------------------------- /bin/my_basic_code_editor_unity_Data/Mono/etc/mono/browscap.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/bin/my_basic_code_editor_unity_Data/Mono/etc/mono/browscap.ini -------------------------------------------------------------------------------- /bin/my_basic_code_editor_unity_Data/globalgamemanagers.assets: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/bin/my_basic_code_editor_unity_Data/globalgamemanagers.assets -------------------------------------------------------------------------------- /bin/my_basic_code_editor_unity_Data/sharedassets0.assets.resS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/bin/my_basic_code_editor_unity_Data/sharedassets0.assets.resS -------------------------------------------------------------------------------- /prj/Assets/Plugins/mac/my_basic.bundle/Contents/MacOS/my_basic: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/prj/Assets/Plugins/mac/my_basic.bundle/Contents/MacOS/my_basic -------------------------------------------------------------------------------- /bin/my_basic_code_editor_unity_Data/Resources/unity_builtin_extra: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/bin/my_basic_code_editor_unity_Data/Resources/unity_builtin_extra -------------------------------------------------------------------------------- /bin/my_basic_code_editor_unity_Data/Managed/UnityEngine.Networking.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/bin/my_basic_code_editor_unity_Data/Managed/UnityEngine.Networking.dll -------------------------------------------------------------------------------- /bin/my_basic_code_editor_unity_Data/Resources/unity default resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/bin/my_basic_code_editor_unity_Data/Resources/unity default resources -------------------------------------------------------------------------------- /bin/my_basic_code_editor_unity_Data/Managed/Assembly-CSharp-firstpass.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/bin/my_basic_code_editor_unity_Data/Managed/Assembly-CSharp-firstpass.dll -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.csproj 2 | *.DS_Store 3 | *.opendb 4 | *.sln 5 | *.suo 6 | *.userprefs 7 | /prj/Debug 8 | /prj/Library 9 | /prj/Temp 10 | /prj/prj.VC.db 11 | /bin/my_basic_code_editor_unity_Data/output_log.txt 12 | -------------------------------------------------------------------------------- /bin/my_basic_code_editor_unity_Data/Managed/UnityEngine.PlaymodeTestsRunner.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/my-basic/code_editor_unity/HEAD/bin/my_basic_code_editor_unity_Data/Managed/UnityEngine.PlaymodeTestsRunner.dll -------------------------------------------------------------------------------- /prj/ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /prj/Assets/Examples/Scenes/Example.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 207f49172f719744a96c7f2ee11822af 3 | timeCreated: 1484121935 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /prj/Assets/Examples.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c905d91ec561eae47bcee7a43f6f4204 3 | folderAsset: yes 4 | timeCreated: 1484121921 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /prj/Assets/Plugins.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fedbfd413d51d2d4a81a6b9fc606ed6a 3 | folderAsset: yes 4 | timeCreated: 1484121899 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/MyCodeEditor/MsgBox.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7fcb8b1f7ef4ed747b8f6343967f01df 3 | timeCreated: 1484482824 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /prj/Assets/Examples/Icons.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6e435c98fa835764989ad0c42a5b9c62 3 | folderAsset: yes 4 | timeCreated: 1484714231 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/MyCodeEditor/MyCodeEditor.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f8defc2995147c84dabc48b3cdde6c7c 3 | timeCreated: 1484130925 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/mac.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aafece89b4ad7489189cde1e6b575605 3 | folderAsset: yes 4 | timeCreated: 1484535220 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/x86.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b434820e3c9f1df489029defae8ef2bb 3 | folderAsset: yes 4 | timeCreated: 1484130652 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/x86_64.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: be8b228d4f1021147bd661e4411f0fa9 3 | folderAsset: yes 4 | timeCreated: 1484130666 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /prj/Assets/Examples/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f66d64d4455c4804092e370e293d8678 3 | folderAsset: yes 4 | timeCreated: 1484121891 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /prj/Assets/Examples/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9b3ba13580d38a54088647d611045700 3 | folderAsset: yes 4 | timeCreated: 1484296627 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/mac/my_basic.bundle/Contents/Info.plist.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d958caee187704dab9554621ce87334d 3 | timeCreated: 1484535221 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/MyCodeEditor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b08b9905f5a0f5e459c369bb2808a8fb 3 | folderAsset: yes 4 | timeCreated: 1484130906 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/mac/my_basic.bundle/Contents/MacOS/my_basic.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 83c47a722b6214fdf9dd3a1be1dc2473 3 | timeCreated: 1484535221 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/mac/my_basic.bundle/Contents/_CodeSignature/CodeResources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c7260fd257c6c4619a703a3f2bb0bec1 3 | timeCreated: 1484535221 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /prj/ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: 8 | - enabled: 1 9 | path: Assets/Examples/Scenes/Example.unity 10 | -------------------------------------------------------------------------------- /prj/ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/mac/my_basic.bundle/Contents.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bf8f8bdcdaedb49c5a1110bdf488c106 3 | folderAsset: yes 4 | timeCreated: 1484535220 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/mac/my_basic.bundle/Contents/MacOS.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 858a6bbf962d64d76a00a662a42aabe7 3 | folderAsset: yes 4 | timeCreated: 1484535220 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/mac/my_basic.bundle/Contents/_CodeSignature.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 18a4dbec9a87b4ef68c2431f8e290bea 3 | folderAsset: yes 4 | timeCreated: 1484535220 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /prj/Assets/Examples/Scripts/Example.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 93dce7cd27a54514eaa084bac29805fe 3 | timeCreated: 1484296642 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/MyCodeEditor/MsgBox.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d619ea2188b84e14bb39dc0959609ef8 3 | timeCreated: 1484482763 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/MyCodeEditor/my_basic.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ab6cc5cce0267904faf328924e26d821 3 | timeCreated: 1484296538 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/MyCodeEditor/Interpreter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1cac538dc8191584f892c35627f19e5e 3 | timeCreated: 1484461563 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/MyCodeEditor/MyCodeEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 57f000d95b1188246b84a1e696cfa059 3 | timeCreated: 1484131332 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/MyCodeEditor/MyCodeHead.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a2a36efeb515bef4cac8e517915e5bb0 3 | timeCreated: 1484131528 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/MyCodeEditor/MyCodeInput.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 397dbdda73e0ac2408df783a9ccc3f5b 3 | timeCreated: 1484370994 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/MyCodeEditor/MyCodeLine.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c9247af80ba2ee94b9660008b1241799 3 | timeCreated: 1484131533 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/MyCodeEditor/MyCodeUtils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 638d26587a64fd1438a935daff0934e1 3 | timeCreated: 1484287102 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /prj/ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | m_Volume: 1 7 | Rolloff Scale: 1 8 | Doppler Factor: 1 9 | Default Speaker Mode: 2 10 | m_SampleRate: 0 11 | m_DSPBufferSize: 0 12 | m_VirtualVoiceCount: 512 13 | m_RealVoiceCount: 32 14 | m_SpatializerPlugin: 15 | m_DisableAudio: 0 16 | m_VirtualizeEffects: 1 17 | -------------------------------------------------------------------------------- /prj/ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_DefaultBehaviorMode: 0 10 | m_SpritePackerMode: 2 11 | m_SpritePackerPaddingPower: 1 12 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd 13 | m_ProjectGenerationRootNamespace: 14 | m_UserGeneratedProjectSuffix: 15 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/MyCodeEditor/Consola.ttf.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7a7fbd379bc895343b1c4a06355eb4f0 3 | timeCreated: 1484289384 4 | licenseType: Free 5 | TrueTypeFontImporter: 6 | serializedVersion: 4 7 | fontSize: 16 8 | forceTextureCase: -2 9 | characterSpacing: 0 10 | characterPadding: 1 11 | includeFontData: 1 12 | fontName: Consolas 13 | fontNames: 14 | - Consolas 15 | fallbackFontReferences: [] 16 | customCharacters: 17 | fontRenderingMode: 2 18 | ascentCalculationMode: 1 19 | userData: 20 | assetBundleName: 21 | assetBundleVariant: 22 | -------------------------------------------------------------------------------- /prj/ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/mac/my_basic.bundle.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0c738b4c321cb4c74bb9b2b12c72cb47 3 | folderAsset: yes 4 | timeCreated: 1484535220 5 | licenseType: Free 6 | PluginImporter: 7 | serializedVersion: 1 8 | iconMap: {} 9 | executionOrder: {} 10 | isPreloaded: 0 11 | isOverridable: 0 12 | platformData: 13 | Any: 14 | enabled: 0 15 | settings: {} 16 | Editor: 17 | enabled: 1 18 | settings: 19 | DefaultValueInitialized: true 20 | OSXIntel: 21 | enabled: 1 22 | settings: {} 23 | OSXIntel64: 24 | enabled: 1 25 | settings: {} 26 | OSXUniversal: 27 | enabled: 1 28 | settings: {} 29 | userData: 30 | assetBundleName: 31 | assetBundleVariant: 32 | -------------------------------------------------------------------------------- /prj/ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_EnablePCM: 1 18 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 19 | -------------------------------------------------------------------------------- /prj/ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | m_Enabled: 0 7 | m_TestMode: 0 8 | m_TestEventUrl: 9 | m_TestConfigUrl: 10 | CrashReportingSettings: 11 | m_EventUrl: https://perf-events.cloud.unity3d.com/api/events/crashes 12 | m_Enabled: 0 13 | m_CaptureEditorExceptions: 1 14 | UnityPurchasingSettings: 15 | m_Enabled: 0 16 | m_TestMode: 0 17 | UnityAnalyticsSettings: 18 | m_Enabled: 0 19 | m_InitializeOnStartup: 1 20 | m_TestMode: 0 21 | m_TestEventUrl: 22 | m_TestConfigUrl: 23 | UnityAdsSettings: 24 | m_Enabled: 0 25 | m_InitializeOnStartup: 1 26 | m_TestMode: 0 27 | m_EnabledPlatforms: 4294967295 28 | m_IosGameId: 29 | m_AndroidGameId: 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (C) 2017 Wang Renxin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /prj/ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | -------------------------------------------------------------------------------- /prj/ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_MinPenetrationForPenalty: 0.01 17 | m_BaumgarteScale: 0.2 18 | m_BaumgarteTimeOfImpactScale: 0.75 19 | m_TimeToSleep: 0.5 20 | m_LinearSleepTolerance: 0.01 21 | m_AngularSleepTolerance: 2 22 | m_QueriesHitTriggers: 1 23 | m_QueriesStartInColliders: 1 24 | m_ChangeStopsCallbacks: 0 25 | m_AlwaysShowColliders: 0 26 | m_ShowColliderSleep: 1 27 | m_ShowColliderContacts: 0 28 | m_ShowColliderAABB: 0 29 | m_ContactArrowScale: 0.2 30 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 31 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 32 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 33 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 34 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 35 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/mac/my_basic.bundle/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildMachineOSBuild 6 | 16D32 7 | CFBundleDevelopmentRegion 8 | en 9 | CFBundleExecutable 10 | my_basic 11 | CFBundleIdentifier 12 | com.tonywang.my-basic 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | my_basic 17 | CFBundlePackageType 18 | BNDL 19 | CFBundleShortVersionString 20 | 1.2 21 | CFBundleSupportedPlatforms 22 | 23 | MacOSX 24 | 25 | CFBundleVersion 26 | 1 27 | DTCompiler 28 | com.apple.compilers.llvm.clang.1_0 29 | DTPlatformBuild 30 | 8C1002 31 | DTPlatformVersion 32 | GM 33 | DTSDKBuild 34 | 16C58 35 | DTSDKName 36 | macosx10.12 37 | DTXcode 38 | 0821 39 | DTXcodeBuild 40 | 8C1002 41 | NSHumanReadableCopyright 42 | Copyright © 2011 - 2017 Wang Renxin. All rights reserved. 43 | 44 | 45 | -------------------------------------------------------------------------------- /bin/my_basic_code_editor_unity_Data/Mono/etc/mono/config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /bin/my_basic_code_editor_unity_Data/Mono/etc/mono/2.0/Browsers/Compat.browser: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/x86/my_basic.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: be53412e9879bb74e86d52647cee93cb 3 | timeCreated: 1484130695 4 | licenseType: Free 5 | PluginImporter: 6 | serializedVersion: 1 7 | iconMap: {} 8 | executionOrder: {} 9 | isPreloaded: 0 10 | isOverridable: 0 11 | platformData: 12 | Any: 13 | enabled: 0 14 | settings: 15 | Exclude Editor: 0 16 | Exclude Linux: 0 17 | Exclude Linux64: 0 18 | Exclude LinuxUniversal: 0 19 | Exclude OSXIntel: 0 20 | Exclude OSXIntel64: 0 21 | Exclude OSXUniversal: 0 22 | Exclude Win: 0 23 | Exclude Win64: 1 24 | Exclude WindowsStoreApps: 1 25 | Exclude iOS: 1 26 | Editor: 27 | enabled: 1 28 | settings: 29 | CPU: x86 30 | DefaultValueInitialized: true 31 | OS: Windows 32 | Linux: 33 | enabled: 1 34 | settings: 35 | CPU: x86 36 | Linux64: 37 | enabled: 1 38 | settings: 39 | CPU: None 40 | LinuxUniversal: 41 | enabled: 1 42 | settings: 43 | CPU: AnyCPU 44 | OSXIntel: 45 | enabled: 1 46 | settings: 47 | CPU: AnyCPU 48 | OSXIntel64: 49 | enabled: 1 50 | settings: 51 | CPU: None 52 | OSXUniversal: 53 | enabled: 1 54 | settings: 55 | CPU: AnyCPU 56 | Win: 57 | enabled: 1 58 | settings: 59 | CPU: AnyCPU 60 | Win64: 61 | enabled: 0 62 | settings: 63 | CPU: None 64 | WindowsStoreApps: 65 | enabled: 0 66 | settings: 67 | CPU: AnyCPU 68 | DontProcess: False 69 | PlaceholderPath: 70 | SDK: AnySDK 71 | ScriptingBackend: AnyScriptingBackend 72 | iOS: 73 | enabled: 0 74 | settings: 75 | CompileFlags: 76 | FrameworkDependencies: 77 | userData: 78 | assetBundleName: 79 | assetBundleVariant: 80 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/x86_64/my_basic.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fcf8fafbbfe8994439337b9982813af8 3 | timeCreated: 1484130706 4 | licenseType: Free 5 | PluginImporter: 6 | serializedVersion: 1 7 | iconMap: {} 8 | executionOrder: {} 9 | isPreloaded: 0 10 | isOverridable: 0 11 | platformData: 12 | Any: 13 | enabled: 0 14 | settings: 15 | Exclude Editor: 0 16 | Exclude Linux: 0 17 | Exclude Linux64: 0 18 | Exclude LinuxUniversal: 0 19 | Exclude OSXIntel: 0 20 | Exclude OSXIntel64: 0 21 | Exclude OSXUniversal: 0 22 | Exclude Win: 1 23 | Exclude Win64: 0 24 | Exclude WindowsStoreApps: 1 25 | Exclude iOS: 1 26 | Editor: 27 | enabled: 1 28 | settings: 29 | CPU: x86_64 30 | DefaultValueInitialized: true 31 | OS: Windows 32 | Linux: 33 | enabled: 1 34 | settings: 35 | CPU: None 36 | Linux64: 37 | enabled: 1 38 | settings: 39 | CPU: x86_64 40 | LinuxUniversal: 41 | enabled: 1 42 | settings: 43 | CPU: AnyCPU 44 | OSXIntel: 45 | enabled: 1 46 | settings: 47 | CPU: None 48 | OSXIntel64: 49 | enabled: 1 50 | settings: 51 | CPU: AnyCPU 52 | OSXUniversal: 53 | enabled: 1 54 | settings: 55 | CPU: AnyCPU 56 | Win: 57 | enabled: 0 58 | settings: 59 | CPU: None 60 | Win64: 61 | enabled: 1 62 | settings: 63 | CPU: AnyCPU 64 | WindowsStoreApps: 65 | enabled: 0 66 | settings: 67 | CPU: AnyCPU 68 | DontProcess: False 69 | PlaceholderPath: 70 | SDK: AnySDK 71 | ScriptingBackend: AnyScriptingBackend 72 | iOS: 73 | enabled: 0 74 | settings: 75 | CompileFlags: 76 | FrameworkDependencies: 77 | userData: 78 | assetBundleName: 79 | assetBundleVariant: 80 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MY-BASIC Code Editor (Unity) 2 | 3 | **Copyright (C) 2017 [Wang Renxin](https://github.com/paladin-t). All rights reserved.** 4 | 5 | ## Introduction 6 | 7 | This is a code editor for [MY-BASIC](https://github.com/paladin-t/my_basic) powered by the Unity3D engine. It's implemented with the standard uGUI system from Unity3D 5.x. 8 | 9 | ![](img/run.png) 10 | 11 | It supports code manipulating, interpreter interacting, and future customization. I used a MY-BASIC DLL for Windows, and Bundle for macOS as demonstration. You can build plugin for other platforms as you wish, or use other interpreters. See the link for more information about [MY-BASIC](https://github.com/paladin-t/my_basic). 12 | 13 | ![](img/phone.jpg) 14 | 15 | Note this repository doesn't contain any extended libraries of MY-BASIC or any other playable stuffs. It's just a small reusable code editor/shell. 16 | 17 | ## Configuration 18 | 19 | You may configure keywords, reserved words, symbols, opcodes, etc. as well as in which colors to represent them. 20 | 21 | The editor also allows to configure how many lines of code is expected to be represented, assuming taking full height of the screen. 22 | 23 | ![](img/config.png) 24 | 25 | It's also able to add new function words for coloring in code. 26 | 27 | ~~~~~~~~~~cs 28 | MyCodeEditor editor = ... 29 | ... 30 | editor.AddFunction("Your function name"); 31 | ~~~~~~~~~~ 32 | 33 | ## How to use the editor 34 | 35 | Execute the `bin/my_basic_code_editor_unity.exe` to run the editor. 36 | 37 | * Click a line to input or edit code 38 | 39 | ![](img/edit.png) 40 | 41 | * Select a file slot to save and load 42 | 43 | ![](img/file.png) 44 | 45 | * Select some lines, then make insertion and deletion by clicking the buttons 46 | 47 | ![](img/curd.png) 48 | 49 | * Click the `RUN` button to run the code top down 50 | * Click the `STEP` button to run the code step by step 51 | * Click the `PAUSE` button to pause a top down execution 52 | * Click the `STOP` button to terminate an execution 53 | 54 | ![](img/exe.png) 55 | 56 | ## How to use the library 57 | 58 | Import the `pkg/my_basic_code_editor_unity.unitypackage` to your Unity3D project to use this library. 59 | 60 | Have fun :) 61 | -------------------------------------------------------------------------------- /prj/Assets/Examples/Icons/icon.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8aca11f79b1bf3e4ba992e7a754e1f8c 3 | timeCreated: 1484714369 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 0 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 1 23 | grayScaleToAlpha: 0 24 | generateCubemap: 6 25 | cubemapConvolution: 0 26 | seamlessCubemap: 0 27 | textureFormat: 1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: 0 31 | aniso: 1 32 | mipBias: -1 33 | wrapMode: 1 34 | nPOTScale: 0 35 | lightmap: 0 36 | compressionQuality: 50 37 | spriteMode: 1 38 | spriteExtrude: 1 39 | spriteMeshType: 1 40 | alignment: 0 41 | spritePivot: {x: 0.5, y: 0.5} 42 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 43 | spritePixelsToUnits: 100 44 | alphaUsage: 1 45 | alphaIsTransparency: 1 46 | spriteTessellationDetail: -1 47 | textureType: 8 48 | textureShape: 1 49 | maxTextureSizeSet: 0 50 | compressionQualitySet: 0 51 | textureFormatSet: 0 52 | platformSettings: 53 | - buildTarget: DefaultTexturePlatform 54 | maxTextureSize: 2048 55 | textureFormat: -1 56 | textureCompression: 1 57 | compressionQuality: 50 58 | crunchedCompression: 0 59 | allowsAlphaSplitting: 0 60 | overridden: 0 61 | - buildTarget: Standalone 62 | maxTextureSize: 2048 63 | textureFormat: -1 64 | textureCompression: 1 65 | compressionQuality: 50 66 | crunchedCompression: 0 67 | allowsAlphaSplitting: 0 68 | overridden: 0 69 | - buildTarget: iPhone 70 | maxTextureSize: 2048 71 | textureFormat: -1 72 | textureCompression: 1 73 | compressionQuality: 50 74 | crunchedCompression: 0 75 | allowsAlphaSplitting: 0 76 | overridden: 0 77 | - buildTarget: Windows Store Apps 78 | maxTextureSize: 2048 79 | textureFormat: -1 80 | textureCompression: 1 81 | compressionQuality: 50 82 | crunchedCompression: 0 83 | allowsAlphaSplitting: 0 84 | overridden: 0 85 | spriteSheet: 86 | serializedVersion: 2 87 | sprites: [] 88 | outline: [] 89 | spritePackingTag: 90 | userData: 91 | assetBundleName: 92 | assetBundleVariant: 93 | -------------------------------------------------------------------------------- /prj/ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 9 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | - {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0} 39 | m_PreloadedShaders: [] 40 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 41 | type: 0} 42 | m_TierSettings_Tier1: 43 | renderingPath: 1 44 | useCascadedShadowMaps: 1 45 | m_TierSettings_Tier2: 46 | renderingPath: 1 47 | useCascadedShadowMaps: 1 48 | m_TierSettings_Tier3: 49 | renderingPath: 1 50 | useCascadedShadowMaps: 1 51 | m_DefaultRenderingPath: 1 52 | m_DefaultMobileRenderingPath: 1 53 | m_TierSettings: [] 54 | m_LightmapStripping: 0 55 | m_FogStripping: 0 56 | m_LightmapKeepPlain: 1 57 | m_LightmapKeepDirCombined: 1 58 | m_LightmapKeepDirSeparate: 1 59 | m_LightmapKeepDynamicPlain: 1 60 | m_LightmapKeepDynamicDirCombined: 1 61 | m_LightmapKeepDynamicDirSeparate: 1 62 | m_FogKeepLinear: 1 63 | m_FogKeepExp: 1 64 | m_FogKeepExp2: 1 65 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/MyCodeEditor/MyCodeInput.cs: -------------------------------------------------------------------------------- 1 | /* 2 | ** This source file is part of MY-BASIC Code Editor (Unity) 3 | ** 4 | ** For the latest info, see https://github.com/my-basic/my_basic_code_editor_unity/ 5 | ** 6 | ** Copyright (C) 2017 Wang Renxin 7 | ** 8 | ** Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | ** this software and associated documentation files (the "Software"), to deal in 10 | ** the Software without restriction, including without limitation the rights to 11 | ** use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | ** the Software, and to permit persons to whom the Software is furnished to do so, 13 | ** subject to the following conditions: 14 | ** 15 | ** The above copyright notice and this permission notice shall be included in all 16 | ** copies or substantial portions of the Software. 17 | ** 18 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | ** FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | using UnityEngine; 27 | using UnityEngine.UI; 28 | 29 | public class MyCodeInput : MonoBehaviour 30 | { 31 | public MyCodeLine Editing { get; private set; } 32 | 33 | public InputField FieldInput 34 | { 35 | get 36 | { 37 | InputField i = GetComponent(); 38 | 39 | return i; 40 | } 41 | } 42 | 43 | public bool Shown 44 | { 45 | get 46 | { 47 | return gameObject.activeSelf; 48 | } 49 | } 50 | 51 | public void Show(MyCodeLine ln) 52 | { 53 | if (Editing != null) 54 | Editing.gameObject.SetActive(true); 55 | 56 | gameObject.SetActive(true); 57 | 58 | FieldInput.Rect().SetSize(ln.Rect().GetSize()); 59 | FieldInput.Rect().transform.localPosition = (ln.Rect().transform.localPosition); 60 | FieldInput.text = ln.Text; 61 | FieldInput.ActivateInputField(); 62 | 63 | ln.gameObject.SetActive(false); 64 | 65 | Editing = ln; 66 | } 67 | 68 | public void Hide() 69 | { 70 | if (Editing != null) 71 | Editing.gameObject.SetActive(true); 72 | 73 | gameObject.SetActive(false); 74 | 75 | Editing = null; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /bin/my_basic_code_editor_unity_Data/Mono/etc/mono/2.0/settings.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 10 | 11 | 20 | 23 | 24 | 25 | 26 | 29 | 30 | 33 | 34 | 43 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/mac/my_basic.bundle/Contents/_CodeSignature/CodeResources: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | files 6 | 7 | files2 8 | 9 | rules 10 | 11 | ^Resources/ 12 | 13 | ^Resources/.*\.lproj/ 14 | 15 | optional 16 | 17 | weight 18 | 1000 19 | 20 | ^Resources/.*\.lproj/locversion.plist$ 21 | 22 | omit 23 | 24 | weight 25 | 1100 26 | 27 | ^Resources/Base\.lproj/ 28 | 29 | weight 30 | 1010 31 | 32 | ^version.plist$ 33 | 34 | 35 | rules2 36 | 37 | .*\.dSYM($|/) 38 | 39 | weight 40 | 11 41 | 42 | ^(.*/)?\.DS_Store$ 43 | 44 | omit 45 | 46 | weight 47 | 2000 48 | 49 | ^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/ 50 | 51 | nested 52 | 53 | weight 54 | 10 55 | 56 | ^.* 57 | 58 | ^Info\.plist$ 59 | 60 | omit 61 | 62 | weight 63 | 20 64 | 65 | ^PkgInfo$ 66 | 67 | omit 68 | 69 | weight 70 | 20 71 | 72 | ^Resources/ 73 | 74 | weight 75 | 20 76 | 77 | ^Resources/.*\.lproj/ 78 | 79 | optional 80 | 81 | weight 82 | 1000 83 | 84 | ^Resources/.*\.lproj/locversion.plist$ 85 | 86 | omit 87 | 88 | weight 89 | 1100 90 | 91 | ^Resources/Base\.lproj/ 92 | 93 | weight 94 | 1010 95 | 96 | ^[^/]+$ 97 | 98 | nested 99 | 100 | weight 101 | 10 102 | 103 | ^embedded\.provisionprofile$ 104 | 105 | weight 106 | 20 107 | 108 | ^version\.plist$ 109 | 110 | weight 111 | 20 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/MyCodeEditor/MsgBox.cs: -------------------------------------------------------------------------------- 1 | /* 2 | ** This source file is part of MY-BASIC Code Editor (Unity) 3 | ** 4 | ** For the latest info, see https://github.com/my-basic/my_basic_code_editor_unity/ 5 | ** 6 | ** Copyright (C) 2017 Wang Renxin 7 | ** 8 | ** Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | ** this software and associated documentation files (the "Software"), to deal in 10 | ** the Software without restriction, including without limitation the rights to 11 | ** use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | ** the Software, and to permit persons to whom the Software is furnished to do so, 13 | ** subject to the following conditions: 14 | ** 15 | ** The above copyright notice and this permission notice shall be included in all 16 | ** copies or substantial portions of the Software. 17 | ** 18 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | ** FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | using System.Collections.Generic; 27 | using UnityEngine; 28 | using UnityEngine.UI; 29 | 30 | public class MsgBox : MonoBehaviour 31 | { 32 | private struct MsgInfo 33 | { 34 | public string title; 35 | 36 | public object msg; 37 | 38 | public ClickedEventHandler callback; 39 | 40 | public MsgInfo(string t, object m, ClickedEventHandler c) 41 | { 42 | title = t; 43 | msg = m; 44 | callback = c; 45 | } 46 | } 47 | 48 | public Text textTitle = null; 49 | 50 | public Text textMsg = null; 51 | 52 | private Stack stack = new Stack(); 53 | 54 | public bool Shown { get { return stack.Count != 0; } } 55 | 56 | public delegate void ClickedEventHandler(MsgBox mb); 57 | 58 | public void Show(string title, object msg, ClickedEventHandler callback = null) 59 | { 60 | gameObject.SetActive(true); 61 | 62 | stack.Push(new MsgInfo(title, msg, callback)); 63 | 64 | textTitle.text = title; 65 | textMsg.text = msg.ToString(); 66 | } 67 | 68 | public void Show(object msg, ClickedEventHandler callback = null) 69 | { 70 | gameObject.SetActive(true); 71 | 72 | stack.Push(new MsgInfo(null, msg, callback)); 73 | 74 | textTitle.text = string.Empty; 75 | textMsg.text = msg.ToString(); 76 | } 77 | 78 | public void Close() 79 | { 80 | stack.Clear(); 81 | 82 | gameObject.SetActive(false); 83 | } 84 | 85 | public void OnOkClicked() 86 | { 87 | if (stack.Peek().callback != null) 88 | stack.Peek().callback(this); 89 | 90 | stack.Pop(); 91 | if (stack.Count == 0) 92 | { 93 | gameObject.SetActive(false); 94 | } 95 | else 96 | { 97 | textTitle.text = stack.Peek().title; 98 | textMsg.text = stack.Peek().msg.ToString(); 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/MyCodeEditor/MyCodeLine.cs: -------------------------------------------------------------------------------- 1 | /* 2 | ** This source file is part of MY-BASIC Code Editor (Unity) 3 | ** 4 | ** For the latest info, see https://github.com/my-basic/my_basic_code_editor_unity/ 5 | ** 6 | ** Copyright (C) 2017 Wang Renxin 7 | ** 8 | ** Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | ** this software and associated documentation files (the "Software"), to deal in 10 | ** the Software without restriction, including without limitation the rights to 11 | ** use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | ** the Software, and to permit persons to whom the Software is furnished to do so, 13 | ** subject to the following conditions: 14 | ** 15 | ** The above copyright notice and this permission notice shall be included in all 16 | ** copies or substantial portions of the Software. 17 | ** 18 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | ** FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | using System; 27 | using UnityEngine; 28 | using UnityEngine.UI; 29 | 30 | public class MyCodeLine : MonoBehaviour 31 | { 32 | private const float TEXT_OCCUPATION = 0.8f; 33 | 34 | public const float X_OFFSET = 2.0f; 35 | public const float Y_OFFSET = 2.0f; 36 | 37 | public Button buttonCode = null; 38 | public Text textCode = null; 39 | 40 | private int lineNumber = 0; 41 | public int LineNumber 42 | { 43 | get 44 | { 45 | return lineNumber; 46 | } 47 | set 48 | { 49 | lineNumber = value; 50 | 51 | this.Rect().SetLeftTopPosition(new Vector2(X_OFFSET, -Y_OFFSET - Height * lineNumber)); 52 | } 53 | } 54 | 55 | public string Text { get; private set; } 56 | 57 | private float height = 0.0f; 58 | public float Height 59 | { 60 | get 61 | { 62 | return height; 63 | } 64 | set 65 | { 66 | height = value; 67 | 68 | int fontSize = (int)(height * TEXT_OCCUPATION); 69 | textCode.fontSize = fontSize; 70 | 71 | this.Rect().SetHeight(height); 72 | buttonCode.Rect().SetHeight(height); 73 | } 74 | } 75 | 76 | public float Width 77 | { 78 | get 79 | { 80 | return this.Rect().GetSize().x; 81 | } 82 | set 83 | { 84 | this.Rect().SetSize(new Vector2(value, this.Rect().GetSize().y)); 85 | } 86 | } 87 | 88 | public float TightWidth 89 | { 90 | get 91 | { 92 | float result = TextWidth; 93 | result += Mathf.Abs(textCode.Rect().offsetMin.x); 94 | result += Mathf.Abs(textCode.Rect().offsetMax.x); 95 | 96 | return result; 97 | } 98 | } 99 | 100 | public int TextWidth 101 | { 102 | get 103 | { 104 | int result = 0; 105 | Font font = textCode.font; 106 | CharacterInfo characterInfo = new CharacterInfo(); 107 | foreach (char c in Text) 108 | { 109 | font.GetCharacterInfo(c, out characterInfo, textCode.fontSize); 110 | result += characterInfo.advance; 111 | } 112 | 113 | return result; 114 | } 115 | } 116 | 117 | public Action LineClicked = null; 118 | 119 | private void Start() 120 | { 121 | buttonCode.gameObject.SetActive(true); 122 | } 123 | 124 | private void Awake() 125 | { 126 | buttonCode.onClick.AddListener(OnButtonCodeClicked); 127 | } 128 | 129 | private void OnDestroy() 130 | { 131 | buttonCode.onClick.RemoveListener(OnButtonCodeClicked); 132 | } 133 | 134 | public MyCodeLine SetText(string text, string rich) 135 | { 136 | Text = text; 137 | 138 | textCode.text = rich; 139 | 140 | return this; 141 | } 142 | 143 | public void Relayout() 144 | { 145 | this.Rect().SetLeftTopPosition(new Vector2(X_OFFSET, -Y_OFFSET - Height * LineNumber)); 146 | } 147 | 148 | private void OnButtonCodeClicked() 149 | { 150 | if (LineClicked != null) 151 | LineClicked(this); 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /prj/ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 5 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Fastest 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | blendWeights: 1 21 | textureQuality: 1 22 | anisotropicTextures: 0 23 | antiAliasing: 0 24 | softParticles: 0 25 | softVegetation: 0 26 | realtimeReflectionProbes: 0 27 | billboardsFaceCameraPosition: 0 28 | vSyncCount: 0 29 | lodBias: 0.3 30 | maximumLODLevel: 0 31 | particleRaycastBudget: 4 32 | asyncUploadTimeSlice: 2 33 | asyncUploadBufferSize: 4 34 | excludedTargetPlatforms: [] 35 | - serializedVersion: 2 36 | name: Fast 37 | pixelLightCount: 0 38 | shadows: 0 39 | shadowResolution: 0 40 | shadowProjection: 1 41 | shadowCascades: 1 42 | shadowDistance: 20 43 | shadowNearPlaneOffset: 3 44 | shadowCascade2Split: 0.33333334 45 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 46 | blendWeights: 2 47 | textureQuality: 0 48 | anisotropicTextures: 0 49 | antiAliasing: 0 50 | softParticles: 0 51 | softVegetation: 0 52 | realtimeReflectionProbes: 0 53 | billboardsFaceCameraPosition: 0 54 | vSyncCount: 0 55 | lodBias: 0.4 56 | maximumLODLevel: 0 57 | particleRaycastBudget: 16 58 | asyncUploadTimeSlice: 2 59 | asyncUploadBufferSize: 4 60 | excludedTargetPlatforms: [] 61 | - serializedVersion: 2 62 | name: Simple 63 | pixelLightCount: 1 64 | shadows: 1 65 | shadowResolution: 0 66 | shadowProjection: 1 67 | shadowCascades: 1 68 | shadowDistance: 20 69 | shadowNearPlaneOffset: 3 70 | shadowCascade2Split: 0.33333334 71 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 72 | blendWeights: 2 73 | textureQuality: 0 74 | anisotropicTextures: 1 75 | antiAliasing: 0 76 | softParticles: 0 77 | softVegetation: 0 78 | realtimeReflectionProbes: 0 79 | billboardsFaceCameraPosition: 0 80 | vSyncCount: 1 81 | lodBias: 0.7 82 | maximumLODLevel: 0 83 | particleRaycastBudget: 64 84 | asyncUploadTimeSlice: 2 85 | asyncUploadBufferSize: 4 86 | excludedTargetPlatforms: [] 87 | - serializedVersion: 2 88 | name: Good 89 | pixelLightCount: 2 90 | shadows: 2 91 | shadowResolution: 1 92 | shadowProjection: 1 93 | shadowCascades: 2 94 | shadowDistance: 40 95 | shadowNearPlaneOffset: 3 96 | shadowCascade2Split: 0.33333334 97 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 98 | blendWeights: 2 99 | textureQuality: 0 100 | anisotropicTextures: 1 101 | antiAliasing: 0 102 | softParticles: 0 103 | softVegetation: 1 104 | realtimeReflectionProbes: 1 105 | billboardsFaceCameraPosition: 1 106 | vSyncCount: 1 107 | lodBias: 1 108 | maximumLODLevel: 0 109 | particleRaycastBudget: 256 110 | asyncUploadTimeSlice: 2 111 | asyncUploadBufferSize: 4 112 | excludedTargetPlatforms: [] 113 | - serializedVersion: 2 114 | name: Beautiful 115 | pixelLightCount: 3 116 | shadows: 2 117 | shadowResolution: 2 118 | shadowProjection: 1 119 | shadowCascades: 2 120 | shadowDistance: 70 121 | shadowNearPlaneOffset: 3 122 | shadowCascade2Split: 0.33333334 123 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 124 | blendWeights: 4 125 | textureQuality: 0 126 | anisotropicTextures: 2 127 | antiAliasing: 2 128 | softParticles: 1 129 | softVegetation: 1 130 | realtimeReflectionProbes: 1 131 | billboardsFaceCameraPosition: 1 132 | vSyncCount: 1 133 | lodBias: 1.5 134 | maximumLODLevel: 0 135 | particleRaycastBudget: 1024 136 | asyncUploadTimeSlice: 2 137 | asyncUploadBufferSize: 4 138 | excludedTargetPlatforms: [] 139 | - serializedVersion: 2 140 | name: Fantastic 141 | pixelLightCount: 4 142 | shadows: 2 143 | shadowResolution: 2 144 | shadowProjection: 1 145 | shadowCascades: 4 146 | shadowDistance: 150 147 | shadowNearPlaneOffset: 3 148 | shadowCascade2Split: 0.33333334 149 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 150 | blendWeights: 4 151 | textureQuality: 0 152 | anisotropicTextures: 2 153 | antiAliasing: 2 154 | softParticles: 1 155 | softVegetation: 1 156 | realtimeReflectionProbes: 1 157 | billboardsFaceCameraPosition: 1 158 | vSyncCount: 1 159 | lodBias: 2 160 | maximumLODLevel: 0 161 | particleRaycastBudget: 4096 162 | asyncUploadTimeSlice: 2 163 | asyncUploadBufferSize: 4 164 | excludedTargetPlatforms: [] 165 | m_PerPlatformDefaultQuality: 166 | Android: 2 167 | Nintendo 3DS: 5 168 | PS4: 5 169 | PSM: 5 170 | PSP2: 2 171 | Samsung TV: 2 172 | Standalone: 5 173 | Tizen: 2 174 | Web: 5 175 | WebGL: 3 176 | WiiU: 5 177 | Windows Store Apps: 5 178 | XboxOne: 5 179 | iPhone: 2 180 | tvOS: 5 181 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/MyCodeEditor/MyCodeHead.cs: -------------------------------------------------------------------------------- 1 | /* 2 | ** This source file is part of MY-BASIC Code Editor (Unity) 3 | ** 4 | ** For the latest info, see https://github.com/my-basic/my_basic_code_editor_unity/ 5 | ** 6 | ** Copyright (C) 2017 Wang Renxin 7 | ** 8 | ** Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | ** this software and associated documentation files (the "Software"), to deal in 10 | ** the Software without restriction, including without limitation the rights to 11 | ** use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | ** the Software, and to permit persons to whom the Software is furnished to do so, 13 | ** subject to the following conditions: 14 | ** 15 | ** The above copyright notice and this permission notice shall be included in all 16 | ** copies or substantial portions of the Software. 17 | ** 18 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | ** FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | using System; 27 | using UnityEngine; 28 | using UnityEngine.UI; 29 | 30 | public class MyCodeHead : MonoBehaviour 31 | { 32 | private const float TEXT_OCCUPATION = 0.8f; 33 | 34 | public const float X_OFFSET = 2.0f; 35 | public const float Y_OFFSET = 2.0f; 36 | 37 | public Toggle toggleSelection = null; 38 | 39 | public Button buttonLineNumber = null; 40 | public Text textLineNumber = null; 41 | 42 | private int lineNumber = 0; 43 | public int LineNumber 44 | { 45 | get 46 | { 47 | return lineNumber; 48 | } 49 | set 50 | { 51 | lineNumber = value; 52 | 53 | this.Rect().SetLeftTopPosition(new Vector2(X_OFFSET, -Y_OFFSET - Height * lineNumber)); 54 | 55 | textLineNumber.text = (lineNumber + 1).ToString(); 56 | } 57 | } 58 | 59 | private float height = 0.0f; 60 | public float Height 61 | { 62 | get 63 | { 64 | return height; 65 | } 66 | set 67 | { 68 | height = value; 69 | 70 | int fontSize = (int)(height * TEXT_OCCUPATION); 71 | textLineNumber.fontSize = fontSize; 72 | 73 | this.Rect().SetHeight(height); 74 | buttonLineNumber.Rect().SetHeight(height); 75 | toggleSelection.Rect().SetSize(new Vector2(height, height)); 76 | } 77 | } 78 | 79 | public float Width 80 | { 81 | get 82 | { 83 | return this.Rect().GetSize().x; 84 | } 85 | set 86 | { 87 | this.Rect().SetSize(new Vector2(value, this.Rect().GetSize().y)); 88 | } 89 | } 90 | 91 | public float TightWidth 92 | { 93 | get 94 | { 95 | float result = LineNumberTextWidth; 96 | result += Mathf.Abs(textLineNumber.Rect().offsetMin.x); 97 | result += Mathf.Abs(textLineNumber.Rect().offsetMax.x); 98 | result += toggleSelection.Rect().GetSize().x; 99 | 100 | return result; 101 | } 102 | } 103 | 104 | public int LineNumberTextWidth 105 | { 106 | get 107 | { 108 | int result = 0; 109 | Font font = textLineNumber.font; 110 | CharacterInfo characterInfo = new CharacterInfo(); 111 | foreach (char c in textLineNumber.text) 112 | { 113 | font.GetCharacterInfo(c, out characterInfo, textLineNumber.fontSize); 114 | result += characterInfo.advance; 115 | } 116 | 117 | return result; 118 | } 119 | } 120 | 121 | private bool selfProtecting = false; 122 | 123 | public bool SelectionEnabled { get; set; } 124 | 125 | public Action HeadClicked = null; 126 | 127 | private void Start() 128 | { 129 | SelectionEnabled = true; 130 | } 131 | 132 | private void Awake() 133 | { 134 | buttonLineNumber.onClick.AddListener(OnButtonHeadClicked); 135 | 136 | toggleSelection.onValueChanged.AddListener(OnSelectionValueChanged); 137 | } 138 | 139 | private void OnDestroy() 140 | { 141 | buttonLineNumber.onClick.RemoveListener(OnButtonHeadClicked); 142 | 143 | toggleSelection.onValueChanged.RemoveListener(OnSelectionValueChanged); 144 | } 145 | 146 | public void Relayout() 147 | { 148 | this.Rect().SetLeftTopPosition(new Vector2(X_OFFSET, -Y_OFFSET - Height * lineNumber)); 149 | 150 | toggleSelection.Rect().SetLeftPosition(-this.Rect().GetSize().x / 2.0f); 151 | buttonLineNumber.Rect().SetSize(new Vector2(this.Rect().GetSize().x - toggleSelection.Rect().GetSize().x, buttonLineNumber.Rect().GetSize().y)); 152 | buttonLineNumber.Rect().SetLeftPosition(-this.Rect().GetSize().x / 2.0f + toggleSelection.Rect().GetSize().x); 153 | } 154 | 155 | private void OnSelectionValueChanged(bool v) 156 | { 157 | if (SelectionEnabled) return; 158 | if (selfProtecting) return; 159 | selfProtecting = true; 160 | toggleSelection.isOn = false; 161 | selfProtecting = false; 162 | } 163 | 164 | private void OnButtonHeadClicked() 165 | { 166 | if (HeadClicked != null) 167 | HeadClicked(this); 168 | } 169 | } 170 | -------------------------------------------------------------------------------- /prj/ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/MyCodeEditor/MyCodeUtils.cs: -------------------------------------------------------------------------------- 1 | /* 2 | ** This source file is part of MY-BASIC Code Editor (Unity) 3 | ** 4 | ** For the latest info, see https://github.com/my-basic/my_basic_code_editor_unity/ 5 | ** 6 | ** Copyright (C) 2017 Wang Renxin 7 | ** 8 | ** Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | ** this software and associated documentation files (the "Software"), to deal in 10 | ** the Software without restriction, including without limitation the rights to 11 | ** use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | ** the Software, and to permit persons to whom the Software is furnished to do so, 13 | ** subject to the following conditions: 14 | ** 15 | ** The above copyright notice and this permission notice shall be included in all 16 | ** copies or substantial portions of the Software. 17 | ** 18 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | ** FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using UnityEngine; 30 | using UnityEngine.UI; 31 | 32 | [Serializable] 33 | public class Coloring 34 | { 35 | [Multiline] 36 | public string texts = null; 37 | 38 | public Color color = Color.black; 39 | 40 | private string[] elements = null; 41 | public string[] Elements 42 | { 43 | get 44 | { 45 | if (elements == null) 46 | { 47 | elements = 48 | ( 49 | from t in texts.Split(';') 50 | where !string.IsNullOrEmpty(t.Trim()) 51 | select t.Trim() 52 | ).ToArray(); 53 | } 54 | 55 | return elements; 56 | } 57 | } 58 | 59 | private string colorHexString = null; 60 | public string ColorHexString 61 | { 62 | get 63 | { 64 | if (colorHexString == null) 65 | { 66 | uint hex = 0; 67 | hex |= (uint)(color.r * 255) << 24; 68 | hex |= (uint)(color.g * 255) << 16; 69 | hex |= (uint)(color.b * 255) << 8; 70 | hex |= 0xff; 71 | 72 | colorHexString = "#" + hex.ToString("X8"); 73 | } 74 | 75 | return colorHexString; 76 | } 77 | } 78 | } 79 | 80 | public class Part 81 | { 82 | public int Start { get; private set; } 83 | 84 | public int End { get; private set; } 85 | 86 | public int Count { get { return End - Start + 1; } } 87 | 88 | public string Text { get; private set; } 89 | 90 | public Part(int start, int end, string text) 91 | { 92 | Start = start; 93 | End = end; 94 | Text = text; 95 | } 96 | 97 | public bool Overlap(int start, int end) 98 | { 99 | if (start >= Start && start <= End) 100 | return true; 101 | if (end >= Start && end <= End) 102 | return true; 103 | if (start <= Start && end >= End) 104 | return true; 105 | 106 | return false; 107 | } 108 | } 109 | 110 | public class Parts : List 111 | { 112 | public bool Overlap(int start, int end) 113 | { 114 | foreach(Part part in this) 115 | { 116 | if (part.Overlap(start, end)) 117 | return true; 118 | } 119 | 120 | return false; 121 | } 122 | } 123 | 124 | internal static class StringExtensions 125 | { 126 | public static int IndexOf(this string str, string sub, int start, bool caseSensitive) 127 | { 128 | if (caseSensitive) 129 | return str.IndexOf(sub, start); 130 | 131 | return str.ToLower().IndexOf(sub.ToLower(), start); 132 | } 133 | } 134 | 135 | internal static class RectTransformExtensions 136 | { 137 | public static void SetDefaultScale(this RectTransform trans) 138 | { 139 | trans.localScale = new Vector3(1, 1, 1); 140 | } 141 | 142 | public static void SetPivotAndAnchors(this RectTransform trans, Vector2 aVec) 143 | { 144 | trans.pivot = aVec; 145 | trans.anchorMin = aVec; 146 | trans.anchorMax = aVec; 147 | } 148 | 149 | public static Vector2 GetSize(this RectTransform trans) 150 | { 151 | return trans.rect.size; 152 | } 153 | 154 | public static float GetWidth(this RectTransform trans) 155 | { 156 | return trans.rect.width; 157 | } 158 | 159 | public static float GetHeight(this RectTransform trans) 160 | { 161 | return trans.rect.height; 162 | } 163 | 164 | public static void SetPositionOfPivot(this RectTransform trans, Vector2 newPos) 165 | { 166 | trans.localPosition = new Vector3(newPos.x, newPos.y, trans.localPosition.z); 167 | } 168 | 169 | public static void SetLeftPosition(this RectTransform trans, float newPos) 170 | { 171 | trans.localPosition = new Vector3(newPos + (trans.pivot.x * trans.rect.width), trans.localPosition.y, trans.localPosition.z); 172 | } 173 | 174 | public static void SetRightPosition(this RectTransform trans, float newPos) 175 | { 176 | trans.localPosition = new Vector3(newPos - ((1f - trans.pivot.x) * trans.rect.width), trans.localPosition.y, trans.localPosition.z); 177 | } 178 | 179 | public static void SetLeftBottomPosition(this RectTransform trans, Vector2 newPos) 180 | { 181 | trans.localPosition = new Vector3(newPos.x + (trans.pivot.x * trans.rect.width), newPos.y + (trans.pivot.y * trans.rect.height), trans.localPosition.z); 182 | } 183 | 184 | public static void SetLeftTopPosition(this RectTransform trans, Vector2 newPos) 185 | { 186 | trans.localPosition = new Vector3(newPos.x + (trans.pivot.x * trans.rect.width), newPos.y - ((1f - trans.pivot.y) * trans.rect.height), trans.localPosition.z); 187 | } 188 | 189 | public static void SetRightBottomPosition(this RectTransform trans, Vector2 newPos) 190 | { 191 | trans.localPosition = new Vector3(newPos.x - ((1f - trans.pivot.x) * trans.rect.width), newPos.y + (trans.pivot.y * trans.rect.height), trans.localPosition.z); 192 | } 193 | 194 | public static void SetRightTopPosition(this RectTransform trans, Vector2 newPos) 195 | { 196 | trans.localPosition = new Vector3(newPos.x - ((1f - trans.pivot.x) * trans.rect.width), newPos.y - ((1f - trans.pivot.y) * trans.rect.height), trans.localPosition.z); 197 | } 198 | 199 | public static void SetSize(this RectTransform trans, Vector2 newSize) 200 | { 201 | Vector2 oldSize = trans.rect.size; 202 | Vector2 deltaSize = newSize - oldSize; 203 | trans.offsetMin = trans.offsetMin - new Vector2(deltaSize.x * trans.pivot.x, deltaSize.y * trans.pivot.y); 204 | trans.offsetMax = trans.offsetMax + new Vector2(deltaSize.x * (1f - trans.pivot.x), deltaSize.y * (1f - trans.pivot.y)); 205 | } 206 | 207 | public static void SetWidth(this RectTransform trans, float newSize) 208 | { 209 | SetSize(trans, new Vector2(newSize, trans.rect.size.y)); 210 | } 211 | 212 | public static void SetHeight(this RectTransform trans, float newSize) 213 | { 214 | SetSize(trans, new Vector2(trans.rect.size.x, newSize)); 215 | } 216 | 217 | public static RectTransform Rect(this MyCodeEditor ui) 218 | { 219 | return ui.GetComponent(); 220 | } 221 | 222 | public static RectTransform Rect(this MyCodeHead ui) 223 | { 224 | return ui.GetComponent(); 225 | } 226 | 227 | public static RectTransform Rect(this MyCodeLine ui) 228 | { 229 | return ui.GetComponent(); 230 | } 231 | 232 | public static RectTransform Rect(this ScrollRect ui) 233 | { 234 | return ui.GetComponent(); 235 | } 236 | 237 | public static RectTransform Rect(this Scrollbar ui) 238 | { 239 | return ui.GetComponent(); 240 | } 241 | 242 | public static RectTransform Rect(this Button ui) 243 | { 244 | return ui.GetComponent(); 245 | } 246 | 247 | public static RectTransform Rect(this Toggle ui) 248 | { 249 | return ui.GetComponent(); 250 | } 251 | 252 | public static RectTransform Rect(this InputField ui) 253 | { 254 | return ui.GetComponent(); 255 | } 256 | 257 | public static RectTransform Rect(this Text ui) 258 | { 259 | return ui.GetComponent(); 260 | } 261 | } 262 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/MyCodeEditor/Interpreter.cs: -------------------------------------------------------------------------------- 1 | /* 2 | ** This source file is part of MY-BASIC Code Editor (Unity) 3 | ** 4 | ** For the latest info, see https://github.com/my-basic/my_basic_code_editor_unity/ 5 | ** 6 | ** Copyright (C) 2017 Wang Renxin 7 | ** 8 | ** Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | ** this software and associated documentation files (the "Software"), to deal in 10 | ** the Software without restriction, including without limitation the rights to 11 | ** use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | ** the Software, and to permit persons to whom the Software is furnished to do so, 13 | ** subject to the following conditions: 14 | ** 15 | ** The above copyright notice and this permission notice shall be included in all 16 | ** copies or substantial portions of the Software. 17 | ** 18 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | ** FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | using System; 27 | using System.Collections; 28 | using System.Threading; 29 | using AOT; 30 | using UnityEngine; 31 | 32 | namespace lib 33 | { 34 | public enum RunMode 35 | { 36 | Stopped, 37 | Once, 38 | Always, 39 | Paused 40 | } 41 | 42 | public sealed class Error 43 | { 44 | public IntPtr s = IntPtr.Zero; 45 | public my_basic.mb_error_e e = my_basic.mb_error_e.SE_NO_ERR; 46 | public string m = null; 47 | public string f = null; 48 | public int p = 0; 49 | public ushort row = 0; 50 | public ushort col = 0; 51 | public int abort_code = 0; 52 | public string full = null; 53 | 54 | public Error(IntPtr _s, my_basic.mb_error_e _e, string _m, string _f, int _p, ushort _row, ushort _col, int _abort_code, string _full) 55 | { 56 | s = _s; 57 | e = _e; 58 | m = _m; 59 | f = _f; 60 | p = _p; 61 | row = _row; 62 | col = _col; 63 | abort_code = _abort_code; 64 | full = _full; 65 | } 66 | } 67 | 68 | public sealed class Interpreter 69 | { 70 | #region Threading 71 | 72 | private static object stopLock = new object(); 73 | private static bool stop = false; 74 | 75 | private static object dataLock = new object(); 76 | private static int line = 0; 77 | private static bool waiting = false; 78 | private static Error error = null; 79 | 80 | #endregion 81 | 82 | private Coroutine co = null; 83 | 84 | private Thread thread = null; 85 | 86 | private IntPtr bas = IntPtr.Zero; 87 | public IntPtr Bas { get { return bas; } } 88 | 89 | public bool Finished 90 | { 91 | get 92 | { 93 | return co == null || thread == null || !thread.IsAlive; 94 | } 95 | } 96 | 97 | public Func Stepped = null; 98 | 99 | public Action ErrorOccured = null; 100 | 101 | public Action ExecutionFinished = null; 102 | 103 | public static void Initlalize() 104 | { 105 | my_basic.mb_init(); 106 | } 107 | 108 | public static void Dispose() 109 | { 110 | my_basic.mb_dispose(); 111 | } 112 | 113 | public void Open() 114 | { 115 | my_basic.mb_open(out bas); 116 | 117 | my_basic.mb_set_error_handler(bas, on_error); 118 | my_basic.mb_debug_set_stepped_handler(bas, on_stepped); 119 | } 120 | 121 | public void Close() 122 | { 123 | my_basic.mb_close(out bas); 124 | } 125 | 126 | #region Threading 127 | 128 | [MonoPInvokeCallback(typeof(my_basic.mb_error_handler_t))] 129 | private static void on_error(IntPtr s, my_basic.mb_error_e e, string m, string f, int p, ushort row, ushort col, int abort_code) 130 | { 131 | lock (dataLock) 132 | { 133 | if (e != my_basic.mb_error_e.SE_NO_ERR) 134 | { 135 | string full = null; 136 | if (f != null) 137 | { 138 | if (e == my_basic.mb_error_e.SE_RN_WRONG_FUNCTION_REACHED) 139 | { 140 | full = string.Format("ERROR\n Ln {0}, Func: {1}, Msg: {2}.\n", row, f, m); 141 | } 142 | else 143 | { 144 | full = string.Format("ERROR\n Ln {0}, File: {1}, Msg: {2}.\n", row, f, m); 145 | } 146 | } 147 | else 148 | { 149 | full = string.Format("ERROR\n Ln {0}, Msg: {1}.\n", row, m); 150 | } 151 | error = new Error(s, e, m, f, p, row, col, abort_code, full); 152 | } 153 | } 154 | } 155 | 156 | [MonoPInvokeCallback(typeof(my_basic.mb_debug_stepped_handler_t))] 157 | private static int on_stepped(IntPtr s, ref IntPtr l, string f, int p, ushort row, ushort col) 158 | { 159 | lock (dataLock) 160 | { 161 | waiting = true; 162 | line = row; 163 | } 164 | 165 | bool w = false; 166 | do 167 | { 168 | lock (dataLock) 169 | { 170 | w = waiting; 171 | } 172 | 173 | lock (stopLock) 174 | { 175 | if (stop) 176 | return my_basic.MB_FUNC_BYE; 177 | } 178 | } while (w); 179 | 180 | return my_basic.MB_FUNC_OK; 181 | } 182 | 183 | #endregion 184 | 185 | public bool Register(my_basic.mb_func_t func) 186 | { 187 | if (!func.Method.IsStatic) 188 | { 189 | Debug.LogError("Static function expected."); 190 | 191 | return false; 192 | } 193 | 194 | string name = func.Method.Name; 195 | 196 | return my_basic.mb_register_func(bas, name.ToUpper(), func) == my_basic.MB_FUNC_OK; 197 | } 198 | 199 | public bool Register(string name, my_basic.mb_func_t func) 200 | { 201 | if (!func.Method.IsStatic) 202 | { 203 | Debug.LogError("Static function expected."); 204 | 205 | return false; 206 | } 207 | 208 | return my_basic.mb_register_func(bas, name.ToUpper(), func) == my_basic.MB_FUNC_OK; 209 | } 210 | 211 | public void RemoveReservedFunc(string name) 212 | { 213 | my_basic.mb_remove_reserved_func(bas, name.ToUpper()); 214 | } 215 | 216 | private void Thread(object par) 217 | { 218 | my_basic.mb_run(bas); 219 | } 220 | 221 | private IEnumerator StartThread(string code) 222 | { 223 | WaitForEndOfFrame wait = new WaitForEndOfFrame(); 224 | 225 | while (thread != null && thread.IsAlive) 226 | { 227 | Stop(); 228 | 229 | yield return wait; 230 | } 231 | thread = null; 232 | 233 | stop = false; 234 | line = 0; 235 | waiting = false; 236 | 237 | my_basic.mb_reset(ref bas); 238 | my_basic.mb_load_string(bas, code); 239 | 240 | thread = new Thread(new ParameterizedThreadStart(Thread)); 241 | thread.Start(null); 242 | 243 | while (thread != null && thread.IsAlive) 244 | { 245 | lock (dataLock) 246 | { 247 | if (waiting) 248 | { 249 | if (error != null) 250 | { 251 | if (ErrorOccured != null) 252 | ErrorOccured(error); 253 | error = null; 254 | } 255 | if (Stepped != null) 256 | { 257 | while (!Stepped(line)) 258 | { 259 | goto _exit; 260 | } 261 | } 262 | waiting = false; 263 | } 264 | } 265 | 266 | _exit: 267 | 268 | yield return wait; 269 | } 270 | thread = null; 271 | 272 | co = null; 273 | 274 | if (ExecutionFinished != null) 275 | ExecutionFinished(); 276 | } 277 | 278 | public void Run(MonoBehaviour owner, string code) 279 | { 280 | if (co != null) 281 | owner.StopCoroutine(co); 282 | 283 | co = owner.StartCoroutine(StartThread(code)); 284 | } 285 | 286 | public void Stop() 287 | { 288 | lock (stopLock) 289 | { 290 | stop = true; 291 | } 292 | } 293 | } 294 | } 295 | -------------------------------------------------------------------------------- /bin/my_basic_code_editor_unity_Data/Mono/etc/mono/2.0/web.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 64 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 108 | 110 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 150 | 151 | 152 | 153 | 154 | 155 | -------------------------------------------------------------------------------- /prj/Assets/Examples/Scripts/Example.cs: -------------------------------------------------------------------------------- 1 | /* 2 | ** This source file is part of MY-BASIC Code Editor (Unity) 3 | ** 4 | ** For the latest info, see https://github.com/my-basic/my_basic_code_editor_unity/ 5 | ** 6 | ** Copyright (C) 2017 Wang Renxin 7 | ** 8 | ** Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | ** this software and associated documentation files (the "Software"), to deal in 10 | ** the Software without restriction, including without limitation the rights to 11 | ** use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | ** the Software, and to permit persons to whom the Software is furnished to do so, 13 | ** subject to the following conditions: 14 | ** 15 | ** The above copyright notice and this permission notice shall be included in all 16 | ** copies or substantial portions of the Software. 17 | ** 18 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | ** FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | using System; 27 | using System.Collections; 28 | using System.IO; 29 | using AOT; 30 | using UnityEngine; 31 | using UnityEngine.UI; 32 | using lib; 33 | 34 | public class Example : MonoBehaviour 35 | { 36 | private RunMode mode = RunMode.Stopped; 37 | 38 | private Interpreter interp = new Interpreter(); 39 | 40 | public MyCodeEditor editor = null; 41 | 42 | public MsgBox msgbox = null; 43 | 44 | public Dropdown dropdownFile = null; 45 | 46 | public bool pauseOnMsg = true; 47 | 48 | #region Threading 49 | 50 | private static object dataLock = new object(); 51 | private static object msg = null; 52 | 53 | #endregion 54 | 55 | private string FilePath 56 | { 57 | get 58 | { 59 | string result = Application.persistentDataPath; 60 | if (!result.EndsWith("\\") && !result.EndsWith("/")) 61 | result += "/"; 62 | result += string.Format("file_{0}.bas", dropdownFile.value); 63 | 64 | return result; 65 | } 66 | } 67 | 68 | private string ConfigFilePath 69 | { 70 | get 71 | { 72 | string result = Application.persistentDataPath; 73 | if (!result.EndsWith("\\") && !result.EndsWith("/")) 74 | result += "/"; 75 | result += "config.txt"; 76 | 77 | return result; 78 | } 79 | } 80 | 81 | private int LastEdited 82 | { 83 | get 84 | { 85 | if (!File.Exists(ConfigFilePath)) 86 | return -1; 87 | 88 | using (FileStream fs = new FileStream(ConfigFilePath, FileMode.Open, FileAccess.Read)) 89 | { 90 | using (StreamReader sr = new StreamReader(fs)) 91 | { 92 | string l = sr.ReadLine(); 93 | 94 | return int.Parse(l); 95 | } 96 | } 97 | } 98 | set 99 | { 100 | if (!File.Exists(ConfigFilePath)) 101 | { 102 | using (FileStream fs = new FileStream(ConfigFilePath, FileMode.OpenOrCreate, FileAccess.Write)) { } 103 | } 104 | 105 | using (FileStream fs = new FileStream(ConfigFilePath, FileMode.Truncate, FileAccess.Write)) 106 | { 107 | using (StreamWriter sw = new StreamWriter(fs)) 108 | { 109 | sw.Write(dropdownFile.value.ToString()); 110 | } 111 | } 112 | } 113 | } 114 | 115 | private void Start() 116 | { 117 | Interpreter.Initlalize(); 118 | 119 | interp.Open(); 120 | interp.Stepped += OnStepped; 121 | interp.ErrorOccured += OnErrorOccured; 122 | interp.ExecutionFinished += OnExecutionFinished; 123 | 124 | interp.RemoveReservedFunc("PRINT"); 125 | interp.RemoveReservedFunc("INPUT"); 126 | interp.Register("PRINT", Discarded); 127 | interp.Register("INPUT", Discarded); 128 | Register(Output); 129 | 130 | editor.LineEdited += OnLineEdited; 131 | 132 | StartCoroutine(Messaging()); 133 | 134 | StartCoroutine(FillLastCode()); 135 | } 136 | 137 | private void OnDestroy() 138 | { 139 | editor.LineEdited -= OnLineEdited; 140 | 141 | interp.Stop(); 142 | 143 | while (!interp.Finished) 144 | { 145 | System.Threading.Thread.Sleep(10); 146 | } 147 | 148 | interp.Close(); 149 | 150 | Interpreter.Dispose(); 151 | } 152 | 153 | private bool OnStepped(int ln) 154 | { 155 | switch (mode) 156 | { 157 | case RunMode.Stopped: 158 | return true; 159 | case RunMode.Once: 160 | Debug.Log(">" + ln.ToString()); 161 | 162 | editor.ScrollToLine(ln); 163 | 164 | mode = RunMode.Paused; 165 | 166 | return true; 167 | case RunMode.Always: 168 | Debug.Log(">" + ln.ToString()); 169 | 170 | return true; 171 | case RunMode.Paused: 172 | return false; 173 | } 174 | 175 | return false; 176 | } 177 | 178 | private void OnErrorOccured(Error err) 179 | { 180 | Debug.LogError(err.full); 181 | 182 | msgbox.Show(err.full); 183 | } 184 | 185 | private void OnExecutionFinished() 186 | { 187 | Debug.Log("OK"); 188 | 189 | mode = RunMode.Stopped; 190 | 191 | editor.Editable = true; 192 | editor.Unselect(); 193 | } 194 | 195 | private bool Register(my_basic.mb_func_t func) 196 | { 197 | if (interp.Register(func)) 198 | { 199 | editor.AddFunction(func.Method.Name.ToLower()); 200 | 201 | return true; 202 | } 203 | 204 | return false; 205 | } 206 | 207 | #region Threading 208 | 209 | [MonoPInvokeCallback(typeof(my_basic.mb_func_t))] 210 | private static int Discarded(IntPtr s, ref IntPtr l) 211 | { 212 | my_basic.mb_value_t val; 213 | 214 | my_basic.mb_attempt_open_bracket(s, ref l); 215 | 216 | while (my_basic.mb_has_arg(s, ref l) != 0) 217 | my_basic.mb_pop_value(s, ref l, out val); 218 | 219 | my_basic.mb_attempt_close_bracket(s, ref l); 220 | 221 | lock (dataLock) 222 | { 223 | msg = "`PRINT`, `INPUT` are discarded in this application."; 224 | } 225 | 226 | return my_basic.MB_FUNC_OK; 227 | } 228 | 229 | [MonoPInvokeCallback(typeof(my_basic.mb_func_t))] 230 | private static int Output(IntPtr s, ref IntPtr l) 231 | { 232 | my_basic.mb_value_t val; 233 | 234 | my_basic.mb_attempt_open_bracket(s, ref l); 235 | 236 | my_basic.mb_pop_value(s, ref l, out val); 237 | 238 | my_basic.mb_attempt_close_bracket(s, ref l); 239 | 240 | lock (dataLock) 241 | { 242 | switch (val.type) 243 | { 244 | case my_basic.mb_data_e.MB_DT_INT: 245 | msg = val.value.integer; 246 | 247 | break; 248 | case my_basic.mb_data_e.MB_DT_REAL: 249 | msg = val.value.float_point; 250 | 251 | break; 252 | case my_basic.mb_data_e.MB_DT_STRING: 253 | msg = val.value.String; 254 | 255 | break; 256 | default: 257 | break; 258 | } 259 | } 260 | 261 | return my_basic.MB_FUNC_OK; 262 | } 263 | 264 | #endregion 265 | 266 | private IEnumerator Messaging() 267 | { 268 | WaitForEndOfFrame wait = new WaitForEndOfFrame(); 269 | while (true) 270 | { 271 | object m = null; 272 | lock (dataLock) 273 | { 274 | m = msg; 275 | msg = null; 276 | } 277 | 278 | if (m != null) 279 | { 280 | if (pauseOnMsg && mode == RunMode.Always) 281 | { 282 | mode = RunMode.Paused; 283 | 284 | msgbox.Show 285 | ( 286 | m, 287 | (_) => { mode = RunMode.Always; } 288 | ); 289 | } 290 | else 291 | { 292 | msgbox.Show(m); 293 | } 294 | } 295 | 296 | yield return wait; 297 | } 298 | } 299 | 300 | private IEnumerator FillLastCode() 301 | { 302 | yield return new WaitForEndOfFrame(); 303 | 304 | if (LastEdited == -1) 305 | { 306 | editor.Append("a = 22"); 307 | editor.Append("b = 7"); 308 | editor.Append("output(a / b)"); 309 | editor.Append("output(\"Hello World!\")"); 310 | 311 | editor.Relayout(); 312 | } 313 | else 314 | { 315 | dropdownFile.value = LastEdited; 316 | OnLoadClicked(); 317 | } 318 | } 319 | 320 | public void OnLoadClicked() 321 | { 322 | OnStopClicked(); 323 | 324 | if (msgbox.Shown) return; 325 | 326 | if (!File.Exists(FilePath)) 327 | { 328 | msgbox.Show("File", "Blank file, not loaded."); 329 | 330 | return; 331 | } 332 | 333 | editor.Clear(); 334 | using (FileStream fs = new FileStream(FilePath, FileMode.Open, FileAccess.Read)) 335 | { 336 | using (StreamReader sr = new StreamReader(fs)) 337 | { 338 | string code = sr.ReadToEnd(); 339 | editor.Text = code; 340 | editor.Relayout(); 341 | } 342 | } 343 | 344 | LastEdited = dropdownFile.value; 345 | } 346 | 347 | public void OnSaveClicked() 348 | { 349 | if (msgbox.Shown) return; 350 | 351 | if (!File.Exists(FilePath)) 352 | { 353 | using (FileStream fs = new FileStream(FilePath, FileMode.OpenOrCreate, FileAccess.Write)) { } 354 | } 355 | 356 | using (FileStream fs = new FileStream(FilePath, FileMode.Truncate, FileAccess.Write)) 357 | { 358 | using (StreamWriter sw = new StreamWriter(fs)) 359 | { 360 | sw.Write(editor.Text); 361 | } 362 | } 363 | 364 | LastEdited = dropdownFile.value; 365 | } 366 | 367 | public void OnInsertClicked() 368 | { 369 | OnStopClicked(); 370 | 371 | if (msgbox.Shown) return; 372 | 373 | editor.Insert(editor.Selected); 374 | 375 | editor.Unselect(editor.Selected); 376 | } 377 | 378 | public void OnDeleteClicked() 379 | { 380 | OnStopClicked(); 381 | 382 | if (msgbox.Shown) return; 383 | 384 | editor.Remove(editor.Selected); 385 | } 386 | 387 | public void OnRunClicked() 388 | { 389 | if (msgbox.Shown) return; 390 | 391 | RunMode m = mode; 392 | 393 | mode = RunMode.Always; 394 | 395 | if (m == RunMode.Stopped) 396 | { 397 | string code = editor.Text; 398 | 399 | interp.Run(this, code); 400 | } 401 | 402 | editor.Editable = false; 403 | } 404 | 405 | public void OnStepClicked() 406 | { 407 | if (msgbox.Shown) return; 408 | 409 | RunMode m = mode; 410 | 411 | mode = RunMode.Once; 412 | 413 | if (m == RunMode.Stopped) 414 | { 415 | string code = editor.Text; 416 | 417 | interp.Run(this, code); 418 | } 419 | 420 | editor.Editable = false; 421 | } 422 | 423 | public void OnPauseClicked() 424 | { 425 | if (msgbox.Shown) return; 426 | 427 | if (mode == RunMode.Always) 428 | mode = RunMode.Paused; 429 | } 430 | 431 | public void OnStopClicked() 432 | { 433 | if (msgbox.Shown) 434 | msgbox.Close(); 435 | 436 | if (mode != RunMode.Stopped) 437 | { 438 | mode = RunMode.Stopped; 439 | 440 | interp.Stop(); 441 | } 442 | 443 | editor.Editable = true; 444 | } 445 | 446 | private void OnLineEdited(int ln) 447 | { 448 | OnStopClicked(); 449 | } 450 | } 451 | -------------------------------------------------------------------------------- /prj/ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!129 &1 4 | PlayerSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 10 7 | productGUID: 2378334c66ccbdb4599d44f787286a40 8 | AndroidProfiler: 0 9 | defaultScreenOrientation: 4 10 | targetDevice: 2 11 | useOnDemandResources: 0 12 | accelerometerFrequency: 60 13 | companyName: Wang Renxin 14 | productName: my_code_editor 15 | defaultCursor: {fileID: 0} 16 | cursorHotspot: {x: 0, y: 0} 17 | m_SplashScreenBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21176471, a: 1} 18 | m_ShowUnitySplashScreen: 1 19 | m_ShowUnitySplashLogo: 1 20 | m_SplashScreenOverlayOpacity: 1 21 | m_SplashScreenAnimation: 1 22 | m_SplashScreenLogoStyle: 1 23 | m_SplashScreenDrawMode: 0 24 | m_SplashScreenBackgroundAnimationZoom: 1 25 | m_SplashScreenLogoAnimationZoom: 1 26 | m_SplashScreenBackgroundLandscapeAspect: 1 27 | m_SplashScreenBackgroundPortraitAspect: 1 28 | m_SplashScreenBackgroundLandscapeUvs: 29 | serializedVersion: 2 30 | x: 0 31 | y: 0 32 | width: 1 33 | height: 1 34 | m_SplashScreenBackgroundPortraitUvs: 35 | serializedVersion: 2 36 | x: 0 37 | y: 0 38 | width: 1 39 | height: 1 40 | m_SplashScreenLogos: [] 41 | m_SplashScreenBackgroundLandscape: {fileID: 0} 42 | m_SplashScreenBackgroundPortrait: {fileID: 0} 43 | m_VirtualRealitySplashScreen: {fileID: 0} 44 | m_HolographicTrackingLossScreen: {fileID: 0} 45 | defaultScreenWidth: 640 46 | defaultScreenHeight: 480 47 | defaultScreenWidthWeb: 960 48 | defaultScreenHeightWeb: 600 49 | m_StereoRenderingPath: 0 50 | m_ActiveColorSpace: 0 51 | m_MTRendering: 1 52 | m_MobileMTRendering: 0 53 | m_StackTraceTypes: 010000000100000001000000010000000100000001000000 54 | iosShowActivityIndicatorOnLoading: -1 55 | androidShowActivityIndicatorOnLoading: -1 56 | tizenShowActivityIndicatorOnLoading: -1 57 | iosAppInBackgroundBehavior: 0 58 | displayResolutionDialog: 2 59 | iosAllowHTTPDownload: 1 60 | allowedAutorotateToPortrait: 0 61 | allowedAutorotateToPortraitUpsideDown: 0 62 | allowedAutorotateToLandscapeRight: 1 63 | allowedAutorotateToLandscapeLeft: 1 64 | useOSAutorotation: 1 65 | use32BitDisplayBuffer: 1 66 | disableDepthAndStencilBuffers: 0 67 | defaultIsFullScreen: 0 68 | defaultIsNativeResolution: 1 69 | runInBackground: 0 70 | captureSingleScreen: 0 71 | muteOtherAudioSources: 0 72 | Prepare IOS For Recording: 0 73 | submitAnalytics: 1 74 | usePlayerLog: 1 75 | bakeCollisionMeshes: 0 76 | forceSingleInstance: 0 77 | resizableWindow: 0 78 | useMacAppStoreValidation: 0 79 | gpuSkinning: 0 80 | graphicsJobs: 0 81 | xboxPIXTextureCapture: 0 82 | xboxEnableAvatar: 0 83 | xboxEnableKinect: 0 84 | xboxEnableKinectAutoTracking: 0 85 | xboxEnableFitness: 0 86 | visibleInBackground: 0 87 | allowFullscreenSwitch: 1 88 | macFullscreenMode: 2 89 | d3d9FullscreenMode: 1 90 | d3d11FullscreenMode: 1 91 | xboxSpeechDB: 0 92 | xboxEnableHeadOrientation: 0 93 | xboxEnableGuest: 0 94 | xboxEnablePIXSampling: 0 95 | n3dsDisableStereoscopicView: 0 96 | n3dsEnableSharedListOpt: 1 97 | n3dsEnableVSync: 0 98 | uiUse16BitDepthBuffer: 0 99 | ignoreAlphaClear: 0 100 | xboxOneResolution: 0 101 | xboxOneMonoLoggingLevel: 0 102 | xboxOneLoggingLevel: 1 103 | videoMemoryForVertexBuffers: 0 104 | psp2PowerMode: 0 105 | psp2AcquireBGM: 1 106 | wiiUTVResolution: 0 107 | wiiUGamePadMSAA: 1 108 | wiiUSupportsNunchuk: 0 109 | wiiUSupportsClassicController: 0 110 | wiiUSupportsBalanceBoard: 0 111 | wiiUSupportsMotionPlus: 0 112 | wiiUSupportsProController: 0 113 | wiiUAllowScreenCapture: 1 114 | wiiUControllerCount: 0 115 | m_SupportedAspectRatios: 116 | 4:3: 1 117 | 5:4: 1 118 | 16:10: 1 119 | 16:9: 1 120 | Others: 1 121 | bundleIdentifier: com.tonywang.editor 122 | bundleVersion: 1.0 123 | preloadedAssets: [] 124 | metroInputSource: 0 125 | m_HolographicPauseOnTrackingLoss: 1 126 | xboxOneDisableKinectGpuReservation: 0 127 | protectGraphicsMemory: 0 128 | AndroidBundleVersionCode: 1 129 | AndroidMinSdkVersion: 9 130 | AndroidPreferredInstallLocation: 1 131 | aotOptions: 132 | apiCompatibilityLevel: 2 133 | stripEngineCode: 1 134 | iPhoneStrippingLevel: 0 135 | iPhoneScriptCallOptimization: 0 136 | iPhoneBuildNumber: 0 137 | ForceInternetPermission: 0 138 | ForceSDCardPermission: 0 139 | CreateWallpaper: 0 140 | APKExpansionFiles: 0 141 | preloadShaders: 0 142 | StripUnusedMeshComponents: 0 143 | VertexChannelCompressionMask: 144 | serializedVersion: 2 145 | m_Bits: 238 146 | iPhoneSdkVersion: 988 147 | iOSTargetOSVersionString: 7.0 148 | tvOSSdkVersion: 0 149 | tvOSRequireExtendedGameController: 0 150 | tvOSTargetOSVersionString: 151 | uIPrerenderedIcon: 0 152 | uIRequiresPersistentWiFi: 0 153 | uIRequiresFullScreen: 0 154 | uIStatusBarHidden: 0 155 | uIExitOnSuspend: 0 156 | uIStatusBarStyle: 0 157 | iPhoneSplashScreen: {fileID: 0} 158 | iPhoneHighResSplashScreen: {fileID: 0} 159 | iPhoneTallHighResSplashScreen: {fileID: 0} 160 | iPhone47inSplashScreen: {fileID: 0} 161 | iPhone55inPortraitSplashScreen: {fileID: 0} 162 | iPhone55inLandscapeSplashScreen: {fileID: 0} 163 | iPadPortraitSplashScreen: {fileID: 0} 164 | iPadHighResPortraitSplashScreen: {fileID: 0} 165 | iPadLandscapeSplashScreen: {fileID: 0} 166 | iPadHighResLandscapeSplashScreen: {fileID: 0} 167 | appleTVSplashScreen: {fileID: 0} 168 | tvOSSmallIconLayers: [] 169 | tvOSLargeIconLayers: [] 170 | tvOSTopShelfImageLayers: [] 171 | tvOSTopShelfImageWideLayers: [] 172 | iOSLaunchScreenType: 0 173 | iOSLaunchScreenPortrait: {fileID: 0} 174 | iOSLaunchScreenLandscape: {fileID: 0} 175 | iOSLaunchScreenBackgroundColor: 176 | serializedVersion: 2 177 | rgba: 0 178 | iOSLaunchScreenFillPct: 100 179 | iOSLaunchScreenSize: 100 180 | iOSLaunchScreenCustomXibPath: 181 | iOSLaunchScreeniPadType: 0 182 | iOSLaunchScreeniPadImage: {fileID: 0} 183 | iOSLaunchScreeniPadBackgroundColor: 184 | serializedVersion: 2 185 | rgba: 0 186 | iOSLaunchScreeniPadFillPct: 100 187 | iOSLaunchScreeniPadSize: 100 188 | iOSLaunchScreeniPadCustomXibPath: 189 | iOSDeviceRequirements: [] 190 | iOSURLSchemes: [] 191 | iOSBackgroundModes: 0 192 | iOSMetalForceHardShadows: 0 193 | appleDeveloperTeamID: 194 | AndroidTargetDevice: 0 195 | AndroidSplashScreenScale: 0 196 | androidSplashScreen: {fileID: 0} 197 | AndroidKeystoreName: 198 | AndroidKeyaliasName: 199 | AndroidTVCompatibility: 1 200 | AndroidIsGame: 1 201 | androidEnableBanner: 1 202 | m_AndroidBanners: 203 | - width: 320 204 | height: 180 205 | banner: {fileID: 0} 206 | androidGamepadSupportLevel: 0 207 | resolutionDialogBanner: {fileID: 0} 208 | m_BuildTargetIcons: 209 | - m_BuildTarget: 210 | m_Icons: 211 | - serializedVersion: 2 212 | m_Icon: {fileID: 2800000, guid: 8aca11f79b1bf3e4ba992e7a754e1f8c, type: 3} 213 | m_Width: 128 214 | m_Height: 128 215 | m_BuildTargetBatching: [] 216 | m_BuildTargetGraphicsAPIs: [] 217 | m_BuildTargetVRSettings: [] 218 | openGLRequireES31: 0 219 | openGLRequireES31AEP: 0 220 | webPlayerTemplate: APPLICATION:Default 221 | m_TemplateCustomTags: {} 222 | wiiUTitleID: 0005000011000000 223 | wiiUGroupID: 00010000 224 | wiiUCommonSaveSize: 4096 225 | wiiUAccountSaveSize: 2048 226 | wiiUOlvAccessKey: 0 227 | wiiUTinCode: 0 228 | wiiUJoinGameId: 0 229 | wiiUJoinGameModeMask: 0000000000000000 230 | wiiUCommonBossSize: 0 231 | wiiUAccountBossSize: 0 232 | wiiUAddOnUniqueIDs: [] 233 | wiiUMainThreadStackSize: 3072 234 | wiiULoaderThreadStackSize: 1024 235 | wiiUSystemHeapSize: 128 236 | wiiUTVStartupScreen: {fileID: 0} 237 | wiiUGamePadStartupScreen: {fileID: 0} 238 | wiiUDrcBufferDisabled: 0 239 | wiiUProfilerLibPath: 240 | actionOnDotNetUnhandledException: 1 241 | enableInternalProfiler: 0 242 | logObjCUncaughtExceptions: 1 243 | enableCrashReportAPI: 0 244 | cameraUsageDescription: 245 | locationUsageDescription: 246 | microphoneUsageDescription: 247 | XboxTitleId: 248 | XboxImageXexPath: 249 | XboxSpaPath: 250 | XboxGenerateSpa: 0 251 | XboxDeployKinectResources: 0 252 | XboxSplashScreen: {fileID: 0} 253 | xboxEnableSpeech: 0 254 | xboxAdditionalTitleMemorySize: 0 255 | xboxDeployKinectHeadOrientation: 0 256 | xboxDeployKinectHeadPosition: 0 257 | ps4NPAgeRating: 12 258 | ps4NPTitleSecret: 259 | ps4NPTrophyPackPath: 260 | ps4ParentalLevel: 1 261 | ps4ContentID: ED1633-NPXX51362_00-0000000000000000 262 | ps4Category: 0 263 | ps4MasterVersion: 01.00 264 | ps4AppVersion: 01.00 265 | ps4AppType: 0 266 | ps4ParamSfxPath: 267 | ps4VideoOutPixelFormat: 0 268 | ps4VideoOutInitialWidth: 1920 269 | ps4VideoOutReprojectionRate: 120 270 | ps4PronunciationXMLPath: 271 | ps4PronunciationSIGPath: 272 | ps4BackgroundImagePath: 273 | ps4StartupImagePath: 274 | ps4SaveDataImagePath: 275 | ps4SdkOverride: 276 | ps4BGMPath: 277 | ps4ShareFilePath: 278 | ps4ShareOverlayImagePath: 279 | ps4PrivacyGuardImagePath: 280 | ps4NPtitleDatPath: 281 | ps4RemotePlayKeyAssignment: -1 282 | ps4RemotePlayKeyMappingDir: 283 | ps4PlayTogetherPlayerCount: 0 284 | ps4EnterButtonAssignment: 1 285 | ps4ApplicationParam1: 0 286 | ps4ApplicationParam2: 0 287 | ps4ApplicationParam3: 0 288 | ps4ApplicationParam4: 0 289 | ps4DownloadDataSize: 0 290 | ps4GarlicHeapSize: 2048 291 | ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ 292 | ps4UseDebugIl2cppLibs: 0 293 | ps4pnSessions: 1 294 | ps4pnPresence: 1 295 | ps4pnFriends: 1 296 | ps4pnGameCustomData: 1 297 | playerPrefsSupport: 0 298 | restrictedAudioUsageRights: 0 299 | ps4UseResolutionFallback: 0 300 | ps4ReprojectionSupport: 0 301 | ps4UseAudio3dBackend: 0 302 | ps4SocialScreenEnabled: 0 303 | ps4ScriptOptimizationLevel: 3 304 | ps4Audio3dVirtualSpeakerCount: 14 305 | ps4attribCpuUsage: 0 306 | ps4PatchPkgPath: 307 | ps4PatchLatestPkgPath: 308 | ps4PatchChangeinfoPath: 309 | ps4PatchDayOne: 0 310 | ps4attribUserManagement: 0 311 | ps4attribMoveSupport: 0 312 | ps4attrib3DSupport: 0 313 | ps4attribShareSupport: 0 314 | ps4attribExclusiveVR: 0 315 | ps4disableAutoHideSplash: 0 316 | ps4IncludedModules: [] 317 | monoEnv: 318 | psp2Splashimage: {fileID: 0} 319 | psp2NPTrophyPackPath: 320 | psp2NPSupportGBMorGJP: 0 321 | psp2NPAgeRating: 12 322 | psp2NPTitleDatPath: 323 | psp2NPCommsID: 324 | psp2NPCommunicationsID: 325 | psp2NPCommsPassphrase: 326 | psp2NPCommsSig: 327 | psp2ParamSfxPath: 328 | psp2ManualPath: 329 | psp2LiveAreaGatePath: 330 | psp2LiveAreaBackroundPath: 331 | psp2LiveAreaPath: 332 | psp2LiveAreaTrialPath: 333 | psp2PatchChangeInfoPath: 334 | psp2PatchOriginalPackage: 335 | psp2PackagePassword: F69AzBlax3CF3EDNhm3soLBPh71Yexui 336 | psp2KeystoneFile: 337 | psp2MemoryExpansionMode: 0 338 | psp2DRMType: 0 339 | psp2StorageType: 0 340 | psp2MediaCapacity: 0 341 | psp2DLCConfigPath: 342 | psp2ThumbnailPath: 343 | psp2BackgroundPath: 344 | psp2SoundPath: 345 | psp2TrophyCommId: 346 | psp2TrophyPackagePath: 347 | psp2PackagedResourcesPath: 348 | psp2SaveDataQuota: 10240 349 | psp2ParentalLevel: 1 350 | psp2ShortTitle: Not Set 351 | psp2ContentID: IV0000-ABCD12345_00-0123456789ABCDEF 352 | psp2Category: 0 353 | psp2MasterVersion: 01.00 354 | psp2AppVersion: 01.00 355 | psp2TVBootMode: 0 356 | psp2EnterButtonAssignment: 2 357 | psp2TVDisableEmu: 0 358 | psp2AllowTwitterDialog: 1 359 | psp2Upgradable: 0 360 | psp2HealthWarning: 0 361 | psp2UseLibLocation: 0 362 | psp2InfoBarOnStartup: 0 363 | psp2InfoBarColor: 0 364 | psp2UseDebugIl2cppLibs: 0 365 | psmSplashimage: {fileID: 0} 366 | splashScreenBackgroundSourceLandscape: {fileID: 0} 367 | splashScreenBackgroundSourcePortrait: {fileID: 0} 368 | spritePackerPolicy: 369 | webGLMemorySize: 256 370 | webGLExceptionSupport: 1 371 | webGLDataCaching: 0 372 | webGLDebugSymbols: 0 373 | webGLEmscriptenArgs: 374 | webGLModulesDirectory: 375 | webGLTemplate: APPLICATION:Default 376 | webGLAnalyzeBuildSize: 0 377 | webGLUseEmbeddedResources: 0 378 | webGLUseWasm: 0 379 | webGLCompressionFormat: 1 380 | scriptingDefineSymbols: {} 381 | platformArchitecture: {} 382 | scriptingBackend: {} 383 | incrementalIl2cppBuild: {} 384 | additionalIl2CppArgs: 385 | m_RenderingPath: 1 386 | m_MobileRenderingPath: 1 387 | metroPackageName: my_code_editor 388 | metroPackageVersion: 389 | metroCertificatePath: 390 | metroCertificatePassword: 391 | metroCertificateSubject: 392 | metroCertificateIssuer: 393 | metroCertificateNotAfter: 0000000000000000 394 | metroApplicationDescription: my_code_editor 395 | wsaImages: {} 396 | metroTileShortName: 397 | metroCommandLineArgsFile: 398 | metroTileShowName: 0 399 | metroMediumTileShowName: 0 400 | metroLargeTileShowName: 0 401 | metroWideTileShowName: 0 402 | metroDefaultTileSize: 1 403 | metroTileForegroundText: 2 404 | metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} 405 | metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, 406 | a: 1} 407 | metroSplashScreenUseBackgroundColor: 0 408 | platformCapabilities: {} 409 | metroFTAName: 410 | metroFTAFileTypes: [] 411 | metroProtocolName: 412 | metroCompilationOverrides: 1 413 | tizenProductDescription: 414 | tizenProductURL: 415 | tizenSigningProfileName: 416 | tizenGPSPermissions: 0 417 | tizenMicrophonePermissions: 0 418 | tizenDeploymentTarget: 419 | tizenDeploymentTargetType: 0 420 | tizenMinOSVersion: 0 421 | n3dsUseExtSaveData: 0 422 | n3dsCompressStaticMem: 1 423 | n3dsExtSaveDataNumber: 0x12345 424 | n3dsStackSize: 131072 425 | n3dsTargetPlatform: 2 426 | n3dsRegion: 7 427 | n3dsMediaSize: 0 428 | n3dsLogoStyle: 3 429 | n3dsTitle: GameName 430 | n3dsProductCode: 431 | n3dsApplicationId: 0xFF3FF 432 | stvDeviceAddress: 433 | stvProductDescription: 434 | stvProductAuthor: 435 | stvProductAuthorEmail: 436 | stvProductLink: 437 | stvProductCategory: 0 438 | XboxOneProductId: 439 | XboxOneUpdateKey: 440 | XboxOneSandboxId: 441 | XboxOneContentId: 442 | XboxOneTitleId: 443 | XboxOneSCId: 444 | XboxOneGameOsOverridePath: 445 | XboxOnePackagingOverridePath: 446 | XboxOneAppManifestOverridePath: 447 | XboxOnePackageEncryption: 0 448 | XboxOnePackageUpdateGranularity: 2 449 | XboxOneDescription: 450 | XboxOneLanguage: 451 | - enus 452 | XboxOneCapability: [] 453 | XboxOneGameRating: {} 454 | XboxOneIsContentPackage: 0 455 | XboxOneEnableGPUVariability: 0 456 | XboxOneSockets: {} 457 | XboxOneSplashScreen: {fileID: 0} 458 | XboxOneAllowedProductIds: [] 459 | XboxOnePersistentLocalStorageSize: 0 460 | vrEditorSettings: {} 461 | cloudServicesEnabled: {} 462 | cloudProjectId: 463 | projectName: 464 | organizationId: 465 | cloudEnabled: 0 466 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/MyCodeEditor/MsgBox.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1001 &100100000 4 | Prefab: 5 | m_ObjectHideFlags: 1 6 | serializedVersion: 2 7 | m_Modification: 8 | m_TransformParent: {fileID: 0} 9 | m_Modifications: [] 10 | m_RemovedComponents: [] 11 | m_ParentPrefab: {fileID: 0} 12 | m_RootGameObject: {fileID: 1507514425855480} 13 | m_IsPrefabParent: 1 14 | --- !u!1 &1055639443348980 15 | GameObject: 16 | m_ObjectHideFlags: 1 17 | m_PrefabParentObject: {fileID: 0} 18 | m_PrefabInternal: {fileID: 100100000} 19 | serializedVersion: 5 20 | m_Component: 21 | - component: {fileID: 224967942144078990} 22 | - component: {fileID: 222910810374676198} 23 | - component: {fileID: 114898337612024284} 24 | m_Layer: 5 25 | m_Name: Text 26 | m_TagString: Untagged 27 | m_Icon: {fileID: 0} 28 | m_NavMeshLayer: 0 29 | m_StaticEditorFlags: 0 30 | m_IsActive: 1 31 | --- !u!1 &1343385348141552 32 | GameObject: 33 | m_ObjectHideFlags: 0 34 | m_PrefabParentObject: {fileID: 0} 35 | m_PrefabInternal: {fileID: 100100000} 36 | serializedVersion: 5 37 | m_Component: 38 | - component: {fileID: 224457312584336350} 39 | - component: {fileID: 222865242141390234} 40 | - component: {fileID: 114957214934675662} 41 | m_Layer: 5 42 | m_Name: Msg 43 | m_TagString: Untagged 44 | m_Icon: {fileID: 0} 45 | m_NavMeshLayer: 0 46 | m_StaticEditorFlags: 0 47 | m_IsActive: 1 48 | --- !u!1 &1507514425855480 49 | GameObject: 50 | m_ObjectHideFlags: 0 51 | m_PrefabParentObject: {fileID: 0} 52 | m_PrefabInternal: {fileID: 100100000} 53 | serializedVersion: 5 54 | m_Component: 55 | - component: {fileID: 224103086814601372} 56 | - component: {fileID: 222324301670046702} 57 | - component: {fileID: 114545201166215900} 58 | - component: {fileID: 114138566889047606} 59 | m_Layer: 5 60 | m_Name: MsgBox 61 | m_TagString: Untagged 62 | m_Icon: {fileID: 0} 63 | m_NavMeshLayer: 0 64 | m_StaticEditorFlags: 0 65 | m_IsActive: 1 66 | --- !u!1 &1695077558261376 67 | GameObject: 68 | m_ObjectHideFlags: 0 69 | m_PrefabParentObject: {fileID: 0} 70 | m_PrefabInternal: {fileID: 100100000} 71 | serializedVersion: 5 72 | m_Component: 73 | - component: {fileID: 224681939222292120} 74 | - component: {fileID: 222109106390912962} 75 | - component: {fileID: 114454353238750680} 76 | m_Layer: 5 77 | m_Name: Title 78 | m_TagString: Untagged 79 | m_Icon: {fileID: 0} 80 | m_NavMeshLayer: 0 81 | m_StaticEditorFlags: 0 82 | m_IsActive: 1 83 | --- !u!1 &1815999271194062 84 | GameObject: 85 | m_ObjectHideFlags: 0 86 | m_PrefabParentObject: {fileID: 0} 87 | m_PrefabInternal: {fileID: 100100000} 88 | serializedVersion: 5 89 | m_Component: 90 | - component: {fileID: 224573035067797948} 91 | - component: {fileID: 222640975810162086} 92 | - component: {fileID: 114247746538470668} 93 | - component: {fileID: 114930417502489590} 94 | m_Layer: 5 95 | m_Name: Button 96 | m_TagString: Untagged 97 | m_Icon: {fileID: 0} 98 | m_NavMeshLayer: 0 99 | m_StaticEditorFlags: 0 100 | m_IsActive: 1 101 | --- !u!114 &114138566889047606 102 | MonoBehaviour: 103 | m_ObjectHideFlags: 1 104 | m_PrefabParentObject: {fileID: 0} 105 | m_PrefabInternal: {fileID: 100100000} 106 | m_GameObject: {fileID: 1507514425855480} 107 | m_Enabled: 1 108 | m_EditorHideFlags: 0 109 | m_Script: {fileID: 11500000, guid: d619ea2188b84e14bb39dc0959609ef8, type: 3} 110 | m_Name: 111 | m_EditorClassIdentifier: 112 | textTitle: {fileID: 114454353238750680} 113 | textMsg: {fileID: 114957214934675662} 114 | --- !u!114 &114247746538470668 115 | MonoBehaviour: 116 | m_ObjectHideFlags: 1 117 | m_PrefabParentObject: {fileID: 0} 118 | m_PrefabInternal: {fileID: 100100000} 119 | m_GameObject: {fileID: 1815999271194062} 120 | m_Enabled: 1 121 | m_EditorHideFlags: 0 122 | m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} 123 | m_Name: 124 | m_EditorClassIdentifier: 125 | m_Material: {fileID: 0} 126 | m_Color: {r: 1, g: 1, b: 1, a: 1} 127 | m_RaycastTarget: 1 128 | m_OnCullStateChanged: 129 | m_PersistentCalls: 130 | m_Calls: [] 131 | m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, 132 | Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 133 | m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} 134 | m_Type: 1 135 | m_PreserveAspect: 0 136 | m_FillCenter: 1 137 | m_FillMethod: 4 138 | m_FillAmount: 1 139 | m_FillClockwise: 1 140 | m_FillOrigin: 0 141 | --- !u!114 &114454353238750680 142 | MonoBehaviour: 143 | m_ObjectHideFlags: 1 144 | m_PrefabParentObject: {fileID: 0} 145 | m_PrefabInternal: {fileID: 100100000} 146 | m_GameObject: {fileID: 1695077558261376} 147 | m_Enabled: 1 148 | m_EditorHideFlags: 0 149 | m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} 150 | m_Name: 151 | m_EditorClassIdentifier: 152 | m_Material: {fileID: 0} 153 | m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} 154 | m_RaycastTarget: 1 155 | m_OnCullStateChanged: 156 | m_PersistentCalls: 157 | m_Calls: [] 158 | m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, 159 | Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 160 | m_FontData: 161 | m_Font: {fileID: 12800000, guid: 7a7fbd379bc895343b1c4a06355eb4f0, type: 3} 162 | m_FontSize: 14 163 | m_FontStyle: 0 164 | m_BestFit: 0 165 | m_MinSize: 10 166 | m_MaxSize: 40 167 | m_Alignment: 3 168 | m_AlignByGeometry: 0 169 | m_RichText: 1 170 | m_HorizontalOverflow: 1 171 | m_VerticalOverflow: 1 172 | m_LineSpacing: 1 173 | m_Text: New Text 174 | --- !u!114 &114545201166215900 175 | MonoBehaviour: 176 | m_ObjectHideFlags: 1 177 | m_PrefabParentObject: {fileID: 0} 178 | m_PrefabInternal: {fileID: 100100000} 179 | m_GameObject: {fileID: 1507514425855480} 180 | m_Enabled: 1 181 | m_EditorHideFlags: 0 182 | m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} 183 | m_Name: 184 | m_EditorClassIdentifier: 185 | m_Material: {fileID: 0} 186 | m_Color: {r: 1, g: 1, b: 1, a: 0.392} 187 | m_RaycastTarget: 1 188 | m_OnCullStateChanged: 189 | m_PersistentCalls: 190 | m_Calls: [] 191 | m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, 192 | Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 193 | m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} 194 | m_Type: 1 195 | m_PreserveAspect: 0 196 | m_FillCenter: 1 197 | m_FillMethod: 4 198 | m_FillAmount: 1 199 | m_FillClockwise: 1 200 | m_FillOrigin: 0 201 | --- !u!114 &114898337612024284 202 | MonoBehaviour: 203 | m_ObjectHideFlags: 1 204 | m_PrefabParentObject: {fileID: 0} 205 | m_PrefabInternal: {fileID: 100100000} 206 | m_GameObject: {fileID: 1055639443348980} 207 | m_Enabled: 1 208 | m_EditorHideFlags: 0 209 | m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} 210 | m_Name: 211 | m_EditorClassIdentifier: 212 | m_Material: {fileID: 0} 213 | m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} 214 | m_RaycastTarget: 1 215 | m_OnCullStateChanged: 216 | m_PersistentCalls: 217 | m_Calls: [] 218 | m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, 219 | Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 220 | m_FontData: 221 | m_Font: {fileID: 12800000, guid: 7a7fbd379bc895343b1c4a06355eb4f0, type: 3} 222 | m_FontSize: 14 223 | m_FontStyle: 0 224 | m_BestFit: 0 225 | m_MinSize: 10 226 | m_MaxSize: 40 227 | m_Alignment: 4 228 | m_AlignByGeometry: 0 229 | m_RichText: 1 230 | m_HorizontalOverflow: 0 231 | m_VerticalOverflow: 0 232 | m_LineSpacing: 1 233 | m_Text: OK 234 | --- !u!114 &114930417502489590 235 | MonoBehaviour: 236 | m_ObjectHideFlags: 1 237 | m_PrefabParentObject: {fileID: 0} 238 | m_PrefabInternal: {fileID: 100100000} 239 | m_GameObject: {fileID: 1815999271194062} 240 | m_Enabled: 1 241 | m_EditorHideFlags: 0 242 | m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3} 243 | m_Name: 244 | m_EditorClassIdentifier: 245 | m_Navigation: 246 | m_Mode: 3 247 | m_SelectOnUp: {fileID: 0} 248 | m_SelectOnDown: {fileID: 0} 249 | m_SelectOnLeft: {fileID: 0} 250 | m_SelectOnRight: {fileID: 0} 251 | m_Transition: 1 252 | m_Colors: 253 | m_NormalColor: {r: 1, g: 1, b: 1, a: 1} 254 | m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} 255 | m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} 256 | m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} 257 | m_ColorMultiplier: 1 258 | m_FadeDuration: 0.1 259 | m_SpriteState: 260 | m_HighlightedSprite: {fileID: 0} 261 | m_PressedSprite: {fileID: 0} 262 | m_DisabledSprite: {fileID: 0} 263 | m_AnimationTriggers: 264 | m_NormalTrigger: Normal 265 | m_HighlightedTrigger: Highlighted 266 | m_PressedTrigger: Pressed 267 | m_DisabledTrigger: Disabled 268 | m_Interactable: 1 269 | m_TargetGraphic: {fileID: 114247746538470668} 270 | m_OnClick: 271 | m_PersistentCalls: 272 | m_Calls: 273 | - m_Target: {fileID: 114138566889047606} 274 | m_MethodName: OnOkClicked 275 | m_Mode: 1 276 | m_Arguments: 277 | m_ObjectArgument: {fileID: 0} 278 | m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine 279 | m_IntArgument: 0 280 | m_FloatArgument: 0 281 | m_StringArgument: 282 | m_BoolArgument: 0 283 | m_CallState: 2 284 | m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, 285 | Culture=neutral, PublicKeyToken=null 286 | --- !u!114 &114957214934675662 287 | MonoBehaviour: 288 | m_ObjectHideFlags: 1 289 | m_PrefabParentObject: {fileID: 0} 290 | m_PrefabInternal: {fileID: 100100000} 291 | m_GameObject: {fileID: 1343385348141552} 292 | m_Enabled: 1 293 | m_EditorHideFlags: 0 294 | m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} 295 | m_Name: 296 | m_EditorClassIdentifier: 297 | m_Material: {fileID: 0} 298 | m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} 299 | m_RaycastTarget: 1 300 | m_OnCullStateChanged: 301 | m_PersistentCalls: 302 | m_Calls: [] 303 | m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, 304 | Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 305 | m_FontData: 306 | m_Font: {fileID: 12800000, guid: 7a7fbd379bc895343b1c4a06355eb4f0, type: 3} 307 | m_FontSize: 18 308 | m_FontStyle: 0 309 | m_BestFit: 0 310 | m_MinSize: 1 311 | m_MaxSize: 40 312 | m_Alignment: 4 313 | m_AlignByGeometry: 0 314 | m_RichText: 1 315 | m_HorizontalOverflow: 0 316 | m_VerticalOverflow: 1 317 | m_LineSpacing: 1 318 | m_Text: New Text 319 | --- !u!222 &222109106390912962 320 | CanvasRenderer: 321 | m_ObjectHideFlags: 1 322 | m_PrefabParentObject: {fileID: 0} 323 | m_PrefabInternal: {fileID: 100100000} 324 | m_GameObject: {fileID: 1695077558261376} 325 | --- !u!222 &222324301670046702 326 | CanvasRenderer: 327 | m_ObjectHideFlags: 1 328 | m_PrefabParentObject: {fileID: 0} 329 | m_PrefabInternal: {fileID: 100100000} 330 | m_GameObject: {fileID: 1507514425855480} 331 | --- !u!222 &222640975810162086 332 | CanvasRenderer: 333 | m_ObjectHideFlags: 1 334 | m_PrefabParentObject: {fileID: 0} 335 | m_PrefabInternal: {fileID: 100100000} 336 | m_GameObject: {fileID: 1815999271194062} 337 | --- !u!222 &222865242141390234 338 | CanvasRenderer: 339 | m_ObjectHideFlags: 1 340 | m_PrefabParentObject: {fileID: 0} 341 | m_PrefabInternal: {fileID: 100100000} 342 | m_GameObject: {fileID: 1343385348141552} 343 | --- !u!222 &222910810374676198 344 | CanvasRenderer: 345 | m_ObjectHideFlags: 1 346 | m_PrefabParentObject: {fileID: 0} 347 | m_PrefabInternal: {fileID: 100100000} 348 | m_GameObject: {fileID: 1055639443348980} 349 | --- !u!224 &224103086814601372 350 | RectTransform: 351 | m_ObjectHideFlags: 1 352 | m_PrefabParentObject: {fileID: 0} 353 | m_PrefabInternal: {fileID: 100100000} 354 | m_GameObject: {fileID: 1507514425855480} 355 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 356 | m_LocalPosition: {x: 0, y: 0, z: 0} 357 | m_LocalScale: {x: 1, y: 1, z: 1} 358 | m_Children: 359 | - {fileID: 224573035067797948} 360 | - {fileID: 224681939222292120} 361 | - {fileID: 224457312584336350} 362 | m_Father: {fileID: 0} 363 | m_RootOrder: 0 364 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 365 | m_AnchorMin: {x: 0.2, y: 0.3} 366 | m_AnchorMax: {x: 0.8, y: 0.7} 367 | m_AnchoredPosition: {x: 0, y: 0} 368 | m_SizeDelta: {x: 0, y: 0} 369 | m_Pivot: {x: 0.5, y: 0.5} 370 | --- !u!224 &224457312584336350 371 | RectTransform: 372 | m_ObjectHideFlags: 1 373 | m_PrefabParentObject: {fileID: 0} 374 | m_PrefabInternal: {fileID: 100100000} 375 | m_GameObject: {fileID: 1343385348141552} 376 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 377 | m_LocalPosition: {x: 0, y: 0, z: 0} 378 | m_LocalScale: {x: 1, y: 1, z: 1} 379 | m_Children: [] 380 | m_Father: {fileID: 224103086814601372} 381 | m_RootOrder: 2 382 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 383 | m_AnchorMin: {x: 0, y: 0} 384 | m_AnchorMax: {x: 1, y: 1} 385 | m_AnchoredPosition: {x: 0, y: 0} 386 | m_SizeDelta: {x: -75, y: -110} 387 | m_Pivot: {x: 0.5, y: 0.5} 388 | --- !u!224 &224573035067797948 389 | RectTransform: 390 | m_ObjectHideFlags: 1 391 | m_PrefabParentObject: {fileID: 0} 392 | m_PrefabInternal: {fileID: 100100000} 393 | m_GameObject: {fileID: 1815999271194062} 394 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 395 | m_LocalPosition: {x: 0, y: 0, z: 0} 396 | m_LocalScale: {x: 1, y: 1, z: 1} 397 | m_Children: 398 | - {fileID: 224967942144078990} 399 | m_Father: {fileID: 224103086814601372} 400 | m_RootOrder: 0 401 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 402 | m_AnchorMin: {x: 0.3, y: 0.06} 403 | m_AnchorMax: {x: 0.7, y: 0.24} 404 | m_AnchoredPosition: {x: 0, y: 0} 405 | m_SizeDelta: {x: 0, y: 0} 406 | m_Pivot: {x: 0.5, y: 0.5} 407 | --- !u!224 &224681939222292120 408 | RectTransform: 409 | m_ObjectHideFlags: 1 410 | m_PrefabParentObject: {fileID: 0} 411 | m_PrefabInternal: {fileID: 100100000} 412 | m_GameObject: {fileID: 1695077558261376} 413 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 414 | m_LocalPosition: {x: 0, y: 0, z: 0} 415 | m_LocalScale: {x: 1, y: 1, z: 1} 416 | m_Children: [] 417 | m_Father: {fileID: 224103086814601372} 418 | m_RootOrder: 1 419 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 420 | m_AnchorMin: {x: 0, y: 1} 421 | m_AnchorMax: {x: 0, y: 1} 422 | m_AnchoredPosition: {x: 90.999985, y: -23} 423 | m_SizeDelta: {x: 160, y: 30} 424 | m_Pivot: {x: 0.5, y: 0.5} 425 | --- !u!224 &224967942144078990 426 | RectTransform: 427 | m_ObjectHideFlags: 1 428 | m_PrefabParentObject: {fileID: 0} 429 | m_PrefabInternal: {fileID: 100100000} 430 | m_GameObject: {fileID: 1055639443348980} 431 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 432 | m_LocalPosition: {x: 0, y: 0, z: 0} 433 | m_LocalScale: {x: 1, y: 1, z: 1} 434 | m_Children: [] 435 | m_Father: {fileID: 224573035067797948} 436 | m_RootOrder: 0 437 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 438 | m_AnchorMin: {x: 0, y: 0} 439 | m_AnchorMax: {x: 1, y: 1} 440 | m_AnchoredPosition: {x: 0, y: 0} 441 | m_SizeDelta: {x: 0, y: 0} 442 | m_Pivot: {x: 0.5, y: 0.5} 443 | -------------------------------------------------------------------------------- /bin/my_basic_code_editor_unity_Data/Mono/etc/mono/1.0/machine.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 |
8 |
9 |
10 | 11 |
13 |
15 |
17 |
19 |
21 |
23 |
25 |
27 |
29 |
31 |
33 |
35 |
37 |
39 |
41 | 42 | 43 |
45 |
47 |
49 |
51 |
53 | 54 |
55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 116 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 135 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 154 | 161 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/MyCodeEditor/MyCodeEditor.cs: -------------------------------------------------------------------------------- 1 | /* 2 | ** This source file is part of MY-BASIC Code Editor (Unity) 3 | ** 4 | ** For the latest info, see https://github.com/my-basic/my_basic_code_editor_unity/ 5 | ** 6 | ** Copyright (C) 2017 Wang Renxin 7 | ** 8 | ** Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | ** this software and associated documentation files (the "Software"), to deal in 10 | ** the Software without restriction, including without limitation the rights to 11 | ** use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | ** the Software, and to permit persons to whom the Software is furnished to do so, 13 | ** subject to the following conditions: 14 | ** 15 | ** The above copyright notice and this permission notice shall be included in all 16 | ** copies or substantial portions of the Software. 17 | ** 18 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | ** FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | using System; 27 | using System.Collections; 28 | using System.Collections.Generic; 29 | using System.Linq; 30 | using System.Text; 31 | using UnityEngine; 32 | using UnityEngine.UI; 33 | 34 | public class MyCodeEditor : MonoBehaviour 35 | { 36 | public Coloring keyword = null; 37 | 38 | public Coloring reserved = null; 39 | 40 | public Coloring symbol = null; 41 | 42 | public Coloring opcode = null; 43 | 44 | public Coloring function = null; 45 | 46 | public Coloring text = null; 47 | 48 | public Coloring comment = null; 49 | 50 | public Coloring discarded = null; 51 | 52 | public bool caseSensitive = false; 53 | 54 | public GameObject prefabHead = null; 55 | 56 | public GameObject prefabLine = null; 57 | 58 | public ScrollRect scrollHeadCol = null; 59 | 60 | public ScrollRect scrollLineCol = null; 61 | 62 | public RectTransform transHeadRoot = null; 63 | 64 | public RectTransform transLineRoot = null; 65 | 66 | public MyCodeInput codeInput = null; 67 | 68 | public int lineCountPerScreen = 18; 69 | 70 | public Material fontMaterial = null; 71 | 72 | private List colorings = new List(); 73 | 74 | private List heads = new List(); 75 | 76 | private List lines = new List(); 77 | 78 | private List userFuncs = new List(); 79 | 80 | private float headNumberWidth = 0.0f; 81 | 82 | private float lineTextWidth = 0.0f; 83 | 84 | public string Text 85 | { 86 | get 87 | { 88 | StringBuilder sb = new StringBuilder(); 89 | for (int i = 0; i < lines.Count; ++i) 90 | { 91 | MyCodeLine ln = lines[i]; 92 | if (i == lines.Count - 1 && string.IsNullOrEmpty(ln.Text)) 93 | continue; 94 | sb.AppendLine(ln.Text); 95 | } 96 | 97 | return sb.ToString(); 98 | } 99 | set 100 | { 101 | Clear(); 102 | 103 | string str = value.Replace("\r\n", "\n").Replace('\r', '\n'); 104 | string[] lns = str.Split('\n'); 105 | foreach (string ln in lns) 106 | { 107 | Append(ln); 108 | } 109 | } 110 | } 111 | 112 | public int LineCount 113 | { 114 | get { return lines.Count; } 115 | } 116 | 117 | private bool editable = true; 118 | public bool Editable 119 | { 120 | get 121 | { 122 | return editable; 123 | } 124 | set 125 | { 126 | editable = value; 127 | foreach (MyCodeHead h in heads) 128 | h.SelectionEnabled = editable; 129 | if (!editable) 130 | codeInput.Hide(); 131 | } 132 | } 133 | 134 | public IEnumerable Selected 135 | { 136 | get 137 | { 138 | List lst = new List(); 139 | for (int i = 0; i < LineCount; ++i) 140 | { 141 | MyCodeHead h = heads[i]; 142 | if (h.toggleSelection.isOn) 143 | lst.Add(i); 144 | } 145 | 146 | return lst; 147 | } 148 | } 149 | 150 | public IEnumerable SelectedText 151 | { 152 | get 153 | { 154 | foreach (int i in Selected) 155 | { 156 | MyCodeLine ln = lines[i]; 157 | 158 | yield return ln.Text; 159 | } 160 | } 161 | } 162 | 163 | public Action HeadClicked = null; 164 | 165 | public Action LineEdited = null; 166 | 167 | private void Start() 168 | { 169 | fontMaterial.mainTexture.filterMode = FilterMode.Point; 170 | 171 | RefillColoring(); 172 | } 173 | 174 | private void OnDestroy() 175 | { 176 | Clear(); 177 | } 178 | 179 | private string Color(string str) 180 | { 181 | Parts parts = new Parts(); 182 | 183 | // Comment. 184 | foreach (string e in comment.Elements) 185 | { 186 | int start = str.IndexOf(e, 0, caseSensitive); 187 | if (start != -1) 188 | { 189 | int end = str.Length - 1; 190 | 191 | string part = str.Substring(start, end - start + 1); 192 | part = string.Format("{0}", part, comment.ColorHexString); 193 | 194 | parts.Add(new Part(start, end, part)); 195 | } 196 | } 197 | 198 | // String. 199 | foreach (string e in text.Elements) 200 | { 201 | int start = str.IndexOf(e, 0, caseSensitive); 202 | while (start != -1) 203 | { 204 | int end = str.IndexOf(e, start + 1, caseSensitive); 205 | if (end != -1) 206 | { 207 | if (!parts.Overlap(start, end)) 208 | { 209 | string part = str.Substring(start, end - start + 1); 210 | part = string.Format("{0}", part, text.ColorHexString); 211 | 212 | parts.Add(new Part(start, end, part)); 213 | } 214 | 215 | start = str.IndexOf(e, end + 1, caseSensitive); 216 | } 217 | } 218 | } 219 | 220 | // Discarded. 221 | foreach (string e in discarded.Elements) 222 | { 223 | int start = str.IndexOf(e, 0, caseSensitive); 224 | while (start != -1) 225 | { 226 | int end = start + e.Length - 1; 227 | 228 | if (!parts.Overlap(start, end)) 229 | { 230 | string part = str.Substring(start, e.Length); 231 | part = string.Format("{0}", part, discarded.ColorHexString); 232 | 233 | parts.Add(new Part(start, end, part)); 234 | } 235 | 236 | start = str.IndexOf(e, end + 1, caseSensitive); 237 | } 238 | } 239 | 240 | // Tokens. 241 | foreach (Coloring coloring in colorings) 242 | { 243 | foreach (string e in coloring.Elements) 244 | { 245 | int start = str.IndexOf(e, 0, caseSensitive); 246 | while (start != -1) 247 | { 248 | int end = start + e.Length - 1; 249 | 250 | if (!parts.Overlap(start, end)) 251 | { 252 | string part = str.Substring(start, e.Length); 253 | part = string.Format("{0}", part, coloring.ColorHexString); 254 | 255 | parts.Add(new Part(start, end, part)); 256 | } 257 | 258 | start = str.IndexOf(e, end + 1, caseSensitive); 259 | } 260 | } 261 | } 262 | 263 | // Replaces. 264 | parts.Sort((x, y) => x.Start - y.Start); 265 | 266 | for (int i = parts.Count - 1; i >= 0; --i) 267 | { 268 | Part part = parts[i]; 269 | str = str.Remove(part.Start, part.Count); 270 | str = str.Insert(part.Start, part.Text); 271 | } 272 | 273 | return str; 274 | } 275 | 276 | private void RefillColoring() 277 | { 278 | colorings.Clear(); 279 | Coloring[] cs = new Coloring[] { keyword, reserved, symbol, opcode, function }; 280 | foreach (Coloring coloring in cs) 281 | { 282 | foreach (string e in coloring.Elements) 283 | { 284 | Coloring c = new Coloring(); 285 | c.texts = e; 286 | c.color = coloring.color; 287 | colorings.Add(c); 288 | } 289 | } 290 | foreach (string f in userFuncs) 291 | { 292 | Coloring c = new Coloring(); 293 | c.texts = f; 294 | c.color = function.color; 295 | colorings.Add(c); 296 | } 297 | colorings.Sort((x, y) => y.texts.Length - x.texts.Length); 298 | } 299 | 300 | public void AddFunction(string func) 301 | { 302 | userFuncs.Add(func); 303 | } 304 | 305 | public void AddFunction(IEnumerable funcs) 306 | { 307 | userFuncs.AddRange(funcs); 308 | } 309 | 310 | public void ClearFunction() 311 | { 312 | userFuncs.Clear(); 313 | } 314 | 315 | private void EnsureLastLineEditable() 316 | { 317 | if (LineCount == 0 || !string.IsNullOrEmpty(lines.Last().Text)) 318 | { 319 | Append(string.Empty); 320 | } 321 | } 322 | 323 | private IEnumerator RelayoutProc(bool reserveScrollValue, bool activateLast) 324 | { 325 | yield return new WaitForEndOfFrame(); 326 | 327 | float height = MyCodeLine.Y_OFFSET * 2.0f; 328 | 329 | // Heads. 330 | headNumberWidth = 0.0f; 331 | foreach (MyCodeHead h in heads) 332 | { 333 | height += h.Rect().GetSize().y; 334 | if (h.TightWidth > headNumberWidth) 335 | headNumberWidth = h.TightWidth; 336 | } 337 | scrollHeadCol.Rect().offsetMin = new Vector2(0.0f, scrollHeadCol.Rect().offsetMin.y); 338 | scrollHeadCol.Rect().SetSize(new Vector2(headNumberWidth + MyCodeHead.X_OFFSET * 2.0f, scrollHeadCol.Rect().GetSize().y)); 339 | transHeadRoot.SetSize(new Vector2(headNumberWidth + MyCodeHead.X_OFFSET * 2.0f, height)); 340 | transHeadRoot.SetLeftPosition(0.0f); 341 | 342 | foreach (MyCodeHead h in heads) 343 | { 344 | h.Width = headNumberWidth; 345 | h.Relayout(); 346 | } 347 | yield return new WaitForEndOfFrame(); 348 | 349 | // Lines. 350 | Vector2 locPos = transLineRoot.localPosition; 351 | float oldVal = scrollLineCol.verticalScrollbar.value; 352 | scrollLineCol.Rect().offsetMin = new Vector2(scrollHeadCol.Rect().GetSize().x, scrollLineCol.Rect().offsetMin.y); 353 | scrollLineCol.Rect().SetSize(new Vector2(this.Rect().GetSize().x - scrollHeadCol.Rect().GetSize().x, scrollLineCol.Rect().GetSize().y)); 354 | 355 | lineTextWidth = scrollLineCol.Rect().GetSize().x - 5; 356 | foreach (MyCodeLine l in lines) 357 | { 358 | if (l.TightWidth > lineTextWidth) 359 | lineTextWidth = l.TightWidth; 360 | } 361 | transLineRoot.SetSize(new Vector2(lineTextWidth + MyCodeLine.X_OFFSET * 2.0f, height)); 362 | transLineRoot.SetLeftPosition(scrollLineCol.verticalScrollbar.Rect().GetSize().x / 2.0f); 363 | yield return new WaitForEndOfFrame(); 364 | 365 | foreach (MyCodeLine l in lines) 366 | { 367 | l.Width = lineTextWidth; 368 | l.Relayout(); 369 | } 370 | yield return new WaitForEndOfFrame(); 371 | 372 | transLineRoot.localPosition = locPos; 373 | 374 | if (reserveScrollValue) 375 | { 376 | scrollLineCol.verticalScrollbar.value = 1.0f; 377 | yield return new WaitForEndOfFrame(); 378 | scrollLineCol.verticalScrollbar.value = oldVal; 379 | } 380 | else 381 | { 382 | transLineRoot.localPosition = locPos; 383 | } 384 | 385 | // Activates last? 386 | if (activateLast) 387 | EditLine(lines.Last()); 388 | } 389 | 390 | public void Relayout(bool toBottom = false, bool activateLast = false) 391 | { 392 | EnsureLastLineEditable(); 393 | 394 | if (codeInput.Shown) 395 | codeInput.Hide(); 396 | 397 | StartCoroutine(RelayoutProc(toBottom, activateLast)); 398 | } 399 | 400 | public int Append(string text) 401 | { 402 | GameObject objLn = Instantiate(prefabLine, transLineRoot) as GameObject; 403 | MyCodeLine ln = objLn.GetComponent(); 404 | ln.Height = (float)Screen.height / lineCountPerScreen; 405 | ln.LineNumber = LineCount; 406 | ln.SetText(text, Color(text)); 407 | ln.LineClicked += OnLineClicked; 408 | lines.Add(ln); 409 | 410 | GameObject objHd = Instantiate(prefabHead, transHeadRoot) as GameObject; 411 | MyCodeHead hd = objHd.GetComponent(); 412 | hd.Height = (float)Screen.height / lineCountPerScreen; 413 | hd.LineNumber = ln.LineNumber; 414 | hd.HeadClicked += OnHeadClicked; 415 | heads.Add(hd); 416 | 417 | return lines.Count; 418 | } 419 | 420 | public bool Insert(int index) 421 | { 422 | if (index < 0 || index >= LineCount) 423 | return false; 424 | 425 | string text = string.Empty; 426 | 427 | GameObject objLn = Instantiate(prefabLine, transLineRoot) as GameObject; 428 | MyCodeLine ln = objLn.GetComponent(); 429 | ln.Height = (float)Screen.height / lineCountPerScreen; 430 | ln.LineNumber = index; 431 | ln.SetText(text, Color(text)); 432 | ln.LineClicked += OnLineClicked; 433 | lines.Insert(index, ln); 434 | 435 | GameObject objHd = Instantiate(prefabHead, transHeadRoot) as GameObject; 436 | MyCodeHead hd = objHd.GetComponent(); 437 | hd.Height = (float)Screen.height / lineCountPerScreen; 438 | hd.LineNumber = ln.LineNumber; 439 | hd.HeadClicked += OnHeadClicked; 440 | heads.Insert(index, hd); 441 | 442 | for (int i = index + 1; i < LineCount; ++i) 443 | { 444 | ++lines[i].LineNumber; 445 | ++heads[i].LineNumber; 446 | } 447 | 448 | return true; 449 | } 450 | 451 | public int Insert(IEnumerable indices) 452 | { 453 | int n = 0; 454 | foreach (int i in indices) 455 | { 456 | Insert(i + n); 457 | ++n; 458 | } 459 | 460 | Relayout(); 461 | 462 | return n; 463 | } 464 | 465 | public bool Remove(int index) 466 | { 467 | if (index < 0 || index >= LineCount) 468 | return false; 469 | 470 | GameObject.Destroy(lines[index].gameObject); 471 | GameObject.Destroy(heads[index].gameObject); 472 | lines.RemoveAt(index); 473 | heads.RemoveAt(index); 474 | for (int i = index; i < LineCount; ++i) 475 | { 476 | --lines[i].LineNumber; 477 | --heads[i].LineNumber; 478 | } 479 | 480 | return true; 481 | } 482 | 483 | public int Remove(IEnumerable indices) 484 | { 485 | int n = 0; 486 | foreach (int i in indices) 487 | { 488 | Remove(i - n); 489 | ++n; 490 | } 491 | 492 | Relayout(true); 493 | 494 | return n; 495 | } 496 | 497 | public void Clear() 498 | { 499 | foreach (MyCodeHead hd in heads) 500 | GameObject.Destroy(hd.gameObject); 501 | heads.Clear(); 502 | 503 | foreach (MyCodeLine mcl in lines) 504 | GameObject.Destroy(mcl.gameObject); 505 | lines.Clear(); 506 | 507 | headNumberWidth = 0.0f; 508 | lineTextWidth = 0.0f; 509 | } 510 | 511 | public void Unselect() 512 | { 513 | for (int i = 0; i < LineCount; ++i) 514 | { 515 | MyCodeHead h = heads[i]; 516 | h.toggleSelection.isOn = false; 517 | } 518 | } 519 | 520 | public bool Unselect(int index) 521 | { 522 | if (index < 0 || index >= LineCount) 523 | return false; 524 | 525 | MyCodeHead h = heads[index]; 526 | h.toggleSelection.isOn = false; 527 | 528 | return true; 529 | } 530 | 531 | public void Unselect(IEnumerable indices) 532 | { 533 | foreach (int i in indices) 534 | { 535 | if (i >= 0 && i < LineCount) 536 | { 537 | MyCodeHead h = heads[i]; 538 | h.toggleSelection.isOn = false; 539 | } 540 | } 541 | } 542 | 543 | public void Select(int index) 544 | { 545 | if (index >= 0 && index < LineCount) 546 | { 547 | MyCodeHead h = heads[index]; 548 | bool e = h.SelectionEnabled; 549 | h.SelectionEnabled = true; 550 | h.toggleSelection.isOn = true; 551 | h.SelectionEnabled = e; 552 | } 553 | } 554 | 555 | public void Select(IEnumerable indices) 556 | { 557 | foreach (int i in indices) 558 | { 559 | if (i >= 0 && i < LineCount) 560 | { 561 | MyCodeHead h = heads[i]; 562 | bool e = h.SelectionEnabled; 563 | h.SelectionEnabled = true; 564 | h.toggleSelection.isOn = true; 565 | h.SelectionEnabled = e; 566 | } 567 | } 568 | } 569 | 570 | private void EditLine(MyCodeLine ln) 571 | { 572 | codeInput.Show(ln); 573 | } 574 | 575 | public void ScrollToLine(int index) 576 | { 577 | if (index < 0) index = 0; 578 | else if (index >= LineCount) index = LineCount - 1; 579 | 580 | float val = 1.0f - (float)index / LineCount; 581 | scrollLineCol.verticalScrollbar.value = val; 582 | 583 | Unselect(); 584 | Select(index); 585 | } 586 | 587 | public void OnScrollLineColValueChanged(Vector2 val) 588 | { 589 | scrollHeadCol.verticalScrollbar.value = val.y; 590 | } 591 | 592 | private void OnLineClicked(MyCodeLine ln) 593 | { 594 | EditLine(ln); 595 | } 596 | 597 | private void OnHeadClicked(MyCodeHead hd) 598 | { 599 | if (HeadClicked != null) 600 | HeadClicked(hd.LineNumber); 601 | } 602 | 603 | public void OnInputEdited() 604 | { 605 | bool relayout = false; 606 | 607 | if (codeInput.Editing != null) 608 | { 609 | codeInput.Editing.SetText(codeInput.FieldInput.text, Color(codeInput.FieldInput.text)); 610 | 611 | if (LineEdited != null) 612 | LineEdited(codeInput.Editing.LineNumber); 613 | 614 | relayout = codeInput.Editing == lines.Last() && !string.IsNullOrEmpty(codeInput.FieldInput.text); 615 | } 616 | 617 | codeInput.Hide(); 618 | 619 | if (relayout) 620 | { 621 | Relayout(Editable, Editable); 622 | } 623 | } 624 | } 625 | -------------------------------------------------------------------------------- /prj/Assets/Plugins/MyCodeEditor/my_basic.cs: -------------------------------------------------------------------------------- 1 | /* 2 | ** This source file is part of MY-BASIC 3 | ** 4 | ** For the latest info, see https://github.com/paladin-t/my_basic/ 5 | ** 6 | ** Copyright (C) 2011 - 2017 Wang Renxin 7 | ** 8 | ** Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | ** this software and associated documentation files (the "Software"), to deal in 10 | ** the Software without restriction, including without limitation the rights to 11 | ** use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | ** the Software, and to permit persons to whom the Software is furnished to do so, 13 | ** subject to the following conditions: 14 | ** 15 | ** The above copyright notice and this permission notice shall be included in all 16 | ** copies or substantial portions of the Software. 17 | ** 18 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | ** FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | using System; 27 | using System.Runtime.InteropServices; 28 | using bool_t = System.Byte; 29 | using int_t = System.Int32; 30 | using real_t = System.Single; 31 | 32 | namespace lib 33 | { 34 | public static class my_basic 35 | { 36 | public class mb_exception : Exception 37 | { 38 | public int Code { get; private set; } 39 | 40 | public mb_exception(int code) 41 | { 42 | Code = code; 43 | } 44 | } 45 | 46 | #if UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX 47 | public const string LIB_NAME = "my_basic"; 48 | #elif UNITY_IOS || UNITY_ANDROID 49 | public const string LIB_NAME = "__Internal"; 50 | #else 51 | public const string LIB_NAME = "my_basic.dll"; 52 | #endif 53 | 54 | public const bool_t True = (bool_t)1; 55 | public const bool_t False = (bool_t)0; 56 | 57 | public const int MB_FUNC_OK = 0; 58 | public const int MB_FUNC_IGNORE = 1; 59 | public const int MB_FUNC_WARNING = 2; 60 | public const int MB_FUNC_ERR = 3; 61 | public const int MB_FUNC_BYE = 4; 62 | public const int MB_FUNC_SUSPEND = 5; 63 | public const int MB_FUNC_END = 6; 64 | public const int MB_LOOP_BREAK = 101; 65 | public const int MB_LOOP_CONTINUE = 102; 66 | public const int MB_SUB_RETURN = 103; 67 | public const int MB_EXTENDED_ABORT = 1001; 68 | 69 | public static int mb_check(int hr) 70 | { 71 | if (hr != MB_FUNC_OK) 72 | throw new mb_exception(hr); 73 | 74 | return hr; 75 | } 76 | 77 | public enum mb_error_e 78 | { 79 | SE_NO_ERR = 0, 80 | /** Common */ 81 | SE_CM_OPEN_MB_FAILED, 82 | SE_CM_FUNC_EXISTS, 83 | SE_CM_FUNC_NOT_EXISTS, 84 | SE_CM_NOT_SUPPORTED, 85 | /** Parsing */ 86 | SE_PS_OPEN_FILE_FAILED, 87 | SE_PS_SYMBOL_TOO_LONG, 88 | SE_PS_INVALID_CHAR, 89 | /** Running */ 90 | SE_RN_EMPTY_PROGRAM, 91 | SE_RN_PROGRAM_TOO_LONG, 92 | SE_RN_SYNTAX_ERROR, 93 | SE_RN_INVALID_DATA_TYPE, 94 | SE_RN_TYPE_NOT_MATCH, 95 | SE_RN_NUMBER_OVERFLOW, 96 | SE_RN_INVALID_STRING, 97 | SE_RN_INDEX_OUT_OF_BOUND, 98 | SE_RN_CANNOT_FIND_WITH_GIVEN_INDEX, 99 | SE_RN_ILLEGAL_BOUND, 100 | SE_RN_TOO_MANY_DIMENSIONS, 101 | SE_RN_OPERATION_FAILED, 102 | SE_RN_INVALID_OPERATION_USAGE, 103 | SE_RN_DIMENSION_COUNT_OUT_OF_BOUND, 104 | SE_RN_RANK_OUT_OF_BOUND, 105 | SE_RN_NEED_COMPLEX_ARRAY, 106 | SE_RN_LABEL_NOT_EXISTS, 107 | SE_RN_NO_RETURN_POINT, 108 | SE_RN_COLON_EXPECTED, 109 | SE_RN_COMMA_EXPECTED, 110 | SE_RN_COMMA_OR_SEMICOLON_EXPECTED, 111 | SE_RN_ARRAY_IDENTIFIER_EXPECTED, 112 | SE_RN_OPEN_BRACKET_EXPECTED, 113 | SE_RN_CLOSE_BRACKET_EXPECTED, 114 | SE_RN_ARRAY_SUBSCRIPT_EXPECTED, 115 | SE_RN_NESTED_TOO_DEEP, 116 | SE_RN_INCOMPLETE_STRUCTURE, 117 | SE_RN_FUNCTION_EXPECTED, 118 | SE_RN_VAR_OR_ARRAY_EXPECTED, 119 | SE_RN_ASSIGN_OPERATOR_EXPECTED, 120 | SE_RN_STRING_EXPECTED, 121 | SE_RN_NUMBER_EXPECTED, 122 | SE_RN_INTEGER_EXPECTED, 123 | SE_RN_ELSE_EXPECTED, 124 | SE_RN_ENDIF_EXPECTED, 125 | SE_RN_TO_EXPECTED, 126 | SE_RN_NEXT_EXPECTED, 127 | SE_RN_UNTIL_EXPECTED, 128 | SE_RN_LOOP_VAR_EXPECTED, 129 | SE_RN_JUMP_LABEL_EXPECTED, 130 | SE_RN_VARIABLE_EXPECTED, 131 | SE_RN_INVALID_ID_USAGE, 132 | SE_RN_DUPLICATE_ID, 133 | SE_RN_OPERATOR_EXPECTED, 134 | SE_RN_CALCULATION_ERROR, 135 | SE_RN_DIVIDE_BY_ZERO, 136 | SE_RN_MOD_BY_ZERO, 137 | SE_RN_INVALID_EXPRESSION, 138 | SE_RN_OUT_OF_MEMORY, 139 | SE_RN_MODULE_NOT_MATCH, 140 | SE_RN_WRONG_FUNCTION_REACHED, 141 | SE_RN_DO_NOT_SUSPEND_IN_A_ROUTINE, 142 | SE_RN_DO_NOT_MIX_INSTRUCTIONAL_AND_STRUCTURED, 143 | SE_RN_INVALID_ROUTINE, 144 | SE_RN_INCOMPLETE_ROUTINE, 145 | SE_RN_ROUTINE_EXPECTED, 146 | SE_RN_DUPLICATE_ROUTINE, 147 | SE_RN_TOO_MANY_ROUTINES, 148 | SE_RN_INVALID_CLASS, 149 | SE_RN_INCOMPLETE_CLASS, 150 | SE_RN_CLASS_EXPECTED, 151 | SE_RN_DUPLICATE_CLASS, 152 | SE_RN_WRONG_META_CLASS, 153 | SE_RN_HASH_AND_COMPARE_MUST_COME_TOGETHER, 154 | SE_RN_CANNOT_CHANGE_ME, 155 | SE_RN_INVALID_LAMBDA, 156 | SE_RN_LIST_EXPECTED, 157 | SE_RN_COLLECTION_EXPECTED, 158 | SE_RN_ITERATOR_EXPECTED, 159 | SE_RN_COLLECTION_OR_ITERATOR_EXPECTED, 160 | SE_RN_COLLECTION_OR_ITERATOR_OR_CLASS_EXPECTED, 161 | SE_RN_INVALID_ITERATOR, 162 | SE_RN_EMPTY_COLLECTION, 163 | SE_RN_REFERENCED_TYPE_EXPECTED, 164 | SE_RN_REFERENCE_COUNT_OVERFLOW, 165 | SE_RN_WEAK_REFERENCE_COUNT_OVERFLOW, 166 | SE_RN_DEBUG_ID_NOT_FOUND, 167 | SE_RN_STACK_TRACE_DISABLED, 168 | /** Extended abort */ 169 | SE_EA_EXTENDED_ABORT, 170 | /** Extra */ 171 | SE_COUNT 172 | } 173 | 174 | public enum mb_data_e 175 | { 176 | MB_DT_NIL = 0, 177 | MB_DT_UNKNOWN = 1 << 0, 178 | MB_DT_INT = 1 << 1, 179 | MB_DT_REAL = 1 << 2, 180 | MB_DT_NUM = MB_DT_INT | MB_DT_REAL, 181 | MB_DT_STRING = 1 << 3, 182 | MB_DT_TYPE = 1 << 4, 183 | MB_DT_USERTYPE = 1 << 5, 184 | MB_DT_USERTYPE_REF = 1 << 6, 185 | MB_DT_ARRAY = 1 << 7, 186 | MB_DT_LIST = 1 << 8, 187 | MB_DT_LIST_IT = 1 << 9, 188 | MB_DT_DICT = 1 << 10, 189 | MB_DT_DICT_IT = 1 << 11, 190 | MB_DT_COLLECTION = MB_DT_LIST | MB_DT_DICT, 191 | MB_DT_ITERATOR = MB_DT_LIST_IT | MB_DT_DICT_IT, 192 | MB_DT_CLASS = 1 << 12, 193 | MB_DT_ROUTINE = 1 << 13 194 | } 195 | 196 | public enum mb_meta_func_u 197 | { 198 | MB_MF_IS = 1 << 0, 199 | MB_MF_ADD = 1 << 1, 200 | MB_MF_SUB = 1 << 2, 201 | MB_MF_MUL = 1 << 3, 202 | MB_MF_DIV = 1 << 4, 203 | MB_MF_NEG = 1 << 5, 204 | MB_MF_CALC = MB_MF_IS | MB_MF_ADD | MB_MF_SUB | MB_MF_MUL | MB_MF_DIV | MB_MF_NEG, 205 | MB_MF_COLL = 1 << 6, 206 | MB_MF_FUNC = 1 << 7 207 | } 208 | 209 | public enum mb_meta_status_u 210 | { 211 | MB_MS_NONE = 0, 212 | MB_MS_DONE = 1 << 0, 213 | MB_MS_RETURNED = 1 << 1 214 | } 215 | 216 | [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Ansi, Pack = 1)] 217 | public struct mb_val_bytes_t 218 | { 219 | [FieldOffset(0)] 220 | public IntPtr ptr; 221 | [FieldOffset(0)] 222 | public ulong ul; 223 | [FieldOffset(0)] 224 | public int_t i; 225 | [FieldOffset(0)] 226 | public real_t r; 227 | } 228 | 229 | [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Ansi, Pack = 1)] 230 | public struct mb_value_u 231 | { 232 | [FieldOffset(0)] 233 | public int_t integer; 234 | [FieldOffset(0)] 235 | public real_t float_point; 236 | [FieldOffset(0)] 237 | public IntPtr str; 238 | [FieldOffset(0)] 239 | public mb_data_e type; 240 | [FieldOffset(0)] 241 | public IntPtr usertype; 242 | [FieldOffset(0)] 243 | public IntPtr usertype_ref; 244 | [FieldOffset(0)] 245 | public IntPtr array; 246 | [FieldOffset(0)] 247 | public IntPtr list; 248 | [FieldOffset(0)] 249 | public IntPtr list_it; 250 | [FieldOffset(0)] 251 | public IntPtr dict; 252 | [FieldOffset(0)] 253 | public IntPtr dict_it; 254 | [FieldOffset(0)] 255 | public IntPtr instance; 256 | [FieldOffset(0)] 257 | public IntPtr routine; 258 | [FieldOffset(0)] 259 | public mb_val_bytes_t bytes; 260 | 261 | public string String { get { return Marshal.PtrToStringAnsi(str); } } 262 | } 263 | 264 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)] 265 | public struct mb_value_t 266 | { 267 | public mb_data_e type; 268 | public mb_value_u value; 269 | } 270 | 271 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 272 | public delegate int mb_func_t(IntPtr s, ref IntPtr l); 273 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 274 | public delegate int mb_has_routine_arg_func_t(IntPtr s, ref IntPtr l, ref mb_value_t va, uint ca, ref uint ia, IntPtr r); 275 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 276 | public delegate int mb_pop_routine_arg_func_t(IntPtr s, ref IntPtr l, ref mb_value_t va, uint ca, ref uint ia, IntPtr r, ref mb_value_t val); 277 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 278 | public delegate int mb_routine_func_t(IntPtr s, ref IntPtr l, ref mb_value_t va, uint ca, IntPtr r, [MarshalAs(UnmanagedType.FunctionPtr)]mb_has_routine_arg_func_t has_arg, [MarshalAs(UnmanagedType.FunctionPtr)]mb_pop_routine_arg_func_t pop_arg); 279 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 280 | public delegate int mb_debug_stepped_handler_t(IntPtr s, ref IntPtr l, string f, int p, ushort row, ushort col); 281 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 282 | public delegate void mb_error_handler_t(IntPtr s, mb_error_e e, string m, string f, int p, ushort row, ushort col, int abort_code); 283 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 284 | public delegate int mb_print_func_t(string fmt, ArgIterator args); 285 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 286 | public delegate int mb_input_func_t(string buf, int size); 287 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 288 | public delegate int mb_import_handler_t(IntPtr s, string f); 289 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 290 | public delegate void mb_dtor_func_t(IntPtr s, IntPtr ptr); 291 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 292 | public delegate IntPtr mb_clone_func_t(IntPtr s, IntPtr ptr); 293 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 294 | public delegate uint mb_hash_func_t(IntPtr s, IntPtr ptr); 295 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 296 | public delegate int mb_cmp_func_t(IntPtr s, IntPtr lptr, IntPtr rptr); 297 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 298 | public delegate void mb_fmt_func_t(IntPtr s, IntPtr ptr, IntPtr buf, uint lb); 299 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 300 | public delegate int mb_meta_operator_t(IntPtr s, ref IntPtr l, ref mb_value_t lv, ref mb_value_t rf, ref mb_value_t ret); 301 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 302 | public delegate mb_meta_status_u mb_meta_func_t(IntPtr s, ref IntPtr l, ref mb_value_t z, string f); 303 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 304 | public delegate IntPtr mb_memory_allocate_func_t(uint s); 305 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 306 | public delegate void mb_memory_free_func_t(IntPtr p); 307 | 308 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 309 | public static extern uint mb_ver(); 310 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 311 | public static extern IntPtr mb_ver_string(); 312 | 313 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 314 | public static extern int mb_init(); 315 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 316 | public static extern int mb_dispose(); 317 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 318 | public static extern int mb_open(out IntPtr s); 319 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 320 | public static extern int mb_close(out IntPtr s); 321 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 322 | public static extern int mb_reset(ref IntPtr s, bool_t clrf = False); 323 | 324 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 325 | public static extern int mb_register_func(IntPtr s, string n, [MarshalAs(UnmanagedType.FunctionPtr)]mb_func_t f); 326 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 327 | public static extern int mb_remove_func(IntPtr s, string n); 328 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 329 | public static extern int mb_remove_reserved_func(IntPtr s, string n); 330 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 331 | public static extern int mb_begin_module(IntPtr s, string n); 332 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 333 | public static extern int mb_end_module(IntPtr s); 334 | 335 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 336 | public static extern int mb_attempt_func_begin(IntPtr s, ref IntPtr l); 337 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 338 | public static extern int mb_attempt_func_end(IntPtr s, ref IntPtr l); 339 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 340 | public static extern int mb_attempt_open_bracket(IntPtr s, ref IntPtr l); 341 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 342 | public static extern int mb_attempt_close_bracket(IntPtr s, ref IntPtr l); 343 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 344 | public static extern int mb_has_arg(IntPtr s, ref IntPtr l); 345 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 346 | public static extern int mb_pop_int(IntPtr s, ref IntPtr l, out int_t val); 347 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 348 | public static extern int mb_pop_real(IntPtr s, ref IntPtr l, out real_t val); 349 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 350 | public static extern int mb_pop_string(IntPtr s, ref IntPtr l, out IntPtr val); 351 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 352 | public static extern int mb_pop_usertype(IntPtr s, ref IntPtr l, out IntPtr val); 353 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 354 | public static extern int mb_pop_value(IntPtr s, ref IntPtr l, out mb_value_t val); 355 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 356 | public static extern int mb_push_int(IntPtr s, ref IntPtr l, int_t val); 357 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 358 | public static extern int mb_push_real(IntPtr s, ref IntPtr l, real_t val); 359 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 360 | public static extern int mb_push_string(IntPtr s, ref IntPtr l, string val); 361 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 362 | public static extern int mb_push_usertype(IntPtr s, ref IntPtr l, IntPtr val); 363 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 364 | public static extern int mb_push_value(IntPtr s, ref IntPtr l, mb_value_t val); 365 | 366 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 367 | public static extern int mb_begin_class(IntPtr s, ref IntPtr l, string n, IntPtr meta, int c, out mb_value_t _out); 368 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 369 | public static extern int mb_end_class(IntPtr s, ref IntPtr l); 370 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 371 | public static extern int mb_get_class_userdata(IntPtr s, ref IntPtr l, ref IntPtr d); 372 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 373 | public static extern int mb_set_class_userdata(IntPtr s, ref IntPtr l, IntPtr d); 374 | 375 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 376 | public static extern int mb_get_value_by_name(IntPtr s, ref IntPtr l, string n, ref mb_value_t val); 377 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 378 | public static extern int mb_add_var(IntPtr s, ref IntPtr l, string n, mb_value_t val, bool_t force); 379 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 380 | public static extern int mb_get_var(IntPtr s, ref IntPtr l, ref IntPtr v); 381 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 382 | public static extern int mb_get_var_value(IntPtr s, IntPtr v, ref mb_value_t val); 383 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 384 | public static extern int mb_set_var_value(IntPtr s, IntPtr v, mb_value_t val); 385 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 386 | public static extern int mb_init_array(IntPtr s, ref IntPtr l, mb_data_e t, ref int d, int c, ref IntPtr a); 387 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 388 | public static extern int mb_get_array_len(IntPtr s, ref IntPtr l, IntPtr a, int r, ref int i); 389 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 390 | public static extern int mb_get_array_elem(IntPtr s, ref IntPtr l, IntPtr a, ref int d, int c, ref mb_value_t val); 391 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 392 | public static extern int mb_set_array_elem(IntPtr s, ref IntPtr l, IntPtr a, ref int d, int c, mb_value_t val); 393 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 394 | public static extern int mb_init_coll(IntPtr s, ref IntPtr l, ref mb_value_t coll); 395 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 396 | public static extern int mb_get_coll(IntPtr s, ref IntPtr l, mb_value_t coll, mb_value_t idx, ref mb_value_t val); 397 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 398 | public static extern int mb_set_coll(IntPtr s, ref IntPtr l, mb_value_t coll, mb_value_t idx, mb_value_t val); 399 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 400 | public static extern int mb_remove_coll(IntPtr s, ref IntPtr l, mb_value_t coll, mb_value_t idx); 401 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 402 | public static extern int mb_count_coll(IntPtr s, ref IntPtr l, mb_value_t coll, ref int c); 403 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 404 | public static extern int mb_make_ref_value(IntPtr s, IntPtr val, ref mb_value_t _out, [MarshalAs(UnmanagedType.FunctionPtr)]mb_dtor_func_t un, [MarshalAs(UnmanagedType.FunctionPtr)]mb_clone_func_t cl, [MarshalAs(UnmanagedType.FunctionPtr)]mb_hash_func_t hs/* = null*/, [MarshalAs(UnmanagedType.FunctionPtr)]mb_cmp_func_t cp/* = null*/, [MarshalAs(UnmanagedType.FunctionPtr)]mb_fmt_func_t ft/* = null*/); 405 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 406 | public static extern int mb_get_ref_value(IntPtr s, ref IntPtr l, mb_value_t val, ref IntPtr _out); 407 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 408 | public static extern int mb_ref_value(IntPtr s, ref IntPtr l, mb_value_t val); 409 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 410 | public static extern int mb_unref_value(IntPtr s, ref IntPtr l, mb_value_t val); 411 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 412 | public static extern int mb_override_value(IntPtr s, ref IntPtr l, mb_value_t val, mb_meta_func_u m, [MarshalAs(UnmanagedType.FunctionPtr)]IntPtr f); 413 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 414 | public static extern int mb_dispose_value(IntPtr s, mb_value_t val); 415 | 416 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 417 | public static extern int mb_get_routine(IntPtr s, ref IntPtr l, string n, ref mb_value_t val); 418 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 419 | public static extern int mb_set_routine(IntPtr s, ref IntPtr l, string n, [MarshalAs(UnmanagedType.FunctionPtr)]mb_routine_func_t f, bool_t force); 420 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 421 | public static extern int mb_eval_routine(IntPtr s, ref IntPtr l, mb_value_t val, ref mb_value_t args, uint argc); 422 | 423 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 424 | public static extern int mb_load_string(IntPtr s, string l, bool_t reset = True); 425 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 426 | public static extern int mb_load_file(IntPtr s, string f); 427 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 428 | public static extern int mb_run(IntPtr s); 429 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 430 | public static extern int mb_suspend(IntPtr s, ref IntPtr l); 431 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 432 | public static extern int mb_schedule_suspend(IntPtr s, int t); 433 | 434 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 435 | public static extern int mb_debug_get(IntPtr s, string n, ref mb_value_t val); 436 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 437 | public static extern int mb_debug_set(IntPtr s, string n, mb_value_t val); 438 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 439 | public static extern int mb_debug_get_stack_trace(IntPtr s, ref IntPtr l, string[] fs, uint fc); 440 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 441 | public static extern int mb_debug_set_stepped_handler(IntPtr s, [MarshalAs(UnmanagedType.FunctionPtr)]mb_debug_stepped_handler_t h); 442 | 443 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 444 | public static extern IntPtr mb_get_type_string(mb_data_e t); 445 | 446 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 447 | public static extern int mb_raise_error(IntPtr s, ref IntPtr l, mb_error_e err, int ret); 448 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 449 | public static extern mb_error_e mb_get_last_error(IntPtr s); 450 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 451 | public static extern IntPtr mb_get_error_desc(mb_error_e err); 452 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 453 | public static extern int mb_set_error_handler(IntPtr s, [MarshalAs(UnmanagedType.FunctionPtr)]mb_error_handler_t h); 454 | 455 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 456 | public static extern int mb_set_printer(IntPtr s, [MarshalAs(UnmanagedType.FunctionPtr)]mb_print_func_t p); 457 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 458 | public static extern int mb_set_inputer(IntPtr s, [MarshalAs(UnmanagedType.FunctionPtr)]mb_input_func_t p); 459 | 460 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 461 | public static extern int mb_gc(IntPtr s, ref int_t collected/* = null*/); 462 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 463 | public static extern int mb_get_userdata(IntPtr s, ref IntPtr d); 464 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 465 | public static extern int mb_set_userdata(IntPtr s, IntPtr d); 466 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 467 | public static extern int mb_set_import_handler(IntPtr s, [MarshalAs(UnmanagedType.FunctionPtr)]mb_import_handler_t h); 468 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 469 | public static extern int mb_gets(IntPtr buf, int s); 470 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 471 | public static extern IntPtr mb_memdup(IntPtr val, uint size); 472 | [DllImport(LIB_NAME, CallingConvention = CallingConvention.Cdecl)] 473 | public static extern int mb_set_memory_manager([MarshalAs(UnmanagedType.FunctionPtr)]mb_memory_allocate_func_t a, [MarshalAs(UnmanagedType.FunctionPtr)]mb_memory_free_func_t f); 474 | } 475 | } 476 | --------------------------------------------------------------------------------