Appearance
图文信息模块管理接口 Graphics
具体函数名及描述如下:
MakeGraphicsText
- 参数及类型:
- 返回值及类型:
- obj:
table文字板信息表;失败返回nil
- obj:
- 该方法的其他说明: 创建文字板图文信息数据(供创建接口使用)
- 具体使用案例如下:
lua
local data = Graphics:MakeGraphicsText([=[123]=], 16, 0, 1, true)MakeflotageText
- 参数及类型:
- 返回值及类型:
- obj:
table漂浮文字信息表;失败返回nil
- obj:
- 该方法的其他说明: 创建漂浮文字图文信息数据(供创建接口使用)
- 具体使用案例如下:
lua
local data = Graphics:MakeflotageText([=[123]=], 16, 1)MakeGraphicsProgress
- 参数及类型:
- 返回值及类型:
- obj:
table进度条信息表;失败返回nil
- obj:
- 该方法的其他说明: 创建进度条图文信息数据(供创建接口使用)
- 具体使用案例如下:
lua
local data = Graphics:MakeGraphicsProgress(100, 100, [=[0xf44336]=], 1)MakeGraphicsArrowToPos
- 参数及类型:
- 返回值及类型:
- obj:
table箭头信息表;失败返回nil
- obj:
- 该方法的其他说明: 生成指向位置的箭头图文信息数据(供创建接口使用)
- 具体使用案例如下:
lua
local data = Graphics:MakeGraphicsArrowToPos(x, y, z, 1, [=[0xf44336]=], 1)MakeGraphicsLineToPos
- 参数及类型:
- 返回值及类型:
- obj:
table线信息表;失败返回nil
- obj:
- 该方法的其他说明: 生成指向位置的线图文信息数据(供创建接口使用)
- 具体使用案例如下:
lua
local data = Graphics:MakeGraphicsLineToPos(x, y, z, 1, [=[0xf44336]=], 1)MakeGraphicsNavPathToPos
- 参数及类型:
- 返回值及类型:
- obj:
table寻路线信息表
- obj:
- 该方法的其他说明: 生成指向位置的寻路引导线图文信息数据(供创建接口使用)
- 具体使用案例如下:
lua
local playerarr = {playerId} --可见玩家数组
local result = Graphics:MakeGraphicsNavPathToPos(x, y, z, 1, playerarr)MakeGraphicsSurfaceToPos
- 参数及类型:
- 返回值及类型:
- obj:
table面信息表;失败返回nil
- obj:
- 该方法的其他说明: 生成指向位置的面图文信息数据(供创建接口使用)
- 具体使用案例如下:
lua
local data = Graphics:MakeGraphicsSurfaceToPos(x, y, z, 1, [=[0xf44336]=], 1)MakeGraphicsArrowToActor
- 参数及类型:
- 返回值及类型:
- obj:
table箭头信息表;失败返回nil
- obj:
- 该方法的其他说明: 生成指向对象的箭头图文信息数据(供创建接口使用)
- 具体使用案例如下:
lua
local data = Graphics:MakeGraphicsArrowToActor(Player:GetHostUin(), 1, [=[0xf44336]=], 1)MakeGraphicsLineToActor
- 参数及类型: objid:number:对象数据,size:number:缩放值,color:number:颜色值(0xFFFFFF),itype:number:线ID
- 返回值及类型:
- info:
table线信息内容
- info:
- 该方法的主要作用: 生成指向对象的线数据
- 具体使用案例如下:
lua
local data = Graphics:MakeGraphicsLineToActor(Player:GetHostUin(), 1, [=[0xf44336]=], 1)MakeGraphicsSurfaceToActor
- 参数及类型: objid:number:对象数据,size:number:缩放值,color:number:颜色值(0xFFFFFF),itype:number:面ID
- 返回值及类型:
- info:
table面信息内容
- info:
- 该方法的主要作用: 生成指向对象的面数据
- 具体使用案例如下:
lua
local data = Graphics:MakeGraphicsSurfaceToActor(Player:GetHostUin(), 1, [=[0xf44336]=], 1)MakeGraphicsImage
- 参数及类型:
- 返回值及类型:
- obj:
table图片信息表;参数无效返回nil
- obj:
- 该方法的其他说明: 生成图片图文信息数据(供创建接口使用)
- 具体使用案例如下:
lua
local data = Graphics:MakeGraphicsImage([=[0_10004]=], 1, 100, 1)CreateGraphicsTxtByPos
- 参数及类型:
- 返回值及类型:
- id:
number图文实例ID;失败返回nil
- id:
- 该方法的其他说明: 在指定位置创建图文信息(文字板等)
- 具体使用案例如下:
lua
y = y + 1
local data = Graphics:CreateGraphicsTxtByPos(x, y, z, Graphics:MakeGraphicsText([=[123 test]=], 16, 0, 1, true), 0, 100, worldId)CreateGraphicsTxtByActor
- 参数及类型:
- 返回值及类型:
- id:
number图文实例ID;失败返回nil
- id:
- 该方法的其他说明: 在生物身上创建文字板图文
- 具体使用案例如下:
lua
local data = Graphics:CreateGraphicsTxtByActor(playerId, Graphics:MakeGraphicsText([=[123 test]=], 16, 0, 1, true), {x = 0, y = 1, z = 0}, 20)CreateflotageTextByPos
- 参数及类型:
- 返回值及类型:
- id:
number图文实例ID;失败返回nil
- id:
- 该方法的其他说明: 在指定位置创建漂浮文字
- 具体使用案例如下:
lua
local graphicsId = Graphics:CreateflotageTextByPos(x, y, z, Graphics:MakeflotageText([=[123 floatage text 111]=], 16, 1), 0, 0, worldId)CreateflotageTextByActor
- 参数及类型:
- 返回值及类型:
- id:
number图文实例ID;失败返回nil
- id:
- 该方法的其他说明: 在生物身上创建漂浮文字
- 具体使用案例如下:
lua
local data = Graphics:CreateflotageTextByActor(playerId, Graphics:MakeflotageText([=[123 floatage text 222]=], 16, 1), {x = 0, y = 1, z = 0}, 100)CreateGraphicsProgressByPos
- 参数及类型:
- 返回值及类型:
- id:
number图文实例ID;失败返回nil
- id:
- 该方法的其他说明: 在指定位置创建进度条
- 具体使用案例如下:
lua
local data = Graphics:CreateGraphicsProgressByPos(
x, y, z, Graphics:MakeGraphicsProgress(100, 101, [=[0xf44336]=], 1),
nil, nil, worldId)CreateGraphicsProgressByActor
- 参数及类型:
- 返回值及类型:
- id:
number图文实例ID;失败返回nil
- id:
- 该方法的其他说明: 在生物身上创建进度条
- 具体使用案例如下:
lua
local data = Graphics:CreateGraphicsProgressByActor(playerId, Graphics:MakeGraphicsProgress(99, 100, [=[0xf44336]=], 1), {x = 0, y = 1, z = 0}, 100)RemoveGraphicsByPos
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否删除成功
- bool:
- 该方法的其他说明: 删除指定位置上指定类型与ID的图文信息
- 具体使用案例如下:
lua
result = Graphics:RemoveGraphicsByPos(x, y, z, itype, gtype, worldId)RemoveGraphicsByObjID
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否删除成功
- bool:
- 该方法的其他说明: 删除指定生物上指定类型与ID的图文信息
- 具体使用案例如下:
lua
local result = Graphics:RemoveGraphicsByObjID(playerId, 11, GraphicsType.Progress)UpdateGraphicsTextById
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否更新成功
- bool:
- 该方法的其他说明: 按实例ID更新文字板图文的内容(字体、透明度等)
- 具体使用案例如下:
lua
local txtgraphis1 = Graphics:CreateGraphicsTxtByPos(x, y + 2, z, Graphics:MakeGraphicsText([=[创建的文本]=], 16, 0, 1, true), 0, 100, worldId)
local txtgraphis2 = Graphics:CreateGraphicsTxtByPos(x + 1, y + 2, z, Graphics:MakeGraphicsText([=[创建的文本]=], 16, 0, 1, true), 0, 100, worldId)
if txtgraphis1 and txtgraphis2 then
self:ThreadWait(1)
end
local updateResult1 = false
local updateResult2 = false
if txtgraphis1 and txtgraphis2 then
updateResult1 = Graphics:UpdateGraphicsTextById(txtgraphis1, "更新的文本1", 20, 0.5, false)
updateResult2 = Graphics:UpdateGraphicsTextById(txtgraphis2, "更新的文本2", 20, 0.5, true)
end
--自动刷新文本
local txtgraphis3 = Graphics:CreateGraphicsTxtByPos(x+3, y, z, Graphics:MakeGraphicsText("动态文本",16, 0, 1, true), 0 , 100, WorldId)
if txtgraphis3 then
local extendparam = {1,2,3}
-- 脚本添加自动刷新图文信息功能
local function getvalues(extendparam) --参数信息是添加监听时传入的参数
return tostring(math.random(1, 9999))
end
Listen:AddGraphicsListenParam(txtgraphis3,{getvalues},extendparam) -- 添加自动刷新函数 extparam 扩展参数会传递到刷新函数里面
endUpdateGraphicsProgressById
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否更新成功
- bool:
- 该方法的其他说明: 按实例ID更新进度条图文的当前值/最大值
- 具体使用案例如下:
lua
local prograhics1 = Graphics:CreateGraphicsProgressByPos( x, y + 1, z, Graphics:MakeGraphicsProgress(90, 100, [=[0xf44336]=], 1), nil, nil, worldId)
local prograhics3 = Graphics:CreateGraphicsProgressByPos( x + 4, y + 1, z, Graphics:MakeGraphicsProgress(89, 100, [=[0xf44336]=], 1), nil, nil, worldId)
if prograhics1 and prograhics3 then
self:ThreadWait(1)
end
local updateResult1 = false
local updateResult3 = false
if prograhics1 and prograhics3 then
updateResult1 = Graphics:UpdateGraphicsProgressById(prograhics1, 10, 200, false)
updateResult3 = Graphics:UpdateGraphicsProgressById(prograhics3, 30, 40, true)
end
local prograhics2 = Graphics:CreateGraphicsProgressByPos(x - 4, y + 1, z, Graphics:MakeGraphicsProgress(10, 20, [=[0xf40000]=], 1, true),nil, nil, worldId)
if prograhics2 then
local extendparam = {1, 2, 3}
local function getvalues()
return math.random(1, 20), math.random(20, 40)
end
Listen:AddGraphicsListenParam(prograhics2, {getvalues}, extendparam)
endCreateGraphicsArrowByActorToPos
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否创建成功
- bool:
- 该方法的其他说明: 创建从生物指向位置的箭头
- 具体使用案例如下:
lua
local isSuccess = Graphics:CreateGraphicsArrowByActorToPos(playerId, Graphics:MakeGraphicsArrowToPos(x + 10, y, z, 1, [=[0xf44336]=], 1), {x = 0, y = 1, z = 0}, 20)CreateGraphicsArrowByActorToActor
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否创建成功
- bool:
- 该方法的其他说明: 创建从生物指向生物的箭头
- 具体使用案例如下:
lua
local isSuccess = Graphics:CreateGraphicsArrowByActorToActor(playerId, Graphics:MakeGraphicsArrowToActor(playerId, 1, [=[0xf44336]=], 1), {x = 0, y = 1, z = 0}, 20)CreateGraphicsArrowByPosToPos
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否创建成功
- bool:
- 该方法的其他说明: 创建从位置指向位置的箭头
- 具体使用案例如下:
lua
local isSuccess = Graphics:CreateGraphicsArrowByPosToPos({x = x, y = y + 3, z = z}, Graphics:MakeGraphicsArrowToPos(x + 10, y + 3, z, 1, [=[0xf44336]=], 1), worldId)CreateGraphicsArrowByPosToActor
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否创建成功
- bool:
- 该方法的其他说明: 创建从位置指向生物的箭头
- 具体使用案例如下:
lua
local isSuccess = Graphics:CreateGraphicsArrowByPosToActor({x = x, y = y + 3, z = z}, Graphics:MakeGraphicsArrowToActor(playerId, 1, [=[0xf44336]=], 1), worldId)CreateGraphicsLineByActorToPos
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否创建成功
- bool:
- 该方法的其他说明: 创建生物到位置的线
- 具体使用案例如下:
lua
local isSuccess = Graphics:CreateGraphicsLineByActorToPos(playerId, Graphics:MakeGraphicsLineToPos(x + 10, y, z, 1, [=[0xf44336]=], 1), {x = 0, y = 1, z = 0}, 20)CreateGraphicsNavPathByActorToPos
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否创建成功
- bool:
- 该方法的其他说明: 创建生物到位置的寻路引导线
- 具体使用案例如下:
lua
local playerarr = {playerId} --可见玩家列表
local info = Graphics:MakeGraphicsNavPathToPos(x + 5, y, z, 1,playerarr)
local result = Graphics:CreateGraphicsNavPathByActorToPos(playerId, info, {x = 1, y = 0, z = 0}, 1)CreateGraphicsLineByActorToActor
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否创建成功
- bool:
- 该方法的其他说明: 创建生物到生物的线
- 具体使用案例如下:
lua
local isSuccess = Graphics:CreateGraphicsLineByActorToActor(playerId, Graphics:MakeGraphicsLineToActor(playerId, 1, [=[0xf44336]=], 1), {x = 0, y = 1, z = 0}, 500)CreateGraphicsLineByPosToPos
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否创建成功
- bool:
- 该方法的其他说明: 创建位置到位置的线
- 具体使用案例如下:
lua
local isSuccess = Graphics:CreateGraphicsLineByPosToPos({x = x, y = y + 3, z = z}, Graphics:MakeGraphicsLineToPos(x + 10, y + 3, z, 1, [=[0xf44336]=], 1), worldId)CreateGraphicsLineByPosToActor
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否创建成功
- bool:
- 该方法的其他说明: 创建位置到生物的线
- 具体使用案例如下:
lua
local isSuccess = Graphics:CreateGraphicsLineByPosToActor({x = x + 3, y = y, z = z}, Graphics:MakeGraphicsLineToActor(playerId, 1, [=[0xf44336]=], 1), worldId)CreateGraphicsSurfaceByActorToPos
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否创建成功
- bool:
- 该方法的其他说明: 创建生物到位置的面
- 具体使用案例如下:
lua
local isSuccess = Graphics:CreateGraphicsSurfaceByActorToPos(playerId, Graphics:MakeGraphicsSurfaceToPos(x + 10, y, z, 1, [=[0xf44336]=], 1), {x = 0, y = 1, z = 0}, 20)CreateGraphicsSurfaceByActorToActor
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否创建成功
- bool:
- 该方法的其他说明: 创建生物到生物的面
- 具体使用案例如下:
lua
local isSuccess = Graphics:CreateGraphicsSurfaceByActorToActor(playerId, Graphics:MakeGraphicsSurfaceToActor(playerId, 1, [=[0xf44336]=], 1), {x = -1, y = 0, z = 0}, 500)CreateGraphicsSurfaceByPosToPos
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否创建成功
- bool:
- 该方法的其他说明: 创建位置到位置的面
- 具体使用案例如下:
lua
local isSuccess = Graphics:CreateGraphicsSurfaceByPosToPos({x = x, y = y + 3, z = z}, Graphics:MakeGraphicsSurfaceToPos(x + 10, y + 3, z, 1, [=[0xf44336]=], 1), worldId)CreateGraphicsSurfaceByPosToActor
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否创建成功
- bool:
- 该方法的其他说明: 创建位置到生物的面
- 具体使用案例如下:
lua
local isSuccess = Graphics:CreateGraphicsSurfaceByPosToActor({x = x, y = y + 3, z = z}, Graphics:MakeGraphicsSurfaceToActor(playerId, 1, [=[0xf44336]=], 1), worldId)ReplaceAllGraphics
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否迁移成功
- bool:
- 该方法的其他说明: 将源对象上的所有图文信息迁移到目标对象
- 具体使用案例如下:
lua
local objs1 = GameObject:CreatePrefab(ObjType.Mob, 3402, x - 1, y, z, 1, true, worldId)
if objs1 and #objs1 > 0 then
objid1 = objs1[1]:GetId()
Graphics:CreateGraphicsTxtByActor(objid1, Graphics:MakeGraphicsText([=[文本替换到嘟嘟鸟上面]=], 16, 0, 1, true), {x = 0, y = 1, z = 0}, 20)
end
self:ThreadWait(1.2)
local objs2 = GameObject:CreatePrefab(ObjType.Mob, 3400, x + 1, y, z, 1, true, worldId)
if objs2 and #objs2 > 0 then
objid2 = objs2[1]:GetId()
end
local result = false
if objid1 and objid2 then
result = Graphics:ReplaceAllGraphics(objid1, objid2)
print("result", result)
endCreateGraphicsImageByPos
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否创建成功
- bool:
- 该方法的其他说明: 在指定位置创建图像图文
- 具体使用案例如下:
lua
local isSuccess = Graphics:CreateGraphicsImageByPos(x, y + 3, z, Graphics:MakeGraphicsImage([=[0_10004]=], 1, 100, 1), nil, nil, worldId)CreateGraphicsImageByActor
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否创建成功
- bool:
- 该方法的其他说明: 在生物上创建图像图文
- 具体使用案例如下:
lua
local isSuccess = Graphics:CreateGraphicsImageByActor(playerId, Graphics:MakeGraphicsImage([=[0_10004]=], 1, 100, 1), {x = 0, y = 1, z = 0}, 200)GetInnerGraphicsOffset
- 参数及类型:
- tuin:
number玩家Uin - itype:
number类型(PlayerNameType)PlayerNameType - callback:function回调函数(参数为高度值)
- tuin:
- 返回值及类型: 无返回值(结果通过callback回调)
- 该方法的其他说明: 获取玩家昵称/称号的偏移高度并通过回调返回(玩家脚本调用)
- 具体使用案例如下:
lua
Graphics:GetInnerGraphicsOffset(playerId, PlayerNameType.Nick, function (height)
if height == 0 then
print("未展示")
else
print("高度", height)
end
end)CreateBrushByPos
- 参数及类型:
- 返回值及类型:
- id:
number笔刷实例ID;失败返回false
- id:
- 该方法的其他说明: 在指定位置创建笔刷区域图文<1.54+>
- 具体使用案例如下:
lua
local pos = {x = x, y = y, z = z}
local dim = {x = 3, y = 3, z = 3}
local itype = 11 --类别ID不是枚举值
local graphicsid = Graphics:CreateBrushByPos(pos, dim, 0xFF00ff, 0, itype, worldId)RemoveGraphicsByGraphicsID
lua
result = Graphics:RemoveGraphicsByGraphicsID(graphicsId)