Ejemplo n.º 1
0
 static public int constructor(IntPtr l)
 {
     try {
         int        argc = LuaDLL.lua_gettop(l);
         StrStrDict o;
         if (argc == 1)
         {
             o = new StrStrDict();
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (argc == 2)
         {
             System.Collections.Generic.IDictionary <System.String, System.String> a1;
             checkType(l, 2, out a1);
             o = new StrStrDict(a1);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         return(error(l, "New object failed."));
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 2
0
    public void TestImp(UnityEngine.Vector2 pos)
    {
        object o    = pos;
        var    list = o as IList <int>;
        var    arr  = o as int[, ][];
        var    dict = new StrStrDict();
        string v;

        if (null != dict && dict.TryGetValue("abc", out v))
        {
            Console.WriteLine(v);
        }
        else if (null != dict && dict.TryGetValue("abc2", out v))
        {
            Console.WriteLine(v);
        }
        while (null != dict && dict.TryGetValue("abc2", out v))
        {
            Console.WriteLine(v);
        }
        do
        {
            Console.WriteLine(v);
        } while (null != dict && dict.TryGetValue("abc2", out v));

        UnityEngine.Vector3 vv = UnityEngine.Vector3.zero;
        vv.x = v == "yes" ? 123 : v == "no" ? 456 : 789;
        int iv = v == "yes" ? 123 : v == "no" ? 456 : 789;

        list.Add(v == "yes" ? 123 : v == "no" ? 456 : 789);
        int statusA = 3;

        statusA = statusA == 1 ? 2 : statusA == 2 ? 1 : statusA == 3 ? 0 : ++statusA;
    }
        private static void Main()
        {
            var dict1 = new StrStrDict
            {
                { "name", "name1" },
                { "number", "0.0158" }
            };
            var dict2 = new StrStrDict
            {
                { "name", "name2" },
                { "number", "0.0038" }
            };
            var dict3 = new StrStrDict
            {
                { "name", "name3" },
                { "number", "0.0148" }
            };
            var list = new List <StrStrDict> {
                dict1, dict2, dict3
            };

            list.Sort(new CustomComparer());
            foreach (var element in list)
            {
                Console.WriteLine("Number = " + element["number"]);
            }
        }
Ejemplo n.º 4
0
 static public int Clear(IntPtr l)
 {
     try {
         StrStrDict self = (StrStrDict)checkSelf(l);
         self.Clear();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 5
0
 static public int get_Values(IntPtr l)
 {
     try {
         StrStrDict self = (StrStrDict)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.Values);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 6
0
 static public int OnDeserialization(IntPtr l)
 {
     try {
         StrStrDict    self = (StrStrDict)checkSelf(l);
         System.Object a1;
         checkType(l, 2, out a1);
         self.OnDeserialization(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 7
0
 static public int ContainsValue(IntPtr l)
 {
     try {
         StrStrDict    self = (StrStrDict)checkSelf(l);
         System.String a1;
         checkType(l, 2, out a1);
         var ret = self.ContainsValue(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 8
0
 static public int getItem(IntPtr l)
 {
     try {
         StrStrDict self = (StrStrDict)checkSelf(l);
         string     v;
         checkType(l, 2, out v);
         var ret = self[v];
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 9
0
 static public int Add(IntPtr l)
 {
     try {
         StrStrDict    self = (StrStrDict)checkSelf(l);
         System.String a1;
         checkType(l, 2, out a1);
         System.String a2;
         checkType(l, 3, out a2);
         self.Add(a1, a2);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 10
0
 static public int setItem(IntPtr l)
 {
     try {
         StrStrDict self = (StrStrDict)checkSelf(l);
         string     v;
         checkType(l, 2, out v);
         string c;
         checkType(l, 3, out c);
         self[v] = c;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 11
0
 static public int GetObjectData(IntPtr l)
 {
     try {
         StrStrDict self = (StrStrDict)checkSelf(l);
         System.Runtime.Serialization.SerializationInfo a1;
         checkType(l, 2, out a1);
         System.Runtime.Serialization.StreamingContext a2;
         checkValueType(l, 3, out a2);
         self.GetObjectData(a1, a2);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }