private bool IsVisible(CockpitMode mode, ButtonCategory category) { switch (category) { case ButtonCategory.Cockpit: return(mode.HasFlag(CockpitMode.Cockpit)); case ButtonCategory.ShipCockpit: return(mode.HasFlag(CockpitMode.Cockpit) && mode.HasFlag(CockpitMode.InShip)); case ButtonCategory.MainShipCockpit: return(mode.HasFlag(CockpitMode.Cockpit) && mode.HasFlag(CockpitMode.InMainShip)); case ButtonCategory.FighterCockpit: return(mode.HasFlag(CockpitMode.Cockpit) && mode.HasFlag(CockpitMode.InFighter)); case ButtonCategory.SRVCockpit: return(mode.HasFlag(CockpitMode.Cockpit) && mode.HasFlag(CockpitMode.InSRV)); default: throw new Exception("Unknown CockpitMode"); } }
void SetMode(CockpitMode mode) { if (gameNotRunning) { gameNotRunning.SetActive(mode.HasFlag(CockpitMode.GameNotRunning)); } if (map) { map.SetActive(mode.HasFlag(CockpitMode.Map)); } if (cockpit) { cockpit.SetActive(mode.HasFlag(CockpitMode.Cockpit)); } if (shipOnlyCockpit) { shipOnlyCockpit.SetActive(mode.HasFlag(CockpitMode.Cockpit) && mode.HasFlag(CockpitMode.InShip)); } if (mainShipOnlyCockpit) { mainShipOnlyCockpit.SetActive(mode.HasFlag(CockpitMode.Cockpit) && mode.HasFlag(CockpitMode.InMainShip)); } if (fighterOnlyCockpit) { fighterOnlyCockpit.SetActive(mode.HasFlag(CockpitMode.Cockpit) && mode.HasFlag(CockpitMode.InFighter)); } if (srvOnlyCockpit) { srvOnlyCockpit.SetActive(mode.HasFlag(CockpitMode.Cockpit) && mode.HasFlag(CockpitMode.InSRV)); } Mode = mode; ModeChanged.Send(Mode); }
void SetMode(CockpitMode mode) { gameNotRunning?.SetActive(mode.HasFlag(CockpitMode.GameNotRunning)); menuMode?.SetActive(mode.HasFlag(CockpitMode.MenuMode)); map?.SetActive(mode.HasFlag(CockpitMode.Map)); stationServices?.SetActive(mode.HasFlag(CockpitMode.StationServices)); cockpit?.SetActive(mode.HasFlag(CockpitMode.Cockpit)); shipOnlyCockpit?.SetActive(mode.HasFlag(CockpitMode.Cockpit) && mode.HasFlag(CockpitMode.InShip)); mainShipOnlyCockpit?.SetActive(mode.HasFlag(CockpitMode.Cockpit) && mode.HasFlag(CockpitMode.InMainShip)); fighterOnlyCockpit?.SetActive(mode.HasFlag(CockpitMode.Cockpit) && mode.HasFlag(CockpitMode.InFighter)); srvOnlyCockpit?.SetActive(mode.HasFlag(CockpitMode.Cockpit) && mode.HasFlag(CockpitMode.InSRV)); fssMode?.SetActive(mode.HasFlag(CockpitMode.FSSMode)); dssMode?.SetActive(mode.HasFlag(CockpitMode.DSSMode)); Mode = mode; ModeChanged.Send(Mode); }