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
InGameIcon
Functionsdelete
DescriptionDefinitiondelete()Code
38 | function InGameIcon:delete() |
39 | self.iconOverlay:delete() |
40 | end |
draw
DescriptionDefinitiondraw()Code
116 | function InGameIcon:draw() |
117 | if self.visible then |
118 | self.iconOverlay:setColor(1, 1, 1, self.alpha) |
119 | self.iconOverlay:render() |
120 | |
121 | setTextBold(true) |
122 | setTextAlignment(RenderText.ALIGN_CENTER) |
123 | setTextColor(0, 0, 0, self.alpha) |
124 | renderText(self.textPosX, self.textPosY - 0.003, 0.025, self.text) |
125 | setTextColor(1.0, 1.0, 1.0, self.alpha) |
126 | renderText(self.textPosX, self.textPosY, 0.025, self.text) |
127 | setTextAlignment(RenderText.ALIGN_LEFT) |
128 | setTextBold(false) |
129 | setTextColor(1,1,1,1) |
130 | end |
131 | end |
hideIcon
DescriptionDefinitionhideIcon()Code
100 | function InGameIcon:hideIcon() |
101 | self.time = self.fadeTime + self.visibleTime |
102 | end |
mouseEvent
DescriptionDefinitionmouseEvent()Code
58 | function InGameIcon:mouseEvent(posX, posY, isDown, isUp, button) |
59 | if self.visible and isDown and button == 1 then |
60 | if self.time <= self.fadeTime + self.visibleTime then |
61 | self:hideIcon() |
62 | end |
63 | end |
64 | end |
new
DescriptionDefinitionnew()Code
12 | function InGameIcon.new() |
13 | local instance = {} |
14 | setmetatable(instance, InGameIcon_mt) |
15 | |
16 | instance.width, instance.height = getNormalizedScreenValues(50, 50) |
17 | instance.posX, instance.posY = getNormalizedScreenValues(25, 360) |
18 | |
19 | instance.textPosX = instance.posX + instance.width * (3/5) |
20 | instance.textPosY = instance.posY + 0.005 |
21 | |
22 | instance.fadeTime = 1000 |
23 | instance.visibleTime = 2000 |
24 | instance.visible = false |
25 | instance.time = 0 |
26 | |
27 | instance.alpha = 0 |
28 | instance.fileName = "dataS/menu/blank.png" |
29 | instance.text = "+1" |
30 | |
31 | instance.iconOverlay = Overlay.new(instance.fileName, instance.posX, instance.posY, instance.width, instance.height) |
32 | |
33 | return instance |
34 | end |
setIcon
DescriptionDefinitionsetIcon()Code
44 | function InGameIcon:setIcon(fileName) |
45 | self.iconOverlay:delete() |
46 | self.fileName = fileName |
47 | self.iconOverlay = Overlay.new(self.fileName, self.posX, self.posY, self.width, self.height) |
48 | end |
setPosition
DescriptionDefinitionsetPosition()Code
106 | function InGameIcon:setPosition(x, y) |
107 | self.iconOverlay:setPosition(x, y) |
108 | self.posX = Utils.getNoNil(x, self.posX) |
109 | self.posY = Utils.getNoNil(y, self.posY) |
110 | self.textPosX = self.posX + self.width * (3/5) |
111 | self.textPosY = self.posY + 0.005 |
112 | end |
setText
DescriptionDefinitionsetText()Code
52 | function InGameIcon:setText(text) |
53 | self.text = text |
54 | end |
showIcon
DescriptionDefinitionshowIcon()Code
91 | function InGameIcon:showIcon(duration) |
92 | self.visibleTime = duration |
93 | self.time = 0 |
94 | self.alpha = 0 |
95 | self.visible = true |
96 | end |
update
DescriptionDefinitionupdate()Code
68 | function InGameIcon:update(dt) |
69 | if self.visible then |
70 | self.time = self.time + dt |
71 | |
72 | -- fade in |
73 | self.alpha = math.min(1.0, self.time / self.fadeTime) |
74 | |
75 | -- fade out |
76 | if self.time > self.fadeTime + self.visibleTime then |
77 | self.alpha = math.max(0.0, (self.fadeTime - (self.time - self.fadeTime - self.visibleTime)) / self.fadeTime) |
78 | end |
79 | |
80 | -- disable |
81 | if self.time > self.fadeTime * 2 + self.visibleTime then |
82 | self.time = 0 |
83 | self.visible = false |
84 | end |
85 | |
86 | end |
87 | end |