细节调整
This commit is contained in:
1 parent
bbc3deeef2
commit
02b8f97d83
16 files changed
+3692
-3565
No files matched your search
@@ -1,5 +1,6 @@
|
||||
using UnityEngine;
|
||||
using Mapbox.Unity.Map;
|
||||
using DG.Tweening;
|
||||
using UnityEngine.UI;
|
||||
using Assets.Scripts.Apis;
|
||||
using System;
|
||||
@@ -8,6 +9,7 @@ using Assets.Scripts.Apis.Models;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.SceneManagement;
|
||||
using System.Collections;
|
||||
|
||||
namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
@@ -66,13 +68,50 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
public void DrawMapRoute(MapDataModel mapData)
|
||||
{
|
||||
var url = Helper.GetMapboxApiUrl(mapData.List);
|
||||
Utils.DisplayImageAysnc(StartCoroutine, mapRouteImage, url, dowloadCallBack);
|
||||
mapRouteImage.gameObject.SetActive(false);
|
||||
if (App.TextureCache.ContainsKey(url))
|
||||
{
|
||||
mapRouteImage.texture = App.TextureCache[url];
|
||||
var canvasGroup = mapRouteImage.GetComponent<CanvasGroup>();
|
||||
canvasGroup.DOFade(1, 1);
|
||||
this.AddProcess(10);
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.DisplayImageAysnc(StartCoroutine, mapRouteImage, url, dowloadCallBack);
|
||||
}
|
||||
}
|
||||
private void dowloadCallBack()
|
||||
|
||||
private void dowloadCallBack(string url)
|
||||
{
|
||||
mapRouteImage.gameObject.SetActive(true);
|
||||
this.AddProcess(10);
|
||||
if (!App.TextureCache.ContainsKey(url))
|
||||
{
|
||||
App.TextureCache.Add(url, mapRouteImage.texture);
|
||||
}
|
||||
else
|
||||
{
|
||||
App.TextureCache[url] = mapRouteImage.texture;
|
||||
}
|
||||
var canvasGroup = mapRouteImage.GetComponent<CanvasGroup>();
|
||||
canvasGroup.DOFade(1, 1);
|
||||
this.AddProcess(10);
|
||||
}
|
||||
float t = 1f;
|
||||
IEnumerator doCanvasGroup(CanvasGroup cp)
|
||||
{
|
||||
t -= Time.deltaTime;
|
||||
while (t<0)
|
||||
{
|
||||
if (1 != cp.alpha)
|
||||
{
|
||||
cp.alpha = Mathf.Lerp(cp.alpha, 1, alphaSpeed * Time.deltaTime);
|
||||
if (Mathf.Abs(1 - cp.alpha) <= 0.01f)
|
||||
{
|
||||
cp.alpha = 1;
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
t = 1;
|
||||
}
|
||||
}
|
||||
//设定当前loading进度
|
||||
public void AddProcess(float v)
|
||||
|
||||
Reference in new issue
Block a user