From 67e12b95ea7b68f4904a7484d77ecfd787d16d0c Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Tue, 30 Oct 2007 09:05:31 +0000 Subject: * Optimized usings * Shortened type references * Removed redundant 'this' qualifier --- OpenSim/Region/Examples/SimpleApp/ComplexObject.cs | 65 +++-- .../Region/Examples/SimpleApp/CpuCounterObject.cs | 25 +- .../Region/Examples/SimpleApp/FileSystemObject.cs | 14 +- .../Region/Examples/SimpleApp/MyNpcCharacter.cs | 286 +++++++++++++++------ OpenSim/Region/Examples/SimpleApp/MyWorld.cs | 32 +-- OpenSim/Region/Examples/SimpleApp/Program.cs | 87 ++++--- .../Examples/SimpleApp/Properties/AssemblyInfo.cs | 31 ++- 7 files changed, 342 insertions(+), 198 deletions(-) (limited to 'OpenSim/Region/Examples') diff --git a/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs b/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs index f5a080f..bfd9d06 100644 --- a/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs +++ b/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs @@ -26,60 +26,69 @@ * */ -using System; -using System.Collections.Generic; -using System.Text; -using OpenSim.Region.Environment.Scenes; -using Axiom.Math; using libsecondlife; using OpenSim.Framework; -using OpenSim.Framework.Interfaces; +using OpenSim.Region.Environment.Scenes; namespace SimpleApp { public class ComplexObject : SceneObjectGroup { private LLQuaternion m_rotationDirection; - + private class RotatingWheel : SceneObjectPart { private LLQuaternion m_rotationDirection; - public RotatingWheel(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, LLVector3 groupPosition, LLVector3 offsetPosition, LLQuaternion rotationDirection) - : base(regionHandle, parent, ownerID, localID, new CylinderShape( 0.5f, 0.2f ), groupPosition, offsetPosition ) + public RotatingWheel(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, + LLVector3 groupPosition, LLVector3 offsetPosition, LLQuaternion rotationDirection) + : base( + regionHandle, parent, ownerID, localID, new CylinderShape(0.5f, 0.2f), groupPosition, offsetPosition + ) { - m_rotationDirection = rotationDirection; + m_rotationDirection = rotationDirection; } public override void UpdateMovement() { - UpdateRotation(RotationOffset * m_rotationDirection); + UpdateRotation(RotationOffset*m_rotationDirection); } } public override void UpdateMovement() { - UpdateGroupRotation(GroupRotation * m_rotationDirection); - + UpdateGroupRotation(GroupRotation*m_rotationDirection); + base.UpdateMovement(); } - - - public ComplexObject(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos ) - : base(scene, regionHandle, ownerID, localID, pos, BoxShape.Default ) + + public ComplexObject(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos) + : base(scene, regionHandle, ownerID, localID, pos, BoxShape.Default) { m_rotationDirection = new LLQuaternion(0.05f, 0.1f, 0.15f); - AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, 0.75f), new LLQuaternion(0.05f,0,0))); - AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, -0.75f), new LLQuaternion(-0.05f,0,0))); + AddPart( + new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, 0.75f), + new LLQuaternion(0.05f, 0, 0))); + AddPart( + new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, -0.75f), + new LLQuaternion(-0.05f, 0, 0))); + + AddPart( + new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0.75f, 0), + new LLQuaternion(0.5f, 0, 0.05f))); + AddPart( + new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, -0.75f, 0), + new LLQuaternion(-0.5f, 0, -0.05f))); - AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0.75f,0), new LLQuaternion(0.5f, 0, 0.05f))); - AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, -0.75f,0), new LLQuaternion(-0.5f, 0, -0.05f))); + AddPart( + new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0.75f, 0, 0), + new LLQuaternion(0, 0.5f, 0.05f))); + AddPart( + new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(-0.75f, 0, 0), + new LLQuaternion(0, -0.5f, -0.05f))); - AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0.75f, 0, 0), new LLQuaternion(0, 0.5f, 0.05f))); - AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(-0.75f, 0, 0), new LLQuaternion(0, -0.5f, -0.05f))); - UpdateParentIDs(); } @@ -88,12 +97,12 @@ namespace SimpleApp m_parts.Remove(part.UUID); remoteClient.SendKillObject(m_regionHandle, part.LocalID); remoteClient.AddMoney(1); - remoteClient.SendChatMessage("Poof!", 1, this.AbsolutePosition, "Party Party", LLUUID.Zero); + remoteClient.SendChatMessage("Poof!", 1, AbsolutePosition, "Party Party", LLUUID.Zero); } - public override void OnGrabGroup( LLVector3 offsetPos, IClientAPI remoteClient) + public override void OnGrabGroup(LLVector3 offsetPos, IClientAPI remoteClient) { - if( m_parts.Count == 1 ) + if (m_parts.Count == 1) { m_parts.Remove(m_rootPart.UUID); m_scene.RemoveEntity(this); @@ -103,4 +112,4 @@ namespace SimpleApp } } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs b/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs index 0f833ea..cbc4dea 100644 --- a/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs +++ b/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs @@ -27,37 +27,34 @@ */ using System; -using System.Collections.Generic; -using System.Text; -using OpenSim.Region.Environment.Scenes; +using System.Diagnostics; using libsecondlife; using OpenSim.Framework; -using System.Timers; -using System.Diagnostics; +using OpenSim.Region.Environment.Scenes; namespace SimpleApp { public class CpuCounterObject : SceneObjectGroup { private PerformanceCounter m_counter; - - public CpuCounterObject(Scene world, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos ) - : base(world, regionHandle, ownerID, localID, pos, BoxShape.Default ) + + public CpuCounterObject(Scene world, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos) + : base(world, regionHandle, ownerID, localID, pos, BoxShape.Default) { String objectName = "Processor"; String counterName = "% Processor Time"; String instanceName = "_Total"; - + m_counter = new PerformanceCounter(objectName, counterName, instanceName); } - public override void UpdateMovement( ) + public override void UpdateMovement() { - float cpu = m_counter.NextValue() / 40f; - LLVector3 size = new LLVector3(cpu, cpu, cpu); + float cpu = m_counter.NextValue()/40f; + LLVector3 size = new LLVector3(cpu, cpu, cpu); //rootPrimitive.ResizeGoup( size ); - + base.UpdateMovement(); } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs b/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs index 746340f..7b1420b 100644 --- a/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs +++ b/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs @@ -27,14 +27,10 @@ */ using System; -using System.Collections.Generic; -using System.Text; -using OpenSim.Region.Environment.Scenes; +using System.IO; using libsecondlife; using OpenSim.Framework; -using System.Timers; -using System.Diagnostics; -using System.IO; +using OpenSim.Region.Environment.Scenes; namespace SimpleApp { @@ -43,9 +39,7 @@ namespace SimpleApp public FileSystemObject(Scene world, FileInfo fileInfo, LLVector3 pos) : base(world, world.RegionInfo.RegionHandle, LLUUID.Zero, world.NextLocalId, pos, BoxShape.Default) { - - - float size = (float)Math.Pow((double)fileInfo.Length, (double)1 / 3) / 5; + float size = (float) Math.Pow((double) fileInfo.Length, (double) 1/3)/5; // rootPrimitive.ResizeGoup(new LLVector3(size, size, size)); Text = fileInfo.Name; ScheduleGroupForFullUpdate(); @@ -56,4 +50,4 @@ namespace SimpleApp base.Update(); } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index 03e0f98..f7fdbb5 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs @@ -26,16 +26,14 @@ * */ +using System; using System.Collections.Generic; using System.Net; using System.Text; using libsecondlife; using libsecondlife.Packets; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework; using OpenSim.Framework; using OpenSim.Region.Environment.Scenes; -using System; namespace SimpleApp { @@ -126,13 +124,15 @@ namespace SimpleApp #pragma warning restore 67 private LLUUID myID = LLUUID.Random(); - public MyNpcCharacter( EventManager eventManager ) + + public MyNpcCharacter(EventManager eventManager) { - // startPos = new LLVector3(128, (float)(Util.RandomClass.NextDouble()*100), 2); + // startPos = new LLVector3(128, (float)(Util.RandomClass.NextDouble()*100), 2); eventManager.OnFrame += Update; } - private LLVector3 startPos = new LLVector3(128, 128,2); + private LLVector3 startPos = new LLVector3(128, 128, 2); + public virtual LLVector3 StartPos { get { return startPos; } @@ -155,92 +155,218 @@ namespace SimpleApp } private string lastName = "NPC" + Util.RandomClass.Next(1, 1000); + public virtual string LastName { get { return lastName; } } - public virtual void OutPacket(Packet newPack) { } - public virtual void SendWearables(AvatarWearable[] wearables) { } - public virtual void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry) { } - public virtual void SendStartPingCheck(byte seq) { } - public virtual void SendKillObject(ulong regionHandle, uint localID) { } - public virtual void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId) { } - public virtual void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) { } - public virtual void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) { } - public virtual void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, LLUUID imSessionID, string fromName, byte dialog, uint timeStamp) { } - public virtual void SendLayerData(float[] map) { } - public virtual void SendLayerData(int px, int py, float[] map) { } - public virtual void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look) { } - public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint) { } - public virtual AgentCircuitData RequestClientInfo() { return new AgentCircuitData(); } - public virtual void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint newRegionExternalEndPoint, string capsURL) { } - public virtual void SendMapBlock(List mapBlocks) { } - public virtual void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags) { } - public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags, string capsURL) { } - public virtual void SendTeleportCancel() { } - public virtual void SendTeleportLocationStart() { } - public virtual void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) { } - - public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID) { } - public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity, LLQuaternion rotation) { } - public virtual void SendCoarseLocationUpdate(List CoarseLocations) { } - - public virtual void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) { } - - public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID, byte[] particleSystem, LLQuaternion rotation) { } - public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation) { } - - public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List items) { } - public virtual void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item) { } - public virtual void SendInventoryItemUpdate(InventoryItemBase Item) { } - public virtual void SendRemoveInventoryItem(LLUUID itemID) { } - public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) { } - public virtual void SendXferPacket(ulong xferID, uint packet, byte[] data) { } - - public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname) { } - - public virtual void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID) { } - public virtual void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags) { } - - public void SendAlertMessage(string message) { } - public void SendAgentAlertMessage(string message, bool modal) { } - public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url) { } + public virtual void OutPacket(Packet newPack) + { + } + + public virtual void SendWearables(AvatarWearable[] wearables) + { + } + + public virtual void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry) + { + } + + public virtual void SendStartPingCheck(byte seq) + { + } + + public virtual void SendKillObject(ulong regionHandle, uint localID) + { + } + + public virtual void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId) + { + } + + public virtual void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, + LLUUID fromAgentID) + { + } + + public virtual void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, + LLUUID fromAgentID) + { + } + + public virtual void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, + LLUUID imSessionID, string fromName, byte dialog, uint timeStamp) + { + } + + public virtual void SendLayerData(float[] map) + { + } + + public virtual void SendLayerData(int px, int py, float[] map) + { + } + + public virtual void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look) + { + } + + public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint) + { + } + + public virtual AgentCircuitData RequestClientInfo() + { + return new AgentCircuitData(); + } + + public virtual void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, + IPEndPoint newRegionExternalEndPoint, string capsURL) + { + } + + public virtual void SendMapBlock(List mapBlocks) + { + } + + public virtual void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags) + { + } + + public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, + uint locationID, uint flags, string capsURL) + { + } + + public virtual void SendTeleportCancel() + { + } + + public virtual void SendTeleportLocationStart() + { + } + + public virtual void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) + { + } + + public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, + uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID) + { + } + + public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, + LLVector3 position, LLVector3 velocity, LLQuaternion rotation) + { + } + + public virtual void SendCoarseLocationUpdate(List CoarseLocations) + { + } + + public virtual void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) + { + } + + public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, + PrimitiveBaseShape primShape, LLVector3 pos, uint flags, + LLUUID objectID, LLUUID ownerID, string text, uint parentID, + byte[] particleSystem, LLQuaternion rotation) + { + } + + public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, + LLVector3 position, LLQuaternion rotation) + { + } + + public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List items) + { + } + + public virtual void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item) + { + } + + public virtual void SendInventoryItemUpdate(InventoryItemBase Item) + { + } + + public virtual void SendRemoveInventoryItem(LLUUID itemID) + { + } + + public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) + { + } + + public virtual void SendXferPacket(ulong xferID, uint packet, byte[] data) + { + } + + public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname) + { + } + + public virtual void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID) + { + } + + public virtual void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, + byte flags) + { + } + + public void SendAlertMessage(string message) + { + } + + public void SendAgentAlertMessage(string message, bool modal) + { + } + + public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, + string url) + { + } public virtual void SendRegionHandshake(RegionInfo regionInfo) { if (OnRegionHandShakeReply != null) { - this.OnRegionHandShakeReply(this); + OnRegionHandShakeReply(this); } if (OnCompleteMovementToRegion != null) { - this.OnCompleteMovementToRegion(); + OnCompleteMovementToRegion(); } } - private void Update( ) + private void Update() { Encoding enc = Encoding.ASCII; - if (this.OnAgentUpdate != null) + if (OnAgentUpdate != null) { - this.OnAgentUpdate(this, movementFlag, bodyDirection); + OnAgentUpdate(this, movementFlag, bodyDirection); } - if (this.flyState == 0) + if (flyState == 0) { - movementFlag = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY | (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG; + movementFlag = (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY | + (uint) MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG; flyState = 1; } - else if (this.flyState == 1) + else if (flyState == 1) { - movementFlag = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY | (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS; + movementFlag = (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY | + (uint) MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS; flyState = 2; } else { - movementFlag = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY; + movementFlag = (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY; flyState = 0; } @@ -251,15 +377,14 @@ namespace SimpleApp ChatFromViewerArgs args = new ChatFromViewerArgs(); args.Message = "Kinda quiet around here, isn't it?"; args.Channel = 0; - args.From = this.FirstName + " " + this.LastName; + args.From = FirstName + " " + LastName; args.Position = new LLVector3(128, 128, 26); args.Sender = this; args.Type = ChatTypeEnum.Shout; - this.OnChatFromViewer(this, args); + OnChatFromViewer(this, args); } count = -1; - } count++; @@ -270,9 +395,19 @@ namespace SimpleApp return false; } - public void SendViewerTime(int phase) { } - public void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID) { } - public void SetDebug(int newDebug) { } + public void SendViewerTime(int phase) + { + } + + public void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, + string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, + LLUUID partnerID) + { + } + + public void SetDebug(int newDebug) + { + } public void InPacket(Packet NewPack) { @@ -281,22 +416,17 @@ namespace SimpleApp public void Close() { } - + private uint m_circuitCode; + public uint CircuitCode { - get - { - return m_circuitCode; - } - set - { - m_circuitCode = value; - } + get { return m_circuitCode; } + set { m_circuitCode = value; } } public void SendLogoutPacket() { } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs index 9a7b340..c616f6a 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs @@ -31,13 +31,9 @@ using libsecondlife; using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Framework.Communications.Cache; -using OpenSim.Framework.Interfaces; using OpenSim.Framework.Servers; -using OpenSim.Framework; - -using OpenSim.Region.Environment.Scenes; -using OpenSim.Region.Terrain; using OpenSim.Region.Environment; +using OpenSim.Region.Environment.Scenes; using Avatar=OpenSim.Region.Environment.Scenes.ScenePresence; namespace SimpleApp @@ -46,8 +42,10 @@ namespace SimpleApp { private List m_avatars; - public MyWorld( RegionInfo regionInfo, AgentCircuitManager authen, CommunicationsManager commsMan, AssetCache assetCach, StorageManager storeMan, BaseHttpServer httpServer, ModuleLoader moduleLoader) - : base( regionInfo, authen, commsMan, assetCach, storeMan, httpServer, moduleLoader, false) + public MyWorld(RegionInfo regionInfo, AgentCircuitManager authen, CommunicationsManager commsMan, + AssetCache assetCach, StorageManager storeMan, BaseHttpServer httpServer, + ModuleLoader moduleLoader) + : base(regionInfo, authen, commsMan, assetCach, storeMan, httpServer, moduleLoader, false) { m_avatars = new List(); } @@ -58,32 +56,30 @@ namespace SimpleApp for (int i = 0; i < 65536; i++) { - int x = i % 256; - int y = i / 256; + int x = i%256; + int y = i/256; map[i] = 25f; } - this.Terrain.GetHeights1D(map); - this.CreateTerrainTexture(); + Terrain.GetHeights1D(map); + CreateTerrainTexture(); } - override public void AddNewClient(IClientAPI client, bool child) + public override void AddNewClient(IClientAPI client, bool child) { SubscribeToClientEvents(client); - ScenePresence avatar = CreateAndAddScenePresence(client, child ); + ScenePresence avatar = CreateAndAddScenePresence(client, child); avatar.AbsolutePosition = new LLVector3(128, 128, 26); LLVector3 pos = new LLVector3(128, 128, 128); - client.OnCompleteMovementToRegion += delegate() - { - client.SendChatMessage("Welcome to My World.", 1, pos, "System", LLUUID.Zero ); - }; + client.OnCompleteMovementToRegion += + delegate() { client.SendChatMessage("Welcome to My World.", 1, pos, "System", LLUUID.Zero); }; client.SendRegionHandshake(m_regInfo); } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index 72aaf6b..b37c2ee 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs @@ -31,23 +31,23 @@ using System.Collections.Generic; using System.IO; using System.Net; using libsecondlife; +using Nini.Config; +using OpenSim.Framework; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Console; -using OpenSim.Framework; using OpenSim.Region.ClientStack; using OpenSim.Region.Communications.Local; using OpenSim.Region.Environment; using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Physics.Manager; -using Nini.Config; namespace SimpleApp { - class Program : RegionApplicationBase, conscmd_callback + internal class Program : RegionApplicationBase, conscmd_callback { private ModuleLoader m_moduleLoader; private IConfigSource m_config; - + protected override LogBase CreateLog() { return new LogBase(null, "SimpleApp", this, true); @@ -57,45 +57,51 @@ namespace SimpleApp { StartLog(); - m_networkServersInfo = new NetworkServersInfo( 1000, 1000 ); + m_networkServersInfo = new NetworkServersInfo(1000, 1000); LocalAssetServer assetServer = new LocalAssetServer(); m_assetCache = new AssetCache(assetServer); } - + public void Run() { base.StartUp(); - + LocalInventoryService inventoryService = new LocalInventoryService(); - LocalUserServices userService = new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX, m_networkServersInfo.DefaultHomeLocY, inventoryService); + LocalUserServices userService = + new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX, + m_networkServersInfo.DefaultHomeLocY, inventoryService); LocalBackEndServices backendService = new LocalBackEndServices(); - CommunicationsLocal localComms = new CommunicationsLocal(m_networkServersInfo, m_httpServer, m_assetCache, userService, inventoryService, backendService, backendService, false); + CommunicationsLocal localComms = + new CommunicationsLocal(m_networkServersInfo, m_httpServer, m_assetCache, userService, inventoryService, + backendService, backendService, false); m_commsManager = localComms; - LocalLoginService loginService = new LocalLoginService(userService, "", localComms, m_networkServersInfo, false); + LocalLoginService loginService = + new LocalLoginService(userService, "", localComms, m_networkServersInfo, false); loginService.OnLoginToRegion += backendService.AddNewSession; m_httpServer.AddXmlRPCHandler("login_to_simulator", loginService.XmlRpcLoginMethod); m_log.Notice(m_log.LineInfo); - - IPEndPoint internalEndPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), m_networkServersInfo.HttpListenerPort); + + IPEndPoint internalEndPoint = + new IPEndPoint(IPAddress.Parse("127.0.0.1"), m_networkServersInfo.HttpListenerPort); RegionInfo regionInfo = new RegionInfo(1000, 1000, internalEndPoint, "localhost"); regionInfo.DataStore = "simpleapp_datastore.yap"; - + UDPServer udpServer; - m_moduleLoader = new ModuleLoader( m_log, m_config ); + m_moduleLoader = new ModuleLoader(m_log, m_config); m_moduleLoader.LoadDefaultSharedModules(); Scene scene = SetupScene(regionInfo, out udpServer); m_moduleLoader.InitialiseSharedModules(scene); - + scene.SetModuleInterfaces(); scene.StartTimer(); @@ -104,18 +110,22 @@ namespace SimpleApp m_moduleLoader.PostInitialise(); m_moduleLoader.ClearCache(); - + udpServer.ServerListener(); - + LLVector3 pos = new LLVector3(110, 129, 27); - SceneObjectGroup sceneObject = new CpuCounterObject(scene, regionInfo.RegionHandle, LLUUID.Zero, scene.PrimIDAllocate(), pos + new LLVector3( 1f, 1f, 1f )); + SceneObjectGroup sceneObject = + new CpuCounterObject(scene, regionInfo.RegionHandle, LLUUID.Zero, scene.PrimIDAllocate(), + pos + new LLVector3(1f, 1f, 1f)); scene.AddEntity(sceneObject); for (int i = 0; i < 27; i++) { - LLVector3 posOffset = new LLVector3( (i%3)*4, (i%9)/3 * 4, (i/9) * 4 ); - ComplexObject complexObject = new ComplexObject(scene, regionInfo.RegionHandle, LLUUID.Zero, scene.PrimIDAllocate(), pos + posOffset ); + LLVector3 posOffset = new LLVector3((i%3)*4, (i%9)/3*4, (i/9)*4); + ComplexObject complexObject = + new ComplexObject(scene, regionInfo.RegionHandle, LLUUID.Zero, scene.PrimIDAllocate(), + pos + posOffset); scene.AddEntity(complexObject); } @@ -128,45 +138,48 @@ namespace SimpleApp List avatars = scene.GetAvatars(); foreach (ScenePresence avatar in avatars) { - avatar.AbsolutePosition = new LLVector3((float)OpenSim.Framework.Util.RandomClass.Next(100,200), (float)OpenSim.Framework.Util.RandomClass.Next(30, 200), 2); + avatar.AbsolutePosition = + new LLVector3((float) Util.RandomClass.Next(100, 200), (float) Util.RandomClass.Next(30, 200), 2); } - - - DirectoryInfo dirInfo = new DirectoryInfo( "." ); + + DirectoryInfo dirInfo = new DirectoryInfo("."); float x = 0; float z = 0; - - foreach( FileInfo fileInfo in dirInfo.GetFiles()) + + foreach (FileInfo fileInfo in dirInfo.GetFiles()) { LLVector3 filePos = new LLVector3(100 + x, 129, 27 + z); x = x + 2; - if( x > 50 ) + if (x > 50) { x = 0; z = z + 2; } - - FileSystemObject fileObject = new FileSystemObject( scene, fileInfo, filePos ); + + FileSystemObject fileObject = new FileSystemObject(scene, fileInfo, filePos); scene.AddEntity(fileObject); } - + m_log.Notice("Press enter to quit."); - m_log.ReadLine(); + m_log.ReadLine(); } - protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, AgentCircuitManager circuitManager) + protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, + AgentCircuitManager circuitManager) { - return new MyWorld(regionInfo, circuitManager, m_commsManager, m_assetCache, storageManager, m_httpServer, new ModuleLoader( m_log, m_config )); + return + new MyWorld(regionInfo, circuitManager, m_commsManager, m_assetCache, storageManager, m_httpServer, + new ModuleLoader(m_log, m_config)); } protected override StorageManager CreateStorageManager(RegionInfo regionInfo) { return new StorageManager("OpenSim.DataStore.NullStorage.dll", "simpleapp.yap", "simpleapp"); } - - protected override PhysicsScene GetPhysicsScene( ) + + protected override PhysicsScene GetPhysicsScene() { return GetPhysicsScene("basicphysics"); } @@ -185,11 +198,11 @@ namespace SimpleApp #endregion - static void Main(string[] args) + private static void Main(string[] args) { Program app = new Program(); app.Run(); } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs b/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs index 2250613..a5c8f05 100644 --- a/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs @@ -1,24 +1,28 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.InteropServices; + // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("SimpleApp")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Playahead AB")] -[assembly: AssemblyProduct("SimpleApp")] -[assembly: AssemblyCopyright("Copyright © Playahead AB 2007")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] + +[assembly : AssemblyTitle("SimpleApp")] +[assembly : AssemblyDescription("")] +[assembly : AssemblyConfiguration("")] +[assembly : AssemblyCompany("Playahead AB")] +[assembly : AssemblyProduct("SimpleApp")] +[assembly : AssemblyCopyright("Copyright © Playahead AB 2007")] +[assembly : AssemblyTrademark("")] +[assembly : AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] + +[assembly : ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("a5cfa45f-5acf-4b2e-9c50-1dd1fd7608ee")] + +[assembly : Guid("a5cfa45f-5acf-4b2e-9c50-1dd1fd7608ee")] // Version information for an assembly consists of the following four values: // @@ -27,5 +31,6 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] + +[assembly : AssemblyVersion("1.0.0.0")] +[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file -- cgit v1.1