├── dist └── .gitkeep ├── UnityProject_Sagiri ├── Assets │ ├── Sagiri │ │ ├── Sagiri.asmdef │ │ ├── Sagiri.asmdef.meta │ │ ├── Editor │ │ │ ├── Tests.meta │ │ │ ├── Tests │ │ │ │ ├── SagiriTests.asmdef.meta │ │ │ │ ├── JsonWriterTest.cs.meta │ │ │ │ ├── SagiriTests.asmdef │ │ │ │ └── JsonWriterTest.cs │ │ │ ├── EntryPoint.cs.meta │ │ │ ├── PackageExporter.cs.meta │ │ │ ├── ShowOnlyDrawer.cs.meta │ │ │ ├── EnvironmentReader.cs.meta │ │ │ ├── ShowOnlyDrawer.cs │ │ │ ├── EnvironmentReader.cs │ │ │ ├── EntryPoint.cs │ │ │ └── PackageExporter.cs │ │ ├── Examples │ │ │ ├── SagiriExample.unity.meta │ │ │ ├── Editor.meta │ │ │ ├── Main.cs.meta │ │ │ ├── GameObjectExamples.cs.meta │ │ │ ├── Editor │ │ │ │ ├── MyBuildProcessor.cs.meta │ │ │ │ └── MyBuildProcessor.cs │ │ │ ├── Main.cs │ │ │ ├── GameObjectExamples.cs │ │ │ └── SagiriExample.unity │ │ ├── Editor.meta │ │ ├── Examples.meta │ │ ├── Prefabs.meta │ │ ├── ShowOnlyAttribute.cs │ │ ├── Prefabs │ │ │ ├── SagiriServer.prefab.meta │ │ │ └── SagiriServer.prefab │ │ ├── Console.cs.meta │ │ ├── Server.cs.meta │ │ ├── Shell.cs.meta │ │ ├── Attributes.cs.meta │ │ ├── CommandTree.cs.meta │ │ ├── Extensions.cs.meta │ │ ├── JsonWriter.cs.meta │ │ ├── LogEntry.cs.meta │ │ ├── ShowOnlyAttribute.cs.meta │ │ ├── Attributes.cs │ │ ├── LogEntry.cs │ │ ├── Console.cs │ │ ├── Extensions.cs │ │ ├── JsonWriter.cs │ │ ├── CommandTree.cs │ │ ├── Shell.cs │ │ └── Server.cs │ ├── StreamingAssets │ │ ├── Sagiri │ │ │ ├── favicon.ico │ │ │ ├── console.css.meta │ │ │ ├── console.js.meta │ │ │ ├── favicon.ico.meta │ │ │ ├── index.html.meta │ │ │ ├── shell.css.meta │ │ │ ├── shell.html.meta │ │ │ ├── shell.js.meta │ │ │ ├── console.html.meta │ │ │ ├── index.html │ │ │ ├── shell.css │ │ │ ├── shell.html │ │ │ ├── shell.js │ │ │ ├── console.css │ │ │ ├── console.html │ │ │ └── console.js │ │ └── Sagiri.meta │ ├── Sagiri.meta │ └── StreamingAssets.meta ├── ProjectSettings │ ├── ProjectVersion.txt │ ├── VFXManager.asset │ ├── ClusterInputManager.asset │ ├── PresetManager.asset │ ├── NetworkManager.asset │ ├── TimeManager.asset │ ├── EditorBuildSettings.asset │ ├── AudioManager.asset │ ├── EditorSettings.asset │ ├── TagManager.asset │ ├── DynamicsManager.asset │ ├── UnityConnectSettings.asset │ ├── Physics2DSettings.asset │ ├── NavMeshAreas.asset │ ├── GraphicsSettings.asset │ ├── QualitySettings.asset │ ├── InputManager.asset │ └── ProjectSettings.asset └── Packages │ └── manifest.json ├── document ├── log-browser.png └── log-unity.png ├── .editorconfig ├── export_package.bat ├── export_package.sh ├── .travis.yml ├── .gitignore ├── LICENSE ├── README.md └── scripts └── install.sh /dist/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Sagiri.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Sagiri" 3 | } 4 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2018.3.0f2 2 | -------------------------------------------------------------------------------- /document/log-browser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/5minlab/sagiri/HEAD/document/log-browser.png -------------------------------------------------------------------------------- /document/log-unity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/5minlab/sagiri/HEAD/document/log-unity.png -------------------------------------------------------------------------------- /UnityProject_Sagiri/ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/5minlab/sagiri/HEAD/UnityProject_Sagiri/ProjectSettings/VFXManager.asset -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/StreamingAssets/Sagiri/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/5minlab/sagiri/HEAD/UnityProject_Sagiri/Assets/StreamingAssets/Sagiri/favicon.ico -------------------------------------------------------------------------------- /UnityProject_Sagiri/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 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | m_DefaultList: [] 7 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/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 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Sagiri.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f51ad5bf12dabb24cb29b34df49b1e8c 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Editor/Tests.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4566039f8812efa4e90ca7447f1927d4 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Editor/Tests/SagiriTests.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9bd51e2094633cd46aabea63bb07ad43 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/StreamingAssets/Sagiri/console.css.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1918f5198f3d65945b2d9fa322e27a00 3 | timeCreated: 1499750605 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/StreamingAssets/Sagiri/console.js.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 61b2f8bff05c74c49b7c449d68338dad 3 | timeCreated: 1499821840 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/StreamingAssets/Sagiri/favicon.ico.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7ac3ce64aad4b804dbd7797f1fbe966a 3 | timeCreated: 1499750605 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/StreamingAssets/Sagiri/index.html.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 24fff50ceef367f40af230185257ea5e 3 | timeCreated: 1500344702 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/StreamingAssets/Sagiri/shell.css.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a3cd8f63ea63d75408fa6b256015e1c4 3 | timeCreated: 1500345812 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/StreamingAssets/Sagiri/shell.html.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7bd7a1aef771b6346b0ee97bb1f3a900 3 | timeCreated: 1500344702 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/StreamingAssets/Sagiri/shell.js.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ba8aa1e1bb09bcb4a8ff3abfa1ffc8d8 3 | timeCreated: 1500347234 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d6aecb308b2f4694ea4b4595530dedc3 3 | folderAsset: yes 4 | timeCreated: 1499761209 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Examples/SagiriExample.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e46c92d691acdec41bc9921a9d711fb5 3 | timeCreated: 1499761242 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/StreamingAssets/Sagiri/console.html.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a7f94fd22a68cef40b882fee695fcf03 3 | timeCreated: 1499750605 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 80d46eeaf62f12d4d9beb64183caacc2 3 | folderAsset: yes 4 | timeCreated: 1499761631 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Examples.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d429869b65c292047bfcbe2c21836a40 3 | folderAsset: yes 4 | timeCreated: 1499761294 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d243fe2c843a26e429cc2ddc1281a7b1 3 | folderAsset: yes 4 | timeCreated: 1499761881 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/StreamingAssets.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7569fd165a9488f418fe8526e60661a4 3 | folderAsset: yes 4 | timeCreated: 1499761429 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Examples/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1c7b2e4ef2dcf0c44b42ffb25ed93bee 3 | folderAsset: yes 4 | timeCreated: 1500534571 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/StreamingAssets/Sagiri.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e6c7c9319b8758640aa9fbf37dc5acf3 3 | folderAsset: yes 4 | timeCreated: 1499761838 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/ShowOnlyAttribute.cs: -------------------------------------------------------------------------------- 1 | // http://answers.unity3d.com/questions/489942/how-to-make-a-readonly-property-in-inspector.html 2 | 3 | namespace Assets.Sagiri { 4 | using UnityEngine; 5 | 6 | public class ShowOnlyAttribute : PropertyAttribute { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/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 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Prefabs/SagiriServer.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 921f21092a415734da4892e17f535113 3 | timeCreated: 1499750605 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: -1 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/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/Sagiri/Examples/SagiriExample.unity 10 | guid: e46c92d691acdec41bc9921a9d711fb5 11 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Console.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ea5920d45dca49040aec80b2f51a3c65 3 | timeCreated: 1499761634 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Server.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f8f10e2c123fa384dba52280f85879f7 3 | timeCreated: 1499761752 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Shell.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 89d7ed848b4ce594f90bf41b53339efe 3 | timeCreated: 1500347234 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Attributes.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f814bca8062fef8458b859b73bf2e34b 3 | timeCreated: 1499761634 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/CommandTree.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3d7e76d2d7db35b4183ea5424dbc9e33 3 | timeCreated: 1500347234 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Extensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8663e18829f88884ab9e93b06ade795b 3 | timeCreated: 1499761634 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/JsonWriter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3ff0def8588e3a149ae6bdf50367a8cd 3 | timeCreated: 1500341230 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/LogEntry.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cf6d95801b7d626458fc9fdae79b891e 3 | timeCreated: 1499827058 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Editor/EntryPoint.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2e1e19c020bde8f4d8b739b8615442d1 3 | timeCreated: 1499821965 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Examples/Main.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8e5d2b1578161fe468f98cd3b9ee0ab5 3 | timeCreated: 1499761304 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/ShowOnlyAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b961837397500b64a91a2da8bf105d90 3 | timeCreated: 1501034517 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Editor/PackageExporter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ece91cccd538650438d9ee7a55dda64d 3 | timeCreated: 1499761634 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Editor/ShowOnlyDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f18be406cde746045bc62e4593fbaf82 3 | timeCreated: 1501034517 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Editor/EnvironmentReader.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 577fc73204d47a540bee4f58dcff05f4 3 | timeCreated: 1499821965 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Editor/Tests/JsonWriterTest.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b343770662e57c442b18f4f0f0aa4074 3 | timeCreated: 1500340931 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Examples/GameObjectExamples.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5abdef743642b9b4cabe680680314728 3 | timeCreated: 1499750605 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Examples/Editor/MyBuildProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 17364a9d7d2b13849906ec49fb6e3d01 3 | timeCreated: 1500534580 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | insert_final_newline = true 6 | trim_trailing_whitespace = true 7 | 8 | [*.cs] 9 | indent_style = space 10 | indent_size = 4 11 | 12 | 13 | [*.js] 14 | indent_style = space 15 | indent_size = 2 16 | 17 | [*.css] 18 | indent_style = space 19 | indent_size = 2 20 | 21 | [*.html] 22 | indent_style = space 23 | indent_size = 2 24 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/StreamingAssets/Sagiri/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Sagiri 4 | 5 | 6 | 7 | 8 |

Sagiri

9 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/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 | -------------------------------------------------------------------------------- /export_package.bat: -------------------------------------------------------------------------------- 1 | @set CURR_DIR=%~dp0 2 | @set UNITY_PATH="C:\\Program Files\\Unity-5.6.2p3\\Editor\\Unity.exe" 3 | @set PROJ_PATH=%CURR_DIR%\UnityProject_Sagiri 4 | @set EXPORT_DIR=%CURR_DIR%\dist 5 | @set METHOD=Assets.Sagiri.Editor.EntryPoint.ExportPackage 6 | @set PACKAGE_NAME=sagiri.unitypackage 7 | @set EXPORT_PATH=%EXPORT_DIR%\%PACKAGE_NAME% 8 | 9 | %UNITY_PATH% -quit -batchmode -nographics -silent-crashes -projectPath %PROJ_PATH% -executeMethod %METHOD% -logFile export.log 10 | -------------------------------------------------------------------------------- /export_package.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | CURR_DIR=`pwd` 4 | UNITY_PATH="/Applications/Unity/Unity.app/Contents/MacOS/Unity" 5 | PROJ_PATH=$CURR_DIR/UnityProject_Sagiri 6 | EXPORT_DIR=$CURR_DIR/dist 7 | METHOD=Assets.Sagiri.Editor.EntryPoint.ExportPackage 8 | PACKAGE_NAME=minamo.unitypackage 9 | export EXPORT_PATH=$EXPORT_DIR/$PACKAGE_NAME 10 | 11 | LOG_FILE=export.log 12 | 13 | $UNITY_PATH -quit -batchmode -nographics -silent-crashes -projectPath $PROJ_PATH -executeMethod $METHOD -logFile $LOG_FILE 14 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Editor/Tests/SagiriTests.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "SagiriTests", 3 | "references": [ 4 | "Sagiri" 5 | ], 6 | "optionalUnityReferences": [ 7 | "TestAssemblies" 8 | ], 9 | "includePlatforms": [ 10 | "Editor" 11 | ], 12 | "excludePlatforms": [], 13 | "allowUnsafeCode": false, 14 | "overrideReferences": false, 15 | "precompiledReferences": [], 16 | "autoReferenced": true, 17 | "defineConstraints": [] 18 | } -------------------------------------------------------------------------------- /UnityProject_Sagiri/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: 0 11 | m_SpritePackerPaddingPower: 1 12 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd 13 | m_ProjectGenerationRootNamespace: 14 | m_UserGeneratedProjectSuffix: 15 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | 3 | os: osx 4 | osx_image: xcode8.3 5 | 6 | cache: 7 | directories: 8 | - scripts/unity-installers/ 9 | 10 | before_install: 11 | - chmod a+x ./*.sh 12 | - chmod a+x ./scripts/*.sh 13 | - mkdir -p scripts/unity-installers/ 14 | 15 | install: 16 | # unity editor 17 | - cd scripts; ./install.sh editor; cd - 18 | 19 | script: 20 | - ./export_package.sh 21 | - ls -al ./dist 22 | 23 | after_script: 24 | - cat export.log 25 | 26 | notifications: 27 | email: false 28 | 29 | branches: 30 | only: 31 | - master -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/StreamingAssets/Sagiri/shell.css: -------------------------------------------------------------------------------- 1 | textarea { 2 | resize:none; 3 | } 4 | 5 | body.console { 6 | background-color:black; 7 | } 8 | textarea.console { 9 | width:100%; 10 | background-color:#383838; 11 | color:#F0F0F0; 12 | font-size: 14px; 13 | font-family: "Lucida Console", Monaco, monospace; 14 | line-height: 16px; 15 | } 16 | 17 | h1 { 18 | margin: 5px; 19 | } 20 | a, a:visited, a:hover { 21 | text-decoration: none; 22 | color: #fff; 23 | font-size: 20px; 24 | } 25 | 26 | #output { 27 | height:500px; 28 | } 29 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Examples/Editor/MyBuildProcessor.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using Assets.Sagiri.Editor; 3 | using UnityEditor; 4 | using UnityEditor.Callbacks; 5 | using UnityEngine; 6 | 7 | namespace Assets.Sagiri.Examples.Editor { 8 | class MyBuildPostprocessor { 9 | [PostProcessBuild(1)] 10 | public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject) { 11 | if (!Debug.isDebugBuild) { 12 | EntryPoint.RemoveSteamingAssets(target, pathToBuiltProject); 13 | } 14 | } 15 | } 16 | } 17 | #endif 18 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/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 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/StreamingAssets/Sagiri/shell.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | sagiri 8 | 9 | 10 | 11 |

sagiri

12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Editor/Tests/JsonWriterTest.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using Assets.Sagiri.Editor; 3 | 4 | namespace Assets.Sagiri.Editor.Tests { 5 | class JsonStringTest { 6 | [Test] 7 | public void FilterTest() { 8 | var cases = new[] 9 | { 10 | new { a = "a\nb", b = @"a\nb" }, 11 | new { a = "a\r\nb", b = @"a\nb" }, 12 | new { a = @"a""b", b = @"a\""b" }, 13 | new { a = @"a\b", b = @"a\\b" }, 14 | }; 15 | foreach (var c in cases) { 16 | var v = JsonString.Filter(c.a); 17 | Assert.AreEqual(c.b, v); 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Unity 2 | UnityProject*/[Ll]ibrary/ 3 | UnityProject*/[Tt]emp/ 4 | UnityProject*/[Oo]bj/ 5 | UnityProject*/[Bb]uild/ 6 | UnityProject*/[Bb]uilds/ 7 | UnityProject*/Assets/AssetStoreTools* 8 | 9 | # Visual Studio 2015 cache directory 10 | .vs 11 | 12 | # Autogenerated VS/MD/Consulo solution and project files 13 | ExportedObj/ 14 | .consulo/ 15 | *.csproj 16 | *.unityproj 17 | *.sln 18 | *.suo 19 | *.tmp 20 | *.user 21 | *.userprefs 22 | *.pidb 23 | *.booproj 24 | *.svd 25 | *.pdb 26 | 27 | # Unity3D generated meta files 28 | *.pidb.meta 29 | 30 | # Unity3D Generated File On Crash Reports 31 | sysinfo.txt 32 | 33 | # Builds 34 | *.apk 35 | *.unitypackage 36 | *.exe 37 | *.exe.meta 38 | 39 | *.log 40 | 41 | # temp 42 | UnityProject_Sagiri/output/ -------------------------------------------------------------------------------- /UnityProject_Sagiri/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 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/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 | serializedVersion: 1 7 | m_Enabled: 1 8 | m_TestMode: 0 9 | m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events 10 | m_EventUrl: https://cdp.cloud.unity3d.com/v1/events 11 | m_ConfigUrl: https://config.uca.cloud.unity3d.com 12 | m_TestInitMode: 0 13 | CrashReportingSettings: 14 | m_EventUrl: https://perf-events.cloud.unity3d.com 15 | m_Enabled: 0 16 | m_LogBufferSize: 10 17 | m_CaptureEditorExceptions: 1 18 | UnityPurchasingSettings: 19 | m_Enabled: 0 20 | m_TestMode: 0 21 | UnityAnalyticsSettings: 22 | m_Enabled: 0 23 | m_TestMode: 0 24 | m_InitializeOnStartup: 1 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 5분실험실 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, 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, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Editor/ShowOnlyDrawer.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using UnityEditor; 3 | using UnityEngine; 4 | 5 | namespace Assets.Sagiri.Editor { 6 | [CustomPropertyDrawer(typeof(ShowOnlyAttribute))] 7 | public class ShowOnlyDrawer : PropertyDrawer { 8 | public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label) { 9 | string valueStr; 10 | 11 | switch (prop.propertyType) { 12 | case SerializedPropertyType.Integer: 13 | valueStr = prop.intValue.ToString(); 14 | break; 15 | case SerializedPropertyType.Boolean: 16 | valueStr = prop.boolValue.ToString(); 17 | break; 18 | case SerializedPropertyType.Float: 19 | valueStr = prop.floatValue.ToString("0.00000"); 20 | break; 21 | case SerializedPropertyType.String: 22 | valueStr = prop.stringValue; 23 | break; 24 | default: 25 | valueStr = "(not supported)"; 26 | break; 27 | } 28 | 29 | EditorGUI.LabelField(position, label.text, valueStr); 30 | } 31 | } 32 | } 33 | #endif 34 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Examples/Main.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace Assets.Sagiri.Examples { 5 | public class Main : MonoBehaviour { 6 | // Use this for initialization 7 | void Start() { 8 | Debug.Log("Start"); 9 | } 10 | 11 | private void OnDestroy() { 12 | Debug.Log("OnDestory"); 13 | } 14 | 15 | int rightClickCount = 0; 16 | 17 | // Update is called once per frame 18 | void Update() { 19 | if (Input.GetMouseButtonDown(0)) { 20 | // left 21 | PrintLog(); 22 | } 23 | 24 | if (Input.GetMouseButtonDown(1)) { 25 | // right 26 | rightClickCount += 1; 27 | Debug.LogFormat("right click : {0}", rightClickCount); 28 | } 29 | 30 | if (Input.GetKey(KeyCode.A)) { 31 | Debug.LogFormat("key pressed : {0}", Time.time); 32 | } 33 | } 34 | 35 | void PrintLog() { 36 | Debug.Log("this is log", this); 37 | Debug.LogWarning("this is warning", this); 38 | Debug.LogError("this is error", this); 39 | Debug.LogException(new NullReferenceException("this is exception"), this); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Attributes.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.RegularExpressions; 3 | 4 | namespace Assets.Sagiri { 5 | [AttributeUsage(AttributeTargets.Method)] 6 | public class CommandAttribute : Attribute { 7 | public delegate void CallbackSimple(); 8 | public delegate void Callback(string[] args); 9 | 10 | public CommandAttribute(string cmd, string help, bool runOnMainThread = true) { 11 | m_command = cmd; 12 | m_help = help; 13 | m_runOnMainThread = runOnMainThread; 14 | } 15 | 16 | public string m_command; 17 | public string m_help; 18 | public bool m_runOnMainThread; 19 | public Callback m_callback; 20 | } 21 | 22 | [AttributeUsage(AttributeTargets.Method)] 23 | public class RouteAttribute : Attribute { 24 | public delegate void Callback(RequestContext context); 25 | 26 | public RouteAttribute(string route, string methods = @"(GET|HEAD)", bool runOnMainThread = true) { 27 | m_route = new Regex(route, RegexOptions.IgnoreCase); 28 | m_methods = new Regex(methods); 29 | m_runOnMainThread = runOnMainThread; 30 | } 31 | 32 | public Regex m_route; 33 | public Regex m_methods; 34 | public bool m_runOnMainThread; 35 | public Callback m_callback; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/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: 3 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_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_QueriesHitTriggers: 1 23 | m_QueriesStartInColliders: 1 24 | m_ChangeStopsCallbacks: 0 25 | m_CallbacksOnDisable: 1 26 | m_AlwaysShowColliders: 0 27 | m_ShowColliderSleep: 1 28 | m_ShowColliderContacts: 0 29 | m_ShowColliderAABB: 0 30 | m_ContactArrowScale: 0.2 31 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 32 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 33 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 34 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 35 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 36 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # sagiri 2 | 3 | [![Build Status](https://travis-ci.org/5minlab/sagiri.svg?branch=master)](https://travis-ci.org/5minlab/sagiri) 4 | 5 | Web browser based Realtime Untiy3D Log viewer 6 | 7 | ![logs in unity](https://raw.githubusercontent.com/5minlab/sagiri/master/document/log-unity.png) 8 | 9 | ![browser log viewer](https://raw.githubusercontent.com/5minlab/sagiri/master/document/log-browser.png) 10 | 11 | It mix two library, [CUDLR][CUDLR] and [Unity-File-Debug]. 12 | Use [CUDLR][CUDLR] as log server. 13 | Use [Unity-File-Debug][Unity-File-Debug] as log viewer. 14 | 15 | ## Features 16 | * Supports iOS, Android, PC/Mac Standalone, and the Unity Editor 17 | * Capture Unity log messages and stack traces 18 | 19 | ## How to use 20 | 1. Import [latest release's package](https://github.com/5minlab/sagiri/releases) into your project. 21 | 2. Move the prefab `SagiriServer` into your scene 22 | 3. Set the port on `SagiriServer` game object. (default value is 55055) 23 | 4. Run the game and connect to http://localhost:55055 with your browser. 24 | (you can find address in unity game screen) 25 | 5. If you want to view log in unity build, check `Development build` flag. 26 | or comment this code block. 27 | 28 | ``` 29 | [PostProcessBuild(1)] 30 | public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject) { 31 | if (!Debug.isDebugBuild) { 32 | //EntryPoint.RemoveSteamingAssets(target, pathToBuiltProject); 33 | } 34 | } 35 | ``` 36 | 37 | ## Example 38 | open scene, `Sagiri/Examples/SagiriExample` 39 | 40 | [CUDLR]: https://github.com/proletariatgames/CUDLR 41 | [Unity-File-Debug]: https://github.com/Sacred-Seed-Studio/Unity-File-Debug 42 | -------------------------------------------------------------------------------- /scripts/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # view-source:https://store.unity.com/kr/download/thank-you?thank-you=personal&os=osx&nid=325 4 | 5 | # stable release 6 | # BASE_URL=http://netstorage.unity3d.com/unity 7 | 8 | # patch release 9 | BASE_URL=http://beta.unity3d.com/download 10 | 11 | #HASH=a2913c821e27 12 | #VERSION=5.6.2f1 13 | 14 | HASH=732dbf75922d 15 | VERSION=2018.1.5f1 16 | 17 | CACHE_DIR=unity-installers 18 | 19 | download() { 20 | package=$1 21 | file=$1 22 | url="$BASE_URL/$HASH/$package" 23 | 24 | echo "Downloading from $url: " 25 | curl -o $CACHE_DIR/`basename "$package"` "$url" 26 | } 27 | 28 | install() { 29 | package=$1 30 | echo "Installing "`basename "$package"` 31 | sudo installer -dumplog -package $CACHE_DIR/`basename "$package"` -target / 32 | } 33 | 34 | main() { 35 | package=$1 36 | 37 | if [ ! -f $CACHE_DIR/`basename "$package"` ]; then 38 | download "$package" 39 | fi 40 | 41 | install "$package" 42 | } 43 | 44 | 45 | case "$1" in 46 | "editor") 47 | main "MacEditorInstaller/Unity-$VERSION.pkg" 48 | ;; 49 | "windows") 50 | main "MacEditorTargetInstaller/UnitySetup-Windows-Support-for-Editor-$VERSION.pkg" 51 | ;; 52 | "mac") 53 | main "MacEditorTargetInstaller/UnitySetup-Mac-Support-for-Editor-$VERSION.pkg" 54 | ;; 55 | "linux") 56 | main "MacEditorTargetInstaller/UnitySetup-Linux-Support-for-Editor-$VERSION.pkg" 57 | ;; 58 | "android") 59 | main "MacEditorTargetInstaller/UnitySetup-Android-Support-for-Editor-$VERSION.pkg" 60 | ;; 61 | "ios") 62 | main "MacEditorTargetInstaller/UnitySetup-iOS-Support-for-Editor-$VERSION.pkg" 63 | ;; 64 | *) 65 | echo "unknown unity installer : $1" 66 | esac 67 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/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 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | m_SettingNames: 89 | - Humanoid 90 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Prefabs/SagiriServer.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &100000 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 100100000} 8 | serializedVersion: 5 9 | m_Component: 10 | - component: {fileID: 400000} 11 | - component: {fileID: 114940109664832240} 12 | m_Layer: 0 13 | m_Name: SagiriServer 14 | m_TagString: Untagged 15 | m_Icon: {fileID: 0} 16 | m_NavMeshLayer: 0 17 | m_StaticEditorFlags: 0 18 | m_IsActive: 1 19 | --- !u!4 &400000 20 | Transform: 21 | m_ObjectHideFlags: 1 22 | m_PrefabParentObject: {fileID: 0} 23 | m_PrefabInternal: {fileID: 100100000} 24 | m_GameObject: {fileID: 100000} 25 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 26 | m_LocalPosition: {x: 0, y: 0, z: 0} 27 | m_LocalScale: {x: 1, y: 1, z: 1} 28 | m_Children: [] 29 | m_Father: {fileID: 0} 30 | m_RootOrder: 0 31 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 32 | --- !u!1001 &100100000 33 | Prefab: 34 | m_ObjectHideFlags: 1 35 | serializedVersion: 2 36 | m_Modification: 37 | m_TransformParent: {fileID: 0} 38 | m_Modifications: [] 39 | m_RemovedComponents: [] 40 | m_ParentPrefab: {fileID: 0} 41 | m_RootGameObject: {fileID: 100000} 42 | m_IsPrefabParent: 1 43 | --- !u!114 &114940109664832240 44 | MonoBehaviour: 45 | m_ObjectHideFlags: 1 46 | m_PrefabParentObject: {fileID: 0} 47 | m_PrefabInternal: {fileID: 100100000} 48 | m_GameObject: {fileID: 100000} 49 | m_Enabled: 1 50 | m_EditorHideFlags: 0 51 | m_Script: {fileID: 11500000, guid: f8f10e2c123fa384dba52280f85879f7, type: 3} 52 | m_Name: 53 | m_EditorClassIdentifier: 54 | Port: 55055 55 | RegisterLogCallback: 1 56 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.ads": "2.3.1", 4 | "com.unity.analytics": "3.2.2", 5 | "com.unity.collab-proxy": "1.2.15", 6 | "com.unity.package-manager-ui": "2.0.3", 7 | "com.unity.purchasing": "2.0.3", 8 | "com.unity.textmeshpro": "1.3.0", 9 | "com.unity.modules.ai": "1.0.0", 10 | "com.unity.modules.animation": "1.0.0", 11 | "com.unity.modules.assetbundle": "1.0.0", 12 | "com.unity.modules.audio": "1.0.0", 13 | "com.unity.modules.cloth": "1.0.0", 14 | "com.unity.modules.director": "1.0.0", 15 | "com.unity.modules.imageconversion": "1.0.0", 16 | "com.unity.modules.imgui": "1.0.0", 17 | "com.unity.modules.jsonserialize": "1.0.0", 18 | "com.unity.modules.particlesystem": "1.0.0", 19 | "com.unity.modules.physics": "1.0.0", 20 | "com.unity.modules.physics2d": "1.0.0", 21 | "com.unity.modules.screencapture": "1.0.0", 22 | "com.unity.modules.terrain": "1.0.0", 23 | "com.unity.modules.terrainphysics": "1.0.0", 24 | "com.unity.modules.tilemap": "1.0.0", 25 | "com.unity.modules.ui": "1.0.0", 26 | "com.unity.modules.uielements": "1.0.0", 27 | "com.unity.modules.umbra": "1.0.0", 28 | "com.unity.modules.unityanalytics": "1.0.0", 29 | "com.unity.modules.unitywebrequest": "1.0.0", 30 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 31 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 32 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 33 | "com.unity.modules.unitywebrequestwww": "1.0.0", 34 | "com.unity.modules.vehicles": "1.0.0", 35 | "com.unity.modules.video": "1.0.0", 36 | "com.unity.modules.vr": "1.0.0", 37 | "com.unity.modules.wind": "1.0.0", 38 | "com.unity.modules.xr": "1.0.0" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Editor/EnvironmentReader.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using System; 3 | using UnityEngine; 4 | /* 5 | * https://github.com/5minlab/minamo/blob/master/UnityProject/Assets/Minamo/Editor/EnvironmentReader.cs 6 | */ 7 | 8 | namespace Assets.Sagiri.Editor { 9 | class EnvironmentReader { 10 | internal static bool TryRead(string key, out string val) { 11 | var parser = new Parser_String(); 12 | try { 13 | var s = Environment.GetEnvironmentVariable(key); 14 | return parser.Parse(s, out val); 15 | 16 | } catch (ArgumentNullException e) { 17 | Debug.LogError(e.Message); 18 | val = ""; 19 | return false; 20 | } 21 | } 22 | 23 | interface Parser { 24 | bool Parse(string s, out T val); 25 | } 26 | 27 | class Parser_Int : Parser { 28 | public bool Parse(string s, out int val) { 29 | if (s == null) { 30 | val = 0; 31 | return false; 32 | } 33 | 34 | try { 35 | val = int.Parse(s); 36 | return true; 37 | 38 | } catch (FormatException) { 39 | val = 0; 40 | return false; 41 | } 42 | } 43 | } 44 | 45 | class Parser_String : Parser { 46 | public bool Parse(string s, out string val) { 47 | if (s == null) { 48 | val = ""; 49 | return false; 50 | } 51 | 52 | val = s; 53 | return true; 54 | } 55 | } 56 | } 57 | } 58 | #endif 59 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/LogEntry.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using UnityEngine; 4 | 5 | namespace Assets.Sagiri { 6 | class LogEntry : IJsonSerializable { 7 | static readonly string[] logTypeStrTable; 8 | static LogEntry() { 9 | // optimize gc 10 | var enums = Enum.GetValues(typeof(LogType)); 11 | 12 | Debug.Assert((int)LogType.Error == 0); 13 | Debug.Assert((int)LogType.Exception == 4); 14 | Debug.Assert((int)enums.Length == 5); 15 | 16 | logTypeStrTable = new string[enums.Length]; 17 | for(int i = 0; i < enums.Length; i++) { 18 | var s = Enum.GetName(typeof(LogType), i); 19 | logTypeStrTable[i] = s; 20 | } 21 | } 22 | 23 | public readonly int uid; 24 | 25 | public readonly string log; 26 | public readonly string stacktrace; 27 | 28 | public readonly LogType level; 29 | public readonly DateTime time; 30 | 31 | static int nextUid = 1; 32 | 33 | readonly JsonObject json; 34 | 35 | public LogEntry(string log, string stacktrace, LogType lv, DateTime time) { 36 | uid = nextUid; 37 | nextUid += 1; 38 | 39 | this.log = log; 40 | this.stacktrace = stacktrace; 41 | this.level = lv; 42 | this.time = time; 43 | 44 | var lvName = logTypeStrTable[(int)lv]; 45 | 46 | json = new JsonObject(); 47 | json["l"] = new JsonString(log); 48 | json["t"] = new JsonString(lvName); 49 | // "2016.09.24.04.23.04" 50 | json["tm"] = new JsonString(time.ToString("yyyy.MM.dd.HH.mm.ss")); 51 | json["s"] = new JsonString(stacktrace); 52 | json["id"] = new JsonInt(uid); 53 | } 54 | 55 | public void AppendJson(StringBuilder sb) { 56 | json.AppendJson(sb); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Console.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using UnityEngine; 5 | 6 | namespace Assets.Sagiri { 7 | public class Console { 8 | /// 9 | /// Max number of lines in the console output 10 | /// 11 | const int MAX_LINES = 100; 12 | 13 | readonly static Console Instance = new Console(); 14 | readonly List m_output = new List(); 15 | 16 | public static void Log(string str, string stacktrace, LogType lv, DateTime time) { 17 | Instance.m_output.Add(new LogEntry(str, stacktrace, lv, time)); 18 | if (Instance.m_output.Count > MAX_LINES) { 19 | Instance.m_output.RemoveAt(0); 20 | } 21 | } 22 | 23 | /* Callback for Unity logging */ 24 | public static void LogCallback(string logString, string stackTrace, LogType type) { 25 | var now = DateTime.Now; 26 | Console.Log(logString, stackTrace, type, now); 27 | } 28 | 29 | static readonly JsonArray jsonBuilder = new JsonArray(); 30 | 31 | #if !NETFX_CORE 32 | // Our routes 33 | [Route("^/console/fetch$")] 34 | public static void FetchLog(RequestContext context) { 35 | // 로그를 어디부터 이어서 받을지 정할수 있도록 36 | // 매번 전체 로그를 보낼 필요는 없을것이다 37 | var last = context.Request.QueryString.Get("last"); 38 | int lastId = 0; 39 | if (!int.TryParse(last, out lastId)) { 40 | lastId = 0; 41 | } 42 | 43 | // 필요한것만 내려주도록 44 | jsonBuilder.Clear(); 45 | foreach (var r in Instance.m_output) { 46 | if (r.uid > lastId) { 47 | jsonBuilder.Add(r); 48 | } 49 | } 50 | var sb = new StringBuilder(); 51 | jsonBuilder.AppendJson(sb); 52 | var json = sb.ToString(); 53 | context.Response.WriteString(json, "application/json"); 54 | } 55 | #endif 56 | } 57 | } -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Extensions.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Net; 3 | 4 | namespace Assets.Sagiri { 5 | #if !NETFX_CORE 6 | public static class ResponseExtension { 7 | public static void WriteString(this HttpListenerResponse response, string input, string type = "text/plain") { 8 | response.StatusCode = (int)HttpStatusCode.OK; 9 | response.StatusDescription = "OK"; 10 | 11 | if (!string.IsNullOrEmpty(input)) { 12 | byte[] buffer = System.Text.Encoding.UTF8.GetBytes(input); 13 | response.ContentLength64 = buffer.Length; 14 | response.ContentType = type; 15 | response.OutputStream.Write(buffer, 0, buffer.Length); 16 | } 17 | } 18 | 19 | public static void WriteBytes(this HttpListenerResponse response, byte[] bytes) { 20 | response.StatusCode = (int)HttpStatusCode.OK; 21 | response.StatusDescription = "OK"; 22 | response.ContentLength64 = bytes.Length; 23 | response.OutputStream.Write(bytes, 0, bytes.Length); 24 | } 25 | 26 | public static void WriteFile(this HttpListenerResponse response, string path, string type = "application/octet-stream", bool download = false) { 27 | using (FileStream fs = File.OpenRead(path)) { 28 | response.StatusCode = (int)HttpStatusCode.OK; 29 | response.StatusDescription = "OK"; 30 | response.ContentLength64 = fs.Length; 31 | response.ContentType = type; 32 | if (download) 33 | response.AddHeader("Content-disposition", string.Format("attachment; filename={0}", Path.GetFileName(path))); 34 | 35 | byte[] buffer = new byte[64 * 1024]; 36 | int read; 37 | while ((read = fs.Read(buffer, 0, buffer.Length)) > 0) { 38 | // FIXME required? 39 | System.Threading.Thread.Sleep(0); 40 | response.OutputStream.Write(buffer, 0, read); 41 | } 42 | } 43 | } 44 | } 45 | #endif 46 | } 47 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Examples/GameObjectExamples.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using UnityEngine; 3 | 4 | namespace Assets.Sagiri.Examples { 5 | /** 6 | * Example console commands for getting information about GameObjects 7 | */ 8 | public static class GameObjectCommands { 9 | 10 | [Command("object list", "lists all the game objects in the scene")] 11 | public static void ListGameObjects() { 12 | Object[] objects = Object.FindObjectsOfType(typeof(GameObject)); 13 | foreach (Object obj in objects) { 14 | Shell.Log(obj.name); 15 | } 16 | } 17 | 18 | [Command("object print", "lists properties of the object")] 19 | public static void PrintGameObject(string[] args) { 20 | if (args.Length < 1) { 21 | Shell.Log("expected : object print "); 22 | return; 23 | } 24 | 25 | GameObject obj = GameObject.Find(args[0]); 26 | if (obj == null) { 27 | Shell.Log("GameObject not found : " + args[0]); 28 | } else { 29 | Shell.Log("Game Object : " + obj.name); 30 | foreach (Component component in obj.GetComponents(typeof(Component))) { 31 | Shell.Log(" Component : " + component.GetType()); 32 | foreach (FieldInfo f in component.GetType().GetFields()) { 33 | Shell.Log(" " + f.Name + " : " + f.GetValue(component)); 34 | } 35 | } 36 | } 37 | } 38 | } 39 | 40 | 41 | 42 | /** 43 | * Example console route for getting information about GameObjects 44 | * 45 | */ 46 | public static class GameObjectRoutes { 47 | [Route("^/object/list.json$", @"(GET|HEAD)", true)] 48 | public static void ListGameObjects(RequestContext context) { 49 | #if !NETFX_CORE 50 | string json = "["; 51 | Object[] objects = Object.FindObjectsOfType(typeof(GameObject)); 52 | foreach (Object obj in objects) { 53 | // FIXME object names need to be escaped.. use minijson or similar 54 | json += string.Format("\"{0}\", ", obj.name); 55 | } 56 | json = json.TrimEnd(new char[] { ',', ' ' }) + "]"; 57 | 58 | context.Response.WriteString(json, "application/json"); 59 | #endif 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /UnityProject_Sagiri/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: 12 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: 16000, guid: 0000000000000000f000000000000000, type: 0} 39 | - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} 40 | m_PreloadedShaders: [] 41 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 42 | type: 0} 43 | m_CustomRenderPipeline: {fileID: 0} 44 | m_TransparencySortMode: 0 45 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 46 | m_DefaultRenderingPath: 1 47 | m_DefaultMobileRenderingPath: 1 48 | m_TierSettings: [] 49 | m_LightmapStripping: 0 50 | m_FogStripping: 0 51 | m_InstancingStripping: 0 52 | m_LightmapKeepPlain: 1 53 | m_LightmapKeepDirCombined: 1 54 | m_LightmapKeepDynamicPlain: 1 55 | m_LightmapKeepDynamicDirCombined: 1 56 | m_LightmapKeepShadowMask: 1 57 | m_LightmapKeepSubtractive: 1 58 | m_FogKeepLinear: 1 59 | m_FogKeepExp: 1 60 | m_FogKeepExp2: 1 61 | m_AlbedoSwatchInfos: [] 62 | m_LightsUseLinearIntensity: 0 63 | m_LightsUseColorTemperature: 0 64 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/StreamingAssets/Sagiri/shell.js: -------------------------------------------------------------------------------- 1 | // caching dom elements 2 | var inputNode = document.querySelector('#input'); 3 | var outputNode = document.querySelector('#output'); 4 | 5 | var commandIndex = -1; 6 | var hash = null; 7 | 8 | function scrollBottom() { 9 | outputNode.scrollTop = output.scrollHeight; 10 | } 11 | 12 | function runCommand(command) { 13 | scrollBottom(); 14 | 15 | var url = 'shell/run?command=' + encodeURI(encodeURIComponent(command)); 16 | fetch(url).then(function(res) { 17 | if(res.ok) { 18 | updateConsole(function () { 19 | updateCommand(commandIndex - 1); 20 | }); 21 | } 22 | }); 23 | 24 | resetInput(); 25 | } 26 | 27 | function updateConsole(callback) { 28 | // Check if we are scrolled to the bottom to force scrolling on update 29 | fetch('shell/out').then(function(res) { 30 | if(res.ok) { 31 | res.text().then(function(text) { 32 | var shouldScroll = (outputNode.scrollHeight - outputNode.scrollTop) == output.clientHeight 33 | output.value = text; 34 | if (callback) callback(); 35 | if (shouldScroll) scrollBottom(); 36 | }) 37 | } 38 | }); 39 | } 40 | 41 | function resetInput() { 42 | commandIndex = -1; 43 | inputNode.value = ''; 44 | } 45 | 46 | function previousCommand() { 47 | updateCommand(commandIndex + 1); 48 | } 49 | 50 | function nextCommand() { 51 | updateCommand(commandIndex - 1); 52 | } 53 | 54 | function updateCommand(index) { 55 | // Check if we are at the defualt index and clear the input 56 | if (index < 0) { 57 | resetInput(); 58 | return; 59 | } 60 | 61 | var url = 'shell/commandHistory?index=' + index; 62 | fetch(url).then(function(res) { 63 | if(res.ok) { 64 | res.text().then(function(text) { 65 | if(text) { 66 | commandIndex = index; 67 | inputNode.value = text; 68 | } 69 | }); 70 | } 71 | }); 72 | } 73 | 74 | function complete(command) { 75 | var url = 'shell/complete?command=' + command; 76 | fetch(url).then(function(res) { 77 | if(res.ok) { 78 | res.text().then(function(text) { 79 | if(text) { 80 | inputNode.value = text; 81 | } 82 | }); 83 | } 84 | }); 85 | } 86 | 87 | // 최초 1번 데이터 가져오기 88 | updateConsole(null); 89 | 90 | inputNode.onkeydown = function (e) { 91 | if (e.keyCode == 13) { // Enter 92 | // we don't want a line break in the console 93 | e.preventDefault(); 94 | runCommand(inputNode.value); 95 | } else if (e.keyCode == 38) { // Up 96 | previousCommand(); 97 | } else if (e.keyCode == 40) { // Down 98 | nextCommand(); 99 | } else if (e.keyCode == 27) { // Escape 100 | resetInput(); 101 | } else if (e.keyCode == 9) { // Tab 102 | e.preventDefault(); 103 | complete(inputNode.value); 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Editor/EntryPoint.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using System.IO; 3 | using UnityEditor; 4 | using UnityEngine; 5 | 6 | /* 7 | * https://github.com/5minlab/minamo/blob/master/UnityProject/Assets/Minamo/Editor/EntryPoint.cs 8 | */ 9 | 10 | namespace Assets.Sagiri.Editor { 11 | class EntryPoint { 12 | public static void ExportPackage() { 13 | string output; 14 | if (EnvironmentReader.TryRead("EXPORT_PATH", out output)) { 15 | Debug.LogFormat("export package : {0}", output); 16 | var b = new PackageBuilder(); 17 | b.Build(output); 18 | } 19 | } 20 | 21 | /// 22 | /// 최종 빌드에서 sagiri를 지우고 싶을때 사용 23 | /// PostProcessBuildAttribute에 연결시키면된다 24 | /// 25 | public static void RemoveSteamingAssets(BuildTarget target, string pathToBuiltProject) { 26 | // https://docs.unity3d.com/ScriptReference/Callbacks.PostProcessBuildAttribute.html 27 | // http://answers.unity3d.com/questions/984854/is-it-possible-to-excluding-streamingassets-depend.html 28 | string streamingAssetsPath = null; 29 | 30 | switch (target) { 31 | case BuildTarget.StandaloneWindows: 32 | case BuildTarget.StandaloneWindows64: 33 | case BuildTarget.StandaloneLinux: 34 | case BuildTarget.StandaloneLinux64: 35 | case BuildTarget.StandaloneLinuxUniversal: { 36 | // windows and linux use "_Data" folder 37 | string root = Path.Combine(Path.GetDirectoryName(pathToBuiltProject), Path.GetFileNameWithoutExtension(pathToBuiltProject) + "_Data"); 38 | streamingAssetsPath = Path.Combine(root, "StreamingAssets"); 39 | } 40 | break; 41 | #if UNITY_2017_3_OR_NEWER 42 | case BuildTarget.StandaloneOSX: 43 | #else 44 | case BuildTarget.StandaloneOSXIntel: 45 | case BuildTarget.StandaloneOSXIntel64: 46 | case BuildTarget.StandaloneOSXUniversal: 47 | #endif 48 | { 49 | streamingAssetsPath = Path.Combine(pathToBuiltProject, "Contents"); 50 | streamingAssetsPath = Path.Combine(streamingAssetsPath, "Resources"); 51 | streamingAssetsPath = Path.Combine(streamingAssetsPath, "Data"); 52 | streamingAssetsPath = Path.Combine(streamingAssetsPath, "StreamingAssets"); 53 | } 54 | break; 55 | } 56 | 57 | if (streamingAssetsPath == null || !Directory.Exists(streamingAssetsPath)) 58 | return; 59 | 60 | var sagiriPath = Path.Combine(streamingAssetsPath, "Sagiri"); 61 | Directory.Delete(sagiriPath, true); 62 | 63 | var contents = Directory.GetFileSystemEntries(streamingAssetsPath); 64 | if(contents.Length == 0) { 65 | Directory.Delete(streamingAssetsPath, true); 66 | } 67 | } 68 | } 69 | } 70 | #endif 71 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Editor/PackageExporter.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEditor; 5 | using UnityEngine; 6 | 7 | /* 8 | * https://github.com/5minlab/minamo/blob/master/UnityProject/Assets/Minamo/Editor/Menu_PackageExporter.cs 9 | */ 10 | 11 | namespace Assets.Sagiri.Editor { 12 | class PackageBuilder { 13 | internal bool Build(string output) { 14 | var assets = GetAssetPaths(); 15 | AssetDatabase.ExportPackage(assets, output); 16 | return true; 17 | } 18 | 19 | internal string[] GetAssetPaths() { 20 | var assetPaths = new List(); 21 | assetPaths.AddRange(GetScripts()); 22 | assetPaths.AddRange(GetAssets()); 23 | return assetPaths.ToArray(); 24 | } 25 | 26 | string[] GetScripts() { 27 | var dirs = new List() 28 | { 29 | "Assets/Sagiri", 30 | "Assets/Sagiri/Prefabs", 31 | "Assets/Sagiri/Examples", 32 | "Assets/Sagiri/Editor", 33 | }; 34 | var founds = AssetDatabase.FindAssets("", dirs.ToArray()); 35 | var set = new HashSet(); 36 | foreach (var guid in founds) { 37 | var assetPath = AssetDatabase.GUIDToAssetPath(guid); 38 | var ext = Path.GetExtension(assetPath); 39 | var dirname = Path.GetDirectoryName(assetPath); 40 | if (dirs.Contains(dirname) && ext != "") { 41 | set.Add(assetPath); 42 | } 43 | } 44 | 45 | var list = new List(); 46 | list.AddRange(set); 47 | list.Sort(); 48 | return list.ToArray(); 49 | } 50 | 51 | string[] GetAssets() { 52 | var dirs = new string[] 53 | { 54 | "Assets/StreamingAssets/Sagiri", 55 | }; 56 | var founds = AssetDatabase.FindAssets("", dirs); 57 | var set = new HashSet(); 58 | foreach (var guid in founds) { 59 | var assetPath = AssetDatabase.GUIDToAssetPath(guid); 60 | var ext = Path.GetExtension(assetPath); 61 | if (ext == ".html" || ext == ".ico" || ext == ".js" || ext == ".css") { 62 | set.Add(assetPath); 63 | } 64 | } 65 | 66 | var list = new List(); 67 | list.AddRange(set); 68 | list.Sort(); 69 | return list.ToArray(); 70 | } 71 | } 72 | 73 | class PackageExporter : ScriptableWizard { 74 | [SerializeField] 75 | string[] assets = null; 76 | 77 | [MenuItem("Window/Sagiri/Export package")] 78 | static void Export() { 79 | ScriptableWizard.DisplayWizard("Exporter", typeof(PackageExporter), "Export"); 80 | } 81 | 82 | private void OnWizardUpdate() { 83 | var b = new PackageBuilder(); 84 | assets = b.GetAssetPaths(); 85 | } 86 | 87 | private void OnWizardCreate() { 88 | string targetFilePath = EditorUtility.SaveFilePanel("Save package", "", "Sagiri", "unitypackage"); 89 | if (targetFilePath == "") { 90 | return; 91 | } 92 | AssetDatabase.ExportPackage(assets, targetFilePath); 93 | } 94 | } 95 | } 96 | #endif 97 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/JsonWriter.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text; 3 | 4 | namespace Assets.Sagiri { 5 | interface IJsonSerializable { 6 | void AppendJson(StringBuilder sb); 7 | } 8 | 9 | public class JsonString : IJsonSerializable { 10 | readonly string val; 11 | 12 | public JsonString(string val) { 13 | this.val = val; 14 | } 15 | public void AppendJson(StringBuilder sb) { 16 | var content = Filter(val); 17 | sb.Append("\""); 18 | sb.Append(content); 19 | sb.Append("\""); 20 | } 21 | 22 | struct ReplaceTuple { 23 | public string prev; 24 | public string next; 25 | public ReplaceTuple(string prev, string next) { 26 | this.prev = prev; 27 | this.next = next; 28 | } 29 | } 30 | 31 | static readonly ReplaceTuple[] tuples = new ReplaceTuple[] 32 | { 33 | // \n은 무시. \n으로 충분할거다 34 | new ReplaceTuple("\r", ""), 35 | 36 | // priority 37 | new ReplaceTuple(@"\", @"\\"), 38 | new ReplaceTuple(@"""", @"\"""), 39 | 40 | new ReplaceTuple("\b", "\\b"), 41 | new ReplaceTuple("\f", "\\f"), 42 | new ReplaceTuple("\n", "\\n"), 43 | new ReplaceTuple("\t", "\\t"), 44 | }; 45 | 46 | public static string Filter(string val) { 47 | var sb = new StringBuilder(val); 48 | foreach (var t in tuples) { 49 | sb.Replace(t.prev, t.next); 50 | } 51 | return sb.ToString(); 52 | } 53 | } 54 | 55 | class JsonInt : IJsonSerializable { 56 | readonly int val; 57 | public JsonInt(int val) { 58 | this.val = val; 59 | } 60 | public void AppendJson(StringBuilder sb) { 61 | sb.Append(val); 62 | } 63 | } 64 | 65 | class JsonArray : IJsonSerializable { 66 | readonly List list = new List(); 67 | public void Add(IJsonSerializable v) { 68 | list.Add(v); 69 | } 70 | 71 | public void Clear() { 72 | list.Clear(); 73 | } 74 | 75 | public void AppendJson(StringBuilder sb) { 76 | sb.Append("["); 77 | for (int i = 0; i < list.Count; i++) { 78 | var r = list[i]; 79 | r.AppendJson(sb); 80 | if (i < list.Count - 1) { 81 | sb.Append(","); 82 | } 83 | } 84 | sb.Append("]"); 85 | } 86 | } 87 | 88 | class JsonObject : IJsonSerializable { 89 | class Pair { 90 | public string key; 91 | public IJsonSerializable value; 92 | public Pair(string key, IJsonSerializable val) { 93 | this.key = key; 94 | this.value = val; 95 | } 96 | } 97 | 98 | readonly List pairs = new List(); 99 | 100 | public IJsonSerializable this[string key] 101 | { 102 | set 103 | { 104 | var p = new Pair(key, value); 105 | pairs.Add(p); 106 | } 107 | } 108 | 109 | public void Clear() { 110 | pairs.Clear(); 111 | } 112 | 113 | public void AppendJson(StringBuilder sb) { 114 | sb.Append("{"); 115 | for(int i = 0; i < pairs.Count; i++) { 116 | var p = pairs[i]; 117 | 118 | sb.Append("\""); 119 | sb.Append(p.key); 120 | sb.Append("\""); 121 | 122 | sb.Append(":"); 123 | 124 | p.value.AppendJson(sb); 125 | 126 | if(i < pairs.Count-1) { 127 | sb.Append(","); 128 | } 129 | } 130 | sb.Append("}"); 131 | } 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/StreamingAssets/Sagiri/console.css: -------------------------------------------------------------------------------- 1 | html, 2 | body, 3 | div, 4 | span { 5 | margin: 0; 6 | padding: 0; 7 | border: 0; 8 | outline: 0; 9 | font-weight: inherit; 10 | font-style: inherit; 11 | font-size: 100%; 12 | font-family: Verdana, "helvetica neue", Helvetica, Arial, sans-serif; 13 | vertical-align: baseline; 14 | } 15 | 16 | body { 17 | font-size: 14px; 18 | line-height: 1.25; 19 | color: black; 20 | background-color: #2c3e50; 21 | color: #bdc3c7; 22 | } 23 | 24 | ol, 25 | ul { 26 | list-style: none; 27 | padding-left: 20px; 28 | font-size: 1.4em; 29 | line-height: 1.4em; 30 | } 31 | 32 | ul ul { 33 | font-size: 1em; 34 | } 35 | 36 | button { 37 | background: #e3e3e3; 38 | border: 1px solid #bbb; 39 | border-radius: 3px; 40 | -webkit-box-shadow: inset 0 0 1px 1px #f6f6f6; 41 | box-shadow: inset 0 0 1px 1px #f6f6f6; 42 | color: #333; 43 | font: bold 12px/1 Verdana, "helvetica neue", helvetica, arial, sans-serif; 44 | padding: 4px 8px; 45 | text-align: center; 46 | cursor: pointer; 47 | } 48 | 49 | button:hover { 50 | background: #d9d9d9; 51 | -webkit-box-shadow: inset 0 0 1px 1px #eaeaea; 52 | box-shadow: inset 0 0 1px 1px #eaeaea; 53 | color: #222; 54 | } 55 | 56 | button:active { 57 | background: #d0d0d0; 58 | -webkit-box-shadow: inset 0 0 1px 1px #e3e3e3; 59 | box-shadow: inset 0 0 1px 1px #e3e3e3; 60 | color: #000; 61 | } 62 | 63 | #sidePanel { 64 | display: block; 65 | position: fixed; 66 | width: 20%; 67 | height: 100%; 68 | overflow: auto; 69 | } 70 | 71 | #side-title a, 72 | #side-title a:visited { 73 | color: #fff; 74 | text-decoration: none; 75 | font-size: 1.2em; 76 | font-weight: bold; 77 | } 78 | 79 | #side-title, 80 | #systemInfo, 81 | #loadLog { 82 | margin: 0 0 10px 0; 83 | line-height: 1.25; 84 | padding: 10px; 85 | border-bottom: 1px solid #bdc3c7; 86 | } 87 | 88 | #large { 89 | padding: 0 7px; 90 | font-size: 125%; 91 | } 92 | 93 | #large p { 94 | padding: 5px; 95 | border: 2px solid #d62728; 96 | border-radius: 5px; 97 | } 98 | 99 | #systemInfo #title, 100 | #systemInfo #system, 101 | #systemInfo #started, 102 | #systemInfo #ended { 103 | display: block; 104 | } 105 | 106 | #search { 107 | display: block; 108 | margin: 0 auto; 109 | width: 90%; 110 | border-radius: 4px; 111 | padding: 5px; 112 | } 113 | 114 | #mainPanel { 115 | display: block; 116 | width: 80%; 117 | margin-left: 20%; 118 | overflow: auto; 119 | } 120 | 121 | .entry { 122 | margin: 5px; 123 | background-color: #bdc3c7; 124 | color: #222; 125 | border-radius: 2px; 126 | } 127 | 128 | .timestamp { 129 | padding: 5px; 130 | display: block; 131 | float: right; 132 | } 133 | 134 | .message { 135 | padding: 5px; 136 | display: block; 137 | } 138 | 139 | .stackBtn { 140 | margin-right: 10px; 141 | } 142 | 143 | .stack { 144 | display: block; 145 | background-color: #f0f0f0; 146 | padding: 10px; 147 | color: #2c3e50; 148 | border-bottom-left-radius: 2px; 149 | border-bottom-right-radius: 2px; 150 | } 151 | 152 | .legend { 153 | display: inline-block; 154 | width: 0.75em; 155 | height: 0.75em; 156 | margin: 0 8px; 157 | } 158 | 159 | .repo { 160 | display: block; 161 | position: fixed; 162 | bottom: 30px; 163 | left: 10px; 164 | } 165 | 166 | .repo a { 167 | text-decoration: none; 168 | color: inherit; 169 | } 170 | 171 | .issues { 172 | display: block; 173 | position: fixed; 174 | bottom: 10px; 175 | left: 10px; 176 | } 177 | 178 | .issues a { 179 | text-decoration: none; 180 | color: inherit; 181 | } 182 | 183 | .hidden { 184 | display: none; 185 | } 186 | 187 | .error { 188 | background-color: #d62728; 189 | } 190 | 191 | .exception { 192 | background-color: #ff9896; 193 | } 194 | 195 | .warning { 196 | background-color: #f1c40f; 197 | } 198 | 199 | .system { 200 | background-color: #17becf; 201 | } 202 | 203 | .assert { 204 | background-color: #ff7f0e; 205 | } 206 | 207 | .log { 208 | background-color: #c7c7c7; 209 | } 210 | 211 | .ai { 212 | background-color: #aec7e8; 213 | } 214 | 215 | .audio { 216 | background-color: #ffbb78; 217 | } 218 | 219 | .content { 220 | background-color: #2ca02c; 221 | } 222 | 223 | .logic { 224 | background-color: #98df8a; 225 | } 226 | 227 | .gui { 228 | background-color: #9467bd; 229 | } 230 | 231 | .input { 232 | background-color: #9edae5; 233 | } 234 | 235 | .network { 236 | background-color: #c49c94; 237 | } 238 | 239 | .physics { 240 | background-color: #e377c2; 241 | } 242 | 243 | .count { 244 | background-color: transparent; 245 | font-size: 0.7em; 246 | } 247 | 248 | .icon { 249 | vertical-align: middle; 250 | margin-right: 3px; 251 | width: 1em; 252 | height: 1em; 253 | display: inline-block; 254 | } 255 | 256 | #sidePanel .icon { 257 | fill: #bdc3c7; 258 | } 259 | 260 | #mainPanel .icon { 261 | fill: #222; 262 | } 263 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/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 | Switch: 5 174 | Tizen: 2 175 | Web: 5 176 | WebGL: 3 177 | WiiU: 5 178 | Windows Store Apps: 5 179 | XboxOne: 5 180 | iPhone: 2 181 | tvOS: 2 182 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/CommandTree.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text.RegularExpressions; 5 | 6 | namespace Assets.Sagiri { 7 | class CommandTree : IEnumerable { 8 | 9 | private Dictionary m_subcommands; 10 | private CommandAttribute m_command; 11 | 12 | public CommandTree() { 13 | m_subcommands = new Dictionary(); 14 | } 15 | 16 | public void Add(CommandAttribute cmd) { 17 | _add(cmd.m_command.ToLower().Split(' '), 0, cmd); 18 | } 19 | 20 | private void _add(string[] commands, int command_index, CommandAttribute cmd) { 21 | if (commands.Length == command_index) { 22 | m_command = cmd; 23 | return; 24 | } 25 | 26 | string token = commands[command_index]; 27 | if (!m_subcommands.ContainsKey(token)) { 28 | m_subcommands[token] = new CommandTree(); 29 | } 30 | m_subcommands[token]._add(commands, command_index + 1, cmd); 31 | } 32 | 33 | public IEnumerator GetEnumerator() { 34 | if (m_command != null && m_command.m_command != null) 35 | yield return m_command; 36 | 37 | foreach (KeyValuePair entry in m_subcommands) { 38 | foreach (CommandAttribute cmd in entry.Value) { 39 | if (cmd != null && cmd.m_command != null) 40 | yield return cmd; 41 | } 42 | } 43 | } 44 | 45 | IEnumerator IEnumerable.GetEnumerator() { 46 | return GetEnumerator(); 47 | } 48 | 49 | public string Complete(string partialCommand) { 50 | return _complete(partialCommand.Split(' '), 0, ""); 51 | } 52 | 53 | public string _complete(string[] partialCommand, int index, string result) { 54 | if (partialCommand.Length == index && m_command != null) { 55 | // this is a valid command... so we do nothing 56 | return result; 57 | } else if (partialCommand.Length == index) { 58 | // This is valid but incomplete.. print all of the subcommands 59 | Shell.LogCommand(result); 60 | foreach (string key in m_subcommands.Keys.OrderBy(m => m)) { 61 | Shell.Log(result + " " + key); 62 | } 63 | return result + " "; 64 | } else if (partialCommand.Length == (index + 1)) { 65 | string partial = partialCommand[index]; 66 | if (m_subcommands.ContainsKey(partial)) { 67 | result += partial; 68 | return m_subcommands[partial]._complete(partialCommand, index + 1, result); 69 | } 70 | 71 | // Find any subcommands that match our partial command 72 | List matches = new List(); 73 | foreach (string key in m_subcommands.Keys.OrderBy(m => m)) { 74 | if (key.StartsWith(partial)) { 75 | matches.Add(key); 76 | } 77 | } 78 | 79 | if (matches.Count == 1) { 80 | // Only one command found, log nothing and return the complete command for the user input 81 | return result + matches[0] + " "; 82 | } else if (matches.Count > 1) { 83 | // list all the options for the user and return partial 84 | Shell.LogCommand(result + partial); 85 | foreach (string match in matches) { 86 | Shell.Log(result + match); 87 | } 88 | } 89 | return result + partial; 90 | } 91 | 92 | string token = partialCommand[index]; 93 | if (!m_subcommands.ContainsKey(token)) { 94 | return result; 95 | } 96 | result += token + " "; 97 | return m_subcommands[token]._complete(partialCommand, index + 1, result); 98 | } 99 | 100 | public void Run(string commandStr) { 101 | // Split user input on spaces ignoring anything in qoutes 102 | Regex regex = new Regex(@""".*?""|[^\s]+"); 103 | MatchCollection matches = regex.Matches(commandStr); 104 | string[] tokens = new string[matches.Count]; 105 | for (int i = 0; i < tokens.Length; ++i) { 106 | tokens[i] = matches[i].Value.Replace("\"", ""); 107 | } 108 | _run(tokens, 0); 109 | } 110 | 111 | static string[] emptyArgs = new string[0] { }; 112 | private void _run(string[] commands, int index) { 113 | if (commands.Length == index) { 114 | RunCommand(emptyArgs); 115 | return; 116 | } 117 | 118 | string token = commands[index].ToLower(); 119 | if (!m_subcommands.ContainsKey(token)) { 120 | RunCommand(commands.Skip(index).ToArray()); 121 | return; 122 | } 123 | m_subcommands[token]._run(commands, index + 1); 124 | } 125 | 126 | private void RunCommand(string[] args) { 127 | if (m_command == null) { 128 | Shell.Log("command not found"); 129 | } else if (m_command.m_runOnMainThread) { 130 | Shell.Queue(m_command, args); 131 | } else { 132 | m_command.m_callback(args); 133 | } 134 | } 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/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 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Shell.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Net; 5 | using System.Reflection; 6 | using UnityEngine; 7 | 8 | namespace Assets.Sagiri { 9 | struct QueuedCommand { 10 | public CommandAttribute command; 11 | public string[] args; 12 | } 13 | 14 | class Shell { 15 | static Shell Instance = new Shell(); 16 | 17 | /// 18 | /// Max number of lines in the console output 19 | /// 20 | const int MAX_LINES = 100; 21 | 22 | /// 23 | /// Maximum number of commands stored in the history 24 | /// 25 | const int MAX_HISTORY = 50; 26 | 27 | /// 28 | /// Prefix for user inputted command 29 | /// 30 | const string COMMAND_OUTPUT_PREFIX = "> "; 31 | 32 | readonly CommandTree m_commands = new CommandTree(); 33 | readonly Queue m_commandQueue = new Queue(); 34 | readonly List m_history = new List(); 35 | readonly List m_output = new List(); 36 | 37 | public Shell() { 38 | RegisterAttributes(); 39 | } 40 | 41 | /* Logs user input to output */ 42 | public static void LogCommand(string cmd) { 43 | Log(COMMAND_OUTPUT_PREFIX + cmd); 44 | } 45 | 46 | /* Logs string to output */ 47 | public static void Log(string str) { 48 | Instance.m_output.Add(str); 49 | if (Instance.m_output.Count > MAX_LINES) { 50 | Instance.m_output.RemoveAt(0); 51 | } 52 | } 53 | 54 | /* Find command based on partial string */ 55 | public static string Complete(string partialCommand) { 56 | return Instance.m_commands.Complete(partialCommand); 57 | } 58 | 59 | /* Get a previously ran command from the history */ 60 | public static string PreviousCommand(int index) { 61 | return index >= 0 && index < Instance.m_history.Count ? Instance.m_history[index] : null; 62 | } 63 | 64 | public static void Update() { 65 | while (Instance.m_commandQueue.Count > 0) { 66 | QueuedCommand cmd = Instance.m_commandQueue.Dequeue(); 67 | cmd.command.m_callback(cmd.args); 68 | } 69 | } 70 | 71 | /* Returns the output */ 72 | public static string Output() { 73 | return string.Join("\n", Instance.m_output.ToArray()); 74 | } 75 | 76 | /* Register a new console command */ 77 | public static void RegisterCommand(string command, string desc, CommandAttribute.Callback callback, bool runOnMainThread = true) { 78 | if (command == null || command.Length == 0) { 79 | throw new Exception("Command String cannot be empty"); 80 | } 81 | 82 | CommandAttribute cmd = new CommandAttribute(command, desc, runOnMainThread); 83 | cmd.m_callback = callback; 84 | 85 | Instance.m_commands.Add(cmd); 86 | } 87 | 88 | /* Queue a command to be executed on update on the main thread */ 89 | public static void Queue(CommandAttribute command, string[] args) { 90 | QueuedCommand queuedCommand = new QueuedCommand(); 91 | queuedCommand.command = command; 92 | queuedCommand.args = args; 93 | Instance.m_commandQueue.Enqueue(queuedCommand); 94 | } 95 | 96 | /* Update history with a new command */ 97 | private void RecordCommand(string command) { 98 | m_history.Insert(0, command); 99 | if (m_history.Count > MAX_HISTORY) 100 | m_history.RemoveAt(m_history.Count - 1); 101 | } 102 | 103 | /* Execute a command */ 104 | public static void Run(string str) { 105 | if (str.Length > 0) { 106 | LogCommand(str); 107 | Instance.RecordCommand(str); 108 | Instance.m_commands.Run(str); 109 | } 110 | } 111 | 112 | private void RegisterAttributes() { 113 | #if !NETFX_CORE 114 | foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) { 115 | // HACK: IL2CPP crashes if you attempt to get the methods of some classes in these assemblies. 116 | if (assembly.FullName.StartsWith("System") || assembly.FullName.StartsWith("mscorlib")) { 117 | continue; 118 | } 119 | foreach (Type type in assembly.GetTypes()) { 120 | // FIXME add support for non-static methods (FindObjectByType?) 121 | foreach (MethodInfo method in type.GetMethods(BindingFlags.Public | BindingFlags.Static)) { 122 | CommandAttribute[] attrs = method.GetCustomAttributes(typeof(CommandAttribute), true) as CommandAttribute[]; 123 | if (attrs.Length == 0) 124 | continue; 125 | 126 | CommandAttribute.Callback cb = Delegate.CreateDelegate(typeof(CommandAttribute.Callback), method, false) as CommandAttribute.Callback; 127 | if (cb == null) { 128 | CommandAttribute.CallbackSimple cbs = Delegate.CreateDelegate(typeof(CommandAttribute.CallbackSimple), method, false) as CommandAttribute.CallbackSimple; 129 | if (cbs != null) { 130 | cb = delegate (string[] args) { 131 | cbs(); 132 | }; 133 | } 134 | } 135 | 136 | if (cb == null) { 137 | Debug.LogError(string.Format("Method {0}.{1} takes the wrong arguments for a console command.", type, method.Name)); 138 | continue; 139 | } 140 | 141 | // try with a bare action 142 | foreach (CommandAttribute cmd in attrs) { 143 | if (string.IsNullOrEmpty(cmd.m_command)) { 144 | Debug.LogError(string.Format("Method {0}.{1} needs a valid command name.", type, method.Name)); 145 | continue; 146 | } 147 | 148 | cmd.m_callback = cb; 149 | m_commands.Add(cmd); 150 | } 151 | } 152 | } 153 | } 154 | #endif 155 | } 156 | 157 | #if !NETFX_CORE 158 | /* Clear all output from console */ 159 | [Command("clear", "clears console output", false)] 160 | public static void Clear() { 161 | Instance.m_output.Clear(); 162 | } 163 | 164 | /* Print a list of all console commands */ 165 | [Command("help", "prints commands", false)] 166 | public static void Help() { 167 | 168 | string help = "Commands:"; 169 | foreach (CommandAttribute cmd in Instance.m_commands.OrderBy(m => m.m_command)) { 170 | help += string.Format("\n{0} : {1}", cmd.m_command, cmd.m_help); 171 | } 172 | 173 | Log(help); 174 | } 175 | 176 | [Route("^/shell/out$")] 177 | public static void Output(RequestContext context) { 178 | context.Response.WriteString(Output()); 179 | } 180 | 181 | [Route("^/shell/run$")] 182 | public static void Run(RequestContext context) { 183 | string command = Uri.UnescapeDataString(context.Request.QueryString.Get("command")); 184 | if (!string.IsNullOrEmpty(command)) 185 | Run(command); 186 | 187 | context.Response.StatusCode = (int)HttpStatusCode.OK; 188 | context.Response.StatusDescription = "OK"; 189 | } 190 | 191 | [Route("^/shell/commandHistory$")] 192 | public static void History(RequestContext context) { 193 | string index = context.Request.QueryString.Get("index"); 194 | 195 | string previous = null; 196 | if (!string.IsNullOrEmpty(index)) 197 | previous = PreviousCommand(System.Int32.Parse(index)); 198 | 199 | context.Response.WriteString(previous); 200 | } 201 | 202 | [Route("^/shell/complete$")] 203 | public static void Complete(RequestContext context) { 204 | string partialCommand = context.Request.QueryString.Get("command"); 205 | 206 | string found = null; 207 | if (partialCommand != null) 208 | found = Complete(partialCommand); 209 | 210 | context.Response.WriteString(found); 211 | } 212 | #endif 213 | } 214 | } 215 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Examples/SagiriExample.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 8 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1} 42 | --- !u!157 &3 43 | LightmapSettings: 44 | m_ObjectHideFlags: 0 45 | serializedVersion: 9 46 | m_GIWorkflowMode: 0 47 | m_GISettings: 48 | serializedVersion: 2 49 | m_BounceScale: 1 50 | m_IndirectOutputScale: 1 51 | m_AlbedoBoost: 1 52 | m_TemporalCoherenceThreshold: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 1 55 | m_EnableRealtimeLightmaps: 1 56 | m_LightmapEditorSettings: 57 | serializedVersion: 8 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_TextureWidth: 1024 61 | m_TextureHeight: 1024 62 | m_AO: 0 63 | m_AOMaxDistance: 1 64 | m_CompAOExponent: 1 65 | m_CompAOExponentDirect: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 3 75 | m_BakeBackend: 0 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 500 79 | m_PVRBounces: 2 80 | m_PVRFiltering: 0 81 | m_PVRFilteringMode: 1 82 | m_PVRCulling: 1 83 | m_PVRFilteringGaussRadiusDirect: 1 84 | m_PVRFilteringGaussRadiusIndirect: 5 85 | m_PVRFilteringGaussRadiusAO: 2 86 | m_PVRFilteringAtrousColorSigma: 1 87 | m_PVRFilteringAtrousNormalSigma: 1 88 | m_PVRFilteringAtrousPositionSigma: 1 89 | m_LightingDataAsset: {fileID: 0} 90 | m_ShadowMaskMode: 2 91 | --- !u!196 &4 92 | NavMeshSettings: 93 | serializedVersion: 2 94 | m_ObjectHideFlags: 0 95 | m_BuildSettings: 96 | serializedVersion: 2 97 | agentTypeID: 0 98 | agentRadius: 0.5 99 | agentHeight: 2 100 | agentSlope: 45 101 | agentClimb: 0.4 102 | ledgeDropHeight: 0 103 | maxJumpAcrossDistance: 0 104 | minRegionArea: 2 105 | manualCellSize: 0 106 | cellSize: 0.16666667 107 | manualTileSize: 0 108 | tileSize: 256 109 | accuratePlacement: 0 110 | m_NavMeshData: {fileID: 0} 111 | --- !u!1 &157700340 112 | GameObject: 113 | m_ObjectHideFlags: 0 114 | m_PrefabParentObject: {fileID: 0} 115 | m_PrefabInternal: {fileID: 0} 116 | serializedVersion: 5 117 | m_Component: 118 | - component: {fileID: 157700342} 119 | - component: {fileID: 157700341} 120 | m_Layer: 0 121 | m_Name: Directional Light 122 | m_TagString: Untagged 123 | m_Icon: {fileID: 0} 124 | m_NavMeshLayer: 0 125 | m_StaticEditorFlags: 0 126 | m_IsActive: 1 127 | --- !u!108 &157700341 128 | Light: 129 | m_ObjectHideFlags: 0 130 | m_PrefabParentObject: {fileID: 0} 131 | m_PrefabInternal: {fileID: 0} 132 | m_GameObject: {fileID: 157700340} 133 | m_Enabled: 1 134 | serializedVersion: 8 135 | m_Type: 1 136 | m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} 137 | m_Intensity: 1 138 | m_Range: 10 139 | m_SpotAngle: 30 140 | m_CookieSize: 10 141 | m_Shadows: 142 | m_Type: 2 143 | m_Resolution: -1 144 | m_CustomResolution: -1 145 | m_Strength: 1 146 | m_Bias: 0.05 147 | m_NormalBias: 0.4 148 | m_NearPlane: 0.2 149 | m_Cookie: {fileID: 0} 150 | m_DrawHalo: 0 151 | m_Flare: {fileID: 0} 152 | m_RenderMode: 0 153 | m_CullingMask: 154 | serializedVersion: 2 155 | m_Bits: 4294967295 156 | m_Lightmapping: 4 157 | m_AreaSize: {x: 1, y: 1} 158 | m_BounceIntensity: 1 159 | m_ColorTemperature: 6570 160 | m_UseColorTemperature: 0 161 | m_ShadowRadius: 0 162 | m_ShadowAngle: 0 163 | --- !u!4 &157700342 164 | Transform: 165 | m_ObjectHideFlags: 0 166 | m_PrefabParentObject: {fileID: 0} 167 | m_PrefabInternal: {fileID: 0} 168 | m_GameObject: {fileID: 157700340} 169 | m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} 170 | m_LocalPosition: {x: 0, y: 3, z: 0} 171 | m_LocalScale: {x: 1, y: 1, z: 1} 172 | m_Children: [] 173 | m_Father: {fileID: 0} 174 | m_RootOrder: 2 175 | m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} 176 | --- !u!1 &255209724 177 | GameObject: 178 | m_ObjectHideFlags: 0 179 | m_PrefabParentObject: {fileID: 0} 180 | m_PrefabInternal: {fileID: 0} 181 | serializedVersion: 5 182 | m_Component: 183 | - component: {fileID: 255209729} 184 | - component: {fileID: 255209728} 185 | - component: {fileID: 255209727} 186 | - component: {fileID: 255209726} 187 | - component: {fileID: 255209725} 188 | m_Layer: 0 189 | m_Name: Main Camera 190 | m_TagString: MainCamera 191 | m_Icon: {fileID: 0} 192 | m_NavMeshLayer: 0 193 | m_StaticEditorFlags: 0 194 | m_IsActive: 1 195 | --- !u!81 &255209725 196 | AudioListener: 197 | m_ObjectHideFlags: 0 198 | m_PrefabParentObject: {fileID: 0} 199 | m_PrefabInternal: {fileID: 0} 200 | m_GameObject: {fileID: 255209724} 201 | m_Enabled: 1 202 | --- !u!124 &255209726 203 | Behaviour: 204 | m_ObjectHideFlags: 0 205 | m_PrefabParentObject: {fileID: 0} 206 | m_PrefabInternal: {fileID: 0} 207 | m_GameObject: {fileID: 255209724} 208 | m_Enabled: 1 209 | --- !u!92 &255209727 210 | Behaviour: 211 | m_ObjectHideFlags: 0 212 | m_PrefabParentObject: {fileID: 0} 213 | m_PrefabInternal: {fileID: 0} 214 | m_GameObject: {fileID: 255209724} 215 | m_Enabled: 1 216 | --- !u!20 &255209728 217 | Camera: 218 | m_ObjectHideFlags: 0 219 | m_PrefabParentObject: {fileID: 0} 220 | m_PrefabInternal: {fileID: 0} 221 | m_GameObject: {fileID: 255209724} 222 | m_Enabled: 1 223 | serializedVersion: 2 224 | m_ClearFlags: 1 225 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 226 | m_NormalizedViewPortRect: 227 | serializedVersion: 2 228 | x: 0 229 | y: 0 230 | width: 1 231 | height: 1 232 | near clip plane: 0.3 233 | far clip plane: 1000 234 | field of view: 60 235 | orthographic: 0 236 | orthographic size: 5 237 | m_Depth: -1 238 | m_CullingMask: 239 | serializedVersion: 2 240 | m_Bits: 4294967295 241 | m_RenderingPath: -1 242 | m_TargetTexture: {fileID: 0} 243 | m_TargetDisplay: 0 244 | m_TargetEye: 3 245 | m_HDR: 1 246 | m_AllowMSAA: 1 247 | m_ForceIntoRT: 0 248 | m_OcclusionCulling: 1 249 | m_StereoConvergence: 10 250 | m_StereoSeparation: 0.022 251 | m_StereoMirrorMode: 0 252 | --- !u!4 &255209729 253 | Transform: 254 | m_ObjectHideFlags: 0 255 | m_PrefabParentObject: {fileID: 0} 256 | m_PrefabInternal: {fileID: 0} 257 | m_GameObject: {fileID: 255209724} 258 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 259 | m_LocalPosition: {x: 0, y: 1, z: -10} 260 | m_LocalScale: {x: 1, y: 1, z: 1} 261 | m_Children: [] 262 | m_Father: {fileID: 0} 263 | m_RootOrder: 1 264 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 265 | --- !u!1001 &703316931 266 | Prefab: 267 | m_ObjectHideFlags: 0 268 | serializedVersion: 2 269 | m_Modification: 270 | m_TransformParent: {fileID: 0} 271 | m_Modifications: 272 | - target: {fileID: 400000, guid: 921f21092a415734da4892e17f535113, type: 2} 273 | propertyPath: m_LocalPosition.x 274 | value: 0 275 | objectReference: {fileID: 0} 276 | - target: {fileID: 400000, guid: 921f21092a415734da4892e17f535113, type: 2} 277 | propertyPath: m_LocalPosition.y 278 | value: 0 279 | objectReference: {fileID: 0} 280 | - target: {fileID: 400000, guid: 921f21092a415734da4892e17f535113, type: 2} 281 | propertyPath: m_LocalPosition.z 282 | value: 0 283 | objectReference: {fileID: 0} 284 | - target: {fileID: 400000, guid: 921f21092a415734da4892e17f535113, type: 2} 285 | propertyPath: m_LocalRotation.x 286 | value: 0 287 | objectReference: {fileID: 0} 288 | - target: {fileID: 400000, guid: 921f21092a415734da4892e17f535113, type: 2} 289 | propertyPath: m_LocalRotation.y 290 | value: 0 291 | objectReference: {fileID: 0} 292 | - target: {fileID: 400000, guid: 921f21092a415734da4892e17f535113, type: 2} 293 | propertyPath: m_LocalRotation.z 294 | value: 0 295 | objectReference: {fileID: 0} 296 | - target: {fileID: 400000, guid: 921f21092a415734da4892e17f535113, type: 2} 297 | propertyPath: m_LocalRotation.w 298 | value: 1 299 | objectReference: {fileID: 0} 300 | - target: {fileID: 400000, guid: 921f21092a415734da4892e17f535113, type: 2} 301 | propertyPath: m_RootOrder 302 | value: 0 303 | objectReference: {fileID: 0} 304 | m_RemovedComponents: [] 305 | m_ParentPrefab: {fileID: 100100000, guid: 921f21092a415734da4892e17f535113, type: 2} 306 | m_IsPrefabParent: 0 307 | --- !u!1 &1959070184 308 | GameObject: 309 | m_ObjectHideFlags: 0 310 | m_PrefabParentObject: {fileID: 0} 311 | m_PrefabInternal: {fileID: 0} 312 | serializedVersion: 5 313 | m_Component: 314 | - component: {fileID: 1959070186} 315 | - component: {fileID: 1959070185} 316 | m_Layer: 0 317 | m_Name: Main 318 | m_TagString: Untagged 319 | m_Icon: {fileID: 0} 320 | m_NavMeshLayer: 0 321 | m_StaticEditorFlags: 0 322 | m_IsActive: 1 323 | --- !u!114 &1959070185 324 | MonoBehaviour: 325 | m_ObjectHideFlags: 0 326 | m_PrefabParentObject: {fileID: 0} 327 | m_PrefabInternal: {fileID: 0} 328 | m_GameObject: {fileID: 1959070184} 329 | m_Enabled: 1 330 | m_EditorHideFlags: 0 331 | m_Script: {fileID: 11500000, guid: 8e5d2b1578161fe468f98cd3b9ee0ab5, type: 3} 332 | m_Name: 333 | m_EditorClassIdentifier: 334 | --- !u!4 &1959070186 335 | Transform: 336 | m_ObjectHideFlags: 0 337 | m_PrefabParentObject: {fileID: 0} 338 | m_PrefabInternal: {fileID: 0} 339 | m_GameObject: {fileID: 1959070184} 340 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 341 | m_LocalPosition: {x: 0, y: 0, z: 0} 342 | m_LocalScale: {x: 1, y: 1, z: 1} 343 | m_Children: [] 344 | m_Father: {fileID: 0} 345 | m_RootOrder: 3 346 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 347 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/StreamingAssets/Sagiri/console.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Sagiri 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 57 | 58 | 59 | 60 | 61 | 63 | 64 | 65 | 66 | 67 | 69 | 70 | 71 | 72 | 73 | 75 | 76 | 77 | 78 | 79 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 93 | 94 | 95 | 96 | 98 | 99 | 100 | 101 | 102 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 |
112 |
113 | Sagiri 114 |
115 |
116 | 117 |
118 | 119 |
120 |
121 | Load a file above 122 | Started: 123 | Ended: 124 | LogID: 125 |
126 |
127 | 128 |
    129 |
  • 130 |
  • 131 |
  • 132 |
  • 133 |
  • 134 |
  • 135 |
  • 136 | 137 |
      138 |
    • 139 |
    • 140 |
    • 141 |
    • 142 |
    • 143 |
    • 144 |
    • 145 |
    • 146 |
    147 |
  • 148 |
149 |
150 | 153 | 161 |
162 | 163 |
164 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/Sagiri/Server.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Net; 7 | using System.Net.Sockets; 8 | using System.Reflection; 9 | using System.Text; 10 | using System.Text.RegularExpressions; 11 | using System.Threading; 12 | using UnityEngine; 13 | 14 | namespace Assets.Sagiri { 15 | #if NETFX_CORE 16 | public class RequestContext { 17 | } 18 | #else 19 | public class RequestContext { 20 | public HttpListenerContext context; 21 | public Match match; 22 | public bool pass; 23 | public string path; 24 | public int currentRoute; 25 | 26 | public HttpListenerRequest Request { get { return context.Request; } } 27 | public HttpListenerResponse Response { get { return context.Response; } } 28 | 29 | public RequestContext(HttpListenerContext ctx) { 30 | context = ctx; 31 | match = null; 32 | pass = false; 33 | path = WWW.UnEscapeURL(context.Request.Url.AbsolutePath); 34 | if (path == "/") 35 | path = "/index.html"; 36 | currentRoute = 0; 37 | } 38 | } 39 | #endif 40 | 41 | #if !NETFX_CORE 42 | public class Server : MonoBehaviour { 43 | /// 44 | /// allow only one server object 45 | /// 46 | static Server s_instance = null; 47 | 48 | [SerializeField] 49 | int portCandidate = 55055; 50 | 51 | [SerializeField] 52 | int maxRetryCount = 10; 53 | 54 | [SerializeField] 55 | bool dontDestroyOnLoad = false; 56 | 57 | [SerializeField] 58 | [ShowOnly] 59 | int _port = -1; 60 | public int Port 61 | { 62 | get { return _port; } 63 | private set { _port = value; } 64 | } 65 | 66 | public string Host 67 | { 68 | get 69 | { 70 | #if UNITY_WSA 71 | return "127.0.0.1"; 72 | #else 73 | // error CS0619: `UnityEngine.Network' is obsolete: ` 74 | // The legacy networking system has been removed in Unity 2018.2. 75 | // Use Unity Multiplayer and NetworkIdentity instead.' 76 | // return Network.player.ipAddress; 77 | return "127.0.0.1"; 78 | #endif 79 | } 80 | } 81 | 82 | [SerializeField] 83 | public bool RegisterLogCallback = false; 84 | 85 | [SerializeField] 86 | bool showGUI = true; 87 | 88 | private static Thread mainThread; 89 | private static string fileRoot; 90 | private static HttpListener listener; 91 | private static List registeredRoutes; 92 | private static Queue mainRequests = new Queue(); 93 | 94 | // List of supported files 95 | // FIXME add an api to register new types 96 | private static Dictionary fileTypes = new Dictionary 97 | { 98 | {"js", "application/javascript"}, 99 | {"json", "application/json"}, 100 | {"jpg", "image/jpeg" }, 101 | {"jpeg", "image/jpeg"}, 102 | {"gif", "image/gif"}, 103 | {"png", "image/png"}, 104 | {"css", "text/css"}, 105 | {"htm", "text/html"}, 106 | {"html", "text/html"}, 107 | {"ico", "image/x-icon"}, 108 | }; 109 | 110 | public virtual void Awake() { 111 | // check singleton 112 | if(s_instance == null) { 113 | s_instance = this; 114 | } else { 115 | GameObject.Destroy(gameObject); 116 | return; 117 | } 118 | 119 | if(dontDestroyOnLoad) { 120 | DontDestroyOnLoad(gameObject); 121 | } 122 | 123 | mainThread = Thread.CurrentThread; 124 | fileRoot = Path.Combine(Application.streamingAssetsPath, "Sagiri"); 125 | 126 | // Start server 127 | // 이전에 사용한 서버에 문제가 생겨서 포트번호를 다시 쓸수 없을지 모른다 128 | // 그러면 다음 포트번호로 접속을 시도해보자 129 | var success = false; 130 | for(int i = 0; i < maxRetryCount; i++) { 131 | var portNum = portCandidate + i; 132 | try { 133 | listener = new HttpListener(); 134 | listener.Prefixes.Add("http://*:" + portNum + "/"); 135 | listener.Start(); 136 | listener.BeginGetContext(ListenerCallback, null); 137 | Debug.Log("Starting Sagiri Server on " + Host + ":" + portNum); 138 | 139 | success = true; 140 | Port = portNum; 141 | StartCoroutine(HandleRequests()); 142 | break; 143 | 144 | } catch (SocketException e) { 145 | Debug.LogException(e, this); 146 | Debug.LogFormat(this, "Cannot use Port {0}, use next port", portNum); 147 | } 148 | } 149 | 150 | if(!success) { 151 | Debug.Log("Cannot execute Sagiri server"); 152 | } 153 | } 154 | 155 | public void OnApplicationPause(bool paused) { 156 | if (paused) { 157 | listener.Stop(); 158 | } else { 159 | listener.Start(); 160 | listener.BeginGetContext(ListenerCallback, null); 161 | } 162 | } 163 | 164 | public virtual void OnDestroy() { 165 | if(s_instance == this) { 166 | s_instance = null; 167 | } 168 | 169 | listener.Stop(); 170 | listener.Close(); 171 | listener = null; 172 | Port = -1; 173 | } 174 | 175 | private void RegisterRoutes() { 176 | if (registeredRoutes == null) { 177 | registeredRoutes = new List(); 178 | 179 | foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) { 180 | foreach (Type type in assembly.GetTypes()) { 181 | // FIXME add support for non-static methods (FindObjectByType?) 182 | foreach (MethodInfo method in type.GetMethods(BindingFlags.Public | BindingFlags.Static)) { 183 | RouteAttribute[] attrs = method.GetCustomAttributes(typeof(RouteAttribute), true) as RouteAttribute[]; 184 | if (attrs.Length == 0) 185 | continue; 186 | 187 | RouteAttribute.Callback cbm = Delegate.CreateDelegate(typeof(RouteAttribute.Callback), method, false) as RouteAttribute.Callback; 188 | if (cbm == null) { 189 | Debug.LogError(string.Format("Method {0}.{1} takes the wrong arguments for a console route.", type, method.Name)); 190 | continue; 191 | } 192 | 193 | // try with a bare action 194 | foreach (RouteAttribute route in attrs) { 195 | if (route.m_route == null) { 196 | Debug.LogError(string.Format("Method {0}.{1} needs a valid route regexp.", type, method.Name)); 197 | continue; 198 | } 199 | 200 | route.m_callback = cbm; 201 | registeredRoutes.Add(route); 202 | } 203 | } 204 | } 205 | } 206 | RegisterFileHandlers(); 207 | } 208 | } 209 | 210 | static void FindFileType(RequestContext context, bool download, out string path, out string type) { 211 | path = Path.Combine(fileRoot, context.match.Groups[1].Value); 212 | 213 | string ext = Path.GetExtension(path).ToLower().TrimStart(new char[] { '.' }); 214 | if (download || !fileTypes.TryGetValue(ext, out type)) 215 | type = "application/octet-stream"; 216 | } 217 | 218 | 219 | public delegate void FileHandlerDelegate(RequestContext context, bool download); 220 | static void WWWFileHandler(RequestContext context, bool download) { 221 | string path, type; 222 | FindFileType(context, download, out path, out type); 223 | 224 | WWW req = new WWW(path); 225 | while (!req.isDone) { 226 | Thread.Sleep(0); 227 | } 228 | 229 | if (string.IsNullOrEmpty(req.error)) { 230 | context.Response.ContentType = type; 231 | if (download) 232 | context.Response.AddHeader("Content-disposition", string.Format("attachment; filename={0}", Path.GetFileName(path))); 233 | 234 | context.Response.WriteBytes(req.bytes); 235 | return; 236 | } 237 | 238 | if (req.error.StartsWith("Couldn't open file")) { 239 | context.pass = true; 240 | } else { 241 | context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; 242 | context.Response.StatusDescription = string.Format("Fatal error:\n{0}", req.error); 243 | } 244 | } 245 | 246 | static void FileHandler(RequestContext context, bool download) { 247 | string path, type; 248 | FindFileType(context, download, out path, out type); 249 | 250 | if (File.Exists(path)) { 251 | context.Response.WriteFile(path, type, download); 252 | } else { 253 | context.pass = true; 254 | } 255 | } 256 | 257 | static void RegisterFileHandlers() { 258 | string pattern = string.Format("({0})", string.Join("|", fileTypes.Select(x => x.Key).ToArray())); 259 | RouteAttribute downloadRoute = new RouteAttribute(string.Format(@"^/download/(.*\.{0})$", pattern)); 260 | RouteAttribute fileRoute = new RouteAttribute(string.Format(@"^/(.*\.{0})$", pattern)); 261 | 262 | bool needs_www = fileRoot.Contains("://"); 263 | downloadRoute.m_runOnMainThread = needs_www; 264 | fileRoute.m_runOnMainThread = needs_www; 265 | 266 | FileHandlerDelegate callback = FileHandler; 267 | if (needs_www) 268 | callback = WWWFileHandler; 269 | 270 | downloadRoute.m_callback = delegate (RequestContext context) { callback(context, true); }; 271 | fileRoute.m_callback = delegate (RequestContext context) { callback(context, false); }; 272 | 273 | registeredRoutes.Add(downloadRoute); 274 | registeredRoutes.Add(fileRoute); 275 | } 276 | 277 | void OnEnable() { 278 | if (RegisterLogCallback) { 279 | // Capture Console Logs 280 | Application.logMessageReceived += Console.LogCallback; 281 | } 282 | } 283 | 284 | void OnDisable() { 285 | if (RegisterLogCallback) { 286 | Application.logMessageReceived -= Console.LogCallback; 287 | } 288 | } 289 | 290 | void Update() { 291 | Shell.Update(); 292 | } 293 | 294 | string hostAndPort = ""; 295 | private void OnGUI() { 296 | if(!showGUI) { return; } 297 | 298 | if (hostAndPort == "" && Port > 0) { 299 | var sb = new StringBuilder(); 300 | sb.Append("Sagiri Server "); 301 | sb.Append(Host); 302 | sb.Append(":"); 303 | sb.Append(Port); 304 | hostAndPort = sb.ToString(); 305 | } 306 | 307 | if(hostAndPort.Length > 0) { 308 | GUI.Label(new Rect(0, 0, 400, 100), hostAndPort); 309 | } 310 | } 311 | 312 | void ListenerCallback(IAsyncResult result) { 313 | RequestContext context = new RequestContext(listener.EndGetContext(result)); 314 | 315 | HandleRequest(context); 316 | 317 | if (listener.IsListening) { 318 | listener.BeginGetContext(ListenerCallback, null); 319 | } 320 | } 321 | 322 | void HandleRequest(RequestContext context) { 323 | RegisterRoutes(); 324 | 325 | try { 326 | bool handled = false; 327 | 328 | for (; context.currentRoute < registeredRoutes.Count; ++context.currentRoute) { 329 | RouteAttribute route = registeredRoutes[context.currentRoute]; 330 | Match match = route.m_route.Match(context.path); 331 | if (!match.Success) 332 | continue; 333 | 334 | if (!route.m_methods.IsMatch(context.Request.HttpMethod)) 335 | continue; 336 | 337 | // Upgrade to main thread if necessary 338 | if (route.m_runOnMainThread && Thread.CurrentThread != mainThread) { 339 | lock (mainRequests) { 340 | mainRequests.Enqueue(context); 341 | } 342 | return; 343 | } 344 | 345 | context.match = match; 346 | route.m_callback(context); 347 | handled = !context.pass; 348 | if (handled) 349 | break; 350 | } 351 | 352 | if (!handled) { 353 | context.Response.StatusCode = (int)HttpStatusCode.NotFound; 354 | context.Response.StatusDescription = "Not Found"; 355 | } 356 | } catch (Exception exception) { 357 | context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; 358 | context.Response.StatusDescription = string.Format("Fatal error:\n{0}", exception); 359 | 360 | Debug.LogException(exception); 361 | } 362 | 363 | context.Response.OutputStream.Close(); 364 | } 365 | 366 | IEnumerator HandleRequests() { 367 | while (true) { 368 | while (mainRequests.Count == 0) { 369 | // yield return new WaitForEndOfFrame(); 370 | yield return null; 371 | } 372 | 373 | RequestContext context = null; 374 | lock (mainRequests) { 375 | context = mainRequests.Dequeue(); 376 | } 377 | 378 | HandleRequest(context); 379 | } 380 | } 381 | } 382 | #endif 383 | } 384 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/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: 15 7 | productGUID: 9ec36a59570330246ac14ac2dab7b718 8 | AndroidProfiler: 0 9 | AndroidFilterTouchesWhenObscured: 0 10 | AndroidEnableSustainedPerformanceMode: 0 11 | defaultScreenOrientation: 4 12 | targetDevice: 2 13 | useOnDemandResources: 0 14 | accelerometerFrequency: 60 15 | companyName: DefaultCompany 16 | productName: UnityProject 17 | defaultCursor: {fileID: 0} 18 | cursorHotspot: {x: 0, y: 0} 19 | m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1} 20 | m_ShowUnitySplashScreen: 1 21 | m_ShowUnitySplashLogo: 1 22 | m_SplashScreenOverlayOpacity: 1 23 | m_SplashScreenAnimation: 1 24 | m_SplashScreenLogoStyle: 1 25 | m_SplashScreenDrawMode: 0 26 | m_SplashScreenBackgroundAnimationZoom: 1 27 | m_SplashScreenLogoAnimationZoom: 1 28 | m_SplashScreenBackgroundLandscapeAspect: 1 29 | m_SplashScreenBackgroundPortraitAspect: 1 30 | m_SplashScreenBackgroundLandscapeUvs: 31 | serializedVersion: 2 32 | x: 0 33 | y: 0 34 | width: 1 35 | height: 1 36 | m_SplashScreenBackgroundPortraitUvs: 37 | serializedVersion: 2 38 | x: 0 39 | y: 0 40 | width: 1 41 | height: 1 42 | m_SplashScreenLogos: [] 43 | m_VirtualRealitySplashScreen: {fileID: 0} 44 | m_HolographicTrackingLossScreen: {fileID: 0} 45 | defaultScreenWidth: 1024 46 | defaultScreenHeight: 768 47 | defaultScreenWidthWeb: 960 48 | defaultScreenHeightWeb: 600 49 | m_StereoRenderingPath: 0 50 | m_ActiveColorSpace: 0 51 | m_MTRendering: 1 52 | m_StackTraceTypes: 010000000100000001000000010000000100000001000000 53 | iosShowActivityIndicatorOnLoading: -1 54 | androidShowActivityIndicatorOnLoading: -1 55 | iosAppInBackgroundBehavior: 0 56 | displayResolutionDialog: 1 57 | iosAllowHTTPDownload: 1 58 | allowedAutorotateToPortrait: 1 59 | allowedAutorotateToPortraitUpsideDown: 1 60 | allowedAutorotateToLandscapeRight: 1 61 | allowedAutorotateToLandscapeLeft: 1 62 | useOSAutorotation: 1 63 | use32BitDisplayBuffer: 1 64 | preserveFramebufferAlpha: 0 65 | disableDepthAndStencilBuffers: 0 66 | androidStartInFullscreen: 1 67 | androidRenderOutsideSafeArea: 0 68 | androidBlitType: 0 69 | defaultIsNativeResolution: 1 70 | macRetinaSupport: 1 71 | runInBackground: 1 72 | captureSingleScreen: 0 73 | muteOtherAudioSources: 0 74 | Prepare IOS For Recording: 0 75 | Force IOS Speakers When Recording: 0 76 | deferSystemGesturesMode: 0 77 | hideHomeButton: 0 78 | submitAnalytics: 1 79 | usePlayerLog: 1 80 | bakeCollisionMeshes: 0 81 | forceSingleInstance: 0 82 | resizableWindow: 0 83 | useMacAppStoreValidation: 0 84 | macAppStoreCategory: public.app-category.games 85 | gpuSkinning: 0 86 | graphicsJobs: 0 87 | xboxPIXTextureCapture: 0 88 | xboxEnableAvatar: 0 89 | xboxEnableKinect: 0 90 | xboxEnableKinectAutoTracking: 0 91 | xboxEnableFitness: 0 92 | visibleInBackground: 0 93 | allowFullscreenSwitch: 1 94 | graphicsJobMode: 0 95 | fullscreenMode: 1 96 | xboxSpeechDB: 0 97 | xboxEnableHeadOrientation: 0 98 | xboxEnableGuest: 0 99 | xboxEnablePIXSampling: 0 100 | metalFramebufferOnly: 0 101 | xboxOneResolution: 0 102 | xboxOneSResolution: 0 103 | xboxOneXResolution: 3 104 | xboxOneMonoLoggingLevel: 0 105 | xboxOneLoggingLevel: 1 106 | xboxOneDisableEsram: 0 107 | xboxOnePresentImmediateThreshold: 0 108 | switchQueueCommandMemory: 0 109 | vulkanEnableSetSRGBWrite: 0 110 | m_SupportedAspectRatios: 111 | 4:3: 1 112 | 5:4: 1 113 | 16:10: 1 114 | 16:9: 1 115 | Others: 1 116 | bundleVersion: 1.0 117 | preloadedAssets: [] 118 | metroInputSource: 0 119 | wsaTransparentSwapchain: 0 120 | m_HolographicPauseOnTrackingLoss: 1 121 | xboxOneDisableKinectGpuReservation: 0 122 | xboxOneEnable7thCore: 0 123 | isWsaHolographicRemotingEnabled: 0 124 | vrSettings: 125 | cardboard: 126 | depthFormat: 0 127 | enableTransitionView: 0 128 | daydream: 129 | depthFormat: 0 130 | useSustainedPerformanceMode: 0 131 | enableVideoLayer: 0 132 | useProtectedVideoMemory: 0 133 | minimumSupportedHeadTracking: 0 134 | maximumSupportedHeadTracking: 1 135 | hololens: 136 | depthFormat: 1 137 | depthBufferSharingEnabled: 0 138 | oculus: 139 | sharedDepthBuffer: 0 140 | dashSupport: 0 141 | enable360StereoCapture: 0 142 | protectGraphicsMemory: 0 143 | enableFrameTimingStats: 0 144 | useHDRDisplay: 0 145 | m_ColorGamuts: 00000000 146 | targetPixelDensity: 30 147 | resolutionScalingMode: 0 148 | androidSupportedAspectRatio: 1 149 | androidMaxAspectRatio: 2.1 150 | applicationIdentifier: {} 151 | buildNumber: {} 152 | AndroidBundleVersionCode: 1 153 | AndroidMinSdkVersion: 16 154 | AndroidTargetSdkVersion: 0 155 | AndroidPreferredInstallLocation: 1 156 | aotOptions: 157 | stripEngineCode: 1 158 | iPhoneStrippingLevel: 0 159 | iPhoneScriptCallOptimization: 0 160 | ForceInternetPermission: 0 161 | ForceSDCardPermission: 0 162 | CreateWallpaper: 0 163 | APKExpansionFiles: 0 164 | keepLoadedShadersAlive: 0 165 | StripUnusedMeshComponents: 0 166 | VertexChannelCompressionMask: 214 167 | iPhoneSdkVersion: 988 168 | iOSTargetOSVersionString: 9.0 169 | tvOSSdkVersion: 0 170 | tvOSRequireExtendedGameController: 0 171 | tvOSTargetOSVersionString: 9.0 172 | uIPrerenderedIcon: 0 173 | uIRequiresPersistentWiFi: 0 174 | uIRequiresFullScreen: 1 175 | uIStatusBarHidden: 1 176 | uIExitOnSuspend: 0 177 | uIStatusBarStyle: 0 178 | iPhoneSplashScreen: {fileID: 0} 179 | iPhoneHighResSplashScreen: {fileID: 0} 180 | iPhoneTallHighResSplashScreen: {fileID: 0} 181 | iPhone47inSplashScreen: {fileID: 0} 182 | iPhone55inPortraitSplashScreen: {fileID: 0} 183 | iPhone55inLandscapeSplashScreen: {fileID: 0} 184 | iPhone58inPortraitSplashScreen: {fileID: 0} 185 | iPhone58inLandscapeSplashScreen: {fileID: 0} 186 | iPadPortraitSplashScreen: {fileID: 0} 187 | iPadHighResPortraitSplashScreen: {fileID: 0} 188 | iPadLandscapeSplashScreen: {fileID: 0} 189 | iPadHighResLandscapeSplashScreen: {fileID: 0} 190 | appleTVSplashScreen: {fileID: 0} 191 | appleTVSplashScreen2x: {fileID: 0} 192 | tvOSSmallIconLayers: [] 193 | tvOSSmallIconLayers2x: [] 194 | tvOSLargeIconLayers: [] 195 | tvOSLargeIconLayers2x: [] 196 | tvOSTopShelfImageLayers: [] 197 | tvOSTopShelfImageLayers2x: [] 198 | tvOSTopShelfImageWideLayers: [] 199 | tvOSTopShelfImageWideLayers2x: [] 200 | iOSLaunchScreenType: 0 201 | iOSLaunchScreenPortrait: {fileID: 0} 202 | iOSLaunchScreenLandscape: {fileID: 0} 203 | iOSLaunchScreenBackgroundColor: 204 | serializedVersion: 2 205 | rgba: 0 206 | iOSLaunchScreenFillPct: 100 207 | iOSLaunchScreenSize: 100 208 | iOSLaunchScreenCustomXibPath: 209 | iOSLaunchScreeniPadType: 0 210 | iOSLaunchScreeniPadImage: {fileID: 0} 211 | iOSLaunchScreeniPadBackgroundColor: 212 | serializedVersion: 2 213 | rgba: 0 214 | iOSLaunchScreeniPadFillPct: 100 215 | iOSLaunchScreeniPadSize: 100 216 | iOSLaunchScreeniPadCustomXibPath: 217 | iOSUseLaunchScreenStoryboard: 0 218 | iOSLaunchScreenCustomStoryboardPath: 219 | iOSDeviceRequirements: [] 220 | iOSURLSchemes: [] 221 | iOSBackgroundModes: 0 222 | iOSMetalForceHardShadows: 0 223 | metalEditorSupport: 1 224 | metalAPIValidation: 1 225 | iOSRenderExtraFrameOnPause: 0 226 | appleDeveloperTeamID: 227 | iOSManualSigningProvisioningProfileID: 228 | tvOSManualSigningProvisioningProfileID: 229 | iOSManualSigningProvisioningProfileType: 0 230 | tvOSManualSigningProvisioningProfileType: 0 231 | appleEnableAutomaticSigning: 0 232 | iOSRequireARKit: 0 233 | appleEnableProMotion: 0 234 | clonedFromGUID: 00000000000000000000000000000000 235 | templatePackageId: 236 | templateDefaultScene: 237 | AndroidTargetArchitectures: 5 238 | AndroidSplashScreenScale: 0 239 | androidSplashScreen: {fileID: 0} 240 | AndroidKeystoreName: 241 | AndroidKeyaliasName: 242 | AndroidBuildApkPerCpuArchitecture: 0 243 | AndroidTVCompatibility: 1 244 | AndroidIsGame: 1 245 | AndroidEnableTango: 0 246 | androidEnableBanner: 1 247 | androidUseLowAccuracyLocation: 0 248 | m_AndroidBanners: 249 | - width: 320 250 | height: 180 251 | banner: {fileID: 0} 252 | androidGamepadSupportLevel: 0 253 | resolutionDialogBanner: {fileID: 0} 254 | m_BuildTargetIcons: [] 255 | m_BuildTargetPlatformIcons: [] 256 | m_BuildTargetBatching: [] 257 | m_BuildTargetGraphicsAPIs: [] 258 | m_BuildTargetVRSettings: [] 259 | m_BuildTargetEnableVuforiaSettings: [] 260 | openGLRequireES31: 0 261 | openGLRequireES31AEP: 0 262 | m_TemplateCustomTags: {} 263 | mobileMTRendering: 264 | Android: 1 265 | iPhone: 1 266 | tvOS: 1 267 | m_BuildTargetGroupLightmapEncodingQuality: 268 | - m_BuildTarget: Standalone 269 | m_EncodingQuality: 1 270 | - m_BuildTarget: XboxOne 271 | m_EncodingQuality: 1 272 | - m_BuildTarget: PS4 273 | m_EncodingQuality: 1 274 | m_BuildTargetGroupLightmapSettings: [] 275 | playModeTestRunnerEnabled: 0 276 | runPlayModeTestAsEditModeTest: 0 277 | actionOnDotNetUnhandledException: 1 278 | enableInternalProfiler: 0 279 | logObjCUncaughtExceptions: 1 280 | enableCrashReportAPI: 0 281 | cameraUsageDescription: 282 | locationUsageDescription: 283 | microphoneUsageDescription: 284 | switchNetLibKey: 285 | switchSocketMemoryPoolSize: 6144 286 | switchSocketAllocatorPoolSize: 128 287 | switchSocketConcurrencyLimit: 14 288 | switchScreenResolutionBehavior: 2 289 | switchUseCPUProfiler: 0 290 | switchApplicationID: 0x01004b9000490000 291 | switchNSODependencies: 292 | switchTitleNames_0: 293 | switchTitleNames_1: 294 | switchTitleNames_2: 295 | switchTitleNames_3: 296 | switchTitleNames_4: 297 | switchTitleNames_5: 298 | switchTitleNames_6: 299 | switchTitleNames_7: 300 | switchTitleNames_8: 301 | switchTitleNames_9: 302 | switchTitleNames_10: 303 | switchTitleNames_11: 304 | switchTitleNames_12: 305 | switchTitleNames_13: 306 | switchTitleNames_14: 307 | switchPublisherNames_0: 308 | switchPublisherNames_1: 309 | switchPublisherNames_2: 310 | switchPublisherNames_3: 311 | switchPublisherNames_4: 312 | switchPublisherNames_5: 313 | switchPublisherNames_6: 314 | switchPublisherNames_7: 315 | switchPublisherNames_8: 316 | switchPublisherNames_9: 317 | switchPublisherNames_10: 318 | switchPublisherNames_11: 319 | switchPublisherNames_12: 320 | switchPublisherNames_13: 321 | switchPublisherNames_14: 322 | switchIcons_0: {fileID: 0} 323 | switchIcons_1: {fileID: 0} 324 | switchIcons_2: {fileID: 0} 325 | switchIcons_3: {fileID: 0} 326 | switchIcons_4: {fileID: 0} 327 | switchIcons_5: {fileID: 0} 328 | switchIcons_6: {fileID: 0} 329 | switchIcons_7: {fileID: 0} 330 | switchIcons_8: {fileID: 0} 331 | switchIcons_9: {fileID: 0} 332 | switchIcons_10: {fileID: 0} 333 | switchIcons_11: {fileID: 0} 334 | switchIcons_12: {fileID: 0} 335 | switchIcons_13: {fileID: 0} 336 | switchIcons_14: {fileID: 0} 337 | switchSmallIcons_0: {fileID: 0} 338 | switchSmallIcons_1: {fileID: 0} 339 | switchSmallIcons_2: {fileID: 0} 340 | switchSmallIcons_3: {fileID: 0} 341 | switchSmallIcons_4: {fileID: 0} 342 | switchSmallIcons_5: {fileID: 0} 343 | switchSmallIcons_6: {fileID: 0} 344 | switchSmallIcons_7: {fileID: 0} 345 | switchSmallIcons_8: {fileID: 0} 346 | switchSmallIcons_9: {fileID: 0} 347 | switchSmallIcons_10: {fileID: 0} 348 | switchSmallIcons_11: {fileID: 0} 349 | switchSmallIcons_12: {fileID: 0} 350 | switchSmallIcons_13: {fileID: 0} 351 | switchSmallIcons_14: {fileID: 0} 352 | switchManualHTML: 353 | switchAccessibleURLs: 354 | switchLegalInformation: 355 | switchMainThreadStackSize: 1048576 356 | switchPresenceGroupId: 357 | switchLogoHandling: 0 358 | switchReleaseVersion: 0 359 | switchDisplayVersion: 1.0.0 360 | switchStartupUserAccount: 0 361 | switchTouchScreenUsage: 0 362 | switchSupportedLanguagesMask: 0 363 | switchLogoType: 0 364 | switchApplicationErrorCodeCategory: 365 | switchUserAccountSaveDataSize: 0 366 | switchUserAccountSaveDataJournalSize: 0 367 | switchApplicationAttribute: 0 368 | switchCardSpecSize: -1 369 | switchCardSpecClock: -1 370 | switchRatingsMask: 0 371 | switchRatingsInt_0: 0 372 | switchRatingsInt_1: 0 373 | switchRatingsInt_2: 0 374 | switchRatingsInt_3: 0 375 | switchRatingsInt_4: 0 376 | switchRatingsInt_5: 0 377 | switchRatingsInt_6: 0 378 | switchRatingsInt_7: 0 379 | switchRatingsInt_8: 0 380 | switchRatingsInt_9: 0 381 | switchRatingsInt_10: 0 382 | switchRatingsInt_11: 0 383 | switchLocalCommunicationIds_0: 384 | switchLocalCommunicationIds_1: 385 | switchLocalCommunicationIds_2: 386 | switchLocalCommunicationIds_3: 387 | switchLocalCommunicationIds_4: 388 | switchLocalCommunicationIds_5: 389 | switchLocalCommunicationIds_6: 390 | switchLocalCommunicationIds_7: 391 | switchParentalControl: 0 392 | switchAllowsScreenshot: 1 393 | switchAllowsVideoCapturing: 1 394 | switchAllowsRuntimeAddOnContentInstall: 0 395 | switchDataLossConfirmation: 0 396 | switchUserAccountLockEnabled: 0 397 | switchSupportedNpadStyles: 3 398 | switchNativeFsCacheSize: 32 399 | switchIsHoldTypeHorizontal: 0 400 | switchSupportedNpadCount: 8 401 | switchSocketConfigEnabled: 0 402 | switchTcpInitialSendBufferSize: 32 403 | switchTcpInitialReceiveBufferSize: 64 404 | switchTcpAutoSendBufferSizeMax: 256 405 | switchTcpAutoReceiveBufferSizeMax: 256 406 | switchUdpSendBufferSize: 9 407 | switchUdpReceiveBufferSize: 42 408 | switchSocketBufferEfficiency: 4 409 | switchSocketInitializeEnabled: 1 410 | switchNetworkInterfaceManagerInitializeEnabled: 1 411 | switchPlayerConnectionEnabled: 1 412 | ps4NPAgeRating: 12 413 | ps4NPTitleSecret: 414 | ps4NPTrophyPackPath: 415 | ps4ParentalLevel: 11 416 | ps4ContentID: ED1633-NPXX51362_00-0000000000000000 417 | ps4Category: 0 418 | ps4MasterVersion: 01.00 419 | ps4AppVersion: 01.00 420 | ps4AppType: 0 421 | ps4ParamSfxPath: 422 | ps4VideoOutPixelFormat: 0 423 | ps4VideoOutInitialWidth: 1920 424 | ps4VideoOutBaseModeInitialWidth: 1920 425 | ps4VideoOutReprojectionRate: 120 426 | ps4PronunciationXMLPath: 427 | ps4PronunciationSIGPath: 428 | ps4BackgroundImagePath: 429 | ps4StartupImagePath: 430 | ps4StartupImagesFolder: 431 | ps4IconImagesFolder: 432 | ps4SaveDataImagePath: 433 | ps4SdkOverride: 434 | ps4BGMPath: 435 | ps4ShareFilePath: 436 | ps4ShareOverlayImagePath: 437 | ps4PrivacyGuardImagePath: 438 | ps4NPtitleDatPath: 439 | ps4RemotePlayKeyAssignment: -1 440 | ps4RemotePlayKeyMappingDir: 441 | ps4PlayTogetherPlayerCount: 0 442 | ps4EnterButtonAssignment: 1 443 | ps4ApplicationParam1: 0 444 | ps4ApplicationParam2: 0 445 | ps4ApplicationParam3: 0 446 | ps4ApplicationParam4: 0 447 | ps4DownloadDataSize: 0 448 | ps4GarlicHeapSize: 2048 449 | ps4ProGarlicHeapSize: 2560 450 | ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ 451 | ps4pnSessions: 1 452 | ps4pnPresence: 1 453 | ps4pnFriends: 1 454 | ps4pnGameCustomData: 1 455 | playerPrefsSupport: 0 456 | enableApplicationExit: 0 457 | resetTempFolder: 1 458 | restrictedAudioUsageRights: 0 459 | ps4UseResolutionFallback: 0 460 | ps4ReprojectionSupport: 0 461 | ps4UseAudio3dBackend: 0 462 | ps4SocialScreenEnabled: 0 463 | ps4ScriptOptimizationLevel: 3 464 | ps4Audio3dVirtualSpeakerCount: 14 465 | ps4attribCpuUsage: 0 466 | ps4PatchPkgPath: 467 | ps4PatchLatestPkgPath: 468 | ps4PatchChangeinfoPath: 469 | ps4PatchDayOne: 0 470 | ps4attribUserManagement: 0 471 | ps4attribMoveSupport: 0 472 | ps4attrib3DSupport: 0 473 | ps4attribShareSupport: 0 474 | ps4attribExclusiveVR: 0 475 | ps4disableAutoHideSplash: 0 476 | ps4videoRecordingFeaturesUsed: 0 477 | ps4contentSearchFeaturesUsed: 0 478 | ps4attribEyeToEyeDistanceSettingVR: 0 479 | ps4IncludedModules: 480 | - libc.prx 481 | - libSceAudioLatencyEstimation.prx 482 | - libSceFace.prx 483 | - libSceFaceTracker.prx 484 | - libSceFios2.prx 485 | - libSceHand.prx 486 | - libSceHandTracker.prx 487 | - libSceHeadTracker.prx 488 | - libSceJobManager.prx 489 | - libSceNpToolkit2.prx 490 | - libSceS3DConversion.prx 491 | - libSceSmart.prx 492 | monoEnv: 493 | splashScreenBackgroundSourceLandscape: {fileID: 0} 494 | splashScreenBackgroundSourcePortrait: {fileID: 0} 495 | spritePackerPolicy: 496 | webGLMemorySize: 256 497 | webGLExceptionSupport: 1 498 | webGLNameFilesAsHashes: 0 499 | webGLDataCaching: 0 500 | webGLDebugSymbols: 0 501 | webGLEmscriptenArgs: 502 | webGLModulesDirectory: 503 | webGLTemplate: APPLICATION:Default 504 | webGLAnalyzeBuildSize: 0 505 | webGLUseEmbeddedResources: 0 506 | webGLCompressionFormat: 1 507 | webGLLinkerTarget: 0 508 | webGLThreadsSupport: 0 509 | scriptingDefineSymbols: {} 510 | platformArchitecture: {} 511 | scriptingBackend: 512 | Metro: 2 513 | il2cppCompilerConfiguration: {} 514 | managedStrippingLevel: {} 515 | incrementalIl2cppBuild: {} 516 | allowUnsafeCode: 0 517 | additionalIl2CppArgs: 518 | scriptingRuntimeVersion: 0 519 | apiCompatibilityLevelPerPlatform: 520 | Metro: 1 521 | m_RenderingPath: 1 522 | m_MobileRenderingPath: 1 523 | metroPackageName: UnityProject 524 | metroPackageVersion: 525 | metroCertificatePath: Assets\WSATestCertificate.pfx 526 | metroCertificatePassword: 527 | metroCertificateSubject: DefaultCompany 528 | metroCertificateIssuer: DefaultCompany 529 | metroCertificateNotAfter: 000b18a0a746d401 530 | metroApplicationDescription: UnityProject 531 | wsaImages: {} 532 | metroTileShortName: 533 | metroTileShowName: 0 534 | metroMediumTileShowName: 0 535 | metroLargeTileShowName: 0 536 | metroWideTileShowName: 0 537 | metroSupportStreamingInstall: 0 538 | metroLastRequiredScene: 0 539 | metroDefaultTileSize: 1 540 | metroTileForegroundText: 2 541 | metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} 542 | metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, 543 | a: 1} 544 | metroSplashScreenUseBackgroundColor: 0 545 | platformCapabilities: {} 546 | metroTargetDeviceFamilies: {} 547 | metroFTAName: 548 | metroFTAFileTypes: [] 549 | metroProtocolName: 550 | metroCompilationOverrides: 1 551 | XboxOneProductId: 552 | XboxOneUpdateKey: 553 | XboxOneSandboxId: 554 | XboxOneContentId: 555 | XboxOneTitleId: 556 | XboxOneSCId: 557 | XboxOneGameOsOverridePath: 558 | XboxOnePackagingOverridePath: 559 | XboxOneAppManifestOverridePath: 560 | XboxOneVersion: 1.0.0.0 561 | XboxOnePackageEncryption: 0 562 | XboxOnePackageUpdateGranularity: 2 563 | XboxOneDescription: 564 | XboxOneLanguage: 565 | - enus 566 | XboxOneCapability: [] 567 | XboxOneGameRating: {} 568 | XboxOneIsContentPackage: 0 569 | XboxOneEnableGPUVariability: 0 570 | XboxOneSockets: {} 571 | XboxOneSplashScreen: {fileID: 0} 572 | XboxOneAllowedProductIds: [] 573 | XboxOnePersistentLocalStorageSize: 0 574 | XboxOneXTitleMemory: 8 575 | xboxOneScriptCompiler: 0 576 | XboxOneOverrideIdentityName: 577 | vrEditorSettings: 578 | daydream: 579 | daydreamIconForeground: {fileID: 0} 580 | daydreamIconBackground: {fileID: 0} 581 | cloudServicesEnabled: {} 582 | luminIcon: 583 | m_Name: 584 | m_ModelFolderPath: 585 | m_PortalFolderPath: 586 | luminCert: 587 | m_CertPath: 588 | m_PrivateKeyPath: 589 | luminIsChannelApp: 0 590 | luminVersion: 591 | m_VersionCode: 1 592 | m_VersionName: 593 | facebookSdkVersion: 7.9.1 594 | facebookAppId: 595 | facebookCookies: 1 596 | facebookLogging: 1 597 | facebookStatus: 1 598 | facebookXfbml: 0 599 | facebookFrictionlessRequests: 1 600 | apiCompatibilityLevel: 2 601 | cloudProjectId: 602 | framebufferDepthMemorylessMode: 0 603 | projectName: 604 | organizationId: 605 | cloudEnabled: 0 606 | enableNativePlatformBackendsForNewInputSystem: 0 607 | disableOldInputManagerSupport: 0 608 | legacyClampBlendShapeWeights: 1 609 | -------------------------------------------------------------------------------- /UnityProject_Sagiri/Assets/StreamingAssets/Sagiri/console.js: -------------------------------------------------------------------------------- 1 | // Variables 2 | var mainPanel = document.getElementById('mainPanel'); 3 | var searchBox = document.getElementById('search'); 4 | var checkEvent = new CustomEvent('change', { checked: this.checked }); 5 | var theSearchableElements = []; 6 | // TODO 100 is too small 7 | var maxToShowByDefault = 100; 8 | var largeFile = false; 9 | var title = document.getElementById('title'); 10 | var startTime = document.getElementById('startTime'); 11 | var endTime = document.getElementById('endTime'); 12 | var largeNotice = document.getElementById('large'); 13 | var lastLogID = document.getElementById('last-log-id'); 14 | 15 | var counts = { 16 | assert: 0, 17 | error: 0, 18 | exception: 0, 19 | warning: 0, 20 | system: 0, 21 | log: 0, 22 | ai: 0, 23 | audio: 0, 24 | content: 0, 25 | logic: 0, 26 | gui: 0, 27 | input: 0, 28 | network: 0, 29 | physics: 0 30 | }; 31 | 32 | var countElements = { 33 | assert: undefined, 34 | error: undefined, 35 | exception: undefined, 36 | warning: undefined, 37 | system: undefined, 38 | log: undefined, 39 | ai: undefined, 40 | audio: undefined, 41 | content: undefined, 42 | logic: undefined, 43 | gui: undefined, 44 | input: undefined, 45 | network: undefined, 46 | physics: undefined 47 | }; 48 | 49 | var checklistElements = { 50 | assert: undefined, 51 | error: undefined, 52 | exception: undefined, 53 | warning: undefined, 54 | system: undefined, 55 | log: undefined, 56 | ai: undefined, 57 | audio: undefined, 58 | content: undefined, 59 | logic: undefined, 60 | gui: undefined, 61 | input: undefined, 62 | network: undefined, 63 | physics: undefined 64 | }; 65 | 66 | var entryElements = { 67 | assert: [], 68 | error: [], 69 | exception: [], 70 | warning: [], 71 | system: [], 72 | log: [], 73 | ai: [], 74 | audio: [], 75 | content: [], 76 | logic: [], 77 | gui: [], 78 | input: [], 79 | network: [], 80 | physics: [] 81 | }; 82 | 83 | var checkboxElements = { 84 | all: document.getElementById('allCheckbox'), 85 | assert: document.getElementById('assertCheckbox'), 86 | error: document.getElementById('errorCheckbox'), 87 | exception: document.getElementById('exceptionCheckbox'), 88 | warning: document.getElementById('warningCheckbox'), 89 | system: document.getElementById('systemCheckbox'), 90 | log: document.getElementById('logCheckbox'), 91 | ai: document.getElementById('aiCheckbox'), 92 | audio: document.getElementById('audioCheckbox'), 93 | content: document.getElementById('contentCheckbox'), 94 | logic: document.getElementById('logicCheckbox'), 95 | gui: document.getElementById('guiCheckbox'), 96 | input: document.getElementById('inputCheckbox'), 97 | network: document.getElementById('networkCheckbox'), 98 | physics: document.getElementById('physicsCheckbox') 99 | }; 100 | 101 | // Functions 102 | // Initialize page 103 | function init() { 104 | console.time('init()'); 105 | // Get elements 106 | // Get count elements 107 | countElements["assert"] = document.getElementsByClassName("count assert")[0]; 108 | countElements["error"] = document.getElementsByClassName("count error")[0]; 109 | countElements["exception"] = document.getElementsByClassName("count exception")[0]; 110 | countElements["warning"] = document.getElementsByClassName("count warning")[0]; 111 | countElements["system"] = document.getElementsByClassName("count system")[0]; 112 | countElements["log"] = document.getElementsByClassName("count log")[0]; 113 | countElements["ai"] = document.getElementsByClassName("count ai")[0]; 114 | countElements["audio"] = document.getElementsByClassName("count audio")[0]; 115 | countElements["content"] = document.getElementsByClassName("count content")[0]; 116 | countElements["logic"] = document.getElementsByClassName("count logic")[0]; 117 | countElements["gui"] = document.getElementsByClassName("count gui")[0]; 118 | countElements["input"] = document.getElementsByClassName("count input")[0]; 119 | countElements["network"] = document.getElementsByClassName("count network")[0]; 120 | countElements["physics"] = document.getElementsByClassName("count physics")[0]; 121 | // Get checklist 122 | checklistElements["assert"] = document.getElementById("li-assert"); 123 | checklistElements["error"] = document.getElementById("li-error"); 124 | checklistElements["exception"] = document.getElementById("li-exception"); 125 | checklistElements["warning"] = document.getElementById("li-warning"); 126 | checklistElements["system"] = document.getElementById("li-system"); 127 | checklistElements["log"] = document.getElementById("li-log"); 128 | checklistElements["ai"] = document.getElementById("li-ai"); 129 | checklistElements["audio"] = document.getElementById("li-audio"); 130 | checklistElements["content"] = document.getElementById("li-content"); 131 | checklistElements["logic"] = document.getElementById("li-logic"); 132 | checklistElements["gui"] = document.getElementById("li-gui"); 133 | checklistElements["input"] = document.getElementById("li-input"); 134 | checklistElements["network"] = document.getElementById("li-network"); 135 | checklistElements["physics"] = document.getElementById("li-physics"); 136 | console.time('init()'); 137 | }//init 138 | 139 | // Load a file 140 | function handleFileSelect(evt) { 141 | console.time("handleFileselect()"); 142 | var file = this.files[0]; 143 | title.textContent = file.name.substr(0, file.name.indexOf('.')); 144 | var timesnip = file.name.replace(title.textContent + ".", '').substr(title.textContent.indexOf('.') + 1).replace('.json', ''); 145 | startTime.textContent = new Date(timesnip.substr(0, 10).replace(/\./g, '-') + "T" + timesnip.substr(11, 2) + ":" + timesnip.substr(14, 2) + ":" + timesnip.substr(17, 2)).toLocaleString(); 146 | endTime.textContent = file.lastModifiedDate.toLocaleString(); 147 | if (file) { 148 | var reader = new FileReader(); 149 | reader.onload = function (f) { 150 | populateLogs(JSON.parse(f.target.result)); 151 | updateCounts(); 152 | updateEntriesList(); 153 | setCheckboxesOn(); 154 | } 155 | reader.readAsText(file); 156 | } 157 | console.timeEnd("handleFileselect()"); 158 | }//handleFileselect 159 | 160 | // Parse a file, clear existing logs, add new to document 161 | function populateLogs(jsonFile) { 162 | console.time("populateLogs()"); 163 | mainPanel.innerHTML = ""; 164 | // Reset our counts 165 | Object.keys(counts).forEach(function (k) { 166 | counts[k] = 0; 167 | }); 168 | // Loop through each log entry and add some html 169 | var entry, inner, time, type; 170 | jsonFile.forEach(function (log) { 171 | type = log.t.toLowerCase(); 172 | counts[type] = ++counts[type]; 173 | entry = document.createElement('div'); 174 | entry.classList.add('entry', type); 175 | entry.classList.add('hidden'); 176 | time = log.tm ? new Date(log.tm.substr(0, 10).replace(/\./g, '-') + "T" + log.tm.substr(11, 2) + ":" + log.tm.substr(14, 2) + ":" + log.tm.substr(17, 2)).toLocaleString() : ""; 177 | inner = '' + time + '' + 178 | '' + log.l + '' + 179 | ''; 180 | entry.innerHTML = inner; 181 | mainPanel.appendChild(entry); 182 | }); 183 | console.timeEnd("populateLogs()"); 184 | }//populateLogs 185 | 186 | 187 | function prependLog(log) { 188 | console.time("prependLog()"); 189 | 190 | var type = log.t.toLowerCase(); 191 | 192 | if(counts[type] == undefined) { 193 | counts[type] = 1; 194 | } else { 195 | counts[type] = ++counts[type]; 196 | } 197 | 198 | // 로그의 갯수가 너무 많아진거같으면 옛날 로그를 지운다 199 | while(counts[type] > maxToShowByDefault) { 200 | var childcount = mainPanel.children.length; 201 | var found = null; 202 | for(var i = childcount-1 ; i >= 0 ; i--) { 203 | var el = mainPanel.children[i]; 204 | if(el.classList.contains(type)) { 205 | found = el; 206 | break; 207 | } 208 | } 209 | if(found) { 210 | mainPanel.removeChild(found); 211 | counts[type]--; 212 | } 213 | } 214 | 215 | var entry = document.createElement('div'); 216 | entry.classList.add('entry', type); 217 | entry.classList.add('hidden'); 218 | var time = log.tm ? new Date(log.tm.substr(0, 10).replace(/\./g, '-') + "T" + log.tm.substr(11, 2) + ":" + log.tm.substr(14, 2) + ":" + log.tm.substr(17, 2)).toLocaleString() : ""; 219 | 220 | var inner = '' + time + '' + 221 | '' + log.l + '' + 222 | ''; 223 | entry.innerHTML = inner; 224 | mainPanel.insertBefore(entry, mainPanel.firstChild); 225 | 226 | console.timeEnd("prependLog()"); 227 | } 228 | 229 | // Update counts, hide empty lists 230 | function updateCounts() { 231 | console.time("updateCounts()"); 232 | 233 | // Update counts 234 | countElements["assert"].textContent = " (" + counts.assert + ")"; 235 | countElements["error"].textContent = " (" + counts.error + ")"; 236 | countElements["exception"].textContent = " (" + counts.exception + ")"; 237 | countElements["warning"].textContent = " (" + counts.warning + ")"; 238 | countElements["system"].textContent = " (" + counts.system + ")"; 239 | countElements["log"].textContent = " (" + counts.log + ")"; 240 | countElements["ai"].textContent = " (" + counts.ai + ")"; 241 | countElements["audio"].textContent = " (" + counts.audio + ")"; 242 | countElements["content"].textContent = " (" + counts.content + ")"; 243 | countElements["logic"].textContent = " (" + counts.logic + ")"; 244 | countElements["gui"].textContent = " (" + counts.gui + ")"; 245 | countElements["input"].textContent = " (" + counts.input + ")"; 246 | countElements["network"].textContent = " (" + counts.network + ")"; 247 | countElements["physics"].textContent = " (" + counts.physics + ")"; 248 | 249 | // Hide no counts 250 | if (!counts["assert"]) { checklistElements["assert"].classList.add('hidden'); } 251 | else { checklistElements["assert"].classList.remove('hidden'); } 252 | 253 | if (!counts["error"]) { checklistElements["error"].classList.add('hidden'); } 254 | else { checklistElements["error"].classList.remove('hidden'); } 255 | 256 | if (!counts["exception"]) { checklistElements["exception"].classList.add('hidden'); } 257 | else { checklistElements["exception"].classList.remove('hidden'); } 258 | 259 | if (!counts["warning"]) { checklistElements["warning"].classList.add('hidden'); } 260 | else { checklistElements["warning"].classList.remove('hidden'); } 261 | 262 | if (!counts["system"]) { checklistElements["system"].classList.add('hidden'); } 263 | else { checklistElements["system"].classList.remove('hidden'); } 264 | 265 | if (!counts["ai"]) { checklistElements["ai"].classList.add('hidden'); } 266 | else { checklistElements["ai"].classList.remove('hidden'); } 267 | 268 | if (!counts["audio"]) { checklistElements["audio"].classList.add('hidden'); } 269 | else { checklistElements["audio"].classList.remove('hidden'); } 270 | 271 | if (!counts["content"]) { checklistElements["content"].classList.add('hidden'); } 272 | else { checklistElements["content"].classList.remove('hidden'); } 273 | 274 | if (!counts["logic"]) { checklistElements["logic"].classList.add('hidden'); } 275 | else { checklistElements["logic"].classList.remove('hidden'); } 276 | 277 | if (!counts["gui"]) { checklistElements["gui"].classList.add('hidden'); } 278 | else { checklistElements["gui"].classList.remove('hidden'); } 279 | 280 | if (!counts["input"]) { checklistElements["input"].classList.add('hidden'); } 281 | else { checklistElements["input"].classList.remove('hidden'); } 282 | 283 | if (!counts["network"]) { checklistElements["network"].classList.add('hidden'); } 284 | else { checklistElements["network"].classList.remove('hidden'); } 285 | 286 | if (!counts["physics"]) { checklistElements["physics"].classList.add('hidden'); } 287 | else { checklistElements["physics"].classList.remove('hidden'); } 288 | 289 | console.timeEnd("updateCounts()"); 290 | }//updateCounts 291 | 292 | // Update list entries 293 | function updateEntriesList() { 294 | console.time("updateEntriesList()"); 295 | entryElements["assert"] = document.getElementsByClassName("entry assert"); 296 | entryElements["error"] = document.getElementsByClassName("entry error"); 297 | entryElements["exception"] = document.getElementsByClassName("entry exception"); 298 | entryElements["warning"] = document.getElementsByClassName("entry warning"); 299 | entryElements["system"] = document.getElementsByClassName("entry system"); 300 | entryElements["log"] = document.getElementsByClassName("entry log"); 301 | entryElements["ai"] = document.getElementsByClassName("entry ai"); 302 | entryElements["audio"] = document.getElementsByClassName("entry audio"); 303 | entryElements["content"] = document.getElementsByClassName("entry content"); 304 | entryElements["logic"] = document.getElementsByClassName("entry logic"); 305 | entryElements["gui"] = document.getElementsByClassName("entry gui"); 306 | entryElements["input"] = document.getElementsByClassName("entry input"); 307 | entryElements["network"] = document.getElementsByClassName("entry network"); 308 | entryElements["physics"] = document.getElementsByClassName("entry physics"); 309 | console.timeEnd("updateEntriesList()"); 310 | }//updateEntriesList 311 | 312 | // turn off big lists 313 | function setCheckboxesOn() { 314 | var any = false, log = false; 315 | Object.keys(counts).forEach(function (key) { 316 | if (counts[key] > maxToShowByDefault) { 317 | any = true; 318 | if (key === "log") { 319 | log = true; 320 | } 321 | checkboxElements[key].checked = false; 322 | if (!(log && (key === "ai" || key === "audio" || key === "content" || key === "logic" || key === "gui" || key === "input" || key === "network" || key === "physics"))) { 323 | checkboxElements[key].dispatchEvent(checkEvent); 324 | } 325 | } 326 | else { 327 | checkboxElements[key].checked = true; 328 | checkboxElements[key].dispatchEvent(checkEvent); 329 | } 330 | }); 331 | if (any) { 332 | checkboxElements["all"].checked = false; 333 | largeNotice.classList.remove('hidden'); 334 | // checkboxElements["all"].dispatchEvent(checkEvent); 335 | } 336 | else if (log) { 337 | checkboxElements["log"].dispatchEvent(checkEvent); 338 | largeNotice.classList.remove('hidden'); 339 | } 340 | else { 341 | checkboxElements["all"].checked = true; 342 | checkboxElements["all"].dispatchEvent(checkEvent); 343 | largeNotice.classList.add('hidden'); 344 | } 345 | }//setCheckboxesOn 346 | 347 | // Helper attached to buttons to open/close stack for current entry 348 | function openCloseStack(element) { 349 | console.time("openCloseStack()"); 350 | var stack = element.parentElement.parentElement.getElementsByClassName('stack'); 351 | stack[0].classList.toggle('hidden'); 352 | console.timeEnd("openCloseStack()"); 353 | }//openCloseStack 354 | 355 | // Helper to show/hide the log entry from checkbox. If a search is present rerun it 356 | function showOrHideLogEntry(type, checked) { 357 | console.time("showOrHideLogEntry(" + type + ")"); 358 | for (var i = 0; i < entryElements[type].length; i++) { 359 | if (checked) { 360 | entryElements[type][i].classList.remove("hidden"); 361 | theSearchableElements.push(entryElements[type][i]); 362 | } 363 | else { 364 | entryElements[type][i].classList.add("hidden"); 365 | var index = theSearchableElements.indexOf(entryElements[type][i]); 366 | theSearchableElements.splice(index, 1); 367 | } 368 | } 369 | // If there is a search query rerun it 370 | if (searchBox.value) { 371 | var event = new CustomEvent('input', {}); 372 | searchBox.dispatchEvent(event); 373 | } 374 | console.timeEnd("showOrHideLogEntry(" + type + ")"); 375 | }//showOrHideLogEntry 376 | 377 | // Helper to handle search query 378 | function search(evt) { 379 | console.time('search()'); 380 | var searchQuery = this.value.toLowerCase(); 381 | var messages, stack, type, time, inMessage, inStack, inType, inTime; 382 | theSearchableElements.forEach(function (element) { 383 | // Reset 384 | inType = false; 385 | inTime = false; 386 | type = element.classList.toString().replace("entry", "").replace("hidden", "").replace(" ", ""); 387 | time = element.getElementsByClassName('timestamp')[0].textContent.toLowerCase(); 388 | if (time.indexOf(searchQuery) > -1) { inTime = true; } 389 | if (type.indexOf(searchQuery) > -1) { inType = true; } 390 | // Loop if not already a match 391 | if (!inType && !inTime) { 392 | inMessage = false; 393 | inStack = false; 394 | messages = element.getElementsByClassName('message'); 395 | stack = element.getElementsByClassName('stack'); 396 | // Loop through messages 397 | for (var j = 0; j < messages.length; j++) { 398 | if (messages[j].nodeType == 1) { 399 | if (messages[j].textContent.toLowerCase().indexOf(searchQuery) > -1) { inMessage = true; } 400 | } 401 | }//for each message 402 | // Loop through stack 403 | for (var j = 0; j < stack.length; j++) { 404 | if (stack[j].nodeType == 1) { 405 | if (stack[j].textContent.toLowerCase().indexOf(searchQuery) > -1) { inStack = true; } 406 | } 407 | }//for each stack 408 | } 409 | // Add remove classes if found 410 | if (inMessage || inStack || inType || inTime) { element.classList.remove("hidden"); } 411 | else { element.classList.add("hidden"); } 412 | });// for each theSearchableElements 413 | console.timeEnd('search()'); 414 | }//search 415 | 416 | // DOM Content Loaded 417 | document.addEventListener('DOMContentLoaded', function () { 418 | console.time("DOMContentLoaded"); 419 | var event = new CustomEvent('change', { checked: this.checked }); 420 | allCheckbox.dispatchEvent(event); 421 | init(); 422 | console.timeEnd("DOMContentLoaded"); 423 | }, false); //DOMContentLoaded 424 | 425 | // Listeners 426 | // File loading 427 | document.getElementById('file').addEventListener('change', handleFileSelect, false); 428 | 429 | // Search logic 430 | searchBox.addEventListener('input', search, false); 431 | 432 | // Listener for the select all checkbox 433 | allCheckbox.addEventListener('change', function (e) { 434 | assertCheckbox.checked = (this.checked ? true : false); 435 | errorCheckbox.checked = (this.checked ? true : false); 436 | exceptionCheckbox.checked = (this.checked ? true : false); 437 | warningCheckbox.checked = (this.checked ? true : false); 438 | systemCheckbox.checked = (this.checked ? true : false); 439 | logCheckbox.checked = (this.checked ? true : false); 440 | 441 | var event = new CustomEvent('change', { checked: this.checked }); 442 | assertCheckbox.dispatchEvent(event); 443 | errorCheckbox.dispatchEvent(event); 444 | exceptionCheckbox.dispatchEvent(event); 445 | warningCheckbox.dispatchEvent(event); 446 | systemCheckbox.dispatchEvent(event); 447 | logCheckbox.dispatchEvent(event); 448 | });//allCheckbox change 449 | 450 | // Listener for the log checkbox 451 | logCheckbox.addEventListener('change', function (e) { 452 | 453 | showOrHideLogEntry("log", this.checked); 454 | 455 | aiCheckbox.checked = (this.checked ? true : false); 456 | audioCheckbox.checked = (this.checked ? true : false); 457 | contentCheckbox.checked = (this.checked ? true : false); 458 | logicCheckbox.checked = (this.checked ? true : false); 459 | guiCheckbox.checked = (this.checked ? true : false); 460 | inputCheckbox.checked = (this.checked ? true : false); 461 | networkCheckbox.checked = (this.checked ? true : false); 462 | physicsCheckbox.checked = (this.checked ? true : false); 463 | 464 | var event = new CustomEvent('change', { checked: this.checked }); 465 | aiCheckbox.dispatchEvent(event); 466 | audioCheckbox.dispatchEvent(event); 467 | contentCheckbox.dispatchEvent(event); 468 | logicCheckbox.dispatchEvent(event); 469 | guiCheckbox.dispatchEvent(event); 470 | inputCheckbox.dispatchEvent(event); 471 | networkCheckbox.dispatchEvent(event); 472 | physicsCheckbox.dispatchEvent(event); 473 | });//logCheckbox change 474 | 475 | // Listeners for individual checkboxes 476 | assertCheckbox.addEventListener('change', function (e) { 477 | if (e.checked) { showOrHideLogEntry("assert", e.checked); } 478 | else { showOrHideLogEntry("assert", this.checked); } 479 | }); 480 | 481 | errorCheckbox.addEventListener('change', function (e) { 482 | if (e.checked) { showOrHideLogEntry("error", e.checked); } 483 | else { showOrHideLogEntry("error", this.checked); } 484 | }); 485 | 486 | exceptionCheckbox.addEventListener('change', function (e) { 487 | if (e.checked) { showOrHideLogEntry("exception", e.checked); } 488 | else { showOrHideLogEntry("exception", this.checked); } 489 | }); 490 | 491 | warningCheckbox.addEventListener('change', function (e) { 492 | if (e.checked) { showOrHideLogEntry("warning", e.checked); } 493 | else { showOrHideLogEntry("warning", this.checked); } 494 | }); 495 | 496 | systemCheckbox.addEventListener('change', function (e) { 497 | if (e.checked) { showOrHideLogEntry("system", e.checked); } 498 | else { showOrHideLogEntry("system", this.checked); } 499 | }); 500 | 501 | aiCheckbox.addEventListener('change', function (e) { 502 | if (e.checked) { showOrHideLogEntry("ai", e.checked); } 503 | else { showOrHideLogEntry("ai", this.checked); } 504 | }); 505 | 506 | audioCheckbox.addEventListener('change', function (e) { 507 | if (e.checked) { showOrHideLogEntry("audio", e.checked); } 508 | else { showOrHideLogEntry("audio", this.checked); } 509 | }); 510 | 511 | contentCheckbox.addEventListener('change', function (e) { 512 | if (e.checked) { showOrHideLogEntry("content", e.checked); } 513 | else { showOrHideLogEntry("content", this.checked); } 514 | }); 515 | 516 | logicCheckbox.addEventListener('change', function (e) { 517 | if (e.checked) { showOrHideLogEntry("logic", e.checked); } 518 | else { showOrHideLogEntry("logic", this.checked); } 519 | }); 520 | 521 | guiCheckbox.addEventListener('change', function (e) { 522 | if (e.checked) { showOrHideLogEntry("gui", e.checked); } 523 | else { showOrHideLogEntry("gui", this.checked); } 524 | }); 525 | 526 | inputCheckbox.addEventListener('change', function (e) { 527 | if (e.checked) { showOrHideLogEntry("input", e.checked); } 528 | else { showOrHideLogEntry("input", this.checked); } 529 | }); 530 | 531 | networkCheckbox.addEventListener('change', function (e) { 532 | if (e.checked) { showOrHideLogEntry("network", e.checked); } 533 | else { showOrHideLogEntry("network", this.checked); } 534 | }); 535 | 536 | physicsCheckbox.addEventListener('change', function (e) { 537 | if (e.checked) { showOrHideLogEntry("physics", e.checked); } 538 | else { showOrHideLogEntry("physics", this.checked); } 539 | }); 540 | 541 | // reset 542 | document.querySelector('#reset-log-entries').onclick = function() { 543 | populateLogs([]); 544 | updateCounts(); 545 | updateEntriesList(); 546 | setCheckboxesOn(); 547 | 548 | lastUniqueLogId = 0; 549 | lastLogID.innerHTML = lastUniqueLogId; 550 | } 551 | 552 | var lastUniqueLogId = 0; 553 | 554 | function handleReceivedLogs(data) { 555 | console.time("handleReceivedLogs load()"); 556 | 557 | // 로그를 역순으로 추가 558 | // 최신 로그가 위에 있는게 읽기 쉬울거같아서? 559 | for(var i = 0 ; i < data.length ; i++) { 560 | var log = data[i]; 561 | if(log.id > lastUniqueLogId) { 562 | prependLog(log); 563 | } 564 | } 565 | 566 | title.textContent = 'sagiri'; 567 | updateCounts(); 568 | updateEntriesList(); 569 | setCheckboxesOn(); 570 | 571 | // 마지막으로 받은 log id 갱신 572 | for(var i = 0 ; i < data.length ; i++) { 573 | var log = data[i]; 574 | if(log.id > lastUniqueLogId) { 575 | lastUniqueLogId = log.id; 576 | } 577 | } 578 | lastLogID.innerHTML = lastUniqueLogId; 579 | 580 | console.timeEnd("handleReceivedLogs load()"); 581 | } 582 | 583 | function updateConsole(callback) { 584 | var path = '/console/fetch'; 585 | var qs = 'last=' + lastUniqueLogId; 586 | var url = path + '?' + qs; 587 | 588 | fetch(url).then(function(res) { 589 | if(res.ok) { 590 | res.json().then(function(data) { 591 | if(data.length > 0) { 592 | handleReceivedLogs(data); 593 | } 594 | }); 595 | } else { 596 | console.log("/console/out response error: ", res.status); 597 | } 598 | }).then(function() { 599 | window.setTimeout(function() { updateConsole(null); }, 500); 600 | }).catch(function(e) { 601 | //console.log("/console/out fetch failed:", e); 602 | window.setTimeout(function() { updateConsole(null); }, 500); 603 | }) 604 | } 605 | 606 | window.setTimeout(function() { updateConsole(null); }, 500); 607 | --------------------------------------------------------------------------------