Add Toggle For Emote Movement ON / OFF (#140)

* feat: toggle between moving emotes and not

* Update Emote.lua

* Update Emote.lua

* Update Emote.lua

* Changes:
• removed `EmoteMoving` from `AnimationOptions`, by default its always `true` now and changeble by toggle
• some refactor and logic changes

Shoutout to @iSentrie 🙏
This commit is contained in:
iSentrie
2023-01-30 02:47:23 +02:00
committed by GitHub
parent 790969a38b
commit 55db9d5ee6
4 changed files with 634 additions and 1390 deletions

View File

@@ -2424,6 +2424,9 @@ function UIMenu.New(Title, Subtitle, X, Y, TxtDictionary, TxtName)
Down = {
Enabled = true,
},
Switch = {
Enabled = true,
}
},
ParentMenu = nil,
ParentItem = nil,
@@ -2882,6 +2885,10 @@ function UIMenu:ProcessControl()
self:GoBack()
end
if self.Controls.Switch.Enabled and (IsDisabledControlJustReleased(0, 37) or IsDisabledControlJustReleased(1, 37) or IsDisabledControlJustReleased(2, 37)) then
self:SwitchMove()
end
if #self.Items == 0 then
return
end
@@ -3170,6 +3177,12 @@ function UIMenu:GoBack()
self.OnMenuClosed(self)
end
function UIMenu:SwitchMove()
PlaySoundFrontend(-1, self.Settings.Audio.Back, self.Settings.Audio.Library, true)
ToggleEmoteMovement = not ToggleEmoteMovement
self:Visible(true)
end
function UIMenu:BindMenuToItem(Menu, Item)
if Menu() == "UIMenu" and Item() == "UIMenuItem" then
Menu.ParentMenu = self
@@ -3573,14 +3586,22 @@ function UIMenu:UpdateScaleform()
PushScaleformMovieFunction(self.InstructionalScaleform, "SET_DATA_SLOT")
PushScaleformMovieFunctionParameterInt(0)
PushScaleformMovieFunctionParameterString(GetControlInstructionalButton(2, 176, 0))
PushScaleformMovieFunctionParameterString("Select")
PushScaleformMovieFunctionParameterString(Config.Languages[lang]['btn_select'])
PopScaleformMovieFunction()
if self.Controls.Back.Enabled then
PushScaleformMovieFunction(self.InstructionalScaleform, "SET_DATA_SLOT")
PushScaleformMovieFunctionParameterInt(1)
PushScaleformMovieFunctionParameterString(GetControlInstructionalButton(2, 177, 0))
PushScaleformMovieFunctionParameterString("Back")
PushScaleformMovieFunctionParameterString(Config.Languages[lang]['btn_back'])
PopScaleformMovieFunction()
end
if self.Controls.Switch.Enabled then
PushScaleformMovieFunction(self.InstructionalScaleform, "SET_DATA_SLOT")
PushScaleformMovieFunctionParameterInt(2)
PushScaleformMovieFunctionParameterString(GetControlInstructionalButton(2, 37, 0))
PushScaleformMovieFunctionParameterString(Config.Languages[lang]['btn_switch']..(ToggleEmoteMovement and ": <C>ON </C>" or ": <C>OFF</C>"))
PopScaleformMovieFunction()
end
@@ -3588,11 +3609,12 @@ function UIMenu:UpdateScaleform()
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