登录页一些特效,路书列表详情框架

This commit is contained in:
Caiyanpeng committed 2021-04-01 11:01:05 +08:00
1 parent 326b74bd03
commit 996f924719
50 files changed
+19916 -6804

No files matched your search

@@ -0,0 +1,20 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class DropdownScript : MonoBehaviour
{
// Start is called before the first frame update
[SerializeField] string label;
void Start()
{
gameObject.transform.Find("Label").GetComponent<Text>().text = label;
}
// Update is called once per frame
void Update()
{
}
}
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 5b590b8b6670b334ea1953fea1deba17
guid: ae819c44673b2e648813f6f57f39b4b6
MonoImporter:
externalObjects: {}
serializedVersion: 2
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: d0341abab3ca8db49b556a2b5cb0465b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,21 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class MapListScript : MonoBehaviour, IEndDragHandler
{
public void OnEndDrag(PointerEventData eventData)
{
var sc = gameObject.transform.parent.GetComponent<MapListController>();
if (eventData.position.y < 0)
{
sc.Refresh();
}
if (eventData.position.y + Screen.height > sc.Content.GetComponent<RectTransform>().rect.height)
{
sc.pageIndex++;
sc.GetList();
}
}
}
+10 -15
View File
@@ -15,9 +15,9 @@ public class MyMap
public class MapScript : MonoBehaviour
{
// Start is called before the first frame update
[SerializeField] Text text;
[SerializeField] GameObject panel;
[SerializeField] RawImage rawImage;
//[SerializeField] Text text;
//[SerializeField] GameObject panel;
//[SerializeField] RawImage rawImage;
void Start()
{
}
@@ -31,19 +31,14 @@ public class MapScript : MonoBehaviour
{
gameObject.GetComponent<Button>().onClick.AddListener(()=>
{
UIManager.ShowMapDetailPanel(myMap.Id);
//SceneManager.LoadScene("4-Demo", LoadSceneMode.Additive);
});
text.text = myMap.Name;
Utils.DisplayImage(StartCoroutine, rawImage, myMap.CoverImage);
int i = 0;
foreach (RectTransform transform in panel.transform)
{
//if (i < myMap.rank && i < 5)
if (i < 3 && i<5)
{
transform.GetComponent<Image>().color = new Color(255, 255, 0);
i++;
}
}
transform.Find("Name").GetComponent<Text>().text = myMap.Name;
Utils.DisplayImage(StartCoroutine, transform.Find("MapTitleImg").GetComponent<RawImage>(), myMap.CoverImage);
var props = transform.Find("Props");
props.Find("DistanceText").GetComponent<Text>().text = $"{myMap.Distance.ToString("#0.00")}KM";
props.Find("EleText").GetComponent<Text>().text = $"{(myMap.TotalClimb ?? 0.0).ToString("#0.00")}M";
props.Find("SlopeText").GetComponent<Text>().text = $"{myMap.AverageGrade.ToString("#0.00")}%";
}
}
@@ -0,0 +1,55 @@
using Assets.Scripts;
using Assets.Scripts.Apis.Models;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class MapDetailController : MonoBehaviour
{
// Start is called before the first frame update
[HideInInspector] public int id = 0;
[HideInInspector] public MapRoute map;
void Start()
{
if (id != 0)
{
var r = ConfigHelper.mapApi.GetById(id);
if (r.result)
{
map = r.data;
}
else
{
Utils.showToast(gameObject, r.errMsg, 1);
}
}
if (transform.Find("BtnGoRide") != null)
{
transform.Find("BtnGoRide").GetComponent<Button>().onClick.AddListener(GoRide);
}
if (transform.Find("Name") != null)
{
transform.Find("Name").GetComponent<Text>().text = map.Name;
}
if (transform.Find("BtnReturn") != null)
{
transform.Find("BtnReturn").GetComponent<Button>().onClick.AddListener(() =>
{
UIManager.ShowHomePanel();
});
}
}
private void GoRide()
{
Utils.showToast(gameObject, "去骑行", 1);
}
// Update is called once per frame
void Update()
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 858ac526aed2cf641a3c0f50a8c7730d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,11 +1,13 @@
using Assets.Cyp.Common;
using Assets.Scripts;
using Assets.Scripts.Apis.Models;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
@@ -14,7 +16,7 @@ public class MapListController : MonoBehaviour
// Start is called before the first frame update
[SerializeField] GameObject map;
[SerializeField] GameObject content;
[SerializeField] Dropdown hardSelector;
[SerializeField] GameObject scroll;
[HideInInspector] public int pageIndex = 0;
[HideInInspector] public int pageSize = 20;
[HideInInspector] public string hard = "全部";
@@ -27,33 +29,53 @@ public class MapListController : MonoBehaviour
private bool isEnd = false;
void Start()
{
if (hardSelector != null)
{
hardSelector.onValueChanged.AddListener(ChangeHard);
}
//if (hardSelector != null)
//{
// hardSelector.onValueChanged.AddListener(ChangeHard);
//}
if (content!=null)
{
var transform = content.transform.GetComponent<RectTransform>();
var layout = content.GetComponent<GridLayoutGroup>();
if (layout != null)
{
var width = transform.rect.width;
layout.cellSize = new Vector2((width - 120) / 5, (width - 120) / 5);
}
//var transform = content.transform.GetComponent<RectTransform>();
//var layout = content.GetComponent<GridLayoutGroup>();
//if (layout != null)
//{
// var width = transform.rect.width;
// layout.cellSize = new Vector2((width - 120) / 5, (width - 120) / 5);
//}
}
GetList();
if (scroll != null)
{
UIManager.AddEvent(scroll, UnityEngine.EventSystems.EventTriggerType.EndDrag, OnEndDrag);
}
//UIManager.AddEvent(transform.Find("Panel").Find("Panel"))
//var obj = Instantiate(Resources.Load<GameObject>("Canvas"));
//obj.transform.parent = transform.parent;
}
private void ChangeHard(int index)
private void OnEndDrag(BaseEventData arg0)
{
var text = hardSelector.options[index].text;
if (text == "全部难度")
var scrollrect = scroll.GetComponent<ScrollRect>();
if (scrollrect.verticalNormalizedPosition <= 0)
{
Debug.Log(scrollrect.verticalNormalizedPosition);
pageIndex++;
GetList();
}
if (scrollrect.verticalNormalizedPosition >= 1)
{
Refresh();
}
}
private void ChangeHard(int index)
{
//var text = hardSelector.options[index].text;
//if (text == "全部难度")
//{
//}
}
public void GetList()