From 646bbbc84b8010e0dacbeed5342cdb045f46cc49 Mon Sep 17 00:00:00 2001 From: MW Date: Wed, 27 Jun 2007 15:28:52 +0000 Subject: Some work on restructuring the namespaces / project names. Note this doesn't compile yet as not all the code has been changed to use the new namespaces. Am committing it now for feedback on the namespaces. --- OpenSim/Region/Examples/SimpleApp/MyWorld.cs | 113 +++++++++++++++ OpenSim/Region/Examples/SimpleApp/Program.cs | 128 +++++++++++++++++ .../Examples/SimpleApp/Properties/AssemblyInfo.cs | 33 +++++ OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj | 154 +++++++++++++++++++++ .../Examples/SimpleApp/SimpleApp.csproj.user | 12 ++ 5 files changed, 440 insertions(+) create mode 100644 OpenSim/Region/Examples/SimpleApp/MyWorld.cs create mode 100644 OpenSim/Region/Examples/SimpleApp/Program.cs create mode 100644 OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs create mode 100644 OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj create mode 100644 OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj.user (limited to 'OpenSim/Region/Examples/SimpleApp') diff --git a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs new file mode 100644 index 0000000..01e0c59 --- /dev/null +++ b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs @@ -0,0 +1,113 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using OpenSim.Framework.Console; +using libsecondlife; +using OpenSim.Region; +using Avatar=OpenSim.Region.Scenes.ScenePresence; +using OpenSim.Region.Scenes; +using OpenSim.Framework; +using OpenSim.Caches; +using OpenGrid.Framework.Communications; +using OpenSim.Servers; + +namespace SimpleApp +{ + public class MyWorld : Scene + { + private RegionInfo m_regionInfo; + private List m_avatars; + + public MyWorld(Dictionary clientThreads, RegionInfo regionInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer) + : base(clientThreads, regionInfo, authen, commsMan, assetCach, httpServer) + { + m_regionInfo = regionInfo; + m_avatars = new List(); + } + + public override void SendLayerData(IClientAPI remoteClient) + { + float[] map = new float[65536]; + + for (int i = 0; i < 65536; i++) + { + int x = i % 256; + int y = i / 256; + + map[i] = (float)(x + y / 2); + } + + remoteClient.SendLayerData(map); + } + + #region IWorld Members + + override public void AddNewClient(IClientAPI client, LLUUID agentID, bool child) + + { + LLVector3 pos = new LLVector3(128, 128, 128); + + client.OnRegionHandShakeReply += SendLayerData; + client.OnChatFromViewer += + delegate(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) + { + // Echo it (so you know what you typed) + client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); + client.SendChatMessage("Ready.", 1, pos, "System", LLUUID.Zero ); + }; + + client.OnRequestWearables += SendWearables; + + client.OnCompleteMovementToRegion += delegate() + { + client.MoveAgentIntoRegion(m_regionInfo, pos, LLVector3.Zero ); + }; + + client.OnCompleteMovementToRegion += delegate() + { + client.SendAvatarData(m_regionInfo.RegionHandle, client.FirstName, + client.LastName, client.AgentId, 0, + pos, null); + + client.SendChatMessage("Welcome to My World.", 1, pos, "System", LLUUID.Zero ); + }; + + client.SendRegionHandshake(m_regionInfo); + + OpenSim.Region.Scenes.ScenePresence avatar = new Avatar( client, this, m_regionInfo ); + + } + + private void SendWearables( IClientAPI client ) + { + client.SendWearables( AvatarWearable.DefaultWearables ); + } + + + override public void RemoveClient(LLUUID agentID) + { + + } + + public RegionInfo RegionInfo + { + get { return m_regionInfo; } + } + + public object SyncRoot + { + get { return this; } + } + + private uint m_nextLocalId = 1; + + public uint NextLocalId + { + get { return m_nextLocalId++; } + } + + #endregion + } +} diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs new file mode 100644 index 0000000..e1465d1 --- /dev/null +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs @@ -0,0 +1,128 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim; +using OpenSim.GridInterfaces.Local; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using OpenSim.Framework.Console; +using OpenSim.Assets; +using libsecondlife; +using OpenSim.Servers; +using OpenSim.Framework; +using OpenSim.Caches; +using OpenGrid.Framework.Communications; +using OpenSim.LocalCommunications; + +namespace SimpleApp +{ + class Program : IAssetReceiver, conscmd_callback + { + private LogBase m_log; + AuthenticateSessionsBase m_circuitManager; + + private void Run() + { + m_log = new LogBase(null, "SimpleApp", this, false); + MainLog.Instance = m_log; + + // CheckSumServer checksumServer = new CheckSumServer(12036); + // checksumServer.ServerListener(); + + string simAddr = "127.0.0.1"; + int simPort = 9000; + /* + LoginServer loginServer = new LoginServer( simAddr, simPort, 0, 0, false ); + loginServer.Startup(); + loginServer.SetSessionHandler( AddNewSessionHandler );*/ + + m_circuitManager = new AuthenticateSessionsBase(); + + InventoryCache inventoryCache = new InventoryCache(); + + LocalAssetServer assetServer = new LocalAssetServer(); + assetServer.SetServerInfo("http://127.0.0.1:8003/", ""); + assetServer.SetReceiver(this); + + AssetCache assetCache = new AssetCache(assetServer); + + UDPServer udpServer = new UDPServer(simPort, assetCache, inventoryCache, m_log, m_circuitManager ); + PacketServer packetServer = new PacketServer( udpServer, (uint) simPort ); + udpServer.ServerListener(); + + ClientView.TerrainManager = new TerrainManager(new SecondLife()); + + CommunicationsManager communicationsManager = new CommunicationsLocal(null); + + RegionInfo regionInfo = new RegionInfo( ); + BaseHttpServer httpServer = new BaseHttpServer(simPort); + udpServer.LocalWorld = new MyWorld( packetServer.ClientAPIs, regionInfo, m_circuitManager, communicationsManager, assetCache, httpServer ); + + // World world = new World(udpServer.PacketServer.ClientAPIs, regionInfo); + // PhysicsScene physicsScene = new NullPhysicsScene(); + // world.PhysicsScene = physicsScene; + // udpServer.LocalWorld = world; + + // httpServer.AddXmlRPCHandler( "login_to_simulator", loginServer.XmlRpcLoginMethod ); + httpServer.Start(); + + m_log.WriteLine( LogPriority.NORMAL, "Press enter to quit."); + m_log.ReadLine(); + } + + private bool AddNewSessionHandler(ulong regionHandle, Login loginData) + { + m_log.WriteLine(LogPriority.NORMAL, "Region [{0}] recieved Login from [{1}] [{2}]", regionHandle, loginData.First, loginData.Last); + + AgentCircuitData agent = new AgentCircuitData(); + agent.AgentID = loginData.Agent; + agent.firstname = loginData.First; + agent.lastname = loginData.Last; + agent.SessionID = loginData.Session; + agent.SecureSessionID = loginData.SecureSession; + agent.circuitcode = loginData.CircuitCode; + agent.BaseFolder = loginData.BaseFolder; + agent.InventoryFolder = loginData.InventoryFolder; + agent.startpos = new LLVector3(128, 128, 70); + + m_circuitManager.AddNewCircuit(agent.circuitcode, agent); + + return true; + } + + #region IAssetReceiver Members + + public void AssetReceived( AssetBase asset, bool IsTexture) + { + throw new Exception("The method or operation is not implemented."); + } + + public void AssetNotFound( AssetBase asset) + { + throw new Exception("The method or operation is not implemented."); + } + + #endregion + + #region conscmd_callback Members + + public void RunCmd(string cmd, string[] cmdparams) + { + throw new Exception("The method or operation is not implemented."); + } + + public void Show(string ShowWhat) + { + throw new Exception("The method or operation is not implemented."); + } + + #endregion + + static void Main(string[] args) + { + Program app = new Program(); + + app.Run(); + } + } +} diff --git a/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs b/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..0f9bf0f --- /dev/null +++ b/OpenSim/Region/Examples/SimpleApp/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +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("")] + +// 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)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("a5cfa45f-5acf-4b2e-9c50-1dd1fd7608ee")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj new file mode 100644 index 0000000..5129be2 --- /dev/null +++ b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj @@ -0,0 +1,154 @@ + + + Local + 8.0.50727 + 2.0 + {24B12448-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + SimpleApp + JScript + Grid + IE50 + false + Exe + + SimpleApp + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\..\..\bin\ + False + False + False + 4 + + + + + ..\..\..\..\bin\libsecondlife.dll + False + + + OpenSim.Servers.dll + False + + + System.dll + False + + + ..\..\..\..\bin\System.Data.dll + False + + + System.Xml.dll + False + + + ..\..\..\..\bin\XMLRPC.dll + False + + + + + OpenSim.Framework + {8ACA2445-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Communications + {CB52B7E7-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Console + {A7CD0630-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Region.Caches + {61FCCDB3-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Region.ClientStack + {DC3698B2-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Region.GridInterfaces.Local + {241A8CDD-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Region.LocalCommunications + {EB3A1BA8-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Region.Simulation + {C0DAB338-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj.user b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj.user new file mode 100644 index 0000000..6841907 --- /dev/null +++ b/OpenSim/Region/Examples/SimpleApp/SimpleApp.csproj.user @@ -0,0 +1,12 @@ + + + Debug + AnyCPU + C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ + 8.0.50727 + ProjectFiles + 0 + + + + -- cgit v1.1