1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- 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<RankItemComp>();
-
- 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();
- }
- }
|