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

Project1

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

[已经过期] 请问信息框中的文本显示速度怎么调整?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
500
在线时间
11 小时
注册时间
2010-12-9
帖子
3
跳转到指定楼层
1
发表于 2016-3-27 12:55:29 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
请问信息框中的文本显示速度怎么调整?官方和yep插件好像都没找到可以调文本速度的选项,总不会要一个字一个字的用\.来调整吧?

Lv1.梦旅人

梦石
0
星屑
50
在线时间
81 小时
注册时间
2016-1-6
帖子
150
2
发表于 2016-3-29 20:58:34 | 只看该作者
根据你的需要,重新修改了之前帮人做的显示头像位置的脚本,添加了调整语速的功能。你用用看,我测试过有效。
该脚本原始模板是Yami Engine Delta - Word Wrap,我在此基础上增加了左右方向显示对话头像和调整语速两个小功能。
使用方法:下载代码后命名为YED_WordWrap.js,加载该脚本后,在需要改语速的对话框里,文首加入<speed:x>
x设为你需要的语速,1的话就是1/4秒,最高可设为99,代码如下:
  1. /*:
  2. * Yami Engine Delta - Word Wrap
  3. *
  4. * @plugindesc This plugin provides word wrap feature, so that a long text
  5. * will be properly broken down into lines.
  6. * @author Yami Engine Delta [Dr.Yami]
  7. *
  8. * @param Break Word
  9. * @desc Allows unbreakable words to be broken.
  10. * @default true
  11. *
  12. * @param Right Face
  13. * @desc 允许对话框头像可以左右切换。(默认值改不改其实都起效。)
  14. * @default false
  15. *
  16. * @param Dialog Speed
  17. * @desc 可以设置对话速度。(请于对话框中设置语速。)
  18. * @default 0
  19. *
  20. * @help
  21. * The word wrap isn't enabled by default. To activate word wrap in any text,
  22. * for example in Message, you have to put following code into the text:
  23. *
  24. * ------------
  25. *   <wrap>
  26. * ------------
  27. *
  28. * The word wrapper will nullify the break lines in editor, so that you have
  29. * to manually break line by using following code in text:
  30. *
  31. * ------------
  32. *   <br>
  33. * ------------
  34. *
  35. * 新添加的左右头像对话效果,需要在文本开头输入以下字符:
  36. * 如果不输入则默认头像在左侧。
  37. *
  38. * ------------
  39. *   <right>
  40. * ------------
  41. *
  42. * 新添加的语速调整效果,需要在文本开头输入以下字符:
  43. * x处替换为小于100的正整数形,1为1/4秒,以此类推
  44. *
  45. * ------------
  46. *   <speed:x>
  47. * ------------
  48. *
  49. * ============================================================================
  50. */

  51. /**
  52. * @namespace WordWrap
  53. * @memberof YED
  54. */

  55. var YED = YED || {};

  56. // init WordWrap module
  57. YED.WordWrap = {};

  58. YED.WordWrap.BreakWord
  59.     = PluginManager.parameters('YED_WordWrap')['Break Word'];
  60. YED.WordWrap.RightFace
  61.     = PluginManager.parameters('YED_WordWrap')['Right Face'];
  62. YED.WordWrap.Speed
  63.     = PluginManager.parameters('YED_WordWrap')['Dialog Speed'];
  64.        
  65. (function($WordWrap) {
  66.     var _Window_Base_processNormalCharacter
  67.         = Window_Base.prototype.processNormalCharacter;
  68.     var _Window_Base_convertEscapeCharacters
  69.         = Window_Base.prototype.convertEscapeCharacters;
  70.                
  71.     var breakWord = eval($WordWrap.BreakWord);

  72.         Window_Message.prototype.drawMessageFace = function() {
  73.                 if (this._rightFace){
  74.                         this.drawFace($gameMessage.faceName(), $gameMessage.faceIndex(), Graphics.boxWidth-216, 0);//rightface
  75.                 }else{
  76.                         this.drawFace($gameMessage.faceName(), $gameMessage.faceIndex(), 0, -100);//leftface
  77.                 }
  78.         };

  79.         Window_Message.prototype.newLineX = function() {
  80.                 if (this._rightFace){
  81.                         return $gameMessage.faceName() === '' ? 0 : 0;//rightface
  82.                 }else{
  83.                         return $gameMessage.faceName() === '' ? 0 : 168;//leftface
  84.                 }
  85.         };
  86.        
  87.     Window_Base.prototype.textAreaWidth = function() {
  88.         return this.contentsWidth();
  89.     };

  90.     Window_Base.prototype.needWrap = function(textState) {
  91.         var c = textState.text[textState.index],
  92.             w = this.textWidth(c),
  93.             nextSpaceIndex = 0,
  94.             nextWord = "",
  95.             nextWidth = 0,
  96.             text = textState.text;

  97.         if (!this._wordWrap) {
  98.             return false;
  99.         }
  100.                
  101.                 if (this._rightFace){
  102.                         if (breakWord && (textState.x + w * 2) >= this.textAreaWidth()-144) {//rightface
  103.                                 textState.index--; // hack for missing character
  104.                                 return true;
  105.                         }
  106.                 }else{
  107.                         if (breakWord && (textState.x + w * 2) >= this.textAreaWidth()) {//leftface
  108.                                 textState.index--; // hack for missing character
  109.                                 return true;
  110.                         }
  111.                 }

  112.         if (!breakWord && c === " ") {
  113.             nextSpaceIndex = text.indexOf(" ", textState.index + 1);

  114.             if (nextSpaceIndex < 0) {
  115.                 nextSpaceIndex = text.length + 1;
  116.             }

  117.             nextWord = text.substring(textState.index, nextSpaceIndex);

  118.             nextWidth = this.textWidth(nextWord);
  119.                        
  120.                         if (this._rightFace){
  121.                                 if (textState.x + nextWidth >= this.textAreaWidth()-144) {//rightface
  122.                                         return true;
  123.                                 }
  124.                         }else{
  125.                                 if (textState.x + nextWidth >= this.textAreaWidth()) {//leftface
  126.                                         return true;
  127.                                 }
  128.                         }
  129.         }

  130.         return false;
  131.     };

  132.     Window_Base.prototype.convertEscapeCharacters = function(text) {
  133.         text = _Window_Base_convertEscapeCharacters.call(this, text);
  134.         text = this.convertWordWrapEscapeCharacters(text);

  135.         return text;
  136.     };

  137.     Window_Base.prototype.convertWordWrapEscapeCharacters = function(text) {
  138.         text = this.enableWordWrap(text);
  139.         
  140.         if (!!this._wordWrap) {
  141.             text = text.replace(/[\n\r]+/g, '');
  142.             text = text.replace(/\<br\>/gi, '\n');
  143.         }

  144.         return text;
  145.     };

  146.     Window.prototype.enableWordWrap = function(text) {
  147.         this._wordWrap = false;
  148.                 this._rightFace = false;
  149.                 this._speed = false;

  150.         if (!!text.match(/\<wrap\>/i)) {
  151.             this._wordWrap = true;
  152.         }
  153.                 if (!!text.match(/\<right\>/i)) {
  154.             this._rightFace = true;
  155.         }
  156.                 //if (!!text.match(/\<speed:1\>/i)) {//此处为只检测速度1的情况
  157.                 if (!!text.match(/\<speed/i)) {
  158.             this._speed = true;
  159.         }

  160.         text = text.replace(/\<wrap\>/gi, '');
  161.                 text = text.replace(/\<right\>/gi, '');
  162.                 //text = text.replace(/\<speed:1\>/gi,'');
  163.                 text = text.replace(/\<speed/gi,'');
  164.                 /*//此处为只检测速度1的情况
  165.                 if(this._speed){
  166.                         text1 = text.split("") ;
  167.                         var text2="";
  168.                         for(i = 0;i <text1.length;i ++){
  169.                                 text2+=(text1[i]+'\x1b.');
  170.                         }
  171.                         text=text2;
  172.                 }
  173.                 */
  174.                 if(this._speed){
  175.                         text1 = text.split("") ;
  176.                         var text2="";
  177.                         var textStart=(text1[2]=='>'?3:4);
  178.                         var speedNum=parseInt(text1[1]+text1[2]);
  179.                         for( textStart ;textStart <text1.length;textStart ++){
  180.                                 text2+=text1[textStart];
  181.                                 for(var j = 0 ; j < speedNum ; j ++){
  182.                                         text2 +='\x1b.';
  183.                                 }
  184.                         }
  185.                         text=text2;
  186.                 }
  187.         return text;
  188.     };

  189.     Window_Base.prototype.processNormalCharacter = function(textState) {
  190.         if (this.needWrap(textState)) {
  191.             return this.processNewLine(textState);
  192.         }

  193.         _Window_Base_processNormalCharacter.call(this, textState);
  194.     };
  195. }(YED.WordWrap));
