1. Hi All,

    In my private mod I have a cursor UI with tabs where I was originally having issues with the cursor resetting to the middle each time the UI was re-rendered. I fixed this by using rendering logic such that only a a subcontainer (referencing the main one as parent) is re-rendered. This rendering logic gave me the desired behavior where the cursor is untouched when the subpanel is re-rendered.

    After I reinstalled Oxide on my server and now it appears the cursor resets every time I render the sub-container.

    Is anyone else experiencing this? Is this a bug in the Cui code, or Oxide?

    Thanks

    This is a code snippet:
    Code:
    public static void CreateWPUI(OnlinePlayer onlinePlayer, string page = "info")
                {
                    ...                CuiElementContainer mainWindow;
                    if (onlinePlayer.WPMainUI == null)
                    {
                        DestroyWPUI(onlinePlayer);
                        mainWindow = CreateElementContainer(WPUI_Name, UIColors["dark"], MainMin, MainMax, true);
                        onlinePlayer.WPMainUI = mainWindow;                    CreatePanel(ref mainWindow, WPUI_Name, UIColors["headerbg"], "0.01 0.81", "0.99 0.96");
                        //CreateLabel(ref contentsContainer, WPUI_Contents, string.Empty, headerButton1, 25, ns(button1x1, headerMinY), ns(button1x2, headerMaxY));                    CreateButton(ref mainWindow, WPUI_Name, UIColors["transparentgrey"], headerButton1, 25, ns(button1x1, headerMinY), ns(button1x2, headerMaxY), "WPUI_Control info");
                        CreateButton(ref mainWindow, WPUI_Name, UIColors["transparentgrey"], headerButton2, 25, ns(button2x1, headerMinY), ns(button2x2, headerMaxY), "WPUI_Control events");
                        CreateButton(ref mainWindow, WPUI_Name, UIColors["transparentgrey"], headerButton3, 25, ns(button3x1, headerMinY), ns(button3x2, headerMaxY), "WPUI_Control currencymenu");
                        CreateButton(ref mainWindow, WPUI_Name, UIColors["transparentgrey"], headerButton4, 25, ns(button4x1, headerMinY), ns(button4x2, headerMaxY), "WPUI_Control shop");                    CreateButton(ref mainWindow, WPUI_Name, UIColors["grey2"], "X", 14, "0.95 0.961", ns(headerMaxX, 0.99f), "WPUI_Control closeui");                    CuiHelper.AddUi(onlinePlayer.Player, mainWindow);
                    }
                    else
                    {
                        mainWindow = onlinePlayer.WPMainUI;
                    }                CuiElementContainer mainSectionContainer = CreateElementContainer(WPUI_Contents, UIColors["mainsection"], "0.01 0.15", "0.99 0.81", true, WPUI_Name);                string message = "Test message!";
                    switch (page)
                    {
                        case "info":
                            SetInfoSection(mainSectionContainer, WPUI_Contents);
                            break;
                        case "events":
                            SetEventsSection(mainSectionContainer, WPUI_Contents, onlinePlayer);
                            break;
                        case "currencymenu":
                        case "shop":
                            message = "Currency & Shop coming soon!";
                            message = $"<color=#C4FF00>{message}</color>";
                            CreateLabel(ref mainSectionContainer, WPUI_Contents, string.Empty, message, 16, "0.01 0.20", ns(0.99f, headerMinY - 0.01f));
                            //CreateLabel(ref mainSectionContainer, WPUI_Contents, string.Empty, message, 16, "0.01 0.20", ns(0.99f, headerMinY - 0.01f));
                            break;
                        default:
                            break;
                    }                CuiHelper.DestroyUi(onlinePlayer.Player, WPUI_Contents);
                    CuiHelper.AddUi(onlinePlayer.Player, mainSectionContainer);
                }public static void DestroyWPUI(OnlinePlayer onlinePlayer)
                {
                    onlinePlayer.Player.ConsoleMessage("Destroying/recreating UI."); // to assist debugging                onlinePlayer.WPMainUI = null;
                    CuiHelper.DestroyUi(onlinePlayer.Player, WPUI_Contents);
                    CuiHelper.DestroyUi(onlinePlayer.Player, WPUI_Name);
                }public class OnlinePlayer
            {
                public BasePlayer Player;
                ..
                public CuiElementContainer WPMainUI = null;
                ..            public void OnDisconnect()
                {
                    try
                    {
                        Interface.Oxide.LogInfo("Destroying online player {0}.", Player.displayName);
                        ..
                        WPUI.DestroyWPUI(this);
                        ..
                    }
                    catch (Exception ex)
                    {
                        Interface.Oxide.LogInfo(ex.ToString());
                    }
                }
            }
     
    Last edited by a moderator: Apr 17, 2017
  2. Wulf

    Wulf Community Admin

    The CUI is provided by Rust, so it would be an issue with it generally.
     
  3. I think Rust devs had a JIRA page or something for reporting bugs. Do you know if there's a special way to report mod-related bugs?
     
  4. Wulf

    Wulf Community Admin

    The CUI is provided by Rust, so it'd be the same place for reporting.
     
  5. This has been fixed in the latest patch. Thanks.