主场景迁移

This commit is contained in:
CaiYanPeng 2021-03-25 17:18:51 +08:00
parent ba994e715c
commit ba324aa68d
18 changed files with 94 additions and 13 deletions

View File

@ -504,6 +504,11 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 1180902778}
m_Modifications:
- target: {fileID: 2589794477215490372, guid: 652cdefe0475dfd429e5a7e92bc3fa31,
type: 3}
propertyPath: m_DownSamplingRate
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2589794478191162464, guid: 652cdefe0475dfd429e5a7e92bc3fa31,
type: 3}
propertyPath: m_Name

View File

@ -1,4 +1,6 @@
using System;
using Assets.Scripts.Apis;
using Assets.Scripts.Apis.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -11,5 +13,9 @@ namespace Assets.Scripts
public static string Host = App.Host;
public static string AppVersion = App.AppVersion;
public static UserResultModel CurrentUser { get; set; }
public static UserApi userApi = new UserApi();
public static MapApi mapApi = new MapApi();
public static MapInterruptRecordApi mapInterruptRecordApi = new MapInterruptRecordApi();
}
}

View File

@ -1,4 +1,4 @@
using Assets.Cyp.Common;
using Assets.Scripts;
using System;
using System.Collections;
using System.Collections.Generic;
@ -27,7 +27,7 @@ public class UserInfo : MonoBehaviour
toast.GetComponent<RectTransform>().position = new Vector3(Screen.width / 2, Screen.height / 2, 0);
toast.transform.parent = parent;
}
if (Global.CurrentUser != null)
if (ConfigHelper.CurrentUser != null)
{
SetCurrentUser();
GetSummary();
@ -45,7 +45,7 @@ public class UserInfo : MonoBehaviour
void SetCurrentUser()
{
var user = Global.CurrentUser;
var user = ConfigHelper.CurrentUser;
Ftp.text = user.FTP.ToString();
Weight.text = user.Weight.ToString();
WKG.text = $"{user.Weight}KG/{user.BicycleWeight}KG";
@ -54,7 +54,7 @@ public class UserInfo : MonoBehaviour
}
void GetSummary()
{
var res = Global.userApi.GetSummary();
var res = ConfigHelper.userApi.GetSummary();
if (res.result)
{
KM.text = $"{res.data.TotalDistance.ToString("#0.00")}KM";

View File

@ -0,0 +1,59 @@
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;
namespace Assets.Scripts
{
public static class Utils
{
/*显示简略提示需要拖Toast的预制件且保证其他组件名字不是Toast,ToastContainer*/
public static void showToast(GameObject game,string text,int duration = 1)
{
var toast = Utils.FindUpParent(game.transform).Find("ToastContainer");
if (toast!=null)
{
toast.GetComponent<Toast>().showToast(JsonConvert.SerializeObject(new
{
text,
duration
}));
//toast.SendMessage("showToast", );
}
}
/*显示简略提示需要拖Toast的预制件且保证其他组件名字不是Toast,ToastContainer*/
/*显示网络图片*/
public delegate Coroutine StartCoroutine(IEnumerator routine);
public static void DisplayImage(StartCoroutine startCoroutine,RawImage img, string url)
{
startCoroutine(DownloadImage(img, url));
}
static IEnumerator DownloadImage(RawImage img,string MediaUrl)
{
UnityWebRequest request = UnityWebRequestTexture.GetTexture(MediaUrl);
yield return request.SendWebRequest();
if (request.isNetworkError || request.isHttpError)
Debug.Log(request.error);
else
img.texture = ((DownloadHandlerTexture)request.downloadHandler).texture;
}
/*显示网络图片*/
/*获取最顶层对象*/
public static Transform FindUpParent(Transform zi)
{
if (zi.parent == null)
return zi;
else
return FindUpParent(zi.parent);
}
/*获取最顶层对象*/
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 860b65f14906bba44b260c0fec18bca6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 9a0a7989900f2c34abeee17c663d08dc
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,5 +1,6 @@
{
"dependencies": {
"com.coffee.softmask-for-ugui": "https://github.com/mob-sakai/SoftMaskForUGUI.git",
"com.unity.collab-proxy": "1.2.16",
"com.unity.ide.rider": "1.1.4",
"com.unity.ide.vscode": "1.2.3",

View File

@ -1,5 +1,12 @@
{
"dependencies": {
"com.coffee.softmask-for-ugui": {
"version": "https://github.com/mob-sakai/SoftMaskForUGUI.git",
"depth": 0,
"source": "git",
"dependencies": {},
"hash": "f59d147fe04be6a84b3cd7eb93bce149410911be"
},
"com.unity.collab-proxy": {
"version": "1.2.16",
"depth": 0,