diff --git a/OpenMetaverse.GUI/InventoryTree.cs b/OpenMetaverse.GUI/InventoryTree.cs index 4803cb15..02b4c2cf 100644 --- a/OpenMetaverse.GUI/InventoryTree.cs +++ b/OpenMetaverse.GUI/InventoryTree.cs @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2008, openmetaverse.org + * Copyright (c) 2007-2009, openmetaverse.org * All rights reserved. * * - Redistribution and use in source and binary forms, with or without diff --git a/OpenMetaverse.GUI/LocalChat.cs b/OpenMetaverse.GUI/LocalChat.cs index 34d02af2..cc906740 100644 --- a/OpenMetaverse.GUI/LocalChat.cs +++ b/OpenMetaverse.GUI/LocalChat.cs @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2008, openmetaverse.org + * Copyright (c) 2007-2009, openmetaverse.org * All rights reserved. * * - Redistribution and use in source and binary forms, with or without @@ -102,6 +102,22 @@ namespace OpenMetaverse.GUI } } + public void LogText(string text, Color color) + { + if (this.InvokeRequired) + { + this.BeginInvoke((MethodInvoker)delegate { LogText(text, color); }); + } + else + { + _rtfOutput.SelectionStart = _rtfOutput.Text.Length; + _rtfOutput.SelectionColor = color; + DateTime now = DateTime.Now; + _rtfOutput.SelectedText = string.Format("{0}[{1}:{2}] {3}", Environment.NewLine, now.Hour.ToString().PadLeft(2, '0'), now.Minute.ToString().PadLeft(2, '0'), text); + _rtfOutput.ScrollToCaret(); + } + } + void Self_OnChat(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourceType, string fromName, UUID id, UUID ownerid, Vector3 position) { if (audible == ChatAudibleLevel.Fully && type != ChatType.StartTyping && type != ChatType.StopTyping) diff --git a/OpenMetaverse.GUI/StatusOutput.cs b/OpenMetaverse.GUI/StatusOutput.cs new file mode 100644 index 00000000..dc600f17 --- /dev/null +++ b/OpenMetaverse.GUI/StatusOutput.cs @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2007-2009, openmetaverse.org + * All rights reserved. + * + * - Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * - Neither the name of the openmetaverse.org nor the names + * of its contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Drawing; +using System.Windows.Forms; + +namespace OpenMetaverse.GUI +{ + public class StatusOutput : RichTextBox + { + private GridClient _Client; + + /// + /// Gets or sets the GridClient associated with this control + /// + public GridClient Client + { + get { return _Client; } + set { if (value != null) InitializeClient(value); } + } + + public StatusOutput() + { + this.ReadOnly = true; + this.BackColor = Color.White; + } + + public void LogText(string text, Color color) + { + if (this.InvokeRequired) + { + this.BeginInvoke((MethodInvoker)delegate { LogText(text, color); }); + } + else + { + this.SelectionStart = this.Text.Length; + this.SelectionColor = color; + DateTime now = DateTime.Now; + this.SelectedText = string.Format("{0}[{1}:{2}] {3}", Environment.NewLine, now.Hour.ToString().PadLeft(2, '0'), now.Minute.ToString().PadLeft(2, '0'), text); + this.ScrollToCaret(); + } + } + + private void InitializeClient(GridClient client) + { + _Client = client; + _Client.Network.OnCurrentSimChanged += new NetworkManager.CurrentSimChangedCallback(Network_OnCurrentSimChanged); + _Client.Network.OnDisconnected += new NetworkManager.DisconnectedCallback(Network_OnDisconnected); + _Client.Network.OnLogin += new NetworkManager.LoginCallback(Network_OnLogin); + _Client.Self.OnAlertMessage += new AgentManager.AlertMessageCallback(Self_OnAlertMessage); + _Client.Self.OnMoneyBalanceReplyReceived += new AgentManager.MoneyBalanceReplyCallback(Self_OnMoneyBalanceReplyReceived); + } + + void Self_OnMoneyBalanceReplyReceived(UUID transactionID, bool transactionSuccess, int balance, int metersCredit, int metersCommitted, string description) + { + if (description != String.Empty) LogText(description, Color.Green); + LogText("Balance: L$" + balance, Color.Green); + } + + void Network_OnCurrentSimChanged(Simulator PreviousSimulator) + { + LogText("Entered region \"" + Client.Network.CurrentSim.Name + "\".", Color.Black); + } + + void Network_OnDisconnected(NetworkManager.DisconnectType reason, string message) + { + LogText("Disconnected" + (message != null && message != String.Empty ? ": " + message : "."), Color.Black); + } + + void Network_OnLogin(LoginStatus login, string message) + { + if (login == LoginStatus.Failed) LogText("Login failed: " + message, Color.Red); + else if (login != LoginStatus.Success) LogText(message, Color.Black); + } + + void Self_OnAlertMessage(string message) + { + LogText(message, Color.Gray); + } + + } +} diff --git a/OpenMetaverse/InventoryManager.cs b/OpenMetaverse/InventoryManager.cs index 212e3be9..a25e2d76 100644 --- a/OpenMetaverse/InventoryManager.cs +++ b/OpenMetaverse/InventoryManager.cs @@ -1965,9 +1965,9 @@ namespace OpenMetaverse /// Simulator to place object in /// Rotation of the object when rezzed /// Vector of where to place object - /// InventoryObject object containing item details + /// InventoryItem object containing item details public UUID RequestRezFromInventory(Simulator simulator, Quaternion rotation, Vector3 position, - InventoryObject item) + InventoryItem item) { return RequestRezFromInventory(simulator, rotation, position, item, _Client.Self.ActiveGroup, UUID.Random(), false); @@ -1979,10 +1979,10 @@ namespace OpenMetaverse /// Simulator to place object in /// Rotation of the object when rezzed /// Vector of where to place object - /// InventoryObject object containing item details + /// InventoryItem object containing item details /// UUID of group to own the object public UUID RequestRezFromInventory(Simulator simulator, Quaternion rotation, Vector3 position, - InventoryObject item, UUID groupOwner) + InventoryItem item, UUID groupOwner) { return RequestRezFromInventory(simulator, rotation, position, item, groupOwner, UUID.Random(), false); } @@ -1993,13 +1993,13 @@ namespace OpenMetaverse /// Simulator to place object in /// Rotation of the object when rezzed /// Vector of where to place object - /// InventoryObject object containing item details + /// InventoryItem object containing item details /// UUID of group to own the object /// User defined queryID to correlate replies /// if set to true the simulator /// will automatically send object detail packet(s) back to the client public UUID RequestRezFromInventory(Simulator simulator, Quaternion rotation, Vector3 position, - InventoryObject item, UUID groupOwner, UUID queryID, bool requestObjectDetails) + InventoryItem item, UUID groupOwner, UUID queryID, bool requestObjectDetails) { RezObjectPacket add = new RezObjectPacket(); diff --git a/OpenMetaverse/Login.cs b/OpenMetaverse/Login.cs index e183be35..782c7f56 100644 --- a/OpenMetaverse/Login.cs +++ b/OpenMetaverse/Login.cs @@ -972,6 +972,7 @@ namespace OpenMetaverse CapsClient loginRequest = new CapsClient(loginUri); loginRequest.OnComplete += new CapsClient.CompleteCallback(LoginReplyHandler); loginRequest.UserData = CurrentContext; + UpdateLoginStatus(LoginStatus.ConnectingToLogin, String.Format("Logging in as {0} {1}...", loginParams.FirstName, loginParams.LastName)); loginRequest.StartRequest(OSDParser.SerializeLLSDXmlBytes(loginLLSD), "application/xml+llsd"); } diff --git a/OpenMetaverse/Primitives/Primitive.cs b/OpenMetaverse/Primitives/Primitive.cs index 4b503b2f..eb9c9230 100644 --- a/OpenMetaverse/Primitives/Primitive.cs +++ b/OpenMetaverse/Primitives/Primitive.cs @@ -1215,9 +1215,14 @@ namespace OpenMetaverse if (ParentID != 0) prim["parentid"] = OSD.FromInteger(ParentID); - prim["light"] = Light.GetOSD(); - prim["flex"] = Flexible.GetOSD(); - prim["sculpt"] = Sculpt.GetOSD(); + if (Light != null) + prim["light"] = Light.GetOSD(); + + if (Flexible != null) + prim["flex"] = Flexible.GetOSD(); + + if (Sculpt != null) + prim["sculpt"] = Sculpt.GetOSD(); return prim; } @@ -1281,6 +1286,8 @@ namespace OpenMetaverse prim.Light = LightData.FromOSD(map["light"]); prim.Sculpt = SculptData.FromOSD(map["sculpt"]); prim.Textures = TextureEntry.FromOSD(map["textures"]); + prim.Properties = new ObjectProperties(); + if (!string.IsNullOrEmpty(map["name"].AsString())) { prim.Properties.Name = map["name"].AsString();