Files
5.24BuYu/Assets/MyGame/aa/UI/Login/UILoginPanel.cs
T
2026-07-25 21:04:58 +08:00

93 lines
2.1 KiB
C#

using Assets.MyGame.Scripts.Net;
using Assets.MyGame.Scripts.Net.APIRequest.Params;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class UILoginPanel : UIBase
{
SubUIManager uIManager;
public UIPanelAddressConfig loginConfig;
public Transform subPanelParent;
[Header("手机登录按钮")]
public Button phoneLogin;
public GameObject phoneLogin1;
[Header("隐私协议多选狂")]
public Toggle privacyPolicy;
[Header("加载中进度条")]
public GameObject loadingParent;
[Header("登录隐私父对象")]
public GameObject loginParent;
[Header("测试")]
public Button WXLogin;
private void Awake()
{
uIManager = new SubUIManager(subPanelParent, loginConfig, this);
#if UNITY_EDITOR
phoneLogin1.SetActive(true);
#else
phoneLogin1.SetActive(false);
#endif
APIManager.token = null;
}
private void Start()
{
phoneLogin.onClick.AddListener(OnPhoneLogin);
WXLogin.onClick.AddListener(() =>
{
APIRequestList.LoginWx(
new LoginWxParam
{
#if UNITY_EDITOR
openId = "1"
#else
openId = "2"
#endif
},
res =>
{
WebSocketManager.Instance.Connect(SocketType.login);
(uIManager.parentUIBase as UILoginPanel)?.Succeed();
});
});
}
private void OnPhoneLogin()
{
uIManager.ShowAsync(UIPanel.LoginEnterPanel);
}
public void Succeed()
{
uIManager.CloseAll();
loginParent.SetActive(false);
loadingParent.SetActive(true);
//这里要跳转到具体的登录界面
UIManager.Instance.ShowAsync(UIPanel.HomeMainPanel, UIPanel.LoginPanel);
}
public override void Show(object args = null)
{
base.Show(args);
if (loadingParent.activeSelf)
{
loadingParent.SetActive(false);
}
if (!loginParent.activeSelf)
{
loginParent.SetActive(true);
}
}
}