diff --git a/Assets/Resources/UI/Prefab/Panel/UserInfoPanel.prefab b/Assets/Resources/UI/Prefab/Panel/UserInfoPanel.prefab index 4d1ba6b1..1206fb4a 100644 --- a/Assets/Resources/UI/Prefab/Panel/UserInfoPanel.prefab +++ b/Assets/Resources/UI/Prefab/Panel/UserInfoPanel.prefab @@ -928,9 +928,9 @@ RectTransform: m_Father: {fileID: 4994020441666303640} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 20, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 20, y: -9} m_SizeDelta: {x: 0, y: 16} m_Pivot: {x: 0.5, y: 1} --- !u!222 &2056250778738691887 @@ -4912,7 +4912,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &7594246243354940095 RectTransform: m_ObjectHideFlags: 0 @@ -5080,7 +5080,7 @@ RectTransform: m_AnchorMin: {x: 0.5, y: 1} m_AnchorMax: {x: 0.5, y: 1} m_AnchoredPosition: {x: 0, y: -50} - m_SizeDelta: {x: 0, y: 34} + m_SizeDelta: {x: 40, y: 34} m_Pivot: {x: 0.5, y: 1} --- !u!222 &7250984511205769639 CanvasRenderer: diff --git a/Assets/Resources/UI/Prefab/Race/ItemSmall.prefab b/Assets/Resources/UI/Prefab/Race/ItemSmall.prefab index 1e48da9f..ced4c38d 100644 --- a/Assets/Resources/UI/Prefab/Race/ItemSmall.prefab +++ b/Assets/Resources/UI/Prefab/Race/ItemSmall.prefab @@ -1593,8 +1593,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 1} m_AnchorMax: {x: 0.5, y: 1} - m_AnchoredPosition: {x: 0, y: -205} - m_SizeDelta: {x: 190, y: 90} + m_AnchoredPosition: {x: 0, y: -215} + m_SizeDelta: {x: 210, y: 90} m_Pivot: {x: 0.5, y: 1} --- !u!222 &5521075339293163153 CanvasRenderer: diff --git a/Assets/Scripts/Apis/Models/UserResultModel.cs b/Assets/Scripts/Apis/Models/UserResultModel.cs index a970567b..237c9c7f 100644 --- a/Assets/Scripts/Apis/Models/UserResultModel.cs +++ b/Assets/Scripts/Apis/Models/UserResultModel.cs @@ -73,5 +73,6 @@ namespace Assets.Scripts.Apis.Models public DateTime LastUpdateWheelStraight { get; set; } public DateTime UpdateTime { get; set; } public string WebHost { get; set; }//创建比赛url + public bool CanCreateRace { get; set; }//是否可以创建比赛 } } diff --git a/Assets/Scripts/Apis/UserApi.cs b/Assets/Scripts/Apis/UserApi.cs index 2a1f7b41..f04fd7b6 100644 --- a/Assets/Scripts/Apis/UserApi.cs +++ b/Assets/Scripts/Apis/UserApi.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using UnityEngine; namespace Assets.Scripts.Apis { @@ -73,6 +74,7 @@ namespace Assets.Scripts.Apis user.Height = ret.data.Height; //todo: check local database, insert new user user.WebHost = ret.data.WebHost; + user.CanCreateRace = ret.data.CanCreateRace; //PubCommData.CurrentUser = user; user.cookie = cookies[0].Value; return new JsonResult() { result = true, data = user }; @@ -244,8 +246,9 @@ namespace Assets.Scripts.Apis { return await GetAsync>("home/getversions"); } - public JsonResult Update(UserResultModel currUser, string filePath = "") + public JsonResult Update(UserResultModel currUser, out string cookie, string filePath = "") { + cookie = App.CurrentUser.cookie; //return await PostAsync>("User/UpdateUserSetting", new { // UID = currUser.Id, // Sex = currUser.Sex, @@ -296,7 +299,7 @@ namespace Assets.Scripts.Apis currUser.Birthday //imgData = imgData }, files); - + Debug.Log(cookie); return Newtonsoft.Json.JsonConvert.DeserializeObject>(res); } public async Task> GetNotify() diff --git a/Assets/Scripts/Scenes/LoginController.cs b/Assets/Scripts/Scenes/LoginController.cs index e9b23b84..066415d1 100644 --- a/Assets/Scripts/Scenes/LoginController.cs +++ b/Assets/Scripts/Scenes/LoginController.cs @@ -859,7 +859,7 @@ public class LoginController : MonoBehaviour { userResult.Nickname = userResult.Phone; } - var r = ConfigHelper.userApi.Update(userResult); + var r = ConfigHelper.userApi.Update(userResult,out string cookie,""); return r.result; //userResult.Birthday.v } diff --git a/Assets/Scripts/UI/Prefab/Panel/EditUserController.cs b/Assets/Scripts/UI/Prefab/Panel/EditUserController.cs index c469d544..faa794bb 100644 --- a/Assets/Scripts/UI/Prefab/Panel/EditUserController.cs +++ b/Assets/Scripts/UI/Prefab/Panel/EditUserController.cs @@ -329,7 +329,7 @@ public class EditUserController : PFUIPanel user.Contact = mName.Text; user.ContactPhone = mPhone.Text; user.ContactAddress = mAddr.Text; - var result = userApi.Update(user); + var result = userApi.Update(user, out string cookie,""); App.isChanged = false; if (result.result == false) { @@ -340,6 +340,7 @@ public class EditUserController : PFUIPanel else { App.CurrentUser = JObject.FromObject(result.data).ToObject(); + App.CurrentUser.cookie = cookie; if (App.CurrentUser.Birthday.HasValue) { App.CurrentUser.Birthday = App.CurrentUser.Birthday.Value.ToLocalTime(); @@ -359,7 +360,7 @@ public class EditUserController : PFUIPanel } void ChangeAvatar(string path) { - var r = userApi.Update(App.CurrentUser, path); + var r = userApi.Update(App.CurrentUser, out string cookie,path); App.isChanged = false; if (r.result) { @@ -374,6 +375,7 @@ public class EditUserController : PFUIPanel } Debug.Log(img); App.CurrentUser.WxHeadImg = img; + App.CurrentUser.cookie = cookie; Utils.showToast(gameObject, "Success", type: 1); //UIManager.ShowAlert(); } diff --git a/Assets/Scripts/UI/Prefab/Panel/HomeController.cs b/Assets/Scripts/UI/Prefab/Panel/HomeController.cs index 8e8b0585..982ba9cd 100644 --- a/Assets/Scripts/UI/Prefab/Panel/HomeController.cs +++ b/Assets/Scripts/UI/Prefab/Panel/HomeController.cs @@ -121,6 +121,7 @@ public class HomeController : PFUIPanel private void GoMatch(BaseEventData e) { UIManager.ShowRaceHomePanel(); + OnExit(e); } private void OnHover(BaseEventData e) { diff --git a/Assets/Scripts/UI/Prefab/Panel/UserInfoController.cs b/Assets/Scripts/UI/Prefab/Panel/UserInfoController.cs index 933493b5..aa439ef6 100644 --- a/Assets/Scripts/UI/Prefab/Panel/UserInfoController.cs +++ b/Assets/Scripts/UI/Prefab/Panel/UserInfoController.cs @@ -62,6 +62,7 @@ public class UserInfoController : PFUIPanel { Application.OpenURL(App.CurrentUser.WebHost + "#/Mine/EditMatch?Token=" + App.CurrentUser.cookie); }); + } public override void Show() { @@ -84,6 +85,7 @@ public class UserInfoController : PFUIPanel { var summary = r.data; var user = App.CurrentUser; + Debug.Log(user.CanCreateRace); Utils.DisplayHead(infoPanel.Find("Avatar").GetComponent(), user.WxHeadImg); infoPanel.Find("Status").Find("Country").GetComponent().texture @@ -117,6 +119,7 @@ public class UserInfoController : PFUIPanel summaryPanel.Find("KM").Find("Value").GetComponent().text = summary.TotalDistance.ToString(); summaryPanel.Find("Climb").Find("Value").GetComponent().text = summary.TotalClimb.ToString(); summaryPanel.Find("Calories").Find("Value").GetComponent().text = summary.TotalKj.ToString(); + summaryPanel.Find("CreateBtn").gameObject.SetActive(user.CanCreateRace); } }