Fivem에 대한 사용자 정의 알림. 기본 GTAV 알림을 모방하지만 더 많은 사용자 정의를 허용합니다
css
ui/css/custom.css
에 추가하여 모양을 사용자 정의하십시오.~r~
, ~b~
, ~h~
등) exports . bulletin : Send ( message , timeout , position , progress , theme , exitAnim , flash )
-- or
exports . bulletin : Send ({
message = ' Message ' ,
timeout = 5000 ,
theme = ' success '
...
})
exports . bulletin : SendAdvanced ( message , title , subject , icon , timeout , position , progress , theme , exitAnim , flash )
-- or
exports . bulletin : SendAdvanced ({
message = ' Some Message ' ,
title = ' Some Title ' ,
subject = ' Some Subtitle ' ,
icon = ' CHAR_BANK_MAZE ' ,
...
})
local pinID = exports . bulletin : SendPinned ({
type = ' advanced ' , -- or 'standard'
message = ' This is pinned! ' ,
title = ' Title ' ,
subject = ' Subject ' ,
icon = ' CHAR_BANK_MAZE '
})
-- unpin
exports . bulletin : Unpin ( pinID )
-- unpin multiple
exports . bulletin : Unpin ({ pinID1 , pinID2 , pinID3 , ... })
-- unpin all
exports . bulletin : Unpin ()
-- update content
exports . bulletin : UpdatePinned ( pinID , options )
이들은 테마 알림을 보내는 속기 방법입니다. 그들은 Send()
메소드와 동일한 매개 변수 / 테이블을 취합니다.
-- Send standard success notification
exports . bulletin : SendSuccess ( ... )
-- Send standard info notification
exports . bulletin : SendInfo ( ... )
-- Send standard warning notification
exports . bulletin : SendWarning ( ... )
-- Send standard error notification
exports . bulletin : SendError ( ... )
클라이언트와 서버 모두에서 모든 방법을 트리거 할 수 있습니다.
-- standard
TriggerClientEvent ( ' bulletin:send ' , source , ... )
-- advanced
TriggerClientEvent ( ' bulletin:sendAdvanced ' , source , ... )
이들은 개별 매개 변수 또는 테이블로 전달됩니다.
파라 | 유형 | 기본 | 옵션 | 선택 과목 | 설명 |
---|---|---|---|---|---|
message | string | 아니요 | 보낼 메시지. 문자열 또는 유효한 HTML 일 수 있습니다 | ||
timeout | integer | 5000 | 예 | ms 의 기간은 알림을 표시합니다 | |
position | string | "bottomleft" | "bottomleft" , "topleft" , "topright" "bottomright" , "bottom" , "top" | 예 | 알림의 위치 |
progress | boolean | false | true , false | 예 | 알림 시간 초과의 진행 상황을 표시할지 여부 |
theme | string | "default" | "default" , "success" , "info" , "warning" , "error" | 예 | 알림의 주제 |
exitAnim | string | "fadeOut" | 옵션은 animate.css 참조하십시오 | 예 | 알림을 숨기는 데 사용되는 애니메이션 |
flash | boolean | false | 예 | 알림을 깜박입니다 | |
title | string | 아니요 | 알림의 제목 (고급 전용) | ||
subject | string | 아니요 | 통지의 주제 / 자막 (고급 만) | ||
icon | string | 아니요 | 사용할 그림 (고급 전용) |
Config . Timeout = 5000 -- Overridden by the `timeout` param
Config . Position = " bottomleft " -- Overridden by the `position` param
Config . Progress = false -- Overridden by the `progress` param
Config . Theme = " default " -- Overridden by the `theme` param
Config . Queue = 5 -- No. of notifications to show before queueing
Config . Stacking = true
Config . ShowStackedCount = true
Config . AnimationOut = " fadeOut " -- Default exit animation - overriden by the `exitAnim` param
Config . AnimationTime = 500 -- Entry / exit animation interval
Config . FlashCount = 5 -- No. of times the notification blinks when `flash` param is used
Config . SoundFile = false -- Sound file stored in ui/audio used for notification sound. Leave as false to disable.
Config . SoundVolume = 0.4 -- 0.0 - 1.0
Config . Pictures = {
-- advanced notification icons
}
자신의 사용자 정의 사진을 추가하려면 64x64
jpg
이미지를 ui/images
디렉토리에 업로드하고 config.lua
의 Config.Pictures
테이블에 사용자 정의 코드와 파일 이름을 추가하십시오.
my_custom_icon_image.jpg
ui/images
디렉토리에 업로드하고 MY_CUSTOM_ICON_CODE
(공백 없음!)를 키로 사용하십시오.
Config . Pictures = {
...
MY_CUSTOM_ICON_CODE = " my_custom_icon_image.jpg " -- Add this
}
그런 다음 알림 호출에서 사용자 정의 코드를 사용하십시오.
exports . bulletin : SendAdvanced ( " Message " , " Title " , " Subject " , " MY_CUSTOM_ICON_CODE " )
사용자 정의 사운드 파일을 ui/audio
디렉토리에 업로드하고 사용하여 구성을 편집하여 알림 사운드를 활성화 할 수 있습니다.
Config . SoundFile = ' my_notification_sound.mp3 '
Config . SoundVolume = 0.4
유효한 오디오 파일 : .mp3
, .ogg
, .wav
게시판은 다음 형식을 지원합니다.
n = new line
~ r ~ = Red
~ b ~ = Blue
~ g ~ = Green
~ y ~ = Yellow
~ p ~ = Purple
~ o ~ = Orange
~ u ~ = Black
~ w ~ = White
~ h ~ = Bold Text
색상에 HTML을 사용할 수도 있습니다.
exports . bulletin : Send ( " <span class='r'>I am red</span> and <span class='y'>I am yellow</span> " )
또는 당신이 좋아하는 모든 html
exports . bulletin : Send ( " <h1>Some Title</h1><p class='paragraph'>Some text</p><footer>Some footer text</footer> " )
고정 알림을 보내려면 알림의 pin_id
저장하여 나중에 파악할 수 있습니다.
local pinID = exports . bulletin : SendPinned ({
type = ' advanced ' -- or 'standard'
message = ' This is pinned! '
})
그런 다음 UNPIN을 사용하지 않으려면 저장된 값을 Unpin()
메소드로 전달합니다.
exports . bulletin : Unpin ( pinID )
Unpin()
메소드는 또한 핀 ID table
허용합니다.
exports . bulletin : Unpin ({ pinned1 , pinned2 , pinned3 })
또는 매개 변수를 생략하여 모든 것을 풀려면 다음과 같습니다.
exports . bulletin : Unpin ()
고정 된 알림의 내용을 업데이트 할 수도 있습니다.
-- Send pinned notification
local pinID = exports . bulletin : SendPinned ({
type = ' advanced ' ,
message = ' This is pinned! ' ,
title = ' Title ' ,
subject = ' Subject ' ,
icon = ' CHAR_BANK_MAZE ' ,
theme = ' success '
})
-- Update it's content
exports . bulletin : UpdatePinned ( pinID , {
message = ' Updated message! ' ,
title = ' Updated title ' ,
subject = ' Updated subject ' ,
icon = ' CHAR_TREVOR ' ,
theme = ' error ' ,
flash = true
})
message
, title
, subject
, icon
, theme
및 flash
옵션 만 현재 업데이트 할 수 있습니다.
고정 된 알림은 대기열이 없으므로 Config.Queue
5
로 설정하고 2
고정 알림이 있으면 언제든지 최대 7
알림이 표시됩니다.
ESX
사용하는 경우 es_extended/client/functions.lua
에서 적절한 기능을 편집하여 bulletin
사용하여 알림을 재정의 할 수 있습니다.
ESX . ShowNotification = function ( msg )
-- SetNotificationTextEntry('STRING')
-- AddTextComponentString(msg)
-- DrawNotification(0,1)
exports . bulletin : Send ( msg )
end
ESX . ShowAdvancedNotification = function ( sender , subject , msg , textureDict , iconType , flash , saveToBrief , hudColorIndex )
-- if saveToBrief == nil then saveToBrief = true end
-- AddTextEntry('esxAdvancedNotification', msg)
-- BeginTextCommandThefeedPost('esxAdvancedNotification')
-- if hudColorIndex then ThefeedNextPostBackgroundColor(hudColorIndex) end
-- EndTextCommandThefeedPostMessagetext(textureDict, textureDict, false, iconType, sender, subject)
-- EndTextCommandThefeedPostTicker(flash or false, saveToBrief)
exports . bulletin : SendAdvanced ( msg , sender , subject , textureDict )
end
회보 저작권 (C) 2021 Mobius1 이 프로그램은 무료 소프트웨어입니다. Free Software Foundation, 라이센스의 버전 3 또는 이후 버전에서 게시 한 GNU 일반 공개 라이센스의 조건에 따라 재분배 및/또는 수정할 수 있습니다. 이 프로그램은 유용 할 것이지만 보증이 없다는 희망으로 배포됩니다. 상업성 또는 특정 목적에 대한 적합성에 대한 묵시적 보증조차 없습니다. 자세한 내용은 GNU 일반 공개 라이센스를 참조하십시오. 이 프로그램과 함께 GNU 일반 공개 라이센스 사본을 받았어야합니다. |