登录增加loading&赛事提醒修改
This commit is contained in:
1 parent
51cea743be
commit
dfb80658dd
23 files changed
+2137
-34355
No files matched your search
@@ -36,5 +36,17 @@ namespace Assets.Scripts.Scenes
|
||||
MapUDPService.Dispose();
|
||||
App.MainDeviceAdapter.Dispose();
|
||||
}
|
||||
|
||||
private void OnApplicationPause(bool focus)
|
||||
{
|
||||
if (focus)
|
||||
{
|
||||
Debug.Log("我休眠了");
|
||||
}
|
||||
else
|
||||
{
|
||||
UIManager.InitNow();//重置当前时间
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Apis;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using Assets.Scripts.Scenes;
|
||||
using Assets.Scripts.UI.Control;
|
||||
using Assets.Scripts.UI.Prefab.Login;
|
||||
using DG.Tweening;
|
||||
@@ -17,6 +18,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Android;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.SceneManagement;
|
||||
@@ -56,8 +58,10 @@ public class SignForm
|
||||
public Dropdown countrys { get; set; }
|
||||
public Dropdown units { get; set; }
|
||||
}
|
||||
public class LoginController : MonoBehaviour
|
||||
public class LoginController : BaseScene
|
||||
{
|
||||
public GameObject loadingPanel { get; set; }
|
||||
|
||||
private Transform mainContent;
|
||||
/*初始页面*/
|
||||
private Transform quickContainer;
|
||||
@@ -113,6 +117,16 @@ public class LoginController : MonoBehaviour
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
#if UNITY_ANDROID || UNITY_IOS
|
||||
loadingPanel = transform.Find("LoadingPanel").gameObject;
|
||||
#endif
|
||||
#if UNITY_ANDROID
|
||||
if (!Permission.HasUserAuthorizedPermission(Permission.FineLocation))
|
||||
Permission.RequestUserPermission(Permission.FineLocation);
|
||||
|
||||
if (!Permission.HasUserAuthorizedPermission(Permission.ExternalStorageRead))
|
||||
Permission.RequestUserPermission(Permission.ExternalStorageRead);
|
||||
#endif
|
||||
Init();
|
||||
if (loginScrollView != null)
|
||||
{
|
||||
@@ -1114,6 +1128,9 @@ public class LoginController : MonoBehaviour
|
||||
/// <param name="gou"></param>
|
||||
void goMain(Transform gou)
|
||||
{
|
||||
#if (UNITY_ANDROID || UNITY_IOS)
|
||||
StartCoroutine("Loading");
|
||||
#endif
|
||||
var data = userResult;
|
||||
if (data == null) return;
|
||||
//ConfigHelper.CurrentUser = res.data;
|
||||
@@ -1135,8 +1152,30 @@ public class LoginController : MonoBehaviour
|
||||
App.CurrentUser = data;
|
||||
App.RideSetting.Sensitivity = data.Sensitivity;
|
||||
//查询我参加的比赛
|
||||
UIManager.UpdateJoinCompetition();
|
||||
SceneManager.LoadSceneAsync("MainScene");
|
||||
Task.Run(() =>
|
||||
{
|
||||
UIManager.UpdateJoinCompetition();
|
||||
});
|
||||
//SceneManager.LoadSceneAsync("MainScene");
|
||||
StartCoroutine("LoadMain");
|
||||
}
|
||||
|
||||
private IEnumerator Loading()
|
||||
{
|
||||
yield return null;
|
||||
DontDestroyOnLoad(loadingPanel);
|
||||
Utils.showLoadingExtension(loadingPanel);
|
||||
}
|
||||
|
||||
private IEnumerator LoadMain()
|
||||
{
|
||||
yield return new WaitForSeconds(1f);
|
||||
SceneManager.LoadSceneAsync("MainScene").completed += QuickLoginUser_completed;
|
||||
}
|
||||
|
||||
private void QuickLoginUser_completed(AsyncOperation obj)
|
||||
{
|
||||
//Utils.hideLoadingExtension(loadingPanel);
|
||||
}
|
||||
/// <summary>
|
||||
/// 缓存打钩的用户信息
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Assets.Scripts;
|
||||
using Assets.Scenes.Ride.Scripts;
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Devices.Ant;
|
||||
using Assets.Scripts.Scenes;
|
||||
using Assets.Scripts.UI.Prefab.Device;
|
||||
@@ -35,14 +36,16 @@ public class MainController : BaseScene
|
||||
//rect1.offsetMin = Vector2.zero;
|
||||
//rect1.offsetMax = Vector2.zero;
|
||||
//transform.Find("ModalPanel").GetComponent<RectTransform>().sizeDelta = new Vector2(844, 390);
|
||||
#else
|
||||
App.MainDeviceAdapter.StartScan();
|
||||
#endif
|
||||
}
|
||||
App.MainDeviceAdapter.StartScan();
|
||||
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
async void Start()
|
||||
{
|
||||
{
|
||||
|
||||
|
||||
UIManager.Instance.Root = root;
|
||||
UIManager.Instance.MainPanel = this.transform.Find("Panel").GetComponent<PFUIPanel>();
|
||||
UIManager.Instance.ModalsPanel = this.transform.Find("ModalPanel").GetComponent<PFUIPanel>();
|
||||
@@ -94,6 +97,7 @@ public class MainController : BaseScene
|
||||
|
||||
|
||||
float t = 1f;
|
||||
float scanTicks = 0;
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
@@ -103,6 +107,12 @@ public class MainController : BaseScene
|
||||
App.CurrentScene = "Main";
|
||||
UIManager.SendCompetitionStartMessage("Main");
|
||||
t = 1;
|
||||
scanTicks++;
|
||||
if (scanTicks == 10)
|
||||
{
|
||||
App.MainDeviceAdapter.StopScan();
|
||||
Debug.Log("StopScan");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,8 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
private GameObject CancelJoin { get; set; }
|
||||
private GameObject ReadMore { get; set; }
|
||||
|
||||
CompetitionUIManager competitionUI { get; set; }
|
||||
|
||||
public override void InjectController(CyclingController controller)
|
||||
{
|
||||
cyclingController = controller;
|
||||
@@ -45,7 +47,6 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
CompetitionDesc = panel.transform.Find("CompetitionDesc").GetComponent<RawImage>();
|
||||
SponsorLogoImage = panel.transform.Find("SponsorTitle/Sponsor").GetComponent<RawImage>();
|
||||
cyclingController.SetUIManager(mainPanel, modelPanel);
|
||||
|
||||
}
|
||||
protected override void Start()
|
||||
{
|
||||
@@ -259,6 +260,8 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
Utils.showToast(gameObject, "race close");
|
||||
return;
|
||||
}
|
||||
competitionUI = cyclingController.singleUIManager as CompetitionUIManager;
|
||||
competitionUI?.SetMobileViewButton(false);
|
||||
base.StartRide(baseEvent);
|
||||
}
|
||||
//观察
|
||||
|
||||
@@ -18,16 +18,18 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
Text title { get; set; }
|
||||
Text timer { get; set; }
|
||||
GameObject raceViewBtn { get; set; }
|
||||
GameObject timerIcon { get; set; }
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start();
|
||||
|
||||
reviewPanel.SetActive(false);
|
||||
//隐藏单人骑行时间
|
||||
var spilitLineH2 = uipanel.transform.Find("ComputerPanel/SpilitLineH2").gameObject;
|
||||
raceViewBtn = uipanel.transform.Find("RaceViewButton").gameObject;
|
||||
#if UNITY_IOS || UNITY_ANDROID
|
||||
viewButton.enabled = mainController.isWatch;
|
||||
viewButton.interactable = mainController.isWatch;
|
||||
timerIcon = uipanel.transform.Find("ComputerPanel/TimerIcon").gameObject;
|
||||
timerIcon.SetActive(false);
|
||||
#else
|
||||
viewButton.gameObject.SetActive(false);
|
||||
#endif
|
||||
@@ -202,6 +204,14 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
}
|
||||
}
|
||||
|
||||
public void SetMobileViewButton(bool enabled)
|
||||
{
|
||||
#if UNITY_IOS || UNITY_ANDROID
|
||||
//viewButton.enabled = enabled;
|
||||
viewButton.interactable = enabled;
|
||||
#endif
|
||||
}
|
||||
|
||||
protected override void StopRide(BaseEventData baseEventData)
|
||||
{
|
||||
if (!App.MainSceneParam.ContainsKey("Name"))
|
||||
|
||||
@@ -384,8 +384,8 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
if (mainController.competitionId > 0)
|
||||
{
|
||||
var showLeft = watchList.Count > 0;
|
||||
viewButton.enabled = true;
|
||||
viewButton.interactable = true;
|
||||
//viewButton.enabled = true;
|
||||
//viewButton.interactable = true;
|
||||
distanceIconCompetition.SetActive(!showLeft);
|
||||
totalDistanceCompetition.gameObject.SetActive(!showLeft);
|
||||
totalDistance.gameObject.SetActive(showLeft);
|
||||
|
||||
@@ -93,11 +93,13 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
|
||||
competitionId = App.CompetionId;
|
||||
App.CompetionId = 0;//清空比赛参数
|
||||
Resources.UnloadUnusedAssets();
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
App.TextureCache.Clear();
|
||||
//App.TextureCache.Clear();
|
||||
Resources.UnloadUnusedAssets();
|
||||
}
|
||||
Transform target;
|
||||
GameObject watcher;
|
||||
@@ -437,7 +439,7 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
chartDataSourceScript.InitHorizontalScrolling(index);
|
||||
}
|
||||
//SingleUIManager singleUIManager;
|
||||
BaseUIManager singleUIManager;
|
||||
public BaseUIManager singleUIManager;
|
||||
public void GameStart()
|
||||
{
|
||||
singleUIManager.StartRide();
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
public class GameEvent { }
|
||||
public class GameEvent { string key { get; set; } }
|
||||
|
||||
public class EventQueueSystem : MonoSingleton<EventQueueSystem>
|
||||
{
|
||||
@@ -25,7 +26,11 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
//注册侦听事件(持续)
|
||||
public static void AddListener<T>(EventDelegate<T> del) where T : GameEvent
|
||||
{
|
||||
Instance.AddDelegate(del);
|
||||
if (!HasListener(del))
|
||||
{
|
||||
Debug.Log(30);
|
||||
Instance.AddDelegate(del);
|
||||
}
|
||||
}
|
||||
|
||||
//注册侦听事件(一次)
|
||||
@@ -39,7 +44,8 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
//判定侦听事件是否存在
|
||||
public static bool HasListener<T>(EventDelegate<T> del) where T : GameEvent
|
||||
{
|
||||
return Instance.delegateLookup.ContainsKey(del);
|
||||
return Instance.delegateLookup.Keys.Where(c => c.GetType() == del.GetType()).Any();
|
||||
//return Instance.delegateLookup.ContainsKey(del);
|
||||
}
|
||||
|
||||
//移除侦听事件
|
||||
@@ -114,6 +120,18 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
return;
|
||||
Instance.eventQueue.Enqueue(e);
|
||||
}
|
||||
static List<string> keyList = new List<string>();
|
||||
|
||||
public static void QueueEventOnce(GameEvent e,string key)
|
||||
{
|
||||
if (!Instance.delegates.ContainsKey(e.GetType()))
|
||||
return;
|
||||
if (keyList.Contains(key))
|
||||
return;
|
||||
keyList.Add(key);
|
||||
Debug.Log(126);
|
||||
Instance.eventQueue.Enqueue(e);
|
||||
}
|
||||
float timer = 0.0f;
|
||||
//事件队列触发处理
|
||||
void Update()
|
||||
|
||||
Reference in new issue
Block a user