バトル画面に新しくステータスウィンドウを作るのは危険でしょうか?
Posted: 2021年8月31日(火) 18:19
お世話になっております、皆様。
以前QTE関連の相談でプレイヤーの入力をリアルタイムに監視する代わりにボタンをクリックして入力を認識するように変更した結果フレームの改善に成功した者です。
数日前にとある方から気になる報告を受けまして、それは「私がバトル画面に追加したウィンドウがフレームに相当な負担をかけている」ということでした。
なので皆様に一度私のコードを見てくださればと思いこのように質問を申し上げることになりました。
このようなものを作りました。コードは以下となります。
Teki_InfoはPlayer_Infoと同じ構造となります。
setTextを使ったのは、drawItemでは何故かウィンドウの中身がまともに出力できなかったのが理由です。
textcolorの負担が大きいとのことがありましたので主人公の名前やレベルなどはイメージに変更することを考えています。
問題なのはrefreshの処理でしょうか?それともtextcolorの無駄遣いでしょうか?
この未熟者が何を間違っているのかを教えてくださればと思う所存です。皆様のご指導をお待ちしております。何卒よろしくお願いいたします。
以前QTE関連の相談でプレイヤーの入力をリアルタイムに監視する代わりにボタンをクリックして入力を認識するように変更した結果フレームの改善に成功した者です。
数日前にとある方から気になる報告を受けまして、それは「私がバトル画面に追加したウィンドウがフレームに相当な負担をかけている」ということでした。
なので皆様に一度私のコードを見てくださればと思いこのように質問を申し上げることになりました。
このようなものを作りました。コードは以下となります。
コード: 全て選択
(function() {
var _Scene_Battle_create = Scene_Battle.prototype.create;
Scene_Battle.prototype.create = function() {
_Scene_Battle_create.call(this);
this.createPlayerWindow();
this.createTekiWindow();
};
Scene_Battle.prototype.createPlayerWindow = function() {
this._PlayerWindow = new Player_Info();
this.addWindow(this._PlayerWindow);
};
Scene_Battle.prototype.createTekiWindow = function() {
this._TekiWindow = new Teki_Info();
this.addWindow(this._TekiWindow);
};
var _Scene_Battle_update = Scene_Battle.prototype.update;
Scene_Battle.prototype.update = function() {
_Scene_Battle_update.call(this);
this._PlayerWindow.setText();
this._TekiWindow.setText();
};
//drawGauge省略
function Player_Info() {
this.initialize.apply(this, arguments);
}
Player_Info.prototype = Object.create(Window_Base.prototype);
Player_Info.prototype.constructor = Player_Info;
Player_Info.prototype.initialize = function() {
var x = 1080;
var y = 361;
var width = 200;
var height = 360;
Window_Base.prototype.initialize.call(this, x, y, width, height);
};
Player_Info.prototype.setText = function(str) {
this._text = str;
this.refresh();
};
Player_Info.prototype.refresh = function() {
this.contents.clear();
this.changeTextColor(this.systemColor());
this.drawText($gameActors.actor(1)._name,5,0);
this.resetTextColor();
this.changeTextColor(this.textColor(4));
this.drawText("Lv",120,25);
this.resetTextColor();
this.drawText($gameActors.actor(1).level,145,25);
this.drawActorHp($gameActors.actor(1),5,50,160);
this.drawActorTp($gameActors.actor(1),5,85,160);
this.changeTextColor(this.textColor(23));
this.drawText("攻撃力",5,140);
this.drawText("魔法力",5,170);
this.drawText("敏捷性",5,200);
this.drawText("運",5,230);
this.resetTextColor();
this.drawText($gameActors.actor(1).param(2),105,140);
this.drawText($gameActors.actor(1).param(4),105,170);
this.drawText($gameActors.actor(1).param(6),105,200);
this.drawText($gameActors.actor(1).param(7),105,230);
};
// fontsize, backopacity, padding 省略
Teki_InfoはPlayer_Infoと同じ構造となります。
setTextを使ったのは、drawItemでは何故かウィンドウの中身がまともに出力できなかったのが理由です。
textcolorの負担が大きいとのことがありましたので主人公の名前やレベルなどはイメージに変更することを考えています。
問題なのはrefreshの処理でしょうか?それともtextcolorの無駄遣いでしょうか?
この未熟者が何を間違っているのかを教えてくださればと思う所存です。皆様のご指導をお待ちしております。何卒よろしくお願いいたします。