130 lines
3.8 KiB
JavaScript
130 lines
3.8 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 EffectType;
|
|
(function (EffectType) {
|
|
EffectType[(EffectType["none"] = -1)] = "none";
|
|
EffectType[(EffectType["gold"] = 0)] = "gold";
|
|
EffectType[(EffectType["mhp"] = 1)] = "mhp";
|
|
EffectType[(EffectType["kikaku"] = 2)] = "kikaku";
|
|
})((EffectType = Nore.EffectType || (Nore.EffectType = {})));
|
|
var Sprite_Effect = /** @class */ (function (_super) {
|
|
__extends(Sprite_Effect, _super);
|
|
function Sprite_Effect(type1, value1, type2, value2) {
|
|
if (type2 === void 0) {
|
|
type2 = EffectType.none;
|
|
}
|
|
if (value2 === void 0) {
|
|
value2 = -1;
|
|
}
|
|
var _this = _super.call(this) || this;
|
|
_this._type1 = type1;
|
|
_this._type2 = type2;
|
|
_this._value1 = value1;
|
|
_this._value2 = value2;
|
|
_this._moveCount = 20;
|
|
_this._waitCount = 60;
|
|
_this.bitmap = new Bitmap(120, 80);
|
|
_this.refresh();
|
|
return _this;
|
|
}
|
|
Sprite_Effect.prototype.refresh = function () {
|
|
var text = this.makeText1();
|
|
this.bitmap.fontSize = 12;
|
|
this.bitmap.textColor = ColorManager.crisisColor();
|
|
this.bitmap.drawText(text, 0, 0, 120, 30, "center");
|
|
var text2 = this.makeText2();
|
|
if (text2) {
|
|
this.bitmap.drawText(text2, 0, 20, 120, 30, "center");
|
|
}
|
|
this.playSound();
|
|
};
|
|
Sprite_Effect.prototype.playSound = function () {
|
|
switch (this._type1) {
|
|
case EffectType.gold:
|
|
AudioManager.playSe({ name: "Coin", volume: 80, pitch: 100, pan: 0 });
|
|
break;
|
|
case EffectType.mhp:
|
|
AudioManager.playSe({
|
|
name: "Heal1",
|
|
volume: 80,
|
|
pitch: 140,
|
|
pan: 0,
|
|
});
|
|
break;
|
|
}
|
|
};
|
|
Sprite_Effect.prototype.makeText1 = function () {
|
|
return this.makeText(this._type1, this.value1());
|
|
};
|
|
Sprite_Effect.prototype.makeText2 = function () {
|
|
return this.makeText(this._type2, this.value2());
|
|
};
|
|
Sprite_Effect.prototype.makeText = function (type, value) {
|
|
switch (type) {
|
|
case EffectType.gold:
|
|
return TextManager.money + " + %1".format(value);
|
|
}
|
|
};
|
|
Sprite_Effect.prototype.value1 = function () {
|
|
return this._value1;
|
|
};
|
|
Sprite_Effect.prototype.value2 = function () {
|
|
return this._value2;
|
|
};
|
|
Sprite_Effect.prototype.update = function () {
|
|
_super.prototype.update.call(this);
|
|
this.updateMove();
|
|
this.updateWait();
|
|
};
|
|
Sprite_Effect.prototype.updateMove = function () {
|
|
if (this._moveCount == 0) {
|
|
return;
|
|
}
|
|
this._moveCount--;
|
|
this.y--;
|
|
};
|
|
Sprite_Effect.prototype.updateWait = function () {
|
|
if (this._waitCount == 0) {
|
|
this._waitCount = -1;
|
|
if (this.parent) {
|
|
this.parent.removeChild(this);
|
|
}
|
|
return;
|
|
}
|
|
this._waitCount--;
|
|
};
|
|
return Sprite_Effect;
|
|
})(Sprite);
|
|
Nore.Sprite_Effect = Sprite_Effect;
|
|
})(Nore || (Nore = {}));
|