local H=require(((game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")):WaitForChild("\080\114\111\106\101\099\116")):WaitForChild("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101"))local u=H:GetResource("\069\120\116\101\114\110\097\108\085\116\105\108\046\078\101\120\117\115\073\110\115\116\097\110\099\101\046\078\101\120\117\115\079\098\106\101\099\116")local z=u:Extend()z:SetClassName("\073\109\097\103\101\069\118\101\110\116\066\105\110\100\101\114")function z.__new(W,H,u,z,A,Z)W:InitializeSuper()local s=Instance.new("\084\101\120\116\066\117\116\116\111\110")s.BackgroundTransparency=1 s.Size=u s.Text=""s.ZIndex=H.ZIndex s.Parent=H W.ImageLabel=H W.BaseImage=z W.HoverImage=A W.PressImage=Z W.Hovering=false W.Pressing=false W.Button=s s.MouseEnter:Connect(function()W.Hovering=true W:UpdateImage()end)s.MouseLeave:Connect(function()W.Hovering=false W.Pressing=false W:UpdateImage()end)s.MouseButton1Down:Connect(function()W.Pressing=true W:UpdateImage()end)s.MouseButton1Up:Connect(function()W.Pressing=false W:UpdateImage()end)W:UpdateImage()end function z.UpdateImage(H)if H.Pressing then H.ImageLabel.Image=H.PressImage elseif H.Hovering then H.ImageLabel.Image=H.HoverImage else H.ImageLabel.Image=H.BaseImage end end return z
--[[
TheNexusAvenger

Binds changing the images of buttons.
--]]

local ReplicatedStorageProject = require(game:GetService("ReplicatedStorage"):WaitForChild("Project"):WaitForChild("ReplicatedStorage"))

local NexusObject = ReplicatedStorageProject:GetResource("ExternalUtil.NexusInstance.NexusObject")

local ImageEventBinder = NexusObject:Extend()
ImageEventBinder:SetClassName("ImageEventBinder")



--[[
Creates an event binder.
--]]
function ImageEventBinder:__new(ImageLabel,ButtonSize,BaseImage,HoverImage,PressImage)
    self:InitializeSuper()

    --Create the button.
    local Button = Instance.new("TextButton")
    Button.BackgroundTransparency = 1
    Button.Size = ButtonSize
    Button.Text = ""
    Button.ZIndex = ImageLabel.ZIndex
    Button.Parent = ImageLabel

    --Storage the state.
    self.ImageLabel = ImageLabel
    self.BaseImage = BaseImage
    self.HoverImage = HoverImage
    self.PressImage = PressImage
    self.Hovering = false
    self.Pressing = false
    self.Button = Button

    --Connect the events.
    Button.MouseEnter:Connect(function()
        self.Hovering = true
        self:UpdateImage()
    end)
    Button.MouseLeave:Connect(function()
        self.Hovering = false
        self.Pressing = false
        self:UpdateImage()
    end)
    Button.MouseButton1Down:Connect(function()
        self.Pressing = true
        self:UpdateImage()
    end)
    Button.MouseButton1Up:Connect(function()
        self.Pressing = false
        self:UpdateImage()
    end)
    self:UpdateImage()
end

--[[
Updates image of the button.
--]]
function ImageEventBinder:UpdateImage()
    if self.Pressing then
        self.ImageLabel.Image = self.PressImage
    elseif self.Hovering then
        self.ImageLabel.Image = self.HoverImage
    else
        self.ImageLabel.Image = self.BaseImage
    end
end



return ImageEventBinder