53 lines
1.5 KiB
C#
53 lines
1.5 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)
|
|
{
|
|
WebSocketSendList.JoinGameChineseChess(v.roomId, tMPInput_Password.text, GameManager.Instance.user.id);
|
|
}
|
|
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);
|
|
}
|
|
});
|
|
}
|
|
|
|
}
|
|
}
|