4 Commits

Author SHA1 Message Date
Yue-bin
ab0df1ee0d chore(playermanager): 更新版本号
All checks were successful
Publish Release / build (push) Successful in 2m3s
更新 stick.plugins.playermanager.csproj 中的版本号从 4.0.0 到 4.0.1,
以反映最新的发布版本。
2026-05-07 04:32:01 +08:00
Yue-bin
74f9e1cf1c fix(Gui): 修正LayoutCursor行进逻辑
BeginRow方法现在正确地推进到下一行,并重置列位置到OffsetX,
对齐原来的GetNewYPosition()行为。EndRow方法仅重置列位置而不行进,
下一行由BeginRow方法推进,使行进逻辑更加清晰明确。
2026-05-07 04:31:25 +08:00
Yue-bin
007c093df4 fix(Gui): 房间公开性组件不显示在同一行
- 创建List集合管理房间公开性相关的widgets
- 将房间公开性标签和按钮合并到同一个HeaderRow中
- 添加条件判断只在有相关widgets时才注册HeaderRow
- 使label和button可以在同一行独立配置显示
2026-05-07 04:31:17 +08:00
Yue-bin
fd208de2db fix(PlayerManager): 样式未被正确初始化
将PlayerManagerGUI.InitializeStyles()方法的访问修饰符从private改为internal,
并在插件启动时调用此方法来初始化GUI样式。
2026-05-07 04:30:39 +08:00
7 changed files with 36 additions and 38 deletions

View File

@@ -1,3 +1,5 @@
using System.Collections.Generic;
namespace stick.plugins.playermanager.Gui; namespace stick.plugins.playermanager.Gui;
/// <summary> /// <summary>
@@ -9,12 +11,22 @@ public static class DefaultWidgets
{ {
public static void RegisterAll() public static void RegisterAll()
{ {
// Header 组件 // Header房间公开性行label + button 在同一行,各自独立可配置)
var publicityWidgets = new List<IHeaderWidget>();
if (PlayerManager.ShowRoomPublicityLabel.Value) if (PlayerManager.ShowRoomPublicityLabel.Value)
RegisterManager.RegisterHeaderRow(InternalWidgets.RoomPublicityLabel.Create()); publicityWidgets.Add(InternalWidgets.RoomPublicityLabel.Create());
if (PlayerManager.ShowRoomPublicityButton.Value) if (PlayerManager.ShowRoomPublicityButton.Value)
RegisterManager.RegisterHeaderRow(InternalWidgets.RoomPublicityButton.Create()); publicityWidgets.Add(InternalWidgets.RoomPublicityButton.Create());
if (publicityWidgets.Count > 0)
{
RegisterManager.RegisterHeaderRow(new HeaderRow
{
Name = "RoomPublicity",
Condition = () => PlayerManager.IsHost(PlayerManager.LocalPlayer),
Children = publicityWidgets,
});
}
// 玩家行组件(始终注册) // 玩家行组件(始终注册)
RegisterManager.RegisterPlayerRow(InternalWidgets.PlayerInfoButton.Create()); RegisterManager.RegisterPlayerRow(InternalWidgets.PlayerInfoButton.Create());

View File

@@ -3,27 +3,19 @@ using static stick.plugins.playermanager.Gui.PlayerManagerGUI;
namespace stick.plugins.playermanager.Gui.InternalWidgets; namespace stick.plugins.playermanager.Gui.InternalWidgets;
/// <summary> /// <summary>
/// 切换公开性按钮的纯工厂 /// 切换公开性按钮的纯工厂,返回 IHeaderWidget由 DefaultWidgets 放入 HeaderRow
/// </summary> /// </summary>
public static class RoomPublicityButton public static class RoomPublicityButton
{ {
public static IHeaderRow Create() public static IHeaderWidget Create()
{ {
return new HeaderRow return new HeaderButtonWidget
{ {
Name = "RoomPublicityButton", Name = "RoomPublicityButton",
Condition = () => PlayerManager.IsHost(PlayerManager.LocalPlayer), Text = "切换公开性",
Children = Action = () => PlayerManager.ToggleLobbyPublicity(),
{ Width = 150f,
new HeaderButtonWidget Style = CommonButtonStyle,
{
Name = "RoomPublicityButton.Content",
Text = "切换公开性",
Action = () => PlayerManager.ToggleLobbyPublicity(),
Width = 150f,
Style = CommonButtonStyle,
},
},
}; };
} }
} }

View File

@@ -3,26 +3,18 @@ using static stick.plugins.playermanager.Gui.PlayerManagerGUI;
namespace stick.plugins.playermanager.Gui.InternalWidgets; namespace stick.plugins.playermanager.Gui.InternalWidgets;
/// <summary> /// <summary>
/// 房间类型标签的纯工厂 /// 房间类型标签的纯工厂,返回 IHeaderWidget由 DefaultWidgets 放入 HeaderRow
/// </summary> /// </summary>
public static class RoomPublicityLabel public static class RoomPublicityLabel
{ {
public static IHeaderRow Create() public static IHeaderWidget Create()
{ {
return new HeaderRow return new HeaderLabelWidget
{ {
Name = "RoomPublicityLabel", Name = "RoomPublicityLabel",
Condition = () => PlayerManager.IsHost(PlayerManager.LocalPlayer), Content = () => $"房间类型: {(PlayerManager.IsPublic ? "" : "")}",
Children = Width = 200f,
{ Style = TitleStyle,
new HeaderLabelWidget
{
Name = "RoomPublicityLabel.Content",
Content = () => $"房间类型: {(PlayerManager.IsPublic ? "" : "")}",
Width = 200f,
Style = TitleStyle,
},
},
}; };
} }
} }

View File

@@ -42,10 +42,12 @@ public class LayoutCursor
} }
/// <summary> /// <summary>
/// 开始新的一行,重置列位置到 OffsetX /// 开始新的一行,推进到下一行并重置列位置到 OffsetX
/// 对齐原来的 GetNewYPosition() 行为
/// </summary> /// </summary>
public void BeginRow() public void BeginRow()
{ {
_currentLine++;
_currentX = OffsetX; _currentX = OffsetX;
} }
@@ -62,11 +64,10 @@ public class LayoutCursor
} }
/// <summary> /// <summary>
/// 结束当前行,移动到下一行 /// 结束当前行,仅重置列位置(不行进,下一行由 BeginRow 推进)
/// </summary> /// </summary>
public void EndRow() public void EndRow()
{ {
_currentLine++;
_currentX = OffsetX; _currentX = OffsetX;
} }

View File

@@ -68,7 +68,7 @@ public static class PlayerManagerGUI
#region #region
private static void InitializeStyles() internal static void InitializeStyles()
{ {
if (StylesInitialized) return; if (StylesInitialized) return;

View File

@@ -150,6 +150,7 @@ public class PlayerManager : BaseUnityPlugin
{ {
InitializeConfiguration(); InitializeConfiguration();
ApplyPatches(); ApplyPatches();
PlayerManagerGUI.InitializeStyles();
DefaultWidgets.RegisterAll(); DefaultWidgets.RegisterAll();
} }

View File

@@ -4,7 +4,7 @@
<TargetFramework>net35</TargetFramework> <TargetFramework>net35</TargetFramework>
<AssemblyName>stick.plugins.playermanager</AssemblyName> <AssemblyName>stick.plugins.playermanager</AssemblyName>
<Product>PlayerManager</Product> <Product>PlayerManager</Product>
<Version>4.0.0</Version> <Version>4.0.1</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<RestoreAdditionalProjectSources> <RestoreAdditionalProjectSources>