本文整理汇总了C#中Inventory类的典型用法代码示例。如果您正苦于以下问题:C# Inventory类的具体用法?C# Inventory怎么用?C# Inventory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Inventory类属于命名空间,在下文中一共展示了Inventory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: invoke
public override void invoke(Inventory invoker) {
audioSource.Play();
foreach (AbstractPowerSource source in AbstractPowerSource.powerSources) {
if (Vector3.Distance(invoker.transform.position, source.transform.position) < range)
source.disable(disableTime);
}
}
开发者ID:viviannimue,项目名称:OpenCircuit,代码行数:7,代码来源:PocketEMP.cs
示例2: Start
void Start()
{
GameObject goItemManager = GameObject.FindGameObjectsWithTag("GameManager").FirstOrDefault( (go) => go.name == "Item Manager" );
if( null == goItemManager )
Debug.LogError( "Failed to find Item Manager game object");
else
m_Inventory = new Inventory( goItemManager.GetComponent<InventoryManager>() );
m_Path = GetComponent<AIPath>();
m_Seeker = GetComponent<Seeker>();
// Find the start locator and set our position/orientation
if( !string.IsNullOrEmpty( m_StartLocatorName ) )
{
GameObject[] locators = GameObject.FindGameObjectsWithTag( "Locator" );
if( locators.Length > 0 )
{
GameObject startLocator = locators.FirstOrDefault( (i) => { return i.name == m_StartLocatorName; } );
if( null != startLocator )
{
transform.position = startLocator.transform.position;
transform.rotation = startLocator.transform.rotation;
}
}
}
}
开发者ID:predominant,项目名称:Treasure_Chest,代码行数:27,代码来源:Player.cs
示例3: OnQueryInventorySucceeded
private void OnQueryInventorySucceeded(string json)
{
if (queryInventorySucceededEvent != null) {
Inventory inventory = new Inventory(json);
queryInventorySucceededEvent(inventory);
}
}
开发者ID:noqno,项目名称:open-iab-unity,代码行数:7,代码来源:OpenIABEventManager.cs
示例4: InitFromInventory
/// <summary>
/// Reset and initialize the entire view based on the given Inventory.</summary>
public void InitFromInventory(Inventory inventory)
{
foreach (KeyValuePair<InventoryItem, InventoryViewItem> entry in _items)
{
Destroy(entry.Value.gameObject);
}
_items.Clear();
_numberOfSlots = inventory._items.Count;
ResetSlots();
int currentActionSlot = 0;
for (int i=0; i < inventory._items.Count; i++)
{
var invItem = AddItem(inventory._items[i], inventory._quantities[i]);
// Update the weapon Slot
if (inventory._items[i] == Player._player.Stats._equippedWeapon)
{
_weaponSlot.Swap(invItem);
}
if (Player._player.Stats._equippedItems.Contains(inventory._items[i]))
{
PlayerMenu._playerMenu._actionSlots[currentActionSlot]._allowsDrag = true;
PlayerMenu._playerMenu._actionSlots[currentActionSlot].Swap(invItem);
PlayerMenu._playerMenu._actionSlots[currentActionSlot]._allowsDrag = false;
currentActionSlot += 1;
}
}
}
开发者ID:PaulSchweizer,项目名称:GameDev,代码行数:29,代码来源:InventoryView.cs
示例5: OnTradeAddItem
public override void OnTradeAddItem(Schema.Item schemaItem, Inventory.Item inventoryItem)
{
// USELESS DEBUG MESSAGES -------------------------------------------------------------------------------
SendTradeMessage("Object AppID: {0}", inventoryItem.AppId);
SendTradeMessage("Object ContextId: {0}", inventoryItem.ContextId);
switch (inventoryItem.AppId)
{
case 440:
SendTradeMessage("TF2 Item Added.");
SendTradeMessage("Name: {0}", schemaItem.Name);
SendTradeMessage("Quality: {0}", inventoryItem.Quality);
SendTradeMessage("Level: {0}", inventoryItem.Level);
SendTradeMessage("Craftable: {0}", (inventoryItem.IsNotCraftable ? "No" : "Yes"));
break;
case 753:
GenericInventory.ItemDescription tmpDescription = OtherSteamInventory.getDescription(inventoryItem.Id);
SendTradeMessage("Steam Inventory Item Added.");
SendTradeMessage("Type: {0}", tmpDescription.type);
SendTradeMessage("Marketable: {0}", (tmpDescription.marketable ? "Yes" : "No"));
break;
default:
SendTradeMessage("Unknown item");
break;
}
// ------------------------------------------------------------------------------------------------------
}
开发者ID:Timboy67678,项目名称:SteamBot,代码行数:29,代码来源:SteamTradeDemoHandler.cs
示例6: Start
// Use this for initialization
void Start()
{
itemImage = gameObject.GetComponent<Image> ();
defaultPosition = transform.localPosition;
myInv = transform.GetComponentInParent<Inventory> ();
//defaultPosition.z = 0
}
开发者ID:t-conti,项目名称:Turn-Based-God,代码行数:8,代码来源:SlotScript.cs
示例7: LocalObject
public LocalObject(LocalShape localShape, string _uniqueName = "", Inventory _inventory = null)
{
uniqueName = _uniqueName;
shape = new ShapeComponent(localShape, this);
if (localShape.type == LocalType.Get("Destructible") || localShape.type == LocalType.Get("Container"))
{
hp = new HPComponent(this);
}
else if (localShape.type == LocalType.Get("Creature"))
{
hp = new HPComponent(this);
movement = new Movement(this);
defence = new Defence(this);
attack = new Attack(this);
abilities = new Abilities(this);
fatigue = new Fatigue(this);
eating = new Eating(this);
}
if (_inventory != null)
{
inventory = new Inventory(6, 1, "", false, null, this);
_inventory.CopyTo(inventory);
}
}
开发者ID:mxgmn,项目名称:GENW,代码行数:26,代码来源:LocalObject.cs
示例8: Awake
void Awake(){
gameObject.name = gameObject.name.Replace("(Clone)", "");
Player = GameObject.FindWithTag("Player").transform;
hcs = Player.GetComponent<HeroControllerScript>();
inv = Player.GetComponent<Inventory>();
ItemObject = Resources.Load(gameObject.name) as GameObject;
}
开发者ID:Vasj0001,项目名称:Game,代码行数:7,代码来源:Items.cs
示例9: DecorationInventory
public DecorationInventory(Inventory inventory)
{
this.inventory = inventory;
this.pockets = new Dictionary<DecorationTypes, DecorationPocket>();
this.secretBaseDecorations = new List<PlacedDecoration>();
this.bedroomDecorations = new List<PlacedDecoration>();
}
开发者ID:trigger-death,项目名称:TriggersPC,代码行数:7,代码来源:DecorationInventory.cs
示例10: GetToolTip
public override string GetToolTip (Inventory inv) {
string stats = string.Empty;
if (Health > 0) {
stats += "\nRestores " + Health.ToString() + " health";
}
if (Mana > 0)
{
stats += "\nRestores " + Mana.ToString() + " energy";
}
if (Rage > 0)
{
stats += "\nRestores " + Rage.ToString() + " rage";
}
string itemTip = base.GetToolTip(inv);
if (inv is VendorInventory) {
return string.Format("{0}" + "<size=20>{1}\n<color=yellow>Buy Price: {2} Crumbs</color></size>", itemTip, stats, BuyPrice);
}
else if (VendorInventory.Instance.IsOpen) {
return string.Format("{0}" + "<size=20>{1}\n<color=yellow>Sell Price: {2} Crumbs</color></size>", itemTip, stats, SellPrice);
}
else {
return string.Format("{0}" + "<size=20>{1}</size>", itemTip, stats);
}
}
开发者ID:Fahrettin52,项目名称:Game-Lab-1.1,代码行数:28,代码来源:Consumable.cs
示例11: Update
void Update()
{
if (itemId == -1)
return;
//如果快捷栏有物品,则刷新物品状态
if (inventory == null)
{
UnityEngine.GameObject canvas = UnityEngine.GameObject.FindGameObjectWithTag("Canvas");
inventory = canvas.transform.Find("Panel - Inventory(Clone)").GetComponent<Inventory>();
}
if (inventory == null)
return;
//物品已使用完或者消失
UnityEngine.GameObject itemobject = inventory.getItemGameObject(itemId);
if (itemobject == null)
{
this.itemId = -1;
this.gameObject.SetActive(false);
return;
}
image_icon.sprite = itemobject.GetComponent<ItemOnObject>().item.itemIcon;
text.rectTransform.localPosition = itemobject.transform.GetChild(1).GetComponent<Text>().transform.localPosition;
text.enabled = true;
text.text = itemobject.transform.GetChild(1).GetComponent<Text>().text;
if (ConsumeLimitCD.instance.isWaiting())
{
image_cool.fillAmount = ConsumeLimitCD.instance.restTime / ConsumeLimitCD.instance.totalTime;
}
else
{
image_cool.fillAmount = 0;
}
}
开发者ID:liuxq,项目名称:TestGame,代码行数:34,代码来源:HotBarProcess.cs
示例12: Awake
void Awake()
{
PickUpSound = gameObject.GetComponent<AudioSource> ();
PickUpSound.clip = PickUpClip;
player = GameObject.FindGameObjectWithTag ("Player");
inv = canv.GetComponent<Inventory>();
}
开发者ID:sea1and,项目名称:SurvivalGame,代码行数:7,代码来源:PickUpManager.cs
示例13: GetCurrentInfo
public StatsExport GetCurrentInfo(Inventory inventory)
{
var stats = inventory.GetPlayerStats().Result;
StatsExport output = null;
var stat = stats.FirstOrDefault();
if (stat != null)
{
var ep = stat.NextLevelXp - stat.PrevLevelXp - (stat.Experience - stat.PrevLevelXp);
var time = Math.Round(ep/(TotalExperience/GetRuntime()), 2);
var hours = 0.00;
var minutes = 0.00;
if (double.IsInfinity(time) == false && time > 0)
{
time = Convert.ToDouble(TimeSpan.FromHours(time).ToString("h\\.mm"), CultureInfo.InvariantCulture);
hours = Math.Truncate(time);
minutes = Math.Round((time - hours)*100);
}
output = new StatsExport
{
Level = stat.Level,
HoursUntilLvl = hours,
MinutesUntilLevel = minutes,
CurrentXp = stat.Experience - stat.PrevLevelXp - GetXpDiff(stat.Level),
LevelupXp = stat.NextLevelXp - stat.PrevLevelXp - GetXpDiff(stat.Level),
};
}
return output;
}
开发者ID:CapSnake,项目名称:NecroBot,代码行数:29,代码来源:Statistics.cs
示例14: Reset
public void Reset(ISettings settings, ILogicSettings logicSettings)
{
Client = new Client(Settings) {AuthType = settings.AuthType};
// ferox wants us to set this manually
Inventory = new Inventory(Client, logicSettings);
Navigation = new Navigation(Client);
}
开发者ID:CalebD44,项目名称:NecroBot,代码行数:7,代码来源:Session.cs
示例15: Start
void Start()
{
anim = GetComponent<Animator>();
gui = (Gui)GameObject.FindObjectOfType(typeof(Gui));
inventory = (Inventory)GameObject.FindObjectOfType(typeof(Inventory));
player = GameObject.FindGameObjectsWithTag("Player")[0];
}
开发者ID:VictorVaxb,项目名称:SurvivalCurse,代码行数:7,代码来源:Enemy2.cs
示例16: OnPointerDown
public void OnPointerDown(PointerEventData data)
{
inv = transform.parent.parent.parent.GetComponent<Inventory>();
if (transform.parent.parent.parent.GetComponent<Hotbar>() == null && data.button == PointerEventData.InputButton.Left && pressingButtonToSplit && inv.stackable && (inv.ItemsInInventory.Count < (inv.height * inv.width)))
{
ItemOnObject itemOnObject = GetComponent<ItemOnObject>();
if (itemOnObject.item.itemValue > 1)
{
int splitPart = itemOnObject.item.itemValue;
itemOnObject.item.itemValue = (int)itemOnObject.item.itemValue / 2;
splitPart = splitPart - itemOnObject.item.itemValue;
inv.addItemToInventory(itemOnObject.item.itemID, splitPart);
inv.stackableSettings();
if (GetComponent<ConsumeItem>().duplication != null)
{
GameObject dup = GetComponent<ConsumeItem>().duplication;
dup.GetComponent<ItemOnObject>().item.itemValue = itemOnObject.item.itemValue;
dup.GetComponent<SplitItem>().inv.stackableSettings();
}
inv.updateItemList();
}
}
}
开发者ID:MadBanny,项目名称:planet-survival,代码行数:27,代码来源:SplitItem.cs
示例17: btnSave_Click
protected void btnSave_Click(object sender, EventArgs e)
{
med = new Inventory();
if (txtMedicineId.Text == "" || txtMedicineId.Text == null)
{
Response.Write("<script> window.alert('Please Select a Medicine to Edit before Saving.')</script>");
}
else
{
if (txtMedicineName.Text == "" || txtMedicineName.Text == null)
{
Response.Write("<script> window.alert('Medicine Field Should not be Empty.')</script>");
}
else
{
if (txtQuantity.Text == "" || txtQuantity.Text == null)
{
Response.Write("<script> window.alert('Quantity Field Should not be Empty.')</script>");
}
else
{
bool checker = med.UpdateMedicine(Convert.ToInt32(txtMedicineId.Text.Trim()), txtMedicineName.Text.Trim(),
ddlCategory.Text.Trim(), Convert.ToInt32(txtQuantity.Text.Trim()));
if (checker == true)
Response.Write("<script> window.alert('Updated Medicine Successful.')</script>");
else
Response.Write("<script> window.alert('Updating is Unsuccessful.')</script>");
gridViewMedicine.DataBind();
}
}
}
}
开发者ID:abdojobs,项目名称:paombonghealthcare,代码行数:34,代码来源:EditMedicine.aspx.cs
示例18: GetToolTip
public virtual string GetToolTip (Inventory inv) {
//string stats = string.Empty;
string color = string.Empty;
string newLine = string.Empty;
if (Description != string.Empty) {
newLine = "\n";
}
switch (Quality) {
case Quality.COMMON:
color = "white";
break;
case Quality.UNCOMMON:
color = "lime";
break;
case Quality.RARE:
color = "navy";
break;
case Quality.EPIC:
color = "magenta";
break;
case Quality.LEGENDARY:
color = "red";
break;
}
return string.Format("<color=" + color + "><size=40>{0}</size></color><size=25><i><color=lime>" + newLine + "{1}</color></i>\n{2}</size>", ItemName,Description, ItemType.ToString().ToLower());
}
开发者ID:Fahrettin52,项目名称:Game-Lab-1.1,代码行数:29,代码来源:Item.cs
示例19: Start
/**
* The Start method is called automatically by Monobehaviours,
* essentially becoming the constructor of the class.
* <p>
* See <a href="http://docs.unity3d.com/ScriptReference/MonoBehaviour.Start.html">docs.unity3d.com</a> for more information.
*/
private void Start() {
inventory = this.transform.parent.parent.GetComponentInParent<Inventory>();
amountText = this.transform.FindChild("Item Amount").GetComponent<Text>();
tooltip = this.transform.FindChild("Item Tooltip").gameObject;
tooltip.SetActive(false);
BuildTooltipText();
}
开发者ID:Icohedron,项目名称:Tremaze,代码行数:13,代码来源:ItemData.cs
示例20: Start
// Use this for initialization
void Start()
{
inventory = GameObject.FindGameObjectWithTag("Inventory");
info = GameObject.FindGameObjectWithTag("InfoPanel").GetComponent<InfoPanel>();
inv = inventory.GetComponent<Inventory>();
inventory.SetActive(false);
}
开发者ID:miojow,项目名称:AwaysWatching,代码行数:8,代码来源:GameOptions.cs
注:本文中的Inventory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论