ChatInputBarConfiguration
*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。
デフォルトのテキストチャット入力バーのプロパティを設定します。親は TextChatService です。
概要
プロパティ
デフォルトのチャット入力バーの実際の画面位置をピクセルで表示します。
デフォルトのチャット入力バーの実際のスクリーンサイズをピクセルで。
チャット入力バーの自動完了を有効にするかどうか。
デフォルトのチャット入力バーの背景色。
デフォルトのチャット入力バーの背景透明度。
デフォルトのチャット入力バーを表示するかどうか。
デフォルトのチャット入力バーでテキストをレンダリングするフォント。
デフォルトのチャット入力バーが焦点合致しているか否か。
追加のキーユーザーが押すと、デフォルトのチャット入力バーに焦点が合うようにトリガーが発動します。
デフォルトのチャット入力バーのプレースホルダーテキストの色。
ターゲットの参照 TextChannel 。
ユーザーを代表してメッセージを送信する指定された TextBox インスタンスへの参照
デフォルトのチャット入力バーのテキストの色。
デフォルトのチャット入力バーのテキストのサイズ。
デフォルトのチャット入力バーのテキストのストロークの色。
デフォルトのチャット入力バーのテキストストロークの透明性。
プロパティ
BackgroundTransparency
デフォルトのチャット入力バーの背景透明度は、0 と 1 の間の数字です。この値は、ユーザーの GuiService.PreferredTransparency と掛け算して、チャット入力バーに使用される有効な背景透明度を作成し、この値セットよりも不透明になる可能性があります。デフォルト値は 0.2 です。
IsFocused
デフォルトのチャット入力バーが焦点合致しているかどうかを示します。プロパティが変更されたイベントを発射するのに便利なので、入力バーの焦点状態の変更に応答するコールバック関数を実装できます。
コードサンプル
The code below includes a simple way to create a typing indicator bubble above a user's avatar when the user is typing. Paste into a LocalScript.
local Players = game:GetService("Players")
local TextChatService = game:GetService("TextChatService")
local ChatInputBarConfiguration = TextChatService:FindFirstChildOfClass("ChatInputBarConfiguration")
local BubbleChatConfiguration = TextChatService:FindFirstChildOfClass("BubbleChatConfiguration")
local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
-- Set up TextLabel
local textLabel = Instance.new("TextLabel")
textLabel.Size = UDim2.fromScale(1, 1)
textLabel.Text = ". . ."
textLabel.BackgroundColor3 = BubbleChatConfiguration.BackgroundColor3
textLabel.BorderColor3 = BubbleChatConfiguration.BackgroundColor3
textLabel.BackgroundTransparency = BubbleChatConfiguration.BackgroundTransparency
textLabel.TextColor3 = BubbleChatConfiguration.TextColor3
textLabel.FontFace = BubbleChatConfiguration.FontFace
textLabel.TextSize = BubbleChatConfiguration.TextSize
-- Parent a UICorner to the TextLabel to have rounded corners
local uiCorner = Instance.new("UICorner")
uiCorner.CornerRadius = UDim.new(0, 12)
uiCorner.Parent = textLabel
-- Set up Billboard
local typingIndicatorBillboard = Instance.new("BillboardGui")
typingIndicatorBillboard.Enabled = false
typingIndicatorBillboard.Size = UDim2.fromScale(1, 1)
typingIndicatorBillboard.StudsOffsetWorldSpace = Vector3.new(-0, 4, 0)
typingIndicatorBillboard.Adornee = Character
textLabel.Parent = typingIndicatorBillboard
typingIndicatorBillboard.Parent = LocalPlayer:FindFirstChildOfClass("PlayerGui")
ChatInputBarConfiguration:GetPropertyChangedSignal("IsFocused"):Connect(function()
-- Enable the typing indicator when the input bar is focused and disable otherwise
typingIndicatorBillboard.Enabled = ChatInputBarConfiguration.IsFocused
end)
KeyboardKeyCode
追加のキーユーザーが押すと、デフォルトのチャット入力バーに焦点が合うようにトリガーが発動します。/ キーに加えて焦点を合わせるための追加のホットキーを持ちたい場合に便利。
TextBox
ユーザーを代表してメッセージを送信する指定された TextBox インスタンスへの参照見た目、外見所、レイアウトを自由に操作して、カスタムチャット入力バー UI をより経験に統合できます。このプロパティをカスタムの TextBox に設定することを選択すると、次の動作のためにコードを書く必要はありません:
- ユーザーがメッセージを入力し、Enum.KeyCode.Return を押すと、メッセージが ChatInputBarConfiguration.TargetTextChannel に送信されます。
- メッセージが送信されると、TextBox.Text が自動的消すクリアされます。
セキュリティのため、TextBox が ChatInputBarConfiguration.TextBox に昇格すると、Luau コードは次の制限が課せられます:
- TextBox.Text プロパティを変更します。
- 使用する TextBox:CaptureFocus() または TextBox:ReleaseFocus() メソッド。