Skip to content

图文信息模块管理接口 Graphics

具体函数名及描述如下:

序号函数名函数描述
1MakeGraphicsText(...)创建文字板信息
2MakeflotageText(...)创建漂浮文字信息
3MakeGraphicsProgress(...)创建进度条信息
4MakeGraphicsArrowToPos(...)生成指向位置的箭头数据
5MakeGraphicsLineToPos(...)生成指向位置的线数据
6MakeGraphicsNavPathToPos(...)生成寻路引导线数据
7MakeGraphicsSurfaceToPos(...)生成指向位置的面数据
8MakeGraphicsArrowToActor(...)生成指向对象的箭头数据
9MakeGraphicsLineToActor(...)生成指向对象的线数据
10MakeGraphicsSurfaceToActor(...)生成指向对象的面数据
11MakeGraphicsImage(...)生成图片信息
12CreateGraphicsTxtByPos(...)在位置上创建图文
13CreateGraphicsTxtByActor(...)在生物身上创建文字板
14CreateflotageTextByPos(...)在位置上创建漂浮文字
15CreateflotageTextByActor(...)在生物身上创建漂浮文字
16CreateGraphicsProgressByPos(...)在位置上创建进度条
17CreateGraphicsProgressByActor(...)在生物身上创建进度条
18RemoveGraphicsByPos(...)删除位置上的图文
19RemoveGraphicsByObjID(...)删除生物的图文
20UpdateGraphicsTextById(...)更新文字板内容
21UpdateGraphicsProgressById(...)更新进度条进度
22CreateGraphicsArrowByActorToPos(...)生物指向位置箭头
23CreateGraphicsArrowByActorToActor(...)生物指向生物箭头
24CreateGraphicsArrowByPosToPos(...)位置指向位置箭头
25CreateGraphicsArrowByPosToActor(...)位置指向生物箭头
26CreateGraphicsLineByActorToPos(...)生物到位置线
27CreateGraphicsNavPathByActorToPos(...)生物到位置寻路引导线
28CreateGraphicsLineByActorToActor(...)生物到生物线
29CreateGraphicsLineByPosToPos(...)位置到位置线
30CreateGraphicsLineByPosToActor(...)位置到生物线
31CreateGraphicsSurfaceByActorToPos(...)生物到位置面
32CreateGraphicsSurfaceByActorToActor(...)生物到生物面
33CreateGraphicsSurfaceByPosToPos(...)位置到位置面
34CreateGraphicsSurfaceByPosToActor(...)位置到生物面
35ReplaceAllGraphics(...)迁移所有图文到目标对象
36CreateGraphicsImageByPos(...)在位置上创建图像
37CreateGraphicsImageByActor(...)在生物上创建图像
38GetInnerGraphicsOffset(...)获取内嵌图文偏移高度
39CreateBrushByPos(...)在位置上创建笔刷
40RemoveGraphicsByGraphicsID(...)按ID删除图文

MakeGraphicsText

  • 参数及类型:
  • 返回值及类型:
    • obj:table文字板信息表;失败返回nil
  • 该方法的其他说明: 创建文字板图文信息数据(供创建接口使用)
  • 具体使用案例如下:
lua
    local data = Graphics:MakeGraphicsText([=[123]=], 16, 0, 1, true)

MakeflotageText

  • 参数及类型:
  • 返回值及类型:
    • obj:table漂浮文字信息表;失败返回nil
  • 该方法的其他说明: 创建漂浮文字图文信息数据(供创建接口使用)
  • 具体使用案例如下:
lua
    local data = Graphics:MakeflotageText([=[123]=], 16, 1)

MakeGraphicsProgress

  • 参数及类型:
    • v1:number当前值
    • v2:number最大值
    • color:number,string颜色值(0xFFFFFF)
    • itype:number进度条ID
  • 返回值及类型:
    • obj:table进度条信息表;失败返回nil
  • 该方法的其他说明: 创建进度条图文信息数据(供创建接口使用)
  • 具体使用案例如下:
lua
    local data = Graphics:MakeGraphicsProgress(100, 100, [=[0xf44336]=], 1)

MakeGraphicsArrowToPos

  • 参数及类型:
  • 返回值及类型:
    • obj:table箭头信息表;失败返回nil
  • 该方法的其他说明: 生成指向位置的箭头图文信息数据(供创建接口使用)
  • 具体使用案例如下:
lua
    local x, y, z = Actor:GetPosition(Player:GetHostUin())

    local data = Graphics:MakeGraphicsArrowToPos(x + 10, y, z, 1, [=[0xf44336]=], 1)

MakeGraphicsLineToPos

  • 参数及类型:
  • 返回值及类型:
    • obj:table线信息表;失败返回nil
  • 该方法的其他说明: 生成指向位置的线图文信息数据(供创建接口使用)
  • 具体使用案例如下:
lua
    local x, y, z = Actor:GetPosition(Player:GetHostUin())

    local data = Graphics:MakeGraphicsLineToPos(x + 10, y, z, 1, [=[0xf44336]=], 1)

