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 x, y, z = Actor:GetPosition(Player:GetHostUin())
local data = Graphics:MakeGraphicsArrowToPos(x + 10, y, z, 1, [=[0xf44336]=], 1)MakeGraphicsLineToPos
- 参数及类型:
- 返回值及类型:
- obj:
table线信息表;失败返回nil
- obj:
- 该方法的其他说明: 生成指向位置的线图文信息数据(供创建接口使用)
- 具体使用案例如下:
lua
local x, y, z = Actor:GetPosition(Player:GetHostUin())
local data = Graphics:MakeGraphicsLineToPos(x + 10, y, z, 1, [=[0xf44336]=], 1)MakeGraphicsNavPathToPos
- 参数及类型:
- 返回值及类型:
- obj:
table寻路线信息表
- obj:
- 该方法的其他说明: 生成指向位置的寻路引导线图文信息数据(供创建接口使用)
- 具体使用案例如下:
lua
local obj = Graphics:MakeGraphicsNavPathToPos(x, y, z, itype, tCanSeePlayers)MakeGraphicsSurfaceToPos
- 参数及类型:
- 返回值及类型:
- obj:
table面信息表;失败返回nil
- obj:
- 该方法的其他说明: 生成指向位置的面图文信息数据(供创建接口使用)
- 具体使用案例如下:
lua
local x, y, z = Actor:GetPosition(Player:GetHostUin())
local data = Graphics:MakeGraphicsSurfaceToPos(x + 10, 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
local x, y, z = Actor:GetPosition(Player:GetHostUin())
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(Player:GetHostUin(), Graphics:MakeGraphicsText([=[123 test]=], 16, 0, 1, true), {x = 0, y = 1, z = 0}, 20)CreateflotageTextByPos
- 参数及类型:
- 返回值及类型:
- id:
number图文实例ID;失败返回nil
- id:
- 该方法的其他说明: 在指定位置创建漂浮文字
- 具体使用案例如下:
lua
local x, y, z = Actor:GetPosition(Player:GetHostUin())
local data = Graphics:CreateflotageTextByPos(x, y, z, Graphics:MakeflotageText([=[123 floatage text 111]=], 16, 1), WorldId)CreateflotageTextByActor
- 参数及类型:
- 返回值及类型:
- id:
number图文实例ID;失败返回nil
- id:
- 该方法的其他说明: 在生物身上创建漂浮文字
- 具体使用案例如下:
lua
local data = Graphics:CreateflotageTextByActor(Player:GetHostUin(), Graphics:MakeflotageText([=[123 floatage text 222]=], 16, 1), {x = 0, y = 1, z = 0}, 100)CreateGraphicsProgressByPos
- 参数及类型:
- 返回值及类型:
- id:
number图文实例ID;失败返回nil
- id:
- 该方法的其他说明: 在指定位置创建进度条
- 具体使用案例如下:
lua
local x, y, z = Actor:GetPosition(Player:GetHostUin())
local data = Graphics:CreateGraphicsProgressByPos(x, y, z, Graphics:MakeGraphicsProgress(100, 101, [=[0xf44336]=], 1), WorldId)CreateGraphicsProgressByActor
- 参数及类型:
- 返回值及类型:
- id:
number图文实例ID;失败返回nil
- id:
- 该方法的其他说明: 在生物身上创建进度条
- 具体使用案例如下:
lua
local data = Graphics:CreateGraphicsProgressByActor(Player:GetHostUin(), Graphics:MakeGraphicsProgress(99, 100, [=[0xf44336]=], 1), {x = 0, y = 1, z = 0}, 100)RemoveGraphicsByPos
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否删除成功
- bool:
- 该方法的其他说明: 删除指定位置上指定类型与ID的图文信息
- 具体使用案例如下:
lua
self:ThreadWait(1)
local result = Graphics:RemoveGraphicsByPos(x, y, z, 11, GraphicsType.Progress, WorldId)RemoveGraphicsByObjID
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否删除成功
- bool:
- 该方法的其他说明: 删除指定生物上指定类型与ID的图文信息
- 具体使用案例如下:
lua
self:ThreadWait(1)
local result = Graphics:RemoveGraphicsByObjID(Player:GetHostUin(), 11, GraphicsType.Progress)UpdateGraphicsTextById
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否更新成功
- bool:
- 该方法的其他说明: 按实例ID更新文字板图文的内容(字体、透明度等)
- 具体使用案例如下:
lua
local x, y, z = Actor:GetPosition(Player:GetHostUin())
y = y + 2
local txtgraphis1 = Graphics:CreateGraphicsTxtByPos(x, y, z, Graphics:MakeGraphicsText([=[创建的文本]=], 16, 0, 1, true), 0 , 100, WorldId)
local txtgraphis2 = Graphics:CreateGraphicsTxtByPos(x+1, y, z, Graphics:MakeGraphicsText([=[创建的文本]=], 16, 0, 1, true), 0 , 100, WorldId)
if txtgraphis1 and txtgraphis2 then
self:ThreadWait(1)
-- 图文信息更新 一般用于间隔一段时间同步
Graphics:UpdateGraphicsTextById(txtgraphis1, "更新的文本1",20,0.5,false) -- 更新文本内容 字体 透明度
Graphics:UpdateGraphicsTextById(txtgraphis2, "更新的文本2",20,0.5,true) -- 更新文本内容 字体 透明度 (最后一次传入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 x, y, z = Actor:GetPosition(Player:GetHostUin())
y = y + 1
local prograhics1 = Graphics:CreateGraphicsProgressByPos(x, y, z, Graphics:MakeGraphicsProgress(90, 100, [=[0xf44336]=], 1), WorldId)
local prograhics3 = Graphics:CreateGraphicsProgressByPos(x + 4, y, z, Graphics:MakeGraphicsProgress(89, 100, [=[0xf44336]=], 1), WorldId)
if prograhics1 and prograhics3 then
self:ThreadWait(1)
Graphics:UpdateGraphicsProgressById(prograhics1, 10,200,false) -- 更新进度条的最小值和最大值
Graphics:UpdateGraphicsProgressById(prograhics3, 30,40,true) -- 更新进度条的最小值和最大值 (最后一次传入true会同步到其他客户端)
end
local prograhics2 = Graphics:CreateGraphicsProgressByPos(x-4, y, z, Graphics:MakeGraphicsProgress(10, 20, [=[0xf40000]=], 1, true), 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) -- 添加自动刷新函数 extparam 扩展参数会传递到刷新函数里面
endCreateGraphicsArrowByActorToPos
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否创建成功
- bool:
- 该方法的其他说明: 创建从生物指向位置的箭头
- 具体使用案例如下:
lua
local x, y, z = Actor:GetPosition(Player:GetHostUin())
local isSuccess = Graphics:CreateGraphicsArrowByActorToPos(Player:GetHostUin(), 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(Player:GetHostUin(), Graphics:MakeGraphicsArrowToActor(Player:GetHostUin(), 1, [=[0xf44336]=], 1), {x = 0, y = 1, z = 0}, 20)CreateGraphicsArrowByPosToPos
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否创建成功
- bool:
- 该方法的其他说明: 创建从位置指向位置的箭头
- 具体使用案例如下:
lua
local x, y, z = Actor:GetPosition(Player:GetHostUin())
y = y + 3
local isSuccess = Graphics:CreateGraphicsArrowByPosToPos({x = x, y = y, z = z}, Graphics:MakeGraphicsArrowToPos(x + 10, y, z, 1, [=[0xf44336]=], 1), WorldId)CreateGraphicsArrowByPosToActor
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否创建成功
- bool:
- 该方法的其他说明: 创建从位置指向生物的箭头
- 具体使用案例如下:
lua
local x, y, z = Actor:GetPosition(Player:GetHostUin())
y = y + 3
local isSuccess = Graphics:CreateGraphicsArrowByPosToActor({x = x, y = y, z = z}, Graphics:MakeGraphicsArrowToActor(Player:GetHostUin(), 1, [=[0xf44336]=], 1), WorldId)CreateGraphicsLineByActorToPos
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否创建成功
- bool:
- 该方法的其他说明: 创建生物到位置的线
- 具体使用案例如下:
lua
local x, y, z = Actor:GetPosition(Player:GetHostUin())
local isSuccess = Graphics:CreateGraphicsLineByActorToPos(Player:GetHostUin(), Graphics:MakeGraphicsLineToPos(x + 10, y, z, 1, [=[0xf44336]=], 1), {x = 0, y = 1, z = 0}, 20)CreateGraphicsNavPathByActorToPos
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否创建成功
- bool:
- 该方法的其他说明: 创建生物到位置的寻路引导线
- 具体使用案例如下:
lua
local bool = Graphics:CreateGraphicsNavPathByActorToPos(objid, info, dir, offset)CreateGraphicsLineByActorToActor
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否创建成功
- bool:
- 该方法的其他说明: 创建生物到生物的线
- 具体使用案例如下:
lua
local isSuccess = Graphics:CreateGraphicsLineByActorToActor(Player:GetHostUin(), Graphics:MakeGraphicsLineToActor(Player:GetHostUin(), 1, [=[0xf44336]=], 1), {x = 0, y = 1, z = 0}, 500)CreateGraphicsLineByPosToPos
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否创建成功
- bool:
- 该方法的其他说明: 创建位置到位置的线
- 具体使用案例如下:
lua
local x, y, z = Actor:GetPosition(Player:GetHostUin())
y = y + 3
local isSuccess = Graphics:CreateGraphicsLineByPosToPos({x = x, y = y, z = z}, Graphics:MakeGraphicsLineToPos(x + 10, y, z, 1, [=[0xf44336]=], 1), WorldId)CreateGraphicsLineByPosToActor
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否创建成功
- bool:
- 该方法的其他说明: 创建位置到生物的线
- 具体使用案例如下:
lua
local x, y, z = Actor:GetPosition(Player:GetHostUin())
x = x + 3
local isSuccess = Graphics:CreateGraphicsLineByPosToActor({x = x, y = y, z = z}, Graphics:MakeGraphicsLineToActor(Player:GetHostUin(), 1, [=[0xf44336]=], 1), WorldId)CreateGraphicsSurfaceByActorToPos
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否创建成功
- bool:
- 该方法的其他说明: 创建生物到位置的面
- 具体使用案例如下:
lua
local x, y, z = Actor:GetPosition(Player:GetHostUin())
local isSuccess = Graphics:CreateGraphicsSurfaceByActorToPos(Player:GetHostUin(), 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(Player:GetHostUin(), Graphics:MakeGraphicsSurfaceToActor(Player:GetHostUin(), 1, [=[0xf44336]=], 1), {x = -1, y = 0, z = 0}, 500)CreateGraphicsSurfaceByPosToPos
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否创建成功
- bool:
- 该方法的其他说明: 创建位置到位置的面
- 具体使用案例如下:
lua
local x, y, z = Actor:GetPosition(Player:GetHostUin())
y = y + 3
local isSuccess = Graphics:CreateGraphicsSurfaceByPosToPos({x = x, y = y, z = z}, Graphics:MakeGraphicsSurfaceToPos(x + 10, y, z, 1, [=[0xf44336]=], 1), WorldId)CreateGraphicsSurfaceByPosToActor
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否创建成功
- bool:
- 该方法的其他说明: 创建位置到生物的面
- 具体使用案例如下:
lua
local x, y, z = Actor:GetPosition(Player:GetHostUin())
y = y + 3
local isSuccess = Graphics:CreateGraphicsSurfaceByPosToActor({x = x, y = y, z = z}, Graphics:MakeGraphicsSurfaceToActor(Player:GetHostUin(), 1, [=[0xf44336]=], 1), WorldId)ReplaceAllGraphics
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否迁移成功
- bool:
- 该方法的其他说明: 将源对象上的所有图文信息迁移到目标对象
- 具体使用案例如下:
lua
local objs = GameObject:CreatePrefab(ObjType.Mob, 3400, x + 1,y,z, 1) -- 创建两个游戏内生物
if objs and #objs > 0 then
objid2 = objs[1]:GetId()
result = Graphics:ReplaceAllGraphics(objid1,objid2)
print("result", result)
endCreateGraphicsImageByPos
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否创建成功
- bool:
- 该方法的其他说明: 在指定位置创建图像图文
- 具体使用案例如下:
lua
local x, y, z = Actor:GetPosition(Player:GetHostUin())
y = y + 3
local isSuccess = Graphics:CreateGraphicsImageByPos(x, y, z, Graphics:MakeGraphicsImage([=[0_10004]=], 1, 100, 1), WorldId)CreateGraphicsImageByActor
- 参数及类型:
- 返回值及类型:
- bool:
boolean是否创建成功
- bool:
- 该方法的其他说明: 在生物上创建图像图文
- 具体使用案例如下:
lua
local isSuccess = Graphics:CreateGraphicsImageByActor(Player:GetHostUin(), 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(Player:GetHostUin(), PlayerNameType.Nick, function (height)
if height == 0 then
print("未展示")
else
print("高度", height)
end
end)CreateBrushByPos
- 参数及类型:
- 返回值及类型:
- id:
number笔刷实例ID;失败返回false
- id:
- 该方法的其他说明: 在指定位置创建笔刷区域图文<1.54+>
- 具体使用案例如下:
lua
local x, y, z = Actor:GetPosition(Player:GetHostUin())
local pos = {x = x, y = y, z = z}
local dim = {x = 3, y = 3, z = 3}
local itype = 11
-- 在玩家位置创建一个3x3x3的方块预览
local graphicsid = Graphics:CreateBrushByPos( pos, dim, 0xFF00ff, Player:GetHostUin(), itype)RemoveGraphicsByGraphicsID
lua
local x, y, z = Actor:GetPosition(Player:GetHostUin())
y = y + 2
local graphicsid = Graphics:CreateGraphicsTxtByPos(x, y, z, Graphics:MakeGraphicsText([=[123 test]=], 16, 0, 1, true), 0 , 100, WorldId)
self:ThreadWait(2)
local result = Graphics:RemoveGraphicsByGraphicsID(graphicsid)