Yo Fellow Makers!
Spent a couple hours on this conundrum. I am reworking the layout of YEP_PartySystem plugin and I am stuck trying to get the party selection command window to show vertically.
I was able to get the action working correctly as one column, but it appears as though the actor items are stacked on each other in the top position. The default behavior is horizontal.
I cannot figure out how to get the actor items to reposition to show as a vertical menu.
Full plugin and stock layout example:
Revised Layout:
Here is the section of the code for the window in question.
Link to demo:
https://1drv.ms/u/s!AsBkv_fm2U8JguRSS_tAqieI2FFvVQ?e=F2orlb
Any ideas?
Spent a couple hours on this conundrum. I am reworking the layout of YEP_PartySystem plugin and I am stuck trying to get the party selection command window to show vertically.
I was able to get the action working correctly as one column, but it appears as though the actor items are stacked on each other in the top position. The default behavior is horizontal.
I cannot figure out how to get the actor items to reposition to show as a vertical menu.
Full plugin and stock layout example:
Revised Layout:
Here is the section of the code for the window in question.
Code:
//=============================================================================
// Window_PartySelect
//=============================================================================
function Window_PartySelect() {
this.initialize.apply(this, arguments);
}
Window_PartySelect.prototype = Object.create(Window_Selectable.prototype);
Window_PartySelect.prototype.constructor = Window_PartySelect;
Window_PartySelect.prototype.initialize = function(commandWindow) {
var wx = commandWindow.width;
var wy = commandWindow.y;
var ww = 370; //Default = Graphics.boxWidth - commandWindow.width;
var wh = 576; //Default = commandWindow.height;
Window_Selectable.prototype.initialize.call(this, wx, wy, ww, wh);
this.select(-1);
this.deactivate();
this.refresh();
};
Window_PartySelect.prototype.maxCols = function() {
return 1; //Default = $gameParty.maxBattleMembers();
};
Window_PartySelect.prototype.numVisibleRows = function() {
return 3;
}
Window_PartySelect.prototype.maxItems = function() {
return $gameParty.maxBattleMembers();
};
Window_PartySelect.prototype.itemRect = function(index) {
var rect = new Rectangle();
rect.width = this.contents.width; //Default = / this.maxItems();
rect.height = this.contents.height /3;
rect.x = index * rect.width;
rect.y = 0;
return rect;
};
Window_PartySelect.prototype.refresh = function() {
this.makeItemList();
this.createContents();
this.drawAllItems();
};
Window_PartySelect.prototype.makeItemList = function() {
this._data = $gameParty._battleMembers.slice(0);
};
Window_PartySelect.prototype.drawItem = function(index) {
var actor = $gameActors.actor(this._data[index]);
var rect = this.itemRect(index);
rect.x += this.textPadding() / 2;
rect.y += this.textPadding() / 2;
rect.width -= this.textPadding();
rect.height -= this.textPadding();
if (actor) {
this.drawActor(rect, actor);
} else {
this.drawEmpty(rect);
}
};
Window_PartySelect.prototype.drawEmpty = function(rect) {
var color = this.gaugeBackColor();
this.changePaintOpacity(false);
this.contents.fillRect(rect.x, rect.y, rect.width, rect.height, color);
this.changePaintOpacity(true);
this.resetFontSettings();
var text = Yanfly.Param.PartyEmptyText
this.contents.drawText(text, rect.x, rect.y, rect.width,
rect.height, 'center');
};
Window_PartySelect.prototype.drawActor = function(rect, actor) {
if (Yanfly.Param.PartyShowFace) {
this.drawActorFace(actor, rect.x, rect.y, rect.width, rect.height);
}
if (Yanfly.Param.PartyShowCharacter) {
var ry = rect.height * 19/20;
this.drawActorCharacter(actor, (rect.x + rect.width / 2) -125, ry -40);
}
this.drawActorName(actor, rect.x +7, rect.y, rect.width);
this.drawLockedIcon(actor, rect);
this.drawRequiredIcon(actor, rect);
};
Window_PartySelect.prototype.drawLockedIcon = function(actor, rect) {
if (!actor._locked) return;
var ix = rect.x + rect.width - Window_Base._iconWidth - 2;
var iy = rect.y + rect.height - Window_Base._iconHeight - 2;
this.drawIcon(Yanfly.Icon.PartyLocked, ix, iy)
};
Window_PartySelect.prototype.drawRequiredIcon = function(actor, rect) {
if (!actor._required) return;
var ix = rect.x + 2;
var iy = rect.y + rect.height - Window_Base._iconHeight - 2;
this.drawIcon(Yanfly.Icon.PartyRequired, ix, iy)
};
Window_PartySelect.prototype.curActor = function() {
if (!this._data) return null;
var actorId = this._data[this._index];
return $gameActors.actor(actorId);
};
Window_PartySelect.prototype.prevActor = function() {
var id = this._index === 0 ? this._data.length - 1 : this._index - 1;
var actorId = this._data[id];
return $gameActors.actor(actorId);
};
Window_PartySelect.prototype.nextActor = function() {
var id = this._index === this._data.length - 1 ? 0 : this._index + 1;
var actorId = this._data[id];
return $gameActors.actor(actorId);
};
Window_PartySelect.prototype.processActor = function(value) {
return true;
};
Window_PartySelect.prototype.isCurrentItemEnabled = function() {
if (this.curActor()) return this.curActor().isFormationChangeOk();
return true;
};
Window_PartySelect.prototype.processPageup = function() {
if (this.curActor() && this.curActor()._locked) {
this.playBuzzerSound();
} else if (this.prevActor() && this.prevActor()._locked) {
this.playBuzzerSound();
} else if (this.processActor('prevActor')) {
Window_Selectable.prototype.processPageup.call(this);
this.activate();
this.select(this._index === 0 ? this._data.length - 1 : this._index - 1)
} else {
this.playBuzzerSound();
}
};
Window_PartySelect.prototype.processPagedown = function() {
if (this.curActor() && this.curActor()._locked) {
this.playBuzzerSound();
} else if (this.nextActor() && this.nextActor()._locked) {
this.playBuzzerSound();
} else if (this.processActor('nextActor')) {
Window_Selectable.prototype.processPagedown.call(this);
this.activate();
this.select(this._index === this._data.length - 1 ? 0 : this._index + 1)
} else {
this.playBuzzerSound();
}
};
Window_PartySelect.prototype.setDetailWindow = function(win) {
this._detailWindow = win;
this.callUpdateHelp();
};
Window_PartySelect.prototype.callUpdateHelp = function() {
this.setHelpWindowItem(this.curActor());
this.setDetailWindowItem(this.curActor());
};
Window_PartySelect.prototype.setHelpWindowItem = function(actor) {
if (this._helpWindow && actor) {
this._helpWindow.setText(actor.profile());
} else if (this._helpWindow) {
this._helpWindow.clear();
}
};
Window_PartySelect.prototype.setDetailWindowItem = function(actor) {
if (this._detailWindow) this._detailWindow.setActor(actor);
};
Window_PartySelect.prototype.item = function() {
var index = this.index();
return this._data && index >= 0 ? this._data[index] : null;
};
Link to demo:
https://1drv.ms/u/s!AsBkv_fm2U8JguRSS_tAqieI2FFvVQ?e=F2orlb
Any ideas?