diff options
Diffstat (limited to 'OpenSim/Examples/SimpleApp')
-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 |
4 files changed, 330 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 | ||