Windward

Windward

View Stats:
NeevoLima 27 Dec, 2015 @ 2:44am
Adding a new Panel to the UITown
Hi,

maybe someone has experience adding additional buttons into the game. I probably just need one example, but I'll show you what I have tried so far. The following code will simply show me a lot of names of all widgets on the town UI.

string s = ""; if (UITown.instance != null) { if (UITown.instance.panel != null) { List<UIWidget> listUIW = UITown.instance.panel.widgets; foreach (UIWidget uiw in listUIW) { s += " " + uiw.name; } } } UIStatusBar.Show(s);

My target is currently to reverse engineer how the menu is made up. A town menu has several buttons for - let me call them - panels. Examples are the "Rumours", "Ships" or "Vault" buttons.

Then I wanted to add another button to the panel, but when I stumpled upon the UIPanel.widgets properties, the documentation [1] says, I should not attempt to modify the widgets of a UIPanel myself. Hm :/

Now my questions are as follows:
  1. Which property modifies the label "Rumours", "Vault", etc.? So, how do I change "Rumours" into "Taverne"?
  2. How do I add another button to the town panel? I would like to add a taverne :blissful_creep:

[1] UIPanel.widgets public attribute: http://www.tasharen.com/windward/docs/class_u_i_panel.html
Last edited by NeevoLima; 27 Dec, 2015 @ 8:04am
< >
Showing 1-1 of 1 comments
ArenMook  [developer] 28 Dec, 2015 @ 8:36pm 
Town panel has child game objects. Some of them are useful to you.

Town panel name: "[02] Window - Town". Its children are:
  • Tabs
  • Cargo Content
  • Inventory Content
  • Quest Content
  • Ships Content
  • Rumors Content
  • Vault Content
Each of those has more children, and some have scroll views which have a panel of their own. So to answer your question, to change "Rumors" into "Taverne", easiest way would be to just do it in the Localization file. No mucking around with code required. Just find the line that starts with "Rumors" and change its translations to something else.

However, if you really wanted to modify the label itself...
GameObject.Find("5. Rumors").GetComponentInChildren<UILabel>().text = "Something";
That said, that label has UILocalize script attached which will overwrite whatever you set the text to by pulling the value from the Localization. So yes... use Localization. Don't try to change the text manually.
Last edited by ArenMook; 28 Dec, 2015 @ 8:36pm
< >
Showing 1-1 of 1 comments
Per page: 1530 50