MakeGraphicsNavPathToPos

  • 参数及类型:
  • 返回值及类型:
    • obj:table寻路线信息表
  • 该方法的其他说明: 生成指向位置的寻路引导线图文信息数据(供创建接口使用)
  • 具体使用案例如下:
lua
local obj = Graphics:MakeGraphicsNavPathToPos(x, y, z, itype, tCanSeePlayers)

MakeGraphicsSurfaceToPos

  • 参数及类型:
  • 返回值及类型:
    • obj:table面信息表;失败返回nil
  • 该方法的其他说明: 生成指向位置的面图文信息数据(供创建接口使用)
  • 具体使用案例如下:
lua
    local x, y, z = Actor:GetPosition(Player:GetHostUin())

    local data = Graphics:MakeGraphicsSurfaceToPos(x + 10, y, z, 1, [=[0xf44336]=], 1)

MakeGraphicsArrowToActor

  • 参数及类型:
    • objid:number对象ID
    • size:number缩放值(可选)
    • color:number,string颜色值(0xFFFFFF)
    • itype:number箭头ID
  • 返回值及类型:
    • obj:table箭头信息表;失败返回nil
  • 该方法的其他说明: 生成指向对象的箭头图文信息数据(供创建接口使用)
  • 具体使用案例如下:
lua
    local data = Graphics:MakeGraphicsArrowToActor(Player:GetHostUin(), 1, [=[0xf44336]=], 1)

MakeGraphicsLineToActor

  • 参数及类型: objid:number:对象数据,size:number:缩放值,color:number:颜色值(0xFFFFFF),itype:number:线ID
  • 返回值及类型:
    • info:table线信息内容
  • 该方法的主要作用: 生成指向对象的线数据
  • 具体使用案例如下:
lua
    local data = Graphics:MakeGraphicsLineToActor(Player:GetHostUin(), 1, [=[0xf44336]=], 1)

MakeGraphicsSurfaceToActor

  • 参数及类型: objid:number:对象数据,size:number:缩放值,color:number:颜色值(0xFFFFFF),itype:number:面ID
  • 返回值及类型:
    • info:table面信息内容
  • 该方法的主要作用: 生成指向对象的面数据
  • 具体使用案例如下:
lua
    local data = Graphics:MakeGraphicsSurfaceToActor(Player:GetHostUin(), 1, [=[0xf44336]=], 1)

MakeGraphicsImage

  • 参数及类型:
  • 返回值及类型:
    • obj:table图片信息表;参数无效返回nil
  • 该方法的其他说明: 生成图片图文信息数据(供创建接口使用)
  • 具体使用案例如下:
lua
    local data = Graphics:MakeGraphicsImage([=[0_10004]=], 1, 100, 1)

CreateGraphicsTxtByPos

  • 参数及类型:
  • 返回值及类型:
    • id:number图文实例ID;失败返回nil
  • 该方法的其他说明: 在指定位置创建图文信息(文字板等)
  • 具体使用案例如下:
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
  • 该方法的其他说明: 在生物身上创建文字板图文
  • 具体使用案例如下:
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
  • 该方法的其他说明: 在指定位置创建漂浮文字
  • 具体使用案例如下:
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
  • 该方法的其他说明: 在生物身上创建漂浮文字
  • 具体使用案例如下:
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
  • 该方法的其他说明: 在指定位置创建进度条
  • 具体使用案例如下:
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
  • 该方法的其他说明: 在生物身上创建进度条
  • 具体使用案例如下:
lua
    local data = Graphics:CreateGraphicsProgressByActor(Player:GetHostUin(), Graphics:MakeGraphicsProgress(99, 100, [=[0xf44336]=], 1), {x = 0, y = 1, z = 0}, 100)

RemoveGraphicsByPos

  • 参数及类型:
  • 返回值及类型:
  • 该方法的其他说明: 删除指定位置上指定类型与ID的图文信息
  • 具体使用案例如下:
lua
    self:ThreadWait(1)

    local result = Graphics:RemoveGraphicsByPos(x, y, z, 11, GraphicsType.Progress, WorldId)

RemoveGraphicsByObjID

  • 参数及类型:
  • 返回值及类型:
  • 该方法的其他说明: 删除指定生物上指定类型与ID的图文信息
  • 具体使用案例如下:
lua
    self:ThreadWait(1)

    local result = Graphics:RemoveGraphicsByObjID(Player:GetHostUin(), 11, GraphicsType.Progress)

UpdateGraphicsTextById

  • 参数及类型:
  • 返回值及类型:
  • 该方法的其他说明: 按实例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 扩展参数会传递到刷新函数里面

	end

UpdateGraphicsProgressById

  • 参数及类型:
  • 返回值及类型:
  • 该方法的其他说明: 按实例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 扩展参数会传递到刷新函数里面

	end

