Exemplo n.º 1
0
 public void SubscribeToCurrencyChange(CurrencyType type, m.MonoActionInt callback, bool invokeOnSubscribe)
 {
     SubscribeToCurrencyChange(type, callback);
     if (invokeOnSubscribe)
     {
         callback(currencies[type].Amount);
     }
 }
Exemplo n.º 2
0
 public void UnsubscribeFromCurrencyChange(CurrencyType type, m.MonoActionInt callback)
 {
     m.MonoActionInt handler = getCurrencyChangeEventDelegate(type);
     if (handler != null)
     {
         handler -= callback;
         updateCurrencyChangeHandler(type, handler);
     }
 }
Exemplo n.º 3
0
 // Overloaded version if you want to override the currency amount:
 bool tryCallCurrencyChangeEvent(CurrencyType type, int amount)
 {
     m.MonoActionInt currencyChangeCallback = getCurrencyChangeEventDelegate(type);
     if (currencyChangeCallback != null)
     {
         currencyChangeCallback(amount);
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 4
0
 void updateCurrencyChangeHandler(CurrencyType type, m.MonoActionInt handler)
 {
     currencyChangeCallbacks[type] = handler;
 }
Exemplo n.º 5
0
 public void SubscribeToCurrencyChange(CurrencyType type, m.MonoActionInt callback)
 {
     m.MonoActionInt handler = getCurrencyChangeEventDelegate(type);
     handler += callback;
     updateCurrencyChangeHandler(type, handler);
 }