Пример #1
0
        public void TestConcatenateInteger()
        {
            LSL_Types.list testList = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger('a'), new LSL_Types.LSLString("test"));
            testList += new LSL_Types.LSLInteger(20);

            Assert.AreEqual(4, testList.Length);
            Assert.AreEqual(new LSL_Types.LSLInteger(20), testList.Data[3]);
            Assert.AreEqual(typeof(LSL_Types.LSLInteger), testList.Data[3].GetType());

            LSL_Types.list secondTestList = testList + new LSL_Types.LSLInteger(2);

            Assert.AreEqual(5, secondTestList.Length);
            Assert.AreEqual(new LSL_Types.LSLInteger(2), secondTestList.Data[4]);
            Assert.AreEqual(typeof(LSL_Types.LSLInteger), secondTestList.Data[4].GetType());
        }
Пример #2
0
        public bool PostObjectEvent(UUID itemID, string name, Object[] p)
        {
            SceneObjectPart part = m_Scene.GetSceneObjectPart(itemID);
            if (part == null)
                return false;

            Object[] lsl_p = new Object[p.Length];
            for (int i = 0; i < p.Length ; i++)
            {
                if (p[i] is int)
                    lsl_p[i] = new LSL_Types.LSLInteger((int)p[i]);
                else if (p[i] is string)
                    lsl_p[i] = new LSL_Types.LSLString((string)p[i]);
                else if (p[i] is Vector3)
                    lsl_p[i] = new LSL_Types.Vector3((Vector3)p[i]);
                else if (p[i] is Quaternion)
                    lsl_p[i] = new LSL_Types.Quaternion((Quaternion)p[i]);
                else if (p[i] is float)
                    lsl_p[i] = new LSL_Types.LSLFloat((float)p[i]);
                else
                    lsl_p[i] = p[i];
            }

            return PostObjectEvent(part.LocalId, new EventParams(name, lsl_p, new DetectParams[0]));
        }
Пример #3
0
        public bool PostScriptEvent(UUID itemID, string name, Object[] p)
        {
            Object[] lsl_p = new Object[p.Length];
            for (int i = 0; i < p.Length ; i++)
            {
                if (p[i] is int)
                    lsl_p[i] = new LSL_Types.LSLInteger((int)p[i]);
                else if (p[i] is string)
                    lsl_p[i] = new LSL_Types.LSLString((string)p[i]);
                else if (p[i] is Vector3)
                    lsl_p[i] = new LSL_Types.Vector3((Vector3)p[i]);
                else if (p[i] is Quaternion)
                    lsl_p[i] = new LSL_Types.Quaternion((Quaternion)p[i]);
                else if (p[i] is float)
                    lsl_p[i] = new LSL_Types.LSLFloat((float)p[i]);
                else
                    lsl_p[i] = p[i];
            }

            return PostScriptEvent(itemID, new EventParams(name, lsl_p, new DetectParams[0]));
        }
Пример #4
0
        public void TestImplicitCastLSLIntegerToLSLFloat()
        {
            LSL_Types.LSLFloat testFloat;

            foreach (int number in m_intList)
            {
                testFloat = new LSL_Types.LSLInteger(number);
                Assert.That(testFloat.value, new DoubleToleranceConstraint(number, _lowPrecisionTolerance));
            }
        }
Пример #5
0
        public void TestGetLSLIntegerItemForLSLIntegerItem()
        {
            LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(999911);
            LSL_Types.list testList = new LSL_Types.list(testValue);

            Assert.AreEqual(testValue, testList.GetLSLIntegerItem(0));
        }