This commit is contained in:
dgflash
2025-05-26 09:26:37 +08:00
parent 71c91aef96
commit c851b21c70

View File

@@ -8,7 +8,7 @@ import { __private, native, sys } from "cc";
/** 平台数据 */
export class PlatformUtil {
/** 获取当前设备的网络类型, 如果网络类型无法获取,默认将返回 `sys.NetworkType.LAN` */
getNetworkType(): __private._pal_system_info_enum_type_network_type__NetworkType {
static getNetworkType(): __private._pal_system_info_enum_type_network_type__NetworkType {
return sys.getNetworkType();
}
@@ -16,17 +16,17 @@ export class PlatformUtil {
* 获取当前设备的电池电量,如果电量无法获取,默认将返回 1
* @return - 0.0 ~ 1.0
*/
getBatteryLevel(): number {
static getBatteryLevel(): number {
return sys.getBatteryLevel();
}
/** 尝试打开一个 web 页面,并非在所有平台都有效 */
openURL(url: string) {
static openURL(url: string) {
sys.openURL(url);
}
/** 拷贝字符串到剪切板 */
copyText(text: string) {
static copyText(text: string) {
native.copyTextToClipboard(text);
}
}