示例#1
0
 public void SubscribeToCurrencyChange(CurrencyType type, m.MonoActionInt callback, bool invokeOnSubscribe)
 {
     SubscribeToCurrencyChange(type, callback);
     if (invokeOnSubscribe)
     {
         callback(currencies[type].Amount);
     }
 }
示例#2
0
 public void UnsubscribeFromCurrencyChange(CurrencyType type, m.MonoActionInt callback)
 {
     m.MonoActionInt handler = getCurrencyChangeEventDelegate(type);
     if (handler != null)
     {
         handler -= callback;
         updateCurrencyChangeHandler(type, handler);
     }
 }
示例#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);
     }
 }
示例#4
0
 void updateCurrencyChangeHandler(CurrencyType type, m.MonoActionInt handler)
 {
     currencyChangeCallbacks[type] = handler;
 }
示例#5
0
 public void SubscribeToCurrencyChange(CurrencyType type, m.MonoActionInt callback)
 {
     m.MonoActionInt handler = getCurrencyChangeEventDelegate(type);
     handler += callback;
     updateCurrencyChangeHandler(type, handler);
 }