وظيفة بسيطة و مفيدة ,
وظيفة إنشاء تنبيه باللوحة ,
CreateAttentionBox = function ( Window , Text , RedLabel , GreenLabel , BlueLabel , AlphaLabel , PropertyBox , AlphaBox , TimerSecond )
assert ( Window , 'Bug @ #1 CreateAttentionBox ; No Window' )
assert ( isElement ( Window ) , 'Bug @ #1 CreateAttentionBox ; This is not Element' )
assert ( getElementType ( Window ) == 'gui-window' , 'Bug @ #1 CreateAttentionBox ; This is not gui window' )
assert ( Text , 'Bug @ #2 CreateAttentionBox ; No Text !' )
assert ( type ( Text ) == 'string' , 'Bug @ #2 CreateAttentionBox ; Not String' )
local Table = {
RedLabel = RedLabel or 255
, GreenLabel = GreenLabel or 255
, BlueLabel = BlueLabel or 255
, AlphaLabel = AlphaLabel or 255
, PropertyBox = PropertyBox or 'tl:FFA30000 tr:FFA30000 bl:FFA30000 br:FFA30000'
, AlphaBox = AlphaBox or 255
, TimerSecond = TimerSecond or 4
}
Box = guiCreateStaticImage ( 10 , 19 , guiGetSize ( Window , false ) - 20 , 21 , ':guieditor/images/dot_white.png' , false , Window )
guiSetProperty ( Box , 'ImageColours' , Table.PropertyBox )
guiSetAlpha ( Box , Table.AlphaBox )
guiSetProperty ( Box , 'AlwaysOnTop' , 'True' )
Label = guiCreateLabel ( 10 , 0 , guiGetSize ( Window , false ) - 20 , 21 , Text , false , Box )
guiLabelSetHorizontalAlign ( Label , 'center' , false )
guiLabelSetVerticalAlign ( Label , 'center' )
guiLabelSetColor ( Label , Table.RedLabel , Table.GreenLabel , Table.BlueLabel , Table.AlphaLabel )
setTimer ( function ( Box , Label )
destroyElement ( Label ) destroyElement ( Box )
end , 1000 * Table.TimerSecond , 1 , Box , Label )
end
- لازم مود الجيوإدتور يكون شغال ..
مثال :