static int FindAll(IntPtr L)
    {
        try
        {
            ToLua.CheckArgsCount(L, 2);
            System.Collections.Generic.List <string> obj = (System.Collections.Generic.List <string>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.List <string>));
            System.Predicate <string> arg0 = null;
            LuaTypes funcType2             = LuaDLL.lua_type(L, 2);

            if (funcType2 != LuaTypes.LUA_TFUNCTION)
            {
                arg0 = (System.Predicate <string>)ToLua.CheckObject(L, 2, typeof(System.Predicate <string>));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 2);
                arg0 = DelegateFactory.CreateDelegate(typeof(System.Predicate <string>), func) as System.Predicate <string>;
            }

            System.Collections.Generic.List <string> o = obj.FindAll(arg0);
            ToLua.PushObject(L, o);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Ejemplo n.º 2
0
    private void TranslateUnitToPoint(Vector3 point, Vector3 forvard)
    {
        forvard.Normalize();
        GameObject go = new GameObject("Point");

        go.transform.position = point;
        go.transform.LookAt(go.transform.position + forvard);
        Vector3 right = go.transform.right;

        Destroy(go);

        var listmove = list.FindAll(v => v.IsSelect && v.NavigateObject != null);


        int count    = listmove.Count;
        int countRow = Mathf.RoundToInt(Mathf.Pow(count, .5f)) + 1;

        for (int y = 0; y < countRow; y++)
        {
            for (int x = 0; x < countRow; x++)
            {
                int index = y * countRow + x;
                if (index < count)
                {
                    listmove[y * countRow + x].NavigateObject.Translate(point - countRow / 2 * right + right * x + forvard * y);
                }
            }
        }
    }
Ejemplo n.º 3
0
 static public int FindAll(IntPtr l)
 {
     try {
         System.Collections.Generic.List <UnityEngine.GameObject> self = (System.Collections.Generic.List <UnityEngine.GameObject>)checkSelf(l);
         System.Predicate <UnityEngine.GameObject> a1;
         LuaDelegation.checkDelegate(l, 2, out a1);
         var ret = self.FindAll(a1);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int FindAll(IntPtr l)
 {
     try {
         System.Collections.Generic.List <System.Int32> self = (System.Collections.Generic.List <System.Int32>)checkSelf(l);
         System.Predicate <System.Int32> a1;
         LuaDelegation.checkDelegate(l, 2, out a1);
         var ret = self.FindAll(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static int FindAll(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         System.Collections.Generic.List <string> obj = (System.Collections.Generic.List <string>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.List <string>));
         System.Predicate <string> arg0             = (System.Predicate <string>)ToLua.CheckDelegate <System.Predicate <string> >(L, 2);
         System.Collections.Generic.List <string> o = obj.FindAll(arg0);
         ToLua.PushSealed(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }