public override void Initialize() { base.Initialize(); if (!equipmentSlots.TryGetSlot(ItemSubType.Weapon, out _weaponSlot)) { throw new Exception($"Not found {ItemSubType.Weapon} slot in {equipmentSlots}"); } if (!equipmentSlots.TryGetSlot(ItemSubType.Armor, out _armorSlot)) { throw new Exception($"Not found {ItemSubType.Armor} slot in {equipmentSlots}"); } inventory.SharedModel.State .Subscribe(inventoryState => { switch (inventoryState) { case ItemType.Consumable: break; case ItemType.Costume: costumeSlots.gameObject.SetActive(true); equipmentSlots.gameObject.SetActive(false); break; case ItemType.Equipment: costumeSlots.gameObject.SetActive(false); equipmentSlots.gameObject.SetActive(true); break; case ItemType.Material: break; default: throw new ArgumentOutOfRangeException(nameof(inventoryState), inventoryState, null); } }) .AddTo(gameObject); inventory.SharedModel.SelectedItemView .Subscribe(ShowTooltip) .AddTo(gameObject); inventory.OnDoubleClickItemView .Subscribe(itemView => { if (itemView is null || itemView.Model is null || itemView.Model.Dimmed.Value) { return; } Equip(itemView.Model); }) .AddTo(gameObject); inventory.OnResetItems.Subscribe(SubscribeInventoryResetItems).AddTo(gameObject); foreach (var slot in equipmentSlots) { slot.ShowUnlockTooltip = true; } foreach (var slot in costumeSlots) { slot.ShowUnlockTooltip = true; } }