与...合作
这是一个小的信息面板。
#特征
可以InfoPanel.json在oxide/config目录下的文件中配置此插件的设置和选项。建议使用JSON编辑器或验证站点(例如jsonlint.com),以避免格式问题和语法错误。
private bool PanelRegister(string pluginName, string panelName, string json)
此功能将加载您的面板。它将首次在ThirdPartyPanels部分下的“信息面板”配置文件中创建一个新条目。之后,信息面板将从那里加载面板配置。
如果在配置中使用文本或图像。它们将被自动命名。(插件名称文本或插件名称图像)例如:MyPanelName-> MyPanelNameText或MyPanelNameImage
private bool ShowPanel(string pluginName, string panelName**, string playerId = null
向所有人或特定玩家显示所选面板。
private bool HidePanel(string pluginName, string panelName, string playerId = null)
对所有人或某些玩家隐藏所选面板。
private bool RefreshPanel(string pluginName, string panelName, string playerId = null)
向所有人或某些玩家刷新面板。
private void SetPanelAttribute( string pluginName, string panelName, string attribute, string value, string playerId = null)
更改所有人或某些玩家的面板属性。
private bool SendPanelInfo( string pluginName, List<string> panels)
您可以将面板名称列表发送到“信息面板”。此列表和配置文件之间的差异将从配置文件中删除,以保持其干净。
private bool IsPlayerGUILoaded(string playerId)
您可以检查播放器的GUI状态。
API范例
using System;
using System.Collections.Generic;
using Oxide.Core.Plugins;
namespace Oxide.Plugins
{
[Info("ApiTest", "Ghosst", "1.0.0")]
[Description("OnlinePlayers Counter.")]
public class ApiTest : RustPlugin
{
Timer CounterTimer;
Timer BlinkTimer;
Timer RandPTimer;
int Count = 0;
bool IsActive = true;
string RandomPlayerID;
bool RandomPlayername = false;
bool Blinker = false;
bool CounterP = false;
List<string> Panels = new List<string> { "BlinkPanel", "CounterPanel", "RandomPlayernamePanel" };
[PluginReference]
Plugin InfoPanel;
void Loaded()
{
if(InfoPanel)
{
InfoPanelInit();
}
}
void OnPluginLoaded(Plugin InfoPanel)
{
if (InfoPanel.Title == "InfoPanel")
{
InfoPanelInit();
}
}
public void InfoPanelInit()
{
//Send Panel names to the infopanel.
InfoPanel.Call("SendPanelInfo", "ApiTest", Panels);
AddRandomPlayerNamePanel();
AddBlinkPanel();
AddCounterPanel();
if (CounterTimer == null & CounterP)
{
CounterTimer = timer.Repeat(5, 0, () => Counter());
}
if (BlinkTimer == null & Blinker)
{
BlinkTimer = timer.Repeat(5, 0, () => Blink());
}
if (RandPTimer == null & RandomPlayername)
{
RandPTimer = timer.Repeat(5, 0, () => RandomPlayer());
}
}
/// <summary>
/// Load the panel
/// </summary>
public void AddRandomPlayerNamePanel()
{
RandomPlayername = (bool)InfoPanel.Call("PanelRegister", "ApiTest", "RandomPlayernamePanel", RndPlayerNameCfg);
}
/// <summary>
/// Load the panel.
/// Show the panel everyone.
/// </summary>
public void AddBlinkPanel()
{
Blinker = (bool)InfoPanel.Call("PanelRegister", "ApiTest", "BlinkPanel", BlinkPCfg);
InfoPanel.Call("ShowPanel", "ApiTest", "BlinkPanel");
}
/// <summary>
/// Load the panel.
/// Show the panel everyone.
/// </summary>
public void AddCounterPanel()
{
CounterP = (bool)InfoPanel.Call("PanelRegister", "ApiTest", "CounterPanel", CounterPCfg);
InfoPanel.Call("ShowPanel", "ApiTest", "CounterPanel");
}
/// <summary>
/// Hide or show the panel
/// </summary>
public void Blink()
{
if(IsActive)
{
IsActive = false;
InfoPanel.Call("HidePanel", "ApiTest", "BlinkPanel");
}
else
{
IsActive = true;
InfoPanel.Call("ShowPanel", "ApiTest", "BlinkPanel");
}
}
/// <summary>
/// Refresh the counter to every active player.
/// </summary>
public void Counter()
{
Count = 5;
if (InfoPanel && CounterP)
{
InfoPanel.Call("SetPanelAttribute", "ApiTest", "CounterPanelText", "Content", Count.ToString());
InfoPanel.Call("SetPanelAttribute", "ApiTest", "CounterPanelText", "FontColor", "0.6 0.1 0.1 1");
InfoPanel.Call("RefreshPanel", "ApiTest", "CounterPanel");
}
}
/// <summary>
/// Show his name to a random player. But just only for him.
/// </summary>
public void RandomPlayer()
{
if(RandomPlayerID != null)
InfoPanel.Call("HidePanel", "ApiTest", "RandomPlayernamePanel", RandomPlayerID);
if(BasePlayer.activePlayerList.Count > 0)
{
var rand = new System.Random();
BasePlayer player = BasePlayer.activePlayerList[rand.Next(BasePlayer.activePlayerList.Count)];
RandomPlayerID = player.UserIDString;
if (InfoPanel && RandomPlayername)
{
InfoPanel.Call("SetPanelAttribute", "ApiTest", "RandomPlayernamePanelText", "Content", player.displayName, RandomPlayerID);
InfoPanel.Call("SetPanelAttribute", "ApiTest", "RandomPlayernamePanelText", "FontColor", "0.2 0.3 0.5 1", RandomPlayerID);
InfoPanel.Call("ShowPanel", "ApiTest", "RandomPlayernamePanel", RandomPlayerID);
}
}
}
/*
Example Configs. Theres is no required option.
*/
string RndPlayerNameCfg = @"
{
""Autoload"": false,
""AnchorX"": ""Left"",
""AnchorY"": ""Bottom"",
""Available"": true,
""BackgroundColor"": ""0.1 0.1 0.1 0.4"",
""Dock"": ""BottomPanel"",
""Width"": 0.07,
""Height"": 0.95,
""Margin"": ""0 0 0 0.005"",
""Order"": 0,
""Image"": {
""AnchorX"": ""Left"",
""AnchorY"": ""Bottom"",
""Available"": true,
""BackgroundColor"": ""0.1 0.1 0.1 0.3"",
""Dock"": ""BottomPanel"",
""Height"": 0.8,
""Margin"": ""0 0.05 0.1 0.05"",
""Order"": 1,
""Url"": "" "",
""Width"": 0.22
},
""Text"": {
""Align"": ""MiddleCenter"",
""AnchorX"": ""Left"",
""AnchorY"": ""Bottom"",
""Available"": true,
""BackgroundColor"": ""0.1 0.1 0.1 0.3"",
""Dock"": ""BottomPanel"",
""FontColor"": ""1 1 1 1"",
""FontSize"": 14,
""Content"": ""APITest Bottom"",
""Height"": 1.0,
""Margin"": ""0 0 0 0"",
""Order"": 2,
""Width"": 0.63
},
}";
string BlinkPCfg = @"{}";
string CounterPCfg = @"
{
""Dock"": ""TopPanel"",
""Text"": {
""Content"": ""APITest Top""
}
}";
}
}
这是一个小的信息面板。
#特征
- 游戏中/服务器时间。
- 在线玩家计数器
- 卧铺柜台
- 留言框
- 空投警报
- 直升机警报
- 辐射警报
- 座标
- 完全定制
- 自定义面板:简单的文本和图标
- 阿皮
- / ipanel-显示可用命令
- / ipanel hide-隐藏信息面板
- / ipanel show-显示信息面板
- / ipanel时钟游戏 -时钟将显示游戏中的时间。
- / ipanel时钟服务器</ -hours> -时钟将显示RL时间。您可以添加或删除小时。
- / ipanel timeformat-显示可用的时间格式。
- / ipanel timeformat-从列表中选择您喜欢的时间格式。
可以InfoPanel.json在oxide/config目录下的文件中配置此插件的设置和选项。建议使用JSON编辑器或验证站点(例如jsonlint.com),以避免格式问题和语法错误。
- 可用:(默认:true),使用此选项,您可以打开或关闭面板。
- 停靠:(默认值:BottomPanel),使用此选项,您可以选择停靠面板。
- 顺序:使用此选项,您可以设置面板的顺序。(具有相同底座和AnchorX的面板)
- AnchorX :(默认:左),您可以将面板拉到扩展坞的左侧或右侧。(左右)
- **锚点:**(默认值:底部),您可以将面板拉到底座/屏幕的顶部或底部。(顶部/底部)
- 宽度:面板宽度。(0-1)
- 高度:面板高度。(0-1)
- 边距:(默认值:0 0 0 0.005)面板边距(上,右,下,左)
- 自动加载:(默认值:true)如果u将其关闭(false)。没有面板将自动显示。但是其他插件可以触发它。
private bool PanelRegister(string pluginName, string panelName, string json)
此功能将加载您的面板。它将首次在ThirdPartyPanels部分下的“信息面板”配置文件中创建一个新条目。之后,信息面板将从那里加载面板配置。
如果在配置中使用文本或图像。它们将被自动命名。(插件名称文本或插件名称图像)例如:MyPanelName-> MyPanelNameText或MyPanelNameImage
private bool ShowPanel(string pluginName, string panelName**, string playerId = null
向所有人或特定玩家显示所选面板。
private bool HidePanel(string pluginName, string panelName, string playerId = null)
对所有人或某些玩家隐藏所选面板。
private bool RefreshPanel(string pluginName, string panelName, string playerId = null)
向所有人或某些玩家刷新面板。
private void SetPanelAttribute( string pluginName, string panelName, string attribute, string value, string playerId = null)
更改所有人或某些玩家的面板属性。
private bool SendPanelInfo( string pluginName, List<string> panels)
您可以将面板名称列表发送到“信息面板”。此列表和配置文件之间的差异将从配置文件中删除,以保持其干净。
private bool IsPlayerGUILoaded(string playerId)
您可以检查播放器的GUI状态。
API范例
using System;
using System.Collections.Generic;
using Oxide.Core.Plugins;
namespace Oxide.Plugins
{
[Info("ApiTest", "Ghosst", "1.0.0")]
[Description("OnlinePlayers Counter.")]
public class ApiTest : RustPlugin
{
Timer CounterTimer;
Timer BlinkTimer;
Timer RandPTimer;
int Count = 0;
bool IsActive = true;
string RandomPlayerID;
bool RandomPlayername = false;
bool Blinker = false;
bool CounterP = false;
List<string> Panels = new List<string> { "BlinkPanel", "CounterPanel", "RandomPlayernamePanel" };
[PluginReference]
Plugin InfoPanel;
void Loaded()
{
if(InfoPanel)
{
InfoPanelInit();
}
}
void OnPluginLoaded(Plugin InfoPanel)
{
if (InfoPanel.Title == "InfoPanel")
{
InfoPanelInit();
}
}
public void InfoPanelInit()
{
//Send Panel names to the infopanel.
InfoPanel.Call("SendPanelInfo", "ApiTest", Panels);
AddRandomPlayerNamePanel();
AddBlinkPanel();
AddCounterPanel();
if (CounterTimer == null & CounterP)
{
CounterTimer = timer.Repeat(5, 0, () => Counter());
}
if (BlinkTimer == null & Blinker)
{
BlinkTimer = timer.Repeat(5, 0, () => Blink());
}
if (RandPTimer == null & RandomPlayername)
{
RandPTimer = timer.Repeat(5, 0, () => RandomPlayer());
}
}
/// <summary>
/// Load the panel
/// </summary>
public void AddRandomPlayerNamePanel()
{
RandomPlayername = (bool)InfoPanel.Call("PanelRegister", "ApiTest", "RandomPlayernamePanel", RndPlayerNameCfg);
}
/// <summary>
/// Load the panel.
/// Show the panel everyone.
/// </summary>
public void AddBlinkPanel()
{
Blinker = (bool)InfoPanel.Call("PanelRegister", "ApiTest", "BlinkPanel", BlinkPCfg);
InfoPanel.Call("ShowPanel", "ApiTest", "BlinkPanel");
}
/// <summary>
/// Load the panel.
/// Show the panel everyone.
/// </summary>
public void AddCounterPanel()
{
CounterP = (bool)InfoPanel.Call("PanelRegister", "ApiTest", "CounterPanel", CounterPCfg);
InfoPanel.Call("ShowPanel", "ApiTest", "CounterPanel");
}
/// <summary>
/// Hide or show the panel
/// </summary>
public void Blink()
{
if(IsActive)
{
IsActive = false;
InfoPanel.Call("HidePanel", "ApiTest", "BlinkPanel");
}
else
{
IsActive = true;
InfoPanel.Call("ShowPanel", "ApiTest", "BlinkPanel");
}
}
/// <summary>
/// Refresh the counter to every active player.
/// </summary>
public void Counter()
{
Count = 5;
if (InfoPanel && CounterP)
{
InfoPanel.Call("SetPanelAttribute", "ApiTest", "CounterPanelText", "Content", Count.ToString());
InfoPanel.Call("SetPanelAttribute", "ApiTest", "CounterPanelText", "FontColor", "0.6 0.1 0.1 1");
InfoPanel.Call("RefreshPanel", "ApiTest", "CounterPanel");
}
}
/// <summary>
/// Show his name to a random player. But just only for him.
/// </summary>
public void RandomPlayer()
{
if(RandomPlayerID != null)
InfoPanel.Call("HidePanel", "ApiTest", "RandomPlayernamePanel", RandomPlayerID);
if(BasePlayer.activePlayerList.Count > 0)
{
var rand = new System.Random();
BasePlayer player = BasePlayer.activePlayerList[rand.Next(BasePlayer.activePlayerList.Count)];
RandomPlayerID = player.UserIDString;
if (InfoPanel && RandomPlayername)
{
InfoPanel.Call("SetPanelAttribute", "ApiTest", "RandomPlayernamePanelText", "Content", player.displayName, RandomPlayerID);
InfoPanel.Call("SetPanelAttribute", "ApiTest", "RandomPlayernamePanelText", "FontColor", "0.2 0.3 0.5 1", RandomPlayerID);
InfoPanel.Call("ShowPanel", "ApiTest", "RandomPlayernamePanel", RandomPlayerID);
}
}
}
/*
Example Configs. Theres is no required option.
*/
string RndPlayerNameCfg = @"
{
""Autoload"": false,
""AnchorX"": ""Left"",
""AnchorY"": ""Bottom"",
""Available"": true,
""BackgroundColor"": ""0.1 0.1 0.1 0.4"",
""Dock"": ""BottomPanel"",
""Width"": 0.07,
""Height"": 0.95,
""Margin"": ""0 0 0 0.005"",
""Order"": 0,
""Image"": {
""AnchorX"": ""Left"",
""AnchorY"": ""Bottom"",
""Available"": true,
""BackgroundColor"": ""0.1 0.1 0.1 0.3"",
""Dock"": ""BottomPanel"",
""Height"": 0.8,
""Margin"": ""0 0.05 0.1 0.05"",
""Order"": 1,
""Url"": "" "",
""Width"": 0.22
},
""Text"": {
""Align"": ""MiddleCenter"",
""AnchorX"": ""Left"",
""AnchorY"": ""Bottom"",
""Available"": true,
""BackgroundColor"": ""0.1 0.1 0.1 0.3"",
""Dock"": ""BottomPanel"",
""FontColor"": ""1 1 1 1"",
""FontSize"": 14,
""Content"": ""APITest Bottom"",
""Height"": 1.0,
""Margin"": ""0 0 0 0"",
""Order"": 2,
""Width"": 0.63
},
}";
string BlinkPCfg = @"{}";
string CounterPCfg = @"
{
""Dock"": ""TopPanel"",
""Text"": {
""Content"": ""APITest Top""
}
}";
}
}