Exemplo n.º 1
0
        private void SendRadarSettings(BlockAddress block)
        {
            try {
                RadarController controller
                    = EWRegistry <RadarController> .Instance.Get(block);

                Message <BlockAddress, RadarSettings> msg
                    = new Message <BlockAddress, RadarSettings>(block, controller.GetRadarSettings());

                if (Helpers.IsServer)
                {
                    _logger.debugLog($"RadarSystemSettings -> Clients for block {block}", "SendRadarSettings");
                    MyAPIGateway.Multiplayer.SendMessageToOthers(
                        Constants.MIDUpdateRadarSettings,
                        msg.ToXML());
                }
                else
                {
                    _logger.debugLog($"RadarSystemSettings -> Server for block {block}", "SendRadarSettings");
                    MyAPIGateway.Multiplayer.SendMessageToServer(
                        Constants.MIDUpdateRadarSettingsServer,
                        msg.ToXML());
                }
            } catch (Exception e) {
                _logger.log(Logger.severity.ERROR, "SendRadarSettings",
                            "Exception caught: " + e.ToString());
            }
        }