71 lines
2.0 KiB
C#
71 lines
2.0 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class UIChineseChessHint : SubUIBase
|
|
{
|
|
public Button TongYi;
|
|
public Button JuJue;
|
|
string targetID;
|
|
public TextMeshProUGUI tmp_msg;
|
|
protected override void OnShow(object args = null)
|
|
{
|
|
base.OnShow(args);
|
|
if (args != null)
|
|
{
|
|
var v = (HintData)args;
|
|
if (v.hintType == 1)
|
|
{
|
|
foreach (var item in v.roomData.users)
|
|
{
|
|
if (item.userId!=GameManager.Instance.user.id)
|
|
{
|
|
tmp_msg.text = $"<color=red>{item.userName}</color> 向您发起了求和";
|
|
targetID=item.userId;
|
|
}
|
|
}
|
|
|
|
}
|
|
else if (v.hintType == 2)
|
|
{
|
|
foreach (var item in v.roomData.users)
|
|
{
|
|
if (item.userId != GameManager.Instance.user.id)
|
|
{
|
|
tmp_msg.text = $"<color=red>{item.userName}</color> 向您发起了认输";
|
|
targetID = item.userId;
|
|
}
|
|
}
|
|
}
|
|
TongYi.onClick.AddListener(() =>
|
|
{
|
|
//WebSocketSendList.GameOperationChineseChess(v.roomData.roomId, 2, GameManager.Instance.user.id);
|
|
WebSocketSendList.EndGameChineseChess(v.roomData.roomId,targetID);
|
|
uIManager.Hide(UIPanel.ZGXQHint);
|
|
});
|
|
JuJue.onClick.AddListener(() =>
|
|
{
|
|
//WebSocketSendList.EndGameChineseChess(v.roomData.roomId, targetID);
|
|
uIManager.Hide(UIPanel.ZGXQHint);
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
}
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
}
|