126 lines
4.8 KiB
C#
126 lines
4.8 KiB
C#
// using UnityEngine;
|
||
// using UnityEngine.UI;
|
||
// using Logic.CrashSight;
|
||
//
|
||
//
|
||
// namespace TH1_Logic.Steam
|
||
// {
|
||
// /// <summary>
|
||
// /// Steam测试UI - 提供简单的UI界面来测试Steam功能
|
||
// /// </summary>
|
||
// public class SteamTestUI : MonoBehaviour
|
||
// {
|
||
// [Header("UI组件")]
|
||
// public Button createLobbyButton;
|
||
// public Button leaveLobbyButton;
|
||
// public Button sendMessageButton;
|
||
// public Button showFriendsButton;
|
||
// public Button inviteButton;
|
||
// public Text statusText;
|
||
// public Text lobbyInfoText;
|
||
// public InputField messageInput;
|
||
//
|
||
// private SteamTestManager steamTestManager;
|
||
//
|
||
// private void Start()
|
||
// {
|
||
// steamTestManager = FindObjectOfType<SteamTestManager>();
|
||
// if (steamTestManager == null)
|
||
// {
|
||
// LogSystem.LogError("找不到SteamTestManager组件!");
|
||
// return;
|
||
// }
|
||
//
|
||
// SetupUI();
|
||
// }
|
||
//
|
||
// private void SetupUI()
|
||
// {
|
||
// if (createLobbyButton) createLobbyButton.onClick.AddListener(OnCreateLobby);
|
||
// if (leaveLobbyButton) leaveLobbyButton.onClick.AddListener(OnLeaveLobby);
|
||
// if (sendMessageButton) sendMessageButton.onClick.AddListener(OnSendMessage);
|
||
// if (showFriendsButton) showFriendsButton.onClick.AddListener(OnShowFriends);
|
||
// if (inviteButton) inviteButton.onClick.AddListener(OnInviteFriends);
|
||
//
|
||
// if (messageInput) messageInput.text = "Hello Steam P2P!";
|
||
// }
|
||
//
|
||
// private void Update()
|
||
// {
|
||
// UpdateUI();
|
||
// }
|
||
//
|
||
// private void UpdateUI()
|
||
// {
|
||
// if (!steamTestManager) return;
|
||
//
|
||
// // 更新状态文本
|
||
// if (statusText)
|
||
// {
|
||
// statusText.text = $"Steam: {(steamTestManager.IsSteamInitialized ? "✓" : "✗")} | " +
|
||
// $"登录: {(steamTestManager.IsLoggedIn ? "✓" : "✗")} | " +
|
||
// $"用户: {steamTestManager.CurrentUserName}";
|
||
// }
|
||
//
|
||
// // 更新房间信息
|
||
// if (lobbyInfoText)
|
||
// {
|
||
// var lobby = SteamLobbyManager.Instance;
|
||
// lobbyInfoText.text = $"状态: {lobby.CurrentState}\n" +
|
||
// $"在房间: {(lobby.IsInLobby ? "✓" : "✗")}\n" +
|
||
// $"是房主: {(lobby.IsLobbyOwner ? "✓" : "✗")}\n" +
|
||
// $"成员数: {lobby.GetMemberCount()}/{lobby.GetMemberLimit()}\n" +
|
||
// $"P2P连接: {SimpleP2P.Instance.GetConnectionCount()}";
|
||
// }
|
||
//
|
||
// // 更新按钮状态
|
||
// bool canCreateLobby = steamTestManager.IsSteamInitialized &&
|
||
// steamTestManager.IsLoggedIn &&
|
||
// !SteamLobbyManager.Instance.IsInLobby;
|
||
//
|
||
// bool inLobby = SteamLobbyManager.Instance.IsInLobby;
|
||
//
|
||
// if (createLobbyButton) createLobbyButton.interactable = canCreateLobby;
|
||
// if (leaveLobbyButton) leaveLobbyButton.interactable = inLobby;
|
||
// if (sendMessageButton) sendMessageButton.interactable = inLobby;
|
||
// if (inviteButton) inviteButton.interactable = inLobby;
|
||
// if (showFriendsButton) showFriendsButton.interactable = steamTestManager.IsSteamInitialized && steamTestManager.IsLoggedIn;
|
||
// }
|
||
//
|
||
// public void OnCreateLobby()
|
||
// {
|
||
// steamTestManager.TestCreateLobby();
|
||
// }
|
||
//
|
||
// public void OnLeaveLobby()
|
||
// {
|
||
// steamTestManager.TestLeaveLobby();
|
||
// }
|
||
//
|
||
// public void OnSendMessage()
|
||
// {
|
||
// if (messageInput && !string.IsNullOrEmpty(messageInput.text))
|
||
// {
|
||
// string message = $"{steamTestManager.CurrentUserName}: {messageInput.text}";
|
||
// byte[] data = System.Text.Encoding.UTF8.GetBytes(message);
|
||
// SteamLobbyManager.Instance.BroadcastMessage(data, true);
|
||
// LogSystem.LogInfo($"发送消息: {message}");
|
||
// }
|
||
// else
|
||
// {
|
||
// steamTestManager.TestSendMessage();
|
||
// }
|
||
// }
|
||
//
|
||
// public void OnShowFriends()
|
||
// {
|
||
// steamTestManager.TestShowOnlineFriends();
|
||
// }
|
||
//
|
||
// public void OnInviteFriends()
|
||
// {
|
||
// steamTestManager.TestOpenInviteOverlay();
|
||
// }
|
||
// }
|
||
// }
|