CreateGraphicsArrowByActorToPos

  • 参数及类型:
  • 返回值及类型:
  • 该方法的其他说明: 创建从生物指向位置的箭头
  • 具体使用案例如下:
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

  • 参数及类型:
  • 返回值及类型:
  • 该方法的其他说明: 创建从生物指向生物的箭头
  • 具体使用案例如下:
lua
    local isSuccess = Graphics:CreateGraphicsArrowByActorToActor(Player:GetHostUin(), Graphics:MakeGraphicsArrowToActor(Player:GetHostUin(), 1, [=[0xf44336]=], 1), {x = 0, y = 1, z = 0}, 20)

CreateGraphicsArrowByPosToPos

  • 参数及类型:
  • 返回值及类型:
  • 该方法的其他说明: 创建从位置指向位置的箭头
  • 具体使用案例如下:
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

  • 参数及类型:
  • 返回值及类型:
  • 该方法的其他说明: 创建从位置指向生物的箭头
  • 具体使用案例如下:
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

  • 参数及类型:
  • 返回值及类型:
  • 该方法的其他说明: 创建生物到位置的线
  • 具体使用案例如下:
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

  • 参数及类型:
  • 返回值及类型:
  • 该方法的其他说明: 创建生物到位置的寻路引导线
  • 具体使用案例如下:
lua
local bool = Graphics:CreateGraphicsNavPathByActorToPos(objid, info, dir, offset)

CreateGraphicsLineByActorToActor

  • 参数及类型:
  • 返回值及类型:
  • 该方法的其他说明: 创建生物到生物的线
  • 具体使用案例如下:
lua
    local isSuccess = Graphics:CreateGraphicsLineByActorToActor(Player:GetHostUin(), Graphics:MakeGraphicsLineToActor(Player:GetHostUin(), 1, [=[0xf44336]=], 1), {x = 0, y = 1, z = 0}, 500)

CreateGraphicsLineByPosToPos

  • 参数及类型:
  • 返回值及类型:
  • 该方法的其他说明: 创建位置到位置的线
  • 具体使用案例如下:
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

  • 参数及类型:
  • 返回值及类型:
  • 该方法的其他说明: 创建位置到生物的线
  • 具体使用案例如下:
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

  • 参数及类型:
  • 返回值及类型:
  • 该方法的其他说明: 创建生物到位置的面
  • 具体使用案例如下:
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

  • 参数及类型:
  • 返回值及类型:
  • 该方法的其他说明: 创建生物到生物的面
  • 具体使用案例如下:
lua
    local isSuccess = Graphics:CreateGraphicsSurfaceByActorToActor(Player:GetHostUin(), Graphics:MakeGraphicsSurfaceToActor(Player:GetHostUin(), 1, [=[0xf44336]=], 1), {x = -1, y = 0, z = 0}, 500)

CreateGraphicsSurfaceByPosToPos

  • 参数及类型:
  • 返回值及类型:
  • 该方法的其他说明: 创建位置到位置的面
  • 具体使用案例如下:
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

  • 参数及类型:
  • 返回值及类型:
  • 该方法的其他说明: 创建位置到生物的面
  • 具体使用案例如下:
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

  • 参数及类型:
  • 返回值及类型:
  • 该方法的其他说明: 将源对象上的所有图文信息迁移到目标对象
  • 具体使用案例如下:
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)

    end

CreateGraphicsImageByPos

  • 参数及类型:
  • 返回值及类型:
  • 该方法的其他说明: 在指定位置创建图像图文
  • 具体使用案例如下:
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

  • 参数及类型:
  • 返回值及类型:
  • 该方法的其他说明: 在生物上创建图像图文
  • 具体使用案例如下:
lua
    local isSuccess = Graphics:CreateGraphicsImageByActor(Player:GetHostUin(), Graphics:MakeGraphicsImage([=[0_10004]=], 1, 100, 1), {x = 0, y = 1, z = 0}, 200)

GetInnerGraphicsOffset

  • 参数及类型:
  • 返回值及类型: 无返回值(结果通过callback回调)
  • 该方法的其他说明: 获取玩家昵称/称号的偏移高度并通过回调返回(玩家脚本调用)
  • 具体使用案例如下:
lua
    Graphics:GetInnerGraphicsOffset(Player:GetHostUin(), PlayerNameType.Nick, function (height)

        if height == 0 then

            print("未展示")

        else

            print("高度", height)

        end

    end)

CreateBrushByPos

  • 参数及类型:
    • pos:table位置坐标
    • dim:table尺寸
    • color:number,string颜色值(0xFFFFFF)
    • showuin:number显示玩家Uin(0全部)
    • itype:number类别ID
    • worldId:number星球ID(可选)
  • 返回值及类型:
    • id:number笔刷实例ID;失败返回false
  • 该方法的其他说明: 在指定位置创建笔刷区域图文<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

  • 参数及类型:
  • 返回值及类型:
  • 该方法的其他说明: 按图文实例ID删除图文信息
  • 具体使用案例如下:
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)