//-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Wednesday, December 19, 2018 //-------------------------------------------------------- using EnhancedUI.EnhancedScroller; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using System; namespace Snxxz.UI { public class RankCellCtrl : ScrollerUI { [SerializeField] Button m_RankButton; [SerializeField] Text m_RankNum; [SerializeField] Image m_RankNumBottom; [SerializeField] Text m_NameTxt; [SerializeField] Text m_JobTxt; // [SerializeField] Text m_RankWhatTxt; [SerializeField] Text m_SegmentTxt; [SerializeField] Text m_IntegralTxt; [SerializeField] Image m_RealmImage; CrossServerOneVsOneRewardModel m_CrossServerRewardModel; CrossServerOneVsOneRewardModel crossServerRewardModel { get { return m_CrossServerRewardModel ?? (m_CrossServerRewardModel = ModelCenter.Instance.GetModel()); } } RoleParticularModel roleParticularModel { get { return ModelCenter.Instance.GetModel(); } } public override void Refresh(CellView cell) { int index = cell.index; if (index < 3) { m_RankNumBottom.gameObject.SetActive(true); if (index == 0) { m_RankNumBottom.SetSprite("Rank_First"); } else if (index == 1) { m_RankNumBottom.SetSprite("Rank_Second"); } else if (index == 2) { m_RankNumBottom.SetSprite("Rank_Third"); } m_RankNum.gameObject.SetActive(false); } else { m_RankNumBottom.gameObject.SetActive(false); m_RankNum.text = (index + 1).ToString(); m_RankNum.gameObject.SetActive(true); } m_RealmImage.gameObject.SetActive(false); RankingInformationClass data = null; ZoneRankingStruct zoneRanking = new ZoneRankingStruct(); zoneRanking.ZoneID = crossServerRewardModel.ZoneID; zoneRanking.SeasonID = crossServerRewardModel.SeasonID; Dictionary rankDic = new Dictionary(); if (crossServerRewardModel.ZoneRankingDic.ContainsKey(zoneRanking)) { rankDic = crossServerRewardModel.ZoneRankingDic[zoneRanking]; } if (rankDic != null && index < rankDic.Count) { data = rankDic[index]; } if (data != null) { m_RankButton.SetListener(() => { //DebugEx.LogError(data.PlayerID); roleParticularModel.ViewFairyCrossServerOneVsOne(data.PlayerID); }); if (data.PlayerID == PlayerDatas.Instance.baseData.PlayerID) { m_JobTxt.color = new Color32(16, 157, 6, 255); m_NameTxt.color = new Color32(16, 157, 6, 255); } else { m_JobTxt.color = new Color32(64, 28, 6, 255); m_NameTxt.color = new Color32(64, 28, 6, 255); ; } m_NameTxt.text = data.PlayerName; m_JobTxt.text = OccupationNameConfig.GetOccupationName(data.Job); RealmConfig presentCfg = RealmConfig.Get(data.Realm); if (data.Realm > 0 && presentCfg != null) { m_RealmImage.gameObject.SetActive(true); m_RealmImage.SetSprite(presentCfg.Img); } // m_RankWhatTxt.text = data.Power.ToString(); Segment(data.DanLv); m_IntegralTxt.text = data.PkScore.ToString(); } else { m_NameTxt.text = Language.Get("L1046"); m_JobTxt.text = "-"; // m_RankWhatTxt.text = "-"; m_SegmentTxt.text = "-"; m_IntegralTxt.text = "-"; m_NameTxt.color = UIHelper.GetUIColor(TextColType.NavyBrown); m_JobTxt.color = UIHelper.GetUIColor(TextColType.NavyBrown); // m_RankWhatTxt.color = UIHelper.GetUIColor(TextColType.NavyBrown); m_SegmentTxt.color = UIHelper.GetUIColor(TextColType.NavyBrown); m_RankButton.RemoveAllListeners(); } } private void Segment(int Danlv) { var config = CrossServerArenaConfig.Get(Danlv); m_SegmentTxt.text = config.Name; m_SegmentTxt.color = UIHelper.GetDanLVColor(Danlv, true); //if (Danlv >= 24) //{ // m_SegmentTxt.color = new Color32(255, 3, 3, 255); //} //else if (Danlv < 24 && Danlv > 15) //{ // m_SegmentTxt.color = new Color32(255, 103, 1, 255); //} //else if (Danlv < 15 && Danlv > 10) //{ // m_SegmentTxt.color = new Color32(218, 72, 213, 255); //} //else //{ // m_SegmentTxt.color = new Color32(104, 104, 104, 255); //} } } }