dead-bunny/js/plugins/Nore_AvCharList.js
2025-01-12 01:21:39 -06:00

486 lines
14 KiB
JavaScript

var __extends =
(this && this.__extends) ||
(function () {
var extendStatics = function (d, b) {
extendStatics =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (d, b) {
d.__proto__ = b;
}) ||
function (d, b) {
for (var p in b)
if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
};
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError(
"Class extends value " + String(b) + " is not a constructor or null"
);
extendStatics(d, b);
function __() {
this.constructor = d;
}
d.prototype =
b === null
? Object.create(b)
: ((__.prototype = b.prototype), new __());
};
})();
var REFRESH_ACTOR_LIST_SW = 258;
var Window_AvCharList = /** @class */ (function (_super) {
__extends(Window_AvCharList, _super);
function Window_AvCharList() {
var _this = this;
var r = new Rectangle(0, 44, 293, 756);
_this = _super.call(this, r) || this;
_this.backOpacity = 255;
_this.frameVisible = false;
_this._margin = 0;
_this.padding = 0;
_this.createContents();
_this.refreshAll();
return _this;
}
Window_AvCharList.prototype.refreshAll = function () {
this._windowContentsSprite.removeChildren();
this._douseiSpriteList = [];
this._faceSpriteList = [];
this.makeItems();
this.refresh();
this.createActorFaceSprites();
this.createBorder();
$gameTemp.douseiMapChanged = false;
this.refreshTutoArrow();
};
Window_AvCharList.prototype.refreshTutoArrow = function () {
if (this._tutoArrow) {
this.removeChild(this._tutoArrow);
this._tutoArrow = null;
}
if ($gameTutorial.nextTarget() == TextManager.target_2_8) {
if (ConfigManager.simpleMenu) {
this.drawArrow(305, 158);
} else {
this.drawArrow(214, 154);
}
}
};
Window_AvCharList.prototype.drawArrow = function (x, y) {
var baseTexture2 = Nore.getSystemBaseTexture("0213_sys");
var texture = new PIXI.Texture(baseTexture2);
var sprite = new PIXI.Sprite(texture);
sprite.x = x;
sprite.y = y;
sprite.rotation = (90 / 180) * Math.PI;
this._tutoArrow = sprite;
this.addChild(sprite);
};
Window_AvCharList.prototype.createBorder = function () {
var g = new PIXI.Graphics();
g.beginFill(0x4d38d1, 1);
var hh = 756;
g.drawRect(0, 0, 1, hh);
g.endFill();
g.x = 292;
this._windowContentsSprite.addChild(g);
};
Window_AvCharList.prototype.createActorFaceSprites = function () {
for (var i = 0; i < this._data.length; i++) {
var actor = this._data[i];
if (!actor) {
return;
}
this.createActorFaceSprite(actor, i);
}
};
Window_AvCharList.prototype.createActorFaceSprite = function (actor, index) {
var rect = this.itemRect(index);
var s = new Sprite_SlgActorFace(actor);
s.y = rect.y - 50;
s.x = -80;
this._windowContentsSprite.addChild(s);
s.refresh();
this._faceSpriteList.push(s);
};
Window_AvCharList.prototype.update = function () {
_super.prototype.update.call(this);
if (
this.isStageChanged() ||
this.douseiMapChanged() ||
$gameSwitches.value(REFRESH_ACTOR_LIST_SW)
) {
this.refreshAll();
}
this.updateFaceVisible();
this.updateVisible();
this.updateOpacity();
this.updateAvButtonEnabled();
};
Window_AvCharList.prototype.updateAvButtonEnabled = function () {
if (!this._avButtonList) {
return;
}
for (var i = 0; i < this._data.length; i++) {
var actor = this._data[i];
var button = this._avButtonList[actor.actorId()];
if (!button) {
continue;
}
if (actor.hpRate() == 1) {
button.enable();
}
}
};
Window_AvCharList.prototype.itemWidth = function () {
return 292;
};
Window_AvCharList.prototype.douseiMapChanged = function () {
return $gameTemp.douseiMapChanged;
};
Window_AvCharList.prototype.updateOpacity = function () {
if (!$gameSwitches.value(53)) {
this.alpha = 1;
return;
}
if ($gameScreen.picture(1)) {
this.alpha = 1 - $gameScreen.picture(1).opacity() / 255;
} else {
this.alpha = 1;
}
};
Window_AvCharList.prototype.updateVisible = function () {
if ($gameSystem.isRecollection()) {
this.visible = false;
return;
}
if ($gameSwitches.value(42)) {
this.visible = false;
} else {
this.visible = true;
}
$gameSwitches.setValue(43, this.visible);
};
Window_AvCharList.prototype.updateFaceVisible = function () {
for (var i = 0; i < this._data.length; i++) {
var actor = this._data[i];
var f = this._faceSpriteList[i];
if (!f) {
return;
}
if (!actor) {
f.visible = false;
continue;
}
if (actor.dousei().isEnabled() && actor.dousei().manId() > 0) {
f.visible = false;
} else {
f.visible = true;
}
}
};
Window_AvCharList.prototype.isStageChanged = function () {
return this._lastStage != $slg.stage();
};
Window_AvCharList.prototype.refresh = function () {
this._avButtonList = [];
$gameSwitches.setValue(REFRESH_ACTOR_LIST_SW, false);
this._windowContentsSprite.removeChildren();
this._windowContentsSprite.x = 0;
this._windowContentsSprite.y = 0;
_super.prototype.refresh.call(this);
};
Window_AvCharList.prototype.maxItems = function () {
if (!this._data) {
return 0;
}
return 7;
};
Window_AvCharList.prototype.maxCols = function () {
return 1;
};
Window_AvCharList.prototype.itemHeight = function () {
return 108;
};
Window_AvCharList.prototype.makeItems = function () {
this._lastStage = $slg.stage();
this._data = [];
var idList = $gameParty.getActorIdList();
for (var _i = 0, idList_1 = idList; _i < idList_1.length; _i++) {
var id = idList_1[_i];
this._data.push($gameActors.actor(id));
}
};
Window_AvCharList.prototype.drawItemBackground = function (index) {
var rect = this.itemRect(index);
var dark = new PIXI.Graphics();
dark.beginFill(0x161420, 1);
var hh = 756 / 7;
dark.drawRect(0, 0, this.itemWidth(), hh);
dark.x = 0;
dark.y = rect.y + 0;
dark.endFill();
this._windowContentsSprite.addChild(dark);
var actor = this._data[index];
if (!actor) {
return;
}
var baseTexture = Nore.getSystemBaseTexture("main");
{
var r = new Rectangle(0, 210, 290, 103);
if ($gameTemp.isIdleMode()) {
r.y += 190;
}
var texture = new PIXI.Texture(baseTexture, r);
var s = new PIXI.Sprite(texture);
s.y = rect.y + 0;
this._windowContentsSprite.addChild(s);
}
};
Window_AvCharList.prototype.drawItem = function (index) {
var actor = this._data[index];
if (!actor) {
return;
}
var rect = this.itemRect(index);
this.createButtons(actor.actorId(), rect);
this.createDouseiSprite(actor.actorId(), rect);
this.createHpGauge(actor.actorId(), rect);
this.createNinshinInfo(actor.actorId(), rect);
this.createDouseiIdle(actor.actorId(), rect);
};
Window_AvCharList.prototype.createDouseiSprite = function (actorId, rect) {
var dousei = $gameActors.actor(actorId).dousei();
if (!dousei.isEnabled()) {
return;
}
var s = new Sprite_Dousei(dousei, rect.y - 18);
s.x = 0;
this._windowContentsSprite.addChild(s);
this._douseiSpriteList.push(s);
};
Window_AvCharList.prototype.createHpGauge = function (actorId, rect) {
if ($gameTemp.isIdleMode()) {
return;
}
var actor = $gameActors.actor(actorId);
var gauge = new Nore.Sprite_ActorHp(actor);
gauge.x = rect.x + 152;
gauge.y = rect.y + 55;
this._windowContentsSprite.addChild(gauge);
};
Window_AvCharList.prototype.createNinshinInfo = function (actorId, rect) {
var actor = $gameActors.actor(actorId);
var infoSprite = new Nore.Sprite_ActorNinshinInfo(actor);
infoSprite.x = rect.x - 5;
infoSprite.y = rect.y + 81;
this._windowContentsSprite.addChild(infoSprite);
};
Window_AvCharList.prototype.createButtons = function (actorId, rect) {
var actor = $gameActors.actor(actorId);
if ($gameTemp.isIdleMode()) {
if (actor.dousei().isEnabled()) {
var button2 = new Sprite_OverableButton("down2");
button2.x = rect.x + 239;
button2.y = rect.y + 9;
this._windowContentsSprite.addChild(button2);
button2.setClickHandler(this.onDousei.bind(this, actorId));
}
return;
}
var button = new Sprite_OverableButton("down");
var left = rect.x + 239;
var yy = rect.y + 1;
var interval = 47;
button.x = left;
button.y = yy;
this._windowContentsSprite.addChild(button);
button.setClickHandler(this.onStatus.bind(this, actorId));
var button3 = new Sprite_OverableButton("av", false, actor.hpRate() < 1);
button3.x = left - interval;
button3.y = yy;
this._windowContentsSprite.addChild(button3);
button3.setClickHandler(this.onRecord.bind(this, actorId));
this._avButtonList[actorId] = button3;
if (actor.dousei().isEnabled()) {
var button2 = new Sprite_OverableButton("down2");
button2.x = left - interval * 2;
button2.y = yy;
this._windowContentsSprite.addChild(button2);
button2.setClickHandler(this.onDousei.bind(this, actorId));
}
};
Window_AvCharList.prototype.createDouseiIdle = function (actorId, rect) {
if (!$gameTemp.isIdleMode()) {
return;
}
var s = new Sprite_DouseiIdle(actorId);
s.x = 140;
s.y = rect.y;
this._windowContentsSprite.addChild(s);
};
Window_AvCharList.prototype.onStatus = function (actorId) {
if ($gameMap.isEventRunning()) {
return;
}
SoundManager.playOk();
$gameParty.setMenuActorId(actorId);
$gameTemp.lastSelectedEroStatusIndex = -1;
SceneManager.push(Nore.Scene_EroStatus);
};
Window_AvCharList.prototype.onRecord = function (actorId) {
if ($gameMap.isEventRunning()) {
return;
}
SoundManager.playOk();
var actor = $gameActors.actor(actorId);
if (actor.dousei().isDouseiNinshin()) {
$gameParty.addCommonEvent(498, -1);
return;
}
if ($slg.hasLastSaleTimeGaugeEvent(actorId)) {
$gameParty.addCommonEvent(491, -1);
return;
}
$gameParty.setMenuActorId(actorId);
SceneManager.push(Scene_AvTree);
};
Window_AvCharList.prototype.onDousei = function (actorId) {
if ($gameMap.isEventRunning()) {
return;
}
SoundManager.playOk();
var actor = $gameActors.actor(actorId);
$gameParty.setMenuActorId(actorId);
if (actor.dousei().isTaikenbanNg()) {
$gameParty.addCommonEvent(492, -1);
return;
}
if (actor.dousei().isDouseiNinshin()) {
$gameParty.addCommonEvent(496, -1);
return;
}
SceneManager.push(Nore.Scene_Dousei);
};
return Window_AvCharList;
})(Window_Selectable);
Game_Interpreter.prototype.getPosX = function (posId) {
switch (posId) {
case Nore.Tachie.LEFT_POS:
if ($gameSwitches.value(43)) {
return Nore.Tachie.LEFT_POS_X + 220;
} else {
return Nore.Tachie.LEFT_POS_X;
}
case Nore.Tachie.RIGHT_POS:
if ($gameSwitches.value(43)) {
return Nore.Tachie.RIGHT_POS_X + 50;
} else {
return Nore.Tachie.RIGHT_POS_X;
}
case Nore.Tachie.CENTER_POS:
if ($gameSwitches.value(43)) {
return Nore.Tachie.CENTER_POS_X + 120;
} else {
return Nore.Tachie.CENTER_POS_X;
}
case Nore.Tachie.CENTER2_POS:
return Nore.Tachie.CENTER_POS_X - 120;
case Nore.Tachie.CENTER3_POS:
if ($gameSwitches.value(43)) {
return Nore.Tachie.CENTER_POS_X - 60;
} else {
return Nore.Tachie.CENTER_POS_X - 110;
}
default:
console.error("posId が不正です:" + posId);
}
};
var Sprite_SlgActorFace = /** @class */ (function (_super) {
__extends(Sprite_SlgActorFace, _super);
function Sprite_SlgActorFace(actor) {
var _this = _super.call(this) || this;
_this._actor = actor;
return _this;
}
Sprite_SlgActorFace.prototype.refresh = function () {
this.removeChildren();
var rect = new Rectangle(0, 52, 220, 92);
var actor = JsonEx.makeDeepCopy(this._actor);
var acceHoppe = actor.getAcceHoppeId();
actor.setHoppeId(acceHoppe);
actor.setDefaultHoppeId(acceHoppe);
this.drawTachieActor(
actor,
this,
this.posX(),
this.posY() - 160,
rect,
actor.getDefaultFaceId(),
0.5
);
};
Sprite_SlgActorFace.prototype.faceId = function () {
var actorId = this._actor.actorId();
switch (actorId) {
case 8:
return 1;
case 10:
return 1;
case 11:
return 2;
case 17:
return this.faceId17();
}
return 4;
};
Sprite_SlgActorFace.prototype.faceId17 = function () {
var avCount = $slg.avInfo().actorAvCount(this._actor.actorId());
switch (avCount) {
case 0:
return 8;
case 1:
return 13;
}
return 4;
};
Sprite_SlgActorFace.prototype.posX = function () {
switch (this._actor.actorId()) {
case 4:
return 15;
case 8:
return 25;
case 9:
return 10;
case 10:
return -10;
case 11:
return 10;
case 13:
return 15;
case 17:
return 15;
}
return 0;
};
Sprite_SlgActorFace.prototype.posY = function () {
switch (this._actor.actorId()) {
case 4:
return 50;
case 9:
return 60;
case 10:
return -25;
case 11:
return -25;
case 13:
return 55;
case 17:
return 22;
}
return 0;
};
return Sprite_SlgActorFace;
})(Sprite);