Options
All
  • Public
  • Public/Protected
  • All
Menu

Module core

Index

References

Enumerations

Classes

Interfaces

Type aliases

Events

Variables

Functions

Object literals

References

AffineTransform

Re-exports AffineTransform

AnimCurve

Re-exports AnimCurve

Animation

Re-exports Animation

AnimationClip

Re-exports AnimationClip

AnimationComponent

Renames and re-exports Animation

AnimationManager

Re-exports AnimationManager

AnimationState

Re-exports AnimationState

Asset

Re-exports Asset

AssetLibrary

Re-exports AssetLibrary

AssetManager

Re-exports AssetManager

BaseNode

Re-exports BaseNode

BezierControlPoints

Re-exports BezierControlPoints

BitMask

Re-exports BitMask

BufferAsset

Re-exports BufferAsset

CCBoolean

Re-exports CCBoolean

CCFloat

Re-exports CCFloat

CCInteger

Re-exports CCInteger

CCLoader

Re-exports CCLoader

CCObject

Re-exports CCObject

CCString

Re-exports CCString

CachedArray

Re-exports CachedArray

Camera

Re-exports Camera

CameraComponent

Renames and re-exports Camera

Color

Re-exports Color

CompactValueTypeArray

Re-exports CompactValueTypeArray

Component

Re-exports Component

CubicSplineNumberValue

Re-exports CubicSplineNumberValue

CubicSplineQuatValue

Re-exports CubicSplineQuatValue

CubicSplineVec2Value

Re-exports CubicSplineVec2Value

CubicSplineVec3Value

Re-exports CubicSplineVec3Value

CubicSplineVec4Value

Re-exports CubicSplineVec4Value

CurveTarget

Re-exports CurveTarget

CurveValue

Re-exports CurveValue

DebugMode

Re-exports DebugMode

Director

Re-exports Director

EPSILON

Re-exports EPSILON

EasingMethod

Re-exports EasingMethod

EasingMethodName

Re-exports EasingMethodName

EffectAsset

Re-exports EffectAsset

Enum

Renames and re-exports valuetypes

Event

Re-exports Event

EventAcceleration

Re-exports EventAcceleration

EventHandler

Re-exports EventHandler

EventInfo

Re-exports EventInfo

EventKeyboard

Re-exports EventKeyboard

EventMouse

Re-exports EventMouse

EventTarget

Re-exports EventTarget

EventTouch

Re-exports EventTouch

Eventify

Re-exports Eventify

ForwardFlow

Re-exports ForwardFlow

ForwardPipeline

Re-exports ForwardPipeline

ForwardStage

Re-exports ForwardStage

GFXAPI

Renames and re-exports API

GFXAddress

Renames and re-exports Address

GFXAttribute

Renames and re-exports Attribute

GFXAttributeName

Renames and re-exports AttributeName

GFXBindingMappingInfo

Renames and re-exports BindingMappingInfo

GFXBlendFactor

Renames and re-exports BlendFactor

GFXBlendOp

Renames and re-exports BlendOp

GFXBlendState

Renames and re-exports BlendState

GFXBlendTarget

Renames and re-exports BlendTarget

GFXBuffer

Renames and re-exports Buffer

GFXBufferAccessBit

Renames and re-exports BufferAccessBit

GFXBufferFlagBit

Renames and re-exports BufferFlagBit

GFXBufferInfo

Renames and re-exports BufferInfo

GFXBufferTextureCopy

Renames and re-exports BufferTextureCopy

GFXBufferUsageBit

Renames and re-exports BufferUsageBit

GFXBufferViewInfo

Renames and re-exports BufferViewInfo

GFXClearFlag

Renames and re-exports ClearFlag

GFXColor

Renames and re-exports Color

GFXColorAttachment

Renames and re-exports ColorAttachment

GFXColorMask

Renames and re-exports ColorMask

GFXCommandBuffer

Renames and re-exports CommandBuffer

GFXCommandBufferInfo

Renames and re-exports CommandBufferInfo

GFXCommandBufferType

Renames and re-exports CommandBufferType

GFXComparisonFunc

Renames and re-exports ComparisonFunc

GFXCullMode

Renames and re-exports CullMode

GFXDepthStencilAttachment

Renames and re-exports DepthStencilAttachment

GFXDepthStencilState

Renames and re-exports DepthStencilState

GFXDescriptorSet

Renames and re-exports DescriptorSet

GFXDescriptorSetInfo

Renames and re-exports DescriptorSetInfo

GFXDescriptorSetLayout

Renames and re-exports DescriptorSetLayout

GFXDescriptorSetLayoutBinding

Renames and re-exports DescriptorSetLayoutBinding

GFXDescriptorSetLayoutInfo

Renames and re-exports DescriptorSetLayoutInfo

GFXDescriptorType

Renames and re-exports DescriptorType

GFXDevice

Renames and re-exports Device

GFXDeviceInfo

Renames and re-exports DeviceInfo

GFXDrawInfo

Renames and re-exports DrawInfo

GFXDynamicStateFlagBit

Renames and re-exports DynamicStateFlagBit

GFXExtent

Renames and re-exports Extent

GFXFeature

Renames and re-exports Feature

GFXFence

Renames and re-exports Fence

GFXFenceInfo

Renames and re-exports FenceInfo

GFXFilter

Renames and re-exports Filter

GFXFormat

Renames and re-exports Format

GFXFormatInfo

Renames and re-exports FormatInfo

GFXFormatInfos

Renames and re-exports FormatInfos

GFXFormatSize

Renames and re-exports FormatSize

GFXFormatSurfaceSize

Renames and re-exports FormatSurfaceSize

GFXFormatType

Renames and re-exports FormatType

GFXFramebuffer

Renames and re-exports Framebuffer

GFXFramebufferInfo

Renames and re-exports FramebufferInfo

GFXIndirectBuffer

Renames and re-exports IndirectBuffer

GFXInputAssembler

Renames and re-exports InputAssembler

GFXInputAssemblerInfo

Renames and re-exports InputAssemblerInfo

GFXInputState

Renames and re-exports InputState

GFXLoadOp

Renames and re-exports LoadOp

GFXMemoryStatus

Renames and re-exports MemoryStatus

GFXMemoryUsageBit

Renames and re-exports MemoryUsageBit

GFXObject

Renames and re-exports Obj

GFXObjectType

Renames and re-exports ObjectType

GFXOffset

Renames and re-exports Offset

GFXPipelineBindPoint

Renames and re-exports PipelineBindPoint

GFXPipelineLayout

Renames and re-exports PipelineLayout

GFXPipelineLayoutInfo

Renames and re-exports PipelineLayoutInfo

GFXPipelineState

Renames and re-exports PipelineState

GFXPipelineStateInfo

Renames and re-exports PipelineStateInfo

GFXPolygonMode

Renames and re-exports PolygonMode

GFXPrimitiveMode

Renames and re-exports PrimitiveMode

GFXQueue

Renames and re-exports Queue

GFXQueueInfo

Renames and re-exports QueueInfo

GFXQueueType

Renames and re-exports QueueType

GFXRasterizerState

Renames and re-exports RasterizerState

GFXRect

Renames and re-exports Rect

GFXRenderPass

Renames and re-exports RenderPass

GFXRenderPassInfo

Renames and re-exports RenderPassInfo

GFXSampleCount

Renames and re-exports SampleCount

GFXSampler

Renames and re-exports Sampler

GFXSamplerInfo

Renames and re-exports SamplerInfo

GFXShadeModel

Renames and re-exports ShadeModel

GFXShader

Renames and re-exports Shader

GFXShaderInfo

Renames and re-exports ShaderInfo

GFXShaderStage

Renames and re-exports ShaderStage

GFXShaderStageFlagBit

Renames and re-exports ShaderStageFlagBit

GFXStencilFace

Renames and re-exports StencilFace

GFXStencilOp

Renames and re-exports StencilOp

GFXStoreOp

Renames and re-exports StoreOp

GFXSubPassInfo

Renames and re-exports SubPassInfo

GFXSurfaceTransform

Renames and re-exports SurfaceTransform

GFXTexture

Renames and re-exports Texture

GFXTextureCopy

Renames and re-exports TextureCopy

GFXTextureFlagBit

Renames and re-exports TextureFlagBit

GFXTextureInfo

Renames and re-exports TextureInfo

GFXTextureLayout

Renames and re-exports TextureLayout

GFXTextureSubres

Renames and re-exports TextureSubres

GFXTextureType

Renames and re-exports TextureType

GFXTextureUsageBit

Renames and re-exports TextureUsageBit

