设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2247|回复: 10
打印 上一主题 下一主题

[已经过期] 求助,怎么把名称输入变成中文!

[复制链接]

Lv1.梦旅人

梦石
0
星屑
123
在线时间
7 小时
注册时间
2022-4-18
帖子
8
跳转到指定楼层
1
发表于 2022-5-5 08:52:13 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
如题,怎么改成中文

QQ截图20220505085111.jpg (33.03 KB, 下载次数: 4)

QQ截图20220505085111.jpg

Lv3.寻梦者

梦石
0
星屑
1733
在线时间
484 小时
注册时间
2006-1-7
帖子
1073
2
发表于 2022-5-5 11:30:57 | 只看该作者
脚本 Window_NameInput 中
把日文替换成你想要的中文。当然这样做能输入的字也是有限的,想我泱泱中华古今文字何止几页,
所以这边推荐亲去论坛搜一下 输入法
我在用夏娜的完美输入法
不过这个脚本需要有一定的脚本基础,不建议纯新手使用,纯新手可以看看别的
初从文,三年不中;后习武,校场发一矢,中鼓吏,逐之出;遂学医,有所成。自撰一良方,服之,卒。
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2421
在线时间
162 小时
注册时间
2020-8-9
帖子
106
3
发表于 2022-5-5 11:40:41 | 只看该作者
我记得事件里有一个可以输入中文的事件,在事件脚本里指定一个变量获取输入值,再让人物名字和这个变量相同
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
123
在线时间
7 小时
注册时间
2022-4-18
帖子
8
4
 楼主| 发表于 2022-5-6 16:23:04 | 只看该作者
白鬼 发表于 2022-5-5 11:30
脚本 Window_NameInput 中
把日文替换成你想要的中文。当然这样做能输入的字也是有限的,想我泱泱中华古今 ...

问问大佬有没有适合萌新(简单)的教程或能直接插入的脚本呢
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1389
在线时间
196 小时
注册时间
2021-8-19
帖子
43
5
发表于 2022-5-6 18:48:48 | 只看该作者
本帖最后由 guoxiaomi 于 2022-5-10 00:21 编辑

