Beispiel #1
0
 /// <summary>
 /// Creates a ConsoleMessage from a native instance's attributes
 /// </summary>
 internal ConsoleMessage(IntPtr pointer)
     : base(pointer)
 {
     Color   = new Color(pointer);
     Type    = (ChatType)       Functions.vp_int(pointer, IntAttributes.ChatType);
     Effect  = (ChatEffect) Functions.vp_int(pointer, IntAttributes.ChatType);
 }
Beispiel #2
0
 internal ConsoleMessage(IntPtr pointer)
 {
     Session = Functions.vp_int(pointer, IntAttributes.AvatarSession);
     Name    = Functions.vp_string(pointer, StringAttributes.AvatarName);
     Message = Functions.vp_string(pointer, StringAttributes.ChatMessage);
     Effect  = (ChatEffect)Functions.vp_int(pointer, IntAttributes.ChatEffects);
     Color   = Color.FromChat(pointer);
 }
Beispiel #3
0
        /// <summary>
        /// Sends a broadcast-like message with custom styling to a specific session
        /// </summary>
        public void ConsoleMessage(int session, ChatEffect effects, Color color, string name, string message)
        {
            int rc;
            lock (this)
                rc = Functions.vp_console_message(pointer, session, name, message, (int) effects,
                    (byte) color.Red, (byte) color.Green, (byte) color.Blue);

            if (rc != 0) throw new VPException( (ReasonCode) rc );
        }
Beispiel #4
0
        /// <summary>
        /// Sends a formattable and broadcast-like message with custom styling to a
        /// specific session. Chainable, thread-safe and splits messages over 255 bytes
        /// in length automatically.
        /// </summary>
        /// <param name="session">
        /// Target session, or use 0 to broadcast to everybody. Alternatively, use
        /// <see cref="ConsoleBroadcast(ChatEffect, Color, string, string)"/>
        /// </param>
        /// <param name="name">
        /// Name to use for message, or blank string for a standalone message
        /// </param>
        /// <param name="effects">Effects to use on this message</param>
        /// <param name="color">Color to use on this message</param>
        /// <param name="message">Message to send</param>
        public Instance ConsoleMessage(int session, ChatEffect effects, Color color, string name, string message, params object[] parts)
        {
            var formatted = string.Format(message, parts);
            var chunks    = Unicode.ChunkByByteLimit(formatted);

            lock (Mutex)
                foreach (var chunk in chunks)
                {
                    Functions.Call(() => Functions.vp_console_message(Pointer, session, name, chunk, (int)effects, color.R, color.G, color.B));
                }

            return(this);
        }
Beispiel #5
0
 /// <summary>
 /// Sends a formattable and broadcast-like message with custom styling to
 /// everybody in-world. Chainable, thread-safe and splits messages over 255 bytes
 /// in length automatically.
 /// </summary>
 /// <param name="name">
 /// Name to use for message, or blank string for a standalone message
 /// </param>
 /// <param name="effects">Effects to use on this message</param>
 /// <param name="color">Color to use on this message</param>
 /// <param name="message">Message to send</param>
 public Instance ConsoleBroadcast(ChatEffect effects, Color color, string name, string message, params object[] parts)
 {
     return(ConsoleMessage(0, effects, color, name, string.Format(message, parts)));
 }
 public static void AddChatEffect(string trigger, ChatEffect effect)
 {
     chatEffects.Add(trigger, effect);
 }
Beispiel #7
0
 /// <summary>
 /// Sends a formatted broadcast-like message with custom styling to a specific
 /// session
 /// </summary>
 public void ConsoleMessage(int session, ChatEffect effects, Color color, string name, string message, params object[] parts)
 {
     ConsoleMessage(session, effects, color, name, string.Format(message, parts));
 }
Beispiel #8
0
 /// <summary>
 /// Sends a formatted broadcast-like message with custom styling to everybody
 /// in-world
 /// </summary>
 public void ConsoleBroadcast(ChatEffect effects, Color color, string name, string message, params object[] parts)
 {
     ConsoleMessage(0, effects, color, name, string.Format(message, parts));
 }
Beispiel #9
0
 /// <summary>
 /// Sends a broadcast-like message with custom styling to everybody in-world
 /// </summary>
 public void ConsoleBroadcast(ChatEffect effects, Color color, string name, string message)
 {
     ConsoleMessage(0, effects, color, name, message);
 }