local Q=game:GetService("\080\108\097\121\101\114\115")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 N=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 H=h:GetResource("\085\073\046\066\117\116\116\111\110\046\073\109\097\103\101\069\118\101\110\116\066\105\110\100\101\114")local O=h:GetResource("\085\073\046\066\117\116\116\111\110\046\087\105\100\101\084\101\120\116\066\117\116\116\111\110\068\101\099\111\114\097\116\111\114")local U=h:GetResource("\083\116\097\116\101\046\080\108\097\121\101\114\068\097\116\097")local T=N:Extend()T:SetClassName("\067\111\114\110\101\114\077\101\110\117\066\117\116\116\111\110\115")function T.__new(N,h)N:InitializeSuper()local T=Instance.new("\073\109\097\103\101\076\097\098\101\108")T.Name="\077\101\110\117\066\111\116\116\111\109\066\097\114\066\097\099\107\103\114\111\117\110\100"T.Size=UDim2.new(1.8,0,1.8,0)T.SizeConstraint="\082\101\108\097\116\105\118\101\089\089"T.AnchorPoint=Vector2.new(.025,.325)T.BackgroundTransparency=1 T.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\055\050\052\055\050\048"T.Parent=h local J=U.GetPlayerData(Q.LocalPlayer)local t=Instance.new("\073\109\097\103\101\076\097\098\101\108")t.BackgroundTransparency=1 t.Size=UDim2.new(.14,0,.14,0)t.Position=UDim2.new(.22,0,.13,0)t.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\051\048\050\051\050\052\057"t.Parent=T local P=Instance.new("\084\101\120\116\076\097\098\101\108")P.BackgroundTransparency=1 P.Size=UDim2.new(3,0,.85,0)P.Position=UDim2.new(1.05,0,-0.25,0)P.Font=Enum.Font.Antique P.TextScaled=true P.Text=tostring(J:GetValue("\067\117\114\114\101\110\099\121"))P.TextColor3=Color3.new(.93333333333333,.80392156862745,1.0)P.TextStrokeColor3=Color3.new(0,0,0)P.TextStrokeTransparency=0 P.TextXAlignment=Enum.TextXAlignment.Left P.Parent=t;(J:GetValueChangedSignal("\067\117\114\114\101\110\099\121")):Connect(function()P.Text=tostring(J:GetValue("\067\117\114\114\101\110\099\121"))end)local b=Instance.new("\073\109\097\103\101\076\097\098\101\108")b.Name="\073\110\118\101\110\116\111\114\121"b.BackgroundTransparency=1 b.Size=UDim2.new(.5,0,.25,0)b.Position=UDim2.new(.1484375,0,.234375,0)b.Parent=T local B=H.new(b,UDim2.new(.484375,0,.703125,0),"\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\055\049\056\050\048\055","\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\055\049\055\056\051\055","\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\055\049\055\056\052\056")local L=Instance.new("\073\109\097\103\101\076\097\098\101\108")L.BackgroundTransparency=1 L.Size=UDim2.new(.5,0,.25,0)L.Position=UDim2.new(.4609375,0,.234375,0)L.Parent=T local K=H.new(L,UDim2.new(.484375,0,.703125,0),"\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\055\049\056\050\056\056","\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\055\049\055\057\054\050","\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\055\049\055\057\055\054")local W=Instance.new("\073\109\097\103\101\076\097\098\101\108")W.Name="\067\111\108\108\101\099\116\097\098\108\101\115"W.BackgroundTransparency=1 W.Size=UDim2.new(.5,0,.25,0)W.Position=UDim2.new(.1484375,0,.4375,0)W.Parent=T local g=H.new(W,UDim2.new(.484375,0,.703125,0),"\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\055\049\056\049\054\055","\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\055\049\055\055\057\049","\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\055\049\055\056\048\057")local u=Instance.new("\073\109\097\103\101\076\097\098\101\108")u.BackgroundTransparency=1 u.Size=UDim2.new(.5,0,.25,0)u.Position=UDim2.new(.4609375,0,.4375,0)u.Parent=T local q=H.new(u,UDim2.new(.484375,0,.703125,0),"\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\055\049\056\050\053\054","\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\055\049\055\057\048\052","\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\055\049\055\057\050\056")local I=Instance.new("\073\109\097\103\101\076\097\098\101\108")I.BackgroundTransparency=1 I.Size=UDim2.new(.54230769230769,0,.15,0)I.SizeConstraint=Enum.SizeConstraint.RelativeYY I.Position=UDim2.new(.16,0,.65,0)I.Parent=T local r=O.new(I,"\067\082\069\068\073\084\083")local p=Instance.new("\070\111\108\100\101\114")p.Name="\071\117\105\079\112\101\110\083\116\097\116\101\115"p.Parent=Q.LocalPlayer:WaitForChild("\080\108\097\121\101\114\071\117\105")N.GuiOpenStatesFolder=p N:ConnectButton(B.Button,"\073\110\118\101\110\116\111\114\121")N:ConnectButton(K.Button,"\083\116\111\114\101")N:ConnectButton(g.Button,"\067\111\108\108\101\099\116\097\098\108\101\115")N:ConnectButton(q.Button,"\081\117\101\115\116\115")N:ConnectButton(r.Button,"\067\114\101\100\105\116\115")end function T.ConnectButton(N,Q,h)local H=Instance.new("\066\111\111\108\086\097\108\117\101")H.Name=h H.Value=false H.Parent=N.GuiOpenStatesFolder local O=true Q.MouseButton1Down:Connect(function()if O then O=false H.Value=not H.Value wait()O=true end end)end return T
--[[
TheNexusAvenger

Menu buttons for the bottom bar.
--]]

