예제 #1
0
        protected override async void Run(Session session, C2F_GetMemberList message, Action <F2C_GetMemberList> reply)
        {
            F2C_GetMemberList response = new F2C_GetMemberList();

            try
            {
                FriendsCircle friendsCircle = await FriendsCircleComponent.Ins.QueryFriendsCircle(message.FriendsCrircleId);

                if (friendsCircle == null)
                {
                    response.Message = "亲友圈不存在";
                    reply(response);
                    return;
                }
                if (!friendsCircle.ManageUserIds.Contains(message.UserId))
                {
                    response.Message = "管理权限不足";
                    reply(response);
                    return;
                }
                FriendsCirleMemberInfo memberInfo = await FriendsCircleComponent.Ins.QueryFriendsCircleMember(message.FriendsCrircleId);

                response.MemberUserIdList = memberInfo.MemberList;
                reply(response);
            }
            catch (Exception e)
            {
                ReplyError(response, e, reply);
            }
        }
예제 #2
0
        protected override async void Run(Session session, C2F_AlterIsRecommend message, Action <F2C_AlterIsRecommend> reply)
        {
            F2C_AlterIsRecommend response = new F2C_AlterIsRecommend();

            try
            {
                FriendsCircle friendsCircle = await FriendsCircleComponent.Ins.QueryFriendsCircle(message.FriendsCrircleId);

                if (friendsCircle == null)
                {
                    response.Message = "亲友圈不存在";
                    reply(response);
                    return;
                }
                if (!friendsCircle.ManageUserIds.Contains(message.UserId))
                {
                    response.Message = "管理权限不足";
                    reply(response);
                    return;
                }
                friendsCircle.AlterIsRecommend(message.IsRecommend);
                reply(response);
            }
            catch (Exception e)
            {
                ReplyError(response, e, reply);
            }
        }
        protected override async void Run(Session session, C2F_ManageJurisdictionOperate message, Action <F2C_ManageJurisdictionOperate> reply)
        {
            F2C_ManageJurisdictionOperate response = new F2C_ManageJurisdictionOperate();

            try
            {
                FriendsCircle friendsCircle = await FriendsCircleComponent.Ins.QueryFriendsCircle(message.FriendsCrircleId);

                if (friendsCircle == null)
                {
                    response.Message = "亲友圈不存在";
                    reply(response);
                    return;
                }
                if (friendsCircle.CreateUserId != message.UserId)
                {
                    response.Message = "管理权限不足";
                    reply(response);
                    return;
                }
                await friendsCircle.OperateManageJurisdiction(message.OperateUserId, message.IsSetManage, response);

                reply(response);
            }
            catch (Exception e)
            {
                ReplyError(response, e, reply);
            }
        }
예제 #4
0
        protected override async void Run(Session session, C2F_OutFriendsCircle message, Action <F2C_OutFriendsCircle> reply)
        {
            F2C_OutFriendsCircle response = new F2C_OutFriendsCircle();

            try
            {
                FriendsCircle friendsCircle = await FriendsCircleComponent.Ins.QueryFriendsCircle(message.FriendsCrircleId);

                if (friendsCircle == null)
                {
                    response.Message = "亲友圈不存在";
                    reply(response);
                    return;
                }
                if (friendsCircle.CreateUserId == message.UserId)
                {
                    response.Message = "创建者不能退出亲友圈";
                    reply(response);
                    return;
                }
                friendsCircle.SucceedOutriendsCircle(message.UserId);
                reply(response);
            }
            catch (Exception e)
            {
                ReplyError(response, e, reply);
            }
        }
예제 #5
0
        protected override async void Run(Session session, C2F_DisposeApplyInfo message, Action <F2C_DisposeApplyInfo> reply)
        {
            F2C_DisposeApplyInfo response = new F2C_DisposeApplyInfo();

            try
            {
                FriendsCircle friendsCircle =
                    await FriendsCircleComponent.Ins.QueryFriendsCircle(message.FriendsCrircleId);

                if (friendsCircle == null)
                {
                    response.Message = "亲友圈不存在";
                    reply(response);
                    return;
                }
                if (!friendsCircle.ManageUserIds.Contains(message.UserId))
                {
                    response.Message = "您的管理权限不足";
                    reply(response);
                    return;
                }
                await friendsCircle.DisposeApplyResult(message.ApplyUserId, message.IsConsent, response);

                reply(response);
            }
            catch (Exception e)
            {
                ReplyError(response, e, reply);
            }
        }
