Game Development Reference
In-Depth Information
itemsContent[i] = (_isEquipment) ? ((i == 0)
? new GUIContent(UNEQUIP) : items[i-1].guiContent) :
items[i].guiContent;
}
} else {
itemsContent[0] = (isNoItem) ? new
GUIContent(NONE) : ((_isEquipment) ? new
GUIContent(UNEQUIP) : items[0].guiContent);
}
_selectedItem = GUI.SelectionGrid (view,
_selectedItem, itemsContent, 1,
GUI.skin.GetStyle("Selected Item"));
GUI.EndScrollView ();
_guiContent = itemsContent[_selectedItem];
}
There is a bug in GUI.SelectionGrid in Unity 4.0 to 4.2. When you roll
over the items, the tooltip always returns an empty string. If you are using Unity
4.0 to 4.2, you can replace these lines of code with the following code:
// Unity JavaScript user:
_selectedItem = GUI.SelectionGrid (view,
_selectedItem, itemsContent, 1,
GUI.skin.GetStyle("Selected Item"));
The preceding code should be replaced with the following code:
for (var j: int = 0; j < itemsContent.Length; j++) {
if (_selectedItem == j) {
GUI.Label(new Rect (0, j*40, 280,
40),itemsContent[j],GUI.skin.GetStyle("Disabled
Click"));
} else {
if (GUI.Button(new Rect (0, j*40, 280,
40),itemsContent[j],GUI.skin.GetStyle("Selected
Item"))) {
_selectedItem = j;
}
Search WWH ::




Custom Search