ユーザ用ツール

サイト用ツール

wiki:unity:tips:300

差分

この文書の現在のバージョンと選択したバージョンの差分を表示します。

この比較画面にリンクする

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
最新リビジョン 両方とも次のリビジョン
wiki:unity:tips:300 [2015/04/16 13:57]
step
wiki:unity:tips:300 [2015/04/16 23:08]
step
ライン 3: ライン 3:
 TouchScreenKeyboardクラスを使えばOSがサポートしているソフトウェアキーボードを使うことが出来ます。 TouchScreenKeyboardクラスを使えばOSがサポートしているソフトウェアキーボードを使うことが出来ます。
  
-<code csharp+<html
-// SoftwareKeyboard.cs +<script src="​https:​//gist.github.com/​step5748/​898703a1584921ac9bba.js"></​script>​ 
-using UnityEngine;​+</​html>​
  
-public class SoftwareKeyboard 
-{ 
-    // 入力結果。 
-    public enum E_RESULT 
-    { 
-        NONE = -1, 
-        DONE,       //​!<​ 入力処理が終了した。 
-        CANCEL, ​    //​!<​ 入力処理がキャンセルされた。 
-    }; 
- 
-    private static TouchScreenKeyboard m_touchScreenKeyboard = null; 
- 
-    //​------------------------------------------------------------- 
-    //! ソフトウェアキーボードオープン. 
-    //​------------------------------------------------------------- 
-    public static void Start(string _initString,​ TouchScreenKeyboardType _type = TouchScreenKeyboardType.Default) 
-    { 
-        // ソフトウェアキーボードをサポートしているか? 
-        if (!TouchScreenKeyboard.isSupported) 
-        { 
-            // サポートしていない。 
-            return; 
-        } 
- 
-        // 既に表示されているか? 
-        if (TouchScreenKeyboard.visible) 
-        { 
-        Debug.Log(false,​ "​Software keyboard already exists."​);​ 
-            return; 
-        } 
- 
-        // ソフトウェアキーボードオープン 
-        m_touchScreenKeyboard = TouchScreenKeyboard.Open(_initString,​ _type); 
-    } 
- 
-    //​------------------------------------------------------------- 
-    //! ソフトウェアキーボード終了確認. 
-    //​------------------------------------------------------------- 
-    public static bool IsEnd() 
-    { 
-        if (m_touchScreenKeyboard == null) 
-        { 
-            return true; 
-        }; 
- 
-        if (m_touchScreenKeyboard.done || m_touchScreenKeyboard.wasCanceled) 
-        { 
-            return true; 
-        } 
-        return false; 
-    } 
- 
-    //​------------------------------------------------------------- 
-    //! 入力結果を返す. 
-    //​------------------------------------------------------------- 
-    public static E_RESULT GetResult() 
-    { 
-        if (m_touchScreenKeyboard == null) 
-        { 
-            return E_RESULT.NONE;​ 
-        }; 
- 
-        // 入力の処理が終了したか 
-        if (m_touchScreenKeyboard.done) 
-        { 
-            Debug.Log("​SoftwareKeyboard Done."​);​ 
-            return E_RESULT.DONE;​ 
-        } 
-        // 入力処理がキャンセルされたかどうか 
-        else if (m_touchScreenKeyboard.wasCanceled) 
-        { 
-            Debug.Log("​SoftwareKeyboard wasCanceled."​);​ 
-            return E_RESULT.CANCEL;​ 
-        } 
-        else 
-        { 
-            Debug.Assert(false,​ "​Software keyboard invalid status."​);​ 
-        } 
-        return E_RESULT.NONE;​ 
-    } 
- 
-    //​------------------------------------------------------------- 
-    //! 入力文字列を返す. 
-    //​------------------------------------------------------------- 
-    public static string GetText() 
-    { 
-        if (m_touchScreenKeyboard == null) 
-        { 
-            return string.Empty;​ 
-        }; 
-        return m_touchScreenKeyboard.text;​ 
-    } 
-} 
- 
- 
-</​code>​ 
Permalink wiki/unity/tips/300.txt · 最終更新: 2015/12/16 12:07 by step

oeffentlich