本文整理汇总了C#中Inventory类的典型用法代码示例。如果您正苦于以下问题:C# Inventory类的具体用法?C# Inventory怎么用?C# Inventory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Inventory类属于命名空间,在下文中一共展示了Inventory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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;
}
}
}
}
示例3: OnQueryInventorySucceeded
private void OnQueryInventorySucceeded(string json)
{
if (queryInventorySucceededEvent != null) {
Inventory inventory = new Inventory(json);
queryInventorySucceededEvent(inventory);
}
}
示例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;
}
}
}
示例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;
}
// ------------------------------------------------------------------------------------------------------
}
示例6: Start
// Use this for initialization
void Start()
{
itemImage = gameObject.GetComponent<Image> ();
defaultPosition = transform.localPosition;
myInv = transform.GetComponentInParent<Inventory> ();
//defaultPosition.z = 0
}
示例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);
}
}
示例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;
}
示例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>();
}
示例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);
}
}
示例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;
}
}
示例12: Awake
void Awake()
{
PickUpSound = gameObject.GetComponent<AudioSource> ();
PickUpSound.clip = PickUpClip;
player = GameObject.FindGameObjectWithTag ("Player");
inv = canv.GetComponent<Inventory>();
}
示例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;
}
示例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);
}
示例15: Start
void Start()
{
anim = GetComponent<Animator>();
gui = (Gui)GameObject.FindObjectOfType(typeof(Gui));
inventory = (Inventory)GameObject.FindObjectOfType(typeof(Inventory));
player = GameObject.FindGameObjectsWithTag("Player")[0];
}