Game Development Reference
In-Depth Information
scrollPosition3 = GUI.BeginScrollView (new Rect (257, 300, 320,
120), scrollPosition3, new Rect (0, 0, 280, 40*in_items));
//We create grid button here.
in_toolArmors = GUI.SelectionGrid (Rect (0, 0, 280,
40*in_items), in_toolArmors, itemsContent, 1, GUI.skin.
GetStyle("Selected Item"));
// End the scrollview we began above.
GUI.EndScrollView ();
gui_armorCon = itemsContent[in_toolArmors];
}
8. Next, we will create the ShowAccess() funcion, which will be used to display the
accessory box as follows:
private function ShowAccess () : void {
var in_items : int = 6;
var itemsContent : GUIContent[] = new GUIContent[in_items];
//We create a GUIContent array of key item here (if you have
more than 1 item, you can also use your item array instead of the
current item)
for (var i: int = 0; i < in_items; i++) {
if (i == 0) {
itemsContent[i] = GUIContent(s_unequip, "");
} else {
itemsContent[i] = GUIContent(a_accessories[0].name, a_
accessories[0].icon);
}
}
scrollPosition3 = GUI.BeginScrollView (new Rect (257, 300, 320,
120), scrollPosition3, new Rect (0, 0, 280, 40*in_items));
//We create grid button here.
in_toolAccess = GUI.SelectionGrid (Rect (0, 0, 280,
40*in_items), in_toolAccess, itemsContent, 1, GUI.skin.
GetStyle("Selected Item"));
// End the scrollview we began above.
GUI.EndScrollView ();
gui_accessCon = itemsContent[in_toolAccess];
}
 
Search WWH ::




Custom Search