Skip to content

Conversation

@Kulltero
Copy link
Owner

@Kulltero Kulltero commented Feb 1, 2023

PR to collect feedback & improvements

Uploading Documentation onto a clean branch because having 557 Stackedit commits doesn't seem sensible
Uploading Documentation onto a clean branch because having 557 Stackedit commits doesn't seem sensible
@@ -0,0 +1,60 @@
# Components: RectTransform
**< [Previous Component](/docs/components/README.md)** | **[Back to Components](/docs/components/README.md)** | **[Next Component](/docs/components/UnityEngine.UI.RawImage.md) >**

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest removing Next links when at the end, and removing the Previous links when at the beginning.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i agree, i initially kept it for the symmetry/aesthetics, but its more important the navigation actually makes sense

A common Technique is to use Anchors to specify what part of the Parent the UI should be anchored to (Top Left Corner or Dead Center. Etc.) and to use Offsets for Size & Position.

## Offsets and Scaling
Rust will automatically scale Offsets depending on the Player's Resolution, which ensures your Offsets are predictable.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest also mentioning that Rust accounts for the client's graphics.uiscale since I still see people believing otherwise.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I completely forgot to mention that, so I've added it to the scaling section as a note


---
before using RawImage, take a look at the Image Component to see if it's better suited for your usecase.
**< [Previous Component](/docs/components/README.md)** | **[Back to Components](/docs/components/README.md)** | **[Next Component](/docs/components/UnityEngine.UI.RawImage.md) >**

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Next Component link location is wrong.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks for pointing it out

@@ -0,0 +1,46 @@
# Components: InputField

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be a markdown file. Links to this page are broken.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noticed it too late, fixed now

### Positioning your CUI alongside rust UI
for features that augment Rust's existing UI, like when you're working with Furnaces & other storage Inventories, its important to make sure your CUI doesn't interfere with the UI you augment.

Rust UI uses the same Placement system CUI does. it anchors all of the UI to the Bottom Middle of the Screen and then uses offsets to position each element. by doing the same you can ensure that your CUI is positioned properly, regardless of Screensize & Aspect Ratio.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it anchors all of the UI to the Bottom Middle of the Screen

This is true for many elements, but of course not true for the status bars, compass, missions, etc. Also not true for vendor dialog which is anchors to middle center.

Wouldn't hurt to also mention that the computer station UI doesn't use this, to save people time from trying to get that to work.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i expanded on that section to clarify it based on your feedback, i did choose to show an easy way to find what a UI element is anchored to instead of repeating your list, i did look at the computer station UI and couldn't really figure out what it was doing either so i'm not sure how to address that one

| `font` | string | the Asset name of the Font you wish to use |
| `align` | string (enum `TextAnchor`) | the way your Text should be aligned |
| `color` | string | the default Color of your Text |
| `verticalOverflow` | string (enum `VerticalWrapMode`) | how Text Overflowing vertically should be handled |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest documenting the enum values and/or providing a link to Unity docs.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a section on the verticalOverflow enum

| `lineType` | string (enum `InputField.LineType`) | dictates if the Field should allow multiple Lines & how to handle when the Player presses `enter` |
| `password` | key presence Field | if the input should be obscured |
| `needsKeyboard` | key presence Field | prevents default Keyboard behavior (movement, item switching etc) while the field is Focused |
| `hudMenuInput` | key presence Field | same as above but for Rust UI (Inventory, Crafting, etc.) |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth mentioning that this if you try to use needsKeyboard while the hud is open, the hud will be closed when clicking on the input. Can also mention that, unlike needsKeyboard, it doesn't block movement or key binds.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i assume with your second sentence you were talking about the hudMenuInput, which i also wasnt aware of. i've added a section to explain this a bit more

| `sprite` | string | the asset Path to the sprite |
| `color` | string | the normalized RGBA values of your color |
| `material` | string | the asset Path to the Material |
| `imagetype` | string (enum `Image.Type`) | sets the display mode of the Image* |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider documenting the known values and/or linking to Unity docs.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i've added some more information for the imagetype field, but i also used the chance to reiterate that the setting really only does things for preconfigured sprites.

i think particularly the sliced & tiled options could be really useful for server loaded images too so it would be really nice to see the api include fields for this in the future

Comment on lines 24 to 26
| `sprite` | string | the asset Path to the sprite |
| `color` | string | the normalized RGBA values of your color |
| `material` | string | the asset Path to the Material |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be awesome to somehow document the known sprite/material values. Not sure if this is the best place for that, since it can change, but perhaps you can document a process by which the allowed values can be determined.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont really know an easy way short of digging out asset files from the game, there is a very outdated repo by orange that lists them of somewhat conveniently https://github.com/OrangeWulf/Rust-Docs/blob/master/Extended/Materials.md, but i'm unsure if linking to it in the docs is the best way to go about it

README.md Outdated

---
### Disclaimer
the readme & Documentation is Community maintained it aims to give Developers a starting Point and educate them on effectively using CUIs for their Projects

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of sentence capitalization issues throughout the docs.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i fixed most of the capitalization issues & went through it with LanguageTool just to make sure I'd catch all the obvious ones, should be a bit better to read now

Fixed InputField name & added section about Text Selection
added notice explaining the default values in the json examples
Improved spelling & fixed capitalization issues
added section for Layers in the Basics
expanded on Positioning in Bugs-Tips
expanded on the imagetype setting for the image component
added references to the bugs/error messages in some of the other pages
added explanation for hudMenuInput & needsKeyboard fields on Input Component
added note explaining that supplying a skinid of 0 causes client issues
Corrected ordering of all Layer values & added descriptions to Hud & Hud.Menu
Comment on lines 18 to 19
"skinid": 0,
"fadeIn": 0.0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"fadeIn" has 4 spaces on various pages, but the other fields are using tabs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants