├── src
└── androidProj
│ ├── settings.gradle
│ ├── .idea
│ ├── copyright
│ │ └── profiles_settings.xml
│ ├── encodings.xml
│ ├── codeStyles
│ │ ├── codeStyleConfig.xml
│ │ └── Project.xml
│ ├── runConfigurations.xml
│ ├── compiler.xml
│ ├── misc.xml
│ └── codeStyleSettings.xml
│ ├── nativeeditplugin
│ ├── src
│ │ └── main
│ │ │ ├── res
│ │ │ └── values
│ │ │ │ └── strings.xml
│ │ │ ├── AndroidManifest.xml
│ │ │ └── java
│ │ │ └── com
│ │ │ └── bkmin
│ │ │ └── android
│ │ │ ├── NativeEditPlugin.java
│ │ │ └── EditBox.java
│ ├── libs
│ │ └── UnityPlayer.jar
│ ├── proguard-rules.pro
│ └── build.gradle
│ ├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
│ ├── build.gradle
│ ├── gradle.properties
│ ├── .gitignore
│ ├── gradlew.bat
│ └── gradlew
├── demo
├── Assets
│ ├── NativeEditPlugin
│ │ ├── demo
│ │ ├── Plugins
│ │ ├── scripts
│ │ ├── demo.meta
│ │ ├── Plugins.meta
│ │ └── scripts.meta
│ ├── NativeEditPlugin.meta
│ ├── Plugins.meta
│ └── Plugins
│ │ └── Editor.meta
├── ProjectSettings
│ ├── ProjectVersion.txt
│ ├── ClusterInputManager.asset
│ ├── NetworkManager.asset
│ ├── TimeManager.asset
│ ├── EditorBuildSettings.asset
│ ├── AudioManager.asset
│ ├── TagManager.asset
│ ├── DynamicsManager.asset
│ ├── EditorSettings.asset
│ ├── UnityConnectSettings.asset
│ ├── Physics2DSettings.asset
│ ├── NavMeshAreas.asset
│ ├── GraphicsSettings.asset
│ ├── QualitySettings.asset
│ ├── InputManager.asset
│ └── ProjectSettings.asset
├── UnityPackageManager
│ └── manifest.json
└── .gitignore
├── release
└── NativeEditPlugin
│ ├── scripts
│ ├── NativeEdit.asmdef
│ ├── NativeEdit.asmdef.meta
│ ├── JsonObject.cs.meta
│ ├── MiniJSON.cs.meta
│ ├── NativeEditBox.cs.meta
│ ├── PluginMsgHandler.cs.meta
│ ├── PluginMsgReceiver.cs.meta
│ ├── PluginMsgReceiver.cs
│ ├── JsonObject.cs
│ ├── PluginMsgHandler.cs
│ ├── NativeEditBox.cs
│ └── MiniJSON.cs
│ ├── Plugins
│ ├── Android
│ │ ├── nativeeditplugin-release.aar
│ │ ├── AndroidManifest.xml.meta
│ │ ├── nativeeditplugin-release.aar.meta
│ │ └── AndroidManifest.xml
│ ├── iOS.meta
│ ├── Android.meta
│ └── iOS
│ │ ├── PlaceholderTextView.h
│ │ ├── EditBox_iOS.h.meta
│ │ ├── JsonObject.h.meta
│ │ ├── PlaceholderTextView.h.meta
│ │ ├── EditBox_iOS.m.meta
│ │ ├── JsonObject.m.meta
│ │ ├── PlaceholderTextView.m.meta
│ │ ├── PluginMsgInterface.mm.meta
│ │ ├── JsonObject.h
│ │ ├── EditBox_iOS.h
│ │ ├── PluginMsgInterface.mm
│ │ ├── PlaceholderTextView.m
│ │ ├── JsonObject.m
│ │ └── EditBox_iOS.m
│ └── demo
│ ├── demo.unity.meta
│ ├── DemoLog.cs.meta
│ └── DemoLog.cs
├── .gitignore
└── README.md
/src/androidProj/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':nativeeditplugin'
2 |
--------------------------------------------------------------------------------
/demo/Assets/NativeEditPlugin/demo:
--------------------------------------------------------------------------------
1 | ../../../release/NativeEditPlugin/demo/
--------------------------------------------------------------------------------
/demo/ProjectSettings/ProjectVersion.txt:
--------------------------------------------------------------------------------
1 | m_EditorVersion: 2017.4.3f1
2 |
--------------------------------------------------------------------------------
/demo/Assets/NativeEditPlugin/Plugins:
--------------------------------------------------------------------------------
1 | ../../../release/NativeEditPlugin/Plugins/
--------------------------------------------------------------------------------
/demo/Assets/NativeEditPlugin/scripts:
--------------------------------------------------------------------------------
1 | ../../../release/NativeEditPlugin/scripts/
--------------------------------------------------------------------------------
/demo/UnityPackageManager/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | }
4 | }
5 |
--------------------------------------------------------------------------------
/release/NativeEditPlugin/scripts/NativeEdit.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "NativeEdit"
3 | }
4 |
--------------------------------------------------------------------------------
/src/androidProj/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # OS generated files
2 | .DS_Store
3 | .DS_Store?
4 | ._*
5 | .Spotlight-V100
6 | .Trashes
7 | Icon?
8 | ehthumbs.db
9 | Thumbs.db
10 |
--------------------------------------------------------------------------------
/src/androidProj/nativeeditplugin/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | nativeeditplugin
3 |
4 |
--------------------------------------------------------------------------------
/src/androidProj/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dongxiansuixin/UnityNativeEdit/HEAD/src/androidProj/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/src/androidProj/nativeeditplugin/libs/UnityPlayer.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dongxiansuixin/UnityNativeEdit/HEAD/src/androidProj/nativeeditplugin/libs/UnityPlayer.jar
--------------------------------------------------------------------------------
/src/androidProj/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/demo/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 |
--------------------------------------------------------------------------------
/release/NativeEditPlugin/Plugins/Android/nativeeditplugin-release.aar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dongxiansuixin/UnityNativeEdit/HEAD/release/NativeEditPlugin/Plugins/Android/nativeeditplugin-release.aar
--------------------------------------------------------------------------------
/src/androidProj/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/demo/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 |
--------------------------------------------------------------------------------
/demo/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 |
--------------------------------------------------------------------------------
/demo/Assets/NativeEditPlugin.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d541cfba5912d43fc837495d4a0d6011
3 | folderAsset: yes
4 | timeCreated: 1430959055
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/release/NativeEditPlugin/demo/demo.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 015099fa862476741b43b0885edbc8dc
3 | timeCreated: 1562335729
4 | licenseType: Free
5 | DefaultImporter:
6 | externalObjects: {}
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/demo/Assets/Plugins.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 943802327f2d0104f859142c6616a6a6
3 | folderAsset: yes
4 | timeCreated: 1562335845
5 | licenseType: Free
6 | DefaultImporter:
7 | externalObjects: {}
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/demo/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/NativeEditPlugin/demo/demo.unity
10 |
--------------------------------------------------------------------------------
/demo/Assets/Plugins/Editor.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 571b27321657f4e44899a901becd95b6
3 | folderAsset: yes
4 | timeCreated: 1562335845
5 | licenseType: Free
6 | DefaultImporter:
7 | externalObjects: {}
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/demo/Assets/NativeEditPlugin/demo.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: aa150935e45ac9f4b952cbb0eee0b4ba
3 | folderAsset: yes
4 | timeCreated: 1562335729
5 | licenseType: Free
6 | DefaultImporter:
7 | externalObjects: {}
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/src/androidProj/nativeeditplugin/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/demo/Assets/NativeEditPlugin/Plugins.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 90b94ef238015574bb5caa9110099943
3 | folderAsset: yes
4 | timeCreated: 1562335729
5 | licenseType: Free
6 | DefaultImporter:
7 | externalObjects: {}
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/demo/Assets/NativeEditPlugin/scripts.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c6a7b1506de0c9d4ab8dc0cb699cd473
3 | folderAsset: yes
4 | timeCreated: 1562335729
5 | licenseType: Free
6 | DefaultImporter:
7 | externalObjects: {}
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/release/NativeEditPlugin/Plugins/iOS.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0a154f58978011a49994efe0447d5f20
3 | folderAsset: yes
4 | timeCreated: 1562335729
5 | licenseType: Free
6 | DefaultImporter:
7 | externalObjects: {}
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/release/NativeEditPlugin/Plugins/Android.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c775b6d53a8dec14a8fca5610b7fa175
3 | folderAsset: yes
4 | timeCreated: 1562335729
5 | licenseType: Free
6 | DefaultImporter:
7 | externalObjects: {}
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/release/NativeEditPlugin/Plugins/Android/AndroidManifest.xml.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 178feb45fbc0ffc44b3b6c35584d937b
3 | timeCreated: 1562335736
4 | licenseType: Free
5 | TextScriptImporter:
6 | externalObjects: {}
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/release/NativeEditPlugin/scripts/NativeEdit.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5048c5d624437e84e903c27d5fccfd54
3 | timeCreated: 1562335732
4 | licenseType: Free
5 | AssemblyDefinitionImporter:
6 | externalObjects: {}
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/src/androidProj/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Thu Jun 20 12:24:46 CST 2019
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
7 |
--------------------------------------------------------------------------------
/release/NativeEditPlugin/demo/DemoLog.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: dd3dfc3c19b13d14db4ba733414bad39
3 | timeCreated: 1562581494
4 | licenseType: Free
5 | MonoImporter:
6 | externalObjects: {}
7 | serializedVersion: 2
8 | defaultReferences: []
9 | executionOrder: 0
10 | icon: {instanceID: 0}
11 | userData:
12 | assetBundleName:
13 | assetBundleVariant:
14 |
--------------------------------------------------------------------------------
/release/NativeEditPlugin/scripts/JsonObject.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3e7b7b423dde343459ac6dca00929ef1
3 | timeCreated: 1562335732
4 | licenseType: Free
5 | MonoImporter:
6 | externalObjects: {}
7 | serializedVersion: 2
8 | defaultReferences: []
9 | executionOrder: 0
10 | icon: {instanceID: 0}
11 | userData:
12 | assetBundleName:
13 | assetBundleVariant:
14 |
--------------------------------------------------------------------------------
/release/NativeEditPlugin/scripts/MiniJSON.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6cd310c07c266294b8edbe9d1fe19e22
3 | timeCreated: 1562335732
4 | licenseType: Free
5 | MonoImporter:
6 | externalObjects: {}
7 | serializedVersion: 2
8 | defaultReferences: []
9 | executionOrder: 0
10 | icon: {instanceID: 0}
11 | userData:
12 | assetBundleName:
13 | assetBundleVariant:
14 |
--------------------------------------------------------------------------------
/release/NativeEditPlugin/scripts/NativeEditBox.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ca4cf2df1cca4e845bbdecbf0e89ee48
3 | timeCreated: 1562335732
4 | licenseType: Free
5 | MonoImporter:
6 | externalObjects: {}
7 | serializedVersion: 2
8 | defaultReferences: []
9 | executionOrder: 0
10 | icon: {instanceID: 0}
11 | userData:
12 | assetBundleName:
13 | assetBundleVariant:
14 |
--------------------------------------------------------------------------------
/release/NativeEditPlugin/scripts/PluginMsgHandler.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b9c8f233db7d1dc42a62abcca68d41a3
3 | timeCreated: 1562335732
4 | licenseType: Free
5 | MonoImporter:
6 | externalObjects: {}
7 | serializedVersion: 2
8 | defaultReferences: []
9 | executionOrder: 0
10 | icon: {instanceID: 0}
11 | userData:
12 | assetBundleName:
13 | assetBundleVariant:
14 |
--------------------------------------------------------------------------------
/release/NativeEditPlugin/scripts/PluginMsgReceiver.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f36a2a0b94a176c42abb38a80d45f694
3 | timeCreated: 1562335732
4 | licenseType: Free
5 | MonoImporter:
6 | externalObjects: {}
7 | serializedVersion: 2
8 | defaultReferences: []
9 | executionOrder: 0
10 | icon: {instanceID: 0}
11 | userData:
12 | assetBundleName:
13 | assetBundleVariant:
14 |
--------------------------------------------------------------------------------
/demo/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 |
--------------------------------------------------------------------------------
/release/NativeEditPlugin/Plugins/iOS/PlaceholderTextView.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 |
4 | @interface PlaceholderTextView : UITextView
5 | {
6 | NSObject* _editBox;
7 | }
8 |
9 | @property(nonatomic, strong) NSString *placeholder;
10 |
11 | @property (nonatomic, strong) UIColor *realTextColor UI_APPEARANCE_SELECTOR;
12 | @property (nonatomic, strong) UIColor *placeholderColor UI_APPEARANCE_SELECTOR;
13 |
14 | -(void) SetEditbox:(NSObject*) box;
15 |
16 | @end
--------------------------------------------------------------------------------
/src/androidProj/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | google()
6 | jcenter()
7 | }
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:3.4.1'
10 |
11 | // NOTE: Do not place your application dependencies here; they belong
12 | // in the individual module build.gradle files
13 | }
14 | }
15 |
16 | allprojects {
17 | repositories {
18 | google()
19 | jcenter()
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/demo/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 |
--------------------------------------------------------------------------------
/src/androidProj/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/release/NativeEditPlugin/Plugins/iOS/EditBox_iOS.h.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7ba18c4df533b69489cede94c2801593
3 | timeCreated: 1562335736
4 | licenseType: Free
5 | PluginImporter:
6 | externalObjects: {}
7 | serializedVersion: 2
8 | iconMap: {}
9 | executionOrder: {}
10 | isPreloaded: 0
11 | isOverridable: 0
12 | platformData:
13 | - first:
14 | Any:
15 | second:
16 | enabled: 1
17 | settings: {}
18 | - first:
19 | Editor: Editor
20 | second:
21 | enabled: 0
22 | settings:
23 | DefaultValueInitialized: true
24 | userData:
25 | assetBundleName:
26 | assetBundleVariant:
27 |
--------------------------------------------------------------------------------
/release/NativeEditPlugin/Plugins/iOS/JsonObject.h.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c17de6c72041dc74ea5a3e1544358419
3 | timeCreated: 1562335736
4 | licenseType: Free
5 | PluginImporter:
6 | externalObjects: {}
7 | serializedVersion: 2
8 | iconMap: {}
9 | executionOrder: {}
10 | isPreloaded: 0
11 | isOverridable: 0
12 | platformData:
13 | - first:
14 | Any:
15 | second:
16 | enabled: 1
17 | settings: {}
18 | - first:
19 | Editor: Editor
20 | second:
21 | enabled: 0
22 | settings:
23 | DefaultValueInitialized: true
24 | userData:
25 | assetBundleName:
26 | assetBundleVariant:
27 |
--------------------------------------------------------------------------------
/release/NativeEditPlugin/Plugins/iOS/PlaceholderTextView.h.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ff17a4f0899f1c044b374ebc76e9642a
3 | timeCreated: 1562335736
4 | licenseType: Free
5 | PluginImporter:
6 | externalObjects: {}
7 | serializedVersion: 2
8 | iconMap: {}
9 | executionOrder: {}
10 | isPreloaded: 0
11 | isOverridable: 0
12 | platformData:
13 | - first:
14 | Any:
15 | second:
16 | enabled: 1
17 | settings: {}
18 | - first:
19 | Editor: Editor
20 | second:
21 | enabled: 0
22 | settings:
23 | DefaultValueInitialized: true
24 | userData:
25 | assetBundleName:
26 | assetBundleVariant:
27 |
--------------------------------------------------------------------------------
/demo/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: 2
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_SolverIterationCount: 6
13 | m_QueriesHitTriggers: 1
14 | m_EnableAdaptiveForce: 0
15 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
16 |
--------------------------------------------------------------------------------
/demo/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: 7
7 | m_ExternalVersionControlSupport: Visible Meta Files
8 | m_SerializationMode: 2
9 | m_LineEndingsForNewScripts: 1
10 | m_DefaultBehaviorMode: 1
11 | m_SpritePackerMode: 2
12 | m_SpritePackerPaddingPower: 1
13 | m_EtcTextureCompressorBehavior: 0
14 | m_EtcTextureFastCompressor: 2
15 | m_EtcTextureNormalCompressor: 2
16 | m_EtcTextureBestCompressor: 5
17 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef
18 | m_ProjectGenerationRootNamespace:
19 | m_UserGeneratedProjectSuffix:
20 | m_CollabEditorSettings:
21 | inProgressEnabled: 1
22 |
--------------------------------------------------------------------------------
/release/NativeEditPlugin/Plugins/Android/nativeeditplugin-release.aar.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0cba3a7ec52957948905b705a410cde1
3 | timeCreated: 1562335736
4 | licenseType: Free
5 | PluginImporter:
6 | externalObjects: {}
7 | serializedVersion: 2
8 | iconMap: {}
9 | executionOrder: {}
10 | isPreloaded: 0
11 | isOverridable: 0
12 | platformData:
13 | - first:
14 | Android: Android
15 | second:
16 | enabled: 1
17 | settings: {}
18 | - first:
19 | Any:
20 | second:
21 | enabled: 0
22 | settings: {}
23 | - first:
24 | Editor: Editor
25 | second:
26 | enabled: 0
27 | settings:
28 | DefaultValueInitialized: true
29 | userData:
30 | assetBundleName:
31 | assetBundleVariant:
32 |
--------------------------------------------------------------------------------
/src/androidProj/nativeeditplugin/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/kyungminbang/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/src/androidProj/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/release/NativeEditPlugin/demo/DemoLog.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEngine;
3 | using UnityEngine.UI;
4 |
5 | public class DemoLog : MonoBehaviour
6 | {
7 | private Text txt;
8 |
9 | private void Start()
10 | {
11 | txt = GetComponent();
12 | }
13 |
14 | public void OnEditValueChanged(string str)
15 | {
16 | txt.text = $"val changed: {str}";
17 | }
18 |
19 | public void OnEndEdit(string str)
20 | {
21 | txt.text = $"edit ended: {str}";
22 | }
23 |
24 | public void OnReturnPressed(NativeEditBox editBox)
25 | {
26 | //hide keyboard
27 | editBox.SetFocus(false);
28 | txt.text = "return pressed";
29 | }
30 |
31 | public void OnBeginEdit(NativeEditBox editBox)
32 | {
33 | txt.text = "begin editing";
34 | }
35 | }
--------------------------------------------------------------------------------
/release/NativeEditPlugin/Plugins/iOS/EditBox_iOS.m.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f3c967df2137e6f4e8a082dbb10c37d5
3 | timeCreated: 1562335736
4 | licenseType: Free
5 | PluginImporter:
6 | externalObjects: {}
7 | serializedVersion: 2
8 | iconMap: {}
9 | executionOrder: {}
10 | isPreloaded: 0
11 | isOverridable: 0
12 | platformData:
13 | - first:
14 | Any:
15 | second:
16 | enabled: 0
17 | settings: {}
18 | - first:
19 | Editor: Editor
20 | second:
21 | enabled: 0
22 | settings:
23 | DefaultValueInitialized: true
24 | - first:
25 | iPhone: iOS
26 | second:
27 | enabled: 1
28 | settings: {}
29 | - first:
30 | tvOS: tvOS
31 | second:
32 | enabled: 1
33 | settings: {}
34 | userData:
35 | assetBundleName:
36 | assetBundleVariant:
37 |
--------------------------------------------------------------------------------
/release/NativeEditPlugin/Plugins/iOS/JsonObject.m.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a506d459e8a7bdb40919f1c6deba056e
3 | timeCreated: 1562335736
4 | licenseType: Free
5 | PluginImporter:
6 | externalObjects: {}
7 | serializedVersion: 2
8 | iconMap: {}
9 | executionOrder: {}
10 | isPreloaded: 0
11 | isOverridable: 0
12 | platformData:
13 | - first:
14 | Any:
15 | second:
16 | enabled: 0
17 | settings: {}
18 | - first:
19 | Editor: Editor
20 | second:
21 | enabled: 0
22 | settings:
23 | DefaultValueInitialized: true
24 | - first:
25 | iPhone: iOS
26 | second:
27 | enabled: 1
28 | settings: {}
29 | - first:
30 | tvOS: tvOS
31 | second:
32 | enabled: 1
33 | settings: {}
34 | userData:
35 | assetBundleName:
36 | assetBundleVariant:
37 |
--------------------------------------------------------------------------------
/release/NativeEditPlugin/Plugins/iOS/PlaceholderTextView.m.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7ee1933a0b6b3474ebab2365a5b6c7a3
3 | timeCreated: 1562335736
4 | licenseType: Free
5 | PluginImporter:
6 | externalObjects: {}
7 | serializedVersion: 2
8 | iconMap: {}
9 | executionOrder: {}
10 | isPreloaded: 0
11 | isOverridable: 0
12 | platformData:
13 | - first:
14 | Any:
15 | second:
16 | enabled: 0
17 | settings: {}
18 | - first:
19 | Editor: Editor
20 | second:
21 | enabled: 0
22 | settings:
23 | DefaultValueInitialized: true
24 | - first:
25 | iPhone: iOS
26 | second:
27 | enabled: 1
28 | settings: {}
29 | - first:
30 | tvOS: tvOS
31 | second:
32 | enabled: 1
33 | settings: {}
34 | userData:
35 | assetBundleName:
36 | assetBundleVariant:
37 |
--------------------------------------------------------------------------------
/release/NativeEditPlugin/Plugins/iOS/PluginMsgInterface.mm.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9d1952d9d8280254aa9599a412a59fca
3 | timeCreated: 1562335736
4 | licenseType: Free
5 | PluginImporter:
6 | externalObjects: {}
7 | serializedVersion: 2
8 | iconMap: {}
9 | executionOrder: {}
10 | isPreloaded: 0
11 | isOverridable: 0
12 | platformData:
13 | - first:
14 | Any:
15 | second:
16 | enabled: 0
17 | settings: {}
18 | - first:
19 | Editor: Editor
20 | second:
21 | enabled: 0
22 | settings:
23 | DefaultValueInitialized: true
24 | - first:
25 | iPhone: iOS
26 | second:
27 | enabled: 1
28 | settings: {}
29 | - first:
30 | tvOS: tvOS
31 | second:
32 | enabled: 1
33 | settings: {}
34 | userData:
35 | assetBundleName:
36 | assetBundleVariant:
37 |
--------------------------------------------------------------------------------
/demo/ProjectSettings/UnityConnectSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!310 &1
4 | UnityConnectSettings:
5 | m_ObjectHideFlags: 0
6 | m_Enabled: 0
7 | m_TestMode: 0
8 | m_TestEventUrl:
9 | m_TestConfigUrl:
10 | m_TestInitMode: 0
11 | CrashReportingSettings:
12 | m_EventUrl: https://perf-events.cloud.unity3d.com/api/events/crashes
13 | m_Enabled: 0
14 | m_CaptureEditorExceptions: 1
15 | UnityPurchasingSettings:
16 | m_Enabled: 0
17 | m_TestMode: 0
18 | UnityAnalyticsSettings:
19 | m_Enabled: 0
20 | m_InitializeOnStartup: 1
21 | m_TestMode: 0
22 | m_TestEventUrl:
23 | m_TestConfigUrl:
24 | UnityAdsSettings:
25 | m_Enabled: 0
26 | m_InitializeOnStartup: 1
27 | m_TestMode: 0
28 | m_EnabledPlatforms: 4294967295
29 | m_IosGameId:
30 | m_AndroidGameId:
31 | PerformanceReportingSettings:
32 | m_Enabled: 0
33 |
--------------------------------------------------------------------------------
/src/androidProj/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/src/androidProj/nativeeditplugin/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 28
5 | buildToolsVersion "28.0.3"
6 |
7 | defaultConfig {
8 | minSdkVersion 19
9 | targetSdkVersion 28
10 | versionCode 1
11 | versionName "1.0"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | repositories {
22 | maven {
23 | url "https://maven.google.com"
24 | }
25 | }
26 | dependencies {
27 | compileOnly files('./libs/UnityPlayer.jar')
28 | }
29 |
30 | task clearJar(type: Delete) {
31 | delete 'build/outputs/nativeeditplugin.jar'
32 | }
33 |
34 | task makeJar(type: Copy) {
35 | from('build/intermediates/bundles/release/')
36 | into('build/outputs/')
37 | }
38 |
39 | makeJar.dependsOn(clearJar, build)
--------------------------------------------------------------------------------
/demo/ProjectSettings/Physics2DSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!19 &1
4 | Physics2DSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | m_Gravity: {x: 0, y: -9.81}
8 | m_DefaultMaterial: {fileID: 0}
9 | m_VelocityIterations: 8
10 | m_PositionIterations: 3
11 | m_VelocityThreshold: 1
12 | m_MaxLinearCorrection: 0.2
13 | m_MaxAngularCorrection: 8
14 | m_MaxTranslationSpeed: 100
15 | m_MaxRotationSpeed: 360
16 | m_MinPenetrationForPenalty: 0.01
17 | m_BaumgarteScale: 0.2
18 | m_BaumgarteTimeOfImpactScale: 0.75
19 | m_TimeToSleep: 0.5
20 | m_LinearSleepTolerance: 0.01
21 | m_AngularSleepTolerance: 2
22 | m_QueriesHitTriggers: 1
23 | m_QueriesStartInColliders: 1
24 | m_ChangeStopsCallbacks: 0
25 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
26 |
--------------------------------------------------------------------------------
/demo/.gitignore:
--------------------------------------------------------------------------------
1 | # This .gitignore file should be placed at the root of your Unity project directory
2 | #
3 | # Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
4 | #
5 | /[Ll]ibrary/
6 | /[Tt]emp/
7 | /[Oo]bj/
8 | /[Bb]uild/
9 | /[Bb]uilds/
10 | /[Ll]ogs/
11 | /[Mm]emoryCaptures/
12 |
13 | # Never ignore Asset meta data
14 | !/[Aa]ssets/**/*.meta
15 |
16 | # TextMesh Pro files
17 | [Aa]ssets/TextMesh*Pro/
18 |
19 | # Autogenerated Jetbrains Rider plugin
20 | [Aa]ssets/Plugins/Editor/JetBrains*
21 |
22 | # Visual Studio cache directory
23 | .vs/
24 |
25 | # Gradle cache directory
26 | .gradle/
27 |
28 | # Autogenerated VS/MD/Consulo/Rider solution and project files
29 | ExportedObj/
30 | .consulo/
31 | .idea/
32 | *.csproj
33 | *.unityproj
34 | *.sln
35 | *.suo
36 | *.tmp
37 | *.user
38 | *.userprefs
39 | *.pidb
40 | *.booproj
41 | *.svd
42 | *.pdb
43 | *.mdb
44 | *.opendb
45 | *.VC.db
46 |
47 | # Unity3D generated meta files
48 | *.pidb.meta
49 | *.pdb.meta
50 | *.mdb.meta
51 |
52 | # Unity3D generated file on crash reports
53 | sysinfo.txt
54 |
55 | # Builds
56 | *.apk
57 | *.unitypackage
58 |
59 | # Crashlytics generated file
60 | crashlytics-build.properties
61 |
--------------------------------------------------------------------------------
/release/NativeEditPlugin/Plugins/iOS/JsonObject.h:
--------------------------------------------------------------------------------
1 | //
2 | // JsonObject.h
3 | // stockissue
4 | //
5 | // Created by KYUNGMIN BANG on 12/8/14.
6 | // Copyright (c) 2014 Nureka Inc. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface JsonObject : NSObject
12 |
13 | @property (nonatomic, strong) NSMutableDictionary* dict;
14 |
15 | -(id)initWithJsonData:(NSData*) json;
16 | -(id)initWithCmd:(NSString*) cmd;
17 | -(id)initWithDictionary:(NSMutableDictionary*) _dict;
18 | -(NSData*)serialize;
19 |
20 | -(void) setInt:(NSString*) key value:(int)value;
21 | -(void) setFloat:(NSString*) key value:(float)value;
22 | -(void) setBool:(NSString*) key value:(BOOL)value;
23 | -(void) setString:(NSString*) key value:(NSString*)value;
24 | -(void) setArray:(NSString*) key value:(NSArray*) value;
25 | -(void) setJsonObject:(NSString*) key value:(JsonObject*) value;
26 |
27 | -(int) getInt:(NSString*) key;
28 | -(float) getFloat:(NSString*) key;
29 | -(BOOL) getBool:(NSString*) key;
30 | -(NSString*) getString:(NSString*) key;
31 | -(NSArray*) getJsonArray:(NSString*) key;
32 | -(NSArray*) getDictArray:(NSString*) key;
33 | -(JsonObject*) getJsonObject:(NSString*) key;
34 |
35 | @end
36 |
37 |
--------------------------------------------------------------------------------
/demo/ProjectSettings/NavMeshAreas.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!126 &1
4 | NavMeshAreas:
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 |
--------------------------------------------------------------------------------
/release/NativeEditPlugin/Plugins/iOS/EditBox_iOS.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 | #import "JsonObject.h"
4 |
5 | /// UnityEditBox Plugin
6 | /// Written by bkmin 2014/11 Nureka Inc.
7 |
8 | #define MSG_CREATE @"CreateEdit"
9 | #define MSG_REMOVE @"RemoveEdit"
10 | #define MSG_SET_TEXT @"SetText"
11 | #define MSG_GET_TEXT @"GetText"
12 | #define MSG_SET_RECT @"SetRect"
13 | #define MSG_SET_TEXTSIZE @"SetTextSize"
14 | #define MSG_SET_FOCUS @"SetFocus"
15 | #define MSG_SET_VISIBLE @"SetVisible"
16 | #define MSG_TEXT_CHANGE @"TextChange"
17 | #define MSG_TEXT_BEGIN_EDIT @"TextBeginEdit"
18 | #define MSG_TEXT_END_EDIT @"TextEndEdit"
19 | #define MSG_RETURN_PRESSED @"ReturnPressed"
20 |
21 | @interface EditBox : NSObject
22 | {
23 | UIView* editView;
24 | UIViewController* viewController;
25 | UIToolbar* keyboardDoneButtonView;
26 | UIBarButtonItem* doneButton;
27 | int tag;
28 | }
29 |
30 | @property (nonatomic, assign) int maxLength;
31 |
32 | +(void) initializeEditBox:(UIViewController*) _unityViewController unityName:(const char*) unityName;
33 | +(JsonObject*) processRecvJsonMsg:(int)nSenderId msg:(JsonObject*) jsonMsg;
34 | +(void) finalizeEditBox;
35 |
36 | -(void) hideKeyboard;
37 | -(BOOL) isFocused;
38 | @end
39 |
--------------------------------------------------------------------------------
/release/NativeEditPlugin/Plugins/Android/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
14 |
15 |
20 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/src/androidProj/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.ap_
4 | *.aab
5 |
6 | # Files for the ART/Dalvik VM
7 | *.dex
8 |
9 | # Java class files
10 | *.class
11 |
12 | # Generated files
13 | bin/
14 | gen/
15 | out/
16 | release/
17 |
18 | # Gradle files
19 | .gradle/
20 | build/
21 |
22 | # Local configuration file (sdk path, etc)
23 | local.properties
24 |
25 | # Proguard folder generated by Eclipse
26 | proguard/
27 |
28 | # Log Files
29 | *.log
30 |
31 | # Android Studio Navigation editor temp files
32 | .navigation/
33 |
34 | # Android Studio captures folder
35 | captures/
36 |
37 | # IntelliJ
38 | *.iml
39 | .idea/workspace.xml
40 | .idea/tasks.xml
41 | .idea/gradle.xml
42 | .idea/assetWizardSettings.xml
43 | .idea/dictionaries
44 | .idea/libraries
45 | # Android Studio 3 in .gitignore file.
46 | .idea/caches
47 | .idea/modules.xml
48 | # Comment next line if keeping position of elements in Navigation Editor is relevant for you
49 | .idea/navEditor.xml
50 |
51 | # Keystore files
52 | # Uncomment the following lines if you do not want to check your keystore files in.
53 | #*.jks
54 | #*.keystore
55 |
56 | # External native build folder generated in Android Studio 2.2 and later
57 | .externalNativeBuild
58 |
59 | # Google Services (e.g. APIs or Firebase)
60 | # google-services.json
61 |
62 | # Freeline
63 | freeline.py
64 | freeline/
65 | freeline_project_description.json
66 |
67 | # fastlane
68 | fastlane/report.xml
69 | fastlane/Preview.html
70 | fastlane/screenshots
71 | fastlane/test_output
72 | fastlane/readme.md
73 |
74 | # Version control
75 | vcs.xml
76 |
77 | # lint
78 | lint/intermediates/
79 | lint/generated/
80 | lint/outputs/
81 | lint/tmp/
82 | # lint/reports/
83 |
--------------------------------------------------------------------------------
/release/NativeEditPlugin/scripts/PluginMsgReceiver.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 Kyungmin Bang
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining
5 | * a copy of this software and associated documentation files (the
6 | * "Software"), to deal in the Software without restriction, including
7 | * without limitation the rights to use, copy, modify, merge, publish,
8 | * distribute, sublicense, and/or sell copies of the Software, and to
9 | * permit persons to whom the Software is furnished to do so, subject to
10 | * the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be
13 | * included in all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | */
23 |
24 | using UnityEngine;
25 |
26 | public abstract class PluginMsgReceiver : MonoBehaviour
27 | {
28 | private int _receiverId;
29 |
30 | protected virtual void Start()
31 | {
32 | _receiverId = PluginMsgHandler.GetInstanceForReceiver(this).RegisterAndGetReceiverId(this);
33 | }
34 |
35 | protected virtual void OnDestroy()
36 | {
37 | PluginMsgHandler.GetInstanceForReceiver(this).RemoveReceiver(_receiverId);
38 | }
39 |
40 | protected JsonObject SendPluginMsg(JsonObject jsonMsg)
41 | {
42 | return PluginMsgHandler.GetInstanceForReceiver(this).SendMsgToPlugin(_receiverId, jsonMsg);
43 | }
44 |
45 | public abstract void OnPluginMsgDirect(JsonObject jsonMsg);
46 | }
--------------------------------------------------------------------------------
/demo/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: 10770, guid: 0000000000000000f000000000000000, type: 0}
37 | - {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0}
38 | - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
39 | - {fileID: 16002, guid: 0000000000000000f000000000000000, type: 0}
40 | - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
41 | m_PreloadedShaders: []
42 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
43 | type: 0}
44 | m_CustomRenderPipeline: {fileID: 0}
45 | m_TransparencySortMode: 0
46 | m_TransparencySortAxis: {x: 0, y: 0, z: 1}
47 | m_DefaultRenderingPath: 1
48 | m_DefaultMobileRenderingPath: 1
49 | m_TierSettings: []
50 | m_LightmapStripping: 0
51 | m_FogStripping: 0
52 | m_InstancingStripping: 0
53 | m_LightmapKeepPlain: 1
54 | m_LightmapKeepDirCombined: 1
55 | m_LightmapKeepDynamicPlain: 1
56 | m_LightmapKeepDynamicDirCombined: 1
57 | m_LightmapKeepShadowMask: 1
58 | m_LightmapKeepSubtractive: 1
59 | m_FogKeepLinear: 1
60 | m_FogKeepExp: 1
61 | m_FogKeepExp2: 1
62 | m_AlbedoSwatchInfos: []
63 | m_LightsUseLinearIntensity: 0
64 | m_LightsUseColorTemperature: 0
65 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## UnityNativeEdit v1.6
2 | Unity Native Input Plugin for both iOS and Android (UGUI InputField compatible).
3 |
4 | This means you don't need a separate 'Unity' Input box and you can use all native text functions such as `Select`, `Copy` and `Paste`.
5 |
6 | ### Usage
7 | 1. Simply copy the files in `release/NativeEditPlugin` into your existing unity project asset folder.
8 | 2. Attach ```NativeEditBox``` script to your UnityUI ```InputField```object.
9 | 3. Build and run on your android or ios device!
10 |
11 | ### Building the Android plugin
12 | If you want to tinker with the project yourself you need to build the Android project again in AndroidStudio (for iOS you can just modify the Objective-C code and it will get built at the same time as the Unity project).
13 |
14 | 1. Open the `src/androidProj` directory in AndroidStudio.
15 | 2. Select View -> Tool Windows -> Gradle in AndroidStudio.
16 | 3. In Gradle run the :nativeeditplugin -> other -> makeJar task.
17 | 4. It's a bit confusing but the task seems to generate .aar files (even though it was called makeJar, not sure what's up with that) in the `src/androidProj/nativeeditplugin/build/outputs/aar` directory.
18 | 5. To test in the demo Unity project copy the `nativeeditplugin-release.aar` file (from the output directory) to the `release\NativeEditPlugin\Plugins\Android` directory. This file is symlinked to the Unity demo project.
19 |
20 | ### Etc
21 | 1. NativeEditBox will work with delegate defined in your Unity UI InputField, `On Value Change` and `End Edit`
22 | 2. It's open source and free to use/redistribute!
23 |
24 | - - -
25 | ## UnityNativeEdit v1.6 中文说明
26 | UnityNativeEdit是适用于Unity、支持iOS和Android的原生输入框插件,免去直接使用UGUI的InputField产生的键盘方面的不便,并且可以和原生应用一样方便地对输入文本进行选择、复制和粘贴等操作。
27 |
28 | 本repo的1.6版本针对[原版](https://github.com/YousicianGit/UnityNativeEdit/)进行了各种优化和bug修复,无需像原版那样要事先挂载`PluginMsgHandler`脚本,并且自2017年起被某国产知名二次元手机游戏使用。
29 |
30 | ### 使用方法
31 | 1. 直接拷贝`release/NativeEditPlugin`目录下的文件到你的项目中;
32 | 2. 在你的InputField对象上添加`NativeEditBox`脚本组件。
33 |
34 | 添加后,如果要通过代码修改输入框的文本的话,请务必通过`NativeEditBox`脚本的`text`属性进行操作,否则将不会看到修改后的文本。
35 | 3. 发布到真机上试试吧!
36 |
37 | ### 生成插件
38 | 如果你想自行修改插件,对安卓平台而言,你需要在Android Studio中重新生成;而对iOS平台而言,只需修改 Objective-C 代码即可。
39 |
40 | 1. 在Android Studio中打开文件夹`src/androidProj`;
41 | 2. 选择 View -> Tool Windows -> Gradle ;
42 | 3. 运行 :nativeeditplugin -> other -> makeJar 任务;
43 | 4. 该任务会在`src/androidProj/nativeeditplugin/build/outputs/aar`下生成.aar文件(即使任务名字叫做makeJar);
44 | 5. 拷贝`nativeeditplugin-release.aar`至`release\NativeEditPlugin\Plugins\Android`文件夹。
45 |
46 | ### Etc
47 | 1. 本插件可以响应同一GameObject上的InputField的`OnValueChanged`和`OnEndEdit`事件。
48 | 2. 本插件开源且可免费使用、分发。
49 |
--------------------------------------------------------------------------------
/src/androidProj/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/src/androidProj/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/release/NativeEditPlugin/Plugins/iOS/PluginMsgInterface.mm:
--------------------------------------------------------------------------------
1 | //
2 | // PluginMsgHandler.m
3 | // Unity-iPhone
4 | //
5 | // Created by KYUNGMIN BANG on 2/24/15.
6 | //
7 | //
8 |
9 | #import "EditBox_iOS.h"
10 |
11 | UIViewController* UnityGetGLViewController();
12 |
13 | char* gCopyString(const char* string) {
14 | if(string == NULL) {
15 | return NULL;
16 | }
17 | char* ret = (char*) malloc(strlen(string) + 1); // memory will be auto-freed by unity
18 | strcpy(ret, string);
19 | return ret;
20 | }
21 |
22 | extern "C" {
23 |
24 | /* typedef void* MonoDomain;
25 | typedef void* MonoAssembly;
26 | typedef void* MonoImage;
27 | typedef void* MonoClass;
28 | typedef void* MonoObject;
29 | typedef void* MonoMethodDesc;
30 | typedef void* MonoMethod;
31 | typedef void* gpointer;
32 | typedef int gboolean;
33 |
34 | MonoDomain *mono_domain_get();
35 | MonoAssembly *mono_domain_assembly_open(MonoDomain *domain, const char *assemblyName);
36 | MonoImage *mono_assembly_get_image(MonoAssembly *assembly);
37 | MonoMethodDesc *mono_method_desc_new(const char *methodString, gboolean useNamespace);
38 | MonoMethodDesc *mono_method_desc_free(MonoMethodDesc *desc);
39 | MonoMethod *mono_method_desc_search_in_image(MonoMethodDesc *methodDesc, MonoImage *image);
40 | MonoObject *mono_runtime_invoke(MonoMethod *method, void *obj, void **params, MonoObject **exc);
41 | gpointer mono_object_unbox(MonoObject *obj);
42 |
43 | void initializUnityPluginHandler()
44 | {
45 | MonoDomain *domain = mono_domain_get();
46 | NSString *assemblyPath = [[[NSBundle mainBundle] bundlePath]
47 | stringByAppendingPathComponent:@"Data/Managed/Assembly-CSharp.dll"];
48 | MonoAssembly *assembly = mono_domain_assembly_open(domain, assemblyPath.UTF8String);
49 | MonoImage *image = mono_assembly_get_image(assembly);
50 |
51 | MonoMethodDesc *desc = mono_method_desc_new("PluginMsgHandler:InitializeHandlerByNative()", FALSE);
52 | MonoMethod *method = mono_method_desc_search_in_image(desc, image);
53 | mono_runtime_invoke(method, NULL, NULL, NULL);
54 | mono_method_desc_free(desc);
55 | } */
56 |
57 | void _iOS_InitPluginMsgHandler(const char* unityName)
58 | {
59 | [EditBox initializeEditBox:UnityGetGLViewController() unityName:unityName];
60 | NSLog(@"_iOS_InitPluginMsgHandler called");
61 | }
62 |
63 | char* _iOS_SendUnityMsgToPlugin(int nSenderId, const char* jsonMsgApp)
64 | {
65 | NSString* strJson = [NSString stringWithUTF8String:jsonMsgApp];
66 | JsonObject* jsonMsg = [[JsonObject alloc] initWithJsonData:[strJson dataUsingEncoding:NSUTF8StringEncoding]];
67 | JsonObject* jsonRet = [EditBox processRecvJsonMsg:nSenderId msg:jsonMsg];
68 |
69 | NSString* strRet = [[NSString alloc] initWithData:[jsonRet serialize] encoding:NSUTF8StringEncoding];
70 | return gCopyString([strRet UTF8String]);
71 | }
72 | void _iOS_ClosePluginMsgHandler()
73 | {
74 | [EditBox finalizeEditBox];
75 | }
76 | }
--------------------------------------------------------------------------------
/release/NativeEditPlugin/Plugins/iOS/PlaceholderTextView.m:
--------------------------------------------------------------------------------
1 | #import "PlaceholderTextView.h"
2 | #import "EditBox_iOS.h"
3 |
4 | @interface PlaceholderTextView ()
5 |
6 | @property (unsafe_unretained, nonatomic, readonly) NSString* realText;
7 |
8 | - (void) beginEditing:(NSNotification*) notification;
9 | - (void) endEditing:(NSNotification*) notification;
10 |
11 | @end
12 |
13 | @implementation PlaceholderTextView
14 |
15 | @synthesize realTextColor;
16 | @synthesize placeholder;
17 | @synthesize placeholderColor;
18 |
19 | #pragma mark -
20 | #pragma mark Initialisation
21 |
22 | - (id) initWithFrame:(CGRect)frame {
23 | if ((self = [super initWithFrame:frame])) {
24 | [self awakeFromNib];
25 | }
26 | return self;
27 | }
28 |
29 | - (void)awakeFromNib {
30 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(beginEditing:) name:UITextViewTextDidBeginEditingNotification object:self];
31 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(endEditing:) name:UITextViewTextDidEndEditingNotification object:self];
32 |
33 | self.realTextColor = self.textColor;
34 | self.placeholderColor = [UIColor lightGrayColor];
35 | }
36 |
37 | #pragma mark -
38 | #pragma mark Setter/Getters
39 |
40 | - (void) setPlaceholder:(NSString *)aPlaceholder {
41 | if ([self.realText isEqualToString:placeholder] && ![self isFirstResponder]) {
42 | self.text = aPlaceholder;
43 | }
44 | if (aPlaceholder != placeholder) {
45 | placeholder = aPlaceholder;
46 | }
47 |
48 |
49 | [self endEditing:nil];
50 | }
51 |
52 | - (void)setPlaceholderColor:(UIColor *)aPlaceholderColor {
53 | placeholderColor = aPlaceholderColor;
54 |
55 | if ([super.text isEqualToString:self.placeholder]) {
56 | self.textColor = self.placeholderColor;
57 | }
58 | }
59 |
60 | - (NSString *) text {
61 | NSString* text = [super text];
62 | if ([text isEqualToString:self.placeholder]) return @"";
63 | return text;
64 | }
65 |
66 | - (void) setText:(NSString *)text {
67 | if (([text isEqualToString:@""] || text == nil) && ![self isFirstResponder]) {
68 | super.text = self.placeholder;
69 | }
70 | else {
71 | super.text = text;
72 | }
73 |
74 | if ([text isEqualToString:self.placeholder] || text == nil) {
75 | self.textColor = self.placeholderColor;
76 | }
77 | else {
78 | self.textColor = self.realTextColor;
79 | }
80 | }
81 |
82 | - (NSString *) realText {
83 | return [super text];
84 | }
85 |
86 | - (void) beginEditing:(NSNotification*) notification {
87 | if ([self.realText isEqualToString:self.placeholder]) {
88 | super.text = nil;
89 | self.textColor = self.realTextColor;
90 | }
91 | }
92 |
93 | - (void) endEditing:(NSNotification*) notification {
94 | if ([self.realText isEqualToString:@""] || self.realText == nil) {
95 | super.text = self.placeholder;
96 | self.textColor = self.placeholderColor;
97 | }
98 | }
99 |
100 | - (void) setTextColor:(UIColor *)textColor {
101 | if ([self.realText isEqualToString:self.placeholder]) {
102 | if ([textColor isEqual:self.placeholderColor]){
103 | [super setTextColor:textColor];
104 | } else {
105 | self.realTextColor = textColor;
106 | }
107 | }
108 | else {
109 | self.realTextColor = textColor;
110 | [super setTextColor:textColor];
111 | }
112 | }
113 |
114 | -(void) SetEditbox:(NSObject*)box
115 | {
116 | _editBox = box;
117 |
118 | }
119 |
120 | #pragma mark -
121 | #pragma mark Dealloc
122 |
123 | - (void)dealloc {
124 | [[NSNotificationCenter defaultCenter] removeObserver:self];
125 |
126 | }
127 |
128 | @end
--------------------------------------------------------------------------------
/release/NativeEditPlugin/Plugins/iOS/JsonObject.m:
--------------------------------------------------------------------------------
1 | //
2 | // JsonObject.m
3 | // stockissue
4 | //
5 | // Created by KYUNGMIN BANG on 12/8/14.
6 | // Copyright (c) 2014 Nureka Inc. All rights reserved.
7 | //
8 |
9 | #import "JsonObject.h"
10 |
11 |
12 | @implementation JsonObject
13 | @synthesize dict;
14 |
15 | -(void) dealloc
16 | {
17 | dict = nil;
18 | }
19 |
20 | -(id)init
21 | {
22 | self = [super init];
23 | if (self)
24 | {
25 | dict = [[NSMutableDictionary alloc] init];
26 |
27 | }
28 | return self;
29 | }
30 |
31 | -(id)initWithDictionary:(NSMutableDictionary*) _dict
32 | {
33 | self = [super init];
34 | if (self)
35 | {
36 | dict = _dict;
37 |
38 | }
39 | return self;
40 | }
41 |
42 | -(id)initWithJsonData:(NSData*) json
43 | {
44 | self = [super init];
45 | if (self)
46 | {
47 | NSError *error;
48 |
49 | dict = [NSJSONSerialization
50 | JSONObjectWithData:json
51 | options:NSJSONReadingMutableContainers
52 | error:&error];
53 | if (dict == nil)
54 | {
55 | NSLog(@"Json parse error %@",[error description]);
56 | }
57 | }
58 | return self;
59 | }
60 | -(id)initWithCmd:(NSString*) cmd
61 | {
62 | self = [self init];
63 | if (dict)
64 | {
65 | dict[@"cmd"] = cmd;
66 | }
67 | return self;
68 | }
69 |
70 | -(NSData*)serialize
71 | {
72 | NSError *error;
73 | NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dict
74 | options:0
75 | error:&error];
76 | return jsonData;
77 | }
78 |
79 | -(void) setInt:(NSString*) key value:(int)value
80 | {
81 | dict[key] = [NSNumber numberWithInt:value];
82 | }
83 | -(void) setFloat:(NSString*) key value:(float)value
84 | {
85 | dict[key] = [NSNumber numberWithFloat:value];
86 | }
87 | -(void) setBool:(NSString*) key value:(BOOL)value
88 | {
89 | dict[key] = [NSNumber numberWithBool:value];
90 | }
91 | -(void) setString:(NSString*) key value:(NSString*)value
92 | {
93 | dict[key] = value;
94 | }
95 | -(void) setArray:(NSString*) key value:(NSArray*) value
96 | {
97 | dict[key] = value;
98 | }
99 | -(void) setJsonObject:(NSString*) key value:(JsonObject*) value
100 | {
101 | dict[key] = value.dict;
102 | }
103 |
104 | -(int) getInt:(NSString*) key
105 | {
106 | id obj = [dict objectForKey:key];
107 | if (obj == nil || obj == (id)[NSNull null]) return 0;
108 | return [obj intValue];
109 | }
110 | -(float) getFloat:(NSString*) key
111 | {
112 | id obj = [dict objectForKey:key];
113 | if (obj == nil || obj == (id)[NSNull null]) return 0.0f;
114 | return [obj floatValue];
115 | }
116 | -(BOOL) getBool:(NSString*) key
117 | {
118 | id obj = [dict objectForKey:key];
119 | if (obj == nil || obj == (id)[NSNull null]) return NO;
120 | return [obj boolValue];
121 | }
122 | -(NSString*) getString:(NSString*) key
123 | {
124 | id obj = [dict objectForKey:key];
125 | if (!obj || obj == (id)[NSNull null]) return @"";
126 | return (NSString*) obj;
127 | }
128 | -(NSArray*) getDictArray:(NSString*) key
129 | {
130 | id obj = [dict objectForKey:key];
131 | if (obj == nil || obj == (id)[NSNull null]) return [[NSArray alloc] init];
132 | return (NSArray*) obj;
133 | }
134 | -(NSArray*) getJsonArray:(NSString*) key
135 | {
136 | id obj = [dict objectForKey:key];
137 | NSMutableArray* arr = [[NSMutableArray alloc] init];
138 | if (obj == nil || obj == (id)[NSNull null]) return arr;
139 | for (id arrObj in (NSMutableArray*) obj) {
140 | JsonObject* newObj = [[JsonObject alloc] initWithDictionary:(NSMutableDictionary*) arrObj];
141 | [arr addObject:newObj];
142 | }
143 | return (NSArray*) arr;
144 | }
145 | -(JsonObject*) getJsonObject:(NSString*) key
146 | {
147 | id obj = [dict objectForKey:key];
148 | JsonObject* newObj = [[JsonObject alloc] init];
149 | if (obj == nil || obj == (id)[NSNull null]) return newObj;
150 | newObj.dict = (NSMutableDictionary*) obj;
151 | return newObj;
152 | }
153 |
154 | @end
155 |
--------------------------------------------------------------------------------
/src/androidProj/nativeeditplugin/src/main/java/com/bkmin/android/NativeEditPlugin.java:
--------------------------------------------------------------------------------
1 | package com.bkmin.android;
2 |
3 | import android.app.Activity;
4 | import android.util.Log;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.RelativeLayout;
8 |
9 | import com.unity3d.player.UnityPlayer;
10 |
11 | import org.json.JSONObject;
12 |
13 | public class NativeEditPlugin {
14 | public static Activity unityActivity;
15 | public static ViewGroup rootView;
16 | private static RelativeLayout mainLayout;
17 | private static ViewGroup topViewGroup;
18 | private static String unityName = "";
19 |
20 | static final String LOG_TAG = "NativeEditPlugin";
21 |
22 | private static View getLeafView(View view) {
23 | if (view instanceof ViewGroup) {
24 | ViewGroup vg = (ViewGroup) view;
25 | for (int i = 0; i < vg.getChildCount(); ++i) {
26 | View childView = vg.getChildAt(i);
27 | View result = getLeafView(childView);
28 | if (result != null)
29 | return result;
30 | }
31 | return null;
32 | } else {
33 | Log.i(LOG_TAG, "Found leaf view");
34 | return view;
35 | }
36 | }
37 |
38 | @SuppressWarnings("unused")
39 | public static void InitPluginMsgHandler(final String _unityName) {
40 | unityActivity = UnityPlayer.currentActivity;
41 | unityName = _unityName;
42 |
43 | unityActivity.runOnUiThread(new Runnable() {
44 | public void run() {
45 | if (mainLayout != null)
46 | topViewGroup.removeView(mainLayout);
47 |
48 | rootView = unityActivity.findViewById(android.R.id.content);
49 | View topMostView = getLeafView(rootView);
50 | topViewGroup = (ViewGroup) topMostView.getParent();
51 | mainLayout = new RelativeLayout(unityActivity);
52 | RelativeLayout.LayoutParams rlp = new RelativeLayout.LayoutParams(
53 | RelativeLayout.LayoutParams.MATCH_PARENT,
54 | RelativeLayout.LayoutParams.MATCH_PARENT);
55 | topViewGroup.addView(mainLayout, rlp);
56 |
57 | rootView.setOnSystemUiVisibilityChangeListener
58 | (new View.OnSystemUiVisibilityChangeListener() {
59 | @Override
60 | public void onSystemUiVisibilityChange(int visibility) {
61 | int systemUiVisibilitySettings =
62 | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
63 | | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
64 | | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
65 | | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
66 | | View.SYSTEM_UI_FLAG_FULLSCREEN
67 | | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
68 | rootView.setSystemUiVisibility(systemUiVisibilitySettings);
69 | }
70 | });
71 | }
72 | });
73 | }
74 |
75 | @SuppressWarnings("unused")
76 | public static void ClosePluginMsgHandler() {
77 | unityActivity.runOnUiThread(new Runnable() {
78 | public void run() {
79 | topViewGroup.removeView(mainLayout);
80 | }
81 | });
82 | }
83 |
84 | public static void SendUnityMessage(JSONObject jsonMsg) {
85 | UnityPlayer.UnitySendMessage(unityName, "OnMsgFromPlugin", jsonMsg.toString());
86 | }
87 |
88 | @SuppressWarnings("unused")
89 | public static String SendUnityMsgToPlugin(final int nSenderId, final String jsonMsg) {
90 | final Runnable task = new Runnable() {
91 | public void run() {
92 | EditBox.processRecvJsonMsg(mainLayout, nSenderId, jsonMsg);
93 | }
94 | };
95 | unityActivity.runOnUiThread(task);
96 | return new JSONObject().toString();
97 | }
98 |
99 | }
100 |
--------------------------------------------------------------------------------
/release/NativeEditPlugin/scripts/JsonObject.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using MiniJSON_Min;
4 | using Object = UnityEngine.Object;
5 |
6 | /*
7 | * Copyright (c) 2015 Kyungmin Bang
8 | *
9 | * Permission is hereby granted, free of charge, to any person obtaining
10 | * a copy of this software and associated documentation files (the
11 | * "Software"), to deal in the Software without restriction, including
12 | * without limitation the rights to use, copy, modify, merge, publish,
13 | * distribute, sublicense, and/or sell copies of the Software, and to
14 | * permit persons to whom the Software is furnished to do so, subject to
15 | * the following conditions:
16 | *
17 | * The above copyright notice and this permission notice shall be
18 | * included in all copies or substantial portions of the Software.
19 | *
20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 | */
28 |
29 |
30 | ///
31 | /// JsonObject provide safe and type-compatible wrapper to access Json Element
32 | /// Safe means, even if a certain Json doesn't contain 'key', it doesn't crash.
33 | ///
34 | public class JsonObject : Object
35 | {
36 | ///
37 | /// Supported object type : double, bool, string, List, Array!
38 | ///
39 | public Dictionary objectDict;
40 |
41 | public JsonObject()
42 | {
43 | objectDict = new Dictionary();
44 | }
45 |
46 | public JsonObject(string strJson)
47 | {
48 | objectDict = Json.Deserialize(strJson) as Dictionary;
49 | }
50 |
51 | public JsonObject(Dictionary dict)
52 | {
53 | objectDict = dict;
54 | }
55 |
56 | public object this[string key]
57 | {
58 | get { return objectDict[key]; }
59 | set { objectDict[key] = value; }
60 | }
61 |
62 | public string getCmd()
63 | {
64 | return (string) objectDict["cmd"];
65 | }
66 |
67 | public string Serialize()
68 | {
69 | var strData = Json.Serialize(objectDict);
70 | return strData;
71 | }
72 |
73 | //// Deserialize helper
74 |
75 | private object GetDictValue(string key)
76 | {
77 | object obj;
78 | if(objectDict.TryGetValue(key, out obj))
79 | return obj ?? "";
80 | return "";
81 | }
82 |
83 | public bool KeyExist(string key)
84 | {
85 | object obj;
86 | if(objectDict.TryGetValue(key, out obj))
87 | return true;
88 | return false;
89 | }
90 |
91 | public Dictionary GetJsonDict(string key)
92 | {
93 | object obj;
94 | if(objectDict.TryGetValue(key, out obj))
95 | return (Dictionary) obj;
96 | return new Dictionary();
97 | }
98 |
99 | public JsonObject GetJsonObject(string key)
100 | {
101 | var dict = GetJsonDict(key);
102 | return new JsonObject(dict);
103 | }
104 |
105 | public bool GetBool(string key)
106 | {
107 | bool val;
108 | if(bool.TryParse(GetDictValue(key).ToString(), out val)) return val;
109 | return false;
110 | }
111 |
112 | public int GetInt(string key)
113 | {
114 | int val;
115 | if(int.TryParse(GetDictValue(key).ToString(), out val)) return val;
116 | return 0;
117 | }
118 |
119 | public float GetFloat(string key)
120 | {
121 | float val;
122 | if(float.TryParse(GetDictValue(key).ToString(), out val)) return val;
123 | return 0.0f;
124 | }
125 |
126 | public string GetString(string key)
127 | {
128 | return GetDictValue(key).ToString();
129 | }
130 |
131 | public object GetEnum(Type type, string key)
132 | {
133 | var obj = (string) GetDictValue(key);
134 | if(obj.Length > 0)
135 | return Enum.Parse(type, obj);
136 | return 0;
137 | }
138 |
139 | public List GetListJsonObject(string key)
140 | {
141 | object obj;
142 | var retList = new List();
143 | if(objectDict.TryGetValue(key, out obj))
144 | foreach(var elem in (List