protected void FinishTrigger(CurrencyTrigger trigger, NPNFError error)
 {
     if (trigger != null)
     {
         trigger.FinishTriggeredAction(this, trigger, error);
     }
 }
        private void HandleUninitializedCurrency(CurrencyTrigger trigger, Action <Currency, CurrencyTrigger, NPNFError> callback)
        {
            NPNFError error = NPNFError.GetGameError(NPNFError.GameCode.CURRENCY_NOT_INITIALIZED);

            if (callback != null)
            {
                callback(this, trigger, error);
            }
            FinishTrigger(trigger, error);
        }
 private void TriggerHandler(CurrencyTrigger trigger)
 {
     if (trigger.action == NPNF.Game.CurrencyTrigger.UserAction.Debit)
     {
         Debit(trigger.amount, trigger);
     }
     else if (trigger.action == NPNF.Game.CurrencyTrigger.UserAction.Credit)
     {
         Credit(trigger.amount, trigger);
     }
 }
 private void Convert(int multiplier, ExchangeRule rule, CurrencyTrigger trigger)
 {
     if (!IsInitialized)
     {
         HandleUninitializedCurrency(trigger, OnConvertError);
         return;
     }
     Model.Convert(currencyName, multiplier, rule.Name, (Dictionary <string, BankReceipt> receipts, NPNFError error) => {
         if (error != null && OnConvertError != null)
         {
             OnConvertError(this, trigger, error);
         }
         FinishTrigger(trigger, error);
     });
 }
 private void Credit(int amount, CurrencyTrigger trigger)
 {
     if (!IsInitialized)
     {
         HandleUninitializedCurrency(trigger, OnCreditError);
         return;
     }
     Model.Credit(currencyName, amount, (BankReceipt receipt, NPNFError error) => {
         if (error != null && OnCreditError != null)
         {
             OnCreditError(this, trigger, error);
         }
         FinishTrigger(trigger, error);
     });
 }
Exemple #6
0
 protected abstract void ConvertErrorHandler(Currency currency, CurrencyTrigger trigger, NPNFError error);