Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ab0df1ee0d | ||
|
|
74f9e1cf1c | ||
|
|
007c093df4 | ||
|
|
fd208de2db |
@@ -1,3 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace stick.plugins.playermanager.Gui;
|
||||
|
||||
/// <summary>
|
||||
@@ -9,12 +11,22 @@ public static class DefaultWidgets
|
||||
{
|
||||
public static void RegisterAll()
|
||||
{
|
||||
// Header 组件
|
||||
// Header:房间公开性行(label + button 在同一行,各自独立可配置)
|
||||
var publicityWidgets = new List<IHeaderWidget>();
|
||||
if (PlayerManager.ShowRoomPublicityLabel.Value)
|
||||
RegisterManager.RegisterHeaderRow(InternalWidgets.RoomPublicityLabel.Create());
|
||||
|
||||
publicityWidgets.Add(InternalWidgets.RoomPublicityLabel.Create());
|
||||
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());
|
||||
|
||||
@@ -3,27 +3,19 @@ using static stick.plugins.playermanager.Gui.PlayerManagerGUI;
|
||||
namespace stick.plugins.playermanager.Gui.InternalWidgets;
|
||||
|
||||
/// <summary>
|
||||
/// 切换公开性按钮的纯工厂
|
||||
/// 切换公开性按钮的纯工厂,返回 IHeaderWidget(由 DefaultWidgets 放入 HeaderRow)
|
||||
/// </summary>
|
||||
public static class RoomPublicityButton
|
||||
{
|
||||
public static IHeaderRow Create()
|
||||
public static IHeaderWidget Create()
|
||||
{
|
||||
return new HeaderRow
|
||||
return new HeaderButtonWidget
|
||||
{
|
||||
Name = "RoomPublicityButton",
|
||||
Condition = () => PlayerManager.IsHost(PlayerManager.LocalPlayer),
|
||||
Children =
|
||||
{
|
||||
new HeaderButtonWidget
|
||||
{
|
||||
Name = "RoomPublicityButton.Content",
|
||||
Text = "切换公开性",
|
||||
Action = () => PlayerManager.ToggleLobbyPublicity(),
|
||||
Width = 150f,
|
||||
Style = CommonButtonStyle,
|
||||
},
|
||||
},
|
||||
Text = "切换公开性",
|
||||
Action = () => PlayerManager.ToggleLobbyPublicity(),
|
||||
Width = 150f,
|
||||
Style = CommonButtonStyle,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,26 +3,18 @@ using static stick.plugins.playermanager.Gui.PlayerManagerGUI;
|
||||
namespace stick.plugins.playermanager.Gui.InternalWidgets;
|
||||
|
||||
/// <summary>
|
||||
/// 房间类型标签的纯工厂
|
||||
/// 房间类型标签的纯工厂,返回 IHeaderWidget(由 DefaultWidgets 放入 HeaderRow)
|
||||
/// </summary>
|
||||
public static class RoomPublicityLabel
|
||||
{
|
||||
public static IHeaderRow Create()
|
||||
public static IHeaderWidget Create()
|
||||
{
|
||||
return new HeaderRow
|
||||
return new HeaderLabelWidget
|
||||
{
|
||||
Name = "RoomPublicityLabel",
|
||||
Condition = () => PlayerManager.IsHost(PlayerManager.LocalPlayer),
|
||||
Children =
|
||||
{
|
||||
new HeaderLabelWidget
|
||||
{
|
||||
Name = "RoomPublicityLabel.Content",
|
||||
Content = () => $"房间类型: {(PlayerManager.IsPublic ? "公开" : "好友可见")}",
|
||||
Width = 200f,
|
||||
Style = TitleStyle,
|
||||
},
|
||||
},
|
||||
Content = () => $"房间类型: {(PlayerManager.IsPublic ? "公开" : "好友可见")}",
|
||||
Width = 200f,
|
||||
Style = TitleStyle,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,10 +42,12 @@ public class LayoutCursor
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 开始新的一行,重置列位置到 OffsetX
|
||||
/// 开始新的一行,推进到下一行并重置列位置到 OffsetX
|
||||
/// 对齐原来的 GetNewYPosition() 行为
|
||||
/// </summary>
|
||||
public void BeginRow()
|
||||
{
|
||||
_currentLine++;
|
||||
_currentX = OffsetX;
|
||||
}
|
||||
|
||||
@@ -62,11 +64,10 @@ public class LayoutCursor
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 结束当前行,移动到下一行
|
||||
/// 结束当前行,仅重置列位置(不行进,下一行由 BeginRow 推进)
|
||||
/// </summary>
|
||||
public void EndRow()
|
||||
{
|
||||
_currentLine++;
|
||||
_currentX = OffsetX;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ public static class PlayerManagerGUI
|
||||
|
||||
#region 样式初始化
|
||||
|
||||
private static void InitializeStyles()
|
||||
internal static void InitializeStyles()
|
||||
{
|
||||
if (StylesInitialized) return;
|
||||
|
||||
|
||||
@@ -150,6 +150,7 @@ public class PlayerManager : BaseUnityPlugin
|
||||
{
|
||||
InitializeConfiguration();
|
||||
ApplyPatches();
|
||||
PlayerManagerGUI.InitializeStyles();
|
||||
DefaultWidgets.RegisterAll();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net35</TargetFramework>
|
||||
<AssemblyName>stick.plugins.playermanager</AssemblyName>
|
||||
<Product>PlayerManager</Product>
|
||||
<Version>4.0.0</Version>
|
||||
<Version>4.0.1</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<RestoreAdditionalProjectSources>
|
||||
|
||||
Reference in New Issue
Block a user