扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 124|回复: 0

[转载发布] Rmmv实现脸图索引显示对应角色名字插件

[复制链接]
累计送礼:
0 个
累计收礼:
0 个
  • TA的每日心情
    开心
    前天 05:59
  • 签到天数: 163 天

    连续签到: 2 天

    [LV.7]常住居民III

    2506

    主题

    555

    回帖

    1万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    6
    卡币
    14383
    OK点
    16
    推广点
    0
    同能卷
    0
    积分
    17472

    灌水之王

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

                本帖来自P1论坛作者codePlayerD,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg.blue/forum.php?mod=viewthread&tid=498154  若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2025-10-10 13:02 , Processed in 0.137474 second(s), 51 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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