Files
JJBB/Assets/Project/Script/GUI/Community/CommunityHistoryMsgItem.cs
2024-08-23 15:49:34 +08:00

91 lines
2.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using Games.Item;
using GCGame.Table;
using Games.ChatHistory;
using GCGame;
using Games.GlobeDefine;
using Module.Log;
public class CommunityHistoryMsgInfo
{
public int MsgID;
public ulong BlogGUID;
public int Profession;
public string HeadPicName;
public string Name;
public int Level;
public int MsgType;
public string MsgText;
public string BlogText;
}
public class CommunityHistoryMsgItem : CommunityPlayerBaseItem
{
public Image _MsgType;
public ChatContex _MsgText;
public ChatContex _BlogText;
private CommunityHistoryMsgInfo _MsgInfo;
public override void Show(Hashtable hash)
{
base.Show(hash);
CommunityHistoryMsgInfo msgInfo = (CommunityHistoryMsgInfo)hash["InitObj"];
ShowHistoryMsg(msgInfo);
}
public virtual void ShowHistoryMsg(CommunityHistoryMsgInfo msgInfo)
{
_MsgInfo = msgInfo;
if (_Icon.isActiveAndEnabled)
{
//没有玩家guid无法获得头像
//if (!string.IsNullOrEmpty(msgInfo.HeadPicName))
//{
// _Icon.SetNetImage(Community.Instance.GetHeadIconDownUrl(msgInfo.HeadPicName), 0L);
//}
//else
{
_Icon.NetImageUrl = "";
_Icon._ImageChecking.gameObject.SetActive(false);
LoadAssetBundle.Instance.SetImageSprite(_Icon._Image, Utils.GetProfessionSpriteName(msgInfo.Profession));
}
}
//LoadAssetBundle.Instance.SetImageSprite(_Icon, Utils.GetProfessionIconName((CharacterDefine.PROFESSION)_MsgInfo.Profession));
_Name.text = _MsgInfo.Name;
_Level.text = _MsgInfo.Level.ToString();
_LevelValue = _MsgInfo.Level;
_Profession = msgInfo.Profession;
LoadAssetBundle.Instance.SetImageSprite(_MsgType, GetMsgTypeIcon(msgInfo.MsgType));
_BlogText.ShowLinkStr(msgInfo.BlogText);
_MsgText.ShowLinkStr(msgInfo.MsgText);
}
private string GetMsgTypeIcon(int type)
{
if (type == 0)
{
return "CommunityUp";
}
else if (type == 2)
{
return "CommunityMsg";
}
else if (type == 1)
{
return "CommunityForward";
}
return "";
}
public void OnBtnViewBlog()
{
LogModule.DebugLog("View blog:" + _MsgInfo.BlogGUID);
}
}