Exemplo n.º 1
0
        private void GetFashionModelAvatars(ServerAccount serverAccount, Guid sessionId, Action <List <object> > returnFunc)
        {
            // Get the local avatar assets
            AvatarManagerServiceAPI.GetAvatarForUser(serverAccount, delegate(XmlDocument localAvatarXml)
            {
                List <object> responseData = new List <object>();

                XmlElement avatarNode          = (XmlElement)localAvatarXml.SelectSingleNode("//Avatar");
                XmlAttribute localAvatarAttrib = localAvatarXml.CreateAttribute("LocalAvatar");
                localAvatarAttrib.InnerText    = "true";
                avatarNode.Attributes.Append(localAvatarAttrib);

                ReplaceItemIdsWithDna(avatarNode);
                AddFacebookData
                (
                    avatarNode,
                    new FacebookFriendInfo
                    (
                        serverAccount.AccountId,
                        serverAccount.FacebookAccountId,
                        serverAccount.Nickname,
                        "",
                        ""
                    )
                );

                responseData.Add(avatarNode.OuterXml);

                FashionMinigameServiceAPI.GetHiredFriendsForJob(serverAccount, Jobs.Model, delegate(ICollection <long> hiredFriendIds)
                {
                    ProcessHiredFriends(serverAccount, returnFunc, responseData, hiredFriendIds);
                });
            });
        }
Exemplo n.º 2
0
        private void GetAvatarsForJob(Message message, Guid sessionId)
        {
            mLogger.Debug("GetAvatarsForJob: " + message.ToString());
            if (message.Data.Count < 2)
            {
                mLogger.Error("Dropping Message (" + message + "), expected Data to be Count == 3, actual was " + message.Data.Count);
                return;
            }

            Jobs avatarJob = (Jobs)Enum.Parse(typeof(Jobs), message.Data[1].ToString());

            ServerAccount           localUserServerAccount = mServerStateMachine.SessionManager.GetServerAccountFromSessionId(sessionId);
            Action <List <object> > returnFunc             = delegate(List <object> resultData)
            {
                Message responseMessage = new Message();
                resultData.Insert(0, message.Data[0]);                 // callbackId
                resultData.Insert(1, avatarJob.ToString());
                responseMessage.FashionGameModelAssetMessage(resultData);
                SendMessageToClient(responseMessage, sessionId);
            };

            if (avatarJob == Jobs.Model)
            {
                // Model is the same as other jobs, but it also has a listing for the local user's avatar
                GetFashionModelAvatars(localUserServerAccount, sessionId, returnFunc);
            }
            else
            {
                FashionMinigameServiceAPI.GetHiredFriendsForJob(localUserServerAccount, avatarJob, delegate(ICollection <long> hiredFriendIds)
                {
                    ProcessHiredFriends(localUserServerAccount, returnFunc, new List <object>(), hiredFriendIds);
                });
            }
        }