Skip to content

Commit

Permalink
Added kanji conversion and callbacks.
Browse files Browse the repository at this point in the history
- Kanji conversion system thanks to the Google CGI API for Japanese Input.
- OnJPInput(string) is called when kanji is confirmed.
- OnBackspace() is called when B button is pressed and when conversion area is empty.
  • Loading branch information
yutokun committed Jan 16, 2017
1 parent 8b4e885 commit baeb311
Show file tree
Hide file tree
Showing 40 changed files with 662 additions and 97 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ VRTextInput_Data/
VRTextInput.exe
*.unitypackage
VRTextInput.zip
Assets/JSON/

*.log #log files, for some plugins
*.pyc #python bytecode cache, for some plugins.
Expand Down
11 changes: 11 additions & 0 deletions Assets/CaptureScreenshot.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using UnityEngine;
using System.Collections;

public class CaptureScreenshot : MonoBehaviour {

void Update () {
if (Input.GetKeyDown (KeyCode.Space)) {
Application.CaptureScreenshot ("image.png");
}
}
}
12 changes: 12 additions & 0 deletions Assets/CaptureScreenshot.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Assets/JSON.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Assets/VR Text Input/Materials/Floor.mat
Binary file not shown.
8 changes: 8 additions & 0 deletions Assets/VR Text Input/Materials/Floor.mat.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Assets/VR Text Input/Prefabs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
8 changes: 8 additions & 0 deletions Assets/VR Text Input/Prefabs/JapaneseInputSystem.prefab.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Assets/VR Text Input/Prefabs/Kanji.prefab
Binary file not shown.
8 changes: 8 additions & 0 deletions Assets/VR Text Input/Prefabs/Kanji.prefab.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Assets/VR Text Input/Scenes/Example.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Assets/VR Text Input/Scenes/Example.unity
Binary file not shown.
Binary file not shown.
8 changes: 8 additions & 0 deletions Assets/VR Text Input/Scenes/Example/LightingData.asset.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
59 changes: 59 additions & 0 deletions Assets/VR Text Input/Scenes/Example/Lightmap-0_comp_dir.exr.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
59 changes: 59 additions & 0 deletions Assets/VR Text Input/Scenes/Example/Lightmap-0_comp_light.exr.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
60 changes: 60 additions & 0 deletions Assets/VR Text Input/Scenes/Example/ReflectionProbe-0.exr.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
60 changes: 60 additions & 0 deletions Assets/VR Text Input/Scenes/Example/ReflectionProbe-1.exr.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file removed Assets/VR Text Input/Scenes/One Hand Input 1.unity
Binary file not shown.
31 changes: 31 additions & 0 deletions Assets/VR Text Input/Scenes/TextInputSample.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;

public class TextInputSample : MonoBehaviour {

[SerializeField] TextMesh textMesh;

//漢字変換後の入力を受け取るサンプルです。
//OnJPInput(string) は漢字変換を確定するたびにコールされ、
//確定した文字列を引数として取得できます。
void OnJPInput (string str) {
textMesh.text += str;
}

//後ろの文字を消去します。仮。デリゲートでコールバックに変更する予定。
void OnBackspace () {
textMesh.text = textMesh.text.Remove (textMesh.text.Length - 1, 1);
}

void Update () {
//シーンのリロード。入力とは関係ありません。
if (OVRInput.GetDown (OVRInput.RawButton.RThumbstick))
SceneManager.LoadScene ("Example");

//19文字を超えないように調整
if (textMesh.text.Length > 19) {
textMesh.text = textMesh.text.Remove (0, 1);
}
}
}
12 changes: 12 additions & 0 deletions Assets/VR Text Input/Scenes/TextInputSample.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit baeb311

Please sign in to comment.