Yes we can, but it will be bad way... We just need to wait for new update.
Community entity UI
Discussion in 'Rust Development' started by ShadowEvil, Jun 5, 2015.
-
The only current bypass that MIGHT work is to randomly generate the button name on every UI call. So for example Button88 will increment to Button89 and so on. This is just an idea that is not tested.
I will recommend waiting for Garry/Rust to fix this issue. -
I prefer to create static elements (ex: TitleButton) and just change the text without deleting button every update. -
-
I'm used simple (maybe bit ugly) random number what added everytime to all panel names:
Code:var RndName = ((int)Math.Round(UnityEngine.Random.Range(0f, 10000000f))).ToString();
Anyway its just temporary for testing...
And i have question - is there way to create some filled rectangle of a certain size? Or i must use images for that (with needed sizes)? Because for now i'm getting only "black" square always with same size using this:
Code:{ ""name"": ""Test{RND}"", ""parent"": ""Overlay"", ""components"": [ { ""type"":""RectTransform"", ""anchormin"": ""0 0"", ""anchormax"": ""1 1"" }, { ""type"":""NeedsCursor"" } ] }, { ""name"": ""TitlePanelBase{RND}"", ""parent"": ""Test{RND}"", ""components"": [ { ""type"":""UnityEngine.UI.Button"", ""close"":""Test{RND}"", ""color"": ""0.3 0.3 0.3 1.0"", }, ] }
Last edited by a moderator: Jun 14, 2015 -
Well basically the Position is also the size. It's a very ugly complex system to work from just raw values. I wrote up a pretty decent system which I'm hoping to release when most of the issues has been fixed.
The next best thing you can do to create a filled space on screen is to use this...
Code:{ ""type"":""UnityEngine.UI.Image"", ""color"":""0.1 0.1 0.1 1"", },
so basically you have 4 values for "color" to fill in. it's your basic RGBA system where A is the Alpha/Opacity of the color.
Code:COLOR : RED GREEN BLUE ALPHA ""COLOR"": ""0.1 0.1 0.1 1"",
-
@Zuen thank you! now i understand what i doing wrong, i didn't correctly understand what is "anchormin" and max, I thought this position of my panels, but it also scales it. Now i'm finally got something working.
Another question - as i can understand we can use rust icons here, how can i look this icon names etc? -
I honestly have no idea how to look up the names right now. I will try and find some solution to this but right now i'm a bit clueless on it.
-
Hmmm, does anyone else have issue with text on buttons? When there is text on button you can't anymore click on button where is text displayed, only in outer of text.
-
-
here is button part:
Code:{ ""name"": ""TitlePanelBut{RND}"", ""parent"": ""TitlePanelBase{RND}"", ""components"": [ { ""type"":""UnityEngine.UI.Button"", ""close"":""Test{RND}"", ""color"": ""0.6 0.3 0.3 1.0"", }, { ""type"":""RectTransform"", ""anchormin"": ""0.9 0.9"", ""anchormax"": ""1 1"" }, ] }, { ""parent"": ""TitlePanelBut{RND}"", ""components"": [ { ""type"":""UnityEngine.UI.Text"", ""text"":""X"", ""fontSize"":20, ""align"": ""MiddleCenter"", }, ] },
-
Well this is suppose to work then. I see nothing wrong at all...
-
Hmm, i have idea or so... Maybe someone can code something for garry or so so we can create something what will can use http://docs.unity3d.com/Manual/StyledText.html ? I mean some form/component in UI where we can use tags like in chat etc. Because right now there is very hard to display messages in multiple colors when i want only highlight small part of text... Not sure anyway if this is possible. Also some scroll functional can be good addition.
Last edited by a moderator: Jun 15, 2015 -
Would be awesome to put in style for text!
On another note!
I'm glad to announce that my UI system is working pretty good. I also added a new feature where the UI you send to the client can now be destroyed after a certain set time. This is useful for displaying notifications or w/e crap we can come up with!
Next feature:
Giving the option to update values of a current UI control. So if you wanted to display some small box displaying the players online and want to update it. This is the kind of feature you need. -
-
...
So I just tested my theory and I managed to re-position a button without having to re-create the whole panel.
http://gyazo.com/7dccc2cb673b1611f6002a9ec42adc85
How my system works.
You create a window.
Then you start adding your controls (Button/Image/RawImage/Label)
Then you send the window to the player.
Now when creating the window you can set some properties for it like the fadeOut time | if it needs a cursor | and if it needs to be removed after x amount of time.
You can also update controls of the window for a selected player.Last edited by a moderator: Jun 15, 2015 -
Hm.. Nice. I think I'll still stay with Garry's though... I mean good work and all..
But What I want the GUI Faces to be used for are just information panels... And maybe a shop... But
Whatever works xD
-
-
[DOUBLEPOST=1434371425][/DOUBLEPOST]
[DOUBLEPOST=1434371565][/DOUBLEPOST] -
I made a pull request for the error. Hopefully he accepts it or fixes it himself.