示例#1
0
        public void TestAddScript()
        {
            TestHelpers.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            UUID userId = TestHelpers.ParseTail(0x1);
//            UUID itemId = TestHelpers.ParseTail(0x2);
            string itemName = "Test Script Item";

            Scene            scene = new SceneHelpers().SetupScene();
            SceneObjectGroup so    = SceneHelpers.CreateSceneObject(1, userId);

            scene.AddNewSceneObject(so, true);

            InventoryItemBase itemTemplate = new InventoryItemBase();

            itemTemplate.Name    = itemName;
            itemTemplate.Folder  = so.UUID;
            itemTemplate.InvType = (int)InventoryType.LSL;

            SceneObjectPart partWhereScriptAdded = scene.RezNewScript(userId, itemTemplate);

            Assert.That(partWhereScriptAdded, Is.Not.Null);

            IEntityInventory primInventory = partWhereScriptAdded.Inventory;

            Assert.That(primInventory.GetInventoryList().Count, Is.EqualTo(1));
            Assert.That(primInventory.ContainsScripts(), Is.True);

            IList <TaskInventoryItem> primItems = primInventory.GetInventoryItems(itemName);

            Assert.That(primItems.Count, Is.EqualTo(1));
        }
示例#2
0
        private StringBuilder AddScenePartItemsReport(StringBuilder sb, IEntityInventory inv)
        {
            ConsoleDisplayTable cdt = new ConsoleDisplayTable();

            cdt.Indent = 2;

            cdt.AddColumn("Name", 50);
            cdt.AddColumn("Type", 12);
            cdt.AddColumn("Running", 7);
            cdt.AddColumn("Item UUID", 36);
            cdt.AddColumn("Asset UUID", 36);

            foreach (TaskInventoryItem item in inv.GetInventoryItems())
            {
                bool foundScriptInstance, scriptRunning;
                foundScriptInstance
                    = SceneObjectPartInventory.TryGetScriptInstanceRunning(m_scene, item, out scriptRunning);

                cdt.AddRow(
                    item.Name,
                    ((InventoryType)item.InvType).ToString(),
                    foundScriptInstance ? scriptRunning.ToString() : "n/a",
                    item.ItemID.ToString(),
                    item.AssetID.ToString());
            }

            return(sb.Append(cdt.ToString()));
        }
示例#3
0
        public static T GetSlot <T>(IEntityInventory inventory, int objectId) where T : ISlot
        {
            var collection = inventory.Slots.ToArray();

            foreach (var item in collection)
            {
                return((T)inventory.Slots.Values.SingleOrDefault(i => i.ObjectId == objectId));
            }

            return(default);
示例#4
0
        private StringBuilder AddScenePartItemsReport(StringBuilder sb, IEntityInventory inv)
        {
            ConsoleDisplayTable cdt = new ConsoleDisplayTable();
            cdt.Indent = 2;

            cdt.AddColumn("Name", 50);
            cdt.AddColumn("Type", 12);
            cdt.AddColumn("Running", 7);
            cdt.AddColumn("Item UUID", 36);
            cdt.AddColumn("Asset UUID", 36);

            foreach (TaskInventoryItem item in inv.GetInventoryItems())
            {
                bool foundScriptInstance, scriptRunning;
                foundScriptInstance
                    = SceneObjectPartInventory.TryGetScriptInstanceRunning(m_scene, item, out scriptRunning);

                cdt.AddRow(
                    item.Name,
                    ((InventoryType)item.InvType).ToString(),
                    foundScriptInstance ? scriptRunning.ToString() : "n/a",
                    item.ItemID.ToString(),
                    item.AssetID.ToString());
            }

            return sb.Append(cdt.ToString());
        }
示例#5
0
        private StringBuilder AddScenePartItemsReport(StringBuilder sb, IEntityInventory inv)
        {
            ConsoleDisplayTable cdt = new ConsoleDisplayTable();
            cdt.Indent = 2;

            cdt.AddColumn("Name", 50);
            cdt.AddColumn("Type", 12);
            cdt.AddColumn("Running", 7);
            cdt.AddColumn("Item UUID", 36);
            cdt.AddColumn("Asset UUID", 36);

            foreach (TaskInventoryItem item in inv.GetInventoryItems())
                cdt.AddRow(
                    item.Name,
                    ((InventoryType)item.InvType).ToString(),
                    (InventoryType)item.InvType == InventoryType.LSL ? item.ScriptRunning.ToString() : "n/a",
                    item.ItemID.ToString(),
                    item.AssetID.ToString());

            return sb.Append(cdt.ToString());
        }