比赛;编辑页面

This commit is contained in:
Caiyanpeng committed 2021-08-31 17:11:43 +08:00
1 parent 85130ce6c3
commit 3ec6fd0569
56 files changed
+16371 -2749

No files matched your search

+20 -13
View File
@@ -110,9 +110,11 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,
tabContainer.Find("3d").gameObject.SetActive(myMap.Enable3D);
tabContainer.Find("Country").GetComponent<RawImage>().texture = UIManager.Instance.loginRegOptions.GetCountryImage(myMap.CountryCode);
transform.Find("CollectImg").GetComponent<Button>().onClick.AddListener(Collect);
transform.Find("CollectImg").gameObject.SetActive(false);
transform.Find("CollectImg").Find("Image").GetComponent<Image>().sprite =
UIManager.Instance.collectDict[myMap.IsFavorite];
#if !(UNITY_ANDROID || UNITY_IOS)
transform.Find("CollectImg").gameObject.SetActive(false);
#endif
transform.Find("BtnInfo").GetComponent<Button>().onClick.AddListener(Info);
transform.Find("BtnRide").GetComponent<Button>().onClick.AddListener(Ride);
@@ -141,8 +143,23 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,
UIManager.ShowMapDetailPanel(map.Id);
}
public void OnPointerExit(PointerEventData eventData)
{
#if !(UNITY_ANDROID || UNITY_IOS)
if (localY != null)
{
transform.DOLocalMoveY(localY.Value, 0.3f);
}
transform.Find("CollectImg").gameObject.SetActive(false);
transform.Find("Shadow").gameObject.SetActive(false);
Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
//SetActive4Button(false);
SetColor(false);
#endif
}
public void OnPointerEnter(PointerEventData eventData)
{
#if !(UNITY_ANDROID || UNITY_IOS)
if (localY == null)
{
localY = transform.localPosition.y;
@@ -153,6 +170,7 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,
Cursor.SetCursor(Resources.Load<Texture2D>("Images/PointerButtonHover"), Vector2.zero, CursorMode.Auto);
//SetActive4Button(true);
SetColor(true);
#endif
}
void SetActive4Button(bool b)
{
@@ -160,18 +178,7 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,
transform.Find("BtnInfo").gameObject.SetActive(b);
transform.Find("BtnRide").gameObject.SetActive(b);
}
public void OnPointerExit(PointerEventData eventData)
{
if (localY != null)
{
transform.DOLocalMoveY(localY.Value, 0.3f);
}
transform.Find("CollectImg").gameObject.SetActive(false);
transform.Find("Shadow").gameObject.SetActive(false);
Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
//SetActive4Button(false);
SetColor(false);
}
private void SetColor(bool isFav)
{
PropNames.icons.ForEach((v) =>
@@ -2,6 +2,7 @@
using Assets.Scripts.Apis;
using Assets.Scripts.Apis.Models;
using Assets.Scripts.UI.Control;
using DG.Tweening;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
@@ -48,8 +49,23 @@ public class EditUserController : PFUIPanel
{
Debug.Log(Utils.GetIP(Utils.ADDRESSFAM.IPv4));
userApi = new UserApi();
#if !(UNITY_ANDROID || UNITY_IOS)
var panel = this.transform.Find("Panel");
#else
var panel = this.transform.Find("Panel/MainPanel");
float? panelTop = null;
Debug.Log($"cyp,{panelTop}");
UIManager.AddEvent(transform.Find("Panel/Btn1").gameObject, EventTriggerType.PointerClick, b =>
{
if (!panelTop.HasValue) panelTop = transform.localPosition.y+185;
panel.DOLocalMoveY(panelTop.Value, 0.3f);
});
UIManager.AddEvent(transform.Find("Panel/Btn2").gameObject, EventTriggerType.PointerClick, b =>
{
if (!panelTop.HasValue) panelTop = transform.localPosition.y+185;
panel.DOLocalMoveY(panelTop.Value + 370, 0.3f);
});
#endif
mID = panel.Find("IDNumber").Find("input").Find("Text").GetComponent<Text>();
mSexDropdown = panel.Find("SexDropdown").GetComponent<PFUIDropdown>();
mSexDropdown = panel.Find("SexDropdown").GetComponent<PFUIDropdown>();
@@ -41,8 +41,44 @@ public class MapListController : PFUIPanel
}
}
private bool isEnd = false;
private Transform topContainer;
protected override void Start()
{
#if (UNITY_ANDROID || UNITY_IOS)
topContainer = transform.Find("Top");
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);
//筛选按钮
var topRect = topContainer.GetComponent<RectTransform>();
if (!App.topRectStartX.HasValue)
{
App.topRectStartX = topRect.localPosition.x;
}
var mc = transform.Find("MC");
UIManager.AddEvent(transform.Find("Panel/BtnFilter").gameObject, EventTriggerType.PointerClick, b =>
{
topContainer.DOLocalMoveX(App.topRectStartX.Value - topRect.rect.width, 0.3f);
mc.gameObject.SetActive(true);
mc.GetComponent<CanvasGroup>().alpha = 0;
mc.GetComponent<CanvasGroup>().DOFade(1, 0.3f);
});
UIManager.AddEvent(topContainer.Find("BtnCancel").gameObject, EventTriggerType.PointerClick, b =>
{
topContainer.DOLocalMoveX(App.topRectStartX.Value, 0.3f);
mc.GetComponent<CanvasGroup>().DOFade(0, 0.3f).onComplete = () =>
{
mc.gameObject.SetActive(false);
};
});
map = Resources.Load<GameObject>("UI/Prefab/MapList/MapItem-Mobile");
#else
topContainer = transform.Find("Panel").Find("Top");
#endif
sort = "Near";
sortDire = "asc";
//if (hardSelector != null)
@@ -69,14 +105,14 @@ public class MapListController : PFUIPanel
// layout.cellSize = new Vector2((width - 120) / 5, (width - 120) / 5);
//}
}
distanceOptions = transform.Find("Panel").Find("Top").Find("distanceOptions");
distanceOptions = topContainer.Find("distanceOptions");
if (distanceOptions != null)
{
var dDropdown = distanceOptions.GetComponent<Dropdown>();
dDropdown.options = MapFilterOptions.distances;
dDropdown.onValueChanged.AddListener(ChangeDistance);
}
diffOptions = transform.Find("Panel").Find("Top").Find("DifficultyContainer");
diffOptions = topContainer.Find("DifficultyContainer");
if (diffOptions != null)
{
foreach (Transform t in diffOptions)
@@ -130,8 +166,8 @@ public class MapListController : PFUIPanel
UIManager.ShowHomePanel();
});
}
tdContainer = transform.Find("Panel").Find("Top").Find("3dContainer");
favContainer = transform.Find("Panel").Find("Top").Find("FavContainer");
tdContainer = topContainer.Find("3dContainer");
favContainer = topContainer.Find("FavContainer");
if (tdContainer != null)
{
UIManager.AddEvent(tdContainer.gameObject, EventTriggerType.PointerClick, (b) =>
@@ -154,7 +190,7 @@ public class MapListController : PFUIPanel
Refresh();
});
}
searchInput = transform.Find("Panel").Find("Top").Find("SearchInput");
searchInput = topContainer.Find("SearchInput");
if (searchInput != null)
{
//searchInput.GetComponent<InputField>().onEndEdit.AddListener((s) =>
@@ -167,7 +203,7 @@ public class MapListController : PFUIPanel
onEndEdit();
});
}
sorts = transform.Find("Panel").Find("Top").Find("FilterOptions");
sorts = topContainer.Find("FilterOptions");
if (sorts != null)
{
var drop = sorts.GetComponent<Dropdown>();
@@ -195,7 +231,7 @@ public class MapListController : PFUIPanel
Refresh();
});
}
sortDir = transform.Find("Panel").Find("Top").Find("Dir");
sortDir = topContainer.Find("Dir");
if (sortDir)
{
var image = sortDir.Find("Image").GetComponent<Image>();
@@ -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:
+2 -2
View File
@@ -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
@@ -179,6 +179,7 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
}
});
}
#if !(UNITY_ANDROID||UNITY_IOS)
void SetButtonColor(bool f)
{
if (routeResult!=null)
@@ -222,6 +223,32 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
}
}
#else
void SetButtonColor(bool f)
{
if (!f)
{
transform.Find("Right").gameObject.SetActive(false);
transform.Find("RightMatch").gameObject.SetActive(false);
transform.Find("RightDot").gameObject.SetActive(true);
}
else
{
transform.Find("Right").gameObject.SetActive(index == 0);
if (index == 0)
{
bool disabled = routeResult.ContinueCyclingParam == null;
if (disabled)
{
btnContinue.GetComponent<Image>().color = Utils.HexToColorHtml("#cdcdcd");
}
}
transform.Find("RightMatch").gameObject.SetActive(index == 1);
transform.Find("RightDot").gameObject.SetActive(false);
}
}
#endif
public void OnPointerExit(PointerEventData eventData)
{
transform.GetComponent<Image>().color = Utils.HexToColorHtml("#23232d");