From 8984a0e64278c72fb53db2955e972e6291507f14 Mon Sep 17 00:00:00 2001 From: LIANG Sidi <1467329765@qq.com> Date: Tue, 27 Aug 2024 14:06:58 +0800 Subject: [PATCH] Revert "refactoring indicator mode to hash, API dosent changed" This reverts commit 064daace489cb06afa269febcce5a154f0682b77. --- Nasal/systems.nas | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/Nasal/systems.nas b/Nasal/systems.nas index 37bcb72..ae94abd 100644 --- a/Nasal/systems.nas +++ b/Nasal/systems.nas @@ -158,16 +158,6 @@ var IndicatorController = { # # - INDICATOR_MODE : { - off: 0, - right_without_led: 1, - left_without_led: 2, - both_without_led: 3, - right_with_led: 4, - left_with_led: 5, - both_with_led: 6 - }, - new: func() { return { parents:[IndicatorController]}; }, leftIndicator : Indicator.new("left"), @@ -223,44 +213,44 @@ var IndicatorController = { return me.mode; }, setMode: func(targetMode){ - if(targetMode == me.INDICATOR_MODE.off){ + if(targetMode == 0){ me.resumeLedMessage(); me.rightIndicator.switchOff(); me.leftIndicator.switchOff(); me.mode = targetMode; if(me.falseLight == 1){ - me.setMode(me.INDICATOR_MODE.both_without_led); + me.setMode(3); } - }else if(targetMode == me.INDICATOR_MODE.right_without_led){ + }else if(targetMode == 1){ me.resumeLedMessage(); me.rightIndicator.switchOn(); me.leftIndicator.switchOff(); me.mode = targetMode; - }else if(targetMode == me.INDICATOR_MODE.left_without_led){ + }else if(targetMode == 2){ me.resumeLedMessage(); me.rightIndicator.switchOff(); me.leftIndicator.switchOn(); me.mode = targetMode; - }else if(targetMode == me.INDICATOR_MODE.both_without_led){ + }else if(targetMode == 3){ me.resumeLedMessage(); me.rightIndicator.switchOn(); me.leftIndicator.switchOn(); me.mode = targetMode; - }else if(targetMode == me.INDICATOR_MODE.right_with_led){ + }else if(targetMode == 4){ me.resumeLedMessage(); me.saveLedMessage(); me.rightIndicator.switchOn(); me.leftIndicator.switchOff(); me.setLedMessage(me.textureRight); me.mode = targetMode; - }else if(targetMode == me.INDICATOR_MODE.left_with_led){ + }else if(targetMode == 5){ me.resumeLedMessage(); me.saveLedMessage(); me.rightIndicator.switchOff(); me.leftIndicator.switchOn(); me.setLedMessage(me.textureLeft); me.mode = targetMode; - }else if(targetMode == me.INDICATOR_MODE.both_with_led){ + }else if(targetMode == 6){ me.mode = targetMode; }else{ return 0;