/// <summary>
    /// 检查IP
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="lst">座位列表</param>
    protected void CheckIP <T>(List <T> lst) where T : SeatEntityBase
    {
        for (int i = 0; i < lst.Count; ++i)
        {
            SeatEntityBase seat1 = lst[i];
            if (seat1.Latitude == 0)
            {
                UIViewManager.Instance.ShowTip(string.Format("未获取到{0}的位置信息", seat1.Nickname));
                continue;
            }
            for (int j = i + 1; j < lst.Count; ++j)
            {
                SeatEntityBase seat2 = lst[j];
                if (LPSUtil.CalculateDistance(seat1.Latitude, seat1.Longitude, seat2.Latitude, seat2.Longitude) < 0.5f)
                {
                    UIViewManager.Instance.ShowTip(string.Format("{0}和{1}距离小于500米", seat1.Nickname, seat2.Nickname));
                }

                if (seat1.IP.Equals(seat2.IP))
                {
                    UIViewManager.Instance.ShowTip(string.Format("{0}和{1}的IP相同", seat1.Nickname, seat2.Nickname));
                }
            }
        }
    }
Exemple #2
0
    public void SetUI <T>(SeatEntityBase seat, List <T> lstOtherSeat) where T : SeatEntityBase
    {
        m_nSeatPos = seat.Pos;
        TextureManager.Instance.LoadHead(seat.Avatar, (Texture2D tex) =>
        {
            m_ImgHead.texture = tex;
        });
        m_TextId.SafeSetText(seat.PlayerId.ToString());
        m_TextNickname.SafeSetText(seat.Nickname);
        m_ImageMan.gameObject.SetActive(seat.Gender == 1);
        m_ImageWoman.gameObject.SetActive(seat.Gender == 0);
        m_TextIP.SafeSetText(seat.IP);

        for (int i = 0; i < m_ArrDistance.Length; ++i)
        {
            if (i < lstOtherSeat.Count)
            {
                m_ArrDistance[i].gameObject.SetActive(true);
                if (seat.Latitude == 0)
                {
                    m_ArrDistance[i].SafeSetText(string.Format("未获取到<color=#306BD8FF>{0}</color>的位置", seat.Nickname));
                }
                else if (lstOtherSeat[i].Latitude == 0)
                {
                    m_ArrDistance[i].SafeSetText(string.Format("未获取到<color=#306BD8FF>{0}</color>的位置", lstOtherSeat[i].Nickname));
                }
                else
                {
                    float distance = LPSUtil.CalculateDistance(seat.Latitude, seat.Longitude, lstOtherSeat[i].Latitude, lstOtherSeat[i].Longitude);
                    m_ArrDistance[i].SafeSetText(string.Format("与<color=#306BD8FF>{0}</color>相距:{1}km", lstOtherSeat[i].Nickname, distance.ToString("0.00")));
                }
            }
            else
            {
                m_ArrDistance[i].gameObject.SetActive(false);
            }
        }
    }