登录页一些特效,路书列表详情框架
This commit is contained in:
1 parent
326b74bd03
commit
996f924719
50 files changed
+19916
-6804
No files matched your search
@@ -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()
|
||||
|
||||
Reference in new issue
Block a user