学习
引擎类
ChatInputBarConfiguration
无法创建

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


代码示例
获取总聊天 UI 边界
local Players = game:GetService("Players")
local TextChatService = game:GetService("TextChatService")
local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local windowConfig = TextChatService.ChatWindowConfiguration
local inputBarConfig = TextChatService.ChatInputBarConfiguration
local function getTotalChatBounds()
local windowPos = windowConfig.AbsolutePosition
local windowSize = windowConfig.AbsoluteSize
local inputPos = inputBarConfig.AbsolutePosition
local inputSize = inputBarConfig.AbsoluteSize
-- 计算两个矩形的并集以获得总聊天 UI 边界。
-- 报告的值不包括聊天窗口顶部和底部边缘的装饰斜边。
local topLeft = Vector2.new(
math.min(windowPos.X, inputPos.X),
math.min(windowPos.Y, inputPos.Y)
)
local bottomRight = Vector2.new(
math.max(windowPos.X + windowSize.X, inputPos.X + inputSize.X),
math.max(windowPos.Y + windowSize.Y, inputPos.Y + inputSize.Y)
)
return topLeft, bottomRight - topLeft
end
-- 等待聊天 UI 初始化并报告绝对值
task.wait(2)
local position, size = getTotalChatBounds()
print("总聊天 UI 位置:", position)
print("总聊天 UI 尺寸:", size)
-- 覆盖一个半透明的框架以可视化验证边界
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "ChatBoundsDebug"
screenGui.DisplayOrder = 100
screenGui.Parent = playerGui
local frame = Instance.new("Frame")
frame.Position = UDim2.fromOffset(position.X, position.Y)
frame.Size = UDim2.fromOffset(size.X, size.Y)
frame.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
frame.BackgroundTransparency = 0.5
frame.BorderSizePixel = 2
frame.BorderColor3 = Color3.fromRGB(255, 0, 0)
frame.Parent = screenGui

API 参考
属性
AbsolutePosition
只读
未复制
功能: Chat
ChatInputBarConfiguration.AbsolutePosition:Vector2

AbsoluteSize
只读
未复制
功能: Chat
ChatInputBarConfiguration.AbsoluteSize:Vector2

AutocompleteEnabled
读取并联
功能: Chat
ChatInputBarConfiguration.AutocompleteEnabled:boolean

BackgroundColor3
读取并联
功能: Chat
ChatInputBarConfiguration.BackgroundColor3:Color3

BackgroundTransparency
读取并联
功能: Chat
ChatInputBarConfiguration.BackgroundTransparency:number

Enabled
读取并联
功能: Chat
ChatInputBarConfiguration.Enabled:boolean

FontFace
读取并联
功能: Chat
ChatInputBarConfiguration.FontFace:Font

IsFocused
只读
未复制
功能: Chat
ChatInputBarConfiguration.IsFocused:boolean
代码示例
输入指示气泡
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()
-- 设置 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
-- 将 UICorner 父级附加到 TextLabel 以获得圆角
local uiCorner = Instance.new("UICorner")
uiCorner.CornerRadius = UDim.new(0, 12)
uiCorner.Parent = textLabel
-- 设置 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()
-- 当输入栏获得焦点时启用输入指示器,否则禁用
typingIndicatorBillboard.Enabled = ChatInputBarConfiguration.IsFocused
end)

KeyboardKeyCode
读取并联
功能: Chat
ChatInputBarConfiguration.KeyboardKeyCode:Enum.KeyCode

PlaceholderColor3
读取并联
功能: Chat
ChatInputBarConfiguration.PlaceholderColor3:Color3

TargetTextChannel
读取并联
功能: Chat
ChatInputBarConfiguration.TargetTextChannel:TextChannel

TextBox
读取并联
功能: Chat
ChatInputBarConfiguration.TextBox:TextBox

TextColor3
读取并联
功能: Chat
ChatInputBarConfiguration.TextColor3:Color3

TextSize
读取并联
功能: Chat
ChatInputBarConfiguration.TextSize:number

TextStrokeColor3
读取并联
功能: Chat
ChatInputBarConfiguration.TextStrokeColor3:Color3

TextStrokeTransparency
读取并联
功能: Chat
ChatInputBarConfiguration.TextStrokeTransparency:number

©2026 Roblox Corporation、Roblox、Roblox 标志及 Powering Imagination 是我们在美国及其他国家或地区的注册与未注册商标。