public virtual void Init() { if (this._item == null) { if (this._itemId <= 0) { if (Application.isPlaying && this._itemId != -1) { if (base.GetComponents <InventoryItemView>().Any((InventoryItemView iiv) => iiv._itemId > 0)) { Debug.Log("InventoryItemView duplicate component : " + base.name); UnityEngine.Object.Destroy(this); } else { Debug.Log("Destroying broken InventoryItemView GO : " + base.name); UnityEngine.Object.Destroy(base.gameObject, 0.5f); } } return; } this._item = ItemDatabase.ItemById(this._itemId); Renderer component = base.gameObject.GetComponent <Renderer>(); if (component && component.enabled && !base.GetComponent <VirtualCursorSnapNode>()) { VirtualCursorSnapNode virtualCursorSnapNode = base.gameObject.AddComponent <VirtualCursorSnapNode>(); virtualCursorSnapNode._layer = LocalPlayer.Inventory._craftingCog.GetComponent <VirtualCursorSnapNode>()._layer; virtualCursorSnapNode.enabled = false; virtualCursorSnapNode.enabled = true; virtualCursorSnapNode.Refresh(); } this._canEquipFromCraft = this._item.MatchType(Item.Types.Equipment); } }
public virtual void Init() { if (this._itemId > 0) { this._item = ItemDatabase.ItemById(this._itemId); Renderer component = base.gameObject.GetComponent <Renderer>(); if (component && component.enabled && !base.GetComponent <VirtualCursorSnapNode>()) { VirtualCursorSnapNode virtualCursorSnapNode = base.gameObject.AddComponent <VirtualCursorSnapNode>(); virtualCursorSnapNode._layer = LocalPlayer.Inventory._craftingCog.GetComponent <VirtualCursorSnapNode>()._layer; virtualCursorSnapNode.enabled = false; virtualCursorSnapNode.enabled = true; virtualCursorSnapNode.Refresh(); } this._canEquipFromCraft = this._item.MatchType(Item.Types.Equipment); return; } Debug.Log("InventoryItemView not setup : " + base.name); if (Application.isPlaying) { UnityEngine.Object.Destroy(base.gameObject, 0.5f); } }