Files
5.24BuYu/Assets/MyGame/aa/UI/Game/ChineseChess/UIChineseChessJoinRoom.cs
T
2026-10-06 01:14:13 +08:00

55 lines
1.7 KiB
C#

using Assets.MyGame.Scripts.Net.WebResponses.ChineseChess;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class UIChineseChessJoinRoom : SubUIBase
{
public TMP_InputField tMPInput_Password;
public Button btn_Notarize;
public Button btn_Paste;
public override void Awake()
{
base.Awake();
btn_Paste.onClick.AddListener(() =>
{
tMPInput_Password.text = ClipboardUtility.GetText();
});
}
protected override void OnShow(object args = null)
{
base.OnShow(args);
var v = (ChineseChessGameClassList.ChessGameRoom)args;
btn_Notarize.onClick.RemoveAllListeners();
btn_Notarize.onClick.AddListener(() =>
{
if (tMPInput_Password.text.Length == 6)
{
// 4.4 重新进入该房间:解除"已退出房间"的推送过滤
(uIManager.parentUIBase as ChineseChessMainPanel)?.MarkJoiningRoom(v.roomId);
WebSocketSendList.JoinGameChineseChess(v.roomId, tMPInput_Password.text, GameManager.Instance.user.BaseInfo.number);
}
else
{
UIManager.Instance.ShowBoardError("密码格式错误");
}
});
if (args != null)
{
tMPInput_Password.text = "";
tMPInput_Password.onValueChanged.RemoveAllListeners();
tMPInput_Password.onValueChanged.AddListener((a) =>
{
if (a.Length > 6)
{
tMPInput_Password.text = a.Substring(0, 6);
}
});
}
}
}