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

Project1

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

[有事请教] RMMV内的字体相关插件会有冲突吗?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
239
在线时间
30 小时
注册时间
2024-4-10
帖子
43
跳转到指定楼层
1
发表于 2024-4-14 22:03:41 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x






改了gamefont.css之后就成功将游戏字体改成华康细圆体
@font-face {
    font-family: GameFont;
    src: url("Gamefonts.ttf");
}

@font-face {
    font-family: GameFont2;
    src: url("UIfontsW4.ttf");
}

.IIV::-webkit-media-controls-play-button,
video::-webkit-media-controls-start-playback-button {
    opacity: 0;
    pointer-events: none;
    width: 5px;
}


可是我想更改DTextPicture.js显示的字体所以用了
D_TEXT_SETTING FONT [字体名称] 指令
但还是没办法,一直维持改过的细圆体

改了gamefont.css好像也不用YEP的核心修改了?

Lv2.观梦者

梦石
0
星屑
580
在线时间
303 小时
注册时间
2012-4-8
帖子
192
2
发表于 2024-4-14 22:29:36 | 只看该作者
虽然没用过,但是试试直接更改 DTextPicture.js 中的 Game_Screen 的 dTextFontFace ?

没看到有 D_TEXT_SETTING FONT [字体名称] 的指令
是我的版本不对吗,我的好像是 mz 的插件版本


JAVASCRIPT 代码复制
  1. /*
  2.  * @command dTextSetting
  3.  * @text 文字列ピクチャ設定
  4.  * @desc 文字列ピクチャの表示方法に関する設定です。変更した設定は描画後も保持されます。未設定の項目は現状維持されます。
  5. */
  6.  
  7. // 注册命令监听
  8.     PluginManagerEx.registerCommand(script, 'dTextSetting', function(args) {
  9.         $gameScreen.setDtextSetting(args);
  10.     });
  11.  
  12.  
  13.     //=============================================================================
  14.     // Game_Screen
  15.     //  動的ピクチャ用のプロパティを追加定義します。
  16.     //=============================================================================
  17.     Game_Screen.prototype.setDtextSetting = function(setting) {
  18.         if (setting.fontFace !== '') {
  19.             this.dTextFontFace = setting.fontFace;
  20.         }
  21.     };
  22.  
  23.     // 获取 文字图片 设置
  24.     Game_Screen.prototype.getDTextPictureInfo = function() {
  25.         const prefix = param.prefixText || '';
  26.         return {
  27.             value         : prefix + this.dTextValue,
  28.             size          : this.dTextSize,
  29.             color         : this.dTextBackColor,
  30.             realTime      : this.dTextRealTime,
  31.             windowFrame   : this.dWindowFrame,
  32.             gradationLeft : this.dTextGradationLeft,
  33.             gradationRight: this.dTextGradationRight,
  34.             align         : this.dTextAlign,
  35.             font          : this.dTextFontFace,
  36.             lineHeight    : this.dTextLineHeight,
  37.             windowOpacity : this.dTextWindowOpacity,
  38.             pictureWidth  : this.dTextPictureWidth,
  39.             pictureHeight : this.dTextPictureHeight,
  40.             vertical      : this.dTextVertical
  41.         };
  42.     };
  43.  
  44.     // 显示 图片
  45.     Game_Picture.prototype.show = function(name, origin, x, y, scaleX,
  46.                                            scaleY, opacity, blendMode) {
  47.         if ($gameScreen.isSettingDText() && !name) {
  48.             arguments[0]   = Date.now().toString();
  49.             this.dTextInfo = $gameScreen.getDTextPictureInfo();
  50.             this.updateDText();
  51.             $gameScreen.clearDTextPicture();
  52.         } else {
  53.             this.dTextInfo = null;
  54.             this._dTextValue = null;
  55.         }
  56.         _Game_Picture_show.apply(this, arguments);
  57.     };
pokemon 和 digimon 正在路上
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
239
在线时间
30 小时
注册时间
2024-4-10
帖子
43
3
 楼主| 发表于 2024-4-14 23:28:30 | 只看该作者
505681468 发表于 2024-4-14 22:29
虽然没用过,但是试试直接更改 DTextPicture.js 中的 Game_Screen 的 dTextFontFace ?

没看到有 D_TEXT_ ...

可能是版本不同,我的说明内的确有  D_TEXT_SETTING FONT [字体名称] : 更改描绘字体

所以该怎么直接修改代码转换字体? 谢谢!

