85 lines
2.3 KiB
C#
85 lines
2.3 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 UIChineseChessWin : SubUIBase
|
|
{
|
|
public Button JiXuYouXi;
|
|
public Button FanHuiDaTing;
|
|
|
|
//---top
|
|
public Image avatar_Top;
|
|
public TextMeshProUGUI tMP_ID_Top;
|
|
public TextMeshProUGUI tMP_Name_Top;
|
|
public TextMeshProUGUI coinCountAdd;
|
|
|
|
//---bottom
|
|
public Image avatar_Bottom;
|
|
public TextMeshProUGUI tMP_ID_Bottom;
|
|
public TextMeshProUGUI tMP_Name_Bottom;
|
|
public TextMeshProUGUI coinCountMinus;
|
|
|
|
public override void Awake()
|
|
{
|
|
|
|
}
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
protected override void OnShow(object args = null)
|
|
{
|
|
base.OnShow(args);
|
|
ChineseChessGameClassList.ChessGameRoom roomData = ((ChineseChessMainPanel)uIManager.parentUIBase).roomData;
|
|
coinCountAdd.text = "+" + roomData.gold;
|
|
coinCountMinus.text = "-" + roomData.gold;
|
|
foreach (var item in roomData.users)
|
|
{
|
|
if (item.userId == GameManager.Instance.user.BaseInfo.number)
|
|
{
|
|
//--top
|
|
|
|
StartCoroutine(item.DownTexture2d((t2d) =>
|
|
{
|
|
avatar_Top.sprite = Sprite.Create(t2d, new Rect(0, 0, t2d.width, t2d.height), new Vector2(0.5f, 0.5f));
|
|
}));
|
|
tMP_ID_Top.text = item.userId;
|
|
tMP_Name_Top.text = item.userName;
|
|
}
|
|
else
|
|
{
|
|
//--top
|
|
|
|
StartCoroutine(item.DownTexture2d((t2d) =>
|
|
{
|
|
avatar_Bottom.sprite = Sprite.Create(t2d, new Rect(0, 0, t2d.width, t2d.height), new Vector2(0.5f, 0.5f));
|
|
}));
|
|
tMP_ID_Bottom.text = item.userId;
|
|
tMP_Name_Bottom.text = item.userName;
|
|
}
|
|
}
|
|
|
|
|
|
JiXuYouXi.onClick.RemoveAllListeners();
|
|
JiXuYouXi.onClick.AddListener(() =>
|
|
{
|
|
uIManager.CloseAll();
|
|
WebSocketSendList.GetRoomListChineseChess(1);
|
|
});
|
|
FanHuiDaTing.onClick.RemoveAllListeners();
|
|
FanHuiDaTing.onClick.AddListener(() =>
|
|
{
|
|
UIManager.Instance.Close(UIPanel.MainGamePanelZGXQ);
|
|
});
|
|
}
|
|
}
|