aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Examples/SimpleApp/MyWorld.cs
diff options
context:
space:
mode:
authorlbsa712007-06-09 21:45:58 +0000
committerlbsa712007-06-09 21:45:58 +0000
commit4224b695acc2e1ad0199dc0ad7f560494182ed54 (patch)
tree8fae1cf25a058bc4e378ef2b6ce264d7f9f0b910 /OpenSim/Examples/SimpleApp/MyWorld.cs
parent*Fixed casting mishap in last commit - client now starts up without crashing (diff)
downloadopensim-SC_OLD-4224b695acc2e1ad0199dc0ad7f560494182ed54.zip
opensim-SC_OLD-4224b695acc2e1ad0199dc0ad7f560494182ed54.tar.gz
opensim-SC_OLD-4224b695acc2e1ad0199dc0ad7f560494182ed54.tar.bz2
opensim-SC_OLD-4224b695acc2e1ad0199dc0ad7f560494182ed54.tar.xz
* LogFile now defaults to "{apptype}.log"
* cleaned away suo and user files. * added handy string chat variety to the API * Moved LockPhysicsEngine on World to SyncRoot on IWorld * Introduced NextLocalId instead of World fuggliness. * Transformed GetRegionInfo to Property on IWorld for great justice * Extracted default wearables (good to have) * Deleted unused BaseServer * Used IWorld instead of World wherever possible * The client constructor's not getting unused port any longer. * Extracted ClientView factoring so PacketServer can be tweaked. * Added SendLayerData to World * Made WorldBase abstract and cleaned it up a bit * added OpenGrid.Framework.Communications.dll.build and OpenSim.World.dll.build to svn * Added code for two examples (but not in prebuild yet)
Diffstat (limited to 'OpenSim/Examples/SimpleApp/MyWorld.cs')
-rw-r--r--OpenSim/Examples/SimpleApp/MyWorld.cs101
1 files changed, 101 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 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Framework.Interfaces;
5using OpenSim.Framework.Types;
6using OpenSim.Framework.Console;
7using libsecondlife;
8
9namespace 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}