Skip to content

Commit ddcfd8d

Browse files
committed
Stability and some memory leaks have been improved.
1 parent 71df2c0 commit ddcfd8d

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

Assets/VR Text Input/Scenes/TextInputSample.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ void OnJPInput (string str) {
1515

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

2122
void Update () {

Assets/VR Text Input/Scripts/JapaneseInputHandler.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ public class JapaneseInputHandler : MonoBehaviour {
1919
bool afterVariationEntered;
2020
int consonantIndex;
2121

22+
public Color baseColor = new Color (255, 255, 255), highlightColor = new Color (255, 0, 0);
23+
2224
TextHandler receiver;
2325
KanjiConverter kanji;
2426

@@ -101,8 +103,8 @@ void Update () {
101103
//パネルの色を変えて振動させる
102104
if (kanji.isConverting == false && currentHandPosition != prevPosition) {
103105
OVRHaptics.RightChannel.Mix (hapticsClip);
104-
selectorTexts [prevPosition].color = new Color (255, 255, 255);
105-
selectorTexts [currentHandPosition].color = new Color (255, 0, 0);
106+
selectorTexts [prevPosition].color = baseColor;
107+
selectorTexts [currentHandPosition].color = highlightColor;
106108
}
107109

108110
//針の位置管理

Assets/VR Text Input/Scripts/KanjiConverter.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ IEnumerator Convert () {
8080
//返ってくるJSONが配列[]のみで処理できないため変換
8181
string result = www.downloadHandler.text.Replace ("[", "{");
8282
result = result.Replace ("]", "}");
83-
Debug.Log ("JSON: " + result);
8483

8584
//JSONをプログラムから扱える形式に変換
8685
JSONObject j = new JSONObject (result);

Assets/VR Text Input/Scripts/TextHandler.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ void Update () {
4444
/// <param name="str">送信する文字</param>
4545
/// <param name="deleteCount">一時入力エリアから削除する文字数</param>
4646
public void Send (string str, int deleteCount) {
47+
if (temporary.text.Length < deleteCount)
48+
deleteCount = temporary.text.Length;
4749
temporary.text = temporary.text.Remove (0, deleteCount);
4850
foreach (var item in gameObjects) {
4951
item.SendMessage ("OnJPInput", str, SendMessageOptions.DontRequireReceiver);

0 commit comments

Comments
 (0)