private void OnDestroy() { ConsumableInventoryData component = Service.Get <CPDataEntityCollection>().GetComponent <ConsumableInventoryData>(Service.Get <CPDataEntityCollection>().LocalPlayerHandle); if (component != null) { component.OnConsumableInventoryChanged -= onInventoryChanged; } }
private void removePurchaseListeners() { Service.Get <EventDispatcher>().RemoveListener <ConsumableServiceErrors.NotEnoughCoins>(onNotEnoughCoinsPurchaseError); Service.Get <EventDispatcher>().RemoveListener <ConsumableServiceErrors.Unknown>(onUnkownPurchaseError); ConsumableInventoryData component = Service.Get <CPDataEntityCollection>().GetComponent <ConsumableInventoryData>(Service.Get <CPDataEntityCollection>().LocalPlayerHandle); if (component != null) { component.OnConsumableInventoryChanged -= onInventoryChanged; } }