个人记录保存
Project1论坛 小圈子 人才 不得学习我的技术
javascript
//=================================================================================================
// GlobalPopupTip.js
//=================================================================================================
/*:
* @target MZ
* @plugindesc 游戏场景全局提示框 带三秒隐藏。
* @author 希夷先生
*
* @help
* 插件功能:游戏场景全局提示框 带三秒隐藏
* 使用方法 SceneManager._scene.showTip(" 金钱 + 300$");
*/
(() => {
const _Scene_Base_prototype_create = Scene_Base.prototype.create;
Scene_Base.prototype.create = function() {
_Scene_Base_prototype_create.call(this);
this._popupTipWindow = null;
this._popupTipDelayCount = 0;
};
const _Scene_Base_prototype_update = Scene_Base.prototype.update;
Scene_Base.prototype.update = function() {
_Scene_Base_prototype_update.call(this);
if(this._popupTipWindow == null){
this._popupTipWindow = new _New_Window(new Rectangle(1, 1, 10, 10));
this._popupTipWindow.paddingScale = 2;
this._popupTipWindow.npc_text = "提示框";
this._popupTipWindow.isWindow=0;
this.addChild(this._popupTipWindow);
}
if (this._popupTipDelayCount > 0) {
this._popupTipDelayCount--;
} else {
// 已经彻底关闭,直接退出
if (this._popupTipWindow.isClosed()) {
return;
}
// 不在关闭动画中,才只关一次
if (!this._popupTipWindow.isClosing()) {
this._popupTipWindow.close();
}
}
};
Scene_Base.prototype.showTip = function(text) {
this._popupTipWindow.npc_text = text;
this._popupTipDelayCount = 180;
this._popupTipWindow.open();
};
})();