搜索面板条件关闭重新打开重置

This commit is contained in:
lishuo committed 2021-05-26 18:04:58 +08:00
1 parent 4e4da38252
commit e88f32e99b
8 files changed
+2780 -2674

No files matched your search

@@ -45,11 +45,13 @@ namespace Assets.Scenes.Ride.Scripts
MapApi mapApi;
Sprite down;
Sprite up;
Transform parent;
private void Awake()
{
mapApi = new MapApi();
cyclingController = FindObjectOfType<CyclingController>();
//分页查询当前路数排行榜选手成绩列表
parent = transform.Find("Panel/PlayerList/Scroll View/Viewport/Content");
prefab = Resources.Load<GameObject>("UI/Prefab/Ride/SelectPlayerItem");
down = Resources.Load<Sprite>("Images/DOWN");
up = Resources.Load<Sprite>("Images/UP");
@@ -111,6 +113,11 @@ namespace Assets.Scenes.Ride.Scripts
OnEndDrag(null);
}
}
if (Input.GetKeyDown(KeyCode.Return))
{
Search(null);
}
bool enabled = gameObjects.Where(c => c.GetComponent<SeletedPlayerScript>().isUsed).Count() > 0;
rideButton.enabled = enabled;
rideButton.interactable = enabled;
@@ -193,14 +200,38 @@ namespace Assets.Scenes.Ride.Scripts
reviewPanel.SetActive(false);
selectPanel.SetActive(true);
nearPanel.SetActive(false);
Reset();
}
private void Reset()
{
inputField.text = string.Empty;
startValue.text = string.Empty;
endValue.text = string.Empty;
pageIndex = 0;
pageSize = 8;
totalPages = 0;
seachName = string.Empty;
_startValue = 0;
_endValue = 0;
foreach (var item in gameObjects)
{
item.GetComponent<SeletedPlayerScript>().Reset();
}
parent.DestroyChildren();
sort = 0;
sortImage.sprite = down;
}
private void Start()
{
//CreateGameObject(cyclingController.mapRouteRankingList);
Refresh();
//Refresh();
}
private void Refresh()
public void Refresh()
{
var list = mapApi.GetShadowList(App.RouteIdParam, seachName, pageIndex, pageSize);
totalPages = list.data.TotalPages;
@@ -225,7 +256,7 @@ namespace Assets.Scenes.Ride.Scripts
}
private void CreateGameObject(List<MapRouteRanking> list)
{
var parent = transform.Find("Panel/PlayerList/Scroll View/Viewport/Content");
int index = 0;
foreach (var item in list)
{