66 lines
2 KiB
JavaScript
66 lines
2 KiB
JavaScript
var Nore;
|
|
(function (Nore) {
|
|
function showTextInput(currentText) {
|
|
var textInput = document.getElementById("textInput");
|
|
textInput.style.display = "block";
|
|
textInput.focus();
|
|
textInput.value = currentText;
|
|
textInput.placeholder = TextManager.placeholder;
|
|
$gameTemp.inInput = true;
|
|
}
|
|
Nore.showTextInput = showTextInput;
|
|
function hideTextInput() {
|
|
var textInput = document.getElementById("textInput");
|
|
textInput.style.display = "none";
|
|
textInput.blur();
|
|
/*
|
|
const textInputHankaku = document.getElementById('textInputHankaku');
|
|
textInputHankaku.style.display = 'block';
|
|
textInputHankaku.focus();
|
|
textInputHankaku.blur();
|
|
textInputHankaku.style.display = 'none';
|
|
*/
|
|
$gameTemp.inInput = false;
|
|
return textInput.value;
|
|
}
|
|
Nore.hideTextInput = hideTextInput;
|
|
var _Input_shouldPreventDefault = Input._shouldPreventDefault;
|
|
Input._shouldPreventDefault = function (keyCode) {
|
|
if ($gameTemp && !$gameTemp.inInput) {
|
|
return _Input_shouldPreventDefault.call(this);
|
|
}
|
|
switch (keyCode) {
|
|
case 8: // backspace
|
|
case 37: // left arrow
|
|
case 39: // right arrow
|
|
return false;
|
|
}
|
|
return _Input_shouldPreventDefault.call(this);
|
|
};
|
|
var _Input_onKeyDown = Input._onKeyDown;
|
|
Input._onKeyDown = function (event) {
|
|
_Input_onKeyDown.call(this, event);
|
|
if ($gameTemp && !$gameTemp.inInput) {
|
|
return;
|
|
}
|
|
if (event.keyCode == 13) {
|
|
this._currentState["enter"] = true;
|
|
}
|
|
if (event.keyCode == 27) {
|
|
this._currentState["escapeText"] = true;
|
|
}
|
|
};
|
|
var _Input_onKeyUp = Input._onKeyUp;
|
|
Input._onKeyUp = function (event) {
|
|
_Input_onKeyUp.call(this, event);
|
|
if ($gameTemp && !$gameTemp.inInput) {
|
|
return;
|
|
}
|
|
if (event.keyCode == 13) {
|
|
this._currentState["enter"] = false;
|
|
}
|
|
if (event.keyCode == 27) {
|
|
this._currentState["escapeText"] = false;
|
|
}
|
|
};
|
|
})(Nore || (Nore = {}));
|