Script v1_7_1_0
- AI
- Animals
- Collections
- Contracts
- Debug
- Economy
- Elements
- EnvironmentalScore
- Errors
- Events
- GUI
- AnimalScreen
- AnimationElement
- BitmapElement
- BoxLayoutElement
- BreadcrumbsElement
- ButtonElement
- ButtonOverlay
- ChatWindow
- CheckedOptionElement
- ClearElement
- ColorPickButtonElement
- ConstructionScreen
- ContextActionDisplay
- ControlBarDisplay
- DialogElement
- DynamicFadedBitmapElement
- FillLevelsDisplay
- FlowLayoutElement
- FocusManager
- FrameElement
- FrameReferenceElement
- GameInfoDisplay
- GameInfoDisplayMobile
- GamePausedDisplay
- Gui
- GuiDataSource
- GuiElement
- GuiMixin
- GuiOverlay
- GuiProfile
- GuiSoundPlayer
- GuiTopDownCamera
- GuiTopDownCursor
- GuiUtils
- HUDDisplayElement
- HUDElement
- HUDFrameElement
- HUDPopupMessage
- HUDSliderElement
- HUDTextDisplay
- IndexChangeSubjectMixin
- IndexStateElement
- InfoDisplay
- InfoHUDBox
- InGameIcon
- IngameMap
- IngameMapElement
- InputGlyphElement
- InputGlyphElementUI
- InputHelpDisplay
- KeyValueInfoHUDBox
- ListElement
- ListItemElement
- MapOverlayGenerator
- MixerWagonHUDExtension
- MultiTextOptionElement
- MultiValueTween
- Overlay
- PagingElement
- PictureElement
- PlatformIconElement
- PlayerControlPadDisplay
- PlaySampleMixin
- RenderElement
- RoundStatusBar
- ScreenElement
- ScrollingLayoutElement
- SettingsModel
- SideNotification
- SideNotificationMobile
- SliderElement
- SpeakerDisplay
- SpeedMeterDisplay
- SpeedSliderDisplay
- StatusBar
- SteeringSliderDisplay
- TabbedMenu
- TabbedMenuFrameElement
- TabbedMenuWithDetails
- TableElement
- TableHeaderElement
- TerrainLayerElement
- TextBackdropElement
- TextElement
- TextInputElement
- ThreePartBitmapElement
- TimerElement
- ToggleButtonElement
- TopNotification
- Tween
- TweenSequence
- VariableWorkWidthHUDExten...
- VehicleHUDExtension
- VehicleSchemaDisplay
- VideoElement
- WardrobeScreen
- Handtools
- Hud
- I3d
- Input
- Jobs
- Maps
- Materials
- Misc
- Objects
- Parameters
- Placeables
- Placement
- Player
- Shop
- Sounds
- Specialization
- Specializations
- StateMachine
- Statistics
- Tasks
- Triggers
- Utils
- Vehicles
Engine v1_7_1_0
- AI
- Animation
- Camera
- Entity
- Fillplanes
- general
- General
- I3D
- Input
- Lighting
- Math
- Network
- Node
- NoteNode
- Overlays
- Particle System
- Physics
- Rendering
- Scenegraph
- Shape
- Sound
- Spline
- String
- Terrain Detail
- Text Rendering
- Tire Track
- VoiceChat
- XML
Foundation Reference
StatusBar
Functionsdelete
DescriptionDefinitiondelete()Code
49 | function StatusBar:delete() |
50 | if self.overlayBackground ~= nil then |
51 | self.overlayBackground:delete() |
52 | end |
53 | if self.overlayValue ~= nil then |
54 | self.overlayValue:delete() |
55 | end |
56 | if self.overlayMarker ~= nil then |
57 | self.overlayMarker:delete() |
58 | end |
59 | end |
new
DescriptionDefinitionnew()Code
15 | function StatusBar.new(filename, uvsBg, uvsMarker, bgColor, valueColor, markerSize, x, y, width, height, custom_mt) |
16 | if custom_mt == nil then |
17 | custom_mt = StatusBar_mt |
18 | end |
19 | local self = setmetatable({}, custom_mt) |
20 | |
21 | self.value = 0 |
22 | self.width = width |
23 | self.height = height |
24 | |
25 | self.isDisabled = false |
26 | |
27 | self.x = x |
28 | self.y = y |
29 | self.markerSize = markerSize |
30 | self.overlayBackground = Overlay.new(filename, x, y, width, height) |
31 | self.overlayBackground:setColor(unpack(bgColor)) |
32 | self.overlayBackground:setUVs(uvsBg) |
33 | self.overlayValue = Overlay.new(filename, x, y, width, height) |
34 | self.overlayValue:setColor(unpack(valueColor)) |
35 | self.overlayValue:setUVs(uvsBg) |
36 | |
37 | if uvsMarker ~= nil then |
38 | self.overlayMarker = Overlay.new(filename, x-markerSize[1]/2, y + (height - markerSize[2])/2, markerSize[1], markerSize[2]) |
39 | self.overlayMarker:setColor(unpack(valueColor)) |
40 | self.overlayMarker:setUVs(uvsMarker) |
41 | end |
42 | self:setValue(0) |
43 | |
44 | return self |
45 | end |
render
DescriptionDefinitionrender()Code
107 | function StatusBar:render() |
108 | self.overlayBackground:render() |
109 | if not self.isDisabled then |
110 | self.overlayValue:render() |
111 | if self.overlayMarker ~= nil then |
112 | self.overlayMarker:render() |
113 | end |
114 | end |
115 | end |
setColor
DescriptionDefinitionsetColor()Code
85 | function StatusBar:setColor(r,g,b,a) |
86 | if self.overlayMarker ~= nil then |
87 | self.overlayMarker:setColor(r,g,b,a) |
88 | end |
89 | if self.overlayValue ~= nil then |
90 | self.overlayValue:setColor(r,g,b,a) |
91 | end |
92 | end |
setDisabled
DescriptionDefinitionsetDisabled()Code
63 | function StatusBar:setDisabled(isDisabled) |
64 | self.isDisabled = isDisabled |
65 | end |
setPosition
DescriptionDefinitionsetPosition()Code
69 | function StatusBar:setPosition(x, y) |
70 | self.x = x |
71 | self.y = y |
72 | if self.overlayBackground ~= nil then |
73 | self.overlayBackground:setPosition(x, y) |
74 | end |
75 | if self.overlayValue ~= nil then |
76 | self.overlayValue:setPosition(x, y) |
77 | end |
78 | if self.overlayMarker ~= nil then |
79 | self.overlayMarker:setPosition(x - self.markerSize[1]/2, y + (self.height - self.markerSize[2])/2) |
80 | end |
81 | end |
setValue
DescriptionDefinitionsetValue()Code
96 | function StatusBar:setValue(newValue) |
97 | self.value = MathUtil.clamp(newValue, 0, 1) |
98 | local markerPosX = newValue * self.width |
99 | self.overlayValue:setDimension(newValue*self.width, self.overlayValue.height) |
100 | if self.overlayMarker ~= nil then |
101 | self.overlayMarker:setPosition(self.x + markerPosX - self.markerSize[1]/2, self.overlayMarker.y) |
102 | end |
103 | end |