复制代码

点评

顺便提个问题,为什么我从Notepad++里复制出来的代码,文本缩进格式会变乱?  发表于 2016-3-29 21:00
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
319
在线时间
890 小时
注册时间
2009-10-12
帖子
1829
3
发表于 2016-3-29 22:15:16 | 只看该作者
本帖最后由 日月星辰 于 2016-3-29 22:27 编辑

如果是想让出字速度变慢。。。:
顺手改了个能全局使用,不用每次显示文章打tag

点击代码右侧 下载,然后去插件管理器启用
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
500
在线时间
11 小时
注册时间
2010-12-9
帖子
3
4
 楼主| 发表于 2016-4-2 10:14:39 | 只看该作者
seedj13 发表于 2016-3-29 20:58
根据你的需要,重新修改了之前帮人做的显示头像位置的脚本,添加了调整语速的功能。你用用看,我测试过有效 ...

谢谢!我还以为都沉了想不到隔了几天上来居然还有好心人帮我{:2_264:},马上试试去!
话说我用notepad++好像没注意过缩进的问题、、
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
500
在线时间
11 小时
注册时间
2010-12-9
帖子
3
5
 楼主| 发表于 2016-4-2 10:16:30 | 只看该作者
日月星辰 发表于 2016-3-29 22:15
如果是想让出字速度变慢。。。:
顺手改了个能全局使用,不用每次显示文章打tag

好的!都是大神啊你们!谢谢~~~~
一个小小的功能都有这么多好心大神出手相助,太感动了{:2_264:},赶紧回去试试!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
13 小时
注册时间
2016-5-31
帖子
5
6
发表于 2016-6-13 17:48:52 | 只看该作者
本帖最后由 mercer_73 于 2016-6-13 17:55 编辑
日月星辰 发表于 2016-3-29 22:15
如果是想让出字速度变慢。。。:
顺手改了个能全局使用,不用每次显示文章打tag


好像没有效果。。。。并没有加载其他插件。楼上那个好使,不过想要个全局的(ΦωΦ)
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-14 00:57

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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