RPGMZ 游戏场景全局提示框 带三秒隐藏插件

个人记录保存

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();
	};

})();

窗口源码

相关推荐
宠..42 分钟前
VS Code 修改 C++ 标准同时修改错误检测标准
java·linux·开发语言·javascript·c++·python·qt
JarvanMo1 小时前
2026年最佳Flutter图标包
前端
Arthur14726122865471 小时前
Vue Query 缓存机制实战:别再让 gcTime 和 staleTime 背锅了
前端
Rkgua1 小时前
React中的赋值操作为什么不是=?
前端·javascript
heyCHEEMS1 小时前
记录一个 React 表单的小坑:缓存节流导致页面刷新
前端·javascript
@不误正业1 小时前
多Agent协作框架深度实战-从ReAct到Plan-and-Execute全架构演进
前端·react.js·架构·agent
唐青枫1 小时前
别再手写重复 CSS 了:SCSS 从入门到实战
前端·css·scss
huohaiyu1 小时前
HTML和CSS基础使用
前端·css·html