Beispiel #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);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 赠送
        /// </summary>
        public void FriendGiveGL(PlayerIDName src_player_id, PropID item_id)
        {
            Player player = UnitManager.Instance.GetUnitByIdx(m_char_idx) as Player;

            if (player == null)
            {
                return;
            }

            if (!m_relations.ContainsKey(src_player_id.char_idx))
            {
                return;
            }

            ss2c.RelationGive rep_msg = PacketPools.Get(ss2c.msg.RELATION_GIVE) as ss2c.RelationGive;
            rep_msg.player_id = src_player_id;
            rep_msg.item_id   = item_id;
            ServerNetManager.Instance.SendProxy(player.client_uid, rep_msg);
        }