예제 #6
0
        //添加亲友圈信息
        public FriendsCircle AddFriendsCircleInfo(FriendsCircle friendsCircle)
        {
            FriendsCircle copyFriendsCircle = CopyFriendsCircle.Copy(friendsCircle);

            _FriendsCircleDic[copyFriendsCircle.FriendsCircleId] = copyFriendsCircle;
            return(copyFriendsCircle);
        }
예제 #7
0
        //玩家退出亲友圈 被管理踢 或者自己退都走这
        public static async void SucceedOutriendsCircle(this FriendsCircle friendsCircle, long userId)
        {
            if (friendsCircle.CreateUserId == userId)
            {
                return;
            }
            UserInFriendsCircle userInFriendsCircle = await FriendsCircleComponent.Ins.QueryUserInFriendsCircle(userId);

            if (userInFriendsCircle.FriendsCircleIdList.Contains(friendsCircle.FriendsCircleId))
            {
                userInFriendsCircle.FriendsCircleIdList.Remove(friendsCircle.FriendsCircleId);
            }
            await FriendsCircleComponent.Ins.SaveDB(userInFriendsCircle);

            FriendsCirleMemberInfo friendsCirleMemberInfo = await FriendsCircleComponent.Ins.QueryFriendsCircleMember(friendsCircle.FriendsCircleId);

            if (friendsCirleMemberInfo.MemberList.Contains(userId))
            {
                friendsCirleMemberInfo.MemberList.Remove(userId);
            }
            await FriendsCircleComponent.Ins.SaveDB(friendsCirleMemberInfo);

            friendsCircle.TotalNumber--;
            await FriendsCircleComponent.Ins.SaveDB(friendsCircle);
        }
예제 #8
0
 //玩家退出亲友圈
 public async void OutFrienCircle(int friendsCircleId)
 {
     if (AlreadyJoinFrienCircleIds != null && CuurSelectFriendsCircle.FriendsCircleId == friendsCircleId)
     {
         CuurSelectFriendsCircle = null;
         await ShowFrienCircle();
     }
 }
예제 #9
0
 //设置当前显示亲友圈的信息 并切换UI
 public async void SetCurrShowFrienCirleInfo(FriendsCircle friendsCircle)
 {
     CuurSelectFriendsCircle = friendsCircle;
     if (CuurSelectFriendsCircle != null)
     {
         CreateUser = await UserComponent.Ins.GetUserInfo(CuurSelectFriendsCircle.CreateUserId);
     }
     await ShowFrienCircle();
 }
예제 #10
0
        public static async ETTask <FriendsCircleAndCreateUser> Create(FriendsCircle friendsCircle)
        {
            FriendsCircleAndCreateUser friendsCircleAndCreateUser = new FriendsCircleAndCreateUser();

            friendsCircleAndCreateUser.FriendsCircleInfo = friendsCircle;
            friendsCircleAndCreateUser.CreateUser        = await UserComponent.Ins.GetUserInfo(friendsCircle.CreateUserId);

            return(friendsCircleAndCreateUser);
        }
예제 #11
0
        //查询本亲友圈排行榜信息
        public static async Task <RanKingPlayerInfo> QueryRankingInfo(this FriendsCircle friendsCircle, long userId)
        {
            List <RanKingPlayerInfo> ranKingPlayerInfos = await FriendsCircleComponent.Ins.dbProxyComponent.Query <RanKingPlayerInfo>(
                ranking => ranking.UserId == userId && ranking.FriendsCircleId == friendsCircle.FriendsCircleId);

            if (ranKingPlayerInfos.Count == 0)
            {
                ranKingPlayerInfos.Add(RanKingPlayerInfoFactory.Create(friendsCircle.FriendsCircleId, userId));
            }
            return(ranKingPlayerInfos[0]);
        }
예제 #12
0
        //游戏服玩家打完一大局 发送过来的结算信息 用于排行榜信息
        public static async void RankingGameReult(this FriendsCircle friendsCircle, RepeatedField <TotalPlayerInfo> totalPlayerInfos)
        {
            for (int i = 0; i < totalPlayerInfos.Count; i++)
            {
                RanKingPlayerInfo ranKingPlayerInfo = await friendsCircle.QueryRankingInfo(totalPlayerInfos[i].UserId);

                ranKingPlayerInfo.TotalScore += totalPlayerInfos[i].TotalScore;
                ranKingPlayerInfo.TotalNumber++;
                await FriendsCircleComponent.Ins.SaveDB(ranKingPlayerInfo);
            }
        }
