aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Examples/SimpleApp
diff options
context:
space:
mode:
authorSean Dague2007-07-16 15:40:11 +0000
committerSean Dague2007-07-16 15:40:11 +0000
commit2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6 (patch)
treee3f80ad51736cf17e856547b1bcf956010927434 /OpenSim/Region/Examples/SimpleApp
parent*Trunk compiles now (diff)
downloadopensim-SC-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.zip
opensim-SC-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.gz
opensim-SC-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.bz2
opensim-SC-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.xz
changed to native line ending encoding
Diffstat (limited to 'OpenSim/Region/Examples/SimpleApp')
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs368
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MySceneObject.cs80
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MyWorld.cs194
-rw-r--r--OpenSim/Region/Examples/SimpleApp/Program.cs252
-rw-r--r--OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs62
5 files changed, 478 insertions, 478 deletions
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
index 7e6b1af..28c9b9a 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
@@ -1,184 +1,184 @@
1using System.Collections.Generic; 1using System.Collections.Generic;
2using System.Net; 2using System.Net;
3using System.Timers; 3using System.Timers;
4using System; 4using System;
5using System.Text; 5using System.Text;
6 6
7using libsecondlife; 7using libsecondlife;
8using libsecondlife.Packets; 8using libsecondlife.Packets;
9 9
10using OpenSim.Framework; 10using OpenSim.Framework;
11using OpenSim.Framework.Interfaces; 11using OpenSim.Framework.Interfaces;
12using OpenSim.Framework.Types; 12using OpenSim.Framework.Types;
13using OpenSim.Framework.Data; 13using OpenSim.Framework.Data;
14using OpenSim.Framework.Utilities; 14using OpenSim.Framework.Utilities;
15 15
16namespace SimpleApp 16namespace SimpleApp
17{ 17{
18 public class MyNpcCharacter : IClientAPI 18 public class MyNpcCharacter : IClientAPI
19 { 19 {
20 private uint movementFlag = 0; 20 private uint movementFlag = 0;
21 private short flyState = 0; 21 private short flyState = 0;
22 private LLQuaternion bodyDirection = LLQuaternion.Identity; 22 private LLQuaternion bodyDirection = LLQuaternion.Identity;
23 private short count = 0; 23 private short count = 0;
24 24
25 public event ImprovedInstantMessage OnInstantMessage; 25 public event ImprovedInstantMessage OnInstantMessage;
26 public event ChatFromViewer OnChatFromViewer; 26 public event ChatFromViewer OnChatFromViewer;
27 public event RezObject OnRezObject; 27 public event RezObject OnRezObject;
28 public event ModifyTerrain OnModifyTerrain; 28 public event ModifyTerrain OnModifyTerrain;
29 public event SetAppearance OnSetAppearance; 29 public event SetAppearance OnSetAppearance;
30 public event StartAnim OnStartAnim; 30 public event StartAnim OnStartAnim;
31 public event LinkObjects OnLinkObjects; 31 public event LinkObjects OnLinkObjects;
32 public event RequestMapBlocks OnRequestMapBlocks; 32 public event RequestMapBlocks OnRequestMapBlocks;
33 public event TeleportLocationRequest OnTeleportLocationRequest; 33 public event TeleportLocationRequest OnTeleportLocationRequest;
34 34
35 public event GenericCall4 OnDeRezObject; 35 public event GenericCall4 OnDeRezObject;
36 public event GenericCall OnRegionHandShakeReply; 36 public event GenericCall OnRegionHandShakeReply;
37 public event GenericCall OnRequestWearables; 37 public event GenericCall OnRequestWearables;
38 public event GenericCall2 OnCompleteMovementToRegion; 38 public event GenericCall2 OnCompleteMovementToRegion;
39 public event UpdateAgent OnAgentUpdate; 39 public event UpdateAgent OnAgentUpdate;
40 public event GenericCall OnRequestAvatarsData; 40 public event GenericCall OnRequestAvatarsData;
41 public event AddNewPrim OnAddPrim; 41 public event AddNewPrim OnAddPrim;
42 public event ObjectDuplicate OnObjectDuplicate; 42 public event ObjectDuplicate OnObjectDuplicate;
43 public event UpdateVector OnGrapObject; 43 public event UpdateVector OnGrapObject;
44 public event ObjectSelect OnDeGrapObject; 44 public event ObjectSelect OnDeGrapObject;
45 public event MoveObject OnGrapUpdate; 45 public event MoveObject OnGrapUpdate;
46 46
47 public event UpdateShape OnUpdatePrimShape; 47 public event UpdateShape OnUpdatePrimShape;
48 public event ObjectSelect OnObjectSelect; 48 public event ObjectSelect OnObjectSelect;
49 public event GenericCall7 OnObjectDescription; 49 public event GenericCall7 OnObjectDescription;
50 public event GenericCall7 OnObjectName; 50 public event GenericCall7 OnObjectName;
51 public event UpdatePrimFlags OnUpdatePrimFlags; 51 public event UpdatePrimFlags OnUpdatePrimFlags;
52 public event UpdatePrimTexture OnUpdatePrimTexture; 52 public event UpdatePrimTexture OnUpdatePrimTexture;
53 public event UpdateVector OnUpdatePrimGroupPosition; 53 public event UpdateVector OnUpdatePrimGroupPosition;
54 public event UpdateVector OnUpdatePrimSinglePosition; 54 public event UpdateVector OnUpdatePrimSinglePosition;
55 public event UpdatePrimRotation OnUpdatePrimGroupRotation; 55 public event UpdatePrimRotation OnUpdatePrimGroupRotation;
56 public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; 56 public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
57 public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation; 57 public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
58 public event UpdateVector OnUpdatePrimScale; 58 public event UpdateVector OnUpdatePrimScale;
59 public event StatusChange OnChildAgentStatus; 59 public event StatusChange OnChildAgentStatus;
60 public event GenericCall2 OnStopMovement; 60 public event GenericCall2 OnStopMovement;
61 public event NewAvatar OnNewAvatar; 61 public event NewAvatar OnNewAvatar;
62 public event GenericCall6 OnRemoveAvatar; 62 public event GenericCall6 OnRemoveAvatar;
63 63
64 public event UUIDNameRequest OnNameFromUUIDRequest; 64 public event UUIDNameRequest OnNameFromUUIDRequest;
65 65
66 public event ParcelPropertiesRequest OnParcelPropertiesRequest; 66 public event ParcelPropertiesRequest OnParcelPropertiesRequest;
67 public event ParcelDivideRequest OnParcelDivideRequest; 67 public event ParcelDivideRequest OnParcelDivideRequest;
68 public event ParcelJoinRequest OnParcelJoinRequest; 68 public event ParcelJoinRequest OnParcelJoinRequest;
69 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; 69 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
70 70
71 public event ParcelSelectObjects OnParcelSelectObjects; 71 public event ParcelSelectObjects OnParcelSelectObjects;
72 public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest; 72 public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
73 public event ObjectDeselect OnObjectDeselect; 73 public event ObjectDeselect OnObjectDeselect;
74 public event EstateOwnerMessageRequest OnEstateOwnerMessage; 74 public event EstateOwnerMessageRequest OnEstateOwnerMessage;
75 75
76 private LLUUID myID = LLUUID.Random(); 76 private LLUUID myID = LLUUID.Random();
77 public MyNpcCharacter() 77 public MyNpcCharacter()
78 { 78 {
79 79
80 } 80 }
81 81
82 public virtual LLVector3 StartPos 82 public virtual LLVector3 StartPos
83 { 83 {
84 get { return new LLVector3(128, 100, 2); } 84 get { return new LLVector3(128, 100, 2); }
85 set { } 85 set { }
86 } 86 }
87 87
88 public virtual LLUUID AgentId 88 public virtual LLUUID AgentId
89 { 89 {
90 get { return myID; } 90 get { return myID; }
91 } 91 }
92 92
93 public virtual string FirstName 93 public virtual string FirstName
94 { 94 {
95 get { return "Annoying"; } 95 get { return "Annoying"; }
96 } 96 }
97 97
98 public virtual string LastName 98 public virtual string LastName
99 { 99 {
100 get { return "NPC"; } 100 get { return "NPC"; }
101 } 101 }
102 102
103 public virtual void OutPacket(Packet newPack) { } 103 public virtual void OutPacket(Packet newPack) { }
104 public virtual void SendWearables(AvatarWearable[] wearables) { } 104 public virtual void SendWearables(AvatarWearable[] wearables) { }
105 public virtual void SendStartPingCheck(byte seq) { } 105 public virtual void SendStartPingCheck(byte seq) { }
106 public virtual void SendKillObject(ulong regionHandle, uint avatarLocalID) { } 106 public virtual void SendKillObject(ulong regionHandle, uint avatarLocalID) { }
107 public virtual void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId) { } 107 public virtual void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId) { }
108 public virtual void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) { } 108 public virtual void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) { }
109 public virtual void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) { } 109 public virtual void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) { }
110 public virtual void SendInstantMessage(string message, LLUUID target, string fromName) { } 110 public virtual void SendInstantMessage(string message, LLUUID target, string fromName) { }
111 public virtual void SendLayerData(float[] map) { } 111 public virtual void SendLayerData(float[] map) { }
112 public virtual void SendLayerData(int px, int py, float[] map) { } 112 public virtual void SendLayerData(int px, int py, float[] map) { }
113 public virtual void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look) { } 113 public virtual void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look) { }
114 public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint) { } 114 public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint) { }
115 public virtual AgentCircuitData RequestClientInfo() { return new AgentCircuitData(); } 115 public virtual AgentCircuitData RequestClientInfo() { return new AgentCircuitData(); }
116 public virtual void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint newRegionExternalEndPoint) { } 116 public virtual void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint newRegionExternalEndPoint) { }
117 public virtual void SendMapBlock(List<MapBlockData> mapBlocks) { } 117 public virtual void SendMapBlock(List<MapBlockData> mapBlocks) { }
118 public virtual void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags) { } 118 public virtual void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags) { }
119 public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags) { } 119 public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags) { }
120 public virtual void SendTeleportCancel() { } 120 public virtual void SendTeleportCancel() { }
121 public virtual void SendTeleportLocationStart() { } 121 public virtual void SendTeleportLocationStart() { }
122 public virtual void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) { } 122 public virtual void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) { }
123 123
124 public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry) { } 124 public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry) { }
125 public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity) { } 125 public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity) { }
126 126
127 public virtual void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) { } 127 public virtual void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) { }
128 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLQuaternion rotation, LLUUID textureID, uint flags) { } 128 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLQuaternion rotation, LLUUID textureID, uint flags) { }
129 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLUUID textureID, uint flags) { } 129 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLUUID textureID, uint flags) { }
130 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID) { } 130 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID) { }
131 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID) { } 131 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID) { }
132 public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation) { } 132 public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation) { }
133 133
134 public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items) { } 134 public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items) { }
135 public virtual void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item) { } 135 public virtual void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item) { }
136 public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname) { } 136 public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname) { }
137 137
138 public virtual void SendRegionHandshake(RegionInfo regionInfo) 138 public virtual void SendRegionHandshake(RegionInfo regionInfo)
139 { 139 {
140 this.OnRegionHandShakeReply(this); 140 this.OnRegionHandShakeReply(this);
141 this.OnCompleteMovementToRegion(); 141 this.OnCompleteMovementToRegion();
142 this.StartMovement(); 142 this.StartMovement();
143 } 143 }
144 144
145 public void StartMovement() 145 public void StartMovement()
146 { 146 {
147 Timer timer = new Timer(); 147 Timer timer = new Timer();
148 timer.Enabled = true; 148 timer.Enabled = true;
149 timer.Interval = 500; 149 timer.Interval = 500;
150 timer.Elapsed += new ElapsedEventHandler(this.Heartbeat); 150 timer.Elapsed += new ElapsedEventHandler(this.Heartbeat);
151 } 151 }
152 152
153 public void Heartbeat(object sender, EventArgs e) 153 public void Heartbeat(object sender, EventArgs e)
154 { 154 {
155 Encoding enc = Encoding.ASCII; 155 Encoding enc = Encoding.ASCII;
156 156
157 this.OnAgentUpdate(this, movementFlag, bodyDirection); 157 this.OnAgentUpdate(this, movementFlag, bodyDirection);
158 158
159 if (this.flyState == 0) 159 if (this.flyState == 0)
160 { 160 {
161 movementFlag = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY | (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG; 161 movementFlag = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY | (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG;
162 flyState = 1; 162 flyState = 1;
163 } 163 }
164 else if (this.flyState == 1) 164 else if (this.flyState == 1)
165 { 165 {
166 movementFlag = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY | (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS; 166 movementFlag = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY | (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS;
167 flyState = 2; 167 flyState = 2;
168 } 168 }
169 else 169 else
170 { 170 {
171 movementFlag = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY; 171 movementFlag = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY;
172 flyState = 0; 172 flyState = 0;
173 } 173 }
174 174
175 if (count >= 40) 175 if (count >= 40)
176 { 176 {
177 this.OnChatFromViewer(enc.GetBytes("Kind of quiet around here, isn't it! \0"), 2, new LLVector3(128, 128, 26), this.FirstName + " " + this.LastName, this.AgentId); 177 this.OnChatFromViewer(enc.GetBytes("Kind of quiet around here, isn't it! \0"), 2, new LLVector3(128, 128, 26), this.FirstName + " " + this.LastName, this.AgentId);
178 count = -1; 178 count = -1;
179 } 179 }
180 180
181 count++; 181 count++;
182 } 182 }
183 } 183 }
184} 184}
diff --git a/OpenSim/Region/Examples/SimpleApp/MySceneObject.cs b/OpenSim/Region/Examples/SimpleApp/MySceneObject.cs
index aab52cc..f5c6a0f 100644
--- a/OpenSim/Region/Examples/SimpleApp/MySceneObject.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MySceneObject.cs
@@ -1,40 +1,40 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using OpenSim.Region.Environment.Scenes; 4using OpenSim.Region.Environment.Scenes;
5using libsecondlife; 5using libsecondlife;
6using OpenSim.Framework.Types; 6using OpenSim.Framework.Types;
7using System.Timers; 7using System.Timers;
8using System.Diagnostics; 8using System.Diagnostics;
9 9
10namespace SimpleApp 10namespace SimpleApp
11{ 11{
12 public class MySceneObject : SceneObject 12 public class MySceneObject : SceneObject
13 { 13 {
14 private PerformanceCounter m_counter; 14 private PerformanceCounter m_counter;
15 15
16 public MySceneObject(Scene world, EventManager eventManager, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) 16 public MySceneObject(Scene world, EventManager eventManager, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape)
17 : base(world, eventManager, ownerID, localID, pos, shape ) 17 : base(world, eventManager, ownerID, localID, pos, shape )
18 { 18 {
19 String objectName = "Processor"; 19 String objectName = "Processor";
20 String counterName = "% Processor Time"; 20 String counterName = "% Processor Time";
21 String instanceName = "_Total"; 21 String instanceName = "_Total";
22 22
23 m_counter = new PerformanceCounter(objectName, counterName, instanceName); 23 m_counter = new PerformanceCounter(objectName, counterName, instanceName);
24 24
25 Timer timer = new Timer(); 25 Timer timer = new Timer();
26 timer.Enabled = true; 26 timer.Enabled = true;
27 timer.Interval = 100; 27 timer.Interval = 100;
28 timer.Elapsed += new ElapsedEventHandler(this.Heartbeat); 28 timer.Elapsed += new ElapsedEventHandler(this.Heartbeat);
29 29
30 } 30 }
31 31
32 public void Heartbeat(object sender, EventArgs e) 32 public void Heartbeat(object sender, EventArgs e)
33 { 33 {
34 float cpu = m_counter.NextValue() / 40f; 34 float cpu = m_counter.NextValue() / 40f;
35 LLVector3 size = new LLVector3(cpu, cpu, cpu); 35 LLVector3 size = new LLVector3(cpu, cpu, cpu);
36 rootPrimitive.ResizeGoup( size ); 36 rootPrimitive.ResizeGoup( size );
37 update(); 37 update();
38 } 38 }
39 } 39 }
40} 40}
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 @@
1using System.Collections.Generic; 1using System.Collections.Generic;
2using libsecondlife; 2using libsecondlife;
3using OpenSim.Framework; 3using OpenSim.Framework;
4using OpenSim.Framework.Communications; 4using OpenSim.Framework.Communications;
5using OpenSim.Framework.Interfaces; 5using OpenSim.Framework.Interfaces;
6using OpenSim.Framework.Servers; 6using OpenSim.Framework.Servers;
7using OpenSim.Framework.Types; 7using OpenSim.Framework.Types;
8using OpenSim.Region.Caches; 8using OpenSim.Region.Caches;
9using OpenSim.Region.Environment.Scenes; 9using OpenSim.Region.Environment.Scenes;
10using OpenSim.Region.Terrain; 10using OpenSim.Region.Terrain;
11using OpenSim.Region.Environment; 11using OpenSim.Region.Environment;
12 12
13using Avatar=OpenSim.Region.Environment.Scenes.ScenePresence; 13using Avatar=OpenSim.Region.Environment.Scenes.ScenePresence;
14 14
15namespace SimpleApp 15namespace 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}
diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs
index c3edf0c..f82bdcb 100644
--- a/OpenSim/Region/Examples/SimpleApp/Program.cs
+++ b/OpenSim/Region/Examples/SimpleApp/Program.cs
@@ -1,126 +1,126 @@
1using System; 1using System;
2using System.Net; 2using System.Net;
3using libsecondlife; 3using libsecondlife;
4using OpenSim.Assets; 4using OpenSim.Assets;
5using OpenSim.Framework; 5using OpenSim.Framework;
6using OpenSim.Framework.Console; 6using OpenSim.Framework.Console;
7using OpenSim.Framework.Interfaces; 7using OpenSim.Framework.Interfaces;
8using OpenSim.Framework.Servers; 8using OpenSim.Framework.Servers;
9using OpenSim.Framework.Types; 9using OpenSim.Framework.Types;
10using OpenSim.Physics.Manager; 10using OpenSim.Physics.Manager;
11using OpenSim.Region.Caches; 11using OpenSim.Region.Caches;
12using OpenSim.Region.Capabilities; 12using OpenSim.Region.Capabilities;
13using OpenSim.Region.ClientStack; 13using OpenSim.Region.ClientStack;
14using OpenSim.Region.Communications.Local; 14using OpenSim.Region.Communications.Local;
15using OpenSim.Region.GridInterfaces.Local; 15using OpenSim.Region.GridInterfaces.Local;
16using System.Timers; 16using System.Timers;
17using OpenSim.Region.Environment.Scenes; 17using OpenSim.Region.Environment.Scenes;
18using OpenSim.Framework.Data; 18using OpenSim.Framework.Data;
19 19
20namespace SimpleApp 20namespace SimpleApp
21{ 21{
22 class Program : conscmd_callback 22 class Program : conscmd_callback
23 { 23 {
24 private LogBase m_log; 24 private LogBase m_log;
25 AuthenticateSessionsBase m_circuitManager; 25 AuthenticateSessionsBase m_circuitManager;
26 uint m_localId; 26 uint m_localId;
27 public MyWorld world; 27 public MyWorld world;
28 private SceneObject m_sceneObject; 28 private SceneObject m_sceneObject;
29 public MyNpcCharacter m_character; 29 public MyNpcCharacter m_character;
30 30
31 private void Run() 31 private void Run()
32 { 32 {
33 m_log = new LogBase(null, "SimpleApp", this, false); 33 m_log = new LogBase(null, "SimpleApp", this, false);
34 MainLog.Instance = m_log; 34 MainLog.Instance = m_log;
35 35
36 // CheckSumServer checksumServer = new CheckSumServer(12036); 36 // CheckSumServer checksumServer = new CheckSumServer(12036);
37 // checksumServer.ServerListener(); 37 // checksumServer.ServerListener();
38 38
39 IPEndPoint internalEndPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 9000); 39 IPEndPoint internalEndPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 9000);
40 40
41 m_circuitManager = new AuthenticateSessionsBase(); 41 m_circuitManager = new AuthenticateSessionsBase();
42 42
43 InventoryCache inventoryCache = new InventoryCache(); 43 InventoryCache inventoryCache = new InventoryCache();
44 44
45 LocalAssetServer assetServer = new LocalAssetServer(); 45 LocalAssetServer assetServer = new LocalAssetServer();
46 assetServer.SetServerInfo("http://127.0.0.1:8003/", ""); 46 assetServer.SetServerInfo("http://127.0.0.1:8003/", "");
47 47
48 AssetCache assetCache = new AssetCache(assetServer); 48 AssetCache assetCache = new AssetCache(assetServer);
49 49
50 ScenePresence.LoadTextureFile("avatar-texture.dat"); 50 ScenePresence.LoadTextureFile("avatar-texture.dat");
51 ScenePresence.PhysicsEngineFlying = true; 51 ScenePresence.PhysicsEngineFlying = true;
52 52
53 PhysicsManager physManager = new PhysicsManager(); 53 PhysicsManager physManager = new PhysicsManager();
54 physManager.LoadPlugins(); 54 physManager.LoadPlugins();
55 55
56 UDPServer udpServer = new UDPServer(internalEndPoint.Port, assetCache, inventoryCache, m_log, m_circuitManager); 56 UDPServer udpServer = new UDPServer(internalEndPoint.Port, assetCache, inventoryCache, m_log, m_circuitManager);
57 PacketServer packetServer = new PacketServer(udpServer); 57 PacketServer packetServer = new PacketServer(udpServer);
58 58
59 ClientView.TerrainManager = new TerrainManager(new SecondLife()); 59 ClientView.TerrainManager = new TerrainManager(new SecondLife());
60 BaseHttpServer httpServer = new BaseHttpServer(internalEndPoint.Port); 60 BaseHttpServer httpServer = new BaseHttpServer(internalEndPoint.Port);
61 61
62 NetworkServersInfo serverInfo = new NetworkServersInfo(); 62 NetworkServersInfo serverInfo = new NetworkServersInfo();
63 CommunicationsLocal communicationsManager = new CommunicationsLocal(serverInfo, httpServer); 63 CommunicationsLocal communicationsManager = new CommunicationsLocal(serverInfo, httpServer);
64 64
65 RegionInfo regionInfo = new RegionInfo(1000, 1000, internalEndPoint, "127.0.0.1"); 65 RegionInfo regionInfo = new RegionInfo(1000, 1000, internalEndPoint, "127.0.0.1");
66 66
67 OpenSim.Region.Environment.StorageManager storeMan = new OpenSim.Region.Environment.StorageManager("OpenSim.DataStore.NullStorage.dll", "simpleapp.yap", "simpleapp"); 67 OpenSim.Region.Environment.StorageManager storeMan = new OpenSim.Region.Environment.StorageManager("OpenSim.DataStore.NullStorage.dll", "simpleapp.yap", "simpleapp");
68 68
69 world = new MyWorld( regionInfo, m_circuitManager, communicationsManager, assetCache, storeMan, httpServer); 69 world = new MyWorld( regionInfo, m_circuitManager, communicationsManager, assetCache, storeMan, httpServer);
70 world.PhysScene = physManager.GetPhysicsScene("basicphysics"); //PhysicsScene.Null; 70 world.PhysScene = physManager.GetPhysicsScene("basicphysics"); //PhysicsScene.Null;
71 71
72 world.LoadWorldMap(); 72 world.LoadWorldMap();
73 world.PhysScene.SetTerrain(world.Terrain.getHeights1D()); 73 world.PhysScene.SetTerrain(world.Terrain.getHeights1D());
74 world.performParcelPrimCountUpdate(); 74 world.performParcelPrimCountUpdate();
75 75
76 udpServer.LocalWorld = world; 76 udpServer.LocalWorld = world;
77 77
78 httpServer.Start(); 78 httpServer.Start();
79 udpServer.ServerListener(); 79 udpServer.ServerListener();
80 80
81 UserProfileData masterAvatar = communicationsManager.UserServer.SetupMasterUser("Test", "User", "test"); 81 UserProfileData masterAvatar = communicationsManager.UserServer.SetupMasterUser("Test", "User", "test");
82 if (masterAvatar != null) 82 if (masterAvatar != null)
83 { 83 {
84 world.RegionInfo.MasterAvatarAssignedUUID = masterAvatar.UUID; 84 world.RegionInfo.MasterAvatarAssignedUUID = masterAvatar.UUID;
85 world.ParcelManager.NoParcelDataFromStorage(); 85 world.ParcelManager.NoParcelDataFromStorage();
86 } 86 }
87 87
88 world.StartTimer(); 88 world.StartTimer();
89 89
90 PrimitiveBaseShape shape = PrimitiveBaseShape.DefaultBox(); 90 PrimitiveBaseShape shape = PrimitiveBaseShape.DefaultBox();
91 shape.Scale = new LLVector3(0.5f, 0.5f, 0.5f); 91 shape.Scale = new LLVector3(0.5f, 0.5f, 0.5f);
92 LLVector3 pos = new LLVector3(138, 129, 27); 92 LLVector3 pos = new LLVector3(138, 129, 27);
93 93
94 m_sceneObject = new MySceneObject(world, world.EventManager, LLUUID.Zero, world.PrimIDAllocate(), pos, shape); 94 m_sceneObject = new MySceneObject(world, world.EventManager, LLUUID.Zero, world.PrimIDAllocate(), pos, shape);
95 world.AddEntity(m_sceneObject); 95 world.AddEntity(m_sceneObject);
96 96
97 m_character = new MyNpcCharacter(); 97 m_character = new MyNpcCharacter();
98 world.AddNewClient(m_character, false); 98 world.AddNewClient(m_character, false);
99 99
100 m_log.WriteLine(LogPriority.NORMAL, "Press enter to quit."); 100 m_log.WriteLine(LogPriority.NORMAL, "Press enter to quit.");
101 m_log.ReadLine(); 101 m_log.ReadLine();
102 102
103 } 103 }
104 104
105 #region conscmd_callback Members 105 #region conscmd_callback Members
106 106
107 public void RunCmd(string cmd, string[] cmdparams) 107 public void RunCmd(string cmd, string[] cmdparams)
108 { 108 {
109 throw new Exception("The method or operation is not implemented."); 109 throw new Exception("The method or operation is not implemented.");
110 } 110 }
111 111
112 public void Show(string ShowWhat) 112 public void Show(string ShowWhat)
113 { 113 {
114 throw new Exception("The method or operation is not implemented."); 114 throw new Exception("The method or operation is not implemented.");
115 } 115 }
116 116
117 #endregion 117 #endregion
118 118
119 static void Main(string[] args) 119 static void Main(string[] args)
120 { 120 {
121 Program app = new Program(); 121 Program app = new Program();
122 122
123 app.Run(); 123 app.Run();
124 } 124 }
125 } 125 }
126} 126}
diff --git a/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs b/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs
index 3b0de8a..2250613 100644
--- a/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs
@@ -1,31 +1,31 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.InteropServices; 2using System.Runtime.InteropServices;
3// General Information about an assembly is controlled through the following 3// General Information about an assembly is controlled through the following
4// set of attributes. Change these attribute values to modify the information 4// set of attributes. Change these attribute values to modify the information
5// associated with an assembly. 5// associated with an assembly.
6[assembly: AssemblyTitle("SimpleApp")] 6[assembly: AssemblyTitle("SimpleApp")]
7[assembly: AssemblyDescription("")] 7[assembly: AssemblyDescription("")]
8[assembly: AssemblyConfiguration("")] 8[assembly: AssemblyConfiguration("")]
9[assembly: AssemblyCompany("Playahead AB")] 9[assembly: AssemblyCompany("Playahead AB")]
10[assembly: AssemblyProduct("SimpleApp")] 10[assembly: AssemblyProduct("SimpleApp")]
11[assembly: AssemblyCopyright("Copyright © Playahead AB 2007")] 11[assembly: AssemblyCopyright("Copyright © Playahead AB 2007")]
12[assembly: AssemblyTrademark("")] 12[assembly: AssemblyTrademark("")]
13[assembly: AssemblyCulture("")] 13[assembly: AssemblyCulture("")]
14 14
15// Setting ComVisible to false makes the types in this assembly not visible 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 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. 17// COM, set the ComVisible attribute to true on that type.
18[assembly: ComVisible(false)] 18[assembly: ComVisible(false)]
19 19
20// The following GUID is for the ID of the typelib if this project is exposed to COM 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")] 21[assembly: Guid("a5cfa45f-5acf-4b2e-9c50-1dd1fd7608ee")]
22 22
23// Version information for an assembly consists of the following four values: 23// Version information for an assembly consists of the following four values:
24// 24//
25// Major Version 25// Major Version
26// Minor Version 26// Minor Version
27// Build Number 27// Build Number
28// Revision 28// Revision
29// 29//
30[assembly: AssemblyVersion("1.0.0.0")] 30[assembly: AssemblyVersion("1.0.0.0")]
31[assembly: AssemblyFileVersion("1.0.0.0")] 31[assembly: AssemblyFileVersion("1.0.0.0")]