登录页一些特效,路书列表详情框架

This commit is contained in:
Caiyanpeng committed 2021-04-01 11:01:05 +08:00
1 parent 326b74bd03
commit 996f924719
50 files changed
+19916 -6804

No files matched your search

+110 -9
View File
@@ -8,27 +8,53 @@ using System.Collections.Generic;
using System.Reflection;
using System.Text;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
//记录:小f 是-457和-681
public class LoginForm
{
public InputField phone;
public InputField pwd;
}
public class LoginController : MonoBehaviour
{
[SerializeField] InputField phone;
[SerializeField] InputField pwd;
[SerializeField] InputField[] loginForm;
[SerializeField] Button login;
[SerializeField] Button loginNewAccount;
[SerializeField] Button loginReturn2;
[SerializeField] Button returnQuick;
[SerializeField] Button regNext;
[SerializeField] Button regPrev;
[SerializeField] Button sign;
[SerializeField] Button remember;
[SerializeField] GameObject loginScrollView;
[SerializeField] GameObject signScrollView;
[SerializeField] GameObject avatarScrollView;
[SerializeField] RawImage loading;
[SerializeField] Button exit;
private ScrollRect scrollPanel;
private ScrollRect scrollSign;
private ScrollRect scrollAvatar;
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 (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);
@@ -46,6 +72,10 @@ public class LoginController : MonoBehaviour
{
scrollSign = signScrollView.GetComponent<ScrollRect>();
}
if (avatarScrollView != null)
{
scrollAvatar = avatarScrollView.GetComponent<ScrollRect>();
}
if (loginNewAccount != null)
{
loginNewAccount.onClick.AddListener(goLogin);
@@ -58,13 +88,76 @@ public class LoginController : MonoBehaviour
{
sign.onClick.AddListener(goSign);
}
if (loginReturn2 != null)
{
loginReturn2.onClick.AddListener(goLoginReturn2);
}
if (regNext != null)
{
regNext.onClick.AddListener(goRegNext);
}
if (regPrev != null)
{
regPrev.onClick.AddListener(goRegPrev);
}
if (exit != null)
{
exit.onClick.AddListener(() => Application.Quit());
}
if (remember != null)
{
remember.onClick.AddListener(() =>
{
var gou = remember.transform.Find("Gou");
if (gou.gameObject.activeSelf)
{
gou.gameObject.SetActive(false);
}
else
{
gou.gameObject.SetActive(true);
}
});
}
imagexf = transform.Find("Panel").Find("LoginContainer").Find("Imagexf");
}
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()
{
StartScrollSign(0);
}
private void goRegNext()
{
StartScrollSign(1);
}
private void goLoginReturn2()
{
this.StartScrollPanel(1);
}
void ReturnQuick()
{
if (imagexf != null)
{
imagexf.DOLocalMove(new Vector3(0, -457, 0), 0.3f);
imagexf.DOLocalMove(new Vector3(0, -447, 0), 0.3f);
}
this.StartScrollPanel(0);
}
@@ -72,17 +165,18 @@ public class LoginController : MonoBehaviour
{
if (imagexf != null)
{
imagexf.DOLocalMove(new Vector3(0, -681, 0), 0.3f);
imagexf.DOLocalMove(new Vector3(0, -635, 0), 0.3f);
}
this.StartScrollPanel(1);
}
void goSign()
{
this.StartScrollPanel(2);
this.StartScrollSign(0);
}
async void Submit()
{
if (phone == null || pwd == null)
if (loginForm[0] == null || loginForm[1] == null)
{
Utils.showToast(gameObject, "未绑定", 1);
return;
@@ -109,10 +203,10 @@ public class LoginController : MonoBehaviour
// Update is called once per frame
void Update()
{
Debug.Log($"{phone.isFocused}, ${pwd != null}, ${Input.GetKeyDown(KeyCode.Tab)}");
if (phone.isFocused && pwd != null && Input.GetKeyDown(KeyCode.Tab))
//Debug.Log($"{phone.isFocused}, ${pwd != null}, ${Input.GetKeyDown(KeyCode.Tab)}");
if (loginForm[0].isFocused && loginForm[1] != null && Input.GetKeyDown(KeyCode.Tab))
{
pwd.ActivateInputField();
loginForm[1].ActivateInputField();
}
goScrollPanel();
goScrollSign();
@@ -131,7 +225,7 @@ public class LoginController : MonoBehaviour
#region 主页面滑动逻辑
private int tmpImdex = 0;
private int scrollPanelIndex = 2;
private float scrollValue = 0.5f;
//private float scrollValue = 0.5f;
private bool startScrollPanel = false;
private void StartScrollPanel(int index)
{
@@ -142,6 +236,7 @@ public class LoginController : MonoBehaviour
private void goScrollPanel()
{
var index = scrollPanelIndex;
var scrollValue = 1f/(3 - 1);
var value = index * scrollValue;
if (scrollPanel != null && startScrollPanel)
{
@@ -183,6 +278,12 @@ public class LoginController : MonoBehaviour
#region 注册页面滑动逻辑
private bool startScrollSign = false;
private int scrollSignIndex = 0;
private void StartScrollSign(int index)
{
if (startScrollSign) return;
scrollSignIndex = index;
startScrollSign = true;
}
private void goScrollSign()
{
float value = scrollSignIndex;