public CommandHandler(ControlInterface ctrlInterface, GlobalConfig config) { this.commandQueue = new CommandQueue(ctrlInterface); this.ctrlInterface = ctrlInterface; this.config = config; eventCallback = LuaEventHandler; luaEventCallbackPtr = Marshal.GetFunctionPointerForDelegate(eventCallback); frameName = SFUtil.GetRandomAsciiString(5); ResolveEndSceneAddress(); RegisterFunctions(); }
public void InitializeLuaEventFrameHandler_W() { if (luaEventFunctionName != null) { return; } luaEventFunctionName = config.LuaPlugFunctionName ?? SFUtil.GetRandomAsciiString(4); FrameScript__RegisterFunction(luaEventFunctionName, luaEventCallbackPtr); FrameScript__Execute($"if not {frameName} then {frameName} = CreateFrame('Frame'); end; {frameName}:SetScript('OnEvent', function(self, eventName, ...) {luaEventFunctionName}(eventName, ...) end); {frameName}:RegisterAllEvents();", 0, 0); wardenScan = false; }
public void InitializeLuaEventFrameHandler() { if (luaEventFunctionName != null) { return; } while (wardenScan) { Thread.Sleep(200); } luaEventFunctionName = config.LuaPlugFunctionName ?? SFUtil.GetRandomAsciiString(4); commandQueue.Submit <object>((() => { FrameScript__RegisterFunction(luaEventFunctionName, luaEventCallbackPtr); FrameScript__Execute($"if not {frameName} then {frameName} = CreateFrame('Frame'); end; {frameName}:SetScript('OnEvent', function(self, eventName, ...) {luaEventFunctionName}(eventName, ...) end); {frameName}:RegisterAllEvents();", 0, 0); return(null); })); }