/// <summary> /// 比较好友排序。 /// </summary> public static int CompareFirend(MsgData_sRelationVO a, MsgData_sRelationVO b) { //在线的排前面 if (a.OnlineStatus == 1 && b.OnlineStatus != 1) { return(-1); } if (a.OnlineStatus != 1 && b.OnlineStatus == 1) { return(1); } return(b.Level - a.Level); //其次按等级 }
/// <summary> /// 好友在线状态改变。 /// </summary> /// <param name="data">网络消息数据。</param> private void OnOnlineStatus(MsgData data) { MsgData_sRelationOnLineStatus info = data as MsgData_sRelationOnLineStatus; MsgData_sRelationVO rvo = GetRelation(info.RoleID); if (rvo == null) { return; } rvo.OnlineStatus = info.LastLoginTime; //SetOnlineStatus(info.RoleID, info.LastLoginTime); //for (int i=0; i<info.RelationList.Count; ++i) //{ // MsgData_sRelationOnLineVO vo = info.RelationList[i]; // SetOnlineStatus(vo.RoleID, vo.OnlineStatus); //} EventParameter ep = EventParameter.Get(); CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_FRIEND_ONLINE_STATUS, ep); }
/// <summary> /// 队伍信息。 /// </summary> /// <param name="data">网络消息数据。</param> private void OnRelationInfo(MsgData data) { MsgData_sRelationList info = data as MsgData_sRelationList; for (int i = 0; i < info.RelationList.Count; ++i) { MsgData_sRelationVO vo = info.RelationList[i]; MsgData_sRelationVO savevo; if (m_RelationInfo.TryGetValue(vo.RoleID, out savevo)) { m_RelationInfo[vo.RoleID] = vo; //更新 } else { m_RelationInfo.Add(vo.RoleID, vo); } } EventParameter ep = EventParameter.Get(); CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_FRIEND_INFO, ep); }
/// <summary> /// 判断与某个玩家是否被拉黑。 /// </summary> /// <param name="id">目标玩家编号。</param> /// <returns>是否被拉黑。</returns> public bool IsInBlackList(long id) { MsgData_sRelationVO vo = GetRelation(id); return(vo != null && CheckRelation(vo.RelationFlag, RelationType.RELATION_TYPE_BLACK)); }
/// <summary> /// 判断与某个玩家是否为仇人。 /// </summary> /// <param name="id">目标玩家编号。</param> /// <returns>是否为仇人。</returns> public bool IsEnemy(long id) { MsgData_sRelationVO vo = GetRelation(id); return(vo != null && CheckRelation(vo.RelationFlag, RelationType.RELATION_TYPE_ENEMY)); }
/// <summary> /// 判断与某个玩家是否为好友。 /// </summary> /// <param name="id">目标玩家编号。</param> /// <returns>是否为好友。</returns> public bool IsFriend(long id) { MsgData_sRelationVO vo = GetRelation(id); return(vo != null && CheckRelation(vo.RelationFlag, RelationType.RELATION_TYPE_FRIEND)); }
/// <summary> /// 判断目标是否在线。 /// </summary> /// <param name="id">玩家编号。</param> /// <returns>是否在线。</returns> public bool IsOnline(long id) { MsgData_sRelationVO vo = GetRelation(id); return(vo != null && vo.OnlineStatus == 0); }