Files
JJBB/Assets/Project/Script/GUI/Community/CommunityBlogContexItem.cs

85 lines
2.4 KiB
C#
Raw Normal View History

2024-08-23 15:49:34 +08:00
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using Games.Item;
using GCGame.Table;
using Games.ChatHistory;
using GCGame;
using Games.GlobeDefine;
public class CommunityBlogContexItem : CommunityPlayerBaseItem
{
public GameObject _PlayerInfoPanel;
public ChatContex _ContexText;
public NetDoubleImage[] _ContexImages;
public GameObject _ImagePanel;
public override void Show(Hashtable hash)
{
base.Show(hash);
}
public virtual void ShowBlogInfo(CommunityBlogInfo blogInfo, bool isShowPlayerInfo)
{
if (isShowPlayerInfo)
{
_PlayerInfoPanel.SetActive(true);
}
else
{
_PlayerInfoPanel.SetActive(false);
}
_GUID = blogInfo.RoleGuid;
if (_Icon.isActiveAndEnabled)
{
if (!string.IsNullOrEmpty(blogInfo.HeadIconUrl))
{
_Icon.SetNetImage(Community.Instance.GetHeadIconDownUrl(blogInfo.HeadIconUrl), blogInfo.RoleGuid);
}
else
{
_Icon._ImageChecking.gameObject.SetActive(false);
LoadAssetBundle.Instance.SetImageSprite(_Icon._Image, Utils.GetProfessionSpriteName( blogInfo.Profession));
}
}
//
_Name.text = blogInfo.Name;
_Level.text = blogInfo.Level.ToString();
_LevelValue = blogInfo.Level;
_Profession = blogInfo.Profession;
_ContexText.ShowLinkStr(blogInfo.Contex);
//_ContexText.text = blogInfo.Contex;
for (int i = 0; i < _ContexImages.Length; ++i)
{
_ContexImages[i].gameObject.SetActive(false);
}
if (blogInfo.ContexImageUrls != null && blogInfo.ContexImageUrls.Count > 0)
{
_ImagePanel.SetActive(true);
int imageCnt = (int)(blogInfo.ContexImageUrls.Count * 0.5f);
for (int i = 0; i < imageCnt; ++i)
{
_ContexImages[i].gameObject.SetActive(true);
_ContexImages[i].SetNetImage(Community.Instance.GetPicDownUrl(blogInfo.ContexImageUrls[i * 2]), Community.Instance.GetPicDownUrl(blogInfo.ContexImageUrls[i * 2 + 1]), blogInfo.RoleGuid);
}
}
else
{
_ImagePanel.SetActive(false);
}
}
public void ShowLargeImages(int idx)
{
CommunityLogic.Instance().ShowLargeImages(_ContexImages, idx);
}
}