UiShopHatItem
The UiShopHatItem class extends UiShopItem to handle hat-type shop items. It adds equip functionality, social media unlock flows (Twitter follow + Facebook like for HatHorns), and a "Coming Soon" placeholder state.
UiShopHatItem private
Extends UiShopItem.
Properties
Inherits all properties from UiShopItem.
Methods
constructor()
ts
function constructor(ui: Ui, itemId: string): voidCalls the parent constructor and registers a listener for the equippedHat event to trigger updates.
update()
ts
function update(): voidOverrides the parent update(). Handles three rendering states:
- Owned: Shows the hat name and an Equip/Equipped button.
- Social unlock (
HatHorns): Shows Twitter Follow and Facebook Like buttons, checking completion states viaMenuShop. - Coming Soon (
HatComingSoon): Shows a disabled placeholder with the schema description. - Default: Shows name, "Hat" tier label, and gold/token cost.
onClick()
ts
function onClick(event: MouseEvent): voidOverrides parent. Emits purchaseItem only if not disabled, on cooldown, owned, or in social-unlock state.
onEquipItem()
ts
function onEquipItem(event: MouseEvent): voidEmits equipItem with the item ID and current tier.
onTwitterFollow()
ts
function onTwitterFollow(event: MouseEvent): voidDisables the Twitter button and emits the twitterFollow event.
onFacebookLike()
ts
function onFacebookLike(event: MouseEvent): voidDisables the Facebook button and emits the facebookLike event.