sys 类型

模块: _decorator父模块: cc

System variables

索引

属性(properties)
方法
  • getNetworkType 获取当前设备的网络类型, 如果网络类型无法获取,默认将返回 cc.sys.NetworkType.LAN
  • getBatteryLevel 获取当前设备的电池电量,如果电量无法获取,默认将返回 1
  • garbageCollect Forces the garbage collection, only available in JSB
  • restartVM Restart the JS VM, only available in JSB
  • getSafeAreaRect 返回手机屏幕安全区域,目前仅在 iOS 原生平台有效。
  • isObjectValid In web engine, it will return true if the object exist
  • dump Dump system informations
  • openURL Open a url in browser
  • now Get the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.

Details

属性(properties)

LANGUAGE_ENGLISH
English language code
metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:40
LANGUAGE_CHINESE
Chinese language code
metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:47
LANGUAGE_FRENCH
French language code
metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:54
LANGUAGE_ITALIAN
Italian language code
metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:61
LANGUAGE_GERMAN
German language code
metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:68
LANGUAGE_SPANISH
Spanish language code
metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:75
LANGUAGE_DUTCH
Spanish language code
metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:82
LANGUAGE_RUSSIAN
Russian language code
metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:89
LANGUAGE_KOREAN
Korean language code
metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:96
LANGUAGE_JAPANESE
Japanese language code
metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:103
LANGUAGE_HUNGARIAN
Hungarian language code
metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:110
LANGUAGE_PORTUGUESE
Portuguese language code
metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:117
LANGUAGE_ARABIC
Arabic language code
metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:124
LANGUAGE_NORWEGIAN
Norwegian language code
metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:131
LANGUAGE_POLISH
Polish language code
metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:138
LANGUAGE_TURKISH
Turkish language code
metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:145
LANGUAGE_UKRAINIAN
Ukrainian language code
metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:152
LANGUAGE_ROMANIAN
Romanian language code
metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:159
LANGUAGE_BULGARIAN
Bulgarian language code
metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:166
LANGUAGE_UNKNOWN
Unknown language code
metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:173
OS_IOS

metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:180
OS_ANDROID

metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:185
OS_WINDOWS

metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:190
OS_MARMALADE

metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:195
OS_LINUX

metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:200
OS_BADA

metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:205
OS_BLACKBERRY

metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:210
OS_OSX

metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:215
OS_WP8

metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:220
OS_WINRT

metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:225
OS_UNKNOWN

metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:230
UNKNOWN

metadescription
类型Number
定义于cocos2d/core/platform/CCSys.js:236
WIN32

metadescription
类型Number
定义于cocos2d/core/platform/CCSys.js:242
LINUX

metadescription
类型Number
定义于cocos2d/core/platform/CCSys.js:248
MACOS

metadescription
类型Number
定义于cocos2d/core/platform/CCSys.js:254
ANDROID

metadescription
类型Number
定义于cocos2d/core/platform/CCSys.js:260
IPHONE

metadescription
类型Number
定义于cocos2d/core/platform/CCSys.js:266
IPAD

metadescription
类型Number
定义于cocos2d/core/platform/CCSys.js:272
BLACKBERRY

metadescription
类型Number
定义于cocos2d/core/platform/CCSys.js:278
NACL

metadescription
类型Number
定义于cocos2d/core/platform/CCSys.js:284
EMSCRIPTEN

metadescription
类型Number
定义于cocos2d/core/platform/CCSys.js:290
TIZEN

metadescription
类型Number
定义于cocos2d/core/platform/CCSys.js:296
WINRT

metadescription
类型Number
定义于cocos2d/core/platform/CCSys.js:302
WP8

metadescription
类型Number
定义于cocos2d/core/platform/CCSys.js:308
MOBILE_BROWSER

metadescription
类型Number
定义于cocos2d/core/platform/CCSys.js:314
DESKTOP_BROWSER

metadescription
类型Number
定义于cocos2d/core/platform/CCSys.js:320
EDITOR_PAGE
Indicates whether executes in editor's window process (Electron's renderer context)
metadescription
类型Number
定义于cocos2d/core/platform/CCSys.js:327
EDITOR_CORE
Indicates whether executes in editor's main process (Electron's browser context)
metadescription
类型Number
定义于cocos2d/core/platform/CCSys.js:334
WECHAT_GAME

metadescription
类型Number
定义于cocos2d/core/platform/CCSys.js:341
QQ_PLAY

metadescription
类型Number
定义于cocos2d/core/platform/CCSys.js:347
FB_PLAYABLE_ADS

