private void onAvatarMovement(ScenePresence client) { string uuid = client.UUID.ToString(); string msg = MGMJson.AvatarMoved(uuid, client.AbsolutePosition, client.GetWorldRotation(), client.GetWorldVelocity()); mgmLink.send(msg); }
public void AddRegion(Scene scene) { if (!enabled) { return; } log("Adding region to MGM"); npc = (NPCModule)scene.RequestModuleInterface <INPCModule>(); if (npc == null || !npc.Enabled) { enabled = false; log("ERROR: NPC module must be enabled for MGM"); return; } scene.AddCommand("mgm", this, "mgm status", "status", "Print the status of the MGM module", consoleStatus); scene.AddCommand("mgm", this, "mgm addUser", "addUser", "Test adding a user", addUser); scene.AddCommand("mgm", this, "mgm removeUser", "removeUser", "Test removing a user", removeUser); mgmLink = new MGMLink(new IPEndPoint(mgmAddress, mgmPort), log); mgmLink.start(); registerEvents(scene.EventManager); string regMsg = MGMJson.Register(scene.Name, scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY, scene.RegionInfo.RegionSizeX); mgmLink.send(regMsg); this.scene = scene; mgr = new MGMClientManager(scene, log); }
private void onAddAvatar(ScenePresence client) { string uuid = client.UUID.ToString(); string msg = MGMJson.AddAvatar(uuid); mgmLink.send(msg); }
public static String RemoveAvatar(string uuid) { Dictionary <string, object> msg = new Dictionary <string, object>(); msg["type"] = "removeAvatar"; msg["uuid"] = uuid; return(MGMJson.Encode(msg)); }
public static String Frame() { TimeSpan t = DateTime.Now - new DateTime(1970, 1, 1); int secondsSinceEpoch = (int)t.TotalMilliseconds; Dictionary <string, object> msg = new Dictionary <string, object>(); msg["type"] = "frame"; msg["ms"] = secondsSinceEpoch; return(MGMJson.Encode(msg)); }
public static string InstantMessage(string sender, string target, int isGroup, string message) { Dictionary <string, object> msg = new Dictionary <string, object>(); msg["type"] = "instantMessage"; msg["sender"] = sender; msg["target"] = target; msg["isGroup"] = isGroup; msg["body"] = message; return(MGMJson.Encode(msg)); }
public static String Register(string regionName, uint locX, uint locY, uint regionSize) { Dictionary <string, object> msg = new Dictionary <string, object>(); msg["type"] = "register"; msg["name"] = regionName; msg["locX"] = locX; msg["locY"] = locY; msg["size"] = regionSize; return(MGMJson.Encode(msg)); }
public static String AvatarMoved(string uuid, OpenMetaverse.Vector3 position, OpenMetaverse.Quaternion rotation, OpenMetaverse.Vector3 velocity) { Dictionary <string, object> msg = new Dictionary <string, object>(); msg ["type"] = "moveAvatar"; msg ["uuid"] = uuid; msg ["position"] = position; msg ["rotation"] = rotation; msg ["velocity"] = velocity; return(MGMJson.Encode(msg)); }
public static String TextMessage(string sender, string target, int channel, string chatType, string pos, string message) { Dictionary <string, object> msg = new Dictionary <string, object>(); msg["type"] = "textMessage"; msg["sender"] = sender; msg["target"] = target; msg["channel"] = channel; msg["chatType"] = chatType; msg["pos"] = pos; msg["body"] = message; return(MGMJson.Encode(msg)); }
//only has broadcasts to local chat, not IMs private void onChatBroadcast(object obj, OSChatMessage msg) { if (msg.Message == "") { //these messages are generated on keyboard input, and have not data return; } string sender = msg.SenderUUID.ToString(); string target = msg.TargetUUID.ToString(); string pos = msg.Position.ToString(); string msgType = Enum.GetName(typeof(ChatTypeEnum), msg.Type); String message = MGMJson.TextMessage(sender, target, msg.Channel, msgType, pos, msg.Message); mgmLink.send(message); }
private void onInstantMessage(GridInstantMessage msg) { if (msg.dialog != 0) { return; } string sender = msg.fromAgentID.ToString(); string target = msg.toAgentID.ToString(); int isGroup; if (msg.fromGroup) { isGroup = 1; // } else { isGroup = 0; } string body = msg.message; String message = MGMJson.InstantMessage(sender, target, isGroup, body); link.send(message); }
public void onRemoveAvatar(OpenMetaverse.UUID uuid) { string msg = MGMJson.RemoveAvatar(uuid.ToString()); mgmLink.send(msg); }