Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo
This commit is contained in:
commit
8226b8a7c2
206 files changed
+13484
-2849
No files matched your search
@@ -142,6 +142,12 @@ namespace Assets.Scripts.Apis
|
||||
var response = await httpClient.GetAsync(url, HttpCompletionOption.ResponseContentRead).ConfigureAwait(false);
|
||||
return await ParseJsonAsync<T>(response);
|
||||
}
|
||||
protected async Task<System.IO.Stream> GetThirdPartStreamAsync(string url)
|
||||
{
|
||||
AddLanguage();
|
||||
var response = await httpClient.GetAsync(url, HttpCompletionOption.ResponseContentRead).ConfigureAwait(false);
|
||||
return await response.Content.ReadAsStreamAsync();
|
||||
}
|
||||
private async Task<T> ParseJsonAsync<T>(HttpResponseMessage response)
|
||||
{
|
||||
var result = await response.Content.ReadAsStringAsync();
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Assets.Scripts.Apis
|
||||
{
|
||||
return Get($"Map/GetMapToken?name={name}");
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取路线数据
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Assets.Scripts.Apis.Models
|
||||
{
|
||||
public class AddressDetail
|
||||
{
|
||||
/// <summary>
|
||||
/// 江苏省
|
||||
/// </summary>
|
||||
public string province { get; set; }
|
||||
/// <summary>
|
||||
/// 南京市
|
||||
/// </summary>
|
||||
public string city { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string district { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string street { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string street_number { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int city_code { get; set; }
|
||||
}
|
||||
|
||||
public class LocationPoint
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string y { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string x { get; set; }
|
||||
}
|
||||
|
||||
public class LocationContent
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public AddressDetail address_detail { get; set; }
|
||||
/// <summary>
|
||||
/// 江苏省南京市
|
||||
/// </summary>
|
||||
public string address { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public LocationPoint point { get; set; }
|
||||
}
|
||||
|
||||
public class LocationModel
|
||||
{
|
||||
/// <summary>
|
||||
/// CN|江苏|南京|None|CHINANET|0|0
|
||||
/// </summary>
|
||||
public string address { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public LocationContent content { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int status { get; set; }
|
||||
|
||||
public string message { get; set; }
|
||||
}
|
||||
public class IpToGeoModel
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ip { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string continent_code { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string country { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string country_code { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string country_code3 { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string region { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string region_code { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string city { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public double latitude { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public double longitude { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string timezone { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int offset { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int asn { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string organization { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c86940fb819b49e419c693d684897a77
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,6 +1,8 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -17,5 +19,14 @@ namespace Assets.Scripts.Apis
|
||||
{
|
||||
return await GetThirdPartAsync<JObject>($"https://api.weixin.qq.com/sns/userinfo?access_token=" + accessToken + "&openid=" + openId);
|
||||
}
|
||||
public async Task<IpToGeoModel> GetLocationInfo()
|
||||
{
|
||||
return await GetThirdPartAsync<IpToGeoModel>("https://ip.seeip.org/geoip");
|
||||
//return await GetThirdPartAsync<LocationModel>($"http://api.map.baidu.com/location/ip?ak=NsfCV0Sp5r0O8yY49RPIpOQZkWFlDnmi&coor=gcj02");
|
||||
}
|
||||
public async Task<Stream> GetMapImage(IpToGeoModel locationInfo)
|
||||
{
|
||||
return await GetThirdPartStreamAsync($"https://api.mapbox.com/styles/v1/mapbox/dark-v10/static/{locationInfo.longitude},{locationInfo.latitude},12.14,0/1280x1280?access_token=pk.eyJ1IjoiYW5keXNqdCIsImEiOiJja2ZhajE5OGwwamRiMnltcW96bHk0ZWFuIn0.GvKanc6UveWSvIjS9HfBPA");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -280,6 +280,9 @@ namespace Assets.Scripts.Apis
|
||||
return await GetAsync<JsonResult<JObject>>("/Home/GetNotify");
|
||||
}
|
||||
|
||||
|
||||
public async Task<JsonResult<JObject>> ResetPassword(string phone, string captcha, string newPwd)
|
||||
{
|
||||
return await PostAsync<JsonResult<JObject>>("NoAuth/v1/ResetPassword", new {phone,captcha,newPwd });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,9 @@ public static class App
|
||||
|
||||
public static string MapBoxAccessToken => "pk.eyJ1IjoiYW5keXNqdCIsImEiOiJja2ZhajE5OGwwamRiMnltcW96bHk0ZWFuIn0.GvKanc6UveWSvIjS9HfBPA";
|
||||
|
||||
public static double latitude { get; internal set; }
|
||||
public static double longitude { get; internal set; }
|
||||
|
||||
public static bool FromLogin = false;
|
||||
|
||||
/// <summary>
|
||||
@@ -29,4 +32,5 @@ public static class App
|
||||
public static IDictionary<string,Texture> TextureCache = new Dictionary<string, Texture>();
|
||||
public static Texture CurrentUserHeadTexture;
|
||||
public static RouteResult routeResult;//骑行记录向骑行场景传值
|
||||
public static Texture DefaultRotateTexture;
|
||||
}
|
||||
@@ -13,6 +13,7 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
using UnityEngine;
|
||||
@@ -109,30 +110,11 @@ public class LoginController : MonoBehaviour
|
||||
void Start()
|
||||
{
|
||||
App.FromLogin = true;
|
||||
GetRotateImage();
|
||||
UIManager.Instance.ModalsPanel = this.transform.Find("ModalPanel").GetComponent<PFUIPanel>();
|
||||
userInfos = UIManager.Instance.userInfos;
|
||||
//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 (loading != null)
|
||||
{
|
||||
//loading.texture.wrapMode = TextureWrapMode.Mirror;
|
||||
}
|
||||
App.DefaultRotateTexture = Utils.ReadTextureFromPlayerPrefs("rotateImage");
|
||||
|
||||
if (loginScrollView != null)
|
||||
{
|
||||
scrollPanel = loginScrollView.GetComponent<ScrollRect>();
|
||||
@@ -149,6 +131,8 @@ public class LoginController : MonoBehaviour
|
||||
signPage1 = content.Find("FirstPage");
|
||||
UIManager.AddEvent(signPage1.Find("next").GetComponent<Button>().gameObject,
|
||||
EventTriggerType.PointerClick, (b) => goRegNext());
|
||||
UIManager.AddEvent(signPage1.Find("BtnModiPass").GetComponent<Button>().gameObject,
|
||||
EventTriggerType.PointerClick, (b) => goResetPassword());
|
||||
//signPage1.Find("next").GetComponent<Button>().onClick.AddListener(() => { goRegNext(); });
|
||||
UIManager.AddEvent(signPage1.Find("Captcha").Find("BtnGet").gameObject,
|
||||
EventTriggerType.PointerClick,(b)=> GetCaptcha());
|
||||
@@ -267,6 +251,7 @@ public class LoginController : MonoBehaviour
|
||||
gou.gameObject.SetActive(true);
|
||||
}
|
||||
});
|
||||
UIManager.AddEvent(loginContainer.Find("ForgetPassword").gameObject, EventTriggerType.PointerClick, (e) =>goSign(type:1));
|
||||
var wechatLogin = loginContainer.Find("otherContainer").Find("Wechat").GetComponent<Button>();
|
||||
UIManager.AddEvent(wechatLogin.gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
@@ -282,10 +267,7 @@ public class LoginController : MonoBehaviour
|
||||
//wx1.GetComponent<CanvasGroup>().DOFade(1, 0.8f).onComplete = () => { wxLock = false; };
|
||||
wx1.DOLocalMoveY(0, 0.3f).onComplete = () => { wxLock = false; };
|
||||
});
|
||||
//wechatLogin.onClick.AddListener(() =>
|
||||
//{
|
||||
|
||||
//});
|
||||
|
||||
var login = loginContainer.Find("login").GetComponent<Button>();
|
||||
UIManager.AddEvent(login.gameObject, EventTriggerType.PointerClick, (b) => Submit());
|
||||
//login.onClick.AddListener(Submit);
|
||||
@@ -450,6 +432,43 @@ public class LoginController : MonoBehaviour
|
||||
};
|
||||
avatar = Resources.Load<Texture>("Images/New Account");
|
||||
}
|
||||
|
||||
async void GetRotateImage()
|
||||
{
|
||||
if (!App.TextureCache.ContainsKey("rotateImage"))
|
||||
{
|
||||
var locationInfo = await ConfigHelper.thirdPartApi.GetLocationInfo();
|
||||
App.latitude = locationInfo.latitude;
|
||||
App.longitude = locationInfo.longitude;
|
||||
//if (locationInfo.status == 0)
|
||||
//{
|
||||
// Debug.Log(locationInfo.address);
|
||||
// Utils.DownloadImageToLocal(StartCoroutine,
|
||||
// $"https://api.mapbox.com/styles/v1/mapbox/dark-v10/static/{locationInfo.content.point.x},{locationInfo.content.point.y},12.14,0/1280x1280?access_token=pk.eyJ1IjoiYW5keXNqdCIsImEiOiJja2ZhajE5OGwwamRiMnltcW96bHk0ZWFuIn0.GvKanc6UveWSvIjS9HfBPA",
|
||||
// "rotateImage");
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// Debug.Log(locationInfo.message);
|
||||
//}
|
||||
Debug.Log(JsonConvert.SerializeObject(locationInfo));
|
||||
var i = await ConfigHelper.thirdPartApi.GetMapImage(locationInfo);
|
||||
var t = new Texture2D(2, 2);
|
||||
if (t.LoadImage(Utils.StreamToBytes(i)))
|
||||
{
|
||||
Debug.Log("成功");
|
||||
App.TextureCache["rotateImage"] = t;
|
||||
Utils.WriteTextureToPlayerPrefs("rotateImage", t);
|
||||
}
|
||||
//Debug.Log(locationInfo.country);
|
||||
//Utils.DownloadImageToLocal(StartCoroutine,
|
||||
//$"https://api.mapbox.com/styles/v1/mapbox/dark-v10/static/{locationInfo.longitude},{locationInfo.latitude},12.14,0/1280x1280?access_token=pk.eyJ1IjoiYW5keXNqdCIsImEiOiJja2ZhajE5OGwwamRiMnltcW96bHk0ZWFuIn0.GvKanc6UveWSvIjS9HfBPA",
|
||||
//"rotateImage");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 执行js 修改微信登录页样式
|
||||
/// </summary>
|
||||
private void AdjustWxQrCode()
|
||||
{
|
||||
wxBrowser.EvalJS(@"
|
||||
@@ -551,8 +570,7 @@ public class LoginController : MonoBehaviour
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//用于倒计时获取验证码
|
||||
#region 倒计时获取验证码
|
||||
int time = 0;
|
||||
float timer = 0f;
|
||||
bool startCaptcha = false;
|
||||
@@ -586,37 +604,8 @@ public class LoginController : MonoBehaviour
|
||||
Utils.showToast(gameObject, r.errMsg);
|
||||
}
|
||||
}
|
||||
|
||||
void HidePassword()
|
||||
{
|
||||
signPage1.Find("Password").gameObject.SetActive(false);
|
||||
signPage1.Find("CPassword").gameObject.SetActive(false);
|
||||
UIManager.RemoveEvent(signPage1.Find("signThird").gameObject);
|
||||
UIManager.AddEvent(signPage1.Find("signThird").gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
goRegNextWithoutPass();
|
||||
});
|
||||
//signPage1.Find("signThird").GetComponent<Button>().onClick.RemoveAllListeners();
|
||||
//signPage1.Find("signThird").GetComponent<Button>().onClick.AddListener(goRegNextWithoutPass);
|
||||
}
|
||||
|
||||
|
||||
void ShowPassword()
|
||||
{
|
||||
signForm.email.text = "";
|
||||
signForm.password.text = "";
|
||||
signForm.captcha.text = "";
|
||||
signForm.cpassword.text = "";
|
||||
signPage1.Find("Password").gameObject.SetActive(true);
|
||||
signPage1.Find("CPassword").gameObject.SetActive(true);
|
||||
UIManager.RemoveEvent(signPage1.Find("signThird").gameObject);
|
||||
UIManager.AddEvent(signPage1.Find("signThird").gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
goRegNext(1);
|
||||
});
|
||||
//signPage1.Find("signThird").GetComponent<Button>().onClick.RemoveAllListeners();
|
||||
//signPage1.Find("signThird").GetComponent<Button>().onClick.AddListener(() => { ; });
|
||||
}
|
||||
#endregion
|
||||
|
||||
void CaptchaTimerTick()
|
||||
{
|
||||
timer -= Time.deltaTime;
|
||||
@@ -637,22 +626,6 @@ public class LoginController : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
private void OnLoginInputDeSelect(BaseEventData arg0, GameObject game)
|
||||
{
|
||||
var image = game.transform.GetComponent<Image>();
|
||||
image.sprite = Resources.Load<Sprite>("Images/gl-no");
|
||||
//var rect = game.transform.GetComponent<RectTransform>();
|
||||
//rect.SetSiblingIndex(rect.childCount-1);
|
||||
}
|
||||
|
||||
private void OnLoginInputSelect(BaseEventData arg0, GameObject game)
|
||||
{
|
||||
var image = game.transform.GetComponent<Image>();
|
||||
image.sprite = Resources.Load<Sprite>("Images/gl");
|
||||
//var rect = game.transform.GetComponent<RectTransform>();
|
||||
//rect.SetSiblingIndex(0);
|
||||
}
|
||||
|
||||
private void goRegPrev()
|
||||
{
|
||||
signForm.email.text = "";
|
||||
@@ -728,6 +701,31 @@ public class LoginController : MonoBehaviour
|
||||
Utils.showToast(gameObject, r.errMsg);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 重置密码逻辑
|
||||
/// </summary>
|
||||
async void goResetPassword()
|
||||
{
|
||||
var Email = signForm.email;
|
||||
var Captcha = signForm.captcha;
|
||||
var Password = signForm.password;
|
||||
var CPassword = signForm.cpassword;
|
||||
if (Password.text != CPassword.text)
|
||||
{
|
||||
Utils.showToast(gameObject, "两次密码输入不一致");
|
||||
return;
|
||||
}
|
||||
var r = await ConfigHelper.userApi.ResetPassword(Email.text, Captcha.text, Password.text);
|
||||
if (r.result)
|
||||
{
|
||||
Utils.showToast(gameObject, "修改成功",type:1);
|
||||
goLoginReturn2();
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.showToast(gameObject, r.errMsg);
|
||||
}
|
||||
}
|
||||
void RefreshWx3(UserResultModel data)
|
||||
{
|
||||
Utils.DisplayImage(StartCoroutine,
|
||||
@@ -736,6 +734,9 @@ public class LoginController : MonoBehaviour
|
||||
wxLogin3.Find("NickName").GetComponent<Text>().text = data.Nickname;
|
||||
userResult = data;
|
||||
}
|
||||
/// <summary>
|
||||
/// 去最后一页准备进入主场景
|
||||
/// </summary>
|
||||
async void goRegEnd()
|
||||
{
|
||||
if (!await UpdateInfo()) return;
|
||||
@@ -749,6 +750,9 @@ public class LoginController : MonoBehaviour
|
||||
}
|
||||
//throw new NotImplementedException();
|
||||
}
|
||||
/// <summary>
|
||||
/// 加载信息
|
||||
/// </summary>
|
||||
void LoadInfo()
|
||||
{
|
||||
var _days = signForm.days.GetComponent<PFUIDropdown>();
|
||||
@@ -772,6 +776,10 @@ public class LoginController : MonoBehaviour
|
||||
_weight.Text = userResult.Weight.ToString();
|
||||
_height.Text = userResult.Height.ToString();
|
||||
}
|
||||
/// <summary>
|
||||
/// 注册页2 修改信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
async Task<bool> UpdateInfo()
|
||||
{
|
||||
if (userResult == null) return false;
|
||||
@@ -789,11 +797,12 @@ public class LoginController : MonoBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
var errorList = new List<object>();
|
||||
errorList.Add(new { Field="Years", ErrMsg="" });
|
||||
errorList.Add(new { Field = "Months", ErrMsg = "" });
|
||||
errorList.Add(new { Field = "Days", ErrMsg = "" });
|
||||
Utils.SetValidate(signFormDict, JArray.FromObject(errorList));
|
||||
Utils.SetValidate(signFormDict, JArray.FromObject(new object[]
|
||||
{
|
||||
new { Field = "Years", ErrMsg = "" },
|
||||
new { Field = "Months", ErrMsg = "" },
|
||||
new { Field = "Days", ErrMsg = "" }
|
||||
}));
|
||||
Utils.showToast(gameObject, "请选择生日");
|
||||
return false;
|
||||
}
|
||||
@@ -810,6 +819,9 @@ public class LoginController : MonoBehaviour
|
||||
return r.result;
|
||||
//userResult.Birthday.v
|
||||
}
|
||||
/// <summary>
|
||||
/// 微信2/注册返回登录
|
||||
/// </summary>
|
||||
private void goLoginReturn2()
|
||||
{
|
||||
if (wxLogin2.gameObject.activeSelf) wxLogin2.gameObject.SetActive(false);
|
||||
@@ -819,6 +831,23 @@ public class LoginController : MonoBehaviour
|
||||
this.StartScrollPanel(1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 立刻跳到登录页并且返回按钮强行失效
|
||||
/// </summary>
|
||||
private void goLoginImmediately()
|
||||
{
|
||||
imagedf.localPosition = new Vector3(-580, -34, 0);
|
||||
imagexf.localPosition = new Vector3(0, -669, 0);
|
||||
LoginBg.localPosition = Vector3.zero;
|
||||
LoginBg.GetComponent<RectTransform>().sizeDelta = new Vector2(360, 573);
|
||||
var scrollValue = 1f / (pageNums - 1);
|
||||
var value = 1 * scrollValue;
|
||||
scrollPanel.horizontalNormalizedPosition = value;
|
||||
loginContainer.Find("returnQuick").GetComponent<Button>().gameObject.SetActive(false);
|
||||
}
|
||||
/// <summary>
|
||||
/// 返回快速登录页
|
||||
/// </summary>
|
||||
void ReturnQuick()
|
||||
{
|
||||
if (imagexf != null)
|
||||
@@ -836,6 +865,10 @@ public class LoginController : MonoBehaviour
|
||||
}
|
||||
this.StartScrollPanel(0);
|
||||
}
|
||||
/// <summary>
|
||||
/// 去登录页
|
||||
/// </summary>
|
||||
/// <param name="noReturn"></param>
|
||||
public void goLogin(bool noReturn = false)
|
||||
{
|
||||
if (imagexf != null)
|
||||
@@ -853,33 +886,56 @@ public class LoginController : MonoBehaviour
|
||||
}
|
||||
//DOTween.To(() => o, x => o = x, t, 0.3f);
|
||||
this.StartScrollPanel(1);
|
||||
if (noReturn)
|
||||
if (noReturn)
|
||||
{
|
||||
loginContainer.Find("returnQuick").GetComponent<Button>().gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 立刻跳到登录页并且返回按钮强行失效
|
||||
/// </summary>
|
||||
private void goLoginImmediately()
|
||||
|
||||
void HidePassword()
|
||||
{
|
||||
imagedf.localPosition = new Vector3(-580, -34, 0);
|
||||
imagexf.localPosition = new Vector3(0, -669, 0);
|
||||
LoginBg.localPosition = Vector3.zero;
|
||||
LoginBg.GetComponent<RectTransform>().sizeDelta = new Vector2(360, 573);
|
||||
var scrollValue = 1f / (pageNums - 1);
|
||||
var value = 1 * scrollValue;
|
||||
scrollPanel.horizontalNormalizedPosition = value;
|
||||
loginContainer.Find("returnQuick").GetComponent<Button>().gameObject.SetActive(false);
|
||||
signPage1.Find("Password").gameObject.SetActive(false);
|
||||
signPage1.Find("CPassword").gameObject.SetActive(false);
|
||||
UIManager.RemoveEvent(signPage1.Find("signThird").gameObject);
|
||||
UIManager.AddEvent(signPage1.Find("signThird").gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
goRegNextWithoutPass();
|
||||
});
|
||||
//signPage1.Find("signThird").GetComponent<Button>().onClick.RemoveAllListeners();
|
||||
//signPage1.Find("signThird").GetComponent<Button>().onClick.AddListener(goRegNextWithoutPass);
|
||||
}
|
||||
void goSign(bool isAccount = true)
|
||||
|
||||
|
||||
void ShowPassword()
|
||||
{
|
||||
signForm.email.text = "";
|
||||
signForm.password.text = "";
|
||||
signForm.captcha.text = "";
|
||||
signForm.cpassword.text = "";
|
||||
signPage1.Find("Password").gameObject.SetActive(true);
|
||||
signPage1.Find("CPassword").gameObject.SetActive(true);
|
||||
UIManager.RemoveEvent(signPage1.Find("signThird").gameObject);
|
||||
UIManager.AddEvent(signPage1.Find("signThird").gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
goRegNext(1);
|
||||
});
|
||||
//signPage1.Find("signThird").GetComponent<Button>().onClick.RemoveAllListeners();
|
||||
//signPage1.Find("signThird").GetComponent<Button>().onClick.AddListener(() => { ; });
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="isAccount"></param>
|
||||
/// <param name="type">0 注册 1 忘记密码</param>
|
||||
void goSign(bool isAccount = true,int type = 0)
|
||||
{
|
||||
if (!isAccount)
|
||||
{
|
||||
pageNums = 5;
|
||||
//wxLogin2.gameObject.SetActive(false);
|
||||
signPage1.Find("next").gameObject.SetActive(false);
|
||||
signPage1.Find("BtnModiPass").gameObject.SetActive(false);
|
||||
signPage1.Find("previousThird").gameObject.SetActive(true);
|
||||
signPage1.Find("signThird").gameObject.SetActive(true);
|
||||
ShowPassword();
|
||||
@@ -888,17 +944,38 @@ public class LoginController : MonoBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
pageNums = 4;
|
||||
wxLogin2.gameObject.SetActive(false);
|
||||
|
||||
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);
|
||||
if (type == 0)
|
||||
{
|
||||
pageNums = 4;
|
||||
signContainer.Find("signText").GetComponent<Text>().text = "SIGN UP";
|
||||
wxLogin2.gameObject.SetActive(false);
|
||||
signPage1.Find("next").gameObject.SetActive(true);
|
||||
signPage1.Find("BtnModiPass").gameObject.SetActive(false);
|
||||
signPage1.Find("previousThird").gameObject.SetActive(false);
|
||||
signPage1.Find("signThird").gameObject.SetActive(false);
|
||||
ShowPassword();
|
||||
this.StartScrollPanel(2);
|
||||
this.StartScrollSign(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
pageNums = 4;
|
||||
signContainer.Find("signText").GetComponent<Text>().text = "RESET PASSWORD";
|
||||
wxLogin2.gameObject.SetActive(false);
|
||||
signPage1.Find("next").gameObject.SetActive(false);
|
||||
signPage1.Find("BtnModiPass").gameObject.SetActive(true);
|
||||
signPage1.Find("previousThird").gameObject.SetActive(false);
|
||||
signPage1.Find("signThird").gameObject.SetActive(false);
|
||||
ShowPassword();
|
||||
this.StartScrollPanel(2);
|
||||
this.StartScrollSign(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 登录/注册完成,去首页
|
||||
/// </summary>
|
||||
/// <param name="gou"></param>
|
||||
void goMain(Transform gou)
|
||||
{
|
||||
var data = userResult;
|
||||
@@ -920,19 +997,12 @@ public class LoginController : MonoBehaviour
|
||||
UIManager.Instance.userInfoIndex = 0;
|
||||
}
|
||||
App.CurrentUser = data;
|
||||
//App.CurrentUser = new UserModel
|
||||
//{
|
||||
// NickName = data.Nickname,
|
||||
// Ftp = data.FTP,
|
||||
// Weight = data.Weight,
|
||||
// BicycleWeight = data.BicycleWeight,
|
||||
// Carlories = "",
|
||||
// Avatar = data.WxHeadImg,
|
||||
// Distance = 0,
|
||||
// Climb = "",
|
||||
//};
|
||||
SceneManager.LoadScene("MainScene");
|
||||
}
|
||||
/// <summary>
|
||||
/// 缓存打钩的用户信息
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
public void SaveInfo(UserResultModel data)
|
||||
{
|
||||
var index = userInfos.FindIndex(x => x.Id == data.Id);
|
||||
@@ -967,23 +1037,12 @@ public class LoginController : MonoBehaviour
|
||||
}
|
||||
UIManager.Instance.userInfos = userInfos;
|
||||
UIManager.Instance.userInfoIndex = index;
|
||||
//PlayerPrefs.SetInt("UserInfoIndex", index);
|
||||
}
|
||||
/// <summary>
|
||||
/// 登录提交
|
||||
/// </summary>
|
||||
async void Submit()
|
||||
{
|
||||
//if (loginForm.email == null || loginForm.password == null)
|
||||
//{
|
||||
// Utils.showToast(gameObject, "未绑定", 1);
|
||||
// return;
|
||||
//}
|
||||
//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.LoginV1(loginForm.email.text, loginForm.password.text, "");
|
||||
//var res = await NoAuthApi.Login(phone.text, pwd.text);
|
||||
if (res.result)
|
||||
@@ -1022,16 +1081,6 @@ public class LoginController : MonoBehaviour
|
||||
}
|
||||
goScrollPanel();
|
||||
goScrollSign();
|
||||
//if (Input.GetKeyDown(KeyCode.Return) && )
|
||||
//{
|
||||
//}
|
||||
//if (Input.GetKeyDown(KeyCode.Return)) {
|
||||
// Debug.Log("回车键");
|
||||
// if (pwd.isFocused)
|
||||
// {
|
||||
// this.Submit();
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
#region 主页面滑动逻辑
|
||||
@@ -1074,20 +1123,7 @@ public class LoginController : MonoBehaviour
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
private void Test()
|
||||
{
|
||||
//if (startScrollPanel) return;
|
||||
//scrollPanelIndex = ((int)System.Math.Pow(tmpImdex, 3)
|
||||
// + 2*(int)System.Math.Pow(tmpImdex, 2)
|
||||
// + 1) % 4;
|
||||
//tmpImdex++;
|
||||
//Debug.Log(scrollPanelIndex);
|
||||
//startScrollPanel = true;
|
||||
if (startScrollSign) return;
|
||||
scrollSignIndex = (scrollSignIndex + 1) % 2;
|
||||
Debug.Log(scrollSignIndex);
|
||||
startScrollSign = true;
|
||||
}
|
||||
|
||||
#region 注册页面滑动逻辑
|
||||
private bool startScrollSign = false;
|
||||
private int scrollSignIndex = 0;
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace Assets.Scripts.UI.Control
|
||||
{
|
||||
case Type.Normal:
|
||||
{
|
||||
image.color = ConvertColor("#353543");
|
||||
image.color = ConvertColor("#414251");
|
||||
}
|
||||
break;
|
||||
case Type.Border:
|
||||
@@ -150,7 +150,7 @@ namespace Assets.Scripts.UI.Control
|
||||
{
|
||||
case Type.Normal:
|
||||
{
|
||||
image.color = ConvertColor("#353543");
|
||||
image.color = ConvertColor("#414251");
|
||||
}
|
||||
break;
|
||||
case Type.Border:
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: beb365ac9b4b5684981508211eca5546
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,39 @@
|
||||
using Assets.Scripts;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class LoadingAnimation : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
[SerializeField] Color c;
|
||||
void Start()
|
||||
{
|
||||
Refresh();
|
||||
}
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
void OnRectTransformDimensionsChange()
|
||||
{
|
||||
Refresh();
|
||||
}
|
||||
|
||||
private void OnValidate()
|
||||
{
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void Refresh()
|
||||
{
|
||||
Transform L = transform.Find("L"), R = transform.Find("R");
|
||||
if (L && R && c.a!=0)
|
||||
{
|
||||
transform.Find("L").GetComponent<Image>().color = c;
|
||||
transform.Find("R").GetComponent<Image>().color = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f5f763f23abe4724987b307b9cf9fb0f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,42 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class LoadingPf : MonoBehaviour
|
||||
{
|
||||
List<Sprite> sprites;
|
||||
Image image;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
sprites = new List<Sprite>();
|
||||
for (int i = 1; i < 80; i++)
|
||||
{
|
||||
sprites.Add(Resources.Load<Sprite>($"Images/全屏loading/loading{i.ToString("0000")}"));
|
||||
}
|
||||
image = transform.GetComponent<Image>();
|
||||
}
|
||||
int index = 0;
|
||||
float time = 0;
|
||||
public void Initial()
|
||||
{
|
||||
index = 0;
|
||||
time = 0;
|
||||
}
|
||||
void Update()
|
||||
{
|
||||
time += Time.deltaTime;
|
||||
if (time < 0.03)
|
||||
{
|
||||
return;
|
||||
}
|
||||
time = 0;
|
||||
if (index % 79 == 0)
|
||||
{
|
||||
index = 0;
|
||||
}
|
||||
image.sprite = sprites[index];
|
||||
index++;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0cb3d6b847d2e034b9ba054d0220dc0d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -54,6 +54,7 @@ public class FeedbackController : PFUIPanel
|
||||
for (int i = 0; i < images.childCount; i++)
|
||||
{
|
||||
images.GetChild(i).GetComponent<Image>().sprite = plus;
|
||||
images.GetChild(i).Find("close").gameObject.SetActive(false);
|
||||
//if (i > 0) SetImageActive(img, false);
|
||||
}
|
||||
content.Text = "";
|
||||
@@ -79,6 +80,11 @@ public class FeedbackController : PFUIPanel
|
||||
var self = ((PointerEventData)e).pointerEnter;
|
||||
Utils.OpenFile((path) =>
|
||||
{
|
||||
if (paths.ContainsValue(path))
|
||||
{
|
||||
Utils.showToast(gameObject, "图片已存在,请选择其他图片");
|
||||
return;
|
||||
}
|
||||
self.GetComponent<Image>().sprite = Utils.PngToSprite(path, 110, 110);
|
||||
self.transform.Find("close").gameObject.SetActive(true);
|
||||
paths[self.name] = path;
|
||||
|
||||
@@ -42,6 +42,10 @@ public class QuickLoginScroll : MonoBehaviour
|
||||
{
|
||||
lightbg.GetComponent<Image>().color = Utils.HexToColorHtml("#ffffff00");
|
||||
lightbg.GetComponent<Image>().gameObject.SetActive(false);
|
||||
int index = (int)System.Math.Round(
|
||||
(scroll.horizontalNormalizedPosition + (contentSize / 2)) / contentSize,
|
||||
0);
|
||||
content.GetChild(index).GetComponent<QuickLoginUser>().setNoActive();
|
||||
//lightbg.GetComponent<Image>().DOFade(0, 0.15f);
|
||||
}
|
||||
|
||||
@@ -66,27 +70,31 @@ public class QuickLoginScroll : MonoBehaviour
|
||||
void goLeft()
|
||||
{
|
||||
if (scroll.horizontalNormalizedPosition <= contentSize) return;
|
||||
doAni();
|
||||
if (!start) startPosition = scroll.horizontalNormalizedPosition;
|
||||
start = true;
|
||||
scrollValue = -1 * contentSize / 30;
|
||||
goMove(-1);
|
||||
}
|
||||
void goRight()
|
||||
{
|
||||
if ((scroll.horizontalNormalizedPosition + contentSize) >= 1) return;
|
||||
goMove();
|
||||
}
|
||||
void goMove(int i = 1)
|
||||
{
|
||||
doAni();
|
||||
if (!start) startPosition = scroll.horizontalNormalizedPosition;
|
||||
start = true;
|
||||
scrollValue = contentSize / 30;
|
||||
scrollValue = i*contentSize / 30;
|
||||
}
|
||||
private bool start = false, _lock = false;
|
||||
private bool start = false;
|
||||
private float scrollValue = 0, totalScrollValue = 0, startPosition = 0;
|
||||
void SetColor()
|
||||
{
|
||||
int index = (int)System.Math.Round(
|
||||
(scroll.horizontalNormalizedPosition + (contentSize / 2)) / contentSize,
|
||||
0);
|
||||
for (int i = 1; i < content.childCount-1; i++)
|
||||
//lightbg.GetComponent<Image>().gameObject.SetActive(true);
|
||||
//lightbg.GetComponent<Image>().DOFade(1, 0.2f);
|
||||
//content.GetChild(index).GetComponent<QuickLoginUser>().setActive();
|
||||
for (int i = 1; i < content.childCount - 1; i++)
|
||||
{
|
||||
string c;
|
||||
if (i == index)
|
||||
@@ -96,7 +104,7 @@ public class QuickLoginScroll : MonoBehaviour
|
||||
content.GetChild(i).GetComponent<QuickLoginUser>().setActive();
|
||||
//
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
content.GetChild(i).GetComponent<QuickLoginUser>().setNoActive();
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public class PropNames
|
||||
{ true,"#ffffff"},{false,"#5c5c6e" }
|
||||
};
|
||||
}
|
||||
public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler
|
||||
public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,IPointerUpHandler
|
||||
{
|
||||
float width;
|
||||
float height;
|
||||
@@ -68,8 +68,22 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler
|
||||
// //transform.DOLocalMoveY(localY.Value, 0.5f);
|
||||
//});
|
||||
|
||||
UIManager.AddEvent(transform.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, (Base) =>
|
||||
//UIManager.AddEvent(transform.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, (Base) =>
|
||||
//{
|
||||
// App.RouteIdParam = myMap.Id;
|
||||
// if (!App.MainSceneParam.ContainsKey("Name"))
|
||||
// {
|
||||
// App.MainSceneParam.Add("Name", "MapListPanel");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// App.MainSceneParam["Name"] = "MapListPanel";
|
||||
// }
|
||||
// SceneManager.LoadScene("Ride");
|
||||
//});
|
||||
transform.GetComponent<Button>().onClick.AddListener(() =>
|
||||
{
|
||||
//UIManager.ShowMapDetailPanel(myMap.Id);
|
||||
App.RouteIdParam = myMap.Id;
|
||||
if (!App.MainSceneParam.ContainsKey("Name"))
|
||||
{
|
||||
@@ -81,20 +95,6 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler
|
||||
}
|
||||
SceneManager.LoadScene("Ride");
|
||||
});
|
||||
//transform.GetComponent<Button>().onClick.AddListener(() =>
|
||||
//{
|
||||
// //UIManager.ShowMapDetailPanel(myMap.Id);
|
||||
// App.RouteIdParam = myMap.Id;
|
||||
// if (!App.MainSceneParam.ContainsKey("Name"))
|
||||
// {
|
||||
// App.MainSceneParam.Add("Name", "MapListPanel");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// App.MainSceneParam["Name"]= "MapListPanel";
|
||||
// }
|
||||
// SceneManager.LoadScene("Ride");
|
||||
//});
|
||||
transform.Find("Name").GetComponent<Text>().text = myMap.Name;
|
||||
Utils.DisplayImage(StartCoroutine, transform.Find("MapTitleImg").GetComponent<RawImage>(), myMap.CoverImage);
|
||||
|
||||
@@ -145,7 +145,9 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler
|
||||
localY = transform.localPosition.y;
|
||||
}
|
||||
transform.Find("CollectImg").gameObject.SetActive(true);
|
||||
transform.DOLocalMoveY(localY.Value + 5, 0.5f);
|
||||
transform.DOLocalMoveY(localY.Value + 5, 0.3f);
|
||||
transform.Find("Shadow").gameObject.SetActive(true);
|
||||
Cursor.SetCursor(Resources.Load<Texture2D>("Images/PointerButtonHover"), Vector2.zero, CursorMode.Auto);
|
||||
//SetActive4Button(true);
|
||||
SetColor(true);
|
||||
}
|
||||
@@ -157,8 +159,10 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler
|
||||
}
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
transform.DOLocalMoveY(localY.Value, 0.5f);
|
||||
transform.DOLocalMoveY(localY.Value, 0.3f);
|
||||
transform.Find("CollectImg").gameObject.SetActive(false);
|
||||
transform.Find("Shadow").gameObject.SetActive(false);
|
||||
Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
|
||||
//SetActive4Button(false);
|
||||
SetColor(false);
|
||||
}
|
||||
@@ -265,4 +269,9 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler
|
||||
{
|
||||
DestroyImmediate(this.gameObject);
|
||||
}
|
||||
|
||||
public void OnPointerUp(PointerEventData eventData)
|
||||
{
|
||||
Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
|
||||
}
|
||||
}
|
||||
@@ -96,7 +96,7 @@ public class EditUserController : PFUIPanel
|
||||
|
||||
ofn.defExt = "JPG";//显示文件的类型
|
||||
//注意 一下项目不一定要全选 但是0x00000008项不要缺少
|
||||
ofn.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;//OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST| OFN_ALLOWMULTISELECT|OFN_NOCHANGEDIR
|
||||
ofn.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000008;//OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST| OFN_ALLOWMULTISELECT|OFN_NOCHANGEDIR
|
||||
|
||||
|
||||
if (Win32.GetOpenFileName(ofn))
|
||||
|
||||
@@ -53,7 +53,7 @@ public class HomeController : PFUIPanel
|
||||
UIManager.ShowUserInfoPanel();
|
||||
//UIManager.ShowConfirm("Quit", "Do you want to quit PowerFun?", null);
|
||||
});
|
||||
GetSummary();
|
||||
//GetSummary();
|
||||
}
|
||||
private void GoRide(BaseEventData e)
|
||||
{
|
||||
@@ -64,17 +64,19 @@ public class HomeController : PFUIPanel
|
||||
{
|
||||
var pe = (PointerEventData)e;
|
||||
var parent = pe.pointerEnter.transform.parent;
|
||||
parent.Find("Image").GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/home/Entrance - ROUTES_hover");
|
||||
parent.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
||||
parent.GetComponent<RectTransform>().localScale = new Vector3(1.05f, 1.05f, 0);
|
||||
//parent.Find("Image").GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/home/Entrance - ROUTES_hover");
|
||||
//parent.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
||||
parent.DOScale(new Vector3(1.05f, 1.05f, 0), 0.3f);
|
||||
//parent.GetComponent<RectTransform>().localScale = ;
|
||||
}
|
||||
private void OnExit(BaseEventData e)
|
||||
{
|
||||
var pe = (PointerEventData)e;
|
||||
var parent = pe.pointerEnter.transform.parent;
|
||||
parent.Find("Image").GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/home/Entrance - ROUTES_nomal");
|
||||
parent.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#5C5C6E");
|
||||
parent.GetComponent<RectTransform>().localScale = new Vector3(1f, 1f, 0);
|
||||
//parent.Find("Image").GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/home/Entrance - ROUTES_nomal");
|
||||
//parent.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#5C5C6E");
|
||||
parent.DOScale(new Vector3(1f, 1f, 0), 0.3f);
|
||||
//parent.GetComponent<RectTransform>().localScale = new Vector3(1f, 1f, 0);
|
||||
}
|
||||
void MoreFunc()
|
||||
{
|
||||
|
||||
@@ -49,9 +49,11 @@ public class MapListController : PFUIPanel
|
||||
//}
|
||||
//ApiBase.SetCookie("15A37DF28842CBA8E4E550BFA24186C8222D392F3EE18D9E95A49CC32796D2E3F6E40385C6A114942546EE1DD793DF34880DE48090B91AD2460EB887B59664BB3965F3371DDA1F1401EC7F27C5A1084566E47069F12CB6BBC0BC7A84ADC5582B");
|
||||
btnMapMode = this.transform.Find("SwitchMode").gameObject;
|
||||
|
||||
SetRounded(btnMapMode.transform, 64);
|
||||
UIManager.AddEvent(btnMapMode.transform.Find("GoList").gameObject, EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
UIManager.PopStack();
|
||||
UIManager.ShowBigMapPanel();
|
||||
});
|
||||
if (content!=null)
|
||||
@@ -349,7 +351,14 @@ public class MapListController : PFUIPanel
|
||||
var cg = this.GetComponent<CanvasGroup>();
|
||||
cg.alpha = 0;
|
||||
base.Show();
|
||||
|
||||
if (App.TextureCache.ContainsKey("rotateImage"))
|
||||
{
|
||||
transform.Find("RawImage").GetComponent<RawImage>().texture = App.TextureCache["rotateImage"];
|
||||
}
|
||||
else if(App.DefaultRotateTexture!=null)
|
||||
{
|
||||
transform.Find("RawImage").GetComponent<RawImage>().texture = App.DefaultRotateTexture;
|
||||
}
|
||||
cg.DOFade(1f, .3f);
|
||||
}
|
||||
}
|
||||
@@ -117,26 +117,30 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
|
||||
}
|
||||
void SetButtonColor(bool f)
|
||||
{
|
||||
if (f)
|
||||
if (index == 0)
|
||||
{
|
||||
bool enabled = routeResult.ContinueCyclingParam == null;
|
||||
btnContinue.GetComponent<Image>().color =
|
||||
enabled ? Utils.HexToColorHtml("#c8c8c880"): Utils.HexToColorHtml("#F93086");
|
||||
btnReRide.GetComponent<Image>().color = Utils.HexToColorHtml("#F93086");
|
||||
btnDelete.GetComponent<Image>().color = Utils.HexToColorHtml("#353543");
|
||||
btnContinue.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
||||
btnReRide.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
||||
btnDelete.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#474759");
|
||||
}
|
||||
else
|
||||
{
|
||||
btnContinue.GetComponent<Image>().color = Utils.HexToColorHtml("#414251");
|
||||
btnReRide.GetComponent<Image>().color = Utils.HexToColorHtml("#414251");
|
||||
btnDelete.GetComponent<Image>().color = Utils.HexToColorHtml("#23232D");
|
||||
btnContinue.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#353543");
|
||||
btnReRide.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#353543");
|
||||
btnDelete.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#353543");
|
||||
if (f)
|
||||
{
|
||||
bool enabled = routeResult.ContinueCyclingParam == null;
|
||||
btnContinue.GetComponent<Image>().color =
|
||||
enabled ? Utils.HexToColorHtml("#75264e") : Utils.HexToColorHtml("#F93086");
|
||||
btnReRide.GetComponent<Image>().color = Utils.HexToColorHtml("#F93086");
|
||||
btnDelete.GetComponent<Image>().color = Utils.HexToColorHtml("#353543");
|
||||
btnContinue.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
||||
btnReRide.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
||||
btnDelete.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#474759");
|
||||
}
|
||||
else
|
||||
{
|
||||
btnContinue.GetComponent<Image>().color = Utils.HexToColorHtml("#414251");
|
||||
btnReRide.GetComponent<Image>().color = Utils.HexToColorHtml("#414251");
|
||||
btnDelete.GetComponent<Image>().color = Utils.HexToColorHtml("#23232D");
|
||||
btnContinue.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#353543");
|
||||
btnReRide.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#353543");
|
||||
btnDelete.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#353543");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
|
||||
@@ -8,6 +8,7 @@ using Assets.Scripts.UI.Prefab.Login;
|
||||
using Newtonsoft.Json;
|
||||
using UnityEngine.UI;
|
||||
using Assets.Scripts.UI.Control;
|
||||
using Assets.Scripts;
|
||||
|
||||
public class UIManager : MonoBehaviour
|
||||
{
|
||||
@@ -374,7 +375,15 @@ public class UIManager : MonoBehaviour
|
||||
public static void ShowPrePanel()
|
||||
{
|
||||
stack.Pop();
|
||||
UIManager.Show(stack.Pop(), UIManager.Instance.MainPanel);
|
||||
var panel = stack.Pop();
|
||||
if (panel == null)
|
||||
{
|
||||
ShowBigMapPanel();
|
||||
}
|
||||
else
|
||||
{
|
||||
UIManager.Show(panel, UIManager.Instance.MainPanel);
|
||||
}
|
||||
|
||||
//if (prePanel.name.Contains("EditUserPanel"))
|
||||
//{
|
||||
@@ -392,6 +401,7 @@ public class UIManager : MonoBehaviour
|
||||
//var root = UIManager.Instance.MainPanel.transform.parent.parent;
|
||||
var bigMap = (GameObject)Instantiate(obj, UIManager.Instance.Root.transform);
|
||||
bigMap.GetComponent<BigMapController>().Show();
|
||||
stack.Push(bigMap.GetComponent<PFUIPanel>());
|
||||
//prePanel = bigMap.GetComponent<PFUIPanel>();
|
||||
}
|
||||
|
||||
@@ -552,6 +562,7 @@ public class UIManager : MonoBehaviour
|
||||
PlayerPrefs.SetString("Settings", JsonConvert.SerializeObject(value));
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
UIManager.Instance = null;
|
||||
|
||||
@@ -120,7 +120,30 @@ namespace Assets.Scripts
|
||||
}));
|
||||
}
|
||||
/*显示简略提示,需要拖Toast的预制件,且保证其他组件名字不是Toast,ToastContainer*/
|
||||
|
||||
public static void showLoading(this GameObject game)
|
||||
{
|
||||
var parent = Utils.FindUpParent(game.transform);
|
||||
var loading = parent.Find("Loading");
|
||||
if (loading == null)
|
||||
{
|
||||
var newLoading = MonoBehaviour.Instantiate(Resources.Load<GameObject>("UI/Prefab/Common/Loading"));
|
||||
newLoading.name = "Loading";
|
||||
newLoading.GetComponent<RectTransform>().position = new Vector3(Screen.width / 2, Screen.height / 2, 0);
|
||||
newLoading.transform.parent = parent;
|
||||
loading = newLoading.transform;
|
||||
}
|
||||
loading.GetComponent<LoadingPf>().Initial();
|
||||
loading.gameObject.SetActive(true);
|
||||
}
|
||||
public static void hideLoading(this GameObject game)
|
||||
{
|
||||
var parent = Utils.FindUpParent(game.transform);
|
||||
var loading = parent.Find("Loading");
|
||||
if (loading != null)
|
||||
{
|
||||
loading.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
/*删除父亲节点下的所有孩子*/
|
||||
static public void DestroyChildren(this Transform t)
|
||||
{
|
||||
@@ -160,15 +183,6 @@ namespace Assets.Scripts
|
||||
else
|
||||
img.texture = ((DownloadHandlerTexture)request.downloadHandler).texture;
|
||||
}
|
||||
static IEnumerator DownloadImageToLocal(RawImage img, string MediaUrl)
|
||||
{
|
||||
UnityWebRequest request = UnityWebRequestTexture.GetTexture(MediaUrl);
|
||||
yield return request.SendWebRequest();
|
||||
if (request.isNetworkError || request.isHttpError)
|
||||
Debug.Log(request.error);
|
||||
else
|
||||
img.texture = ((DownloadHandlerTexture)request.downloadHandler).texture;
|
||||
}
|
||||
|
||||
static IEnumerator DownloadImageCallBack(RawImage img, string MediaUrl,Action<string> action)
|
||||
{
|
||||
@@ -193,8 +207,48 @@ namespace Assets.Scripts
|
||||
return FindUpParent(zi.parent);
|
||||
}
|
||||
/*获取最顶层对象*/
|
||||
/*Texture相关*/
|
||||
public static void WriteTextureToPlayerPrefs(string tag, Texture2D tex)
|
||||
{
|
||||
// if texture is png otherwise you can use tex.EncodeToJPG().
|
||||
byte[] texByte = tex.EncodeToPNG();
|
||||
|
||||
// convert byte array to base64 string
|
||||
string base64Tex = System.Convert.ToBase64String(texByte);
|
||||
|
||||
// write string to playerpref
|
||||
PlayerPrefs.SetString(tag, base64Tex);
|
||||
PlayerPrefs.Save();
|
||||
}
|
||||
public static Texture2D ReadTextureFromPlayerPrefs(string tag)
|
||||
{
|
||||
// load string from playerpref
|
||||
string base64Tex = PlayerPrefs.GetString(tag, null);
|
||||
|
||||
if (!string.IsNullOrEmpty(base64Tex))
|
||||
{
|
||||
// convert it to byte array
|
||||
byte[] texByte = System.Convert.FromBase64String(base64Tex);
|
||||
Texture2D tex = new Texture2D(2, 2);
|
||||
|
||||
//load texture from byte array
|
||||
if (tex.LoadImage(texByte))
|
||||
{
|
||||
return tex;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
/*Texture相关*/
|
||||
public static byte[] StreamToBytes(Stream stream)
|
||||
{
|
||||
byte[] bytes = new byte[stream.Length];
|
||||
stream.Read(bytes, 0, bytes.Length);
|
||||
// 设置当前流的位置为流的开始
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public static Color HexToColor(string hex)
|
||||
{
|
||||
@@ -261,8 +315,8 @@ namespace Assets.Scripts
|
||||
|
||||
ofn.defExt = "JPG";//显示文件的类型
|
||||
//注意 一下项目不一定要全选 但是0x00000008项不要缺少
|
||||
ofn.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;//OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST| OFN_ALLOWMULTISELECT|OFN_NOCHANGEDIR
|
||||
|
||||
ofn.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000008;
|
||||
//0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008 OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST| OFN_ALLOWMULTISELECT|OFN_NOCHANGEDIR
|
||||
|
||||
if (Win32.GetOpenFileName(ofn))
|
||||
{
|
||||
@@ -270,7 +324,7 @@ namespace Assets.Scripts
|
||||
}
|
||||
}
|
||||
/*打开文件*/
|
||||
/**/
|
||||
/*文本框/下拉框错误*/
|
||||
public static void SetValidate(Dictionary<string, Selectable> dict, JArray errorList)
|
||||
{
|
||||
foreach (var error in errorList)
|
||||
@@ -289,5 +343,6 @@ namespace Assets.Scripts
|
||||
//formDict[error.Value<string>("Filed")].error.Value<string>("ErrMsg");
|
||||
}
|
||||
}
|
||||
/*文本框/下拉框错误*/
|
||||
}
|
||||
}
|
||||
@@ -12,10 +12,11 @@ namespace Assets.Scripts
|
||||
[DllImport("Comdlg32.dll", SetLastError = true, ThrowOnUnmappableChar = true, CharSet = CharSet.Auto)]
|
||||
public static extern bool GetOpenFileName([In, Out] OpenFileName ofn);
|
||||
public static bool GetOpenFileName1([In, Out] OpenFileName ofn)
|
||||
|
||||
{
|
||||
return GetOpenFileName(ofn);
|
||||
}
|
||||
[DllImport("user32.dll")]
|
||||
public static extern IntPtr GetForegroundWindow();
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +25,7 @@ namespace Assets.Scripts
|
||||
public class OpenFileName
|
||||
{
|
||||
public int structSize = 0;
|
||||
public IntPtr dlgOwner = IntPtr.Zero;
|
||||
public IntPtr dlgOwner = Win32.GetForegroundWindow();
|
||||
public IntPtr instance = IntPtr.Zero;
|
||||
public String filter = null;
|
||||
public String customFilter = null;
|
||||
|
||||
Reference in new issue
Block a user