Exemplo n.º 1
0
        /// <summary>响应邀请</summary>
        public ASObject CommandStart(TGGSession session, ASObject data)
        {
            try
            {
# if DEBUG
                XTrace.WriteLine("{0}:{1}", "FAMILY_INVITE_REPLY", "响应邀请");
#endif
                var state  = Convert.ToInt32(data.FirstOrDefault(m => m.Key == "state").Value);
                var fid    = Convert.ToInt64(data.FirstOrDefault(m => m.Key == "id").Value);
                var userid = Convert.ToInt64(data.FirstOrDefault(m => m.Key == "userid").Value);
                var family = tg_family.GetEntityById(fid);

                if (family == null)
                {
                    return(ErrorResult((int)ResultType.FAMILY_NOEXIST));
                }
                if (session.Player.Family.fid != 0)
                {
                    return(ErrorResult((int)ResultType.FAMILY_MEMBER_EXIST));
                }

                if (state == (int)FamilyApplyType.ACCEPT)
                {
                    var base_level = Variable.BASE_RULE.FirstOrDefault(m => m.id == "18005");
                    if (base_level == null)
                    {
                        return(ErrorResult((int)ResultType.FAMILY_USERLEVEL_LACK));
                    }
                    if (session.Player.Role.Kind.role_level < Convert.ToInt32(base_level.value))
                    {
                        return(ErrorResult((int)ResultType.FAMILY_USERLEVEL_LACK));
                    }
                    return(InviteReplyProcess(family, session.Player.User.id));
                }
                if (state == (int)FamilyApplyType.REFUSE)   //推送拒绝信心给邀请人
                {
                    if (Variable.OnlinePlayer.ContainsKey(userid))
                    {
                        var sessionB = Variable.OnlinePlayer[userid] as TGGSession;
                        if (sessionB != null)
                        {
                            FAMILY_REFUSE_PUSH.GetInstance().CommandStart(sessionB);
                        }
                    }
                }
                else
                {
                    return(ErrorResult((int)ResultType.FRONT_DATA_ERROR));
                }
                return(ErrorResult((int)ResultType.SUCCESS));
            }
Exemplo n.º 2
0
 /// <summary> FAMILY_REFUSE_PUSH单体模式 </summary>
 public static FAMILY_REFUSE_PUSH GetInstance()
 {
     return(ObjInstance ?? (ObjInstance = new FAMILY_REFUSE_PUSH()));
 }