ユーザ用ツール

サイト用ツール

wiki:unity:tips:300

差分

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

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

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
最新リビジョン 両方とも次のリビジョン
wiki:unity:tips:300 [2015/04/16 13:54]
step
wiki:unity:tips:300 [2015/04/16 23:08]
step
ライン 1: ライン 1:
 ====== ソフトウェアキーボード処理 ====== ====== ソフトウェアキーボード処理 ======
  
-<code csharp>​ +TouchScreenKeyboardクラスを使えばOSがサポートしているソフトウェアキーボードを使うことが出来ます。
-// SoftwareKeyboard.cs +
-using UnityEngine;​+
  
-public class SoftwareKeyboard +<​html>​ 
-+<script src="​https:​//gist.github.com/step5748/898703a1584921ac9bba.js">​</script> 
-    ​// 入力結果。 +</html>
-    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