void Init() { if (Inited || MyAPIGateway.Session == null) { return; } try { Networker.Init(ModID); Networker.RegisterHandler("LaserSession", MessageHandler); MyAPIGateway.Utilities.MessageEntered += Utilities_MessageEntered; Settings = new LaserSettings(); if (MyAPIGateway.Multiplayer.IsServer) { LoadSettings(); } else { Networker.SendToServer("LaserSession", "AskingSettings", null); } } catch (Exception Scrap) { LogError("Init", Scrap); } Inited = true; }
void SaveSettings() { if (Settings == null) { Settings = new LaserSettings(); } using (var Writer = MyAPIGateway.Utilities.WriteFileInWorldStorage("laserwelders.sbc", typeof(SessionCore))) { string buffer = MyAPIGateway.Utilities.SerializeToXML(Settings); Writer.Write(buffer); } }