JAVASCRIPT 代码复制
  1. // Game_Screen
  2.     //  動的ピクチャ用のプロパティを追加定義します。
  3.     //=============================================================================
  4.     var _Game_Screen_clear      = Game_Screen.prototype.clear;
  5.     Game_Screen.prototype.clear = function() {
  6.         _Game_Screen_clear.call(this);
  7.         this.clearDTextPicture();
  8.     };
  9.  
  10.     Game_Screen.prototype.clearDTextPicture = function() {
  11.         this.dTextValue          = null;
  12.         this.dTextOriginal       = null;
  13.         this.dTextRealTime       = null;
  14.         this.dTextSize           = 0;
  15.         this.dTextAlign          = 0;
  16.         this.dTextBackColor      = null;
  17.         this.dTextFont           = null;
  18.         this.dUsingVariables     = null;
  19.         this.dWindowFrame        = null;
  20.         this.dTextGradationRight = 0;
  21.         this.dTextGradationLeft  = 0;
  22.     };
  23.  
  24.     Game_Screen.prototype.setDTextPicture = function(value, size) {
  25.         if (typeof TranslationManager !== 'undefined') {
  26.             TranslationManager.translateIfNeed(value, function(translatedText) {
  27.                 value = translatedText;
  28.             });
  29.         }
  30.         this.dUsingVariables = (this.dUsingVariables || []).concat(getUsingVariables(value));
  31.         this.dTextValue      = (this.dTextValue || '') + getArgString(value, false) + '\n';
  32.         this.dTextOriginal   = (this.dTextOriginal || '') + value + '\n';
  33.         this.dTextSize       = size;
  34.     };
  35.  
  36.     Game_Screen.prototype.setDTextWindowCursor = function(pictureId, rect) {
  37.         var picture = this.picture(pictureId);
  38.         if (picture) {
  39.             picture.setWindowCursor(rect);
  40.             picture.setWindowCursorActive(true);
  41.         }
  42.     };
  43.  
  44.     Game_Screen.prototype.setDTextWindowCursorActive = function(pictureId, value) {
  45.         var picture = this.picture(pictureId);
  46.         if (picture) {
  47.             picture.setWindowCursorActive(value);
  48.         }
  49.     };
  50.  
  51.     Game_Screen.prototype.getDTextPictureInfo = function() {
  52.         return {
  53.             value         : this.dTextValue,
  54.             size          : this.dTextSize || 0,
  55.             align         : this.dTextAlign || 0,
  56.             color         : this.dTextBackColor,
  57.             font          : this.dTextFont,
  58.             usingVariables: this.dUsingVariables,
  59.             realTime      : this.dTextRealTime,
  60.             originalValue : this.dTextOriginal,
  61.             windowFrame   : this.dWindowFrame,
  62.             gradationLeft : this.dTextGradationLeft,
  63.             gradationRight: this.dTextGradationRight,
  64.         };
  65.     };
  66.  
  67.     Game_Screen.prototype.isSettingDText = function() {
  68.         return !!this.dTextValue;
  69.     };
  70.  
  71.     Game_Screen.prototype.setDtextFont = function(name) {
  72.         this.dTextFont = name;
  73.     };
  74.  
  75.     var _Game_Screen_updatePictures      = Game_Screen.prototype.updatePictures;
  76.     Game_Screen.prototype.updatePictures = function() {
  77.         _Game_Screen_updatePictures.apply(this, arguments);
  78.         $gameVariables.clearChangedVariables();
  79.     };
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
580
在线时间
303 小时
注册时间
2012-4-8
帖子
192
4
发表于 2024-4-14 23:35:09 | 只看该作者
本帖最后由 505681468 于 2024-4-14 23:38 编辑
3000Roger 发表于 2024-4-14 23:28
可能是版本不同,我的说明内的确有  D_TEXT_SETTING FONT [字体名称] : 更改描绘字体

所以该怎么直接修 ...


版本不同我也不确定 ,可以试试
  1. $gameScreen.dTextFontFace = "GameFont2"
复制代码


参考
  1. Window_Base.prototype.standardFontFace = function() {
  2.     if ($gameSystem.isChinese()) {
  3.         return 'SimHei, Heiti TC, sans-serif';
  4.     } else if ($gameSystem.isKorean()) {
  5.         return 'Dotum, AppleGothic, sans-serif';
  6.     } else {
  7.         return 'GameFont';
  8.     }
  9. };

  10. Window_Base.prototype.resetFontSettings = function() {
  11.     this.contents.fontFace = this.standardFontFace();
  12.     this.contents.fontSize = this.standardFontSize();
  13.     this.resetTextColor();
  14. };
复制代码



顺便......楼主方便分享下插件来源吗,是 github 下的,还是说修改版
虽然是 mv 插件项目,但是我下下来的这个是 mz 版本......
pokemon 和 digimon 正在路上
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
239
在线时间
30 小时
注册时间
2024-4-10
帖子
43
5
 楼主| 发表于 2024-4-15 00:30:32 | 只看该作者
