查看: 1099|回复: 8

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

[复制链接]
梦石
0
星屑
268
在线时间
33 小时
注册时间
2024-4-10
回帖
33
发表于 2024-4-14 22:03:41 | 显示全部楼层 |阅读模式

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

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

×
字體1.jpg

字體2.jpg

字體3.jpg

改了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的核心修改了?
梦石
0
星屑
1333
在线时间
471 小时
注册时间
2012-4-8
回帖
314
发表于 2024-4-14 22:29:36 | 显示全部楼层
虽然没用过,但是试试直接更改 DTextPicture.js 中的 Game_Screen 的 dTextFontFace ?

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


[pre lang="javascript"]/*
* @command dTextSetting
* @text 文字列ピクチャ設定
* @desc 文字列ピクチャの表示方法に関する設定です。変更した設定は描画後も保持されます。未設定の項目は現状維持されます。
*/

// 注册命令监听
    PluginManagerEx.registerCommand(script, 'dTextSetting', function(args) {
        $gameScreen.setDtextSetting(args);
    });


    //=============================================================================
    // Game_Screen
    //  動的ピクチャ用のプロパティを追加定義します。
    //=============================================================================
    Game_Screen.prototype.setDtextSetting = function(setting) {
        if (setting.fontFace !== '') {
            this.dTextFontFace = setting.fontFace;
        }
    };

    // 获取 文字图片 设置
    Game_Screen.prototype.getDTextPictureInfo = function() {
        const prefix = param.prefixText || '';
        return {
            value         : prefix + this.dTextValue,
            size          : this.dTextSize,
            color         : this.dTextBackColor,
            realTime      : this.dTextRealTime,
            windowFrame   : this.dWindowFrame,
            gradationLeft : this.dTextGradationLeft,
            gradationRight: this.dTextGradationRight,
            align         : this.dTextAlign,
            font          : this.dTextFontFace,
            lineHeight    : this.dTextLineHeight,
            windowOpacity : this.dTextWindowOpacity,
            pictureWidth  : this.dTextPictureWidth,
            pictureHeight : this.dTextPictureHeight,
            vertical      : this.dTextVertical
        };
    };

    // 显示 图片
    Game_Picture.prototype.show = function(name, origin, x, y, scaleX,
                                           scaleY, opacity, blendMode) {
        if ($gameScreen.isSettingDText() && !name) {
            arguments[0]   = Date.now().toString();
            this.dTextInfo = $gameScreen.getDTextPictureInfo();
            this.updateDText();
            $gameScreen.clearDTextPicture();
        } else {
            this.dTextInfo = null;
            this._dTextValue = null;
        }
        _Game_Picture_show.apply(this, arguments);
    };[/pre]
pokemon 和 digimon 正在路上
回复

使用道具 举报

梦石
0
星屑
268
在线时间
33 小时
注册时间
2024-4-10
回帖
33
 楼主| 发表于 2024-4-14 23:28:30 | 显示全部楼层
505681468 发表于 2024-4-14 22:29
虽然没用过,但是试试直接更改 DTextPicture.js 中的 Game_Screen 的 dTextFontFace ?

没看到有 D_TEXT_ ...

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

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

[pre lang="javascript"]// Game_Screen
    //  動的ピクチャ用のプロパティを追加定義します。
    //=============================================================================
    var _Game_Screen_clear      = Game_Screen.prototype.clear;
    Game_Screen.prototype.clear = function() {
        _Game_Screen_clear.call(this);
        this.clearDTextPicture();
    };

    Game_Screen.prototype.clearDTextPicture = function() {
        this.dTextValue          = null;
        this.dTextOriginal       = null;
        this.dTextRealTime       = null;
        this.dTextSize           = 0;
        this.dTextAlign          = 0;
        this.dTextBackColor      = null;
        this.dTextFont           = null;
        this.dUsingVariables     = null;
        this.dWindowFrame        = null;
        this.dTextGradationRight = 0;
        this.dTextGradationLeft  = 0;
    };

    Game_Screen.prototype.setDTextPicture = function(value, size) {
        if (typeof TranslationManager !== 'undefined') {
            TranslationManager.translateIfNeed(value, function(translatedText) {
                value = translatedText;
            });
        }
        this.dUsingVariables = (this.dUsingVariables || []).concat(getUsingVariables(value));
        this.dTextValue      = (this.dTextValue || '') + getArgString(value, false) + '\n';
        this.dTextOriginal   = (this.dTextOriginal || '') + value + '\n';
        this.dTextSize       = size;
    };

    Game_Screen.prototype.setDTextWindowCursor = function(pictureId, rect) {
        var picture = this.picture(pictureId);
        if (picture) {
            picture.setWindowCursor(rect);
            picture.setWindowCursorActive(true);
        }
    };

    Game_Screen.prototype.setDTextWindowCursorActive = function(pictureId, value) {
        var picture = this.picture(pictureId);
        if (picture) {
            picture.setWindowCursorActive(value);
        }
    };

    Game_Screen.prototype.getDTextPictureInfo = function() {
        return {
            value         : this.dTextValue,
            size          : this.dTextSize || 0,
            align         : this.dTextAlign || 0,
            color         : this.dTextBackColor,
            font          : this.dTextFont,
            usingVariables: this.dUsingVariables,
            realTime      : this.dTextRealTime,
            originalValue : this.dTextOriginal,
            windowFrame   : this.dWindowFrame,
            gradationLeft : this.dTextGradationLeft,
            gradationRight: this.dTextGradationRight,
        };
    };

    Game_Screen.prototype.isSettingDText = function() {
        return !!this.dTextValue;
    };

    Game_Screen.prototype.setDtextFont = function(name) {
        this.dTextFont = name;
    };

    var _Game_Screen_updatePictures      = Game_Screen.prototype.updatePictures;
    Game_Screen.prototype.updatePictures = function() {
        _Game_Screen_updatePictures.apply(this, arguments);
        $gameVariables.clearChangedVariables();
    };
[/pre]
回复

使用道具 举报

梦石
0
星屑
1333
在线时间
471 小时
注册时间
2012-4-8
回帖
314
发表于 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 正在路上
回复

使用道具 举报

梦石
0
星屑
268
在线时间
33 小时
注册时间
2024-4-10
回帖
33
 楼主| 发表于 2024-4-15 00:30:32 | 显示全部楼层
DTextPicture.rar (9.28 KB, 下载次数: 3)

感謝你的回答,我再試試看!
回复

使用道具 举报

梦石
0
星屑
1333
在线时间
471 小时
注册时间
2012-4-8
回帖
314
发表于 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. };
复制代码



效果
1.gif

预加载字体后的效果
2.gif


事件设置
2.png
1.png


关于字体的可能使用
[pre lang="text"]Searching 121 files for "GAMEFONT"

js\rpg_core.js:
  853       * @type String
  854       */
  855:     this.fontFace = 'GameFont';
  856  
  857      /**
  ...
2340      this._createFPSMeter();
2341      this._createModeBox();
2342:     this._createGameFontLoader();
2343  };
2344  
....
2663  /**
2664   * @static
2665:  * @method _createGameFontLoader
2666   * @private
2667   */
2668: Graphics._createGameFontLoader = function() {
2669:     this._createFontLoader('GameFont');
2670  };
2671  

js\rpg_scenes.js:
  372  Scene_Boot.prototype.isReady = function() {
  373      if (Scene_Base.prototype.isReady.call(this)) {
  374:         return DataManager.isDatabaseLoaded() && this.isGameFontLoaded();
  375      } else {
  376          return false;
  ...
  378  };
  379  
  380: Scene_Boot.prototype.isGameFontLoaded = function() {
  381:     if (Graphics.isFontLoaded('GameFont')) {
  382          return true;
  383      } else if (!Graphics.canUseCssFontLoading()){
  384          var elapsed = Date.now() - this._startDate;
  385          if (elapsed >= 60000) {
  386:             throw new Error('Failed to load GameFont');
  387          }
  388      }

js\rpg_windows.js:
   43          return 'Dotum, AppleGothic, sans-serif';
   44      } else {
   45:         return 'GameFont';
   46      }
   47  };

10 matches across 3 files[/pre]
pokemon 和 digimon 正在路上
回复

使用道具 举报

梦石
0
星屑
268
在线时间
33 小时
注册时间
2024-4-10
回帖
33
 楼主| 发表于 2024-4-15 01:45:32 | 显示全部楼层
505681468 发表于 2024-4-15 00:57
版本确实不一样,基本可以不用管了......

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

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

使用道具 举报

梦石
0
星屑
1333
在线时间
471 小时
注册时间
2012-4-8
回帖
314
发表于 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 正在路上
回复

使用道具 举报

梦石
0
星屑
2299
在线时间
178 小时
注册时间
2023-11-16
回帖
76
发表于 2024-4-15 08:16:30 | 显示全部楼层
原版的yep核心是会操作字体的,你得去找一下yep核心的设置,或者去站里找钻头大佬改版的yep核心,那个就不会影响字体
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部