public static void Test()
        {
            PrimitiveTypes32 val;
            var sArray = new string[]
            {
                "true",
                "false",
                "@",
                "123",
                "123.4f",
                "123.4",
                "1",
                "1.",
                "1f",
                "@ExpressionTypeIndex",
                "@DifficultyIndex",
            };

            foreach (var s in sArray)
            {
                if (PrimitiveTypes32.TryParse(s, out val))
                {
                    Debug.Log("\"" + s + "\"->" + "val:" + val.ToString());
                }
                else
                {
                    Debug.Log("PrimitiveTypes32.TryParse(\"" + s + "\") returns false.");
                }
            }
        }
Beispiel #2
0
        public static PrimitiveTypes32 ParsePrimitiveTypes32(this string self, PrimitiveTypes32 defaultValue)
        {
            PrimitiveTypes32 val;

            if (PrimitiveTypes32.TryParse(self, out val))
            {
#if LOG_DETAIL
                Debug.LogWarning("at \"" + self + "\"" + "." + MethodBase.GetCurrentMethod().Name + "(defaultValue:" + defaultValue + ")\n PrimitiveTypes32.TryParse(\"" + self + "\") returns false.");
#endif
                val = defaultValue;
            }
            return(val);
        }