LUADOC - Farming Simulator 22

Script v1_7_1_0

Engine v1_7_1_0

Foundation Reference

PlatformIconElement

Description
Display a platform icon, depending on current and set platform.
Parent
BitmapElement
Functions

copyAttributes

Description
Definition
copyAttributes()
Code
31function PlatformIconElement:copyAttributes(src)
32 PlatformIconElement:superClass().copyAttributes(self, src)
33
34 self.platformId = src.platformId
35end

delete

Description
Definition
delete()
Code
25function PlatformIconElement:delete()
26 PlatformIconElement:superClass().delete(self)
27end

new

Description
Definition
new()
Code
17function PlatformIconElement.new(target, custom_mt)
18 local self = PlatformIconElement:superClass().new(target, custom_mt or PlatformIconElement_mt)
19
20 return self
21end

setPlatformId

Description
Set the terrain layer to render
Definition
setPlatformId()
Code
39function PlatformIconElement:setPlatformId(platformId)
40 local useOtherIcon = false
41
42 -- On some platforms we can only show the icon for the same platform
43 if GS_PLATFORM_ID == PlatformId.PS4 or GS_PLATFORM_ID == PlatformId.PS5 then
44 if platformId ~= PlatformId.PS4 and platformId ~= PlatformId.PS5 then
45 useOtherIcon = true
46 end
47 elseif GS_PLATFORM_ID == PlatformId.XBOX_ONE or GS_PLATFORM_ID == PlatformId.XBOX_SERIES then
48 if platformId ~= PlatformId.XBOX_ONE and platformId ~= PlatformId.XBOX_SERIES then
49 useOtherIcon = true
50 end
51 end
52
53 if useOtherIcon then
54 platformId = 0
55 end
56
57 self:setImageUVs(nil, unpack(GuiUtils.getUVs(PlatformIconElement.UVS[platformId])))
58end