示例#1
0
 protected void FinishTrigger(CurrencyTrigger trigger, NPNFError error)
 {
     if (trigger != null)
     {
         trigger.FinishTriggeredAction(this, trigger, error);
     }
 }
示例#2
0
        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);
        }
示例#3
0
 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);
     }
 }
示例#4
0
 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);
     });
 }
示例#5
0
 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);
     });
 }
示例#6
0
 protected abstract void ConvertErrorHandler(Currency currency, CurrencyTrigger trigger, NPNFError error);