跳至主要內容

Class: _unit

muzzik大约 3 分钟

index / audio_ / _unit

Class: _unit

audio_._unit

音频单元

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new _unit(init_?)

Parameters

NameType
init_?Partial<_unit>

Defined in

assets/@framework/audio/mk_audio_base.ts:382open in new window

Properties

clip

clip: null | AudioClip = null

音频资源

Defined in

assets/@framework/audio/mk_audio_base.ts:389open in new window


type

type: type = global_config.audio.type.effect

音频类型

Defined in

assets/@framework/audio/mk_audio_base.ts:393open in new window


_event

Optional _event: event_target<event_protocol>

事件对象

Defined in

assets/@framework/audio/mk_audio_base.ts:397open in new window


group_ns

group_ns: number[] = []

分组

Defined in

assets/@framework/audio/mk_audio_base.ts:399open in new window


stop_group_n

stop_group_n: null | number = null

当前停止分组

Remarks

停止时优先级最大的分组

Defined in

assets/@framework/audio/mk_audio_base.ts:405open in new window


state

state: state = state.stop

播放状态

Defined in

assets/@framework/audio/mk_audio_base.ts:407open in new window


wait_play_n

wait_play_n: number = -1

等待播放次数

Remarks

-1:关闭,0-n:等待播放次数

Defined in

assets/@framework/audio/mk_audio_base.ts:413open in new window


real_volume_n

real_volume_n: number = 0

真实音量

Defined in

assets/@framework/audio/mk_audio_base.ts:415open in new window


use_play_b

Optional use_play_b: boolean

使用 play 接口,默认使用 playOneShot

Remarks

common 使用

  • play 接口存在最大并发数限制 cc.AudioSource.maxAudioChannel

  • playOneShot 接口不能暂停

Defined in

assets/@framework/audio/mk_audio_base.ts:425open in new window


_init_b

Protected _init_b: boolean = false

初始化状态

Defined in

assets/@framework/audio/mk_audio_base.ts:502open in new window

Accessors

init_b

get init_b(): boolean

初始化状态

Returns

boolean

Defined in

assets/@framework/audio/mk_audio_base.ts:428open in new window

set init_b(value_b_): void

Parameters

NameType
value_b_boolean

Returns

void

Defined in

assets/@framework/audio/mk_audio_base.ts:432open in new window


volume_n

get volume_n(): number

音量

Returns

number

Remarks

  • common:use_play_b 为 false 的情况下修改只能在下次 play 时生效

Defined in

assets/@framework/audio/mk_audio_base.ts:442open in new window

set volume_n(value_n_): void

Parameters

NameType
value_n_number

Returns

void

Defined in

assets/@framework/audio/mk_audio_base.ts:446open in new window


loop_b

get loop_b(): boolean

循环

Returns

boolean

Defined in

assets/@framework/audio/mk_audio_base.ts:451open in new window

set loop_b(value_b_): void

Parameters

NameType
value_b_boolean

Returns

void

Defined in

assets/@framework/audio/mk_audio_base.ts:455open in new window


total_time_s_n

get total_time_s_n(): number

总时长(秒)

Returns

number

Defined in

assets/@framework/audio/mk_audio_base.ts:460open in new window


curr_time_s_n

get curr_time_s_n(): number

当前时间(秒)

Returns

number

Defined in

assets/@framework/audio/mk_audio_base.ts:465open in new window

set curr_time_s_n(value_n_): void

Parameters

NameType
value_n_number

Returns

void

Defined in

assets/@framework/audio/mk_audio_base.ts:469open in new window


event

get event(): event_target<event_protocol>

事件对象

Returns

event_target<event_protocol>

Defined in

assets/@framework/audio/mk_audio_base.ts:474open in new window


wait_play_b

get wait_play_b(): boolean

等待播放开关

Returns

boolean

Defined in

assets/@framework/audio/mk_audio_base.ts:479open in new window

set wait_play_b(value_b_): void

Parameters

NameType
value_b_boolean

Returns

void

Defined in

assets/@framework/audio/mk_audio_base.ts:483open in new window


audio_source

get audio_source(): null | AudioSource

音频组件

Returns

null | AudioSource

Remarks

common 使用

Defined in

assets/@framework/audio/mk_audio_base.ts:492open in new window

set audio_source(value_): void

Parameters

NameType
value_null | AudioSource

Returns

void

Defined in

assets/@framework/audio/mk_audio_base.ts:496open in new window

Methods

update_volume

Abstract update_volume(): void

更新音量

Returns

void

Defined in

assets/@framework/audio/mk_audio_base.ts:505open in new window


_clone

Protected Abstract _clone(): _unit

克隆

Returns

_unit

Defined in

assets/@framework/audio/mk_audio_base.ts:507open in new window


clone

clone(): _unit

克隆

Returns

_unit

Defined in

assets/@framework/audio/mk_audio_base.ts:510open in new window

clone(value_n_): _unit[]

克隆

Parameters

NameTypeDescription
value_n_number克隆数量

Returns

_unit[]

Defined in

assets/@framework/audio/mk_audio_base.ts:515open in new window

📣 觉得很赞?分享给你的朋友吧!