예제 #13
0
 //修改玩法
 public static async Task AlterWanFa(this FriendsCircle friendsCircle, RepeatedField <int> roomConfigs, long toyGameId, IResponse iResponse)
 {
     //效验配置 如果配置错误 会使用默认配置
     if (!RoomConfigIntended.IntendedRoomConfigParameter(roomConfigs, toyGameId))
     {
         //效验不通过 不会修改
         iResponse.Message = "玩法参数有误 无法修改";
         return;
     }
     friendsCircle.DefaultWanFaCofigs = roomConfigs;
     await FriendsCircleComponent.Ins.SaveDB(friendsCircle);
 }
예제 #14
0
        //获取并设置默认亲友圈信息
        public async Task SetDefaultSelectFriendsCircle(int frienCircleId = 0)
        {
            if (!AlreadyJoinFrienCircleIds.Contains(frienCircleId))
            {
                if (AlreadyJoinFrienCircleIds.Count <= 0)
                {
                    return;
                }
                frienCircleId = AlreadyJoinFrienCircleIds[0];
            }
            CuurSelectFriendsCircle = await GetFriendsCircleInfo(frienCircleId);

            CreateUser = await UserComponent.Ins.GetUserInfo(CuurSelectFriendsCircle.CreateUserId);
        }
예제 #15
0
        public static FriendsCircle Create(string name, long createUserId, RepeatedField <int> wanFaCofigs, string announcement)
        {
            FriendsCircle friendsCircle = ComponentFactory.Create <FriendsCircle>();

            friendsCircle.FriendsCircleId    = Game.Scene.GetComponent <FriendsCircleComponent>().GetNewFriendsCircleId();
            friendsCircle.Name               = name;
            friendsCircle.CreateUserId       = createUserId;
            friendsCircle.TotalNumber        = 0;//总人数0
            friendsCircle.DefaultWanFaCofigs = wanFaCofigs;
            friendsCircle.ManageUserIds.Add(createUserId);
            friendsCircle.Announcement = announcement;
            friendsCircle.IsRecommend  = false;
            return(friendsCircle);
        }
예제 #16
0
        //玩家成功加入亲友圈
        public static async Task SucceedJoinFriendsCircle(this FriendsCircle friendsCircle, long userId)
        {
            UserInFriendsCircle userInFriendsCircle = await FriendsCircleComponent.Ins.QueryUserInFriendsCircle(userId);

            userInFriendsCircle.FriendsCircleIdList.Add(friendsCircle.FriendsCircleId);
            await FriendsCircleComponent.Ins.SaveDB(userInFriendsCircle);

            FriendsCirleMemberInfo friendsCirleMemberInfo = await FriendsCircleComponent.Ins.QueryFriendsCircleMember(friendsCircle.FriendsCircleId);

            friendsCirleMemberInfo.MemberList.Add(userId);
            await FriendsCircleComponent.Ins.SaveDB(friendsCirleMemberInfo);

            friendsCircle.TotalNumber++;
            await FriendsCircleComponent.Ins.SaveDB(friendsCircle);
        }
예제 #17
0
        //协议查询亲友圈信息
        private async Task <RepeatedField <FriendsCircle> > QueryFriendsCircleInfo(params int[] ids)
        {
            C2F_GetFriendsCircleInfo c2FGetFriendsCircleInfo = new C2F_GetFriendsCircleInfo();

            c2FGetFriendsCircleInfo.FriendsCrircleIds.Add(ids);
            F2C_GetFriendsCircleInfo f2CGetFriendsCircleInfo = (F2C_GetFriendsCircleInfo)await SessionComponent.Instance.Call(c2FGetFriendsCircleInfo);

            RepeatedField <FriendsCircle> friendsCircles = new RepeatedField <FriendsCircle>();

            for (int i = 0; i < f2CGetFriendsCircleInfo.FrienCircleInfos.Count; i++)
            {
                FriendsCircle friendsCircle = AddFriendsCircleInfo(f2CGetFriendsCircleInfo.FrienCircleInfos[i]);
                friendsCircles.Add(friendsCircle);
            }
            return(friendsCircles);
        }
