예제 #1
0
        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);
            }
        }
예제 #2
0
        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();
            }
        }
예제 #3
0
        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);
        }