local Players = game:GetService("Players")

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

local NexusObject = ReplicatedStorageProject:GetResource("ExternalUtil.NexusInstance.NexusObject")
local ImageEventBinder = ReplicatedStorageProject:GetResource("UI.Button.ImageEventBinder")
local WideTextButtonDecorator = ReplicatedStorageProject:GetResource("UI.Button.WideTextButtonDecorator")
local PlayerData = ReplicatedStorageProject:GetResource("State.PlayerData")

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



--[[
Creates corner menu buttons.
--]]
function CornerMenuButtons:__new(BottomFrame)
    self:InitializeSuper()

    --Create the bottom bar container.
    local MenuBottomBarBackground = Instance.new("ImageLabel")
    MenuBottomBarBackground.Name = "MenuBottomBarBackground"
    MenuBottomBarBackground.Size = UDim2.new(1.8,0,1.8,0)
    MenuBottomBarBackground.SizeConstraint = "RelativeYY"
    MenuBottomBarBackground.AnchorPoint = Vector2.new(0.025,0.325)
    MenuBottomBarBackground.BackgroundTransparency = 1
    MenuBottomBarBackground.Image = "rbxassetid://132724720"
    MenuBottomBarBackground.Parent = BottomFrame

    --Create the currency display.
    local StatsPlayerData = PlayerData.GetPlayerData(Players.LocalPlayer)
    local CandyIcon = Instance.new("ImageLabel")
    CandyIcon.BackgroundTransparency = 1
    CandyIcon.Size = UDim2.new(0.14,0,0.14,0)
    CandyIcon.Position = UDim2.new(0.22,0,0.13,0)
    CandyIcon.Image = "rbxassetid://133023249"
    CandyIcon.Parent = MenuBottomBarBackground

    local CandyText = Instance.new("TextLabel")
    CandyText.BackgroundTransparency = 1
    CandyText.Size = UDim2.new(3,0,0.85,0)
    CandyText.Position = UDim2.new(1.05,0,-0.25,0)
    CandyText.Font = Enum.Font.Antique
    CandyText.TextScaled = true
    CandyText.Text = tostring(StatsPlayerData:GetValue("Currency"))
    CandyText.TextColor3 = Color3.new(238/255,205/255,255/255)
    CandyText.TextStrokeColor3 = Color3.new(0,0,0)
    CandyText.TextStrokeTransparency = 0
    CandyText.TextXAlignment = Enum.TextXAlignment.Left
    CandyText.Parent = CandyIcon

    StatsPlayerData:GetValueChangedSignal("Currency"):Connect(function()
        CandyText.Text = tostring(StatsPlayerData:GetValue("Currency"))
    end)
    
    --Create the buttons.
    local InventoryImage = Instance.new("ImageLabel")
    InventoryImage.Name = "Inventory"
    InventoryImage.BackgroundTransparency = 1
    InventoryImage.Size = UDim2.new(128/256,0,64/256,0)
    InventoryImage.Position = UDim2.new(38/256,0,60/256,0)
    InventoryImage.Parent = MenuBottomBarBackground
    local InventoryButton = ImageEventBinder.new(InventoryImage,UDim2.new(62/128,0,45/64,0),"rbxassetid://132718207","rbxassetid://132717837","rbxassetid://132717848")

    local StoreImage = Instance.new("ImageLabel")
    StoreImage.BackgroundTransparency = 1
    StoreImage.Size = UDim2.new(128/256,0,64/256,0)
    StoreImage.Position = UDim2.new(118/256,0,60/256,0)
    StoreImage.Parent = MenuBottomBarBackground
    local StoreButton = ImageEventBinder.new(StoreImage,UDim2.new(62/128,0,45/64,0),"rbxassetid://132718288","rbxassetid://132717962","rbxassetid://132717976")

    local CollectablesImage = Instance.new("ImageLabel")
    CollectablesImage.Name = "Collectables"
    CollectablesImage.BackgroundTransparency = 1
    CollectablesImage.Size = UDim2.new(128/256,0,64/256,0)
    CollectablesImage.Position = UDim2.new(38/256,0,112/256,0)
    CollectablesImage.Parent = MenuBottomBarBackground
    local CollectablesButton = ImageEventBinder.new(CollectablesImage,UDim2.new(62/128,0,45/64,0),"rbxassetid://132718167","rbxassetid://132717791","rbxassetid://132717809")

    local QuestsImage = Instance.new("ImageLabel")
    QuestsImage.BackgroundTransparency = 1
    QuestsImage.Size = UDim2.new(128/256,0,64/256,0)
    QuestsImage.Position = UDim2.new(118/256,0,112/256,0)
    QuestsImage.Parent = MenuBottomBarBackground
    local QuestsButton = ImageEventBinder.new(QuestsImage,UDim2.new(62/128,0,45/64,0),"rbxassetid://132718256","rbxassetid://132717904","rbxassetid://132717928")

    local CreditsImage = Instance.new("ImageLabel")
    CreditsImage.BackgroundTransparency = 1
    CreditsImage.Size = UDim2.new(0.15 * (188/52),0,0.15,0)
    CreditsImage.SizeConstraint = Enum.SizeConstraint.RelativeYY
    CreditsImage.Position = UDim2.new(0.16,0,0.65,0)
    CreditsImage.Parent = MenuBottomBarBackground
    local CreditsButton = WideTextButtonDecorator.new(CreditsImage,"CREDITS")

    --Set up the buttons.
    local GuiOpenStatesFolder = Instance.new("Folder")
    GuiOpenStatesFolder.Name = "GuiOpenStates"
    GuiOpenStatesFolder.Parent = Players.LocalPlayer:WaitForChild("PlayerGui")
    self.GuiOpenStatesFolder = GuiOpenStatesFolder

    self:ConnectButton(InventoryButton.Button,"Inventory")
    self:ConnectButton(StoreButton.Button,"Store")
    self:ConnectButton(CollectablesButton.Button,"Collectables")
    self:ConnectButton(QuestsButton.Button,"Quests")
    self:ConnectButton(CreditsButton.Button,"Credits")
end

--[[
Connects a button for a given open state.
--]]
function CornerMenuButtons:ConnectButton(Button,OpenStateName)
    --Set up the open state value.
    local ValueObject = Instance.new("BoolValue")
    ValueObject.Name = OpenStateName
    ValueObject.Value = false
    ValueObject.Parent = self.GuiOpenStatesFolder
    
    --Connect the button.
    local DB = true
    Button.MouseButton1Down:Connect(function()
        if DB then
            DB = false
            ValueObject.Value = not ValueObject.Value
            wait()
            DB = true
        end
    end)
end



return CornerMenuButtons