Merge remote-tracking branch 'origin/dev' into dev_lishuo
# Conflicts: # Assets/Scripts/App.cs
This commit is contained in:
commit
614d067d25
39 files changed
+5682
-12276
No files matched your search
@@ -3,12 +3,12 @@ using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class LoadingPf : MonoBehaviour
|
||||
public class LoadingPf : PFUIPanel
|
||||
{
|
||||
List<Sprite> sprites;
|
||||
Image image;
|
||||
|
||||
private void Start()
|
||||
protected override void Start()
|
||||
{
|
||||
sprites = new List<Sprite>();
|
||||
for (int i = 1; i < 80; i++)
|
||||
@@ -19,11 +19,14 @@ public class LoadingPf : MonoBehaviour
|
||||
}
|
||||
int index = 0;
|
||||
float time = 0;
|
||||
public void Initial()
|
||||
public override void Show()
|
||||
{
|
||||
base.Show();
|
||||
|
||||
index = 0;
|
||||
time = 0;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
time += Time.deltaTime;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -50,7 +50,7 @@ public class QuickLoginUser : MonoBehaviour
|
||||
{
|
||||
top.GetComponent<LoginController>().SaveInfo(r.data);
|
||||
App.CurrentUser = r.data;
|
||||
|
||||
App.rideSetting.sensitivity = App.CurrentUser.Sensitivity;
|
||||
SceneManager.LoadScene("MainScene");
|
||||
}
|
||||
else
|
||||
|
||||
@@ -99,7 +99,16 @@ public class BigMapController : PFUIPanel
|
||||
content = panel.Find("Scroll View").Find("Viewport").Find("Content").gameObject;
|
||||
var input = panel.Find("InputField");
|
||||
base.SetRounded(input, 20f);
|
||||
input.GetComponent<InputField>().onEndEdit.AddListener((text) =>
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.Return))
|
||||
{
|
||||
this.Search(null);
|
||||
}
|
||||
});
|
||||
|
||||
keyword = input.Find("Text").GetComponent<Text>();
|
||||
|
||||
var searchBtn = input.Find("Search").gameObject;
|
||||
UIManager.AddEvent(searchBtn, EventTriggerType.PointerClick, Search);
|
||||
|
||||
@@ -141,22 +150,27 @@ public class BigMapController : PFUIPanel
|
||||
|
||||
}
|
||||
|
||||
private void Search(BaseEventData e)
|
||||
private async void Search(BaseEventData e)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(keyword.text))
|
||||
{
|
||||
//yield return null;
|
||||
return;
|
||||
}
|
||||
Debug.Log(keyword.text);
|
||||
//UIManager.ShowLoadingDialogBox();
|
||||
//Utils.showLoading(this.gameObject);
|
||||
|
||||
var infoStr = mapboxApi.GetAddressInfo(keyword.text);
|
||||
//Debug.Log(info);
|
||||
UIManager.ShowLoadingDialogBox();
|
||||
|
||||
var infoStr = await mapboxApi.GetAddressInfo(keyword.text);
|
||||
//Debug.Log(infoStr);
|
||||
var info = Newtonsoft.Json.Linq.JObject.Parse(infoStr);
|
||||
|
||||
var center = (info["features"] as JArray).First()["center"];
|
||||
mapManager.UpdateMap(new Vector2d(Convert.ToDouble(center[1]), Convert.ToDouble(center[0])));
|
||||
//mapManager.SetCenterLatitudeLongitude(new Vector2d(31.325053, 120.623564));
|
||||
//mapManager.UpdateMap(new Vector2d(31.325053, 120.623564));
|
||||
|
||||
|
||||
UIManager.HideLoadingDialogBox();
|
||||
}
|
||||
|
||||
private void MapManager_OnInitialized()
|
||||
|
||||
@@ -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
|
||||
{
|
||||
@@ -21,11 +22,21 @@ public class EarthController : PFUIPanel
|
||||
private GameObject hotPanel;
|
||||
private GameObject content;
|
||||
private Object itemObject;
|
||||
Transform rootPanel;
|
||||
Canvas canvas;
|
||||
float time = 0f;
|
||||
bool showSummary = false;
|
||||
Vector2 latlonCenter;
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
mapApi = new MapApi();
|
||||
|
||||
canvas = this.transform.Find("Canvas").GetComponent<Canvas>();
|
||||
canvas.worldCamera = Camera.main;
|
||||
|
||||
rootPanel = this.transform.Find("Canvas").Find("Panel");
|
||||
|
||||
map = WorldMapGlobe.instance;
|
||||
map.showProvinces = true;
|
||||
map.showCities = true;
|
||||
@@ -45,8 +56,7 @@ 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");
|
||||
|
||||
SetRounded(panel, 60);
|
||||
@@ -111,11 +121,14 @@ public class EarthController : PFUIPanel
|
||||
|
||||
Province.text = province.name;
|
||||
|
||||
ShowSummary(province.latlonCenter);
|
||||
latlonCenter = province.latlonCenter;
|
||||
time = 0f;
|
||||
showSummary = true;
|
||||
//ShowSummary(province.latlonCenter);
|
||||
};
|
||||
map.OnProvinceExit += (int provinceIndex, int regionIndex) =>
|
||||
{
|
||||
|
||||
showSummary = false;
|
||||
};
|
||||
map.OnProvinceClick += (int provinceIndex, int regionIndex) =>
|
||||
{
|
||||
@@ -188,7 +201,7 @@ public class EarthController : PFUIPanel
|
||||
|
||||
private void Map_OnClick(Vector3 sphereLocation, int mouseButtonIndex)
|
||||
{
|
||||
Debug.Log("click");
|
||||
//Debug.Log("click");
|
||||
|
||||
Vector2 latLon = Conversion.GetLatLonFromSpherePoint(sphereLocation);
|
||||
Debug.Log("Clicked on Latitude: " + latLon.x + ", Longitude: " + latLon.y);
|
||||
@@ -211,8 +224,18 @@ public class EarthController : PFUIPanel
|
||||
void Update()
|
||||
{
|
||||
//var zoom = map.GetZoomLevel();
|
||||
|
||||
//Debug.Log(zoom);
|
||||
|
||||
if (showSummary)
|
||||
{
|
||||
time += Time.deltaTime;
|
||||
if (time >= 0.2)
|
||||
{
|
||||
ShowSummary(latlonCenter);
|
||||
showSummary = false;
|
||||
}
|
||||
}
|
||||
//Debug.Log(showSummary + "," + time);
|
||||
}
|
||||
|
||||
public void Show(double lat, double lon)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user