DTextPicture.rar (9.28 KB, 下载次数: 2)

感謝你的回答,我再試試看!
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
580
在线时间
303 小时
注册时间
2012-4-8
帖子
192
6
发表于 2024-4-15 00:57:14 | 只看该作者
本帖最后由 505681468 于 2024-4-15 01:20 编辑
3000Roger 发表于 2024-4-15 00:30
感謝你的回答,我再試試看!


版本确实不一样,基本可以不用管了......

用 MV 版试了试,是没问题的(说不定还真有插件冲突?可以先用纯净工程测试下)
唯一出现的问题是,由于资源没有提前加载,所以首次使用字体会显示失败,这个时候多刷调用几次就行
MV 的其他资源没问题是因为有预先加载或者懒加载校验

所以解决问题需要预加载
如果对使用时间要求不紧张的话,可以不用管加载校验
  1. // 字体加载
  2. Graphics._createGameFontLoader = function() {
  3.     this._createFontLoader('GameFont');
  4.     this._createFontLoader('GameFont2');
  5. };
复制代码



效果


预加载字体后的效果



事件设置




关于字体的可能使用
TEXT 代码复制
  1. Searching 121 files for "GAMEFONT"
  2.  
  3. js\rpg_core.js:
  4.   853       * @type String
  5.   854       */
  6.   855:     this.fontFace = 'GameFont';
  7.   856  
  8.   857      /**
  9.   ...
  10. 2340      this._createFPSMeter();
  11. 2341      this._createModeBox();
  12. 2342:     this._createGameFontLoader();
  13. 2343  };
  14. 2344  
  15. ....
  16. 2663  /**
  17. 2664   * @static
  18. 2665:  * @method _createGameFontLoader
  19. 2666   * @private
  20. 2667   */
  21. 2668: Graphics._createGameFontLoader = function() {
  22. 2669:     this._createFontLoader('GameFont');
  23. 2670  };
  24. 2671  
  25.  
  26. js\rpg_scenes.js:
  27.   372  Scene_Boot.prototype.isReady = function() {
  28.   373      if (Scene_Base.prototype.isReady.call(this)) {
  29.   374:         return DataManager.isDatabaseLoaded() && this.isGameFontLoaded();
  30.   375      } else {
  31.   376          return false;
  32.   ...
  33.   378  };
  34.   379  
  35.   380: Scene_Boot.prototype.isGameFontLoaded = function() {
  36.   381:     if (Graphics.isFontLoaded('GameFont')) {
  37.   382          return true;
  38.   383      } else if (!Graphics.canUseCssFontLoading()){
  39.   384          var elapsed = Date.now() - this._startDate;
  40.   385          if (elapsed >= 60000) {
  41.   386:             throw new Error('Failed to load GameFont');
  42.   387          }
  43.   388      }
  44.  
  45. js\rpg_windows.js:
  46.    43          return 'Dotum, AppleGothic, sans-serif';
  47.    44      } else {
  48.    45:         return 'GameFont';
  49.    46      }
  50.    47  };
  51.  
  52. 10 matches across 3 files

pokemon 和 digimon 正在路上
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
239
在线时间
30 小时
注册时间
2024-4-10
帖子
43
7
 楼主| 发表于 2024-4-15 01:45:32 | 只看该作者
505681468 发表于 2024-4-15 00:57
版本确实不一样,基本可以不用管了......

用 MV 版试了试,是没问题的(说不定还真有插件冲突?可以先用 ...

我重新测试后效果跟你第一张图一样
那字体加载的代码要加在哪里?
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
580
在线时间
303 小时
注册时间
2012-4-8
帖子
192
8
发表于 2024-4-15 01:50:43 | 只看该作者
本帖最后由 505681468 于 2024-4-15 01:52 编辑
3000Roger 发表于 2024-4-15 01:45
我重新测试后效果跟你第一张图一样
那字体加载的代码要加在哪里?


在 js\rpg_core.js

  1. // 创建字体加载器
  2. Graphics._createGameFontLoader = function() {
  3.     this._createFontLoader('GameFont');
  4.     this._createFontLoader('GameFont2');
  5. };
复制代码
pokemon 和 digimon 正在路上
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
522
在线时间
81 小时
注册时间
2023-11-16
帖子
53
9
发表于 2024-4-15 08:16:30 | 只看该作者
原版的yep核心是会操作字体的,你得去找一下yep核心的设置,或者去站里找钻头大佬改版的yep核心,那个就不会影响字体
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-7 11:39

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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