Exemple #1
0
 private void OnFriendAdded(AddFriendResult result)
 {
     if (result.Created)
     {
         Debug.Log("Friend Sucessfully added");
     }
     ChatHandler.ShowChallangeNotify(friendToFindName);
     RefreshFriendList();
 }
Exemple #2
0
        private void HandleAddFriendResult(JsonMessage lobbyMsg)
        {
            UserInfo playerself = WorldSystem.Instance.GetPlayerSelf();

            if (null == playerself)
            {
                return;
            }
            JsonData jsonData = lobbyMsg.m_JsonData;

            ArkCrossEngineMessage.Msg_LC_AddFriendResult protoData = lobbyMsg.m_ProtoData as ArkCrossEngineMessage.Msg_LC_AddFriendResult;
            if (null != protoData)
            {
                string          target_nick = protoData.m_TargetNick;
                AddFriendResult result      = (AddFriendResult)protoData.m_Result;
                if (AddFriendResult.ADD_SUCCESS == result && null != LobbyClient.Instance.CurrentRole)
                {
                    Dictionary <ulong, FriendInfo> friends = LobbyClient.Instance.CurrentRole.Friends;
                    if (null != friends && friends.Count < FriendInfo.c_Friend_Max)
                    {
                        ulong      friend_guid    = protoData.m_FriendInfo.Guid;
                        string     friend_nick    = protoData.m_FriendInfo.Nickname;
                        int        friend_hero_id = protoData.m_FriendInfo.HeroId;
                        int        friend_level   = protoData.m_FriendInfo.Level;
                        int        friend_score   = protoData.m_FriendInfo.FightingScore;
                        bool       friend_online  = protoData.m_FriendInfo.IsOnline;
                        bool       friend_black   = protoData.m_FriendInfo.IsBlack;
                        FriendInfo new_friend     = new FriendInfo();
                        new_friend.Guid          = friend_guid;
                        new_friend.Nickname      = friend_nick;
                        new_friend.HeroId        = friend_hero_id;
                        new_friend.Level         = friend_level;
                        new_friend.FightingScore = friend_score;
                        new_friend.IsOnline      = friend_online;
                        new_friend.IsBlack       = friend_black;
                        if (!friends.ContainsKey(friend_guid))
                        {
                            friends.Add(friend_guid, new_friend);
                        }
                        GfxSystem.PublishGfxEvent("ge_add_friend", "friend", friend_guid, friend_nick, result);
                    }
                }
                else
                {
                    ulong guid = 0;
                    GfxSystem.PublishGfxEvent("ge_add_friend", "friend", guid, target_nick, result);
                }
            }
        }
        public async Task <AddFriendResult> DoAddFriend(AddFriendInfo request)
        {
            try
            {
                dynamic requestInfo = request;

                var result = await DataExchange.DoDataExchange((object)requestInfo);

                AddFriendResult retVal = result.ToObject <AddFriendResult>();

                return(retVal);
            }
            catch (Exception e)
            {
                return(new AddFriendResult(false, e.Message));
            }
        }
Exemple #4
0
        private void btnClose_Click(object sender, EventArgs e)
        {
            this.friendID = this.skinTextBox_id.SkinTxt.Text.Trim();
            if (this.friendID.Length == 0)
            {
                MessageBoxEx.Show("帐号不能为空!");
                this.DialogResult = System.Windows.Forms.DialogResult.None;
                return;
            }

            try
            {
                if (this.ggSupporter.IsFriend(this.friendID))
                {
                    MessageBoxEx.Show("该用户已经是好友!");
                    this.DialogResult = System.Windows.Forms.DialogResult.None;
                    return;
                }

                this.catalogName = this.skinComboBox1.SelectedItem.ToString();
                AddFriendContract contract = new AddFriendContract(this.friendID, this.catalogName);
                byte[]            info     = ESPlus.Serialization.CompactPropertySerializer.Default.Serialize(contract);
                byte[]            bRes     = this.rapidPassiveEngine.CustomizeOutter.Query(InformationTypes.AddFriend, info);
                AddFriendResult   res      = (AddFriendResult)BitConverter.ToInt32(bRes, 0);
                if (res == AddFriendResult.FriendNotExist)
                {
                    MessageBoxEx.Show("帐号不存在!");
                    this.DialogResult = System.Windows.Forms.DialogResult.None;
                    return;
                }

                this.DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            catch (Exception ee)
            {
                MessageBoxEx.Show("添加好友失败!" + ee.Message);
                this.DialogResult = System.Windows.Forms.DialogResult.None;
            }
        }
Exemple #5
0
        public async Task <AddFriendResult> DoAddFriend(AddFriendInfo request)
        {
            try
            {
                if (!Misc.IsValideUserName(request.FriendName))
                {
                    throw new Exception(
                              "Invalid User Name, only letters and digits allowed, minimum length is 3 char and maximum length is 15 char!");
                }

                dynamic requestInfo = request;

                var result = await DataExchange.DoDataExchange((object)requestInfo);

                AddFriendResult retVal = result.ToObject <AddFriendResult>();

                return(retVal);
            }
            catch (Exception e)
            {
                return(new AddFriendResult(false, e.Message));
            }
        }
Exemple #6
0
 private void onfriendaddedsucess(AddFriendResult result)
 {
     getplayfabfriends();
 }
Exemple #7
0
 private void OnFriendAddedSuccess(AddFriendResult result)
 {
     GetPlayfabFriends();
 }