using System.Collections; using System.Collections.Generic; using UnityEngine; using Api; using Plugins.CxShine.UIUtil; using UI.Items; using UnityEngine.Rendering; using UnityEngine.UI; public class RankComp : MonoBehaviour { public Image india; public Image all; public Sprite selectSp; public Sprite unSelectSp; public GameObject RankItemPrefab; public Transform RankItemContainer; private bool isIndia = true; // Start is called before the first frame update void Start() { refreshUI(); } private void refreshUI() { india.sprite = isIndia ? selectSp : unSelectSp; all.sprite = !isIndia ? selectSp : unSelectSp; ContainerUtil.RemoveAllChild(this,RankItemContainer); ApiComp.Instance.playerRank(isIndia, data => { for (int i = 0; i < data.rankList.Count; i++) { var go = Instantiate(RankItemPrefab, RankItemContainer); var comp = go.GetComponent(); comp.init(id=>{},data.rankList[i],i+1); } }, (code, err) => { }); } public void A__ClickIndia() { if (isIndia) { return; } isIndia =true; refreshUI(); } public void A__ClickAll() { if (!isIndia) { return; } isIndia =false; refreshUI(); } }