Пример #1
0
        public void ParsePresenceCallback(string in_message, ref PresenceData in_presenceData)
        {
            Dictionary <string, object> jsonMessage = (Dictionary <string, object>)JsonReader.Deserialize(in_message);
            Dictionary <string, object> jsonData    = (Dictionary <string, object>)jsonMessage[BrainCloudConsts.JSON_DATA];
            Dictionary <string, object> fromData    = (Dictionary <string, object>)jsonData[BrainCloudConsts.JSON_FROM_KEY];

            in_presenceData.Reset();
            if (fromData.ContainsKey(BrainCloudConsts.JSON_ID))
            {
                in_presenceData.ProfileId = (string)fromData[BrainCloudConsts.JSON_ID];
            }
            if (jsonData.ContainsKey(BrainCloudConsts.JSON_ONLINE))
            {
                in_presenceData.IsOnline = (bool)jsonData[BrainCloudConsts.JSON_ONLINE];
            }
            Dictionary <string, object> activity;

            if (jsonData.ContainsKey(BrainCloudConsts.JSON_ACTIVITY))
            {
                activity = (Dictionary <string, object>)jsonData[BrainCloudConsts.JSON_ACTIVITY];

                if (activity.ContainsKey(BrainCloudConsts.JSON_LOCATION))
                {
                    in_presenceData.Location = (string)activity[BrainCloudConsts.JSON_LOCATION];
                }
                if (activity.ContainsKey(BrainCloudConsts.JSON_STATUS))
                {
                    in_presenceData.Status = (string)activity[BrainCloudConsts.JSON_STATUS];
                }
                if (activity.ContainsKey(BrainCloudConsts.JSON_LOBBY_ID))
                {
                    in_presenceData.LobbyId = (string)activity[BrainCloudConsts.JSON_LOBBY_ID];
                }
            }
        }
Пример #2
0
        public PlayerData()
        {
            PlayerName         = "";
            ProfileId          = "";
            PlayerEmail        = "";
            PlayerPictureUrl   = "";
            OpponentPlayerData = null;

            MatchMakingEnabled = false;
            IsTester           = false;

            PlayerXPData = new XPData();
            Presence     = new PresenceData();
        }