Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.setBackgroundColor(colors.gray)
- term.setTextColor(colors.white)
- term.clear()
- local selectedMenuPoint = "Home"
- local isServerOnline = false
- local function square(sX,sY,eX,eY,col)
- term.setBackgroundColor(col)
- for i = sY,eY do
- term.setCursorPos(sX,i)
- for i = sX,eX do
- term.write(" ")
- end
- end
- end
- local function drawTopMenu()
- if selectedMenuPoint == "Home" then
- term.setCursorPos(1,1)
- term.setTextColor(colors.black)
- term.setBackgroundColor(colors.lightGray)
- for i = 1, 17 do
- term.write(" ")
- end
- term.setCursorPos(2,1)
- term.write("Home")
- term.setCursorPos(18,1)
- term.setBackgroundColor(colors.gray)
- term.setTextColor(colors.white)
- for i = 1, 17 do
- term.write(" ")
- end
- term.setCursorPos(19,1)
- term.write("Server")
- term.setCursorPos(35,1)
- for i = 1, 17 do
- term.write(" ")
- end
- term.setCursorPos(37,1)
- term.write("File")
- elseif selectedMenuPoint == "Server" then
- term.setCursorPos(1,1)
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.gray)
- for i = 1, 17 do
- term.write(" ")
- end
- term.setCursorPos(2,1)
- term.write("Home")
- term.setCursorPos(18,1)
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.black)
- for i = 1, 17 do
- term.write(" ")
- end
- term.setCursorPos(19,1)
- term.write("Server")
- term.setCursorPos(35,1)
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.gray)
- for i = 1, 17 do
- term.write(" ")
- end
- term.setCursorPos(37,1)
- term.write("File")
- elseif selectedMenuPoint == "File" then
- term.setCursorPos(1,1)
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.gray)
- for i = 1, 17 do
- term.write(" ")
- end
- term.setCursorPos(2,1)
- term.write("Home")
- term.setCursorPos(18,1)
- for i = 1, 17 do
- term.write(" ")
- end
- term.setCursorPos(19,1)
- term.write("Server")
- term.setTextColor(colors.black)
- term.setBackgroundColor(colors.lightGray)
- term.setCursorPos(35,1)
- for i = 1, 17 do
- term.write(" ")
- end
- term.setCursorPos(37,1)
- term.write("File")
- end
- end
- local function drawContent()
- if selectedMenuPoint == "Home" then
- term.setTextColor(colors.gray)
- term.setBackgroundColor(colors.white)
- for i = 2, 19 do
- term.setCursorPos(1,i)
- for j = 1, 51 do
- term.write(" ")
- end
- end
- square(5,4,51-5,8,colors.lightGray)
- term.setCursorPos(6,5)
- term.write("The server is "..(isServerOnline and "online" or "offline"))
- term.setCursorPos(6,7)
- term.write("Version: fPanel Spaghetti (1.1)")
- elseif selectedMenuPoint == "Server" then
- term.setTextColor(colors.gray)
- term.setBackgroundColor(colors.white)
- for i = 2, 19 do
- term.setCursorPos(1,i)
- for j = 1, 51 do
- term.write(" ")
- end
- end
- term.setCursorPos(2,4)
- term.write("The server is "..(isServerOnline and "online" or "offline").. " press c to change it")
- term.setCursorPos(3,5)
- term.write("It's only an example,so you can't change it")
- elseif selectedMenuPoint == "File" then
- term.setTextColor(colors.gray)
- term.setBackgroundColor(colors.white)
- for i = 2, 19 do
- term.setCursorPos(1,i)
- for j = 1, 51 do
- term.write(" ")
- end
- end
- term.setCursorPos(3,4)
- term.setBackgroundColor(colors.lightGray)
- term.write(" You can't use this cause It's just an example")
- term.setCursorPos(3,6)
- term.write("upload")
- end
- end
- drawTopMenu()
- local function topMenuClickHandle()
- while true do
- local evt,btn,x,y = os.pullEvent("mouse_click")
- if x >= 1 and x <= 17 and y == 1 and selectedMenuPoint ~= "Home" then
- selectedMenuPoint = "Home"
- drawTopMenu()
- drawContent()
- elseif x >= 17+1 and x <= 17*2 and y == 1 and selectedMenuPoint ~= "Server" then
- selectedMenuPoint = "Server"
- drawTopMenu()
- drawContent()
- --[[while selectedMenuPoint == "Server" do
- local evt,btn,x,y = os.pullEvent("mouse_click")
- if x >= 5+string.len("The server is "..(isServerOnline and "online" or "offline").. "click -) ") and x <= 5+string.len("The server is "..(isServerOnline and "online" or "offline").. "click -) ")+4 and y == 4 then
- isServerOnline = not isServerOnline
- end
- sleep(0)
- end]]--
- while selectedMenuPoint == "Server" do
- local evt, char = os.pullEvent("char")
- if char == "c" then
- isServerOnline = not isServerOnline
- selectedMenuPoint = "Home"
- drawTopMenu()
- drawContent()
- end
- sleep(0)
- end
- elseif x >= (17*2)+1 and x <= 51 and y == 1 and selectedMenuPoint ~= "File" then
- selectedMenuPoint = "File"
- drawTopMenu()
- drawContent()
- end
- sleep(0)
- end
- end
- topMenuClickHandle()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement