mirror of
https://github.com/jimathy/rpemotes.git
synced 2026-03-31 06:34:20 -04:00
Add Menu scroll Increment Toggle (#154)
* feat: increment (#149) * feat: increment att. 2 (#150) * feat: increment * changes * language * indentations * indent * General Improvements (#152) * style: style changes * chore: update native name * fix: add missing argument to ResetPedMovementClipset * refactor: remove unused code * refactor: better gender check * refactor/style: merge to one line and correct argument --------- Co-authored-by: Mads <madsleander@outlook.com> * feat: increment for faster surfing lists (#153) * feat: increment * changes * language * indentations * indent * General Improvements (#152) * style: style changes * chore: update native name * fix: add missing argument to ResetPedMovementClipset * refactor: remove unused code * refactor: better gender check * refactor/style: merge to one line and correct argument * instructional button fix --------- Co-authored-by: Mads <madsleander@outlook.com> --------- Co-authored-by: iSentrie <xvender7@gmail.com> Co-authored-by: Mads <madsleander@outlook.com>
This commit is contained in:
45
NativeUI.lua
45
NativeUI.lua
@@ -2423,6 +2423,9 @@ function UIMenu.New(Title, Subtitle, X, Y, TxtDictionary, TxtName)
|
||||
},
|
||||
Down = {
|
||||
Enabled = true,
|
||||
},
|
||||
Increment = {
|
||||
Enabled = true,
|
||||
}
|
||||
},
|
||||
ParentMenu = nil,
|
||||
@@ -2868,6 +2871,8 @@ function UIMenu:Visible(bool)
|
||||
end
|
||||
end
|
||||
|
||||
local paginationValue = 1
|
||||
|
||||
function UIMenu:ProcessControl()
|
||||
if not self._Visible then
|
||||
return
|
||||
@@ -2882,6 +2887,15 @@ function UIMenu:ProcessControl()
|
||||
self:GoBack()
|
||||
end
|
||||
|
||||
if self.Controls.Increment.Enabled and (IsDisabledControlJustReleased(0, 19) or IsDisabledControlJustReleased(1, 19) or IsDisabledControlJustReleased(2, 19)) then
|
||||
if paginationValue == 1 then
|
||||
paginationValue = 10
|
||||
else
|
||||
paginationValue = 1
|
||||
end
|
||||
self:Visible(true)
|
||||
end
|
||||
|
||||
if #self.Items == 0 then
|
||||
return
|
||||
end
|
||||
@@ -2972,6 +2986,10 @@ function UIMenu:ProcessControl()
|
||||
end
|
||||
|
||||
function UIMenu:GoUpOverflow()
|
||||
if self:CurrentSelection() < 10 then
|
||||
paginationValue = 1
|
||||
end
|
||||
|
||||
if #self.Items <= self.Pagination.Total + 1 then
|
||||
return
|
||||
end
|
||||
@@ -2985,10 +3003,10 @@ function UIMenu:GoUpOverflow()
|
||||
self.ActiveItem = self.ActiveItem + (#self.Items - 1)
|
||||
self.Items[self:CurrentSelection()]:Selected(true)
|
||||
else
|
||||
self.Pagination.Min = self.Pagination.Min - 1
|
||||
self.Pagination.Max = self.Pagination.Max - 1
|
||||
self.Pagination.Min = self.Pagination.Min - paginationValue
|
||||
self.Pagination.Max = self.Pagination.Max - paginationValue
|
||||
self.Items[self:CurrentSelection()]:Selected(false)
|
||||
self.ActiveItem = self.ActiveItem - 1
|
||||
self.ActiveItem = self.ActiveItem - paginationValue
|
||||
self.Items[self:CurrentSelection()]:Selected(true)
|
||||
end
|
||||
else
|
||||
@@ -3014,6 +3032,10 @@ function UIMenu:GoUp()
|
||||
end
|
||||
|
||||
function UIMenu:GoDownOverflow()
|
||||
if self:CurrentSelection() > (#self.Items - 10) then
|
||||
paginationValue = 1
|
||||
end
|
||||
|
||||
if #self.Items <= self.Pagination.Total + 1 then
|
||||
return
|
||||
end
|
||||
@@ -3026,10 +3048,10 @@ function UIMenu:GoDownOverflow()
|
||||
self.ActiveItem = 1000 - (1000 % #self.Items)
|
||||
self.Items[self:CurrentSelection()]:Selected(true)
|
||||
else
|
||||
self.Pagination.Max = self.Pagination.Max + 1
|
||||
self.Pagination.Max = self.Pagination.Max + paginationValue
|
||||
self.Pagination.Min = self.Pagination.Max - (self.Pagination.Total + 1)
|
||||
self.Items[self:CurrentSelection()]:Selected(false)
|
||||
self.ActiveItem = self.ActiveItem + 1
|
||||
self.ActiveItem = self.ActiveItem + paginationValue
|
||||
self.Items[self:CurrentSelection()]:Selected(true)
|
||||
end
|
||||
else
|
||||
@@ -3584,15 +3606,24 @@ function UIMenu:UpdateScaleform()
|
||||
PopScaleformMovieFunction()
|
||||
end
|
||||
|
||||
local count = 2
|
||||
if self.Controls.Increment.Enabled then
|
||||
PushScaleformMovieFunction(self.InstructionalScaleform, "SET_DATA_SLOT")
|
||||
PushScaleformMovieFunctionParameterInt(3)
|
||||
PushScaleformMovieFunctionParameterString(GetControlInstructionalButton(2, 19, 0))
|
||||
PushScaleformMovieFunctionParameterString(Config.Languages[lang]['btn_increment']..(paginationValue and ': '..paginationValue or ": "..paginationValue))
|
||||
PopScaleformMovieFunction()
|
||||
end
|
||||
|
||||
local count = 3
|
||||
|
||||
for i = 1, #self.InstructionalButtons do
|
||||
if self.InstructionalButtons[i] then
|
||||
if #self.InstructionalButtons[i] == 2 then
|
||||
if #self.InstructionalButtons[i] == 3 then
|
||||
PushScaleformMovieFunction(self.InstructionalScaleform, "SET_DATA_SLOT")
|
||||
PushScaleformMovieFunctionParameterInt(count)
|
||||
PushScaleformMovieFunctionParameterString(self.InstructionalButtons[i][1])
|
||||
PushScaleformMovieFunctionParameterString(self.InstructionalButtons[i][2])
|
||||
PushScaleformMovieFunctionParameterString(self.InstructionalButtons[i][3])
|
||||
PopScaleformMovieFunction()
|
||||
count = count + 1
|
||||
end
|
||||
|
||||
@@ -318,6 +318,7 @@ Config.Languages = {
|
||||
['btn_select'] = "Select",
|
||||
['btn_back'] = "Back",
|
||||
['btn_switch'] = "Movement",
|
||||
['btn_increment'] = "Increment"
|
||||
},
|
||||
['fi'] = { -- Finnish 🇫🇮
|
||||
['emotes'] = 'Animaatiot 🎬',
|
||||
|
||||
@@ -47,23 +47,23 @@ local FavoriteEmote = ""
|
||||
|
||||
if Config.FavKeybindEnabled then
|
||||
RegisterCommand('emotefav', function() FavKeybind() end)
|
||||
|
||||
RegisterKeyMapping("emotefav", "Execute your favorite emote", "keyboard", Config.FavKeybind)
|
||||
|
||||
local doingFavoriteEmote = false
|
||||
function FavKeybind()
|
||||
if doingFavoriteEmote == false then
|
||||
doingFavoriteEmote = true
|
||||
if not IsPedSittingInAnyVehicle(PlayerPedId()) then
|
||||
if FavoriteEmote ~= "" and (not CanUseFavKeyBind or CanUseFavKeyBind()) then
|
||||
EmoteCommandStart(nil, { FavoriteEmote, 0 })
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
else
|
||||
EmoteCancel()
|
||||
doingFavoriteEmote = false
|
||||
|
||||
function FavKeybind()
|
||||
if doingFavoriteEmote == false then
|
||||
doingFavoriteEmote = true
|
||||
if not IsPedSittingInAnyVehicle(PlayerPedId()) then
|
||||
if FavoriteEmote ~= "" and (not CanUseFavKeyBind or CanUseFavKeyBind()) then
|
||||
EmoteCommandStart(nil, { FavoriteEmote, 0 })
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
else
|
||||
EmoteCancel()
|
||||
doingFavoriteEmote = false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user