Ejemplo n.º 1
0
        public override bool TakeAction()
        {
            UserBasisCache dest = UserHelper.FindUserBasis(Uid);

            if (dest == null)
            {
                return(true);
            }
            FriendApplyData apply = GetFriends.FindFriendApply(Uid);

            if (apply == null)
            {
                return(true);
            }

            receipt            = new JPFriendApplyData();
            receipt.UserId     = Uid;
            receipt.NickName   = dest.NickName;
            receipt.Profession = dest.Profession;
            receipt.AvatarUrl  = dest.AvatarUrl;
            receipt.UserLv     = dest.UserLv;
            //receipt.FightValue = dest.FightingValue;
            receipt.VipLv     = dest.VipLv;
            receipt.ApplyTime = apply.ApplyDate;

            GameSession fsession = GameSession.Get(dest.UserID);

            receipt.IsOnline = fsession != null && fsession.Connected;
            return(true);
        }
Ejemplo n.º 2
0
        public override bool TakeAction()
        {
            UserBasisCache   dest        = UserHelper.FindUserBasis(destuid);
            UserFriendsCache destFriends = UserHelper.FindUserFriends(destuid);

            FriendApplyData apply = GetFriends.FindFriendApply(destuid);

            if (apply == null)
            {
                receipt = RequestFriendResult.NoApply;
                return(true);
            }

            if (result == EventStatus.Good)
            {
                if (GetFriends.IsFriendNumFull())
                {
                    receipt = RequestFriendResult.FriendNumFull;
                }
                else if (GetFriends.IsHaveFriend(destuid))
                {
                    receipt = RequestFriendResult.HadFriend;
                }
                else if (destFriends.IsFriendNumFull())
                {
                    receipt = RequestFriendResult.DestFriendNumFull;
                }
                else
                {
                    receipt = RequestFriendResult.OK;

                    GetFriends.AddFriend(destuid);

                    destFriends.AddFriend(Current.UserId);

                    PushMessageHelper.NewFriendNotification(GameSession.Get(destuid), Current.UserId);
                    PushMessageHelper.NewFriendNotification(Current, destuid);
                }
            }
            GetFriends.ApplyList.Remove(apply);


            return(true);
        }