public static void ItemPickUp(ItemDefinition def, int amount, string nameOverride) { if (SingletonComponent <NoticeArea> .Instance == null) { return; } GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>((amount > 0 ? SingletonComponent <NoticeArea> .Instance.itemPickupPrefab : SingletonComponent <NoticeArea> .Instance.itemDroppedPrefab)); if (gameObject == null) { return; } gameObject.transform.SetParent(SingletonComponent <NoticeArea> .Instance.transform, false); ItemPickupNotice component = gameObject.GetComponent <ItemPickupNotice>(); if (component == null) { return; } component.itemInfo = def; component.amount = amount; if (!string.IsNullOrEmpty(nameOverride)) { component.Text.text = nameOverride; } }
public static void ItemPickUp(ItemDefinition def, int amount, string nameOverride) { if (Object.op_Equality((Object)SingletonComponent <NoticeArea> .Instance, (Object)null)) { return; } GameObject gameObject = (GameObject)Object.Instantiate <GameObject>(amount > 0 ? (M0)((NoticeArea)SingletonComponent <NoticeArea> .Instance).itemPickupPrefab : (M0)((NoticeArea)SingletonComponent <NoticeArea> .Instance).itemDroppedPrefab); if (Object.op_Equality((Object)gameObject, (Object)null)) { return; } gameObject.get_transform().SetParent(((Component)SingletonComponent <NoticeArea> .Instance).get_transform(), false); ItemPickupNotice component = (ItemPickupNotice)gameObject.GetComponent <ItemPickupNotice>(); if (Object.op_Equality((Object)component, (Object)null)) { return; } component.itemInfo = def; component.amount = amount; if (string.IsNullOrEmpty(nameOverride)) { return; } component.Text.set_text(nameOverride); }