diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs | 31 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/Program.cs | 26 |
2 files changed, 54 insertions, 3 deletions
diff --git a/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs b/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs new file mode 100644 index 0000000..2e43fe6 --- /dev/null +++ b/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs | |||
@@ -0,0 +1,31 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim.Region.Environment.Scenes; | ||
5 | using libsecondlife; | ||
6 | using OpenSim.Framework.Types; | ||
7 | using System.Timers; | ||
8 | using System.Diagnostics; | ||
9 | using System.IO; | ||
10 | using Primitive=OpenSim.Region.Environment.Scenes.Primitive; | ||
11 | |||
12 | namespace SimpleApp | ||
13 | { | ||
14 | public class FileSystemObject : SceneObject | ||
15 | { | ||
16 | public FileSystemObject(Scene world, FileInfo fileInfo, LLVector3 pos) | ||
17 | : base( world, world.EventManager, LLUUID.Zero, world.NextLocalId, pos, BoxShape.Default ) | ||
18 | { | ||
19 | |||
20 | |||
21 | float size = (float)Math.Pow((double)fileInfo.Length, (double) 1 / 3) / 5; | ||
22 | rootPrimitive.ResizeGoup(new LLVector3(size, size, size)); | ||
23 | rootPrimitive.Text = fileInfo.Name; | ||
24 | } | ||
25 | |||
26 | public override void Update() | ||
27 | { | ||
28 | base.Update(); | ||
29 | } | ||
30 | } | ||
31 | } | ||
diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index 4dae461..82dba0e 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs | |||
@@ -17,6 +17,7 @@ using System.Timers; | |||
17 | using OpenSim.Region.Environment.Scenes; | 17 | using OpenSim.Region.Environment.Scenes; |
18 | using OpenSim.Framework.Data; | 18 | using OpenSim.Framework.Data; |
19 | using OpenSim.Region.Environment; | 19 | using OpenSim.Region.Environment; |
20 | using System.IO; | ||
20 | 21 | ||
21 | namespace SimpleApp | 22 | namespace SimpleApp |
22 | { | 23 | { |
@@ -58,16 +59,35 @@ namespace SimpleApp | |||
58 | 59 | ||
59 | udpServer.ServerListener(); | 60 | udpServer.ServerListener(); |
60 | 61 | ||
61 | PrimitiveBaseShape shape = PrimitiveBaseShape.DefaultBox(); | 62 | PrimitiveBaseShape shape = BoxShape.Default; |
62 | shape.Scale = new LLVector3(0.5f, 0.5f, 0.5f); | 63 | shape.Scale = new LLVector3(0.5f, 0.5f, 0.5f); |
63 | LLVector3 pos = new LLVector3(138, 129, 27); | 64 | LLVector3 pos = new LLVector3(138, 129, 27); |
64 | 65 | ||
65 | SceneObject m_sceneObject = new CpuCounterObject(scene, scene.EventManager, LLUUID.Zero, scene.PrimIDAllocate(), pos, shape); | 66 | SceneObject sceneObject = new CpuCounterObject(scene, scene.EventManager, LLUUID.Zero, scene.PrimIDAllocate(), pos, shape); |
66 | scene.AddEntity(m_sceneObject); | 67 | scene.AddEntity(sceneObject); |
67 | 68 | ||
68 | MyNpcCharacter m_character = new MyNpcCharacter( scene.EventManager ); | 69 | MyNpcCharacter m_character = new MyNpcCharacter( scene.EventManager ); |
69 | scene.AddNewClient(m_character, false); | 70 | scene.AddNewClient(m_character, false); |
70 | 71 | ||
72 | DirectoryInfo dirInfo = new DirectoryInfo( "." ); | ||
73 | |||
74 | float x = 0; | ||
75 | float z = 0; | ||
76 | |||
77 | foreach( FileInfo fileInfo in dirInfo.GetFiles()) | ||
78 | { | ||
79 | LLVector3 filePos = new LLVector3(100 + x, 129, 27 + z); | ||
80 | x = x + 2; | ||
81 | if( x > 50 ) | ||
82 | { | ||
83 | x = 0; | ||
84 | z = z + 2; | ||
85 | } | ||
86 | |||
87 | FileSystemObject fileObject = new FileSystemObject( scene, fileInfo, filePos ); | ||
88 | scene.AddEntity(fileObject); | ||
89 | } | ||
90 | |||
71 | m_log.WriteLine(LogPriority.NORMAL, "Press enter to quit."); | 91 | m_log.WriteLine(LogPriority.NORMAL, "Press enter to quit."); |
72 | m_log.ReadLine(); | 92 | m_log.ReadLine(); |
73 | } | 93 | } |