ChatWindowConfiguration

显示已弃用

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

无法创建

配置默认文字聊天窗口的属性。它的父辈是 TextChatService

概要

属性

属性

AbsolutePosition

只读
未复制

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

AbsoluteSize

只读
未复制

只读属性,提供默认聊天窗口的像素屏幕尺寸。与 GuiBase2d.AbsoluteSize 相似。

BackgroundColor3

读取并联

默认聊天窗口的背景颜色。如果背景颜色未被覆盖,这个值将尊重用户的 GuiService.PreferredTransparency ,使菜单变得更灰,因为菜单透明度降低。默认值为 Color3.new(25, 27, 29)

BackgroundTransparency

读取并联

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

Enabled

读取并联

是否显示默认聊天窗口。设置为 false 隐藏。

FontFace

读取并联

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

HeightScale

读取并联

默认聊天窗口高度应缩放的因子。必须在 0.52 之间的值。定义超出范围的值将实际值卡住到最近的边界。

HorizontalAlignment

聊天窗口的横向对齐。行为类似于 UIGridStyleLayout.HorizontalAlignment .设置为 LeftRight 添加一小块垫子,远离触碰屏幕相应的垂直边缘。将设置为 Center 将窗口调整到屏幕中间的横向。默认值为 Left

TextColor3

读取并联

默认聊天窗口中文本的颜色。默认值为 Color3.new(255, 255, 255)

TextSize

读取并联

默认聊天窗口中文本的大小。默认值为 14

TextStrokeColor3

读取并联

默认聊天窗口中文本行的颜色。默认值为 Color3.new(0, 0, 0)

TextStrokeTransparency

读取并联

默认聊天窗口中文本的stroke透明度。默认值为 0.5

VerticalAlignment

聊天窗口的垂直对齐。行为类似于 UIGridStyleLayout.VerticalAlignment .将设置为 TopBottom 添加一小块垫子,远离触碰屏幕相应边缘。将设置为 Center 将窗口调整到屏幕垂直中间。默认值为 Top

WidthScale

读取并联

默认聊天窗口宽度应缩放的因子。必须在 0.52 之间的值。定义超出范围的值将实际值卡住到最近的边界。

方法

DeriveNewMessageProperties

创建一个新的 ChatWindowMessageProperties 实例,可用于自定义聊天窗口中的消息外观。ChatWindowMessagePropertiesTextChatMessageProperties 继承。

这是用于在自定义 TextChatService.OnChatWindowAdded 回调期间使用的。


local TextChatService = game:GetService("TextChatService")
local ChatWindowConfiguration = TextChatService.ChatWindowConfiguration
TextChatService.OnChatWindowAdded = function(textChatMessage)
local properties = ChatWindowConfiguration:DeriveNewMessageProperties()
if textChatMessage.Metadata == "Important" then
properties.TextColor3 = Color3.fromRGB(255, 0, 0)
end
return properties
end

返回

代码示例

This example checks if two users can chat, creates a new TextChannel, and adds them to it.

CanUsersDirectChatAsync

local TextChatService = game:GetService("TextChatService")
local directChatParticipants = TextChatService:CanUsersDirectChatAsync(userId1, { userId2 })
-- Check for eligible participants
if #directChatParticipants > 0 then
local directChannel = Instance.new("TextChannel")
directChannel.Parent = TextChatService
for _, participant in directChatParticipants do
directChannel:AddUserAsync(participant)
end
return directChannel
end
warn("Could not create TextChannel. Not enough eligible users.")
return nil

活动