private void SetupButton(Configuration.Button button) { // Check for existance to prevent load spam if same permissions used if (!string.IsNullOrEmpty(button.Permission) && !permission.PermissionExists(button.Permission)) { permission.RegisterPermission(button.Permission, this); } cmd.AddConsoleCommand(button.UI.CommandName, this, arg => { var basePlayer = arg.Player(); if (basePlayer == null) { return(false); } foreach (var commandData in button.Commands) { basePlayer.SendConsoleCommand(commandData.Command, commandData.Arguments); } return(false); }); if (button.UI.Color.IsLink) { ImageLibraryLoad(button.UI.ButtonBackgroundName, button.UI.Color.Link); } }
private void CacheButton(Configuration.Button button) { button.UI.ParsedButtonBackground = button.UI.GetButtonBackground(); button.UI.ParsedButton = button.UI.GetButton(); if (!button.UI.TextPlaceholder) { button.UI.ParsedButtonText = button.UI.GetButtonText(); } }
private void InterfaceAddButton(IPlayer player, CuiElementContainer container, Configuration.Button button) { if (!string.IsNullOrEmpty(button.Permission) && !player.HasPermission(button.Permission)) { return; } container.Add(button.UI.ParsedButtonBackground); container.Add(button.UI.ParsedButton); container.Add(button.UI.TextPlaceholder ? button.UI.GetButtonText(player) : button.UI.ParsedButtonText); }