From 0bac4b430c264741b7f9e63b5d8fb781ba306c68 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Tue, 18 Sep 2007 12:13:44 +0000 Subject: * Handlerized ViewerEffect * Now there-is-only-client-manager * First step towards moving Logout and ConnectionClosed out of Client and into something else (which will let us get rid of ClientView reference to ClientManager * General posititvity, peace, love and understanding --- .../ClientStack/ClientView.PacketHandlers.cs | 44 +++++++++++++++------- 1 file changed, 30 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs') diff --git a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs index 71fea0d..65ad431 100644 --- a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs +++ b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs @@ -37,13 +37,28 @@ namespace OpenSim.Region.ClientStack protected virtual void RegisterLocalPacketHandlers() { this.AddLocalPacketHandler(PacketType.LogoutRequest, this.Logout); + this.AddLocalPacketHandler(PacketType.ViewerEffect, this.HandleViewerEffect); this.AddLocalPacketHandler(PacketType.AgentCachedTexture, this.AgentTextureCached); this.AddLocalPacketHandler(PacketType.MultipleObjectUpdate, this.MultipleObjUpdate); } - protected virtual bool Logout(IClientAPI simClient, Packet packet) + private bool HandleViewerEffect(IClientAPI sender, Packet Pack) { - MainLog.Instance.Verbose( "OpenSimClient.cs:ProcessInPacket() - Got a logout request"); + ViewerEffectPacket viewer = (ViewerEffectPacket)Pack; + + if( OnViewerEffect != null ) + { + OnViewerEffect(sender, viewer.Effect); + } + + return true; + } + + protected virtual bool Logout(IClientAPI client, Packet packet) + { + // TODO: Refactor out this into an OnLogout so the ClientManager can close all clients. + + MainLog.Instance.Verbose("OpenSimClient.cs:ProcessInPacket() - Got a logout request"); //send reply to let the client logout LogoutReplyPacket logReply = new LogoutReplyPacket(); logReply.AgentData.AgentID = this.AgentId; @@ -52,8 +67,9 @@ namespace OpenSim.Region.ClientStack logReply.InventoryData[0] = new LogoutReplyPacket.InventoryDataBlock(); logReply.InventoryData[0].ItemID = LLUUID.Zero; OutPacket(logReply); - // - this.KillClient(); + // + this.Close(); + return true; } @@ -81,7 +97,7 @@ namespace OpenSim.Region.ClientStack protected bool MultipleObjUpdate(IClientAPI simClient, Packet packet) { MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet; - // System.Console.WriteLine("new multi update packet " + multipleupdate.ToString()); + // System.Console.WriteLine("new multi update packet " + multipleupdate.ToString()); for (int i = 0; i < multipleupdate.ObjectData.Length; i++) { #region position @@ -99,7 +115,7 @@ namespace OpenSim.Region.ClientStack if (OnUpdatePrimSinglePosition != null) { libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); - // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); + // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); } } @@ -128,7 +144,7 @@ namespace OpenSim.Region.ClientStack if (OnUpdatePrimGroupRotation != null) { libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); - // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); + // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); OnUpdatePrimGroupRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); } } @@ -139,7 +155,7 @@ namespace OpenSim.Region.ClientStack libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true); //Console.WriteLine("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z); - // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); + // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); OnUpdatePrimGroupMouseRotation(multipleupdate.ObjectData[i].ObjectLocalID, pos, rot, this); } } @@ -164,10 +180,10 @@ namespace OpenSim.Region.ClientStack if (OnUpdatePrimScale != null) { libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); - // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z ); - OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); - libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); - OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); + // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z ); + OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); + libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); + OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); } } else if (multipleupdate.ObjectData[i].Type == 5)//single prim scale from object tab @@ -175,7 +191,7 @@ namespace OpenSim.Region.ClientStack if (OnUpdatePrimScale != null) { libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); - // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); + // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); } } @@ -184,7 +200,7 @@ namespace OpenSim.Region.ClientStack if (OnUpdatePrimScale != null) { libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); - // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); + // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); } } -- cgit v1.1