public void Activate() { if (!enabled) { return; } switch (contentType) { case ButtonContentType.Spell when balance.SpellInfosById.ContainsKey(itemId): input.CastSpell(itemId); break; case ButtonContentType.Empty: break; default: throw new ArgumentOutOfRangeException(nameof(contentType), $"Unknown button content type: {contentType}"); } }
private void UpdateContent() { switch (contentType) { case ButtonContentType.Spell when balance.SpellInfosById.ContainsKey(itemId): spellInfo = balance.SpellInfosById[itemId]; ContentImage.sprite = rendering.SpellVisualSettingsById.ContainsKey(itemId) ? rendering.SpellVisualSettingsById[itemId].SpellIcon : rendering.DefaultSpellIcon; break; case ButtonContentType.Spell: case ButtonContentType.Empty: Remove(); break; default: throw new ArgumentOutOfRangeException(nameof(contentType), $"Unknown button content: {contentType} with id: {itemId}"); } }