登录页一些效果,接路线列表页
This commit is contained in:
1 parent
d1d9c92f1c
commit
f45711f39f
78 files changed
+9990
-5830
No files matched your search
@@ -5,6 +5,7 @@ using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class HomeController : MonoBehaviour
|
||||
@@ -18,7 +19,8 @@ public class HomeController : MonoBehaviour
|
||||
[SerializeField] Text Climb;
|
||||
[SerializeField] Text NickName;
|
||||
[SerializeField] Button More;
|
||||
|
||||
[SerializeField] Button BtnRide;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
@@ -39,7 +41,7 @@ public class HomeController : MonoBehaviour
|
||||
//{
|
||||
// More.onClick.AddListener(MoreFunc);
|
||||
//}
|
||||
|
||||
BtnRide.onClick.AddListener(GoRide);
|
||||
var wifi = this.transform.Find("MainToolContainer").Find("Wifi");
|
||||
UIManager.AddEvent(wifi.gameObject, EventTriggerType.PointerClick, x =>
|
||||
{
|
||||
@@ -54,7 +56,11 @@ public class HomeController : MonoBehaviour
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void GoRide()
|
||||
{
|
||||
UIManager.ShowMapListPanel();
|
||||
//SceneManager.LoadScene("3-MapList");
|
||||
}
|
||||
|
||||
void MoreFunc()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
using Assets.Cyp.Common;
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class MapListController : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
[SerializeField] GameObject map;
|
||||
[SerializeField] GameObject content;
|
||||
[SerializeField] Dropdown hardSelector;
|
||||
[HideInInspector] public int pageIndex = 0;
|
||||
[HideInInspector] public int pageSize = 20;
|
||||
[HideInInspector] public string hard = "全部";
|
||||
public GameObject Content {
|
||||
get
|
||||
{
|
||||
return content;
|
||||
}
|
||||
}
|
||||
private bool isEnd = false;
|
||||
void Start()
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
GetList();
|
||||
|
||||
//var obj = Instantiate(Resources.Load<GameObject>("Canvas"));
|
||||
//obj.transform.parent = transform.parent;
|
||||
}
|
||||
|
||||
private void ChangeHard(int index)
|
||||
{
|
||||
var text = hardSelector.options[index].text;
|
||||
if (text == "全部难度")
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void GetList()
|
||||
{
|
||||
if (isEnd) return;
|
||||
var res = Global.mapApi.GetList(pageIndex, pageSize, "");
|
||||
if (res.result)
|
||||
{
|
||||
|
||||
if (res.data.Count == 0)
|
||||
{
|
||||
isEnd = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
DisplayMaps(res.data);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
void DisplayMaps(List<MapRoute> list)
|
||||
{
|
||||
if (map != null)
|
||||
{
|
||||
foreach (var item in list)
|
||||
{
|
||||
var obj = Instantiate(map);
|
||||
obj.GetComponent<MapScript>().Initial(item);
|
||||
//obj.SendMessage("Initial", );
|
||||
obj.transform.parent = content.transform;
|
||||
obj.transform.localScale = new Vector3(1, 1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void Refresh()
|
||||
{
|
||||
content.transform.DestroyChildren();
|
||||
pageIndex = 0;
|
||||
GetList();
|
||||
}
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e87cee7d1f8eeb94d986bf6d6eaf4cbc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in new issue
Block a user