private static void RetainSettings(ShieldSettings.ClientSettings newSettings, ShieldSettings.ClientSettings oldSettings) { if (oldSettings == null || newSettings == null) { return; } newSettings.Left = oldSettings.Left; newSettings.Right = oldSettings.Right; newSettings.Up = oldSettings.Up; newSettings.Down = oldSettings.Down; newSettings.Front = oldSettings.Front; newSettings.Back = oldSettings.Back; newSettings.NoShunting = oldSettings.NoShunting; newSettings.ActionKey = oldSettings.ActionKey; newSettings.Notices = oldSettings.Notices; newSettings.DisableKeys = oldSettings.DisableKeys; newSettings.Energy = oldSettings.Energy; newSettings.Kinetic = oldSettings.Kinetic; newSettings.HudScale = oldSettings.HudScale; newSettings.ShieldIconPos = oldSettings.ShieldIconPos; newSettings.MaxHitRings = oldSettings.MaxHitRings; newSettings.ShowHitRings = oldSettings.ShowHitRings; }
private void InitKeys(ShieldSettings.ClientSettings data) { Core.Session.UiInput.ActionKey = Core.Session.KeyMap[data.ActionKey]; Core.Session.UiInput.Shunting = Core.Session.KeyMap[data.NoShunting]; Core.Session.UiInput.Left = Core.Session.KeyMap[data.Left]; Core.Session.UiInput.Right = Core.Session.KeyMap[data.Right]; Core.Session.UiInput.Front = Core.Session.KeyMap[data.Front]; Core.Session.UiInput.Back = Core.Session.KeyMap[data.Back]; Core.Session.UiInput.Up = Core.Session.KeyMap[data.Up]; Core.Session.UiInput.Down = Core.Session.KeyMap[data.Down]; Core.Session.UiInput.Kinetic = Core.Session.KeyMap[data.Kinetic]; Core.Session.UiInput.Energy = Core.Session.KeyMap[data.Energy]; }
private void WriteNewClientCfg(ShieldSettings.ClientSettings oldSettings = null) { VersionChange = true; MyAPIGateway.Utilities.DeleteFileInGlobalStorage(Session.ClientCfgName); Core.ClientConfig = new ShieldSettings.ClientSettings { Version = Session.ClientCfgVersion }; RetainSettings(Core.ClientConfig, oldSettings); InitKeys(Core.ClientConfig); var writer = MyAPIGateway.Utilities.WriteFileInGlobalStorage(Session.ClientCfgName); var data = MyAPIGateway.Utilities.SerializeToXML(Core.ClientConfig); Write(writer, data); }