Files
opensim/OpenSim/Examples/SimpleApp2/MyClientView.cs
lbsa71 4224b695ac * LogFile now defaults to "{apptype}.log"
* cleaned away suo and user files.
* added handy string chat variety to the API
* Moved LockPhysicsEngine on World to SyncRoot on IWorld
* Introduced NextLocalId instead of World fuggliness.
* Transformed GetRegionInfo to Property on IWorld for great justice
* Extracted default wearables (good to have)
* Deleted unused BaseServer
* Used IWorld instead of World wherever possible
* The client constructor's not getting unused port any longer.
* Extracted ClientView factoring so PacketServer can be tweaked.
* Added SendLayerData to World
* Made WorldBase abstract and cleaned it up a bit
* added OpenGrid.Framework.Communications.dll.build and OpenSim.World.dll.build to svn
* Added code for two examples (but not in prebuild yet)
2007-06-09 21:45:58 +00:00

70 lines
2.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using OpenSim;
using libsecondlife;
using OpenSim.Framework.Interfaces;
using System.Net;
using libsecondlife.Packets;
using OpenSim.Assets;
using OpenSim.Framework.Types;
using OpenSim.Framework;
namespace SimpleApp2
{
public class MyClientView : ClientView
{
private float[] m_map;
private Dictionary<uint, IClientAPI> m_clientAPIs;
public MyClientView(float[] map, Dictionary<uint, IClientAPI> clientAPIs, EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, ClientView> clientThreads, IWorld world, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AuthenticateSessionsBase authenSessions)
: base(remoteEP, initialcirpack, clientThreads, world, assetCache, packServer, inventoryCache, authenSessions)
{
m_map = map;
m_clientAPIs = clientAPIs;
OnRegionHandShakeReply += RegionHandShakeReplyHandler;
OnChatFromViewer += ChatHandler;
OnRequestWearables += RequestWearablesHandler;
OnCompleteMovementToRegion += CompleteMovementToRegionHandler;
}
private void ChatHandler(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
{
// Echo it (so you know what you typed)
SendChatMessage(message, type, fromPos, fromName, fromAgentID);
SendChatMessage("Ready.", 1, fromPos, "System", LLUUID.Zero);
}
private void CompleteMovementToRegionHandler()
{
LLVector3 pos = new LLVector3(128, 128, 128);
MoveAgentIntoRegion(m_world.RegionInfo);
SendAvatarData( m_world.RegionInfo, FirstName,
LastName, AgentId, 0,
pos);
SendChatMessage("Welcome to My World.", 1, pos, "System", LLUUID.Zero);
// OpenSim.world.Primitive prim = new OpenSim.world.Primitive( m_clientAPIs, m_world.RegionInfo.RegionHandle, m_world, AgentId );
// SendNewPrim( prim );
}
private void RegionHandShakeReplyHandler(IClientAPI client)
{
client.SendLayerData(m_map);
}
private void RequestWearablesHandler(IClientAPI client)
{
SendWearables(AvatarWearable.DefaultWearables);
}
}
}