比赛;编辑页面
This commit is contained in:
1 parent
85130ce6c3
commit
3ec6fd0569
56 files changed
+16371
-2749
No files matched your search
@@ -71,7 +71,11 @@ public class RaceHomeScript : RaceScript
|
||||
StartTime();
|
||||
rightContainer = transform.Find("RightContainer");
|
||||
leftContainer = transform.Find("LeftContainer");
|
||||
#if !(UNITY_ANDROID || UNITY_IOS)
|
||||
btnGoList = rightContainer.Find("Container-2/BtnGoList");
|
||||
#else
|
||||
btnGoList = rightContainer.Find("BtnGoList");
|
||||
#endif
|
||||
if (btnGoList != null)
|
||||
{
|
||||
UIManager.AddEvent(btnGoList.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
||||
@@ -92,7 +96,11 @@ public class RaceHomeScript : RaceScript
|
||||
|
||||
async void GetData()
|
||||
{
|
||||
#if !(UNITY_ANDROID || UNITY_IOS)
|
||||
var r = await ConfigHelper.mapCompetitionApi.GetCompetitionListV2("", 0, 7, order: 0);
|
||||
#else
|
||||
var r = await ConfigHelper.mapCompetitionApi.GetCompetitionListV2("", 0, 4, order: 0);
|
||||
#endif
|
||||
var activityList = await ConfigHelper.mapCompetitionApi.GetCompetitionListV2("", 0, 3, activity: 1, order: 2);
|
||||
DisplayMaps(r.data, activityList.data);
|
||||
Initial();
|
||||
@@ -112,6 +120,10 @@ public class RaceHomeScript : RaceScript
|
||||
smallGame = Resources.Load<GameObject>("UI/Prefab/Race/ItemSmall"),
|
||||
bannerItem = Resources.Load<GameObject>("UI/Prefab/Race/Banner/BannerItem"),
|
||||
dotItem = Resources.Load<GameObject>("UI/Prefab/Race/Banner/DotItem");
|
||||
#if UNITY_ANDROID || UNITY_ANDROID
|
||||
bannerItem = Resources.Load<GameObject>("UI/Prefab/Race/Banner/BannerItem-Mobile");
|
||||
smallGame = Resources.Load<GameObject>("UI/Prefab/Race/Mobile/ItemSmall-Mobile");
|
||||
#endif
|
||||
//for (i = 0; i < 2; i++)
|
||||
//{
|
||||
// var game = Instantiate<GameObject>(bigGame);
|
||||
@@ -166,9 +178,11 @@ public class RaceHomeScript : RaceScript
|
||||
dot.transform.localScale = Vector3.one;
|
||||
//scroll.content
|
||||
}
|
||||
#if !(UNITY_ANDROID || UNITY_IOS)
|
||||
rightContainer.Find("Container-2/BtnGoList").SetAsLastSibling();
|
||||
rightContainer.Find("Container-2/BtnGoList").GetComponent<RaceMaskScript>().localY =
|
||||
list.Count < 4 ? -167.5f :-492.5f;
|
||||
#endif
|
||||
}
|
||||
void OnBannerClick(MapCompetition map)
|
||||
{
|
||||
@@ -192,7 +206,14 @@ public class RaceHomeScript : RaceScript
|
||||
//{
|
||||
// contentSize = 0;
|
||||
//}
|
||||
contentSize = 1f / (content.childCount - 1);
|
||||
if (content.childCount > 1)
|
||||
{
|
||||
contentSize = 1f / (content.childCount - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
contentSize = 0;
|
||||
}
|
||||
scroll.horizontalNormalizedPosition = 0;
|
||||
}
|
||||
void goLeft()
|
||||
@@ -211,7 +232,7 @@ public class RaceHomeScript : RaceScript
|
||||
void goMove(int i = 1)
|
||||
{
|
||||
//doAni();
|
||||
if (startMoveEnd) return;
|
||||
if (startMoveEnd || contentSize == 0) return;
|
||||
if (!start) startPosition = scroll.horizontalNormalizedPosition;
|
||||
start = true;
|
||||
scrollValue = i * contentSize / 20;
|
||||
|
||||
@@ -9,7 +9,10 @@ using UnityEngine.EventSystems;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class RaceItemScript : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler, IPointerUpHandler
|
||||
public class RaceItemScript : MonoBehaviour
|
||||
#if !(UNITY_ANDROID||UNITY_IOS)
|
||||
, IPointerExitHandler, IPointerEnterHandler, IPointerUpHandler
|
||||
#endif
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
public enum ItemType { big, small }
|
||||
@@ -26,8 +29,9 @@ public class RaceItemScript : MonoBehaviour, IPointerExitHandler, IPointerEnterH
|
||||
{
|
||||
|
||||
}
|
||||
public void Initial(MapCompetition mapCompetition,Transform parent)
|
||||
public void Initial(MapCompetition mapCompetition,Transform parent,string from = "list")
|
||||
{
|
||||
#if !(UNITY_ANDROID || UNITY_IOS)
|
||||
transform.GetComponent<Button>().onClick.AddListener(() =>
|
||||
{
|
||||
App.RouteIdParam = mapCompetition.RouteId;
|
||||
@@ -35,6 +39,16 @@ public class RaceItemScript : MonoBehaviour, IPointerExitHandler, IPointerEnterH
|
||||
SceneManager.LoadScene("Ride");
|
||||
});
|
||||
Utils.DisplayImage(transform.GetComponent<RawImage>(), mapCompetition.RouteCover, true);
|
||||
#else
|
||||
if (from == "list")
|
||||
{
|
||||
Utils.DisplayImage(transform.GetComponent<RawImage>(), mapCompetition.RouteCover, true);
|
||||
transform.GetComponent<Button>().onClick.AddListener(() =>
|
||||
{
|
||||
UIManager.ShowRaceDetailModal(mapCompetition);
|
||||
});
|
||||
}
|
||||
#endif
|
||||
Utils.DisplayImage(transform.Find("AltitudeCurve").GetComponent<RawImage>(), mapCompetition.AltitudeGraph, true);
|
||||
transform.Find("InfoContainer/Text").GetComponent<Text>().SetTextWithEllipsis(mapCompetition.Title);
|
||||
transform.Find("GetReadyContainer").gameObject.SetActive(mapCompetition.Status != 4);
|
||||
@@ -52,7 +66,14 @@ public class RaceItemScript : MonoBehaviour, IPointerExitHandler, IPointerEnterH
|
||||
transform.Find("InfoContainer/StartTime/Text").GetComponent<Text>().text = mapCompetition.StartTime.ToLocalTime().ToString();
|
||||
transform.Find("CountContainer/Text").GetComponent<Text>().text = mapCompetition.ApplyCount.ToString();
|
||||
SetStatus(mapCompetition);
|
||||
#if !(UNITY_ANDROID || UNITY_IOS)
|
||||
SetButtonGroup(mapCompetition);
|
||||
#else
|
||||
if (from != "list")
|
||||
{
|
||||
SetButtonGroup(mapCompetition);
|
||||
}
|
||||
#endif
|
||||
if (parent != null)
|
||||
{
|
||||
this.parent = parent;
|
||||
|
||||
@@ -193,7 +193,16 @@ public class RaceListScript : RaceScript
|
||||
}
|
||||
//Refresh();
|
||||
}
|
||||
|
||||
protected override void Start()
|
||||
{
|
||||
#if (UNITY_ANDROID || UNITY_IOS)
|
||||
var rectTransform = transform.GetComponent<RectTransform>();
|
||||
var offsetMax = rectTransform.offsetMax;
|
||||
rectTransform.offsetMax = new Vector2(0, offsetMax.y);
|
||||
var offsetMin = rectTransform.offsetMin;
|
||||
rectTransform.offsetMin = new Vector2(0, offsetMin.y);
|
||||
#endif
|
||||
}
|
||||
private async Task Login()
|
||||
{
|
||||
var result = await ConfigHelper.userApi.Login("13115011550", "laozhong", "");
|
||||
@@ -279,7 +288,12 @@ public class RaceListScript : RaceScript
|
||||
|
||||
private void DisplayMaps(List<MapCompetition> list)
|
||||
{
|
||||
#if UNITY_ANDROID || UNITY_IOS
|
||||
GameObject smallGame = Resources.Load<GameObject>("UI/Prefab/Race/Mobile/ItemSmall-Mobile");
|
||||
#else
|
||||
GameObject smallGame = Resources.Load<GameObject>("UI/Prefab/Race/ItemSmall");
|
||||
#endif
|
||||
|
||||
foreach (var map in list)
|
||||
{
|
||||
var game = Instantiate<GameObject>(smallGame);
|
||||
|
||||
@@ -9,10 +9,12 @@ public class RaceMaskScript : MonoBehaviour, IPointerEnterHandler,IPointerExitHa
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
transform.Find("Panel").GetComponent<CanvasGroup>().DOFade(1, 0.5f);
|
||||
if (localY.HasValue)
|
||||
|
||||
if (!localY.HasValue)
|
||||
{
|
||||
transform.DOLocalMoveY(localY.Value + 5, 0.3f);
|
||||
localY = transform.localPosition.y;
|
||||
}
|
||||
transform.DOLocalMoveY(localY.Value + 5, 0.3f);
|
||||
}
|
||||
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class RaceModalScript : RaceScript
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
UIManager.AddEvent(transform.Find("Container/Exit").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
//停止计时器
|
||||
UIManager.CloseModal();
|
||||
transform.GetComponent<RaceScript>().SetCurrentItem(null);
|
||||
});
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
public void Initial(MapCompetition mapCompetition)
|
||||
{
|
||||
var item = transform.Find("Container/Main/ItemSmall-Mobile");
|
||||
|
||||
item.GetComponent<RaceItemScript>().Initial(mapCompetition, transform,"modal");
|
||||
//开始计时器
|
||||
transform.GetComponent<RaceScript>().SetCurrentItem(item);
|
||||
Utils.DisplayImage(transform.Find("Container/Main/Left").GetComponent<RawImage>(),
|
||||
mapCompetition.RouteCover, true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 95df82ebb7d60894c80ae5ba7afdf48b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -31,10 +31,10 @@ public class RaceScript : PFUIPanel
|
||||
/// <param name="t"></param>
|
||||
public void SetCurrentItem(Transform t)
|
||||
{
|
||||
currentItem = t;
|
||||
HandleTime();
|
||||
if (t != null)
|
||||
{
|
||||
currentItem = t;
|
||||
HandleTime();
|
||||
StartTime();
|
||||
}
|
||||
else
|
||||
|
||||
Reference in new issue
Block a user