修改细节

This commit is contained in:
Caiyanpeng committed 2021-04-25 13:35:07 +08:00
1 parent a96d538dc1
commit 048538a0c8
78 files changed
+15285 -6903

No files matched your search

@@ -77,6 +77,7 @@ public class BigMapController : PFUIPanel
UIManager.AddEvent(goList.Find("GoList").gameObject, EventTriggerType.PointerClick, (e) =>
{
mapManager.Destroy();
UIManager.PopStack();
UIManager.ShowMapListPanel();
//this.gameObject.SetActive(false);
//DestroyImmediate(this.gameObject);
@@ -3,6 +3,7 @@ using Assets.Scripts.Apis;
using Assets.Scripts.Apis.Models;
using Assets.Scripts.UI.Control;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -40,6 +41,7 @@ public class EditUserController : PFUIPanel
private Button mSwitchButton;
PfUIButton mChangeAvatar;
Transform linkContainer;
Dictionary<string, Selectable> dict;
protected override void Awake()
{
@@ -148,8 +150,20 @@ public class EditUserController : PFUIPanel
//{
// new Dropdown.OptionData()
//});
LoadDataSync();
dict = new Dictionary<string, Selectable>
{
{"NickName",mNickName.GetComponent<InputField>() },
{"FTP",mFTP.GetComponent<InputField>() },
{"Weight",mWeight.GetComponent<InputField>() },
{"Height",mHeight.GetComponent<InputField>() },
{"WheelDiameter",mWD.GetComponent<InputField>() },
{"MaxHeartRate",mMHR.GetComponent<InputField>() },
{"BicycleWeight",mBW.GetComponent<InputField>() },
{"Contact",mName.GetComponent<InputField>() },
{"ContactPhone",mPhone.GetComponent<InputField>() },
{"ContactAddress",mAddr.GetComponent<InputField>() },
};
}
async Task Login()
@@ -228,7 +242,11 @@ public class EditUserController : PFUIPanel
UIManager.AddEvent(mCancelButton.gameObject, EventTriggerType.PointerClick, Cancel);
UIManager.AddEvent(mSwitchButton.gameObject, EventTriggerType.PointerClick, Switch);
}
public override void Show()
{
base.Show();
LoadDataSync();
}
private void Switch(BaseEventData arg0)
{
SceneManager.LoadScene("1-Login");
@@ -265,6 +283,20 @@ public class EditUserController : PFUIPanel
user.Sex = mSexDropdown.SelectedItem == "男" ? 1 : 2;
user.Nickname = mNickName.Text;
user.Country = UIManager.Instance.loginRegOptions.GetCountryName(mConutryDropdown.SelectedIndex);
var errorList = new List<object>();
if (string.IsNullOrEmpty(mNickName.Text)) errorList.Add(new { Field = "Nickname", ErrMsg = "请填写昵称" });
if (string.IsNullOrEmpty(mFTP.Text)) errorList.Add(new { Field="FTP", ErrMsg="请填写FTP" });
if (string.IsNullOrEmpty(mHeight.Text)) errorList.Add(new { Field = "Height", ErrMsg = "请填写身高" });
if (string.IsNullOrEmpty(mWeight.Text)) errorList.Add(new { Field = "Weight", ErrMsg = "请填写体重" });
if (string.IsNullOrEmpty(mMHR.Text)) errorList.Add(new { Field = "MaxHeartRate", ErrMsg = "请填写最大心率" });
if (string.IsNullOrEmpty(mBW.Text)) errorList.Add(new { Field = "BicycleWeight", ErrMsg = "请填写车重" });
if (string.IsNullOrEmpty(mWD.Text)) errorList.Add(new { Field = "WheelDiameter", ErrMsg = "请填写轮径" });
if (errorList.Count > 0)
{
Utils.SetValidate(dict, JArray.FromObject(errorList));
Utils.showToast(gameObject, "请填写相关信息");
return;
}
user.FTP = int.Parse(mFTP.Text);
user.Height = int.Parse(mHeight.Text);
user.Weight = int.Parse(mWeight.Text);
@@ -278,7 +310,9 @@ public class EditUserController : PFUIPanel
var result = await userApi.Update(user);
if (result.result == false)
{
UIManager.ShowAlert(result.errMsg);
Utils.SetValidate(dict, JArray.FromObject(result.data));
Utils.showToast(gameObject, result.errMsg);
//UIManager.ShowAlert(result.errMsg);
}
else
{
@@ -302,7 +336,7 @@ public class EditUserController : PFUIPanel
var r = await userApi.Update(App.CurrentUser, path);
if (r.result)
{
var img = r.data.Value<string>("WxHeadImg");
var img = JObject.FromObject(r.data).Value<string>("WxHeadImg");
Utils.DisplayImage(StartCoroutine, mHeadImage, img);
var userinfos = UIManager.Instance.userInfos;
var i = userinfos.FindIndex(x => x.Id == App.CurrentUser.Id);
@@ -321,6 +355,6 @@ public class EditUserController : PFUIPanel
}
void Cancel(BaseEventData e)
{
UIManager.ShowUserInfoPanel();
UIManager.ShowPrePanel();
}
}
@@ -37,7 +37,16 @@ public class HomeController : PFUIPanel
mainNav.ShowExit();
UIManager.AddEvent(BtnRide.gameObject, EventTriggerType.PointerClick, GoRide);
UIManager.AddEvent(BtnRide.gameObject, EventTriggerType.PointerEnter, (b) =>
{
BtnRide.GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/home/Entrance - ROUTES_hover");
BtnRide.transform.Find("RouterText").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
});
UIManager.AddEvent(BtnRide.gameObject, EventTriggerType.PointerExit, (b) =>
{
BtnRide.GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/home/Entrance - ROUTES_nomal");
BtnRide.transform.Find("RouterText").GetComponent<Text>().color = Utils.HexToColorHtml("#5C5C6E");
});
var avatar = userInfo.Find("Avatar").GetComponent<RawImage>();
var rect = ((RectTransform)avatar.transform).rect;
SetRounded(avatar.transform, rect.height);
@@ -54,7 +63,6 @@ public class HomeController : PFUIPanel
});
GetSummary();
}
private void GoRide(BaseEventData e)
{
UIManager.ShowMapListPanel();
@@ -134,6 +142,7 @@ public class HomeController : PFUIPanel
cg.alpha = 0;
base.Show();
cg.DOFade(1f, 0.3f);
cg.DOFade(1f, 0.3f);
GetSummary();
}
}
@@ -38,7 +38,7 @@ public class MapDetailController : PFUIPanel
{
transform.Find("BtnReturn").GetComponent<Button>().onClick.AddListener(() =>
{
UIManager.ShowMapListPanel();
UIManager.ShowPrePanel();
});
}
}
@@ -64,14 +64,14 @@ public class MapListController : PFUIPanel
// layout.cellSize = new Vector2((width - 120) / 5, (width - 120) / 5);
//}
}
distanceOptions = transform.Find("Panel").Find("Panel").Find("distanceOptions");
distanceOptions = transform.Find("Panel").Find("Top").Find("distanceOptions");
if (distanceOptions != null)
{
var dDropdown = distanceOptions.GetComponent<Dropdown>();
dDropdown.options = MapFilterOptions.distances;
dDropdown.onValueChanged.AddListener(ChangeDistance);
}
diffOptions = transform.Find("Panel").Find("Panel").Find("DifficultyContainer");
diffOptions = transform.Find("Panel").Find("Top").Find("DifficultyContainer");
if (diffOptions != null)
{
foreach (Transform t in diffOptions)
@@ -79,14 +79,14 @@ public class MapListController : PFUIPanel
var button = t.GetComponent<Button>();
var image = t.GetComponent<Image>();
var text = t.Find("Text").GetComponent<Text>();
button.onClick.AddListener(() =>
UIManager.AddEvent(button.gameObject, EventTriggerType.PointerClick, (b) =>
{
ColorUtility.TryParseHtmlString("#23232D", out Color c1);
if (image.color.r == c1.r && image.color.g == c1.g && image.color.b == c1.b)
{
ColorUtility.TryParseHtmlString("#F93086", out Color c);
image.color = c;
text.color = new Color(1, 1, 1,1);
text.color = new Color(1, 1, 1, 1);
hands.Add(MapFilterOptions.diffDict[text.text]);
}
else
@@ -99,6 +99,7 @@ public class MapListController : PFUIPanel
scroll.GetComponent<ScrollRect>().verticalNormalizedPosition = 1;
Refresh();
});
//button.onClick.AddListener();
}
}
BindHeadImage();
@@ -111,7 +112,7 @@ public class MapListController : PFUIPanel
//});
UIManager.AddEvent(scroll, UnityEngine.EventSystems.EventTriggerType.EndDrag, OnEndDrag);
}
//UIManager.AddEvent(transform.Find("Panel").Find("Panel"))
//UIManager.AddEvent(transform.Find("Panel").Find("Top"))
//var obj = Instantiate(Resources.Load<GameObject>("Canvas"));
//obj.transform.parent = transform.parent;
@@ -124,11 +125,11 @@ public class MapListController : PFUIPanel
UIManager.ShowHomePanel();
});
}
tdContainer = transform.Find("Panel").Find("Panel").Find("3dContainer");
favContainer = transform.Find("Panel").Find("Panel").Find("FavContainer");
tdContainer = transform.Find("Panel").Find("Top").Find("3dContainer");
favContainer = transform.Find("Panel").Find("Top").Find("FavContainer");
if (tdContainer != null)
{
tdContainer.GetComponent<Button>().onClick.AddListener(() =>
UIManager.AddEvent(tdContainer.gameObject, EventTriggerType.PointerClick, (b) =>
{
var gou = tdContainer.Find("Gou").gameObject;
bool v = !gou.activeSelf;
@@ -139,7 +140,7 @@ public class MapListController : PFUIPanel
}
if (favContainer != null)
{
favContainer.GetComponent<Button>().onClick.AddListener(() =>
UIManager.AddEvent(favContainer.gameObject, EventTriggerType.PointerClick, (b) =>
{
var gou = favContainer.Find("Gou").gameObject;
bool v = !gou.activeSelf;
@@ -148,20 +149,20 @@ public class MapListController : PFUIPanel
Refresh();
});
}
searchInput = transform.Find("Panel").Find("Panel").Find("SearchInput");
searchInput = transform.Find("Panel").Find("Top").Find("SearchInput");
if (searchInput != null)
{
searchInput.GetComponent<InputField>().onEndEdit.AddListener((s) =>
{
Debug.Log(Input.GetKeyUp(KeyCode.A));
//onEndEdit(s);
});
searchInput.Find("Button").GetComponent<Button>().onClick.AddListener(() =>
{
onEndEdit();
});
//searchInput.GetComponent<InputField>().onEndEdit.AddListener((s) =>
//{
// Debug.Log(Input.GetKeyUp(KeyCode.A));
// //onEndEdit(s);
//});
UIManager.AddEvent(searchInput.Find("Button").gameObject, EventTriggerType.PointerClick, (b) =>
{
onEndEdit();
});
}
sorts = transform.Find("Panel").Find("Panel").Find("FilterOptions");
sorts = transform.Find("Panel").Find("Top").Find("FilterOptions");
if (sorts != null)
{
var drop = sorts.GetComponent<Dropdown>();
@@ -176,7 +177,7 @@ public class MapListController : PFUIPanel
Refresh();
});
}
sortDir = transform.Find("Panel").Find("Panel").Find("Dir");
sortDir = transform.Find("Panel").Find("Top").Find("Dir");
if (sortDir)
{
var image = sortDir.Find("Image").GetComponent<Image>();
@@ -199,11 +200,8 @@ public class MapListController : PFUIPanel
void onEndEdit()
{
var t = searchInput.GetComponent<InputField>().text;
if (!string.IsNullOrEmpty(t))
{
ftname = t;
Refresh();
}
ftname = t;
Refresh();
}
/// <summary>
/// 绑定头像
@@ -268,14 +266,25 @@ public class MapListController : PFUIPanel
var res = await ConfigHelper.mapApi.GetList(pageIndex, pageSize, ftname,distance,string.Join(",",hands),is3d,sort,sortDire,isFav);
if (res.result)
{
if (res.data.Count == 0 && pageIndex != 0)
_lock = false;
if (res.data.Count == 0)
{
isEnd = true;
if (pageIndex != 0)
{
isEnd = true;
scroll.transform.Find("Error").gameObject.SetActive(false);
}
else
{
Debug.Log("当前没查到内容");
scroll.transform.Find("Error").gameObject.SetActive(true);
}
}
else
{
isEnd = false;
DisplayMaps(res.data);
scroll.transform.Find("Error").gameObject.SetActive(false);
}
}
@@ -310,6 +319,8 @@ public class MapListController : PFUIPanel
}
// Update is called once per frame
bool startMouse = false;
private bool _lock;
void Update()
{
if (Input.GetAxis("Mouse ScrollWheel") != 0)
@@ -328,8 +339,10 @@ public class MapListController : PFUIPanel
OnEndDrag(null);
}
}
if (Input.GetKey(KeyCode.KeypadEnter) || Input.GetKey(KeyCode.Return))
if (Input.GetKey(KeyCode.KeypadEnter) || Input.GetKey(KeyCode.Return))
{
if (_lock) return;
_lock = true;
onEndEdit();
}
}
@@ -20,7 +20,8 @@ public class UserInfoController : PFUIPanel
UIManager.AddEvent(exitBtn.gameObject, EventTriggerType.PointerClick, (b) =>
{
UIManager.ShowHomePanel();
UIManager.ShowPrePanel();
//UIManager.ShowHomePanel();
});
//exitBtn.onClick.AddListener(() =>
//{
@@ -32,6 +33,7 @@ public class UserInfoController : PFUIPanel
SceneManager.LoadScene("1-Login");
});
infoPanel = transform.Find("InfoPanel").Find("P");
Button editBtn = infoPanel.Find("EditButton").GetComponent<Button>();
UIManager.AddEvent(editBtn.gameObject, EventTriggerType.PointerClick, (b) =>
{
@@ -41,6 +43,14 @@ public class UserInfoController : PFUIPanel
//{
// UIManager.ShowEditUserPanel();
//});
UIManager.AddEvent(transform.Find("InfoPanel").gameObject, EventTriggerType.PointerEnter, (b) =>
{
editBtn.gameObject.SetActive(true);
});
UIManager.AddEvent(transform.Find("InfoPanel").gameObject, EventTriggerType.PointerExit, (b) =>
{
editBtn.gameObject.SetActive(false);
});
summaryPanel = transform.Find("SummaryPanel");
}
public override void Show()
@@ -68,7 +78,7 @@ public class UserInfoController : PFUIPanel
infoPanel.Find("IdText").GetComponent<Text>().text = $"ID:{user.Id.ToString("000000")}";
infoPanel.Find("NameText").GetComponent<Text>().text = $"{user.Nickname}";
infoPanel.Find("EmailText").GetComponent<Text>().text = $"{user.Phone}";
infoPanel.Find("DescText").GetComponent<Text>().text = $"{summary.Tips}";
infoPanel.Find("Ftp").Find("Value").GetComponent<Text>().text = user.FTP.ToString();
infoPanel.Find("MHR").Find("Value").GetComponent<Text>().text = user.MaxHeartRate.ToString();
infoPanel.Find("Weight").Find("Value").GetComponent<Text>().text = $"{user.Weight}KG";