Jump to content
  • 0

Editing Game UI



Ok, so i've watched the tutorials and played around with the InventoryWindow.JSON to try an include an extra button by the "X" button that will open a crafting window. Haven't even gotten around to the function of the button because I can't get the changes to commit. I QUIT the Server and Client, edit the JSON, save the JSON, restart server and client, check the JSON to see if changes stayed(they do so far), click "Log In", check JSON again and it has reverted to the orignal without the edit. I must be missing something here.


Heres the JSON Edit(a copy of "CloseButton" with name change and 70px location change on the X axis, pasted directly after "CloseButton"):

  "CraftButton": {
    "Bounds": "124,4,26,25",
    "Padding": "3,4,0,0",
    "AlignmentEdgeDistances": "0,0,0,0",
    "AlignmentTransform": "0,0",
    "Margin": "0,0,0,0",
    "RenderColor": "255,255,255,255",
    "Alignments": "Top,Right",
    "DrawBackground": true,
    "MinimumSize": "1,1",
    "MaximumSize": "30,30",
    "Disabled": false,
    "Hidden": false,
    "RestrictToParent": true,
    "MouseInputEnabled": true,
    "HideToolTip": false,
    "ToolTipBackground": null,
    "ToolTipFont": null,
    "ToolTipTextColor": "",
    "TextColor": "0,255,255,255",
    "HoveredTextColor": "",
    "ClickedTextColor": "",
    "DisabledTextColor": "255,90,90,90",
    "TextAlign": "Center",
    "TextPadding": "3,3,3,3",
    "AutoSizeToContents": false,
    "Font": "arial,10",
    "TextScale": 1.0,
    "NormalImage": "closenormal.png",
    "HoveredImage": "closehover.png",
    "ClickedImage": "closeclicked.png",
    "DisabledImage": "",
    "CenterImage": false,
    "HoverSound": "octave-tap-resonant.wav",
    "MouseUpSound": "",
    "MouseDownSound": "octave-tap-warm.wav",
    "ClickSound": ""

And, I'm not too sure HOW to give functionality to the new button if I can get it to stay, I've looked through the source and the JSONS to see if, lets say, "CloseButton" has a function to close the window directly linked to it that I could mimic, and either im blind and stupid or i just dont understand. The button IS linked to a "Close window" type function, I just dont see how.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0
6 minutes ago, jcsnider said:

The json only applies to existing elements. Defining those elements and their functionality are done in the source. If you add elements into the json that do not exist in the source they will just get dropped off.

Oooooh ok. Cool, I'll look into it. Thank you.

Link to comment
Share on other sites

  • 0

Ok, been into the source pretty hard the past few hours. I managed to make minor progress lol(Im used to Visual placement of components(VB.Net), not hardcoding them)

So basically, I searched for and copied every instance of "CloseButton" and edited it to "CraftButton" essentially, with an exception that I think may be the problem.






















And now for the part that I THINK is causing my problem, I'm just not sure what to do about it. I thought that the CloseButton status rendering(pressed/Hover/up) wouldn't work with the Craft button so i opted for the generic Button rendering, but I'm thinking i might have write a whole new rendering structure for the Craft Button itself, instead of piggybacking off the generic button.





Take a look inside there ^^ for images of the code. Please let me know if My hypothesis is correct(about the button rendering for Craft Button), or how i should fix it if that isnt the case.


Also, could probably figure it out but I'll ask anyways; once i get the button to show up alongside the CloseButton without issue, how would I go about calling a crafting table on the CraftButtonPressed handler?



EDIT: So I actually went ahead and created custom Window.Craft(Hover/Down/Disabled) functions and that apparently didnt work, or I did it wrong lol

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...