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

})();

窗口源码

相关推荐
Sinclair3 分钟前
安企CMS的安装-PHPStudy(小皮面板)部署
前端·后端
会飞的特洛伊5 分钟前
IAM身份认证
前端·后端
tokenKe22 分钟前
Epic Games 发布下一代版本控制系统 Lore:被 HN 干到 1000+ 分的“游戏版 Git“
git·游戏
钛态1 小时前
AI 组件生成评测:别只看页面能不能渲染
前端·vue·react·web
Hyyy1 小时前
requestAnimationFrame和setTimeout有什么不同
前端
Jackson__1 小时前
问到你想清楚,这个 skill 专治没想明白就写代码!
前端·github·ai编程
এ慕ོ冬℘゜1 小时前
前端实战:Textarea 实时字数计数输入器(带字数限制+UI优化完整源码)
前端·ui
程序员黑豆2 小时前
从零开始:创建第一个鸿蒙应用程序
前端·harmonyos
只与明月听3 小时前
LangChain 学习-掌握LangChain Core API
前端·人工智能·后端
Listen·Rain3 小时前
Vue3中组件间通信详解
前端·javascript·vue.js