Skip to content

Utils

Kind: global class

  • Utils
    • new Utils()
    • .RPGMAKER_NAME
    • .RPGMAKER_VERSION
    • .isOptionValid(name) ⇒ boolean
    • .isNwjs() ⇒ boolean
    • .isMobileDevice() ⇒ boolean
    • .isMobileSafari() ⇒ boolean
    • .isAndroidChrome() ⇒ boolean
    • .canReadGameFiles() ⇒ boolean
    • .rgbToCssColor(r, g, b) ⇒ string
    • .generateRuntimeId() ⇒ number
    • .isSupportPassiveEvent() ⇒ boolean

new Utils()

定义实用方法的静态类,提供各种游戏开发相关的工具函数
The static class that defines utility methods, providing various game development utility functions


Utils.RPGMAKER_NAME

RPG Maker 的名称,当前版本为'MV'
The name of the RPG Maker, 'MV' in the current version

Kind: static property of Utils
Read only: true
Properties

NameTypeDescription
RPGMAKER_NAMEstringRPG Maker 名称 - RPG Maker name

Utils.RPGMAKER_VERSION

RPG Maker 的版本号
The version number of the RPG Maker

Kind: static property of Utils
Read only: true
Properties

NameTypeDescription
RPGMAKER_VERSIONstringRPG Maker 版本 - RPG Maker version

Utils.isOptionValid(name) ⇒ boolean

检查指定的选项是否在 URL 查询字符串中
Checks whether the specified option is in the URL query string

Kind: static method of Utils
Returns: boolean - 如果选项在查询字符串中则返回 true - True if the option is in the query string

ParamTypeDescription
namestring选项名称 - Option name

Utils.isNwjs() ⇒ boolean

检查当前运行平台是否为 NW.js 桌面应用
Checks whether the current platform is NW.js desktop application

Kind: static method of Utils
Returns: boolean - 如果平台是 NW.js 则返回 true - True if the platform is NW.js


Utils.isMobileDevice() ⇒ boolean

检查当前运行平台是否为移动设备
Checks whether the current platform is a mobile device

Kind: static method of Utils
Returns: boolean - 如果平台是移动设备则返回 true - True if the platform is a mobile device


Utils.isMobileSafari() ⇒ boolean

检查当前浏览器是否为 iOS 设备上的 Safari 浏览器
Checks whether the current browser is Safari on iOS devices

Kind: static method of Utils
Returns: boolean - 如果浏览器是 Mobile Safari 则返回 true - True if the browser is Mobile Safari


Utils.isAndroidChrome() ⇒ boolean

检查当前浏览器是否为 Android 设备上的 Chrome 浏览器
Checks whether the current browser is Chrome on Android devices

Kind: static method of Utils
Returns: boolean - 如果浏览器是 Android Chrome 则返回 true - True if the browser is Android Chrome


Utils.canReadGameFiles() ⇒ boolean

检查浏览器是否具有读取游戏文件夹中文件的权限
Checks whether the browser has permission to read files in the game folder

Kind: static method of Utils
Returns: boolean - 如果浏览器可以读取游戏文件夹中的文件则返回 true - True if the browser can read files in the game folder


Utils.rgbToCssColor(r, g, b) ⇒ string

将 RGB 颜色值转换为 CSS 颜色字符串格式
Converts RGB color values to CSS color string format

Kind: static method of Utils
Returns: string - CSS 颜色字符串 - CSS color string

ParamTypeDescription
rnumber红色值,范围为 (0, 255) - The red value in the range (0, 255)
gnumber绿色值,范围为 (0, 255) - The green value in the range (0, 255)
bnumber蓝色值,范围为 (0, 255) - The blue value in the range (0, 255)

Utils.generateRuntimeId() ⇒ number

生成一个递增的唯一运行时标识符
Generates an incrementing unique runtime identifier

Kind: static method of Utils
Returns: number - 唯一的运行时 ID - A unique runtime ID


Utils.isSupportPassiveEvent() ⇒ boolean

检测浏览器是否支持被动事件监听器,用于提高滚动性能
Tests whether the browser supports passive event listeners for better scroll performance

Kind: static method of Utils
Returns: boolean - 如果浏览器支持被动事件则返回 true - True if the browser supports passive event, false otherwise


贡献者

暂无相关贡献者

页面历史

暂无最近变更历史
最近更新