aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Examples
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Examples')
-rw-r--r--OpenSim/Region/Examples/SimpleApp/LlsdMethodEntry.cs10
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MyWorld.cs93
-rw-r--r--OpenSim/Region/Examples/SimpleApp/Program.cs130
-rw-r--r--OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs31
4 files changed, 264 insertions, 0 deletions
diff --git a/OpenSim/Region/Examples/SimpleApp/LlsdMethodEntry.cs b/OpenSim/Region/Examples/SimpleApp/LlsdMethodEntry.cs
new file mode 100644
index 0000000..d0ef2af
--- /dev/null
+++ b/OpenSim/Region/Examples/SimpleApp/LlsdMethodEntry.cs
@@ -0,0 +1,10 @@
1using System.Collections;
2using System.Text;
3using libsecondlife;
4using OpenSim.Region.Capabilities;
5using System.IO;
6
7namespace OpenSim.Framework.Servers
8{
9
10}
diff --git a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs
new file mode 100644
index 0000000..3c69420
--- /dev/null
+++ b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs
@@ -0,0 +1,93 @@
1using System.Collections.Generic;
2using libsecondlife;
3using OpenSim.Framework;
4using OpenSim.Framework.Communications;
5using OpenSim.Framework.Interfaces;
6using OpenSim.Framework.Servers;
7using OpenSim.Framework.Types;
8using OpenSim.Region.Caches;
9using OpenSim.Region.Environment.Scenes;
10using Avatar=OpenSim.Region.Environment.Scenes.ScenePresence;
11
12namespace SimpleApp
13{
14 public class MyWorld : Scene
15 {
16 private List<ScenePresence> m_avatars;
17
18 public MyWorld(ClientManager clientManager, RegionInfo regionInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer)
19 : base(clientManager, regionInfo, authen, commsMan, assetCach, httpServer)
20 {
21 m_avatars = new List<Avatar>();
22 }
23
24 public override void SendLayerData(IClientAPI remoteClient)
25 {
26 float[] map = new float[65536];
27
28 for (int i = 0; i < 65536; i++)
29 {
30 int x = i % 256;
31 int y = i / 256;
32
33 map[i] = (float)(x + y / 2);
34 }
35
36 remoteClient.SendLayerData(map);
37 }
38
39 #region IWorld Members
40
41 override public void AddNewClient(IClientAPI client, bool child)
42
43 {
44 LLVector3 pos = new LLVector3(128, 128, 128);
45
46 client.OnRegionHandShakeReply += SendLayerData;
47 client.OnChatFromViewer +=
48 delegate(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
49 {
50 // Echo it (so you know what you typed)
51 client.SendChatMessage(message, type, fromPos, fromName, fromAgentID);
52 client.SendChatMessage("Ready.", 1, pos, "System", LLUUID.Zero );
53 };
54
55 client.OnRequestWearables += SendWearables;
56 client.OnAddPrim += AddNewPrim;
57 client.OnUpdatePrimGroupPosition += this.UpdatePrimPosition;
58 client.OnRequestMapBlocks += this.RequestMapBlocks;
59 client.OnTeleportLocationRequest += this.RequestTeleportLocation;
60 client.OnGrapUpdate += this.MoveObject;
61 client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest;
62
63 client.OnCompleteMovementToRegion += delegate()
64 {
65 client.MoveAgentIntoRegion(m_regInfo, pos, LLVector3.Zero );
66 };
67
68 client.OnCompleteMovementToRegion += delegate()
69 {
70 client.SendAvatarData(m_regInfo.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
78 };
79
80 client.SendRegionHandshake(m_regInfo);
81
82 CreateAndAddScenePresence(client);
83
84 }
85
86 private void SendWearables( IClientAPI client )
87 {
88 client.SendWearables( AvatarWearable.DefaultWearables );
89 }
90
91 #endregion
92 }
93}
diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs
new file mode 100644
index 0000000..87e877c
--- /dev/null
+++ b/OpenSim/Region/Examples/SimpleApp/Program.cs
@@ -0,0 +1,130 @@
1using System;
2using System.Net;
3using libsecondlife;
4using OpenSim.Assets;
5using OpenSim.Framework;
6using OpenSim.Framework.Console;
7using OpenSim.Framework.Interfaces;
8using OpenSim.Framework.Servers;
9using OpenSim.Framework.Types;
10using OpenSim.Physics.Manager;
11using OpenSim.Region.Caches;
12using OpenSim.Region.Capabilities;
13using OpenSim.Region.ClientStack;
14using OpenSim.Region.Communications.Local;
15using OpenSim.Region.GridInterfaces.Local;
16
17namespace SimpleApp
18{
19 class Program : IAssetReceiver, conscmd_callback
20 {
21 private LogBase m_log;
22 AuthenticateSessionsBase m_circuitManager;
23 uint m_localId;
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 IPEndPoint internalEndPoint = new IPEndPoint( IPAddress.Parse( "127.0.0.1" ), 9000 );
34
35 m_circuitManager = new AuthenticateSessionsBase();
36
37 InventoryCache inventoryCache = new InventoryCache();
38
39 LocalAssetServer assetServer = new LocalAssetServer();
40 assetServer.SetServerInfo("http://127.0.0.1:8003/", "");
41 assetServer.SetReceiver(this);
42
43 AssetCache assetCache = new AssetCache(assetServer);
44
45 UDPServer udpServer = new UDPServer( internalEndPoint.Port, assetCache, inventoryCache, m_log, m_circuitManager );
46 PacketServer packetServer = new PacketServer(udpServer);
47 udpServer.ServerListener();
48
49 ClientView.TerrainManager = new TerrainManager(new SecondLife());
50 BaseHttpServer httpServer = new BaseHttpServer(internalEndPoint.Port);
51
52 NetworkServersInfo serverInfo = new NetworkServersInfo();
53 CommunicationsLocal communicationsManager = new CommunicationsLocal(serverInfo, httpServer);
54
55 RegionInfo regionInfo = new RegionInfo( 1000, 1000, internalEndPoint, "127.0.0.1" );
56
57 MyWorld world = new MyWorld(packetServer.ClientManager, regionInfo, m_circuitManager, communicationsManager, assetCache, httpServer);
58 world.PhysScene = PhysicsScene.Null;
59 udpServer.LocalWorld = world;
60
61 httpServer.AddXmlRPCHandler("login_to_simulator", communicationsManager.UserServices.XmlRpcLoginMethod );
62
63 httpServer.Start();
64
65 m_log.WriteLine( LogPriority.NORMAL, "Press enter to quit.");
66 m_log.ReadLine();
67
68 PrimData primData = new PrimData();
69 primData.Scale = new LLVector3(1, 1, 1);
70
71 m_localId = world.AddNewPrim( LLUUID.Zero, primData, LLVector3.Zero, new LLQuaternion(0, 0, 0, 0), LLUUID.Zero, 0);
72
73 }
74
75 private bool AddNewSessionHandler(ulong regionHandle, Login loginData)
76 {
77 m_log.WriteLine(LogPriority.NORMAL, "Region [{0}] recieved Login from [{1}] [{2}]", regionHandle, loginData.First, loginData.Last);
78
79 AgentCircuitData agent = new AgentCircuitData();
80 agent.AgentID = loginData.Agent;
81 agent.firstname = loginData.First;
82 agent.lastname = loginData.Last;
83 agent.SessionID = loginData.Session;
84 agent.SecureSessionID = loginData.SecureSession;
85 agent.circuitcode = loginData.CircuitCode;
86 agent.BaseFolder = loginData.BaseFolder;
87 agent.InventoryFolder = loginData.InventoryFolder;
88 agent.startpos = new LLVector3(128, 128, 70);
89
90 m_circuitManager.AddNewCircuit(agent.circuitcode, agent);
91
92 return true;
93 }
94
95 #region IAssetReceiver Members
96
97 public void AssetReceived( AssetBase asset, bool IsTexture)
98 {
99 throw new Exception("The method or operation is not implemented.");
100 }
101
102 public void AssetNotFound( AssetBase asset)
103 {
104 throw new Exception("The method or operation is not implemented.");
105 }
106
107 #endregion
108
109 #region conscmd_callback Members
110
111 public void RunCmd(string cmd, string[] cmdparams)
112 {
113 throw new Exception("The method or operation is not implemented.");
114 }
115
116 public void Show(string ShowWhat)
117 {
118 throw new Exception("The method or operation is not implemented.");
119 }
120
121 #endregion
122
123 static void Main(string[] args)
124 {
125 Program app = new Program();
126
127 app.Run();
128 }
129 }
130}
diff --git a/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs b/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..3b0de8a
--- /dev/null
+++ b/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs
@@ -0,0 +1,31 @@
1using System.Reflection;
2using System.Runtime.InteropServices;
3// General Information about an assembly is controlled through the following
4// set of attributes. Change these attribute values to modify the information
5// associated with an assembly.
6[assembly: AssemblyTitle("SimpleApp")]
7[assembly: AssemblyDescription("")]
8[assembly: AssemblyConfiguration("")]
9[assembly: AssemblyCompany("Playahead AB")]
10[assembly: AssemblyProduct("SimpleApp")]
11[assembly: AssemblyCopyright("Copyright © Playahead AB 2007")]
12[assembly: AssemblyTrademark("")]
13[assembly: AssemblyCulture("")]
14
15// Setting ComVisible to false makes the types in this assembly not visible
16// to COM components. If you need to access a type in this assembly from
17// COM, set the ComVisible attribute to true on that type.
18[assembly: ComVisible(false)]
19
20// The following GUID is for the ID of the typelib if this project is exposed to COM
21[assembly: Guid("a5cfa45f-5acf-4b2e-9c50-1dd1fd7608ee")]
22
23// Version information for an assembly consists of the following four values:
24//
25// Major Version
26// Minor Version
27// Build Number
28// Revision
29//
30[assembly: AssemblyVersion("1.0.0.0")]
31[assembly: AssemblyFileVersion("1.0.0.0")]