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

Project1

 找回密码
 注册会员
搜索
楼主: KRZOKUHD
打印 上一主题 下一主题

[原创发布] KRZ小插件合集

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1680
在线时间
124 小时
注册时间
2019-1-4
帖子
108
41
 楼主| 发表于 2024-2-19 19:55:05 | 只看该作者
有人问yep的信息核心自动换行的事
这个修改改了单词换行(drill翻译的那个不对,那个就是普通的是否自动换行)

把这一段放到插件里
Yanfly.RegExp = new RegExp("[\u4E00-\u9FA5]+");
function checkStringIsChinese(str) {
  var pattern = Yanfly.RegExp;
  if (pattern.test(str)) {
    return true;
  }
  return false;
}


然后把这个两个函数覆盖成这样
Yanfly.Message.Window_Base_processNormalCharacter =
    Window_Base.prototype.processNormalCharacter;
Window_Base.prototype.processNormalCharacter = function(textState) {
        var textState2 = textState;
    if (this.checkWordWrap(textState2)) return this.processNewLine(textState2);
    Yanfly.Message.Window_Base_processNormalCharacter.call(this, textState);
};

Window_Base.prototype.checkWordWrap = function(textState) {
    if (!textState) return false;
    if (!this._wordWrap) return false;
    if (textState.text[textState.index] === ' ' || checkStringIsChinese(textState.text[textState.index])) {
      var nextSpace = textState.text.indexOf(',', textState.index + 1);
        nextSpace = Math.min(nextSpace,textState.text.indexOf(',', textState.index + 1));
        nextSpace = Math.min(nextSpace,textState.text.indexOf('。', textState.index + 1));
        nextSpace = Math.min(nextSpace,textState.text.indexOf(' ', textState.index + 1));                
      var nextBreak = textState.text.indexOf('\n', textState.index + 1);
      if (nextSpace < 0) nextSpace = textState.text.length + 1;
      if (nextBreak > 0) nextSpace = Math.min(nextSpace, nextBreak);
          nextSpace = textState.index+1;
if(        !checkStringIsChinese(textState.text[textState.index+1]) ) nextSpace = textState.index+3;
      var word = textState.text.substring(textState.index, nextSpace);
      var size = this.textWidthExCheck(word);
    }
    return (size + textState.x > this.wordwrapWidth());
};

Window_Base.prototype.wordwrapWidth = function(){
  return this.contents.width-48;////-48根据需求修改,修改的换行宽度,一般-48挺好的
};

0w     0what?
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
309
在线时间
32 小时
注册时间
2023-5-2
帖子
17
42
发表于 2024-2-23 22:26:06 | 只看该作者
嘿嘿 烤乳猪大佬厉害  插件我就抱走了
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1680
在线时间
124 小时
注册时间
2019-1-4
帖子
108
43
 楼主| 发表于 前天 17:32 | 只看该作者
根据变量修改物品、装备价格

* 如题所示,在物品、武器、防具备注上
*  <PRICEVAR: 变量id> 修改物品价格为 变量id
*
*   以下需要yep的商店核心
*  <SELLPRICEVAR: 变量id> 修改物品卖出价格为 变量id
*  
*  备注:
*   默认价格更新在地图加载后、打开商店界面前,只是修改变量不会自动刷新,
*
*  推荐修改变量后需要使用脚本:
*   DataManager.processcustompriceNotetags();
*  来手动更新一下价格。
*
*  目前仅做了默认的金币价格,没有做多货币相关支持。

(多货币内容太多了不想写)

krz_customprice.7z

1.04 KB, 下载次数: 0

0w     0what?
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-8 09:35

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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