Merge remote-tracking branch 'origin/dev_mobile' into dev_mobile_ble

# Conflicts:
#	Assets/Scripts/App.cs
#	Assets/Scripts/Mobile/WeChatController.cs
This commit is contained in:
lishuo committed 2021-09-02 10:10:06 +08:00
commit c280408192
92 files changed
+27853 -6958

No files matched your search

@@ -7,6 +7,7 @@ using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using DG.Tweening;
namespace Assets.Scripts.UI.Control
{
@@ -96,6 +97,10 @@ namespace Assets.Scripts.UI.Control
public void SetValidate()
{
outline.enabled = true;
outline.DOFade(1, 1f).onComplete = () =>
{
outline.DOFade(0, 1f);
};
}
//public void SetValidate(string s)
//{
+6 -2
View File
@@ -7,7 +7,7 @@ using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using DG.Tweening;
namespace Assets.Scripts.UI.Control
{
public class PFUIInputField: PFUIComponentBase
@@ -81,7 +81,7 @@ namespace Assets.Scripts.UI.Control
material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
}
var rect = ((RectTransform)transform).rect;
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, Math.Min(rect.height*0.7f, 50f), 0));
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, Math.Min(rect.height*0.35f, 50f), 0));
gameObject.GetComponent<Image>().material = material;
outline = this.GetComponent<Outline>();
@@ -123,6 +123,10 @@ namespace Assets.Scripts.UI.Control
if (value)
{
outline.enabled = true;
outline.DOFade(1, 1f).onComplete = () =>
{
outline.DOFade(0, 1f);
};
outline.effectColor = Utils.HexToColorHtml("#F93086");
ColorUtility.TryParseHtmlString("#F93086", out Color color);
//this.mInnerInputField.transform.Find("Text").GetComponent<Text>().color = color;
+2
View File
@@ -110,12 +110,14 @@ namespace Assets.Scripts.UI.Control
{
if (!this.isActiveAndEnabled) return;
//Cursor.SetCursor(cursor, Vector2.zero, CursorMode.Auto);
#if !(UNITY_ANDROID || UNITY_IOS)
if (!string.IsNullOrWhiteSpace(Tooltips))
{
tooltips.GetComponent<CanvasGroup>().alpha = 0f;
tooltips.SetActive(true);
tooltips.GetComponent<CanvasGroup>().DOFade(1f, 0.2f);
}
#endif
switch (mType)
{
case Type.Normal:
@@ -14,9 +14,27 @@ public class QuickLoginScroll : MonoBehaviour
private float contentSize;
private int count;
[SerializeField] Button L, R;
float startPos, endPos;
void Start()
{
scroll = gameObject.GetComponent<ScrollRect>();
UIManager.AddEvent(scroll.gameObject, UnityEngine.EventSystems.EventTriggerType.BeginDrag, b =>
{
startPos = scroll.horizontalNormalizedPosition;
Debug.Log(startPos);
});
UIManager.AddEvent(scroll.gameObject, UnityEngine.EventSystems.EventTriggerType.EndDrag, b =>
{
endPos = scroll.horizontalNormalizedPosition;
if (startPos > endPos)
{
goLeft();
}
else if (startPos < endPos)
{
goRight();
}
});
//scroll.onValueChanged.AddListener((a) =>
//{
// Debug.Log(a);
@@ -28,6 +46,7 @@ public class QuickLoginScroll : MonoBehaviour
{
UIManager.AddEvent(L.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick,(b)=>
{
startPos = scroll.horizontalNormalizedPosition;
goLeft();
});
//L.onClick.AddListener(goLeft);
@@ -36,6 +55,7 @@ public class QuickLoginScroll : MonoBehaviour
{
UIManager.AddEvent(R.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, (b) =>
{
startPos = scroll.horizontalNormalizedPosition;
goRight();
});
//R.onClick.AddListener(goRight);
@@ -67,6 +87,7 @@ public class QuickLoginScroll : MonoBehaviour
if (content.childCount - 3 > 0)
{
contentSize = 1f / (content.childCount - 3);
Debug.Log(contentSize);
}
else
{
@@ -82,32 +103,39 @@ public class QuickLoginScroll : MonoBehaviour
scroll.horizontalNormalizedPosition = contentSize/2+i*contentSize;
#else
scroll.horizontalNormalizedPosition = i * contentSize;
Debug.Log(scroll.horizontalNormalizedPosition);
#endif
SetColor();
}
void goLeft()
{
Debug.Log($"{scroll.horizontalNormalizedPosition},{contentSize}");
if (scroll.horizontalNormalizedPosition+0.0001 <= contentSize) return;
if (scroll.horizontalNormalizedPosition <= 0 + 0.0001) return;
goMove(-1);
}
void goRight()
{
Debug.Log(scroll.horizontalNormalizedPosition);
if (scroll.horizontalNormalizedPosition+0.0001 >= 1) return;
goMove();
}
void goMove(int i = 1)
{
doAni();
//#if !(UNITY_ANDROID || UNITY_IOS)
// if (!start) startPosition = scroll.horizontalNormalizedPosition;
//#else
// int ind = GetIndex(startPos);
// if (!start) startPosition = ind*contentSize;
//#endif
if (!start) startPosition = scroll.horizontalNormalizedPosition;
start = true;
scrollValue = i*contentSize / 10;
#if !(UNITY_ANDROID || UNITY_IOS)
scrollValue = i * contentSize / 10;
#else
scrollValue = ((GetIndex(startPos) + i) * contentSize - startPos) / 10;
#endif
}
private bool start = false;
private float scrollValue = 0, totalScrollValue = 0, startPosition = 0;
int GetIndex()
int GetIndex(float? startPos = null)
{
#if !(UNITY_ANDROID || UNITY_IOS)
return (int)System.Math.Round(
@@ -118,9 +146,8 @@ public class QuickLoginScroll : MonoBehaviour
{
return 1;
}
return (int)System.Math.Round(
(scroll.horizontalNormalizedPosition+ contentSize) / contentSize,
0);
return (int)System.Math.Round
((startPos ?? scroll.horizontalNormalizedPosition + contentSize) / contentSize, 0);
#endif
}
void SetColor()
@@ -156,7 +183,11 @@ public class QuickLoginScroll : MonoBehaviour
{
scrollValue = 0;
start = false;
#if !(UNITY_ANDROID || UNITY_IOS)
scroll.horizontalNormalizedPosition = startPosition + (totalScrollValue<0?-1:1)*contentSize;
#else
scroll.horizontalNormalizedPosition = (GetIndex(startPos) + (totalScrollValue < 0 ? -1 : 1)) * contentSize;
#endif
//Debug.Log();
SetColor();
totalScrollValue = 0;
@@ -23,10 +23,14 @@ public class QuickLoginUser : MonoBehaviour
{
if (user == null) return;
this.top = top;
#if !(UNITY_ANDROID || UNITY_IOS)
UIManager.AddEvent(gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, (b) =>
{
goMain();
});
#else
gameObject.GetComponent<Button>().onClick.AddListener(() => { goMain(); });
#endif
//transform.GetComponent<Button>().onClick.AddListener();
this.user = user;
Utils.DisplayHead(transform.Find("Avatar").GetComponent<RawImage>(), user.Avatar);
+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) =>
@@ -25,7 +25,7 @@ public class BigMapController : PFUIPanel
AbstractMap mapManager;
//GameObject cube;
//GameObject cube1;
GameObject canvas;
GameObject canvas,mainContainer;
GameObject content;
Text keyword;
UnityEngine.Object begin;
@@ -81,12 +81,21 @@ public class BigMapController : PFUIPanel
//mapManager.SetCenterLatitudeLongitude(new Mapbox.Utils.Vector2d(32.051203, 118.771572));
this.transform.Find("Map").GetComponent<QuadTreeCameraMovement>()._referenceCamera = Camera.main;
canvas = this.transform.Find("Canvas").gameObject;
#if UNITY_ANDROID || UNITY_IOS
mainContainer = canvas.transform.Find("MainContainer").gameObject;
#else
mainContainer = canvas;
#endif
canvas.GetComponent<Canvas>().worldCamera = Camera.main;
var goList = canvas.transform.Find("SwitchMode");
var goList = mainContainer.transform.Find("SwitchMode");
#if UNITY_ANDROID || UNITY_IOS
SetRounded(goList, 52);
#else
SetRounded(goList, 64);
#endif
UIManager.AddEvent(goList.Find("GoList").gameObject, EventTriggerType.PointerClick, (e) =>
{
mapManager.Destroy();
@@ -96,9 +105,12 @@ public class BigMapController : PFUIPanel
//DestroyImmediate(this.gameObject);
});
var panel = canvas.transform.Find("Panel");
var panel = mainContainer.transform.Find("Panel");
#if UNITY_ANDROID || UNITY_IOS
base.SetRounded(panel, 20f);
#else
base.SetRounded(panel, 30f);
#endif
var qtcm = this.transform.Find("Map").GetComponent<QuadTreeCameraMovement>();
UIManager.AddEvent(panel.gameObject, EventTriggerType.PointerEnter, (e) =>
@@ -125,8 +137,11 @@ public class BigMapController : PFUIPanel
var searchBtn = input.Find("Search").gameObject;
UIManager.AddEvent(searchBtn, EventTriggerType.PointerClick, Search);
#if UNITY_ANDROID || UNITY_IOS
tipsObject = Resources.Load("UI/Prefab/MapList/MapItem-Mobile");
#else
tipsObject = Resources.Load("UI/Prefab/MapList/MapItem");
#endif
//tips = ((GameObject)Instantiate(tipsObject, canvas.transform.Find("TipsContainer"))).GetComponent<Tips>();
//tips.Hide();
@@ -142,7 +157,7 @@ public class BigMapController : PFUIPanel
/// </summary>
void BindHeadImage()
{
var headImage = canvas.transform.Find("HeadImage").GetComponent<RawImage>();
var headImage = mainContainer.transform.Find("HeadImage").GetComponent<RawImage>();
//var material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
var rect = ((RectTransform)headImage.transform).rect;
//material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height, 0));
@@ -315,7 +330,7 @@ public class BigMapController : PFUIPanel
//GameObject direct;
void CreateLine(int id, LineItem line)
{
#region 画线
#region 画线
List<Vector2d> pp1 = line.Points;
var dat = new List<Vector3>();
foreach (var item in pp1)
@@ -354,13 +369,16 @@ public class BigMapController : PFUIPanel
//lineRender.SetVertexCount(dat.Count);
lineRender.SetPositions(feat.Points[0].ToArray());
#endregion
#endregion
#region 添加左边的列表项
#region 添加左边的列表项
if (linesCache[id].Item == null)
{
#if UNITY_ANDROID || UNITY_IOS
var itemObject = Resources.Load("UI/Prefab/BigMap/Mobile/Item");
#else
var itemObject = Resources.Load("UI/Prefab/BigMap/Item");
#endif
var itemObject1 = (GameObject)Instantiate(itemObject, content.transform, false);
var iii = itemObject1.GetComponent<Item>();
iii.SetModel(line.Model);
@@ -396,9 +414,9 @@ public class BigMapController : PFUIPanel
}
};
}
#endregion
#endregion
#region 添加marker
#region 添加marker
if (line.BeginMarker == null)
{
@@ -437,7 +455,7 @@ public class BigMapController : PFUIPanel
line.BeginMarker.transform.position = ConverToPosition(line.Points.First());
#endregion
#endregion
if (line.Selected)
{
@@ -62,12 +62,20 @@ public class EarthController : PFUIPanel
//itemObject = Resources.Load("UI/Prefab/BigMap/Item");
panel = rootPanel.Find("Panel").gameObject;
#if UNITY_ANDROID || UNITY_IOS
SetRounded(panel.transform, 20);
#else
SetRounded(panel.transform, 60);
#endif
panel.gameObject.SetActive(false);
var goList = rootPanel.transform.Find("SwitchMode");
#if UNITY_ANDROID || UNITY_IOS
SetRounded(goList, 52);
#else
SetRounded(goList, 64);
#endif
UIManager.AddEvent(goList.Find("GoList").gameObject, EventTriggerType.PointerClick, (e) =>
{
//UIManager.PopStack();
@@ -2,6 +2,8 @@
using Assets.Scripts.Apis;
using Assets.Scripts.Apis.Models;
using Assets.Scripts.UI.Control;
using Assets.Scripts.UI.UIEffect;
using DG.Tweening;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
@@ -48,8 +50,33 @@ 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;
UIGradient g1 = transform.Find("Panel/Btn1").GetComponent<UIGradient>()
, g2 = transform.Find("Panel/Btn2").GetComponent<UIGradient>();
UIManager.AddEvent(transform.Find("Panel/Btn1").gameObject, EventTriggerType.PointerClick, b =>
{
if (!panelTop.HasValue) panelTop = transform.localPosition.y+185;
panel.DOLocalMoveY(panelTop.Value, 0.3f);
g1.color1 = Utils.HexToColorHtml("#F93086");
g1.color2 = Utils.HexToColorHtml("#ff7485");
g2.color1 = Utils.HexToColorHtml("#353543");
g2.color2 = Utils.HexToColorHtml("#474759");
//.color1 = Utils.HexToColorHtml()
});
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);
g2.color1 = Utils.HexToColorHtml("#F93086");
g2.color2 = Utils.HexToColorHtml("#ff7485");
g1.color1 = Utils.HexToColorHtml("#353543");
g1.color2 = Utils.HexToColorHtml("#474759");
});
#endif
mID = panel.Find("IDNumber").Find("input").Find("Text").GetComponent<Text>();
mSexDropdown = panel.Find("SexDropdown").GetComponent<PFUIDropdown>();
mSexDropdown = panel.Find("SexDropdown").GetComponent<PFUIDropdown>();
@@ -248,15 +275,7 @@ public class EditUserController : PFUIPanel
}
private void Switch(BaseEventData arg0)
{
UIManager.ShowConfirm("Logout", "Do you want to log out and change accounts?", () =>
{
#if !(UNITY_ANDROID || UNITY_IOS)
SceneManager.LoadScene("Login");
#else
SceneManager.LoadScene("Login-Mobile");
#endif
UIManager.CloseConfirm();
},2);
UIManager.SwitchAccount();
}
// Update is called once per frame
@@ -129,7 +129,14 @@ public class HomeController : PFUIPanel
Application.Quit();
});
#else
Application.OpenURL("powerfun://app");
if (App.weChatController.isApplicationAvilible("com.zhixingpai.powerfun", "powerfun"))
{
Application.OpenURL("powerfun://app");
}
else
{
Application.OpenURL("http://www.powerfun.com/Download");
}
#endif
}
//进入比赛
@@ -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>();
@@ -29,15 +29,7 @@ public class UserInfoController : PFUIPanel
UIManager.AddEvent(transform.Find("InfoPanel").Find("SwitchAccountButton").gameObject,
EventTriggerType.PointerClick, (b) =>
{
UIManager.ShowConfirm("Logout", "Do you want to log out and change accounts?", () =>
{
#if !(UNITY_ANDROID || UNITY_IOS)
SceneManager.LoadScene("Login");
#else
SceneManager.LoadScene("Login-Mobile");
#endif
UIManager.CloseConfirm();
},2);
UIManager.SwitchAccount();
});
infoPanel = transform.Find("InfoPanel").Find("P");
@@ -57,9 +49,10 @@ public class UserInfoController : PFUIPanel
#if UNITY_ANDROID || UNITY_IOS
editBtn.gameObject.SetActive(true);
var recordBtn = infoPanel.Find("RecordButton");
UIManager.AddEvent(recordBtn.gameObject, EventTriggerType.PointerEnter, (b) =>
UIManager.AddEvent(recordBtn.gameObject, EventTriggerType.PointerClick, (b) =>
{
Debug.Log("去看記錄");
Debug.Log(62);
UIManager.ShowResultListPanel();
});
#else
UIManager.AddEvent(transform.Find("InfoPanel").gameObject, EventTriggerType.PointerEnter, (b) =>
@@ -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
@@ -9,7 +9,7 @@ using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class ResultListController : MonoBehaviour
public class ResultListController : PFUIPanel
{
[SerializeField]Transform routeResult;
Transform localRouteItem;
@@ -29,6 +29,9 @@ public class ResultListController : MonoBehaviour
void Awake()
{
//ApiBase.SetCookie("73385F5F719B610D132C1ECF3E9143272BF15214D57ED91CD7A9DFD832407471535112AAEB8E9271F75D54FBBF2D99F18FA313C1EEA5676F5D722D7FBB07C926BEC5905591BF9AFDDC6336552DF273112C2DA1794E6FA2F465B11FECD2E82E52");
#if UNITY_ANDROID || UNITY_IOS
routeResult = Resources.Load<Transform>("UI/Prefab/ResultList/RouteItem-Mobile");
#endif
InitialColor();
scroll = transform.Find("ListPanel").Find("Scroll").GetComponent<ScrollRect>();
btnMatch = transform.Find("ListPanel").Find("BtnMatch");
@@ -283,7 +286,7 @@ public class ResultListController : MonoBehaviour
}
scroll.transform.Find("Error").gameObject.SetActive(contents[scrollIndex].childCount == 0);
}
#region 主页面滑动逻辑
#region 主页面滑动逻辑
int scrollIndex = 0;
bool startScroll = false;
ScrollRect scroll;
@@ -318,7 +321,7 @@ public class ResultListController : MonoBehaviour
}
}
}
#endregion
#endregion
//float scrollIndex = 0;
//bool startScroll = false;
//ScrollRect scroll;
@@ -0,0 +1,30 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ResultListPanelController : PFUIPanel
{
// Start is called before the first frame update
void Start()
{
UIManager.AddEvent(transform.Find("LTPanel/Button").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
UIManager.ShowPrePanel();
});
UIManager.AddEvent(transform.Find("LTPanel/SwitchAccountButton").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
UIManager.SwitchAccount();
});
}
public override void Show()
{
base.Show();
transform.Find("RideResultList").GetComponent<ResultListController>().Load();
}
// Update is called once per frame
void Update()
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 693a8dfbfae474849b06c5d0080136f1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -100,12 +100,12 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
transform.Find("Right").gameObject.SetActive(false);
}
//right.gameObject.SetActive(true);
#if !(UNITY_ANDROID || UNITY_IOS)
gameObject.GetComponent<Button>().onClick.AddListener(() =>
{
Detail();
});
});
#endif
}
void Detail()
{
@@ -179,6 +179,7 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
}
});
}
#if !(UNITY_ANDROID||UNITY_IOS)
void SetButtonColor(bool f)
{
if (routeResult!=null)
@@ -215,7 +216,6 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
}
else
{
Debug.Log(216);
btnDetail.GetComponent<Image>().color = Utils.HexToColorHtml("#414251");
btnDetail.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#353543");
}
@@ -223,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");