예제 #18
0
        //把人踢出亲友圈
        public static async Task KickOutFriendsCircle(this FriendsCircle friendsCircle, long operateUserId, long byOperateUserId, IResponse iResponse)
        {
            if (friendsCircle.ManageUserIds.Contains(byOperateUserId))
            {
                iResponse.Message = "不能踢管理出亲友圈";
                return;
            }
            FriendsCirleMemberInfo applyFriendsCirleInfo = await FriendsCircleComponent.Ins.QueryFriendsCircleMember(friendsCircle.FriendsCircleId);

            if (!applyFriendsCirleInfo.MemberList.Contains(byOperateUserId))
            {
                iResponse.Message = "玩家已经不再亲友圈中";
                return;
            }
            friendsCircle.SucceedOutriendsCircle(byOperateUserId);//成功退出亲友圈
        }
예제 #19
0
        //处理申请加入亲友圈
        public static async Task DisposeApplyResult(this FriendsCircle friendsCircle, long applyUserId, bool isConsent, IResponse iResponse)
        {
            ApplyFriendsCirleInfo applyFriendsCirleInfo = await FriendsCircleComponent.Ins.QueryFriendsCircleApply(friendsCircle.FriendsCircleId);

            if (!applyFriendsCirleInfo.ApplyList.Contains(applyUserId))
            {
                iResponse.Message = "该玩家不在申请列表里面 或被其他管理处理";
                return;
            }
            applyFriendsCirleInfo.ApplyList.Remove(applyUserId);
            await FriendsCircleComponent.Ins.SaveDB(applyFriendsCirleInfo);

            if (isConsent)
            {
                await friendsCircle.SucceedJoinFriendsCircle(applyUserId);//成功加入亲友圈
            }
        }
예제 #20
0
        protected override async void Run(Session session, S2F_SendTotalPlayerInfo message)
        {
            try
            {
                FriendsCircle friendsCircle = await FriendsCircleComponent.Ins.QueryFriendsCircle(message.FriendsCrircleId);

                if (friendsCircle == null)
                {
                    Log.Error("游戏发过得我战绩 没有对应的亲友圈接收:" + message.FriendsCrircleId);
                    return;
                }
                friendsCircle.RankingGameReult(message.TotalPlayerInfos);
            }
            catch (Exception e)
            {
                Log.Error(e.ToString());
            }
        }
예제 #21
0
        //申请加入亲友圈
        public static async Task ApplyJoinFriendsCircle(this FriendsCircle friendsCircle, long userId, IResponse iResponse)
        {
            FriendsCirleMemberInfo memberInfo = await FriendsCircleComponent.Ins.QueryFriendsCircleMember(friendsCircle.FriendsCircleId);

            if (memberInfo.MemberList.Contains(userId))
            {
                iResponse.Message = "你已经在该亲友圈中";
                return;
            }
            ApplyFriendsCirleInfo applyFriendsCirleInfo = await FriendsCircleComponent.Ins.QueryFriendsCircleApply(friendsCircle.FriendsCircleId);

            if (applyFriendsCirleInfo.ApplyList.Contains(userId))
            {
                iResponse.Message = "已经在申请列表中";
                return;
            }
            applyFriendsCirleInfo.ApplyList.Add(userId);
            await FriendsCircleComponent.Ins.SaveDB(applyFriendsCirleInfo);
        }
예제 #22
0
        public static FriendsCircle Copy(FriendsCircle friendsCircle)
        {
            FriendsCircle newfriendsCircle = new FriendsCircle();

            newfriendsCircle.FriendsCircleId    = friendsCircle.FriendsCircleId;
            newfriendsCircle.Name               = friendsCircle.Name;
            newfriendsCircle.CreateUserId       = friendsCircle.CreateUserId;
            newfriendsCircle.TotalNumber        = friendsCircle.TotalNumber;
            newfriendsCircle.DefaultWanFaCofigs = new RepeatedField <int>()
            {
                friendsCircle.DefaultWanFaCofigs
            };
            newfriendsCircle.ManageUserIds = new RepeatedField <long>()
            {
                friendsCircle.ManageUserIds.ToArray()
            };
            newfriendsCircle.Announcement = friendsCircle.Announcement;
            newfriendsCircle.IsRecommend  = friendsCircle.IsRecommend;
            return(newfriendsCircle);
        }
