| | |
| | | using System.Collections; |
| | | using UnityEngine.UI; |
| | | using System.Linq;
|
| | | using TableConfig;
|
| | |
|
| | | namespace Snxxz.UI {
|
| | | namespace Snxxz.UI
|
| | | {
|
| | | //赛季奖励的奖励条
|
| | | [XLua.Hotfix] |
| | | public class SeasonRewardCell:MonoBehaviour {
|
| | | public class SeasonRewardCell : MonoBehaviour
|
| | | {
|
| | | [SerializeField] Text m_Text_Ranking; |
| | | [SerializeField] Transform m_Itemlist; |
| | | [SerializeField] Button m_ReceiveBtn; |
| | |
| | | set { m_ReceiveBtn = value; }
|
| | |
|
| | | } |
| | | public void ScrollerDataTypAndId(ScrollerDataType type,int id)
|
| | | public void ScrollerDataTypAndId(ScrollerDataType type, int id)
|
| | | {
|
| | | switch (type)
|
| | | {
|
| | | case ScrollerDataType.Header:
|
| | | SetReceive(id);
|
| | | case ScrollerDataType.Header:
|
| | | SetReceiveH(id);
|
| | | break;
|
| | | case ScrollerDataType.Normal:
|
| | | SetReceiveN(id);
|
| | | break;
|
| | |
|
| | | }
|
| | |
|
| | | } |
| | | |
| | | private void SetReceive(int id)
|
| | | private void SetReceiveH(int id)
|
| | | {
|
| | | if (!crossServerRewardModel.SeasonRewardDic.AwardDic.ContainsKey(id))
|
| | | {
|
| | | return;
|
| | | }
|
| | | m_Text_Ranking.gameObject.SetActive(true);
|
| | | m_Segmenttext.gameObject.SetActive(false);
|
| | | m_ImageColor.gameObject.SetActive(true);
|
| | | m_ImageWorld.gameObject.SetActive(true);
|
| | | var keyList = crossServerRewardModel.SeasonRewardDic.AwardDic.Keys.ToList();
|
| | | int Index = keyList.IndexOf(id);
|
| | | if (Index == 0)
|
| | | {
|
| | | m_Text_Ranking.text = "1-" + id+"名";
|
| | | m_Text_Ranking.text = "1-" + id + "名";
|
| | | }
|
| | | else
|
| | | {
|
| | | int Number = keyList[(Index - 1)];
|
| | | m_Text_Ranking.text = Number+"-"+ id+"名";
|
| | | m_Text_Ranking.text = (Number+1) + "-" + id + "名";
|
| | | }
|
| | | ReceiveItem(id);
|
| | | switch (Index)
|
| | | {
|
| | | case 0:
|
| | | m_ImageColor.SetSprite("CrossServer_1");
|
| | | m_ImageWorld.SetSprite("CrossServer_6");
|
| | | break;
|
| | | case 1:
|
| | | m_ImageColor.SetSprite("CrossServer_2");
|
| | | m_ImageWorld.SetSprite("CrossServer_7");
|
| | | break;
|
| | | case 2:
|
| | | m_ImageColor.SetSprite("CrossServer_3");
|
| | | m_ImageWorld.SetSprite("CrossServer_8");
|
| | | break;
|
| | | }
|
| | | if (CrossServerOneVsOnePKSeason.Instance.SeasonState != 2)
|
| | | {
|
| | | m_ReceiveBtn.gameObject.SetActive(false);
|
| | | m_IsDrawImage.gameObject.SetActive(false);
|
| | | m_IsReachImage.gameObject.SetActive(false);
|
| | | }
|
| | | else
|
| | | {
|
| | |
|
| | | }
|
| | | ReceiveItemH(id);
|
| | | } |
| | | |
| | | private void ReceiveItem(int Id)
|
| | | private void ReceiveItemH(int Id)
|
| | | {
|
| | | var List = crossServerRewardModel.SeasonRewardDic.GetAwardItem(Id);
|
| | | for (int i = 0; i < m_Itemlist.childCount; i++)
|
| | |
| | | _ItemCell.Init(cellModel);
|
| | | int type = i;
|
| | | _ItemCell.cellBtn.SetListener(() =>
|
| | | { |
| | | ItemAttrData attrData = new ItemAttrData(List[type].item.id, false, (ulong)List[type].item.count,-1, List[type].isBind);
|
| | | {
|
| | | ItemAttrData attrData = new ItemAttrData(List[type].item.id, false, (ulong)List[type].item.count, -1, List[type].isBind);
|
| | | itemTipsModel.SetItemTipsModel(attrData);
|
| | | });
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | }
|
| | | } |
| | | |
| | | private void SetReceiveN(int Id)
|
| | | {
|
| | | if (!crossServerRewardModel.SeasonRewardConfigDic.ContainsKey(Id))
|
| | | {
|
| | | return;
|
| | | }
|
| | | m_Text_Ranking.gameObject.SetActive(false);
|
| | | m_Segmenttext.gameObject.SetActive(true);
|
| | | m_ImageColor.gameObject.SetActive(true);
|
| | | m_ImageColor.SetSprite("CrossServer_4");
|
| | | m_ImageWorld.gameObject.SetActive(false);
|
| | | var config = Config.Instance.Get<CrossServerArenaConfig>(Id);
|
| | | if (config != null)
|
| | | {
|
| | | m_Segmenttext.text = config.Name;
|
| | | }
|
| | | if (CrossServerOneVsOnePKSeason.Instance.SeasonState != 2)
|
| | | {
|
| | | m_ReceiveBtn.gameObject.SetActive(false);
|
| | | m_IsDrawImage.gameObject.SetActive(false);
|
| | | m_IsReachImage.gameObject.SetActive(false);
|
| | | }
|
| | | else
|
| | | {
|
| | |
|
| | |
|
| | | }
|
| | | ReceiveItemN(Id);
|
| | | }
|
| | | private void ReceiveItemN(int Id)
|
| | | {
|
| | | var List = crossServerRewardModel.SeasonRewardConfigDic[Id];
|
| | | for (int i = 0; i < m_Itemlist.childCount; i++)
|
| | | {
|
| | | GameObject ObjChild = m_Itemlist.GetChild(i).gameObject;
|
| | | if (i < List.Count)
|
| | | {
|
| | | ObjChild.SetActive(true);
|
| | | ItemCell _ItemCell = ObjChild.GetComponent<ItemCell>();
|
| | | ItemCellModel cellModel = new ItemCellModel(List[i].ItemId, true, (ulong)List[i].ItemNumber, List[i].Isbind);
|
| | | _ItemCell.Init(cellModel);
|
| | | int type = i;
|
| | | _ItemCell.cellBtn.SetListener(() =>
|
| | | {
|
| | | ItemAttrData attrData = new ItemAttrData(List[type].ItemId, false, (ulong)List[type].ItemNumber, -1, List[type].Isbind);
|
| | | itemTipsModel.SetItemTipsModel(attrData);
|
| | | });
|
| | | }
|
| | | else
|
| | | {
|
| | | ObjChild.SetActive(false);
|
| | | }
|
| | | }
|
| | | } |
| | | } |
| | | |