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

501 lines
16 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 __());
};
})();
/*:ja
* @target MZ
* @author ル
*
* @command preloadLastJacket
* @text ジャケット画像を先読み
* @des ジャケット画像を先読み
* @arg actorId
* @type number
* @desc actorId
*
* @command showLastJacket
* @text ジャケット画像を表示
* @des ジャケット画像を表示
* @arg actorId
* @type number
* @desc actorId
*
* @command hideLastJacket
* @text ジャケット画像を消去
* @des ジャケット画像を消去
*
* @command preloadJacketNtr
* @text NTRジャケット画像を先読み
* @des NTRジャケット画像を先読み
* @arg itemId
* @type number
* @desc itemId
*
* @command showJacketNtr
* @text NTRジャケット画像を表示
* @des NTRジャケット画像を表示
* @arg itemId
* @type number
* @desc itemId
*/
var Nore;
(function (Nore) {
var pluginName = "Nore_AvJacketUiBig";
PluginManager.registerCommand(
pluginName,
"preloadLastJacket",
function (args) {
var actorId = parseInt(args.actorId);
var av = $slg.avInfo().actorLastShowResultAv(actorId);
var jacket = av.avJacket();
if (jacket.isActorOnlyLayout()) {
return;
}
var ss = jacket.screenShot();
var imageId = ss.imageId();
this._waitLoading = true;
Nore.preloadWebp2(imageId);
}
);
PluginManager.registerCommand(pluginName, "showLastJacket", function (args) {
if (SceneManager._scene instanceof Scene_Map2) {
var actorId = parseInt(args.actorId);
var av = $slg.avInfo().actorLastShowResultAv(actorId);
var jacket = av.avJacket();
var isSyusan = av.isSyusan();
var isBote = av.isBote();
$gameSwitches.setValue(113, isBote);
$gameSwitches.setValue(114, isSyusan);
var scene = SceneManager._scene;
scene.showBigJacket(jacket);
}
});
PluginManager.registerCommand(pluginName, "hideLastJacket", function (args) {
if (SceneManager._scene instanceof Scene_Map2) {
var scene = SceneManager._scene;
scene.hideBigJacket();
}
});
PluginManager.registerCommand(
pluginName,
"preloadJacketNtr",
function (args) {
var itemId = parseInt(args.itemId);
var av = $slg.avInfo().findAvByItemId(itemId);
if (!av) {
return;
}
var jacket = av.avJacket();
if (jacket.isActorOnlyLayout()) {
return;
}
var ss = jacket.screenShot();
var imageId = ss.imageId();
this._waitLoading = true;
Nore.preloadWebp2(imageId);
}
);
PluginManager.registerCommand(pluginName, "showJacketNtr", function (args) {
if (SceneManager._scene instanceof Scene_Map2) {
var itemId = parseInt(args.itemId);
var av = $slg.avInfo().findAvByItemId(itemId);
if (!av) {
console.error("AVが存在しません:" + itemId);
return;
}
var jacket = av.avJacket();
var scene = SceneManager._scene;
scene.showBigJacket(jacket);
}
});
var Scene_AvJacketBig = /** @class */ (function (_super) {
__extends(Scene_AvJacketBig, _super);
function Scene_AvJacketBig() {
return (_super !== null && _super.apply(this, arguments)) || this;
}
Scene_AvJacketBig.prototype.create = function () {
_super.prototype.create.call(this);
this.createAvWindow();
};
Scene_AvJacketBig.prototype.createAvWindow = function () {
this._avWindow = new Window_AvJacketBig();
this.addChild(this._avWindow);
};
Scene_AvJacketBig.prototype.update = function () {
_super.prototype.update.call(this);
if (
Input.isTriggered("cancel") ||
Input.isTriggered("ok") ||
TouchInput.isTriggered() ||
TouchInput.rightButton
) {
SoundManager.playOk();
this.popScene();
}
};
Scene_AvJacketBig.prototype.createCancelButton = function () {
this._cancelButton = new Sprite_Button2("cancel", true);
this._cancelButton.x = 860;
this._cancelButton.y = 30;
this.addWindow(this._cancelButton);
};
return Scene_AvJacketBig;
})(Scene_MenuBase);
Nore.Scene_AvJacketBig = Scene_AvJacketBig;
var Window_AvJacketBig = /** @class */ (function (_super) {
__extends(Window_AvJacketBig, _super);
function Window_AvJacketBig() {
var _this = this;
var r = new Rectangle(270, 60, 500, 500);
_this = _super.call(this, r) || this;
_this.backOpacity = 0;
_this.frameVisible = false;
_this.createJacket();
return _this;
}
Window_AvJacketBig.prototype.createJacket = function () {
var av = $gameTemp.bigAv;
this._jacketSprite = new Sprite_AvJacketBig(
av.avJacket(),
JacketScale.scale3,
null
);
this.addChild(this._jacketSprite);
this._jacketSprite.x = 100;
this._jacketSprite.y = 20;
av.avJacket().setDirty();
};
Window_AvJacketBig.prototype.update = function () {
_super.prototype.update.call(this);
$gameTemp.bigAv.avJacket().clearDirty();
};
return Window_AvJacketBig;
})(Window_Base);
Nore.Window_AvJacketBig = Window_AvJacketBig;
var Sprite_AvJacketBig = /** @class */ (function (_super) {
__extends(Sprite_AvJacketBig, _super);
function Sprite_AvJacketBig(avJacket, jacketScale, callback) {
if (callback === void 0) {
callback = null;
}
var _this = _super.call(this) || this;
_this._callback = callback;
_this._jacketScale = jacketScale;
var margin = _this.margin();
_this._avJacket = avJacket;
_this._screenShot = new Sprite_AvScreenShotBig(avJacket, jacketScale);
_this._screenShot.x = margin;
_this._avActor = new Sprite_AvActorBig(avJacket, jacketScale);
_this._avActor.x = margin;
_this._avActor.y = margin;
_this._avText = new Sprite_AvTextBig(avJacket, jacketScale);
_this._avText.x = margin;
_this._avText.y = margin;
_this._avParts = new Sprite_JacketPartsBig(avJacket, jacketScale);
_this._avParts.x = margin;
_this._avParts.y = margin;
var g = new PIXI.Graphics();
g.beginFill(_this.frameColor(), 1);
g.drawRect(
0,
0,
_this.spriteWidth() + margin * 2,
_this.spriteHeight() + margin * 2
);
g.endFill();
_this.addChild(g);
_this._backLayer = new PIXI.Sprite();
_this.addChild(_this._backLayer);
_this.addChild(_this._avActor);
_this.addChild(_this._screenShot);
_this.addChild(_this._avParts);
_this.addChild(_this._avText);
var spriteWidth = _this.spriteWidth() + 4;
var spriteHeight = _this.spriteHeight() + 4;
var rect = new Rectangle(0, 0, spriteWidth, spriteHeight);
var myMask = new PIXI.Graphics();
myMask.beginFill(0xffffff);
myMask.drawRect(
rect.x + _this.getGlobalPosition().x,
rect.y + _this.getGlobalPosition().y,
rect.width,
rect.height
);
myMask.endFill();
_this.mask = myMask;
_this.addChild(_this.mask);
_this.drawFrame(rect);
_this._frame.width = rect.width;
_this._frame.height = rect.height;
_this.updatePosition();
_this._screenShot.loadImage(_this.onLoad.bind(_this));
return _this;
}
Sprite_AvJacketBig.prototype.onLoad = function () {
if (this._callback) {
this._callback();
}
this.refresh();
};
Sprite_AvJacketBig.prototype.outerFrameWidth = function () {
return 3;
};
Sprite_AvJacketBig.prototype.margin = function () {
return 3;
};
Sprite_AvJacketBig.prototype.spriteWidth = function () {
return Math.floor(147 * this._jacketScale);
};
Sprite_AvJacketBig.prototype.spriteHeight = function () {
return Math.floor(200 * this._jacketScale);
};
Sprite_AvJacketBig.prototype.createBackSprite = function () {
var backItemId = this._avJacket.backItemId();
if (this._avJacket.layout() == 21) {
backItemId = 201; // 黒背景
}
if (this._avJacket.layout() == 22) {
backItemId = 202; // 白背景
}
var armor = $dataArmors[backItemId];
if (armor.meta["back"]) {
var backId = parseInt(armor.meta["back"]);
var t = PIXI.utils.TextureCache["back_" + backId.padZero(3) + ".png"];
var s = new PIXI.Sprite(t);
return s;
} else if (armor.meta["backColor"]) {
var color = armor.meta["backColor"];
var dark = new PIXI.Graphics();
dark.beginFill(parseInt(color), 1);
dark.drawRect(0, 0, this.spriteWidth(), this.spriteHeight());
dark.endFill();
var s = new PIXI.Sprite();
s.addChild(dark);
return s;
} else {
console.error("背景画像が不正です:" + backItemId);
}
};
Sprite_AvJacketBig.prototype.jacketScale = function () {
return this._jacketScale;
};
Sprite_AvJacketBig.prototype.outlineFilter = function () {
var filter = new PIXI.filters.OutlineFilter(2, this.outlineColor(), 0.5);
filter.alpha = 0.7;
return filter;
};
return Sprite_AvJacketBig;
})(Sprite_BaseAvJacket);
Nore.Sprite_AvJacketBig = Sprite_AvJacketBig;
var Sprite_AvScreenShotBig = /** @class */ (function (_super) {
__extends(Sprite_AvScreenShotBig, _super);
function Sprite_AvScreenShotBig(jacket, jacketScale) {
var _this = _super.call(this) || this;
_this._jacket = jacket;
_this._jacketScale = jacketScale;
_this._ss = jacket.screenShot();
if (!jacket) {
console.error("jacket is null");
}
return _this;
}
Sprite_AvScreenShotBig.prototype.loadImage = function (callback) {
this._callback = callback;
if (this._jacket.hasNoImage()) {
this.onLoad();
return;
}
var imageId = this._ss.imageId();
this._waitLoading = true;
Nore.preloadWebp2(imageId, this.onLoad.bind(this));
};
Sprite_AvScreenShotBig.prototype.onLoad = function () {
this._waitLoading = false;
if (this._callback) {
this._callback();
}
};
Sprite_AvScreenShotBig.prototype.makeJacket = function () {
if (this._jacket.hasNoImage()) {
return;
}
this._sprite = new PIXI.Sprite();
this.addChild(this._sprite);
this._sprite.x = (-1280 / 2) * this.imageScale();
this._sprite.y = (-800 / 2) * this.imageScale();
var list = this._ss.eroImageList();
for (var _i = 0, list_1 = list; _i < list_1.length; _i++) {
var file = list_1[_i];
var f = file;
var t = PIXI.utils.TextureCache[f];
if (!t) {
console.error(f + "のAV Jacketファイルが見つかりません");
continue;
}
var s = new PIXI.Sprite(t);
//s.scale.x = this.imageScale();
//s.scale.y = this.imageScale();
this._sprite.addChild(s);
if (this._ss.manColor() > 0) {
if (t.textureCacheIds.length > 0) {
if (t.textureCacheIds[0].includes("man")) {
var s2 = new PIXI.Sprite(t);
this._sprite.addChild(s2);
setManColorFilter(this._ss.manColor(), s2);
}
}
}
}
this._sprite.scale.x = this.imageScale();
this._sprite.scale.y = this.imageScale();
};
Sprite_AvScreenShotBig.prototype.imageScale = function () {
return (147 / 1280) * this._jacketScale;
};
Sprite_AvScreenShotBig.prototype.destroy = function (options) {
this.removeChild(this._sprite);
this.releaseWebp();
_super.prototype.destroy.call(this, options);
};
Sprite_AvScreenShotBig.prototype.releaseWebp = function () {
var imageId = this._ss.imageId();
Nore.releaseWebp(imageId + "_1");
};
Sprite_AvScreenShotBig.prototype.spriteHight = function () {
return 92;
};
Sprite_AvScreenShotBig.prototype.setScreenShot = function (ss) {
this._ss = ss;
if (this._sprite) {
this.removeChild(this._sprite);
}
if (this._waitLoading) {
return;
}
this.makeJacket();
};
Sprite_AvScreenShotBig.prototype.update = function () {
_super.prototype.update.call(this);
if (!this._waitLoading) {
return;
}
if (this.isLoaded()) {
this._waitLoading = false;
this.makeJacket();
}
};
Sprite_AvScreenShotBig.prototype.isLoaded = function () {
var imageId = this._ss.imageId();
if (!Nore.isWebpLoaded(imageId + "_1")) {
return false;
}
if (!Nore.isWebpLoaded(imageId + "_2")) {
return false;
}
return true;
};
return Sprite_AvScreenShotBig;
})(Sprite);
var Sprite_AvActorBig = /** @class */ (function (_super) {
__extends(Sprite_AvActorBig, _super);
function Sprite_AvActorBig(avJacket, jacketScale) {
var _this = _super.call(this, avJacket) || this;
_this._jacketScale = jacketScale;
return _this;
}
Sprite_AvActorBig.prototype.jacketScale = function () {
return this._jacketScale;
};
return Sprite_AvActorBig;
})(Sprite_AvActor);
var Sprite_AvTextBig = /** @class */ (function (_super) {
__extends(Sprite_AvTextBig, _super);
function Sprite_AvTextBig(avJacket, jacketScale) {
return _super.call(this, avJacket, jacketScale) || this;
}
Sprite_AvTextBig.prototype.updatePositionType3 = function () {
var y = this.lineY();
if (this._jacketScale == JacketScale.scale2) {
this._text1.x = 4;
this._text1.y = y + 3;
this._text2.x = 4;
this._text2.y = y + 41;
} else {
this._text1.x = 4;
this._text1.y = y - 1;
this._text2.x = 4;
this._text2.y = y + 56;
}
};
Sprite_AvTextBig.prototype.drawTypeVertical3 = function () {
this._text1.refresh();
this._text2.refresh();
if (this._jacketScale == JacketScale.scale2) {
this._text1.x = 310;
this._text1.y = 0;
this._text2.x = 6;
this._text2.y = 0;
} else {
this._text1.x = 410;
this._text1.y = 0;
this._text2.x = 6;
this._text2.y = -6;
}
};
Sprite_AvTextBig.prototype.drawTopBottom = function () {
this._text1.refresh();
this._text2.refresh();
if (this._jacketScale == JacketScale.scale2) {
this._text1.x = 4;
this._text1.y = 50;
this._text2.x = 4;
this._text2.y = 400;
} else {
this._text1.x = 4;
this._text1.y = 75;
this._text2.x = 4;
this._text2.y = 526;
}
};
return Sprite_AvTextBig;
})(Sprite_AvText);
var Sprite_JacketPartsBig = /** @class */ (function (_super) {
__extends(Sprite_JacketPartsBig, _super);
function Sprite_JacketPartsBig(avJacket, jacketScale) {
var _this = _super.call(this, avJacket, jacketScale) || this;
_this._jacketScale = jacketScale;
return _this;
}
Sprite_JacketPartsBig.prototype.bigActorIconOffset = function () {
return 10 * this._jacketScale;
};
return Sprite_JacketPartsBig;
})(Sprite_AvParts);
})(Nore || (Nore = {}));