Compare commits
2 Commits
v4.0.6-rec
...
3ecb7fb78b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3ecb7fb78b | ||
|
|
4e8931caba |
@@ -15,6 +15,9 @@ public static class GUIStyles
|
|||||||
/// <summary>普通按钮样式(fontSize=22, richText=false)</summary>
|
/// <summary>普通按钮样式(fontSize=22, richText=false)</summary>
|
||||||
public static GUIStyle Button;
|
public static GUIStyle Button;
|
||||||
|
|
||||||
|
/// <summary>被按过的按钮样式,用于标识已经进入过的房间(fontSize=22)</summary>
|
||||||
|
public static GUIStyle ButtonPressed;
|
||||||
|
|
||||||
/// <summary>黄色按钮样式(已记录玩家)</summary>
|
/// <summary>黄色按钮样式(已记录玩家)</summary>
|
||||||
public static GUIStyle YellowButton;
|
public static GUIStyle YellowButton;
|
||||||
|
|
||||||
@@ -35,6 +38,8 @@ public static class GUIStyles
|
|||||||
|
|
||||||
Label = new GUIStyle(GUI.skin.label) { fontSize = 22 };
|
Label = new GUIStyle(GUI.skin.label) { fontSize = 22 };
|
||||||
Button = new GUIStyle(GUI.skin.button) { fontSize = 22, richText = false };
|
Button = new GUIStyle(GUI.skin.button) { fontSize = 22, richText = false };
|
||||||
|
ButtonPressed = new GUIStyle(GUI.skin.button) { fontSize = 22, richText = false };
|
||||||
|
ButtonPressed.normal.textColor = Color.grey;
|
||||||
|
|
||||||
YellowButton = new GUIStyle(GUI.skin.button) { fontSize = 22, richText = false };
|
YellowButton = new GUIStyle(GUI.skin.button) { fontSize = 22, richText = false };
|
||||||
YellowButton.normal.textColor = Color.yellow;
|
YellowButton.normal.textColor = Color.yellow;
|
||||||
|
|||||||
@@ -190,17 +190,24 @@ public static class PlayerManagerGUI
|
|||||||
for (int i = 0; i < PlayerManager.lobbyDataList.Count; i++)
|
for (int i = 0; i < PlayerManager.lobbyDataList.Count; i++)
|
||||||
{
|
{
|
||||||
CSteamID lobbyId = PlayerManager.lobbyDataList[i];
|
CSteamID lobbyId = PlayerManager.lobbyDataList[i];
|
||||||
|
var style = PlayerManager.enteredLobbyList.Contains(lobbyId) ? GUIStyles.ButtonPressed : GUIStyles.Button;
|
||||||
|
if (PlayerManager.enteredLobbyList.Contains(lobbyId))
|
||||||
|
|
||||||
if (GUI.Button(
|
if (GUI.Button(
|
||||||
new Rect(Cursor.OffsetX, Cursor.LineHeight * i, 500f, 40f),
|
new Rect(Cursor.OffsetX, Cursor.LineHeight * i, 500f, 40f),
|
||||||
$"{lobbyId} 人数{SteamMatchmaking.GetNumLobbyMembers(lobbyId)}",
|
$"{lobbyId} 人数{SteamMatchmaking.GetNumLobbyMembers(lobbyId)}",
|
||||||
GUIStyles.Button
|
style
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
// 在大厅中则不加入
|
// 在大厅中则不加入
|
||||||
if (!PlayerManager.MatchmakingHandler.IsInsideLobby)
|
if (!PlayerManager.MatchmakingHandler.IsInsideLobby)
|
||||||
|
{
|
||||||
|
// 记录一下加入过的状态
|
||||||
|
PlayerManager.enteredLobbyList.Add(lobbyId);
|
||||||
PlayerManager.JoinSpecificServer(lobbyId);
|
PlayerManager.JoinSpecificServer(lobbyId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GUI.EndScrollView();
|
GUI.EndScrollView();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,6 +102,11 @@ public class PlayerManager : BaseUnityPlugin
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static List<CSteamID> lobbyDataList = [];
|
public static List<CSteamID> lobbyDataList = [];
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 进入过的大厅列表
|
||||||
|
/// </summary>
|
||||||
|
public static HashSet<CSteamID> enteredLobbyList = [];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 大厅距离过滤设置
|
/// 大厅距离过滤设置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -195,7 +200,7 @@ public class PlayerManager : BaseUnityPlugin
|
|||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
HandleInput();
|
HandleInput();
|
||||||
if (SteamManager.Initialized)
|
if (SteamManager.Initialized && LocalPlayer is null)
|
||||||
{
|
{
|
||||||
LocalPlayer = new(SteamUser.GetSteamID());
|
LocalPlayer = new(SteamUser.GetSteamID());
|
||||||
}
|
}
|
||||||
@@ -434,6 +439,7 @@ public class PlayerManager : BaseUnityPlugin
|
|||||||
{
|
{
|
||||||
Debug.Log("大厅列表请求完成: " + result.m_nLobbiesMatching + " 个大厅");
|
Debug.Log("大厅列表请求完成: " + result.m_nLobbiesMatching + " 个大厅");
|
||||||
lobbyDataList = [];
|
lobbyDataList = [];
|
||||||
|
enteredLobbyList = [];
|
||||||
uint lobbyCount = result.m_nLobbiesMatching;
|
uint lobbyCount = result.m_nLobbiesMatching;
|
||||||
|
|
||||||
for (uint i = 0; i < lobbyCount; i++)
|
for (uint i = 0; i < lobbyCount; i++)
|
||||||
|
|||||||
Reference in New Issue
Block a user