Esempio n. 1
0
        /// <summary>
        /// Draw text
        /// </summary>
        /// <param name="text">Text to drawn</param>
        /// <param name="x">X position in pixel</param>
        /// <param name="y">Y position in pixel</param>
        /// <param name="align">Horizontal alignment</param>
        /// <param name="color">Color</param>
        /// <param name="scale">Scale</param>
        /// <param name="shadowOffset">Offset of shadow</param>
        /// <param name="shadowColor">Color of shadow</param>
        /// <param name="screenHeight">Height of screen in pixel</param>
        /// <param name="screenWidth">Width of screen in pixel</param>
        public static void DrawText(MLString text, float x, float y, GlobalConst.HAlignment align, Color color, float scale = 0.35f, int shadowOffset = 0, Color shadowColor = new Color(), int screenWidth = GlobalConst.DEFAULT_SCREEN_WIDTH, int screenHeight = GlobalConst.DEFAULT_SCREEN_HEIGHT)
        {
            //TextElement tl = new TextElement(ML(text), new PointF(x, y), scale, color, align, showShadow, showOutline);
            //tl.Draw();

            Function.Call(Hash.SET_TEXT_SCALE, scale, scale);
            Function.Call(Hash._SET_TEXT_COLOR, color.R, color.G, color.B, color.A);
            Function.Call(Hash.SET_TEXT_CENTRE, align == GlobalConst.HAlignment.Center);
            Function.Call(Hash.SET_TEXT_DROPSHADOW, shadowOffset, shadowColor.R, shadowColor.G, shadowColor.B, shadowColor.A);
            Function.Call((Hash)GlobalConst.CustomHash.DRAW_TEXT, Function.Call <string>((Hash)GlobalConst.CustomHash.CREATE_STRING, 10, "LITERAL_STRING", ML(text)), (float)x / screenWidth, (float)y / screenHeight);
        }
Esempio n. 2
0
 /// <summary>
 /// Shows a notification above in-game mini-map
 /// </summary>
 /// <param name="message">Message to show</param>
 public static void ShowNotification(MLString message)
 {
     RDR2.UI.Screen.ShowSubtitle(ML(message));
 }
Esempio n. 3
0
 /// <summary>
 /// Format a multi-language string.
 /// </summary>
 /// <param name="format">String format</param>
 /// <param name="args">Arguments</param>
 /// <returns></returns>
 public static string FormatML(MLString format, params object[] args)
 {
     return(string.Format(ML(format), args));
 }
Esempio n. 4
0
 /// <summary>
 ///  Format a multi-language string.
 /// </summary>
 /// <param name="format">String format</param>
 /// <param name="arg">Argument</param>
 /// <returns></returns>
 public static string FormatML(MLString format, MLString arg)
 {
     return(string.Format(ML(format), ML(arg)));
 }
Esempio n. 5
0
 /// <summary>
 /// Gets the string with current language code.
 /// </summary>
 /// <param name="str">Multi-string</param>
 /// <returns></returns>
 public static string ML(MLString str)
 {
     return(str[Trainer.LanguageCode]);
 }