第一次进地球,登录页bug修改,主页面交互修改,其它细节

This commit is contained in:
Caiyanpeng committed 2021-04-30 17:46:00 +08:00
1 parent f7b33bf491
commit 333542a63a
30 files changed
+1990 -2007

No files matched your search

+55 -28
View File
@@ -146,6 +146,8 @@ public class LoginController : MonoBehaviour
signPage2 = content.Find("NextPage");
UIManager.AddEvent(signPage2.Find("previous").GetComponent<Button>().gameObject,
EventTriggerType.PointerClick, (b) => goRegPrev());
signPage2.Find("previous").GetComponent<Button>().enabled = false;
signPage2.Find("previous").GetComponent<Button>().interactable = false;
//signPage2.Find("previous").GetComponent<Button>().onClick.AddListener(goRegPrev);
UIManager.AddEvent(signPage2.Find("sign").GetComponent<Button>().gameObject,
EventTriggerType.PointerClick, (b) => goRegEnd());
@@ -252,15 +254,22 @@ public class LoginController : MonoBehaviour
{
if (wxLock) return;
wxLock = true;
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();
var wx1 = mainContent.Find("FormContainer-Login").Find("Mask").Find("FormContainer-wx1");
wx1.gameObject.SetActive(true);
Debug.Log(178 + "已经开启" + wx1.gameObject.activeSelf);
//wxBrowser.RegisterFunction("isFinish", args =>
//{
// Debug.Log(331);
// startJs = false;
//});
////AdjustWxQrCode();
//startJs = true;
//var wx1 = mainContent.Find("FormContainer-Login").Find("Mask").Find("FormContainer-wx1");
wxLogin1.gameObject.SetActive(true);
//Debug.Log(178 + "已经开启" + wx1.gameObject.activeSelf);
//wx1.GetComponent<CanvasGroup>().DOFade(1, 0.8f).onComplete = () => { wxLock = false; };
wx1.DOLocalMoveY(0, 0.3f).onComplete = () => { wxLock = false; };
wxLogin1.DOLocalMoveY(0, 0.3f).onComplete = () => { wxLock = false; };
});
var login = loginContainer.Find("login").GetComponent<Button>();
@@ -326,6 +335,7 @@ public class LoginController : MonoBehaviour
// writable: false
// }
//});");
wxBrowser.onTextureUpdated += OnUserScan;
//browser.Zoom = 0.5f;
//browser.
@@ -337,10 +347,12 @@ public class LoginController : MonoBehaviour
{
UIManager.AddEvent(wxLogin2.Find("return").gameObject, EventTriggerType.PointerClick, (b) =>
{
wxLogin1.gameObject.SetActive(false);
wxLogin1.GetComponent<RectTransform>().localPosition = new Vector3(0, -573, 0);
wxLogin2.gameObject.SetActive(false);
//wxLogin3.gameObject.SetActive(false);
pageNums = 4;
Canvas.ForceUpdateCanvases();
//Canvas.ForceUpdateCanvases();
StartScrollPanel(1);
});
wxLogin2.Find("Next").GetComponent<Button>().onClick.AddListener(() =>
@@ -451,6 +463,8 @@ public class LoginController : MonoBehaviour
userInfos = UIManager.Instance.userInfos;
App.DefaultRotateTexture = Utils.ReadTextureFromPlayerPrefs("rotateImage");
var notifyId = PlayerPrefs.GetInt("notifyId");
App.firstEnter = PlayerPrefs.GetInt("firstEnter");
PlayerPrefs.SetInt("firstEnter", 1);
var r = await ConfigHelper.userApi.GetNotify();
if (r.result)
{
@@ -502,25 +516,26 @@ public class LoginController : MonoBehaviour
/// </summary>
private void AdjustWxQrCode()
{
wxBrowser.EvalJS(@"
let time = null;
let f = ()=>{
document.getElementsByClassName('qrcode')[0].style.marginTop = 0;
document.getElementsByClassName('title')[0].style.display = 'none';
document.getElementById('wx_default_tip').childNodes[3].innerHTML = `""PowerFun""`;
document.body.style.background = '#272732';
document.body.style.overflow = 'hidden';
document.body.style.transformOrigin = 'top left';
document.body.style.transform = 'scale(0.85106382978)';
document.body.style.padding = '0';
if(document.body.style.padding === '0px' && time!=null){
clearInterval(time);
}
}
f();
if(document.body.style.padding !== '0px'){
time = setInterval(f,500);
}");
wxBrowser.EvalJSCSP(@"
const f = ()=>{
//if(document.body.style.padding === '0px')
//{
// console.log('停止');
// isFinish();
// return;
//}
console.log('js调整');
document.getElementsByClassName('qrcode')[0].style.marginTop = 0;
document.getElementsByClassName('title')[0].style.display = 'none';
document.getElementById('wx_default_tip').childNodes[3].innerHTML = `""PowerFun""`;
document.body.style.background = '#272732';
document.body.style.overflow = 'hidden';
document.body.style.transformOrigin = 'top left';
document.body.style.transform = 'scale(0.85106382978)';
document.body.style.padding = '0';
}
f();").Done();
}
//浏览器加载回调
private async void OnUserScan()
@@ -529,12 +544,12 @@ public class LoginController : MonoBehaviour
{
//AdjustWxQrCode();
}
Debug.Log(wxBrowser.Url);
//Debug.Log(wxBrowser.Url);
var rgx = Regex.Match(wxBrowser.Url, @"https\:\/\/wx.powerfun.com.cn/NoAuth/v1/WxWebLogin\?code=(.*?)&state=(.*?)$");
var groups = rgx.Groups;
if (groups.Count == 3)
{
wxLogin1.gameObject.SetActive(false);
wxBrowser.LoadHTML("<div />");
var state = groups[2].Value;
if (state == wxState)
{
@@ -547,6 +562,7 @@ public class LoginController : MonoBehaviour
var r = await ConfigHelper.userApi.OnWebWxLoginCheckUnionId(unionId, openId);
if (r.result)
{
JObject data = JObject.FromObject(r.data);
if (data.Value<string>("success") != null && data.Value<string>("success") == "False")
{
@@ -1129,8 +1145,19 @@ public class LoginController : MonoBehaviour
}
goScrollPanel();
goScrollSign();
//if (wxLogin1.gameObject.activeInHierarchy)
//{
// adjTime += Time.deltaTime;
// if (adjTime >= 0.5 && wxLogin1.gameObject.activeInHierarchy && startJs)
// {
// Debug.Log("在调整");
// adjTime = 0;
// AdjustWxQrCode();
// }
//}
}
//float adjTime = 0;
//bool startJs = false;
#region 主页面滑动逻辑
private int tmpImdex = 0;
private int scrollPanelIndex = 2;