本文へスキップ

ウイ

説明

このコンポーネントは、エンティティに関連するユーザインタフェースを確立する。

プロパティ

プロパティタイプデフォルト説明
タイプ (必須)ストリングサポートされているタイプは以下の通り:オーバーレイ」と「3D
フォントストリング使用フォント
フォントサイズf32文字の大きさ
位置ストリングポジショニングタイプ
不透明性f321オブジェクト全体の不透明度
背景の不透明度f320背景の不透明度
背景サイズストリング背景のサイズ
背景ストリング背景色
カラーストリング前景色(文字色
テキストストリング""オブジェクトのテキスト内容
イメージストリングヌル画像リソース
固定サイズブーリアンサイズが固定かどうかを判断する
ストリング100オブジェクトの幅
高さストリング100オブジェクトの高さ
トップストリングトップ・ボーダーからの縦位置
ストリング左ボーダーからの水平位置
ストリングボトムボーダーからの垂直位置
ストリング右ボーダーからの水平位置
ボーダーカラーストリングボーダーの色
ボーダー半径f320要素の角を丸める
アラインコンテンツストリングコンテンツアイテム間のスペース配分:'flex-start'、'center'、'flex-end'、'stretch'、'space-between'、'space-around'
整列項目ストリング十字軸上の項目の整列:'flex-start'、'center'、'flex-end'、'stretch'、'baseline'
アラインセルフストリング個々のフレックスアイテムの配置:'auto'、'flex-start'、'center'、'flex-end'、'stretch'、'baseline'。
ボーダー幅f320ボーダーの幅
カラムギャップストリング列間の隙間
方向ストリングテキストの方向:inherit'、'LTR'、'RTL'
表示ストリング要素の表示タイプ:'flex', 'none'
フレックスf32フレックス・グロース、シュリンク、ベーシス・ショートハンド
フレックスベースストリングフレックスアイテムの初期メインサイズ
フレックス方向ストリングコンテナ内のフレックスアイテムの方向:許可される値: 'column', 'column-reverse', 'row', 'row-reverse'
フレックスグロウf32フレックス項目が成長する能力を定義する
フレックスシュリンクf32フレックスアイテムが縮小する機能を定義する。
フレックスラップストリングフレックスアイテムを折り返すかどうか:許可される値: 'no-wrap', 'wrap', 'wrap-reverse'
ギャップストリングフレックス・アイテム間のギャップ
正当化コンテンツストリング主軸上の項目の配置:'flex-start'、'center'、'flex-end'、'space-between'、'space-around'、'space-evenly'
マージンストリング要素周囲のマージン
マージンボトムストリング下マージン
マージン左ストリング左マージン
マージン右ストリング右マージン
マージントップストリングトップマージン
最大高さストリングエレメントの最大高さ
最大幅ストリングエレメントの最大幅
ミニハイトストリング要素の最小高さ
最小幅ストリング要素の最小幅
オーバーフローストリング要素のサイズを超えるコンテンツをどのように扱うか:'visible'、'hidden'、'scroll'
パディングストリング要素内部のパディング
パディング・ボトムストリングボトムパッド
パディング左ストリング左パディング
パディング右ストリング右詰め
パディングトップストリングトップ・パディング
行間ストリング列間の隙間
テキストアラインストリング要素内のテキストの整列:'left'、'right'、'center'、'justify'

機能

Get

Returns a read-only reference.

Example

ecs.Ui.get(world, component.eid)

Set

Ensures the component exists on the entity, then assigns the (optional) data to the component.

Example

ecs.Ui.set(world, component.eid, {
type: 'overlay',
background: '#FFFFFF'
})

Mutate

Perform an update to the component within a callback function. Return true to indicate no changes made.

Example

ecs.Ui.mutate(world, component.eid, (cursor) => {
cursor.opacity = 0.5;
cursor.text = 'Hello World!';
cursor.width = 150;
return false;
})

Remove

Removes the component from the entity.

Example

ecs.Ui.remove(world, component.eid)

Has

Returns true if the component is present on the entity.

Example

ecs.Ui.has(world, component.eid)

Reset

Adds, or resets the component to its default state.

Example

ecs.Ui.reset(world, component.eid)

Advanced Functions

Cursor

Returns a mutable reference. Cursors are reused so only one cursor for each component can exist at a time.

Example
ecs.Ui.cursor(world, component.eid)

Acquire

Same behavior as cursor, but commit must be called after the cursor is done being used.

Example
ecs.Ui.acquire(world, component.eid)

Commit

Called after acquire. An optional third argument determines whether the cursor was mutated or not.

Example
ecs.Ui.commit(world, component.eid)
ecs.Ui.commit(world, component.eid, false)

Dirty

Mark the entity as having been mutated. Only needed in a specific case where systems are mutating data.

Example
ecs.Ui.dirty(world, component.eid)