コード例 #1
0
        /// <summary>
        /// 添加关系:发给对方验证
        /// </summary>
        public void AddRelationGL(long event_idx, PlayerIDName player_id, eRelationFlag flag, string message)
        {
            Player player = UnitManager.Instance.GetUnitByIdx(m_char_idx) as Player;

            if (player == null)
            {
                return;
            }

            //超过上限
            if (IsRelationFull(flag))
            {
                return;
            }

            //判断是否已经存在关系
            RelationInfo relation_info;

            if (m_relations.TryGetValue(player_id.char_idx, out relation_info) && relation_info.flags == flag)
            {
                return;
            }

            //发给client处理是否同意
            if (flag != eRelationFlag.Block)
            {
                ss2c.RelationAdd rep_msg = PacketPools.Get(ss2c.msg.RELATION_ADD) as ss2c.RelationAdd;
                rep_msg.event_idx = event_idx;
                rep_msg.player_id = player_id;
                rep_msg.message   = message;
                rep_msg.flag      = flag;
                ServerNetManager.Instance.SendProxy(player.client_uid, rep_msg);
            }
        }
コード例 #2
0
        /// <summary>
        /// 添加关系
        /// </summary>
        private void OnRelationAdd(PacketBase packet)
        {
            ss2c.RelationAdd msg  = packet as ss2c.RelationAdd;
            RelationAddInfo  info = new RelationAddInfo();

            info.event_idx = msg.event_idx;
            info.player_id = msg.player_id;
            info.message   = msg.message;
            info.flag      = msg.flag;
            RelationDataManager.Instance.AddNewApplys(info);
        }