metadescription
类型Number
定义于cocos2d/core/platform/CCSys.js:353
BROWSER_TYPE_WECHAT
BROWSER_TYPE_WECHAT
metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:359
BROWSER_TYPE_WECHAT_GAME
BROWSER_TYPE_WECHAT_GAME
metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:366
BROWSER_TYPE_WECHAT_GAME_SUB
BROWSER_TYPE_WECHAT_GAME_SUB
metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:373
BROWSER_TYPE_QQ_PLAY
BROWSER_TYPE_QQ_PLAY
metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:380
BROWSER_TYPE_ANDROID

metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:387
BROWSER_TYPE_IE

metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:394
BROWSER_TYPE_QQ

metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:401
BROWSER_TYPE_MOBILE_QQ

metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:408
BROWSER_TYPE_UC

metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:415
BROWSER_TYPE_UCBS
uc third party integration.
metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:422
BROWSER_TYPE_360

metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:429
BROWSER_TYPE_BAIDU_APP

metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:436
BROWSER_TYPE_BAIDU

metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:443
BROWSER_TYPE_MAXTHON

metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:450
BROWSER_TYPE_OPERA

metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:457
BROWSER_TYPE_OUPENG

metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:464
BROWSER_TYPE_MIUI

metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:471
BROWSER_TYPE_FIREFOX

metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:478
BROWSER_TYPE_SAFARI

metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:485
BROWSER_TYPE_CHROME

metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:492
BROWSER_TYPE_LIEBAO

metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:499
BROWSER_TYPE_QZONE

metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:506
BROWSER_TYPE_SOUGOU

metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:513
BROWSER_TYPE_UNKNOWN

metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:520
isNative
Is native ? This is set to be true in jsb auto.
metadescription
类型Boolean
定义于cocos2d/core/platform/CCSys.js:528
isBrowser
Is web browser ?
metadescription
类型Boolean
定义于cocos2d/core/platform/CCSys.js:535
isMobile
Indicate whether system is mobile system
metadescription
类型Boolean
定义于cocos2d/core/platform/CCSys.js:720
platform
Indicate the running platform
metadescription
类型Number
定义于cocos2d/core/platform/CCSys.js:726
language
Indicate the current language of the running system
metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:742
os
Indicate the running os name
metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:776
osVersion
Indicate the running os version
metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:781
osMainVersion
Indicate the running os main version
metadescription
类型Number
定义于cocos2d/core/platform/CCSys.js:786
browserType
Indicate the running browser type
metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:792
browserVersion
Indicate the running browser version
metadescription
类型String
定义于cocos2d/core/platform/CCSys.js:829
windowPixelResolution
Indicate the real pixel resolution of the whole game window
metadescription
类型Size
定义于cocos2d/core/platform/CCSys.js:847
localStorage
cc.sys.localStorage is a local storage component.
metadescription
类型Object
定义于cocos2d/core/platform/CCSys.js:880
capabilities
The capabilities of the current platform
metadescription
类型Object
定义于cocos2d/core/platform/CCSys.js:914



#### 方法



##### getNetworkType


获取当前设备的网络类型, 如果网络类型无法获取,默认将返回 cc.sys.NetworkType.LAN

metadescription
返回NetworkType
定义于cocos2d/core/platform/CCSys.js:1065
getBatteryLevel

获取当前设备的电池电量,如果电量无法获取,默认将返回 1

metadescription
返回Number
定义于cocos2d/core/platform/CCSys.js:1079
garbageCollect

Forces the garbage collection, only available in JSB

metadescription
定义于cocos2d/core/platform/CCSys.js:1093
restartVM

Restart the JS VM, only available in JSB

metadescription
定义于cocos2d/core/platform/CCSys.js:1101
getSafeAreaRect

返回手机屏幕安全区域,目前仅在 iOS 原生平台有效。其它平台将默认返回设计分辨率尺寸。

metadescription
返回Rect
定义于cocos2d/core/platform/CCSys.js:1109
isObjectValid

Check whether an object is valid,In web engine, it will return true if the object existIn native engine, it will return true if the JS object and the correspond native object are both valid

metadescription
返回Boolean
定义于cocos2d/core/platform/CCSys.js:1123
参数列表
dump

Dump system informations

metadescription
定义于cocos2d/core/platform/CCSys.js:1138
openURL

Open a url in browser

metadescription
定义于cocos2d/core/platform/CCSys.js:1157
参数列表
now

Get the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.

metadescription
返回Number
定义于cocos2d/core/platform/CCSys.js:1171