* 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)
This commit is contained in:
lbsa71
2007-06-09 21:45:58 +00:00
parent 42448ad129
commit 4224b695ac
83 changed files with 1371 additions and 974 deletions

View File

@@ -0,0 +1,101 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types;
using OpenSim.Framework.Console;
using libsecondlife;
namespace SimpleApp
{
public class MyWorld : IWorld
{
private RegionInfo m_regionInfo;
public MyWorld(RegionInfo regionInfo)
{
m_regionInfo = regionInfo;
}
private void SendLayerData(IClientAPI remoteClient)
{
float[] map = new float[65536];
for (int i = 0; i < 65536; i++)
{
int x = i % 256;
int y = i / 256;
map[i] = (float)(x + y / 2);
}
remoteClient.SendLayerData(map);
}
#region IWorld Members
void IWorld.AddNewAvatar(IClientAPI client, LLUUID agentID, bool child)
{
LLVector3 pos = new LLVector3(128, 128, 128);
client.OnRegionHandShakeReply += SendLayerData;
client.OnChatFromViewer +=
delegate(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
{
// Echo it (so you know what you typed)
client.SendChatMessage(message, type, fromPos, fromName, fromAgentID);
client.SendChatMessage("Ready.", 1, pos, "System", LLUUID.Zero );
};
client.OnRequestWearables += SendWearables;
client.OnCompleteMovementToRegion += delegate()
{
client.MoveAgentIntoRegion(m_regionInfo);
};
client.OnCompleteMovementToRegion += delegate()
{
client.SendAvatarData(m_regionInfo, client.FirstName,
client.LastName, client.AgentId, 0,
pos);
client.SendChatMessage("Welcome to My World.", 1, pos, "System", LLUUID.Zero );
};
client.SendRegionHandshake(m_regionInfo);
}
private void SendWearables( IClientAPI client )
{
client.SendWearables( AvatarWearable.DefaultWearables );
}
void IWorld.RemoveAvatar(LLUUID agentID)
{
}
RegionInfo IWorld.RegionInfo
{
get { return m_regionInfo; }
}
object IWorld.SyncRoot
{
get { return this; }
}
private uint m_nextLocalId = 1;
uint IWorld.NextLocalId
{
get { return m_nextLocalId++; }
}
#endregion
}
}

View File

@@ -0,0 +1,110 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenSim;
using OpenSim.Servers;
using OpenSim.GridInterfaces.Local;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types;
using OpenSim.UserServer;
using OpenSim.Framework.Console;
using OpenSim.world;
using OpenSim.Physics.Manager;
using OpenSim.Assets;
using libsecondlife;
namespace SimpleApp
{
class Program : IAssetReceiver, conscmd_callback
{
private ConsoleBase m_console;
private void Run()
{
m_console = new ConsoleBase(null, "SimpleApp", this, false);
MainConsole.Instance = m_console;
CheckSumServer checksumServer = new CheckSumServer(12036);
checksumServer.ServerListener();
string simAddr = "127.0.0.1";
int simPort = 9000;
LoginServer loginServer = new LoginServer( simAddr, simPort, 0, 0, false );
loginServer.Startup();
AuthenticateSessionsLocal localSessions = new AuthenticateSessionsLocal();
loginServer.SetSessionHandler(localSessions.AddNewSessionHandler );
InventoryCache inventoryCache = new InventoryCache();
LocalAssetServer assetServer = new LocalAssetServer();
assetServer.SetServerInfo("http://127.0.0.1:8003/", "");
assetServer.SetReceiver(this);
AssetCache assetCache = new AssetCache(assetServer);
UDPServer udpServer = new UDPServer(simPort, assetCache, inventoryCache, m_console, localSessions );
PacketServer packetServer = new PacketServer( udpServer, (uint) simPort );
udpServer.ServerListener();
ClientView.TerrainManager = new TerrainManager(new SecondLife());
RegionInfo regionInfo = new RegionInfo();
udpServer.LocalWorld = new MyWorld( regionInfo );
// World world = new World(udpServer.PacketServer.ClientAPIs, regionInfo);
// PhysicsScene physicsScene = new NullPhysicsScene();
// world.PhysicsScene = physicsScene;
// udpServer.LocalWorld = world;
BaseHttpServer httpServer = new BaseHttpServer( simPort );
httpServer.AddXmlRPCHandler( "login_to_simulator", loginServer.XmlRpcLoginMethod );
httpServer.Start();
m_console.WriteLine( LogPriority.NORMAL, "Press enter to quit.");
m_console.ReadLine();
}
private void AddNewSessionHandler(Login loginData)
{
m_console.WriteLine( LogPriority.NORMAL, "Recieved Login from [{0}] [{1}]", loginData.First, loginData.Last );
}
#region IAssetReceiver Members
public void AssetReceived( AssetBase asset, bool IsTexture)
{
throw new Exception("The method or operation is not implemented.");
}
public void AssetNotFound( AssetBase asset)
{
throw new Exception("The method or operation is not implemented.");
}
#endregion
#region conscmd_callback Members
public void RunCmd(string cmd, string[] cmdparams)
{
throw new Exception("The method or operation is not implemented.");
}
public void Show(string ShowWhat)
{
throw new Exception("The method or operation is not implemented.");
}
#endregion
static void Main(string[] args)
{
Program app = new Program();
app.Run();
}
}
}

View File

@@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SimpleApp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Playahead AB")]
[assembly: AssemblyProduct("SimpleApp")]
[assembly: AssemblyCopyright("Copyright © Playahead AB 2007")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a5cfa45f-5acf-4b2e-9c50-1dd1fd7608ee")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,86 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{AD062D99-DD53-4D37-A4B8-2AF635377AEB}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SimpleApp</RootNamespace>
<AssemblyName>SimpleApp</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="libsecondlife, Version=0.9.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\bin\libsecondlife.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="MyWorld.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
<Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
<Name>OpenSim.Framework.Console</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj">
<Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
<Name>OpenSim.Framework</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Common\OpenSim.Servers\OpenSim.Servers.csproj">
<Project>{8BB20F0A-0000-0000-0000-000000000000}</Project>
<Name>OpenSim.Servers</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Common\XmlRpcCS\XMLRPC.csproj">
<Project>{8E81D43C-0000-0000-0000-000000000000}</Project>
<Name>XMLRPC</Name>
</ProjectReference>
<ProjectReference Include="..\..\OpenSim.GridInterfaces\Local\OpenSim.GridInterfaces.Local.csproj">
<Project>{546099CD-0000-0000-0000-000000000000}</Project>
<Name>OpenSim.GridInterfaces.Local</Name>
</ProjectReference>
<ProjectReference Include="..\..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj">
<Project>{8BE16150-0000-0000-0000-000000000000}</Project>
<Name>OpenSim.Physics.Manager</Name>
</ProjectReference>
<ProjectReference Include="..\..\OpenSim.RegionServer\OpenSim.RegionServer.csproj">
<Project>{632E1BFD-0000-0000-0000-000000000000}</Project>
<Name>OpenSim.RegionServer</Name>
</ProjectReference>
<ProjectReference Include="..\..\OpenSim.World\OpenSim.World.csproj">
<Project>{642A14A8-0000-0000-0000-000000000000}</Project>
<Name>OpenSim.World</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>