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
ColorPickButtonElement
DescriptionClickable button element with one or two colors inside and a special selection designParent
ButtonElementFunctions
copyAttributes
DescriptionDefinitioncopyAttributes()Code
53 | function ColorPickButtonElement:copyAttributes(src) |
54 | ColorPickButtonElement:superClass().copyAttributes(self, src) |
55 | |
56 | self.selectionFrameThickness = table.copy(src.selectionFrameThickness) |
57 | self.selectionFrameColor = table.copy(src.selectionFrameColor) |
58 | self.metallicImageUVs = table.copy(src.metallicImageUVs) |
59 | self.nonMetallicImageUVs = table.copy(src.nonMetallicImageUVs) |
60 | end |
draw
DescriptionDefinitiondraw()Code
64 | function ColorPickButtonElement:draw(clipX1, clipY1, clipX2, clipY2) |
65 | if self:getIsSelected() then |
66 | GuiOverlay.renderOverlay(self.overlay, self.absPosition[1] + self.absSize[1] * 0.15, self.absPosition[2] + self.absSize[2] * 0.15, self.absSize[1] * 0.7, self.absSize[2] * 0.7, self:getOverlayState(), clipX1, clipY1, clipX2, clipY2) |
67 | |
68 | |
69 | local r, g, b, a = unpack(self.selectionFrameColor) |
70 | drawFilledRect(self.absPosition[1], self.absPosition[2], self.absSize[1], self.selectionFrameThickness[2], r, g, b, a) |
71 | drawFilledRect(self.absPosition[1], self.absPosition[2] + self.absSize[2] - self.selectionFrameThickness[2], self.absSize[1], self.selectionFrameThickness[2], r, g, b, a) |
72 | |
73 | drawFilledRect(self.absPosition[1], self.absPosition[2], self.selectionFrameThickness[1], self.absSize[2], r, g, b, a) |
74 | drawFilledRect(self.absPosition[1] + self.absSize[1] - self.selectionFrameThickness[1], self.absPosition[2], self.selectionFrameThickness[1], self.absSize[2], r, g, b, a) |
75 | else |
76 | GuiOverlay.renderOverlay(self.overlay, self.absPosition[1], self.absPosition[2], self.absSize[1], self.absSize[2], self:getOverlayState(), clipX1, clipY1, clipX2, clipY2) |
77 | end |
78 | |
79 | if self.debugEnabled or g_uiDebugEnabled then |
80 | local xPixel = 1 / g_screenWidth |
81 | local yPixel = 1 / g_screenHeight |
82 | |
83 | local posX1 = self.absPosition[1] |
84 | local posX2 = self.absPosition[1]+self.size[1]-xPixel |
85 | |
86 | local posY1 = self.absPosition[2] |
87 | local posY2 = self.absPosition[2]+self.size[2]-yPixel |
88 | |
89 | drawFilledRect(posX1, posY1, posX2-posX1, yPixel, 0, 1, 0, 0.7) |
90 | drawFilledRect(posX1, posY2, posX2-posX1, yPixel, 0, 1, 0, 0.7) |
91 | drawFilledRect(posX1, posY1, xPixel, posY2-posY1, 0, 1, 0, 0.7) |
92 | drawFilledRect(posX1+posX2-posX1, posY1, xPixel, posY2-posY1, 0, 1, 0, 0.7) |
93 | end |
94 | end |
loadFromXML
DescriptionDefinitionloadFromXML()Code
31 | function ColorPickButtonElement:loadFromXML(xmlFile, key) |
32 | ColorPickButtonElement:superClass().loadFromXML(self, xmlFile, key) |
33 | |
34 | -- create second overlay for the second color. |
35 | |
36 | self.selectionFrameThickness = GuiUtils.getNormalizedValues(getXMLString(xmlFile, key.."#selectionFrameThickness"), self.outputSize, self.selectionFrameThickness) |
37 | self.selectionFrameColor = GuiUtils.getColorArray(getXMLString(xmlFile, key.."#selectionFrameColor"), self.selectionFrameColor) |
38 | end |
loadProfile
DescriptionDefinitionloadProfile()Code
42 | function ColorPickButtonElement:loadProfile(profile, applyProfile) |
43 | ColorPickButtonElement:superClass().loadProfile(self, profile, applyProfile) |
44 | |
45 | self.selectionFrameThickness = GuiUtils.getNormalizedValues(profile:getValue("selectionFrameThickness"), self.outputSize, self.selectionFrameThickness) |
46 | self.selectionFrameColor = GuiUtils.getColorArray(profile:getValue("selectionFrameColor"), self.selectionFrameColor) |
47 | self.metallicImageUVs = GuiUtils.getUVs(profile:getValue("metallicImageUVs")) |
48 | self.nonMetallicImageUVs = table.copy(self.overlay.uvs) |
49 | end |
new
DescriptionDefinitionnew()Code
16 | function ColorPickButtonElement.new(target, custom_mt) |
17 | local self = ColorPickButtonElement:superClass().new(target, custom_mt or ColorPickButtonElement_mt) |
18 | |
19 | self.colors = { |
20 | {1,1,1,1} |
21 | } |
22 | |
23 | self.selectionFrameThickness = {0, 0} |
24 | self.selectionFrameColor = {1,1,1,1} |
25 | |
26 | return self |
27 | end |