Godot 本地通知插件使用教程
1. 项目的目录结构及介绍
godot-local-notification/
├── addons/
│ └── localnotification-html5/
├── android-plugin/
├── ios-framework/
├── scripts/
├── .gitignore
├── LICENSE
├── README.md
└── nativelib.json
- addons/: 包含用于 HTML5 平台的本地通知插件。
- android-plugin/: 包含 Android 平台的本地通知插件。
- ios-framework/: 包含 iOS 平台的本地通知插件。
- scripts/: 包含用于配置和启动本地通知的脚本。
- .gitignore: Git 忽略文件。
- LICENSE: 项目许可证文件,采用 MIT 许可证。
- README.md: 项目说明文档。
- nativelib.json: 本地库配置文件。
2. 项目的启动文件介绍
项目的启动文件位于 scripts/
目录下,主要文件为 localnotification.gd
。该文件用于在 Godot 项目中自动加载,以便在代码中全局使用本地通知功能。
# scripts/localnotification.gd
# 该文件包含用于显示本地通知的 API
func show(message: String, title: String, interval: float, tag: int, repeating_interval: int = 0):
# 显示通知
pass
func show_daily(message: String, title: String, hour: int, minute: int, tag: int = 1):
# 每日显示通知
pass
3. 项目的配置文件介绍
项目的配置文件为 nativelib.json
,该文件用于配置本地库的相关设置。
{
"name": "local-notification",
"version": "0.2.2",
"description": "Local/Push notification plugin for Godot engine",
"author": "DrMoriarty",
"license": "MIT"
}
- name: 插件名称。
- version: 插件版本。
- description: 插件描述。
- author: 插件作者。
- license: 插件许可证。
通过以上配置文件和启动文件,可以方便地在 Godot 项目中集成和使用本地通知功能。