Skip to content

SlideButton Component#96

Open
Mercury-devs wants to merge 1 commit into
Facepunch:masterfrom
Mercury-devs:SlideButtonComponent
Open

SlideButton Component#96
Mercury-devs wants to merge 1 commit into
Facepunch:masterfrom
Mercury-devs:SlideButtonComponent

Conversation

@Mercury-devs
Copy link
Copy Markdown

What Changed

Added a new CUI component: SlideButton Component.

The component works as a toggle button with two states: On and Off. When clicked, it:

  • toggles its internal state;
  • changes the text;
  • changes the background color;
  • changes the text color;
  • plays a short slide animation for the text;
  • sends a command to the server via ConsoleNetwork.ClientRunOnServer if a command is provided.

New JSON Fields

The component supports the following fields:

{
  "type": "SlideButton",
  "isOn": false,
  "offText": "Off",
  "onText": "On",
  "offCommand": "myplugin.toggle 0",
  "onCommand": "myplugin.toggle 1",
  "offColor": "0.35 0.35 0.35 1.0",
  "onColor": "0.2 0.75 0.3 1.0",
  "offTextColor": "1.0 1.0 1.0 1.0",
  "onTextColor": "1.0 1.0 1.0 1.0",
  "offSlideDirection": "Right",
  "onSlideDirection": "Left",
  "duration": 0.15,
  "slidePixels": 30
}
Untitled.mp4

- Init
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant