* Fixed some null reference exceptions in Primitive OSD de/serialization

* Changed RequestRezFromInventory to accept the InventoryItem base type and allow rezzing of InventoryAttachments (non-breaking change)
* Implemented OnLogin event for LoginStatus.ConnectingToLogin
* Added public LogText() method to LocalChat GUI element


git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@2402 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
2009-01-02 21:25:21 +00:00
parent d8b0cf6867
commit e9ca2fef01
6 changed files with 141 additions and 11 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -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;
/// <summary>
/// Gets or sets the GridClient associated with this control
/// </summary>
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);
}
}
}

View File

@@ -1965,9 +1965,9 @@ namespace OpenMetaverse
/// <param name="simulator">Simulator to place object in</param>
/// <param name="rotation">Rotation of the object when rezzed</param>
/// <param name="position">Vector of where to place object</param>
/// <param name="item">InventoryObject object containing item details</param>
/// <param name="item">InventoryItem object containing item details</param>
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
/// <param name="simulator">Simulator to place object in</param>
/// <param name="rotation">Rotation of the object when rezzed</param>
/// <param name="position">Vector of where to place object</param>
/// <param name="item">InventoryObject object containing item details</param>
/// <param name="item">InventoryItem object containing item details</param>
/// <param name="groupOwner">UUID of group to own the object</param>
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
/// <param name="simulator">Simulator to place object in</param>
/// <param name="rotation">Rotation of the object when rezzed</param>
/// <param name="position">Vector of where to place object</param>
/// <param name="item">InventoryObject object containing item details</param>
/// <param name="item">InventoryItem object containing item details</param>
/// <param name="groupOwner">UUID of group to own the object</param>
/// <param name="queryID">User defined queryID to correlate replies</param>
/// <param name="requestObjectDetails">if set to true the simulator
/// will automatically send object detail packet(s) back to the client</param>
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();

View File

@@ -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");
}

View File

@@ -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();