键盘bug,细节调整

This commit is contained in:
Caiyanpeng committed 2021-04-25 19:35:41 +08:00
1 parent 048538a0c8
commit 8de7e94c8d
12 files changed
+1058 -465

No files matched your search

@@ -35,18 +35,10 @@ public class HomeController : PFUIPanel
mainNav = this.transform.Find("MainNav").GetComponent<MainNav>();
mainNav.ShowExit();
UIManager.AddEvent(BtnRide.gameObject, EventTriggerType.PointerClick, GoRide);
UIManager.AddEvent(BtnRide.gameObject, EventTriggerType.PointerEnter, (b) =>
{
BtnRide.GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/home/Entrance - ROUTES_hover");
BtnRide.transform.Find("RouterText").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
});
UIManager.AddEvent(BtnRide.gameObject, EventTriggerType.PointerExit, (b) =>
{
BtnRide.GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/home/Entrance - ROUTES_nomal");
BtnRide.transform.Find("RouterText").GetComponent<Text>().color = Utils.HexToColorHtml("#5C5C6E");
});
UIManager.AddEvent(BtnRide.gameObject, EventTriggerType.PointerEnter, OnHover);
UIManager.AddEvent(BtnRide.gameObject, EventTriggerType.PointerExit, OnExit);
var avatar = userInfo.Find("Avatar").GetComponent<RawImage>();
var rect = ((RectTransform)avatar.transform).rect;
SetRounded(avatar.transform, rect.height);
@@ -66,8 +58,24 @@ public class HomeController : PFUIPanel
private void GoRide(BaseEventData e)
{
UIManager.ShowMapListPanel();
OnExit(e);
}
private void OnHover(BaseEventData e)
{
var pe = (PointerEventData)e;
var parent = pe.pointerEnter.transform.parent;
parent.Find("Image").GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/home/Entrance - ROUTES_hover");
parent.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
parent.GetComponent<RectTransform>().localScale = new Vector3(1.05f, 1.05f, 0);
}
private void OnExit(BaseEventData e)
{
var pe = (PointerEventData)e;
var parent = pe.pointerEnter.transform.parent;
parent.Find("Image").GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/home/Entrance - ROUTES_nomal");
parent.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#5C5C6E");
parent.GetComponent<RectTransform>().localScale = new Vector3(1f, 1f, 0);
}
void MoreFunc()
{
//Utils.showToast(gameObject, "更多信息", 1);
@@ -92,7 +100,7 @@ public class HomeController : PFUIPanel
}
Utils.DisplayImage(StartCoroutine, userInfo.Find("Avatar").GetComponent<RawImage>(), App.CurrentUser.WxHeadImg);
userInfo.Find("Country").GetComponent<RawImage>().texture = UIManager.Instance.loginRegOptions.GetCountryImageByName(App.CurrentUser.Country);
userInfo.Find("CaloriesContainer").Find("CaloriesValue").GetComponent<Text>().text = double.Parse(summary.Kcal).ToString("0") +" KCAL";
userInfo.Find("KMContainer").Find("KMValue").GetComponent<Text>().text = summary.TotalDistance.ToString("0") +" KM";
userInfo.Find("ClimbContainer").Find("ClimbValue").GetComponent<Text>().text = summary.TotalClimb +" M";
@@ -181,20 +181,21 @@ public class MapListController : PFUIPanel
if (sortDir)
{
var image = sortDir.Find("Image").GetComponent<Image>();
sortDir.GetComponent<Button>().onClick.AddListener(() =>
UIManager.AddEvent(sortDir.gameObject, EventTriggerType.PointerClick, (b) =>
{
if (image.sprite.name == "DOWN")
{
image.sprite = Resources.Load<Sprite>("Images/UP");
sortDire = "asc";
}
else
else
{
image.sprite = Resources.Load<Sprite>("Images/DOWN");
sortDire = "desc";
}
Refresh();
});
//sortDir.GetComponent<Button>().onClick.AddListener();
}
}
void onEndEdit()
@@ -266,7 +267,6 @@ public class MapListController : PFUIPanel
var res = await ConfigHelper.mapApi.GetList(pageIndex, pageSize, ftname,distance,string.Join(",",hands),is3d,sort,sortDire,isFav);
if (res.result)
{
_lock = false;
if (res.data.Count == 0)
{
if (pageIndex != 0)
@@ -319,7 +319,6 @@ public class MapListController : PFUIPanel
}
// Update is called once per frame
bool startMouse = false;
private bool _lock;
void Update()
{
@@ -339,10 +338,8 @@ public class MapListController : PFUIPanel
OnEndDrag(null);
}
}
if (Input.GetKey(KeyCode.KeypadEnter) || Input.GetKey(KeyCode.Return))
if (Input.GetKeyDown(KeyCode.KeypadEnter) || Input.GetKeyDown(KeyCode.Return))
{
if (_lock) return;
_lock = true;
onEndEdit();
}
}
@@ -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();
}
}
@@ -58,7 +58,8 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
if (btnContinue)
{
//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 = !(result.Progress == 1.0);
btnContinue.GetComponent<Button>().enabled = !(result.Progress == 1.0);
}
@@ -66,13 +67,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);