Exemple #1
0
 internal static void setSettings(Settings settings)
 {
     Settings = settings; Flush();
 }
Exemple #2
0
 void GetSettings()
 {
     if (IsServer)
     {   // Server side, get from local drive
         Logger.Log.Info("Server get settings.");
         if ((Settings = Database.Instance.GetData<Settings>("settings", typeof(Settings))) == null)
             Settings = new Settings();
     }
     else
     {   // request settings from server.
         TimeSpan ts = DateTime.Now - m_settingRequested;
         if (MyAPIGateway.Session.Player != null && ts.TotalSeconds > 10) // request settings every 10 secs if there no response
         {
             Logger.Log.Info("Request settings from server!");
             SyncPacket packet = new SyncPacket();
             packet.proto = SyncPacket.Version;
             packet.request = true;
             packet.command = (ushort)Command.SettingsSync;
             packet.steamId = MyAPIGateway.Session.Player.SteamUserId;
             SendMessageToServer(packet); // send request only to server
             m_settingRequested = DateTime.Now;
         }
     }
 }
Exemple #3
0
 public static void SendSettingsToServer(Settings settings, ulong steamId)
 {
     SyncPacket newpacket = new SyncPacket();
     newpacket.proto = SyncPacket.Version;
     newpacket.request = false;
     newpacket.command = (ushort)Command.SettingsChange;
     newpacket.steamId = steamId;
     newpacket.settings = settings;
     SendMessageToServer(newpacket); // send only to server
 }