diff options
author | lbsa71 | 2007-06-09 21:45:58 +0000 |
---|---|---|
committer | lbsa71 | 2007-06-09 21:45:58 +0000 |
commit | 4224b695acc2e1ad0199dc0ad7f560494182ed54 (patch) | |
tree | 8fae1cf25a058bc4e378ef2b6ce264d7f9f0b910 /OpenSim/Examples | |
parent | *Fixed casting mishap in last commit - client now starts up without crashing (diff) | |
download | opensim-SC_OLD-4224b695acc2e1ad0199dc0ad7f560494182ed54.zip opensim-SC_OLD-4224b695acc2e1ad0199dc0ad7f560494182ed54.tar.gz opensim-SC_OLD-4224b695acc2e1ad0199dc0ad7f560494182ed54.tar.bz2 opensim-SC_OLD-4224b695acc2e1ad0199dc0ad7f560494182ed54.tar.xz |
* 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)
Diffstat (limited to 'OpenSim/Examples')
-rw-r--r-- | OpenSim/Examples/SimpleApp/MyWorld.cs | 101 | ||||
-rw-r--r-- | OpenSim/Examples/SimpleApp/Program.cs | 110 | ||||
-rw-r--r-- | OpenSim/Examples/SimpleApp/Properties/AssemblyInfo.cs | 33 | ||||
-rw-r--r-- | OpenSim/Examples/SimpleApp/SimpleApp.csproj | 86 | ||||
-rw-r--r-- | OpenSim/Examples/SimpleApp2/MyClientView.cs | 69 | ||||
-rw-r--r-- | OpenSim/Examples/SimpleApp2/MyPacketServer.cs | 30 | ||||
-rw-r--r-- | OpenSim/Examples/SimpleApp2/Program.cs | 160 | ||||
-rw-r--r-- | OpenSim/Examples/SimpleApp2/Properties/AssemblyInfo.cs | 33 | ||||
-rw-r--r-- | OpenSim/Examples/SimpleApp2/SimpleApp2.csproj | 87 |
9 files changed, 709 insertions, 0 deletions
diff --git a/OpenSim/Examples/SimpleApp/MyWorld.cs b/OpenSim/Examples/SimpleApp/MyWorld.cs new file mode 100644 index 0000000..27775f1 --- /dev/null +++ b/OpenSim/Examples/SimpleApp/MyWorld.cs | |||
@@ -0,0 +1,101 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim.Framework.Interfaces; | ||
5 | using OpenSim.Framework.Types; | ||
6 | using OpenSim.Framework.Console; | ||
7 | using libsecondlife; | ||
8 | |||
9 | namespace SimpleApp | ||
10 | { | ||
11 | public class MyWorld : IWorld | ||
12 | { | ||
13 | private RegionInfo m_regionInfo; | ||
14 | |||
15 | public MyWorld(RegionInfo regionInfo) | ||
16 | { | ||
17 | m_regionInfo = regionInfo; | ||
18 | } | ||
19 | |||
20 | private void SendLayerData(IClientAPI remoteClient) | ||
21 | { | ||
22 | float[] map = new float[65536]; | ||
23 | |||
24 | for (int i = 0; i < 65536; i++) | ||
25 | { | ||
26 | int x = i % 256; | ||
27 | int y = i / 256; | ||
28 | |||
29 | map[i] = (float)(x + y / 2); | ||
30 | } | ||
31 | |||
32 | remoteClient.SendLayerData(map); | ||
33 | } | ||
34 | |||
35 | #region IWorld Members | ||
36 | |||
37 | void IWorld.AddNewAvatar(IClientAPI client, LLUUID agentID, bool child) | ||
38 | { | ||
39 | LLVector3 pos = new LLVector3(128, 128, 128); | ||
40 | |||
41 | client.OnRegionHandShakeReply += SendLayerData; | ||
42 | client.OnChatFromViewer += | ||
43 | delegate(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) | ||
44 | { | ||
45 | // Echo it (so you know what you typed) | ||
46 | client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); | ||
47 | client.SendChatMessage("Ready.", 1, pos, "System", LLUUID.Zero ); | ||
48 | }; | ||
49 | |||
50 | client.OnRequestWearables += SendWearables; | ||
51 | |||
52 | client.OnCompleteMovementToRegion += delegate() | ||
53 | { | ||
54 | client.MoveAgentIntoRegion(m_regionInfo); | ||
55 | }; | ||
56 | |||
57 | client.OnCompleteMovementToRegion += delegate() | ||
58 | { | ||
59 | client.SendAvatarData(m_regionInfo, client.FirstName, | ||
60 | client.LastName, client.AgentId, 0, | ||
61 | pos); | ||
62 | |||
63 | client.SendChatMessage("Welcome to My World.", 1, pos, "System", LLUUID.Zero ); | ||
64 | }; | ||
65 | |||
66 | client.SendRegionHandshake(m_regionInfo); | ||
67 | |||
68 | } | ||
69 | |||
70 | private void SendWearables( IClientAPI client ) | ||
71 | { | ||
72 | client.SendWearables( AvatarWearable.DefaultWearables ); | ||
73 | } | ||
74 | |||
75 | void IWorld.RemoveAvatar(LLUUID agentID) | ||
76 | { | ||
77 | |||
78 | } | ||
79 | |||
80 | RegionInfo IWorld.RegionInfo | ||
81 | { | ||
82 | get { return m_regionInfo; } | ||
83 | } | ||
84 | |||
85 | object IWorld.SyncRoot | ||
86 | { | ||
87 | get { return this; } | ||
88 | } | ||
89 | |||
90 | private uint m_nextLocalId = 1; | ||
91 | |||
92 | uint IWorld.NextLocalId | ||
93 | { | ||
94 | get { return m_nextLocalId++; } | ||
95 | } | ||
96 | |||
97 | #endregion | ||
98 | |||
99 | |||
100 | } | ||
101 | } | ||
diff --git a/OpenSim/Examples/SimpleApp/Program.cs b/OpenSim/Examples/SimpleApp/Program.cs new file mode 100644 index 0000000..e44bdba --- /dev/null +++ b/OpenSim/Examples/SimpleApp/Program.cs | |||
@@ -0,0 +1,110 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim; | ||
5 | using OpenSim.Servers; | ||
6 | using OpenSim.GridInterfaces.Local; | ||
7 | using OpenSim.Framework.Interfaces; | ||
8 | using OpenSim.Framework.Types; | ||
9 | using OpenSim.UserServer; | ||
10 | using OpenSim.Framework.Console; | ||
11 | using OpenSim.world; | ||
12 | using OpenSim.Physics.Manager; | ||
13 | using OpenSim.Assets; | ||
14 | using libsecondlife; | ||
15 | |||
16 | namespace SimpleApp | ||
17 | { | ||
18 | class Program : IAssetReceiver, conscmd_callback | ||
19 | { | ||
20 | private ConsoleBase m_console; | ||
21 | |||
22 | private void Run() | ||
23 | { | ||
24 | m_console = new ConsoleBase(null, "SimpleApp", this, false); | ||
25 | MainConsole.Instance = m_console; | ||
26 | |||
27 | CheckSumServer checksumServer = new CheckSumServer(12036); | ||
28 | checksumServer.ServerListener(); | ||
29 | |||
30 | string simAddr = "127.0.0.1"; | ||
31 | int simPort = 9000; | ||
32 | |||
33 | LoginServer loginServer = new LoginServer( simAddr, simPort, 0, 0, false ); | ||
34 | loginServer.Startup(); | ||
35 | |||
36 | AuthenticateSessionsLocal localSessions = new AuthenticateSessionsLocal(); | ||
37 | loginServer.SetSessionHandler(localSessions.AddNewSessionHandler ); | ||
38 | |||
39 | InventoryCache inventoryCache = new InventoryCache(); | ||
40 | |||
41 | LocalAssetServer assetServer = new LocalAssetServer(); | ||
42 | assetServer.SetServerInfo("http://127.0.0.1:8003/", ""); | ||
43 | assetServer.SetReceiver(this); | ||
44 | |||
45 | AssetCache assetCache = new AssetCache(assetServer); | ||
46 | |||
47 | UDPServer udpServer = new UDPServer(simPort, assetCache, inventoryCache, m_console, localSessions ); | ||
48 | PacketServer packetServer = new PacketServer( udpServer, (uint) simPort ); | ||
49 | udpServer.ServerListener(); | ||
50 | |||
51 | ClientView.TerrainManager = new TerrainManager(new SecondLife()); | ||
52 | |||
53 | RegionInfo regionInfo = new RegionInfo(); | ||
54 | |||
55 | udpServer.LocalWorld = new MyWorld( regionInfo ); | ||
56 | |||
57 | // World world = new World(udpServer.PacketServer.ClientAPIs, regionInfo); | ||
58 | // PhysicsScene physicsScene = new NullPhysicsScene(); | ||
59 | // world.PhysicsScene = physicsScene; | ||
60 | // udpServer.LocalWorld = world; | ||
61 | |||
62 | BaseHttpServer httpServer = new BaseHttpServer( simPort ); | ||
63 | httpServer.AddXmlRPCHandler( "login_to_simulator", loginServer.XmlRpcLoginMethod ); | ||
64 | httpServer.Start(); | ||
65 | |||
66 | m_console.WriteLine( LogPriority.NORMAL, "Press enter to quit."); | ||
67 | m_console.ReadLine(); | ||
68 | } | ||
69 | |||
70 | private void AddNewSessionHandler(Login loginData) | ||
71 | { | ||
72 | m_console.WriteLine( LogPriority.NORMAL, "Recieved Login from [{0}] [{1}]", loginData.First, loginData.Last ); | ||
73 | } | ||
74 | |||
75 | #region IAssetReceiver Members | ||
76 | |||
77 | public void AssetReceived( AssetBase asset, bool IsTexture) | ||
78 | { | ||
79 | throw new Exception("The method or operation is not implemented."); | ||
80 | } | ||
81 | |||
82 | public void AssetNotFound( AssetBase asset) | ||
83 | { | ||
84 | throw new Exception("The method or operation is not implemented."); | ||
85 | } | ||
86 | |||
87 | #endregion | ||
88 | |||
89 | #region conscmd_callback Members | ||
90 | |||
91 | public void RunCmd(string cmd, string[] cmdparams) | ||
92 | { | ||
93 | throw new Exception("The method or operation is not implemented."); | ||
94 | } | ||
95 | |||
96 | public void Show(string ShowWhat) | ||
97 | { | ||
98 | throw new Exception("The method or operation is not implemented."); | ||
99 | } | ||
100 | |||
101 | #endregion | ||
102 | |||
103 | static void Main(string[] args) | ||
104 | { | ||
105 | Program app = new Program(); | ||
106 | |||
107 | app.Run(); | ||
108 | } | ||
109 | } | ||
110 | } | ||
diff --git a/OpenSim/Examples/SimpleApp/Properties/AssemblyInfo.cs b/OpenSim/Examples/SimpleApp/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..0f9bf0f --- /dev/null +++ b/OpenSim/Examples/SimpleApp/Properties/AssemblyInfo.cs | |||
@@ -0,0 +1,33 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // General Information about an assembly is controlled through the following | ||
6 | // set of attributes. Change these attribute values to modify the information | ||
7 | // associated with an assembly. | ||
8 | [assembly: AssemblyTitle("SimpleApp")] | ||
9 | [assembly: AssemblyDescription("")] | ||
10 | [assembly: AssemblyConfiguration("")] | ||
11 | [assembly: AssemblyCompany("Playahead AB")] | ||
12 | [assembly: AssemblyProduct("SimpleApp")] | ||
13 | [assembly: AssemblyCopyright("Copyright © Playahead AB 2007")] | ||
14 | [assembly: AssemblyTrademark("")] | ||
15 | [assembly: AssemblyCulture("")] | ||
16 | |||
17 | // Setting ComVisible to false makes the types in this assembly not visible | ||
18 | // to COM components. If you need to access a type in this assembly from | ||
19 | // COM, set the ComVisible attribute to true on that type. | ||
20 | [assembly: ComVisible(false)] | ||
21 | |||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
23 | [assembly: Guid("a5cfa45f-5acf-4b2e-9c50-1dd1fd7608ee")] | ||
24 | |||
25 | // Version information for an assembly consists of the following four values: | ||
26 | // | ||
27 | // Major Version | ||
28 | // Minor Version | ||
29 | // Build Number | ||
30 | // Revision | ||
31 | // | ||
32 | [assembly: AssemblyVersion("1.0.0.0")] | ||
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | ||
diff --git a/OpenSim/Examples/SimpleApp/SimpleApp.csproj b/OpenSim/Examples/SimpleApp/SimpleApp.csproj new file mode 100644 index 0000000..51e14de --- /dev/null +++ b/OpenSim/Examples/SimpleApp/SimpleApp.csproj | |||
@@ -0,0 +1,86 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
4 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
5 | <ProductVersion>8.0.50727</ProductVersion> | ||
6 | <SchemaVersion>2.0</SchemaVersion> | ||
7 | <ProjectGuid>{AD062D99-DD53-4D37-A4B8-2AF635377AEB}</ProjectGuid> | ||
8 | <OutputType>Exe</OutputType> | ||
9 | <AppDesignerFolder>Properties</AppDesignerFolder> | ||
10 | <RootNamespace>SimpleApp</RootNamespace> | ||
11 | <AssemblyName>SimpleApp</AssemblyName> | ||
12 | </PropertyGroup> | ||
13 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
14 | <DebugSymbols>true</DebugSymbols> | ||
15 | <DebugType>full</DebugType> | ||
16 | <Optimize>false</Optimize> | ||
17 | <OutputPath>bin\Debug\</OutputPath> | ||
18 | <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
19 | <ErrorReport>prompt</ErrorReport> | ||
20 | <WarningLevel>4</WarningLevel> | ||
21 | </PropertyGroup> | ||
22 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
23 | <DebugType>pdbonly</DebugType> | ||
24 | <Optimize>true</Optimize> | ||
25 | <OutputPath>bin\Release\</OutputPath> | ||
26 | <DefineConstants>TRACE</DefineConstants> | ||
27 | <ErrorReport>prompt</ErrorReport> | ||
28 | <WarningLevel>4</WarningLevel> | ||
29 | </PropertyGroup> | ||
30 | <ItemGroup> | ||
31 | <Reference Include="libsecondlife, Version=0.9.0.0, Culture=neutral, processorArchitecture=MSIL"> | ||
32 | <SpecificVersion>False</SpecificVersion> | ||
33 | <HintPath>..\..\..\bin\libsecondlife.dll</HintPath> | ||
34 | </Reference> | ||
35 | <Reference Include="System" /> | ||
36 | <Reference Include="System.Data" /> | ||
37 | <Reference Include="System.Xml" /> | ||
38 | </ItemGroup> | ||
39 | <ItemGroup> | ||
40 | <Compile Include="MyWorld.cs" /> | ||
41 | <Compile Include="Program.cs" /> | ||
42 | <Compile Include="Properties\AssemblyInfo.cs" /> | ||
43 | </ItemGroup> | ||
44 | <ItemGroup> | ||
45 | <ProjectReference Include="..\..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> | ||
46 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> | ||
47 | <Name>OpenSim.Framework.Console</Name> | ||
48 | </ProjectReference> | ||
49 | <ProjectReference Include="..\..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj"> | ||
50 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> | ||
51 | <Name>OpenSim.Framework</Name> | ||
52 | </ProjectReference> | ||
53 | <ProjectReference Include="..\..\..\Common\OpenSim.Servers\OpenSim.Servers.csproj"> | ||
54 | <Project>{8BB20F0A-0000-0000-0000-000000000000}</Project> | ||
55 | <Name>OpenSim.Servers</Name> | ||
56 | </ProjectReference> | ||
57 | <ProjectReference Include="..\..\..\Common\XmlRpcCS\XMLRPC.csproj"> | ||
58 | <Project>{8E81D43C-0000-0000-0000-000000000000}</Project> | ||
59 | <Name>XMLRPC</Name> | ||
60 | </ProjectReference> | ||
61 | <ProjectReference Include="..\..\OpenSim.GridInterfaces\Local\OpenSim.GridInterfaces.Local.csproj"> | ||
62 | <Project>{546099CD-0000-0000-0000-000000000000}</Project> | ||
63 | <Name>OpenSim.GridInterfaces.Local</Name> | ||
64 | </ProjectReference> | ||
65 | <ProjectReference Include="..\..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj"> | ||
66 | <Project>{8BE16150-0000-0000-0000-000000000000}</Project> | ||
67 | <Name>OpenSim.Physics.Manager</Name> | ||
68 | </ProjectReference> | ||
69 | <ProjectReference Include="..\..\OpenSim.RegionServer\OpenSim.RegionServer.csproj"> | ||
70 | <Project>{632E1BFD-0000-0000-0000-000000000000}</Project> | ||
71 | <Name>OpenSim.RegionServer</Name> | ||
72 | </ProjectReference> | ||
73 | <ProjectReference Include="..\..\OpenSim.World\OpenSim.World.csproj"> | ||
74 | <Project>{642A14A8-0000-0000-0000-000000000000}</Project> | ||
75 | <Name>OpenSim.World</Name> | ||
76 | </ProjectReference> | ||
77 | </ItemGroup> | ||
78 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | ||
79 | <!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
80 | Other similar extension points exist, see Microsoft.Common.targets. | ||
81 | <Target Name="BeforeBuild"> | ||
82 | </Target> | ||
83 | <Target Name="AfterBuild"> | ||
84 | </Target> | ||
85 | --> | ||
86 | </Project> \ No newline at end of file | ||
diff --git a/OpenSim/Examples/SimpleApp2/MyClientView.cs b/OpenSim/Examples/SimpleApp2/MyClientView.cs new file mode 100644 index 0000000..dd8869c --- /dev/null +++ b/OpenSim/Examples/SimpleApp2/MyClientView.cs | |||
@@ -0,0 +1,69 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim; | ||
5 | using libsecondlife; | ||
6 | using OpenSim.Framework.Interfaces; | ||
7 | using System.Net; | ||
8 | using libsecondlife.Packets; | ||
9 | using OpenSim.Assets; | ||
10 | using OpenSim.Framework.Types; | ||
11 | using OpenSim.Framework; | ||
12 | |||
13 | namespace SimpleApp2 | ||
14 | { | ||
15 | public class MyClientView : ClientView | ||
16 | { | ||
17 | private float[] m_map; | ||
18 | private Dictionary<uint, IClientAPI> m_clientAPIs; | ||
19 | |||
20 | 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) | ||
21 | : base(remoteEP, initialcirpack, clientThreads, world, assetCache, packServer, inventoryCache, authenSessions) | ||
22 | { | ||
23 | m_map = map; | ||
24 | m_clientAPIs = clientAPIs; | ||
25 | |||
26 | OnRegionHandShakeReply += RegionHandShakeReplyHandler; | ||
27 | OnChatFromViewer += ChatHandler; | ||
28 | OnRequestWearables += RequestWearablesHandler; | ||
29 | OnCompleteMovementToRegion += CompleteMovementToRegionHandler; | ||
30 | } | ||
31 | |||
32 | private void ChatHandler(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) | ||
33 | { | ||
34 | // Echo it (so you know what you typed) | ||
35 | SendChatMessage(message, type, fromPos, fromName, fromAgentID); | ||
36 | SendChatMessage("Ready.", 1, fromPos, "System", LLUUID.Zero); | ||
37 | } | ||
38 | |||
39 | private void CompleteMovementToRegionHandler() | ||
40 | { | ||
41 | LLVector3 pos = new LLVector3(128, 128, 128); | ||
42 | |||
43 | MoveAgentIntoRegion(m_world.RegionInfo); | ||
44 | |||
45 | SendAvatarData( m_world.RegionInfo, FirstName, | ||
46 | LastName, AgentId, 0, | ||
47 | pos); | ||
48 | |||
49 | SendChatMessage("Welcome to My World.", 1, pos, "System", LLUUID.Zero); | ||
50 | |||
51 | |||
52 | |||
53 | // OpenSim.world.Primitive prim = new OpenSim.world.Primitive( m_clientAPIs, m_world.RegionInfo.RegionHandle, m_world, AgentId ); | ||
54 | |||
55 | // SendNewPrim( prim ); | ||
56 | |||
57 | } | ||
58 | |||
59 | private void RegionHandShakeReplyHandler(IClientAPI client) | ||
60 | { | ||
61 | client.SendLayerData(m_map); | ||
62 | } | ||
63 | |||
64 | private void RequestWearablesHandler(IClientAPI client) | ||
65 | { | ||
66 | SendWearables(AvatarWearable.DefaultWearables); | ||
67 | } | ||
68 | } | ||
69 | } | ||
diff --git a/OpenSim/Examples/SimpleApp2/MyPacketServer.cs b/OpenSim/Examples/SimpleApp2/MyPacketServer.cs new file mode 100644 index 0000000..9c21016 --- /dev/null +++ b/OpenSim/Examples/SimpleApp2/MyPacketServer.cs | |||
@@ -0,0 +1,30 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim; | ||
5 | using OpenSim.Assets; | ||
6 | using System.Net; | ||
7 | using libsecondlife.Packets; | ||
8 | using OpenSim.Framework.Interfaces; | ||
9 | using OpenSim.Framework; | ||
10 | |||
11 | namespace SimpleApp2 | ||
12 | { | ||
13 | public class MyPacketServer : PacketServer | ||
14 | { | ||
15 | private float[] m_map; | ||
16 | |||
17 | public MyPacketServer(float[] map, OpenSimNetworkHandler networkHandler, uint port ) : base( networkHandler, port ) | ||
18 | { | ||
19 | m_map = map; | ||
20 | } | ||
21 | |||
22 | protected override ClientView CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, ClientView> clientThreads, IWorld world, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AuthenticateSessionsBase authenSessions) | ||
23 | { | ||
24 | // (EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, ClientView> clientThreads, IWorld world, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AuthenticateSessionsBase authenSessions) | ||
25 | |||
26 | |||
27 | return new MyClientView(m_map, ClientAPIs, remoteEP, initialcirpack, clientThreads, world, assetCache, packServer, inventoryCache, authenSessions); | ||
28 | } | ||
29 | } | ||
30 | } | ||
diff --git a/OpenSim/Examples/SimpleApp2/Program.cs b/OpenSim/Examples/SimpleApp2/Program.cs new file mode 100644 index 0000000..9b977f6 --- /dev/null +++ b/OpenSim/Examples/SimpleApp2/Program.cs | |||
@@ -0,0 +1,160 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim; | ||
5 | using OpenSim.Servers; | ||
6 | using OpenSim.GridInterfaces.Local; | ||
7 | using OpenSim.Framework.Interfaces; | ||
8 | using OpenSim.Framework.Types; | ||
9 | using OpenSim.UserServer; | ||
10 | using OpenSim.Framework.Console; | ||
11 | using OpenSim.world; | ||
12 | using OpenSim.Physics.Manager; | ||
13 | using OpenSim.Assets; | ||
14 | using libsecondlife; | ||
15 | |||
16 | namespace SimpleApp2 | ||
17 | { | ||
18 | class Program : IWorld, IAssetReceiver, conscmd_callback | ||
19 | { | ||
20 | private ConsoleBase m_console; | ||
21 | private RegionInfo m_regionInfo; | ||
22 | private float[] m_map; | ||
23 | |||
24 | private void Run() | ||
25 | { | ||
26 | m_console = new ConsoleBase(null, "SimpleApp", this, false); | ||
27 | MainConsole.Instance = m_console; | ||
28 | |||
29 | m_map = CreateMap(); | ||
30 | |||
31 | CheckSumServer checksumServer = new CheckSumServer(12036); | ||
32 | checksumServer.ServerListener(); | ||
33 | |||
34 | string simAddr = "127.0.0.1"; | ||
35 | int simPort = 9000; | ||
36 | |||
37 | LoginServer loginServer = new LoginServer(simAddr, simPort, 0, 0, false); | ||
38 | loginServer.Startup(); | ||
39 | |||
40 | AuthenticateSessionsLocal localSessions = new AuthenticateSessionsLocal(); | ||
41 | loginServer.SetSessionHandler(localSessions.AddNewSessionHandler); | ||
42 | |||
43 | InventoryCache inventoryCache = new InventoryCache(); | ||
44 | |||
45 | LocalAssetServer assetServer = new LocalAssetServer(); | ||
46 | assetServer.SetServerInfo("http://127.0.0.1:8003/", ""); | ||
47 | assetServer.SetReceiver(this); | ||
48 | |||
49 | AssetCache assetCache = new AssetCache(assetServer); | ||
50 | |||
51 | UDPServer udpServer = new UDPServer(simPort, assetCache, inventoryCache, m_console, localSessions); | ||
52 | PacketServer packetServer = new MyPacketServer(m_map, udpServer, (uint) simPort ); | ||
53 | udpServer.ServerListener(); | ||
54 | |||
55 | ClientView.TerrainManager = new TerrainManager(new SecondLife()); | ||
56 | |||
57 | m_regionInfo = new RegionInfo(); | ||
58 | |||
59 | udpServer.LocalWorld = this; | ||
60 | |||
61 | // World world = new World(udpServer.PacketServer.ClientAPIs, regionInfo); | ||
62 | // PhysicsScene physicsScene = new NullPhysicsScene(); | ||
63 | // world.PhysicsScene = physicsScene; | ||
64 | // udpServer.LocalWorld = world; | ||
65 | |||
66 | BaseHttpServer httpServer = new BaseHttpServer(simPort); | ||
67 | httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.XmlRpcLoginMethod); | ||
68 | httpServer.Start(); | ||
69 | |||
70 | m_console.WriteLine(LogPriority.NORMAL, "Press enter to quit."); | ||
71 | m_console.ReadLine(); | ||
72 | } | ||
73 | |||
74 | private float[] CreateMap() | ||
75 | { | ||
76 | float[] map = new float[65536]; | ||
77 | |||
78 | for (int i = 0; i < 65536; i++) | ||
79 | { | ||
80 | int x = i % 256; | ||
81 | int y = i / 256; | ||
82 | |||
83 | map[i] = (float)(x + y / 2); | ||
84 | } | ||
85 | |||
86 | return map; | ||
87 | } | ||
88 | |||
89 | private void AddNewSessionHandler(Login loginData) | ||
90 | { | ||
91 | m_console.WriteLine(LogPriority.NORMAL, "Recieved Login from [{0}] [{1}]", loginData.First, loginData.Last); | ||
92 | } | ||
93 | |||
94 | static void Main(string[] args) | ||
95 | { | ||
96 | Program app = new Program(); | ||
97 | |||
98 | app.Run(); | ||
99 | } | ||
100 | |||
101 | #region IWorld Members | ||
102 | |||
103 | void IWorld.AddNewAvatar(IClientAPI remoteClient, LLUUID agentID, bool child) | ||
104 | { | ||
105 | remoteClient.SendRegionHandshake(m_regionInfo); | ||
106 | } | ||
107 | |||
108 | void IWorld.RemoveAvatar(LLUUID agentID) | ||
109 | { | ||
110 | throw new Exception("The method or operation is not implemented."); | ||
111 | } | ||
112 | |||
113 | RegionInfo IWorld.RegionInfo | ||
114 | { | ||
115 | get { return m_regionInfo; } | ||
116 | } | ||
117 | |||
118 | object IWorld.SyncRoot | ||
119 | { | ||
120 | get { return this; } | ||
121 | } | ||
122 | |||
123 | private uint m_nextLocalId = 1; | ||
124 | |||
125 | uint IWorld.NextLocalId | ||
126 | { | ||
127 | get { return m_nextLocalId++; } | ||
128 | } | ||
129 | |||
130 | #endregion | ||
131 | |||
132 | #region IAssetReceiver Members | ||
133 | |||
134 | public void AssetReceived(AssetBase asset, bool IsTexture) | ||
135 | { | ||
136 | throw new Exception("The method or operation is not implemented."); | ||
137 | } | ||
138 | |||
139 | public void AssetNotFound(AssetBase asset) | ||
140 | { | ||
141 | throw new Exception("The method or operation is not implemented."); | ||
142 | } | ||
143 | |||
144 | #endregion | ||
145 | |||
146 | #region conscmd_callback Members | ||
147 | |||
148 | public void RunCmd(string cmd, string[] cmdparams) | ||
149 | { | ||
150 | throw new Exception("The method or operation is not implemented."); | ||
151 | } | ||
152 | |||
153 | public void Show(string ShowWhat) | ||
154 | { | ||
155 | throw new Exception("The method or operation is not implemented."); | ||
156 | } | ||
157 | |||
158 | #endregion | ||
159 | } | ||
160 | } | ||
diff --git a/OpenSim/Examples/SimpleApp2/Properties/AssemblyInfo.cs b/OpenSim/Examples/SimpleApp2/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..f7d6aae --- /dev/null +++ b/OpenSim/Examples/SimpleApp2/Properties/AssemblyInfo.cs | |||
@@ -0,0 +1,33 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // General Information about an assembly is controlled through the following | ||
6 | // set of attributes. Change these attribute values to modify the information | ||
7 | // associated with an assembly. | ||
8 | [assembly: AssemblyTitle("SimpleApp2")] | ||
9 | [assembly: AssemblyDescription("")] | ||
10 | [assembly: AssemblyConfiguration("")] | ||
11 | [assembly: AssemblyCompany("Playahead AB")] | ||
12 | [assembly: AssemblyProduct("SimpleApp2")] | ||
13 | [assembly: AssemblyCopyright("Copyright © Playahead AB 2007")] | ||
14 | [assembly: AssemblyTrademark("")] | ||
15 | [assembly: AssemblyCulture("")] | ||
16 | |||
17 | // Setting ComVisible to false makes the types in this assembly not visible | ||
18 | // to COM components. If you need to access a type in this assembly from | ||
19 | // COM, set the ComVisible attribute to true on that type. | ||
20 | [assembly: ComVisible(false)] | ||
21 | |||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
23 | [assembly: Guid("bdda0707-02b4-46ca-87ce-ab3c12558a4a")] | ||
24 | |||
25 | // Version information for an assembly consists of the following four values: | ||
26 | // | ||
27 | // Major Version | ||
28 | // Minor Version | ||
29 | // Build Number | ||
30 | // Revision | ||
31 | // | ||
32 | [assembly: AssemblyVersion("1.0.0.0")] | ||
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | ||
diff --git a/OpenSim/Examples/SimpleApp2/SimpleApp2.csproj b/OpenSim/Examples/SimpleApp2/SimpleApp2.csproj new file mode 100644 index 0000000..92664e3 --- /dev/null +++ b/OpenSim/Examples/SimpleApp2/SimpleApp2.csproj | |||
@@ -0,0 +1,87 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
4 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
5 | <ProductVersion>8.0.50727</ProductVersion> | ||
6 | <SchemaVersion>2.0</SchemaVersion> | ||
7 | <ProjectGuid>{C84B2171-D386-4377-B490-9C5A56674B9E}</ProjectGuid> | ||
8 | <OutputType>Exe</OutputType> | ||
9 | <AppDesignerFolder>Properties</AppDesignerFolder> | ||
10 | <RootNamespace>SimpleApp2</RootNamespace> | ||
11 | <AssemblyName>SimpleApp2</AssemblyName> | ||
12 | </PropertyGroup> | ||
13 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
14 | <DebugSymbols>true</DebugSymbols> | ||
15 | <DebugType>full</DebugType> | ||
16 | <Optimize>false</Optimize> | ||
17 | <OutputPath>bin\Debug\</OutputPath> | ||
18 | <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
19 | <ErrorReport>prompt</ErrorReport> | ||
20 | <WarningLevel>4</WarningLevel> | ||
21 | </PropertyGroup> | ||
22 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
23 | <DebugType>pdbonly</DebugType> | ||
24 | <Optimize>true</Optimize> | ||
25 | <OutputPath>bin\Release\</OutputPath> | ||
26 | <DefineConstants>TRACE</DefineConstants> | ||
27 | <ErrorReport>prompt</ErrorReport> | ||
28 | <WarningLevel>4</WarningLevel> | ||
29 | </PropertyGroup> | ||
30 | <ItemGroup> | ||
31 | <Reference Include="libsecondlife, Version=0.9.0.0, Culture=neutral, processorArchitecture=MSIL"> | ||
32 | <SpecificVersion>False</SpecificVersion> | ||
33 | <HintPath>..\..\..\bin\libsecondlife.dll</HintPath> | ||
34 | </Reference> | ||
35 | <Reference Include="System" /> | ||
36 | <Reference Include="System.Data" /> | ||
37 | <Reference Include="System.Xml" /> | ||
38 | </ItemGroup> | ||
39 | <ItemGroup> | ||
40 | <Compile Include="MyClientView.cs" /> | ||
41 | <Compile Include="MyPacketServer.cs" /> | ||
42 | <Compile Include="Program.cs" /> | ||
43 | <Compile Include="Properties\AssemblyInfo.cs" /> | ||
44 | </ItemGroup> | ||
45 | <ItemGroup> | ||
46 | <ProjectReference Include="..\..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> | ||
47 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> | ||
48 | <Name>OpenSim.Framework.Console</Name> | ||
49 | </ProjectReference> | ||
50 | <ProjectReference Include="..\..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj"> | ||
51 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> | ||
52 | <Name>OpenSim.Framework</Name> | ||
53 | </ProjectReference> | ||
54 | <ProjectReference Include="..\..\..\Common\OpenSim.Servers\OpenSim.Servers.csproj"> | ||
55 | <Project>{8BB20F0A-0000-0000-0000-000000000000}</Project> | ||
56 | <Name>OpenSim.Servers</Name> | ||
57 | </ProjectReference> | ||
58 | <ProjectReference Include="..\..\..\Common\XmlRpcCS\XMLRPC.csproj"> | ||
59 | <Project>{8E81D43C-0000-0000-0000-000000000000}</Project> | ||
60 | <Name>XMLRPC</Name> | ||
61 | </ProjectReference> | ||
62 | <ProjectReference Include="..\..\OpenSim.GridInterfaces\Local\OpenSim.GridInterfaces.Local.csproj"> | ||
63 | <Project>{546099CD-0000-0000-0000-000000000000}</Project> | ||
64 | <Name>OpenSim.GridInterfaces.Local</Name> | ||
65 | </ProjectReference> | ||
66 | <ProjectReference Include="..\..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj"> | ||
67 | <Project>{8BE16150-0000-0000-0000-000000000000}</Project> | ||
68 | <Name>OpenSim.Physics.Manager</Name> | ||
69 | </ProjectReference> | ||
70 | <ProjectReference Include="..\..\OpenSim.RegionServer\OpenSim.RegionServer.csproj"> | ||
71 | <Project>{632E1BFD-0000-0000-0000-000000000000}</Project> | ||
72 | <Name>OpenSim.RegionServer</Name> | ||
73 | </ProjectReference> | ||
74 | <ProjectReference Include="..\..\OpenSim.World\OpenSim.World.csproj"> | ||
75 | <Project>{642A14A8-0000-0000-0000-000000000000}</Project> | ||
76 | <Name>OpenSim.World</Name> | ||
77 | </ProjectReference> | ||
78 | </ItemGroup> | ||
79 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | ||
80 | <!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
81 | Other similar extension points exist, see Microsoft.Common.targets. | ||
82 | <Target Name="BeforeBuild"> | ||
83 | </Target> | ||
84 | <Target Name="AfterBuild"> | ||
85 | </Target> | ||
86 | --> | ||
87 | </Project> \ No newline at end of file | ||