# Mini-map Management

Before using the Mini-map API, you need to create a Mini-map API Management object as follows:

local MapMark = class.MapMark.new()

The specific function name and description are as follows:

Serial number Function name Description
1 newShape(...) Add a shape (line, rectangle, circle)
2 deleteShape(...) Delete a shape
3 setShapeColor(...) Set shape color
4 showShape(...) Set shape display or hide
5 updateLine(...) Update shape (line), pass in start and end coordinates
6 updateRectangle(...) Update shape (rectangle), pass in start coordinates and size
7 updateCircle(...) Update shape (circle), pass in center coordinates and radius

# newShape

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Add a shape (line, rectangle, circle)
  • The specific use cases are as follows:
--在地图创建一条黑色的线并显示(貌似没有效果)
--第一个参数0是形状类型:0线 1矩形 2圆形
--第二个参数是是否显示:true是 false否
--后三个参数是形状颜色,分别是R、G、B(红绿蓝)
local result,shapeid=MapMark:newShape(0,true,0,0,0)
--在聊天框显示
Chat:sendSystemMsg("创建了一条黑色的线!")

# deleteShape

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Delete a shape
  • The specific use cases are as follows:
--把id为1的形状删除,参数1就是要删除的形状id
MapMark:deleteShape(1)
--在聊天框显示
Chat:sendSystemMsg("删除了id为1的形状!")

# setShapeColor

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set shape color
  • The specific use cases are as follows:
--把id为1的形状设置为黑色
--第一个参数是形状id
--后三个参数是要改成的颜色,分别是R、G、B(红绿蓝)
MapMark:setShapeColor(1,0,0,0)
--在聊天框显示
Chat:sendSystemMsg("id为1的形状被设置成了黑色!")

# showShape

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set shape display or hide
  • The specific use cases are as follows:
--把id为1的形状隐藏
--第一个参数是形状id
--第二个参数是是否隐藏,true显示 false隐藏
MapMark:showShape(1,false)
--在聊天框显示
Chat:sendSystemMsg("隐藏了id为1的形状!")

# updateLine

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Update shape (line), pass in start and end coordinates
  • The specific use cases are as follows:
--把id为1的形状(只能是直线)设置为从(0,0)到(1,1)
--第一个参数1是直线形状id
--第二、三个参数0,0是直线起点坐标
--后两个参数1,1是直线终点坐标
MapMark:updateLine(1,0,0,1,1)
--在聊天框显示
Chat:sendSystemMsg("id为1的直线被设置为了从(0,0)到(1,1)")

# updateRectangle

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Update shape (rectangle), pass in start coordinates and size
  • The specific use cases are as follows:
--把id为1的形状(只能是矩形)设置为从(0,0)开始宽和高分别为1和1的矩形
--第一个参数1是矩形形状id
--第二、三个参数0,0是矩形起点坐标
--后两个参数1,1是矩形宽高尺寸
MapMark:updateRectangle(1,0,0,1,1)
--在聊天框显示
Chat:sendSystemMsg("id为1的矩形被设置为了起点在(0,0),宽高分别是1和1")

# updateCircle

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Update shape (circle), pass in center coordinates and radius
  • The specific use cases are as follows:
--把id为1的形状(只能是圆)设置为圆心为(0,0),半径为1的圆
--第一个参数1是圆形形状id
--第二、三个参数0,0是圆的圆心坐标
--最后一个参数1是圆的半径
MapMark:updateCircle(1,0,0,1)
--在聊天框显示
Chat:sendSystemMsg("id为1的圆被设置为了圆心在(0,0),半径为1")
Last Update: 6/11/2020, 9:30:46 PM