Script v1.7.1.0
- AI
- Animals
- Contracts
- Debug
- Economy
- Effects
- Events
- Farms
- GUI
- Handtools
- I3d
- Materials
- Misc
- Objects
- Placeables
- Player
- Shop
- Sounds
- Specializations
- Triggers
- Utils
- Vehicles
- Weather
Engine v1.7.1.0
- AI
- Animation
- Camera
- Entity
- Fillplanes
- General
- I3D
- Input
- Lighting
- Math
- Network
- Node
- Overlays
- Particle System
- Physics
- JointConstructor:setActors
- JointConstructor:setJointTransforms
- addDifferential
- addForce
- addImpulse
- addTorque
- addTorqueImpulse
- addVehicleLink
- computeWheelShapeTireForces
- createCCT
- createWheelShape
- getAngularDamping
- getAngularVelocity
- getCCTCollisionFlags
- getCenterOfMass
- getCollisionMask
- getDensity
- getLinearDamping
- getLinearVelocity
- getMass
- getMotorRotationSpeed
- getRigidBodyType
- getVelocityAtLocalPos
- getVelocityAtWorldPos
- getVolume
- getWheelShapeAxleSpeed
- getWheelShapeContactForce
- getWheelShapeContactNormal
- getWheelShapeContactObject
- getWheelShapeContactPoint
- getWheelShapePosition
- getWheelShapeSlip
- moveCCT
- overlapBox
- overlapSphere
- raycastAll
- raycastClosest
- removeCCT
- setAngularDamping
- setAngularVelocity
- setCenterOfMass
- setCollisionMask
- setFrictionVelocity
- setJointDrive
- setLinearDamping
- setLinearVelocity
- setMass
- setRigidBodyType
- setSolverIterationCount
- setWheelShapeForcePoint
- setWheelShapeProps
- setWheelShapeTireFriction
- simulatePhysics
- simulatePhysicsTimeScale
- updateDifferential
- Rendering
- Scenegraph
- Shape
- Sound
- Spline
- String
- Terrain Detail
- Text Rendering
- Tire Track
- XML
- general
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 |