diff options
Diffstat (limited to 'OpenSim/Region/Examples/SimpleApp/MyWorld.cs')
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/MyWorld.cs | 194 |
1 files changed, 97 insertions, 97 deletions
diff --git a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs index 29b255b..4fe3c7a 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs | |||
@@ -1,97 +1,97 @@ | |||
1 | using System.Collections.Generic; | 1 | using System.Collections.Generic; |
2 | using libsecondlife; | 2 | using libsecondlife; |
3 | using OpenSim.Framework; | 3 | using OpenSim.Framework; |
4 | using OpenSim.Framework.Communications; | 4 | using OpenSim.Framework.Communications; |
5 | using OpenSim.Framework.Interfaces; | 5 | using OpenSim.Framework.Interfaces; |
6 | using OpenSim.Framework.Servers; | 6 | using OpenSim.Framework.Servers; |
7 | using OpenSim.Framework.Types; | 7 | using OpenSim.Framework.Types; |
8 | using OpenSim.Region.Caches; | 8 | using OpenSim.Region.Caches; |
9 | using OpenSim.Region.Environment.Scenes; | 9 | using OpenSim.Region.Environment.Scenes; |
10 | using OpenSim.Region.Terrain; | 10 | using OpenSim.Region.Terrain; |
11 | using OpenSim.Region.Environment; | 11 | using OpenSim.Region.Environment; |
12 | 12 | ||
13 | using Avatar=OpenSim.Region.Environment.Scenes.ScenePresence; | 13 | using Avatar=OpenSim.Region.Environment.Scenes.ScenePresence; |
14 | 14 | ||
15 | namespace SimpleApp | 15 | namespace SimpleApp |
16 | { | 16 | { |
17 | public class MyWorld : Scene | 17 | public class MyWorld : Scene |
18 | { | 18 | { |
19 | private List<ScenePresence> m_avatars; | 19 | private List<ScenePresence> m_avatars; |
20 | 20 | ||
21 | public MyWorld( RegionInfo regionInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, StorageManager storeMan, BaseHttpServer httpServer) | 21 | public MyWorld( RegionInfo regionInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, StorageManager storeMan, BaseHttpServer httpServer) |
22 | : base( regionInfo, authen, commsMan, assetCach, storeMan, httpServer) | 22 | : base( regionInfo, authen, commsMan, assetCach, storeMan, httpServer) |
23 | { | 23 | { |
24 | m_avatars = new List<Avatar>(); | 24 | m_avatars = new List<Avatar>(); |
25 | } | 25 | } |
26 | 26 | ||
27 | public override void LoadWorldMap() | 27 | public override void LoadWorldMap() |
28 | { | 28 | { |
29 | float[] map = new float[65536]; | 29 | float[] map = new float[65536]; |
30 | 30 | ||
31 | for (int i = 0; i < 65536; i++) | 31 | for (int i = 0; i < 65536; i++) |
32 | { | 32 | { |
33 | int x = i % 256; | 33 | int x = i % 256; |
34 | int y = i / 256; | 34 | int y = i / 256; |
35 | 35 | ||
36 | map[i] = 25f; | 36 | map[i] = 25f; |
37 | } | 37 | } |
38 | 38 | ||
39 | this.Terrain.setHeights1D(map); | 39 | this.Terrain.setHeights1D(map); |
40 | this.CreateTerrainTexture(); | 40 | this.CreateTerrainTexture(); |
41 | } | 41 | } |
42 | 42 | ||
43 | #region IWorld Members | 43 | #region IWorld Members |
44 | 44 | ||
45 | override public void AddNewClient(IClientAPI client, bool child) | 45 | override public void AddNewClient(IClientAPI client, bool child) |
46 | { | 46 | { |
47 | LLVector3 pos = new LLVector3(128, 128, 128); | 47 | LLVector3 pos = new LLVector3(128, 128, 128); |
48 | 48 | ||
49 | client.OnRegionHandShakeReply += SendLayerData; | 49 | client.OnRegionHandShakeReply += SendLayerData; |
50 | /*client.OnChatFromViewer += | 50 | /*client.OnChatFromViewer += |
51 | delegate(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) | 51 | delegate(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) |
52 | { | 52 | { |
53 | // Echo it (so you know what you typed) | 53 | // Echo it (so you know what you typed) |
54 | client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); | 54 | client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); |
55 | client.SendChatMessage("Ready.", 1, pos, "System", LLUUID.Zero ); | 55 | client.SendChatMessage("Ready.", 1, pos, "System", LLUUID.Zero ); |
56 | }; | 56 | }; |
57 | */ | 57 | */ |
58 | client.OnChatFromViewer += this.SimChat; | 58 | client.OnChatFromViewer += this.SimChat; |
59 | client.OnAddPrim += AddNewPrim; | 59 | client.OnAddPrim += AddNewPrim; |
60 | client.OnUpdatePrimGroupPosition += this.UpdatePrimPosition; | 60 | client.OnUpdatePrimGroupPosition += this.UpdatePrimPosition; |
61 | client.OnRequestMapBlocks += this.RequestMapBlocks; | 61 | client.OnRequestMapBlocks += this.RequestMapBlocks; |
62 | client.OnTeleportLocationRequest += this.RequestTeleportLocation; | 62 | client.OnTeleportLocationRequest += this.RequestTeleportLocation; |
63 | client.OnGrapUpdate += this.MoveObject; | 63 | client.OnGrapUpdate += this.MoveObject; |
64 | client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; | 64 | client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; |
65 | 65 | ||
66 | client.OnCompleteMovementToRegion += delegate() | 66 | client.OnCompleteMovementToRegion += delegate() |
67 | { | 67 | { |
68 | client.SendChatMessage("Welcome to My World.", 1, pos, "System", LLUUID.Zero ); | 68 | client.SendChatMessage("Welcome to My World.", 1, pos, "System", LLUUID.Zero ); |
69 | }; | 69 | }; |
70 | 70 | ||
71 | client.SendRegionHandshake(m_regInfo); | 71 | client.SendRegionHandshake(m_regInfo); |
72 | 72 | ||
73 | ScenePresence avatar = CreateAndAddScenePresence(client); | 73 | ScenePresence avatar = CreateAndAddScenePresence(client); |
74 | avatar.Pos = new LLVector3(128, 128, 26); | 74 | avatar.Pos = new LLVector3(128, 128, 26); |
75 | } | 75 | } |
76 | 76 | ||
77 | public override void Update() | 77 | public override void Update() |
78 | { | 78 | { |
79 | foreach (LLUUID UUID in Entities.Keys) | 79 | foreach (LLUUID UUID in Entities.Keys) |
80 | { | 80 | { |
81 | Entities[UUID].updateMovement(); | 81 | Entities[UUID].updateMovement(); |
82 | } | 82 | } |
83 | 83 | ||
84 | lock (this.m_syncRoot) | 84 | lock (this.m_syncRoot) |
85 | { | 85 | { |
86 | this.phyScene.Simulate(timeStep); | 86 | this.phyScene.Simulate(timeStep); |
87 | } | 87 | } |
88 | 88 | ||
89 | foreach (LLUUID UUID in Entities.Keys) | 89 | foreach (LLUUID UUID in Entities.Keys) |
90 | { | 90 | { |
91 | Entities[UUID].update(); | 91 | Entities[UUID].update(); |
92 | } | 92 | } |
93 | } | 93 | } |
94 | 94 | ||
95 | #endregion | 95 | #endregion |
96 | } | 96 | } |
97 | } | 97 | } |