Project1

标题: Rmmv实现脸图索引显示对应角色名字插件 [打印本页]

作者: codePlayerD    时间: 2025-10-3 22:32
标题: Rmmv实现脸图索引显示对应角色名字插件
插件实现了以下功能:
1-通过提前配置脸图对应角色姓名,在写对话的时候直接在名字窗口上面直接显示角色姓名;
2-通过插件实现区间内所有对话都使用插件指令获得的姓名
更多功能已经写现在插件里面了
对话框的换肤实现了保存到配置,可以使用插件指令搭配对话选项进行简单的对话框换肤

JAVASCRIPT 代码复制下载
  1. /*:
  2.  * @plugindesc 简单增强对话框1.2.1
  3.  * @author OYS_codePlayerD(缘系列)
  4.  * @version 1.2.1
  5.  *
  6.  * @param TiMsgModel
  7.  * @text 开启脸图索引名字
  8.  * @desc 开启后通过脸图和索引设置对话e的角色名字
  9.  * @type boolean
  10.  * @default true
  11.  *
  12.  * @param PlayerFaceNames
  13.  * @text 指定特殊角色脸图文件名
  14.  * @desc 使用逗号分隔,用于从数据文件获得对应角色数据
  15.  * @default Actor1,Actor2
  16.  *
  17.  * @param setMsgNameColor
  18.  * @text 指定名字框文字颜色
  19.  * @desc 设置名字框文字初始颜色,数值:0-31
  20.  * @type number
  21.  * @min 0
  22.  * @max 31
  23.  * @default 2
  24.  *
  25.  * @param msgNameFontSize
  26.  * @text 名字框名字大小
  27.  * @desc 设置名字框名字大小
  28.  * @type number
  29.  * @default 28
  30.  *
  31.  * @param nameWindowHeight
  32.  * @text 名字框的最大高度
  33.  * @desc 设置名字框的最大高度
  34.  * @type number
  35.  * @default 100
  36.  *
  37.  * @param PositionTypeX
  38.  * @text 起始窗口位置
  39.  * @desc 起始时窗口位置,后续可通过插件指令更改
  40.  * @type select
  41.  * @option 左方
  42.  * @value 2
  43.  * @option 中间
  44.  * @value 1
  45.  * @option 方右
  46.  * @value 0
  47.  * @default 0
  48.  *
  49.  * @param defaultOffsetY
  50.  * @text 名字框相对窗口Y偏移
  51.  * @desc Y:以对话框为参照点,向上偏移的数值
  52.  * @type number
  53.  * @default 0
  54.  *
  55.  * @help
  56.  *  插件功能:
  57.  *      1-增加对话角色名字框
  58.  *      2-实现了几种更换对话角色名字的功能
  59.  *      3-实现对话窗口相关换肤功能(支持保存到配置文件)
  60.  *  名字相关插件命令:
  61.  *      TiMsg original
  62.  *            :0-原始模式(没有名字窗口那个)
  63.  *      TiMsg selftName 我是名字
  64.  *            :2-自定义名字
  65.  *      TiMsg selfEid 1
  66.  *           :3-通过Id获得这个id对应的名称
  67.  *      TiMsg reset
  68.  *           :1-重置,与上述3个指令组合成区间效果
  69.  *           举例:
  70.  *               TiMsg selfEid 1
  71.  *                |
  72.  *                |区间内所有对话名字使用id=1这个事件的名称,以上其余同理
  73.  *                |
  74.  *               TiMsg reset
  75.  *      TiMsg msgNameColor ColorId  
  76.  *            : 这里是切换对话角色名字的颜色
  77.  *          - 示例 : TiMsg msgNameColor 2 :和\c[2]一样,范围:0-31
  78.  *  名字框插件相关指令:
  79.  *      TiMsg wLeft   :名字框靠左
  80.  *      TiMsg wCenter :名字框居中
  81.  *      TiMsg wRight  :名字框靠右
  82.  *  对话窗口皮肤相关插件指令:
  83.  *      TiMsg Skin fileName
  84.  *            说明:实现切换小窗口的皮肤切换,可以再对话时添加指令
  85.  *            注意:请务必预加载皮肤,不然可能会使用默认皮肤或直接没有皮肤
  86.  *      TiMsg saveIniSkin
  87.  *          --保存对话皮肤配置
  88.  * 版权备注:
  89.  *      1-免费可商用,但请注明作者:OYS
  90.  *
  91.  */
  92.  
  93. (function () {
  94.     const pluginName = 'OYS_TiMessage';
  95.     const parameters = PluginManager.parameters(pluginName);
  96.     const playerFaceNames = (parameters['PlayerFaceNames'] || '').split(',').map(name => name.trim());
  97.     // 窗口相关参数,这是为了时限对话角色名字
  98.     let defaultWidth = 200;
  99.     let defaultHeight = Number(parameters['nameWindowHeight'] || 100);
  100.     let defaultX = 50;
  101.     let defaultY = Number(parameters['defaultOffsetY'] || 0);
  102.     //=================分割========
  103.     let TiMsgModel = (parameters['TiMsgModel'] || true);
  104.     let MsgNameColorId = Number(parameters['setMsgNameColor'] || 2);
  105.     let currentMode = 1;
  106.     let selftName = "";
  107.     let currenEid = 0;
  108.     let WindowsPosition = 0;
  109.     // 引入NW.js的文件系统和路径模块,实现对话窗口换肤配置
  110.     const fs = require('fs');
  111.     const path = require('path');
  112.  
  113.     // 在这里配置脸图对应的数据
  114.     function actorsDataGet(currentFaceName, faceIndex) {
  115.         // 为每张图片绑定对应角色名
  116.         var actorsData = {
  117.             "Actor1": {
  118.                 "0": getActorsName(1),
  119.                 "1": getActorsName(2),
  120.                 "2": getActorsName(3),
  121.                 "3": getActorsName(4),
  122.                 "4": getActorsName(1),
  123.                 "5": "自定义",
  124.                 "6": getActorsName(1),
  125.                 "7": getActorsName(1),
  126.             },
  127.             "Actor2": {
  128.                 "0": getActorsName(1),
  129.                 "1": getActorsName(1),
  130.                 "2": getActorsName(2),
  131.                 "3": getActorsName(4),
  132.                 "4": getActorsName(2),
  133.                 "5": getActorsName(3),
  134.                 "6": getActorsName(4),
  135.                 "7": "自定义名字",
  136.             },
  137.         };
  138.         return actorsData[currentFaceName][faceIndex];
  139.     }
  140.     // =================
  141.     // 配置所有可能用到的皮肤图片文件(文件必须存在)
  142.     // =========
  143.     const availableSkins = [
  144.         // 这个是窗口皮肤配置,要用的皮肤文件都写在这里
  145.         // 这是给名字窗口使用的皮肤
  146.         'Window',
  147.         'Window2',
  148.     ];
  149.     availableSkins.forEach(skinName => {
  150.         // 预加载皮肤,如果不做预加载,小窗口皮肤无法使用哦
  151.         ImageManager.loadSystem(skinName);
  152.     });
  153.  
  154.  
  155.     // ========皮肤,从文件中加载============
  156.     // 因为不干扰存档文件,所以配置文件单开,
  157.     // 所以保存需要使用插件指令
  158.     // =============================
  159.     let currentSkin = loadWindowSkin(); // 打开游戏时就加载配置
  160.     let msgNameFontSize = Number(parameters['msgNameFontSize'] || 28);
  161.     const _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
  162.     Game_Interpreter.prototype.pluginCommand = function (command, args) {
  163.         _Game_Interpreter_pluginCommand.call(this, command, args);
  164.         if (command === 'TiMsg') {
  165.             switch (args[0]) {
  166.                 case 'original':
  167.                     currentMode = 0;
  168.                     break;
  169.                 case 'reset':
  170.                     currentMode = 1;
  171.                     break;
  172.                 case 'selftName':
  173.                     currentMode = 2;
  174.                     selftName = args[1];
  175.                     break;
  176.                 case 'selfEid':
  177.                     currentMode = 3;
  178.                     currenEid = Number(args[1]);
  179.                     break;
  180.                 case 'wLeft':
  181.                     WindowsPosition = 0;
  182.                     break;
  183.                 case 'wCenter':
  184.                     WindowsPosition = 1;
  185.                     break;
  186.                 case 'wRight':
  187.                     WindowsPosition = 2;
  188.                     break;
  189.                 case 'msgNameColor':
  190.                     MsgNameColorId = Number(args[1]);
  191.                     break;
  192.                 case 'Skin':
  193.                     const newSkin = args[1];
  194.                     currentSkin = availableSkins.includes(newSkin) ? newSkin : 'Window';
  195.                     break;
  196.                 case 'saveIniSkin':
  197.                     saveWindowSkin(currentSkin)
  198.                     break;
  199.             }
  200.         }
  201.     };
  202.  
  203.     // ============================
  204.     // 这里操作配置文件
  205.     // --实现 对话窗口皮肤 的配置
  206.     // --实现 选项窗口皮肤 的配置
  207.     // --可拓展 实现 菜单窗口皮肤 的配置
  208.     // =====================
  209.     // 获取配置文件
  210.     function getConfigFilePath() {
  211.         return path.join(process.cwd(), 'wini.json');
  212.     }
  213.     function doesConfigFileExist() {
  214.         try {
  215.             return fs.existsSync(getConfigFilePath()) &&
  216.                 fs.statSync(getConfigFilePath()).isFile();
  217.         } catch (e) {
  218.             return false;
  219.         }
  220.     }
  221.     // 初始化配置文件(如果不存在则初始化配置)
  222.     function initializeConfigFile() {
  223.         if (!doesConfigFileExist()) {
  224.             try {
  225.                 const defaultConfig = {
  226.                     windowSkin: 'Window',//窗口,给window_Base用
  227.                     WindowMessageSkin: 'Window2',//对话窗口皮肤
  228.                     lastSaved: new Date().toISOString()
  229.                 };
  230.                 fs.writeFileSync(
  231.                     getConfigFilePath(),
  232.                     JSON.stringify(defaultConfig, null, 2),
  233.                     'utf8'
  234.                 );
  235.                 // 成功
  236.                 return true;
  237.             } catch (e) {
  238.                 // 创建默认配置文件失败
  239.                 return false;
  240.             }
  241.         }
  242.         return true;
  243.     }
  244.  
  245.     function saveWindowSkin(skinName) {
  246.         // 确保配置文件存在
  247.         if (!initializeConfigFile()) { return false; }
  248.         try {
  249.             const currentConfig = JSON.parse(fs.readFileSync(getConfigFilePath(), 'utf8'));
  250.             const updatedConfig = {
  251.                 ...currentConfig,
  252.                 WindowMessageSkin: skinName,
  253.                 lastSaved: new Date().toISOString()
  254.             };
  255.             fs.writeFileSync(
  256.                 getConfigFilePath(),
  257.                 JSON.stringify(updatedConfig, null, 2),
  258.                 'utf8'
  259.             );
  260.             // 已保存皮肤设置
  261.             return true;
  262.         } catch (e) {
  263.             console.error('保存皮肤设置失败:', e);
  264.             return false;
  265.         }
  266.     }
  267.     function loadWindowSkin() {
  268.         // 确保配置文件存在
  269.         if (!initializeConfigFile()) { return 'Window'; }
  270.         try {
  271.             const config = JSON.parse(fs.readFileSync(getConfigFilePath(), 'utf8'));
  272.             if (config && typeof config.WindowMessageSkin === 'string') {
  273.                 return config.WindowMessageSkin;
  274.             } else {
  275.                 // 配置文件格式不正确,使用默认皮肤
  276.                 return 'Window';
  277.             }
  278.         } catch (e) {
  279.             // 加载皮肤设置失败
  280.             return 'Window';
  281.         }
  282.     }
  283.  
  284.     function getActorsName(id) {
  285.         // 通过id获取角色数据库里的对应角色名
  286.         return $gameActors.actor(id) ? $gameActors.actor(id).name() : "未知角色数据";
  287.     }
  288.  
  289.     // =========
  290.     // 实现设置姓名框的名字
  291.     // ===========================
  292.     const _Game_Message_allText = Game_Message.prototype.allText;
  293.     Game_Message.prototype.allText = function () {
  294.         const originalText = _Game_Message_allText.call(this);
  295.         if (!originalText) return originalText;
  296.         if (TiMsgModel) {
  297.             const currentFaceName = this.faceName();
  298.             const faceIndex = this.faceIndex();
  299.             // 处理脸图加索引以及没有脸图
  300.             if (currentMode === 1) {
  301.                 if (currentFaceName.trim() === '') {
  302.                     // 使用事件名作为名称
  303.                     const currentEvent = $gameMap._interpreter._eventId ?
  304.                         $gameMap.event($gameMap._interpreter._eventId) : null;
  305.                     const eventName = currentEvent ? currentEvent.event().name : "未知事件";
  306.                     setMsgNameTxt(eventName);
  307.                     return originalText;
  308.                 }
  309.                 // 使用 脸图+索引 模式
  310.                 const isActors = playerFaceNames.includes(currentFaceName);
  311.                 if (isActors) {
  312.                     const msgName = actorsDataGet(currentFaceName, faceIndex);
  313.                     setMsgNameTxt(msgName);
  314.                     return originalText;
  315.                 } else {
  316.                     const currentEvent = $gameMap._interpreter._eventId ?
  317.                         $gameMap.event($gameMap._interpreter._eventId) : null;
  318.                     const eventName = currentEvent ? currentEvent.event().name : "未知事件";
  319.                     setMsgNameTxt(eventName);
  320.                     return originalText;
  321.                 }
  322.             }
  323.             if (currentMode === 0) {
  324.                 // 原始的模式
  325.                 setMsgNameTxt(selftName);
  326.                 return originalText;
  327.             }
  328.             if (currentMode === 2) {//自定义名字
  329.                 setMsgNameTxt(selftName);
  330.                 return originalText;
  331.             }
  332.             if (currentMode === 3) {
  333.                 // 事件名称
  334.                 if (currenEid < 1) {
  335.                     const currentEvent = $gameMap._interpreter._eventId ?
  336.                         $gameMap.event($gameMap._interpreter._eventId) : null;
  337.                     const eventName = currentEvent ? currentEvent.event().name : "未知事件";
  338.                     setMsgNameTxt(eventName);
  339.                     return originalText;
  340.                 } else {
  341.                     const eventNameEid = $gameMap.event(currenEid).event().name;
  342.                     setMsgNameTxt(eventNameEid);
  343.                     return originalText;
  344.                 }
  345.             }
  346.         }
  347.         return originalText;
  348.     };
  349.     function setMsgNameTxt(txt) {
  350.         selftName = txt;
  351.     }
  352.  
  353.     //===============
  354.     //名字窗口,原本想调用窗口来实现,但发现不符合预期
  355.     //=====================================
  356.     var _Window_Message_initialize = Window_Message.prototype.initialize;
  357.     Window_Message.prototype.initialize = function () {
  358.         _Window_Message_initialize.call(this);
  359.         this.createSkinWindow();
  360.         this.createMsgNameTxt();
  361.         this.windowskin = ImageManager.loadSystem(currentSkin)
  362.     };
  363.     Window_Message.prototype.createSkinWindow = function () {
  364.         //模拟实现窗口皮肤效果
  365.         this._MsgWindowSkin = new Sprite(new Bitmap(defaultWidth + 16, defaultHeight + 16));
  366.         this._MsgWindowSkin.x = defaultX;
  367.         this._MsgWindowSkin.y = (defaultY + defaultHeight + 16) * (-1);
  368.         this._MsgWindowSkin.visible = true;
  369.         this.addChild(this._MsgWindowSkin);
  370.         if (!this._MsgWindowSkin) return;
  371.         this.skin = ImageManager.loadSystem(currentSkin);
  372.         if (!this.skin.isReady()) {// 加载失败则降级到默认皮肤
  373.             this.skin = ImageManager.loadSystem('Window');
  374.         } else {
  375.             const bitmap = this._MsgWindowSkin.bitmap;
  376.             const width = bitmap.width;
  377.             const height = bitmap.height;
  378.             bitmap.clear();
  379.             const padding = 3.7;
  380.             const w = width - padding * 2;
  381.             const h = height - padding * 2;
  382.             this.drawBackgroud(bitmap, this.skin, padding, 0, 0, w, h);
  383.             const mw = 8; // 边框宽度
  384.             this.drawBord(bitmap, this.skin, 1, 0, mw, width, height)
  385.         }
  386.     };
  387.     Window_Message.prototype.updateWindowSkin = function (txtWidth) {
  388.         const getChangesta = txtWidth > defaultWidth;
  389.         let setSkinWinW = getChangesta ? txtWidth : defaultWidth;
  390.         this._MsgWindowSkin.bitmap = new Bitmap(setSkinWinW + 16 - 3.7, defaultHeight + 16);
  391.         const bitmap = this._MsgWindowSkin.bitmap;
  392.         const width = bitmap.width;
  393.         const height = bitmap.height;
  394.         bitmap.clear();
  395.         const nmaePadding = 8;
  396.         // 这里实现变换位置
  397.         if (WindowsPosition === 0) {
  398.             this._MsgWindowSkin.x = 10 - nmaePadding;
  399.         }
  400.         if (WindowsPosition === 1) {
  401.             this._MsgWindowSkin.x = (Graphics.boxWidth - setSkinWinW) / 2 - nmaePadding;
  402.         }
  403.         if (WindowsPosition === 2) {
  404.             this._MsgWindowSkin.x = (Graphics.boxWidth - setSkinWinW) - nmaePadding;
  405.         }
  406.         // 这里实现更换皮肤
  407.         this.skin = ImageManager.loadSystem(currentSkin);
  408.         this.windowskin = ImageManager.loadSystem(currentSkin)
  409.         const padding = 3.7;
  410.         const w = width - padding * 2;
  411.         const h = height - padding * 2;
  412.         this.drawBackgroud(bitmap, this.skin, padding, 0, 0, w, h);
  413.         const mw = 8; // 边框宽度
  414.         this.drawBord(bitmap, this.skin, 1, 0, mw, width, height)
  415.     }
  416.  
  417.     Window_Message.prototype.createMsgNameTxt = function () {
  418.         this._msgNameTxtSprite = new Sprite();
  419.         this._msgNameTxtSprite.bitmap = new Bitmap(defaultHeight, defaultHeight);
  420.         this._msgNameTxtSprite.bitmap.fontSize = Window_Base.prototype.standardFontSize();
  421.         // 这里初始计算是以对话窗口左上角为0,0,
  422.         // 在这里还是蛮好用的,刚好设置到窗口上方
  423.         this._msgNameTxtSprite.x = defaultX + 8;
  424.         this._msgNameTxtSprite.y = (defaultY + defaultHeight + 8) * (-1);
  425.         this._msgNameTxtSprite.visible = false;
  426.         this.z = 5;
  427.         this.addChild(this._msgNameTxtSprite);
  428.     };
  429.     Window_Message.prototype.updateMsgNameTxt = function (txtWidth) {
  430.         const getTxtChangeSta = txtWidth > defaultWidth;
  431.         let TxtWidthSet = getTxtChangeSta ? txtWidth : defaultWidth;
  432.         this._msgNameTxtSprite.visible = true;
  433.         this._msgNameTxtSprite.bitmap = new Bitmap(TxtWidthSet - 4, defaultHeight);
  434.         this._msgNameTxtSprite.bitmap.clear();
  435.         // 这里实现变换位置
  436.         if (WindowsPosition === 0) {
  437.             this._msgNameTxtSprite.x = 10;
  438.         }
  439.         if (WindowsPosition === 1) {
  440.             this._msgNameTxtSprite.x = (Graphics.boxWidth - TxtWidthSet) / 2;
  441.         }
  442.         if (WindowsPosition === 2) {
  443.             this._msgNameTxtSprite.x = (Graphics.boxWidth - TxtWidthSet);
  444.         }
  445.         // 更换字体大小
  446.         this._msgNameTxtSprite.bitmap.fontSize = msgNameFontSize;
  447.         this._msgNameTxtSprite.bitmap.textColor = this.textColor(MsgNameColorId);
  448.         this._msgNameTxtSprite.bitmap.drawText(selftName, 0, 0, TxtWidthSet - 4, defaultHeight, 'center');
  449.     }
  450.     Window_Message.prototype.updateCustomSprite = function () {
  451.         let txtWidth = this._msgNameFontSize * selftName.length;
  452.         if (this._MsgWindowSkin) {
  453.             this._MsgWindowSkin.visible = false;
  454.             if (currentMode !== 0) {
  455.                 this._MsgWindowSkin.visible = true;
  456.                 this.updateWindowSkin(txtWidth);
  457.             }
  458.         }
  459.         if (this._msgNameTxtSprite) {
  460.             this._msgNameTxtSprite.visible = false;
  461.             if (currentMode !== 0) {
  462.                 this.updateMsgNameTxt(txtWidth);
  463.             }
  464.         }
  465.     }
  466.  
  467.     var _Window_Message_prototype_update = Window_Message.prototype.update;
  468.     Window_Message.prototype.update = function () {
  469.         _Window_Message_prototype_update.call(this);
  470.         //留着作为特效拓展,暂时没想好
  471.     }
  472.     var _Window_Message_startMessage = Window_Message.prototype.startMessage;
  473.     Window_Message.prototype.startMessage = function () {
  474.         _Window_Message_startMessage.call(this);
  475.         this.updateCustomSprite();
  476.     };
  477.     var _Window_Message_terminateMessage = Window_Message.prototype.terminateMessage;
  478.     Window_Message.prototype.terminateMessage = function () {
  479.         _Window_Message_terminateMessage.call(this);
  480.         if (this._msgNameTxtSprite) {
  481.             this._msgNameTxtSprite.visible = false;
  482.         }
  483.         if (this._MsgWindowSkin) {
  484.             this._MsgWindowSkin.visible = false;
  485.         }
  486.     };
  487.     // =========
  488.     // 对话选项换皮肤
  489.     // ==================
  490.     var Window_ChoiceList_prototype_start = Window_ChoiceList.prototype.start;
  491.     Window_ChoiceList.prototype.start = function () {
  492.         Window_ChoiceList_prototype_start.call(this);
  493.         this.windowskin = ImageManager.loadSystem(currentSkin);
  494.     };
  495.     //=====================
  496.     // 这里是处理小窗口的绘制,基本保持不动就好了
  497.     // =======================================
  498.     Window_Message.prototype.drawBord = function (tempBitmapBorder, skin, cpX, cpY, mw, width, height) {
  499.         //对比用,心累填数据: bitmap.blt(源图片, 源x, 源y, 源宽, 源高, 目标x, 目标y, 目标宽, 目标高);
  500.         // 左边两角
  501.         tempBitmapBorder.blt(skin, cpX * 96, 0, mw, mw, 0, 0, mw, mw); // 左上角
  502.         tempBitmapBorder.blt(skin, cpX * 96, 96 + 96 * cpY - mw, mw, mw, 0, height - mw, mw, mw); // 左下角
  503.         // 右边两角
  504.         tempBitmapBorder.blt(skin, 96 + cpX * 96 - mw, 0, mw, mw, width - mw, 0, mw, mw); // 右上角
  505.         tempBitmapBorder.blt(skin, 96 + cpX * 96 - mw, 96 + cpY * 96 - mw, mw, mw, width - mw, height - mw, mw, mw); // 右下角
  506.         // 上下边线
  507.         tempBitmapBorder.blt(skin, cpX * 96 + mw, 0, 96 - 2 * mw, mw, mw, 0, width - 2 * mw, mw); // 上边
  508.         tempBitmapBorder.blt(skin, cpX * 96 + mw, 96 - mw, 96 - 2 * mw, mw, mw, height - mw, width - 2 * mw, mw);
  509.         // 左右边线
  510.         tempBitmapBorder.blt(skin, cpX * 96, mw, mw, 96 - 2 * mw, 0, mw, mw, height - 2 * mw); // 左边
  511.         tempBitmapBorder.blt(skin, 96 + cpX * 96 - mw, mw, mw, 96 - 2 * mw, width - mw, mw, mw, height - 2 * mw);
  512.     };
  513.  
  514.     Window_Message.prototype.drawBackgroud = function (drawBackgroudBitmap, skin, padding, cpX, cpY, w, h) {
  515.         const mw = 96;
  516.         const backColor = this.contentsBackColor();
  517.         drawBackgroudBitmap.clear();
  518.  
  519.  
  520.         drawBackgroudBitmap.context.globalCompositeOperation = 'overlay';
  521.         drawBackgroudBitmap.context.globalAlpha = 0.75;
  522.         // 绘制窗口平铺花纹
  523.         const sx = 0;
  524.         const sy = 96;
  525.         const sw = mw - 0 * 2;
  526.         const sh = mw - 0 * 2;
  527.         for (let y = padding; y < h + padding; y += sh) {
  528.             for (let x = padding; x < w + padding; x += sw) {
  529.                 const drawWidth = Math.min(sw, w + padding - x);
  530.                 const drawHeight = Math.min(sh, h + padding - y);
  531.                 drawBackgroudBitmap.blt(skin, sx, sy, sw, sh, x, y, drawWidth, drawHeight);
  532.             }
  533.         }
  534.         drawBackgroudBitmap.fillRect(padding, padding, w, h, backColor);
  535.         drawBackgroudBitmap.context.globalAlpha = 1;
  536.         drawBackgroudBitmap.context.globalCompositeOperation = 'source-over';
  537.  
  538.     };
  539.     // 模拟RMMV的背景色获取
  540.     Window_Message.prototype.contentsBackColor = function () {
  541.         const tone = $gameSystem.windowTone();
  542.         return `rgba(${tone[0]}, ${tone[1]}, ${tone[2]},0.75)`;
  543.     };
  544. })();

作者: 元始天尊    时间: 2025-10-4 16:55
用了之后显示的只字母+数字? 怎么配置显示名字?
// 在这里配置脸图对应的数据
    function actorsDataGet(currentFaceName, faceIndex) {
        // 为每张图片绑定对应角色名
        var actorsData = {
            "A01": {
                "0": getActorsName(1),
                "1": getActorsName(2),
                "2": getActorsName(3),
                "3": getActorsName(4),
                "4": getActorsName(1),
                "5": "自定义",
                "6": getActorsName(1),
                "7": getActorsName(1),
            },
            "Actor2": {
                "0": getActorsName(1),
                "1": getActorsName(1),
                "2": getActorsName(2),
                "3": getActorsName(4),
                "4": getActorsName(2),
                "5": getActorsName(3),
                "6": getActorsName(4),
                "7": "自定义名字",
            },
        };
        return actorsData[currentFaceName][faceIndex];
在这边改括号里面1吗?  改成名字也不管用
作者: 元始天尊    时间: 2025-10-4 17:10
        // 为每张图片绑定对应角色名
        var actorsData = {
            "A01": {
            "0": "洛卡斯",  // 索引0 → 洛卡斯
            "1": "洛卡斯",  // 索引1 → 洛卡斯
            "2": "洛卡斯",  // 索引2 → 洛卡斯
            "3": "洛卡斯",  // 索引3 → 洛卡斯
            "4": "洛卡斯",  // 索引4 → 洛卡斯
            "5": "洛卡斯",  // 索引5 → 洛卡斯
            "6": "洛卡斯",  // 索引6 → 洛卡斯
            "7": "洛卡斯"   // 索引7 → 洛卡斯
            },
            "A02": {
            "0": "洛薇尔",  // 索引0 → 洛卡斯
            "1": "洛薇尔",  // 索引1 → 洛卡斯
            "2": "洛薇尔",  // 索引2 → 洛卡斯
            "3": "洛薇尔",  // 索引3 → 洛卡斯
            "4": "洛薇尔",  // 索引4 → 洛卡斯
            "5": "洛薇尔",  // 索引5 → 洛卡斯
            "6": "洛薇尔",  // 索引6 → 洛卡斯
            "7": "洛薇尔"   // 索引7 → 洛卡斯
            },
        };   名字都改了也不行啊  还是显示事件名字




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1