summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/LuaEngine/XLua.cs
blob: 59e33224796ea14ea855fec2c13ec1878efa9700 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using UnityEngine;
using System.Collections.Generic;
using LuaInterface;
using System;

public class XLua
{




    /// <summary>
    /// ptc 处理
    /// </summary>
    /// <returns></returns>
    public static void NotifyRoute(uint _type, byte[] bytes, int length)
    {
        LuaScriptMgr mgr = HotfixManager.Instance.GetLuaScriptMgr();
        mgr.DoFile("LuaNotifyProcess.lua");
        LuaFunction func = mgr.GetLuaFunction("LuaNotifyProcess.Process");
        func.Call(_type, Hotfix.LuaProtoBuffer(bytes, length), length);
    }



    /// <summary>
    /// 重载 c#协议
    /// </summary>
    public static void OverideNet(uint _type,byte[] bytes,int length)
    {
        LuaScriptMgr mgr = HotfixManager.Instance.GetLuaScriptMgr();
        mgr.DoFile("LuaNotifyProcess.lua");
        LuaFunction func = mgr.GetLuaFunction("LuaNotifyProcess.ProcessOveride");
        func.Call(_type, Hotfix.LuaProtoBuffer(bytes, length), length);
    }


    /// <summary>
    /// 抓取lua初始化的协议
    /// </summary>
    /// <returns></returns>
    public static object[] FetchRegistID()
    {
        LuaScriptMgr mgr = HotfixManager.Instance.GetLuaScriptMgr();
        mgr.DoFile("LuaNotifyProcess.lua");
        LuaFunction func = mgr.GetLuaFunction("LuaNotifyProcess.FetchRegistedID");
        return func.Call();
    }


}