Skip to content

Commit

Permalink
Distance is now m or ft
Browse files Browse the repository at this point in the history
  • Loading branch information
schwiti6190 committed Apr 3, 2022
1 parent 2bc387f commit 6bc8ee0
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions scripts/gui/hud/CpBaseHud.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ CpBaseHud.uvs = {
{184, 148, 32, 32}
},
exitSymbol = {
{150, 180, 32, 32}
{148, 184, 32, 32}
},
circleSymbol = {
{0, 366, 28, 28}
Expand Down Expand Up @@ -377,24 +377,22 @@ function CpBaseHud:addCopyCourseBtn(line)
self.copyCourseElements.leftBtn:setPosition(leftX, leftY-btnYOffset)
self.copyCourseElements.leftBtn:setCallback("onClickPrimary", self.vehicle, function (vehicle)
self.copyCourseIx = MathUtil.clamp(self.copyCourseIx - 1, 1, #self.courseVehicles)
print("leftClick")
end)

self.copyCourseElements.copyBtn = CpHudButtonElement.new(copyOverlay, self.baseHud)
self.copyCourseElements.copyBtn:setPosition(rightX, rightY-btnYOffset)
self.copyCourseElements.copyBtn:setCallback("onClickPrimary", self.vehicle, function (vehicle)
print("copyClick")
--- TODO: add course copy logic here!
end)
self.copyCourseElements.copyBtn:setCallback("onHoveredChanged", self.vehicle, function (vehicle)
print("copyClick on hover")
--- TODO: Maybe change the vehicle name to the course name, while hovered.
end)


self.copyCourseElements.rightBtn = CpHudButtonElement.new(rightOverlay, self.baseHud)
self.copyCourseElements.rightBtn:setPosition(rightX - width - self.wMargin/2 , rightY-btnYOffset)
self.copyCourseElements.rightBtn:setCallback("onClickPrimary", self.vehicle, function (vehicle)
self.copyCourseIx = MathUtil.clamp(self.copyCourseIx + 1, 1, #self.courseVehicles)
print("rightClick")
end)

self.copyCourseElements.vehicleBtn = CpTextHudElement.new(self.baseHud,
Expand Down Expand Up @@ -489,7 +487,8 @@ function CpBaseHud:updateCopyBtn(status)
e:setVisible(not status:getIsActive() and #self.courseVehicles>0)
end
local v = self.courseVehicles[self.copyCourseIx]
local text = v and string.format("%s (%dm)", CpUtil.getName(v), calcDistanceFrom(v.rootNode, self.vehicle.rootNode)) or ""
local distText = v and AIParameterSettingList.getDistanceText(calcDistanceFrom(v.rootNode, self.vehicle.rootNode))
local text = v and string.format("%s (%s)", CpUtil.getName(v), distText) or ""
self.copyCourseElements.vehicleBtn:setTextDetails(text)
end

Expand Down

0 comments on commit 6bc8ee0

Please sign in to comment.