Merge remote-tracking branch 'origin/dev_nonearth' into dev_cyp

# Conflicts:
#	Assets/Scripts/UI/Prefab/MapList/MapItem.cs
This commit is contained in:
CaiYanPeng 2021-12-16 16:55:14 +08:00
commit 12e0d8d295
11 changed files with 1261 additions and 1207 deletions

View File

@ -284,7 +284,9 @@
"My Upload": "我的上传", "My Upload": "我的上传",
"My Collection": "我的收藏", "My Collection": "我的收藏",
"Recent Routes": "最近骑行", "Recent Routes": "最近骑行",
"All Route": "全部线路" "All Route": "全部线路",
"Reconnect": "重新连接",
"Did you want to reconnect the trip that was interrupted abnormally?": "你有异常中断的骑行,是否重新连接开始骑行?"
}, },
"en": { "en": {
"HOT ROUTES": "HOT ROUTES", "HOT ROUTES": "HOT ROUTES",
@ -562,6 +564,8 @@
"My Upload": "My Upload", "My Upload": "My Upload",
"My Collection": "My Collection", "My Collection": "My Collection",
"Recent Routes": "Recent Routes", "Recent Routes": "Recent Routes",
"All Route": "All Route" "All Route": "All Route",
"Reconnect": "Reconnect",
"Did you want to reconnect the trip that was interrupted abnormally?": "Did you want to reconnect the trip that was interrupted abnormally?"
} }
} }

View File

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 84d23fd0e2b8aa54a93c299537dec8b4
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: b6d8302f7867b0f4da50ee0fa4921dbb
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -400,7 +400,8 @@ public class MainController : BaseScene
{ {
var tempRecordData = Newtonsoft.Json.JsonConvert.DeserializeObject<TempRecordData>(content); var tempRecordData = Newtonsoft.Json.JsonConvert.DeserializeObject<TempRecordData>(content);
App.tempRecordData = tempRecordData; App.tempRecordData = tempRecordData;
SceneManager.LoadScene("Ride");
UIManager.ShowConfirm(App.GetLocalString("Reconnect"), App.GetLocalString("Did you want to reconnect the trip that was interrupted abnormally?"), () => { SceneManager.LoadScene("Ride"); });
} }
} }
} }

View File

@ -57,7 +57,7 @@ namespace Assets.Scenes.Ride.Scripts
return; return;
} }
if (targetAlpha != canvasGroup.alpha && depressFlag) if (targetAlpha != canvasGroup.alpha && depressFlag && slider.value >= 100)
{ {
canvasGroup.alpha = Mathf.Lerp(canvasGroup.alpha, targetAlpha, alphaSpeed * Time.deltaTime); canvasGroup.alpha = Mathf.Lerp(canvasGroup.alpha, targetAlpha, alphaSpeed * Time.deltaTime);
if (Mathf.Abs(targetAlpha - canvasGroup.alpha) <= 0.01f) if (Mathf.Abs(targetAlpha - canvasGroup.alpha) <= 0.01f)
@ -66,6 +66,7 @@ namespace Assets.Scenes.Ride.Scripts
} }
if (canvasGroup.alpha == 0) if (canvasGroup.alpha == 0)
{ {
StartGame();
transform.gameObject.SetActive(false); transform.gameObject.SetActive(false);
} }
} }
@ -108,12 +109,16 @@ namespace Assets.Scenes.Ride.Scripts
_map.OnInitialized += _map_OnInitialized; _map.OnInitialized += _map_OnInitialized;
canvasGroup = transform.GetComponent<CanvasGroup>(); canvasGroup = transform.GetComponent<CanvasGroup>();
rideNow.interactable = false; //rideNow.interactable = false;
//rideNow.enabled = false; //rideNow.enabled = false;
UIManager.AddEvent(rideNow.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, StartRide); UIManager.AddEvent(rideNow.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, StartRide);
UIManager.AddEvent(cancel.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, Cancel); UIManager.AddEvent(cancel.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, Cancel);
slider.onValueChanged.AddListener((f) =>
{
processText.text = $"{(f).ToString("#0")}%";
});
} }
//加载数据 //加载数据
protected virtual void InitGameObjectData() protected virtual void InitGameObjectData()
{ {
@ -155,25 +160,30 @@ namespace Assets.Scenes.Ride.Scripts
//设定当前loading进度 //设定当前loading进度
public virtual void AddProcess(float v) public virtual void AddProcess(float v)
{ {
process += v;
slider.value = process;
slider.onValueChanged.AddListener((f) =>
{
processText.text = $"{(f).ToString("#0")}%";
});
if (process >= 100) if (process >= 100)
return;
process += v;
if (depressFlag)
{ {
rideNow.interactable = true; slider.DOKill();
//rideNow.enabled = true; slider.DOValue(process, 0.5f);
} }
} }
protected string GetMaxString(string value, int length) protected string GetMaxString(string value, int length)
{ {
var s = Helper.SubStr(value, length); var s = Helper.SubStr(value, length);
return s; return s;
} }
private void StartGame()
{
Debug.Log("StartGame");
cyclingController.InitTcp();
MapUDPService.SendGizpModel();
cyclingController.ReSetUIManager();
cyclingController.GoContinueRide();
}
protected virtual void StartRide(BaseEventData baseEvent) protected virtual void StartRide(BaseEventData baseEvent)
{ {
if (!rideNow.IsInteractable()) if (!rideNow.IsInteractable())
@ -181,31 +191,10 @@ namespace Assets.Scenes.Ride.Scripts
rideNow.interactable = false; rideNow.interactable = false;
processText.gameObject.SetActive(true); processText.gameObject.SetActive(true);
slider.gameObject.SetActive(true); slider.gameObject.SetActive(true);
var preValue = slider.value;
slider.value = 0; canvasGroup.blocksRaycasts = false;
slider.DOValue(preValue, 2).onComplete+=()=> { depressFlag = true;
cyclingController.InitTcp(); slider.DOValue(process, 1);
MapUDPService.SendGizpModel();
cyclingController.ReSetUIManager();
cyclingController.GoContinueRide();
//启用ridenow
canvasGroup.blocksRaycasts = false;
depressFlag = true;
};
//var checkAnt = cyclingController.CheckAnt();
//#if UNITY_EDITOR
// checkAnt = true;
//#endif
// if (!checkAnt && !cyclingController.isWatch)
// {
//#if UNITY_IOS || UNITY_ANDROID
// var alert = (GameObject)Instantiate(Resources.Load("UI/Prefab/Ride/Mobile/Alert"), panel.transform);
//#else
// var alert = (GameObject)Instantiate(Resources.Load("UI/Prefab/Ride/Alert"), panel.transform);
//#endif
// alert.SetActive(true);
// }
// else
} }
protected virtual void Cancel(BaseEventData baseEvent) protected virtual void Cancel(BaseEventData baseEvent)
{ {
@ -224,6 +213,7 @@ namespace Assets.Scenes.Ride.Scripts
if (s == ModuleState.Finished) if (s == ModuleState.Finished)
{ {
AddProcess(40); AddProcess(40);
Debug.Log($"add 40");
} }
}; };
} }

