Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
C#/Lua: UIMenu add switch for 3D animations
  • Loading branch information
manups4e committed Aug 8, 2023
1 parent 752dd0d commit 962ec9c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
17 changes: 17 additions & 0 deletions ScaleformUI_Csharp/Menus/UIMenu/UIMenu.cs
Expand Up @@ -926,6 +926,8 @@ public int MaxItemsOnScreen

public bool MouseEdgeEnabled = true;
public bool ControlDisablingEnabled = true;
private bool enabled3DAnimations;

public bool EnableAnimation
{
get => enableAnimation;
Expand All @@ -938,6 +940,20 @@ public bool EnableAnimation
}
}
}

public bool Enabled3DAnimations
{
get => enabled3DAnimations;
set
{
enabled3DAnimations = value;
if (Visible)
{
Main.scaleformUI.CallFunction("ENABLE_3D_ANIMATIONS", enabled3DAnimations);
}
}
}

public MenuAnimationType AnimationType
{
get => animationType;
Expand Down Expand Up @@ -2279,6 +2295,7 @@ internal async void BuildUpMenuAsync()
}
}
Main.scaleformUI.CallFunction("ENABLE_MOUSE", MouseControlsEnabled);
Main.scaleformUI.CallFunction("ENABLE_3D_ANIMATIONS", enabled3DAnimations);
EnableAnimation = _animEnabled;
FadeInMenu();
isBuilding = false;
Expand Down
13 changes: 13 additions & 0 deletions ScaleformUI_Lua/src/Menus/UIMenu/UIMenu.lua
Expand Up @@ -112,6 +112,7 @@ function UIMenu.New(title, subTitle, x, y, glare, txtDictionary, txtName, altern
_timeBeforeOverflow = 0,
_canHe = true,
_scaledWidth = (720 * GetAspectRatio(false)),
enabled3DAnimations = true,
isFading = false,
fadingTime = fadeTime or 0.1,
Controls = {
Expand Down Expand Up @@ -358,6 +359,17 @@ function UIMenu:AnimationEnabled(enable)
return self.enableAnimation
end

function UIMenu:Enabled3DAnimations(enable)
if enable ~= nil then
self.enabled3DAnimations = enable
if self:Visible() then
ScaleformUI.Scaleforms._ui:CallFunction("ENABLE_3D_ANIMATIONS", false, enable)
end
else
return self.enabled3DAnimations
end
end

--- Sets the menu's scrolling animationType while the menu is visible.
---@param menuAnimationType MenuAnimationType?
---@return number MenuAnimationType
Expand Down Expand Up @@ -673,6 +685,7 @@ function UIMenu:BuildUpMenuAsync()
end
end
ScaleformUI.Scaleforms._ui:CallFunction("ENABLE_MOUSE", false, self.Settings.MouseControlsEnabled)
ScaleformUI.Scaleforms._ui:CallFunction("ENABLE_3D_ANIMATIONS", false, self.enabled3DAnimations)
self:AnimationEnabled(enab)
self:FadeInMenu()
self._isBuilding = false
Expand Down

0 comments on commit 962ec9c

Please sign in to comment.