4 Commits

Author SHA1 Message Date
Yue-bin
3ecb7fb78b fix(PlayerManager): 修复本地玩家初始化逻辑
当SteamManager已初始化但LocalPlayer为空时才创建新的LocalPlayer实例,
避免重复初始化问题。
2026-06-19 20:25:15 +08:00
Yue-bin
4e8931caba feat(gui): 添加已访问大厅的视觉标识功能
添加了ButtonPressed样式用于标识已进入过的大厅,
使用户能够直观区分未访问和已访问的大厅。

在PlayerManager中新增enteredLobbyList集合来跟踪已访问的大厅,
并在界面中根据访问状态显示不同的按钮颜色。
2026-06-19 20:24:29 +08:00
Yue-bin
3adcdc46ba Merge branch 'master' of 172.16.29.13:Stick_Mods/stick.plugins.playermanager
All checks were successful
Publish Release / build (push) Successful in 31s
2026-06-11 02:13:25 +08:00
Yue-bin
b6edc70594 chore(ci): 为.NET构建流程添加代理配置
在Gitea工作流中添加HTTP/HTTPS代理环境变量配置,
以解决网络访问问题并提高依赖包恢复速度。
2026-06-11 02:13:09 +08:00
4 changed files with 34 additions and 11 deletions

View File

@@ -21,6 +21,11 @@ jobs:
- name: Restore dependencies
run: dotnet restore
# 直接加代理得了
env:
http_proxy: "http://172.17.0.1:7890"
https_proxy: "http://172.17.0.1:7890"
no_proxy: "localhost,127.0.0.1,*.lan"
- name: Build
run: dotnet build --no-restore --configuration Release

View File

@@ -15,6 +15,9 @@ public static class GUIStyles
/// <summary>普通按钮样式fontSize=22, richText=false</summary>
public static GUIStyle Button;
/// <summary>被按过的按钮样式用于标识已经进入过的房间fontSize=22</summary>
public static GUIStyle ButtonPressed;
/// <summary>黄色按钮样式(已记录玩家)</summary>
public static GUIStyle YellowButton;
@@ -35,6 +38,8 @@ public static class GUIStyles
Label = new GUIStyle(GUI.skin.label) { fontSize = 22 };
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.normal.textColor = Color.yellow;

View File

@@ -190,16 +190,23 @@ public static class PlayerManagerGUI
for (int i = 0; i < PlayerManager.lobbyDataList.Count; i++)
{
CSteamID lobbyId = PlayerManager.lobbyDataList[i];
if (GUI.Button(
new Rect(Cursor.OffsetX, Cursor.LineHeight * i, 500f, 40f),
$"{lobbyId} 人数{SteamMatchmaking.GetNumLobbyMembers(lobbyId)}",
GUIStyles.Button
))
{
// 在大厅中则不加入
if (!PlayerManager.MatchmakingHandler.IsInsideLobby)
PlayerManager.JoinSpecificServer(lobbyId);
}
var style = PlayerManager.enteredLobbyList.Contains(lobbyId) ? GUIStyles.ButtonPressed : GUIStyles.Button;
if (PlayerManager.enteredLobbyList.Contains(lobbyId))
if (GUI.Button(
new Rect(Cursor.OffsetX, Cursor.LineHeight * i, 500f, 40f),
$"{lobbyId} 人数{SteamMatchmaking.GetNumLobbyMembers(lobbyId)}",
style
))
{
// 在大厅中则不加入
if (!PlayerManager.MatchmakingHandler.IsInsideLobby)
{
// 记录一下加入过的状态
PlayerManager.enteredLobbyList.Add(lobbyId);
PlayerManager.JoinSpecificServer(lobbyId);
}
}
}
GUI.EndScrollView();

View File

@@ -102,6 +102,11 @@ public class PlayerManager : BaseUnityPlugin
/// </summary>
public static List<CSteamID> lobbyDataList = [];
/// <summary>
/// 进入过的大厅列表
/// </summary>
public static HashSet<CSteamID> enteredLobbyList = [];
/// <summary>
/// 大厅距离过滤设置
/// </summary>
@@ -195,7 +200,7 @@ public class PlayerManager : BaseUnityPlugin
private void Update()
{
HandleInput();
if (SteamManager.Initialized)
if (SteamManager.Initialized && LocalPlayer is null)
{
LocalPlayer = new(SteamUser.GetSteamID());
}
@@ -434,6 +439,7 @@ public class PlayerManager : BaseUnityPlugin
{
Debug.Log("大厅列表请求完成: " + result.m_nLobbiesMatching + " 个大厅");
lobbyDataList = [];
enteredLobbyList = [];
uint lobbyCount = result.m_nLobbiesMatching;
for (uint i = 0; i < lobbyCount; i++)