Example #1
0
    public void DisplayInfo(HotbarItem infoItem)
    {
        StringBuilder builder = new StringBuilder();

        builder.Append("<size=35>").Append(infoItem.ColouredName).Append("</size>\n");
        builder.Append(infoItem.GetInfoDisplayText());

        infoText.text = builder.ToString();

        popupCanvasObject.SetActive(true);

        LayoutRebuilder.ForceRebuildLayoutImmediate(popupObject);
    }
Example #2
0
        public void DisplayInfo(HotbarItem infoItem)
        {
            //Create a string builder instance.
            StringBuilder builder = new StringBuilder();

            //Get the item's custom display text.
            builder.Append("<size=35>").Append(infoItem.ColouredName).Append("</size>\n");
            builder.Append(infoItem.GetInfoDisplayText());

            //Set info text to be displayed.
            infoText.text = builder.ToString();

            //Activate UI canvas object.
            popupCanvasObject.SetActive(true);

            //Fixes resize problem.
            LayoutRebuilder.ForceRebuildLayoutImmediate(popupObject);
        }
    //Function to display info based on the hotbar item
    public void DisplayInfo(HotbarItem infoItem)
    {
        //Create a new string builder
        StringBuilder builder = new StringBuilder();

        //Get the colored text of the item
        builder.Append("<size=35>").Append(infoItem.ColouredName).Append("</size>\n");

        //Get the display text from the item
        builder.Append(infoItem.GetInfoDisplayText());

        //Set the text based on the built text
        infoText.text = builder.ToString();

        //Activate the popup object
        popupCanvasObject.SetActive(true);

        //Rebuild the layout of the window
        LayoutRebuilder.ForceRebuildLayoutImmediate(popupObject);
    }