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 showSalesPage * @text 販売ページ表示 * @des 販売ページ表示 */ var Nore; (function (Nore) { var pluginName = "Nore_SalesPage"; PluginManager.registerCommand(pluginName, "showSalesPage", function (args) { $gameParty.setMenuActorId(0); SceneManager.push(Scene_SalesPage); }); })(Nore || (Nore = {})); var Scene_SalesPage = /** @class */ (function (_super) { __extends(Scene_SalesPage, _super); function Scene_SalesPage() { return (_super !== null && _super.apply(this, arguments)) || this; } Scene_SalesPage.prototype.create = function () { _super.prototype.create.call(this); this.createSalesWindow(); this.createSalesTop(); }; Scene_SalesPage.prototype.createSalesTop = function () { this._salesTop = new Sprite_SalesTop(this._avList); this.addChild(this._salesTop); }; Scene_SalesPage.prototype.createSalesWindow = function () { this._salesWindow = new Window_SalesPage(); this._salesWindow.setHandler("cancel", this.onCancel.bind(this)); this._salesWindow.setHandler("ok", this.onOk.bind(this)); this.addChild(this._salesWindow); this._salesWindow.activate(); this._avList = this._salesWindow.validAvList(); if ($gameTemp.lastScrollY) { this._salesWindow.scrollTo(0, $gameTemp.lastScrollY); } if ($gameTemp.lastSelectedIndex >= 0) { this._salesWindow.select($gameTemp.lastSelectedIndex); } else { this._salesWindow.select(0); } }; Scene_SalesPage.prototype.onCancel = function () { $gameTemp.lastScrollY = -1; $gameTemp.lastSelectedIndex = -1; this.popScene(); }; Scene_SalesPage.prototype.update = function () { _super.prototype.update.call(this); }; Scene_SalesPage.prototype.onOk = function () { var avSet = this._salesWindow.selectedItem(); if (!avSet) { this._salesWindow.activate(); return; } if (avSet.isNull()) { this._salesWindow.activate(); return; } $gameTemp.lastScrollY = this._salesWindow.scrollY(); $gameTemp.lastSelectedIndex = this._salesWindow.index(); SceneManager.snapForBackground(); $gameTemp.avSet = avSet; SceneManager.push(Scene_AvJacketBigSalesPage); }; return Scene_SalesPage; })(Scene_MenuBase); var Sprite_SalesTop = /** @class */ (function (_super) { __extends(Sprite_SalesTop, _super); function Sprite_SalesTop(avList) { var _this = _super.call(this) || this; _this._avList = avList; _this.bitmap = new BitmapNoOutline(Graphics.width, 90); _this.bitmap.clear(); _this.bitmap.fillAll("#FFFFFF"); var m = 10; var y = 40; _this.bitmap.fillRect(m, y, Graphics.width - m * 2, 2, "#303030"); _this.bitmap.fillRect(m, y + 2, Graphics.width - m * 2, 36, "#eeeeee"); _this.bitmap.textColor = ""; _this.bitmap.fontBold = true; _this.bitmap.fontSize = 20; _this.bitmap.drawText("List of erotic videos (Sorted by number of sales)", 10, 4, 300, 32); _this.bitmap.fontBold = false; _this.bitmap.fontSize = 14; _this.bitmap.drawText( "%1 Titles".format(_this._avList.length), 16, 40, 300, 32 ); return _this; } return Sprite_SalesTop; })(Sprite); var NULL_AV_ID = -1; var AvSet = /** @class */ (function () { function AvSet(itemId) { this._itemId = itemId; this._avList = []; } AvSet.prototype.avJacket = function () { if (this.isNull()) { return null; } return this.mainAv().avJacket(); }; AvSet.prototype.isNull = function () { return this._itemId == NULL_AV_ID; }; AvSet.prototype.pushAv = function (av) { this._avList.push(av); }; AvSet.prototype.avAt = function (index) { return this._avList[index]; }; AvSet.prototype.mainAv = function () { if (this._favoriteAvIndex >= 0) { return this._avList[this._favoriteAvIndex]; } else { console.error("main av index が不正です" + this._favoriteAvIndex); return this._avList[0]; } }; AvSet.prototype.realSales = function () { var n = 0; for (var _i = 0, _a = this._avList; _i < _a.length; _i++) { var av = _a[_i]; n += av.realSales(); } return n; }; AvSet.prototype.jacketTitle = function () { return this.mainAv().jacketTitle(); }; AvSet.prototype.jacketSubTitle = function () { return this.mainAv().jacketSubTitle(); }; AvSet.prototype.count = function () { return this._avList.length; }; AvSet.prototype.favoriteAvIndex = function () { return this._favoriteAvIndex; }; AvSet.prototype.setFavotireIndex = function (index) { this._favoriteAvIndex = index; for (var i = 0; i < this._avList.length; i++) { var av = this._avList[i]; av.setFavorite(this._favoriteAvIndex == i); } }; AvSet.prototype.onMake = function () { this._favoriteAvIndex = -1; for (var i = 0; i < this._avList.length; i++) { var av = this._avList[i]; if (this._favoriteAvIndex >= 0) { av.setFavorite(false); } if (av.isFavorite()) { this._favoriteAvIndex = i; } } if (this._favoriteAvIndex < 0) { var index = 0; var lastAv = this._avList[index]; lastAv.setFavorite(true); this._favoriteAvIndex = index; } }; return AvSet; })(); var AvSetMaker = /** @class */ (function () { function AvSetMaker(list) { this._list = list; this._map = {}; } AvSetMaker.prototype.make = function () { for (var _i = 0, _a = this._list; _i < _a.length; _i++) { var av = _a[_i]; if (!this._map[av.itemId()]) { this._map[av.itemId()] = new AvSet(av.itemId()); } var avSet = this._map[av.itemId()]; avSet.pushAv(av); } var result = []; for (var key in this._map) { var avSet = this._map[key]; avSet.onMake(); result.push(avSet); } return result; }; return AvSetMaker; })(); var Window_SalesPage = /** @class */ (function (_super) { __extends(Window_SalesPage, _super); function Window_SalesPage() { var _this = this; var y = 84; var r = new Rectangle( -4, y, Graphics.width + 4 * 2, Graphics.height + 4 - y ); _this._isNoSumi = true; _this = _super.call(this, r) || this; _this.padding = 0; _this.makeItems(); _this.refresh(); return _this; } Window_SalesPage.prototype.loadWindowskin = function () { this.windowskin = ImageManager.loadSystem("Window2"); }; Window_SalesPage.prototype.updateBackOpacity = function () { this.backOpacity = 255; }; Window_SalesPage.prototype.createContents = function () { var width = this.contentsWidth(); var height = this.contentsHeight(); this.destroyContents(); this.contents = new BitmapNoOutline(width, height); this.contentsBack = new Bitmap(width, height); this.resetFontSettings(); }; Window_SalesPage.prototype.avList = function () { return this._avList; }; Window_SalesPage.prototype.validAvList = function () { var result = []; for (var _i = 0, _a = this._avList; _i < _a.length; _i++) { var set = _a[_i]; if (!set.isNull()) { result.push(set); } } return result; }; Window_SalesPage.prototype.selectedItem = function () { return this._avList[this.index()]; }; Window_SalesPage.prototype.itemRect = function (index) { var r = _super.prototype.itemRect.call(this, index); r.x += 20; r.y += 10; return r; }; Window_SalesPage.prototype.makeItems = function () { var actor = $gameParty.menuActor(); var actorId = -1; if (actor) { actorId = actor.actorId(); } var list = []; for (var _i = 0, _a = $slg.avInfo().allList(); _i < _a.length; _i++) { var av = _a[_i]; if (av.isShowResult()) { if (actorId < 0) { list.push(av); } else if (av.actorId() == actorId) { list.push(av); } } } var avSetMaker = new AvSetMaker(list); this._avList = avSetMaker.make(); this._avList = this._avList.sort(function (a, b) { return b.realSales() - a.realSales(); }); if (this._avList.length % this.maxCols() > 0) { var blankLength = this.maxCols() - (this._avList.length % this.maxCols()); for (var i = 0; i < blankLength; i++) { this._avList.push(new AvSet(-1)); } } }; Window_SalesPage.prototype.refresh = function () { this._windowContentsSprite.x = 0; this._windowContentsSprite.y = 0; _super.prototype.refresh.call(this); this.contentsBack.visible = false; // this.drawTitle(); //this.refreshBack(); }; Window_SalesPage.prototype.drawAllItems = function () { this._windowContentsSprite.removeChildren(); _super.prototype.drawAllItems.call(this); }; Window_SalesPage.prototype.drawItemBackground = function () {}; /*setCursorRect() { }*/ Window_SalesPage.prototype.colSpacing = function () { return 0; }; Window_SalesPage.prototype.rowSpacing = function () { return 0; }; /*refreshBack() { this._windowContentsBackSprite.removeChildren(); const g = new PIXI.Graphics(); g.beginFill(0xffffff, 1); g.drawRect(0, 0, this.width, this.height); g.endFill(); this.addChild(g); this._windowContentsBackSprite.addChild(g) }*/ Window_SalesPage.prototype.drawItem = function (index) { var rect = this.itemRect(index); this.drawFrame(rect); var av = this._avList[index]; var jacket = av.avJacket(); if (!jacket) { return; } var sprite = new Sprite_AvJacket(jacket); sprite.x = rect.x + 26; sprite.y = rect.y + 12; var avCount = av.count(); if (avCount > 1) { if (avCount > 4) { avCount = 4; } var offset = (avCount - 1) * 3 - 2; for (var i = 0; i < avCount - 1; i++) { var g = new PIXI.Graphics(); //g.beginFill(0x333333, 1); g.lineStyle(1, 0xaaaaaa); g.beginFill(0xdddddd, 1); g.drawRect(0, 0, sprite.width - 4, sprite.height - 4); g.endFill(); g.x = sprite.x + 4 + offset; g.y = sprite.y - offset; this._windowContentsSprite.addChild(g); offset -= 3; } } this._windowContentsSprite.addChild(sprite); sprite.refresh(); //sprite.setHandler(this.onAv.bind(this, av)); this.contents.fontFace = "メイリオ"; this.contents.textColor = "#005fc0"; this.contents.fontBold = false; var xx = rect.x + 10; var yy = rect.y + 210; this.contents.fontSize = 14; this.drawText(av.jacketTitle(), xx, yy, 190); this.drawText(av.jacketSubTitle(), xx, yy + 16, 190); this.contents.textColor = "#C10000"; this.contents.fontBold = true; this.drawText("Sales: " + av.realSales(), xx, yy + 16 + 18 + 2, 120); }; Window_SalesPage.prototype.onAv = function (av) { if (this._avPressed) { return; } this._avPressed = true; SceneManager.snapForBackground(); SoundManager.playOk(); $gameTemp.avSet = av; SceneManager.push(Scene_AvJacketBigSalesPage); }; Window_SalesPage.prototype.drawFrame = function (rect) { var g = new PIXI.Graphics(); g.lineStyle(1, 0xcccccc); g.drawRect(0, 0, rect.width, rect.height); g.x = rect.x; g.y = rect.y; this._windowContentsSprite.addChild(g); }; Window_SalesPage.prototype.maxCols = function () { return 6; }; Window_SalesPage.prototype.drawImage = function () {}; Window_SalesPage.prototype.drawTitle = function () { this.contents.textColor = "#333333"; this.contents.fontSize = 17; this.contents.fontBold = true; this.drawText("Porno List", 10, 0, 320); }; Window_SalesPage.prototype.itemWidth = function () { var w = _super.prototype.itemWidth.call(this); return w - 5; }; Window_SalesPage.prototype.itemHeight = function () { return 285; }; Window_SalesPage.prototype.maxItems = function () { if (this._avList) { return this._avList.length; } return 0; }; Window_SalesPage.prototype.overallHeight = function () { var h = _super.prototype.overallHeight.call(this); return h + 20; }; Window_SalesPage.prototype.ensureCursorVisible = function (smooth) { if (this._cursorAll) { this.scrollTo(0, 0); } else if (this.innerHeight > 0 && this.row() >= 0) { var scrollY_1 = this.scrollY(); var itemTop = this.row() * this.itemHeight(); var itemBottom = itemTop + this.itemHeight() + 20; var scrollMin = itemBottom - this.innerHeight; if (scrollY_1 > itemTop) { if (smooth) { this.smoothScrollTo(0, itemTop); } else { this.scrollTo(0, itemTop); } } else if (scrollY_1 < scrollMin) { if (smooth) { this.smoothScrollTo(0, scrollMin); } else { this.scrollTo(0, scrollMin); } } } }; return Window_SalesPage; })(Window_Selectable); var Scene_AvJacketBigSalesPage = /** @class */ (function (_super) { __extends(Scene_AvJacketBigSalesPage, _super); function Scene_AvJacketBigSalesPage() { return (_super !== null && _super.apply(this, arguments)) || this; } Scene_AvJacketBigSalesPage.prototype.create = function () { var avSet = $gameTemp.avSet; this._avSet = avSet; this._index = avSet.favoriteAvIndex(); _super.prototype.create.call(this); this.createAvWindow(); this.createCancelButton(); this.createMsgWindow(); this.updateButtonVisible(); this._jacketRect = new Rectangle(365, 27, 500, 670); }; Scene_AvJacketBigSalesPage.prototype.createAvWindow = function () { this._avWindow = new Window_AvJacketBigSalesPage(this._avSet.mainAv()); this.addChild(this._avWindow); }; Scene_AvJacketBigSalesPage.prototype.createMsgWindow = function () { this._msgWindow = new Nore.Window_Msg(270); this._msgWindow.setTexts([ TextManager.screenShot1, TextManager.screenShot2, TextManager.screenShot3, TextManager.screenShot4, ]); this.addChild(this._msgWindow); this._msgWindow.hide(); this._msgWindow.setHandler("ok", this.onMsgOk.bind(this)); }; Scene_AvJacketBigSalesPage.prototype.update = function () { _super.prototype.update.call(this); if (Input.isTriggered("cancel") || TouchInput.rightButton) { SoundManager.playOk(); this.popScene(); } else if (Input.isTriggered("ok")) { this.onFavorite(); } else if (Input.isTriggered("left")) { this.onLeft(); } else if (Input.isTriggered("right")) { this.onRight(); } else if (TouchInput.isTriggered()) { this.updateTouch(); } }; Scene_AvJacketBigSalesPage.prototype.updateTouch = function () { if ($gameTemp.confirmWindowActive) { return; } var x = TouchInput.x; var y = TouchInput.y; if (this._jacketRect.contains(x, y)) { this.onCancel(); } else if (x < 250) { this.onCancel(); } else if (x > 1030) { this.onCancel(); } else if (y > 700) { if (x < 500) { this.onCancel(); } else if (x > 920) { this.onCancel(); } } }; Scene_AvJacketBigSalesPage.prototype.onMsgOk = function () { this._msgWindow.hide(); this._avWindow.activate(); this._cancelButton.visible = true; this.updateButtonVisible(); }; Scene_AvJacketBigSalesPage.prototype.onCancel = function () { SoundManager.playCancel(); this.popScene(); }; Scene_AvJacketBigSalesPage.prototype.updateButtonVisible = function () { if (this._downLoadButton) { this._downLoadButton.visible = true; } if (this._avSet.count() == 1) { this._rightButton.visible = false; this._leftButton.visible = false; this._favoriteButton.visible = false; } else { this._favoriteButton.visible = true; if (this._index == 0) { this._rightButton.visible = false; this._leftButton.visible = true; } else if (this._index == this._avSet.count() - 1) { this._rightButton.visible = true; this._leftButton.visible = false; } else { this._rightButton.visible = true; this._leftButton.visible = true; } } if (this._index == this._avSet.favoriteAvIndex()) { this._favoriteButton.push(); } else { this._favoriteButton.up(); } }; Scene_AvJacketBigSalesPage.prototype.createCancelButton = function () { this._cancelButton = new Sprite_Button2("cancel", true); this._cancelButton.x = 860; this._cancelButton.y = 30; this.addWindow(this._cancelButton); }; Scene_AvJacketBigSalesPage.prototype.createButtons = function () { var y = 370; this.addLeftButton(280, y); this.addRightButton(910, y); this.addBottomButton(530, 708); this.addDownLoadButton(700, 708); }; Scene_AvJacketBigSalesPage.prototype.addLeftButton = function (x, y) { var button = new Sprite_Button2("pageup", true); button.x = x; button.y = y; this.addChild(button); button.setClickHandler(this.onLeft.bind(this)); this._leftButton = button; }; Scene_AvJacketBigSalesPage.prototype.addRightButton = function (x, y) { var button = new Sprite_Button2("pagedown", true); button.x = x; button.y = y; this.addChild(button); button.setClickHandler(this.onRight.bind(this)); this._rightButton = button; }; Scene_AvJacketBigSalesPage.prototype.addBottomButton = function (x, y) { var button = new Sprite_Button3("main", true); button.x = x; button.y = y; this.addChild(button); button.setClickHandler(this.onFavorite.bind(this)); this.addChild(button); this._favoriteButton = button; }; Scene_AvJacketBigSalesPage.prototype.addDownLoadButton = function (x, y) { if (!Nore.isTakeScreenshotEnabled()) { return; } var button = new Sprite_Button3("downLoad", true); button.x = x; button.y = y; this.addChild(button); button.setClickHandler(this.onDownLoad.bind(this)); this.addChild(button); this._downLoadButton = button; }; Scene_AvJacketBigSalesPage.prototype.onDownLoad = function () { var bitmap = this._avWindow.snap(); Nore.takeScreenShotBitmap(this.makeFileName() + ".png", bitmap); SoundManager.playReflection(); this._msgWindow.show(); this._msgWindow.activate(); this._avWindow.deactivate(); this._rightButton.visible = false; this._leftButton.visible = false; this._favoriteButton.visible = false; this._downLoadButton.visible = false; this._cancelButton.visible = false; }; Scene_AvJacketBigSalesPage.prototype.makeFileName = function () { var d = new Date(); var timeStamp = "%1-%2-%3".format( d.getFullYear(), (d.getMonth() + 1).padZero(2), d.getDate().padZero(2) ); timeStamp += "_%1%2%3".format( d.getHours().padZero(2), d.getMinutes().padZero(2), d.getSeconds().padZero(2) ); return timeStamp; }; Scene_AvJacketBigSalesPage.prototype.onLeft = function () { if (this._avSet.count() - 1 == this._index) { return; } SoundManager.playCursor(); this._index++; this.refreshJacket(); this.updateButtonVisible(); }; Scene_AvJacketBigSalesPage.prototype.onRight = function () { if (this._index == 0) { return; } SoundManager.playCursor(); this._index--; this.refreshJacket(); this.updateButtonVisible(); }; Scene_AvJacketBigSalesPage.prototype.onFavorite = function () { if (this._avSet.count() == 1) { return; } SoundManager.playOk(); this._avSet.setFavotireIndex(this._index); this.updateButtonVisible(); }; Scene_AvJacketBigSalesPage.prototype.refreshJacket = function () { var av = this._avSet.avAt(this._index); this._avWindow.refreshJacket(av); }; return Scene_AvJacketBigSalesPage; })(Scene_MenuBase); var Window_AvJacketBigSalesPage = /** @class */ (function (_super) { __extends(Window_AvJacketBigSalesPage, _super); function Window_AvJacketBigSalesPage(av) { var _this = this; var r = new Rectangle(270, 5, 500, 500); _this = _super.call(this, r) || this; _this._av = av; _this.backOpacity = 0; _this.frameVisible = false; _this.createJacket(); _this._isWindow = false; return _this; } Window_AvJacketBigSalesPage.prototype.createJacket = function () { this._jacketSprite = new Nore.Sprite_AvJacketBig( this._av.avJacket(), JacketScale.scale3, null ); this.addChild(this._jacketSprite); this.moveJacket(); }; Window_AvJacketBigSalesPage.prototype.moveJacket = function () { this._jacketSprite.x = 100; this._jacketSprite.y = 20; }; Window_AvJacketBigSalesPage.prototype.refreshJacket = function (av) { this._av = av; this.removeChild(this._jacketSprite); this.createJacket(); }; Window_AvJacketBigSalesPage.prototype.update = function () { _super.prototype.update.call(this); if (this._av) { this._av.avJacket().clearDirty(); } }; Window_AvJacketBigSalesPage.prototype.snap = function () { var lastX = this.x; var lastY = this.y; this.x = 0; this.y = 0; this._jacketSprite.x = 0; this._jacketSprite.y = 0; var width = this._jacketSprite.spriteWidth() + 4; var height = this._jacketSprite.spriteHeight() + 4; var bitmap = new Bitmap(width, height); var renderTexture = PIXI.RenderTexture.create(width, height); var renderer = Graphics.app.renderer; renderer.render(this, renderTexture); this.worldTransform.identity(); var canvas = renderer.extract.canvas(renderTexture); bitmap.context.drawImage(canvas, 0, 0); canvas.width = 0; canvas.height = 0; renderTexture.destroy({ destroyBase: true }); bitmap.baseTexture.update(); this.moveJacket(); this.x = lastX; this.y = lastY; return bitmap; }; return Window_AvJacketBigSalesPage; })(Window_Base);