GFXTextureViewInfo

Renames and re-exports TextureViewInfo

GFXType

Renames and re-exports Type

GFXUniform

Renames and re-exports Uniform

GFXUniformBlock

Renames and re-exports UniformBlock

GFXUniformSampler

Renames and re-exports UniformSampler

GFXViewport

Renames and re-exports Viewport

GFX_DESCRIPTOR_BUFFER_TYPE

Renames and re-exports DESCRIPTOR_BUFFER_TYPE

GFX_DESCRIPTOR_DYNAMIC_TYPE

Renames and re-exports DESCRIPTOR_DYNAMIC_TYPE

GFX_DESCRIPTOR_SAMPLER_TYPE

Renames and re-exports DESCRIPTOR_SAMPLER_TYPE

GFX_DRAW_INFO_SIZE

Renames and re-exports DRAW_INFO_SIZE

GFX_MAX_ATTACHMENTS

Renames and re-exports MAX_ATTACHMENTS

Game

Re-exports Game

IAnimationEvent

Re-exports IAnimationEvent

IAnimationEventGroup

Re-exports IAnimationEventGroup

IColorLike

Re-exports IColorLike

IComponentsCurveData

Re-exports IComponentsCurveData

IGameConfig

Re-exports IGameConfig

IMat3Like

Re-exports IMat3Like

IMat4Like

Re-exports IMat4Like

INodeCurveData

Re-exports INodeCurveData

IObjectCurveData

Re-exports IObjectCurveData

IPropertyCurveData

Re-exports IPropertyCurveData

IQuatLike

Re-exports IQuatLike

IRectLike

Re-exports IRectLike

IRuntimeCurve

Re-exports IRuntimeCurve

ISchedulable

Re-exports ISchedulable

ISizeLike

Re-exports ISizeLike

IVec2Like

Re-exports IVec2Like

IVec3Like

Re-exports IVec3Like

IVec4Like

Re-exports IVec4Like

ImageAsset

Re-exports ImageAsset

JavaScript

Re-exports JavaScript

JsonAsset

Re-exports JsonAsset

Layers

Re-exports Layers

Mat3

Re-exports Mat3

Mat4

Re-exports Mat4

Material

Re-exports Material

MissingScript

Re-exports MissingScript

Node

Re-exports Node

NodeActivator

Re-exports NodeActivator

Pool

Re-exports Pool

Prefab

Re-exports Prefab

PrefabLink

Re-exports PrefabLink

PrivateNode

Re-exports PrivateNode

Quat

Re-exports Quat

RatioSampler

Re-exports RatioSampler

Rect

Re-exports Rect

RecyclePool

Re-exports RecyclePool

RenderFlow

Re-exports RenderFlow

RenderPipeline

Re-exports RenderPipeline

RenderStage

Re-exports RenderStage

RenderTexture

Re-exports RenderTexture

RenderableComponent

Re-exports RenderableComponent

RenderingSubMesh

Re-exports RenderingSubMesh

ResolutionPolicy

Re-exports ResolutionPolicy

Scene

Re-exports Scene

SceneAsset

Re-exports SceneAsset

Scheduler

Re-exports Scheduler

Script

Re-exports Script

ShadowFlow

Re-exports ShadowFlow

ShadowStage

Re-exports ShadowStage

Size

Re-exports Size

SystemEvent

Re-exports SystemEvent

SystemEventType

Re-exports SystemEventType

TextAsset

Re-exports TextAsset

Texture2D

Re-exports Texture2D

TextureCube

Re-exports TextureCube

Touch

Re-exports Touch

TypeScript

Re-exports TypeScript

VERSION

Renames and exports engineVersion

ValueType

Re-exports ValueType

Vec2

Re-exports Vec2

Vec3

Re-exports Vec3

Vec4

Re-exports Vec4

View

Re-exports View

WorldNode3DToLocalNodeUI

Re-exports WorldNode3DToLocalNodeUI

WorldNode3DToWorldNodeUI

Re-exports WorldNode3DToWorldNodeUI

_decorator

Re-exports _decorator

absMax

Re-exports absMax

absMaxComponent

Re-exports absMaxComponent

approx

Re-exports approx

assert

Re-exports assert

assertID

Re-exports assertID

assetManager

Re-exports assetManager

bezier

Re-exports bezier

bezierByTime

Re-exports bezierByTime

bits

Renames and re-exports math

builtinResMgr

Re-exports builtinResMgr

ccenum

Re-exports ccenum

clamp

Re-exports clamp

clamp01

Re-exports clamp01

color

Re-exports color

computeRatioByType

Re-exports computeRatioByType

convertUtils

Re-exports convertUtils

director

Re-exports director

easing

Re-exports easing

effects

Re-exports effects

equals

Re-exports equals

error

Re-exports error

errorID

Re-exports errorID

find

Re-exports find

game

Re-exports game

getError

Re-exports getError

getPathFromRoot

Re-exports getPathFromRoot

getWorldTransformUntilRoot

Re-exports getWorldTransformUntilRoot

instantiate

Re-exports instantiate

inverseLerp

Re-exports inverseLerp

isDisplayStats

Re-exports isDisplayStats

isValid

Re-exports isValid

js

Re-exports js

lerp

Re-exports lerp

loader

Re-exports loader

log

Re-exports log

logID

Re-exports logID

macro

Re-exports macro

markAsWarning

Re-exports markAsWarning

mat4

Re-exports mat4

misc

Re-exports misc

murmurhash2_32_gc

Re-exports murmurhash2_32_gc

nextPow2

Re-exports nextPow2

path

Re-exports path

pingPong

Re-exports pingPong

pseudoRandom

Re-exports pseudoRandom

pseudoRandomRange

Re-exports pseudoRandomRange

pseudoRandomRangeInt

Re-exports pseudoRandomRangeInt

quat

Re-exports quat

random

Re-exports random

randomRange

Re-exports randomRange

randomRangeInt

Re-exports randomRangeInt

rect

Re-exports rect

removeProperty

Re-exports removeProperty

repeat

Re-exports repeat

replaceProperty

Re-exports replaceProperty

resources

Re-exports resources

sampleAnimationCurve

Re-exports sampleAnimationCurve

screen

Re-exports screen

setDefaultLogTimes

Re-exports setDefaultLogTimes

setDisplayStats

Re-exports setDisplayStats

size

Re-exports size

sys

Re-exports sys

systemEvent

Re-exports systemEvent

toDegree

Re-exports toDegree

toRadian

Re-exports toRadian

url

Re-exports url

v2

Re-exports v2

v3

Re-exports v3

v4

Re-exports v4

view

Re-exports view

warn

Re-exports warn

warnID

Re-exports warnID

Type aliases

NormalizedGameConfig

NormalizedGameConfig: IGameConfig & { frameRate: NonNullable<IGameConfig["frameRate"]> }

Events

AdaptResult

AdaptResult:

!en Emit when design resolution changed. !zh 当设计分辨率改变时发送。

scale

scale: number[]

Optional viewport

viewport: null | Rect

Variables

Const ERROR_MAP_URL

ERROR_MAP_URL: "https://github.com/cocos-creator/engine/blob/3d/EngineErrorMap.md" = "https://github.com/cocos-creator/engine/blob/3d/EngineErrorMap.md"

Const MAX_POOL_SIZE

MAX_POOL_SIZE: 20 = 20

Const SUPPORT_TEXTURE_FORMATS

SUPPORT_TEXTURE_FORMATS: string[] = ['.astc', '.pkm', '.pvr', '.webp', '.jpg', '.jpeg', '.bmp', '.png']

Const __BrowserGetter

__BrowserGetter: BrowserGetter = new BrowserGetter()

Const _global

_global: any = typeof window === 'undefined' ? global : window

Const assertFormatter

assertFormatter: (Anonymous function) = getTypedFormatter('Assert')

Let ccError

ccError: log = ccLog

Let ccLog

ccLog: log = console.log.bind(console)

Let ccWarn

ccWarn: log = ccLog

Const director

director: Director = Director.instance = legacyCC.director = new Director()

导演类。

Const engineVersion

engineVersion: "3.0.0" = "3.0.0"

Const errorFormatter

errorFormatter: (Anonymous function) = getTypedFormatter('Error')

Const game

game: Game = legacyCC.game = new Game()
en

This is a Game instance.

zh

这是一个 Game 类的实例,包含游戏主体信息并负责驱动游戏的游戏对象。

Const idGenerator

idGenerator: IDGenerator = new IdGenerator('Scheduler')

Const logFormatter

logFormatter: (Anonymous function) = getTypedFormatter('Log')

