本文整理汇总了C#中AC.InvItem类的典型用法代码示例。如果您正苦于以下问题:C# InvItem类的具体用法?C# InvItem怎么用?C# InvItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InvItem类属于AC命名空间,在下文中一共展示了InvItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InvItem
public InvItem (InvItem assetItem)
{
count = assetItem.count;
tex = assetItem.tex;
activeTex = assetItem.activeTex;
carryOnStart = assetItem.carryOnStart;
canCarryMultiple = assetItem.canCarryMultiple;
label = assetItem.label;
altLabel = assetItem.altLabel;
id = assetItem.id;
lineID = assetItem.lineID;
useIconID = assetItem.useIconID;
binID = assetItem.binID;
useSeparateSlots = assetItem.useSeparateSlots;
isEditing = false;
recipeSlot = -1;
useActionList = assetItem.useActionList;
lookActionList = assetItem.lookActionList;
interactions = assetItem.interactions;
combineActionList = assetItem.combineActionList;
unhandledActionList = assetItem.unhandledActionList;
unhandledCombineActionList = assetItem.unhandledCombineActionList;
combineID = assetItem.combineID;
}
示例2: HighlightItemOnInstant
/**
* <summary>Fully highlights an inventory item instantly.</summary>
* <param name = "_id">The ID number of the inventory item (see InvItem) to highlight</param>
*/
public void HighlightItemOnInstant(int _id)
{
highlightItem = GetItem (_id);
highlightState = HighlightState.None;
pulse = 1f;
}
示例3: InsertAt
/**
* <summary>Adds an inventory item to the Container's contents, at a particular index.</summary>
* <param name = "_item">The InvItem to place within the Container</param>
* <param name = "_index">The index number within the Container's current contents to insert the new item</param>
*/
public void InsertAt(InvItem _item, int _index)
{
ContainerItem newContainerItem = new ContainerItem (_item.id, GetIDArray ());
newContainerItem.count = _item.count;
if (items.Count <= _index)
{
items.Add (newContainerItem);
}
else
{
items.Insert (_index, newContainerItem);
}
}
示例4: GetPropertyDisplayValue
private string GetPropertyDisplayValue(int languageNumber, InvItem invItem)
{
if (invItem != null)
{
InvVar invVar = invItem.GetProperty (itemPropertyID);
if (invVar != null)
{
return invVar.GetDisplayValue (languageNumber);
}
}
return "";
}
示例5: DeactivateAllItems
private void DeactivateAllItems ()
{
foreach (InvItem item in items)
{
item.isEditing = false;
}
selectedItem = null;
}
示例6: CreateItemsGUI
private void CreateItemsGUI ()
{
EditorGUILayout.LabelField ("Inventory items", EditorStyles.boldLabel);
filter = EditorGUILayout.TextField ("Filter by name:", filter);
EditorGUILayout.Space ();
foreach (InvItem item in items)
{
if (filter == "" || item.label.ToLower ().Contains (filter.ToLower ()))
{
EditorGUILayout.BeginHorizontal ();
string buttonLabel = item.label;
if (buttonLabel == "")
{
buttonLabel = "(Untitled)";
}
if (GUILayout.Toggle (item.isEditing, item.id + ": " + buttonLabel, "Button"))
{
if (selectedItem != item)
{
DeactivateAllItems ();
ActivateItem (item);
}
}
if (GUILayout.Button (sideIcon, GUILayout.Width (20f), GUILayout.Height (15f)))
{
SideMenu (item);
}
EditorGUILayout.EndHorizontal ();
}
}
if (GUILayout.Button("Create new item"))
{
Undo.RecordObject (this, "Create inventory item");
ResetFilter ();
InvItem newItem = new InvItem (GetIDArray ());
items.Add (newItem);
DeactivateAllItems ();
ActivateItem (newItem);
}
}
示例7: DrawTexture
private void DrawTexture(Rect rect, InvItem _item, bool isActive)
{
if (_item == null) return;
Texture2D tex = null;
if (Application.isPlaying && KickStarter.runtimeInventory != null && inventoryBoxType != AC_InventoryBoxType.DisplaySelected)
{
if (_item == KickStarter.runtimeInventory.highlightItem && _item.activeTex != null)
{
KickStarter.runtimeInventory.DrawHighlighted (rect);
return;
}
if (_item.activeTex != null && ((isActive && KickStarter.settingsManager.activeWhenHover) || _item == KickStarter.runtimeInventory.selectedItem))
{
tex = _item.activeTex;
}
else if (_item.tex != null)
{
tex = _item.tex;
}
}
else if (_item.tex != null)
{
tex = _item.tex;
}
if (tex != null)
{
GUI.DrawTexture (rect, tex, ScaleMode.StretchToFill, true, 0f);
}
}
示例8: InvItem
public InvItem(InvItem assetItem)
{
count = assetItem.count;
tex = assetItem.tex;
activeTex = assetItem.activeTex;
carryOnStart = assetItem.carryOnStart;
carryOnStartNotDefault = assetItem.carryOnStartNotDefault;
carryOnStartID = assetItem.carryOnStartID;
canCarryMultiple = assetItem.canCarryMultiple;
label = assetItem.label;
altLabel = assetItem.altLabel;
id = assetItem.id;
lineID = assetItem.lineID;
useIconID = assetItem.useIconID;
binID = assetItem.binID;
useSeparateSlots = assetItem.useSeparateSlots;
isEditing = false;
recipeSlot = -1;
overrideUseSyntax = assetItem.overrideUseSyntax;
hotspotPrefix1 = assetItem.hotspotPrefix1;
hotspotPrefix2 = assetItem.hotspotPrefix2;
useActionList = assetItem.useActionList;
lookActionList = assetItem.lookActionList;
interactions = assetItem.interactions;
combineActionList = assetItem.combineActionList;
unhandledActionList = assetItem.unhandledActionList;
unhandledCombineActionList = assetItem.unhandledCombineActionList;
combineID = assetItem.combineID;
}
示例9: RebuildProperties
private void RebuildProperties(InvItem item)
{
// Which properties are available?
List<int> availableVarIDs = new List<int>();
foreach (InvVar invVar in invVars)
{
if (!invVar.limitToCategories || bins.Count == 0 || invVar.categoryIDs.Contains (item.binID))
{
availableVarIDs.Add (invVar.id);
}
}
// Create new properties / transfer existing values
List<InvVar> newInvVars = new List<InvVar>();
foreach (InvVar invVar in invVars)
{
if (availableVarIDs.Contains (invVar.id))
{
InvVar newInvVar = new InvVar (invVar);
InvVar oldInvVar = item.GetProperty (invVar.id);
if (oldInvVar != null)
{
newInvVar.TransferValues (oldInvVar);
}
newInvVars.Add (newInvVar);
}
}
item.vars = newInvVars;
}
示例10: ExtractInventory
private void ExtractInventory (InvItem invItem, bool onlySeekNew)
{
if (onlySeekNew && invItem.lineID == -1)
{
// Assign a new ID on creation
SpeechLine newLine;
if (invItem.altLabel != "")
{
newLine = new SpeechLine (GetIDArray(), EditorApplication.currentScene, invItem.altLabel, languages.Count - 1, AC_TextType.InventoryItem);
}
else
{
newLine = new SpeechLine (GetIDArray(), EditorApplication.currentScene, invItem.label, languages.Count - 1, AC_TextType.InventoryItem);
}
invItem.lineID = newLine.lineID;
lines.Add (newLine);
}
else if (!onlySeekNew && invItem.lineID > -1)
{
// Already has an ID, so don't replace
if (invItem.altLabel != "")
{
lines.Add (new SpeechLine (invItem.lineID, EditorApplication.currentScene, invItem.altLabel, languages.Count - 1, AC_TextType.InventoryItem));
}
else
{
lines.Add (new SpeechLine (invItem.lineID, EditorApplication.currentScene, invItem.label, languages.Count - 1, AC_TextType.InventoryItem));
}
}
}
示例11: Remove
/**
* <summary>Removes an inventory item from the player's inventory.</summary>
* <param name = "_item">The inventory item (InvItem) to remove</param>
*/
public void Remove(InvItem _item)
{
if (_item != null && localItems.Contains (_item))
{
if (_item == selectedItem)
{
SetNull ();
}
localItems [localItems.IndexOf (_item)] = null;
localItems = ReorderItems (localItems);
localItems = RemoveEmptySlots (localItems);
}
}
示例12: MoveItemToIndex
/**
* <summary>Moves an item already in an inventory to a different slot.</summary>
* <param name = "item">The inventory item to move</param>
* <param name = "items">The List of inventory items that the item is to be moved within</param>
* <param name = "index">The index number of the MenuInventoryBox slot to move the item to</param>
* <returns>The re-ordered List of inventory items</returns>
*/
public List<InvItem> MoveItemToIndex(InvItem item, List<InvItem> items, int index)
{
if (item != null)
{
if (KickStarter.settingsManager.canReorderItems)
{
// Check nothing in place already
int oldIndex = items.IndexOf (item);
while (items.Count <= Mathf.Max (index, oldIndex))
{
items.Add (null);
}
if (items [index] == null)
{
items [index] = item;
items [oldIndex] = null;
}
SetNull ();
items = RemoveEmptySlots (items);
}
else if (items.IndexOf (item) == index)
{
SetNull ();
}
}
return items;
}
示例13: Look
/**
* <summary>Runs an inventory item's "Examine" interaction.</summary>
* <param name = "item">The inventory item to examine</param>
*/
public void Look(InvItem item)
{
if (item == null || item.recipeSlot > -1) return;
if (item.lookActionList)
{
AdvGame.RunActionListAsset (item.lookActionList);
}
}
示例14: RemoveRecipes
/**
* Resets any active recipe, and clears all MenuCrafting elements.
*/
/*
public void RemoveRecipes ()
{
while (craftingItems.Count > 0)
{
for (int i=0; i<craftingItems.Count; i++)
{
Add (craftingItems[i].id, craftingItems[i].count, false, -1);
craftingItems.RemoveAt (i);
}
}
PlayerMenus.ResetInventoryBoxes ();
}*/
/**
* <summary>Moves an ingredient from a crafting recipe back into the player's inventory.</summary>
* <param name = "_recipeSlot">The index number of the MenuCrafting slot that the ingredient was placed in</param>
* <param name = "selectAfter">If True, the inventory item will be selected once the transfer is complete</param>
*/
/*
public void TransferCraftingToLocal (int _recipeSlot, bool selectAfter)
{
foreach (InvItem item in craftingItems)
{
if (item.recipeSlot == _recipeSlot)
{
Add (item.id, item.count, selectAfter, -1);
SelectItemByID (item.id, SelectItemMode.Use);
craftingItems.Remove (item);
return;
}
}
}*/
/**
* <summary>Moves an ingredient from the player's inventory into a crafting recipe as an ingredient.</summary>
* <param name = "_item">The inventory item to transfer</param>
* <param name = "_slot">The index number of the MenuCrafting slot to place the item in</param>
*/
/*
public void TransferLocalToCrafting (InvItem _item, int _slot)
{
if (_item != null && localItems.Contains (_item))
{
_item.recipeSlot = _slot;
craftingItems.Add (_item);
localItems [localItems.IndexOf (_item)] = null;
localItems = ReorderItems (localItems);
localItems = RemoveEmptySlots (localItems);
SetNull ();
}
}*/
/**
* <summary>Gets a list of inventory items associated with the interactions of the current Hotspot or item being hovered over.</summary>
* <returns>A list of inventory items associated with the interactions of the current Hotspot or item being hovered over</returns>
*/
/*
public List<InvItem> MatchInteractions ()
{
List<InvItem> items = new List<InvItem>();
matchingInvInteractions = new List<int>();
if (!KickStarter.settingsManager.cycleInventoryCursors)
{
return items;
}
if (hoverItem != null)
{
items = MatchInteractionsFromItem (items, hoverItem);
}
else if (KickStarter.playerInteraction.GetActiveHotspot ())
{
List<Button> invButtons = KickStarter.playerInteraction.GetActiveHotspot ().invButtons;
foreach (Button button in invButtons)
{
foreach (InvItem item in localItems)
{
if (item != null && item.id == button.invID && !button.isDisabled)
{
matchingInvInteractions.Add (invButtons.IndexOf (button));
items.Add (item);
break;
}
}
}
}
return items;
}*/
private List<InvItem> MatchInteractionsFromItem(List<InvItem> items, InvItem _item)
{
if (_item != null && _item.combineID != null)
{
foreach (int combineID in _item.combineID)
{
foreach (InvItem item in localItems)
{
//.........这里部分代码省略.........
示例15: DoesHaveInventoryInteraction
public bool DoesHaveInventoryInteraction(InvItem invItem)
{
if (invItem != null)
{
foreach (int invID in combineID)
{
if (invID == invItem.id)
{
return true;
}
}
}
return false;
}