修改细节

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

@@ -18,7 +18,7 @@ public class FeedbackController : PFUIPanel
Sprite plus;
void Awake()
{
ApiBase.SetCookie("3B7C1A274805FBB658A16F7B658F7FC3B01599154A952C20011B0F207A9F7B9709CAB23AD8B62FF5F85806DD0AD5059223FD6A582EF79B3F211E64572290202D2821928E824BA6C5313C32C4291763A3797304AE193B272DB9907F7D5AB46D53");
//ApiBase.SetCookie("3B7C1A274805FBB658A16F7B658F7FC3B01599154A952C20011B0F207A9F7B9709CAB23AD8B62FF5F85806DD0AD5059223FD6A582EF79B3F211E64572290202D2821928E824BA6C5313C32C4291763A3797304AE193B272DB9907F7D5AB46D53");
main = transform.Find("Main");
images = main.Find("Images");
paths = new Dictionary<string, string>();
@@ -110,7 +110,7 @@ public class FeedbackController : PFUIPanel
}
else
{
Utils.showToast(gameObject, "已提交");
Utils.showToast(gameObject, "已提交", type: 1);
}
}
// Update is called once per frame
@@ -107,20 +107,17 @@ public class QuickLoginScroll : MonoBehaviour
{
if (start)
{
scroll.horizontalNormalizedPosition += scrollValue;
totalScrollValue += scrollValue;
if (System.Math.Abs(totalScrollValue) >= contentSize)
{
scrollValue = 0;
start = false;
scroll.horizontalNormalizedPosition = startPosition + totalScrollValue;
scroll.horizontalNormalizedPosition = startPosition + (totalScrollValue<0?-1:1)*contentSize;
//Debug.Log();
SetColor();
totalScrollValue = 0;
}
else
{
scroll.horizontalNormalizedPosition += scrollValue;
}
}
}
}
@@ -25,6 +25,7 @@ namespace Assets.Scripts.UI.Prefab.MapList
{"5-10KM","5-10" },
{"10-20KM","10-20" },
{"20-30KM","20-30" },
{"30-50KM","30-50" },
{"50-100KM","50-100" },
{"100-200KM","100-200" },
{"200-无限制","200-99999" },
+6 -4
View File
@@ -122,8 +122,8 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler
}
transform.Find("CollectImg").gameObject.SetActive(true);
transform.DOLocalMoveY(localY.Value + 5, 0.5f);
SetActive4Button(true);
SetColor(map.IsFavorite);
//SetActive4Button(true);
SetColor(true);
}
void SetActive4Button(bool b)
{
@@ -135,7 +135,7 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler
{
transform.DOLocalMoveY(localY.Value, 0.5f);
transform.Find("CollectImg").gameObject.SetActive(false);
SetActive4Button(false);
//SetActive4Button(false);
SetColor(false);
}
private void SetColor(bool isFav)
@@ -150,6 +150,8 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler
transform.Find("Props").Find(v).GetComponent<Text>().color = Utils.HexToColorHtml(
PropNames.colorDict[isFav]);
});
transform.Find("MapHBImg").GetComponent<RawImage>().color = Utils.HexToColorHtml(
PropNames.colorDict[isFav]);
}
async void Collect()
{
@@ -167,7 +169,7 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler
map.IsFavorite = !map.IsFavorite;
transform.Find("CollectImg").Find("Image").GetComponent<Image>().sprite =
UIManager.Instance.collectDict[map.IsFavorite];
SetColor(map.IsFavorite);
//SetColor(map.IsFavorite);
}
else
{
@@ -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";
@@ -58,8 +58,7 @@ public class ResultListController : MonoBehaviour
{
UIManager.AddEvent(searchInput.Find("Button").gameObject, EventTriggerType.PointerClick, (b) =>
{
name = searchInput.GetComponent<InputField>().text;
Refresh(contents[scrollIndex]);
onEndEdit();
});
//searchInput.Find("Button").GetComponent<Button>().onClick.AddListener(() =>
//{
@@ -115,16 +114,28 @@ public class ResultListController : MonoBehaviour
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[index] != 0)
_lock = false;
if (r.data.Count == 0)
{
isEnd[index] = true;
if (pageIndex[index] != 0)
{
isEnd[index] = true;
scroll.transform.Find("Error").gameObject.SetActive(false);
}
else
{
//contents[index];
scroll.transform.Find("Error").gameObject.SetActive(true);
}
}
else
{
isEnd[index] = false;
DisplayRouteResult(r.data, contents[index],index);
scroll.transform.Find("Error").gameObject.SetActive(false);
//DisplayRouteResult(r.data, matchContent);
}
}
@@ -154,9 +165,21 @@ public class ResultListController : MonoBehaviour
}
// Update is called once per frame
bool _lock = false;
void onEndEdit()
{
name = searchInput.GetComponent<InputField>().text;
Refresh(contents[scrollIndex]);
}
void Update()
{
GoScroll();
if (Input.GetKey(KeyCode.KeypadEnter) || Input.GetKey(KeyCode.Return))
{
if (_lock) return;
_lock = true;
onEndEdit();
}
}
void StartScroll(int index)
{
@@ -177,6 +200,7 @@ public class ResultListController : MonoBehaviour
btnRoute.GetComponent<Text>().color = c1;
btnMatch.GetComponent<Text>().color = c2;
}
scroll.transform.Find("Error").gameObject.SetActive(contents[scrollIndex].childCount == 0);
}
#region 主页面滑动逻辑
int scrollIndex = 0;