public void TestConstructFromLSLFloat()
        {
            LSL_Types.LSLString testString;

            foreach (KeyValuePair<double, string> number in m_doubleStringSet)
            {
                testString = new LSL_Types.LSLString(new LSL_Types.LSLFloat(number.Key));
                Assert.AreEqual(number.Value, testString.m_string);
            }
        }
Пример #2
0
        public void TestConcatenateString()
        {
            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.LSLString("addition");

            Assert.AreEqual(4, testList.Length);
            Assert.AreEqual(new LSL_Types.LSLString("addition"), testList.Data[3]);
            Assert.AreEqual(typeof(LSL_Types.LSLString), testList.Data[3].GetType());

            LSL_Types.list secondTestList = testList + new LSL_Types.LSLString("more");

            Assert.AreEqual(5, secondTestList.Length);
            Assert.AreEqual(new LSL_Types.LSLString("more"), secondTestList.Data[4]);
            Assert.AreEqual(typeof(LSL_Types.LSLString), secondTestList.Data[4].GetType());
        }
Пример #3
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]));
        }
Пример #4
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]));
        }
Пример #5
0
        public void TestExplicitCastLSLStringToQuaternion()
        {
            TestHelpers.InMethod();

            string quaternionString = "<0.00000, 0.70711, 0.00000, 0.70711>";
            LSL_Types.LSLString quaternionLSLString = new LSL_Types.LSLString(quaternionString);

            LSL_Types.Quaternion expectedQuaternion = new LSL_Types.Quaternion(0.0, 0.70711, 0.0, 0.70711);
            LSL_Types.Quaternion stringQuaternion = (LSL_Types.Quaternion) quaternionString;
            LSL_Types.Quaternion LSLStringQuaternion = (LSL_Types.Quaternion) quaternionLSLString;

            Assert.AreEqual(expectedQuaternion, stringQuaternion);
            Assert.AreEqual(expectedQuaternion, LSLStringQuaternion);
        }