tModLoader TerraUI Toolkit (Example Mod Included)

I have a problem when compiling my mod with a tone of errors (I confess a few are my own)
could I have help? by the way the example mod works fine during compiling
Code:
c:\Users\Josep\OneDrive\Documents\My Games\Terraria\ModLoader\Mod Sources\CodingTest\CodingTest.cs(29,28) : error CS0117: 'CodingTest.CodingTest' does not contain a definition for 'DirtMachineUIOpen'

c:\Users\Josep\OneDrive\Documents\My Games\Terraria\ModLoader\Mod Sources\CodingTest\CodingTest.cs(33,32) : error CS0117: 'CodingTest.CodingTest' does not contain a definition for 'DirtMachineUIOpen'

c:\Users\Josep\OneDrive\Documents\My Games\Terraria\ModLoader\Mod Sources\CodingTest\CodingTest.cs(37,36) : error CS0117: 'CodingTest.CodingTest' does not contain a definition for 'DirtMachineUI'

c:\Users\Josep\OneDrive\Documents\My Games\Terraria\ModLoader\Mod Sources\CodingTest\CodingTest.cs(39,36) : error CS0117: 'CodingTest.CodingTest' does not contain a definition for 'DirtMachineUI'

c:\Users\Josep\OneDrive\Documents\My Games\Terraria\ModLoader\Mod Sources\CodingTest\CodingTest.cs(39,56) : error CS0246: The type or namespace name 'ExampleUI' could not be found (are you missing a using directive or an assembly reference?)

c:\Users\Josep\OneDrive\Documents\My Games\Terraria\ModLoader\Mod Sources\CodingTest\CodingTest.cs(41,32) : error CS0117: 'CodingTest.CodingTest' does not contain a definition for 'DirtMachineUI'

c:\Users\Josep\OneDrive\Documents\My Games\Terraria\ModLoader\Mod Sources\CodingTest\MyPlayer.cs(28,37) : error CS0103: The name 'Keyboard' does not exist in the current context

c:\Users\Josep\OneDrive\Documents\My Games\Terraria\ModLoader\Mod Sources\CodingTest\MyPlayer.cs(30,39) : error CS0103: The name 'Mouse' does not exist in the current context

c:\Users\Josep\OneDrive\Documents\My Games\Terraria\ModLoader\Mod Sources\CodingTest\TerraUI\UI\UIWindows\DirtMachineUI.cs(26,46) : error CS1502: The best overloaded method match for 'Microsoft.Xna.Framework.Vector2.Vector2(float, float)' has some invalid arguments

c:\Users\Josep\OneDrive\Documents\My Games\Terraria\ModLoader\Mod Sources\CodingTest\TerraUI\UI\UIWindows\DirtMachineUI.cs(26,58) : error CS1503: Argument 1: cannot convert from 'double' to 'float'

c:\Users\Josep\OneDrive\Documents\My Games\Terraria\ModLoader\Mod Sources\CodingTest\TerraUI\UI\UIWindows\DirtMachineUI.cs(27,75) : error CS0103: The name 'Contexts' does not exist in the current context

c:\Users\Josep\OneDrive\Documents\My Games\Terraria\ModLoader\Mod Sources\CodingTest\TerraUI\UI\UIWindows\DirtMachineUI.cs(41,79) : error CS0103: The name 'Contexts' does not exist in the current context

c:\Users\Josep\OneDrive\Documents\My Games\Terraria\ModLoader\Mod Sources\CodingTest\TerraUI\UI\UIWindows\DirtMachineUI.cs(45,77) : error CS0103: The name 'Contexts' does not exist in the current context

c:\Users\Josep\OneDrive\Documents\My Games\Terraria\ModLoader\Mod Sources\CodingTest\TerraUI\UI\UIWindows\DirtMachineUI.cs(58,33) : error CS1061: 'System.Collections.Generic.List<CodingTest.UIObject>' does not contain a definition for 'add' and no extension method 'add' accepting a first argument of type 'System.Collections.Generic.List<CodingTest.UIObject>' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Josep\OneDrive\Documents\My Games\Terraria\ModLoader\Mod Sources\CodingTest\TerraUI\UI\UIWindows\DirtMachineUI.cs(59,33) : error CS1061: 'System.Collections.Generic.List<CodingTest.UIObject>' does not contain a definition for 'add' and no extension method 'add' accepting a first argument of type 'System.Collections.Generic.List<CodingTest.UIObject>' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Josep\OneDrive\Documents\My Games\Terraria\ModLoader\Mod Sources\CodingTest\TerraUI\UI\UIWindows\DirtMachineUI.cs(60,33) : error CS1061: 'System.Collections.Generic.List<CodingTest.UIObject>' does not contain a definition for 'add' and no extension method 'add' accepting a first argument of type 'System.Collections.Generic.List<CodingTest.UIObject>' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Josep\OneDrive\Documents\My Games\Terraria\ModLoader\Mod Sources\CodingTest\TerraUI\UI\UIWindows\DirtMachineUI.cs(56,17) : error CS0103: The name 'BUITE' does not exist in the current context

