修改细节

This commit is contained in:
Caiyanpeng committed 2021-04-28 15:22:04 +08:00
1 parent 5080503ebd
commit c8111d7db3
25 files changed
+1677 -7833

No files matched your search

+6 -1
View File
@@ -119,7 +119,12 @@ namespace Assets.Scripts.Apis
{
return await PostAsync<JsonResult<object>>("/MemberFavoriteMap/Cancel", new { routeId });
}
public async Task<JsonResult<object>> DeleteRecord(string id)
{
return await PostAsync<JsonResult<object>>("/MapRecord/Delete", new { id });
}
public JsonResult<MapRouteRankingList> GetRouteRanking(int id,string type, int pageIndex,int pageSize,string name)
{
var url = $"Map/v1/GetRouteRanking?pageIndex={ 0 }&pageSize={ pageSize }&name={ name }&id={ id }&type={ type }&filterSelf={ true }";
@@ -163,5 +163,7 @@ namespace Assets.Scripts.Apis.Models
///
/// </summary>
public string CanShareOnStrava { get; set; }
public string ViewUrl { get; set; }
}
}
+4 -1
View File
@@ -178,7 +178,10 @@ namespace Assets.Scripts.Apis
public async Task<JsonResult<UserResultModel>> QuickLogin()
{
var r = await PostAsync<JsonResult<UserResultModel>>("NoAuth/QuickLogin", null);
r.data.cookie = cookies[0].Value;
if (r.result)
{
r.data.cookie = cookies[0].Value;
}
return r;
}
+2
View File
@@ -33,4 +33,6 @@ public static class App
public static Texture CurrentUserHeadTexture;
public static RouteResult routeResult;//骑行记录向骑行场景传值
public static Texture DefaultRotateTexture;
//全局用 输入框或者下拉框修改标志位
public static bool isChanged { get; set; }
}
+8 -5
View File
@@ -293,7 +293,10 @@ public class LoginController : MonoBehaviour
{
UIManager.AddEvent(exit.gameObject, EventTriggerType.PointerClick, (b) =>
{
Application.Quit();
UIManager.ShowConfirm("Quit", "Do you want to quit PowerFun?", () =>
{
Application.Quit();
});
});
}
@@ -644,7 +647,7 @@ public class LoginController : MonoBehaviour
var CPassword = signForm.cpassword;
if (Password.text != CPassword.text)
{
Utils.showToast(gameObject, "两次密码输入不一致");
Utils.showToast(gameObject, "Two password entries are inconsistent");//两次密码输入不一致
return;
}
//JsonConvert
@@ -713,13 +716,13 @@ public class LoginController : MonoBehaviour
var CPassword = signForm.cpassword;
if (Password.text != CPassword.text)
{
Utils.showToast(gameObject, "两次密码输入不一致");
Utils.showToast(gameObject, "Two password entries are inconsistent");//两次密码输入不一致
return;
}
var r = await ConfigHelper.userApi.ResetPassword(Email.text, Captcha.text, Password.text);
if (r.result)
{
Utils.showToast(gameObject, "修改成功",type:1);
Utils.showToast(gameObject, "Success",type:1);
goLoginReturn2();
}
else
@@ -804,7 +807,7 @@ public class LoginController : MonoBehaviour
new { Field = "Months", ErrMsg = "" },
new { Field = "Days", ErrMsg = "" }
}));
Utils.showToast(gameObject, "请选择生日");
Utils.showToast(gameObject, "Please select birthday");//请选择生日
return false;
}
userResult.Sex = _genders.SelectedIndex + 1;
+6 -2
View File
@@ -62,9 +62,12 @@ namespace Assets.Scripts.UI.Control
void Awake()
{
//this.mSelectedIndex =
//UIManager.AddEvent(this.transform.GetComponent<Image>().gameObject, EventTriggerType.Select, new UnityEngine.Events.UnityAction<BaseEventData>(OnSelect));
UIManager.AddEvent(this.transform.GetComponent<Image>().gameObject, EventTriggerType.Select, (b)=>
{
App.isChanged = true;
});
//UIManager.AddEvent(this.transform.GetComponent<Image>().gameObject, EventTriggerType.Deselect, new UnityEngine.Events.UnityAction<BaseEventData>(OnDeselect));
//this.GetComponent<Dropdown>().itemText.color = Utils.HexToColorHtml("#ff2742");
this.GetComponent<Dropdown>().onValueChanged.AddListener(i => {
mSelectedIndex = i;
@@ -99,6 +102,7 @@ namespace Assets.Scripts.UI.Control
var image = this.transform.GetComponent<Image>();
var png = Resources.Load<Sprite>("Images/ipt-1");
image.sprite = png;
App.isChanged = true;
}
public void OnDeselect(BaseEventData eventData)
{
+2 -1
View File
@@ -53,7 +53,8 @@ namespace Assets.Scripts.UI.Control
outline.enabled = true;
ColorUtility.TryParseHtmlString("#F93086", out Color color);
outline.effectColor = color;
outline.effectColor = color;
App.isChanged = true;
}
public void OnDeselect(BaseEventData eventData)
@@ -82,7 +82,7 @@ public class FeedbackController : PFUIPanel
{
if (paths.ContainsValue(path))
{
Utils.showToast(gameObject, "图片已存在,请选择其他图片");
Utils.showToast(gameObject, "Picture already exists, please choose another picture");//图片已存在,请选择其他图片
return;
}
self.GetComponent<Image>().sprite = Utils.PngToSprite(path, 110, 110);
@@ -116,7 +116,7 @@ public class FeedbackController : PFUIPanel
}
else
{
Utils.showToast(gameObject, "已提交", type: 1);
Utils.showToast(gameObject, "Submitted", type: 1);//已提交
}
}
// Update is called once per frame
@@ -6,6 +6,7 @@ using DG.Tweening;
using UnityEngine.UI;
using Assets.Scripts.Apis;
using Newtonsoft.Json.Linq;
using Assets.Scripts;
public class EarthController : PFUIPanel
{
@@ -45,7 +46,6 @@ public class EarthController : PFUIPanel
protected override void Start()
{
itemObject = Resources.Load("UI/Prefab/BigMap/Item");
var rootPanel = this.transform.Find("Canvas").Find("Panel");
var panel = rootPanel.Find("Panel");
@@ -171,7 +171,7 @@ public class EditUserController : PFUIPanel
var result = await new UserApi().Login("13115011550", "laozhong", "");
App.CurrentUser = result.data;
}
async Task LoadDataSync()
void LoadDataSync()
{
//if (!App.FromLogin)
//{
@@ -246,6 +246,7 @@ public class EditUserController : PFUIPanel
{
base.Show();
LoadDataSync();
App.isChanged = false;
}
private void Switch(BaseEventData arg0)
{
@@ -276,58 +277,64 @@ public class EditUserController : PFUIPanel
mDayDropdown.AddOptions(list);
}
async void Save(BaseEventData e)
void Save(BaseEventData e)
{
var user = JsonConvert.DeserializeObject<UserResultModel>(JsonConvert.SerializeObject(App.CurrentUser));
user.Birthday = new DateTime(int.Parse(mYearDropdown.SelectedItem), int.Parse(mMonthDropdown.SelectedItem), int.Parse(mDayDropdown.SelectedItem));
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);
user.MaxHeartRate = int.Parse(mMHR.Text);
user.BicycleWeight = int.Parse(mBW.Text);
user.WheelDiameter = int.Parse(mWD.Text);
user.Unit = mUnitDropdown.SelectedIndex;
user.Contact = mName.Text;
user.ContactPhone = mPhone.Text;
user.ContactAddress = mAddr.Text;
var result = await userApi.Update(user);
if (result.result == false)
{
Utils.SetValidate(dict, JArray.FromObject(result.data));
Utils.showToast(gameObject, result.errMsg);
//UIManager.ShowAlert(result.errMsg);
}
else
{
App.CurrentUser = user;
var userinfos = UIManager.Instance.userInfos;
var i = userinfos.FindIndex(x => x.Id == App.CurrentUser.Id);
if (i != -1)
{
userinfos[i].NickName = user.Nickname;
UIManager.Instance.userInfos = userinfos;
}
Utils.showToast(gameObject, "Success", type: 1);
//UIManager.ShowAlert("Success");
}
LoadDataSync();
UIManager.ShowConfirm("Confirm", "Are you sure to edit?", async () =>
{
var user = JsonConvert.DeserializeObject<UserResultModel>(JsonConvert.SerializeObject(App.CurrentUser));
user.Birthday = new DateTime(int.Parse(mYearDropdown.SelectedItem), int.Parse(mMonthDropdown.SelectedItem), int.Parse(mDayDropdown.SelectedItem));
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, "Please fill in the information");//请填写相关信息
return;
}
user.FTP = int.Parse(mFTP.Text);
user.Height = int.Parse(mHeight.Text);
user.Weight = int.Parse(mWeight.Text);
user.MaxHeartRate = int.Parse(mMHR.Text);
user.BicycleWeight = int.Parse(mBW.Text);
user.WheelDiameter = int.Parse(mWD.Text);
user.Unit = mUnitDropdown.SelectedIndex;
user.Contact = mName.Text;
user.ContactPhone = mPhone.Text;
user.ContactAddress = mAddr.Text;
var result = await userApi.Update(user);
App.isChanged = false;
if (result.result == false)
{
Utils.SetValidate(dict, JArray.FromObject(result.data));
Utils.showToast(gameObject, result.errMsg);
//UIManager.ShowAlert(result.errMsg);
}
else
{
App.CurrentUser = user;
var userinfos = UIManager.Instance.userInfos;
var i = userinfos.FindIndex(x => x.Id == App.CurrentUser.Id);
if (i != -1)
{
userinfos[i].NickName = user.Nickname;
UIManager.Instance.userInfos = userinfos;
}
Utils.showToast(gameObject, "Success", type: 1);
//UIManager.ShowAlert("Success");
}
LoadDataSync();
});
//App.CurrentUser = user;
//UIManager.ShowAlert("result.errMsg");
@@ -335,6 +342,7 @@ public class EditUserController : PFUIPanel
async void ChangeAvatar(string path)
{
var r = await userApi.Update(App.CurrentUser, path);
App.isChanged = false;
if (r.result)
{
var img = JObject.FromObject(r.data).Value<string>("WxHeadImg");
@@ -358,6 +366,18 @@ public class EditUserController : PFUIPanel
}
void Cancel(BaseEventData e)
{
UIManager.ShowPrePanel();
if (App.isChanged)
{
UIManager.ShowConfirm("Tips", "It is detected that you have modified, do you want to give up and return?", () =>
{
UIManager.ShowPrePanel();
UIManager.CloseConfirm();
});
}
else
{
UIManager.ShowPrePanel();
}
}
}
@@ -100,6 +100,10 @@ public class HomeController : PFUIPanel
{
userInfo.Find("SexIcon").GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/woman");
}
else
{
userInfo.Find("SexIcon").GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/man");
}
Utils.DisplayImage(StartCoroutine, userInfo.Find("Avatar").GetComponent<RawImage>(), App.CurrentUser.WxHeadImg);
userInfo.Find("Country").GetComponent<RawImage>().texture = UIManager.Instance.loginRegOptions.GetCountryImageByName(App.CurrentUser.Country);
@@ -84,10 +84,19 @@ public class UserInfoController : PFUIPanel
infoPanel.Find("Weight").Find("Value").GetComponent<Text>().text = $"{user.Weight}KG";
infoPanel.Find("BW").Find("Value").GetComponent<Text>().text = $"{user.BicycleWeight}KG";
infoPanel.Find("WD").Find("Value").GetComponent<Text>().text = $"{user.WheelDiameter}MM";
//infoPanel.Find("Ftp").Find("Time").GetComponent<Text>().text = user.LastUpdateFtpTime.ToString("yyyy-MM-dd");
//infoPanel.Find("MHR").Find("Time").GetComponent<Text>().text = user.MaxHeartRate.ToString();
//infoPanel.Find("Weight").Find("Time").GetComponent<Text>().text = user.LastUpdateWeightTime.ToString("yyyy-MM-dd");
//infoPanel.Find("BW").Find("Time").GetComponent<Text>().text = user.LastUpdateBicycleWeightTime.ToString("yyyy-MM-dd");
//infoPanel.Find("WD").Find("Time").GetComponent<Text>().text = $"{user.WheelDiameter}MM";
if (user.Sex == 2)
{
infoPanel.Find("SexIcon").GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/woman");
}
else
{
infoPanel.Find("SexIcon").GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/man");
}
summaryPanel.Find("Number").Find("Value").GetComponent<Text>().text = summary.Count.ToString();
summaryPanel.Find("Time").Find("Value").GetComponent<Text>().text = summary.TotalTicks.ToString();
summaryPanel.Find("KM").Find("Value").GetComponent<Text>().text = summary.TotalDistance.ToString();
@@ -89,35 +89,57 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
right.Find("Value").GetComponent<Text>().text = result.Ranking.ToString();
}
right.gameObject.SetActive(true);
gameObject.GetComponent<Button>().onClick.AddListener(() =>
{
Application.OpenURL(result.ViewUrl);
});
this.index = index;
}
private void Delete()
{
//throw new NotImplementedException();
UIManager.ShowAlert("暂未实现");
UIManager.ShowConfirm("Delete", "Delete this record?", async () =>
{
var r = await ConfigHelper.mapApi.DeleteRecord(routeResult.Id);
UIManager.CloseConfirm();
if (r.result)
{
DestroyImmediate(gameObject);
}
else
{
Utils.showToast(gameObject, r.errMsg);
}
});
}
private void GoReRide()
{
App.RouteIdParam = routeResult.RouteId;
App.routeResult = routeResult;
App.routeResult.ContinueCyclingParam = null;
SceneManager.LoadScene("Ride");
UIManager.ShowConfirm("ReRide", "Ride again?", () =>
{
App.RouteIdParam = routeResult.RouteId;
App.routeResult = routeResult;
App.routeResult.ContinueCyclingParam = null;
SceneManager.LoadScene("Ride");
});
}
private void GoContinue()
{
if (routeResult.ContinueCyclingParam != null)
UIManager.ShowConfirm("Continue", "Continue riding?", () =>
{
App.RouteIdParam = routeResult.RouteId;
App.routeResult = routeResult;
SceneManager.LoadScene("Ride");
}
if (routeResult.ContinueCyclingParam != null)
{
App.RouteIdParam = routeResult.RouteId;
App.routeResult = routeResult;
SceneManager.LoadScene("Ride");
}
});
}
void SetButtonColor(bool f)
{
if (index == 0)
if (index == 0 && routeResult!=null)
{
if (f)
{
@@ -166,6 +188,7 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
}
titleColor = "#414251";
SetButtonColor(false);
Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
}
public void OnPointerEnter(PointerEventData eventData)
@@ -192,5 +215,6 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
}
titleColor = "#5c5c6e";
SetButtonColor(true);
Cursor.SetCursor(Resources.Load<Texture2D>("Images/PointerButtonHover"), Vector2.zero, CursorMode.Auto);
}
}
+8 -4
View File
@@ -142,6 +142,7 @@ public class UIManager : MonoBehaviour
stack = new Stack<PFUIPanel>();
loginRegOptions = new LoginRegOptions();
var userInfosJson = PlayerPrefs.GetString("UserInfos");
Debug.Log(userInfosJson);
userInfos = JsonConvert.DeserializeObject<List<QUserInfo>>(userInfosJson);
if (userInfos == null) userInfos = new List<QUserInfo>();
@@ -352,9 +353,6 @@ public class UIManager : MonoBehaviour
UIManager.Show(UIManager.Instance.EditUserPanel, UIManager.Instance.MainPanel);
}
public static void ShowLoadingDialogBox()
{
}
public static void ShowMapListPanel()
{
UIManager.Show(UIManager.Instance.MapListPanel, UIManager.Instance.MainPanel);
@@ -536,7 +534,13 @@ public class UIManager : MonoBehaviour
UIManager.Instance.confirm.Set(title, content, action);
}
}
public static void CloseConfirm()
{
if (UIManager.Instance.confirm != null)
{
UIManager.Instance.confirm.Close();
}
}
public LoginRegOptions loginRegOptions { get; private set; }
private List<QUserInfo> _userInfos;
public List<QUserInfo> userInfos
+4 -3
View File
@@ -123,8 +123,9 @@ namespace Assets.Scripts
public static void showToast(GameObject game,string text,int duration = 1,int type = 0)
{
//type 0错误 1正确
var parent = Utils.FindUpParent(game.transform);
var toast = parent.Find("ToastContainer");
var parent = UIManager.Instance.ModalsPanel;
if (parent == null) return;
var toast = parent.transform.Find("ToastContainer");
if (toast != null)
{
MonoBehaviour.DestroyImmediate(toast.gameObject);
@@ -132,7 +133,7 @@ namespace Assets.Scripts
var newToast = MonoBehaviour.Instantiate(Resources.Load<GameObject>("UI/Prefab/ToastContainer"));
newToast.name = "ToastContainer";
newToast.GetComponent<RectTransform>().position = new Vector3(Screen.width / 2, Screen.height / 2, 0);
newToast.transform.parent = parent;
newToast.transform.parent = parent.transform;
toast = newToast.transform;
var toastStyle = toastDict[type].Split('|');
toast.Find("Image").GetComponent<Image>().sprite = Resources.Load<Sprite>(toastStyle[0]);