Merge remote-tracking branch 'origin/dev' into dev_lishuo
This commit is contained in:
commit
a49acaab1e
94 files changed
+5564
-2224
No files matched your search
@@ -20,7 +20,7 @@ public class ConnectDeviceModal : PFUIPanel
|
||||
}
|
||||
set
|
||||
{
|
||||
Debug.Log(value);
|
||||
//Debug.Log(value);
|
||||
mSensorType = value;
|
||||
var deviceInfoStr = Utils.deviceDict[value.ToString()];
|
||||
if (deviceInfoStr != null)
|
||||
@@ -66,8 +66,8 @@ public class ConnectDeviceModal : PFUIPanel
|
||||
|
||||
UIManager.AddEvent(closeBtn.gameObject, EventTriggerType.PointerClick, new UnityEngine.Events.UnityAction<BaseEventData>(e =>
|
||||
{
|
||||
//this.gameObject.SetActive(false);
|
||||
this.Close();
|
||||
//DestroyImmediate(this.gameObject);
|
||||
}));
|
||||
|
||||
deviceItem = Resources.Load("UI/Prefab/Device/DeviceItem");
|
||||
@@ -156,6 +156,7 @@ public class ConnectDeviceModal : PFUIPanel
|
||||
|
||||
var gameObject = (GameObject)Instantiate(deviceItem);
|
||||
gameObject.transform.SetParent(content.transform);
|
||||
gameObject.transform.localScale = new Vector3(1, 1, 1);
|
||||
var deviceItemObj = gameObject.GetComponent<DeviceItem>();
|
||||
deviceItemObj.DeviceInfo = device;
|
||||
|
||||
@@ -200,13 +201,17 @@ public class ConnectDeviceModal : PFUIPanel
|
||||
public override void Close()
|
||||
{
|
||||
base.Close();
|
||||
DestroyImmediate(this.gameObject);
|
||||
//DestroyImmediate(this.gameObject);
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
|
||||
|
||||
float time = 0;
|
||||
float _x = 0;
|
||||
float _y = 0;
|
||||
/// <summary>
|
||||
/// 做search动画
|
||||
/// </summary>
|
||||
void Move()
|
||||
{
|
||||
var hudu = (2 * Mathf.PI / 360) * 1 * time;
|
||||
|
||||
@@ -70,18 +70,19 @@ public class DeviceView : MonoBehaviour
|
||||
var material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
|
||||
var rect = ((RectTransform)transform).rect;
|
||||
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height * 0.2f, 0));
|
||||
//this.GetComponent<Image>().material = material;
|
||||
this.GetComponent<Image>().material = material;
|
||||
|
||||
var img1 = unconnectionPanel.GetComponent<Image>();
|
||||
if(img1 != null)
|
||||
{
|
||||
img1.material = material;
|
||||
|
||||
var gradient = unconnectionPanel.GetComponent<UIGradient>();
|
||||
if (gradient != null)
|
||||
{
|
||||
gradient.color1 = Utils.HexToColor("353543");
|
||||
gradient.color2 = Utils.HexToColor("23232D");
|
||||
}
|
||||
//var gradient = unconnectionPanel.GetComponent<UIGradient>();
|
||||
//if (gradient != null)
|
||||
//{
|
||||
// gradient.color1 = Utils.HexToColor("353543");
|
||||
// gradient.color2 = Utils.HexToColor("23232D");
|
||||
//}
|
||||
}
|
||||
|
||||
var img2 = connectionPanel.GetComponent<Image>();
|
||||
@@ -89,12 +90,12 @@ public class DeviceView : MonoBehaviour
|
||||
{
|
||||
img2.material = material;
|
||||
|
||||
var gradient1 = connectionPanel.GetComponent<UIGradient>();
|
||||
if (gradient1 != null)
|
||||
{
|
||||
gradient1.color1 = Utils.HexToColor("FF7485");
|
||||
gradient1.color2 = Utils.HexToColor("F93086");
|
||||
}
|
||||
//var gradient1 = connectionPanel.GetComponent<UIGradient>();
|
||||
//if (gradient1 != null)
|
||||
//{
|
||||
// gradient1.color1 = Utils.HexToColor("FF7485");
|
||||
// gradient1.color2 = Utils.HexToColor("F93086");
|
||||
//}
|
||||
}
|
||||
|
||||
logo = this.transform.Find("Logo").GetComponent<Image>();
|
||||
@@ -151,7 +152,7 @@ public class DeviceView : MonoBehaviour
|
||||
{
|
||||
sprite0 = Resources.Load<Sprite>("Images/Devices/Power_0");
|
||||
sprite1 = Resources.Load<Sprite>("Images/Devices/Power_1");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Devices/Power_3");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Devices/Power_4");
|
||||
|
||||
powerUnit.text = "W";
|
||||
}
|
||||
@@ -159,7 +160,7 @@ public class DeviceView : MonoBehaviour
|
||||
{
|
||||
sprite0 = Resources.Load<Sprite>("Images/Devices/Speed_0");
|
||||
sprite1 = Resources.Load<Sprite>("Images/Devices/Speed_1");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Devices/Speed_3");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Devices/Speed_4");
|
||||
|
||||
powerUnit.text = "KPH";
|
||||
}
|
||||
@@ -167,7 +168,7 @@ public class DeviceView : MonoBehaviour
|
||||
{
|
||||
sprite0 = Resources.Load<Sprite>("Images/Devices/Cadence_0");
|
||||
sprite1 = Resources.Load<Sprite>("Images/Devices/Cadence_1");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Devices/Cadence_3");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Devices/Cadence_4");
|
||||
|
||||
powerUnit.text = "RPM";
|
||||
}
|
||||
@@ -175,7 +176,7 @@ public class DeviceView : MonoBehaviour
|
||||
{
|
||||
sprite0 = Resources.Load<Sprite>("Images/Devices/Heart Rate_0");
|
||||
sprite1 = Resources.Load<Sprite>("Images/Devices/Heart Rate_1");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Devices/Heart Rate_3");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Devices/Heart Rate_4");
|
||||
|
||||
powerUnit.text = "BPM";
|
||||
}
|
||||
@@ -183,7 +184,7 @@ public class DeviceView : MonoBehaviour
|
||||
{
|
||||
sprite0 = Resources.Load<Sprite>("Images/Devices/Trainer_0");
|
||||
sprite1 = Resources.Load<Sprite>("Images/Devices/Trainer_1");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Devices/Trainer_3");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Devices/Trainer_4");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,7 +256,11 @@ public class DeviceView : MonoBehaviour
|
||||
var connectionCanvasGroup = connectionPanel.GetComponent<CanvasGroup>();
|
||||
connectionCanvasGroup.alpha = 0;
|
||||
connectionPanel.SetActive(true);
|
||||
connectionCanvasGroup.DOFade(1f, .3f);
|
||||
connectionCanvasGroup.DOFade(1f, .3f).OnComplete(()=> {
|
||||
//if (logoSprite != null) {
|
||||
// logo.sprite = logoSprite;
|
||||
//}
|
||||
});
|
||||
}
|
||||
logo.sprite = sprite3;
|
||||
|
||||
|
||||
@@ -29,7 +29,14 @@ public class QuickLoginUser : MonoBehaviour
|
||||
});
|
||||
//transform.GetComponent<Button>().onClick.AddListener();
|
||||
this.user = user;
|
||||
Utils.DisplayImage(StartCoroutine, transform.Find("Avatar").GetComponent<RawImage>(),user.Avatar);
|
||||
if (!string.IsNullOrEmpty(user.Avatar))
|
||||
{
|
||||
Utils.DisplayImage(StartCoroutine, transform.Find("Avatar").GetComponent<RawImage>(), user.Avatar);
|
||||
}
|
||||
else
|
||||
{
|
||||
transform.Find("Avatar").GetComponent<RawImage>().texture = Resources.Load<Texture>("Images/icon-1024");
|
||||
}
|
||||
transform.Find("NickNameText").GetComponent<Text>().text = user.NickName;
|
||||
UIManager.AddEvent(transform.Find("BtnDelete").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
|
||||
@@ -10,11 +10,11 @@ public class MainNav : MonoBehaviour
|
||||
private GameObject home;
|
||||
private void Awake()
|
||||
{
|
||||
var material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
|
||||
//var material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
|
||||
|
||||
var rect = ((RectTransform)this.transform).rect;
|
||||
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height, 0));
|
||||
this.GetComponent<Image>().material = material;
|
||||
//var rect = ((RectTransform)this.transform).rect;
|
||||
//material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height, 0));
|
||||
//this.GetComponent<Image>().material = material;
|
||||
|
||||
var device = this.transform.Find("Device");
|
||||
UIManager.AddEvent(device.gameObject, EventTriggerType.PointerClick, x =>
|
||||
|
||||
@@ -100,8 +100,8 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,
|
||||
|
||||
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";
|
||||
props.Find("DistanceText").GetComponent<Text>().text = $"{myMap.Distance.ToString(myMap.Distance>1000? "#0" : "#0.00")}KM";
|
||||
props.Find("EleText").GetComponent<Text>().text = $"{(myMap.TotalClimb ?? 0.0).ToString(myMap.TotalClimb > 1000 ? "#0" : "#0.00")}M";
|
||||
props.Find("SlopeText").GetComponent<Text>().text = $"{myMap.AverageGrade.ToString("#0.00")}%";
|
||||
props.Find("rideText").GetComponent<Text>().text = myMap.TheHeat.ToString();
|
||||
var tabContainer = transform.Find("TabContainer");
|
||||
|
||||
@@ -13,6 +13,6 @@ public class RotateBg : MonoBehaviour
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
transform.Rotate(new Vector3(0,0,-Time.deltaTime * 1/3));
|
||||
transform.Rotate(new Vector3(0,0,-Time.deltaTime * 1/4));
|
||||
}
|
||||
}
|
||||
@@ -22,14 +22,15 @@ public class NewsController : PFUIPanel
|
||||
Get();
|
||||
}
|
||||
Transform content,exit;
|
||||
async void Get()
|
||||
void Get()
|
||||
{
|
||||
var r = await ConfigHelper.userApi.GetNotify();
|
||||
if (r.result)
|
||||
{
|
||||
content.GetComponent<Text>().text = r.data.Value<string>("Content");
|
||||
//content.GetComponent<Text>().text
|
||||
}
|
||||
//var r = await ConfigHelper.userApi.GetNotify();
|
||||
//if (r.result)
|
||||
//{
|
||||
// content.GetComponent<Text>().text = r.data.Value<string>("Content");
|
||||
// //content.GetComponent<Text>().text
|
||||
//}
|
||||
content.GetComponent<Text>().text = App.notifyContent;
|
||||
}
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
|
||||
@@ -19,6 +19,8 @@ public class DeviceController : PFUIPanel
|
||||
private Sprite circuloCarga;
|
||||
private Sprite circuloCompleto;
|
||||
RectTransform circulo;
|
||||
private GameObject statusText;
|
||||
|
||||
private bool _available = false;
|
||||
private bool Available
|
||||
{
|
||||
@@ -37,6 +39,8 @@ public class DeviceController : PFUIPanel
|
||||
//circulo.gameObject.SetActive(false);
|
||||
DOTween.Kill(circulo, false);
|
||||
circulo.GetComponent<Image>().sprite = circuloCompleto;
|
||||
|
||||
ShowStatusText("ANT+ Connected");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -44,6 +48,8 @@ public class DeviceController : PFUIPanel
|
||||
//circulo.gameObject.SetActive(true);
|
||||
circulo.GetComponent<Image>().sprite = circuloCarga;
|
||||
circulo.DOLocalRotate(new Vector3(0, 0, 360), 1f, RotateMode.FastBeyond360).SetEase(Ease.Linear).SetLoops(-1);
|
||||
|
||||
ShowStatusText("ANT+ Disconnect");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,6 +86,10 @@ public class DeviceController : PFUIPanel
|
||||
var bg = this.transform.Find("Status").Find("Bg");
|
||||
antStatus = bg.Find("Ant+").GetComponent<Image>();
|
||||
|
||||
statusText = this.transform.Find("Status").Find("GameObject").gameObject;
|
||||
statusText.SetActive(false);
|
||||
|
||||
|
||||
circulo = bg.Find("Image").GetComponent<RectTransform>();
|
||||
//circulo.DORotate(new Vector3(0, 0, 360), 1.5f, RotateMode.Fast).SetLoops(-1);
|
||||
circulo.DOLocalRotate(new Vector3(0, 0, 360), 1f, RotateMode.FastBeyond360).SetEase(Ease.Linear).SetLoops(-1);
|
||||
@@ -126,4 +136,14 @@ public class DeviceController : PFUIPanel
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void ShowStatusText(string text)
|
||||
{
|
||||
statusText.transform.Find("Text").GetComponent<Text>().text = text;
|
||||
statusText.GetComponent<CanvasGroup>().alpha = 0;
|
||||
statusText.SetActive(true);
|
||||
statusText.GetComponent<CanvasGroup>().DOFade(1f, 0.1f).OnComplete(()=> {
|
||||
statusText.GetComponent<CanvasGroup>().DOFade(0f, 0.3f).SetDelay(3f);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -19,14 +19,15 @@ public class EarthController : PFUIPanel
|
||||
private Text CountText;
|
||||
private Text OfficialText;
|
||||
private Text RiderText;
|
||||
private GameObject hotPanel;
|
||||
private GameObject content;
|
||||
private Object itemObject;
|
||||
//private GameObject hotPanel;
|
||||
//private GameObject content;
|
||||
//private Object itemObject;
|
||||
Transform rootPanel;
|
||||
Canvas canvas;
|
||||
float time = 0f;
|
||||
bool showSummary = false;
|
||||
Vector2 latlonCenter;
|
||||
private GameObject panel;
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
@@ -40,40 +41,41 @@ public class EarthController : PFUIPanel
|
||||
map = WorldMapGlobe.instance;
|
||||
map.showProvinces = true;
|
||||
map.showCities = true;
|
||||
map.autoRotationSpeed = 0f;
|
||||
//map.autoRotationSpeed = 0f;
|
||||
|
||||
//map.autoRotationSpeed = 0.1f;
|
||||
//Camera.main.fieldOfView = 180;
|
||||
|
||||
map.SetZoomLevel(1.4f);
|
||||
//map.allowUserZoom = false;
|
||||
map.showLatitudeLines = false;
|
||||
map.showLongitudeLines = false;
|
||||
map.showCursor = false;
|
||||
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
protected override void Start()
|
||||
{
|
||||
itemObject = Resources.Load("UI/Prefab/BigMap/Item");
|
||||
//itemObject = Resources.Load("UI/Prefab/BigMap/Item");
|
||||
|
||||
var panel = rootPanel.Find("Panel");
|
||||
panel = rootPanel.Find("Panel").gameObject;
|
||||
SetRounded(panel.transform, 60);
|
||||
panel.gameObject.SetActive(false);
|
||||
|
||||
SetRounded(panel, 60);
|
||||
|
||||
hotPanel = rootPanel.Find("HotPanel").gameObject;
|
||||
SetRounded(hotPanel.transform, 60);
|
||||
|
||||
maskImage = rootPanel.Find("MaskImage").GetComponent<RawImage>();
|
||||
|
||||
Country = panel.Find("Country").GetComponent<Text>();
|
||||
Province = panel.Find("Province").GetComponent<Text>();
|
||||
CountText = panel.Find("CountPanel").Find("Count").GetComponent<Text>();
|
||||
OfficialText = panel.Find("OfficialPanel").Find("Count").GetComponent<Text>();
|
||||
RiderText = panel.Find("RiderPanel").Find("Count").GetComponent<Text>();
|
||||
Country = panel.transform.Find("Country").GetComponent<Text>();
|
||||
Province = panel.transform.Find("Province").GetComponent<Text>();
|
||||
CountText = panel.transform.Find("CountPanel").Find("Count").GetComponent<Text>();
|
||||
OfficialText = panel.transform.Find("OfficialPanel").Find("Count").GetComponent<Text>();
|
||||
RiderText = panel.transform.Find("RiderPanel").Find("Count").GetComponent<Text>();
|
||||
|
||||
content = hotPanel.transform.Find("Scroll View").Find("Viewport").Find("Content").gameObject;
|
||||
//map.SetZoomLevel(10);
|
||||
//hotPanel = rootPanel.Find("HotPanel").gameObject;
|
||||
//SetRounded(hotPanel.transform, 60);
|
||||
//content = hotPanel.transform.Find("Scroll View").Find("Viewport").Find("Content").gameObject;
|
||||
|
||||
|
||||
|
||||
//var mainCanvas = GameObject.Find("Canvas");
|
||||
//mainCanvas.gameObject.SetActive(false);
|
||||
@@ -82,10 +84,10 @@ public class EarthController : PFUIPanel
|
||||
Camera.main.transform.position = new Vector3(0, 0);
|
||||
Camera.main.transform.rotation = Quaternion.Euler(0, 0, 0);
|
||||
|
||||
|
||||
|
||||
var zoom = map.GetZoomLevel();
|
||||
|
||||
map.SetZoomLevel(1.43f);
|
||||
//var zoom = map.GetZoomLevel();
|
||||
//Debug.Log(zoom);
|
||||
map.OnZoomStart += Map_OnZoomStart;
|
||||
map.OnZoomEnd += Map_OnZoomEnd;
|
||||
|
||||
@@ -93,6 +95,7 @@ public class EarthController : PFUIPanel
|
||||
|
||||
map.OnCountryEnter += (int countryIndex, int regionIndex) =>
|
||||
{
|
||||
map.autoRotationSpeed = 0f;
|
||||
var country = map.countries[countryIndex];
|
||||
if (country.name.ToLower().Contains("taiwan"))
|
||||
{
|
||||
@@ -144,6 +147,13 @@ public class EarthController : PFUIPanel
|
||||
/// <param name="latlonCenter"></param>
|
||||
private async void ShowSummary(Vector2 latlonCenter)
|
||||
{
|
||||
if(panel.activeInHierarchy == false)
|
||||
{
|
||||
panel.SetActive(true);
|
||||
panel.GetComponent<CanvasGroup>().alpha = 0;
|
||||
panel.GetComponent<CanvasGroup>().DOFade(1f, 0.1f);
|
||||
}
|
||||
|
||||
var result = await mapApi.GetEarthData(latlonCenter.x, latlonCenter.y);
|
||||
if (result.result == false)
|
||||
{
|
||||
@@ -155,29 +165,26 @@ public class EarthController : PFUIPanel
|
||||
OfficialText.text = obj.Value<string>("officialCount");
|
||||
RiderText.text = obj.Value<string>("riderCount");
|
||||
|
||||
//for (int i = 0; i < content.transform.childCount; i++)
|
||||
|
||||
//foreach (Transform item in content.transform)
|
||||
//{
|
||||
// DestroyImmediate(content.transform.GetChild(i));
|
||||
//}
|
||||
foreach (Transform item in content.transform)
|
||||
{
|
||||
GameObject.Destroy(item.gameObject);
|
||||
}
|
||||
// GameObject.Destroy(item.gameObject);
|
||||
//}
|
||||
|
||||
|
||||
var list = JArray.FromObject(obj["list"]);
|
||||
foreach (var item in list)
|
||||
{
|
||||
var itemObject1 = (GameObject)Instantiate(itemObject, content.transform, false);
|
||||
var iii = itemObject1.GetComponent<Item>();
|
||||
iii.SetModel(new Assets.Scripts.Apis.Models.NearRouteModel
|
||||
{
|
||||
Id = item.Value<int>("Id"),
|
||||
Name = item.Value<string>("Name"),
|
||||
TheHeat = item.Value<int>("TheHat"),
|
||||
IsFire = item.Value<bool>("IsFire")
|
||||
});
|
||||
}
|
||||
//var list = JArray.FromObject(obj["list"]);
|
||||
//foreach (var item in list)
|
||||
//{
|
||||
// var itemObject1 = (GameObject)Instantiate(itemObject, content.transform, false);
|
||||
// var iii = itemObject1.GetComponent<Item>();
|
||||
// iii.SetModel(new Assets.Scripts.Apis.Models.NearRouteModel
|
||||
// {
|
||||
// Id = item.Value<int>("Id"),
|
||||
// Name = item.Value<string>("Name"),
|
||||
// TheHeat = item.Value<int>("TheHat"),
|
||||
// IsFire = item.Value<bool>("IsFire")
|
||||
// });
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
@@ -187,6 +194,8 @@ public class EarthController : PFUIPanel
|
||||
/// <param name="latLon"></param>
|
||||
private void EnterBigMap(Vector2 latLon)
|
||||
{
|
||||
Debug.Log("enter big map");
|
||||
|
||||
map.FlyToLocation(latLon.x, latLon.y, 1f, 0.1f).Then(() => {
|
||||
//Close();
|
||||
|
||||
@@ -223,7 +232,7 @@ public class EarthController : PFUIPanel
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
//var zoom = map.GetZoomLevel();
|
||||
var zoom = map.GetZoomLevel();
|
||||
//Debug.Log(zoom);
|
||||
|
||||
if (showSummary)
|
||||
|
||||
@@ -189,6 +189,10 @@ public class EditUserController : PFUIPanel
|
||||
{
|
||||
Utils.DisplayImage(StartCoroutine, mHeadImage, currentUser.WxHeadImg);
|
||||
}
|
||||
else
|
||||
{
|
||||
mHeadImage.texture = Resources.Load<Texture>("Images/icon-1024");
|
||||
}
|
||||
if (currentUser.Sex == 1)
|
||||
{
|
||||
mSexDropdown.SelectValue("男");
|
||||
@@ -250,7 +254,11 @@ public class EditUserController : PFUIPanel
|
||||
}
|
||||
private void Switch(BaseEventData arg0)
|
||||
{
|
||||
SceneManager.LoadScene("1-Login");
|
||||
UIManager.ShowConfirm("Logout", "Do you want to log out and change accounts?", () =>
|
||||
{
|
||||
SceneManager.LoadScene("1-Login");
|
||||
UIManager.CloseConfirm();
|
||||
});
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
@@ -279,66 +287,67 @@ public class EditUserController : PFUIPanel
|
||||
|
||||
void Save(BaseEventData e)
|
||||
{
|
||||
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();
|
||||
});
|
||||
|
||||
//UIManager.ShowConfirm("Confirm", "Are you sure to edit?", SaveFunc);
|
||||
SaveFunc();
|
||||
//App.CurrentUser = user;
|
||||
|
||||
//UIManager.ShowAlert("result.errMsg");
|
||||
}
|
||||
async void SaveFunc()
|
||||
{
|
||||
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();
|
||||
}
|
||||
async void ChangeAvatar(string path)
|
||||
{
|
||||
var r = await userApi.Update(App.CurrentUser, path);
|
||||
@@ -366,18 +375,19 @@ public class EditUserController : PFUIPanel
|
||||
}
|
||||
void Cancel(BaseEventData e)
|
||||
{
|
||||
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();
|
||||
});
|
||||
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();
|
||||
}
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// UIManager.ShowPrePanel();
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -104,8 +104,15 @@ public class HomeController : PFUIPanel
|
||||
{
|
||||
userInfo.Find("SexIcon").GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/man");
|
||||
}
|
||||
Utils.DisplayImage(StartCoroutine, userInfo.Find("Avatar").GetComponent<RawImage>(), App.CurrentUser.WxHeadImg);
|
||||
|
||||
if (!string.IsNullOrEmpty(App.CurrentUser.WxHeadImg))
|
||||
{
|
||||
Utils.DisplayImage(StartCoroutine, userInfo.Find("Avatar").GetComponent<RawImage>(), App.CurrentUser.WxHeadImg);
|
||||
}
|
||||
else
|
||||
{
|
||||
userInfo.Find("Avatar").GetComponent<RawImage>().texture = Resources.Load<Texture>("Images/icon-1024");
|
||||
}
|
||||
|
||||
userInfo.Find("Country").GetComponent<RawImage>().texture = UIManager.Instance.loginRegOptions.GetCountryImageByName(App.CurrentUser.Country);
|
||||
userInfo.Find("CaloriesContainer").Find("CaloriesValue").GetComponent<Text>().text = double.Parse(summary.Kcal).ToString("0") +" KCAL";
|
||||
userInfo.Find("KMContainer").Find("KMValue").GetComponent<Text>().text = summary.TotalDistance.ToString("0") +" KM";
|
||||
@@ -113,8 +120,10 @@ public class HomeController : PFUIPanel
|
||||
|
||||
userInfo.Find("GroupTop").Find("FtpContainer").Find("FtpTime").GetComponent<Text>().text = App.CurrentUser.LastUpdateFtpTime.ToString("yyyy.MM.dd");
|
||||
userInfo.Find("GroupTop").Find("WeightContainer").Find("WeightTime").GetComponent<Text>().text = App.CurrentUser.LastUpdateWeightTime.ToString("yyyy.MM.dd");
|
||||
|
||||
|
||||
userInfo.Find("GroupTop").Find("WKGContainer").Find("WKGTime").GetComponent<Text>().text =
|
||||
DateTime.Compare(App.CurrentUser.LastUpdateFtpTime, App.CurrentUser.LastUpdateWeightTime)>0
|
||||
? App.CurrentUser.LastUpdateFtpTime.ToString("yyyy.MM.dd")
|
||||
: App.CurrentUser.LastUpdateWeightTime.ToString("yyyy.MM.dd");
|
||||
}
|
||||
void GetSummary()
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@ public class MapDetailController : PFUIPanel
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.showToast(gameObject, r.errMsg, 1);
|
||||
Utils.showToast(gameObject, r.errMsg);
|
||||
}
|
||||
}
|
||||
if (transform.Find("BtnGoRide") != null)
|
||||
|
||||
@@ -30,7 +30,11 @@ public class UserInfoController : PFUIPanel
|
||||
UIManager.AddEvent(transform.Find("InfoPanel").Find("SwitchAccountButton").gameObject,
|
||||
EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
SceneManager.LoadScene("1-Login");
|
||||
UIManager.ShowConfirm("Logout", "Do you want to log out and change accounts?", () =>
|
||||
{
|
||||
SceneManager.LoadScene("1-Login");
|
||||
UIManager.CloseConfirm();
|
||||
});
|
||||
});
|
||||
infoPanel = transform.Find("InfoPanel").Find("P");
|
||||
|
||||
@@ -70,7 +74,15 @@ public class UserInfoController : PFUIPanel
|
||||
{
|
||||
var summary = r.data;
|
||||
var user = App.CurrentUser;
|
||||
Utils.DisplayImage(StartCoroutine, infoPanel.Find("Avatar").GetComponent<RawImage>(), user.WxHeadImg);
|
||||
if (!string.IsNullOrEmpty(user.WxHeadImg))
|
||||
{
|
||||
Utils.DisplayImage(StartCoroutine, infoPanel.Find("Avatar").GetComponent<RawImage>(), user.WxHeadImg);
|
||||
}
|
||||
else
|
||||
{
|
||||
infoPanel.Find("Avatar").GetComponent<RawImage>().texture = Resources.Load<Texture>("Images/icon-1024");
|
||||
}
|
||||
|
||||
infoPanel.Find("Status").Find("Country").GetComponent<RawImage>().texture
|
||||
= UIManager.Instance.loginRegOptions.GetCountryImageByName(user.Country);
|
||||
infoPanel.Find("Status").Find("Wx").gameObject.SetActive(
|
||||
@@ -84,11 +96,11 @@ 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";
|
||||
infoPanel.Find("Ftp").Find("Time").GetComponent<Text>().text = user.LastUpdateFtpTime.ToString("yyyy-MM-dd");
|
||||
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.LastUpdateWheelStraight.ToString("yyyy-MM-dd");
|
||||
infoPanel.Find("MHR").Find("Time").GetComponent<Text>().text = user.LastUpdateMaxHeartRate.ToString("yyyy-MM-dd");
|
||||
if (user.Sex == 2)
|
||||
{
|
||||
infoPanel.Find("SexIcon").GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/woman");
|
||||
|
||||
Reference in new issue
Block a user