View File

@ -366,8 +366,9 @@ public class CyclingController : DeviceServiceMonoBase
{ {
case 1: case 1:
{ {
UnityEngine.Debug.Log($"{Input.touches[0]}{Input.touches[0].phase }");
//单击切换极简模式 //单击切换极简模式
if (Input.touches[0].tapCount==1 && isStart && singleUIManager.clearLock && competitionId == 0) if (Input.touches[0].tapCount==1 && Input.touches[0].phase == TouchPhase.Moved && isStart && singleUIManager.clearLock && competitionId == 0)
{ {
if (IsPointerOverGameObject(Input.mousePosition)) if (IsPointerOverGameObject(Input.mousePosition))
{ {
@ -673,7 +674,7 @@ public class CyclingController : DeviceServiceMonoBase
private IEnumerator MoveCamera(Vector3 prePos, Vector3 nextPos) private IEnumerator MoveCamera(Vector3 prePos, Vector3 nextPos)
{ {
float t = 0; float t = 0;
while (t < 0.5f) while (t < 0.37f)
{ {
t += Time.deltaTime; t += Time.deltaTime;
Vector3 v = Vector3.Lerp(prePos, nextPos, t); Vector3 v = Vector3.Lerp(prePos, nextPos, t);

View File

@ -227,7 +227,7 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,
map.IsFavorite = !map.IsFavorite; map.IsFavorite = !map.IsFavorite;
transform.Find("CollectImg").Find("Image").GetComponent<Image>().sprite = transform.Find("CollectImg").Find("Image").GetComponent<Image>().sprite =
UIManager.Instance.collectDict[map.IsFavorite]; UIManager.Instance.collectDict[map.IsFavorite];
if (model != null) if (this.model != null)
{ {
this.model.IsFavorite = map.IsFavorite; this.model.IsFavorite = map.IsFavorite;
} }

View File

@ -887,6 +887,7 @@ public class UIManager : MonoBehaviour
} }
static Texture2D cursor; static Texture2D cursor;
static AudioClip buttonClip;
public static void RemoveEvent(GameObject gameObject) public static void RemoveEvent(GameObject gameObject)
{ {
EventTrigger et = gameObject.GetComponent<EventTrigger>(); EventTrigger et = gameObject.GetComponent<EventTrigger>();
@ -936,9 +937,21 @@ public class UIManager : MonoBehaviour
{ {
cursor = Resources.Load<Texture2D>("Images/PointerButtonHover"); cursor = Resources.Load<Texture2D>("Images/PointerButtonHover");
} }
//设置点击音效
if (buttonClip == null)
{
buttonClip = Resources.Load<AudioClip>("audio/dundundun");
}
var audioSource = gameObject.GetComponent<AudioSource>();
if (audioSource == null)
{
audioSource = gameObject.AddComponent<AudioSource>();
}
UIManager.AddEvent(gameObject, EventTriggerType.PointerEnter, (e) => UIManager.AddEvent(gameObject, EventTriggerType.PointerEnter, (e) =>
{ {
//if (!gameObject.activeInHierarchy) return; //if (!gameObject.activeInHierarchy) return;
audioSource.PlayOneShot(buttonClip);
Cursor.SetCursor(cursor, Vector2.zero, CursorMode.Auto); Cursor.SetCursor(cursor, Vector2.zero, CursorMode.Auto);
}); });
UIManager.AddEvent(gameObject, EventTriggerType.PointerUp, (e) => UIManager.AddEvent(gameObject, EventTriggerType.PointerUp, (e) =>
@ -951,6 +964,7 @@ public class UIManager : MonoBehaviour
//if (!gameObject.activeInHierarchy) return; //if (!gameObject.activeInHierarchy) return;
Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto); Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
}); });
} }
} }