82 lines
1.9 KiB
C#
82 lines
1.9 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using System.Collections;
|
|
using Games.Item;
|
|
using GCGame.Table;
|
|
using Games.ChatHistory;
|
|
using GCGame;
|
|
using Games.GlobeDefine;
|
|
|
|
public class FriendChatFindItem : UIItemSelect
|
|
{
|
|
public Text _Name;
|
|
public Image _Icon;
|
|
public Text _Level;
|
|
public GameObject _AddBtn;
|
|
public GameObject _AlreadyAdd;
|
|
|
|
Relation _Relation;
|
|
FriendChat _FriendChat;
|
|
public override void Show(Hashtable hash)
|
|
{
|
|
base.Show();
|
|
|
|
if (hash["InitObj"] is Relation)
|
|
{
|
|
_Relation = (Relation)hash["InitObj"];
|
|
InitRelation();
|
|
}
|
|
|
|
}
|
|
|
|
private void InitRelation()
|
|
{
|
|
_Name.text = _Relation.Name;
|
|
string spriteName = Utils.GetProfessionSpriteName(_Relation.Profession);
|
|
LoadAssetBundle.Instance.SetImageSprite(_Icon, spriteName);
|
|
_Level.text = _Relation.Level.ToString();
|
|
|
|
if (GameManager.gameManager.PlayerDataPool.FriendList.RelationDataList.ContainsKey(_Relation.Guid)
|
|
|| GameManager.gameManager.PlayerDataPool.GuildFriendList.RelationDataList.ContainsKey(_Relation.Guid))
|
|
{
|
|
_AddBtn.SetActive(false);
|
|
_AlreadyAdd.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
_AddBtn.SetActive(true);
|
|
_AlreadyAdd.SetActive(false);
|
|
}
|
|
|
|
if (_Relation.State == (int)CharacterDefine.RELATION_TYPE.OFFLINE)
|
|
{
|
|
_Icon.material = FriendChatItem.ImageGrayMaterial;
|
|
}
|
|
else
|
|
{
|
|
_Icon.material = null;
|
|
}
|
|
}
|
|
|
|
public override void Refresh()
|
|
{
|
|
base.Refresh();
|
|
|
|
InitRelation();
|
|
}
|
|
|
|
public void AddFriend()
|
|
{
|
|
if (_Relation == null)
|
|
return;
|
|
|
|
//如果非玩家,则不显示
|
|
if (GlobeVar.INVALID_GUID == _Relation.Guid)
|
|
{
|
|
return;
|
|
}
|
|
|
|
Singleton<ObjManager>.Instance.MainPlayer.ReqAddFriend(_Relation.Guid);
|
|
}
|
|
}
|