Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local User = ""
- local Emails = {{From="From", Subject="Subject", Content="Content"}, {From="Cesar", Subject="New program", Content="ContentContentContentContentContent"}}
- function main()
- PageLogin()
- end
- function PageLogin()
- User = ""
- local Password = ""
- while (true) do
- --Paint
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.setCursorPos(23,2)
- print("E-MAIL")
- paintutils.drawFilledBox(19, 5, 32, 14, colors.yellow)
- term.setCursorPos(20,6)
- print("User:")
- term.setCursorPos(20,9)
- print("Password:")
- term.setCursorPos(20,12)
- term.setTextColor(colors.blue)
- print("New account?")
- paintutils.drawLine(20, 7, 31, 7, colors.black)
- paintutils.drawLine(20, 10, 31, 10, colors.black)
- paintutils.drawFilledBox(22, 16, 29, 18, colors.green)
- term.setCursorPos(23,17)
- term.setTextColor(colors.white)
- print("Log In")
- paintutils.drawPixel(20, 7, colors.black)
- term.setCursorPos(20,7)
- term.setTextColor(colors.white)
- print(User)
- local secret = ""
- for i = 1,string.len(Password) do
- secret = secret .. "*"
- end
- term.setCursorPos(20,10)
- term.setTextColor(colors.white)
- print(secret)
- local event, button, x, y = os.pullEvent("mouse_click")
- if (y == 7 and x >= 20 and x <= 31) then
- paintutils.drawLine(20, 7, 31, 7, colors.black)
- term.setCursorPos(20,7)
- term.setTextColor(colors.white)
- User = read()
- elseif (y == 10 and x >= 20 and x <= 31) then
- paintutils.drawLine(20, 10, 31, 10, colors.black)
- term.setCursorPos(20,10)
- term.setTextColor(colors.white)
- Password = read("*")
- elseif (y == 12 and x >= 20 and x <= 31) then
- PageNewAccount()
- elseif (y >= 16 and y <= 18 and x >= 22 and x <= 29) then
- PageInvoice()
- end
- end
- end
- function PageNewAccount()
- local Loop = true
- local User = ""
- local Password = ""
- local ConfirmPassword = ""
- while (Loop) do
- --Paint
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.setCursorPos(23,2)
- print("E-MAIL")
- paintutils.drawFilledBox(19, 5, 32, 14, colors.yellow)
- term.setCursorPos(20,6)
- print("User:")
- term.setCursorPos(20,9)
- print("Password:")
- term.setCursorPos(20,12)
- print("Confirm pass:")
- paintutils.drawPixel(2,2,colors.red)
- term.setCursorPos(2,2)
- print("< Back")
- paintutils.drawLine(20, 7, 31, 7, colors.black)
- paintutils.drawLine(20, 10, 31, 10, colors.black)
- paintutils.drawLine(20, 13, 31, 13, colors.black)
- paintutils.drawFilledBox(21, 16, 30, 18, colors.green)
- term.setCursorPos(22,17)
- term.setTextColor(colors.white)
- print("Register")
- paintutils.drawPixel(20, 7, colors.black)
- term.setCursorPos(20,7)
- term.setTextColor(colors.white)
- print(User)
- local secret = ""
- for i = 1,string.len(Password) do
- secret = secret .. "*"
- end
- term.setCursorPos(20,10)
- term.setTextColor(colors.white)
- print(secret)
- secret = ""
- for i = 1,string.len(ConfirmPassword) do
- secret = secret .. "*"
- end
- term.setCursorPos(20,13)
- term.setTextColor(colors.white)
- print(secret)
- local event, button, x, y = os.pullEvent("mouse_click")
- if (y == 7 and x >= 20 and x <= 31) then
- paintutils.drawLine(20, 7, 31, 7, colors.black)
- term.setCursorPos(20,7)
- term.setTextColor(colors.white)
- User = read()
- elseif (y == 10 and x >= 20 and x <= 31) then
- paintutils.drawLine(20, 10, 31, 10, colors.black)
- term.setCursorPos(20,10)
- term.setTextColor(colors.white)
- Password = read("*")
- elseif (y == 13 and x >= 20 and x <= 31) then
- paintutils.drawLine(20, 13, 31, 13, colors.black)
- term.setCursorPos(20,13)
- term.setTextColor(colors.white)
- ConfirmPassword = read("*")
- elseif (y == 2 and x >= 2 and x <= 7) then
- Loop = false
- elseif (y >= 16 and y <= 18 and x >= 21 and x <= 31) then
- --register here
- if (true) then
- Loop = false
- end
- end
- end
- end
- function PageInvoice()
- local Loop = true
- local mailIndex = nil
- while(Loop) do
- --Paint
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- paintutils.drawFilledBox(1, 1, 51, 3, colors.yellow)
- paintutils.drawLine(15, 4, 15, 19, colors.black)
- for i=4,19,3 do
- if (i%2==0) then
- paintutils.drawFilledBox(1,i,14,i+2, colors.white)
- else
- paintutils.drawFilledBox(1,i,14,i+2, colors.pink)
- end
- end
- local y = 4
- for i,mail in ipairs(Emails) do
- if (y%2==0) then
- paintutils.drawPixel(2,y,colors.white)
- else
- paintutils.drawPixel(2,y,colors.pink)
- end
- term.setCursorPos(2,y)
- print(mail.From)
- term.setCursorPos(2,y+1)
- print(mail.Subject)
- y=y+3
- end
- term.setTextColor(colors.white)
- paintutils.drawPixel(44, 2, colors.red)
- term.setCursorPos(44,2)
- print("Log out")
- paintutils.drawPixel(2, 2, colors.green)
- term.setCursorPos(2,2)
- print("New email")
- term.setTextColor(colors.black)
- for i,mail in ipairs(Emails) do
- if (i==mailIndex) then
- paintutils.drawPixel(17, 5, colors.white)
- term.setCursorPos(17,5)
- print("From: ")
- paintutils.drawLine(25, 5, 50, 5, colors.lightBlue)
- term.setCursorPos(22,5)
- print(mail.From)
- paintutils.drawPixel(17, 6, colors.white)
- term.setCursorPos(17,6)
- print("Subject: ")
- paintutils.drawLine(25, 6, 50, 6, colors.lightBlue)
- term.setCursorPos(25,6)
- print(mail.Subject)
- paintutils.drawPixel(17, 7, colors.white)
- term.setCursorPos(17,7)
- print("Content:")
- paintutils.drawFilledBox(17,8,50,18, colors.lightBlue)
- local startY = 8
- local startX = 17
- for i = 1, #mail.Content do
- if (startX >= 50) then
- startX = 17
- startY = startY + 1
- end
- local c = mail.Content:sub(i,i)
- term.setCursorPos(startX,startY)
- print(c)
- startX = startX + 1
- end
- end
- end
- local event, button, x, y = os.pullEvent("mouse_click")
- if (y == 2 and x >= 44 and x <= 50) then
- Loop = false
- elseif (y == 2 and x >= 2 and x <= 10) then
- PageNew()
- end
- local iy = 4
- for i,mail in ipairs(Emails) do
- if (x >= 1 and x <= 14 and y >= iy and y <= iy+2) then
- mailIndex = i
- end
- iy=iy+3
- end
- end
- end
- function PageNew()
- local mail = {From=User, Subject="", Content="", To=""}
- local Loop = true
- while (Loop) do
- --Paint
- term.setBackgroundColor(colors.white)
- term.clear()
- paintutils.drawFilledBox(1, 1, 51, 3, colors.yellow)
- term.setTextColor(colors.white)
- paintutils.drawPixel(44, 2, colors.red)
- term.setCursorPos(44,2)
- print("Cancel")
- paintutils.drawPixel(2, 2, colors.green)
- term.setCursorPos(2,2)
- print("Send")
- term.setTextColor(colors.black)
- paintutils.drawPixel(2, 5, colors.white)
- term.setCursorPos(2,5)
- print("Destination: ")
- paintutils.drawLine(14, 5, 50, 5, colors.lightBlue)
- term.setCursorPos(14,5)
- print(mail.To)
- paintutils.drawPixel(2, 6, colors.white)
- term.setCursorPos(2,6)
- print("Subject: ")
- paintutils.drawLine(10, 6, 50, 6, colors.lightBlue)
- term.setCursorPos(10,6)
- print(mail.Subject)
- paintutils.drawPixel(2, 7, colors.white)
- term.setCursorPos(2,7)
- print("Content:")
- paintutils.drawFilledBox(2,8,50,18, colors.lightBlue)
- term.setCursorPos(2,8)
- print(mail.Content)
- local event, button, x, y = os.pullEvent("mouse_click")
- if (y == 2 and x >= 44 and x <= 49) then
- Loop = false
- elseif (y == 2 and x >= 2 and x <= 5) then
- -- Send email
- Loop = false
- elseif (y == 5 and x >= 14 and x <= 50) then
- term.setCursorPos(14,5)
- mail.To = read()
- elseif (y == 6 and x >= 10 and x <= 50) then
- term.setCursorPos(10,6)
- mail.Subject = read()
- elseif (y >= 8 and y <= 18 and x >= 2 and x <= 50) then
- term.setCursorPos(2,8)
- mail.Content = read()
- end
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment