aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Examples/SimpleApp
diff options
context:
space:
mode:
authorMW2007-06-27 15:28:52 +0000
committerMW2007-06-27 15:28:52 +0000
commit646bbbc84b8010e0dacbeed5342cdb045f46cc49 (patch)
tree770b34d19855363c3c113ab9a0af9a56d821d887 /OpenSim/Region/Examples/SimpleApp
downloadopensim-SC-646bbbc84b8010e0dacbeed5342cdb045f46cc49.zip
opensim-SC-646bbbc84b8010e0dacbeed5342cdb045f46cc49.tar.gz
opensim-SC-646bbbc84b8010e0dacbeed5342cdb045f46cc49.tar.bz2
opensim-SC-646bbbc84b8010e0dacbeed5342cdb045f46cc49.tar.xz
Some work on restructuring the namespaces / project names. Note this doesn't compile yet as not all the code has been changed to use the new namespaces. Am committing it now for feedback on the namespaces.
Diffstat (limited to 'OpenSim/Region/Examples/SimpleApp')
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MyWorld.cs113
-rw-r--r--OpenSim/Region/Examples/SimpleApp/Program.cs128
-rw-r--r--OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj154
-rw-r--r--OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj.user12
5 files changed, 440 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..01e0c59
--- /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;
9using Avatar=OpenSim.Region.Scenes.ScenePresence;
10using OpenSim.Region.Scenes;
11using OpenSim.Framework;
12using OpenSim.Caches;
13using OpenGrid.Framework.Communications;
14using OpenSim.Servers;
15
16namespace SimpleApp
17{
18 public class MyWorld : Scene
19 {
20 private RegionInfo m_regionInfo;
21 private List<OpenSim.Region.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.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..e1465d1
--- /dev/null
+++ b/OpenSim/Region/Examples/SimpleApp/Program.cs
@@ -0,0 +1,128 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim;
5using OpenSim.GridInterfaces.Local;
6using OpenSim.Framework.Interfaces;
7using OpenSim.Framework.Types;
8using OpenSim.Framework.Console;
9using OpenSim.Assets;
10using libsecondlife;
11using OpenSim.Servers;
12using OpenSim.Framework;
13using OpenSim.Caches;
14using OpenGrid.Framework.Communications;
15using OpenSim.LocalCommunications;
16
17namespace SimpleApp
18{
19 class Program : IAssetReceiver, conscmd_callback
20 {
21 private LogBase m_log;
22 AuthenticateSessionsBase m_circuitManager;
23
24 private void Run()
25 {
26 m_log = new LogBase(null, "SimpleApp", this, false);
27 MainLog.Instance = m_log;
28
29 // CheckSumServer checksumServer = new CheckSumServer(12036);
30 // checksumServer.ServerListener();
31
32 string simAddr = "127.0.0.1";
33 int simPort = 9000;
34 /*
35 LoginServer loginServer = new LoginServer( simAddr, simPort, 0, 0, false );
36 loginServer.Startup();
37 loginServer.SetSessionHandler( AddNewSessionHandler );*/
38
39 m_circuitManager = new AuthenticateSessionsBase();
40
41 InventoryCache inventoryCache = new InventoryCache();
42
43 LocalAssetServer assetServer = new LocalAssetServer();
44 assetServer.SetServerInfo("http://127.0.0.1:8003/", "");
45 assetServer.SetReceiver(this);
46
47 AssetCache assetCache = new AssetCache(assetServer);
48
49 UDPServer udpServer = new UDPServer(simPort, assetCache, inventoryCache, m_log, m_circuitManager );
50 PacketServer packetServer = new PacketServer( udpServer, (uint) simPort );
51 udpServer.ServerListener();
52
53 ClientView.TerrainManager = new TerrainManager(new SecondLife());
54
55 CommunicationsManager communicationsManager = new CommunicationsLocal(null);
56
57 RegionInfo regionInfo = new RegionInfo( );
58 BaseHttpServer httpServer = new BaseHttpServer(simPort);
59 udpServer.LocalWorld = new MyWorld( packetServer.ClientAPIs, regionInfo, m_circuitManager, communicationsManager, assetCache, httpServer );
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 // httpServer.AddXmlRPCHandler( "login_to_simulator", loginServer.XmlRpcLoginMethod );
67 httpServer.Start();
68
69 m_log.WriteLine( LogPriority.NORMAL, "Press enter to quit.");
70 m_log.ReadLine();
71 }
72
73 private bool AddNewSessionHandler(ulong regionHandle, Login loginData)
74 {
75 m_log.WriteLine(LogPriority.NORMAL, "Region [{0}] recieved Login from [{1}] [{2}]", regionHandle, loginData.First, loginData.Last);
76
77 AgentCircuitData agent = new AgentCircuitData();
78 agent.AgentID = loginData.Agent;
79 agent.firstname = loginData.First;
80 agent.lastname = loginData.Last;
81 agent.SessionID = loginData.Session;
82 agent.SecureSessionID = loginData.SecureSession;
83 agent.circuitcode = loginData.CircuitCode;
84 agent.BaseFolder = loginData.BaseFolder;
85 agent.InventoryFolder = loginData.InventoryFolder;
86 agent.startpos = new LLVector3(128, 128, 70);
87
88 m_circuitManager.AddNewCircuit(agent.circuitcode, agent);
89
90 return true;
91 }
92
93 #region IAssetReceiver Members
94
95 public void AssetReceived( AssetBase asset, bool IsTexture)
96 {
97 throw new Exception("The method or operation is not implemented.");
98 }
99
100 public void AssetNotFound( AssetBase asset)
101 {
102 throw new Exception("The method or operation is not implemented.");
103 }
104
105 #endregion
106
107 #region conscmd_callback Members
108
109 public void RunCmd(string cmd, string[] cmdparams)
110 {
111 throw new Exception("The method or operation is not implemented.");
112 }
113
114 public void Show(string ShowWhat)
115 {
116 throw new Exception("The method or operation is not implemented.");
117 }
118
119 #endregion
120
121 static void Main(string[] args)
122 {
123 Program app = new Program();
124
125 app.Run();
126 }
127 }
128}
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..5129be2
--- /dev/null
+++ b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj
@@ -0,0 +1,154 @@
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="OpenSim.Servers" >
66 <HintPath>OpenSim.Servers.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 <Reference Include="System" >
70 <HintPath>System.dll</HintPath>
71 <Private>False</Private>
72 </Reference>
73 <Reference Include="System.Data.dll" >
74 <HintPath>..\..\..\..\bin\System.Data.dll</HintPath>
75 <Private>False</Private>
76 </Reference>
77 <Reference Include="System.Xml" >
78 <HintPath>System.Xml.dll</HintPath>
79 <Private>False</Private>
80 </Reference>
81 <Reference Include="XMLRPC.dll" >
82 <HintPath>..\..\..\..\bin\XMLRPC.dll</HintPath>
83 <Private>False</Private>
84 </Reference>
85 </ItemGroup>
86 <ItemGroup>
87 <ProjectReference Include="..\..\..\Framework\General\OpenSim.Framework.csproj">
88 <Name>OpenSim.Framework</Name>
89 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
90 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
91 <Private>False</Private>
92 </ProjectReference>
93 <ProjectReference Include="..\..\..\Framework\Communications\OpenSim.Framework.Communications.csproj">
94 <Name>OpenSim.Framework.Communications</Name>
95 <Project>{CB52B7E7-0000-0000-0000-000000000000}</Project>
96 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
97 <Private>False</Private>
98 </ProjectReference>
99 <ProjectReference Include="..\..\..\Framework\Console\OpenSim.Framework.Console.csproj">
100 <Name>OpenSim.Framework.Console</Name>
101 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
102 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
103 <Private>False</Private>
104 </ProjectReference>
105 <ProjectReference Include="..\..\Caches\OpenSim.Region.Caches.csproj">
106 <Name>OpenSim.Region.Caches</Name>
107 <Project>{61FCCDB3-0000-0000-0000-000000000000}</Project>
108 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
109 <Private>False</Private>
110 </ProjectReference>
111 <ProjectReference Include="..\..\ClientStack\OpenSim.Region.ClientStack.csproj">
112 <Name>OpenSim.Region.ClientStack</Name>
113 <Project>{DC3698B2-0000-0000-0000-000000000000}</Project>
114 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
115 <Private>False</Private>
116 </ProjectReference>
117 <ProjectReference Include="..\..\GridInterfaces\Local\OpenSim.Region.GridInterfaces.Local.csproj">
118 <Name>OpenSim.Region.GridInterfaces.Local</Name>
119 <Project>{241A8CDD-0000-0000-0000-000000000000}</Project>
120 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
121 <Private>False</Private>
122 </ProjectReference>
123 <ProjectReference Include="..\..\LocalCommunications\OpenSim.Region.LocalCommunications.csproj">
124 <Name>OpenSim.Region.LocalCommunications</Name>
125 <Project>{EB3A1BA8-0000-0000-0000-000000000000}</Project>
126 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
127 <Private>False</Private>
128 </ProjectReference>
129 <ProjectReference Include="..\..\Simulation\OpenSim.Region.Simulation.csproj">
130 <Name>OpenSim.Region.Simulation</Name>
131 <Project>{C0DAB338-0000-0000-0000-000000000000}</Project>
132 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
133 <Private>False</Private>
134 </ProjectReference>
135 </ItemGroup>
136 <ItemGroup>
137 <Compile Include="MyWorld.cs">
138 <SubType>Code</SubType>
139 </Compile>
140 <Compile Include="Program.cs">
141 <SubType>Code</SubType>
142 </Compile>
143 <Compile Include="Properties\AssemblyInfo.cs">
144 <SubType>Code</SubType>
145 </Compile>
146 </ItemGroup>
147 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
148 <PropertyGroup>
149 <PreBuildEvent>
150 </PreBuildEvent>
151 <PostBuildEvent>
152 </PostBuildEvent>
153 </PropertyGroup>
154</Project>
diff --git a/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj.user b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj.user
new file mode 100644
index 0000000..6841907
--- /dev/null
+++ b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj.user
@@ -0,0 +1,12 @@
1<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\</ReferencePath>
6 <LastOpenVersion>8.0.50727</LastOpenVersion>
7 <ProjectView>ProjectFiles</ProjectView>
8 <ProjectTrust>0</ProjectTrust>
9 </PropertyGroup>
10 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
11 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
12</Project>