You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Whenever i called AIO.Handle("AIOExample", "print") from a client event handler my print function on the server side got called twice.
But the client side event handler only got triggered once.
Here is the lua code:
`
local AIO = AIO or require("AIO")
local handler = AIO.AddHandlers("AIOExample", {});
if AIO.AddAddon() then
function handler.print()
print("Hello from client")
end
else
-- Create the base frame.
FrameTest = CreateFrame("Frame", "FrameTest", UIParent, "UIPanelDialogTemplate")
local frame = FrameTest
-- Some basic method usage..
-- Read the wow addon widget API for what each function does:
-- http://wowwiki.wikia.com/Widget_API
frame:SetSize(200, 200)
frame:RegisterForDrag("LeftButton")
frame:SetPoint("CENTER")
frame:SetToplevel(true)
frame:SetClampedToScreen(true)
-- Enable dragging of frame
frame:SetMovable(true)
frame:EnableMouse(true)
frame:SetScript("OnDragStart", frame.StartMoving)
frame:SetScript("OnHide", frame.StopMovingOrSizing)
frame:SetScript("OnDragStop", frame.StopMovingOrSizing)
-- This enables saving of the position of the frame over reload of the UI or restarting game
AIO.SavePosition(frame)
-- Creating an input:
local input = CreateFrame("EditBox", "InputTest", frame, "InputBoxTemplate")
input:SetSize(100, 30)
input:SetAutoFocus(false)
input:SetPoint("CENTER", frame, "CENTER", 0, 50)
input:SetScript("OnEnterPressed", input.ClearFocus)
input:SetScript("OnEscapePressed", input.ClearFocus)
-- Creating a slider:
local slider = CreateFrame("Slider", "SlideTest", frame, "OptionsSliderTemplate")
slider:SetSize(100, 17)
slider:SetPoint("CENTER", frame, "CENTER", 0, -50)
slider:SetValueStep(0.5)
slider:SetMinMaxValues(0, 100)
slider:SetValue(50)
slider.tooltipText = 'This is the Tooltip hint'
_G[slider:GetName() .."Text"]:SetText(50)
slider:SetScript("OnValueChanged", function(self) _G[slider:GetName() .."Text"]:SetText(self:GetValue()) end)
_G[slider:GetName().."High"]:Hide()
_G[slider:GetName().."Low"]:Hide()
slider:Show()
-- Creating a child, a button:
local button = CreateFrame("Button", "ButtonTest", frame)
button:SetSize(100, 30)
button:SetPoint("CENTER", frame, "CENTER")
button:EnableMouse(true)
-- Small script to clear the focus from input on click
button:SetScript("OnMouseUp", function() input:ClearFocus() end)
-- Usually I use UIPanelButtonTemplate for buttons, but I wanted to show and test some custom color texture here:
local texture = button:CreateTexture("TextureTest")
texture:SetAllPoints(button)
texture:SetTexture(0.5, 1, 1, 0.5)
button:SetNormalTexture(texture)
-- Set the font, could use GameFontNormal template, but I wanted to create my own
local fontstring = button:CreateFontString("FontTest")
fontstring:SetFont("Fonts\\FRIZQT__.TTF", 11, "OUTLINE, MONOCHROME")
fontstring:SetShadowOffset(1, -1)
button:SetFontString(fontstring)
button:SetText("Test")
function OnClickButton(btn)
AIO.Handle("AIOExample", "print")
end
button:SetScript("OnClick", OnClickButton)
print("client")
end
`
Tested on latest version of Trinity Core and it worked well.
The text was updated successfully, but these errors were encountered:
budasnorbi
changed the title
AIO Handle executed twice
AIO Handle executes twice
Aug 14, 2024
Whenever i called AIO.Handle("AIOExample", "print") from a client event handler my print function on the server side got called twice.
But the client side event handler only got triggered once.
I am on the latest version of https://github.com/liyunfan1223/azerothcore-wotlk/tree/Playerbot
test.mp4
Here is the lua code:
`
local AIO = AIO or require("AIO")
local handler = AIO.AddHandlers("AIOExample", {});
if AIO.AddAddon() then
function handler.print()
print("Hello from client")
end
else
-- Create the base frame.
FrameTest = CreateFrame("Frame", "FrameTest", UIParent, "UIPanelDialogTemplate")
local frame = FrameTest
end
`
Tested on latest version of Trinity Core and it worked well.
The text was updated successfully, but these errors were encountered: