登录页调整 增加半圆角组件 基本完成路线列表功能 基本完成骑行列表 开始做编辑页
This commit is contained in:
1 parent
5156473bb2
commit
10e738f958
100 files changed
+20085
-11852
No files matched your search
@@ -55,9 +55,9 @@ namespace Assets.Scripts.Apis
|
||||
/// <param name="sort">hot, distance</param>
|
||||
/// <param name="sortDire">asc</param>
|
||||
/// <returns></returns>
|
||||
public JsonResult<List<MapRoute>> GetList(int pageIndex, int pageSize, string name, string distance="", string hands="", bool is3D=false, string sort="", string sortDire = "")
|
||||
public JsonResult<List<MapRoute>> GetList(int pageIndex, int pageSize, string name, string distance="", string hands="", bool is3D=false, string sort="", string sortDire = "", bool isFav = false)
|
||||
{
|
||||
var url = $"Map/GetRoute?pageIndex={ pageIndex }&pageSize={ pageSize }&name={ name }&distance={ distance }&hands={ hands }&is3D={ is3D }&sort={ sort }&sortDire={ sortDire }";
|
||||
var url = $"Map/GetRoute?pageIndex={ pageIndex }&pageSize={ pageSize }&name={ name }&distance={ distance }&hands={ hands }&is3D={ is3D }&sort={ sort }&sortDire={ sortDire }&isFav={isFav}";
|
||||
|
||||
return Get<JsonResult<List<MapRoute>>>(url);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Assets.Scripts.Apis
|
||||
{
|
||||
@@ -21,5 +23,28 @@ namespace Assets.Scripts.Apis
|
||||
var jsonResult = JsonConvert.DeserializeObject<JsonResult<AddMapRecordResultModel>>(result);
|
||||
return jsonResult;
|
||||
}
|
||||
|
||||
public JsonResult<List<RouteResult>> GetMapInterruptRecord(string keyword, int pageIndex, int pageSize)
|
||||
{
|
||||
var result = new JsonResult<List<RouteResult>>()
|
||||
{
|
||||
result = false,
|
||||
data = null,
|
||||
errMsg = ""
|
||||
};
|
||||
try
|
||||
{
|
||||
var r = Get<List<RouteResult>>($"MapRecord/GetMapInterruptRecord?keyword={keyword}&pageIndex={pageIndex}&pageSize={pageSize}");
|
||||
result.result = true;
|
||||
result.data = r;
|
||||
return result;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Log(e.ToString());
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -100,5 +100,7 @@ namespace Assets.Scripts.Apis.Models
|
||||
public bool IsFavorite { get; set; }
|
||||
|
||||
public bool Enable3D { get; set; }
|
||||
public int TheHeat { get; set; }
|
||||
public string Hard { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Assets.Scripts.Apis.Models
|
||||
{
|
||||
public class RouteResultParam
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int? OnlineUserId { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ContinueMark { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int? ContinueIndex { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int? RouteId { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int? CompetitionId { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public double EndDistance { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string RankingsId { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string GlobalContinue { get; set; }
|
||||
}
|
||||
public class RouteResult
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Id { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int RankingId { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string IsCompleted { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string IsDelete { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ManufacturerName { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int MapCompetitionId { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public List<double> Point { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public double Progress { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int RouteId { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string RouteImage { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string RouteName { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public double TotalDistance { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int Ticks { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string TrainingTime { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int UserId { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public double EndDistance { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Mode { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public double TripDistance { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string CanAgain { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public RouteResultParam Param { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string CanContinueCycling { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public RouteResultParam ContinueCyclingParam { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Address { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int Count { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string CyclingEquipmentName { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string CanDelete { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int Ranking { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public double CurrentRouteStartDistance { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string CanShareOnStrava { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 20fedef2ea43f1749a5492c955936068
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -115,9 +115,9 @@ namespace Assets.Scripts.Apis
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
public async Task<JsonResult<object>> GetCaptcha(string phone)
|
||||
public async Task<JsonResult<JObject>> GetCaptcha(string phone)
|
||||
{
|
||||
return await PostAsync<JsonResult<object>>("NoAuth/v1/GetCaptcha",new {phone });
|
||||
return await PostAsync<JsonResult<JObject>>("NoAuth/v1/GetCaptcha",new {phone });
|
||||
}
|
||||
public async Task<JsonResult<object>> UpdateUserInfo(UserResultModel user)
|
||||
{
|
||||
@@ -127,6 +127,10 @@ namespace Assets.Scripts.Apis
|
||||
{
|
||||
return Get<JsonResult<JObject>>("User/GetCurrentUser");
|
||||
}
|
||||
public async Task<JsonResult<UserResultModel>> QuickLogin()
|
||||
{
|
||||
return await PostAsync<JsonResult<UserResultModel>>("NoAuth/QuickLogin",null);
|
||||
}
|
||||
|
||||
public async Task<JsonResult<object>> OnWebWxLoginCheckUnionId(string unionId, string openId)
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ using UnityEngine;
|
||||
|
||||
public static class App
|
||||
{
|
||||
public static string Host = "http://192.168.0.97:5082/";
|
||||
public static string Host = "http://192.168.0.101:5087/";
|
||||
|
||||
public static string AppVersion = "1.0.0";
|
||||
|
||||
|
||||
@@ -27,6 +27,11 @@ public class QUserInfo
|
||||
public string Avatar { get; set; }
|
||||
public string Cookie { get; set; }
|
||||
}
|
||||
public class LoginForm
|
||||
{
|
||||
public InputField email { get; set; }
|
||||
public InputField password { get; set; }
|
||||
}
|
||||
public class SignForm
|
||||
{
|
||||
//页面1
|
||||
@@ -46,31 +51,32 @@ public class SignForm
|
||||
}
|
||||
public class LoginController : MonoBehaviour
|
||||
{
|
||||
[SerializeField] InputField[] loginForm;
|
||||
[SerializeField] Button login;
|
||||
[SerializeField] Button loginNewAccount;
|
||||
private Transform mainContent;
|
||||
/*初始页面*/
|
||||
private Transform quickContainer;
|
||||
private Transform loginContainer;
|
||||
private Transform signContainer;
|
||||
/*初始页面*/
|
||||
LoginForm loginForm;
|
||||
[SerializeField] Button loginReturn2;
|
||||
[SerializeField] Button returnQuick;
|
||||
[SerializeField] Button sign;
|
||||
[SerializeField] Button remember;
|
||||
[SerializeField] Button wechatLogin;
|
||||
private Button remember;
|
||||
/*滑动相关*/
|
||||
[SerializeField] GameObject loginScrollView;
|
||||
[SerializeField] GameObject signScrollView;
|
||||
[SerializeField] GameObject avatarScrollView;
|
||||
/*滑动相关*/
|
||||
//注册
|
||||
private Transform signPage1;
|
||||
private Transform signPage2;
|
||||
private Transform signScrollBar;
|
||||
private SignForm signForm;
|
||||
private LoginRegOptions regOptions;
|
||||
[SerializeField] GameObject avatarScrollView;
|
||||
[SerializeField] RawImage loading;
|
||||
[SerializeField] Button exit;
|
||||
|
||||
private ScrollRect scrollPanel;
|
||||
private ScrollRect scrollSign;
|
||||
private ScrollRect scrollAvatar;
|
||||
private Transform imagexf;
|
||||
private Transform mainContent;
|
||||
//注册主页面
|
||||
private Transform signContainer;
|
||||
private UserResultModel userResult;
|
||||
/*微信相关*/
|
||||
private Browser wxBrowser;
|
||||
@@ -81,8 +87,13 @@ public class LoginController : MonoBehaviour
|
||||
private JObject wxInfoJson;
|
||||
private bool wxLock;
|
||||
/*微信相关*/
|
||||
|
||||
private List<QUserInfo> userInfos;
|
||||
|
||||
/*退出按钮*/
|
||||
[SerializeField] Button exit;
|
||||
/*退出按钮*/
|
||||
//其他
|
||||
[SerializeField] RawImage loading;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
@@ -92,24 +103,21 @@ public class LoginController : MonoBehaviour
|
||||
//userInfos.RemoveAt(0);
|
||||
//PlayerPrefs.SetString("UserInfos", "");
|
||||
//transform.Find("RawImage").DOMove(new Vector3(0.5f,0.5f,0),1);
|
||||
if (loginForm.Length == 2 && loginForm[0] != null && loginForm[1] != null)
|
||||
{
|
||||
foreach (var ipt in loginForm)
|
||||
{
|
||||
UIManager.AddEvent(ipt.gameObject, EventTriggerType.PointerClick, new UnityAction<BaseEventData>
|
||||
((BaseEventData arg0) => { OnLoginInputSelect(arg0, ipt.gameObject); }));
|
||||
UIManager.AddEvent(ipt.gameObject, EventTriggerType.Select, new UnityAction<BaseEventData>
|
||||
((BaseEventData arg0) => { OnLoginInputSelect(arg0, ipt.gameObject); }));
|
||||
UIManager.AddEvent(ipt.gameObject, EventTriggerType.Deselect, new UnityAction<BaseEventData>
|
||||
((BaseEventData arg0) => { OnLoginInputDeSelect(arg0, ipt.gameObject); }));
|
||||
}
|
||||
//loginForm[0].
|
||||
}
|
||||
if (login != null)
|
||||
{
|
||||
login.onClick.AddListener(Submit);
|
||||
//login.onClick.AddListener(Submit);
|
||||
}
|
||||
|
||||
//if (loginForm.Length == 2 && loginForm[0] != null && loginForm[1] != null)
|
||||
//{
|
||||
// foreach (var ipt in loginForm)
|
||||
// {
|
||||
// UIManager.AddEvent(ipt.gameObject, EventTriggerType.PointerClick, new UnityAction<BaseEventData>
|
||||
// ((BaseEventData arg0) => { OnLoginInputSelect(arg0, ipt.gameObject); }));
|
||||
// UIManager.AddEvent(ipt.gameObject, EventTriggerType.Select, new UnityAction<BaseEventData>
|
||||
// ((BaseEventData arg0) => { OnLoginInputSelect(arg0, ipt.gameObject); }));
|
||||
// UIManager.AddEvent(ipt.gameObject, EventTriggerType.Deselect, new UnityAction<BaseEventData>
|
||||
// ((BaseEventData arg0) => { OnLoginInputDeSelect(arg0, ipt.gameObject); }));
|
||||
// }
|
||||
// //loginForm[0].
|
||||
//}
|
||||
|
||||
if (loading != null)
|
||||
{
|
||||
loading.texture.wrapMode = TextureWrapMode.Repeat;
|
||||
@@ -118,6 +126,9 @@ public class LoginController : MonoBehaviour
|
||||
{
|
||||
scrollPanel = loginScrollView.GetComponent<ScrollRect>();
|
||||
mainContent = loginScrollView.transform.Find("Viewport").Find("Content");
|
||||
quickContainer = mainContent.Find("FormContainer-Quick");
|
||||
loginContainer = mainContent.Find("FormContainer-Login").Find("FormContainer");
|
||||
signContainer = mainContent.Find("FormContainer-Sign");
|
||||
}
|
||||
if (signScrollView != null)
|
||||
{
|
||||
@@ -208,29 +219,18 @@ public class LoginController : MonoBehaviour
|
||||
content.Find("empty2").transform.SetSiblingIndex(content.childCount-1);
|
||||
scrollAvatar.GetComponent<QuickLoginScroll>().Initial();
|
||||
}
|
||||
if (loginNewAccount != null)
|
||||
if (quickContainer != null)
|
||||
{
|
||||
var loginNewAccount = quickContainer.Find("loginNewAccount").GetComponent<Button>();
|
||||
loginNewAccount.onClick.AddListener(goLogin);
|
||||
}
|
||||
if (returnQuick != null)
|
||||
if (loginContainer != null)
|
||||
{
|
||||
var returnQuick = loginContainer.Find("returnQuick").GetComponent<Button>();
|
||||
returnQuick.onClick.AddListener(ReturnQuick);
|
||||
}
|
||||
if (sign != null)
|
||||
{
|
||||
sign.onClick.AddListener(()=>goSign());
|
||||
}
|
||||
if (loginReturn2 != null)
|
||||
{
|
||||
loginReturn2.onClick.AddListener(goLoginReturn2);
|
||||
}
|
||||
if (exit != null)
|
||||
{
|
||||
exit.onClick.AddListener(() => Application.Quit());
|
||||
}
|
||||
signContainer = mainContent.Find("FormContainer-Sign");
|
||||
if (remember != null)
|
||||
{
|
||||
var sign = loginContainer.Find("reg").GetComponent<Button>();
|
||||
sign.onClick.AddListener(() => goSign());
|
||||
remember = loginContainer.Find("rememberButton").GetComponent<Button>();
|
||||
remember.onClick.AddListener(() =>
|
||||
{
|
||||
var gou = remember.transform.Find("Gou");
|
||||
@@ -243,29 +243,49 @@ public class LoginController : MonoBehaviour
|
||||
gou.gameObject.SetActive(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (wechatLogin != null)
|
||||
{
|
||||
var wechatLogin = loginContainer.Find("otherContainer").Find("Wechat").GetComponent<Button>();
|
||||
wechatLogin.onClick.AddListener(() =>
|
||||
{
|
||||
if (wxLock) return;
|
||||
wxLock = true;
|
||||
|
||||
wxState = (DateTime.Now.ToUniversalTime().Ticks / 10000 * new System.Random().Next(1,5)).ToString();
|
||||
|
||||
wxState = (DateTime.Now.ToUniversalTime().Ticks / 10000 * new System.Random().Next(1, 5)).ToString();
|
||||
wxBrowser.Url = $"https://open.weixin.qq.com/connect/qrconnect?appid={App.WxAppId}&redirect_uri=https%3A%2F%2Fwx.powerfun.com.cn%2FNoAuth%2Fv1%2FWxWebLogin&response_type=code&scope=snsapi_login&state={wxState}#wechat_redirect";
|
||||
AdjustWxQrCode();
|
||||
//AdjustWxQrCode();
|
||||
var wx1 = mainContent.Find("FormContainer-Login").Find("FormContainer-wx1");
|
||||
wx1.gameObject.SetActive(true);
|
||||
Debug.Log(178+ "已经开启"+ wx1.gameObject.activeSelf);
|
||||
wx1.DOLocalMoveY(0, 0.3f).onComplete = ()=> { wxLock = false; };
|
||||
Debug.Log(178 + "已经开启" + wx1.gameObject.activeSelf);
|
||||
wx1.DOLocalMoveY(0, 0.3f).onComplete = () => { wxLock = false; };
|
||||
});
|
||||
var login = loginContainer.Find("login").GetComponent<Button>();
|
||||
login.onClick.AddListener(Submit);
|
||||
loginForm = new LoginForm()
|
||||
{
|
||||
email = loginContainer.Find("phone").GetComponent<InputField>(),
|
||||
password = loginContainer.Find("pwd").GetComponent<InputField>()
|
||||
};
|
||||
}
|
||||
//if (loginReturn2 != null)
|
||||
//{
|
||||
// loginReturn2.onClick.AddListener(goLoginReturn2);
|
||||
//}
|
||||
if (signContainer != null)
|
||||
{
|
||||
var loginr2 = signContainer.Find("loginr2").GetComponent<Button>();
|
||||
loginr2.onClick.AddListener(goLoginReturn2);
|
||||
}
|
||||
if (exit != null)
|
||||
{
|
||||
exit.onClick.AddListener(() => Application.Quit());
|
||||
}
|
||||
|
||||
wxLogin1 = mainContent.Find("FormContainer-Login").Find("FormContainer-wx1");
|
||||
if (wxLogin1 != null)
|
||||
{
|
||||
wxLogin1.Find("Image").GetComponent<Button>().onClick.AddListener(() =>
|
||||
{
|
||||
wxLock = true;
|
||||
wxBrowser.Url = "chrome://version/";
|
||||
wxLogin1.DOMoveY(-573, 0.8f).onComplete = () =>
|
||||
{
|
||||
wxLock = false;
|
||||
@@ -338,12 +358,11 @@ public class LoginController : MonoBehaviour
|
||||
});
|
||||
}
|
||||
imagexf = transform.Find("Panel").Find("LoginContainer").Find("Imagexf");
|
||||
|
||||
|
||||
}
|
||||
private void AdjustWxQrCode()
|
||||
{
|
||||
wxBrowser.EvalJS(@"
|
||||
console.log(document.getElementsByClassName('qrcode')[0]);
|
||||
document.getElementsByClassName('qrcode')[0].style.marginTop = 0;
|
||||
document.getElementsByClassName('title')[0].style.display = 'none';
|
||||
document.body.style.background = '#272732';
|
||||
@@ -397,12 +416,12 @@ public class LoginController : MonoBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
userResult = data.ToObject<UserResultModel>();
|
||||
RefreshWx3(data.ToObject<UserResultModel>());
|
||||
wxLogin3.gameObject.SetActive(true);
|
||||
Utils.DisplayImage(StartCoroutine,
|
||||
wxLogin3.Find("Avatar").GetComponent<RawImage>(),
|
||||
wxInfoJson.Value<string>("headimgurl"));
|
||||
wxLogin3.Find("NickName").GetComponent<Text>().text = wxInfoJson.Value<string>("nickname");
|
||||
//Utils.DisplayImage(StartCoroutine,
|
||||
//wxLogin3.Find("Avatar").GetComponent<RawImage>(),
|
||||
//wxInfoJson.Value<string>("headimgurl"));
|
||||
//wxLogin3.Find("NickName").GetComponent<Text>().text = wxInfoJson.Value<string>("nickname");
|
||||
signContainer.gameObject.SetActive(false);
|
||||
pageNums = 3;
|
||||
//this.goSign();
|
||||
@@ -444,6 +463,10 @@ public class LoginController : MonoBehaviour
|
||||
//Timer t = new Ti
|
||||
if (r.result)
|
||||
{
|
||||
if (r.data.Value<bool>("isExist") && pageNums == 5)
|
||||
{
|
||||
HidePassword();
|
||||
}
|
||||
time = 60;
|
||||
btnText.text = $"Again({time})";
|
||||
System.Timers.Timer timer = new System.Timers.Timer();
|
||||
@@ -461,6 +484,22 @@ public class LoginController : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
void HidePassword()
|
||||
{
|
||||
signPage1.Find("Password").gameObject.SetActive(false);
|
||||
signPage1.Find("CPassword").gameObject.SetActive(false);
|
||||
signPage1.Find("signThird").GetComponent<Button>().onClick.RemoveAllListeners();
|
||||
signPage1.Find("signThird").GetComponent<Button>().onClick.AddListener(goRegNextWithoutPass);
|
||||
}
|
||||
|
||||
|
||||
void ShowPassword()
|
||||
{
|
||||
signPage1.Find("Password").gameObject.SetActive(true);
|
||||
signPage1.Find("CPassword").gameObject.SetActive(true);
|
||||
signPage1.Find("signThird").GetComponent<Button>().onClick.RemoveAllListeners();
|
||||
signPage1.Find("signThird").GetComponent<Button>().onClick.AddListener(() => { goRegNext(1); });
|
||||
}
|
||||
void CaptchaTimerTick()
|
||||
{
|
||||
timer -= Time.deltaTime;
|
||||
@@ -507,6 +546,11 @@ public class LoginController : MonoBehaviour
|
||||
var Captcha = signForm.captcha;
|
||||
var Password = signForm.password;
|
||||
var CPassword = signForm.cpassword;
|
||||
if (Password.text != CPassword.text)
|
||||
{
|
||||
Utils.showToast(gameObject,"两次密码输入不一致");
|
||||
return;
|
||||
}
|
||||
//JsonConvert
|
||||
JsonResult<UserResultModel> r = null;
|
||||
if (signType == 0)
|
||||
@@ -526,14 +570,44 @@ public class LoginController : MonoBehaviour
|
||||
}
|
||||
if (r!=null && r.result)
|
||||
{
|
||||
RefreshWx3(r.data);
|
||||
StartScrollSign(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
StartScrollSign(1);
|
||||
//Utils.showToast(gameObject, r.errMsg, 1);
|
||||
Utils.showToast(gameObject, r.errMsg, 1);
|
||||
}
|
||||
}
|
||||
async void goRegNextWithoutPass()
|
||||
{
|
||||
var Email = signForm.email;
|
||||
var Captcha = signForm.captcha;
|
||||
var r = await ConfigHelper.userApi.OnWebWxLogin(Email.text,
|
||||
Captcha.text,
|
||||
wxInfoJson.Value<string>("unionid"),
|
||||
wxInfoJson.Value<string>("openid"),
|
||||
wxInfoJson.Value<string>("headimgurl"),
|
||||
wxInfoJson.Value<string>("nickname"),
|
||||
wxInfoJson.Value<int>("sex"),
|
||||
"");
|
||||
if (r.result)
|
||||
{
|
||||
RefreshWx3(r.data);
|
||||
StartScrollPanel(4);
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.showToast(gameObject, r.errMsg);
|
||||
}
|
||||
}
|
||||
void RefreshWx3(UserResultModel data)
|
||||
{
|
||||
Utils.DisplayImage(StartCoroutine,
|
||||
wxLogin3.Find("Avatar").GetComponent<RawImage>(),
|
||||
data.WxHeadImg);
|
||||
wxLogin3.Find("NickName").GetComponent<Text>().text = data.Nickname;
|
||||
userResult = data;
|
||||
}
|
||||
private void goRegEnd()
|
||||
{
|
||||
if (pageNums == 5)
|
||||
@@ -577,6 +651,7 @@ public class LoginController : MonoBehaviour
|
||||
signPage1.Find("next").gameObject.SetActive(false);
|
||||
signPage1.Find("previousThird").gameObject.SetActive(true);
|
||||
signPage1.Find("signThird").gameObject.SetActive(true);
|
||||
ShowPassword();
|
||||
this.StartScrollPanel(3);
|
||||
this.StartScrollSign(0);
|
||||
}
|
||||
@@ -588,6 +663,7 @@ public class LoginController : MonoBehaviour
|
||||
signPage1.Find("next").gameObject.SetActive(true);
|
||||
signPage1.Find("previousThird").gameObject.SetActive(false);
|
||||
signPage1.Find("signThird").gameObject.SetActive(false);
|
||||
ShowPassword();
|
||||
this.StartScrollPanel(2);
|
||||
this.StartScrollSign(0);
|
||||
}
|
||||
@@ -609,6 +685,7 @@ public class LoginController : MonoBehaviour
|
||||
});
|
||||
PlayerPrefs.SetString("UserInfos", JsonConvert.SerializeObject(userInfos));
|
||||
}
|
||||
App.CurrentUser = data;
|
||||
//App.CurrentUser = new UserModel
|
||||
//{
|
||||
// NickName = data.Nickname,
|
||||
@@ -624,19 +701,19 @@ public class LoginController : MonoBehaviour
|
||||
}
|
||||
async void Submit()
|
||||
{
|
||||
if (loginForm[0] == null || loginForm[1] == null)
|
||||
if (loginForm.email == null || loginForm.password == null)
|
||||
{
|
||||
Utils.showToast(gameObject, "未绑定", 1);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(loginForm[0].text) || string.IsNullOrEmpty(loginForm[1].text))
|
||||
if (string.IsNullOrEmpty(loginForm.email.text) || string.IsNullOrEmpty(loginForm.password.text))
|
||||
{
|
||||
Utils.showToast(gameObject, "请输入信息", 1);
|
||||
return;
|
||||
}
|
||||
//var res = await Global.userApi.Login(phone.text, pwd.text, "");
|
||||
//测试用
|
||||
var res = await ConfigHelper.userApi.Login(loginForm[0].text, loginForm[1].text, "");
|
||||
var res = await ConfigHelper.userApi.Login(loginForm.email.text, loginForm.password.text, "");
|
||||
//var res = await NoAuthApi.Login(phone.text, pwd.text);
|
||||
if (res.result)
|
||||
{
|
||||
@@ -652,9 +729,9 @@ public class LoginController : MonoBehaviour
|
||||
void Update()
|
||||
{
|
||||
//Debug.Log($"{phone.isFocused}, ${pwd != null}, ${Input.GetKeyDown(KeyCode.Tab)}");
|
||||
if (loginForm[0].isFocused && loginForm[1] != null && Input.GetKeyDown(KeyCode.Tab))
|
||||
if (Input.GetKeyDown(KeyCode.Tab) && loginForm !=null && loginForm.email.isFocused && loginForm.password != null)
|
||||
{
|
||||
loginForm[1].ActivateInputField();
|
||||
loginForm.password.ActivateInputField();
|
||||
}
|
||||
if (startCaptcha)
|
||||
{
|
||||
|
||||
@@ -21,10 +21,10 @@ namespace Assets.Scripts.UI.Prefab.Login
|
||||
}
|
||||
return op.options;
|
||||
}
|
||||
public static List<Dropdown.OptionData> dayOption28 = SetOptions(28);
|
||||
public static List<Dropdown.OptionData> dayOption29 = SetOptions(29);
|
||||
public static List<Dropdown.OptionData> dayOption30 = SetOptions(30);
|
||||
public static List<Dropdown.OptionData> dayOption31 = SetOptions(31);
|
||||
public static Dictionary<int, List<Dropdown.OptionData>> dayOption = new Dictionary<int, List<Dropdown.OptionData>>()
|
||||
{
|
||||
{28,SetOptions(28) },{29,SetOptions(29) },{30,SetOptions(30) },{31,SetOptions(31) }
|
||||
};
|
||||
}
|
||||
public class CountryModel
|
||||
{
|
||||
@@ -76,22 +76,8 @@ namespace Assets.Scripts.UI.Prefab.Login
|
||||
}
|
||||
public List<Dropdown.OptionData> GetDayOptions(int year,int month)
|
||||
{
|
||||
if (new int[] { 1, 3, 5, 7, 8, 10, 12 }.Contains(month))
|
||||
{
|
||||
return DayOptions.dayOption31;
|
||||
}
|
||||
else if (new int[] { 4, 6, 9, 11 }.Contains(month))
|
||||
{
|
||||
return DayOptions.dayOption30;
|
||||
}
|
||||
else if (month == 2)
|
||||
{
|
||||
return DateTime.IsLeapYear(year) ? DayOptions.dayOption29 : DayOptions.dayOption28;
|
||||
}
|
||||
else
|
||||
{
|
||||
return days;
|
||||
}
|
||||
int day = DateTime.DaysInMonth(year, month);
|
||||
return DayOptions.dayOption[day];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,16 +20,17 @@ public class QuickLoginUser : MonoBehaviour
|
||||
}
|
||||
public void Initial(QUserInfo user)
|
||||
{
|
||||
if (user ==null) return;
|
||||
transform.GetComponent<Button>().onClick.AddListener(() =>
|
||||
if (user == null) return;
|
||||
transform.GetComponent<Button>().onClick.AddListener(async () =>
|
||||
{
|
||||
ApiBase.SetCookie(user.Cookie);
|
||||
var r = ConfigHelper.userApi.GetUserInfo();
|
||||
var r = await ConfigHelper.userApi.QuickLogin();
|
||||
if (r.result)
|
||||
{
|
||||
App.CurrentUser = r.data;
|
||||
//ConfigHelper.CurrentUser = r.data.Value<UserResultModel>("user");
|
||||
//ConfigHelper.CurrentUser = re;
|
||||
var usermodel = r.data.Value<JObject>("user");
|
||||
//var usermodel = r.data.Value<JObject>("user");
|
||||
//App.CurrentUser = new UserModel
|
||||
//{
|
||||
// NickName = usermodel.Value<string>("NickName"),
|
||||
@@ -41,6 +42,7 @@ public class QuickLoginUser : MonoBehaviour
|
||||
// Distance = 0,
|
||||
// Climb = "",
|
||||
//};
|
||||
|
||||
SceneManager.LoadScene("MainScene");
|
||||
}
|
||||
else
|
||||
@@ -94,6 +96,7 @@ public class QuickLoginUser : MonoBehaviour
|
||||
transform.Find("Avatar").GetComponent<RawImage>().DOFade(1f, 0.3f);
|
||||
transform.GetComponent<Button>().enabled = true;
|
||||
transform.Find("NickNameText").GetComponent<Text>().enabled = true;
|
||||
transform.Find("BtnDelete").GetComponent<Button>().gameObject.SetActive(true);
|
||||
}
|
||||
public void setNoActive()
|
||||
{
|
||||
@@ -102,5 +105,6 @@ public class QuickLoginUser : MonoBehaviour
|
||||
transform.Find("Avatar").GetComponent<RawImage>().DOFade(0.5f, 0.3f);
|
||||
transform.GetComponent<Button>().enabled = false;
|
||||
transform.Find("NickNameText").GetComponent<Text>().enabled = false;
|
||||
transform.Find("BtnDelete").GetComponent<Button>().gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Assets.Scripts.UI.Prefab.MapList
|
||||
{
|
||||
public class MapFilterOptions
|
||||
{
|
||||
public static List<Dropdown.OptionData> distances = new string[] {"全部",
|
||||
"0-5KM",
|
||||
"5-10KM",
|
||||
"10-20KM",
|
||||
"20-30KM",
|
||||
"30-50KM",
|
||||
"50-100KM",
|
||||
"100-200KM",
|
||||
"200-无限制", }.Select(x=>new Dropdown.OptionData(x)).ToList();
|
||||
public static Dictionary<string, string> distanceDict = new Dictionary<string, string>()
|
||||
{
|
||||
{"全部","" },
|
||||
{"0-5KM","0-5" },
|
||||
{"5-10KM","5-10" },
|
||||
{"10-20KM","10-20" },
|
||||
{"20-30KM","20-30" },
|
||||
{"50-100KM","50-100" },
|
||||
{"100-200KM","100-200" },
|
||||
{"200-无限制","200-99999" },
|
||||
};
|
||||
public static Dictionary<string,string> diffDict = new Dictionary<string, string>()
|
||||
{
|
||||
{"FLAT","0-100" },
|
||||
{"LV.4","100-250" },
|
||||
{"LV.3","250-350" },
|
||||
{"LV.2","350-550" },
|
||||
{"LV.1","550-750" },
|
||||
{"HC","750-99999" },
|
||||
};
|
||||
public static List<Dropdown.OptionData> sorts = new string[] {
|
||||
"Distance","Name","Difficulty","Hot"//,"Times"
|
||||
}.Select(x => new Dropdown.OptionData(x)).ToList();
|
||||
public static Dictionary<string, string> diffDisplayDict = new Dictionary<string, string>()
|
||||
{
|
||||
{"FLAT","0-100" },
|
||||
{"LV.4","100-250" },
|
||||
{"LV.3","250-350" },
|
||||
{"LV.2","350-550" },
|
||||
{"LV.1","550-750" },
|
||||
{"HC","750-99999" },
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 045d47b55ae6eb844827ba951f3af3e6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,4 +1,4 @@
|
||||
using Assets.Cyp.Common;
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -6,12 +6,6 @@ using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class MyMap
|
||||
{
|
||||
public string name { get; set; }
|
||||
public int rank { get; set; }
|
||||
public string image { get; set; }
|
||||
}
|
||||
public class MapItem : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
@@ -36,9 +30,15 @@ public class MapItem : MonoBehaviour
|
||||
});
|
||||
transform.Find("Name").GetComponent<Text>().text = myMap.Name;
|
||||
Utils.DisplayImage(StartCoroutine, transform.Find("MapTitleImg").GetComponent<RawImage>(), myMap.CoverImage);
|
||||
var props = transform.Find("Props");
|
||||
transform.Find("CollectImg").gameObject.SetActive(myMap.IsFavorite);
|
||||
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("SlopeText").GetComponent<Text>().text = $"{myMap.AverageGrade.ToString("#0.00")}%";
|
||||
props.Find("rideText").GetComponent<Text>().text = myMap.TheHeat.ToString();
|
||||
var tabContainer = transform.Find("TabContainer");
|
||||
var diff = tabContainer.Find("Diff");
|
||||
diff.Find("Text").GetComponent<Text>().text = myMap.Hard;
|
||||
tabContainer.Find("3d").gameObject.SetActive(myMap.Enable3D);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class RotateBg : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
transform.Rotate(new Vector3(0,0,-0.01f*1/3));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2646b2ba277320e41bea125e9aebcb06
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -95,29 +95,29 @@ public class EditUserController : PFUIPanel
|
||||
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height, 0));
|
||||
mHeadImage.material = material;
|
||||
|
||||
var currentUser = App.CurrentUser;
|
||||
mIdText.text = "ID:" + currentUser.Id.ToString();
|
||||
mNameText.text = currentUser.Nickname;
|
||||
//var currentUser = App.CurrentUser;
|
||||
//mIdText.text = "ID:" + currentUser.Id.ToString();
|
||||
//mNameText.text = currentUser.Nickname;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(currentUser.WxHeadImg))
|
||||
{
|
||||
Utils.DisplayImage(StartCoroutine, mHeadImage, currentUser.WxHeadImg);
|
||||
}
|
||||
if (currentUser.Sex == 1)
|
||||
{
|
||||
mSexDropdown.SelectValue("男");
|
||||
}
|
||||
else
|
||||
{
|
||||
mSexDropdown.SelectValue("女");
|
||||
}
|
||||
if (currentUser.Birthday.HasValue)
|
||||
{
|
||||
var birthday = currentUser.Birthday.Value;
|
||||
mYearDropdown.SelectValue(birthday.Year.ToString());
|
||||
mMonthDropdown.SelectValue(birthday.Month.ToString());
|
||||
mDayDropdown.SelectValue(birthday.Day.ToString());
|
||||
}
|
||||
//if (!string.IsNullOrWhiteSpace(currentUser.WxHeadImg))
|
||||
//{
|
||||
// Utils.DisplayImage(StartCoroutine, mHeadImage, currentUser.WxHeadImg);
|
||||
//}
|
||||
//if (currentUser.Sex == 1)
|
||||
//{
|
||||
// mSexDropdown.SelectValue("男");
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// mSexDropdown.SelectValue("女");
|
||||
//}
|
||||
//if (currentUser.Birthday.HasValue)
|
||||
//{
|
||||
// var birthday = currentUser.Birthday.Value;
|
||||
// mYearDropdown.SelectValue(birthday.Year.ToString());
|
||||
// mMonthDropdown.SelectValue(birthday.Month.ToString());
|
||||
// mDayDropdown.SelectValue(birthday.Day.ToString());
|
||||
//}
|
||||
|
||||
UIManager.AddEvent(mSaveButton.gameObject, EventTriggerType.PointerClick, Save);
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ public class HomeController : PFUIPanel
|
||||
//App.CurrentUser.Distance = res.data.TotalDistance;
|
||||
//App.CurrentUser.Climb = res.data.TotalClimb;
|
||||
//App.CurrentUser.Carlories = res.data.Kcal;
|
||||
SetCurrentUser();
|
||||
//SetCurrentUser();
|
||||
//Climb.text = $"{res.data.TotalClimb.ToString()}M";
|
||||
//Calories.text = $"{res.data.Kcal.ToString()}KCAL";
|
||||
//Calories.text = res.data.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Assets.Cyp.Common;
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Apis;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using Assets.Scripts.UI.Prefab.MapList;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -20,7 +21,15 @@ public class MapListController : PFUIPanel
|
||||
[HideInInspector] public int pageIndex = 0;
|
||||
[HideInInspector] public int pageSize = 20;
|
||||
[HideInInspector] public string hard = "全部";
|
||||
|
||||
private Transform distanceOptions;
|
||||
private Transform diffOptions;
|
||||
private Transform tdContainer;
|
||||
private Transform favContainer;
|
||||
private Transform sorts;
|
||||
private Transform sortDir;
|
||||
private Transform searchInput;
|
||||
//private Transform distanceOption;
|
||||
//private Transform distanceOption;
|
||||
private Button returnBtn;
|
||||
public GameObject Content {
|
||||
get
|
||||
@@ -31,6 +40,7 @@ public class MapListController : PFUIPanel
|
||||
private bool isEnd = false;
|
||||
protected override void Start()
|
||||
{
|
||||
ApiBase.SetCookie("73385F5F719B610D132C1ECF3E9143272BF15214D57ED91CD7A9DFD832407471535112AAEB8E9271F75D54FBBF2D99F18FA313C1EEA5676F5D722D7FBB07C926BEC5905591BF9AFDDC6336552DF273112C2DA1794E6FA2F465B11FECD2E82E52");
|
||||
//if (hardSelector != null)
|
||||
//{
|
||||
// hardSelector.onValueChanged.AddListener(ChangeHard);
|
||||
@@ -45,6 +55,44 @@ public class MapListController : PFUIPanel
|
||||
// layout.cellSize = new Vector2((width - 120) / 5, (width - 120) / 5);
|
||||
//}
|
||||
}
|
||||
distanceOptions = transform.Find("Panel").Find("Panel").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");
|
||||
if (diffOptions != null)
|
||||
{
|
||||
foreach (Transform t in diffOptions)
|
||||
{
|
||||
var button = t.GetComponent<Button>();
|
||||
var image = t.GetComponent<Image>();
|
||||
var text = t.Find("Text").GetComponent<Text>();
|
||||
button.onClick.AddListener(() =>
|
||||
{
|
||||
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);
|
||||
hands.Add(MapFilterOptions.diffDict[text.text]);
|
||||
}
|
||||
else
|
||||
{
|
||||
ColorUtility.TryParseHtmlString("#6E6E7D", out Color c);
|
||||
image.color = c1;
|
||||
text.color = c;
|
||||
hands.Remove(MapFilterOptions.diffDict[text.text]);
|
||||
}
|
||||
scroll.GetComponent<ScrollRect>().verticalNormalizedPosition = 1;
|
||||
Refresh();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
GetList();
|
||||
if (scroll != null)
|
||||
{
|
||||
@@ -63,6 +111,73 @@ public class MapListController : PFUIPanel
|
||||
UIManager.ShowHomePanel();
|
||||
});
|
||||
}
|
||||
tdContainer = transform.Find("Panel").Find("Panel").Find("3dContainer");
|
||||
favContainer = transform.Find("Panel").Find("Panel").Find("FavContainer");
|
||||
if (tdContainer != null)
|
||||
{
|
||||
tdContainer.GetComponent<Button>().onClick.AddListener(() =>
|
||||
{
|
||||
var gou = tdContainer.Find("Gou").gameObject;
|
||||
bool v = !gou.activeSelf;
|
||||
gou.SetActive(v);
|
||||
is3d = v;
|
||||
Refresh();
|
||||
});
|
||||
}
|
||||
if (favContainer != null)
|
||||
{
|
||||
favContainer.GetComponent<Button>().onClick.AddListener(() =>
|
||||
{
|
||||
var gou = favContainer.Find("Gou").gameObject;
|
||||
bool v = !gou.activeSelf;
|
||||
gou.SetActive(v);
|
||||
isFav = v;
|
||||
Refresh();
|
||||
});
|
||||
}
|
||||
searchInput = transform.Find("Panel").Find("Panel").Find("SearchInput");
|
||||
if (searchInput != null)
|
||||
{
|
||||
searchInput.Find("Button").GetComponent<Button>().onClick.AddListener(() =>
|
||||
{
|
||||
ftname = searchInput.GetComponent<InputField>().text;
|
||||
Refresh();
|
||||
});
|
||||
}
|
||||
sorts = transform.Find("Panel").Find("Panel").Find("FilterOptions");
|
||||
if (sorts != null)
|
||||
{
|
||||
var drop = sorts.GetComponent<Dropdown>();
|
||||
drop.options = MapFilterOptions.sorts;
|
||||
drop.value = 3;
|
||||
drop.onValueChanged.AddListener((int index)=>
|
||||
{
|
||||
sort = drop.options[index].text;
|
||||
var image = sortDir.Find("Image").GetComponent<Image>();
|
||||
image.sprite = Resources.Load<Sprite>("Images/DOWN");
|
||||
sortDire = "desc";
|
||||
Refresh();
|
||||
});
|
||||
}
|
||||
sortDir = transform.Find("Panel").Find("Panel").Find("Dir");
|
||||
if (sortDir)
|
||||
{
|
||||
var image = sortDir.Find("Image").GetComponent<Image>();
|
||||
sortDir.GetComponent<Button>().onClick.AddListener(() =>
|
||||
{
|
||||
if (image.sprite.name == "DOWN")
|
||||
{
|
||||
image.sprite = Resources.Load<Sprite>("Images/UP");
|
||||
sortDire = "asc";
|
||||
}
|
||||
else
|
||||
{
|
||||
image.sprite = Resources.Load<Sprite>("Images/DOWN");
|
||||
sortDire = "desc";
|
||||
}
|
||||
Refresh();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEndDrag(BaseEventData arg0)
|
||||
@@ -73,7 +188,6 @@ public class MapListController : PFUIPanel
|
||||
Debug.Log(scrollrect.verticalNormalizedPosition);
|
||||
pageIndex++;
|
||||
GetList();
|
||||
|
||||
}
|
||||
if (scrollrect.verticalNormalizedPosition >= 1)
|
||||
{
|
||||
@@ -81,28 +195,39 @@ public class MapListController : PFUIPanel
|
||||
}
|
||||
}
|
||||
|
||||
private void ChangeHard(int index)
|
||||
private void ChangeDistance(int index)
|
||||
{
|
||||
var text = distanceOptions.GetComponent<Dropdown>().options[index].text;
|
||||
distance = MapFilterOptions.distanceDict[text];
|
||||
scroll.GetComponent<ScrollRect>().verticalNormalizedPosition = 1;
|
||||
Refresh();
|
||||
//var text = hardSelector.options[index].text;
|
||||
//if (text == "全部难度")
|
||||
//{
|
||||
|
||||
//}
|
||||
}
|
||||
|
||||
//查询条件
|
||||
string ftname = "";
|
||||
string distance = "";
|
||||
List<string> hands = new List<string>();
|
||||
bool is3d = false,isFav = false;
|
||||
string sort = "Hot",sortDire = "desc";
|
||||
//string name = "";
|
||||
//string name = "";
|
||||
public void GetList()
|
||||
{
|
||||
if (isEnd) return;
|
||||
var res = Global.mapApi.GetList(pageIndex, pageSize, "");
|
||||
var res = ConfigHelper.mapApi.GetList(pageIndex, pageSize, ftname,distance,string.Join(",",hands),is3d,sort,sortDire,isFav);
|
||||
if (res.result)
|
||||
{
|
||||
|
||||
if (res.data.Count == 0)
|
||||
if (res.data.Count == 0 && pageIndex != 0)
|
||||
{
|
||||
isEnd = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
isEnd = false;
|
||||
DisplayMaps(res.data);
|
||||
}
|
||||
}
|
||||
@@ -128,6 +253,13 @@ public class MapListController : PFUIPanel
|
||||
pageIndex = 0;
|
||||
GetList();
|
||||
}
|
||||
void ResetList()
|
||||
{
|
||||
distance = "";
|
||||
hands = new List<string>();
|
||||
name = "";
|
||||
Refresh();
|
||||
}
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4d3acfe11364023479f5bbb56d2cabde
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,216 @@
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Apis;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class ResultListController : MonoBehaviour
|
||||
{
|
||||
[SerializeField]Transform routeResult;
|
||||
Transform scrollContent;
|
||||
Transform routeScroll, matchScroll;
|
||||
Transform routeContent, matchContent;
|
||||
Transform btnRoute, btnMatch,searchInput;
|
||||
Color c1, c2;
|
||||
// Start is called before the first frame update
|
||||
int pageIndex = 0, pageSize = 20;
|
||||
string name = "";
|
||||
void Start()
|
||||
{
|
||||
ApiBase.SetCookie("73385F5F719B610D132C1ECF3E9143272BF15214D57ED91CD7A9DFD832407471535112AAEB8E9271F75D54FBBF2D99F18FA313C1EEA5676F5D722D7FBB07C926BEC5905591BF9AFDDC6336552DF273112C2DA1794E6FA2F465B11FECD2E82E52");
|
||||
InitialColor();
|
||||
scroll = transform.Find("ListPanel").Find("Scroll").GetComponent<ScrollRect>();
|
||||
btnMatch = transform.Find("ListPanel").Find("BtnMatch");
|
||||
btnRoute = transform.Find("ListPanel").Find("BtnRoute");
|
||||
searchInput = transform.Find("ListPanel").Find("SearchInput");
|
||||
scrollContent = scroll.transform.Find("Viewport").Find("Content");
|
||||
routeScroll = scrollContent.Find("RouteList");
|
||||
routeContent = routeScroll.Find("Viewport").Find("Content");
|
||||
matchScroll = scrollContent.Find("MatchList");
|
||||
matchContent = matchScroll.Find("Viewport").Find("Content");
|
||||
if (btnMatch != null)
|
||||
{
|
||||
btnMatch.GetComponent<Button>().onClick.AddListener(() => StartScroll(0));
|
||||
}
|
||||
if (btnRoute != null)
|
||||
{
|
||||
btnRoute.GetComponent<Button>().onClick.AddListener(() => StartScroll(1));
|
||||
}
|
||||
if (searchInput != null)
|
||||
{
|
||||
searchInput.Find("Button").GetComponent<Button>().onClick.AddListener(() =>
|
||||
{
|
||||
name = searchInput.GetComponent<InputField>().text;
|
||||
Refresh();
|
||||
});
|
||||
}
|
||||
if (routeScroll != null)
|
||||
{
|
||||
UIManager.AddEvent(routeScroll.gameObject, UnityEngine.EventSystems.EventTriggerType.EndDrag, OnEndDrag);
|
||||
}
|
||||
if (matchScroll)
|
||||
{
|
||||
UIManager.AddEvent(matchScroll.gameObject, UnityEngine.EventSystems.EventTriggerType.EndDrag, OnEndDrag);
|
||||
}
|
||||
GetList();
|
||||
}
|
||||
|
||||
private void OnEndDrag(BaseEventData e)
|
||||
{
|
||||
var pe = (PointerEventData)e;
|
||||
var scrollrect = pe.pointerDrag.GetComponent<ScrollRect>();
|
||||
if (scrollrect.verticalNormalizedPosition <= 0)
|
||||
{
|
||||
Debug.Log(scrollrect.verticalNormalizedPosition);
|
||||
pageIndex++;
|
||||
GetList();
|
||||
}
|
||||
if (scrollrect.verticalNormalizedPosition >= 1)
|
||||
{
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
private void Refresh()
|
||||
{
|
||||
routeContent.transform.DestroyChildren();
|
||||
pageIndex = 0;
|
||||
GetList();
|
||||
}
|
||||
bool isEnd = false;
|
||||
void GetList()
|
||||
{
|
||||
var r =ConfigHelper.mapInterruptRecordApi.GetMapInterruptRecord(name, pageIndex, 20);
|
||||
if (r.result)
|
||||
{
|
||||
if (r.data.Count == 0 && pageIndex != 0)
|
||||
{
|
||||
isEnd = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
isEnd = false;
|
||||
DisplayRouteResult(r.data,routeContent);
|
||||
DisplayRouteResult(r.data, matchContent);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.showToast(gameObject, r.errMsg);
|
||||
}
|
||||
}
|
||||
void DisplayRouteResult(List<RouteResult> list,Transform content)
|
||||
{
|
||||
if (routeResult != null)
|
||||
{
|
||||
foreach (var item in list)
|
||||
{
|
||||
var obj = Instantiate(routeResult);
|
||||
obj.GetComponent<RouteItem>().Initial(item);
|
||||
//obj.SendMessage("Initial", );
|
||||
obj.transform.parent = content;
|
||||
obj.transform.localScale = new Vector3(1, 1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
void InitialColor()
|
||||
{
|
||||
ColorUtility.TryParseHtmlString("#FFFFFF", out c1);
|
||||
ColorUtility.TryParseHtmlString("#5C5C6E", out c2);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
GoScroll();
|
||||
}
|
||||
void StartScroll(int index)
|
||||
{
|
||||
if (startScroll) return;
|
||||
if (index == 0)
|
||||
{
|
||||
//翻到比赛页,比赛按钮变白,线路按钮变灰
|
||||
scrollIndex = 1;
|
||||
startScroll = true;
|
||||
btnRoute.GetComponent<Text>().color = c2;
|
||||
btnMatch.GetComponent<Text>().color = c1;
|
||||
}
|
||||
else if (index == 1)
|
||||
{
|
||||
//反过来
|
||||
scrollIndex = 0;
|
||||
startScroll = true;
|
||||
btnRoute.GetComponent<Text>().color = c1;
|
||||
btnMatch.GetComponent<Text>().color = c2;
|
||||
}
|
||||
}
|
||||
#region 主页面滑动逻辑
|
||||
int scrollIndex = 0;
|
||||
bool startScroll = false;
|
||||
ScrollRect scroll;
|
||||
//private float scrollValue = 0.5f;
|
||||
int pageNums = 2;
|
||||
void GoScroll()
|
||||
{
|
||||
var index = scrollIndex;
|
||||
var scrollValue = 1f / (pageNums - 1);
|
||||
var value = index * scrollValue;
|
||||
if (scroll != null && startScroll)
|
||||
{
|
||||
if (scroll.horizontalNormalizedPosition >= value)
|
||||
{
|
||||
scroll.horizontalNormalizedPosition -= (scrollValue / 20);
|
||||
if (scroll.horizontalNormalizedPosition <= value)
|
||||
{
|
||||
Debug.Log(index);
|
||||
scroll.horizontalNormalizedPosition = value;
|
||||
startScroll = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
scroll.horizontalNormalizedPosition += (scrollValue / 20);
|
||||
if (scroll.horizontalNormalizedPosition >= value)
|
||||
{
|
||||
Debug.Log(index);
|
||||
scroll.horizontalNormalizedPosition = value;
|
||||
startScroll = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
//float scrollIndex = 0;
|
||||
//bool startScroll = false;
|
||||
//ScrollRect scroll;
|
||||
//void GoScroll()
|
||||
//{
|
||||
// float value = scrollIndex;
|
||||
// if (scroll != null && startScroll)
|
||||
// {
|
||||
// if (scrollIndex == 0)
|
||||
// {
|
||||
// scroll.horizontalNormalizedPosition -= (1f / 20);
|
||||
// if (scroll.horizontalNormalizedPosition <= 0)
|
||||
// {
|
||||
// scroll.horizontalNormalizedPosition = 0;
|
||||
// startScroll = false;
|
||||
|
||||
// }
|
||||
// }
|
||||
// else if (scrollIndex == 1)
|
||||
// {
|
||||
// scroll.horizontalNormalizedPosition += (1f / 20);
|
||||
// if (scroll.horizontalNormalizedPosition >= 1)
|
||||
// {
|
||||
// scroll.horizontalNormalizedPosition = 1;
|
||||
// startScroll = false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e9e4a559c32ef6d4a95d06e4a10c73d4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,122 @@
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
Transform left,row1,row2,right;
|
||||
Transform btnReRide, btnContinue, btnDelete;
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
string titleColor = "#5c5c6e";
|
||||
public void Initial(RouteResult result)
|
||||
{
|
||||
left = transform.Find("Left");
|
||||
row1 = left.Find("Main").Find("Row1");
|
||||
row2 = left.Find("Main").Find("Row2");
|
||||
Utils.DisplayImage(StartCoroutine, transform.Find("CoverImage").GetComponent<RawImage>(), result.RouteImage);
|
||||
left.Find("Main").Find("Name").GetComponent<Text>().text = result.RouteName;
|
||||
left.Find("Main").Find("Time").GetComponent<Text>().text = result.CreateTime.ToString("yyyy-MM-dd HH-mm-ss");
|
||||
row1.Find("Time").GetComponent<Text>().text = $"<color={titleColor}>Riding time:</color>{result.TrainingTime}";
|
||||
row1.Find("Distance").GetComponent<Text>().text = $"<color={titleColor}>Mileage:</color>{result.EndDistance.ToString("#0.00")}KM";
|
||||
row1.Find("Times").GetComponent<Text>().text = $"<color={titleColor}>Times:</color>{result.Count}";
|
||||
row1.Find("Rank").GetComponent<Text>().text = $"<color={titleColor}>Rank:</color>{result.Ranking}";
|
||||
left.Find("Progress").Find("Image").GetComponent<Image>().fillAmount = (float)result.Progress;
|
||||
left.Find("Progress").Find("Value").GetComponent<Text>().text = (result.Progress * 100).ToString("#0");
|
||||
row2.Find("Device").GetComponent<Text>().text = $"<color={titleColor}>Cycling equipment:</color>{result.ManufacturerName}";
|
||||
right = transform.Find("Right");
|
||||
btnContinue = right.Find("BtnContinue");
|
||||
if (btnContinue)
|
||||
{
|
||||
btnContinue.gameObject.SetActive(false);
|
||||
btnContinue.GetComponent<Button>().onClick.AddListener(GoContinue);
|
||||
}
|
||||
btnReRide = right.Find("BtnReRide");
|
||||
if (btnReRide)
|
||||
{
|
||||
btnReRide.gameObject.SetActive(false);
|
||||
btnReRide.GetComponent<Button>().onClick.AddListener(GoReRide);
|
||||
}
|
||||
btnDelete = right.Find("BtnDelete");
|
||||
if (btnDelete)
|
||||
{
|
||||
btnDelete.gameObject.SetActive(false);
|
||||
btnDelete.GetComponent<Button>().onClick.AddListener(Delete);
|
||||
}
|
||||
}
|
||||
|
||||
private void Delete()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private void GoReRide()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private void GoContinue()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
transform.GetComponent<Image>().color = Utils.HexToColorHtml("#23232d");
|
||||
if (left != null)
|
||||
{
|
||||
left.Find("Main").Find("Time").GetComponent<Text>().color = Utils.HexToColorHtml("#414251");
|
||||
left.Find("Progress").Find("Image").GetComponent<Image>().color = Utils.HexToColorHtml("#5c5c6e");
|
||||
left.Find("Progress").Find("Value").GetComponent<Text>().color = Utils.HexToColorHtml("#414251");
|
||||
left.Find("Progress").Find("bf").GetComponent<Text>().color = Utils.HexToColorHtml("#414251");
|
||||
}
|
||||
if (row1 != null)
|
||||
{
|
||||
row1.Find("Time").GetComponent<Text>().color = Utils.HexToColorHtml("#9E9EAD");
|
||||
row1.Find("Distance").GetComponent<Text>().color = Utils.HexToColorHtml("#9E9EAD");
|
||||
row1.Find("Times").GetComponent<Text>().color = Utils.HexToColorHtml("#9E9EAD");
|
||||
row1.Find("Rank").GetComponent<Text>().color = Utils.HexToColorHtml("#9E9EAD");
|
||||
}
|
||||
titleColor = "#414251";
|
||||
btnContinue.gameObject.SetActive(false);
|
||||
btnReRide.gameObject.SetActive(false);
|
||||
btnDelete.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
transform.GetComponent<Image>().color = Utils.HexToColorHtml("#353543");
|
||||
if (left != null)
|
||||
{
|
||||
left.Find("Main").Find("Time").GetComponent<Text>().color = Utils.HexToColorHtml("#5c5c6e");
|
||||
left.Find("Progress").Find("Image").GetComponent<Image>().color = Utils.HexToColorHtml("#F93086");
|
||||
left.Find("Progress").Find("Value").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
||||
left.Find("Progress").Find("bf").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
||||
}
|
||||
if (row1 != null)
|
||||
{
|
||||
row1.Find("Time").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
||||
row1.Find("Distance").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
||||
row1.Find("Times").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
||||
row1.Find("Rank").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
||||
}
|
||||
titleColor = "#5c5c6e";
|
||||
btnContinue.gameObject.SetActive(true);
|
||||
btnReRide.gameObject.SetActive(true);
|
||||
btnDelete.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f822eddd7a641a744a198d79e43e3f55
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -91,5 +91,10 @@ namespace Assets.Scripts
|
||||
byte b = byte.Parse(hex.Substring(4, 2), NumberStyles.HexNumber);
|
||||
return new Color32(r, g, b, byte.MaxValue);
|
||||
}
|
||||
public static Color HexToColorHtml(string hex)
|
||||
{
|
||||
ColorUtility.TryParseHtmlString(hex, out Color c);
|
||||
return c;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user