c:\Users\Josep\OneDrive\Documents\My Games\Terraria\ModLoader\Mod Sources\CodingTest\Tiles\DirtMachine.cs(36,24) : error CS0117: 'CodingTest.CodingTest' does not contain a definition for 'DirtMachineUIOpen'
 
Now that I look at the UI that Terraria already provides, probably not. Unless I want to do something completely my own way I'd just use that.

Do you mean tModLoader or Terraria itself? Either way, you seem to think that one is a better UI kit, I think? Any resource for me to use to do UI in that way?

Thanks!
 
Well, I believe that all of Terraria's UI is done via the in-built Terraria UI system. I don't really use it myself, but that's mainly because I like to write my own. I think you can see examples in the Example Mod and in the game itself, so that should be the thing you use if you want to make UI. I think.
 
This is wonderful. I was really stuck on making a custom UI, and this mod basically saved my life. Lol

However, I wanted to list a few issues I encountered.
~Whenever an item slot is being drawn, you can't use weapons or open doors. Perhaps there's a missing check for if the mouse is hovering over the slot?
~I can't seem to get buttons to work despite the fact that I basically copy-pasted the code. Clicking the button does nothing even though I coded in what I wanted it to do. However, I'm not using a parent object for it (it's a standalone button), is that the issue?
~A bug I encountered in the example mod itself: If one clicks in the text box, you can't move. This is expected behavior. However, if you click the close button, you still can't move. But closing the interface via closing your inventory allows you to move again. It's kinda buggy and I had to restart my game to be able to move again.
~Items in custom item slots do not draw their names or tool-tips. If this is intentional, do you think you could include the code for drawing it in the example mod(s)? (I think I can find and/or write the code myself, but it would be easier for a lot of other people if it was included.)

Edit: Turns out the code in the BUITEPlayer.cs is needed to fix the buttons, but the other issues are still present.
 
Last edited:
This is wonderful. I was really stuck on making a custom UI, and this mod basically saved my life. Lol

However, I wanted to list a few issues I encountered.
~Whenever an item slot is being drawn, you can't use weapons or open doors. Perhaps there's a missing check for if the mouse is hovering over the slot?
~I can't seem to get buttons to work despite the fact that I basically copy-pasted the code. Clicking the button does nothing even though I coded in what I wanted it to do. However, I'm not using a parent object for it (it's a standalone button), is that the issue?
~A bug I encountered in the example mod itself: If one clicks in the text box, you can't move. This is expected behavior. However, if you click the close button, you still can't move. But closing the interface via closing your inventory allows you to move again. It's kinda buggy and I had to restart my game to be able to move again.
~Items in custom item slots do not draw their names or tool-tips. If this is intentional, do you think you could include the code for drawing it in the example mod(s)? (I think I can find and/or write the code myself, but it would be easier for a lot of other people if it was included.)

Edit: Turns out the code in the BUITEPlayer.cs is needed to fix the buttons, but the other issues are still present.

To be honest, I don't really work on this anymore. Not sure if @abluescarab does still. The example mod hasn't been updated since release so I wouldn't expect it to work :guidegrin: But hey, glad to see that it still helped someone. Use any code that works freely and sorry to say but you'll probably have to modify / fix any bugs on your own. If you want help I'd be glad to provide it though :guidesmile:
 
To be honest, I don't really work on this anymore. Not sure if @abluescarab does still. The example mod hasn't been updated since release so I wouldn't expect it to work :guidegrin: But hey, glad to see that it still helped someone. Use any code that works freely and sorry to say but you'll probably have to modify / fix any bugs on your own. If you want help I'd be glad to provide it though :guidesmile:
Ah, I see. Yeah, I've been able to fix a few of the bugs and I guess I'll just continue to try and fix the others.
 
TerraUI was a great tool in the past, but it's likely better to use a UIElement-based system now. Perhaps this toolkit could turn into a library of custom UIElements instead?
 
TerraUI was a great tool in the past, but it's likely better to use a UIElement-based system now. Perhaps this toolkit could turn into a library of custom UIElements instead?
I'm not aware of the new system since I've been gone for a while. Is there any information I can read on it? Edit: Nevermind, I found this tutorial and some stuff in the example mod. Thanks for letting me know!

Edit 2: The UIElement system is nice. I'll work it into TerraUI hopefully soon, but I'll need to figure out how to implement everything first, what's missing, etc.

Edit 3: The first UIObject has been released! The progress bar in the UIElement system was severely lacking, so that was the first step. Check out the uielement branch until it's ready to go and I merge into master.
 
Last edited:
Back
Top Bottom