601 lines
17 KiB
JavaScript
601 lines
17 KiB
JavaScript
//=============================================================================
|
|
// RPG Maker MZ - Alternative Save Screen
|
|
//=============================================================================
|
|
|
|
/*:
|
|
* @target MZ
|
|
* @plugindesc Alternative save/load screen layout.
|
|
* @author Yoji Ojima
|
|
*
|
|
* @help AltSaveScreen.js
|
|
*
|
|
* This plugin changes the layout of the save/load screen.
|
|
* It puts the file list on the top and the details on the bottom.
|
|
*
|
|
* It does not provide plugin commands.
|
|
*/
|
|
|
|
/*:ja
|
|
* @target MZ
|
|
* @plugindesc セーブ/ロード画面のレイアウトを変更します。
|
|
* @author Yoji Ojima
|
|
*
|
|
* @help AltSaveScreen.js
|
|
*
|
|
* このプラグインは、セーブ/ロード画面のレイアウトを変更します。
|
|
* ファイル一覧を上側に、詳細を下側に配置します。
|
|
*
|
|
* プラグインコマンドはありません。
|
|
*
|
|
* 追記:サムライゲーム用に一部カスタマイズします。
|
|
*/
|
|
|
|
(() => {
|
|
const _Scene_File_create = Scene_File.prototype.create;
|
|
Scene_File.prototype.create = function () {
|
|
_Scene_File_create.apply(this, arguments);
|
|
this._listWindow.height = this._listWindow.fittingHeight(3);
|
|
const x = 0;
|
|
const y = this._listWindow.y + this._listWindow.height;
|
|
const width = Graphics.boxWidth;
|
|
const height = Graphics.boxHeight - y;
|
|
const rect = new Rectangle(x, y, width, height);
|
|
const statusWindow = new Window_SavefileStatus(rect);
|
|
this._listWindow.mzkp_statusWindow = statusWindow;
|
|
this.addWindow(statusWindow);
|
|
};
|
|
|
|
const _Scene_File_start = Scene_File.prototype.start;
|
|
Scene_File.prototype.start = function () {
|
|
_Scene_File_start.apply(this, arguments);
|
|
this._listWindow.ensureCursorVisible();
|
|
this._listWindow.callUpdateHelp();
|
|
};
|
|
|
|
// セーブファイル一覧ウインドウ
|
|
|
|
Window_SavefileList.prototype.windowWidth = function () {
|
|
return Graphics.boxWidth;
|
|
};
|
|
|
|
Window_SavefileList.prototype.maxCols = function () {
|
|
return 4;
|
|
};
|
|
|
|
Window_SavefileList.prototype.itemHeight = function () {
|
|
return this.lineHeight() * 3 + 28;
|
|
//return 8;
|
|
};
|
|
|
|
const _Window_SavefileList_callUpdateHelp =
|
|
Window_SavefileList.prototype.callUpdateHelp;
|
|
Window_SavefileList.prototype.callUpdateHelp = function () {
|
|
_Window_SavefileList_callUpdateHelp.apply(this, arguments);
|
|
if (this.active && this.mzkp_statusWindow) {
|
|
this.mzkp_statusWindow.setSavefileId(this.savefileId());
|
|
}
|
|
};
|
|
|
|
const _Window_SavefileList_prototype_drawItem =
|
|
Window_SavefileList.prototype.drawItem;
|
|
Window_SavefileList.prototype.drawItem = function (index) {
|
|
// 位置を微調整したいので処理を改変する。元の表示に戻したい場合はif(true)とすること。
|
|
if (false) {
|
|
_Window_SavefileList_prototype_drawItem.call(this, index);
|
|
return;
|
|
}
|
|
|
|
const savefileId = this.indexToSavefileId(index);
|
|
const info = DataManager.savefileInfo(savefileId);
|
|
const rect = this.itemRectWithPadding(index);
|
|
this.resetTextColor();
|
|
this.changePaintOpacity(this.isEnabled(savefileId));
|
|
|
|
// //リスト画像描画
|
|
this.drawSaveFrame(rect.x, rect.y + 4);
|
|
|
|
//セーブファイル番号
|
|
//フォントサイズの変更
|
|
const defaultFontSize = $gameSystem.mainFontSize();
|
|
this.contents.fontSize = defaultFontSize - 10;
|
|
this.drawTitle(savefileId, rect.x + 2, rect.y);
|
|
//フォントサイズリセット
|
|
this.contents.fontsize = defaultFontSize;
|
|
|
|
//セーブデータがあれば内容表示
|
|
if (info) {
|
|
this.drawContents(info, rect);
|
|
}
|
|
};
|
|
|
|
Window_SavefileList.prototype.drawSaveFrame = function (x, y) {
|
|
let bitmap = ImageManager.loadBitmap(
|
|
"img/pictures/SystemPic/",
|
|
"UI_savelist"
|
|
);
|
|
const pw = bitmap.width;
|
|
const ph = bitmap.height;
|
|
const sx = 0;
|
|
const sy = 0;
|
|
this.contents.blt(bitmap, sx, sy, pw, ph, x, y);
|
|
};
|
|
|
|
Window_SavefileList.prototype.drawClearChapter = function (x, y, chap) {
|
|
let bitmap = [
|
|
ImageManager.loadBitmap("img/pictures/SystemPic/", "UI_savec1"),
|
|
ImageManager.loadBitmap("img/pictures/SystemPic/", "UI_savec2"),
|
|
ImageManager.loadBitmap("img/pictures/SystemPic/", "UI_savec3"),
|
|
ImageManager.loadBitmap("img/pictures/SystemPic/", "UI_savec4"),
|
|
ImageManager.loadBitmap("img/pictures/SystemPic/", "UI_savec5"),
|
|
ImageManager.loadBitmap("img/pictures/SystemPic/", "UI_save_trial"),
|
|
];
|
|
const pw = bitmap[chap].width;
|
|
const ph = bitmap[chap].height;
|
|
const sx = 0;
|
|
const sy = 0;
|
|
const wy = 17;
|
|
this.contents.blt(bitmap[chap], sx, sy * (wy * chap), pw, ph, x, y);
|
|
};
|
|
|
|
const _Window_SavefileList_prototype_drawContents =
|
|
Window_SavefileList.prototype.drawContents;
|
|
Window_SavefileList.prototype.drawContents = function (info, rect) {
|
|
// 位置を微調整したいので処理を改変する。元の表示に戻したい場合はif(true)とすること。
|
|
if (false) {
|
|
_Window_SavefileList_prototype_drawContents.call(this, info, rect);
|
|
return;
|
|
}
|
|
|
|
const bottom = rect.y + rect.height;
|
|
const defaultFontSize = $gameSystem.mainFontSize();
|
|
const lineHeight = this.lineHeight();
|
|
|
|
// アクター画像
|
|
this.drawPartyCharacters(info, rect.x + rect.width * 0.78, bottom - 24);
|
|
|
|
// アクターレベル
|
|
let actorLevel = 1;
|
|
if (info.actorLevel && info.actorLevel > 0) {
|
|
actorLevel = info.actorLevel;
|
|
}
|
|
this.contents.fontSize = defaultFontSize - 5;
|
|
this.drawText(
|
|
TextManager.level + " " + actorLevel,
|
|
rect.x + 10,
|
|
bottom - lineHeight * 2.8,
|
|
rect.width
|
|
);
|
|
|
|
//クリアしたチャプター
|
|
let cwy = 17;
|
|
if (!info.ChapClear1) {
|
|
if (info.trialvar)
|
|
this.drawClearChapter(
|
|
rect.x + rect.width / 1.18,
|
|
rect.y + 5 + cwy * 0,
|
|
5
|
|
);
|
|
} else if (info.ChapClear1) {
|
|
if (info.ChapClear1)
|
|
this.drawClearChapter(rect.x + rect.width / 3, rect.y + 5 + cwy * 0, 0);
|
|
if (info.ChapClear2)
|
|
this.drawClearChapter(rect.x + rect.width / 3, rect.y + 5 + cwy * 1, 1);
|
|
if (info.ChapClear3)
|
|
this.drawClearChapter(rect.x + rect.width / 3, rect.y + 5 + cwy * 2, 2);
|
|
if (info.ChapClear4)
|
|
this.drawClearChapter(rect.x + rect.width / 2, rect.y + 5 + cwy * 0, 3);
|
|
if (info.ChapClear5)
|
|
this.drawClearChapter(rect.x + rect.width / 2, rect.y + 5 + cwy * 1, 4);
|
|
if (info.trialvar)
|
|
this.drawClearChapter(
|
|
rect.x + rect.width / 1.18,
|
|
rect.y + 5 + cwy * 0,
|
|
5
|
|
);
|
|
}
|
|
|
|
// 現在のプレイ中のチャプター
|
|
this.contents.fontSize = defaultFontSize - 8;
|
|
let list_chapX = rect.x;
|
|
let list_chapY = bottom - lineHeight * 2.1;
|
|
if (1 <= info.purpose && info.purpose <= 999) {
|
|
//this.drawText(IIITEXT[0], rect.x + 10, bottom - (lineHeight * 1.5), rect.width);
|
|
this.drawText(
|
|
$dataSystemTexts.SaveList_Chapter0,
|
|
list_chapX,
|
|
list_chapY,
|
|
rect.width
|
|
);
|
|
}
|
|
if (1000 <= info.purpose && info.purpose <= 1999) {
|
|
this.drawText(
|
|
$dataSystemTexts.SaveList_Chapter1,
|
|
list_chapX,
|
|
list_chapY,
|
|
rect.width
|
|
);
|
|
}
|
|
if (2000 <= info.purpose && info.purpose <= 2999) {
|
|
this.drawText(
|
|
$dataSystemTexts.SaveList_Chapter2,
|
|
list_chapX,
|
|
list_chapY,
|
|
rect.width
|
|
);
|
|
}
|
|
if (3000 <= info.purpose && info.purpose <= 3999) {
|
|
//chapter3 befor
|
|
this.drawText(
|
|
$dataSystemTexts.SaveList_Chapter3,
|
|
list_chapX,
|
|
list_chapY,
|
|
rect.width
|
|
);
|
|
}
|
|
if (4000 <= info.purpose && info.purpose <= 4999) {
|
|
//chapterEx1
|
|
this.drawText(
|
|
$dataSystemTexts.SaveList_ChapterEx,
|
|
list_chapX,
|
|
list_chapY,
|
|
rect.width
|
|
);
|
|
}
|
|
if (5000 <= info.purpose && info.purpose <= 6999) {
|
|
//chapter3 after
|
|
this.drawText(
|
|
$dataSystemTexts.SaveList_Chapter3,
|
|
list_chapX,
|
|
list_chapY,
|
|
rect.width
|
|
);
|
|
}
|
|
if (7000 <= info.purpose && info.purpose <= 9999) {
|
|
//chapterEx2
|
|
this.drawText(
|
|
$dataSystemTexts.SaveList_ChapterEx2,
|
|
list_chapX,
|
|
list_chapY,
|
|
rect.width
|
|
);
|
|
}
|
|
if (info.purpose >= 10000) {
|
|
this.drawText(
|
|
$dataSystemTexts.SaveList_ChapterSelect,
|
|
list_chapX,
|
|
list_chapY,
|
|
rect.width
|
|
);
|
|
}
|
|
this.contents.fontSize = defaultFontSize;
|
|
|
|
// プレイ時間
|
|
// this.contents.fontSize = defaultFontSize - 8;
|
|
// this.drawText("time", rect.x + 10, bottom - (lineHeight * 1.5), rect.width);
|
|
// this.drawPlaytime(info, rect.x - rect.width /2.2, bottom - (lineHeight * 1.5), rect.width);
|
|
|
|
// 鈴音アクター表示
|
|
if (!$dataPurpose) {
|
|
return;
|
|
}
|
|
const varVal = info.purpose; //$gameVariables.value(varId);
|
|
if (100 <= varVal && varVal <= 9999) {
|
|
if (100 <= varVal && varVal <= 1999) {
|
|
// 1章
|
|
this.drawCharacter(
|
|
"!$ActorC2_10",
|
|
2,
|
|
rect.x + rect.width * 0.93,
|
|
bottom - 24
|
|
);
|
|
}
|
|
|
|
if (2000 <= varVal && varVal <= 2999) {
|
|
// 2章
|
|
this.drawCharacter(
|
|
"!$ActorC2_10",
|
|
2,
|
|
rect.x + rect.width * 0.93,
|
|
bottom - 24
|
|
);
|
|
}
|
|
|
|
if (3000 <= varVal && varVal <= 3999) {
|
|
// 3章 前半
|
|
if (3200 <= varVal && varVal <= 3299) {
|
|
//鈴音一時操作時
|
|
return;
|
|
} else {
|
|
this.drawCharacter(
|
|
"!$ActorC2_10",
|
|
2,
|
|
rect.x + rect.width * 0.93,
|
|
bottom - 24
|
|
);
|
|
}
|
|
}
|
|
|
|
if (4000 <= varVal && varVal <= 4999) {
|
|
// 断章
|
|
if (4100 <= varVal && varVal <= 4200) {
|
|
this.drawCharacter(
|
|
"!$ActorC2_20",
|
|
2,
|
|
rect.x + rect.width * 0.93,
|
|
bottom - 24
|
|
);
|
|
}
|
|
}
|
|
|
|
if (5000 <= varVal && varVal <= 7000) {
|
|
// 3章 後半
|
|
if (5100 <= varVal && varVal <= 7000) {
|
|
this.drawCharacter(
|
|
"!$ActorC2_10",
|
|
2,
|
|
rect.x + rect.width * 0.93,
|
|
bottom - 24
|
|
);
|
|
}
|
|
}
|
|
|
|
if (7000 <= varVal && varVal <= 9999) {
|
|
// EX章
|
|
}
|
|
|
|
if (10000 <= varVal) {
|
|
// Chapter Select
|
|
this.drawCharacter(
|
|
"!$ActorC11_10",
|
|
2,
|
|
rect.x + rect.width * 0.93,
|
|
bottom - 24
|
|
);
|
|
//this.drawTextEx("\\I[225]", rect.x + rect.width*0.85, bottom - 60, rect.width);
|
|
}
|
|
}
|
|
|
|
// マップ名
|
|
this.contents.fontSize = defaultFontSize - 8;
|
|
this.drawText(
|
|
info.mapName,
|
|
rect.x + 8,
|
|
bottom - lineHeight * 1.5,
|
|
rect.width,
|
|
"left"
|
|
);
|
|
|
|
// セーブ時間
|
|
this.contents.fontSize = defaultFontSize - 8;
|
|
let sdate = [
|
|
info.timeYear,
|
|
info.timeMonth,
|
|
info.timeDate,
|
|
info.timeHours,
|
|
info.timeMinutes,
|
|
];
|
|
this.drawText(
|
|
$dataSystemTexts.SaveList_savetime +
|
|
sdate[0] +
|
|
"/" +
|
|
sdate[1] +
|
|
"/" +
|
|
sdate[2] +
|
|
" " +
|
|
sdate[3] +
|
|
":" +
|
|
sdate[4],
|
|
rect.x,
|
|
bottom - lineHeight * 0.85,
|
|
rect.width,
|
|
"right"
|
|
);
|
|
};
|
|
|
|
// セーブ画面下部のウインドウ
|
|
|
|
function Window_SavefileStatus() {
|
|
this.initialize.apply(this, arguments);
|
|
}
|
|
|
|
Window_SavefileStatus.prototype = Object.create(Window_Base.prototype);
|
|
Window_SavefileStatus.prototype.constructor = Window_SavefileStatus;
|
|
|
|
Window_SavefileStatus.prototype.initialize = function (rect) {
|
|
Window_Base.prototype.initialize.call(this, rect);
|
|
this._savefileId = 1;
|
|
};
|
|
|
|
Window_SavefileStatus.prototype.setSavefileId = function (id) {
|
|
this._savefileId = id;
|
|
this.refresh();
|
|
};
|
|
|
|
Window_SavefileStatus.prototype.refresh = function () {
|
|
const info = DataManager.savefileInfo(this._savefileId);
|
|
const rect = this.contents.rect;
|
|
this.contents.clear();
|
|
this.resetTextColor();
|
|
this.drawTitle(this._savefileId, rect.x + 160, rect.y);
|
|
if (info) {
|
|
this.drawContents(info, rect);
|
|
}
|
|
};
|
|
|
|
Window_SavefileStatus.prototype.drawTitle = function (savefileId, x, y) {
|
|
if (savefileId === 0) {
|
|
this.drawText(TextManager.autosave, x, y, 180);
|
|
} else {
|
|
this.drawText(TextManager.file + " " + savefileId, x, y, 180);
|
|
}
|
|
};
|
|
|
|
Window_SavefileStatus.prototype.drawContents = function (info, rect) {
|
|
var bottom = rect.y + rect.height;
|
|
var lh = this.lineHeight();
|
|
|
|
//III add
|
|
//infoの中身はIISaveInfoEx.jsにて編集
|
|
if (!$dataPurpose) {
|
|
return;
|
|
}
|
|
const varVal = info.purpose; //$gameVariables.value(varId);
|
|
let purposeText = "---";
|
|
let len = $dataPurpose.length;
|
|
for (let i = 0; i < len; i++) {
|
|
let data = $dataPurpose[i];
|
|
if (!data) {
|
|
continue;
|
|
}
|
|
if (data.val <= varVal) {
|
|
purposeText = data.purposeText;
|
|
} else {
|
|
break;
|
|
}
|
|
}
|
|
|
|
this.drawTextEx(
|
|
$dataSystemTexts.SaveList_purpose + purposeText,
|
|
rect.x + 150,
|
|
bottom - lh * 3,
|
|
rect.width - 192
|
|
);
|
|
this.drawTextEx(
|
|
$dataSystemTexts.SaveList_nowmap + info.mapName,
|
|
rect.x + 150,
|
|
bottom - lh * 2,
|
|
rect.width - 192
|
|
);
|
|
this.drawTextEx(
|
|
$dataSystemTexts.SaveList_playtime + info.playtime,
|
|
rect.x + 150,
|
|
bottom - lh * 1,
|
|
rect.width
|
|
);
|
|
this.drawTextEx(
|
|
"\\}" +
|
|
info.timeYear +
|
|
"/" +
|
|
info.timeMonth +
|
|
"/" +
|
|
info.timeDate +
|
|
" " +
|
|
info.timeHours +
|
|
":" +
|
|
info.timeMinutes,
|
|
rect.width - 170,
|
|
bottom - lh * 1,
|
|
rect.width
|
|
);
|
|
|
|
//this.drawPartyActor(info, rect.x + 30, bottom - 10);
|
|
this.drawPartyfaces(info, rect.x, bottom - 144);
|
|
|
|
//Hステータス
|
|
let wx = 90;
|
|
let ssx = (wx + 16) * 4 + 47;
|
|
this.drawTextEx(
|
|
"\\I[238]Lv" + info.Hlv,
|
|
rect.width - ssx + wx * 0,
|
|
bottom - lh * 2,
|
|
rect.width
|
|
);
|
|
this.drawTextEx(
|
|
"\\I[220]Lv" + info.HparamKuti,
|
|
rect.width - ssx + wx * 1,
|
|
bottom - lh * 2,
|
|
rect.width
|
|
);
|
|
this.drawTextEx(
|
|
"\\I[221]Lv" + info.HparamTitu,
|
|
rect.width - ssx + wx * 2,
|
|
bottom - lh * 2,
|
|
rect.width
|
|
);
|
|
this.drawTextEx(
|
|
"\\I[222]Lv" + info.HparamTiti,
|
|
rect.width - ssx + wx * 3,
|
|
bottom - lh * 2,
|
|
rect.width
|
|
);
|
|
this.drawTextEx(
|
|
"\\I[223]Lv" + info.HparamSiri,
|
|
rect.width - ssx + wx * 4,
|
|
bottom - lh * 2,
|
|
rect.width
|
|
);
|
|
};
|
|
|
|
Window_SavefileStatus.prototype.drawPartyfaces = function (info, x, y) {
|
|
if (info && info.faces) {
|
|
for (var i = 0; i < info.characters.length; i++) {
|
|
// var data = info.characters[i];
|
|
var dataf = info.faces[i];
|
|
this.drawFace(dataf[0], dataf[1], x + i * 150, y);
|
|
// this.drawCharacter2(data[0], data[1], x + 20 + i * 150, y);
|
|
break;
|
|
}
|
|
}
|
|
};
|
|
|
|
Window_SavefileStatus.prototype.drawPartyActor = function (info, x, y) {
|
|
if (info && info.faces) {
|
|
for (var i = 0; i < info.characters.length; i++) {
|
|
var data = info.characters[i];
|
|
this.drawCharacter2(data[0], data[1], x + 20 + i * 150, y);
|
|
break;
|
|
}
|
|
}
|
|
};
|
|
|
|
Window_SavefileStatus.prototype.drawCharacter2 = function (
|
|
characterName,
|
|
characterIndex,
|
|
x,
|
|
y
|
|
) {
|
|
var bitmap = ImageManager.loadCharacter(characterName);
|
|
var big = ImageManager.isBigCharacter(characterName);
|
|
var pw = bitmap.width / (big ? 3 : 12);
|
|
var ph = bitmap.height / (big ? 4 : 8);
|
|
var n = characterIndex;
|
|
if (big) n = 0;
|
|
var sx = ((n % 4) * 3 + 1) * pw;
|
|
var sy = Math.floor(n / 4) * 4 * ph;
|
|
this.contents.blt(bitmap, sx, sy, pw, ph, x - pw / 2, y - ph);
|
|
};
|
|
|
|
const _Window_SavefileStatus_prototype_resetFontSettings =
|
|
Window_SavefileStatus.prototype.resetFontSettings;
|
|
Window_SavefileStatus.prototype.resetFontSettings = function () {
|
|
_Window_SavefileStatus_prototype_resetFontSettings.call(this);
|
|
this.contents.fontFace = "menufont, " + $gameSystem.mainFontFace();
|
|
};
|
|
|
|
//最大セーブデータ数を上書き
|
|
DataManager.maxSavefiles = function () {
|
|
return 51;
|
|
};
|
|
|
|
//in
|
|
|
|
const _Window_Save_makeFontBigger = Window_Base.prototype.makeFontBigger;
|
|
Window_Base.prototype.makeFontBigger = function () {
|
|
if (this.contents.fontSize <= 96) {
|
|
this.contents.fontSize += 4;
|
|
} else {
|
|
_Window_Save_makeFontBigger.apply(this, arguments);
|
|
}
|
|
};
|
|
|
|
const _Window_Save_makeFontSmaller = Window_Base.prototype.makeFontSmaller;
|
|
Window_Base.prototype.makeFontSmaller = function () {
|
|
if (this.contents.fontSize >= 20) {
|
|
this.contents.fontSize -= 4;
|
|
} else {
|
|
_Window_Save_makeFontSmaller.apply(this, arguments);
|
|
}
|
|
};
|
|
|
|
//out
|
|
})();
|