diff --git a/LemonUI/Scaleform/BaseScaleform.cs b/LemonUI/Scaleform/BaseScaleform.cs index 5ebafead..07e2b493 100644 --- a/LemonUI/Scaleform/BaseScaleform.cs +++ b/LemonUI/Scaleform/BaseScaleform.cs @@ -44,6 +44,22 @@ public abstract class BaseScaleform : IScaleform /// If the Scaleform should be visible or not. /// public bool Visible { get; set; } + /// + /// If the Scaleform is loaded or not. + /// + public bool IsLoaded + { + get + { +#if FIVEM + return API.HasScaleformMovieLoaded(Handle); +#elif RPH + return NativeFunction.CallByHash(0x85F01B8D5B90570E, Handle); +#elif (SHVDN2 || SHVDN3) + return Function.Call(Hash.HAS_SCALEFORM_MOVIE_LOADED, Handle); +#endif + } + } #endregion @@ -56,19 +72,32 @@ public abstract class BaseScaleform : IScaleform public BaseScaleform(string sc) { Name = sc; + + LoadScaleform(); + } + + #endregion + + #region Protected Functions + + /// + /// Load a given Scaleform + /// + protected void LoadScaleform() + { #if FIVEM - Handle = API.RequestScaleformMovie(sc); + Handle = API.RequestScaleformMovie(Name); #elif RPH - Handle = NativeFunction.CallByHash(0x11FE353CF9733E6F, sc); + Handle = NativeFunction.CallByHash(0x11FE353CF9733E6F, Name); #elif (SHVDN2 || SHVDN3) - Handle = Function.Call(Hash.REQUEST_SCALEFORM_MOVIE, sc); + Handle = Function.Call(Hash.REQUEST_SCALEFORM_MOVIE, Name); #endif #pragma warning disable CS0618 // Type or member is obsolete #if FIVEM - scaleform = new CitizenFX.Core.Scaleform(sc); + scaleform = new CitizenFX.Core.Scaleform(Name); #elif (SHVDN2 || SHVDN3) - scaleform = new GTA.Scaleform(sc); + scaleform = new GTA.Scaleform(Name); #endif #pragma warning restore CS0618 // Type or member is obsolete }