# UI Management

Before using UI API, you need to create a UI API Management object as follows:

local UI = class.UI.new()

The specific function name and description are as follows:

Serial number Function name Description
1 setGBattleUI(...) Set the battle ended UI
2 world2RadarPos(...) Convert world coordinates to Mini-map
3 world2RadarDist(...) Convert world length to Mini-map
4 setMinimapRenderMode(...) Set Mini-map rander mode:1. The 45 degree rotation view angle; 2.The overall view Angle
5 setShapeLine(...) Map marker shape set to Line Shape
6 setShapeCircle(...) Map marker shape set to Circle Shape
7 ShowScreenEffect(...) display screen effects

# setGBattleUI

  • Parameters and types:
    • name:string Set name
    • value:string or boolean Set value
  • Return value and types:
  • The main role of this method: Set the battle ended UI
  • The specific use cases are as follows:
--设置游戏结束界面(有些貌似没效果)
--设置左标题,只需要修改第二个参数
UI:setGBattleUI("left_title","这里是左标题")
--设置右标题,只需要修改第二个参数
UI:setGBattleUI("rigjt_title","这里是右标题")
--设置左描述,只需要修改第二个参数
UI:setGBattleUI("left_desc","这里是左描述")
--设置左简述,只需要修改第二个参数
UI:setGBattleUI("left_title_desc","这里是左简述")
--设置右简述,只需要修改第二个参数
UI:setGBattleUI("right_title_desc","这里是右简述")
--设置比分导航栏面板按钮是否显示,true显示 false不显示
UI:setGBattleUI("battle_btn",true)
--设置比赛结果是否显示,true显示 false不显示
UI:setGBattleUI("result",true)
--设置比赛结果底板是否显示,true显示 false不显示
UI:setGBattleUI("result_bkg",true)
--设置再来一局按钮是否显示,true显示 false不显示
UI:setGBattleUI("reopen",true)
--在聊天框显示提示
Chat:sendSystemMsg("做动画表情结束游戏即可查看效果")
--每当玩家做动画表情,就会游戏结束
--当玩家做动画表情时执行此函数
local function Player_PlayAction(event)
	--结束游戏
    Game:doGameEnd(nil)
end
--注册一个动画表情监听器,事件发生时执行上面的函数
ScriptSupportEvent:registerEvent([=[Player.PlayAction]=],Player_PlayAction)

# world2RadarPos

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Convert world coordinates to Mini-map
  • The specific use cases are as follows:
--获取存档里(100,100)的位置在地图上的坐标
local result,x,z=UI:world2RadarPos(100,100)
--在聊天框显示
Chat:sendSystemMsg("坐标(100,100)在当前地图上的坐标为("..x..","..z..")")

# world2RadarDist

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Convert world length to Mini-map
  • The specific use cases are as follows:
--获取存档里100格距离在地图上的长度
local result,length=UI:world2RadarDist(100)
--在聊天框显示
Chat:sendSystemMsg("存档里100格距离在地图上的长度为"..length)

# setMinimapRenderMode

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set Mini-map rander mode:1. The 45 degree rotation view angle; 2.The overall view Angle
  • The specific use cases are as follows:
--设置地图查看模式为45度旋转视角
--参数 0:默认 1:45度旋转视角 2:全图固定俯视角
UI:setMinimapRenderMode(1)
--在聊天框显示
Chat:sendSystemMsg("设置地图查看模式为45度旋转视角")

# setShapeLine

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Map marker shape set to Line Shape
  • The specific use cases are as follows:
local result = UI:setShapeLine(uiname, p1x, p1y, p2x, p2y)

# setShapeCircle

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Map marker shape set to Circle Shape
  • The specific use cases are as follows:
local result = UI:setShapeCircle(uiname, x, y, radius)

# ShowScreenEffect

  • Parameters and types:
  • Return value and types:
  • The main role of this method: display screen effects
  • The specific use cases are as follows:
--显示雾效(貌似没效果)
--第一个参数为屏幕效果id:1 speedline 2 powerline 3 fog
--第二个参数为 loops:true是 false否
--第三个参数为 speed increase
UI:ShowScreenEffect(3,false,1)
--在聊天框显示
Chat:sendSystemMsg("显示雾效")
Last Update: 6/11/2020, 9:30:46 PM