Ejemplo n.º 1
0
    private static int set_pathFinished(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            WorldPathfinding.TargetInfo targetInfo = (WorldPathfinding.TargetInfo)obj;
            LuaTypes          luaTypes             = LuaDLL.lua_type(L, 2);
            Move.PathFinished pathFinished;
            if (luaTypes != LuaTypes.LUA_TFUNCTION)
            {
                pathFinished = (Move.PathFinished)ToLua.CheckObject(L, 2, typeof(Move.PathFinished));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 2);
                pathFinished = (DelegateFactory.CreateDelegate(typeof(Move.PathFinished), func) as Move.PathFinished);
            }
            targetInfo.pathFinished = pathFinished;
            result = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index pathFinished on a nil value");
        }
        return(result);
    }
Ejemplo n.º 2
0
    private static int Clear(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 1);
            WorldPathfinding.TargetInfo targetInfo = (WorldPathfinding.TargetInfo)ToLua.CheckObject(L, 1, typeof(WorldPathfinding.TargetInfo));
            targetInfo.Clear();
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
Ejemplo n.º 3
0
    private static int IsInWorldPathfinding(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 1);
            WorldPathfinding.TargetInfo targetInfo = (WorldPathfinding.TargetInfo)ToLua.CheckObject(L, 1, typeof(WorldPathfinding.TargetInfo));
            bool value = targetInfo.IsInWorldPathfinding();
            LuaDLL.lua_pushboolean(L, value);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
    private static int get_targetInfo(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            WorldPathfinding            worldPathfinding = (WorldPathfinding)obj;
            WorldPathfinding.TargetInfo targetInfo       = worldPathfinding.targetInfo;
            ToLua.PushObject(L, targetInfo);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index targetInfo on a nil value");
        }
        return(result);
    }
Ejemplo n.º 5
0
    private static int set_destination(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            WorldPathfinding.TargetInfo targetInfo = (WorldPathfinding.TargetInfo)obj;
            Vector3 destination = ToLua.ToVector3(L, 2);
            targetInfo.destination = destination;
            result = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index destination on a nil value");
        }
        return(result);
    }
Ejemplo n.º 6
0
    private static int set_radius(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            WorldPathfinding.TargetInfo targetInfo = (WorldPathfinding.TargetInfo)obj;
            float radius = (float)LuaDLL.luaL_checknumber(L, 2);
            targetInfo.radius = radius;
            result            = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index radius on a nil value");
        }
        return(result);
    }
Ejemplo n.º 7
0
    private static int get_pathFinished(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            WorldPathfinding.TargetInfo targetInfo   = (WorldPathfinding.TargetInfo)obj;
            Move.PathFinished           pathFinished = targetInfo.pathFinished;
            ToLua.Push(L, pathFinished);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index pathFinished on a nil value");
        }
        return(result);
    }
Ejemplo n.º 8
0
    private static int get_toMapId(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            WorldPathfinding.TargetInfo targetInfo = (WorldPathfinding.TargetInfo)obj;
            int toMapId = targetInfo.toMapId;
            LuaDLL.lua_pushinteger(L, toMapId);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index toMapId on a nil value");
        }
        return(result);
    }
Ejemplo n.º 9
0
    private static int _CreateWorldPathfinding_TargetInfo(IntPtr L)
    {
        int result;

        try
        {
            int num = LuaDLL.lua_gettop(L);
            if (num == 4)
            {
                int               toMap    = (int)LuaDLL.luaL_checknumber(L, 1);
                Vector3           dest     = ToLua.ToVector3(L, 2);
                float             ra       = (float)LuaDLL.luaL_checknumber(L, 3);
                LuaTypes          luaTypes = LuaDLL.lua_type(L, 4);
                Move.PathFinished arrived;
                if (luaTypes != LuaTypes.LUA_TFUNCTION)
                {
                    arrived = (Move.PathFinished)ToLua.CheckObject(L, 4, typeof(Move.PathFinished));
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 4);
                    arrived = (DelegateFactory.CreateDelegate(typeof(Move.PathFinished), func) as Move.PathFinished);
                }
                WorldPathfinding.TargetInfo o = new WorldPathfinding.TargetInfo(toMap, dest, ra, arrived);
                ToLua.PushObject(L, o);
                result = 1;
            }
            else
            {
                result = LuaDLL.luaL_throw(L, "invalid arguments to ctor method: WorldPathfinding.TargetInfo.New");
            }
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
Ejemplo n.º 10
0
    public void BeginWorldPathfinding(int toMap, int x, float y, int z, float ra = 0.1f, Move.PathFinished callback = null, bool midPoint = false)
    {
        if (Singleton <RoleManager> .Instance.mainRole != null)
        {
            if (Singleton <RoleManager> .Instance.mainRole.move.jumpMode != 0)
            {
                Util.CallMethod("CtrlManager", "CSPopUpNotifyText", new object[]
                {
                    "PlotJumpTip"
                });
                return;
            }
            Vector3 vector = new Vector3((float)x, y, (float)z);
            if (toMap == 0 || vector == Vector3.zero)
            {
                return;
            }
            if (this.targetInfo == null || (this.targetInfo.toMapId != toMap && toMap != 0) || (this.targetInfo.destination != vector && vector != Vector3.zero))
            {
                this.targetInfo = new WorldPathfinding.TargetInfo(toMap, vector, ra, callback);
            }
            Singleton <RoleManager> .Instance.mainRole.roleState.AddState(16);

            Singleton <RoleManager> .Instance.mainRole.move.SearchPathInWorld(toMap, vector, ra, delegate
            {
                Singleton <RoleManager> .Instance.mainRole.roleState.RemoveState(16);
                if (callback != null)
                {
                    callback();
                }
            });

            Util.CallMethod("HERO", "SetMidPointWalk", new object[]
            {
                midPoint
            });
        }
    }