Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Tutorial in die Stavros Reaktorprogramme
- -- Dieses Programm ist ein Autoupdater und Starter
- -- fuer das Stavros Reaktoranzeige-Programm.
- -- Es zeigt die Werte einen Big Reaktors
- -- (aktiv/passiv) auf einem Monitor an.
- -- Es aktualisiert sich selbst und startet
- -- automatisch mit dem Pc.
- -- Damit es arbeitet, schliesse per Modem
- -- mindestens einen Monitor von 4x3,
- -- einen Reaktor und optional einen
- -- Alarm auf den PC an.
- -- Fuer Fragen melde dich bitte bei PlatinKinggg
- -- Copyright PlatinKinggg
- -- Frei zur Verteilung
- -- Viel Spass mit dem Programm :D
- debugLevel = 1
- require("Funktionen")
- programInitialize()
- -- Start der Programmschleife
- timerID = os.startTimer(1)
- while true do
- event, param1, param2, param3 = os.pullEvent()
- --[[
- In diesem Abschnitt des Hauptprogramms werden die Anzeigen verarbeitet. Dies geschieht durch Timer-Events, die sekündlich ausgelöst werden.
- ]]
- if event == "timer" then
- if page == -100 then
- monitor.clear()
- display.bootScreen("Starte Programm neu...")
- os.reboot()
- elseif page == -99 then
- monitor.clear()
- display.interface("Hauptseite", " Zurück")
- display.aboutAutor()
- elseif page == -2 then
- baseTask()
- pageHeader = "Systemsteuerung"
- display.interface("Hauptseite", " Systemsteuerung")
- display.systemControl()
- elseif page == -1 then
- baseTask()
- display.interface("Zurück", "Speichern")
- display.optionSettingEntry(currentOptionRow)
- elseif page == 0 then
- baseTask()
- if currentOptionPage == 1 then
- pageHeader = "Optionen - Seite 1"
- elseif currentOptionPage == 2 then
- pageHeader = "Optionen - Seite 2"
- elseif currentOptionPage == 3 then
- pageHeader = "Optionen - Seite 3"
- end
- display.interface("Hauptseite", " Systemsteuerung")
- display.optionMain()
- elseif page == 1 then
- baseTask()
- pageHeader = "Übersicht"
- display.interface("Hauptseite", " Systemsteuerung")
- display.pageMain()
- elseif page == 2 then
- baseTask()
- pageHeader = "Energieproduktion"
- display.interface("Hauptseite", " Systemsteuerung")
- windowCreate.pageRF()
- display.pageRF()
- elseif page == 3 then
- baseTask()
- pageHeader = "Brennstoff-Info"
- display.interface("Hauptseite", " Systemsteuerung")
- windowCreate.pageFuel()
- display.pageFuel()
- elseif page == 4 then
- baseTask()
- pageHeader = "Brennstoff-Effizienz"
- display.interface("Hauptseite", " Systemsteuerung")
- display.pageEfficiency()
- end
- --[[
- Der Bereich event == "monitor_touch" regelt alle Aktionen bei Bedienung des Monitors, wie z.B. die Änderung der Seite oder Auslösung von Aktionen.
- ]]
- elseif event == "monitor_touch" then
- os.cancelTimer(timerID)
- os.queueEvent("timer", 1)
- if touchCheck(param2, param3, optionButtonWindowInfo) == true then
- page = 0
- currentOptionPage = 1
- elseif page == -99 then
- if touchCheck(param2, param3, leftCenterButtonWindowInfo, monitorHeight - 5) then
- page = configTable[5]
- elseif touchCheck(param2, param3, rightCenterButtonWindowInfo, monitorHeight - 5) then
- page = -2
- currentSettingsPage = 1
- page = pageOld
- end
- elseif page == -2 then
- if touchCheck(param2, param3, leftCenterButtonWindowInfo, monitorHeight - 5) then
- page = configTable[5]
- elseif touchCheck(param2, param3, rightCenterButtonWindowInfo, monitorHeight - 5) then
- page = -2
- currentSettingsPage = 1
- elseif touchCheck(param2, param3, leftButtonWindowInfo, monitorHeight - 5) then
- currentSettingsPage = currentSettingsPage - 1
- if currentSettingsPage < 1 then
- currentSettingsPage = 2
- end
- elseif touchCheck(param2, param3, rightButtonWindowInfo, monitorHeight - 5) then
- currentSettingsPage = currentSettingsPage + 1
- if currentSettingsPage > 2 then
- currentSettingsPage = 1
- end
- elseif touchCheck(param2, param3, systemControlWindowInfo[1], 5) then
- if currentSettingsPage == 1 then
- pageOld = page
- page = -99
- elseif currentSettingsPage == 2 then
- if reactorActive == true then
- setActive(false)
- else
- setActive(true)
- end
- end
- elseif touchCheck(param2, param3, systemControlWindowInfo[2], 5) then
- if currentSettingsPage == 1 then
- elseif currentSettingsPage == 2 then
- setAllControlRodLevels(0)
- end
- elseif touchCheck(param2, param3, systemControlWindowInfo[3], 5) then
- if currentSettingsPage == 1 then
- elseif currentSettingsPage == 2 then
- ejectWaste()
- end
- elseif touchCheck(param2, param3, systemControlWindowInfo[4], 5) then
- if currentSettingsPage == 1 then
- elseif currentSettingsPage == 2 then
- page = -100
- end
- end
- elseif page == -1 then
- if touchCheck(param2, param3, leftButtonWindowInfo, monitorHeight - 5) then
- configTableManipulator = configTableManipulator - 1
- elseif touchCheck(param2, param3, rightButtonWindowInfo, monitorHeight - 5) then
- configTableManipulator = configTableManipulator + 1
- elseif touchCheck(param2, param3, leftCenterButtonWindowInfo, monitorHeight - 5) then
- page = page + 1
- elseif touchCheck(param2, param3, rightCenterButtonWindowInfo, monitorHeight - 5) then
- configTable[selectedConfig] = (configTable[selectedConfig] + configTableManipulator)
- config.save()
- page = 0
- end
- elseif page == 0 then
- if touchCheck(param2, param3, leftButtonWindowInfo, monitorHeight - 5) then
- currentOptionPage = currentOptionPage - 1
- if currentOptionPage < 1 then
- currentOptionPage = 3
- end
- elseif touchCheck(param2, param3, rightButtonWindowInfo, monitorHeight - 5) then
- currentOptionPage = currentOptionPage + 1
- if currentOptionPage > 3 then
- currentOptionPage = 1
- end
- elseif touchCheck(param2, param3, leftCenterButtonWindowInfo, monitorHeight - 5) then
- page = configTable[5]
- elseif touchCheck(param2, param3, rightCenterButtonWindowInfo, monitorHeight - 5) then
- page = -2
- currentSettingsPage = 1
- elseif touchCheck(param2, param3, optionMainWindowInfo[1], 5) then
- pageOld = page
- page = -1
- currentOptionRow = 1
- configTableManipulator = 0
- newConfigValue = nil
- selectedConfig = nil
- elseif touchCheck(param2, param3, optionMainWindowInfo[2], 5) then
- pageOld = page
- page = -1
- currentOptionRow = 2
- configTableManipulator = 0
- newConfigValue = nil
- selectedConfig = nil
- elseif touchCheck(param2, param3, optionMainWindowInfo[3], 5) then
- pageOld = page
- page = -1
- currentOptionRow = 3
- configTableManipulator = 0
- newConfigValue = nil
- selectedConfig = nil
- elseif touchCheck(param2, param3, optionMainWindowInfo[4], 5) then
- pageOld = page
- page = -1
- currentOptionRow = 4
- configTableManipulator = 0
- newConfigValue = nil
- selectedConfig = nil
- end
- elseif page == 1 then
- if touchCheck(param2, param3, leftCenterButtonWindowInfo, monitorHeight - 5) then
- page = configTable[5]
- elseif touchCheck(param2, param3, rightCenterButtonWindowInfo, monitorHeight - 5) then
- page = -2
- currentSettingsPage = 1
- elseif touchCheck(param2, param3, leftButtonWindowInfo, monitorHeight - 5) then
- page = page - 1
- pageCheck()
- elseif touchCheck(param2, param3, rightButtonWindowInfo, monitorHeight - 5) then
- page = page + 1
- pageCheck()
- end
- elseif page == 2 then
- if touchCheck(param2, param3, leftCenterButtonWindowInfo, monitorHeight - 5) then
- page = configTable[5]
- elseif touchCheck(param2, param3, rightCenterButtonWindowInfo, monitorHeight - 5) then
- page = -2
- currentSettingsPage = 1
- elseif touchCheck(param2, param3, leftButtonWindowInfo, monitorHeight - 5) then
- page = page - 1
- pageCheck()
- elseif touchCheck(param2, param3, rightButtonWindowInfo, monitorHeight - 5) then
- page = page + 1
- pageCheck()
- end
- elseif page == 3 then
- if touchCheck(param2, param3, leftCenterButtonWindowInfo, monitorHeight - 5) then
- page = configTable[5]
- elseif touchCheck(param2, param3, rightCenterButtonWindowInfo, monitorHeight - 5) then
- page = -2
- currentSettingsPage = 1
- elseif touchCheck(param2, param3, leftButtonWindowInfo, monitorHeight - 5) then
- page = page - 1
- pageCheck()
- elseif touchCheck(param2, param3, rightButtonWindowInfo, monitorHeight - 5) then
- page = page + 1
- pageCheck()
- end
- elseif page == 4 then
- if touchCheck(param2, param3, leftCenterButtonWindowInfo, monitorHeight - 5) then
- page = configTable[5]
- elseif touchCheck(param2, param3, rightCenterButtonWindowInfo, monitorHeight - 5) then
- page = -2
- currentSettingsPage = 1
- elseif touchCheck(param2, param3, leftButtonWindowInfo, monitorHeight - 5) then
- page = page - 1
- pageCheck()
- elseif touchCheck(param2, param3, rightButtonWindowInfo, monitorHeight - 5) then
- page = page + 1
- pageCheck()
- end
- end
- --[[
- In diesem Abschnitt des Hauptprogramms werden Änderungen an der Monitorgröße verarbeitet und die Anzeigen rekalibriert. Dies geschieht durch Monitor_Resize-Events.
- ]]
- elseif event == "monitor_resize" then
- sleep(2)
- os.queueEvent("timer", 1)
- monitorCheck()
- windowCreate.foundation()
- windowCreate.interface()
- windowCreate.optionMain()
- windowCreate.pageMain()
- windowCreate.pageRF()
- windowCreate.pageFuel()
- windowCreate.pageEfficiency()
- windowCreate.optionSetting()
- windowCreate.systemControl()
- windowCreate.bootScreen()
- elseif type(param1) == "number" then
- if keys.getName(param1) == "delete" then
- display.bootScreen("Starte Programm neu...")
- os.reboot()
- end
- end
- end
- -- Copyright PlatinKinggg
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement