do-disciplinary-committee-m.../www/js/plugins/InfoWindow.js
2025-05-04 14:43:03 -05:00

246 lines
No EOL
7.7 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//=============================================================================
// InfoWindow.js
//=============================================================================
/*:
* @plugindesc 情報表示ウィンドウをメニュー画面に追加するプラグイン
* @author Me
*
* @help 情報表示ウィンドウをメニュー画面上に追加します。
*
* 2020.12.27 suzu 表示ウィンドウの表示/非表示切り替え機能の追加
*
* @param display switch
* @desc 情報表示ウィンドウの表示/非表示を切り替えるスイッチNo
* @default 0
* @type number
*
*/
(function() {
var parameters = PluginManager.parameters('InfoWindow');
var displaySwitchNo = Number(parameters['display switch'] || 0);
var gaugeBitmap = ImageManager.loadSystem('Gauge');
var gaugeWidth = gaugeBitmap.width;
var gaugeHeight = gaugeBitmap.height;
// マップ上にウィンドウ表示するよ宣言
var Scene_map_start = Scene_Map.prototype.start;
Scene_Map.prototype.start = function() {
Scene_map_start.call(this);
this._InfoWindow = new Window_Info();
this.addWindow(this._InfoWindow);
};
var _Scene_Map_update = Scene_Map.prototype.update;
Scene_Map.prototype.update = function() {
_Scene_Map_update.call(this);
this._InfoWindow.setText();
};
Window_Base.prototype.drawHypnoGauge = function(x, y, width, rate, color1, color2) {
x -=256;
this.contents.blt(gaugeBitmap, 0, 0, gaugeWidth, gaugeHeight, x, y);
var fillW = Math.floor((width - 2) * rate);
var fillH = gaugeHeight - 4;
var gaugeFillRect = new Rectangle(2, 2, fillW, fillH);
this.contents.fillRect(gaugeFillRect.x + x, gaugeFillRect.y + y, Math.floor(width - 2), gaugeFillRect.height);
this.contents.clearRect(gaugeFillRect.x + x+1, gaugeFillRect.y + y-1, Math.floor(width - 4), gaugeFillRect.height+1);
this.contents.fillRect(gaugeFillRect.x + x + 1, gaugeFillRect.y + y - 1, Math.floor(width - 4), gaugeFillRect.height, 'rgba(0, 0, 0, 0.5)');
// ゲージの色
this.contents.gradientFillRect(gaugeFillRect.x + x + 1, gaugeFillRect.y + y - 1, Math.floor((width - 4) * rate), gaugeFillRect.height, color1, color2);
// ゲージのふち
}
;
// ここからメニューウィンドウ作り始まります。
function Window_Info() {
this.initialize.apply(this, arguments);
}
Window_Info.prototype = Object.create(Window_Base.prototype);
Window_Info.prototype.constructor = Window_Info;
Window_Info.prototype.initialize = function() {
var x = -40;
var y = -18;
var width = 1064;
var height = 95;
if($gameVariables.value(8)>=1){
Window_Base.prototype.initialize.call(this, x, y, width, height);
}else{
Window_Base.prototype.initialize.call(this, x+1024, y, width, height);
}
/**
* 2020.12.27 suzu 非表示切り替え機能の追加
*/
if(!!$gameSwitches.value(displaySwitchNo)){
this.opacity = 0;
this.contentsOpacity = 0;
}
};
Window_Info.prototype.setText = function(str) {
this._text = str;
this.refresh();
};
// ウィンドウに載せる内容
Window_Info.prototype.refresh = function() {
this.contents.clear();
//日付情報計算部
switch($gameVariables.value(2)){
case 0:
var time1 = "\\I[1017]";
var time2 = "\\fs[11] Morning ";
break;
case 1:
var time1 = "\\I[1018]";
var time2 = "\\fs[11]Afternoon";
break;
case 2:
var time1 = "\\I[1019]";
var time2 = "\\fs[11] Evening ";
break;
case 3:
var time1 = "\\I[1020]";
var time2 = "\\fs[11] Night ";
break;
case 4:
var time1 = "\\I[1020]";
var time2 = "\\fs[11]Mid Night";
break;
case 5:
var time1 = "\\I[1020]";
var time2 = "\\fs[11] Dream ";
break;
default:
var time1 = "\\I[1020]";
var time2 = "\\fs[11] ????? ";
break;
}
if(!$gameSwitches.value(15)){
var color = 16;
}else{
var color = 21;
}
var day = " " + $gameVariables.value(4);
var day_info = "\\fs[28]" + day.slice(-3) +`\\fs[22]\\C[${color}]\\C[0]` + $gameVariables.value(3)[$gameVariables.value(4)%7] + `\\C[${color}]`
//学内風紀計算部
var school_value = " " +$gameVariables.value(149);
var school_info = school_value.slice(-3) + `\\C[${color}]/\\C[0]100`;
//所有SP計算部
var sp_value = "00000000" +$gameVariables.value(142);
var sp_info = sp_value.slice(-8)+ ` \\C[${color}]pt\\C[0]`;
//リリィのHP計算部
var lily_hp = " " + $gameVariables.value(122)
var lily_maxhp = $gameVariables.value(123) + " ";
var lilyinfo = lily_hp.slice(-4) + `\\C[${color}]/\\C[0]` + lily_maxhp.slice(0,4);
//彩羽のHP計算部
var Iroha_hp = " " + $gameActors.actor(1).hp;
var Iroha_maxhp = $gameActors.actor(1).param(0) + " ";
var Irohainfo = Iroha_hp.slice(-4) + `\\C[${color}]/\\C[0]` + Iroha_maxhp.slice(0,4);
//催眠抵抗値計算部
var hypno_value = " " + $gameVariables.value(262)
if(hypno_value==100){
var hypno_info = hypno_value.slice(-3) + `\\C[${color}]/\\C[0]100`;
}else if(hypno_value<10){
var hypno_info = " " + hypno_value.slice(-3) + "\\C[0]" + `\\C[${color}]/\\C[0]100`;
}else{
var hypno_info = " " + hypno_value.slice(-3) + "\\C[0]" + `\\C[${color}]/\\C[0]100`;
}
//佐井の魔力計算部
var sai_value = " " + $gameVariables.value(346)
if(sai_value==100){
var sai_info = sai_value.slice(-3) + `\\C[${color}] %\\C[0]`;
}else if(hypno_value<10){
var sai_info = " " + sai_value.slice(-3) + "\\C[0]" + `\\C[${color}] %\\C[0]`;
}else{
var sai_info = " " + sai_value.slice(-3) + "\\C[0]" + `\\C[${color}] %\\C[0]`;
}
//行動力計算部
var stamina_now = " " + $gameVariables.value(160);
var stamina_max = $gameVariables.value(161) + " ";
var stamina = stamina_now.slice(-3) + `\\C[${color}]/\\C[0]` + stamina_max.slice(0,3);
this.drawTextEx(time1,32,1);
this.drawTextEx(time2,26,15);
this.drawTextEx(day_info,140,2);
if(!$gameSwitches.value(15)){
if($gameSwitches.value(257)){
this.drawHypnoGauge(570, 29, 210, $gameVariables.value(346)/100, "#4A35E4","#FF57FF" );
if($gameVariables.value(346) < 10){
this.drawTextEx(sai_info,470, 0);
}else{
this.drawTextEx(sai_info,462, 0);
}
}else if(!$gameSwitches.value(253)){
this.drawTextEx(school_info,410, 0);
}else{
if($gameVariables.value(24)>=30){
this.drawHypnoGauge(570, 29, 210, $gameVariables.value(262)/100, "#4A35E4","#FF57FF" );
this.drawTextEx(hypno_info,434, 0);
}
}
}else{
this.drawTextEx(sp_info,396, 0);
}
if(!$gameSwitches.value(15)){
if(!$gameSwitches.value(4)){
this.drawTextEx(Irohainfo,700 + (7 - Iroha_hp.length)*6, 0);
}else{
this.drawTextEx(lilyinfo,700, 0);
}
}else{
this.drawTextEx(Irohainfo,700 + (7 - Iroha_hp.length)*6, 0);
}
this.drawTextEx(stamina,930, 0);
this.resetTextColor();
};
// フォントサイズ
Window_Info.prototype.standardFontSize = function() {
return 20;
};
// ウィンドウの透明度
Window_Info.prototype.standardBackOpacity = function() {
return 200;
};
// ウィンドウの余白
Window_Info.prototype.standardPadding = function() {
return 18;
};
/**
* 2020.12.27 suzu 非表示切り替え機能の追加
*/
var _Window_Info_update = Window_Info.prototype.update;
Window_Info.prototype.update = function(){
_Window_Info_update.call(this);
if(displaySwitchNo <= 0){
return;
}
if(!!$gameSwitches.value(displaySwitchNo) && this.isOpen() && !this.isOpening()){
this.close();
}
else if(!$gameSwitches.value(displaySwitchNo) && this.isClosed() && !this.isClosing()){
this.open();
this.opacity = 255;
this.contentsOpacity = 255;
}
}
})();