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
PlaySampleMixin
DescriptionPlay UI sound sample mixin. Add this mixin to a GuiElement to enable it to play UI sounds. Added methods: GuiElement:setPlaySampleCallback(callback): Set a callback for playing UI sound samples, signature: function(sampleName). GuiElement:playSample(index, count): Called by the decorated GuiElement to play a sound sample using a name from GuiSoundPlayer.SOUND_SAMPLES. GuiElement:disablePlaySample(): Permanently disables playing samples for special cases (i.e. separate sound logic)Parent
GuiMixinFunctions
addTo
DescriptionSee GuiMixin:addTo().Definition
addTo()Code
30 | function PlaySampleMixin:addTo(guiElement) |
31 | if PlaySampleMixin:superClass().addTo(self, guiElement) then |
32 | guiElement.setPlaySampleCallback = PlaySampleMixin.setPlaySampleCallback |
33 | guiElement.playSample = PlaySampleMixin.playSample |
34 | guiElement.disablePlaySample = PlaySampleMixin.disablePlaySample |
35 | |
36 | -- make sure an uninitialized call doesn't blow up by assigning an empty function: |
37 | guiElement[PlaySampleMixin].playSampleCallback = NO_CALLBACK |
38 | |
39 | return true |
40 | else |
41 | return false |
42 | end |
43 | end |
clone
DescriptionClone this mixin's state from a source to a destination GuiElement instance.Definition
clone()Code
71 | function PlaySampleMixin:clone(srcGuiElement, dstGuiElement) |
72 | dstGuiElement[PlaySampleMixin].playSampleCallback = srcGuiElement[PlaySampleMixin].playSampleCallback |
73 | end |
disablePlaySample
DescriptionPermanently disable playing samples on the decorated GuiElement for special cases.Definition
disablePlaySample()Code
65 | function PlaySampleMixin.disablePlaySample(guiElement) |
66 | guiElement[PlaySampleMixin].playSampleCallback = NO_CALLBACK |
67 | end |
new
DescriptionDefinitionnew()Code
24 | function PlaySampleMixin.new() |
25 | return GuiMixin.new(PlaySampleMixin_mt, PlaySampleMixin) |
26 | end |
playSample
DescriptionRequest playing a UI sound sample identified by name.Definition
playSample(table guiElement, string sampleName)Arguments
table | guiElement | GuiElement instance |
string | sampleName | Sample name, use one of GuiSoundPlayer.SOUND_SAMPLES. |
57 | function PlaySampleMixin.playSample(guiElement, sampleName) |
58 | if not guiElement.soundDisabled then |
59 | guiElement[PlaySampleMixin].playSampleCallback(sampleName) |
60 | end |
61 | end |
setPlaySampleCallback
DescriptionSet a callback to play a UI sound sample.Definition
setPlaySampleCallback(table guiElement, function callback)Arguments
table | guiElement | GuiElement instance |
function | callback | Play sample callback, signature: function(sampleName) |
49 | function PlaySampleMixin.setPlaySampleCallback(guiElement, callback) |
50 | guiElement[PlaySampleMixin].playSampleCallback = callback |
51 | end |