Let logList

logList: HTMLTextAreaElement | null = null

Const view

view: View = View.instance = legacyCC.view = new View()
en

view is the singleton view object.

zh

view 是全局的视图单例对象。

Const warnFormatter

warnFormatter: (Anonymous function) = getTypedFormatter('Warning')

Functions

resetDebugSetting

throw

  • throw(error_: any): void

assert

  • assert(value: any, message?: undefined | string, ...optionalParams: any[]): void
  • 对检查测试条件进行检查,如果条件不为 true 则输出错误消息

    Parameters

    • value: any

      The condition to check on

    • Optional message: undefined | string

      A JavaScript string containing zero or more substitution strings.

    • Rest ...optionalParams: any[]

      JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.

    Returns void

assertID

  • assertID(condition: any, id: number, ...optionalParams: any[]): void

Let ccAssert

  • ccAssert(condition: any, message?: any, ...optionalParams: any[]): void

error

  • error(message?: any, ...optionalParams: any[]): void
  • 输出错误消息到 Cocos Creator 编辑器的 Console 或运行时页面端的 Console 中。

    • 在 Cocos Creator 中,错误信息显示是红色的。
    • 在 Chrome 中,错误信息有红色的图标以及红色的消息文本。

    Parameters

    • Optional message: any

      A JavaScript string containing zero or more substitution strings.

    • Rest ...optionalParams: any[]

      JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.

    Returns void

errorID

  • errorID(id: number, ...optionalParams: any[]): void

formatString

  • formatString(message?: any, ...optionalParams: any[]): any

getError

  • getError(errorId: number, ...param: any[]): string
  • 通过 error id 和必要的参数来获取错误信息。

    Parameters

    • errorId: number
    • Rest ...param: any[]

    Returns string

getTypedFormatter

  • getTypedFormatter(type: "Log" | "Warning" | "Error" | "Assert"): (Anonymous function)

isDisplayStats

  • isDisplayStats(): boolean

log

  • log(message?: any, ...optionalParams: any[]): void
  • 输出一条消息到 Cocos Creator 编辑器的 Console 或运行时 Web 端的 Console 中。

    Parameters

    • Optional message: any

      A JavaScript string containing zero or more substitution strings.

    • Rest ...optionalParams: any[]

      JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.

    Returns void

logID

  • logID(id: number, ...optionalParams: any[]): void

setDisplayStats

  • setDisplayStats(displayStats: boolean): void

warn

  • warn(message?: any, ...optionalParams: any[]): void
  • 输出警告消息到 Cocos Creator 编辑器的 Console 或运行时 Web 端的 Console 中。

    • 在 Cocos Creator 中,警告信息显示是黄色的。
    • 在 Chrome 中,警告信息有着黄色的图标以及黄色的消息文本。

    Parameters

    • Optional message: any

      A JavaScript string containing zero or more substitution strings.

    • Rest ...optionalParams: any[]

      JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output.

    Returns void

warnID

  • warnID(id: number, ...optionalParams: any[]): void

Object literals

Const KEY

KEY: object

*

*: number = 106
en

The numeric keypad '*'

zh

数字键盘 *

readonly

+

+: number = 107
en

The numeric keypad '+'

zh

数字键盘 +

readonly

,

,: number = 188
en

The ',' key.

zh

逗号键

readonly

-

-: number = 109
en

The numeric keypad '-'

zh

数字键盘 -

readonly

.

.: number = 190
en

The '.' key.

zh

句号键

readonly

/

/: number = 111
en

The numeric keypad '/'

zh

数字键盘 /

readonly

0

0: number = 48
en

The '0' key on the top of the alphanumeric keyboard.

zh

字母键盘上的 0 键

readonly

1

1: number = 49
en

The '1' key on the top of the alphanumeric keyboard.

zh

字母键盘上的 1 键

readonly

2

2: number = 50
en

The '2' key on the top of the alphanumeric keyboard.

zh

字母键盘上的 2 键

readonly

3

3: number = 51
en

The '3' key on the top of the alphanumeric keyboard.

zh

字母键盘上的 3 键

readonly

4

4: number = 52
en

The '4' key on the top of the alphanumeric keyboard.

zh

字母键盘上的 4 键

readonly

5

5: number = 53
en

The '5' key on the top of the alphanumeric keyboard.

zh

字母键盘上的 5 键

readonly

6

6: number = 54
en

The '6' key on the top of the alphanumeric keyboard.

zh

字母键盘上的 6 键

readonly

7

7: number = 55
en

The '7' key on the top of the alphanumeric keyboard.

zh

字母键盘上的 7 键

readonly

8

8: number = 56
en

The '8' key on the top of the alphanumeric keyboard.

zh

字母键盘上的 8 键

readonly

9

9: number = 57
en

The '9' key on the top of the alphanumeric keyboard.

zh

字母键盘上的 9 键

readonly

;

;: number = 186
en

The ';' key.

zh

分号键

readonly

=

=: number = 187
en

The '=' key.

zh

等于号键

readonly

Delete

Delete: number = 46
en

The Delete key

zh

删除键

readonly

[

[: number = 219
en

The '[' key

zh

按键 [

readonly

]

]: number = 221
en

The ']' key

zh

按键 ]

readonly

a

a: number = 65
en

The a key

zh

A 键

readonly

alt

alt: number = 18
en

The alt key

zh

Alt 键

readonly

b

b: number = 66
en

The b key

zh

B 键

readonly

back

back: number = 6
en

The back key

zh

返回键

readonly

backslash

backslash: number = 220
en

The '' key

zh

反斜杠键

readonly

backspace

backspace: number = 8
en

The backspace key

zh

退格键

readonly

c

c: number = 67
en

The c key

zh

C 键

readonly

capslock

capslock: number = 20
en

The caps lock key

zh

大写锁定键

readonly

closebracket

closebracket: number = 221
en

The ']' key

zh

按键 ]

readonly

comma

comma: number = 188
en

The ',' key.

zh

逗号键

readonly

ctrl

ctrl: number = 17
en

The ctrl key

zh

Ctrl 键

readonly

d

d: number = 68
en

The d key

zh

D 键

readonly

dash

dash: number = 189
en

The dash '-' key.

zh

中划线键

readonly

down

down: number = 40
en

The down key

zh

向下箭头键

readonly

dpadCenter

dpadCenter: number = 1005
en

The dpad center key

zh

导航键 确定键

readonly

dpadDown

dpadDown: number = 1004
en

The dpad down key

zh

导航键 向下

readonly

dpadLeft

dpadLeft: number = 1000
en

The dpad left key

zh

导航键 向左

readonly

dpadRight

dpadRight: number = 1001
en

The dpad right key

zh

导航键 向右

readonly

dpadUp

dpadUp: number = 1003
en

The dpad up key

zh

导航键 向上

readonly

e

e: number = 69
en

The e key

zh

E 键

readonly

end

end: number = 35
en

The end key

zh

结束键

readonly

enter

enter: number = 13
en

The enter key

zh

回车键

readonly

equal

equal: number = 187
en

The '=' key.

zh

等于号键

readonly

escape

escape: number = 27
en

The esc key

zh

ESC 键

readonly

f

f: number = 70
en

The f key

zh

F 键

readonly

f1

f1: number = 112
en

The F1 function key

zh

F1 功能键

readonly

f10

f10: number = 121
en

The F10 function key

zh

F10 功能键

readonly

f11

f11: number = 122
en

The F11 function key

zh

F11 功能键

readonly

f12

f12: number = 123
en

The F12 function key

zh

F12 功能键

readonly

f2

f2: number = 113
en

The F2 function key

zh

F2 功能键

readonly

f3

f3: number = 114
en

The F3 function key

zh

F3 功能键

readonly

f4

f4: number = 115
en

The F4 function key

zh

F4 功能键

readonly

f5

f5: number = 116
en

The F5 function key

zh

F5 功能键

readonly

f6

f6: number = 117
en

The F6 function key

zh

F6 功能键

readonly

f7

f7: number = 118
en

The F7 function key

zh

F7 功能键

readonly

f8

f8: number = 119
en

The F8 function key

zh

F8 功能键

readonly

f9

f9: number = 120
en

The F9 function key

zh

F9 功能键

readonly

forwardslash

forwardslash: number = 191
en

The forward slash key

zh

正斜杠键

readonly

g

g: number = 71
en

The g key

zh

G 键

readonly

grave

grave: number = 192
en

The grave key

zh

