本文整理匯總了C#中libsecondlife.Simulator.ToString方法的典型用法代碼示例。如果您正苦於以下問題:C# Simulator.ToString方法的具體用法?C# Simulator.ToString怎麽用?C# Simulator.ToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類libsecondlife.Simulator
的用法示例。
在下文中一共展示了Simulator.ToString方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Network_OnEventQueueRunning
private void Network_OnEventQueueRunning(Simulator simulator)
{
Logger.DebugLog("Event queue is running for " + simulator.ToString() + ", enabling uploads", Client);
EnableUpload();
}
示例2: RegionHandshakeHandler
private void RegionHandshakeHandler(Packet packet, Simulator simulator)
{
RegionHandshakePacket handshake = (RegionHandshakePacket)packet;
simulator.ID = handshake.RegionInfo.CacheID;
simulator.IsEstateManager = handshake.RegionInfo.IsEstateManager;
simulator.Name = Helpers.FieldToUTF8String(handshake.RegionInfo.SimName);
simulator.SimOwner = handshake.RegionInfo.SimOwner;
simulator.TerrainBase0 = handshake.RegionInfo.TerrainBase0;
simulator.TerrainBase1 = handshake.RegionInfo.TerrainBase1;
simulator.TerrainBase2 = handshake.RegionInfo.TerrainBase2;
simulator.TerrainBase3 = handshake.RegionInfo.TerrainBase3;
simulator.TerrainDetail0 = handshake.RegionInfo.TerrainDetail0;
simulator.TerrainDetail1 = handshake.RegionInfo.TerrainDetail1;
simulator.TerrainDetail2 = handshake.RegionInfo.TerrainDetail2;
simulator.TerrainDetail3 = handshake.RegionInfo.TerrainDetail3;
simulator.TerrainHeightRange00 = handshake.RegionInfo.TerrainHeightRange00;
simulator.TerrainHeightRange01 = handshake.RegionInfo.TerrainHeightRange01;
simulator.TerrainHeightRange10 = handshake.RegionInfo.TerrainHeightRange10;
simulator.TerrainHeightRange11 = handshake.RegionInfo.TerrainHeightRange11;
simulator.TerrainStartHeight00 = handshake.RegionInfo.TerrainStartHeight00;
simulator.TerrainStartHeight01 = handshake.RegionInfo.TerrainStartHeight01;
simulator.TerrainStartHeight10 = handshake.RegionInfo.TerrainStartHeight10;
simulator.TerrainStartHeight11 = handshake.RegionInfo.TerrainStartHeight11;
simulator.WaterHeight = handshake.RegionInfo.WaterHeight;
simulator.Flags = (Simulator.RegionFlags)handshake.RegionInfo.RegionFlags;
simulator.BillableFactor = handshake.RegionInfo.BillableFactor;
simulator.Access = (Simulator.SimAccess)handshake.RegionInfo.SimAccess;
Client.Log("Received a region handshake for " + simulator.ToString(), Helpers.LogLevel.Info);
// Send a RegionHandshakeReply
RegionHandshakeReplyPacket reply = new RegionHandshakeReplyPacket();
reply.AgentData.AgentID = Client.Self.AgentID;
reply.AgentData.SessionID = Client.Self.SessionID;
reply.RegionInfo.Flags = 0;
SendPacket(reply, simulator);
// We're officially connected to this sim
simulator.connected = true;
simulator.ConnectedEvent.Set();
}
示例3: TeleportHandler
/// <summary>
/// Handler for teleport Requests
/// </summary>
/// <param name="packet">Incoming TeleportHandler packet</param>
/// <param name="simulator">Simulator sending teleport information</param>
private void TeleportHandler(Packet packet, Simulator simulator)
{
bool finished = false;
TeleportFlags flags = TeleportFlags.Default;
if (packet.Type == PacketType.TeleportStart)
{
TeleportStartPacket start = (TeleportStartPacket)packet;
teleportMessage = "Teleport started";
flags = (TeleportFlags)start.Info.TeleportFlags;
teleportStat = TeleportStatus.Start;
Client.DebugLog("TeleportStart received, Flags: " + flags.ToString());
}
else if (packet.Type == PacketType.TeleportProgress)
{
TeleportProgressPacket progress = (TeleportProgressPacket)packet;
teleportMessage = Helpers.FieldToUTF8String(progress.Info.Message);
flags = (TeleportFlags)progress.Info.TeleportFlags;
teleportStat = TeleportStatus.Progress;
Client.DebugLog("TeleportProgress received, Message: " + teleportMessage + ", Flags: " + flags.ToString());
}
else if (packet.Type == PacketType.TeleportFailed)
{
TeleportFailedPacket failed = (TeleportFailedPacket)packet;
teleportMessage = Helpers.FieldToUTF8String(failed.Info.Reason);
teleportStat = TeleportStatus.Failed;
finished = true;
Client.DebugLog("TeleportFailed received, Reason: " + teleportMessage);
}
else if (packet.Type == PacketType.TeleportFinish)
{
TeleportFinishPacket finish = (TeleportFinishPacket)packet;
flags = (TeleportFlags)finish.Info.TeleportFlags;
string seedcaps = Helpers.FieldToUTF8String(finish.Info.SeedCapability);
finished = true;
Client.DebugLog("TeleportFinish received, Flags: " + flags.ToString());
// Connect to the new sim
Simulator newSimulator = Client.Network.Connect(new IPAddress(finish.Info.SimIP),
finish.Info.SimPort, finish.Info.RegionHandle, true, seedcaps);
if (newSimulator != null)
{
teleportMessage = "Teleport finished";
teleportStat = TeleportStatus.Finished;
// Disconnect from the previous sim
Client.Network.DisconnectSim(simulator, true);
Client.Log("Moved to new sim " + newSimulator.ToString(), Helpers.LogLevel.Info);
}
else
{
teleportMessage = "Failed to connect to the new sim after a teleport";
teleportStat = TeleportStatus.Failed;
// We're going to get disconnected now
Client.Log(teleportMessage, Helpers.LogLevel.Error);
}
}
else if (packet.Type == PacketType.TeleportCancel)
{
//TeleportCancelPacket cancel = (TeleportCancelPacket)packet;
teleportMessage = "Cancelled";
teleportStat = TeleportStatus.Cancelled;
finished = true;
Client.DebugLog("TeleportCancel received from " + simulator.ToString());
}
else if (packet.Type == PacketType.TeleportLocal)
{
TeleportLocalPacket local = (TeleportLocalPacket)packet;
teleportMessage = "Teleport finished";
flags = (TeleportFlags)local.Info.TeleportFlags;
teleportStat = TeleportStatus.Finished;
relativePosition = local.Info.Position;
Movement.Camera.LookDirection(local.Info.LookAt);
// This field is apparently not used for anything
//local.Info.LocationID;
finished = true;
Client.DebugLog("TeleportLocal received, Flags: " + flags.ToString());
}
if (OnTeleport != null)
//.........這裏部分代碼省略.........
示例4: ParcelOverlayHandler
private void ParcelOverlayHandler(Packet packet, Simulator simulator)
{
ParcelOverlayPacket overlay = (ParcelOverlayPacket)packet;
if (overlay.ParcelData.SequenceID >= 0 && overlay.ParcelData.SequenceID <= 3)
{
Buffer.BlockCopy(overlay.ParcelData.Data, 0, simulator.ParcelOverlay,
overlay.ParcelData.SequenceID * 1024, 1024);
simulator.ParcelOverlaysReceived++;
if (simulator.ParcelOverlaysReceived > 3)
{
// TODO: ParcelOverlaysReceived should become internal, and reset to zero every
// time it hits four. Also need a callback here
}
}
else
{
Client.Log("Parcel overlay with sequence ID of " + overlay.ParcelData.SequenceID +
" received from " + simulator.ToString(), Helpers.LogLevel.Warning);
}
}
示例5: TeleportHandler
/// <summary>
/// Handler for teleport Requests
/// </summary>
/// <param name="packet">Incoming TeleportHandler packet</param>
/// <param name="simulator">Simulator sending teleport information</param>
private void TeleportHandler(Packet packet, Simulator simulator)
{
if (packet.Type == PacketType.TeleportStart)
{
Client.DebugLog("TeleportStart received from " + simulator.ToString());
teleportMessage = "Teleport started";
TeleportStat = TeleportStatus.Start;
if (OnBeginTeleport != null)
{
OnBeginTeleport(Client.Network.CurrentSim, teleportMessage, TeleportStat);
}
}
else if (packet.Type == PacketType.TeleportProgress)
{
Client.DebugLog("TeleportProgress received from " + simulator.ToString());
teleportMessage = Helpers.FieldToString(((TeleportProgressPacket)packet).Info.Message);
TeleportStat = TeleportStatus.Progress;
if (OnBeginTeleport != null)
{
OnBeginTeleport(Client.Network.CurrentSim, teleportMessage, TeleportStat);
}
}
else if (packet.Type == PacketType.TeleportFailed)
{
Client.DebugLog("TeleportFailed received from " + simulator.ToString());
teleportMessage = Helpers.FieldToString(((TeleportFailedPacket)packet).Info.Reason);
TeleportStat = TeleportStatus.Failed;
if (OnBeginTeleport != null)
{
OnBeginTeleport(Client.Network.CurrentSim, teleportMessage, TeleportStat);
}
OnBeginTeleport = null;
}
else if (packet.Type == PacketType.TeleportFinish)
{
Client.DebugLog("TeleportFinish received from " + simulator.ToString());
TeleportFinishPacket finish = (TeleportFinishPacket)packet;
Simulator previousSim = Client.Network.CurrentSim;
// Connect to the new sim
String seedcaps = Encoding.UTF8.GetString(finish.Info.SeedCapability).Replace("\x00","");
Simulator sim = Client.Network.Connect(new IPAddress((long)finish.Info.SimIP), finish.Info.SimPort,
simulator.CircuitCode, true, seedcaps);
if (sim != null)
{
teleportMessage = "Teleport finished";
TeleportStat = TeleportStatus.Finished;
// Move the avatar in to the new sim
CompleteAgentMovementPacket move = new CompleteAgentMovementPacket();
move.AgentData.AgentID = Client.Network.AgentID;
move.AgentData.SessionID = Client.Network.SessionID;
move.AgentData.CircuitCode = simulator.CircuitCode;
Client.Network.SendPacket(move, sim);
// Disconnect from the previous sim
Client.Network.DisconnectSim(previousSim);
Client.Log("Moved to new sim " + sim.ToString(), Helpers.LogLevel.Info);
if (OnBeginTeleport != null)
{
OnBeginTeleport(sim, teleportMessage, TeleportStat);
}
else
{
// Sleep a little while so we can collect parcel information
// NOTE: This doesn't belong in libsecondlife
// System.Threading.Thread.Sleep(1000);
}
}
else
{
teleportMessage = "Failed to connect to the new sim after a teleport";
TeleportStat = TeleportStatus.Failed;
// FIXME: Set the previous CurrentSim to the current simulator again
Client.Log(teleportMessage, Helpers.LogLevel.Warning);
if (OnBeginTeleport != null)
{
OnBeginTeleport(Client.Network.CurrentSim, teleportMessage, TeleportStat);
}
}
//.........這裏部分代碼省略.........