public void TrackUserPresence(Game game, Amplitude.Unity.Session.Session session, int turn)
 {
     Diagnostics.Assert(game != null);
     Diagnostics.Assert(session != null);
     if (this.presence == null)
     {
         int num = game.Empires.Count((Empire empire) => empire is MajorEmpire);
         this.presence = new List <GameSaveSessionDescriptor.UserPresenceInfo> [num];
         for (int i = 0; i < num; i++)
         {
             this.presence[i] = new List <GameSaveSessionDescriptor.UserPresenceInfo>();
         }
     }
     for (int j = 0; j < this.presence.Length; j++)
     {
         string x    = string.Format("Empire{0}", j);
         string text = session.GetLobbyData <string>(x, null);
         if (!string.IsNullOrEmpty(text))
         {
             int index = this.presence[j].Count - 1;
             if (this.presence[j].Count == 0 || this.presence[j][index].SteamUserID != text)
             {
                 GameSaveSessionDescriptor.UserPresenceInfo userPresenceInfo  = default(GameSaveSessionDescriptor.UserPresenceInfo);
                 GameSaveSessionDescriptor.UserPresenceInfo userPresenceInfo2 = userPresenceInfo;
                 userPresenceInfo2.SteamUserID = text;
                 userPresenceInfo2.Turn        = turn;
                 userPresenceInfo = userPresenceInfo2;
                 if (Steamworks.SteamAPI.IsSteamRunning && !text.StartsWith("AI"))
                 {
                     try
                     {
                         ulong value = Convert.ToUInt64(text, 16);
                         userPresenceInfo.UserName = Steamworks.SteamAPI.SteamFriends.GetFriendPersonaName(new Steamworks.SteamID(value));
                     }
                     catch
                     {
                     }
                 }
                 this.presence[j].Add(userPresenceInfo);
             }
         }
     }
 }
    void IXmlSerializable.ReadXml(XmlReader reader)
    {
        this.lobbyData.Clear();
        int    num       = 1;
        string attribute = reader.GetAttribute("Version");

        if (!string.IsNullOrEmpty(attribute))
        {
            int.TryParse(attribute, out num);
        }
        reader.ReadStartElement();
        string value = reader.ReadElementString("SessionMode");

        this.SessionMode = (SessionMode)((int)Enum.Parse(typeof(SessionMode), value));
        reader.ReadStartElement("LobbyData");
        while (reader.IsStartElement("LobbyData"))
        {
            string attribute2 = reader.GetAttribute("Key");
            reader.ReadStartElement("LobbyData");
            string value2 = reader.ReadString();
            this.lobbyData.Add(attribute2, value2);
            reader.ReadEndElement();
        }
        reader.ReadEndElement();
        if (num >= 2)
        {
            int    num2       = 0;
            string attribute3 = reader.GetAttribute("Count");
            int.TryParse(attribute3, out num2);
            this.presence = null;
            if (num2 > 0)
            {
                this.presence = new List <GameSaveSessionDescriptor.UserPresenceInfo> [num2];
                for (int i = 0; i < num2; i++)
                {
                    this.presence[i] = new List <GameSaveSessionDescriptor.UserPresenceInfo>();
                }
            }
            reader.ReadStartElement("UserPresence");
            for (int j = 0; j < this.presence.Length; j++)
            {
                attribute3 = reader.GetAttribute("Count");
                reader.ReadStartElement("UserPresenceInfo");
                int num3 = 0;
                int.TryParse(attribute3, out num3);
                for (int k = 0; k < num3; k++)
                {
                    string attribute4 = reader.GetAttribute("Turn");
                    string attribute5 = reader.GetAttribute("SteamUserID");
                    GameSaveSessionDescriptor.UserPresenceInfo userPresenceInfo  = default(GameSaveSessionDescriptor.UserPresenceInfo);
                    GameSaveSessionDescriptor.UserPresenceInfo userPresenceInfo2 = userPresenceInfo;
                    userPresenceInfo2.SteamUserID = attribute5;
                    userPresenceInfo = userPresenceInfo2;
                    int.TryParse(attribute4, out userPresenceInfo.Turn);
                    reader.ReadStartElement("Entry");
                    if (reader.NodeType == XmlNodeType.CDATA)
                    {
                        userPresenceInfo.UserName = reader.Value;
                        reader.Skip();
                    }
                    if (reader.NodeType == XmlNodeType.EndElement && reader.Name == "Entry")
                    {
                        reader.ReadEndElement();
                    }
                    this.presence[j].Add(userPresenceInfo);
                }
                if (reader.NodeType == XmlNodeType.EndElement && reader.Name == "UserPresenceInfo")
                {
                    reader.ReadEndElement();
                }
            }
            if (reader.NodeType == XmlNodeType.EndElement && reader.Name == "UserPresence")
            {
                reader.ReadEndElement();
            }
        }
        reader.ReadEndElement();
        if (!this.lobbyData.ContainsKey("HeatWaveIntensity"))
        {
            this.lobbyData.Add("HeatWaveIntensity", "Moderate");
        }
        if (!this.lobbyData.ContainsKey("HeatWaveDuration"))
        {
            this.lobbyData.Add("HeatWaveDuration", "Moderate");
        }
        if (!this.lobbyData.ContainsKey("MadSeasonType"))
        {
            this.lobbyData.Add("MadSeasonType", "HighChanceShortDuration");
        }
        if (!this.lobbyData.ContainsKey("PlayWithMadSeason"))
        {
            this.lobbyData.Add("PlayWithMadSeason", "true");
        }
        if (!this.lobbyData.ContainsKey("PlayWithKaiju"))
        {
            this.lobbyData.Add("PlayWithKaiju", "true");
        }
    }