303 lines
9.3 KiB
JavaScript
303 lines
9.3 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 Nore;
|
|
(function (Nore) {
|
|
var Window_Top = /** @class */ (function (_super) {
|
|
__extends(Window_Top, _super);
|
|
function Window_Top(isSlg) {
|
|
var _this = this;
|
|
var r = new Rectangle(0, 0, Graphics.width, 46);
|
|
_this = _super.call(this, r) || this;
|
|
_this._buttonList = [];
|
|
_this._isSlg = isSlg;
|
|
_this.backOpacity = 255;
|
|
_this._margin = 0;
|
|
_this._padding = 0;
|
|
_this.refresh();
|
|
_this.createGaugeSprite();
|
|
_this.frameVisible = false;
|
|
_this._refreshBack();
|
|
_this.createButtons();
|
|
return _this;
|
|
}
|
|
Window_Top.prototype.createButtons = function () {
|
|
this.createOptionButton();
|
|
this.createWarpButton();
|
|
this.createMenuButton();
|
|
};
|
|
Window_Top.prototype.createMenuButton = function () {
|
|
var disable = false;
|
|
if (this._isSlg) {
|
|
disable = true;
|
|
}
|
|
this._menuButton = new Sprite_OverableButton("menu", false, disable);
|
|
this._menuButton.x = this.buttonX() + this.buttonInterval();
|
|
this._menuButton.y = this.buttonY();
|
|
this._menuButton.visible = true;
|
|
this.addChild(this._menuButton);
|
|
this._buttonList.push(this._menuButton);
|
|
};
|
|
Window_Top.prototype.createWarpButton = function () {
|
|
var disable = false;
|
|
if (this._isSlg) {
|
|
disable = true;
|
|
}
|
|
this._warpButton = new Sprite_OverableButton("warp", false, disable);
|
|
this._warpButton.x = this.buttonX();
|
|
this._warpButton.y = this.buttonY();
|
|
this._warpButton.visible = true;
|
|
this.addChild(this._warpButton);
|
|
this._buttonList.push(this._warpButton);
|
|
};
|
|
Window_Top.prototype.createOptionButton = function () {
|
|
this._optionButton = new Sprite_OverableButton("option", this._isSlg);
|
|
this._optionButton.x = this.buttonX() + this.buttonInterval() * 2;
|
|
this._optionButton.y = this.buttonY();
|
|
this._optionButton.visible = true;
|
|
this.addChild(this._optionButton);
|
|
this._buttonList.push(this._optionButton);
|
|
this._optionButton.setClickHandler(this.onOption.bind(this));
|
|
};
|
|
Window_Top.prototype.onOption = function () {
|
|
SoundManager.playOk();
|
|
SceneManager.push(Scene_Options);
|
|
};
|
|
Window_Top.prototype.buttonY = function () {
|
|
return -3;
|
|
};
|
|
Window_Top.prototype.buttonInterval = function () {
|
|
return 55;
|
|
};
|
|
Window_Top.prototype.buttonX = function () {
|
|
return 1042;
|
|
};
|
|
Window_Top.prototype._createBackSprite = function () {
|
|
this._backSprite = new Sprite();
|
|
var backWidth = 432;
|
|
for (var i = 0; i < 3; i++) {
|
|
var baseTexture = Nore.getSystemBaseTexture("main");
|
|
var rect = new Rectangle(0, 0, backWidth, 46);
|
|
var texture = new PIXI.Texture(baseTexture, rect);
|
|
var s = new PIXI.Sprite(texture);
|
|
s.x = i * backWidth;
|
|
this._backSprite.addChild(s);
|
|
}
|
|
this._container.addChild(this._backSprite);
|
|
};
|
|
Window_Top.prototype._refreshBack = function () {};
|
|
Window_Top.prototype.contentsHeight = function () {
|
|
return 50;
|
|
};
|
|
Window_Top.prototype.createGaugeSprite = function () {
|
|
this._gaugeSpriteSet = new Sprite_TimeGaugeEventSet();
|
|
this.addChild(this._gaugeSpriteSet);
|
|
this._gaugeSpriteSet.y = 46;
|
|
};
|
|
Window_Top.prototype.hideTimeGauge = function () {
|
|
this._gaugeSpriteSet.hide();
|
|
};
|
|
Window_Top.prototype.refresh = function () {
|
|
this._windowContentsSprite.removeChildren();
|
|
this.contents.clear();
|
|
this.contents.fontSize = 30;
|
|
this.drawGold(20, 2);
|
|
this.drawFan(168, 2);
|
|
this.drawTicket(310, 2);
|
|
this.drawTutorial(461, 2);
|
|
};
|
|
Window_Top.prototype.drawTicket = function (xx, yy) {
|
|
this.drawIcon(Icon.ticket, xx - 5, yy + 6);
|
|
var labelX = 40;
|
|
this._lastTicket = $gameParty.gachaTicket();
|
|
this.drawNumber(this._lastTicket, xx + labelX, yy + 12, 100, "left", 2);
|
|
};
|
|
Window_Top.prototype.drawGold = function (xx, yy) {
|
|
this.contents.fontSize = 26;
|
|
var ww = 100;
|
|
this.drawIcon(Icon.gold2, xx, yy + 4);
|
|
var labelX = 40;
|
|
if ($gameParty.upGoldValue() > 0) {
|
|
var g = $gameParty.upGoldValue();
|
|
$gameParty.clearUpGoldValue();
|
|
if (!$gameSwitches.value(18)) {
|
|
this.addGainGoldSprite(g);
|
|
}
|
|
}
|
|
this._lastMoney = $gameParty.gold();
|
|
this.drawNumber($gameParty.gold(), xx + labelX, yy + 12, ww, "left", 2);
|
|
};
|
|
Window_Top.prototype.addGainGoldSprite = function (g) {
|
|
this.removeGoldSprite();
|
|
var s = new Sprite_GainGold(g);
|
|
s.x = this.calcGainGoldSpriteX();
|
|
s.y = -8;
|
|
this.addChild(s);
|
|
this._gainGoldSprite = s;
|
|
};
|
|
Window_Top.prototype.calcGainGoldSpriteX = function () {
|
|
var goldLen = ($gameParty.gold() + "").length;
|
|
return goldLen * 14;
|
|
};
|
|
Window_Top.prototype.removeGoldSprite = function () {
|
|
if (this._gainGoldSprite) {
|
|
this.removeChild(this._gainGoldSprite);
|
|
}
|
|
this._gainGoldSprite = null;
|
|
};
|
|
Window_Top.prototype.drawFan = function (xx, yy) {
|
|
var ww = 100;
|
|
this.drawIcon(Icon.fan, xx, yy + 4);
|
|
var labelX = 40;
|
|
this._lastFan = $slg.fan();
|
|
this.drawNumber(
|
|
this._lastFan * FAN_UNIT,
|
|
xx + labelX,
|
|
yy + 12,
|
|
ww,
|
|
"left",
|
|
2
|
|
);
|
|
};
|
|
Window_Top.prototype.drawTutorial = function (xx, yy) {
|
|
var target = $gameTutorial.nextTarget();
|
|
this._lastTutorial = target;
|
|
if (!target) {
|
|
return;
|
|
}
|
|
{
|
|
var baseTexture = Nore.getSystemBaseTexture("main");
|
|
var x = 0;
|
|
if (ConfigManager.language == "en") {
|
|
x = 100;
|
|
}
|
|
var rect = new Rectangle(x, 45, 100, 26);
|
|
var texture = new PIXI.Texture(baseTexture, rect);
|
|
var s = new PIXI.Sprite(texture);
|
|
s.x = xx;
|
|
s.y = 10;
|
|
this._windowContentsSprite.addChild(s);
|
|
}
|
|
this.contents.fontSize = 18;
|
|
this.drawText(target, xx - 8, yy + 14, 520, "left");
|
|
};
|
|
Window_Top.prototype.itemRect = function (index) {
|
|
var r = new Rectangle(302, 8, 40, 40);
|
|
r.x += index * 40;
|
|
return r;
|
|
};
|
|
Window_Top.prototype.maxItems = function () {
|
|
return 2;
|
|
};
|
|
Window_Top.prototype.maxCols = function () {
|
|
return 2;
|
|
};
|
|
Window_Top.prototype.update = function () {
|
|
_super.prototype.update.call(this);
|
|
if (this.isChanged()) {
|
|
this.refresh();
|
|
}
|
|
this.updateVisible();
|
|
this.updateOpacity();
|
|
};
|
|
Window_Top.prototype.isChanged = function () {
|
|
if (this._lastMoney != $gameParty.gold()) {
|
|
return true;
|
|
}
|
|
if (this._lastFan != $slg.fan()) {
|
|
return true;
|
|
}
|
|
if (this._lastTutorial != $gameTutorial.nextTarget()) {
|
|
return true;
|
|
}
|
|
if (this._lastTicket != $gameParty.gachaTicket()) {
|
|
return true;
|
|
}
|
|
return false;
|
|
};
|
|
Window_Top.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_Top.prototype.updateVisible = function () {
|
|
if ($gameSwitches.value(999)) {
|
|
this.visible = false;
|
|
return;
|
|
}
|
|
if ($gameSwitches.value(18)) {
|
|
this.visible = false;
|
|
} else {
|
|
this.visible = true;
|
|
}
|
|
};
|
|
return Window_Top;
|
|
})(Window_Base);
|
|
Nore.Window_Top = Window_Top;
|
|
})(Nore || (Nore = {}));
|
|
var Sprite_GainGold = /** @class */ (function (_super) {
|
|
__extends(Sprite_GainGold, _super);
|
|
function Sprite_GainGold(gold) {
|
|
var _this = _super.call(this) || this;
|
|
_this.bitmap = new Bitmap(100, 30);
|
|
_this.bitmap.fontSize = 12;
|
|
_this.bitmap.textColor = "#FFFF88";
|
|
_this.bitmap.fontBold = true;
|
|
_this.bitmap.drawText("+" + gold, 0, 0, 80, 30, "right");
|
|
if (!$slg.goldSe) {
|
|
//AudioManager.playSe({ name: 'Coin', volume: 100, pitch: 100, pan: 0 });
|
|
$slg.goldSe = true;
|
|
}
|
|
_this._wait = 50;
|
|
return _this;
|
|
}
|
|
Sprite_GainGold.prototype.update = function () {
|
|
_super.prototype.update.call(this);
|
|
if (this._wait > 0) {
|
|
this._wait--;
|
|
}
|
|
if (this._wait <= 0) {
|
|
this.opacity -= 10;
|
|
if (this.opacity <= 0) {
|
|
if (this.parent && this.parent.removeGoldSprite) {
|
|
this.parent.removeGoldSprite();
|
|
}
|
|
}
|
|
}
|
|
};
|
|
return Sprite_GainGold;
|
|
})(Sprite);
|