Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo

# Conflicts:
#	Assets/Scripts/UI/Prefab/ResultList/RouteItem.cs
This commit is contained in:
lishuo committed 2021-04-25 19:43:07 +08:00
commit 2b275d6dc5
12 files changed
+1058 -465

No files matched your search

@@ -19,7 +19,7 @@ public class ResultListController : MonoBehaviour
// Start is called before the first frame update
int pageSize = 20;
string name = "";
Transform[] contents;
Transform[] contents,scrolls;
Dictionary<int, string> filterOptionDict = new Dictionary<int, string>
{
{0,"routes" },{1,"competition" }
@@ -70,18 +70,27 @@ public class ResultListController : MonoBehaviour
{
UIManager.AddEvent(routeScroll.gameObject, UnityEngine.EventSystems.EventTriggerType.EndDrag, OnEndDrag);
}
if (matchScroll)
if (matchScroll != null)
{
UIManager.AddEvent(matchScroll.gameObject, UnityEngine.EventSystems.EventTriggerType.EndDrag, OnEndDrag);
}
scrolls = new Transform[] { routeScroll, matchScroll };
GetList(0);
GetList(1);
}
private void OnEndDrag(BaseEventData e)
{
var pe = (PointerEventData)e;
var scrollrect = pe.pointerDrag.GetComponent<ScrollRect>();
ScrollRect scrollrect = null;
if (e != null)
{
var pe = (PointerEventData)e;
scrollrect = pe.pointerDrag.GetComponent<ScrollRect>();
}
else
{
scrollrect = scrolls[scrollIndex].GetComponent<ScrollRect>();
}
if (scrollrect.verticalNormalizedPosition <= 0)
{
Debug.Log(scrollrect.verticalNormalizedPosition);
@@ -117,7 +126,6 @@ public class ResultListController : MonoBehaviour
if (r.result)
{
_lock = false;
if (r.data.Count == 0)
{
if (pageIndex[index] != 0)
@@ -165,19 +173,33 @@ public class ResultListController : MonoBehaviour
}
// Update is called once per frame
bool _lock = false;
void onEndEdit()
{
name = searchInput.GetComponent<InputField>().text;
Refresh(contents[scrollIndex]);
}
bool startMouse = false;
void Update()
{
GoScroll();
if (Input.GetKey(KeyCode.KeypadEnter) || Input.GetKey(KeyCode.Return))
if (Input.GetAxis("Mouse ScrollWheel") != 0)
{
if (scrolls[scrollIndex].GetComponent<ScrollRect>().verticalNormalizedPosition <= 0 ||
scrolls[scrollIndex].GetComponent<ScrollRect>().verticalNormalizedPosition >= (pageIndex[scrollIndex] == 0 ? 1.05 : 1))
{
startMouse = true;
}
}
else
{
if (startMouse)
{
startMouse = false;
OnEndDrag(null);
}
}
if (Input.GetKeyDown(KeyCode.KeypadEnter) || Input.GetKeyDown(KeyCode.Return))
{
if (_lock) return;
_lock = true;
onEndEdit();
}
}
@@ -60,7 +60,8 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
bool enabled = result.ContinueCyclingParam != null;
//btnContinue.gameObject.SetActive(false);
btnContinue.GetComponent<Button>().onClick.AddListener(GoContinue);
//btnContinue.GetComponent<Button>().onClick.AddListener(GoContinue);
UIManager.AddEvent(btnContinue.gameObject, EventTriggerType.PointerClick, (b) => GoContinue());
btnContinue.GetComponent<Button>().interactable = enabled;
btnContinue.GetComponent<Button>().enabled = enabled;
}
@@ -68,13 +69,15 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
if (btnReRide)
{
//btnReRide.gameObject.SetActive(false);
btnReRide.GetComponent<Button>().onClick.AddListener(GoReRide);
UIManager.AddEvent(btnReRide.gameObject, EventTriggerType.PointerClick, (b) => GoReRide());
//btnReRide.GetComponent<Button>().onClick.AddListener(GoReRide);
}
btnDelete = right.Find("BtnDelete");
if (btnDelete)
{
//btnDelete.gameObject.SetActive(false);
btnDelete.GetComponent<Button>().onClick.AddListener(Delete);
//btnDelete.GetComponent<Button>().onClick.AddListener(Delete);
UIManager.AddEvent(btnDelete.gameObject, EventTriggerType.PointerClick, (b) => Delete());
}
SetButtonColor(false);
transform.Find("RightMatch").gameObject.SetActive(false);