Exemplo n.º 1
0
    /*好友在线排序*/
    private int FriendListComppare(ArkCrossEngine.FriendInfo friendInfo1, ArkCrossEngine.FriendInfo friendInfo2)
    {
        int res = 0;

        if (friendInfo1.IsOnline == friendInfo2.IsOnline)
        {
            if (friendInfo1.FightingScore > friendInfo2.FightingScore)
            {
                return(-1);
            }
            else
            {
                return(0);
            }
        }
        else if (friendInfo1.IsOnline)
        {
            return(-1);
        }
        else if (friendInfo2.IsOnline)
        {
            return(1);
        }
        return(res);
    }
Exemplo n.º 2
0
 /*添加好友*/
 void AddFriend(ArkCrossEngine.FriendInfo friendInfo)
 {
     if (null != friendInfo)
     {
         UnityEngine.GameObject go = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ArkCrossEngine.ResourceSystem.GetSharedResource("UI/Friend/Friend"));
         UnityEngine.Transform  tf = gameObject.transform.Find("sp_heikuang/ScrollView/Grid");
         if (null != tf)
         {
             go = NGUITools.AddChild(tf.gameObject, go);
             if (null != go)
             {
                 friendDic.Add(go, friendInfo);
                 SetFriendItemInfo(go, friendInfo);
             }
         }
         //玩家不在线
         if (null != go)
         {
             UnityEngine.Transform transform;
             UISprite us;
             if (!friendInfo.IsOnline)
             {
                 transform = go.transform.Find("DI2");
                 if (null != transform)
                 {
                     us = transform.gameObject.GetComponent <UISprite>();
                     if (null != us)
                     {
                         us.spriteName = "bg_2";
                     }
                 }
                 HideCompent(go, "liaotian");
                 HideCompent(go, "zudui");
                 HideCompent(go, "AddFriend");
             }
             else
             {
                 transform = go.transform.Find("DI2");
                 if (null != transform)
                 {
                     us = transform.gameObject.GetComponent <UISprite>();
                     if (null != us)
                     {
                         us.spriteName = "backgroud";
                     }
                 }
                 ShowCompent(go, "liaotian");
                 ShowCompent(go, "zudui");
             }
         }
     }
 }
Exemplo n.º 3
0
 /*设置好友item信息*/
 void SetFriendItemInfo(UnityEngine.GameObject go, ArkCrossEngine.FriendInfo friendInfo)
 {
     if (null != go && null != friendInfo)
     {
         UnityEngine.Transform transform;
         transform = go.transform.Find("name");
         if (null != transform)
         {
             UILabel uiLable = transform.gameObject.GetComponent <UILabel>();
             if (null != uiLable)
             {
                 uiLable.text = friendInfo.Nickname;
             }
         }
         transform = go.transform.Find("lv");
         if (null != transform)
         {
             UILabel uiLable = transform.gameObject.GetComponent <UILabel>();
             if (null != uiLable)
             {
                 uiLable.text = "Lv." + friendInfo.Level.ToString();
             }
         }
         transform = go.transform.Find("head");
         if (transform != null)
         {
             UISprite us = transform.gameObject.GetComponent <UISprite>();
             if (us != null)
             {
                 Data_PlayerConfig cg = PlayerConfigProvider.Instance.GetPlayerConfigById(friendInfo.HeroId);
                 us.spriteName = cg.m_PortraitForCell;
             }
         }
         transform = go.transform.Find("zhanli");
         if (null != transform)
         {
             UILabel uiLable = transform.gameObject.GetComponent <UILabel>();
             if (null != uiLable)
             {
                 uiLable.text = friendInfo.FightingScore.ToString();
             }
         }
     }
 }
Exemplo n.º 4
0
 /*聊天*/
 public void FriendChat(UnityEngine.GameObject go)
 {
     try
     {
         string userId = string.Empty;
         if (friendDic.ContainsKey(go))
         {
             ArkCrossEngine.FriendInfo fInfo = friendDic[go];
             if (fInfo != null)
             {
                 userId = fInfo.Guid.ToString();
             }
         }
         if (!String.IsNullOrEmpty(userId))
         {
             //CYGTConnector.beginOneChatWithGameUserId(userId);
         }
     }
     catch (Exception ex)
     {
         ArkCrossEngine.LogicSystem.LogFromGfx("[Error]:Exception:{0}\n{1}", ex.Message, ex.StackTrace);
     }
 }