aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Examples
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Examples')
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MyWorld.cs113
-rw-r--r--OpenSim/Region/Examples/SimpleApp/Program.cs129
-rw-r--r--OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj156
-rw-r--r--OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build54
5 files changed, 485 insertions, 0 deletions
diff --git a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs
new file mode 100644
index 0000000..89f39d3
--- /dev/null
+++ b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs
@@ -0,0 +1,113 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Framework.Interfaces;
5using OpenSim.Framework.Types;
6using OpenSim.Framework.Console;
7using libsecondlife;
8using OpenSim.Region.Environment;
9using Avatar=OpenSim.Region.Environment.Scenes.ScenePresence;
10using OpenSim.Region.Environment.Scenes;
11using OpenSim.Framework;
12using OpenSim.Region.Caches;
13using OpenSim.Framework.Communications;
14using OpenSim.Framework.Servers;
15
16namespace SimpleApp
17{
18 public class MyWorld : Scene
19 {
20 private RegionInfo m_regionInfo;
21 private List<OpenSim.Region.Environment.Scenes.ScenePresence> m_avatars;
22
23 public MyWorld(Dictionary<uint, IClientAPI> clientThreads, RegionInfo regionInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer)
24 : base(clientThreads, regionInfo, authen, commsMan, assetCach, httpServer)
25 {
26 m_regionInfo = regionInfo;
27 m_avatars = new List<Avatar>();
28 }
29
30 public override void SendLayerData(IClientAPI remoteClient)
31 {
32 float[] map = new float[65536];
33
34 for (int i = 0; i < 65536; i++)
35 {
36 int x = i % 256;
37 int y = i / 256;
38
39 map[i] = (float)(x + y / 2);
40 }
41
42 remoteClient.SendLayerData(map);
43 }
44
45 #region IWorld Members
46
47 override public void AddNewClient(IClientAPI client, LLUUID agentID, bool child)
48
49 {
50 LLVector3 pos = new LLVector3(128, 128, 128);
51
52 client.OnRegionHandShakeReply += SendLayerData;
53 client.OnChatFromViewer +=
54 delegate(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
55 {
56 // Echo it (so you know what you typed)
57 client.SendChatMessage(message, type, fromPos, fromName, fromAgentID);
58 client.SendChatMessage("Ready.", 1, pos, "System", LLUUID.Zero );
59 };
60
61 client.OnRequestWearables += SendWearables;
62
63 client.OnCompleteMovementToRegion += delegate()
64 {
65 client.MoveAgentIntoRegion(m_regionInfo, pos, LLVector3.Zero );
66 };
67
68 client.OnCompleteMovementToRegion += delegate()
69 {
70 client.SendAvatarData(m_regionInfo.RegionHandle, client.FirstName,
71 client.LastName, client.AgentId, 0,
72 pos, null);
73
74 client.SendChatMessage("Welcome to My World.", 1, pos, "System", LLUUID.Zero );
75 };
76
77 client.SendRegionHandshake(m_regionInfo);
78
79 OpenSim.Region.Environment.Scenes.ScenePresence avatar = new Avatar( client, this, m_regionInfo );
80
81 }
82
83 private void SendWearables( IClientAPI client )
84 {
85 client.SendWearables( AvatarWearable.DefaultWearables );
86 }
87
88
89 override public void RemoveClient(LLUUID agentID)
90 {
91
92 }
93
94 public RegionInfo RegionInfo
95 {
96 get { return m_regionInfo; }
97 }
98
99 public object SyncRoot
100 {
101 get { return this; }
102 }
103
104 private uint m_nextLocalId = 1;
105
106 public uint NextLocalId
107 {
108 get { return m_nextLocalId++; }
109 }
110
111 #endregion
112 }
113}
diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs
new file mode 100644
index 0000000..4060d68
--- /dev/null
+++ b/OpenSim/Region/Examples/SimpleApp/Program.cs
@@ -0,0 +1,129 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim;
5using OpenSim.Region.GridInterfaces.Local;
6using OpenSim.Framework.Interfaces;
7using OpenSim.Framework.Types;
8using OpenSim.Framework.Console;
9using OpenSim.Framework.Servers;
10using OpenSim.Assets;
11using libsecondlife;
12using OpenSim.Framework;
13using OpenSim.Region.Caches;
14using OpenSim.Framework.Communications;
15using OpenSim.Region.Communications.Local;
16using OpenSim.Region.ClientStack;
17
18namespace SimpleApp
19{
20 class Program : IAssetReceiver, conscmd_callback
21 {
22 private LogBase m_log;
23 AuthenticateSessionsBase m_circuitManager;
24
25 private void Run()
26 {
27 m_log = new LogBase(null, "SimpleApp", this, false);
28 MainLog.Instance = m_log;
29
30 // CheckSumServer checksumServer = new CheckSumServer(12036);
31 // checksumServer.ServerListener();
32
33 string simAddr = "127.0.0.1";
34 int simPort = 9000;
35 /*
36 LoginServer loginServer = new LoginServer( simAddr, simPort, 0, 0, false );
37 loginServer.Startup();
38 loginServer.SetSessionHandler( AddNewSessionHandler );*/
39
40 m_circuitManager = new AuthenticateSessionsBase();
41
42 InventoryCache inventoryCache = new InventoryCache();
43
44 LocalAssetServer assetServer = new LocalAssetServer();
45 assetServer.SetServerInfo("http://127.0.0.1:8003/", "");
46 assetServer.SetReceiver(this);
47
48 AssetCache assetCache = new AssetCache(assetServer);
49
50 UDPServer udpServer = new UDPServer(simPort, assetCache, inventoryCache, m_log, m_circuitManager );
51 PacketServer packetServer = new PacketServer( udpServer, (uint) simPort );
52 udpServer.ServerListener();
53
54 ClientView.TerrainManager = new TerrainManager(new SecondLife());
55
56 CommunicationsManager communicationsManager = new CommunicationsLocal(null);
57
58 RegionInfo regionInfo = new RegionInfo( );
59 BaseHttpServer httpServer = new BaseHttpServer(simPort);
60 udpServer.LocalWorld = new MyWorld( packetServer.ClientAPIs, regionInfo, m_circuitManager, communicationsManager, assetCache, httpServer );
61
62 // World world = new World(udpServer.PacketServer.ClientAPIs, regionInfo);
63 // PhysicsScene physicsScene = new NullPhysicsScene();
64 // world.PhysicsScene = physicsScene;
65 // udpServer.LocalWorld = world;
66
67 // httpServer.AddXmlRPCHandler( "login_to_simulator", loginServer.XmlRpcLoginMethod );
68 httpServer.Start();
69
70 m_log.WriteLine( LogPriority.NORMAL, "Press enter to quit.");
71 m_log.ReadLine();
72 }
73
74 private bool AddNewSessionHandler(ulong regionHandle, Login loginData)
75 {
76 m_log.WriteLine(LogPriority.NORMAL, "Region [{0}] recieved Login from [{1}] [{2}]", regionHandle, loginData.First, loginData.Last);
77
78 AgentCircuitData agent = new AgentCircuitData();
79 agent.AgentID = loginData.Agent;
80 agent.firstname = loginData.First;
81 agent.lastname = loginData.Last;
82 agent.SessionID = loginData.Session;
83 agent.SecureSessionID = loginData.SecureSession;
84 agent.circuitcode = loginData.CircuitCode;
85 agent.BaseFolder = loginData.BaseFolder;
86 agent.InventoryFolder = loginData.InventoryFolder;
87 agent.startpos = new LLVector3(128, 128, 70);
88
89 m_circuitManager.AddNewCircuit(agent.circuitcode, agent);
90
91 return true;
92 }
93
94 #region IAssetReceiver Members
95
96 public void AssetReceived( AssetBase asset, bool IsTexture)
97 {
98 throw new Exception("The method or operation is not implemented.");
99 }
100
101 public void AssetNotFound( AssetBase asset)
102 {
103 throw new Exception("The method or operation is not implemented.");
104 }
105
106 #endregion
107
108 #region conscmd_callback Members
109
110 public void RunCmd(string cmd, string[] cmdparams)
111 {
112 throw new Exception("The method or operation is not implemented.");
113 }
114
115 public void Show(string ShowWhat)
116 {
117 throw new Exception("The method or operation is not implemented.");
118 }
119
120 #endregion
121
122 static void Main(string[] args)
123 {
124 Program app = new Program();
125
126 app.Run();
127 }
128 }
129}
diff --git a/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs b/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..0f9bf0f
--- /dev/null
+++ b/OpenSim/Region/Examples/SimpleApp/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("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/Region/Examples/SimpleApp/SimpleApp.csproj b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj
new file mode 100644
index 0000000..0a82172
--- /dev/null
+++ b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj
@@ -0,0 +1,156 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{24B12448-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>SimpleApp</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Exe</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>SimpleApp</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\..\..\..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\..\..\..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="libsecondlife.dll" >
62 <HintPath>..\..\..\..\bin\libsecondlife.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 <Reference Include="System" >
66 <HintPath>System.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 <Reference Include="System.Data.dll" >
70 <HintPath>..\..\..\..\bin\System.Data.dll</HintPath>
71 <Private>False</Private>
72 </Reference>
73 <Reference Include="System.Xml" >
74 <HintPath>System.Xml.dll</HintPath>
75 <Private>False</Private>
76 </Reference>
77 <Reference Include="XMLRPC.dll" >
78 <HintPath>..\..\..\..\bin\XMLRPC.dll</HintPath>
79 <Private>False</Private>
80 </Reference>
81 </ItemGroup>
82 <ItemGroup>
83 <ProjectReference Include="..\..\..\Framework\General\OpenSim.Framework.csproj">
84 <Name>OpenSim.Framework</Name>
85 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private>
88 </ProjectReference>
89 <ProjectReference Include="..\..\..\Framework\Communications\OpenSim.Framework.Communications.csproj">
90 <Name>OpenSim.Framework.Communications</Name>
91 <Project>{CB52B7E7-0000-0000-0000-000000000000}</Project>
92 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
93 <Private>False</Private>
94 </ProjectReference>
95 <ProjectReference Include="..\..\..\Framework\Console\OpenSim.Framework.Console.csproj">
96 <Name>OpenSim.Framework.Console</Name>
97 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
98 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
99 <Private>False</Private>
100 </ProjectReference>
101 <ProjectReference Include="..\..\..\Framework\Servers\OpenSim.Framework.Servers.csproj">
102 <Name>OpenSim.Framework.Servers</Name>
103 <Project>{2CC71860-0000-0000-0000-000000000000}</Project>
104 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
105 <Private>False</Private>
106 </ProjectReference>
107 <ProjectReference Include="..\..\Caches\OpenSim.Region.Caches.csproj">
108 <Name>OpenSim.Region.Caches</Name>
109 <Project>{61FCCDB3-0000-0000-0000-000000000000}</Project>
110 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
111 <Private>False</Private>
112 </ProjectReference>
113 <ProjectReference Include="..\..\ClientStack\OpenSim.Region.ClientStack.csproj">
114 <Name>OpenSim.Region.ClientStack</Name>
115 <Project>{DC3698B2-0000-0000-0000-000000000000}</Project>
116 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
117 <Private>False</Private>
118 </ProjectReference>
119 <ProjectReference Include="..\..\Communications\Local\OpenSim.Region.Communications.Local.csproj">
120 <Name>OpenSim.Region.Communications.Local</Name>
121 <Project>{BFB5D807-0000-0000-0000-000000000000}</Project>
122 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
123 <Private>False</Private>
124 </ProjectReference>
125 <ProjectReference Include="..\..\Environment\OpenSim.Region.Environment.csproj">
126 <Name>OpenSim.Region.Environment</Name>
127 <Project>{DCBA491C-0000-0000-0000-000000000000}</Project>
128 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
129 <Private>False</Private>
130 </ProjectReference>
131 <ProjectReference Include="..\..\GridInterfaces\Local\OpenSim.Region.GridInterfaces.Local.csproj">
132 <Name>OpenSim.Region.GridInterfaces.Local</Name>
133 <Project>{241A8CDD-0000-0000-0000-000000000000}</Project>
134 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
135 <Private>False</Private>
136 </ProjectReference>
137 </ItemGroup>
138 <ItemGroup>
139 <Compile Include="MyWorld.cs">
140 <SubType>Code</SubType>
141 </Compile>
142 <Compile Include="Program.cs">
143 <SubType>Code</SubType>
144 </Compile>
145 <Compile Include="Properties\AssemblyInfo.cs">
146 <SubType>Code</SubType>
147 </Compile>
148 </ItemGroup>
149 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
150 <PropertyGroup>
151 <PreBuildEvent>
152 </PreBuildEvent>
153 <PostBuildEvent>
154 </PostBuildEvent>
155 </PropertyGroup>
156</Project>
diff --git a/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build b/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build
new file mode 100644
index 0000000..f8896fa
--- /dev/null
+++ b/OpenSim/Region/Examples/SimpleApp/SimpleApp.exe.build
@@ -0,0 +1,54 @@
1<?xml version="1.0" ?>
2<project name="SimpleApp" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="exe" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.exe">
11 <resources prefix="SimpleApp" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="MyWorld.cs" />
15 <include name="Program.cs" />
16 <include name="Properties/AssemblyInfo.cs" />
17 </sources>
18 <references basedir="${project::get-base-directory()}">
19 <lib>
20 <include name="${project::get-base-directory()}" />
21 <include name="${project::get-base-directory()}/${build.dir}" />
22 </lib>
23 <include name="../../../../bin/libsecondlife.dll" />
24 <include name="../../../../bin/OpenSim.Framework.dll" />
25 <include name="../../../../bin/OpenSim.Framework.Communications.dll" />
26 <include name="../../../../bin/OpenSim.Framework.Console.dll" />
27 <include name="../../../../bin/OpenSim.Framework.Servers.dll" />
28 <include name="../../../../bin/OpenSim.Region.Caches.dll" />
29 <include name="../../../../bin/OpenSim.Region.ClientStack.dll" />
30 <include name="../../../../bin/OpenSim.Region.Communications.Local.dll" />
31 <include name="../../../../bin/OpenSim.Region.Environment.dll" />
32 <include name="../../../../bin/OpenSim.Region.GridInterfaces.Local.dll" />
33 <include name="System.dll" />
34 <include name="System.Data.dll.dll" />
35 <include name="System.Xml.dll" />
36 <include name="../../../../bin/XMLRPC.dll" />
37 </references>
38 </csc>
39 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../../bin/" />
40 <mkdir dir="${project::get-base-directory()}/../../../../bin/"/>
41 <copy todir="${project::get-base-directory()}/../../../../bin/">
42 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
43 <include name="*.dll"/>
44 <include name="*.exe"/>
45 </fileset>
46 </copy>
47 </target>
48 <target name="clean">
49 <delete dir="${bin.dir}" failonerror="false" />
50 <delete dir="${obj.dir}" failonerror="false" />
51 </target>
52 <target name="doc" description="Creates documentation.">
53 </target>
54</project>