|
本帖最后由 烁灵 于 2024-5-28 10:37 编辑
大意了,Galv的脚本不能二次发布以后不翻译了
原地址:Galv's Visual Novel Choices MZ | RPG Maker Forums (rpgmakerweb.com)
效果:
范例:https://www.123pan.com/s/uBKyVv-ptF3A.html 提取码:7MnO
插件代码:
- //-----------------------------------------------------------------------------
- // Galv's Visual Novel Choices MZ
- //-----------------------------------------------------------------------------
- // For: RPGMAKER MV/MZ
- // GALV_VisualNovelChoicesMZ.js
- //-----------------------------------------------------------------------------
- // 2020-11-17 - Version 1.0 - release
- //-----------------------------------------------------------------------------
- // Terms can be found at:
- // galvs-scripts.com
- // 汉化 by 烁灵
- // 更多汉化脚本请访问:http://www.hknmtt.com
- //-----------------------------------------------------------------------------
- var Imported = Imported || {};
- Imported.Galv_VisualNovelChoices = true;
- var Galv = Galv || {}; // Galv's main object
- Galv.VNC = Galv.VNC || {}; // Plugin object
- Galv.VNC.pluginName = "GALV_VisualNovelChoicesMZ";
- //-----------------------------------------------------------------------------
- /*:
- * @plugindesc (v.1.0) Changes how the "Choice" message boxes display to appear more like visual novels.
- * @url http://galvs-scripts.com
- * @target MZ
- * @author Galv
- * @orderAfter GALV_MessageStylesMZ
- *
- * @param Command Width
- * @desc VNButtons.png 图片的宽度.
- * @default 700
- *
- * @param Command Height
- * @desc 每个选项的高度
- * @default 48
- *
- * @param Always Middle
- * @desc 保持居中,忽略选项的“窗口位置”设置. 填 true 或 false
- * @default true
- *
- * @param Message Gap
- * @desc 选项与对话框的距离
- * @default 0
- *
- * @param Disabled Button
- * @desc 用于显示无效选项的图片编号(如果使用了无效选项插件的话)
- * @default 3
- *
- * @requiredAssets img/system/VNButtons
- *
- * @help
- * Galv's Visual Novel Choices
- * ----------------------------------------------------------------------------
- * 以视觉小说的风格显示选项. 选项按钮图片需要放在 /img/system/ 文件夹下,图片名为:
- * "VNButtons.png". 这是一张单图片,包含了所有选项背景,从上到下排列。
- * Command Width 和 Command Height 设置图片的宽度和每个按钮图片的高度,确保将
- * "Command Width" 设定为图片的宽度。
- *
- * VNButtons 文件里第一张图片的按钮编号是 0。这张图是选项的光标图。默认应用的选项按钮图是
- * 1 号按钮(在光标图下边第一张)
- *
- * 在选项的文本中使用 \b[x] 可以指定不同的选项图片,x 是行数(从1开始)
- *
- * "Disabled Button" 选项是为了当你使用无效选项插件做准备的,比如:
- * Hime 的 "Disabled Choice Conditions" 插件.
- *
- * ----------------------------------------------------------------------------
- * 脚本调用:
- * ----------------------------------------------------------------------------
- *
- * $gameSystem.vnChoices = status; // status 可以为 true 或 false
- */
- //-----------------------------------------------------------------------------
- // CODE STUFFS
- //-----------------------------------------------------------------------------
- Galv.VNC.width = Number(PluginManager.parameters(Galv.VNC.pluginName)["Command Width"]);
- Galv.VNC.height = Number(PluginManager.parameters(Galv.VNC.pluginName)["Command Height"]);
- Galv.VNC.alwaysMid = PluginManager.parameters(Galv.VNC.pluginName)["Always Middle"].toLowerCase() == 'true';
- Galv.VNC.msgGap = Number(PluginManager.parameters(Galv.VNC.pluginName)["Message Gap"]);
- Galv.VNC.disableBtn = Number(PluginManager.parameters(Galv.VNC.pluginName)["Disabled Button"]);
- // Cache
- Galv.VNC.Scene_Boot_loadSystemImages = Scene_Boot.prototype.loadSystemImages;
- Scene_Boot.prototype.loadSystemImages = function() {
- ImageManager.loadSystem('VNButtons');
- Galv.VNC.Scene_Boot_loadSystemImages.call(this);
- };
- // Choice stuff
- Galv.VNC.Game_System_initialize = Game_System.prototype.initialize;
- Game_System.prototype.initialize = function() {
- Galv.VNC.Game_System_initialize.call(this);
- this.vnChoices = true;
- };
- // Overwrite
- Window_ChoiceList.prototype.textHeight = Window_ChoiceList.prototype.lineHeight;
- Galv.VNC.Window_ChoiceList_lineHeight = Window_ChoiceList.prototype.lineHeight;
- Window_ChoiceList.prototype.lineHeight = function() {return $gameSystem.vnChoices ? Galv.VNC.height : Galv.VNC.Window_ChoiceList_lineHeight.call(this);};
- Galv.VNC.Window_ChoiceList_itemHeight = Window_ChoiceList.prototype.itemHeight;
- Window_ChoiceList.prototype.itemHeight = function() {return $gameSystem.vnChoices ? Galv.VNC.height : Galv.VNC.Window_ChoiceList_itemHeight.call(this);};
- Galv.VNC.Window_ChoiceList_drawItem = Window_ChoiceList.prototype.drawItem;
- Window_ChoiceList.prototype.drawItem = function(index) {
- if ($gameSystem.vnChoices) {
- const rect = this.itemRectForText(index);
- this.drawButton(index,rect.y);
- if (index === this._index) this.drawButton(index,rect.y,true);
- const offset = 0;//(this.lineHeight() - this.textHeight()) * 0.5;
- this.drawTextEx(this.commandName(index), rect.x, rect.y + offset);
- } else {
- Galv.VNC.Window_ChoiceList_drawItem.call(this,index);
- };
- };
- Galv.VNC.Window_ChoiceList_updatePlacement = Window_ChoiceList.prototype.updatePlacement;
- Window_ChoiceList.prototype.updatePlacement = function() {
- Galv.VNC.Window_ChoiceList_updatePlacement.call(this);
- if ($gameSystem.vnChoices && Galv.VNC.alwaysMid) {
- this.x = (Graphics.boxWidth - this.width) / 2;
- };
- if (this._messageWindow.y >= Graphics.boxHeight / 2) {
- this.y -= Galv.VNC.msgGap;
- } else {
- this.y += Galv.VNC.msgGap;
- };
- };
- Galv.VNC.Window_ChoiceList__refreshCursor = Window_ChoiceList.prototype._refreshCursor;
- Window_ChoiceList.prototype._refreshCursor = function() {
- if ($gameSystem.vnChoices) {
- this._cursorSprite.opacity = 0;
- } else {
- Galv.VNC.Window_ChoiceList__refreshCursor.call(this);
- };
- };
- Galv.VNC.Window_ChoiceList_drawItemBackground = Window_ChoiceList.prototype.drawItemBackground;
- Window_ChoiceList.prototype.drawItemBackground = function(index) {
- if ($gameSystem.vnChoices) return;
- Galv.VNC.Window_ChoiceList_drawItemBackground.call(this,index);
- };
- Window_ChoiceList.prototype.drawButton = function(index,y,cursor) {
- const bitmap = ImageManager.loadSystem('VNButtons');
- const pw = Galv.VNC.width;
- const ph = Galv.VNC.height;
- let bgId = 0;
- const sx = 0;
- if (cursor) {
- bgId = 0;
- } else {
- if (this._list[index].enabled === false || !this.choice_background) {
- bgId = Galv.VNC.disableBtn;
- } else {
- bgId = this.choice_background[index] ? this.choice_background[index] : 1;
- };
- };
- const sy = bgId * ph;
- this.contents.blt(bitmap, sx, sy, pw, ph, 0, y);
- };
- Galv.VNC.Window_ChoiceList_start = Window_ChoiceList.prototype.start;
- Window_ChoiceList.prototype.start = function() {
- this.setupVNChoices();
- Galv.VNC.Window_ChoiceList_start.call(this);
- };
- Window_ChoiceList.prototype.setupVNChoices = function() {
- this.ChoiceSprites = [];
- this.choice_background = [];
- this._vnIndex = this._index;
- if ($gameSystem.vnChoices) {
- this.opacity = 0;
- } else {
- this.opacity = 255;
- };
- };
- Galv.VNC.Window_ChoiceList_update = Window_ChoiceList.prototype.update;
- Window_ChoiceList.prototype.update = function() {
- Galv.VNC.Window_ChoiceList_update.call(this);
- if (this._vnIndex != this._index) {
- this.refresh();
- this._vnIndex = this._index;
- }
- };
- Galv.VNC.Window_ChoiceList_updateBackground = Window_ChoiceList.prototype.updateBackground;
- Window_ChoiceList.prototype.updateBackground = function() {
- if ($gameSystem.vnChoices) {
- this._background = 2;
- this.setBackgroundType(this._background);
- } else {
- Galv.VNC.Window_ChoiceList_updateBackground.call(this);
- };
-
- };
- Galv.VNC.Window_ChoiceList_convertEscapeCharacters = Window_ChoiceList.prototype.convertEscapeCharacters;
- Window_ChoiceList.prototype.convertEscapeCharacters = function(text,index) {
- text = text.replace(/\\/g, '\x1b');
- text = text.replace(/\x1b\x1b/g, '\\');
- text = text.replace(/\x1bB\[(\d+)\]/gi, function() {
- this.choice_background[index] = parseInt(arguments[1]);
- return "";
- }.bind(this));
-
- return Galv.VNC.Window_ChoiceList_convertEscapeCharacters.call(this,text);
- };
- Window_ChoiceList.prototype.itemRectForText = function(index) {
- let rect = this.itemRect(index);
- if ($gameSystem.vnChoices) {
- let txt = $gameMessage._choices[index];
-
- // count icon code
- let icons = txt.match(/\\i\[/g) || txt.match(/\\I\[/g);
- icons = icons ? icons.length * 36 : 0;
-
- txt = this.convertEscapeCharacters(txt,index);
- txt = txt.replace(/i\[\d*\]/g,"");
- txt = txt.replace(/I\[\d*\]/g,"");
-
- txt = txt.replace(/c\[\d*\]/g,"");
- txt = txt.replace(/C\[\d*\]/g,"");
- const txtSize = this.textWidth(txt) + icons;
- rect.x = (Galv.VNC.width - txtSize) / 2;
- } else {
- rect.x += $gameSystem.windowPadding();
- };
- rect.width -= $gameSystem.windowPadding() * 2;
- return rect;
- };
- Window_ChoiceList.prototype.windowWidth = function() {
- const width = this.maxChoiceWidth() + this.padding * 2;
- return Math.min(width, Graphics.boxWidth);
- };
- Galv.VNC.Window_ChoiceList_maxChoiceWidth = Window_ChoiceList.prototype.maxChoiceWidth;
- Window_ChoiceList.prototype.maxChoiceWidth = function() {
- if ($gameSystem.vnChoices) {
- return Galv.VNC.width;
- } else {
- return Galv.VNC.Window_ChoiceList_maxChoiceWidth.call(this);
- };
- };
- Galv.VNC.Window_Message_updateFloatChoiceWindow = Window_Message.prototype.updateFloatChoiceWindow;
- Window_Message.prototype.updateFloatChoiceWindow = function() {
- if ($gameSystem.vnChoices) {
- let targetY = Graphics.height - this._choiceListWindow.height;
- if (this.y + this.height > targetY) targetY = 0;
- this._choiceListWindow.y = targetY;
- return;
- };
- Galv.VNC.Window_Message_updateFloatChoiceWindow.call(this);
- };
复制代码
|
|