82 lines
2.3 KiB
C#
82 lines
2.3 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.BaseInfo.number)
|
|
{
|
|
tmp_msg.text = $"<color=red>{item.userId}</color> 向您发起了求和";
|
|
targetID=item.userId;
|
|
}
|
|
}
|
|
|
|
}
|
|
else if (v.hintType == 2)
|
|
{
|
|
foreach (var item in v.roomData.users)
|
|
{
|
|
if (item.userId != GameManager.Instance.user.BaseInfo.number)
|
|
{
|
|
tmp_msg.text = $"是否确认认输";
|
|
targetID = item.userId;
|
|
}
|
|
}
|
|
}
|
|
TongYi.onClick.AddListener(() =>
|
|
{
|
|
//WebSocketSendList.GameOperationChineseChess(v.roomData.roomId, 2, GameManager.Instance.user.BaseInfo.number);
|
|
if (v.hintType == 1)
|
|
{
|
|
//WebSocketSendList.EndGameChineseChess(v.roomData.roomId, targetID);
|
|
WebSocketSendList.EndGameChineseChess(v.roomData.roomId, null);
|
|
uIManager.Hide(UIPanel.ZGXQHint);
|
|
}
|
|
else if (v.hintType == 2)
|
|
{
|
|
|
|
WebSocketSendList.EndGameChineseChess(v.roomData.roomId, targetID);
|
|
}
|
|
|
|
|
|
});
|
|
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()
|
|
{
|
|
|
|
}
|
|
}
|