按键 `

readonly

h

h: number = 72
en

The h key

zh

H 键

readonly

home

home: number = 36
en

The home key

zh

主菜单键

readonly

i

i: number = 73
en

The i key

zh

I 键

readonly

insert

insert: number = 45
en

The insert key

zh

插入键

readonly

j

j: number = 74
en

The j key

zh

J 键

readonly

k

k: number = 75
en

The k key

zh

K 键

readonly

l

l: number = 76
en

The l key

zh

L 键

readonly

left

left: number = 37
en

The left key

zh

向左箭头键

readonly

m

m: number = 77
en

The m key

zh

M 键

readonly

menu

menu: number = 18
en

The menu key

zh

菜单键

readonly

n

n: number = 78
en

The n key

zh

N 键

readonly

none

none: number = 0
en

None

zh

没有分配

readonly

num0

num0: number = 96
en

The numeric keypad 0

zh

数字键盘 0

readonly

num1

num1: number = 97
en

The numeric keypad 1

zh

数字键盘 1

readonly

num2

num2: number = 98
en

The numeric keypad 2

zh

数字键盘 2

readonly

num3

num3: number = 99
en

The numeric keypad 3

zh

数字键盘 3

readonly

num4

num4: number = 100
en

The numeric keypad 4

zh

数字键盘 4

readonly

num5

num5: number = 101
en

The numeric keypad 5

zh

数字键盘 5

readonly

num6

num6: number = 102
en

The numeric keypad 6

zh

数字键盘 6

readonly

num7

num7: number = 103
en

The numeric keypad 7

zh

数字键盘 7

readonly

num8

num8: number = 104
en

The numeric keypad 8

zh

数字键盘 8

readonly

num9

num9: number = 105
en

The numeric keypad 9

zh

数字键盘 9

readonly

numdel

numdel: number = 110
en

The numeric keypad 'delete'

zh

数字键盘删除键

readonly

numlock

numlock: number = 144
en

The numlock key

zh

数字锁定键

readonly

o

o: number = 79
en

The o key

zh

O 键

readonly

openbracket

openbracket: number = 219
en

The '[' key

zh

按键 [

readonly

p

p: number = 80
en

The p key

zh

P 键

readonly

pagedown

pagedown: number = 34
en

The page down key

zh

向下翻页键

readonly

pageup

pageup: number = 33
en

The page up key

zh

向上翻页键

readonly

pause

pause: number = 19
en

The pause key

zh

暂停键

readonly

period

period: number = 190
en

The '.' key

zh

句号键

readonly

q

q: number = 81
en

The q key

zh

Q 键

readonly

quote

quote: number = 222
en

The quote key

zh

单引号键

readonly

r

r: number = 82
en

The r key

zh

R 键

readonly

right

right: number = 39
en

The right key

zh

向右箭头键

readonly

s

s: number = 83
en

The s key

zh

S 键

readonly

scrolllock

scrolllock: number = 145
en

The scroll lock key

zh

滚动锁定键

readonly

select

select: number = 41
en

The select key

zh

Select 键

readonly

semicolon

semicolon: number = 186
en

The ';' key.

zh

分号键

readonly

shift

shift: number = 16
en

The shift key

zh

Shift 键

readonly

space

space: number = 32
en

The space key

zh

空格键

readonly

t

t: number = 84
en

The t key

zh

T 键

readonly

tab

tab: number = 9
en

The tab key

zh

Tab 键

readonly

u

u: number = 85
en

The u key

zh

U 键

readonly

up

up: number = 38
en

The up key

zh

向上箭头键

readonly

v

v: number = 86
en

The v key

zh

V 键

readonly

w

w: number = 87
en

The w key

zh

W 键

readonly

x

x: number = 88
en

The x key

zh

X 键

readonly

y

y: number = 89
en

The y key

zh

Y 键

readonly

z

z: number = 90
en

The z key

zh

Z 键

readonly

Const legacyCC

legacyCC: object
en

The main namespace of Cocos2d-JS, all engine core classes, functions, properties and constants are defined in this namespace.

zh

Cocos 引擎的主要命名空间,引擎代码中所有的类,函数,属性和常量都在这个命名空间中定义。

deprecated

_global

_global: any

Const macro

macro: object
en

Predefined constants

zh

预定义常量。

CLEANUP_IMAGE_CACHE

CLEANUP_IMAGE_CACHE: boolean = false
en

Whether to clear the original image cache after uploaded a texture to GPU. If cleared, Dynamic Atlas will not be supported. Normally you don't need to enable this option on the web platform, because Image object doesn't consume too much memory. But on Wechat Game platform, the current version cache decoded data in Image object, which has high memory usage. So we enabled this option by default on Wechat, so that we can release Image cache immediately after uploaded to GPU. Currently not useful in 3D engine

zh

是否在将贴图上传至 GPU 之后删除原始图片缓存,删除之后图片将无法进行 动态合图。 在 Web 平台,你通常不需要开启这个选项,因为在 Web 平台 Image 对象所占用的内存很小。 但是在微信小游戏平台的当前版本,Image 对象会缓存解码后的图片数据,它所占用的内存空间很大。 所以我们在微信平台默认开启了这个选项,这样我们就可以在上传 GL 贴图之后立即释放 Image 对象的内存,避免过高的内存占用。 在 3D 引擎中暂时无效。

default

false

DEG

DEG: number = 180 / Math.PI

One degree

ENABLE_MULTI_TOUCH

ENABLE_MULTI_TOUCH: boolean = true
en

Whether to enable multi-touch.

zh

是否开启多点触摸

default

true

ENABLE_TILEDMAP_CULLING

ENABLE_TILEDMAP_CULLING: boolean = true
en

Whether or not enabled tiled map auto culling. If you set the TiledMap skew or rotation, then need to manually disable this, otherwise, the rendering will be wrong. Currently not useful in 3D engine

zh

是否开启瓦片地图的自动裁减功能。瓦片地图如果设置了 skew, rotation 的话,需要手动关闭,否则渲染会出错。 在 3D 引擎中暂时无效。

default

true

ENABLE_TRANSPARENT_CANVAS

ENABLE_TRANSPARENT_CANVAS: boolean = false
en

Boolean that indicates if the canvas contains an alpha channel, default sets to false for better performance. Though if you want to make your canvas background transparent and show other dom elements at the background, you can set it to true before {{game.init}}. Web only.

zh

用于设置 Canvas 背景是否支持 alpha 通道,默认为 false,这样可以有更高的性能表现。 如果你希望 Canvas 背景是透明的,并显示背后的其他 DOM 元素,你可以在 {{game.init}} 之前将这个值设为 true。 仅支持 Web

default

false

ENABLE_WEBGL_ANTIALIAS

ENABLE_WEBGL_ANTIALIAS: boolean = true
en

Boolean that indicates if the WebGL context is created with antialias option turned on, default value is false. Set it to true could make your game graphics slightly smoother, like texture hard edges when rotated. Whether to use this really depend on your game design and targeted platform, device with retina display usually have good detail on graphics with or without this option, you probably don't want antialias if your game style is pixel art based. Also, it could have great performance impact with some browser / device using software MSAA. You can set it to true before {{game.init}}. Web only.

zh

用于设置在创建 WebGL Context 时是否开启抗锯齿选项,默认值是 false。 将这个选项设置为 true 会让你的游戏画面稍稍平滑一些,比如旋转硬边贴图时的锯齿。是否开启这个选项很大程度上取决于你的游戏和面向的平台。 在大多数拥有 retina 级别屏幕的设备上用户往往无法区分这个选项带来的变化;如果你的游戏选择像素艺术风格,你也多半不会想开启这个选项。 同时,在少部分使用软件级别抗锯齿算法的设备或浏览器上,这个选项会对性能产生比较大的影响。 你可以在 {{game.init}} 之前设置这个值,否则它不会生效。 仅支持 Web

default

true

FLT_EPSILON

FLT_EPSILON: number = 1.192092896e-7

A minimal float value

KEY

KEY: { *: number; +: number; ,: number; -: number; .: number; /: number; 0: number; 1: number; 2: number; 3: number; 4: number; 5: number; 6: number; 7: number; 8: number; 9: number; ;: number; =: number; Delete: number; [: number; ]: number; a: number; alt: number; b: number; back: number; backslash: number; backspace: number; c: number; capslock: number; closebracket: number; comma: number; ctrl: number; d: number; dash: number; down: number; dpadCenter: number; dpadDown: number; dpadLeft: number; dpadRight: number; dpadUp: number; e: number; end: number; enter: number; equal: number; escape: number; f: number; f1: number; f10: number; f11: number; f12: number; f2: number; f3: number; f4: number; f5: number; f6: number; f7: number; f8: number; f9: number; forwardslash: number; g: number; grave: number; h: number; home: number; i: number; insert: number; j: number; k: number; l: number; left: number; m: number; menu: number; n: number; none: number; num0: number; num1: number; num2: number; num3: number; num4: number; num5: number; num6: number; num7: number; num8: number; num9: number; numdel: number; numlock: number; o: number; openbracket: number; p: number; pagedown: number; pageup: number; pause: number; period: number; q: number; quote: number; r: number; right: number; s: number; scrolllock: number; select: number; semicolon: number; shift: number; space: number; t: number; tab: number; u: number; up: number; v: number; w: number; x: number; y: number; z: number }
en

Key map for keyboard event

zh

键盘事件的按键值。

example

{@link cocos/core/platform/CCCommon/KEY.js}

Type declaration

  • *: number
    en

    The numeric keypad '*'

    zh

    数字键盘 *

    readonly
  • +: number
    en

    The numeric keypad '+'

    zh

    数字键盘 +

    readonly
  • ,: number
    en

    The ',' key.

    zh

    逗号键

    readonly
  • -: number
    en

    The numeric keypad '-'

    zh

    数字键盘 -

    readonly
  • .: number
    en

    The '.' key.

    zh

    句号键

    readonly
  • /: number
    en

    The numeric keypad '/'

    zh

    数字键盘 /

    readonly
  • 0: number
    en

    The '0' key on the top of the alphanumeric keyboard.

    zh

    字母键盘上的 0 键

    readonly
  • 1: number
    en

    The '1' key on the top of the alphanumeric keyboard.

    zh

    字母键盘上的 1 键

    readonly
  • 2: number
    en

    The '2' key on the top of the alphanumeric keyboard.

    zh

    字母键盘上的 2 键

    readonly
  • 3: number
    en

    The '3' key on the top of the alphanumeric keyboard.

    zh

    字母键盘上的 3 键

    readonly
  • 4: number
    en

    The '4' key on the top of the alphanumeric keyboard.

    zh

    字母键盘上的 4 键

    readonly
  • 5: number
    en

    The '5' key on the top of the alphanumeric keyboard.

    zh

    字母键盘上的 5 键

    readonly
  • 6: number
    en

    The '6' key on the top of the alphanumeric keyboard.

    zh

    字母键盘上的 6 键

    readonly
  • 7: number
    en

    The '7' key on the top of the alphanumeric keyboard.

    zh

    字母键盘上的 7 键

    readonly
  • 8: number
    en

    The '8' key on the top of the alphanumeric keyboard.

    zh

    字母键盘上的 8 键

    readonly
  • 9: number
    en

    The '9' key on the top of the alphanumeric keyboard.

    zh

    字母键盘上的 9 键

    readonly
  • ;: number
    en

    The ';' key.

    zh

    分号键

    readonly
  • =: number
    en

    The '=' key.

    zh

    等于号键

    readonly
  • Delete: number
    en

    The Delete key

    zh

    删除键

    readonly
  • [: number
    en

    The '[' key

    zh

    按键 [

    readonly
  • ]: number
    en

    The ']' key

    zh

    按键 ]

    readonly
  • a: number
    en

    The a key

    zh

    A 键

    readonly
  • alt: number
    en

    The alt key

    zh

    Alt 键

    readonly
  • b: number
    en

    The b key

    zh

    B 键

    readonly
  • back: number
    en

    The back key

    zh

    返回键

    readonly
  • backslash: number
    en

    The '' key

    zh

    反斜杠键

    readonly
  • backspace: number
    en

    The backspace key

    zh

    退格键

    readonly
  • c: number
    en

    The c key

    zh

    C 键

    readonly
  • capslock: number
    en

    The caps lock key

    zh

    大写锁定键

    readonly
  • closebracket: number
    en

    The ']' key

    zh

    按键 ]

    readonly
  • comma: number
    en

    The ',' key.

    zh

    逗号键

    readonly
  • ctrl: number
    en

    The ctrl key

    zh

    Ctrl 键

    readonly
  • d: number
    en

    The d key

    zh

    D 键

    readonly
  • dash: number
    en

    The dash '-' key.

    zh

    中划线键

    readonly
  • down: number
    en

    The down key

    zh

    向下箭头键

    readonly
  • dpadCenter: number
    en

    The dpad center key

    zh

    导航键 确定键

    readonly
  • dpadDown: number
    en

    The dpad down key

    zh

    导航键 向下

    readonly
  • dpadLeft: number
    en

    The dpad left key

    zh

    导航键 向左

    readonly
  • dpadRight: number
    en

    The dpad right key

    zh

    导航键 向右

    readonly
  • dpadUp: number
    en

    The dpad up key

    zh

    导航键 向上

    readonly
  • e: number
    en

    The e key

    zh

    E 键

    readonly
  • end: number
    en

    The end key

    zh

    结束键

    readonly
  • enter: number
    en

    The enter key

    zh

    回车键

    readonly
  • equal: number
    en

    The '=' key.

    zh

    等于号键

    readonly
  • escape: number
    en

    The esc key

    zh

    ESC 键

    readonly
  • f: number
    en

    The f key

    zh

    F 键

    readonly
  • f1: number
    en

    The F1 function key

    zh

    F1 功能键

    readonly
  • f10: number
    en

    The F10 function key

    zh

    F10 功能键

    readonly
  • f11: number
    en

    The F11 function key

    zh

    F11 功能键

    readonly
  • f12: number
    en

    The F12 function key

    zh

    F12 功能键

    readonly
  • f2: number
    en

    The F2 function key

    zh

    F2 功能键

    readonly
  • f3: number
    en

    The F3 function key

    zh

    F3 功能键

    readonly
  • f4: number
    en

    The F4 function key

    zh

    F4 功能键

    readonly
  • f5: number
    en

    The F5 function key

    zh

    F5 功能键

    readonly
  • f6: number
    en

    The F6 function key

    zh

    F6 功能键

    readonly
  • f7: number
    en

    The F7 function key

    zh

    F7 功能键

    readonly
  • f8: number
    en

    The F8 function key

    zh

    F8 功能键

    readonly
  • f9: number
    en

    The F9 function key

    zh

    F9 功能键

    readonly
  • forwardslash: number
    en

    The forward slash key

    zh

    正斜杠键

    readonly
  • g: number
    en

    The g key

    zh

    G 键

    readonly
  • grave: number
    en

    The grave key

    zh

    按键 `

    readonly
  • h: number
    en

    The h key

    zh

    H 键

    readonly
  • home: number
    en

    The home key

    zh

    主菜单键

    readonly
  • i: number
    en

    The i key

    zh

    I 键

    readonly
  • insert: number
    en

    The insert key

    zh

    插入键

    readonly
  • j: number
    en

    The j key

    zh

    J 键

    readonly
  • k: number
    en

    The k key

    zh

    K 键

    readonly
  • l: number
    en

    The l key

    zh

    L 键

    readonly
  • left: number
    en

    The left key

    zh

    向左箭头键

    readonly
  • m: number
    en

    The m key

    zh

    M 键

    readonly
  • menu: number
    en

    The menu key

    zh

    菜单键

    readonly
  • n: number
    en

    The n key

    zh

    N 键

    readonly
  • none: number
    en

    None

    zh

    没有分配

    readonly
  • num0: number
    en

    The numeric keypad 0

    zh

    数字键盘 0

    readonly
  • num1: number
    en

    The numeric keypad 1

    zh

    数字键盘 1

    readonly
  • num2: number
    en

    The numeric keypad 2

    zh

    数字键盘 2

    readonly
  • num3: number
    en

    The numeric keypad 3

    zh

    数字键盘 3

    readonly
  • num4: number
    en

    The numeric keypad 4

    zh

    数字键盘 4

    readonly
  • num5: number
    en

    The numeric keypad 5

    zh

    数字键盘 5

    readonly
  • num6: number
    en

    The numeric keypad 6

    zh

    数字键盘 6

    readonly
  • num7: number
    en

    The numeric keypad 7

    zh

    数字键盘 7

    readonly
  • num8: number
    en

    The numeric keypad 8

    zh

    数字键盘 8

    readonly
  • num9: number
    en

    The numeric keypad 9

    zh

    数字键盘 9

    readonly
  • numdel: number
    en

    The numeric keypad 'delete'

    zh

    数字键盘删除键

    readonly
  • numlock: number
    en

    The numlock key

    zh

    数字锁定键

    readonly
  • o: number
    en

    The o key

    zh

    O 键

    readonly
  • openbracket: number
    en

    The '[' key

    zh

    按键 [

    readonly
  • p: number
    en

    The p key

    zh

    P 键

    readonly
  • pagedown: number
    en

    The page down key

    zh

    向下翻页键

    readonly
  • pageup: number
    en

    The page up key

    zh

    向上翻页键

    readonly
  • pause: number
    en

    The pause key

    zh

    暂停键

    readonly
  • period: number
    en

    The '.' key

    zh

    句号键

    readonly
  • q: number
    en

    The q key

    zh

    Q 键

    readonly
  • quote: number
    en

    The quote key

    zh

    单引号键

    readonly
  • r: number
    en

    The r key

    zh

    R 键

    readonly
  • right: number
    en

    The right key

    zh

    向右箭头键

    readonly
  • s: number
    en

    The s key

    zh

    S 键

    readonly
  • scrolllock: number
    en

    The scroll lock key

    zh

    滚动锁定键

    readonly
  • select: number
    en

    The select key

    zh

    Select 键

    readonly
  • semicolon: number
    en

    The ';' key.

    zh

    分号键

    readonly
  • shift: number
    en

    The shift key

    zh

    Shift 键

    readonly
  • space: number
    en

    The space key

    zh

    空格键

    readonly
  • t: number
    en

    The t key

    zh

    T 键

    readonly
  • tab: number
    en

    The tab key

    zh

    Tab 键

    readonly
  • u: number
    en

    The u key

    zh

    U 键

    readonly
  • up: number
    en

    The up key

    zh

    向上箭头键

    readonly
  • v: number
    en

    The v key

    zh

    V 键

    readonly
  • w: number
    en

    The w key

    zh

    W 键

    readonly
  • x: number
    en

    The x key

    zh

    X 键

    readonly
  • y: number
    en

    The y key

    zh

    Y 键

    readonly
  • z: number
    en

    The z key

    zh

    Z 键

    readonly

MAX_LABEL_CANVAS_POOL_SIZE

MAX_LABEL_CANVAS_POOL_SIZE: number = 20
en

The maximum size of the canvas pool used by Label, please adjust according to the number of label component in the same scene of the project

zh

Label 使用的 canvas pool 的最大大小,请根据项目同场景的 label 数量进行调整

default

20

ORIENTATION_AUTO

ORIENTATION_AUTO: number = 3
en

Oriented automatically

zh

自动适配朝向

ORIENTATION_LANDSCAPE

ORIENTATION_LANDSCAPE: number = 2
en

Oriented horizontally

zh

横屏朝向

ORIENTATION_PORTRAIT

ORIENTATION_PORTRAIT: number = 1
en

Oriented vertically

zh

竖屏朝向

RAD

RAD: number = Math.PI / 180

PI / 180

REPEAT_FOREVER

REPEAT_FOREVER: number = (Number.MAX_VALUE - 1)

A maximum value of number

SUPPORT_TEXTURE_FORMATS

SUPPORT_TEXTURE_FORMATS: string[]
en

The image format supported by the engine defaults, and the supported formats may differ in different build platforms and device types. Currently all platform and device support ['.webp', '.jpg', '.jpeg', '.bmp', '.png'], ios mobile platform

zh

引擎默认支持的图片格式,支持的格式可能在不同的构建平台和设备类型上有所差别。 目前所有平台和设备支持的格式有 ['.webp', '.jpg', '.jpeg', '.bmp', '.png']. The iOS mobile platform also supports the PVR format。

TOUCH_TIMEOUT

TOUCH_TIMEOUT: number = 5000
en

The timeout to determine whether a touch is no longer active and should be removed. The reason to add this timeout is due to an issue in X5 browser core, when X5 is presented in wechat on Android, if a touch is glissed from the bottom up, and leave the page area, no touch cancel event is triggered, and the touch will be considered active forever. After multiple times of this action, our maximum touches number will be reached and all new touches will be ignored. So this new mechanism can remove the touch that should be inactive if it's not updated during the last 5000 milliseconds. Though it might remove a real touch if it's just not moving for the last 5 seconds which is not easy with the sensibility of mobile touch screen. You can modify this value to have a better behavior if you find it's not enough.

zh

用于甄别一个触点对象是否已经失效并且可以被移除的延时时长 添加这个时长的原因是 X5 内核在微信浏览器中出现的一个 bug。 在这个环境下,如果用户将一个触点从底向上移出页面区域,将不会触发任何 touch cancel 或 touch end 事件,而这个触点会被永远当作停留在页面上的有效触点。 重复这样操作几次之后,屏幕上的触点数量将达到我们的事件系统所支持的最高触点数量,之后所有的触摸事件都将被忽略。 所以这个新的机制可以在触点在一定时间内没有任何更新的情况下视为失效触点并从事件系统中移除。 当然,这也可能移除一个真实的触点,如果用户的触点真的在一定时间段内完全没有移动(这在当前手机屏幕的灵敏度下会很难)。 你可以修改这个值来获得你需要的效果,默认值是 5000 毫秒。

default

5000

Const screen

screen: object
en

The screen API provides an easy way for web content to be presented using the user's entire screen. It's designed for web platforms and some mobile browsers don't provide such behavior, e.g. Safari

zh

screen 单例对象提供简单的方法来尝试让 Web 内容进入全屏模式。这是 Web 平台特有的行为,在部分浏览器上并不支持这样的功能。

_fn

_fn: any = null as any

_fnMap

_fnMap: string[][] = [['requestFullscreen','exitFullscreen','fullscreenchange','fullscreenEnabled','fullscreenElement',],['requestFullScreen','exitFullScreen','fullScreenchange','fullScreenEnabled','fullScreenElement',],['webkitRequestFullScreen','webkitCancelFullScreen','webkitfullscreenchange','webkitIsFullScreen','webkitCurrentFullScreenElement',],['mozRequestFullScreen','mozCancelFullScreen','mozfullscreenchange','mozFullScreen','mozFullScreenElement',],['msRequestFullscreen','msExitFullscreen','MSFullscreenChange','msFullscreenEnabled','msFullscreenElement',],]

_onfullscreenchange

_onfullscreenchange: any = null as any

_onfullscreenerror

_onfullscreenerror: any = null as any

_preOnFullScreenError

_preOnFullScreenError: any = null as any

_preOnTouch

_preOnTouch: any = null as any

_supportsFullScreen

_supportsFullScreen: boolean = false

_touchEvent

_touchEvent: string = ""

ensureFullScreen

  • ensureFullScreen(element: HTMLElement, onFullScreenChange: (this: Document, ev: any) => any): void
  • Parameters

    • element: HTMLElement
    • onFullScreenChange: (this: Document, ev: any) => any
        • (this: Document, ev: any): any
        • Parameters

          • this: Document
          • ev: any

          Returns any

    Returns void

autoFullScreen

  • autoFullScreen(element: HTMLElement, onFullScreenChange: (this: Document, ev: any) => any): void
  • 自动监听触摸、鼠标事件并在下一次事件触发时尝试进入全屏模式

    Parameters

    • element: HTMLElement

      The element to request full screen state

    • onFullScreenChange: (this: Document, ev: any) => any

      callback function when full screen state changed

        • (this: Document, ev: any): any
        • Parameters

          • this: Document
          • ev: any

          Returns any

    Returns void

disableAutoFullScreen

  • disableAutoFullScreen(element: any): void

exitFullScreen

  • exitFullScreen(): Promise<any> | undefined

fullScreen

  • fullScreen(): boolean

init

  • init(): void

requestFullScreen

  • requestFullScreen(element: HTMLElement, onFullScreenChange?: undefined | ((this: Document, ev: any) => any), onFullScreenError?: undefined | ((this: Document, ev: any) => any)): Promise<any> | undefined
  • 尝试使当前节点进入全屏模式,很多浏览器不允许程序触发这样的行为,必须在一个用户交互回调中才会生效。 如果希望更简单一些,可以尝试用 {{autoFullScreen}} 来自动监听用户触摸事件并在下一次触摸事件中尝试进入全屏模式。

    Parameters

    • element: HTMLElement

      The element to request full screen state

    • Optional onFullScreenChange: undefined | ((this: Document, ev: any) => any)

      callback function when full screen state changed

    • Optional onFullScreenError: undefined | ((this: Document, ev: any) => any)

      callback function when full screen error

    Returns Promise<any> | undefined

supportsFullScreen

  • get supportsFullScreen(): boolean

Const sys

sys: object
en

A set of system related variables

zh

一系列系统相关环境变量

main

ALIPAY_MINI_GAME

ALIPAY_MINI_GAME: number = 113
property

{Number} ALIPAY_MINI_GAME

readonly
default

113

ANDROID

ANDROID: number = 3
en

Platform - Android native app

zh

平台 - 安卓原生平台

default

3

BAIDU_MINI_GAME

BAIDU_MINI_GAME: number = 107
property

{Number} BAIDU_MINI_GAME

readonly
default

107

BLACKBERRY

BLACKBERRY: number = 6
en

Platform - Blackberry devices

zh

平台 - 黑莓设备

default

6

BROWSER_TYPE_360

BROWSER_TYPE_360: string = "360browser"
en

Browser Type - 360 Browser

zh

浏览器类型 - 360 浏览器

default

"360browser"

BROWSER_TYPE_ANDROID

BROWSER_TYPE_ANDROID: string = "androidbrowser"
en

Browser Type - Android Browser

zh

浏览器类型 - 安卓浏览器

default

"androidbrowser"

BROWSER_TYPE_BAIDU

BROWSER_TYPE_BAIDU: string = "baidubrowser"
en

Browser Type - Baidu Browser

zh

浏览器类型 - 百度浏览器

default

"baidubrowser"

BROWSER_TYPE_BAIDU_APP

BROWSER_TYPE_BAIDU_APP: string = "baiduboxapp"
en

Browser Type - Baidu Box App

zh

浏览器类型 - Baidu Box App

default

"baiduboxapp"

BROWSER_TYPE_CHROME

BROWSER_TYPE_CHROME: string = "chrome"
en

Browser Type - Chrome Browser

zh

浏览器类型 - Chrome 浏览器

default

"chrome"

BROWSER_TYPE_EDGE

BROWSER_TYPE_EDGE: string = "edge"
en

Browser Type - Microsoft Edge

zh

浏览器类型 - 微软 Edge

default

"edge"

BROWSER_TYPE_FIREFOX

BROWSER_TYPE_FIREFOX: string = "firefox"
en

Browser Type - Firefox Browser

zh

浏览器类型 - Firefox 浏览器

default

"firefox"

BROWSER_TYPE_HUAWEI

BROWSER_TYPE_HUAWEI: string = "huawei"
property

{String} BROWSER_TYPE_HUAWEI

readonly
default

"huawei"

BROWSER_TYPE_IE

BROWSER_TYPE_IE: string = "ie"
en

Browser Type - Internet Explorer

zh

浏览器类型 - 微软 IE

default

"ie"

BROWSER_TYPE_LIEBAO

BROWSER_TYPE_LIEBAO: string = "liebao"
en

Browser Type - Cheetah Browser

zh

浏览器类型 - 猎豹浏览器

default

"liebao"

BROWSER_TYPE_MAXTHON

BROWSER_TYPE_MAXTHON: string = "maxthon"
en

Browser Type - Maxthon Browser

zh

浏览器类型 - 傲游浏览器

default

"maxthon"

BROWSER_TYPE_MIUI

BROWSER_TYPE_MIUI: string = "miuibrowser"
en

Browser Type - MI UI Browser

zh

浏览器类型 - MIUI 内置浏览器

default

"miuibrowser"

BROWSER_TYPE_MOBILE_QQ

BROWSER_TYPE_MOBILE_QQ: string = "mqqbrowser"
en

Browser Type - Mobile QQ Browser

zh

浏览器类型 - 手机 QQ 浏览器

default

"mqqbrowser"

BROWSER_TYPE_OPERA

BROWSER_TYPE_OPERA: string = "opera"
en

Browser Type - Opera Browser

zh

浏览器类型 - Opera 浏览器

default

"opera"

BROWSER_TYPE_OUPENG

BROWSER_TYPE_OUPENG: string = "oupeng"
en

Browser Type - Oupeng Browser

zh

浏览器类型 - 欧朋浏览器

default

"oupeng"

BROWSER_TYPE_QQ

BROWSER_TYPE_QQ: string = "qqbrowser"
en

Browser Type - QQ Browser

zh

浏览器类型 - QQ 浏览器

default

"qqbrowser"

BROWSER_TYPE_QZONE

BROWSER_TYPE_QZONE: string = "qzone"
en

Browser Type - QZone Inner Browser

zh

浏览器类型 - QZone 内置浏览器

default

"qzone"

BROWSER_TYPE_SAFARI

BROWSER_TYPE_SAFARI: string = "safari"
en

Browser Type - Safari Browser

zh

浏览器类型 - Safari 浏览器

default

"safari"

BROWSER_TYPE_SOUGOU

BROWSER_TYPE_SOUGOU: string = "sogou"
en

Browser Type - Sogou Browser

zh

浏览器类型 - 搜狗浏览器

default

"sogou"

BROWSER_TYPE_UC

BROWSER_TYPE_UC: string = "ucbrowser"
en

Browser Type - UC Browser

zh

浏览器类型 - UC 浏览器

default

"ucbrowser"

BROWSER_TYPE_UCBS

BROWSER_TYPE_UCBS: string = "ucbs"
en

Browser Type - Third party integrated UC browser

zh

浏览器类型 - 第三方应用中集成的 UC 浏览器

default

"ucbs"

BROWSER_TYPE_UNKNOWN

BROWSER_TYPE_UNKNOWN: string = "unknown"
en

Browser Type - Unknown

zh

浏览器类型 - 未知

default

"unknown"

BROWSER_TYPE_WECHAT

BROWSER_TYPE_WECHAT: string = "wechat"
en

Browser Type - WeChat inner browser

zh

浏览器类型 - 微信内置浏览器

default

"wechat"

BYTEDANCE_MINI_GAME

BYTEDANCE_MINI_GAME: number = 117
property

{Number} BYTEDANCE_MINI_GAME

readonly
default

117

COCOSPLAY

COCOSPLAY: number = 112
property

{Number} COCOSPLAY

readonly
default

112

DESKTOP_BROWSER

DESKTOP_BROWSER: number = 101
en

Platform - Desktop browsers

zh

平台 - 桌面端浏览器

default

101

EDITOR_CORE

EDITOR_CORE: number = 103
en

Platform - Editor's main process

zh

平台 - 编辑器主进程

default

103

EDITOR_PAGE

EDITOR_PAGE: number = 102
en

Platform - Editor's window process

zh

平台 - 编辑器窗口进程

default

102

EMSCRIPTEN

EMSCRIPTEN: number = 8
en

Platform - Emscripten compiled runtime

zh

平台 - 编译为 Emscripten 的运行时环境

default

8

FB_PLAYABLE_ADS

FB_PLAYABLE_ADS: number = 106
property

{Number} FB_PLAYABLE_ADS

readonly
default

106

HUAWEI_QUICK_GAME

HUAWEI_QUICK_GAME: number = 110
property

{Number} HUAWEI_QUICK_GAME

readonly
default

110

IPAD

IPAD: number = 5
en

Platform - iPad native app

zh

平台 - iPad 原生平台

default

5

IPHONE

IPHONE: number = 4
en

Platform - iPhone native app

zh

平台 - iPhone 原生平台

default

4

LANGUAGE_ARABIC

LANGUAGE_ARABIC: string = "ar"
en

Arabic language code

zh

语言代码 - 阿拉伯语

LANGUAGE_BULGARIAN

LANGUAGE_BULGARIAN: string = "bg"
en

Bulgarian language code

zh

语言代码 - 保加利亚语

LANGUAGE_CHINESE

LANGUAGE_CHINESE: string = "zh"
en

Chinese language code

zh

语言代码 - 中文

LANGUAGE_DUTCH

LANGUAGE_DUTCH: string = "du"
en

Spanish language code

zh

语言代码 - 荷兰语

LANGUAGE_ENGLISH

LANGUAGE_ENGLISH: string = "en"
en

English language code

zh

语言代码 - 英语

LANGUAGE_FRENCH

LANGUAGE_FRENCH: string = "fr"
en

French language code

zh

语言代码 - 法语

LANGUAGE_GERMAN

LANGUAGE_GERMAN: string = "de"
en

German language code

zh

语言代码 - 德语

LANGUAGE_HUNGARIAN

LANGUAGE_HUNGARIAN: string = "hu"
en

Hungarian language code

zh

语言代码 - 匈牙利语

LANGUAGE_ITALIAN

LANGUAGE_ITALIAN: string = "it"
en

Italian language code

zh

语言代码 - 意大利语

LANGUAGE_JAPANESE

LANGUAGE_JAPANESE: string = "ja"
en

Japanese language code

zh

语言代码 - 日语

LANGUAGE_KOREAN

LANGUAGE_KOREAN: string = "ko"
en

Korean language code

zh

语言代码 - 韩语

LANGUAGE_NORWEGIAN

LANGUAGE_NORWEGIAN: string = "no"
en

Norwegian language code

zh

语言代码 - 挪威语

LANGUAGE_POLISH

LANGUAGE_POLISH: string = "pl"
en

Polish language code

zh

语言代码 - 波兰语

LANGUAGE_PORTUGUESE

LANGUAGE_PORTUGUESE: string = "pt"
en

Portuguese language code

zh

语言代码 - 葡萄牙语

LANGUAGE_ROMANIAN

LANGUAGE_ROMANIAN: string = "ro"
en

Romanian language code

zh

语言代码 - 罗马尼亚语

LANGUAGE_RUSSIAN

LANGUAGE_RUSSIAN: string = "ru"
en

Russian language code

zh

语言代码 - 俄罗斯语

LANGUAGE_SPANISH

LANGUAGE_SPANISH: string = "es"
en

Spanish language code

zh

语言代码 - 西班牙语

LANGUAGE_TURKISH

LANGUAGE_TURKISH: string = "tr"
en

Turkish language code

zh

语言代码 - 土耳其语

LANGUAGE_UKRAINIAN

LANGUAGE_UKRAINIAN: string = "uk"
en

Ukrainian language code

zh

语言代码 - 乌克兰语

LANGUAGE_UNKNOWN

LANGUAGE_UNKNOWN: string = "unknown"
en

Unknown language code

zh

语言代码 - 未知

LINKSURE_MINI_GAME

LINKSURE_MINI_GAME: number = 119
property

{Number} LINKSURE_MINI_GAME

readonly
default

119

LINUX

LINUX: number = 1
en

Platform - Linux

zh

平台 - Linux

default

1

MACOS

MACOS: number = 2
en

Platform - Mac OS X app

zh

平台 - Mac OS X 原生平台

default

2

MOBILE_BROWSER

MOBILE_BROWSER: number = 100
en

Platform - Mobile browsers

zh

平台 - 移动浏览器

default

100

NACL

NACL: number = 7
en

Platform - NACL

zh

平台 - NACL

default

7

NetworkType

NetworkType: NetworkType
en

Network type enumeration

zh

网络类型枚举

OPPO_MINI_GAME

OPPO_MINI_GAME: number = 109
property

{Number} OPPO_MINI_GAME

readonly
default

109

OS_ANDROID

OS_ANDROID: string = "Android"
en

Operating System - Android

zh

操作系统 - 安卓

OS_IOS

OS_IOS: string = "iOS"
en

Operating System - iOS

zh

操作系统 - iOS

OS_LINUX

OS_LINUX: string = "Linux"
en

Operating System - Linux

zh

操作系统 - Linux

OS_OSX

OS_OSX: string = "OS X"
en

Operating System - Mac OS X

zh

操作系统 - Mac OS X

OS_UNKNOWN

OS_UNKNOWN: string = "Unknown"
en

Operating System - Unknown

zh

操作系统 - 未知

OS_WINDOWS

OS_WINDOWS: string = "Windows"
en

Operating System - Windows

zh

操作系统 - Windows

QQ_PLAY

QQ_PLAY: number = 105
en

Platform - QQ Play Game

zh

平台 - QQ Play

default

105

QTT_MINI_GAME

QTT_MINI_GAME: number = 116
property

{Number} QTT_MINI_GAME

readonly
default

116

TIZEN

TIZEN: number = 9
en

Platform - Tizen

zh

平台 - Tizen

default

9

UNKNOWN

UNKNOWN: number = -1
en

Platform - Unknown

zh

平台 - 未知

default

-1

VIVO_MINI_GAME

VIVO_MINI_GAME: number = 108
property

{Number} VIVO_MINI_GAME

readonly
default

108

WECHAT_GAME

WECHAT_GAME: number = 104
en

Platform - WeChat Mini Game

zh

平台 - 微信小游戏

default

104

WIN32

WIN32: number = 0
en

Platform - 32 bit Windows application

zh

平台 - 32位 Windows 可执行程序

default

0

WINRT

WINRT: number = 10
en

Platform - Windows RT

zh

平台 - Windows RT

default

10

WP8

WP8: number = 11
en

Platform - Windows Phone 8 app

zh

平台 - Windows Phone 8 原生应用

default

11

XIAOMI_QUICK_GAME

XIAOMI_QUICK_GAME: number = 111
property

{Number} XIAOMI_QUICK_GAME

readonly
default

111

Private __audioSupport

__audioSupport: null = null

Audio support in the browser

MULTI_CHANNEL : Multiple audio while playing - If it doesn't, you can only play background music WEB_AUDIO : Support for WebAudio - Support W3C WebAudio standards, all of the audio can be played AUTOPLAY : Supports auto-play audio - if Don‘t support it, On a touch detecting background music canvas, and then replay REPLAY_AFTER_TOUCH : The first music will fail, must be replay after touchstart USE_EMPTIED_EVENT : Whether to use the emptied event to replace load callback DELAY_CREATE_CTX : delay created the context object - only webAudio NEED_MANUAL_LOOP : loop attribute failure, need to perform loop manually

May be modifications for a few browser version

Private __videoSupport

__videoSupport: null = null

Video support in the browser

browserType

browserType: string = "unknown"
en

Indicate the running browser type

zh

指示当前运行的浏览器类型

browserVersion

browserVersion: string = ""
en

Indicate the running browser version

zh

指示当前运行的浏览器版本

capabilities

capabilities: null = null
en

The capabilities of the current platform

zh

当前平台的功能可用性

isBrowser

isBrowser: boolean = typeof window === 'object' && typeof document === 'object'
en

Whether the running platform is browser

zh

指示运行平台是否是浏览器

isLittleEndian

isLittleEndian: boolean = (() => {const buffer = new ArrayBuffer(2);new DataView(buffer).setInt16(0, 256, true);// Int16Array uses the platform's endianness.return new Int16Array(buffer)[0] === 256;})()
en

Whether the endianness of current platform is little endian

zh

当前平台字节顺序是否是小端序

isMobile

isMobile: boolean = false
en

Indicate whether the current running context is a mobile system

zh

指示当前运行平台是否是移动端平台

default

false

isNative

isNative: boolean = false
en

Whether the running platform is native app

zh

指示运行平台是否是原生平台

language

language: string = "unknown"
en

Indicate the current language of the running system

zh

指示当前运行环境的语言

default

{{sys.LANGUAGE_UNKNOWN}}

languageCode

languageCode: string = "unknown"
en

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.

zh

指示当前运行环境的语言 获取当前的语言iso 639-1代码。 有效的语言代码包括 "zh-tw"、"en"、"en-us"、"fr"、"fr-fr"、"es-es "等。 实际值完全取决于目的地平台提供的结果。

default

{{sys.LANGUAGE_UNKNOWN}}

localStorage

localStorage: null = null
en

It is a local storage component based on HTML5 localStorage API, on web platform, it's equal to window.localStorage

zh

HTML5 标准中的 localStorage 的本地存储功能,在 Web 端等价于 window.localStorage

os

os: string = "Unknown"
en

Indicate the running os name

zh

指示当前运行系统

osMainVersion

osMainVersion: number = 0
en

Indicate the running os main version

zh

指示当前系统主版本

osVersion

osVersion: string = ""
en

Indicate the running os version string

zh

指示当前运行系统版本字符串

platform

platform: number = -1
en

The running platform

zh

当前运行平台或环境

default

{{sys.UNKNOWN}}

windowPixelResolution

windowPixelResolution: null = null
en

Indicate the real pixel resolution of the whole game window

zh

指示游戏窗口的像素分辨率

init

  • __init(): void

dump

  • dump(): void

garbageCollect

  • garbageCollect(): void

getBatteryLevel

  • getBatteryLevel(): number

getNetworkType

getSafeAreaRect

  • getSafeAreaRect(): Rect
  • 返回手机屏幕安全区域(设计分辨率为单位),如果不是异形屏将默认返回 visibleRect。目前支持安卓、iOS 原生平台和微信小游戏平台。

    method

    getSafeAreaRect

    Returns Rect

isObjectValid

  • isObjectValid(obj: any): boolean
  • 检查一个对象是否非空或在原生平台有效, 在 Web 平台,只要对象非空或非 Undefined 就会返回 true,在原生平台,我们会检查当前 JS 对象和其绑定的原生对象是否都有效

    Parameters

    • obj: any

      The object to be checked

    Returns boolean

now

  • now(): number

openURL

  • openURL(url: any): void

Private restartVM

  • restartVM(): void

Generated using TypeDoc