登录页一些效果,接路线列表页
This commit is contained in:
1 parent
d1d9c92f1c
commit
f45711f39f
78 files changed
+9990
-5830
No files matched your search
@@ -10,27 +10,76 @@ using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
//记录:小f 是-457和-681
|
||||
public class LoginController : MonoBehaviour
|
||||
{
|
||||
[SerializeField] InputField phone;
|
||||
[SerializeField] InputField pwd;
|
||||
[SerializeField] Button login;
|
||||
[SerializeField] Button loginNewAccount;
|
||||
[SerializeField] Button returnQuick;
|
||||
[SerializeField] Button sign;
|
||||
[SerializeField] GameObject loginScrollView;
|
||||
[SerializeField] GameObject signScrollView;
|
||||
[SerializeField] RawImage loading;
|
||||
private ScrollRect scrollPanel;
|
||||
private ScrollRect scrollSign;
|
||||
private Transform imagexf;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
transform.Find("RawImage").DOMove(new Vector3(0.5f,0.5f,0),1);
|
||||
if (login != null)
|
||||
//transform.Find("RawImage").DOMove(new Vector3(0.5f,0.5f,0),1);
|
||||
if (login != null)
|
||||
{
|
||||
login.onClick.AddListener(Submit);
|
||||
//login.onClick.AddListener(Submit);
|
||||
}
|
||||
if (loading != null)
|
||||
if (loading != null)
|
||||
{
|
||||
loading.texture.wrapMode = TextureWrapMode.Repeat;
|
||||
}
|
||||
if (loginScrollView != null)
|
||||
{
|
||||
scrollPanel = loginScrollView.GetComponent<ScrollRect>();
|
||||
}
|
||||
if (signScrollView != null)
|
||||
{
|
||||
scrollSign = signScrollView.GetComponent<ScrollRect>();
|
||||
}
|
||||
if (loginNewAccount != null)
|
||||
{
|
||||
loginNewAccount.onClick.AddListener(goLogin);
|
||||
}
|
||||
if (returnQuick != null)
|
||||
{
|
||||
returnQuick.onClick.AddListener(ReturnQuick);
|
||||
}
|
||||
if (sign != null)
|
||||
{
|
||||
sign.onClick.AddListener(goSign);
|
||||
}
|
||||
imagexf = transform.Find("Panel").Find("LoginContainer").Find("Imagexf");
|
||||
}
|
||||
void ReturnQuick()
|
||||
{
|
||||
if (imagexf != null)
|
||||
{
|
||||
imagexf.DOLocalMove(new Vector3(0, -457, 0), 0.3f);
|
||||
}
|
||||
this.StartScrollPanel(0);
|
||||
}
|
||||
void goLogin()
|
||||
{
|
||||
if (imagexf != null)
|
||||
{
|
||||
imagexf.DOLocalMove(new Vector3(0, -681, 0), 0.3f);
|
||||
}
|
||||
this.StartScrollPanel(1);
|
||||
}
|
||||
void goSign()
|
||||
{
|
||||
this.StartScrollPanel(2);
|
||||
}
|
||||
|
||||
async void Submit()
|
||||
{
|
||||
if (phone == null || pwd == null)
|
||||
@@ -65,6 +114,8 @@ public class LoginController : MonoBehaviour
|
||||
{
|
||||
pwd.ActivateInputField();
|
||||
}
|
||||
goScrollPanel();
|
||||
goScrollSign();
|
||||
//if (Input.GetKeyDown(KeyCode.Return) && )
|
||||
//{
|
||||
//}
|
||||
@@ -76,5 +127,86 @@ public class LoginController : MonoBehaviour
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
#region 主页面滑动逻辑
|
||||
private int tmpImdex = 0;
|
||||
private int scrollPanelIndex = 2;
|
||||
private float scrollValue = 0.5f;
|
||||
private bool startScrollPanel = false;
|
||||
private void StartScrollPanel(int index)
|
||||
{
|
||||
if (startScrollPanel) return;
|
||||
scrollPanelIndex = index;
|
||||
startScrollPanel = true;
|
||||
}
|
||||
private void goScrollPanel()
|
||||
{
|
||||
var index = scrollPanelIndex;
|
||||
var value = index * scrollValue;
|
||||
if (scrollPanel != null && startScrollPanel)
|
||||
{
|
||||
if (scrollPanel.horizontalNormalizedPosition >= value)
|
||||
{
|
||||
scrollPanel.horizontalNormalizedPosition -= (scrollValue / 20);
|
||||
if (scrollPanel.horizontalNormalizedPosition <= value)
|
||||
{
|
||||
scrollPanel.horizontalNormalizedPosition = value;
|
||||
startScrollPanel = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
scrollPanel.horizontalNormalizedPosition += (scrollValue / 20);
|
||||
if (scrollPanel.horizontalNormalizedPosition >= value)
|
||||
{
|
||||
scrollPanel.horizontalNormalizedPosition = value;
|
||||
startScrollPanel = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#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;
|
||||
private void goScrollSign()
|
||||
{
|
||||
float value = scrollSignIndex;
|
||||
if (scrollSign != null && startScrollSign)
|
||||
{
|
||||
if (scrollSignIndex == 0)
|
||||
{
|
||||
scrollSign.horizontalNormalizedPosition -= (1f / 20);
|
||||
if (scrollSign.horizontalNormalizedPosition <= 0)
|
||||
{
|
||||
scrollSign.horizontalNormalizedPosition = 0;
|
||||
startScrollSign = false;
|
||||
}
|
||||
}
|
||||
else if (scrollSignIndex == 1)
|
||||
{
|
||||
scrollSign.horizontalNormalizedPosition += (1f / 20);
|
||||
if (scrollSign.horizontalNormalizedPosition >= 1)
|
||||
{
|
||||
scrollSign.horizontalNormalizedPosition = 1;
|
||||
startScrollSign = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
Reference in new issue
Block a user