feat(fix-system): 整合维修面板灯光系统并重构面板结构
Made-with: Cursor
This commit is contained in:
@@ -6,7 +6,9 @@ namespace AibisDream
|
||||
{
|
||||
public static class ScreenYarnCommand
|
||||
{
|
||||
private static FixLightSystem LightSystem => FixPanelSystem.GetRepairPanel<CablePanel>().FixLightSystem;
|
||||
private static CablePanel CablePanel => FixPanelSystem.GetRepairPanel<CablePanel>();
|
||||
private static CablePanelLight CablePanelLight => CablePanel?.PanelLight;
|
||||
private static FixPanelLight PanelLight => FixPanelSystem.Instance?.PanelLight;
|
||||
|
||||
private static TaskPanel TaskPanel => FixPanelSystem.Instance.TaskPanel;
|
||||
private static ScreenPanel ScreenPanel => FixPanelSystem.Instance.ScreenPanel;
|
||||
@@ -39,64 +41,64 @@ namespace AibisDream
|
||||
|
||||
#endregion
|
||||
|
||||
#region FixLightSystem相关命令
|
||||
#region 灯光系统相关命令
|
||||
|
||||
[YarnCommand("set_light_state")]
|
||||
public static void SetLightState(string state)
|
||||
{
|
||||
if (LightSystem == null) return;
|
||||
if (System.Enum.TryParse<FixLightSystem.LightState>(state, true, out var lightState))
|
||||
if (FixPanelSystem.Instance == null) return;
|
||||
if (System.Enum.TryParse<LightState>(state, true, out var lightState))
|
||||
{
|
||||
LightSystem.SetLightState(lightState);
|
||||
FixPanelSystem.Instance.SetLightState(lightState);
|
||||
}
|
||||
}
|
||||
|
||||
[YarnCommand("set_small_light_state")]
|
||||
public static void SetSmallLightState(string state)
|
||||
{
|
||||
if (LightSystem == null) return;
|
||||
if (CablePanelLight == null) return;
|
||||
if (System.Enum.TryParse<FixLightSystem.SmallLightState>(state, true, out var smallLightState))
|
||||
{
|
||||
LightSystem.SetSmallLightState(smallLightState);
|
||||
CablePanelLight.SetSmallLightState(smallLightState);
|
||||
}
|
||||
}
|
||||
|
||||
[YarnCommand("set_small_light_status")]
|
||||
public static void SetSmallLightStatus(string status)
|
||||
{
|
||||
if (LightSystem == null) return;
|
||||
if (CablePanelLight == null) return;
|
||||
if (System.Enum.TryParse<FixLightSystem.SmallLightStatus>(status, true, out var smallLightStatus))
|
||||
{
|
||||
LightSystem.SetSmallLightStatus(smallLightStatus);
|
||||
CablePanelLight.SetSmallLightStatus(smallLightStatus);
|
||||
}
|
||||
}
|
||||
|
||||
[YarnCommand("set_environment_light_flickering")]
|
||||
public static void SetEnvironmentLightFlickering(bool isFlickering)
|
||||
{
|
||||
if (LightSystem == null) return;
|
||||
LightSystem.SetEnvironmentLightFlickering(isFlickering);
|
||||
if (PanelLight == null) return;
|
||||
PanelLight.SetEnvironmentLightFlickering(isFlickering);
|
||||
}
|
||||
|
||||
[YarnCommand("set_alarm_blink_speed")]
|
||||
public static void SetAlarmBlinkSpeed(float speed)
|
||||
{
|
||||
if (LightSystem == null) return;
|
||||
LightSystem.SetAlarmBlinkSpeed(speed);
|
||||
if (PanelLight == null) return;
|
||||
PanelLight.SetAlarmBlinkSpeed(speed);
|
||||
}
|
||||
|
||||
[YarnCommand("stop_alarm_light")]
|
||||
public static void StopAlarmLight()
|
||||
{
|
||||
if (LightSystem == null) return;
|
||||
LightSystem.StopAlarmLight();
|
||||
if (PanelLight == null) return;
|
||||
PanelLight.StopAlarmLight();
|
||||
}
|
||||
|
||||
[YarnCommand("start_system")]
|
||||
public static IEnumerator StartSystem()
|
||||
{
|
||||
if (LightSystem == null) yield break;
|
||||
yield return LightSystem.StartSystem();
|
||||
if (FixPanelSystem.Instance == null) yield break;
|
||||
yield return FixPanelSystem.Instance.StartAllSystems();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user