private void FinishTrigger(GachaTrigger trigger, NPNFError error) { if (trigger != null) { trigger.FinishTriggeredAction(this, trigger, error); } }
private void TriggerHandler(GachaTrigger trigger) { if (User.IsCurrentProfileExist()) { GachaTrigger gachaTrigger = (GachaTrigger)trigger; Play(gachaTrigger.priceName, gachaTrigger.purchaseCount, gachaTrigger); } }
private void Play(string priceName, int purchaseCount, GachaTrigger trigger) { if (!IsInitialized) { NPNFError error = NPNFError.GetGameError(NPNFError.GameCode.GACHA_NOT_INITIALIZED); if (OnPlayError != null) { OnPlayError(this, trigger, error); } FinishTrigger(trigger, error); return; } User.CurrentProfile.Gacha.Play(Name, priceName, purchaseCount, (FormulaResult result, NPNFError error) => { if (error == null) { List <Entitlement> entitlements = new List <Entitlement>(); foreach (var entitlement in result.AddedEntitlements) { entitlements.Add(User.CurrentProfile.Entitlements.GetCached(entitlement.Id)); } if (OnPlayDone != null) { OnPlayDone(this, trigger, entitlements); } } else { if (OnPlayError != null) { OnPlayError(this, trigger, error); } } FinishTrigger(trigger, error); }); }
protected abstract void PlayErrorHandler(Gacha gacha, GachaTrigger trigger, NPNFError error);
protected abstract void PlayDoneHandler(Gacha gacha, GachaTrigger trigger, List <Entitlement> results);