JAVASCRIPT 代码复制
  1. *:
  2. * RS_Window_KorNameEdit.js
  3. * @plugindesc This plugin allows you to type in korean in the Name Input Proccessing <RS_Window_KorNameEdit>
  4. *
  5. * @author biud436
  6. * [url=home.php?mod=space&uid=146643]@SINCE[/url] 2015.10.19
  7. * @version 1.6.0 (2016.06.18)
  8. *
  9. * @param windowWidth
  10. * @desc Number
  11. * @default 580
  12. *
  13. * @param windowCenter
  14. * @desc Boolean
  15. * @default false
  16. *
  17. * @param editWindow_Opacity
  18. * @desc This value is opacity of a name edit window between 0 and 255.
  19. * @default 225
  20. *
  21. * @param askingText
  22. * @desc This is a text hint
  23. * @default Please enter the name
  24. *
  25. * @param outlineWidth
  26. * @desc
  27. * @default 1
  28. *
  29. * @param outlineColor
  30. * @desc
  31. * @default black
  32. *
  33. * @param fontColor
  34. * @desc
  35. * @default white
  36. *
  37. * @param standardFontSize
  38. * @desc
  39. * @default 28
  40. *
  41. * @param Chinese Fonts
  42. * @desc
  43. * @default SimHei, Heiti TC, sans-serif
  44. *
  45. * @param Korean Fonts
  46. * @desc
  47. * @default Dotum, AppleGothic, sans-serif
  48. *
  49. * @param Default Fonts
  50. * @desc
  51. * @default GameFont
  52. *
  53. * @help
  54. * This plugin provides a keyboard that allows you to type in korean
  55. * or other native language in the Name Input Proccessing.
  56. *
  57. * This plugin provides following the pluginCommand below.
  58. *
  59. * KNE width number
  60. * KNE center true/false
  61. * KNE outlineWidth number
  62. * KNE outlineColor string
  63. * KNE fontColor string
  64. * KNE fontSize number
  65. * KNE opacity number
  66. * KNE askText string
  67. *
  68. * - Change Log
  69. * 2016.03.05 (v1.3.3) - Fixed the class structure.
  70. * 2016.03.22 (v1.4.0) - Fixed a bug that causes a serious problem.
  71. * 2016.04.05 (v1.5.0) - Fixed a bug that causes to delete the text automatically
  72. * when you can type Hangul text of length less than 2.
  73. * 2016.06.18 (v1.6.0) - Fixed the inheritance structure, and the parameter called 'askText'.
  74. * 2016.08.09 (v1.6.1) - Fixed shouldPreventDefault function of Input class.
  75. */
  76. /*:ko
  77.   * RS_Window_KorNameEdit.js
  78.   * @plugindesc 한글 이름 입력 처리 플러그인입니다. <RS_Window_KorNameEdit>
  79.   * @author 러닝은빛(biud436)
  80.   *
  81.   * @since 2015.10.19
  82.   * @version 1.6.0 (2016.06.18)
  83.   *
  84.   * @param windowWidth
  85.   * @desc 숫자값을 입력하세요.
  86.   * @default 580
  87.   *
  88.   * @param windowCenter
  89.   * @desc true 또는 false를 입력하세요.
  90.   * @default false
  91.   *
  92.   * @param editWindow_Opacity
  93.   * @desc 이름 윈도우의 투명도 값으로 0 ~ 255 사이의 숫자 값을 입력하세요.
  94.   * @default 225
  95.   *
  96.   * @param askingText
  97.   * @desc 텍스트 힌트
  98.   * @default 이름을 입력하세요.
  99.   *
  100.   * @param outlineWidth
  101.   * @desc 테두리 두께
  102.   * @default 1
  103.   *
  104.   * @param outlineColor
  105.   * @desc 테두리 색상
  106.   * @default black
  107.   *
  108.   * @param fontColor
  109.   * @desc 폰트 색상
  110.   * @default white
  111.   *
  112.   * @param standardFontSize
  113.   * @desc 기본 폰트 크기
  114.   * @default 28
  115.   *
  116.   * @param Chinese Fonts
  117.   * @desc 중국어 폰트
  118.   * @default SimHei, Heiti TC, sans-serif
  119.   *
  120.   * @param Korean Fonts
  121.   * @desc 한국어 폰트
  122.   * @default Dotum, AppleGothic, sans-serif
  123.   *
  124.   * @param Default Fonts
  125.   * @desc 기본 폰트
  126.   * @default GameFont
  127.   *
  128.   * @help
  129.   *
  130.   * 이 플러그인은 아래와 같은 플러그인 커맨드를 제공합니다.
  131.   *
  132.   * 한국어 명령어 (Korean)
  133.   * KNE 폭 숫자
  134.   * KNE 중앙정렬 true/false
  135.   * KNE 테두리크기 숫자
  136.   * KNE 테두리색상 문자열
  137.   * KNE 폰트색상 문자열
  138.   * KNE 폰트크기 숫자
  139.   * KNE 투명도 숫자
  140.   * KNE 텍스트 문자열
  141.   *
  142.   * - Change Log
  143.   * 2015.10.19 - 최초 작성일
  144.   * 2015.12.10 - 버그 픽스(화면 축소 버그 수정)
  145.   * 2016.02.15 - 플러그인 매개변수 및 플러그인 커맨드 추가
  146.   * 2016.03.22 - 플러그인 커맨드에서 문자열을 길게 쓸 수 있게 되었으며 백스페이스 버그를 수정했습니다.
  147.   * 2016.04.05 - 한글 입력 시, 두 글자 이상을 꼭 입력해야 하는 버그가 수정되었습니다.
  148.   * 2016.06.18 - 상속 구조 변경, 파라미터 기본 값 수정, 폰트 변경 기능 추가, 시스템 언어에 따라 글자 폭 자동 감지 기능 추가
  149.   */
  150.  
  151. var Imported = Imported || {};
  152. Imported.Window_KorNameEdit = true;
  153.  
  154. (function() {
  155.  
  156.   // private static class
  157.   function RSMatch() {
  158.       throw new Error('This is a static class');
  159.   }
  160.  
  161.   // private class
  162.   function TextBox() {
  163.     this.initialize.apply(this, arguments);
  164.   };
  165.  
  166.   //===========================================================================
  167.   // Private Members
  168.   //===========================================================================
  169.  
  170.   var parameters = $plugins.filter(function (i) {
  171.     return i.description.contains('<RS_Window_KorNameEdit>');
  172.   });
  173.  
  174.   parameters = (parameters.length > 0) && parameters[0].parameters;
  175.  
  176.   RSMatch.windowWidth = Number(parameters['windowWidth'] || 580);
  177.   RSMatch.windowCenter = String(parameters['windowCenter'] || 'false');
  178.   RSMatch.outlineWidth = Number(parameters['outlineWidth'] || 1);
  179.   RSMatch.outlineColor = String(parameters['outlineColor'] || 'black');
  180.   RSMatch.fontColor = String(parameters['fontColor'] || 'white');
  181.   RSMatch.opacity = Number(parameters['editWindow_Opacity'] || 225);
  182.   RSMatch.askText = String(parameters['askingText'] || 'Please enter the name');
  183.   RSMatch.standardFontSize = Number(parameters['standardFontSize'] || 28);
  184.   RSMatch.fonts = {
  185.     'ChineseFonts': parameters['Chinese Fonts'] || 'SimHei, Heiti TC, sans-serif',
  186.     'KoreanFonts': parameters['Korean Fonts'] || 'Dotum, AppleGothic, sans-serif',
  187.     'DefaultFonts': parameters['Default Fonts'] || 'GameFont',
  188.   };
  189.  
  190.   var original_Input_shouldPreventDefault = Input._shouldPreventDefault;
  191.   var dialog_Input_shouldPreventDefault = function(keyCode) {
  192.       switch (keyCode) {
  193.       case 33:    // pageup
  194.       case 34:    // pagedown
  195.       case 37:    // left arrow
  196.       case 38:    // up arrow
  197.       case 39:    // right arrow
  198.       case 40:    // down arrow
  199.           return true;
  200.       }
  201.       return false;
  202.   };
  203.  
  204.  
  205.   //===========================================================================
  206.   // TextBox Class
  207.   //===========================================================================
  208.  
  209.   TextBox.BACK_SPACE = 8;
  210.   TextBox.ENTER = 13;
  211.   TextBox.IS_NOT_CHAR = 32;
  212.   TextBox.KEYS_ARRAY = 255;
  213.  
  214.   TextBox.prototype.initialize = function(_editWindow)  {
  215.     this._editWindow = _editWindow;
  216.     this.createTextBox();
  217.     this.getFocus();
  218.     this.startToConvertInput();
  219.   };
  220.  
  221.   TextBox.prototype.createTextBox = function() {
  222.     this._textBox = document.createElement('input');
  223.     this._textBox.type = "text";
  224.     this._textBox.id = "textBox";
  225.     this._textBox.style.opacity = 0;
  226.     this._textBox.style.zIndex = 1000;
  227.     this._textBox.autofocus = false;
  228.     this._textBox.width = 1;
  229.     this._textBox.height = 1;
  230.     this._textBox.multiple = false;
  231.     this._textBox.style.imeMode = 'active';
  232.  
  233.     if($gameSystem.isJapanese()) {
  234.       this._textBox.inputmode = 'katakana';
  235.     }
  236.  
  237.     this._textBox.style.position = 'absolute';
  238.     this._textBox.style.top = 0;
  239.     this._textBox.style.left = 0;
  240.     this._textBox.style.right = 0;
  241.     this._textBox.style.bottom = 0;
  242.  
  243.     this._textBox.onkeydown = this.onKeyDown.bind(this);
  244.  
  245.     document.body.appendChild(this._textBox);
  246.   };
  247.  
  248.   TextBox.prototype.startToConvertInput = function () {
  249.     Input._shouldPreventDefault = dialog_Input_shouldPreventDefault;
  250.   };
  251.  
  252.   TextBox.prototype.startToOriginalInput = function () {
  253.     Input._shouldPreventDefault = original_Input_shouldPreventDefault;
  254.   };
  255.  
  256.  
  257.   TextBox.prototype.setEvent = function(func) {
  258.     this._textBox.onchange = func;
  259.   };
  260.  
  261.   TextBox.prototype.terminateTextBox = function() {
  262.     document.body.removeChild(this._textBox);
  263.     this.startToOriginalInput();
  264.   };
  265.  
  266.   TextBox.prototype.onKeyDown = function(e) {
  267.     var keyCode = e.which;
  268.     this.getFocus();
  269.     if (keyCode < TextBox.IS_NOT_CHAR) {
  270.       if(keyCode === TextBox.BACK_SPACE) {
  271.         this.backSpace();
  272.       } else if(keyCode === TextBox.ENTER) {
  273.         if(this.getTextLength() <= 0) {
  274.           e.preventDefault();
  275.           // console.error("아무 글자도 입력하지 않았습니다");
  276.         }
  277.       }
  278.     } else if (keyCode < TextBox.KEYS_ARRAY) {
  279.       //
  280.     }
  281.   }
  282.  
  283.   TextBox.prototype.getTextLength = function() {
  284.     return this._textBox.value.length;
  285.   };
  286.  
  287.   TextBox.prototype.getMaxLength = function() {
  288.     return this._editWindow._maxLength;
  289.   };
  290.  
  291.   TextBox.prototype.backSpace = function() {
  292.     this._editWindow._name = this._editWindow._name.slice(0, this._textBox.value.length - 1);
  293.     this._editWindow._index = this._textBox.value.length;
  294.     this._textBox.value = this._editWindow._name;
  295.     this._editWindow.refresh();
  296.   };
  297.  
  298.   TextBox.prototype.refreshNameEdit = function()  {
  299.     this._editWindow._name = this._textBox.value.toString();
  300.     this._editWindow._index = this._textBox.value.length || 0;
  301.     this._editWindow.refresh();
  302.   };
  303.  
  304.   TextBox.prototype.update = function() {
  305.     if(this.getTextLength() <= this._editWindow._maxLength) {
  306.       this.refreshNameEdit();
  307.     }
  308.   };
  309.  
  310.   TextBox.prototype.getFocus = function() {
  311.     this._textBox.focus();
  312.   };
  313.  
  314.   TextBox.prototype.terminate =  function() {
  315.     this.terminateTextBox();
  316.   };
  317.  
  318.   //===========================================================================
  319.   // Window_NameEdit Class
  320.   //===========================================================================
  321.  
  322.   function Window_KorNameEdit() {
  323.      this.initialize.apply(this, arguments);
  324.   }
  325.  
  326.   Window_KorNameEdit.prototype = Object.create(Window_NameEdit.prototype);
  327.   Window_KorNameEdit.prototype.constructor = Window_KorNameEdit;
  328.  
  329.   Window_KorNameEdit.prototype.initialize = function(actor, maxLength) {
  330.     Window_NameEdit.prototype.initialize.call(this, actor, maxLength);
  331.   };
  332.  
  333.   Window_KorNameEdit.prototype.standardFontFace = function() {
  334.       if ($gameSystem.isChinese()) {
  335.           return RSMatch.fonts.ChineseFonts;
  336.       } else if ($gameSystem.isKorean()) {
  337.           return RSMatch.fonts.KoreanFonts;
  338.       } else {
  339.           return RSMatch.fonts.DefaultFonts;
  340.       }
  341.   };
  342.  
  343.   Window_KorNameEdit.prototype.charWidth = function () {
  344.     var text = 'A';
  345.     if (navigator.language.match(/^zh/)) { // isChinese
  346.         text = '\u4E00';
  347.     } else if (navigator.language.match(/^ko/)) { // isKorean
  348.         text = '\uAC00';
  349.     }
  350.     return this.textWidth(text);
  351.   };
  352.  
  353.   Window_KorNameEdit.prototype.drawActorFace = function(actor, x, y, width, height) {
  354.       this.drawFace(actor.faceName(), actor.faceIndex(), x, y, width, height);
  355.       this.changeTextColor(this.hpColor(actor));
  356.       this.drawText(RSMatch.askText, this.left(), y + this.fittingHeight(1) / 2, this.width);
  357.   };
  358.  
  359.   Window_KorNameEdit.prototype.itemRect = function(index) {
  360.       return {
  361.           x: this.left() + index * this.charWidth(),
  362.           y: this.fittingHeight(1),
  363.           width: this.charWidth(),
  364.           height: this.lineHeight()
  365.       };
  366.   };
  367.  
  368.   Window_KorNameEdit.prototype.windowWidth = function () {
  369.     return RSMatch.windowWidth;
  370.   };
  371.  
  372.   Window_KorNameEdit.prototype.drawChar = function (index) {
  373.     var rect = this.itemRect(index);
  374.     this.resetTextColor();
  375.     this.contents.outlineWidth = RSMatch.outlineWidth;
  376.     this.contents.outlineColor = RSMatch.outlineColor;
  377.     this.contents.fontColor = RSMatch.fontColor;
  378.     this.drawText(this._name[index] || '', rect.x, rect.y)
  379.   };
  380.  
  381.   Window_KorNameEdit.prototype.standardFontSize = function() {
  382.       return RSMatch.standardFontSize;
  383.   };
  384.  
  385.   //===========================================================================
  386.   // Scene_Name Class
  387.   //===========================================================================
  388.  
  389.   function Scene_KorName() {
  390.       this.initialize.apply(this, arguments);
  391.   }
  392.  
  393.   Scene_KorName.prototype = Object.create(Scene_Name.prototype);
  394.   Scene_KorName.prototype.constructor = Scene_KorName;
  395.  
  396.   Scene_KorName.prototype.initialize = function() {
  397.       Scene_Name.prototype.initialize.call(this);
  398.   };
  399.  
  400.   Scene_KorName.prototype.update = function() {
  401.     Scene_Name.prototype.update.call(this);
  402.   }
  403.  
  404.   Scene_KorName.prototype.create = function () {
  405.     Scene_MenuBase.prototype.create.call(this);
  406.     this._actor = $gameActors.actor(this._actorId);
  407.     this.createEditWindow();
  408.     this.createTextBox();
  409.     this._textBox.setEvent( this.onInputOk.bind(this) );
  410.   };
  411.  
  412.   Scene_KorName.prototype.createEditWindow = function() {
  413.       this._editWindow = new Window_KorNameEdit(this._actor, this._maxLength);
  414.       this.addWindow(this._editWindow);
  415.   };
  416.  
  417.   Scene_KorName.prototype.createTextBox =  function() {
  418.     this._textBox = new TextBox(this._editWindow);
  419.     if(RSMatch.windowCenter === "true") {
  420.       this._editWindow.y = Graphics.boxHeight / 2 - this._editWindow.height / 2;
  421.     }
  422.     this._editWindow.opacity = RSMatch.opacity;
  423.   }
  424.  
  425.   Scene_KorName.prototype.update = function() {
  426.     this._textBox.getFocus();
  427.     this._textBox.update();
  428.     Scene_MenuBase.prototype.update.call(this);
  429.   }
  430.  
  431.   Scene_KorName.prototype.terminate = function() {
  432.     Scene_MenuBase.prototype.terminate.call(this);
  433.     this._textBox.terminate();
  434.   }
  435.  
  436.   //===========================================================================
  437.   // Game_Interpreter
  438.   //===========================================================================
  439.  
  440.   // Name Input Processing
  441.   Game_Interpreter.prototype.command303 = function() {
  442.       if (!$gameParty.inBattle()) {
  443.           if ($dataActors[this._params[0]]) {
  444.               SceneManager.push(Scene_KorName);
  445.               SceneManager.prepareNextScene(this._params[0], this._params[1]);
  446.           }
  447.       }
  448.       return true;
  449.   };
  450.  
  451.   //===========================================================================
  452.   // Game_Interpreter
  453.   //===========================================================================
  454.  
  455.   var alias_Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
  456.   Game_Interpreter.prototype.pluginCommand = function(command, args) {
  457.       alias_Game_Interpreter_pluginCommand.call(this, command, args);
  458.       if(command === "KNE") {
  459.         switch(args[0]) {
  460.           case 'width':
  461.           case '폭':
  462.             RSMatch.windowWidth = Number(args[1] || 580);
  463.             break;
  464.           case 'center':
  465.           case '중앙정렬':
  466.             RSMatch.windowCenter = String(args[1] || 'false');
  467.             break;
  468.           case 'outlineWidth':
  469.           case '테두리크기':
  470.             RSMatch.windowWidth = Number(args[1] || 1);
  471.             break;
  472.           case 'outlineColor':
  473.           case '테두리색상':
  474.             RSMatch.outlineColor = String(args[1] || 'black');
  475.             break;
  476.           case 'fontColor':
  477.           case '폰트색상':
  478.             RSMatch.fontColor = String(args[1] || 'white');
  479.             break;
  480.           case 'fontSize':
  481.           case '폰트크기':
  482.             RSMatch.standardFontSize = Number(args[1] || 28);
  483.             break;
  484.           case 'opacity':
  485.           case '투명도':
  486.             var _opacity = Number(args[1] || 1);
  487.             RSMatch.opacity = _opacity.clamp(0, 255);
  488.             break;
  489.           case 'askText':
  490.           case '텍스트':
  491.             RSMatch.askText = String(args.slice(1).join(""));
  492.             break;
  493.         }
  494.       }
  495.   };
  496.  
  497. })();

点评

兄弟你发错区了,不过也没关系,我只是帮你添上了代码框  发表于 2022-5-10 00:21
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
7946
在线时间
1182 小时
注册时间
2007-7-29
帖子
2055
6
发表于 2022-5-6 23:51:29 | 只看该作者
上古帖子:https://rpg.blue/thread-174413-1-1.html
话说如果你善用搜索会发现新大陆的。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
123
在线时间
7 小时
注册时间
2022-4-18
帖子
8
7
 楼主| 发表于 2022-5-8 20:32:43 | 只看该作者
enghao_lim 发表于 2022-5-6 23:51
上古帖子:https://rpg.blue/thread-174413-1-1.html
话说如果你善用搜索会发现新大陆的。 ...

谢谢大佬,但是好像73行有bug欸(纯新人完全不会修qwq)

点评

大哥,没有人知道你的73行是什么 ==。  发表于 2022-5-14 22:22
回复 支持 反对

使用道具 举报

Lv5.捕梦者 (版主)

梦石
1
星屑
23963
在线时间
3338 小时
注册时间
2011-7-8
帖子
3925

开拓者

8
发表于 2022-5-22 20:10:23 | 只看该作者
可以看看这个帖子的10楼:https://rpg.blue/thread-484741-1-1.html

评分

参与人数 1+1 收起 理由
taeckle + 1 大神威武!

查看全部评分

熟悉rgss和ruby,xp区版主~
正在填坑:《膜拜组传奇》讲述膜拜组和学霸们的故事。
已上steam:与TXBD合作的Reformers《变革者》
* 战斗调用公共事件 *
* RGSOS 网络脚本 *
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
123
在线时间
7 小时
注册时间
2022-4-18
帖子
8
9
 楼主| 发表于 2022-11-10 20:25:53 | 只看该作者
enghao_lim 发表于 2022-5-6 23:51
上古帖子:https://rpg.blue/thread-174413-1-1.html
话说如果你善用搜索会发现新大陆的。 ...

打扰一下——!我好像看了看懂了点(?)不过大佬给的字库要放在工程文件下,我试了之后却显示没找到是怎么回事呢?
sos问题会不会太弱智了
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-20 03:06

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表