增加移动端界面暂存
This commit is contained in:
1 parent
31e8e3bebb
commit
3c9d489c76
56 files changed
+59321
-2517
No files matched your search
+14
-9
@@ -11,14 +11,19 @@ using Assets.Scripts.Devices;
|
||||
|
||||
public static class App
|
||||
{
|
||||
public static string Host = "http://192.168.0.101:5083/";
|
||||
public static string Host = "http://192.168.0.101:5084/";
|
||||
|
||||
public static string AppVersion = Application.version;
|
||||
|
||||
public static int RouteIdParam = 0;
|
||||
public static UserResultModel CurrentUser { get; set; }
|
||||
public static string WxAppId = "wx9e8ca734e024f084";
|
||||
|
||||
#if !(UNITY_ANDROID || UNITY_IOS)
|
||||
//pc版微信id
|
||||
public static string WxAppId => "wx9e8ca734e024f084";
|
||||
#else
|
||||
//移动版微信id
|
||||
public static string WxAppId => "wx9146e6697a6aef2d";
|
||||
#endif
|
||||
public static string MapBoxAccessToken => "pk.eyJ1IjoiYW5keXNqdCIsImEiOiJja2ZhajE5OGwwamRiMnltcW96bHk0ZWFuIn0.GvKanc6UveWSvIjS9HfBPA";
|
||||
|
||||
public static double latitude { get; internal set; }
|
||||
@@ -72,12 +77,12 @@ public static class App
|
||||
static App()
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
Host = "http://pf.juze.pro/";
|
||||
UdpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 21000);
|
||||
TcpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 21001);
|
||||
//Host = "https://wx.powerfun.com.cn/";
|
||||
//UdpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 11000);
|
||||
//TcpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 11001);
|
||||
//Host = "http://pf.juze.pro/";
|
||||
//UdpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 21000);
|
||||
//TcpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 21001);
|
||||
Host = "https://wx.powerfun.com.cn/";
|
||||
UdpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 11000);
|
||||
TcpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 11001);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,33 @@
|
||||
using Assets.Scripts;
|
||||
using DG.Tweening;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class LoginControllerMobile : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
ScrollRect loginScrollView;
|
||||
Transform thirdLoginPage;
|
||||
void Awake()
|
||||
{
|
||||
|
||||
loginScrollView = transform.Find("Panel/LoginContainer/LoginScrollView").GetComponent<ScrollRect>();
|
||||
thirdLoginPage = loginScrollView.content.Find("FormContainer-Login/Mask/FormContainer-third");
|
||||
UIManager.AddEvent(loginScrollView.content.Find("FormContainer-Login/Mask/FormContainer/BtnThirdLogin").gameObject,
|
||||
UnityEngine.EventSystems.EventTriggerType.PointerClick,
|
||||
(b)=> ShowThirdLoginPage());
|
||||
UIManager.AddEvent(loginScrollView.content.Find("FormContainer-Login/Mask/FormContainer-third/BtnReturn").gameObject,
|
||||
UnityEngine.EventSystems.EventTriggerType.PointerClick,
|
||||
(b) => HideThirdLoginPage());
|
||||
UIManager.AddEvent(loginScrollView.content.Find("FormContainer-Login/Mask/FormContainer-third/otherContainer/Wechat").gameObject,
|
||||
UnityEngine.EventSystems.EventTriggerType.PointerClick,
|
||||
(b) => goWxLogin());
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
@@ -18,11 +35,22 @@ public class LoginControllerMobile : MonoBehaviour
|
||||
}
|
||||
private void ShowThirdLoginPage()
|
||||
{
|
||||
|
||||
thirdLoginPage.DOLocalMoveY(0, 0.3f);
|
||||
}
|
||||
private void HideThirdLoginPage()
|
||||
public void HideThirdLoginPage()
|
||||
{
|
||||
|
||||
thirdLoginPage.DOLocalMoveY(-301, 0.3f);
|
||||
}
|
||||
private void goWxLogin()
|
||||
{
|
||||
#if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS)
|
||||
var weChat = App.weChatController;
|
||||
weChat.Init(App.WxAppId);
|
||||
if (weChat.IsWeChatAppInstalled())
|
||||
{
|
||||
weChat.WxLogin("snsapi_userinfo", "");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/// <summary>
|
||||
/// 从ios或者安卓接收code,在c#里不建议调用
|
||||
|
||||
@@ -148,10 +148,10 @@ public class LoginController : MonoBehaviour
|
||||
EventTriggerType.PointerClick, (b) => goRegNext(1));
|
||||
//signPage1.Find("signThird").GetComponent<Button>().onClick.AddListener(() => { goRegNext(1); });
|
||||
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;
|
||||
//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());
|
||||
@@ -211,7 +211,9 @@ public class LoginController : MonoBehaviour
|
||||
countrys = countrys,
|
||||
units = units,
|
||||
};
|
||||
#if !(UNITY_ANDROID || UNITY_IOS)
|
||||
signScrollBar = signScrollView.transform.Find("Image").Find("Image");
|
||||
#endif
|
||||
}
|
||||
if (avatarScrollView != null)
|
||||
{
|
||||
@@ -219,7 +221,11 @@ public class LoginController : MonoBehaviour
|
||||
var content = scrollAvatar.transform.Find("Viewport").Find("Content");
|
||||
foreach (var user in userInfos)
|
||||
{
|
||||
#if !(UNITY_ANDROID || UNITY_IOS)
|
||||
var info = Instantiate(Resources.Load<GameObject>("UI/Prefab/Login/QuickUserInfo")).transform;
|
||||
#else
|
||||
var info = Instantiate(Resources.Load<GameObject>("UI/Prefab/Login/Mobile/QuickUserInfo")).transform;
|
||||
#endif
|
||||
info.GetComponent<QuickLoginUser>().Initial(user, transform);
|
||||
info.SetParent(content);
|
||||
info.localScale = new Vector3(1, 1, 1);
|
||||
@@ -253,10 +259,11 @@ public class LoginController : MonoBehaviour
|
||||
}
|
||||
});
|
||||
UIManager.AddEvent(loginContainer.Find("ForgetPassword").gameObject, EventTriggerType.PointerClick, (e) =>goSign(type:1));
|
||||
#if !(UNITY_IOS || UNITY_ANDROID)
|
||||
var wechatLogin = loginContainer.Find("otherContainer").Find("Wechat").GetComponent<Button>();
|
||||
UIManager.AddEvent(wechatLogin.gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
#if !(UNITY_IOS || UNITY_ANDROID)
|
||||
|
||||
if (wxLock) return;
|
||||
wxLock = true;
|
||||
//wxState = (DateTime.Now.ToUniversalTime().Ticks / 10000 * new System.Random().Next(1, 5)).ToString();
|
||||
@@ -274,9 +281,9 @@ public class LoginController : MonoBehaviour
|
||||
//Debug.Log(178 + "已经开启" + wx1.gameObject.activeSelf);
|
||||
//wx1.GetComponent<CanvasGroup>().DOFade(1, 0.8f).onComplete = () => { wxLock = false; };
|
||||
wxLogin1.DOLocalMoveY(0, 0.3f).onComplete = () => { wxLock = false; };
|
||||
#endif
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
#endif
|
||||
var login = loginContainer.Find("login").GetComponent<Button>();
|
||||
UIManager.AddEvent(login.gameObject, EventTriggerType.PointerClick, (b) => Submit());
|
||||
//login.onClick.AddListener(Submit);
|
||||
@@ -292,11 +299,18 @@ public class LoginController : MonoBehaviour
|
||||
//}
|
||||
if (signContainer != null)
|
||||
{
|
||||
#if !(UNITY_ANDROID || UNITY_IOS)
|
||||
var loginr2 = signContainer.Find("loginr2").GetComponent<Button>();
|
||||
UIManager.AddEvent(loginr2.gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
goLoginReturn2();
|
||||
});
|
||||
#else
|
||||
UIManager.AddEvent(signContainer.Find("loginr2").gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
goLoginReturn2();
|
||||
});
|
||||
#endif
|
||||
}
|
||||
if (exit != null)
|
||||
{
|
||||
@@ -308,7 +322,7 @@ public class LoginController : MonoBehaviour
|
||||
},2);
|
||||
});
|
||||
}
|
||||
|
||||
#if !(UNITY_IOS || UNITY_ANDROID)
|
||||
wxLogin1 = mainContent.Find("FormContainer-Login").Find("Mask").Find("FormContainer-wx1");
|
||||
if (wxLogin1 != null)
|
||||
{
|
||||
@@ -316,7 +330,6 @@ public class LoginController : MonoBehaviour
|
||||
{
|
||||
wxReturnLogin();
|
||||
});
|
||||
#if !(UNITY_IOS || UNITY_ANDROID)
|
||||
wxBrowser = wxLogin1.Find("Browser (GUI)").GetComponent<Browser>();
|
||||
if (wxBrowser != null)
|
||||
{
|
||||
@@ -339,15 +352,18 @@ public class LoginController : MonoBehaviour
|
||||
//browser.Zoom = 0.5f;
|
||||
//browser.
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
#endif
|
||||
wxLogin2 = mainContent.Find("FormContainer-wx2");
|
||||
if (wxLogin2 != null)
|
||||
{
|
||||
UIManager.AddEvent(wxLogin2.Find("return").gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
#if !(UNITY_IOS || UNITY_ANDROID)
|
||||
wxLogin1.gameObject.SetActive(false);
|
||||
wxLogin1.GetComponent<RectTransform>().localPosition = new Vector3(0, -573, 0);
|
||||
#endif
|
||||
wxLogin2.gameObject.SetActive(false);
|
||||
//wxLogin3.gameObject.SetActive(false);
|
||||
pageNums = 4;
|
||||
@@ -382,8 +398,10 @@ public class LoginController : MonoBehaviour
|
||||
else
|
||||
{
|
||||
signContainer.gameObject.SetActive(true);
|
||||
#if !(UNITY_IOS || UNITY_ANDROID)
|
||||
wxLogin1.gameObject.SetActive(false);
|
||||
wxLogin1.GetComponent<RectTransform>().localPosition = new Vector3(0, -573, 0);
|
||||
#endif
|
||||
pageNums = 4;
|
||||
//wxLogin3.gameObject.SetActive(false);
|
||||
StartScrollPanel(1);
|
||||
@@ -427,6 +445,7 @@ public class LoginController : MonoBehaviour
|
||||
{"Phone",loginForm.email },
|
||||
{"Pwd",loginForm.password },
|
||||
};
|
||||
#if !(UNITY_ANDROID || UNITY_IOS)
|
||||
loginForm.email.onEndEdit.AddListener(async (s) =>
|
||||
{
|
||||
if (!string.IsNullOrEmpty(s) && avatarName!=s)
|
||||
@@ -443,6 +462,7 @@ public class LoginController : MonoBehaviour
|
||||
}
|
||||
}
|
||||
});
|
||||
#endif
|
||||
signFormDict = new Dictionary<string, Selectable>
|
||||
{
|
||||
{ "Phone",signForm.email},
|
||||
@@ -467,15 +487,7 @@ public class LoginController : MonoBehaviour
|
||||
async void Init()
|
||||
{
|
||||
|
||||
#if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS)
|
||||
var weChat = App.weChatController;
|
||||
//WeChatController weChat = new WeChatController();
|
||||
weChat.Init("wx9146e6697a6aef2d");
|
||||
if (weChat.IsWeChatAppInstalled())
|
||||
{
|
||||
weChat.WxLogin("snsapi_userinfo", "");
|
||||
}
|
||||
#endif
|
||||
|
||||
UIManager.Instance.ModalsPanel = this.transform.Find("ModalPanel").GetComponent<PFUIPanel>();
|
||||
userInfos = UIManager.Instance.userInfos;
|
||||
App.DefaultRotateTexture = Utils.ReadTextureFromPlayerPrefs("rotateImage");
|
||||
@@ -543,7 +555,7 @@ public class LoginController : MonoBehaviour
|
||||
/// </summary>
|
||||
private void AdjustWxQrCode()
|
||||
{
|
||||
#if !(UNITY_IOS || UNITY_ANDROID)
|
||||
#if !(UNITY_IOS || UNITY_ANDROID)
|
||||
wxBrowser.EvalJSCSP(@"
|
||||
document.getElementsByClassName('qrcode')[0].style.marginTop = 0;
|
||||
document.getElementsByClassName('title')[0].style.display = 'none';
|
||||
@@ -815,6 +827,12 @@ public class LoginController : MonoBehaviour
|
||||
void goRegEnd()
|
||||
{
|
||||
if (!UpdateInfo()) return;
|
||||
#if UNITY_ANDROID || UNITY_IOS
|
||||
imagedf.GetComponent<Image>().DOFade(1, 0.3f);
|
||||
imagexf.GetComponent<Image>().DOFade(1, 0.3f);
|
||||
LoginBg.GetComponent<RectTransform>().DOSizeDelta(new Vector2(354, 300), 0.3f);
|
||||
LoginBg.GetComponent<RectTransform>().DOLocalMoveY(-35, 0.3f);
|
||||
#endif
|
||||
if (pageNums == 5)
|
||||
{
|
||||
this.StartScrollPanel(4);
|
||||
@@ -899,22 +917,31 @@ public class LoginController : MonoBehaviour
|
||||
/// </summary>
|
||||
private void goLoginReturn2()
|
||||
{
|
||||
#if UNITY_ANDROID || UNITY_IOS
|
||||
imagedf.GetComponent<Image>().DOFade(1, .3f);
|
||||
imagexf.GetComponent<Image>().DOFade(1, .3f);
|
||||
LoginBg.GetComponent<RectTransform>().DOSizeDelta(new Vector2(354, 300), .3f);
|
||||
LoginBg.GetComponent<RectTransform>().DOLocalMoveY(-35, .3f);
|
||||
#endif
|
||||
if (wxLogin2.gameObject.activeSelf) wxLogin2.gameObject.SetActive(false);
|
||||
//if (wxLogin3.gameObject.activeSelf) wxLogin3.gameObject.SetActive(false);
|
||||
pageNums = 4;
|
||||
#if !(UNITY_ANDROID || UNITY_IOS)
|
||||
if (wxLogin1.transform.localPosition.y == 0)
|
||||
{
|
||||
wxReturnLogin();
|
||||
}
|
||||
#else
|
||||
transform.GetComponent<LoginControllerMobile>().HideThirdLoginPage();
|
||||
#endif
|
||||
Canvas.ForceUpdateCanvases();
|
||||
this.StartScrollPanel(1);
|
||||
}
|
||||
#if !(UNITY_IOS || UNITY_ANDROID)
|
||||
void wxReturnLogin()
|
||||
{
|
||||
wxLock = true;
|
||||
#if !(UNITY_IOS || UNITY_ANDROID)
|
||||
wxBrowser.LoadHTML("<div/>");
|
||||
#endif
|
||||
//wxBrowser.Url = "chrome://version/";
|
||||
wxLogin1.DOLocalMoveY(-573, 0.3f).onComplete = () =>
|
||||
{
|
||||
@@ -922,17 +949,18 @@ public class LoginController : MonoBehaviour
|
||||
wxLogin1.gameObject.SetActive(false);
|
||||
};
|
||||
}
|
||||
#endif
|
||||
/// <summary>
|
||||
/// 立刻跳到登录页并且返回按钮强行失效
|
||||
/// </summary>
|
||||
private void goLoginImmediately()
|
||||
{
|
||||
#if !(UNITY_IOS || UNITY_ANDROID)
|
||||
#if !(UNITY_IOS || UNITY_ANDROID)
|
||||
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);
|
||||
#endif
|
||||
#endif
|
||||
var scrollValue = 1f / (pageNums - 1);
|
||||
var value = 1 * scrollValue;
|
||||
scrollPanel.horizontalNormalizedPosition = value;
|
||||
@@ -943,7 +971,7 @@ public class LoginController : MonoBehaviour
|
||||
/// </summary>
|
||||
void ReturnQuick()
|
||||
{
|
||||
#if !(UNITY_IOS || UNITY_ANDROID)
|
||||
#if !(UNITY_IOS || UNITY_ANDROID)
|
||||
if (imagexf != null)
|
||||
{
|
||||
imagexf.DOLocalMoveY(-575, 0.3f);
|
||||
@@ -957,7 +985,7 @@ public class LoginController : MonoBehaviour
|
||||
LoginBg.GetComponent<RectTransform>().DOSizeDelta(new Vector2(360, 385), 0.3f);
|
||||
LoginBg.GetComponent<RectTransform>().DOLocalMoveY(-94, 0.3f);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
this.StartScrollPanel(0);
|
||||
}
|
||||
/// <summary>
|
||||
@@ -1027,6 +1055,12 @@ public class LoginController : MonoBehaviour
|
||||
/// <param name="type">0 注册 1 忘记密码</param>
|
||||
void goSign(bool isAccount = true,int type = 0)
|
||||
{
|
||||
#if UNITY_ANDROID || UNITY_IOS
|
||||
imagedf.GetComponent<Image>().DOFade(0, .3f);
|
||||
imagexf.GetComponent<Image>().DOFade(0, .3f);
|
||||
LoginBg.GetComponent<RectTransform>().DOSizeDelta(new Vector2(354, 370), .3f);
|
||||
LoginBg.GetComponent<RectTransform>().DOLocalMoveY(0, .3f);
|
||||
#endif
|
||||
if (!isAccount)
|
||||
{
|
||||
pageNums = 5;
|
||||
@@ -1097,7 +1131,7 @@ public class LoginController : MonoBehaviour
|
||||
App.RideSetting.Sensitivity = data.Sensitivity;
|
||||
//查询我参加的比赛
|
||||
UIManager.UpdateJoinCompetition();
|
||||
SceneManager.LoadScene("MainScene");
|
||||
SceneManager.LoadSceneAsync("MainScene");
|
||||
}
|
||||
/// <summary>
|
||||
/// 缓存打钩的用户信息
|
||||
@@ -1201,8 +1235,7 @@ public class LoginController : MonoBehaviour
|
||||
{
|
||||
CaptchaTimerTick();
|
||||
}
|
||||
goScrollPanel();
|
||||
goScrollSign();
|
||||
|
||||
//if (wxLogin1.gameObject.activeInHierarchy)
|
||||
//{
|
||||
// adjTime += Time.deltaTime;
|
||||
@@ -1214,6 +1247,11 @@ public class LoginController : MonoBehaviour
|
||||
// }
|
||||
//}
|
||||
}
|
||||
private void FixedUpdate()
|
||||
{
|
||||
goScrollPanel();
|
||||
goScrollSign();
|
||||
}
|
||||
//float adjTime = 0;
|
||||
//bool startJs = false;
|
||||
#region 主页面滑动逻辑
|
||||
@@ -1237,7 +1275,7 @@ public class LoginController : MonoBehaviour
|
||||
{
|
||||
if (scrollPanel.horizontalNormalizedPosition >= value)
|
||||
{
|
||||
scrollPanel.horizontalNormalizedPosition -= (scrollValue / 20);
|
||||
scrollPanel.horizontalNormalizedPosition -= (scrollValue / 10);
|
||||
if (scrollPanel.horizontalNormalizedPosition <= value)
|
||||
{
|
||||
scrollPanel.horizontalNormalizedPosition = value;
|
||||
@@ -1246,7 +1284,7 @@ public class LoginController : MonoBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
scrollPanel.horizontalNormalizedPosition += (scrollValue / 20);
|
||||
scrollPanel.horizontalNormalizedPosition += (scrollValue / 10);
|
||||
if (scrollPanel.horizontalNormalizedPosition >= value)
|
||||
{
|
||||
scrollPanel.horizontalNormalizedPosition = value;
|
||||
@@ -1295,7 +1333,9 @@ public class LoginController : MonoBehaviour
|
||||
// signForm.height.text = "";
|
||||
//}
|
||||
}
|
||||
#if !(UNITY_ANDROID || UNITY_IOS)
|
||||
signScrollBar.DOLocalMoveX((index-1) *160, 0.2f);
|
||||
#endif
|
||||
}
|
||||
private void goScrollSign()
|
||||
{
|
||||
@@ -1304,7 +1344,7 @@ public class LoginController : MonoBehaviour
|
||||
{
|
||||
if (scrollSignIndex == 0)
|
||||
{
|
||||
scrollSign.horizontalNormalizedPosition -= (1f / 20);
|
||||
scrollSign.horizontalNormalizedPosition -= (1f / 10);
|
||||
if (scrollSign.horizontalNormalizedPosition <= 0)
|
||||
{
|
||||
scrollSign.horizontalNormalizedPosition = 0;
|
||||
@@ -1314,7 +1354,7 @@ public class LoginController : MonoBehaviour
|
||||
}
|
||||
else if (scrollSignIndex == 1)
|
||||
{
|
||||
scrollSign.horizontalNormalizedPosition += (1f / 20);
|
||||
scrollSign.horizontalNormalizedPosition += (1f / 10);
|
||||
if (scrollSign.horizontalNormalizedPosition >= 1)
|
||||
{
|
||||
scrollSign.horizontalNormalizedPosition = 1;
|
||||
|
||||
@@ -21,7 +21,10 @@ public class MainController : BaseScene
|
||||
Version.text = "V"+App.AppVersion;
|
||||
DeviceCache.Init(PFConstants.DeviceCacheFolder);
|
||||
Loom.Initialize();
|
||||
|
||||
#if UNITY_ANDROID || UNITY_IOS
|
||||
transform.GetComponent<CanvasScaler>().referenceResolution = new Vector2(844,390);
|
||||
transform.Find("Panel").GetComponent<RectTransform>().sizeDelta = new Vector2(844, 390);
|
||||
#endif
|
||||
App.MainDeviceAdapter.StartScan();
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,10 @@ public class QuickLoginScroll : MonoBehaviour
|
||||
void Start()
|
||||
{
|
||||
scroll = gameObject.GetComponent<ScrollRect>();
|
||||
//scroll.onValueChanged.AddListener((a) =>
|
||||
//{
|
||||
// Debug.Log(a);
|
||||
//});
|
||||
content = gameObject.transform.Find("Viewport").Find("Content");
|
||||
lightbg = transform.parent.Find("Light");
|
||||
//Initial();
|
||||
@@ -42,9 +46,7 @@ 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);
|
||||
int index = GetIndex();
|
||||
content.GetChild(index).GetComponent<QuickLoginUser>().setNoActive();
|
||||
//lightbg.GetComponent<Image>().DOFade(0, 0.15f);
|
||||
}
|
||||
@@ -52,6 +54,7 @@ public class QuickLoginScroll : MonoBehaviour
|
||||
public void Initial()
|
||||
{
|
||||
count = content.childCount;
|
||||
#if !(UNITY_ANDROID || UNITY_IOS)
|
||||
if (content.childCount - 2 > 0)
|
||||
{
|
||||
contentSize = 1f / (content.childCount - 2);
|
||||
@@ -60,11 +63,27 @@ public class QuickLoginScroll : MonoBehaviour
|
||||
{
|
||||
contentSize = 0;
|
||||
}
|
||||
#else
|
||||
if (content.childCount - 3 > 0)
|
||||
{
|
||||
contentSize = 1f / (content.childCount - 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
contentSize = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
//scroll.horizontalNormalizedPosition = 0;
|
||||
Canvas.ForceUpdateCanvases();
|
||||
var i = PlayerPrefs.GetInt("UserInfoIndex");
|
||||
Debug.Log($"51 {i}");
|
||||
#if !(UNITY_ANDROID || UNITY_IOS)
|
||||
scroll.horizontalNormalizedPosition = contentSize/2+i*contentSize;
|
||||
#else
|
||||
scroll.horizontalNormalizedPosition = i * contentSize;
|
||||
Debug.Log(scroll.horizontalNormalizedPosition);
|
||||
#endif
|
||||
SetColor();
|
||||
}
|
||||
void goLeft()
|
||||
@@ -74,7 +93,8 @@ public class QuickLoginScroll : MonoBehaviour
|
||||
}
|
||||
void goRight()
|
||||
{
|
||||
if ((scroll.horizontalNormalizedPosition + contentSize) >= 1) return;
|
||||
Debug.Log(scroll.horizontalNormalizedPosition);
|
||||
if (scroll.horizontalNormalizedPosition+0.0001 >= 1) return;
|
||||
goMove();
|
||||
}
|
||||
void goMove(int i = 1)
|
||||
@@ -82,15 +102,25 @@ public class QuickLoginScroll : MonoBehaviour
|
||||
doAni();
|
||||
if (!start) startPosition = scroll.horizontalNormalizedPosition;
|
||||
start = true;
|
||||
scrollValue = i*contentSize / 30;
|
||||
scrollValue = i*contentSize / 10;
|
||||
}
|
||||
private bool start = false;
|
||||
private float scrollValue = 0, totalScrollValue = 0, startPosition = 0;
|
||||
void SetColor()
|
||||
int GetIndex()
|
||||
{
|
||||
int index = (int)System.Math.Round(
|
||||
#if !(UNITY_ANDROID || UNITY_IOS)
|
||||
return (int)System.Math.Round(
|
||||
(scroll.horizontalNormalizedPosition + (contentSize / 2)) / contentSize,
|
||||
0);
|
||||
#else
|
||||
return (int)System.Math.Round(
|
||||
(scroll.horizontalNormalizedPosition+ contentSize) / contentSize,
|
||||
0);
|
||||
#endif
|
||||
}
|
||||
void SetColor()
|
||||
{
|
||||
int index = GetIndex();
|
||||
//lightbg.GetComponent<Image>().gameObject.SetActive(true);
|
||||
//lightbg.GetComponent<Image>().DOFade(1, 0.2f);
|
||||
//content.GetChild(index).GetComponent<QuickLoginUser>().setActive();
|
||||
@@ -111,7 +141,7 @@ public class QuickLoginScroll : MonoBehaviour
|
||||
}
|
||||
}
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
void FixedUpdate()
|
||||
{
|
||||
if (start)
|
||||
{
|
||||
|
||||
@@ -250,7 +250,11 @@ public class EditUserController : PFUIPanel
|
||||
{
|
||||
UIManager.ShowConfirm("Logout", "Do you want to log out and change accounts?", () =>
|
||||
{
|
||||
#if !(UNITY_ANDROID || UNITY_IOS)
|
||||
SceneManager.LoadScene("Login");
|
||||
#else
|
||||
SceneManager.LoadScene("Login-Mobile");
|
||||
#endif
|
||||
UIManager.CloseConfirm();
|
||||
},2);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,11 @@ public class UserInfoController : PFUIPanel
|
||||
{
|
||||
UIManager.ShowConfirm("Logout", "Do you want to log out and change accounts?", () =>
|
||||
{
|
||||
#if !(UNITY_ANDROID || UNITY_IOS)
|
||||
SceneManager.LoadScene("Login");
|
||||
#else
|
||||
SceneManager.LoadScene("Login-Mobile");
|
||||
#endif
|
||||
UIManager.CloseConfirm();
|
||||
},2);
|
||||
});
|
||||
|
||||
@@ -152,7 +152,7 @@ public class UIManager : MonoBehaviour
|
||||
{
|
||||
UIManager.PopStack();
|
||||
}
|
||||
UIManager.Instance.MainPanel.GetComponent<Image>().sprite =
|
||||
UIManager.Instance.MainPanel.transform.parent.Find("Bg").GetComponent<Image>().sprite =
|
||||
Resources.Load<Sprite>("Images/Race/RACE-BG");
|
||||
UIManager.Show(UIManager.Instance.RaceHomePanel, UIManager.Instance.MainPanel);
|
||||
}
|
||||
@@ -307,7 +307,11 @@ public class UIManager : MonoBehaviour
|
||||
{
|
||||
if (internalComponent == null)
|
||||
{
|
||||
#if !(UNITY_ANDROID || UNITY_IOS)
|
||||
UnityEngine.Object @object = Resources.Load("UI/Prefab/Panel/" + prefabName);
|
||||
#else
|
||||
UnityEngine.Object @object = Resources.Load("UI/Prefab/Panel/Mobile/" + prefabName);
|
||||
#endif
|
||||
if (@object != null)
|
||||
{
|
||||
GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(@object, base.transform.parent, false);
|
||||
@@ -464,7 +468,7 @@ public class UIManager : MonoBehaviour
|
||||
public static void ShowHomePanel()
|
||||
{
|
||||
stack.Clear();
|
||||
UIManager.Instance.MainPanel.GetComponent<Image>().sprite =
|
||||
UIManager.Instance.MainPanel.transform.parent.Find("Bg").GetComponent<Image>().sprite =
|
||||
Resources.Load<Sprite>("Images/main-bg");
|
||||
UIManager.Show(UIManager.Instance.HomePanel, UIManager.Instance.MainPanel);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user