ChatInputBarConfiguration

显示已弃用

*此内容使用人工智能(Beta)翻译,可能包含错误。若要查看英文页面,请点按 此处

无法创建

配置默认文本聊天输入栏的属性。它是父辈到 TextChatService

概要

属性

属性

AbsolutePosition

只读
未复制

只读属性,提供默认聊天输入栏的屏幕位置以像素。与 GuiBase2d.AbsolutePosition 相似。

AbsoluteSize

只读
未复制

只读属性,提供默认聊天输入栏的屏幕尺寸以像素。行为类似于 GuiBase2d.AbsoluteSize

AutocompleteEnabled

读取并联

是否启用聊天输入栏的自动完成。设置为 false 以禁用自动完成。

BackgroundColor3

读取并联

默认聊天输入栏的背景颜色。默认值为 Color3.new(25, 27, 29)

BackgroundTransparency

读取并联

默认聊天输入栏的背景透明度为 01 之间的数字。这个值与用户的 GuiService.PreferredTransparency 乘以以创建聊天输入栏使用的有效背景透明度,可能比这里设置的值更不透明。默认值为 0.2

Enabled

读取并联

是否显示默认聊天输入栏。设置为 false 隐藏。

FontFace

读取并联

用于在默认聊天输入栏中渲染文本的字体。默认值为 Enum.Font.BuilderSansMedium

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.

Typing Indicator Bubble

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

读取并联

额外的关键用户可以按下以触发关注默认聊天输入栏的操作。当您想要在 / 键之外还有一个额外的快捷键来进行聚焦时,有用。

PlaceholderColor3

读取并联

默认聊天输入栏中的占位符文本的颜色。默认值为 Color3.new(178, 178, 178)

TargetTextChannel

读取并联

决定在用户发送消息时使用哪个 TextChannel 默认聊天输入栏。

TextBox

读取并联

指向指定的 TextBox 实例,该实例代表用户发送消息。您可以使用它来自由操纵外观、位置和布局,进一步整合自定义聊天输入栏 UI 到您的体验中。当选择将此属性设置为自定义 TextBox 时,您不需要为以下行为写任何代码:

为了安全,在晋升到 ChatInputBarConfiguration.TextBox 时,对 TextBox 会被施加一些限制。 Luau 代码将无法:

TextColor3

读取并联

默认聊天输入栏的文本颜色。默认值为 Color3.new(255, 255, 255)

TextSize

读取并联

默认聊天输入栏的文本大小。默认值为 14

TextStrokeColor3

读取并联

默认聊天输入栏中文本的字体颜色。默认值为 Color3.new(0, 0, 0)

TextStrokeTransparency

读取并联

默认聊天输入栏中文本的纹理透明度。默认值为 0.5

方法

活动