예제 #23
0
        //创建亲友圈
        public static async Task <FriendsCircle> CreatorFriendsCircle(this FriendsCircleComponent friendsCircleComponent,
                                                                      long creatorUserId, string name, string announcement, RepeatedField <int> roomConfigs, long toyGameId, IResponse iResponse)
        {
            User creatorUser = await UserHelp.QueryUserInfo(creatorUserId);

            if (creatorUser.Jewel < 200)
            {
                iResponse.Message = "钻石少于200无法创建亲友圈";
                return(null);
            }
            //效验配置 如果配置错误 会使用默认配置
            if (!RoomConfigIntended.IntendedRoomConfigParameter(roomConfigs, toyGameId))
            {
                iResponse.Message = "玩法配置错误 无法创建";
                return(null);
            }
            FriendsCircle friendsCircle = FriendsCircleFactory.Create(name, creatorUserId, roomConfigs, announcement);
            await friendsCircle.SucceedJoinFriendsCircle(creatorUserId); //成功加入到亲友圈 这个方法和保存亲友圈数据到数据库

            return(friendsCircle);
        }
        protected override async void Run(Session session, C2F_GetFriendsCircleInfo message, Action <F2C_GetFriendsCircleInfo> reply)
        {
            F2C_GetFriendsCircleInfo response = new F2C_GetFriendsCircleInfo();

            try
            {
                for (int i = 0; i < message.FriendsCrircleIds.Count; i++)
                {
                    FriendsCircle friendsCircle = await FriendsCircleComponent.Ins.QueryFriendsCircle(message.FriendsCrircleIds[i]);

                    if (friendsCircle != null)
                    {
                        response.FrienCircleInfos.Add(friendsCircle);
                    }
                }
                reply(response);
            }
            catch (Exception e)
            {
                ReplyError(response, e, reply);
            }
        }
예제 #25
0
 //设置或取消管理 操作管理权限
 public static async Task OperateManageJurisdiction(this FriendsCircle friendsCircle, long oprateMageJuridictionUserId, bool isSetManage, IResponse iResponse)
 {
     if (oprateMageJuridictionUserId == friendsCircle.CreateUserId)
     {
         iResponse.Message = "不能设置自己";
         return;
     }
     if (isSetManage)
     {
         if (!friendsCircle.ManageUserIds.Contains(oprateMageJuridictionUserId))
         {
             friendsCircle.ManageUserIds.Add(oprateMageJuridictionUserId);
         }
     }
     else
     {
         if (friendsCircle.ManageUserIds.Contains(oprateMageJuridictionUserId))
         {
             friendsCircle.ManageUserIds.Remove(oprateMageJuridictionUserId);
         }
     }
     await FriendsCircleComponent.Ins.SaveDB(friendsCircle);
 }
예제 #26
0
        protected override async void Run(Session session, C2F_KickOutFriendsCircle message, Action <F2C_KickOutFriendsCircle> reply)
        {
            F2C_KickOutFriendsCircle response = new F2C_KickOutFriendsCircle();

            try
            {
                FriendsCircle friendsCircle = await FriendsCircleComponent.Ins.QueryFriendsCircle(message.FriendsCrircleId);

                if (friendsCircle == null)
                {
                    response.Message = "亲友圈不存在";
                    reply(response);
                    return;
                }
                await friendsCircle.KickOutFriendsCircle(message.UserId, message.OperateUserId, response);

                reply(response);
            }
            catch (Exception e)
            {
                ReplyError(response, e, reply);
            }
        }
예제 #27
0
 //修改是否推荐给陌生人
 public static async void AlterIsRecommend(this FriendsCircle friendsCircle, bool isRecommend)
 {
     friendsCircle.IsRecommend = isRecommend;
     FriendsCircleComponent.Ins.AlterRecommend(friendsCircle, isRecommend);
     await FriendsCircleComponent.Ins.SaveDB(friendsCircle);
 }
예제 #28
0
 //切换亲友圈
 public void  CutFrienCircle(FriendsCircle friendsCircle)
 {
     SetCurrShowFrienCirleInfo(friendsCircle);
 }
예제 #29
0
        //获取亲友圈的成员列表
        public static async Task <RepeatedField <long> > GetMemberList(this FriendsCircle friendsCircle)
        {
            FriendsCirleMemberInfo friendsCirleMemberInfo = await FriendsCircleComponent.Ins.QueryFriendsCircleMember(friendsCircle.FriendsCircleId);

            return(friendsCirleMemberInfo.MemberList);
        }
예제 #30
0
 //成功创建亲友圈
 public void SucceedCreatorFriendsCircle(FriendsCircle friendsCircle)
 {
     SetCurrShowFrienCirleInfo(friendsCircle);
 }