This commit is contained in:
Caiyanpeng committed 2021-04-15 15:58:37 +08:00
1 parent 038720e7bd
commit c97bd50f3f
32 files changed
+9899 -3719

No files matched your search

@@ -68,6 +68,10 @@ namespace Assets.Scripts.UI.Prefab.Login
if (c == null) return null;
return Resources.Load<Texture>(c.source);
}
public Texture GetCountryImage(string code)
{
return GetCountryImage(GetCountryIndexByCode(code));
}
public int GetCountryIndexByCode(string code)
{
var c = countryList.FindIndex(x => x.abbreviation.ToLower() == code.ToLower());
@@ -31,6 +31,7 @@ public class MapItem : MonoBehaviour
transform.Find("Name").GetComponent<Text>().text = myMap.Name;
Utils.DisplayImage(StartCoroutine, transform.Find("MapTitleImg").GetComponent<RawImage>(), myMap.CoverImage);
transform.Find("CollectImg").gameObject.SetActive(myMap.IsFavorite);
transform.Find("Hot").gameObject.SetActive(myMap.IsFire);
var props = transform.Find("Props");
props.Find("DistanceText").GetComponent<Text>().text = $"{myMap.Distance.ToString("#0.00")}KM";
props.Find("EleText").GetComponent<Text>().text = $"{(myMap.TotalClimb ?? 0.0).ToString("#0.00")}M";
@@ -40,5 +41,6 @@ public class MapItem : MonoBehaviour
var diff = tabContainer.Find("Diff");
diff.Find("Text").GetComponent<Text>().text = myMap.Hard;
tabContainer.Find("3d").gameObject.SetActive(myMap.Enable3D);
tabContainer.Find("Country").GetComponent<RawImage>().texture = UIManager.Instance.loginRegOptions.GetCountryImage(myMap.CountryCode);
}
}
@@ -13,6 +13,7 @@ using UnityEngine.UI;
public class EditUserController : PFUIPanel
{
private Button mSaveButton;
private Button mReturnButton;
private PFUIDropdown mSexDropdown;
private PFUIDropdown mDayDropdown;
private PFUIDropdown mMonthDropdown;
@@ -33,6 +34,7 @@ public class EditUserController : PFUIPanel
mMonthDropdown = panel.Find("MonthDropdown").GetComponent<PFUIDropdown>();
mDayDropdown = panel.Find("DayDropdown").GetComponent<PFUIDropdown>();
mSaveButton = this.transform.Find("SaveButton").GetComponent<Button>();
mReturnButton = transform.Find("CancelButton").GetComponent<Button>();
mHeadImage = this.transform.Find("HeadImage").GetComponent<RawImage>();
mSexDropdown.ClearOptions();
@@ -80,12 +82,17 @@ public class EditUserController : PFUIPanel
// new Dropdown.OptionData()
//});
LoadDataSync();
LoadDataSyncAsync();
}
async void LoadDataSync()
async System.Threading.Tasks.Task Login()
{
var result = await new UserApi().Login("13115011550", "laozhong", "");
App.CurrentUser = result.data;
}
async System.Threading.Tasks.Task LoadDataSyncAsync()
{
await Login();
Material material = null;
if (material == null)
{
@@ -95,33 +102,38 @@ public class EditUserController : PFUIPanel
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height, 0));
mHeadImage.material = material;
//var currentUser = App.CurrentUser;
//mIdText.text = "ID:" + currentUser.Id.ToString();
//mNameText.text = currentUser.Nickname;
//if (!string.IsNullOrWhiteSpace(currentUser.WxHeadImg))
//{
// Utils.DisplayImage(StartCoroutine, mHeadImage, currentUser.WxHeadImg);
//}
//if (currentUser.Sex == 1)
//{
// mSexDropdown.SelectValue("男");
//}
//else
//{
// mSexDropdown.SelectValue("女");
//}
//if (currentUser.Birthday.HasValue)
//{
// var birthday = currentUser.Birthday.Value;
// mYearDropdown.SelectValue(birthday.Year.ToString());
// mMonthDropdown.SelectValue(birthday.Month.ToString());
// mDayDropdown.SelectValue(birthday.Day.ToString());
//}
var currentUser = App.CurrentUser;
mIdText.text = "ID:" + currentUser.Id.ToString();
mNameText.text = currentUser.Nickname;
if (!string.IsNullOrWhiteSpace(currentUser.WxHeadImg))
{
Utils.DisplayImage(StartCoroutine, mHeadImage, currentUser.WxHeadImg);
}
if (currentUser.Sex == 1)
{
mSexDropdown.SelectValue("男");
}
else
{
mSexDropdown.SelectValue("女");
}
if (currentUser.Birthday.HasValue)
{
var birthday = currentUser.Birthday.Value;
mYearDropdown.SelectValue(birthday.Year.ToString());
mMonthDropdown.SelectValue(birthday.Month.ToString());
mDayDropdown.SelectValue(birthday.Day.ToString());
}
UIManager.AddEvent(mReturnButton.gameObject, EventTriggerType.PointerClick, Return);
UIManager.AddEvent(mSaveButton.gameObject, EventTriggerType.PointerClick, Save);
}
private void Return(BaseEventData arg0)
{
UIManager.ShowUserInfoPanel();
}
// Start is called before the first frame update
protected override void Start()
{
@@ -59,7 +59,10 @@ public class HomeController : PFUIPanel
{
UIManager.ShowAlert("test");
});
UIManager.AddEvent(transform.Find("MainNav").Find("Setting").gameObject, EventTriggerType.PointerClick, x =>
{
UIManager.ShowSettingModal();
});
GetSummary();
}
@@ -39,7 +39,7 @@ public class MapListController : PFUIPanel
}
}
private bool isEnd = false;
protected override void Start()
protected override void Start()
{
//if (hardSelector != null)
//{
@@ -19,9 +19,10 @@ public class ResultListController : MonoBehaviour
// Start is called before the first frame update
int pageIndex = 0, pageSize = 20;
string name = "";
Transform[] contents;
void Start()
{
ApiBase.SetCookie("73385F5F719B610D132C1ECF3E9143272BF15214D57ED91CD7A9DFD832407471535112AAEB8E9271F75D54FBBF2D99F18FA313C1EEA5676F5D722D7FBB07C926BEC5905591BF9AFDDC6336552DF273112C2DA1794E6FA2F465B11FECD2E82E52");
//ApiBase.SetCookie("73385F5F719B610D132C1ECF3E9143272BF15214D57ED91CD7A9DFD832407471535112AAEB8E9271F75D54FBBF2D99F18FA313C1EEA5676F5D722D7FBB07C926BEC5905591BF9AFDDC6336552DF273112C2DA1794E6FA2F465B11FECD2E82E52");
InitialColor();
scroll = transform.Find("ListPanel").Find("Scroll").GetComponent<ScrollRect>();
btnMatch = transform.Find("ListPanel").Find("BtnMatch");
@@ -32,6 +33,7 @@ public class ResultListController : MonoBehaviour
routeContent = routeScroll.Find("Viewport").Find("Content");
matchScroll = scrollContent.Find("MatchList");
matchContent = matchScroll.Find("Viewport").Find("Content");
contents = new Transform[] { routeContent, matchContent};
if (btnMatch != null)
{
btnMatch.GetComponent<Button>().onClick.AddListener(() => StartScroll(0));
@@ -45,7 +47,7 @@ public class ResultListController : MonoBehaviour
searchInput.Find("Button").GetComponent<Button>().onClick.AddListener(() =>
{
name = searchInput.GetComponent<InputField>().text;
Refresh();
Refresh(contents[scrollIndex]);
});
}
if (routeScroll != null)
@@ -71,13 +73,13 @@ public class ResultListController : MonoBehaviour
}
if (scrollrect.verticalNormalizedPosition >= 1)
{
Refresh();
Refresh(contents[scrollIndex]);
}
}
private void Refresh()
private void Refresh(Transform content)
{
routeContent.transform.DestroyChildren();
content.transform.DestroyChildren();
pageIndex = 0;
GetList();
}
@@ -94,8 +96,8 @@ public class ResultListController : MonoBehaviour
else
{
isEnd = false;
DisplayRouteResult(r.data,routeContent);
DisplayRouteResult(r.data, matchContent);
DisplayRouteResult(r.data,contents[scrollIndex]);
//DisplayRouteResult(r.data, matchContent);
}
}
else
@@ -0,0 +1,31 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class SettingContoller : PFUIPanel
{
// Start is called before the first frame update
Transform exit;
protected override void Awake()
{
exit = transform.Find("Main").Find("Exit");
if (exit != null)
{
exit.GetComponent<Button>().onClick.AddListener(()=>
{
Close();
});
}
}
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1304d873aa16cd641a83b889e9a1f3af
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: