Last active
July 15, 2023 14:38
-
-
Save Meorawr/7ce869fbd64dd6964ec086d910de2852 to your computer and use it in GitHub Desktop.
Radial Wheel Experiment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LoadAddOn("Blizzard_RadialWheel") | |
local EmoteWedges = | |
{ | |
{ | |
type = "ROAR", | |
icon = "Ping_Wheel_Icon_OnMyWay", | |
text = "Test Wedge 1", | |
}, | |
{ | |
type = "SNARL", | |
icon = "Ping_Wheel_Icon_Warning", | |
text = "Test Wedge 2", | |
}, | |
{ | |
type = "PRAY", | |
icon = "Ping_Wheel_Icon_Assist_Glow", | |
text = "Test Wedge 3", | |
}, | |
{ | |
type = "DRINK", | |
icon = "Ping_Wheel_Icon_Attack", | |
text = "Test Wedge 4", | |
}, | |
} | |
local EmoteWheelFrame = CreateFrame("Frame", nil, UIParent, "RadialWheelFrameTemplate") | |
EmoteWheelFrame:SetAllPoints(UIParent) | |
EmoteWheelFrame:SetFrameStrata("HIGH") | |
EmoteWheelFrame:SetShown(false) | |
EmoteWheelFrame:SetToplevel(true) | |
EmoteWheelFrame.radialParent = EmoteWheelFrame | |
local EmoteListenerFrame = CreateFrame("Frame") | |
EmoteListenerFrame:SetAllPoints(nil) | |
EmoteListenerFrame:SetFrameStrata("FULLSCREEN") | |
EmoteListenerFrame:SetPropagateKeyboardInput(false) | |
function EmoteListenerFrame:OnLoad() | |
self.keys = {} | |
self.radialParent = self | |
self:SetScript("OnKeyDown", self.OnKeyDown) | |
self:SetScript("OnKeyUp", self.OnKeyUp) | |
end | |
function EmoteListenerFrame:OnKeyDown(key) | |
self.keys[key] = true | |
self:SetWheelShown(self:ShouldShowWheel()) | |
end | |
function EmoteListenerFrame:OnKeyUp(key) | |
self.keys[key] = false | |
self:SetWheelShown(self:ShouldShowWheel()) | |
end | |
function EmoteListenerFrame:ShouldShowWheel() | |
return IsControlKeyDown() and self.keys["E"] | |
end | |
function EmoteListenerFrame:SetWheelShown(shown) | |
if shown then | |
self:ShowWheel() | |
else | |
self:HideWheel() | |
end | |
end | |
function EmoteListenerFrame:HideWheel() | |
if not EmoteWheelFrame:IsShown() then | |
return | |
end | |
self:SetPropagateKeyboardInput(true) | |
local result = EmoteWheelFrame:SelectionEnd() | |
EmoteWheelFrame:Hide() | |
if result then | |
DoEmote(result.type, "none") | |
end | |
end | |
function EmoteListenerFrame:ShowWheel() | |
if EmoteWheelFrame:IsShown() then | |
return | |
end | |
local isSmall = false | |
local cooldownInfo = nil | |
EmoteWheelFrame:Show() | |
EmoteWheelFrame:SelectionStart(EmoteWedges, isSmall, cooldownInfo) | |
self:SetPropagateKeyboardInput(false) | |
end | |
EmoteListenerFrame:OnLoad() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment