查看: 3386|回复: 10

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

[复制链接]
梦石
0
星屑
123
在线时间
7 小时
注册时间
2022-4-18
回帖
6
发表于 2022-5-5 08:52:13 | 显示全部楼层 |阅读模式

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

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

×
如题,怎么改成中文
QQ截图20220505085111.jpg
梦石
0
星屑
1748
在线时间
485 小时
注册时间
2006-1-7
回帖
996
发表于 2022-5-5 11:30:57 | 显示全部楼层
脚本 Window_NameInput 中
把日文替换成你想要的中文。当然这样做能输入的字也是有限的,想我泱泱中华古今文字何止几页,
所以这边推荐亲去论坛搜一下 输入法
我在用夏娜的完美输入法
不过这个脚本需要有一定的脚本基础,不建议纯新手使用,纯新手可以看看别的
初从文,三年不中;后习武,校场发一矢,中鼓吏,逐之出;遂学医,有所成。自撰一良方,服之,卒。
回复

使用道具 举报

梦石
0
星屑
2881
在线时间
172 小时
注册时间
2020-8-9
回帖
100
发表于 2022-5-5 11:40:41 | 显示全部楼层
我记得事件里有一个可以输入中文的事件,在事件脚本里指定一个变量获取输入值,再让人物名字和这个变量相同
回复

使用道具 举报

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

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

使用道具 举报

梦石
0
星屑
1484
在线时间
205 小时
注册时间
2021-8-19
回帖
39
发表于 2022-5-6 18:48:48 | 显示全部楼层
本帖最后由 guoxiaomi 于 2022-5-10 00:21 编辑
  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. var Imported = Imported || {};
  151. Imported.Window_KorNameEdit = true;

  152. (function() {

  153.   // private static class
  154.   function RSMatch() {
  155.       throw new Error('This is a static class');
  156.   }

  157.   // private class
  158.   function TextBox() {
  159.     this.initialize.apply(this, arguments);
  160.   };

  161.   //===========================================================================
  162.   // Private Members
  163.   //===========================================================================

  164.   var parameters = $plugins.filter(function (i) {
  165.     return i.description.contains('<RS_Window_KorNameEdit>');
  166.   });

  167.   parameters = (parameters.length > 0) && parameters[0].parameters;

  168.   RSMatch.windowWidth = Number(parameters['windowWidth'] || 580);
  169.   RSMatch.windowCenter = String(parameters['windowCenter'] || 'false');
  170.   RSMatch.outlineWidth = Number(parameters['outlineWidth'] || 1);
  171.   RSMatch.outlineColor = String(parameters['outlineColor'] || 'black');
  172.   RSMatch.fontColor = String(parameters['fontColor'] || 'white');
  173.   RSMatch.opacity = Number(parameters['editWindow_Opacity'] || 225);
  174.   RSMatch.askText = String(parameters['askingText'] || 'Please enter the name');
  175.   RSMatch.standardFontSize = Number(parameters['standardFontSize'] || 28);
  176.   RSMatch.fonts = {
  177.     'ChineseFonts': parameters['Chinese Fonts'] || 'SimHei, Heiti TC, sans-serif',
  178.     'KoreanFonts': parameters['Korean Fonts'] || 'Dotum, AppleGothic, sans-serif',
  179.     'DefaultFonts': parameters['Default Fonts'] || 'GameFont',
  180.   };

  181.   var original_Input_shouldPreventDefault = Input._shouldPreventDefault;
  182.   var dialog_Input_shouldPreventDefault = function(keyCode) {
  183.       switch (keyCode) {
  184.       case 33:    // pageup
  185.       case 34:    // pagedown
  186.       case 37:    // left arrow
  187.       case 38:    // up arrow
  188.       case 39:    // right arrow
  189.       case 40:    // down arrow
  190.           return true;
  191.       }
  192.       return false;
  193.   };


  194.   //===========================================================================
  195.   // TextBox Class
  196.   //===========================================================================

  197.   TextBox.BACK_SPACE = 8;
  198.   TextBox.ENTER = 13;
  199.   TextBox.IS_NOT_CHAR = 32;
  200.   TextBox.KEYS_ARRAY = 255;

  201.   TextBox.prototype.initialize = function(_editWindow)  {
  202.     this._editWindow = _editWindow;
  203.     this.createTextBox();
  204.     this.getFocus();
  205.     this.startToConvertInput();
  206.   };

  207.   TextBox.prototype.createTextBox = function() {
  208.     this._textBox = document.createElement('input');
  209.     this._textBox.type = "text";
  210.     this._textBox.id = "textBox";
  211.     this._textBox.style.opacity = 0;
  212.     this._textBox.style.zIndex = 1000;
  213.     this._textBox.autofocus = false;
  214.     this._textBox.width = 1;
  215.     this._textBox.height = 1;
  216.     this._textBox.multiple = false;
  217.     this._textBox.style.imeMode = 'active';

  218.     if($gameSystem.isJapanese()) {
  219.       this._textBox.inputmode = 'katakana';
  220.     }

  221.     this._textBox.style.position = 'absolute';
  222.     this._textBox.style.top = 0;
  223.     this._textBox.style.left = 0;
  224.     this._textBox.style.right = 0;
  225.     this._textBox.style.bottom = 0;

  226.     this._textBox.onkeydown = this.onKeyDown.bind(this);

  227.     document.body.appendChild(this._textBox);
  228.   };

  229.   TextBox.prototype.startToConvertInput = function () {
  230.     Input._shouldPreventDefault = dialog_Input_shouldPreventDefault;
  231.   };

  232.   TextBox.prototype.startToOriginalInput = function () {
  233.     Input._shouldPreventDefault = original_Input_shouldPreventDefault;
  234.   };


  235.   TextBox.prototype.setEvent = function(func) {
  236.     this._textBox.onchange = func;
  237.   };

  238.   TextBox.prototype.terminateTextBox = function() {
  239.     document.body.removeChild(this._textBox);
  240.     this.startToOriginalInput();
  241.   };

  242.   TextBox.prototype.onKeyDown = function(e) {
  243.     var keyCode = e.which;
  244.     this.getFocus();
  245.     if (keyCode < TextBox.IS_NOT_CHAR) {
  246.       if(keyCode === TextBox.BACK_SPACE) {
  247.         this.backSpace();
  248.       } else if(keyCode === TextBox.ENTER) {
  249.         if(this.getTextLength() <= 0) {
  250.           e.preventDefault();
  251.           // console.error("아무 글자도 입력하지 않았습니다");
  252.         }
  253.       }
  254.     } else if (keyCode < TextBox.KEYS_ARRAY) {
  255.       //
  256.     }
  257.   }

  258.   TextBox.prototype.getTextLength = function() {
  259.     return this._textBox.value.length;
  260.   };

  261.   TextBox.prototype.getMaxLength = function() {
  262.     return this._editWindow._maxLength;
  263.   };

  264.   TextBox.prototype.backSpace = function() {
  265.     this._editWindow._name = this._editWindow._name.slice(0, this._textBox.value.length - 1);
  266.     this._editWindow._index = this._textBox.value.length;
  267.     this._textBox.value = this._editWindow._name;
  268.     this._editWindow.refresh();
  269.   };

  270.   TextBox.prototype.refreshNameEdit = function()  {
  271.     this._editWindow._name = this._textBox.value.toString();
  272.     this._editWindow._index = this._textBox.value.length || 0;
  273.     this._editWindow.refresh();
  274.   };

  275.   TextBox.prototype.update = function() {
  276.     if(this.getTextLength() <= this._editWindow._maxLength) {
  277.       this.refreshNameEdit();
  278.     }
  279.   };

  280.   TextBox.prototype.getFocus = function() {
  281.     this._textBox.focus();
  282.   };

  283.   TextBox.prototype.terminate =  function() {
  284.     this.terminateTextBox();
  285.   };

  286.   //===========================================================================
  287.   // Window_NameEdit Class
  288.   //===========================================================================

  289.   function Window_KorNameEdit() {
  290.      this.initialize.apply(this, arguments);
  291.   }

  292.   Window_KorNameEdit.prototype = Object.create(Window_NameEdit.prototype);
  293.   Window_KorNameEdit.prototype.constructor = Window_KorNameEdit;

  294.   Window_KorNameEdit.prototype.initialize = function(actor, maxLength) {
  295.     Window_NameEdit.prototype.initialize.call(this, actor, maxLength);
  296.   };

  297.   Window_KorNameEdit.prototype.standardFontFace = function() {
  298.       if ($gameSystem.isChinese()) {
  299.           return RSMatch.fonts.ChineseFonts;
  300.       } else if ($gameSystem.isKorean()) {
  301.           return RSMatch.fonts.KoreanFonts;
  302.       } else {
  303.           return RSMatch.fonts.DefaultFonts;
  304.       }
  305.   };

  306.   Window_KorNameEdit.prototype.charWidth = function () {
  307.     var text = 'A';
  308.     if (navigator.language.match(/^zh/)) { // isChinese
  309.         text = '\u4E00';
  310.     } else if (navigator.language.match(/^ko/)) { // isKorean
  311.         text = '\uAC00';
  312.     }
  313.     return this.textWidth(text);
  314.   };

  315.   Window_KorNameEdit.prototype.drawActorFace = function(actor, x, y, width, height) {
  316.       this.drawFace(actor.faceName(), actor.faceIndex(), x, y, width, height);
  317.       this.changeTextColor(this.hpColor(actor));
  318.       this.drawText(RSMatch.askText, this.left(), y + this.fittingHeight(1) / 2, this.width);
  319.   };

  320.   Window_KorNameEdit.prototype.itemRect = function(index) {
  321.       return {
  322.           x: this.left() + index * this.charWidth(),
  323.           y: this.fittingHeight(1),
  324.           width: this.charWidth(),
  325.           height: this.lineHeight()
  326.       };
  327.   };

  328.   Window_KorNameEdit.prototype.windowWidth = function () {
  329.     return RSMatch.windowWidth;
  330.   };

  331.   Window_KorNameEdit.prototype.drawChar = function (index) {
  332.     var rect = this.itemRect(index);
  333.     this.resetTextColor();
  334.     this.contents.outlineWidth = RSMatch.outlineWidth;
  335.     this.contents.outlineColor = RSMatch.outlineColor;
  336.     this.contents.fontColor = RSMatch.fontColor;
  337.     this.drawText(this._name[index] || '', rect.x, rect.y)
  338.   };

  339.   Window_KorNameEdit.prototype.standardFontSize = function() {
  340.       return RSMatch.standardFontSize;
  341.   };

  342.   //===========================================================================
  343.   // Scene_Name Class
  344.   //===========================================================================

  345.   function Scene_KorName() {
  346.       this.initialize.apply(this, arguments);
  347.   }

  348.   Scene_KorName.prototype = Object.create(Scene_Name.prototype);
  349.   Scene_KorName.prototype.constructor = Scene_KorName;

  350.   Scene_KorName.prototype.initialize = function() {
  351.       Scene_Name.prototype.initialize.call(this);
  352.   };

  353.   Scene_KorName.prototype.update = function() {
  354.     Scene_Name.prototype.update.call(this);
  355.   }

  356.   Scene_KorName.prototype.create = function () {
  357.     Scene_MenuBase.prototype.create.call(this);
  358.     this._actor = $gameActors.actor(this._actorId);
  359.     this.createEditWindow();
  360.     this.createTextBox();
  361.     this._textBox.setEvent( this.onInputOk.bind(this) );
  362.   };

  363.   Scene_KorName.prototype.createEditWindow = function() {
  364.       this._editWindow = new Window_KorNameEdit(this._actor, this._maxLength);
  365.       this.addWindow(this._editWindow);
  366.   };

  367.   Scene_KorName.prototype.createTextBox =  function() {
  368.     this._textBox = new TextBox(this._editWindow);
  369.     if(RSMatch.windowCenter === "true") {
  370.       this._editWindow.y = Graphics.boxHeight / 2 - this._editWindow.height / 2;
  371.     }
  372.     this._editWindow.opacity = RSMatch.opacity;
  373.   }

  374.   Scene_KorName.prototype.update = function() {
  375.     this._textBox.getFocus();
  376.     this._textBox.update();
  377.     Scene_MenuBase.prototype.update.call(this);
  378.   }

  379.   Scene_KorName.prototype.terminate = function() {
  380.     Scene_MenuBase.prototype.terminate.call(this);
  381.     this._textBox.terminate();
  382.   }

  383.   //===========================================================================
  384.   // Game_Interpreter
  385.   //===========================================================================

  386.   // Name Input Processing
  387.   Game_Interpreter.prototype.command303 = function() {
  388.       if (!$gameParty.inBattle()) {
  389.           if ($dataActors[this._params[0]]) {
  390.               SceneManager.push(Scene_KorName);
  391.               SceneManager.prepareNextScene(this._params[0], this._params[1]);
  392.           }
  393.       }
  394.       return true;
  395.   };

  396.   //===========================================================================
  397.   // Game_Interpreter
  398.   //===========================================================================

  399.   var alias_Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
  400.   Game_Interpreter.prototype.pluginCommand = function(command, args) {
  401.       alias_Game_Interpreter_pluginCommand.call(this, command, args);
  402.       if(command === "KNE") {
  403.         switch(args[0]) {
  404.           case 'width':
  405.           case '폭':
  406.             RSMatch.windowWidth = Number(args[1] || 580);
  407.             break;
  408.           case 'center':
  409.           case '중앙정렬':
  410.             RSMatch.windowCenter = String(args[1] || 'false');
  411.             break;
  412.           case 'outlineWidth':
  413.           case '테두리크기':
  414.             RSMatch.windowWidth = Number(args[1] || 1);
  415.             break;
  416.           case 'outlineColor':
  417.           case '테두리색상':
  418.             RSMatch.outlineColor = String(args[1] || 'black');
  419.             break;
  420.           case 'fontColor':
  421.           case '폰트색상':
  422.             RSMatch.fontColor = String(args[1] || 'white');
  423.             break;
  424.           case 'fontSize':
  425.           case '폰트크기':
  426.             RSMatch.standardFontSize = Number(args[1] || 28);
  427.             break;
  428.           case 'opacity':
  429.           case '투명도':
  430.             var _opacity = Number(args[1] || 1);
  431.             RSMatch.opacity = _opacity.clamp(0, 255);
  432.             break;
  433.           case 'askText':
  434.           case '텍스트':
  435.             RSMatch.askText = String(args.slice(1).join(""));
  436.             break;
  437.         }
  438.       }
  439.   };

  440. })();
复制代码

点评

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

使用道具 举报

梦石
0
星屑
8003
在线时间
1184 小时
注册时间
2007-7-29
回帖
2014
发表于 2022-5-6 23:51:29 | 显示全部楼层
上古帖子:https://rpg.blue/thread-174413-1-1.html
话说如果你善用搜索会发现新大陆的。
回复

使用道具 举报

梦石
0
星屑
123
在线时间
7 小时
注册时间
2022-4-18
回帖
6
 楼主| 发表于 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
回复

使用道具 举报

梦石
1
星屑
24088
在线时间
3339 小时
注册时间
2011-7-8
回帖
3862

开拓者

发表于 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 网络脚本 *
回复

使用道具 举报

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

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

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部