sys 类型
System variables
索引
属性(properties)
LANGUAGE_ENGLISHStringEnglish language codeLANGUAGE_CHINESEStringChinese language codeLANGUAGE_FRENCHStringFrench language codeLANGUAGE_ITALIANStringItalian language codeLANGUAGE_GERMANStringGerman language codeLANGUAGE_SPANISHStringSpanish language codeLANGUAGE_DUTCHStringSpanish language codeLANGUAGE_RUSSIANStringRussian language codeLANGUAGE_KOREANStringKorean language codeLANGUAGE_JAPANESEStringJapanese language codeLANGUAGE_HUNGARIANStringHungarian language codeLANGUAGE_PORTUGUESEStringPortuguese language codeLANGUAGE_ARABICStringArabic language codeLANGUAGE_NORWEGIANStringNorwegian language codeLANGUAGE_POLISHStringPolish language codeLANGUAGE_TURKISHStringTurkish language codeLANGUAGE_UKRAINIANStringUkrainian language codeLANGUAGE_ROMANIANStringRomanian language codeLANGUAGE_BULGARIANStringBulgarian language codeLANGUAGE_UNKNOWNStringUnknown language codeOS_OPENHARMONYStringOS_IOSStringOS_ANDROIDStringOS_WINDOWSStringOS_MARMALADEStringOS_LINUXStringOS_BADAStringOS_BLACKBERRYStringOS_OSXStringOS_WP8StringOS_WINRTStringOS_UNKNOWNStringUNKNOWNNumberWIN32NumberLINUXNumberMACOSNumberANDROIDNumberIPHONENumberIPADNumberBLACKBERRYNumberNACLNumberEMSCRIPTENNumberTIZENNumberWINRTNumberWP8NumberOPENHARMONYNumberMOBILE_BROWSERNumberDESKTOP_BROWSERNumberEDITOR_PAGENumberIndicates whether executes in editor's window process (Electron's renderer context)EDITOR_CORENumberIndicates whether executes in editor's main process (Electron's browser context)WECHAT_GAMENumberQQ_PLAYNumberFB_PLAYABLE_ADSNumberBAIDU_GAMENumberVIVO_GAMENumberOPPO_GAMENumberHUAWEI_GAMENumberXIAOMI_GAMENumberJKW_GAMENumberALIPAY_GAMENumberWECHAT_GAME_SUBNumberBAIDU_GAME_SUBNumberQTT_GAMENumberBYTEDANCE_GAMENumberBYTEDANCE_GAME_SUBNumberLINKSURENumberTAOBAONumberTAOBAO_MINIGAMENumberBROWSER_TYPE_WECHATStringBROWSER_TYPE_WECHATBROWSER_TYPE_ANDROIDStringBROWSER_TYPE_IEStringBROWSER_TYPE_EDGEStringBROWSER_TYPE_QQStringBROWSER_TYPE_MOBILE_QQStringBROWSER_TYPE_UCStringBROWSER_TYPE_UCBSStringuc third party integration.BROWSER_TYPE_360StringBROWSER_TYPE_BAIDU_APPStringBROWSER_TYPE_BAIDUStringBROWSER_TYPE_MAXTHONStringBROWSER_TYPE_OPERAStringBROWSER_TYPE_OUPENGStringBROWSER_TYPE_MIUIStringBROWSER_TYPE_FIREFOXStringBROWSER_TYPE_SAFARIStringBROWSER_TYPE_CHROMEStringBROWSER_TYPE_LIEBAOStringBROWSER_TYPE_QZONEStringBROWSER_TYPE_SOUGOUStringBROWSER_TYPE_HUAWEIStringBROWSER_TYPE_UNKNOWNStringisNativeBooleanIs native ? This is set to be true in jsb auto.isBrowserBooleanIs web browser ?isMobileBooleanIndicate whether system is mobile systemplatformNumberIndicate the running platformlanguageCodeStringGet current language iso 639-1 code....languageStringIndicate the current language of the running systemosStringIndicate the running os nameosVersionStringIndicate the running os versionosMainVersionNumberIndicate the running os main versionbrowserTypeString | nullIndicate the running browser typebrowserVersionString | nullIndicate the running browser versionwindowPixelResolutionSizeIndicate the real pixel resolution of the whole game windowlocalStorageObjectcc.sys.localStorage is a local storage component.capabilitiesObjectThe capabilities of the current platform
方法
glExtensionIs webgl extension support?getMaxJointMatrixSizeGet max joint matrix size for skinned mesh renderer.getSafeAreaRect返回手机屏幕安全区域(设计分辨率为单位),如果不是异形屏将默认返回 visibleRect。getNetworkType获取当前设备的网络类型, 如果网络类型无法获取,默认将返回 cc.sys.NetworkType.LANgetBatteryLevel获取当前设备的电池电量,如果电量无法获取,默认将返回 1garbageCollectForces the garbage collection, only available in JSBrestartVMRestart the JS VM, only available in JSBisObjectValidIn web engine, it will return true if the object existdumpDump system informationsopenURLOpen a url in browsernowGet the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.
Details
属性(properties)
LANGUAGE_ENGLISH
English language code
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:53 |
LANGUAGE_CHINESE
Chinese language code
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:60 |
LANGUAGE_FRENCH
French language code
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:67 |
LANGUAGE_ITALIAN
Italian language code
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:74 |
LANGUAGE_GERMAN
German language code
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:81 |
LANGUAGE_SPANISH
Spanish language code
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:88 |
LANGUAGE_DUTCH
Spanish language code
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:95 |
LANGUAGE_RUSSIAN
Russian language code
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:102 |
LANGUAGE_KOREAN
Korean language code
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:109 |
LANGUAGE_JAPANESE
Japanese language code
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:116 |
LANGUAGE_HUNGARIAN
Hungarian language code
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:123 |
LANGUAGE_PORTUGUESE
Portuguese language code
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:130 |
LANGUAGE_ARABIC
Arabic language code
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:137 |
LANGUAGE_NORWEGIAN
Norwegian language code
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:144 |
LANGUAGE_POLISH
Polish language code
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:151 |
LANGUAGE_TURKISH
Turkish language code
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:158 |
LANGUAGE_UKRAINIAN
Ukrainian language code
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:165 |
LANGUAGE_ROMANIAN
Romanian language code
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:172 |
LANGUAGE_BULGARIAN
Bulgarian language code
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:179 |
LANGUAGE_UNKNOWN
Unknown language code
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:186 |
OS_OPENHARMONY
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:193 |
OS_IOS
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:198 |
OS_ANDROID
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:203 |
OS_WINDOWS
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:208 |
OS_MARMALADE
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:213 |
OS_LINUX
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:218 |
OS_BADA
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:223 |
OS_BLACKBERRY
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:228 |
OS_OSX
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:233 |
OS_WP8
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:238 |
OS_WINRT
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:243 |
OS_UNKNOWN
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:248 |
UNKNOWN
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:254 |
WIN32
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:260 |
LINUX
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:266 |
MACOS
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:272 |
ANDROID
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:278 |
IPHONE
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:284 |
IPAD
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:290 |
BLACKBERRY
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:296 |
NACL
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:302 |
EMSCRIPTEN
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:308 |
TIZEN
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:314 |
WINRT
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:320 |
WP8
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:326 |
OPENHARMONY
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:332 |
MOBILE_BROWSER
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:338 |
DESKTOP_BROWSER
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:344 |
EDITOR_PAGE
Indicates whether executes in editor's window process (Electron's renderer context)
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:351 |
EDITOR_CORE
Indicates whether executes in editor's main process (Electron's browser context)
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:358 |
WECHAT_GAME
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:365 |
QQ_PLAY
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:371 |
FB_PLAYABLE_ADS
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:377 |
BAIDU_GAME
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:383 |
VIVO_GAME
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:389 |
OPPO_GAME
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:395 |
HUAWEI_GAME
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:401 |
XIAOMI_GAME
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:407 |
JKW_GAME
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:413 |
ALIPAY_GAME
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:419 |
WECHAT_GAME_SUB
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:425 |
BAIDU_GAME_SUB
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:431 |
QTT_GAME
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:437 |
BYTEDANCE_GAME
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:443 |
BYTEDANCE_GAME_SUB
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:449 |
LINKSURE
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:455 |
TAOBAO
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:461 |
TAOBAO_MINIGAME
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:468 |
BROWSER_TYPE_WECHAT
BROWSER_TYPE_WECHAT
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:475 |
BROWSER_TYPE_ANDROID
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:482 |
BROWSER_TYPE_IE
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:489 |
BROWSER_TYPE_EDGE
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:496 |
BROWSER_TYPE_QQ
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:503 |
BROWSER_TYPE_MOBILE_QQ
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:510 |
BROWSER_TYPE_UC
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:517 |
BROWSER_TYPE_UCBS
uc third party integration.
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:524 |
BROWSER_TYPE_360
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:531 |
BROWSER_TYPE_BAIDU_APP
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:538 |
BROWSER_TYPE_BAIDU
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:545 |
BROWSER_TYPE_MAXTHON
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:552 |
BROWSER_TYPE_OPERA
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:559 |
BROWSER_TYPE_OUPENG
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:566 |
BROWSER_TYPE_MIUI
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:573 |
BROWSER_TYPE_FIREFOX
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:580 |
BROWSER_TYPE_SAFARI
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:587 |
BROWSER_TYPE_CHROME
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:594 |
BROWSER_TYPE_LIEBAO
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:601 |
BROWSER_TYPE_QZONE
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:608 |
BROWSER_TYPE_SOUGOU
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:615 |
BROWSER_TYPE_HUAWEI
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:622 |
BROWSER_TYPE_UNKNOWN
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:629 |
isNative
Is native ? This is set to be true in jsb auto.
| meta | description |
|---|---|
| 类型 | Boolean |
| 定义于 | cocos2d/core/platform/CCSys.js:637 |
isBrowser
Is web browser ?
| meta | description |
|---|---|
| 类型 | Boolean |
| 定义于 | cocos2d/core/platform/CCSys.js:643 |
isMobile
Indicate whether system is mobile system
| meta | description |
|---|---|
| 类型 | Boolean |
| 定义于 | cocos2d/core/platform/CCSys.js:810 |
platform
Indicate the running platform
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:816 |
languageCode
Get current language iso 639-1 code. Examples of valid language codes include "zh-tw", "en", "en-us", "fr", "fr-fr", "es-es", etc. The actual value totally depends on results provided by destination platform.
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:831 |
language
Indicate the current language of the running system
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:841 |
os
Indicate the running os name
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:880 |
osVersion
Indicate the running os version
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/platform/CCSys.js:885 |
osMainVersion
Indicate the running os main version
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:890 |
browserType
Indicate the running browser type
| meta | description |
|---|---|
| 类型 | String | Null |
| 定义于 | cocos2d/core/platform/CCSys.js:896 |
browserVersion
Indicate the running browser version
| meta | description |
|---|---|
| 类型 | String | Null |
| 定义于 | cocos2d/core/platform/CCSys.js:934 |
windowPixelResolution
Indicate the real pixel resolution of the whole game window
| meta | description |
|---|---|
| 类型 | Size |
| 定义于 | cocos2d/core/platform/CCSys.js:952 |
localStorage
cc.sys.localStorage is a local storage component.
| meta | description |
|---|---|
| 类型 | Object |
| 定义于 | cocos2d/core/platform/CCSys.js:985 |
capabilities
The capabilities of the current platform
| meta | description |
|---|---|
| 类型 | Object |
| 定义于 | cocos2d/core/platform/CCSys.js:1016 |
方法
glExtension
Is webgl extension support?
| meta | description |
|---|---|
| 返回 | Boolean |
| 定义于 | cocos2d/core/platform/CCSys.js:649 |
参数列表
nameUnknown
getMaxJointMatrixSize
Get max joint matrix size for skinned mesh renderer.
| meta | description |
|---|---|
| 定义于 | cocos2d/core/platform/CCSys.js:659 |
getSafeAreaRect
返回手机屏幕安全区域(设计分辨率为单位),如果不是异形屏将默认返回 visibleRect。目前支持安卓、iOS 原生平台和微信小游戏平台。
| meta | description |
|---|---|
| 返回 | Rect |
| 定义于 | cocos2d/core/platform/CCSys.js:680 |
getNetworkType
获取当前设备的网络类型, 如果网络类型无法获取,默认将返回 cc.sys.NetworkType.LAN
| meta | description |
|---|---|
| 返回 | sys.NetworkType |
| 定义于 | cocos2d/core/platform/CCSys.js:1177 |
getBatteryLevel
获取当前设备的电池电量,如果电量无法获取,默认将返回 1
| meta | description |
|---|---|
| 返回 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:1191 |
garbageCollect
Forces the garbage collection, only available in JSB
| meta | description |
|---|---|
| 定义于 | cocos2d/core/platform/CCSys.js:1205 |
restartVM
Restart the JS VM, only available in JSB
| meta | description |
|---|---|
| 定义于 | cocos2d/core/platform/CCSys.js:1213 |
isObjectValid
Check whether an object is valid, In web engine, it will return true if the object exist In native engine, it will return true if the JS object and the correspond native object are both valid
| meta | description |
|---|---|
| 返回 | Boolean |
| 定义于 | cocos2d/core/platform/CCSys.js:1221 |
参数列表
objObject
dump
Dump system informations
| meta | description |
|---|---|
| 定义于 | cocos2d/core/platform/CCSys.js:1236 |
openURL
Open a url in browser
| meta | description |
|---|---|
| 定义于 | cocos2d/core/platform/CCSys.js:1255 |
参数列表
urlString
now
Get the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.
| meta | description |
|---|---|
| 返回 | Number |
| 定义于 | cocos2d/core/platform/CCSys.js:1269 |