using UnityEngine; using UnityEngine.UI; using System.Collections; using Games.Item; using GCGame.Table; using Games.ChatHistory; using GCGame; using Games.GlobeDefine; public class FriendChatAddItem : UIItemSelect { public Text _Name; public Image _Icon; public Text _Level; public Text _OutLineTime; 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(); //_OutLineTime.text = _Relation.TimeInfo.ToString(); if (_Relation.State == (int)CharacterDefine.RELATION_TYPE.OFFLINE) { _Icon.material = FriendChatItem.ImageGrayMaterial; } else { _Icon.material = null; } } public void AddFriend() { if (_Relation == null) return; //如果非玩家,则不显示 if (GlobeVar.INVALID_GUID == _Relation.Guid) { return; } Singleton.Instance.MainPlayer.ReqAddFriend(_Relation.Guid); } }