修改细节
This commit is contained in:
1 parent
164db7c013
commit
ca938ab6f5
16 files changed
+1608
-51
No files matched your search
@@ -13,12 +13,17 @@ public class RaceHomeScript : RaceScript
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
private ScrollRect scroll;
|
||||
private Transform content,rightContainer,leftContainer,btnGoList,avatar;
|
||||
private Transform content,rightContainer,leftContainer,btnGoList;
|
||||
private float contentSize;
|
||||
private int count;
|
||||
private Button L, R;
|
||||
//当前鼠标悬浮的卡片
|
||||
async void Start()
|
||||
public override void Show()
|
||||
{
|
||||
base.Show();
|
||||
handleAvatar();
|
||||
}
|
||||
void Start()
|
||||
{
|
||||
scroll = transform.Find("LeftContainer/Swiper").GetComponent<ScrollRect>();
|
||||
content = scroll.content;
|
||||
@@ -43,38 +48,31 @@ public class RaceHomeScript : RaceScript
|
||||
});
|
||||
}
|
||||
StartTime();
|
||||
#if UNITY_EDITOR
|
||||
if (App.CurrentUser == null) //App.CurrentUser == null
|
||||
{
|
||||
await Login();
|
||||
}
|
||||
#endif
|
||||
rightContainer = transform.Find("RightContainer");
|
||||
leftContainer = transform.Find("LeftContainer");
|
||||
btnGoList = rightContainer.Find("Container-2/BtnGoList");
|
||||
UIManager.AddEvent(btnGoList.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
UIManager.ShowRaceListPanel();
|
||||
transform.GetComponent<CanvasGroup>().DOFade(0, 0.5f).onComplete = () =>
|
||||
{
|
||||
UIManager.ShowRaceListPanel();
|
||||
};
|
||||
});
|
||||
avatar = transform.Find("Avatar");
|
||||
if (avatar != null)
|
||||
{
|
||||
Utils.DisplayImage(avatar.GetComponent<RawImage>(), App.CurrentUser.WxHeadImg, true);
|
||||
UIManager.AddEvent(avatar.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
UIManager.ShowUserInfoPanel();
|
||||
});
|
||||
}
|
||||
var r = await ConfigHelper.mapCompetitionApi.GetCompetitionListV2("", 0, 7,order:0);
|
||||
var activityList = await ConfigHelper.mapCompetitionApi.GetCompetitionListV2("", 0, 3, activity: 1,order:1);
|
||||
DisplayMaps(r.data,activityList.data);
|
||||
handleAvatar();
|
||||
GetData();
|
||||
}
|
||||
|
||||
async void GetData()
|
||||
{
|
||||
var r = await ConfigHelper.mapCompetitionApi.GetCompetitionListV2("", 0, 7, order: 0);
|
||||
var activityList = await ConfigHelper.mapCompetitionApi.GetCompetitionListV2("", 0, 3, activity: 1, order: 1);
|
||||
DisplayMaps(r.data, activityList.data);
|
||||
Initial();
|
||||
Utils.StartTimeUnLimit(10, () =>
|
||||
Utils.StartTimeUnLimit(10, () =>
|
||||
{
|
||||
goRight();
|
||||
});
|
||||
}
|
||||
|
||||
private void DisplayMaps(List<MapCompetition> list, List<MapCompetition> activityList)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
@@ -46,7 +46,10 @@ public class RaceItemScript : MonoBehaviour, IPointerExitHandler, IPointerEnterH
|
||||
transform.Find("CountContainer/Text").GetComponent<Text>().text = mapCompetition.ApplyCount.ToString();
|
||||
SetStatus(mapCompetition);
|
||||
SetButtonGroup(mapCompetition);
|
||||
this.parent = parent;
|
||||
if (parent != null)
|
||||
{
|
||||
this.parent = parent;
|
||||
}
|
||||
this.mapCompetition = mapCompetition;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using Assets.Scripts.UI.Prefab.Race;
|
||||
using DG.Tweening;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -21,15 +22,14 @@ public class RaceListScript : RaceScript
|
||||
private List<string> statusOptions = new List<string>();
|
||||
bool isReserve = false;
|
||||
int order = 1;
|
||||
public override void Show()
|
||||
{
|
||||
base.Show();
|
||||
handleAvatar();
|
||||
}
|
||||
//筛选条件
|
||||
async void Start()
|
||||
void Start()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
if (App.CurrentUser == null) //App.CurrentUser == null
|
||||
{
|
||||
await Login();
|
||||
}
|
||||
#endif
|
||||
scroll = transform.Find("ListContainer/List").gameObject;
|
||||
if (scroll != null)
|
||||
{
|
||||
@@ -108,18 +108,13 @@ public class RaceListScript : RaceScript
|
||||
{
|
||||
UIManager.AddEvent(btnReturn.gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
UIManager.ShowRaceHomePanel(true);
|
||||
});
|
||||
}
|
||||
avatar = transform.Find("Avatar");
|
||||
if (avatar != null)
|
||||
{
|
||||
Utils.DisplayImage(avatar.GetComponent<RawImage>(), App.CurrentUser.WxHeadImg, true);
|
||||
UIManager.AddEvent(avatar.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
UIManager.ShowUserInfoPanel();
|
||||
transform.GetComponent<CanvasGroup>().DOFade(0, 0.5f).onComplete = () =>
|
||||
{
|
||||
UIManager.ShowRaceHomePanel(true);
|
||||
};
|
||||
});
|
||||
}
|
||||
handleAvatar();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
@@ -134,7 +129,6 @@ public class RaceListScript : RaceScript
|
||||
{
|
||||
if (Input.GetAxis("Mouse ScrollWheel") != 0)
|
||||
{
|
||||
Debug.Log(scroll.GetComponent<ScrollRect>().verticalNormalizedPosition);
|
||||
if (scroll.GetComponent<ScrollRect>().verticalNormalizedPosition <= 0 ||
|
||||
scroll.GetComponent<ScrollRect>().verticalNormalizedPosition >= (pageIndex == 0 ? 1.2 : 1))
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Assets.Scripts;
|
||||
using DG.Tweening;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@@ -8,6 +9,11 @@ public class RaceScript : PFUIPanel
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
protected Transform currentItem { get; set; }
|
||||
public override void Show()
|
||||
{
|
||||
base.Show();
|
||||
transform.GetComponent<CanvasGroup>().DOFade(1, 0.5f);
|
||||
}
|
||||
protected void StartTime()
|
||||
{
|
||||
timerFlag = true;
|
||||
@@ -34,6 +40,20 @@ public class RaceScript : PFUIPanel
|
||||
StopTime();
|
||||
}
|
||||
}
|
||||
private Transform avatar;
|
||||
protected void handleAvatar()
|
||||
{
|
||||
avatar = transform.Find("Avatar");
|
||||
if (avatar != null)
|
||||
{
|
||||
Debug.Log(App.CurrentUser.WxHeadImg);
|
||||
Utils.DisplayImage(avatar.GetComponent<RawImage>(), App.CurrentUser.WxHeadImg, true);
|
||||
UIManager.AddEvent(avatar.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
UIManager.ShowUserInfoPanel();
|
||||
});
|
||||
}
|
||||
}
|
||||
/*参考代码
|
||||
var second = Math.Ceiling((Now - mapCompetition.StartTime.ToLocalTime()).TotalSeconds);
|
||||
|
||||
@@ -54,7 +74,6 @@ public class RaceScript : PFUIPanel
|
||||
if (currentItem != null && currentItem.Find("GetReadyContainer").gameObject.activeSelf)
|
||||
{
|
||||
var map = currentItem.GetComponent<RaceItemScript>().mapCompetition;
|
||||
Debug.Log(map.Status);
|
||||
if (map.Status == 1)
|
||||
{
|
||||
currentItem.Find("GetReadyContainer/Title").GetComponent<Text>().text = "Application Start Time";
|
||||
@@ -67,16 +86,21 @@ public class RaceScript : PFUIPanel
|
||||
else
|
||||
{
|
||||
//Dictionary<int,>
|
||||
var time = (map.Status == 1 ? map.StartTime.ToLocalTime() : map.EndTime.ToLocalTime()) - UIManager.Now.GetDateTime();
|
||||
var time = (map.Status == 2 ? map.StartTime.ToLocalTime() : map.EndTime.ToLocalTime()) - UIManager.Now.GetDateTime();
|
||||
if (time.TotalSeconds < 0)
|
||||
{
|
||||
currentItem.Find("GetReadyContainer").GetComponent<CanvasGroup>().alpha = 0;
|
||||
var res = ConfigHelper.mapCompetitionApi.GetById(map.Id);
|
||||
if (res.result)
|
||||
{
|
||||
currentItem.GetComponent<RaceItemScript>().Initial(res.data, null);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
currentItem.Find("GetReadyContainer").GetComponent<CanvasGroup>().alpha = 1;
|
||||
currentItem.Find("GetReadyContainer/Title").GetComponent<Text>().text
|
||||
= map.Status == 1 ? "Get Ready" : "Riding Time";
|
||||
= map.Status == 2 ? "Get Ready" : "Riding Time";
|
||||
currentItem.Find("GetReadyContainer/Value").GetComponent<Text>().text
|
||||
= Utils.GetCountDown(time);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user