Exemplo n.º 1
0
        /// <summary>
        /// Creates a more advanced (SMS-alike) <see cref="Notification"/> above the minimap showing a sender icon, subject and the message.
        /// </summary>
        /// <param name="icon">The notification icon.</param>
        /// <param name="sender">The sender name.</param>
        /// <param name="subject">The subject line.</param>
        /// <param name="message">The message itself.</param>
        /// <param name="fadeIn">If <c>true</c> the message will fade in.</param>
        /// <param name="blinking">if set to <c>true</c> the notification will blink.</param>
        /// <returns>The handle of the <see cref="Notification"/> which can be used to hide it using <see cref="Notification.Hide(int)"/>.</returns>
        public static int Show(NotificationIcon icon, string sender, string subject, string message, bool fadeIn, bool blinking = false)
        {
            Function.Call(Hash._SET_NOTIFICATION_TEXT_ENTRY, "STRING");

            const int maxStringLength = 99;

            for (int i = 0; i < message.Length; i += maxStringLength)
            {
                Function.Call(Hash.ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME, message.Substring(i, System.Math.Min(maxStringLength, message.Length - i)));
            }

            Function.Call(Hash._SET_NOTIFICATION_MESSAGE_2, "CHAR_" + icon.ToString(), "CHAR_" + icon.ToString(), fadeIn, 1, sender, subject);

            return(Function.Call <int>(Hash._DRAW_NOTIFICATION_4, blinking, true));
        }
Exemplo n.º 2
0
 private static string GetSmallIconName(NotificationIcon icon)
 {
     return("anp_" + icon.ToString().ToLower());
 }