/// <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); }
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); }
/// <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 ); }
/// <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); }
/// <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); }
/// <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)); }
/// <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)); }
/// <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); }