aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Examples/SimpleApp2
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Examples/SimpleApp2')
-rw-r--r--OpenSim/Examples/SimpleApp2/MyClientView.cs69
-rw-r--r--OpenSim/Examples/SimpleApp2/MyPacketServer.cs30
-rw-r--r--OpenSim/Examples/SimpleApp2/Program.cs160
-rw-r--r--OpenSim/Examples/SimpleApp2/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Examples/SimpleApp2/SimpleApp2.csproj87
5 files changed, 379 insertions, 0 deletions
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 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim;
5using libsecondlife;
6using OpenSim.Framework.Interfaces;
7using System.Net;
8using libsecondlife.Packets;
9using OpenSim.Assets;
10using OpenSim.Framework.Types;
11using OpenSim.Framework;
12
13namespace 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 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim;
5using OpenSim.Assets;
6using System.Net;
7using libsecondlife.Packets;
8using OpenSim.Framework.Interfaces;
9using OpenSim.Framework;
10
11namespace 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 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim;
5using OpenSim.Servers;
6using OpenSim.GridInterfaces.Local;
7using OpenSim.Framework.Interfaces;
8using OpenSim.Framework.Types;
9using OpenSim.UserServer;
10using OpenSim.Framework.Console;
11using OpenSim.world;
12using OpenSim.Physics.Manager;
13using OpenSim.Assets;
14using libsecondlife;
15
16namespace 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 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using 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