登录增加loading&赛事提醒修改

This commit is contained in:
lishuo committed 2021-09-13 18:21:43 +08:00
1 parent 51cea743be
commit dfb80658dd
23 files changed
+2137 -34355

No files matched your search

@@ -16,6 +16,7 @@ public class QuickLoginUser : MonoBehaviour
{
QUserInfo user;
Transform top;
GameObject loadingPanel { get; set; }
// Start is called before the first frame update
void Start()
{
@@ -30,6 +31,8 @@ public class QuickLoginUser : MonoBehaviour
goMain();
});
#else
var loginController = FindObjectOfType<LoginController>();
loadingPanel = loginController.loadingPanel;
gameObject.GetComponent<Button>().onClick.AddListener(() => { goMain(); });
#endif
//transform.GetComponent<Button>().onClick.AddListener();
@@ -49,6 +52,10 @@ public class QuickLoginUser : MonoBehaviour
}
async void goMain()
{
#if (UNITY_ANDROID || UNITY_IOS)
StartCoroutine("Loading");
#endif
ApiBase.SetCookie(user.Cookie);
var r = await ConfigHelper.userApi.QuickLogin();
if (r.result)
@@ -56,13 +63,31 @@ public class QuickLoginUser : MonoBehaviour
top.GetComponent<LoginController>().SaveInfo(r.data);
App.CurrentUser = r.data;
App.RideSetting.Sensitivity = App.CurrentUser.Sensitivity;
SceneManager.LoadScene("MainScene");
//SceneManager.LoadScene("MainScene");
StartCoroutine("LoadMain");
}
else
{
Utils.showToast(gameObject, r.errMsg);
}
}
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);
}
private void OnDestroy()
{
}
@@ -10,7 +10,7 @@ namespace Assets.Scenes.Ride.Scripts
public class RaceAlertController : PFUIPanel
{
public Text Content { get; set; }
//public Text Timer { get; set; }
public Text Timer { get; set; }
public GameObject GoBtn { get; set; }
public GameObject Card { get; set; }
public GameObject StayBtn { get; set; }
@@ -23,7 +23,7 @@ namespace Assets.Scenes.Ride.Scripts
protected override void Awake()
{
//Card
//Timer = this.transform.Find("Card/Timer").GetComponent<Text>();
Timer = this.transform.Find("Card/Timer")?.GetComponent<Text>();
Content = this.transform.Find("Card/Content").GetComponent<Text>();
GoBtn = this.transform.Find("Card/Go").gameObject;
StayBtn = this.transform.Find("Card/Stay").gameObject;
@@ -35,16 +35,19 @@ namespace Assets.Scenes.Ride.Scripts
float t = 1f;
private void Update()
{
//t -= Time.deltaTime;
//while (t <= 0)
//{
// if (ticks > 0)
// {
// ticks--;
// Timer.text = Helper.FormatTicks(ticks);
// }
// t = 1f;
//}
t -= Time.deltaTime;
while (t <= 0)
{
if (ticks > 0)
{
ticks--;
if (Timer != null)
{
Timer.text = Helper.FormatTicks(ticks);
}
}
t += 1f;
}
}
public void Set(DateTime startTime, DateTime now,string title, string sceneName, int competitionId,int routeId)
@@ -69,6 +72,8 @@ namespace Assets.Scenes.Ride.Scripts
{
App.CompetitionIdList.Add(CompetitionId);
this.Close();
Utils.DestroyChildren(transform);
DestroyImmediate(gameObject);
}
}
}
@@ -79,7 +79,7 @@ public class LocalRouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterH
Name.text = record.RouteName;
Time.text = record.StartTime.ToString();
RidingTime.text = $"<color={titleColor}>Riding time:</color>{record.Ticks}";
RidingTime.text = $"<color={titleColor}>Riding time:</color>{Helper.FormatTicks(record.Ticks)}";
RidingDistance.text = $"<color={titleColor}>Mileage:</color>{record.EndDistance.ToString("#0.00")}KM";
Device.text = $"<color={titleColor}>Cycling equipment:</color>{record.ManufacturerName}";
}