Hello, I have two questions to ask about the Lists because I am making an inventory.
1) I use GUILayout.SelectionGrid, who show a string List. In these List there are my items, like Axe or Sword. So in my list I have "Axe" and "Sword" and the selectionGrid show it very well. But, I also want to translate my game, so Axe and Sword will change if the game is in Italian or French per example. The problem is I can't directly do it in the list because the string will change, it is possible to, if in the list the item is "Axe", in the inventory grid it would be item.axe (per example)?
2) I also want to add the number of an item, it would be perfect if I can do like that: item.axe + "(" + axeNumber.ToString() + ")".
Cordialy.
My code:
public List InventoryItemName = new List();
in OnGUI ():
customerGridNames = new string[InventoryItemName.Count];
for(int cnt = 0; cnt < InventoryItemName.Count; cnt++) {
customerGridNames[cnt] = InventoryItemName[cnt];
}
scrollPos = GUILayout.BeginScrollView (scrollPos);
selectedGrid = GUILayout.SelectionGrid(selectedGrid, customerGridNames, 1);
if (selectedGrid == item.axeID) mainID = item.axeID;
if (selectedGrid == item.swordID) mainID = item.swordID;
GUILayout.EndScrollView ();
↧