Merge remote-tracking branch 'origin/dev' into dev_lishuo
This commit is contained in:
commit
f10eeac073
38 files changed
+4835
-2394
No files matched your search
@@ -19,11 +19,19 @@ public class QuickLoginScroll : MonoBehaviour
|
||||
//Initial();
|
||||
if (L != null)
|
||||
{
|
||||
L.onClick.AddListener(goLeft);
|
||||
UIManager.AddEvent(L.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick,(b)=>
|
||||
{
|
||||
goLeft();
|
||||
});
|
||||
//L.onClick.AddListener(goLeft);
|
||||
}
|
||||
if (R != null)
|
||||
{
|
||||
R.onClick.AddListener(goRight);
|
||||
UIManager.AddEvent(R.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
goRight();
|
||||
});
|
||||
//R.onClick.AddListener(goRight);
|
||||
}
|
||||
}
|
||||
public void Initial()
|
||||
|
||||
@@ -23,46 +23,40 @@ public class QuickLoginUser : MonoBehaviour
|
||||
{
|
||||
if (user == null) return;
|
||||
this.top = top;
|
||||
transform.GetComponent<Button>().onClick.AddListener(async () =>
|
||||
UIManager.AddEvent(gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
ApiBase.SetCookie(user.Cookie);
|
||||
var r = await ConfigHelper.userApi.QuickLogin();
|
||||
if (r.result)
|
||||
{
|
||||
//
|
||||
top.GetComponent<LoginController>().SaveInfo(r.data);
|
||||
App.CurrentUser = r.data;
|
||||
//ConfigHelper.CurrentUser = r.data.Value<UserResultModel>("user");
|
||||
//ConfigHelper.CurrentUser = re;
|
||||
//var usermodel = r.data.Value<JObject>("user");
|
||||
//App.CurrentUser = new UserModel
|
||||
//{
|
||||
// NickName = usermodel.Value<string>("NickName"),
|
||||
// Ftp = usermodel.Value<int>("FTP"),
|
||||
// Weight = usermodel.Value<double>("Weight"),
|
||||
// BicycleWeight = usermodel.Value<double>("BicycleWeight"),
|
||||
// Carlories = "",
|
||||
// Avatar = usermodel.Value<string>("WxHeadImg"),
|
||||
// Distance = 0,
|
||||
// Climb = "",
|
||||
//};
|
||||
|
||||
SceneManager.LoadScene("MainScene");
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.showToast(gameObject, r.errMsg);
|
||||
}
|
||||
goMain();
|
||||
});
|
||||
//transform.GetComponent<Button>().onClick.AddListener();
|
||||
this.user = user;
|
||||
Utils.DisplayImage(StartCoroutine, transform.Find("Avatar").GetComponent<RawImage>(),user.Avatar);
|
||||
transform.Find("NickNameText").GetComponent<Text>().text = user.NickName;
|
||||
transform.Find("BtnDelete").GetComponent<Button>().onClick.AddListener(DestroySelf);
|
||||
UIManager.AddEvent(transform.Find("BtnDelete").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
DestroySelf();
|
||||
});
|
||||
//transform.Find("BtnDelete").GetComponent<Button>().onClick.AddListener(DestroySelf);
|
||||
}
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
async void goMain()
|
||||
{
|
||||
ApiBase.SetCookie(user.Cookie);
|
||||
var r = await ConfigHelper.userApi.QuickLogin();
|
||||
if (r.result)
|
||||
{
|
||||
top.GetComponent<LoginController>().SaveInfo(r.data);
|
||||
App.CurrentUser = r.data;
|
||||
|
||||
SceneManager.LoadScene("MainScene");
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.showToast(gameObject, r.errMsg);
|
||||
}
|
||||
}
|
||||
private void OnDestroy()
|
||||
{
|
||||
|
||||
@@ -6,6 +6,8 @@ using UnityEngine.UI;
|
||||
|
||||
public class MainNav : MonoBehaviour
|
||||
{
|
||||
private GameObject exit;
|
||||
private GameObject home;
|
||||
private void Awake()
|
||||
{
|
||||
var material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
|
||||
@@ -14,18 +16,32 @@ public class MainNav : MonoBehaviour
|
||||
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height, 0));
|
||||
this.GetComponent<Image>().material = material;
|
||||
|
||||
var wifi = this.transform.Find("Wifi");
|
||||
UIManager.AddEvent(wifi.gameObject, EventTriggerType.PointerClick, x =>
|
||||
var device = this.transform.Find("Device");
|
||||
UIManager.AddEvent(device.gameObject, EventTriggerType.PointerClick, x =>
|
||||
{
|
||||
Debug.Log("click wifi");
|
||||
Debug.Log("click device");
|
||||
UIManager.ShowDevicePanel();
|
||||
});
|
||||
|
||||
var home = this.transform.Find("Home");
|
||||
UIManager.AddEvent(home.gameObject, EventTriggerType.PointerClick, x =>
|
||||
home = this.transform.Find("Home").gameObject;
|
||||
UIManager.AddEvent(home, EventTriggerType.PointerClick, x =>
|
||||
{
|
||||
UIManager.ShowHomePanel();
|
||||
});
|
||||
|
||||
exit = this.transform.Find("Exit").gameObject;
|
||||
exit.SetActive(false);
|
||||
|
||||
|
||||
UIManager.AddEvent(exit, EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
Application.Quit();
|
||||
});
|
||||
|
||||
UIManager.AddEvent(transform.Find("Setting").gameObject, EventTriggerType.PointerClick, x =>
|
||||
{
|
||||
UIManager.ShowSettingModal();
|
||||
});
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
@@ -39,4 +55,10 @@ public class MainNav : MonoBehaviour
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void ShowExit()
|
||||
{
|
||||
exit.SetActive(true);
|
||||
home.SetActive(false);
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ using UnityEngine.Events;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.SceneManagement;
|
||||
using Mapbox.Examples;
|
||||
using DG.Tweening;
|
||||
|
||||
public class BigMapController : PFUIPanel
|
||||
{
|
||||
@@ -33,6 +34,10 @@ public class BigMapController : PFUIPanel
|
||||
int timer = 0;
|
||||
protected override void Awake()
|
||||
{
|
||||
var cg = this.transform.Find("Canvas").GetComponent<CanvasGroup>();
|
||||
cg.alpha = 0;
|
||||
|
||||
|
||||
mapApi = new MapApi();
|
||||
mapboxApi = new MapBoxApi();
|
||||
|
||||
@@ -384,13 +389,21 @@ public class BigMapController : PFUIPanel
|
||||
//timer += Time.deltaTime;
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
var cg = this.transform.Find("Canvas").GetComponent<CanvasGroup>();
|
||||
cg.alpha = 0;
|
||||
base.Show();
|
||||
|
||||
cg.DOFade(1f, 0.3f);
|
||||
}
|
||||
|
||||
public override void Close()
|
||||
{
|
||||
//base.Close();
|
||||
|
||||
DestroyImmediate(this.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
class LineItem
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
using DG.Tweening;
|
||||
|
||||
public class DeviceController : PFUIPanel
|
||||
{
|
||||
@@ -89,6 +90,15 @@ public class DeviceController : PFUIPanel
|
||||
}
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
var cg = this.GetComponent<CanvasGroup>();
|
||||
cg.alpha = 0;
|
||||
base.Show();
|
||||
|
||||
cg.DOFade(1f, 0.3f);
|
||||
}
|
||||
|
||||
private void OnApplicationQuit()
|
||||
{
|
||||
AntConnector.Instance().Dispose();
|
||||
|
||||
@@ -156,11 +156,10 @@ public class EditUserController : PFUIPanel
|
||||
}
|
||||
async Task LoadDataSync()
|
||||
{
|
||||
if (!App.FromLogin)
|
||||
{
|
||||
await Login();
|
||||
}
|
||||
|
||||
//if (!App.FromLogin)
|
||||
//{
|
||||
// await Login();
|
||||
//}
|
||||
|
||||
var currentUser = App.CurrentUser;
|
||||
if (currentUser == null) return;
|
||||
|
||||
@@ -25,10 +25,15 @@ public class HomeController : PFUIPanel
|
||||
//[SerializeField] Button More;
|
||||
[SerializeField] Button BtnRide;
|
||||
[SerializeField] Transform userInfo;
|
||||
|
||||
private MainNav mainNav;
|
||||
// Start is called before the first frame update
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start();
|
||||
|
||||
mainNav = this.transform.Find("MainNav").GetComponent<MainNav>();
|
||||
mainNav.ShowExit();
|
||||
//var parent = Utils.FindUpParent(gameObject.transform);
|
||||
//if (parent.Find("ToastContainer") == null)
|
||||
//{
|
||||
@@ -45,10 +50,8 @@ public class HomeController : PFUIPanel
|
||||
BtnRide.onClick.AddListener(GoRide);
|
||||
|
||||
var avatar = userInfo.Find("Avatar").GetComponent<RawImage>();
|
||||
var material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
|
||||
var rect = ((RectTransform)avatar.transform).rect;
|
||||
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height, 0));
|
||||
avatar.material = material;
|
||||
var rect = ((RectTransform)avatar.transform).rect;
|
||||
SetRounded(avatar.transform, rect.height);
|
||||
|
||||
UIManager.AddEvent(avatar.gameObject, EventTriggerType.PointerClick, x =>
|
||||
{
|
||||
@@ -59,10 +62,6 @@ public class HomeController : PFUIPanel
|
||||
{
|
||||
UIManager.ShowAlert("test");
|
||||
});
|
||||
UIManager.AddEvent(transform.Find("MainNav").Find("Setting").gameObject, EventTriggerType.PointerClick, x =>
|
||||
{
|
||||
UIManager.ShowSettingModal();
|
||||
});
|
||||
GetSummary();
|
||||
}
|
||||
|
||||
@@ -99,16 +98,17 @@ public class HomeController : PFUIPanel
|
||||
userInfo.Find("NickName").GetComponent<Text>().text = App.CurrentUser.Nickname;
|
||||
userInfo.Find("GroupTop").Find("FtpContainer").Find("FtpValue").GetComponent<Text>().text = App.CurrentUser.FTP.ToString();
|
||||
userInfo.Find("GroupTop").Find("WeightContainer").Find("WeightValue").GetComponent<Text>().text = App.CurrentUser.Weight.ToString();
|
||||
userInfo.Find("GroupTop").Find("WKGContainer").Find("WKGValue").GetComponent<Text>().text = $"{App.CurrentUser.Weight}kg/{App.CurrentUser.BicycleWeight}kg";
|
||||
userInfo.Find("GroupTop").Find("WKGContainer").Find("WKGValue").GetComponent<Text>().text = $"{ (App.CurrentUser.FTP/ App.CurrentUser.Weight).ToString("0.0") }";
|
||||
userInfo.Find("CaloriesContainer").Find("CaloriesValue").GetComponent<Text>().text = summary.Kcal +" KCAL";
|
||||
userInfo.Find("KMContainer").Find("KMValue").GetComponent<Text>().text = summary.TotalDistance.ToString("0") +" KM";
|
||||
userInfo.Find("ClimbContainer").Find("ClimbValue").GetComponent<Text>().text = summary.TotalClimb +" M";
|
||||
userInfo.Find("IDText").GetComponent<Text>().text = "ID:"+App.CurrentUser.Id;
|
||||
userInfo.Find("IDText").GetComponent<Text>().text = "ID:"+App.CurrentUser.Id.ToString("000000");
|
||||
//var user = ConfigHelper.CurrentUser;
|
||||
//Ftp.text = summary.Ftp.ToString();
|
||||
//Weight.text = user.Weight.ToString();
|
||||
//WKG.text = $"{user.Weight}KG/{user.BicycleWeight}KG";
|
||||
//NickName.text = user.Nickname;
|
||||
|
||||
Utils.DisplayImage(StartCoroutine, userInfo.Find("Avatar").GetComponent<RawImage>(), App.CurrentUser.WxHeadImg);
|
||||
}
|
||||
async void GetSummary()
|
||||
@@ -152,6 +152,11 @@ public class HomeController : PFUIPanel
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
var cg = this.GetComponent<CanvasGroup>();
|
||||
cg.alpha = 0;
|
||||
base.Show();
|
||||
|
||||
cg.DOFade(1f, 0.3f);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
using Assets.Scripts.Apis;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using Assets.Scripts.UI.Prefab.MapList;
|
||||
using DG.Tweening;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -197,10 +198,10 @@ public class MapListController : PFUIPanel
|
||||
var rect = ((RectTransform)headImage.transform).rect;
|
||||
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height, 0));
|
||||
headImage.material = material;
|
||||
if (App.FromLogin)
|
||||
{
|
||||
//if (App.FromLogin)
|
||||
//{
|
||||
Utils.DisplayImage(StartCoroutine, headImage, App.CurrentUser.WxHeadImg);
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
UIManager.AddEvent(headImage.gameObject, EventTriggerType.PointerClick, (e) =>
|
||||
@@ -294,4 +295,13 @@ public class MapListController : PFUIPanel
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
var cg = this.GetComponent<CanvasGroup>();
|
||||
cg.alpha = 0;
|
||||
base.Show();
|
||||
|
||||
cg.DOFade(1f, .3f);
|
||||
}
|
||||
}
|
||||
@@ -18,10 +18,14 @@ public class UserInfoController : PFUIPanel
|
||||
|
||||
Button exitBtn = this.transform.Find("InfoPanel").Find("Button").GetComponent<Button>();
|
||||
|
||||
exitBtn.onClick.AddListener(() =>
|
||||
UIManager.AddEvent(exitBtn.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
UIManager.ShowHomePanel();
|
||||
});
|
||||
//exitBtn.onClick.AddListener(() =>
|
||||
//{
|
||||
// UIManager.ShowHomePanel();
|
||||
//});
|
||||
UIManager.AddEvent(transform.Find("InfoPanel").Find("SwitchAccountButton").gameObject,
|
||||
UnityEngine.EventSystems.EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
@@ -29,20 +33,24 @@ public class UserInfoController : PFUIPanel
|
||||
});
|
||||
infoPanel = transform.Find("InfoPanel").Find("P");
|
||||
Button editBtn = infoPanel.Find("EditButton").GetComponent<Button>();
|
||||
editBtn.onClick.AddListener(() =>
|
||||
{
|
||||
UIManager.ShowEditUserPanel();
|
||||
});
|
||||
UIManager.AddEvent(editBtn.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
UIManager.ShowEditUserPanel();
|
||||
});
|
||||
//editBtn.onClick.AddListener(() =>
|
||||
//{
|
||||
// UIManager.ShowEditUserPanel();
|
||||
//});
|
||||
summaryPanel = transform.Find("SummaryPanel");
|
||||
Load();
|
||||
}
|
||||
async void Load()
|
||||
{
|
||||
if (!App.FromLogin)
|
||||
{
|
||||
var result = await userApi.Login("15651831367", "123456", "");
|
||||
App.CurrentUser = result.data;
|
||||
}
|
||||
//if (!App.FromLogin)
|
||||
//{
|
||||
// var result = await userApi.Login("15651831367", "123456", "");
|
||||
// App.CurrentUser = result.data;
|
||||
//}
|
||||
var r = userApi.GetSummary();
|
||||
if (r.result)
|
||||
{
|
||||
|
||||
@@ -17,9 +17,13 @@ public class ResultListController : MonoBehaviour
|
||||
Transform btnRoute, btnMatch,searchInput;
|
||||
Color c1, c2;
|
||||
// Start is called before the first frame update
|
||||
int pageIndex = 0, pageSize = 20;
|
||||
int pageSize = 20;
|
||||
string name = "";
|
||||
Transform[] contents;
|
||||
Dictionary<int, string> filterOptionDict = new Dictionary<int, string>
|
||||
{
|
||||
{0,"routes" },{1,"competition" }
|
||||
};
|
||||
void Start()
|
||||
{
|
||||
//ApiBase.SetCookie("73385F5F719B610D132C1ECF3E9143272BF15214D57ED91CD7A9DFD832407471535112AAEB8E9271F75D54FBBF2D99F18FA313C1EEA5676F5D722D7FBB07C926BEC5905591BF9AFDDC6336552DF273112C2DA1794E6FA2F465B11FECD2E82E52");
|
||||
@@ -36,19 +40,32 @@ public class ResultListController : MonoBehaviour
|
||||
contents = new Transform[] { routeContent, matchContent};
|
||||
if (btnMatch != null)
|
||||
{
|
||||
btnMatch.GetComponent<Button>().onClick.AddListener(() => StartScroll(0));
|
||||
UIManager.AddEvent(btnMatch.gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
StartScroll(0);
|
||||
});
|
||||
//btnMatch.GetComponent<Button>().onClick.AddListener(() => StartScroll(0));
|
||||
}
|
||||
if (btnRoute != null)
|
||||
{
|
||||
btnRoute.GetComponent<Button>().onClick.AddListener(() => StartScroll(1));
|
||||
UIManager.AddEvent(btnRoute.gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
StartScroll(1);
|
||||
});
|
||||
//btnRoute.GetComponent<Button>().onClick.AddListener(() => StartScroll(1));
|
||||
}
|
||||
if (searchInput != null)
|
||||
{
|
||||
searchInput.Find("Button").GetComponent<Button>().onClick.AddListener(() =>
|
||||
UIManager.AddEvent(searchInput.Find("Button").gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
name = searchInput.GetComponent<InputField>().text;
|
||||
Refresh(contents[scrollIndex]);
|
||||
name = searchInput.GetComponent<InputField>().text;
|
||||
Refresh(contents[scrollIndex]);
|
||||
});
|
||||
//searchInput.Find("Button").GetComponent<Button>().onClick.AddListener(() =>
|
||||
//{
|
||||
// name = searchInput.GetComponent<InputField>().text;
|
||||
// Refresh(contents[scrollIndex]);
|
||||
//});
|
||||
}
|
||||
if (routeScroll != null)
|
||||
{
|
||||
@@ -58,7 +75,8 @@ public class ResultListController : MonoBehaviour
|
||||
{
|
||||
UIManager.AddEvent(matchScroll.gameObject, UnityEngine.EventSystems.EventTriggerType.EndDrag, OnEndDrag);
|
||||
}
|
||||
GetList();
|
||||
GetList(0);
|
||||
GetList(1);
|
||||
}
|
||||
|
||||
private void OnEndDrag(BaseEventData e)
|
||||
@@ -68,7 +86,7 @@ public class ResultListController : MonoBehaviour
|
||||
if (scrollrect.verticalNormalizedPosition <= 0)
|
||||
{
|
||||
Debug.Log(scrollrect.verticalNormalizedPosition);
|
||||
pageIndex++;
|
||||
pageIndex[scrollIndex]++;
|
||||
GetList();
|
||||
}
|
||||
if (scrollrect.verticalNormalizedPosition >= 1)
|
||||
@@ -80,23 +98,33 @@ public class ResultListController : MonoBehaviour
|
||||
private void Refresh(Transform content)
|
||||
{
|
||||
content.transform.DestroyChildren();
|
||||
pageIndex = 0;
|
||||
isEnd[scrollIndex] = false;
|
||||
pageIndex[scrollIndex] = 0;
|
||||
GetList();
|
||||
}
|
||||
bool isEnd = false;
|
||||
void GetList()
|
||||
Dictionary<int, bool> isEnd = new Dictionary<int, bool>
|
||||
{
|
||||
var r =ConfigHelper.mapInterruptRecordApi.GetMapInterruptRecord(name, pageIndex, 20);
|
||||
{0,false },{1,false }
|
||||
};
|
||||
Dictionary<int, int> pageIndex = new Dictionary<int, int>
|
||||
{
|
||||
{0,0 },{1,0 }
|
||||
};
|
||||
async void GetList(int? sindex = null)
|
||||
{
|
||||
var index = sindex ?? scrollIndex;
|
||||
if (isEnd[index]) return;
|
||||
var r = await ConfigHelper.mapInterruptRecordApi.GetMapInterruptRecord(name, pageIndex[index], 20,filterOptionDict[index]);
|
||||
if (r.result)
|
||||
{
|
||||
if (r.data.Count == 0 && pageIndex != 0)
|
||||
if (r.data.Count == 0 && pageIndex[index] != 0)
|
||||
{
|
||||
isEnd = true;
|
||||
isEnd[index] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
isEnd = false;
|
||||
DisplayRouteResult(r.data,contents[scrollIndex]);
|
||||
isEnd[index] = false;
|
||||
DisplayRouteResult(r.data, contents[index],index);
|
||||
//DisplayRouteResult(r.data, matchContent);
|
||||
}
|
||||
}
|
||||
@@ -105,14 +133,14 @@ public class ResultListController : MonoBehaviour
|
||||
Utils.showToast(gameObject, r.errMsg);
|
||||
}
|
||||
}
|
||||
void DisplayRouteResult(List<RouteResult> list,Transform content)
|
||||
void DisplayRouteResult(List<RouteResult> list,Transform content,int index)
|
||||
{
|
||||
if (routeResult != null)
|
||||
{
|
||||
foreach (var item in list)
|
||||
{
|
||||
var obj = Instantiate(routeResult);
|
||||
obj.GetComponent<RouteItem>().Initial(item);
|
||||
obj.GetComponent<RouteItem>().Initial(item, index);
|
||||
//obj.SendMessage("Initial", );
|
||||
obj.transform.parent = content;
|
||||
obj.transform.localScale = new Vector3(1, 1, 1);
|
||||
|
||||
@@ -26,7 +26,9 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
|
||||
}
|
||||
string titleColor = "#5c5c6e";
|
||||
RouteResult data;
|
||||
public void Initial(RouteResult result)
|
||||
//滑动索引 0route 1match
|
||||
int index;
|
||||
public void Initial(RouteResult result,int index)
|
||||
{
|
||||
routeResult = result;
|
||||
left = transform.Find("Left");
|
||||
@@ -38,29 +40,49 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
|
||||
row1.Find("Time").GetComponent<Text>().text = $"<color={titleColor}>Riding time:</color>{result.TrainingTime}";
|
||||
row1.Find("Distance").GetComponent<Text>().text = $"<color={titleColor}>Mileage:</color>{result.EndDistance.ToString("#0.00")}KM";
|
||||
row1.Find("Times").GetComponent<Text>().text = $"<color={titleColor}>Times:</color>{result.Count}";
|
||||
row1.Find("Rank").GetComponent<Text>().text = $"<color={titleColor}>Rank:</color>{result.Ranking}";
|
||||
if (index == 0)
|
||||
{
|
||||
row1.Find("Rank").GetComponent<Text>().text = $"<color={titleColor}>Rank:</color>{result.Ranking}";
|
||||
}
|
||||
else
|
||||
{
|
||||
row1.Find("Rank").GetComponent<Text>().text = $"";
|
||||
}
|
||||
left.Find("Progress").Find("Image").GetComponent<Image>().fillAmount = (float)result.Progress;
|
||||
left.Find("Progress").Find("Value").GetComponent<Text>().text = (result.Progress * 100).ToString("#0");
|
||||
row2.Find("Device").GetComponent<Text>().text = $"<color={titleColor}>Cycling equipment:</color>{result.ManufacturerName}";
|
||||
right = transform.Find("Right");
|
||||
btnContinue = right.Find("BtnContinue");
|
||||
if (btnContinue)
|
||||
if (index == 0)
|
||||
{
|
||||
btnContinue.gameObject.SetActive(false);
|
||||
btnContinue.GetComponent<Button>().onClick.AddListener(GoContinue);
|
||||
right = transform.Find("Right");
|
||||
btnContinue = right.Find("BtnContinue");
|
||||
if (btnContinue)
|
||||
{
|
||||
//btnContinue.gameObject.SetActive(false);
|
||||
btnContinue.GetComponent<Button>().onClick.AddListener(GoContinue);
|
||||
}
|
||||
btnReRide = right.Find("BtnReRide");
|
||||
if (btnReRide)
|
||||
{
|
||||
//btnReRide.gameObject.SetActive(false);
|
||||
btnReRide.GetComponent<Button>().onClick.AddListener(GoReRide);
|
||||
}
|
||||
btnDelete = right.Find("BtnDelete");
|
||||
if (btnDelete)
|
||||
{
|
||||
//btnDelete.gameObject.SetActive(false);
|
||||
btnDelete.GetComponent<Button>().onClick.AddListener(Delete);
|
||||
}
|
||||
SetButtonColor(false);
|
||||
transform.Find("RightMatch").gameObject.SetActive(false);
|
||||
}
|
||||
btnReRide = right.Find("BtnReRide");
|
||||
if (btnReRide)
|
||||
else
|
||||
{
|
||||
btnReRide.gameObject.SetActive(false);
|
||||
btnReRide.GetComponent<Button>().onClick.AddListener(GoReRide);
|
||||
}
|
||||
btnDelete = right.Find("BtnDelete");
|
||||
if (btnDelete)
|
||||
{
|
||||
btnDelete.gameObject.SetActive(false);
|
||||
btnDelete.GetComponent<Button>().onClick.AddListener(Delete);
|
||||
right = transform.Find("RightMatch");
|
||||
transform.Find("Right").gameObject.SetActive(false);
|
||||
right.Find("Value").GetComponent<Text>().text = result.Ranking.ToString();
|
||||
}
|
||||
right.gameObject.SetActive(true);
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
private void Delete()
|
||||
@@ -86,10 +108,35 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
|
||||
SceneManager.LoadScene("Ride");
|
||||
}
|
||||
}
|
||||
|
||||
void SetButtonColor(bool f)
|
||||
{
|
||||
if (f)
|
||||
{
|
||||
btnContinue.GetComponent<Image>().color = Utils.HexToColorHtml("#F93086");
|
||||
btnReRide.GetComponent<Image>().color = Utils.HexToColorHtml("#F93086");
|
||||
btnDelete.GetComponent<Image>().color = Utils.HexToColorHtml("#353543");
|
||||
btnContinue.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
||||
btnReRide.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
||||
btnDelete.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#474759");
|
||||
}
|
||||
else
|
||||
{
|
||||
btnContinue.GetComponent<Image>().color = Utils.HexToColorHtml("#414251");
|
||||
btnReRide.GetComponent<Image>().color = Utils.HexToColorHtml("#414251");
|
||||
btnDelete.GetComponent<Image>().color = Utils.HexToColorHtml("#23232D");
|
||||
btnContinue.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#353543");
|
||||
btnReRide.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#353543");
|
||||
btnDelete.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#353543");
|
||||
}
|
||||
}
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
transform.GetComponent<Image>().color = Utils.HexToColorHtml("#23232d");
|
||||
if (index == 1)
|
||||
{
|
||||
right.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#414251");
|
||||
right.Find("Value").GetComponent<Text>().color = Utils.HexToColorHtml("#5c5c6e");
|
||||
}
|
||||
if (left != null)
|
||||
{
|
||||
left.Find("Main").Find("Time").GetComponent<Text>().color = Utils.HexToColorHtml("#414251");
|
||||
@@ -105,14 +152,17 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
|
||||
row1.Find("Rank").GetComponent<Text>().color = Utils.HexToColorHtml("#9E9EAD");
|
||||
}
|
||||
titleColor = "#414251";
|
||||
btnContinue.gameObject.SetActive(false);
|
||||
btnReRide.gameObject.SetActive(false);
|
||||
btnDelete.gameObject.SetActive(false);
|
||||
SetButtonColor(false);
|
||||
}
|
||||
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
transform.GetComponent<Image>().color = Utils.HexToColorHtml("#353543");
|
||||
if (index == 1)
|
||||
{
|
||||
right.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#5c5c6e");
|
||||
right.Find("Value").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
||||
}
|
||||
if (left != null)
|
||||
{
|
||||
left.Find("Main").Find("Time").GetComponent<Text>().color = Utils.HexToColorHtml("#5c5c6e");
|
||||
@@ -128,8 +178,6 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
|
||||
row1.Find("Rank").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
||||
}
|
||||
titleColor = "#5c5c6e";
|
||||
btnContinue.gameObject.SetActive(true);
|
||||
btnReRide.gameObject.SetActive(true);
|
||||
btnDelete.gameObject.SetActive(true);
|
||||
SetButtonColor(true);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
using System.Collections;
|
||||
using DG.Tweening;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
public class SettingContoller : PFUIPanel
|
||||
{
|
||||
@@ -12,13 +14,17 @@ public class SettingContoller : PFUIPanel
|
||||
exit = transform.Find("Main").Find("Exit");
|
||||
if (exit != null)
|
||||
{
|
||||
exit.GetComponent<Button>().onClick.AddListener(()=>
|
||||
//exit.GetComponent<Button>().onClick.AddListener(()=>
|
||||
//{
|
||||
// Close();
|
||||
//});
|
||||
UIManager.AddEvent(exit.gameObject, EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
Close();
|
||||
});
|
||||
}
|
||||
}
|
||||
void Start()
|
||||
protected override void Start()
|
||||
{
|
||||
|
||||
}
|
||||
@@ -28,4 +34,13 @@ public class SettingContoller : PFUIPanel
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
var cg = this.GetComponent<CanvasGroup>();
|
||||
cg.alpha = 0;
|
||||
base.Show();
|
||||
|
||||
cg.DOFade(1f, 0.3f);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user