From 33bb5e06b9836d6678d3da126fd4feaad1715c68 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Tue, 27 Feb 2007 23:57:36 +0000 Subject: [PATCH] Changed the example code to properly use the automatic AgentThrottle (throttle values need to be set before the client logs in) git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@1013 52acb1d6-8a22-11de-b505-999d5b087335 --- .../examples/Heightmap/frmHeightmap.cs | 10 +++++----- .../examples/TestClient/ClientManager.cs | 11 +++++------ .../examples/groupmanager/frmGroupManager.cs | 5 ++++- .../examples/primexport/frmPrimExport.cs | 14 ++++++++------ libsecondlife-cs/examples/sldump/sldump.cs | 13 ++++++------- libsecondlife-cs/libsecondlife.sln | 8 -------- 6 files changed, 28 insertions(+), 33 deletions(-) diff --git a/libsecondlife-cs/examples/Heightmap/frmHeightmap.cs b/libsecondlife-cs/examples/Heightmap/frmHeightmap.cs index 76373ab5..a4619e49 100644 --- a/libsecondlife-cs/examples/Heightmap/frmHeightmap.cs +++ b/libsecondlife-cs/examples/Heightmap/frmHeightmap.cs @@ -29,6 +29,11 @@ namespace Heightmap LastName = lastName; Password = password; + // Throttle land up and other things down + Client.Throttle.Cloud = 0; + Client.Throttle.Land = 1000000; + Client.Throttle.Wind = 0; + // Build the picture boxes this.SuspendLayout(); for (int y = 0; y < 16; y++) @@ -71,11 +76,6 @@ namespace Heightmap { UpdateTimer.Elapsed += new System.Timers.ElapsedEventHandler(UpdateTimer_Elapsed); UpdateTimer.Start(); - - // Crank up the terrain throttle and turn off or down other useless info - Client.Throttle.Total = 0.0f; - Client.Throttle.Land = 999999.0f; - Client.Throttle.Set(); } } diff --git a/libsecondlife-cs/examples/TestClient/ClientManager.cs b/libsecondlife-cs/examples/TestClient/ClientManager.cs index 01aac4d7..430386e5 100644 --- a/libsecondlife-cs/examples/TestClient/ClientManager.cs +++ b/libsecondlife-cs/examples/TestClient/ClientManager.cs @@ -87,6 +87,11 @@ namespace libsecondlife.TestClient client.SimPrims = SimPrims; client.Master = account.Master; + // Throttle the connection to not receive LayerData packets + client.Throttle.Land = 0.0f; + client.Throttle.Cloud = 0.0f; + client.Throttle.Wind = 0.0f; + if (this.startpos.sim != null) { if (this.startpos.x == 0 || this.startpos.y == 0 || this.startpos.z == 0) @@ -117,12 +122,6 @@ namespace libsecondlife.TestClient Clients[client.Network.AgentID] = client; Console.WriteLine("Logged in " + client.ToString()); - - // Throttle the connection to not receive LayerData packets - client.Throttle.Land = 0.0f; - client.Throttle.Cloud = 0.0f; - client.Throttle.Wind = 0.0f; - client.Throttle.Set(); } return client; diff --git a/libsecondlife-cs/examples/groupmanager/frmGroupManager.cs b/libsecondlife-cs/examples/groupmanager/frmGroupManager.cs index 555dd578..bb2105fb 100644 --- a/libsecondlife-cs/examples/groupmanager/frmGroupManager.cs +++ b/libsecondlife-cs/examples/groupmanager/frmGroupManager.cs @@ -18,6 +18,10 @@ namespace groupmanager public frmGroupManager() { Client = new SecondLife(); + // Throttle unnecessary things down + Client.Throttle.Land = 0; + Client.Throttle.Wind = 0; + Client.Throttle.Cloud = 0; InitializeComponent(); } @@ -64,7 +68,6 @@ namespace groupmanager { groupBox.Enabled = true; - Client.Throttle.Set(); Client.Groups.BeginGetCurrentGroups(new GroupManager.CurrentGroupsCallback(GroupsUpdatedHandler)); } else diff --git a/libsecondlife-cs/examples/primexport/frmPrimExport.cs b/libsecondlife-cs/examples/primexport/frmPrimExport.cs index b3c36653..7e3c40ee 100644 --- a/libsecondlife-cs/examples/primexport/frmPrimExport.cs +++ b/libsecondlife-cs/examples/primexport/frmPrimExport.cs @@ -299,12 +299,19 @@ namespace primexport InitializeComponent(); client = new SecondLife(); + + // Setup the callbacks client.OnLogMessage += new SecondLife.LogCallback(client_OnLogMessage); client.Objects.RequestAllObjects = true; client.Objects.OnNewPrim += new ObjectManager.NewPrimCallback(PrimSeen); client.Objects.OnNewAvatar += new ObjectManager.NewAvatarCallback(AvatarSeen); client.Objects.OnNewAttachment += new ObjectManager.NewAttachmentCallback(AttachmentSeen); + // Throttle down unnecessary things + client.Throttle.Cloud = 0; + client.Throttle.Land = 0; + client.Throttle.Wind = 0; + grpLogin.Enabled = true; } @@ -576,12 +583,7 @@ namespace primexport if (client.Network.Login(txtFirstName.Text, txtLastName.Text, txtPassword.Text, "primexport", "jhurliman@wsu.edu")) { - client.Throttle.Asset = 0; - client.Throttle.Cloud = 0; - client.Throttle.Land = 0; - client.Throttle.Texture = 0; - client.Throttle.Wind = 0; - client.Throttle.Set(); + ; } else { diff --git a/libsecondlife-cs/examples/sldump/sldump.cs b/libsecondlife-cs/examples/sldump/sldump.cs index 9608e610..929eee0d 100644 --- a/libsecondlife-cs/examples/sldump/sldump.cs +++ b/libsecondlife-cs/examples/sldump/sldump.cs @@ -102,6 +102,12 @@ namespace sldump return; } + // Throttle packets that we don't want all the way down + client.Throttle.Land = 0; + client.Throttle.Wind = 0; + client.Throttle.Cloud = 0; + client.Throttle.Texture = 0; + // Setup the packet callback and disconnect event handler client.Network.RegisterCallback(PacketType.Default, new NetworkManager.PacketCallback(DefaultHandler)); client.Network.OnDisconnected += new NetworkManager.DisconnectedCallback(DisconnectHandler); @@ -116,13 +122,6 @@ namespace sldump // Login was successful Console.WriteLine("Message of the day: " + client.Network.LoginValues["message"]); - // Throttle packets that we don't want all the way down - client.Throttle.Land = 0; - client.Throttle.Wind = 0; - client.Throttle.Cloud = 0; - client.Throttle.Texture = 0; - client.Throttle.Set(); - int start = Environment.TickCount; int milliseconds = Int32.Parse(args[3]) * 1000; bool forever = (milliseconds > 0) ? false : true; diff --git a/libsecondlife-cs/libsecondlife.sln b/libsecondlife-cs/libsecondlife.sln index af787c6a..5a2a0331 100644 --- a/libsecondlife-cs/libsecondlife.sln +++ b/libsecondlife-cs/libsecondlife.sln @@ -50,8 +50,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Heightmap", "examples\Heigh EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "key2name", "examples\Key2Name\key2name.csproj", "{4FF68142-9C61-42D1-87DC-5D37CB671C29}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "animationbot", "..\animationbot\animationbot.csproj", "{D82F2B21-2E02-43A2-96E8-94D6B5EBE3B5}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|.NET 1.1 = Debug|.NET 1.1 @@ -212,12 +210,6 @@ Global {4FF68142-9C61-42D1-87DC-5D37CB671C29}.Release|.NET 1.1.ActiveCfg = Release|Any CPU {4FF68142-9C61-42D1-87DC-5D37CB671C29}.Release|Any CPU.ActiveCfg = Release|Any CPU {4FF68142-9C61-42D1-87DC-5D37CB671C29}.Release|Any CPU.Build.0 = Release|Any CPU - {D82F2B21-2E02-43A2-96E8-94D6B5EBE3B5}.Debug|.NET 1.1.ActiveCfg = Debug|Any CPU - {D82F2B21-2E02-43A2-96E8-94D6B5EBE3B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D82F2B21-2E02-43A2-96E8-94D6B5EBE3B5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D82F2B21-2E02-43A2-96E8-94D6B5EBE3B5}.Release|.NET 1.1.ActiveCfg = Release|Any CPU - {D82F2B21-2E02-43A2-96E8-94D6B5EBE3B5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D82F2B21-2E02-43A2-96E8-94D6B5EBE3B5}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE