Custom Status Framework - 自定义状态栏框架

汉化 Custom Status Framework - 自定义状态栏框架 1.1.3

原地址
该插件本身并没有任何功能,是为其他插件提供了一个框架来操作右侧游戏 UI 中出现的状态列表。

位置​

从1.1.0版本开始,支持了自定义状态栏框架位置的功能。这不仅仅是位置上的关系,现在除了vanilla位置之外,都将能为服务器提供更好的性能。因为在 vanilla 模式下,插件必须执行更多处理。
1694406813772

支持的位置​

  • top left
  • top
  • top right
  • left
  • vanilla (默认)
  • right
  • bottom left
  • bottom
  • bottom right

性能提升​

在1.1.0版本之后,有一些配置选项可以帮助您通过启用或禁用功能来提高服务器的性能。如果您遇到性能问题,请参阅以下配置提示:

1.避免使用 vanilla 位置​

在配置中,您可以选择指定位置,这是自定义状态栏的位置。默认情况下,它设置为“vanilla”,这意味着任何自定义状态都将显示在Rust自带的状态栏之上。这提供了干净且无缝的外观,但是,为了实现这一点,插件必须计算显示原始状态的所有场景,然后为服务器上的每个玩家重新绘制它们 - 这可能会导致性能问题。为了获得最佳性能,请将“Position”选项更改为任何其他有效值(请参考支持的位置)。

2.确保Fast Refresh为false​

默认情况下,从1.1.0版本开始,状态栏会每秒刷新一次,这意味着玩家的状态最多可能需要一秒钟才能从屏幕上删除。如果您在配置中启用“Fast Refresh”,状态将以更快的速度更新,但这会给服务器带来更大的压力。为了获得最佳性能,请将“Fast Refresh”设置为 false

3.限制使用本插件的插件数量​

依赖本插件的插件越多,需要进行的更新就越多。如果本插件相关的插件以最佳方式编写(避免全局/动态状态),那么它不会对性能造成太大影响。但是,如果您运行的许多插件*确实*使用动态/全局状态,那么您可能会遇到性能问题。有效利用本插件取决于本插件相关插件的开发人员。可以尝试一次禁用一个插件,看看哪些插件导致性能问题。


开发者API​

在下载中下载CustomStatusFrameworkDemo.cs (2023/09/15已更新)来查看本插件API使用方法示例。
注意:在任何情况下都不建议动态更新状态,因为会严重影响性能,建议在适当的时候手动更新。
C#:
    // API Documentation for Custom Status Framework v1.0.5

    // Returns a list of all statuses for a player, both vanilla and custom ones.
        List<string> GetStatusList
        (
            BasePlayer basePlayer
        )
          
        // Returns true if a player has a status matching the given id.
        bool HasStatus
        (
            BasePlayer basePlayer, 
            string id
        )
          
        // Method for showing a simple temporary status to a player.
        // This status will appear and then disappear after some time.
        void ShowStatus
        (
            BasePlayer basePlayer, 
            string id, 
            string color = null, 
            string text = null, 
            string textColor = null, 
            string subText = null, 
            string subTextColor = null, 
            string imageLibraryIconId = null, 
            string iconColor = null, 
            float seconds = 4f
        )
          
        // Creates a status for the given player.
        private void SetStatus
        (
            BasePlayer basePlayer, 
            string id, 
            string color, 
            string text, 
            string textColor, 
            string subText, 
            string subTextColor, 
            string imageLibraryIconId, 
            string iconColor
        )
          
        // Removes the specified status from the given player.
        private void ClearStatus
        (
            BasePlayer basePlayer, 
            string id
        )

        // Performs a ClearStatus and then a SetStatus.
        // Useful if you want to simply refresh a status value.
        private void UpdateStatus
        (
            BasePlayer basePlayer, 
            string id, string color, 
            string text, 
            string textColor, 
            string subText, 
            string subTextColor, 
            string imageLibraryIconId,
            string iconColor
        )

        // Creates a global status with a static value.
        // The value of this status will not change, but will be dynamically applied to all
        // players who meet the specified condition function.
        private void CreateStatus
        (
            string id, 
            string color, 
            string text, 
            string textColor, 
            string subText, 
            string subTextColor, 
            string imageLibraryIconId, 
            string iconColor, 
            Func<BasePlayer, bool> condition
        )
          
        // Creates a global status with a dynamic value.
        // The value of this status will change, and is dynamically set for each player
        // based on the return of the dynamicValue function.
        // This status will be dynamically applied to all players who meet the specified
        // condition function.
        private void CreateDynamicStatus
        (
            string id, 
            string color, 
            string text, 
            string textColor, 
            string subTextColor, 
            string imageLibraryIconId, 
            string iconColor, 
            Func<BasePlayer, bool> condition, 
            Func<BasePlayer, string> dynamicValue
        )
          
        // Deletes a global status by id.
        private void DeleteStatus
        (
            string id
        )
作者
对味儿
下载
8
查看
648
首次发布
最后更新
评分
0.00 星 0评价

来自对味儿的更多资源

分享资源

最新更新

  1. 1.1.3

    修复在使用 vanilla 位置时, OnPlayerMetabolize Hook性能表现问题。 快速刷新现在默认开启,仅建议您在遇到性能问题时更改它。 显示控制台提示现在默认关闭 -...
  2. 1.1.2

    修复 metabolize Hook的NRE错误。 修复重新加载时的错误。
  3. 1.1.0

    新增配置选项来调整状态栏的位置。设置除vanilla以外的任何值都不会叠加在默认状态栏之上。这可以提升性能。 新增配置选项来调整状态栏的位置偏移。 重新设计代码以提高大型服务器的性能。...
标签