55 lines
1.4 KiB
C#
55 lines
1.4 KiB
C#
using Assets.MyGame.Scripts.Net.WebResponses.ChineseChess;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class UIChineseChessSetCoin : SubUIBase
|
|
{
|
|
public TextMeshProUGUI tmp_CurrGlod;
|
|
public TMP_InputField tmpInput_Coin;
|
|
public Button btn_Enter;
|
|
|
|
private ChineseChessGameClassList.ChessGameRoom roomData;
|
|
|
|
public override void Awake()
|
|
{
|
|
base.Awake();
|
|
|
|
}
|
|
public override void Show(object args = null)
|
|
{
|
|
base.Show(args);
|
|
if (args != null)
|
|
{
|
|
roomData = (ChineseChessGameClassList.ChessGameRoom)args;
|
|
tmp_CurrGlod.text = ChineseChessMainPanel.FormatGold(GameManager.Instance.user.assets.gold);
|
|
btn_Enter.onClick.RemoveAllListeners();
|
|
btn_Enter.onClick.AddListener(OnEnter);
|
|
}
|
|
}
|
|
|
|
private void OnEnter()
|
|
{
|
|
SendGold();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 超时自动确认(使用当前输入值或默认100)
|
|
/// </summary>
|
|
public void AutoConfirm()
|
|
{
|
|
SendGold();
|
|
}
|
|
|
|
private void SendGold()
|
|
{
|
|
if (roomData == null) return;
|
|
int gold = string.IsNullOrEmpty(tmpInput_Coin.text) ? 100 : Convert.ToInt32(tmpInput_Coin.text);
|
|
if (gold < 100) gold = 100;
|
|
WebSocketSendList.SelectGlodChineseChess(roomData.roomId, gold, GameManager.Instance.user.BaseInfo.number);
|
|
}
|
|
}
|