加场景切换和事件绑定功能
This commit is contained in:
1 parent
e7044b3cde
commit
38d1c387c3
40 files changed
+2954
-4271
No files matched your search
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f32005e7feffc344096558df74482afb
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Assets.Scripts.UI.Control
|
||||
{
|
||||
public class PfPrimaryButton : MonoBehaviour
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cb33d8ce76885d8438909e96ff897bf3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Assets.Scripts.UI.Control
|
||||
{
|
||||
public class PfText : MonoBehaviour
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e47f6ee11b78f3247a0b474b6c36e2cd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class DeviceController : MonoBehaviour
|
||||
{
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
Button button = this.transform.Find("Button").GetComponent<Button>();
|
||||
button.onClick.AddListener(() =>
|
||||
{
|
||||
UIManager.ShowHomePanel();
|
||||
});
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3a8eec0d4bf3f4841982794180df6e10
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,103 @@
|
||||
using Assets.Scripts;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class HomeController : MonoBehaviour
|
||||
{
|
||||
[SerializeField] Text Ftp;
|
||||
[SerializeField] RawImage Avatar;
|
||||
[SerializeField] Text Weight;
|
||||
[SerializeField] Text WKG;
|
||||
[SerializeField] Text Calories;
|
||||
[SerializeField] Text KM;
|
||||
[SerializeField] Text Climb;
|
||||
[SerializeField] Text NickName;
|
||||
[SerializeField] Button More;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
//var parent = Utils.FindUpParent(gameObject.transform);
|
||||
//if (parent.Find("ToastContainer") == null)
|
||||
//{
|
||||
// var toast = Instantiate(Resources.Load<GameObject>("UI/Prefab/ToastContainer"));
|
||||
// toast.name = "ToastContainer";
|
||||
// toast.GetComponent<RectTransform>().position = new Vector3(Screen.width / 2, Screen.height / 2, 0);
|
||||
// toast.transform.parent = parent;
|
||||
//}
|
||||
//if (ConfigHelper.CurrentUser != null)
|
||||
//{
|
||||
// SetCurrentUser();
|
||||
// GetSummary();
|
||||
//}
|
||||
//if (More != null)
|
||||
//{
|
||||
// More.onClick.AddListener(MoreFunc);
|
||||
//}
|
||||
|
||||
var wifi = this.transform.Find("MainToolContainer").Find("Wifi");
|
||||
UIManager.AddEvent(wifi.gameObject, EventTriggerType.PointerClick, x =>
|
||||
{
|
||||
Debug.Log("click wifi");
|
||||
UIManager.ShowDevicePanel();
|
||||
});
|
||||
|
||||
var avatar = this.transform.Find("UserInfo").Find("Image");
|
||||
UIManager.AddEvent(avatar.gameObject, EventTriggerType.PointerClick, x =>
|
||||
{
|
||||
UIManager.ShowUserInfoPanel();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MoreFunc()
|
||||
{
|
||||
Utils.showToast(gameObject, "更多信息", 1);
|
||||
}
|
||||
|
||||
void SetCurrentUser()
|
||||
{
|
||||
var user = ConfigHelper.CurrentUser;
|
||||
Ftp.text = user.FTP.ToString();
|
||||
Weight.text = user.Weight.ToString();
|
||||
WKG.text = $"{user.Weight}KG/{user.BicycleWeight}KG";
|
||||
NickName.text = user.Nickname;
|
||||
Utils.DisplayImage(StartCoroutine, Avatar, user.WxHeadImg);
|
||||
}
|
||||
void GetSummary()
|
||||
{
|
||||
var res = ConfigHelper.userApi.GetSummary();
|
||||
if (res.result)
|
||||
{
|
||||
KM.text = $"{res.data.TotalDistance.ToString("#0.00")}KM";
|
||||
Climb.text = $"{res.data.TotalClimb.ToString()}M";
|
||||
Calories.text = $"{res.data.Kcal.ToString()}KCAL";
|
||||
//Calories.text = res.data.
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.showToast(gameObject, res.errMsg);
|
||||
}
|
||||
//var res = await NoAuthApi.GetCurrentUser();
|
||||
//if (res.result)
|
||||
//{
|
||||
// Global.CurrentUser = res.data;
|
||||
// SetCurrentUser();
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// Utils.showToast(gameObject, res.errMsg);
|
||||
//}
|
||||
}
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 32d45078acd8c0341bc9d900a607ebcd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class UserInfoController : MonoBehaviour
|
||||
{
|
||||
@@ -8,6 +9,13 @@ public class UserInfoController : MonoBehaviour
|
||||
void Start()
|
||||
{
|
||||
this.transform.localPosition = new Vector3(0, 0, 0);
|
||||
|
||||
Button exitBtn = this.transform.Find("InfoPanel").Find("Button").GetComponent<Button>();
|
||||
|
||||
exitBtn.onClick.AddListener(() =>
|
||||
{
|
||||
UIManager.ShowHomePanel();
|
||||
});
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
|
||||
Reference in new issue
Block a user