コード例 #1
0
    public LuaEventTestLogic(
        CommandService commandService,
        LuaEventService luaEventService,
        LuaValueMapper mapper)
    {
        this.luaEventService = luaEventService;

        mapper.DefineStructMapper <ExplicitStruct>(x => new LuaValue("Explicit!"));

        commandService.AddCommand("sendvector").Triggered     += SendLuaVector;
        commandService.AddCommand("sendvectorlist").Triggered += SendLuaVectorList;
        commandService.AddCommand("senddata").Triggered       += SendDataStruct;
        commandService.AddCommand("sendmapped").Triggered     += SendLuaMappable;
        commandService.AddCommand("sendexplicit").Triggered   += SendExplicitStruct;
    }
コード例 #2
0
    public LuaEventService(MtaServer server,
                           RootElement root,
                           LatentPacketService latentPacketService,
                           IElementCollection elementCollection,
                           LuaValueMapper mapper)
    {
        this.server = server;
        this.root   = root;
        this.latentPacketService = latentPacketService;
        this.elementCollection   = elementCollection;
        this.mapper        = mapper;
        this.eventHandlers = new Dictionary <string, List <Action <LuaEvent> > >();

        server.LuaEventTriggered += HandleLuaEvent;
    }
コード例 #3
0
    public LuaControllerLogic(
        MtaServer server,
        LuaEventService luaEventService,
        IElementCollection elementCollection,
        LuaValueMapper luaValueMapper)
    {
        this.server            = server;
        this.luaEventService   = luaEventService;
        this.elementCollection = elementCollection;
        this.luaValueMapper    = luaValueMapper;

        this.handlers = new();
        this.implicitlyCastableTypes = new();

        IndexImplicitlyCastableTypes();
        IndexControllers();
    }