Menu Changes - Slight Pain #374
garrynewman
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm merging the menu branch I worked on last week in today.
This isn't finished by any means, but all the stuff that would leave you unable to develop with it should be, so I should be able to be developing it on the master branch this week.
Some .addon file changes
Addon files can now specify which package they're from. This allows local addons to use the config from the api. Right now this means that on the local game page you'll get icons for the addons in your addons folder.
To specify the addon just add this to the .addon
Quick Play
The quick play button on the home screen is a convenience for us developers. It'll recreate the last created game, using the same map and same settings that you last chose.
UI Sounds
You can specify sounds in CSS now using the sound-in and sound-out properties.
Panel Event Changes
Panel.OnEvent is now obsolete and shouldn't be used.
If you're catching an existing event, override one of the new virtual methods:
If not, there's a new [PanelEvent] attribute to add to methods. Add this to a public method and the event will be passed to it.
Calling events should be done via the new
Panel.CreateEvent
method.Adding listeners to events should be done via the new
Panel.AddEventListener
method.Style Specificity
The stylesheet system should now obey style specificity.
Previously a selector took precedence purely based on its order in the stylesheet, so if you were counting on that you might see some problems with some styles taking priority when you didn't expect them to.
UseTemplate
I added a new attribute for panels. Adding [UseTemplate] to your panel will automatically set the template. If your file is named "ui/mypanel.cs", it'll automatically try to load "ui/mypanel.html".
I also added a couple of virtual methods to make it easier for you to make your panels play nice with the template system..
PreTemplateApplied
andPostTemplateApplied
Using this method is a bit more friendly when using hotload, since we can detect the attribute changes during hotload and load/unload/reload the template at that point. If you set the template in the constructor there's no real way for us to change it automatically.
Library.GetAttributes
You can define custom attributes for your classes. Here's an example.
I made a custom attribute that allows me to mark panels with a URL.
By deriving from
LibraryAttribute
it goes in the Library system.Then you can use the Library to get all registered attributes.
And you can use the attribute to create the class
pixel-snap
We had a bunch of problems when panels were right next to each other, and the same colour, you could see a line between them. This line shouldn't be there obviously, it should be a solid colour.
This was happening because the panels weren't snapped to the pixels, so we had this subpixel stuff happening. The problem with snapping to the pixel is that it makes things like nametags, which are following a position in world, look jolty and horrible,
So I added
pixel-snap
css property. Setting it to 1 turns snapping on, setting it to 0 turns it off. It defaults to 1.If you have a HUD that is following the world or whatever, just set it to 0 on those panels (or their parent panel).
Known Issues
Like I said, this isn't complete, a bunch of stuff is placeholder and broken. Here's some stuff I know about
Beta Was this translation helpful? Give feedback.
All reactions