fix(client): 解决终端配置界面文字重叠与停站状态进站预告误报问题
1. 修复配置界面 UI 布局:当发车音乐可用列表过长时导致与后续输入提示重叠的问题,通过拆分显示并换行解决。 2. 彻底解决停站时误报进站预告:当 CC 电脑检测到当前站台已有列车停靠(`State.currentTrain ~= nil`)时,无论显示器上显示的是该站台的当前列车发车倒计时,还是被阻塞的下一班列车的到达倒计时,均强制抑制针对该站台的“进站预告”触发,直至站台被清空。
This commit is contained in:
+29
-15
@@ -1,6 +1,6 @@
|
||||
|
||||
-- 1. Configuration & Constants
|
||||
local APP_VERSION_TEXT = "v1.0.57"
|
||||
local APP_VERSION_TEXT = "v1.0.58"
|
||||
|
||||
local CONFIG = {
|
||||
CLOUD_URL = "ws://stabadmin.fse-media.group",
|
||||
@@ -273,9 +273,11 @@ function Utils.promptSlaveIdentity()
|
||||
|
||||
term.setCursorPos(1, 10)
|
||||
term.setTextColor(colors.gray)
|
||||
term.write("Available beeps: " .. availStr)
|
||||
term.setTextColor(colors.white)
|
||||
term.write("Available beeps:")
|
||||
term.setCursorPos(1, 11)
|
||||
term.write(availStr)
|
||||
term.setTextColor(colors.white)
|
||||
term.setCursorPos(1, 13)
|
||||
term.write("Departure beep (e.g. fc1): ")
|
||||
|
||||
term.setCursorPos(30, 6)
|
||||
@@ -285,15 +287,15 @@ function Utils.promptSlaveIdentity()
|
||||
term.setCursorPos(31, 8)
|
||||
local stationPlatform = Utils.trim(read() or "")
|
||||
|
||||
term.setCursorPos(32, 11)
|
||||
term.setCursorPos(32, 13)
|
||||
local departureBeep = Utils.trim(read() or "")
|
||||
if departureBeep == "" then departureBeep = "fc1" end
|
||||
|
||||
if stationCode == "" or stationPlatform == "" then
|
||||
term.setCursorPos(1, 12)
|
||||
term.setCursorPos(1, 15)
|
||||
term.setTextColor(colors.red)
|
||||
term.write("Both station code and platform are required.")
|
||||
term.setCursorPos(1, 14)
|
||||
term.setCursorPos(1, 16)
|
||||
term.setTextColor(colors.lightGray)
|
||||
term.write("Press any key to retry...")
|
||||
os.pullEvent("key")
|
||||
@@ -359,9 +361,11 @@ function Utils.promptConfig()
|
||||
|
||||
term.setCursorPos(1, 10)
|
||||
term.setTextColor(colors.gray)
|
||||
term.write("Available beeps: " .. availStr)
|
||||
term.setTextColor(colors.white)
|
||||
term.write("Available beeps:")
|
||||
term.setCursorPos(1, 11)
|
||||
term.write(availStr)
|
||||
term.setTextColor(colors.white)
|
||||
term.setCursorPos(1, 13)
|
||||
term.write("Departure beep [" .. currentBeep .. "]: ")
|
||||
|
||||
term.setCursorPos(30, 6)
|
||||
@@ -373,17 +377,17 @@ function Utils.promptConfig()
|
||||
local platformInput = Utils.trim(read() or "")
|
||||
if platformInput == "" then platformInput = currentPlatform end
|
||||
|
||||
term.setCursorPos(32, 11)
|
||||
term.setCursorPos(32, 13)
|
||||
local beepInput = Utils.trim(read() or "")
|
||||
if beepInput == "" then beepInput = currentBeep end
|
||||
|
||||
local ok = Utils.saveStationIdentity(codeInput, platformInput, beepInput)
|
||||
if ok then
|
||||
Utils.refreshStationIdentity()
|
||||
term.setCursorPos(1, 12)
|
||||
term.setCursorPos(1, 15)
|
||||
term.setTextColor(colors.green)
|
||||
term.write("Configuration saved.")
|
||||
term.setCursorPos(1, 14)
|
||||
term.setCursorPos(1, 16)
|
||||
term.setTextColor(colors.lightGray)
|
||||
term.write("Press any key to return...")
|
||||
os.pullEvent("key")
|
||||
@@ -393,10 +397,10 @@ function Utils.promptConfig()
|
||||
State.inConfig = false
|
||||
break
|
||||
else
|
||||
term.setCursorPos(1, 12)
|
||||
term.setCursorPos(1, 15)
|
||||
term.setTextColor(colors.red)
|
||||
term.write("Failed to save configuration.")
|
||||
term.setCursorPos(1, 14)
|
||||
term.setCursorPos(1, 16)
|
||||
term.setTextColor(colors.lightGray)
|
||||
term.write("Press any key to retry...")
|
||||
os.pullEvent("key")
|
||||
@@ -2764,8 +2768,13 @@ function Main.loop()
|
||||
end
|
||||
|
||||
local isAtStation = false
|
||||
local trainPlatform = tostring(platform or State.stationPlatform or "1")
|
||||
local currentPlatform = tostring(State.stationPlatform or "1")
|
||||
|
||||
if State.currentTrain then
|
||||
if State.currentTrain.id == trainName then
|
||||
if trainPlatform == currentPlatform then
|
||||
isAtStation = true
|
||||
elseif State.currentTrain.id == trainName then
|
||||
if trainName == "???" or trainName == "Unknown" or trainName == "" then
|
||||
if Utils.isFuzzyMatch(State.currentTrain.dest, destination) then
|
||||
isAtStation = true
|
||||
@@ -2913,8 +2922,13 @@ function Main.loop()
|
||||
end
|
||||
|
||||
local isAtStation = false
|
||||
local trainPlatform = tostring(platform or State.stationPlatform or "1")
|
||||
local currentPlatform = tostring(State.stationPlatform or "1")
|
||||
|
||||
if State.currentTrain then
|
||||
if State.currentTrain.id == tName then
|
||||
if trainPlatform == currentPlatform then
|
||||
isAtStation = true
|
||||
elseif State.currentTrain.id == tName then
|
||||
if tName == "???" or tName == "Unknown" or tName == "" then
|
||||
if Utils.isFuzzyMatch(State.currentTrain.dest, dest) then
|
||||
isAtStation = true
|
||||
|
||||
Reference in New Issue
Block a user