But InputField does not worked. Who made a mistake? Component developer or i in my plugin.Code:/* * Basic example to use CountDown and InputField * * Countdown: /ui.countdown * InputField: /ui.inputfield * */using Oxide.Game.Rust.Cui;namespace Oxide.Plugins { [Info("CommunityUI", "miRror", "1.0.0")] public class CommunityUI : RustPlugin { private string uiCountDown = @" [{ ""name"": ""uiCountDown"", ""components"": [ { ""type"": ""CountDown"", ""align"": ""MiddleCenter"", ""wrapperText"": ""Left %TIME_LEFT% seconds"", ""timeLeft"": ""10"", ""fontSize"": ""30"", ""font"": ""RobotoCondensed-Bold.ttf"", ""color"": ""0 0.7 0.5 1"", ""command"": ""cui.test"" }, { ""type"":""RectTransform"", ""anchormin"": ""0 0"", ""anchormax"": ""1 1"" } ] }]"; private string uiInputField = @" [{ ""name"": ""uiInputField"", ""parent"": ""Overlay"", ""components"": [ { ""type"": ""UnityEngine.UI.Image"", ""material"": ""assets/icons/greyout.mat"", ""color"": ""0.1 0.1 0.1 0.97"", }, { ""type"": ""RectTransform"", ""anchormin"": ""0.4 0.45"", ""anchormax"": ""0.6 0.55"" }, { ""type"": ""NeedsCursor"" } ] }, { ""parent"": ""uiInputField"", ""components"": [ { ""type"":""UnityEngine.UI.Text"", ""text"":""Enter message..."", ""fontSize"": 30, ""align"": ""MiddleCenter"", }, { ""type"": ""InputField"", ""command"": ""yourcommand "", }, { ""type"":""RectTransform"", ""anchormin"": ""0 0"", ""anchormax"": ""1 1"" } ] }]"; private void Unload() { foreach(BasePlayer player in BasePlayer.activePlayerList) { CuiHelper.DestroyUi(player, "uiCountDown"); CuiHelper.DestroyUi(player, "uiInputField"); } } [ChatCommand("ui.countdown")] private void cmdChatCountdown(BasePlayer player, string command, string[] args) { CuiHelper.DestroyUi(player, "uiCountDown"); CuiHelper.AddUi(player, uiCountDown); } [ChatCommand("ui.inputfield")] private void cmdChatInputField(BasePlayer player, string command, string[] args) { CuiHelper.DestroyUi(player, "uiInputField"); CuiHelper.AddUi(player, uiInputField); } } }
See more: GitHub - Facepunch/rust-community: Community Entity to fill Server Side modder requests
New Countdown and InputField CUI components
Discussion in 'Rust Development' started by miRror, Apr 15, 2017.