using Assets.MyGame.Scripts.Net.WebResponses.ChineseChess; using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI; public class UIChineseChessDefeated : SubUIBase { public Button JiXuYouXi; public Button FanHuiDaTing; //---top public Image avatar_Top; public TextMeshProUGUI tMP_ID_Top; public TextMeshProUGUI tMP_Name_Top; public TextMeshProUGUI coinCountMinus; //---bottom public Image avatar_Bottom; public TextMeshProUGUI tMP_ID_Bottom; public TextMeshProUGUI tMP_Name_Bottom; public TextMeshProUGUI coinCountAdd; public override void Awake() { } // Start is called before the first frame update 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.id) { //--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); }); } }