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 CommunityFlowerInfo { public int Profession; public string HeadIconName; public string Name; public ulong GUID; public int Level; public int Time; public int Flower1; public int Flower2; public int Flower3; public int Flower4; public int FlowerTotal; public static List _FlowerDataID = null; public static List FlowerDataID { get { if (_FlowerDataID == null) { _FlowerDataID = new List(); var weiboTab = TableManager.GetWeiboByID(0, 0); for (int i = 0; i < weiboTab.getFlowerItemIDCount(); ++i) { _FlowerDataID.Add(weiboTab.GetFlowerItemIDbyIndex(i)); } } return _FlowerDataID; } } public void SetFlowerCnt(int dataID, int cnt) { var idx = FlowerDataID.IndexOf(dataID); switch (idx) { case 0: Flower1 = cnt; break; case 1: Flower2 = cnt; break; case 2: Flower3 = cnt; break; case 3: Flower4 = cnt; break; } } } public class CommunityFlowerItem : CommunityPlayerBaseItem { public Text _Time; public Image[] _FlowerIcons; public Text _Flower1; public Text _Flower2; public Text _Flower3; public Text _Flower4; public Text _TotleFlower; private CommunityFlowerInfo _FlowerInfo; public override void Show(Hashtable hash) { base.Show(hash); CommunityFlowerInfo msgInfo = (CommunityFlowerInfo)hash["InitObj"]; ShowFlowerInfo(msgInfo); } public virtual void ShowFlowerInfo(CommunityFlowerInfo msgInfo) { _FlowerInfo = msgInfo; if (_Icon.isActiveAndEnabled) { if (!string.IsNullOrEmpty(msgInfo.HeadIconName)) { _Icon.SetNetImage(Community.Instance.GetHeadIconDownUrl(msgInfo.HeadIconName), msgInfo.GUID); } else { _Icon.NetImageUrl = ""; if (_Icon._ImageChecking != null) { _Icon._ImageChecking.gameObject.SetActive(false); } LoadAssetBundle.Instance.SetImageSprite(_Icon._Image, Utils.GetProfessionSpriteName(msgInfo.Profession)); } } _GUID = _FlowerInfo.GUID; _Name.text = _FlowerInfo.Name; _Level.text = _FlowerInfo.Level.ToString(); _LevelValue = _FlowerInfo.Level; _Profession = msgInfo.Profession; _Time.text = CommunityBlogItem.GetBlogTimeStr(_FlowerInfo.Time); _Flower1.text = _FlowerInfo.Flower1.ToString(); _Flower2.text = _FlowerInfo.Flower2.ToString(); _Flower3.text = _FlowerInfo.Flower3.ToString(); _Flower4.text = _FlowerInfo.Flower4.ToString(); _TotleFlower.text = _FlowerInfo.FlowerTotal.ToString(); for (int i = 0; i < CommunityFlowerInfo.FlowerDataID.Count; ++i) { Tab_CommonItem commonItem = TableManager.GetCommonItemByID(CommunityFlowerInfo.FlowerDataID[i], 0); LoadAssetBundle.Instance.SetImageSprite(_FlowerIcons[i], commonItem.Icon); if (commonItem.QualityEffect > 0) { CommonItemContainerItem.ShowQualityEffect(true, commonItem.QualityEffect, _FlowerIcons[i].transform); } else { CommonItemContainerItem.ShowQualityEffect(false, commonItem.QualityEffect, _FlowerIcons[i].transform); } } } }