public void Init(KeyConfigManager keyConfigManager, KeyConfigType keyconfigType, KeyCode keycode) { //機能テキスト、アサインされているKeyCodeテキスト設定 KeyConfigTypeText.text = keyconfigType.GetStringValue(); assignKeyCodeText.text = keycode.ToString(); this.keyconfigType = keyconfigType; this.keyConfigManager = keyConfigManager; }
/// <summary> /// キー割り当て関連 /// </summary> //ボタンを押したキーの割り当て入力受付開始 public void KeyAssignReceipt(KeyConfigType keyConfigType) { //キーの割り当てを行っているボタンを取得 assignKeyConfigType = keyConfigType; //フォーカスを戻すボタンを控えておく selectedButton = EventSystem.current.currentSelectedGameObject; EventSystem.current.SetSelectedGameObject(null); //モード変更 titleManager.KeyAssignReceipt(); }
/// <summary> /// キー入力取得関連 /// </summary> //キーの入力を確認する private static bool InputKeyCheck(KeyConfigType keyConfigType, Func <KeyCode, bool> predicate) { if (!configMap.ContainsKey(keyConfigType)) { Debug.Log($"Error キーコンフィグDictionaryにキーが存在しません key : {keyConfigType.ToString()}"); return(false); } //key(機能)からValueのkeyCodeを取得 KeyCode keyCode = configMap[keyConfigType]; if (predicate(keyCode)) { //ログが沢山出るのでコメントアウト //Debug.Log($"キーが押されました key : {keyConfigType.ToString()}"); return(true); } return(false); }
//テキスト更新 キーコンフィグ実行時に呼ばれる public void UpdateText(KeyConfigType keyconfigType, KeyCode keycode) { //機能テキスト、アサインされているKeyCodeテキスト設定 KeyConfigTypeText.text = keyconfigType.GetStringValue(); assignKeyCodeText.text = keycode.ToString(); }
//引数の機能(決定、キャンセル等)にアサインされているキーが押下されていないかを返す public static bool GetKeyUp(KeyConfigType keyConfigType) { return(InputKeyCheck(keyConfigType, Input.GetKeyUp)); }