本文整理汇总了C#中ItemData.GetId方法的典型用法代码示例。如果您正苦于以下问题:C# ItemData.GetId方法的具体用法?C# ItemData.GetId怎么用?C# ItemData.GetId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemData
的用法示例。
在下文中一共展示了ItemData.GetId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnGUI
void OnGUI()
{
GUIContent titleContent = new GUIContent("Crab Databases");
if (GUILayout.Button((showFactions ? "↖ " : "↓ ") + "Factions", EditorStyles.boldLabel)) {
showFactions = !showFactions;
}
if (showFactions) {
}
if (GUILayout.Button((showItems ? "↖ " : "↓ ") + "Items", EditorStyles.boldLabel)) {
showItems = !showItems;
if (showItems) UpdateItems();
}
if (showItems) {
int newIndex = EditorGUILayout.Popup(itemIndex, itemNames);
if (newIndex != itemIndex) {
if (newIndex != 0) {
SelectItem(newIndex);
} else {
item = null;
itemName = "New Item";
itemMesh = null;
}
}
itemIndex = newIndex;
EditorGUI.indentLevel++;
itemName = EditorGUILayout.TextField(itemName);
itemMesh = EditorGUILayout.ObjectField(itemMesh, typeof(GameObject)) as GameObject;
/*
if (GUILayout.Button((showItemsAdvanced ? " ↖ " : " ↓ ") + "Advanced", EditorStyles.label))
{
showItemsAdvanced = !showItemsAdvanced;
}
if (showItemsAdvanced)
{
EditorGUI.indentLevel++;
//itemClass = EditorGUILayout.ObjectField(itemClass, typeof(ItemData)) as ItemData;
EditorGUI.indentLevel--;
}*/
if (GUILayout.Button(CreatingNewItem() ? "Create" : "Save", EditorStyles.miniButton)) {
if (CreatingNewItem()) {
item = new ItemData();
GetDB().db.Add(item);
itemIndex = item.GetId()+1;
}
item.name = itemName;
item.mesh = itemMesh;
if (!CreatingNewItem()) {
GetDB().db[itemIndex - 1] = item;
}
UpdateItems();
}
if (!CreatingNewItem() && GUILayout.Button("Remove", EditorStyles.miniButton)) {
GetDB().db.Remove(item);
UpdateItems();
SelectItem(itemIndex-1);
}
EditorGUI.indentLevel--;
}
}