Casual Game Template
Documentation
Overview
Casual Game Template provides a portrait casual game's progression, rewards, currencies, boosters, Shop, Daily Rewards, Missions, Chest, ads, purchases, analytics and consent. Runtime services connect these systems to a gameplay mechanic; the Settings window edits their configuration and checks it before a build. The demo supplies Win/Lose controls so the shell can be exercised before a game mechanic is implemented.
The product's source folder, namespaces and Editor menus retain the name CasualGameCore. Shared Core services ship with the package; their APIs are outside this reference. See the integration guide, third-party notices and AI-use record.
Environment and dependencies
The minimum supported Unity version is 6000.6.0f1. The verified baseline uses that Editor with URP 17.6.0. Other render pipelines have no established acceptance in this package.
| Required package | Tested version | Use |
|---|---|---|
com.unity.render-pipelines.universal |
17.6.0 | Demo rendering |
com.unity.ugui |
2.6.0 | Canvas UI and TextMesh Pro |
com.unity.inputsystem |
1.20.0 | Demo and UI input |
com.unity.nuget.newtonsoft-json |
3.2.2 | Shared save serialization |
com.unity.modules.unitywebrequest |
1.0.0 | HTTP clock requests |
Import TMP Essential Resources separately. The checked archive includes the product's adapters but excludes the LevelPlay, Unity IAP, GameAnalytics, Zenject and VContainer SDK implementations. Install optional SDKs separately when using their integrations. The tested source SDK versions are LevelPlay 9.3.2, Unity IAP 5.4.4 and GameAnalytics 8.3.1; these versions establish local integration coverage, not acceptance of live ads, purchases or analytics delivery.
In Settings → Ads or Analytics, selecting the bundled provider while its factory is absent shows Download LevelPlay SDK or Download GameAnalytics SDK below Provider. The button opens the vendor's official download/installation page in a browser. Install the compatible SDK separately, let Unity recompile, then reopen the tab. The button is hidden once the provider is discovered; unsupported platforms still show their availability warning. Custom providers do not show these vendor links.
Local verification covers Windows Editor and a WebGL development player. Android/iOS device acceptance and provider account setup remain release tasks.
Quick Start
Collapsed settings cards in Economy, Shop, Boosters, Daily Rewards, Missions and Chest open when you click anywhere on their summary or card background; click again to close them. Edit/Done remains available. Controls inside the expanded details work without collapsing the card. Daily Rewards headers preview the assigned Reward picture, or the first reward's available icon when no picture is assigned; editing the picture or bundle refreshes that preview.
- Install the required packages through Package Manager, configure a URP asset in Graphics/Quality, and set Active Input Handling to Input System or Both. Import TMP Essential Resources before opening the demo.
- Import the checked
.unitypackage. OpenTools/Ostryzhnyi/Casual Game Core/Settings. Import setup creates project-owned settings atAssets/CasualGameCoreGenerated/Resources/CasualGameSettings.assetif they are absent. Existing settings are retained; an empty audio mixer reference can be filled from the packaged mixer. - For the first run, keep Ads, IAP and Analytics in
Simulationfor every platform. These are the shipped defaults; previously created project settings are not migrated. SelectValidate configurationand readConfiguration findings. Empty legal URLs are reported and their player actions are hidden. - Open DemoScene, enter Play Mode and finish the initial consent/Daily overlays. Use Play and the demo's Win/Lose controls. Check balances and progression, retry after a loss, and launch again to check persistence. The default Chest interval is five displayed levels; an ordinary Level 1 win does not open it.
- Create a component derived from
GameplayMechanicfor your game. Implement content loading and attempt state inside its three operations. This minimal integration surface compiles, but intentionally supplies no gameplay:
using Ostryzhnyi.CasualGameCore.Progression;
public sealed class MyMechanic : GameplayMechanic
{
public override void StartUnit(ProgressionContext context) { }
public override void RestartUnit(ProgressionContext context) { }
public override void ContinueUnit(ProgressionContext context) { }
public void Complete() => Win();
public void Fail() => Lose();
}- Assign the component to the scene's
CasualGameInstallermechanic field and add additional injectable components to its scene objects. Preserve the demo's context, view-service and UI input wiring. Replace the demo panel when your mechanic has its own input and completion conditions. - Override
SetPaused(bool)for your simulation. OverrideApplyBooster(BoosterId, Action<bool>)to apply an effect and acknowledge it exactly once; the base implementation reports false and spends nothing. OverrideCapabilitiesif your game supports ratings, then pass one to three stars toWin. An unrated mechanic ignores supplied stars.
Do not grant the win reward or advance the save from the mechanic. The result flow owns those operations. Before release, configure your legal URLs and consent text, then install and configure each SDK you intend to use. Simulation does not send provider traffic.
Runtime API
Types are grouped by namespace, with composition and gameplay integration first. Each entry documents members declared by that type; inherited Core/Unity APIs are not repeated. Public members and protected extension hooks are included. Unity callbacks are described through their visible behavior rather than listed as callable APIs.
Method signatures preserve optional arguments. Return/exception notes supplement the XML contracts with the source's explicit guard paths; expressions in those notes retain source variable names. A final return path follows earlier guards. Provider and coroutine callbacks can complete later; use the service's result callback rather than treating a request as a successful grant. Field defaults below are C# declaration defaults, not values copied from the configured import asset.
Namespace: Ostryzhnyi.CasualGameCore.Economy.Progression
ContinuePrice
Responsible for: The continue price: Amount of one currency, plus IncrementPerUse for each continue already used in the current unit. An Amount of zero turns the currency continue off.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.Progression.ContinuePrice. Declaration: public sealed class ContinuePrice. Source.
| Member | Type | Description |
|---|---|---|
CurrencyId |
string |
Currency Id. Declared initializer: EconomySettingsSection.HardCurrencyId. |
Amount |
long |
Amount. Without an initializer, a new instance uses default(long). |
IncrementPerUse |
long |
Increment Per Use. Without an initializer, a new instance uses default(long). |
CurrencyContinueMethod
Responsible for: Resumes a lost attempt for currency. It is offered whenever a price is configured, affordable or not, so the player can always select it and an unaffordable tap shows Not enough {name} through the guard. It reports success only after the spend succeeded. Continues are counted per unit, in memory: the count starts again when the unit changes.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.Progression.CurrencyContinueMethod. Declaration: public sealed class CurrencyContinueMethod : IContinueMethod. Source.
| Method | Description |
|---|---|
public CurrencyContinueMethod(ProgressionRewardRules rules, EconomySettingsSection settings, IProgressionPosition position, AffordabilityGuard guard) |
Creates CurrencyContinueMethod with the supplied dependencies and configuration. Throws ArgumentNullException when rules == null. Throws ArgumentNullException when settings == null. Throws ArgumentNullException when position == null. Throws ArgumentNullException when guard == null. |
public void Execute(Action<bool> complete) |
Completes false when no continue price resolves. Otherwise attempts the full price through the spending guard and completes with success; only successful spends increment the per-unit use counter. Throws ArgumentNullException when complete == null. |
| Member | Type | Description |
|---|---|---|
MethodId |
string |
Method Id. Declared initializer: "currency". |
Id |
string |
Id. Getter returns MethodId. |
Label |
string |
What the lose popup shows on this method's button, such as "Continue" or "Watch ad". Getter returns "Continue". |
Price |
string |
The price of the next continue, such as 10 Gem; null when no price is configured. Getter returns _rules.TryGetContinuePrice(UsedInThisUnit(), out var price) ? $"{price.Amount} {DisplayName(price.Id)}" : null. |
IsAvailable |
bool |
True when a continue price is configured. Getter returns _rules.TryGetContinuePrice(0, out _). |
ProgressionRewardRules
Responsible for: The configurable progression values of the economy: what a win grants and what a continue costs.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.Progression.ProgressionRewardRules. Declaration: public sealed class ProgressionRewardRules. Source.
| Method | Description |
|---|---|
public RewardBundle ResolveWinBundle(int unitIndex) |
The bundle of the tier with the highest WinRewardTier.FromIndex at or below unitIndex, or null when no tier applies. Among tiers with the same start the first one wins. Returns null when WinTiers == null. |
public bool TryGetContinuePrice(int continuesUsed, out CurrencyAmount price) |
The price of the next continue after continuesUsed in this unit, saturating at long.MaxValue. False, with no price, when no currency or no positive amount is configured. Returns false when configured == null || string.IsNullOrWhiteSpace(configured.CurrencyId) || configured.Amount <= 0. |
| Member | Type | Description |
|---|---|---|
WinTiers |
List<WinRewardTier> |
Every unit grants 10 coin and a continue costs 10 gem, until the author changes them. Declared initializer: new List<WinRewardTier> { DefaultTier() }. |
ContinuePrice |
ContinuePrice |
Continue Price. Declared initializer: new ContinuePrice { CurrencyId = EconomySettingsSection.HardCurrencyId, Amount = 10 }. |
WinBaseReward
Responsible for: What the base reward step publishes on ResultFlowContext.BaseReward for later steps and the Win View to read. Rewards is what this step granted: empty when nothing was configured, when the token was already used, or when the grant failed.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.Progression.WinBaseReward. Declaration: public sealed class WinBaseReward. Source.
| Method | Description |
|---|---|
public WinBaseReward(string token, GrantResult result, IReadOnlyList<ResolvedReward> rewards) |
Creates WinBaseReward with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
Token |
string |
Token. Read-only property. |
Result |
GrantResult |
Result. Read-only property. |
Rewards |
IReadOnlyList<ResolvedReward> |
Rewards. Read-only property. |
WinBaseRewardStep
Responsible for: Grants the win's tier bundle once per attempt, under the token win:{AttemptKey}, and publishes what it granted on ResultFlowContext.BaseReward as a WinBaseReward. It runs before the unit is advanced, so the unit index is the one just won.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.Progression.WinBaseRewardStep. Declaration: public sealed class WinBaseRewardStep : IConditionalResultFlowStep. Source.
| Method | Description |
|---|---|
public WinBaseRewardStep(ProgressionRewardRules rules, IProgressionPosition position, IRewardGrantor grantor, IRandom random) |
Creates WinBaseRewardStep with the supplied dependencies and configuration. Throws ArgumentNullException when rules == null. Throws ArgumentNullException when position == null. Throws ArgumentNullException when grantor == null. Throws ArgumentNullException when random == null. |
public bool AppliesTo(AttemptOutcome outcome) |
Returns whether this step applies to the supplied result context. |
public bool AppliesTo(ResultFlowContext context) |
An ordinary win; the day's extra level has its own reward. Throws ArgumentNullException when context == null. |
public void Run(ResultFlowContext context, Action done) |
Runs this result-flow step using the supplied context and completion operation. Throws ArgumentNullException when context == null. Throws ArgumentNullException when done == null. |
| Member | Type | Description |
|---|---|---|
Order |
int |
Order. Getter returns ResultFlowOrder.BaseReward. |
WinRewardDisplayStep
Responsible for: Puts what the win granted on the Win popup: the amount of the first granted reward and its icon, so the popup shows this win's reward and not the prefab's sample number. It runs after WinBaseRewardStep and before the rewarded multiplier, which raises the number when the player takes it. A win that granted nothing shows no reward row.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.Progression.WinRewardDisplayStep. Declaration: public sealed class WinRewardDisplayStep : IConditionalResultFlowStep. Source.
| Method | Description |
|---|---|
public WinRewardDisplayStep(Func<IViewService> views, RewardHandlerRegistry handlers) |
Creates WinRewardDisplayStep with the supplied dependencies and configuration. views: Resolved on each use, because the View service lives in a scene. handlers: Describes a reward's item, for its icon. Throws ArgumentNullException when views == null. Throws ArgumentNullException when handlers == null. |
public bool AppliesTo(AttemptOutcome outcome) |
Returns whether this step applies to the supplied result context. |
public bool AppliesTo(ResultFlowContext context) |
An ordinary win; the Level of Day step shows its own reward. Throws ArgumentNullException when context == null. |
public void Run(ResultFlowContext context, Action done) |
Runs this result-flow step using the supplied context and completion operation. Throws ArgumentNullException when context == null. Throws ArgumentNullException when done == null. |
public static void ShowFirst(WinView view, IReadOnlyList<ResolvedReward> rewards, RewardHandlerRegistry handlers) |
Shows the first reward's amount and icon on view, or hides the row for no rewards. |
| Member | Type | Description |
|---|---|---|
Order |
int |
Order. Getter returns ResultFlowOrder.BaseRewardShown. |
WinRewardTier
Responsible for: One win reward tier: Bundle applies from unit index FromIndex until a higher tier starts.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.Progression.WinRewardTier. Declaration: public sealed class WinRewardTier. Source.
| Member | Type | Description |
|---|---|---|
FromIndex |
int |
From Index. Without an initializer, a new instance uses default(int). |
Bundle |
RewardBundle |
Bundle. Declared initializer: new RewardBundle(). |
Namespace: Ostryzhnyi.CasualGameCore
CasualGameCoreAssembly
Responsible for: Marks the runtime assembly of Casual Game Core. Provider assemblies, tests, and the package export check resolve the assembly through this type instead of by name.
Qualified name: Ostryzhnyi.CasualGameCore.CasualGameCoreAssembly. Declaration: public static class CasualGameCoreAssembly. Source.
| Member | Type | Description |
|---|---|---|
Name |
string |
Name. Declared initializer: "Ostryzhnyi.CasualGameCore". |
Namespace: Ostryzhnyi.CasualGameCore.Ads
AdFreeState
Responsible for: The in-memory IAdFreeState: unresolved and not owned until the entitlement sync calls SetOwned.
Qualified name: Ostryzhnyi.CasualGameCore.Ads.AdFreeState. Declaration: public sealed class AdFreeState : IAdFreeState. Source.
| Method | Description |
|---|---|
public void SetOwned(bool owned) |
Records the entitlement and marks the state resolved. |
| Member | Type | Description |
|---|---|---|
IsOwned |
bool |
True when the player owns Remove Ads. Only meaningful once IsResolved. Setter: private set. |
IsResolved |
bool |
True once ownership is known, whichever way. A due interstitial waits for this (or its timeout), so a paying player is not shown an ad just because the entitlement had not loaded yet. Setter: private set. |
AdPlacement
Responsible for: The ids of the product's rewarded placements. A placement is only a string: a flow may pass its own id, and the id is part of the grant token (ad:{placement}:{requestId}), so keep ids short and stable.
Qualified name: Ostryzhnyi.CasualGameCore.Ads.AdPlacement. Declaration: public static class AdPlacement. Source.
| Member | Type | Description |
|---|---|---|
Continue |
string |
Continue. Declared initializer: "continue". |
WinMultiplier |
string |
Win Multiplier. Declared initializer: "win-multiplier". |
CurrencyReward |
string |
Currency Reward. Declared initializer: "currency-reward". |
Booster |
string |
Booster. Declared initializer: "booster". |
ChestKey |
string |
Chest Key. Declared initializer: "chest-key". |
Interstitial |
string |
The placement an interstitial is reported under. Declared initializer: "interstitial". |
AdRequested
Responsible for: Raised when an ad is requested, before the provider is asked.
Qualified name: Ostryzhnyi.CasualGameCore.Ads.AdRequested. Declaration: public struct AdRequested. Source.
| Member | Type | Description |
|---|---|---|
Placement |
string |
Placement. Without an initializer, a new instance uses default(string). |
Rewarded |
bool |
Rewarded. Without an initializer, a new instance uses default(bool). |
AdResult
Responsible for: How an ad request ended. Only Completed earns a reward.
Qualified name: Ostryzhnyi.CasualGameCore.Ads.AdResult. Declaration: public enum AdResult. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Completed |
0 |
The player watched the ad to the end. |
Closed |
1 |
The player left before the end. |
Failed |
2 |
The ad failed to load or show, or the provider stayed silent past the timeout. |
Unavailable |
3 |
No ad could be shown right now: not initialized, none loaded, or another ad is already showing. |
AdRewardCompleted
Responsible for: Raised when a rewarded ad ended with AdResult.Completed, so a reward may be granted.
Qualified name: Ostryzhnyi.CasualGameCore.Ads.AdRewardCompleted. Declaration: public struct AdRewardCompleted. Source.
| Member | Type | Description |
|---|---|---|
Placement |
string |
Placement. Without an initializer, a new instance uses default(string). |
AdViewed
Responsible for: Raised once when a requested ad ends, whatever the result.
Qualified name: Ostryzhnyi.CasualGameCore.Ads.AdViewed. Declaration: public struct AdViewed. Source.
| Member | Type | Description |
|---|---|---|
Placement |
string |
Placement. Without an initializer, a new instance uses default(string). |
Rewarded |
bool |
Rewarded. Without an initializer, a new instance uses default(bool). |
Result |
AdResult |
Result. Without an initializer, a new instance uses default(AdResult). |
AdsConsent
Responsible for: What the player allowed, in the terms a provider maps to its SDK (for LevelPlay: consent plus COPPA and do-not-sell metadata). Plan 11 produces it from the consent flow; until then ads start with NotRequired.
Qualified name: Ostryzhnyi.CasualGameCore.Ads.AdsConsent. Declaration: public readonly struct AdsConsent. Source.
| Method | Description |
|---|---|
public AdsConsent(bool adsAllowed, bool personalizedAds, bool ageRestricted, bool analyticsAllowed = true) |
Creates AdsConsent with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
AdsAllowed |
bool |
Ads Allowed. Read-only property. |
PersonalizedAds |
bool |
Personalized Ads. Read-only property. |
AgeRestricted |
bool |
Age Restricted. Read-only property. |
AnalyticsAllowed |
bool |
Whether analytics may start. The same choice answers ads and analytics. Read-only property. |
NotRequired |
AdsConsent |
For a project that does not collect consent: ads allowed, personalized, not age restricted, analytics allowed. Getter returns new AdsConsent(true, true, false, true). |
AdsData
Responsible for: The persisted ads counters. A blob written before a field existed loads with that field at 0.
Qualified name: Ostryzhnyi.CasualGameCore.Ads.AdsData. Declaration: public sealed class AdsData. Source.
| Member | Type | Description |
|---|---|---|
AttemptsSinceInterstitial |
int |
Attempts that ended in a win or a loss since the last interstitial cycle ended. Without an initializer, a new instance uses default(int). |
AdsFeature
Responsible for: Composes ads when the Ads toggle is on and the platform's mode is not Disabled: a disabled platform composes nothing, so the feature gate hides every ad call to action. Simulation composes the visible fake ad; Real SDK composes the provider of the chosen factory and, when it cannot run, composes nothing and warns. A platform with no mode-table row (the Editor on desktop, standalone) simulates unless ads are disabled on every platform. The provider initializes only after the IPrivacyConsent port answers, and not at all when the answer does not allow ads.
Qualified name: Ostryzhnyi.CasualGameCore.Ads.AdsFeature. Declaration: public sealed class AdsFeature : ICasualFeature. Source.
| Method | Description |
|---|---|
public AdsFeature(CasualGameSettings settings, ProviderRegistry registry = null, ServicePlatform? platform = null) |
Creates AdsFeature with the supplied dependencies and configuration. registry: The installed provider factories; every public factory in the loaded assemblies when null. platform: The platform to compose for; the running one when null. For tests. Throws ArgumentNullException when settings == null. |
public void Register(DIContainer container) |
Registers this feature’s services and signal bindings in the supplied container. Throws InvalidOperationException when !(_factory == null) and typed == null. |
| Member | Type | Description |
|---|---|---|
FeatureId |
string |
Feature Id. Declared initializer: "Ads". |
Id |
string |
Id. Getter returns FeatureId. |
Enabled |
bool |
Enabled. Getter returns _enabled. |
Priority |
int |
After the Notices and Economy features. Getter returns int.MinValue + 5. |
AdsPlatformKeys
Responsible for: The identifiers one platform's ad network needs. They are documented by the provider as safe to ship in a client, so they are tagged ClientSafeAttribute; that is a declaration, not encryption.
Qualified name: Ostryzhnyi.CasualGameCore.Ads.AdsPlatformKeys. Declaration: public sealed class AdsPlatformKeys. Source.
| Member | Type | Description |
|---|---|---|
AppKey |
string |
App Key. Declared initializer: "". |
RewardedAdUnitId |
string |
Rewarded Ad Unit Id. Declared initializer: "". |
InterstitialAdUnitId |
string |
Interstitial Ad Unit Id. Declared initializer: "". |
AdsSave
Responsible for: How many attempts have ended since the last interstitial cycle, so the schedule survives a restart. Found by the Saves catalog scan; every change is saved at once. Whether an interstitial is due is derived from this counter and the configured frequency, so a changed frequency applies to the attempts already counted.
Qualified name: Ostryzhnyi.CasualGameCore.Ads.AdsSave. Declaration: public sealed class AdsSave : VersionedSaveModel<AdsData>. Source.
| Method | Description |
|---|---|
public int RecordAttempt() |
Counts one ended attempt and saves. Returns the new count; it saturates instead of wrapping. |
public void ResetCycle() |
Starts a new interstitial cycle: the counter goes back to 0 and is saved. |
| Member | Type | Description |
|---|---|---|
AttemptsSinceInterstitial |
int |
Attempts Since Interstitial. Getter returns Data.AttemptsSinceInterstitial. |
AdsService
Responsible for: Coordinates rewarded/interstitial requests, readiness, timeout and callback completion.
Qualified name: Ostryzhnyi.CasualGameCore.Ads.AdsService. Declaration: public sealed class AdsService : IAdsService. Source.
| Method | Description |
|---|---|
public AdsService(IAdProvider provider, OstryzhnyiSignal<AdRequested> requested = null, OstryzhnyiSignal<AdViewed> viewed = null, OstryzhnyiSignal<AdRewardCompleted> rewardCompleted = null, double timeoutSeconds = DefaultTimeoutSeconds, Action<IEnumerator> run = null, Func<double> seconds = null) |
Creates AdsService with the supplied dependencies and configuration. requested: Raised when an ad is requested. viewed: Raised once when a request ends. rewardCompleted: Raised when a rewarded ad completed. run: Starts a coroutine; the shared tween core's runner when null. seconds: A monotonic clock in seconds; real time when null. Throws ArgumentOutOfRangeException when !(timeoutSeconds > 0) || double.IsInfinity(timeoutSeconds). Throws ArgumentNullException when provider == null. |
public void ShowRewarded(string placement, Action<AdResult> complete) |
Shows a rewarded ad for placement. A request while another ad is showing, before initialization or with an empty placement reports AdResult.Unavailable immediately. |
public void ShowInterstitial(Action<AdResult> complete) |
Shows an interstitial under AdPlacement.Interstitial, with the same guards as ShowRewarded. |
| Member | Type | Description |
|---|---|---|
DefaultTimeoutSeconds |
double |
How long a provider may stay silent before the request is reported as failed. Declared initializer: 30. |
IsInitialized |
bool |
True once the provider has initialized and is ready to take requests. Getter returns _initialized. |
IsRewardedReady |
bool |
True when a rewarded ad could be shown right now. Getter returns _initialized && !_showing && ProviderReady(). |
AdsSettingsSection
Responsible for: The ads settings.
Qualified name: Ostryzhnyi.CasualGameCore.Ads.AdsSettingsSection. Declaration: public sealed class AdsSettingsSection : ICasualSettingsSection. Source.
| Method | Description |
|---|---|
public AdsPlatformKeys KeysFor(ServicePlatform platform) |
The identifiers for a platform, or null for one that has none (WebGL). Returns null after the preceding guards/branches. |
| Member | Type | Description |
|---|---|---|
ServiceId |
string |
The service id in the platform mode table. Declared initializer: "ads". |
ProviderId |
string |
The real provider to use when a platform's mode is Real SDK. Declared initializer: "levelplay". |
Android |
AdsPlatformKeys |
Android. Declared initializer: new AdsPlatformKeys(). |
Ios |
AdsPlatformKeys |
Ios. Declared initializer: new AdsPlatformKeys(). |
InterstitialEveryAttempts |
int |
An interstitial is due after this many completed attempts, wins and losses both. Values below 1 behave as 1. Declared initializer: 3. |
RewardMultiplier |
int |
The factor a rewarded ad applies to the win reward. 2 grants the base amount once more. Declared initializer: 2. |
MultiplierEnabled |
bool |
Offers the rewarded win multiplier. Declared initializer: true. |
ContinueEnabled |
bool |
Offers the rewarded continue. Declared initializer: true. |
SimulationDelaySeconds |
float |
How long the fake ad stays on screen. Declared initializer: 2f. |
SimulationResult |
SimulatedAdOutcome |
Simulation Result. Declared initializer: SimulatedAdOutcome.Success. |
TimeoutSeconds |
float |
How long a provider may stay silent before a request is reported as failed. Declared initializer: 30f. |
AdFreeWaitSeconds |
float |
How long a due interstitial waits for the Remove Ads entitlement to load before the player is treated as not owning it. 0 or less does not wait. Declared initializer: 3f. |
EffectiveInterstitialEveryAttempts |
int |
InterstitialEveryAttempts as used at runtime: at least 1. Getter returns Math.Max(1, InterstitialEveryAttempts). |
ConsentNotRequired
Responsible for: The default port for a project with no consent flow: the choice is known at once and ads are allowed.
Qualified name: Ostryzhnyi.CasualGameCore.Ads.ConsentNotRequired. Declaration: public sealed class ConsentNotRequired : IPrivacyConsent. Source.
| Method | Description |
|---|---|
public void WhenReady(Action<AdsConsent> callback) |
Calls callback once with the player's choice: at once when it is already known, otherwise when it has been made. Several callers may wait at the same time and each is called once. Throws ArgumentNullException when callback == null. |
IAdFreeState
Responsible for: Whether the player owns Remove Ads. Only interstitials read it; rewarded ads never do, so owning it keeps every rewarded button working (AE12). It is registered by the always-composed core feature, not by AdsFeature, so the entitlement sync of the purchases plan can set it even when ads are off.
Qualified name: Ostryzhnyi.CasualGameCore.Ads.IAdFreeState. Declaration: public interface IAdFreeState. Source.
| Method | Description |
|---|---|
void SetOwned(bool owned) |
Records the entitlement and marks the state resolved. |
| Member | Type | Description |
|---|---|---|
IsOwned |
bool |
True when the player owns Remove Ads. Only meaningful once IsResolved. Read-only property. |
IsResolved |
bool |
True once ownership is known, whichever way. A due interstitial waits for this (or its timeout), so a paying player is not shown an ad just because the entitlement had not loaded yet. Read-only property. |
IAdProvider
Responsible for: One ad network behind the ads service. It keeps SDK types out of the product: the simulation, the disabled path and a real SDK all look the same to every flow. Callbacks only; nothing here blocks.
Qualified name: Ostryzhnyi.CasualGameCore.Ads.IAdProvider. Declaration: public interface IAdProvider. Source.
| Method | Description |
|---|---|
void Initialize(AdsConsent consent, Action<bool> complete) |
Starts the provider with what the player consented to. complete receives whether it is ready to show ads. |
void ShowRewarded(string placement, Action<AdResult> complete) |
Shows a rewarded ad. complete is called once with how it ended. |
void ShowInterstitial(Action<AdResult> complete) |
Shows an interstitial. complete is called once with how it ended. |
| Member | Type | Description |
|---|---|---|
IsRewardedReady |
bool |
True when a rewarded ad is loaded and can be shown now. Read-only property. |
IAdsService
Responsible for: The ad API the product calls. Flows never see a provider or an SDK. Every request ends in exactly one callback, and a request that cannot run reports AdResult.Unavailable at once instead of throwing.
Qualified name: Ostryzhnyi.CasualGameCore.Ads.IAdsService. Declaration: public interface IAdsService. Source.
| Method | Description |
|---|---|
void ShowRewarded(string placement, Action<AdResult> complete) |
Shows a rewarded ad for placement. A request while another ad is showing, before initialization or with an empty placement reports AdResult.Unavailable immediately. |
void ShowInterstitial(Action<AdResult> complete) |
Shows an interstitial under AdPlacement.Interstitial, with the same guards as ShowRewarded. |
| Member | Type | Description |
|---|---|---|
IsInitialized |
bool |
True once the provider has initialized and is ready to take requests. Read-only property. |
IsRewardedReady |
bool |
True when a rewarded ad could be shown right now. Read-only property. |
IPrivacyConsent
Responsible for: The port ads wait on before they initialize. The consent flow of plan 11 implements it; a project that does not collect consent gets ConsentNotRequired. Exactly one implementation is registered, and the consent feature composes before Ads so the default never replaces it.
Qualified name: Ostryzhnyi.CasualGameCore.Ads.IPrivacyConsent. Declaration: public interface IPrivacyConsent. Source.
| Method | Description |
|---|---|
void WhenReady(Action<AdsConsent> callback) |
Calls callback once with the player's choice: at once when it is already known, otherwise when it has been made. Several callers may wait at the same time and each is called once. |
ISimulatedAdPresenter
Responsible for: Puts the fake ad on screen. The provider owns the timing and the result; the presenter only shows, updates and hides the overlay, so the provider is testable without a View.
Qualified name: Ostryzhnyi.CasualGameCore.Ads.ISimulatedAdPresenter. Declaration: public interface ISimulatedAdPresenter. Source.
| Method | Description |
|---|---|
bool Show(string message, bool closable, Action closeRequested) |
Shows the fake ad. closeRequested is called if the player presses the close button, which is only offered when closable is true. Returns false when there is no overlay to show. |
void SetRemainingSeconds(float seconds) |
Updates remaining seconds using the supplied value. |
void Hide() |
Hides this view or UI element. |
InterstitialScheduler
Responsible for: Shows an interstitial once per N ended attempts, after the whole result flow has closed. Wins and losses both count; an abandoned attempt raises neither signal, so it never does. Reaching N only marks an interstitial due: it is shown at the next ResultFlowClosed, so a win that goes on to a chest is delayed until the chest and reward are done (AE11). If the app leaves the result flow another way, the interstitial stays due.
Qualified name: Ostryzhnyi.CasualGameCore.Ads.InterstitialScheduler. Declaration: public sealed class InterstitialScheduler : IDisposable. Source.
While IAdFreeState.IsResolved is false a due interstitial waits, up to AdsSettingsSection.AdFreeWaitSeconds, and is shown afterwards only if the player does not own Remove Ads. An owned Remove Ads ends the cycle without a request (AE12). Any result of an interstitial, AdResult.Failed and AdResult.Unavailable included, ends the cycle, so a failed one is not retried in the same cycle.
| Method | Description |
|---|---|
public InterstitialScheduler(IAdsService ads, AdsSave save, IAdFreeState adFree, AdsSettingsSection settings, OstryzhnyiSignal<UnitCompleted> completed, OstryzhnyiSignal<UnitFailed> failed, OstryzhnyiSignal<ResultFlowClosed> closed, Action<IEnumerator> run = null, Func<double> seconds = null) |
Creates InterstitialScheduler with the supplied dependencies and configuration. completed: A win was reported; counts one attempt. failed: A loss was reported; counts one attempt. closed: The result flow closed; a due interstitial is shown now. run: Starts a coroutine; the shared tween core's runner when null. seconds: A monotonic clock in seconds; real time when null. Throws ArgumentNullException when ads == null. Throws ArgumentNullException when save == null. Throws ArgumentNullException when adFree == null. Throws ArgumentNullException when settings == null. Throws ArgumentNullException when completed == null. Throws ArgumentNullException when failed == null. Throws ArgumentNullException when closed == null. |
public void Dispose() |
Stops listening. A waiting interstitial is dropped and stays due. |
| Member | Type | Description |
|---|---|---|
IsDue |
bool |
True when enough attempts have ended for an interstitial and it has not been shown or skipped yet. Getter returns _save.AttemptsSinceInterstitial >= _settings.EffectiveInterstitialEveryAttempts. |
IsWaiting |
bool |
True while a due interstitial is waiting for IAdFreeState.IsResolved. Getter returns _waiting. |
SimulatedAdOutcome
Responsible for: What a simulated ad ends with.
Qualified name: Ostryzhnyi.CasualGameCore.Ads.SimulatedAdOutcome. Declaration: public enum SimulatedAdOutcome. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Success |
0 |
Success. |
Cancel |
1 |
Cancel. |
Fail |
2 |
Fail. |
Unavailable |
3 |
Unavailable. |
SimulatedAdPresenter
Responsible for: Shows the fake ad as a SimulatedAdView through the View service.
Qualified name: Ostryzhnyi.CasualGameCore.Ads.SimulatedAdPresenter. Declaration: public sealed class SimulatedAdPresenter : ISimulatedAdPresenter. Source.
| Method | Description |
|---|---|
public SimulatedAdPresenter(Func<IViewService> viewService) |
Creates SimulatedAdPresenter with the supplied dependencies and configuration. viewService: Resolved on each use, because the View service lives in a scene and may not exist yet when this is composed. Throws ArgumentNullException when viewService == null. |
public bool Show(string message, bool closable, Action closeRequested) |
Shows the fake ad. closeRequested is called if the player presses the close button, which is only offered when closable is true. Returns false when there is no overlay to show. Returns false when view == null. Returns false after the preceding guards/branches after a caught exception. |
public void SetRemainingSeconds(float seconds) |
Updates remaining seconds using the supplied value. |
public void Hide() |
Hides this view or UI element. |
SimulatedAdProvider
Responsible for: The ad provider that needs no SDK: it shows a fake ad for the configured delay and ends with the configured result. It is ready immediately and reports SimulatedAdOutcome.Unavailable only when shown.
Qualified name: Ostryzhnyi.CasualGameCore.Ads.SimulatedAdProvider. Declaration: public sealed class SimulatedAdProvider : IAdProvider. Source.
| Method | Description |
|---|---|
public SimulatedAdProvider(AdsSettingsSection settings, ISimulatedAdPresenter presenter, Action<IEnumerator> run = null, Func<double> seconds = null) |
Creates SimulatedAdProvider with the supplied dependencies and configuration. settings: Read at each ad, so an edit during play takes effect on the next one. run: Starts a coroutine; the shared tween core's runner when null. seconds: A monotonic clock in seconds; real time when null. Throws ArgumentNullException when settings == null. Throws ArgumentNullException when presenter == null. |
public void Initialize(AdsConsent consent, Action<bool> complete) |
Starts the provider with what the player consented to. complete receives whether it is ready to show ads. Throws ArgumentNullException when complete == null. |
public void ShowRewarded(string placement, Action<AdResult> complete) |
Shows a rewarded ad. complete is called once with how it ended. |
public void ShowInterstitial(Action<AdResult> complete) |
Shows an interstitial. complete is called once with how it ended. |
| Member | Type | Description |
|---|---|---|
IsRewardedReady |
bool |
True when a rewarded ad is loaded and can be shown now. Getter returns true. |
SimulatedAdView
Responsible for: The fake ad: a message, the seconds left and a close button. It is a View on the Notice layer, so it looks and behaves the same in the Editor, on devices and on WebGL. The close button is only usable when the simulated result is SimulatedAdOutcome.Cancel: otherwise the ad cannot be dismissed early.
Qualified name: Ostryzhnyi.CasualGameCore.Ads.SimulatedAdView. Declaration: public sealed class SimulatedAdView : CasualView. Source.
| Method | Description |
|---|---|
public void Present(string message, bool closable) |
Sets the text and whether the player may close the ad early. Call before showing the View. |
public void SetRemainingSeconds(float seconds) |
Updates remaining seconds using the supplied value. |
| Member | Type | Description |
|---|---|---|
Layer |
Layers |
Layer. Getter returns Layers.Notice. |
CloseRequested |
Action |
The player pressed the close button, which is only possible while it is usable. |
Message |
string |
Message. Getter returns _messageText != null ? _messageText.text : string.Empty. |
Countdown |
string |
Countdown. Getter returns _countdownText != null ? _countdownText.text : string.Empty. |
CloseUsable |
bool |
True while the close button is shown and can be pressed. Getter returns _closable && _closeButton != null && _closeButton.gameObject.activeSelf && _closeButton.interactable. |
Namespace: Ostryzhnyi.CasualGameCore.Ads.Flows
AdContinueMethod
Responsible for: Resumes a lost attempt for a rewarded ad. It reports success only when the ad ended AdResult.Completed, so the continue registry resumes the attempt exactly once. Any other result shows the NoticeKind.AdUnavailable notice and reports failure, which leaves the Lose View open.
Qualified name: Ostryzhnyi.CasualGameCore.Ads.Flows.AdContinueMethod. Declaration: public sealed class AdContinueMethod : IContinueMethod. Source.
It is offered whenever AdsSettingsSection.ContinueEnabled is on, ready or not, so a runtime no-fill shows the retry notice instead of making the button vanish. A disabled platform mode composes no ads, so it is not registered.
| Method | Description |
|---|---|
public AdContinueMethod(IAdsService ads, INoticeService notices, AdsSettingsSection settings) |
Creates AdContinueMethod with the supplied dependencies and configuration. Throws ArgumentNullException when ads == null. Throws ArgumentNullException when notices == null. Throws ArgumentNullException when settings == null. |
public void Execute(Action<bool> complete) |
Requests the Continue rewarded placement. Completes true only for Completed; a concurrent request completes false. Other outcomes show AdUnavailable and complete false. A null completion callback throws. Throws ArgumentNullException when complete == null. Throws the current exception on the corresponding guard path. |
| Member | Type | Description |
|---|---|---|
MethodId |
string |
Method Id. Declared initializer: "ad". |
Id |
string |
Id. Getter returns MethodId. |
Label |
string |
What the lose popup shows on this method's button, such as "Continue" or "Watch ad". Getter returns "Watch ad". |
Price |
string |
Always null: watching an ad is free. Getter returns null. |
IsAvailable |
bool |
True while AdsSettingsSection.ContinueEnabled is on. Getter returns _settings.ContinueEnabled. |
RewardedAdButton
Responsible for: The shared "watch an ad, get a reward" button. A tap requests a rewarded ad under the configured placement. Only a AdResult.Completed ad grants the configured bundle, once, under the token ad:{placement}:{requestId}, where the request id is created at tap time. Any other result shows the NoticeKind.AdUnavailable notice and leaves the View it sits on open. A platform with ads disabled hides it; a runtime no-fill keeps it visible.
Qualified name: Ostryzhnyi.CasualGameCore.Ads.Flows.RewardedAdButton. Declaration: public sealed class RewardedAdButton : MonoBehaviour. Source.
| Method | Description |
|---|---|
public void Configure(string placementId, RewardBundle reward, UnityEngine.UI.Button button = null) |
Editor and test seam: sets the placement, the bundle and the button it listens to. |
public void SetSources(IAdsService ads, IRewardGrantor grantor, INoticeService notices, IFeatureGate gate, IRandom random = null) |
Test seam: uses these sources instead of the injected or project ones, then re-evaluates the gate. |
public void Request() |
The tap handler: requests the ad and, on AdResult.Completed, grants the bundle. |
public void Evaluate() |
Hides the button when ads are not composed or nothing is configured, and shows it otherwise. |
| Member | Type | Description |
|---|---|---|
Config |
RewardedPlacementConfig |
Config. Getter returns _config. |
Rewarded |
Action<GrantResult> |
Raised once after a completed ad's grant, with its result. A replayed grant reports GrantResult.AlreadyGranted. |
IsRequesting |
bool |
True while an ad requested by this button has not ended; further taps are ignored. Getter returns _requesting. |
RewardedPlacementConfig
Responsible for: What one RewardedAdButton asks for and grants: the placement the ad is requested under and the bundle a completed ad grants. The booster and chest plans configure their own, with a bundle their registered reward handlers understand.
Qualified name: Ostryzhnyi.CasualGameCore.Ads.Flows.RewardedPlacementConfig. Declaration: public sealed class RewardedPlacementConfig. Source.
| Member | Type | Description |
|---|---|---|
PlacementId |
string |
The placement id the ad is requested under; it is part of the grant token ad:{placement}:{requestId}. Declared initializer: AdPlacement.CurrencyReward. |
Reward |
RewardBundle |
What a completed ad grants. A bundle with no entries grants nothing, so the button is not offered. Declared initializer: new RewardBundle(). |
IsConfigured |
bool |
True when a placement id is set and the bundle has at least one entry. Getter returns !string.IsNullOrWhiteSpace(PlacementId) && HasEntry(). |
WinMultiplierStep
Responsible for: Offers a rewarded multiplier on the win reward. It runs at ResultFlowOrder.RewardMultiplier, after the base reward, shows the offer on the Win View and completes at once, so the player stays free to move on. When the player takes the offer and the ad ends AdResult.Completed it grants only the extra amount, base times the multiplier minus base, under the token ad:win-multiplier:{AttemptKey}, so the same attempt never grants it twice.
Qualified name: Ostryzhnyi.CasualGameCore.Ads.Flows.WinMultiplierStep. Declaration: public sealed class WinMultiplierStep : IResultFlowStep. Source.
Nothing is offered when AdsSettingsSection.MultiplierEnabled is off, the multiplier is below WinView.MinimumMultiplier, or the base reward step granted nothing. Every other ad result shows the NoticeKind.AdUnavailable notice and keeps the offer, so the player can try again.
| Method | Description |
|---|---|
public WinMultiplierStep(IAdsService ads, IRewardGrantor grantor, INoticeService notices, AdsSettingsSection settings, Func<IViewService> views) |
Creates WinMultiplierStep with the supplied dependencies and configuration. views: Resolved on each use, because the View service lives in a scene. Throws ArgumentNullException when ads == null. Throws ArgumentNullException when grantor == null. Throws ArgumentNullException when notices == null. Throws ArgumentNullException when settings == null. Throws ArgumentNullException when views == null. |
public bool AppliesTo(AttemptOutcome outcome) |
Returns whether this step applies to the supplied result context. |
public static string TokenFor(int attemptKey) |
The grant token for an attempt: ad:win-multiplier:{attemptKey}. |
public void Run(ResultFlowContext context, Action done) |
Runs this result-flow step using the supplied context and completion operation. Throws ArgumentNullException when context == null. Throws ArgumentNullException when done == null. |
| Member | Type | Description |
|---|---|---|
Order |
int |
Order. Getter returns ResultFlowOrder.RewardMultiplier. |
Namespace: Ostryzhnyi.CasualGameCore.Analytics
AnalyticsError
Responsible for: A sanitized error, never raw save data or recovery contents. Produced by ErrorReporter.
Qualified name: Ostryzhnyi.CasualGameCore.Analytics.AnalyticsError. Declaration: public readonly struct AnalyticsError. Source.
| Method | Description |
|---|---|
public AnalyticsError(AnalyticsErrorSeverity severity, string message, string stackTrace = "") |
Creates AnalyticsError with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
Severity |
AnalyticsErrorSeverity |
Severity. Read-only property. |
Message |
string |
Message. Read-only property. |
StackTrace |
string |
Stack Trace. Read-only property. |
AnalyticsErrorSeverity
Responsible for: Identifies the severity of a captured analytics error.
Qualified name: Ostryzhnyi.CasualGameCore.Analytics.AnalyticsErrorSeverity. Declaration: public enum AnalyticsErrorSeverity. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Error |
0 |
Error. |
Critical |
1 |
Critical. |
AnalyticsEvent
Responsible for: One thing to report: a name and flat parameters. It is SDK-free and immutable, so any provider can map it. A parameter value is a string, a bool or a number; anything else is rejected when the event is made, not when it is sent.
Qualified name: Ostryzhnyi.CasualGameCore.Analytics.AnalyticsEvent. Declaration: public sealed class AnalyticsEvent. Source.
| Method | Description |
|---|---|
public AnalyticsEvent(string name, IReadOnlyDictionary<string, object> parameters = null) |
Creates AnalyticsEvent with the supplied dependencies and configuration. name: What happened, for example unit_started. Required. parameters: Copied, so a later change to the caller's dictionary does not change the event. Null for none. Throws ArgumentException: The name is blank, or a parameter has a blank key, a null value or a value that is not a string, bool or number. Throws ArgumentException when string.IsNullOrWhiteSpace(name). Throws ArgumentException when string.IsNullOrWhiteSpace(pair.Key). This check is inside the iteration. Throws ArgumentException when !IsSupported(pair.Value). This check is inside the iteration. |
public override string ToString() |
For logs and the monitor, for example unit_started {index=3, stars=2}, parameters in key order. |
| Member | Type | Description |
|---|---|---|
Name |
string |
Name. Read-only property. |
Parameters |
IReadOnlyDictionary<string, object> |
The parameters, never null; read-only. Read-only property. |
AnalyticsEventMapper
Responsible for: Turns the product's signals into analytics events. Features never call analytics: this subscribes to the signals of the systems that are composed and reports each as one event from AnalyticsSchema. A system that is not composed raises no signal, so it simply produces no event. A signal handler here never throws, so analytics can never break the system that raised the signal.
Qualified name: Ostryzhnyi.CasualGameCore.Analytics.AnalyticsEventMapper. Declaration: public sealed class AnalyticsEventMapper : IDisposable. Source.
| Method | Description |
|---|---|
public AnalyticsEventMapper(IAnalytics analytics, DIContainer container) |
Creates AnalyticsEventMapper with the supplied dependencies and configuration. container: Where the signals are looked up: parents too. Signals a feature registers are only found when that feature is composed; progression and continue signals, which a scene creates, are found or created. Throws ArgumentNullException when analytics == null. Throws ArgumentNullException when container == null. |
public void Dispose() |
Stops listening. Events already sent stay sent. |
AnalyticsFeature
Responsible for: Composes analytics when the Analytics toggle is on and the platform's mode is not Disabled: a disabled platform composes nothing, so nothing is sent. Simulation composes the SDK-free provider; Real SDK composes the provider of the chosen factory and, when it cannot run, composes nothing and warns. A platform with no mode-table row (the Editor on desktop, standalone) simulates. The provider starts only after the IPrivacyConsent port answers.
Qualified name: Ostryzhnyi.CasualGameCore.Analytics.AnalyticsFeature. Declaration: public sealed class AnalyticsFeature : ICasualFeature. Source.
| Method | Description |
|---|---|
public AnalyticsFeature(CasualGameSettings settings, ProviderRegistry registry = null, ServicePlatform? platform = null, SimulatedAnalyticsLog log = null) |
Creates AnalyticsFeature with the supplied dependencies and configuration. registry: The installed provider factories; every public factory in the loaded assemblies when null. platform: The platform to compose for; the running one when null. For tests. log: Where the simulation records; SimulatedAnalyticsLog.Default when null. For tests. Throws ArgumentNullException when settings == null. |
public void Register(DIContainer container) |
Registers this feature’s services and signal bindings in the supplied container. Throws InvalidOperationException when !(_factory == null) and typed == null. |
| Member | Type | Description |
|---|---|---|
FeatureId |
string |
Feature Id. Declared initializer: "Analytics". |
Id |
string |
Id. Getter returns FeatureId. |
Enabled |
bool |
Enabled. Getter returns _enabled. |
Priority |
int |
After the Ads feature, whose consent port it shares. Getter returns int.MinValue + 13. |
AnalyticsPlatformKeys
Responsible for: The identifiers one platform's analytics backend needs. GameAnalytics ships both its game key and its secret key inside the client by design, so both are tagged ClientSafeAttribute and the secret key is on the credential validator's explicit allowlist; that is a declaration, not encryption.
Qualified name: Ostryzhnyi.CasualGameCore.Analytics.AnalyticsPlatformKeys. Declaration: public sealed class AnalyticsPlatformKeys. Source.
| Member | Type | Description |
|---|---|---|
GameKey |
string |
Game Key. Declared initializer: "". |
SecretKey |
string |
Secret Key. Declared initializer: "". |
AnalyticsSchema
Responsible for: Every event id and parameter name the product reports. It is the one place they live, so it doubles as the documentation of what a dashboard receives; the mapper builds events from it and nothing else names them.
Qualified name: Ostryzhnyi.CasualGameCore.Analytics.AnalyticsSchema. Declaration: public static class AnalyticsSchema. Source.
The limits are GameAnalytics' documented ones for a design event id: one to five parts separated by colons, each part up to 64 characters, written with a-z, A-Z, 0-9 and - _ . , : ( ) ! ?. No total length is documented. Every id below is a single short part. Parameter values are sent as custom fields, which have no documented limit; the mapper still cuts a text value to MaxValueLength so an unexpectedly long id cannot grow an event without bound.
| Method | Description |
|---|---|
public static bool IsValidEventId(string id) |
True when the id follows the documented rules above. Returns false when string.IsNullOrEmpty(id). Returns false when parts.Length > MaxIdParts. Returns false when part.Length == 0 || part.Length > MaxPartLength. This check is inside the iteration. Returns false when !IsAllowed(character). This check is inside the iteration. |
| Member | Type | Description |
|---|---|---|
MaxIdParts |
int |
Max Id Parts. Declared initializer: 5. |
MaxPartLength |
int |
Max Part Length. Declared initializer: 64. |
MaxValueLength |
int |
The longest text a parameter keeps. Declared initializer: 64. |
AllEventIds |
IReadOnlyList<string> |
Every event id, in the order they are declared. Getter returns EventIds. |
AnalyticsService
Responsible for: The IAnalytics: holds a ready flag and forwards events to the provider only while it is ready and enabled. Everything a provider does is contained, so a broken backend can never break the game. Only the type of a provider's exception is logged, because messages can carry SDK payloads.
Qualified name: Ostryzhnyi.CasualGameCore.Analytics.AnalyticsService. Declaration: public sealed class AnalyticsService : IAnalytics, IDisposable. Source.
| Method | Description |
|---|---|
public AnalyticsService(IAnalyticsProvider provider, ErrorReportingSettings errors = null, IErrorLogSource errorLogs = null) |
Creates AnalyticsService with the supplied dependencies and configuration. Throws ArgumentNullException when provider == null. |
public void Dispose() |
Releases this instance’s owned subscriptions or pending work. Call it when the owning flow ends. |
public void Track(AnalyticsEvent analyticsEvent) |
Sends the event to the provider when it is ready and enabled; otherwise the event is dropped, never buffered or saved. A null event, and a provider that throws, are logged and never reach the caller. |
public void SetEnabled(bool enabled) |
Turns sending on or off, on the service and on the provider. Events tracked while off are dropped. |
| Member | Type | Description |
|---|---|---|
IsReady |
bool |
True once the provider has initialized and is ready to take events. Getter returns _ready. |
AnalyticsSettingsSection
Responsible for: The analytics settings.
Qualified name: Ostryzhnyi.CasualGameCore.Analytics.AnalyticsSettingsSection. Declaration: public sealed class AnalyticsSettingsSection : ICasualSettingsSection. Source.
| Method | Description |
|---|---|
public AnalyticsPlatformKeys KeysFor(ServicePlatform platform) |
The identifiers for Android, iOS or WebGL; null for an unknown platform. Returns null after the preceding guards/branches. |
| Member | Type | Description |
|---|---|---|
ServiceId |
string |
The service id in the platform mode table. Declared initializer: "analytics". |
ProviderId |
string |
The real provider to use when a platform's mode is Real SDK. Declared initializer: "gameanalytics". |
Android |
AnalyticsPlatformKeys |
Android. Declared initializer: new AnalyticsPlatformKeys(). |
Ios |
AnalyticsPlatformKeys |
Ios. Declared initializer: new AnalyticsPlatformKeys(). |
WebGl |
AnalyticsPlatformKeys |
Web Gl. Declared initializer: new AnalyticsPlatformKeys(). |
ErrorReporting |
ErrorReportingSettings |
Error Reporting. Declared initializer: new ErrorReportingSettings(). |
LogSimulatedEvents |
bool |
Whether the simulation also writes each event to the Console. The Editor monitor lists them either way. Declared initializer: true. |
ErrorReporter
Responsible for: Session-limited, deduplicated and sanitized error forwarding. Dispose to remove the log subscription.
Qualified name: Ostryzhnyi.CasualGameCore.Analytics.ErrorReporter. Declaration: public sealed class ErrorReporter : IDisposable. Source.
| Method | Description |
|---|---|
public static void ResetSession() |
Disposes live reporters, including pending initialization, so Unity log callbacks cannot survive a new session. |
public ErrorReporter(IAnalyticsProvider provider, ErrorReportingSettings settings, IErrorLogSource logs = null, Func<string, string> redact = null) |
Creates ErrorReporter with the supplied dependencies and configuration. Throws ArgumentNullException when provider == null. Throws ArgumentNullException when settings == null. |
public void SetEnabled(bool enabled) |
Subscribes to error logs only when enabled, not disposed, error reporting is configured, the session limit is positive and the provider supports errors. Disabling unsubscribes. |
public void Dispose() |
Releases this instance’s owned subscriptions or pending work. Call it when the owning flow ends. |
| Member | Type | Description |
|---|---|---|
SubmissionCount |
int |
Submission Count. Setter: private set. |
DuplicateCount |
int |
Duplicate Count. Setter: private set. |
LimitDropCount |
int |
Limit Drop Count. Setter: private set. |
ErrorReportingSettings
Responsible for: Error reporting options. The runtime clamps the session limit to 0–100; zero disables capture.
Qualified name: Ostryzhnyi.CasualGameCore.Analytics.ErrorReportingSettings. Declaration: public sealed class ErrorReportingSettings. Source.
| Member | Type | Description |
|---|---|---|
MaximumSessionLimit |
int |
Maximum Session Limit. Declared initializer: 100. |
Enabled |
bool |
Enabled. Declared initializer: true. |
MaxErrorsPerSession |
int |
Max Errors Per Session. Declared initializer: 10. |
Events
Responsible for: The event ids.
Qualified name: Ostryzhnyi.CasualGameCore.Analytics.AnalyticsSchema.Events. Declaration: public static class Events. Source.
| Member | Type | Description |
|---|---|---|
UnitStarted |
string |
Unit Started. Declared initializer: "unit_started". |
UnitCompleted |
string |
Unit Completed. Declared initializer: "unit_completed". |
UnitFailed |
string |
Unit Failed. Declared initializer: "unit_failed". |
UnitRestarted |
string |
Unit Restarted. Declared initializer: "unit_restarted". |
AdRequested |
string |
Ad Requested. Declared initializer: "ad_requested". |
AdViewed |
string |
Ad Viewed. Declared initializer: "ad_viewed". |
AdRewardCompleted |
string |
Ad Reward Completed. Declared initializer: "ad_reward_completed". |
IapStarted |
string |
Iap Started. Declared initializer: "iap_started". |
IapCompleted |
string |
Iap Completed. Declared initializer: "iap_completed". |
CurrencyEarned |
string |
Currency Earned. Declared initializer: "currency_earned". |
CurrencySpent |
string |
Currency Spent. Declared initializer: "currency_spent". |
BoosterPurchased |
string |
Booster Purchased. Declared initializer: "booster_purchased". |
BoosterUsed |
string |
Booster Used. Declared initializer: "booster_used". |
ContinueUsed |
string |
Continue Used. Declared initializer: "continue_used". |
IAnalytics
Responsible for: The analytics API the product calls. Nothing that tracks ever sees a provider or an SDK, and nothing needs to handle a failure: Track never throws.
Qualified name: Ostryzhnyi.CasualGameCore.Analytics.IAnalytics. Declaration: public interface IAnalytics. Source.
| Method | Description |
|---|---|
void Track(AnalyticsEvent analyticsEvent) |
Sends the event to the provider when it is ready and enabled; otherwise the event is dropped, never buffered or saved. A null event, and a provider that throws, are logged and never reach the caller. |
void SetEnabled(bool enabled) |
Turns sending on or off, on the service and on the provider. Events tracked while off are dropped. |
| Member | Type | Description |
|---|---|---|
IsReady |
bool |
True once the provider has initialized and is ready to take events. Read-only property. |
IAnalyticsProvider
Responsible for: One analytics backend behind the analytics service. It keeps SDK types out of the product: the simulation and a real SDK look the same to everything that tracks. Callbacks only; nothing here blocks. A provider may throw from any member; the service contains it.
Qualified name: Ostryzhnyi.CasualGameCore.Analytics.IAnalyticsProvider. Declaration: public interface IAnalyticsProvider. Source.
| Method | Description |
|---|---|
void TrackError(AnalyticsError error) |
Accepts an error already sanitized by ErrorReporter, while analytics is ready and consented. |
void Initialize(Action<bool> complete) |
Starts the provider. complete receives whether it is ready to take events. |
void Track(AnalyticsEvent analyticsEvent) |
Sends one event. Only called while the provider is ready and enabled. |
void SetEnabled(bool enabled) |
Turns event sending on or off for a provider that is already running, for example when the player withdraws consent. A provider with an SDK maps this to the SDK's own opt-out so the SDK's internal traffic stops too. |
| Member | Type | Description |
|---|---|---|
SupportsErrorReporting |
bool |
False when the backend cannot accept sanitized errors. Read-only property. |
IErrorLogSource
Responsible for: Main-thread Unity log source. Subscription starts only after analytics is ready and consented.
Qualified name: Ostryzhnyi.CasualGameCore.Analytics.IErrorLogSource. Declaration: public interface IErrorLogSource. Source.
| Member | Type | Description |
|---|---|---|
Received |
Application.LogCallback |
Raised for received notifications. |
Parameters
Responsible for: The parameter names.
Qualified name: Ostryzhnyi.CasualGameCore.Analytics.AnalyticsSchema.Parameters. Declaration: public static class Parameters. Source.
| Member | Type | Description |
|---|---|---|
Kind |
string |
Kind. Declared initializer: "kind". |
Index |
string |
Index. Declared initializer: "index". |
Attempt |
string |
Attempt. Declared initializer: "attempt". |
Stars |
string |
Stars. Declared initializer: "stars". |
Retry |
string |
Retry. Declared initializer: "retry". |
LevelOfDay |
string |
True for the day's extra level; sent on every unit event so it is told apart from the unit at the player's place. Declared initializer: "level_of_day". |
Placement |
string |
Placement. Declared initializer: "placement". |
Rewarded |
string |
Rewarded. Declared initializer: "rewarded". |
Result |
string |
Result. Declared initializer: "result". |
ProductId |
string |
Product Id. Declared initializer: "product_id". |
Currency |
string |
Currency. Declared initializer: "currency". |
Amount |
string |
Amount. Declared initializer: "amount". |
Source |
string |
Source. Declared initializer: "source". |
Reason |
string |
Reason. Declared initializer: "reason". |
Booster |
string |
Booster. Declared initializer: "booster". |
Method |
string |
Method. Declared initializer: "method". |
SimulatedAnalyticsLog
Responsible for: What the simulated analytics provider recorded, newest last. The Editor monitor window reads it. It keeps only the most recent Capacity events, so a long session cannot grow it without bound.
Qualified name: Ostryzhnyi.CasualGameCore.Analytics.SimulatedAnalyticsLog. Declaration: public sealed class SimulatedAnalyticsLog. Source.
| Method | Description |
|---|---|
public SimulatedAnalyticsLog(int capacity = DefaultCapacity) |
Creates SimulatedAnalyticsLog with the supplied dependencies and configuration. Throws ArgumentOutOfRangeException: The capacity is below 1. Throws ArgumentOutOfRangeException when capacity < 1. |
public void Add(AnalyticsEvent analyticsEvent) |
Records the event, dropping the oldest when the log is full. A null event is ignored. |
public void Clear() |
Clears the recorded state owned by this instance. |
| Member | Type | Description |
|---|---|---|
DefaultCapacity |
int |
The default capacity. Declared initializer: 500. |
Default |
SimulatedAnalyticsLog |
The log the simulated provider and the monitor window share unless told otherwise. Declared initializer: new SimulatedAnalyticsLog(). Read-only property. |
Capacity |
int |
Capacity. Read-only property. |
Entries |
IReadOnlyList<AnalyticsEvent> |
A copy of the recorded events, oldest first. Getter returns _entries.ToArray(). |
Added |
Action<AnalyticsEvent> |
Raised after an event was recorded. |
Cleared |
Action |
Raised after the log was emptied. |
SimulatedAnalyticsProvider
Responsible for: The analytics provider that needs no SDK: it is ready at once, records every event in a SimulatedAnalyticsLog for the Editor monitor, and writes it to the Console when the settings ask for that.
Qualified name: Ostryzhnyi.CasualGameCore.Analytics.SimulatedAnalyticsProvider. Declaration: public sealed class SimulatedAnalyticsProvider : IAnalyticsProvider. Source.
| Method | Description |
|---|---|
public void TrackError(AnalyticsError error) |
Accepts an error already sanitized by ErrorReporter, while analytics is ready and consented. |
public SimulatedAnalyticsProvider(AnalyticsSettingsSection settings, SimulatedAnalyticsLog log = null) |
Creates SimulatedAnalyticsProvider with the supplied dependencies and configuration. settings: Read at each event, so an edit during play takes effect on the next one. log: Where events are recorded; SimulatedAnalyticsLog.Default when null. Throws ArgumentNullException when settings == null. |
public void Initialize(Action<bool> complete) |
Starts the provider. complete receives whether it is ready to take events. Throws ArgumentNullException when complete == null. |
public void Track(AnalyticsEvent analyticsEvent) |
Sends one event. Only called while the provider is ready and enabled. |
public void SetEnabled(bool enabled) |
Turns event sending on or off for a provider that is already running, for example when the player withdraws consent. A provider with an SDK maps this to the SDK's own opt-out so the SDK's internal traffic stops too. |
| Member | Type | Description |
|---|---|---|
SupportsErrorReporting |
bool |
False when the backend cannot accept sanitized errors. Getter returns false. |
Namespace: Ostryzhnyi.CasualGameCore.Boosters
BoosterComposition
Responsible for: Connects the booster inventory to the scene's attempt state and mechanic. Both only exist once a scene has loaded, so this runs from the scene's CasualGameInstaller after ProgressionComposition.Connect, and again for the next scene.
Qualified name: Ostryzhnyi.CasualGameCore.Boosters.BoosterComposition. Declaration: public static class BoosterComposition. Source.
| Method | Description |
|---|---|
public static BoosterService Connect(DIContainer container, IGameplayMechanic mechanic) |
Binds the registered BoosterService to the registered progression service and mechanic. Returns null, and binds nothing, when boosters are not composed. Throws ArgumentNullException when container == null. Throws ArgumentNullException when mechanic == null. Returns null when !container.TryResolve(typeof(BoosterService), out var service) || !container.TryResolve(typeof(IProgressionService), out var progression). |
public static HudBoosterController ConnectHud(DIContainer container, Func<IViewService> views = null) |
Builds the HudBoosterController from what container holds and registers it, replacing and disposing the one an earlier scene made. Returns null, and registers nothing, when boosters are not composed. views: Resolved on use; ViewService.Instance when null. Throws ArgumentNullException when container == null. Returns null when !container.TryResolve(typeof(IBoosterService), out var boosters). |
public static OutOfBoosterController ConnectOutOfBooster(DIContainer container, IGameplayMechanic mechanic, Func<IViewService> views = null) |
Builds the OutOfBoosterController for the scene's mechanic from what container holds and registers it, replacing and disposing the one an earlier scene made. Returns null, and registers nothing, when boosters are not composed. views: Resolved on use; ViewService.Instance when null. Throws ArgumentNullException when container == null. Returns null when !container.TryResolve(typeof(IBoosterService), out _). |
BoosterDefinition
Responsible for: One booster, as data. UnlockedByDefault (default on) decides whether a new profile can use it at once; off, it stays locked until IBoosterService.Unlock(id), shows a lock in its HUD slot, is never spent or sold while locked, and a profile saved before unlocking existed keeps every booster unlocked. Id is the stable key the inventory, signals and the mechanic use, so it never changes after creation; the name and icon are free to change. How many a player owns is not stored here: the profile holds the count and starts it from StartingAmount for a new profile, so editing a definition never rewrites an existing count.
Qualified name: Ostryzhnyi.CasualGameCore.Boosters.BoosterDefinition. Declaration: public sealed class BoosterDefinition. Source.
| Member | Type | Description |
|---|---|---|
DefaultStartingAmount |
long |
Default Starting Amount. Declared initializer: 3. |
Id |
string |
Id. Declared initializer: "". |
DisplayName |
string |
Display Name. Declared initializer: "". |
Icon |
Sprite |
Icon. Without an initializer, a new instance uses default(Sprite). |
StartingAmount |
long |
How many a new profile starts with. A negative value counts as 0. Declared initializer: DefaultStartingAmount. |
Pack |
BoosterPack |
Pack. Declared initializer: new BoosterPack(). |
BoosterId |
BoosterId |
The identity the mechanic and the inventory use for this booster. Getter returns new BoosterId(Id). |
InitialCount |
long |
StartingAmount with a negative value counted as 0. Getter returns Math.Max(0, StartingAmount). |
BoosterGranted
Responsible for: Boosters were added to the inventory by the booster reward type: a pack, a rewarded ad, a mission or a daily reward.
Qualified name: Ostryzhnyi.CasualGameCore.Boosters.BoosterGranted. Declaration: public struct BoosterGranted. Source.
| Member | Type | Description |
|---|---|---|
Id |
string |
Id. Without an initializer, a new instance uses default(string). |
Amount |
long |
Amount. Without an initializer, a new instance uses default(long). |
Source |
string |
Source. Without an initializer, a new instance uses default(string). |
BoosterPack
Responsible for: What buying a booster pack gives and costs. The booster definition owns it, so the Shop and the Out of Booster popup price the same pack. The payment reuses the Shop's: real money through a store product, or the Soft or Hard currency.
Qualified name: Ostryzhnyi.CasualGameCore.Boosters.BoosterPack. Declaration: public sealed class BoosterPack. Source.
| Member | Type | Description |
|---|---|---|
DefaultAmount |
long |
Default Amount. Declared initializer: 5. |
DefaultPrice |
long |
Default Price. Declared initializer: 150. |
Amount |
long |
How many boosters one pack grants; at least 1. Declared initializer: DefaultAmount. |
Payment |
ShopPayment |
Starts as DefaultPrice Soft Currency, the price of the Shop's booster placeholders. Declared initializer: new ShopPayment { Method = ShopPaymentMethod.SoftCurrency, Price = DefaultPrice }. |
BoosterPackOfferProvider
Responsible for: Fills a Shop offer that points at a booster pack in from the booster definition: the bundle is the pack's amount of that booster, and the payment is the pack's. The offer keeps its own name and icon, falling back to the definition's, so the Shop and the Out of Booster popup price the same pack and cannot drift apart.
Qualified name: Ostryzhnyi.CasualGameCore.Boosters.BoosterPackOfferProvider. Declaration: public sealed class BoosterPackOfferProvider : IShopOfferResolver. Source.
| Method | Description |
|---|---|
public BoosterPackOfferProvider(BoostersSettingsSection boosters) |
Creates BoosterPackOfferProvider with the supplied dependencies and configuration. Throws ArgumentNullException when boosters == null. |
public ShopOffer Resolve(ShopOffer offer) |
The offer as sold. An offer with no booster reference is returned as it is. An offer whose booster no longer exists, or whose pack has no payment, is null: it cannot be sold. Returns null when offer == null. Returns null when pack?.Payment == null. |
public ShopOffer FindOffer(ShopSettingsSection shop, string boosterId) |
The Shop offer, as sold, that sells this booster's pack, or null when there is none. The Out of Booster popup buys it through the purchase flow, so it pays the Shop's price. Returns null when shop == null || string.IsNullOrWhiteSpace(boosterId). Returns null after the preceding guards/branches. |
BoosterRewardHandler
Responsible for: The booster reward type: its items are the booster ids, and a grant adds that many to the inventory. Shop packs, rewarded ads, missions and daily rewards all reach the inventory through this handler and the grantor's tokens. Given the boosters settings it also describes a booster by its display name and icon for the reward collection screen.
Qualified name: Ostryzhnyi.CasualGameCore.Boosters.BoosterRewardHandler. Declaration: public sealed class BoosterRewardHandler : IRewardHandler, IRewardDescriber. Source.
| Method | Description |
|---|---|
public BoosterRewardHandler() |
An authoring instance for the Editor catalog: it lists boosters but cannot grant. |
public BoosterRewardHandler(IBoosterService boosters = null, BoostersSettingsSection settings = null) |
Creates BoosterRewardHandler with the supplied dependencies and configuration. boosters: The inventory to grant into; null makes an authoring-only handler that lists the ids but grants nothing. settings: The boosters to describe; without it a booster is shown by its id. |
public bool TryDescribe(string itemId, out string label, out Sprite icon) |
The display label and icon for an item, or false when the item is unknown. The icon may be null. |
public IReadOnlyList<string> GetItemChoices(CasualGameSettings settings) |
The item ids an entry of this type can name, for the Editor dropdown. |
public bool Grant(string itemId, long amount, string source) |
Grants amount of the item. Returns false, granting nothing, when the item is unknown or the handler cannot grant. source says why, for the owning signal. Returns false when _boosters == null. |
| Member | Type | Description |
|---|---|---|
TypeId |
string |
The id entries use to pick this handler, for example currency. Getter returns ShopSettingsSection.BoosterRewardType. |
BoosterService
Responsible for: Persisted counts and the acknowledged use of a booster. A use marks the service busy, asks the mechanic to apply the effect and commits only on an acknowledgement of true: a false, a timeout, or a mechanic that throws leaves the count as it was and frees the service, and an answer that arrives late is ignored.
Qualified name: Ostryzhnyi.CasualGameCore.Boosters.BoosterService. Declaration: public sealed class BoosterService : IBoosterService. Source.
One use runs at a time across all boosters, because a mechanic applies one effect at a time. A count is saved before the signal that reports it, and the grantor saves its token after the handler returns, so a crash between the two can repeat one grant of a redelivered order; that window is a single write wide.
| Method | Description |
|---|---|
public BoosterService(BoostersSave save, BoostersSettingsSection settings, OstryzhnyiSignal<BoosterUsed> used = null, OstryzhnyiSignal<BoosterGranted> granted = null, double timeoutSeconds = DefaultTimeoutSeconds, Action<IEnumerator> run = null, Func<double> seconds = null) |
Creates BoosterService with the supplied dependencies and configuration. timeoutSeconds: How long the mechanic may take to answer; must be positive and finite. run: Starts a coroutine; the shared tween core's runner when null. seconds: A monotonic clock in seconds; real time when null. Throws ArgumentOutOfRangeException when !(timeoutSeconds > 0) || double.IsInfinity(timeoutSeconds). Throws ArgumentNullException when save == null. Throws ArgumentNullException when settings == null. |
public void Bind(IProgressionService progression, IGameplayMechanic mechanic) |
Connects the attempt state and the mechanic of the scene that just loaded. Before it is called, and after the progression service is replaced by another scene's, a use is BoosterUseResult.NotInGameplay. |
public long GetCount(string id) |
How many the player owns. A booster seen for the first time starts at its definition's starting amount and keeps that count from then on, whatever the definition says later. Zero for an unknown id. |
public void TryUse(string id, Action<BoosterUseResult> complete = null) |
Uses one booster. It needs a running attempt and a count above zero; the mechanic is then asked to apply the effect, and the count drops, is saved and BoosterUsed is raised only when the mechanic acknowledges it. complete is called exactly once, at once for a refusal, and says how it ended. |
public bool Grant(string id, long amount, string source) |
Adds boosters to the inventory. Returns false, changing nothing, for an unknown id or an amount below 1. Raises BoosterGranted after the count is saved. Returns false when amount < 1 || _settings.Find(id) == null. |
| Member | Type | Description |
|---|---|---|
DefaultTimeoutSeconds |
double |
Default Timeout Seconds. Declared initializer: 10. |
IsBusy |
bool |
True while a use is waiting for the mechanic. A second use is refused until it ends. Getter returns _pending != null. |
BoosterSlotViewData
Responsible for: What one HUD booster slot shows: data in, nothing the View could decide for itself. An empty slot shows a plus instead of its count and still takes a tap, because tapping it opens the Out of Booster flow.
Qualified name: Ostryzhnyi.CasualGameCore.Boosters.BoosterSlotViewData. Declaration: public readonly struct BoosterSlotViewData. Source.
| Method | Description |
|---|---|
public BoosterSlotViewData(BoosterId id, string name, Sprite icon, long count) |
Creates BoosterSlotViewData with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
Id |
BoosterId |
The booster a tap on this slot asks to use. Read-only property. |
Name |
string |
Name. Read-only property. |
Icon |
Sprite |
The booster's icon; null keeps the slot's prefab art. Read-only property. |
Count |
long |
How many the player owns. Read-only property. |
IsEmpty |
bool |
Is Empty. Getter returns Count <= 0. |
BoosterUseResult
Responsible for: How a use request ended. Only Used spent a booster; everything else left the count as it was.
Qualified name: Ostryzhnyi.CasualGameCore.Boosters.BoosterUseResult. Declaration: public enum BoosterUseResult. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Used |
0 |
The mechanic acknowledged the effect; the count dropped by one and BoosterUsed was raised. |
NotInGameplay |
1 |
The attempt is not running, or no mechanic is connected. |
OutOfStock |
2 |
The player has none left; the Out of Booster flow takes over. |
Busy |
3 |
Another use is still waiting for the mechanic, so this tap was ignored. |
Unknown |
4 |
No booster has this id. |
Declined |
5 |
The mechanic answered that it could not apply the effect. |
TimedOut |
6 |
The mechanic never answered within the timeout. |
BoosterUsed
Responsible for: A booster use the mechanic acknowledged: the count has dropped by one.
Qualified name: Ostryzhnyi.CasualGameCore.Boosters.BoosterUsed. Declaration: public struct BoosterUsed. Source.
| Member | Type | Description |
|---|---|---|
Id |
string |
Id. Without an initializer, a new instance uses default(string). |
BoostersData
Responsible for: Stores booster inventory counts.
Qualified name: Ostryzhnyi.CasualGameCore.Boosters.BoostersData. Declaration: public sealed class BoostersData. Source.
| Member | Type | Description |
|---|---|---|
Counts |
Dictionary<string, long> |
Counts. Declared initializer: new Dictionary<string, long>(). |
BoostersFeature
Responsible for: Composes boosters when the Boosters toggle is on: registers the saved inventory as IBoosterService and adds the booster reward handler to the economy's registry. With the toggle off nothing is registered, so a bundle with a booster entry is skipped with the registry's one warning. Registration fails, and Boosters stay off, when the economy is not composed. It also makes sure the Shop's purchase flow exists, so Out of Booster can sell a pack when the Shop is off.
Qualified name: Ostryzhnyi.CasualGameCore.Boosters.BoostersFeature. Declaration: public sealed class BoostersFeature : ICasualFeature. Source.
| Method | Description |
|---|---|
public BoostersFeature(CasualGameSettings settings) |
Creates BoostersFeature with the supplied dependencies and configuration. settings: The settings whose Boosters toggle decides whether the feature composes. Throws ArgumentNullException when settings == null. |
public void Register(DIContainer container) |
Registers this feature’s services and signal bindings in the supplied container. Throws InvalidOperationException on the corresponding guard path. |
| Member | Type | Description |
|---|---|---|
FeatureId |
string |
Feature Id. Declared initializer: "Boosters". |
Id |
string |
Id. Getter returns FeatureId. |
Enabled |
bool |
Enabled. Getter returns _settings.Toggles.Boosters. |
Priority |
int |
After the Shop, which only reads the Boosters gate when it lists a booster card. Getter returns int.MinValue + 9. |
BoostersSave
Responsible for: How many of each booster the player owns. Holds counts only: a definition never rewrites a count that is already here, and an id with no count has not been initialized yet. Found by the Saves catalog scan.
Qualified name: Ostryzhnyi.CasualGameCore.Boosters.BoostersSave. Declaration: public sealed class BoostersSave : VersionedSaveModel<BoostersData>. Source.
| Method | Description |
|---|---|
public bool TryGetCount(string id, out long count) |
True, with the saved count, when this booster has been initialized for the profile. |
public void SetCount(string id, long count) |
Stores the count (never below 0) and saves it before returning. Throws ArgumentNullException when id == null. |
BoostersSettingsSection
Responsible for: The Boosters settings section: the booster definitions. A section that was never saved starts with the three default boosters; each is edited on its own.
Qualified name: Ostryzhnyi.CasualGameCore.Boosters.BoostersSettingsSection. Declaration: public sealed class BoostersSettingsSection : ICasualSettingsSection. Source.
| Method | Description |
|---|---|
public BoostersSettingsSection() |
Creates BoostersSettingsSection with the supplied dependencies and configuration. |
public BoosterDefinition Find(string id) |
The booster with this id, or null when there is none. |
public bool TryAdd(string id, out string message) |
Adds a booster with the default pack and starting amount. Fails with a message, and changes nothing, when the id is empty or already used. Returns false when trimmed.Length == 0. Returns false when Find(trimmed) != null. |
public bool TryRemove(string id, out string message) |
Removes a booster. Fails with a message, and changes nothing, for an unknown id. Returns false when booster == null. |
| Member | Type | Description |
|---|---|---|
Boosters |
List<BoosterDefinition> |
Boosters. Declared initializer: new List<BoosterDefinition>(). |
UseTimeoutSeconds |
float |
How long the mechanic may take to acknowledge a booster use before the count is left unchanged. A value that is not positive and finite falls back to BoosterService.DefaultTimeoutSeconds. Declared initializer: (float)BoosterService.DefaultTimeoutSeconds. |
EffectiveUseTimeoutSeconds |
double |
UseTimeoutSeconds, or the default when it is not positive and finite. Getter returns UseTimeoutSeconds > 0 && !float.IsInfinity(UseTimeoutSeconds) ? UseTimeoutSeconds : BoosterService.DefaultTimeoutSeconds. |
HudBoosterController
Responsible for: Binds the HUD's booster slots to the inventory. Each time the HUD opens it shows one slot per booster definition with the live count, and keeps them current as boosters are used and granted. A tap asks the inventory to use the booster; when the player has none it opens the Out of Booster popup instead and raises OutOfBoosterRequested for the flow that fills it. A tap while another use is waiting for the mechanic does nothing. Knows the HUD View only.
Qualified name: Ostryzhnyi.CasualGameCore.Boosters.HudBoosterController. Declaration: public sealed class HudBoosterController : IDisposable. Source.
Without a View service the controller stays inert. While the Boosters feature is not enabled on the gate the slots stay hidden.
| Method | Description |
|---|---|
public HudBoosterController(Func<IViewService> views, IBoosterService boosters, BoostersSettingsSection settings, IFeatureGate gate = null, OstryzhnyiSignal<BoosterUsed> used = null, OstryzhnyiSignal<BoosterGranted> granted = null, OstryzhnyiSignal<OutOfBoosterRequested> outOfBooster = null) |
Creates HudBoosterController with the supplied dependencies and configuration. views: Resolved once; without a View service the controller stays inert. gate: The slots show only while BoostersFeature.FeatureId is enabled; always when null. Throws ArgumentNullException when views == null. Throws ArgumentNullException when boosters == null. Throws ArgumentNullException when settings == null. |
public void Dispose() |
Releases this instance’s owned subscriptions or pending work. Call it when the owning flow ends. |
IBoosterService
Responsible for: The booster inventory and the use path. Core owns the count and the spending; the mechanic owns the effect.
Qualified name: Ostryzhnyi.CasualGameCore.Boosters.IBoosterService. Declaration: public interface IBoosterService. Source.
| Method | Description |
|---|---|
long GetCount(string id) |
How many the player owns. A booster seen for the first time starts at its definition's starting amount and keeps that count from then on, whatever the definition says later. Zero for an unknown id. |
void TryUse(string id, Action<BoosterUseResult> complete = null) |
Uses one booster. It needs a running attempt and a count above zero; the mechanic is then asked to apply the effect, and the count drops, is saved and BoosterUsed is raised only when the mechanic acknowledges it. complete is called exactly once, at once for a refusal, and says how it ended. |
bool Grant(string id, long amount, string source) |
Adds boosters to the inventory. Returns false, changing nothing, for an unknown id or an amount below 1. Raises BoosterGranted after the count is saved. |
| Member | Type | Description |
|---|---|---|
IsBusy |
bool |
True while a use is waiting for the mechanic. A second use is refused until it ends. Read-only property. |
OutOfBoosterController
Responsible for: Refills an empty booster without leaving gameplay. When the HUD announces a booster that ran out, the popup that opens shows that booster and its pack. Buy runs the Shop's PurchaseFlow for the pack offer, so it pays the Shop's price; the ad option is the shared rewarded button configured with a one-booster reward and has no counter or cooldown. A success closes the popup. A failure leaves it open with the notice the flow or the button shows. The mechanic is paused while the popup is open and resumed when it closes. Knows the Out of Booster View only.
Qualified name: Ostryzhnyi.CasualGameCore.Boosters.OutOfBoosterController. Declaration: public sealed class OutOfBoosterController : IDisposable. Source.
Without a View service the controller stays inert.
| Method | Description |
|---|---|
public OutOfBoosterController(Func<IViewService> views, BoostersSettingsSection boosters, ShopSettingsSection shop, BoosterPackOfferProvider packs, IGameplayMechanic mechanic, PurchaseFlow purchases = null, IIapService iap = null, IAdsService ads = null, IRewardGrantor grantor = null, INoticeService notices = null, IFeatureGate gate = null, OstryzhnyiSignal<OutOfBoosterRequested> requested = null) |
Creates OutOfBoosterController with the supplied dependencies and configuration. views: Resolved once; without a View service the controller stays inert. mechanic: Paused while the popup is open; may be null. purchases: Null when the Shop and Boosters are not composed, which hides Buy. iap: Null when IAP is not composed; a store-paid pack then shows the price text it was configured with. ads: Null when Ads are not composed; the ad option then reports the ad as unavailable. gate: Decides whether a store-paid pack is for sale (Iap) and whether the ad option shows (Ads). Throws ArgumentNullException when views == null. Throws ArgumentNullException when boosters == null. Throws ArgumentNullException when shop == null. Throws ArgumentNullException when packs == null. |
public void Dispose() |
Releases this instance’s owned subscriptions or pending work. Call it when the owning flow ends. |
OutOfBoosterRequested
Responsible for: The player tapped a booster they have none of. The Out of Booster popup has been opened for it; U5's flow reads Id to know which pack to offer.
Qualified name: Ostryzhnyi.CasualGameCore.Boosters.OutOfBoosterRequested. Declaration: public struct OutOfBoosterRequested. Source.
| Member | Type | Description |
|---|---|---|
Id |
string |
Id. Without an initializer, a new instance uses default(string). |
OutOfBoosterViewData
Responsible for: What the Out of Booster popup shows: the booster that ran out and its pack, as data. The ad option is not listed here because it hides itself when ads are off.
Qualified name: Ostryzhnyi.CasualGameCore.Boosters.OutOfBoosterViewData. Declaration: public readonly struct OutOfBoosterViewData. Source.
| Method | Description |
|---|---|
public OutOfBoosterViewData(string boosterName, Sprite icon, long packAmount, string priceText, bool buyAvailable) |
Creates OutOfBoosterViewData with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
BoosterName |
string |
Booster Name. Read-only property. |
Icon |
Sprite |
The booster's icon; null keeps the popup's prefab art. Read-only property. |
PackAmount |
long |
How many one purchase grants. Read-only property. |
PriceText |
string |
The pack's price as the Shop shows it. Read-only property. |
BuyAvailable |
bool |
False hides the Buy option: the booster has no pack on sale, or its price needs a store that is switched off. Read-only property. |
Namespace: Ostryzhnyi.CasualGameCore.Chest
ChestBoard
Responsible for: The nine cells of one chest, every reward already rolled. A board never changes after it is made: it has no way to reroll or replace a cell, it copies the cells it is given, and the lists it hands out are read-only.
Qualified name: Ostryzhnyi.CasualGameCore.Chest.ChestBoard. Declaration: public sealed class ChestBoard. Source.
| Method | Description |
|---|---|
public ChestBoard(IReadOnlyList<IReadOnlyList<ResolvedReward>> cells, int jackpotIndex) |
Creates ChestBoard with the supplied dependencies and configuration. cells: The resolved rewards of each cell; exactly ChestSettingsSection.CellCount of them, none empty. jackpotIndex: The cell that holds the jackpot. Throws ArgumentNullException when cells == null. Throws ArgumentException when cells.Count != ChestSettingsSection.CellCount. Throws ArgumentException when cells.Any(cell => cell == null || cell.Count == 0). Throws ArgumentOutOfRangeException when jackpotIndex < 0 || jackpotIndex >= ChestSettingsSection.CellCount. |
| Member | Type | Description |
|---|---|---|
CellCount |
int |
How many cells the board has. Getter returns _cells.Length. |
JackpotIndex |
int |
The cell that holds the jackpot. Read-only property. |
this |
IReadOnlyList<ResolvedReward> |
What the cell grants when it is opened. Throws ArgumentOutOfRangeException when cell < 0 || cell >= _cells.Length. Read-only property. |
ChestBoardGenerator
Responsible for: Makes a chest's board. Pure: it reads only its arguments and draws only from the supplied IRandom, so a seeded random gives the same board every time. All nine cells are settled here and nothing is rolled later.
Qualified name: Ostryzhnyi.CasualGameCore.Chest.ChestBoardGenerator. Declaration: public static class ChestBoardGenerator. Source.
| Method | Description |
|---|---|
public static ChestBoard Generate(ChestSettingsSection settings, IRandom random) |
Draws the jackpot cell, resolves the jackpot, then fills the other eight cells in order, each with a pool rule picked by weight and its amounts rolled from their ranges. Rules with a weight of 0 or less are never picked, and a rule may hold several reward types. Throws InvalidOperationException: The pool has no rule with a positive weight, or the jackpot or such a rule grants nothing. The validator blocks these. Throws ArgumentNullException when settings == null. Throws ArgumentNullException when random == null. Throws InvalidOperationException when pool.Count == 0. Throws InvalidOperationException when !GrantsSomething(settings.Jackpot). Throws InvalidOperationException when pool.Any(rule => !GrantsSomething(rule.Bundle)). |
ChestCellOpened
Responsible for: A cell was opened and its bundle granted.
Qualified name: Ostryzhnyi.CasualGameCore.Chest.ChestCellOpened. Declaration: public struct ChestCellOpened. Source.
| Member | Type | Description |
|---|---|---|
SessionId |
string |
Session Id. Without an initializer, a new instance uses default(string). |
Cell |
int |
Cell. Without an initializer, a new instance uses default(int). |
IsJackpot |
bool |
Is Jackpot. Without an initializer, a new instance uses default(bool). |
KeysLeft |
int |
Keys Left. Without an initializer, a new instance uses default(int). |
ChestCellViewData
Responsible for: What one cell of the Chest screen shows: closed, or opened with what it granted.
Qualified name: Ostryzhnyi.CasualGameCore.Chest.ChestCellViewData. Declaration: public readonly struct ChestCellViewData. Source.
| Method | Description |
|---|---|
public ChestCellViewData(int cell, bool isOpened, bool isJackpot, string rewardText, Sprite icon, bool isMixed = false) |
Creates ChestCellViewData with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
Cell |
int |
The zero-based cell; the view's tap reports it. Read-only property. |
IsOpened |
bool |
True once the cell is open. A closed cell shows nothing of its contents, the jackpot included. Read-only property. |
IsJackpot |
bool |
True for the jackpot cell, but only worth showing once IsOpened. Read-only property. |
RewardText |
string |
A short text for what the opened cell granted, for example 50 Coin, 1 Booster 1; empty while closed. Read-only property. |
Icon |
Sprite |
The icon of the first granted reward that has one; null when none has, and always null while closed. Read-only property. |
IsMixed |
bool |
True when the opened cell granted more than one reward, for example coins and gems together. Read-only property. |
ChestComposition
Responsible for: Binds the Chest popup for the scene. It runs from the scene's CasualGameInstaller, because the popup lives in the scene's View service, and replaces the controller an earlier scene made.
Qualified name: Ostryzhnyi.CasualGameCore.Chest.ChestComposition. Declaration: public static class ChestComposition. Source.
| Method | Description |
|---|---|
public static ChestController Connect(DIContainer container, Func<IViewService> views = null) |
Builds the key purchases and the ChestController over the composed chest. Returns null, and does nothing, when the Chest is not composed or the economy parts it needs are missing. views: Resolved on use; ViewService.Instance when null. Throws ArgumentNullException when container == null. Returns null when !container.TryResolve(typeof(IChestService), out var chest) || !container.TryResolve(typeof(AffordabilityGuard), out var guard) || !container.TryResolve(typeof(INoticeService), out var notices) || !container.TryResolve(typeof(RewardHandlerRegistry), out var handlers) || !container.TryResolve(typeof(OstryzhnyiSignal<ChestStarted>), out var started) || !container.TryResolve(typeof(OstryzhnyiSignal<ChestCellOpened>), out var opened) || !container.TryResolve(typeof(OstryzhnyiSignal<ChestKeysAdded>), out var keysAdded) || !container.TryResolve(typeof(OstryzhnyiSignal<ChestEnded>), out var ended). |
ChestController
Responsible for: Binds the Chest popup to the chest in progress. When a chest starts it opens the popup, which then shows the nine cells, the key counter and the Get Keys buttons; a tap on a closed cell opens it, or points at the Get Keys options when there is no key; a tap on a Get Keys button buys that pack; Exit, and the system back key, end the chest. The summary of an ended chest is the chest step's. Knows the Chest popup only.
Qualified name: Ostryzhnyi.CasualGameCore.Chest.ChestController. Declaration: public sealed class ChestController : IDisposable. Source.
| Method | Description |
|---|---|
public ChestController(Func<IViewService> views, IChestService chest, ChestKeyPurchases purchases, ChestSettingsSection settings, EconomySettingsSection economy, RewardHandlerRegistry handlers, OstryzhnyiSignal<ChestStarted> started, OstryzhnyiSignal<ChestCellOpened> opened, OstryzhnyiSignal<ChestKeysAdded> keysAdded, OstryzhnyiSignal<ChestEnded> ended) |
Creates ChestController with the supplied dependencies and configuration. views: Resolved once; without a View service the controller stays inert. Throws ArgumentNullException when views == null. Throws ArgumentNullException when chest == null. Throws ArgumentNullException when purchases == null. Throws ArgumentNullException when settings == null. Throws ArgumentNullException when economy == null. Throws ArgumentNullException when handlers == null. Throws ArgumentNullException when started == null. Throws ArgumentNullException when opened == null. Throws ArgumentNullException when keysAdded == null. Throws ArgumentNullException when ended == null. |
public IReadOnlyList<ChestCellViewData> BuildCells() |
The cells the popup would show right now, one per cell of the chest in progress; empty when there is no chest. |
public ChestKeyOfferViewData BuildAdOffer() |
The ad button as the popup would show it right now. |
public ChestKeyOfferViewData BuildGemOffer() |
The Hard Currency button as the popup would show it right now, with its price. |
public void Dispose() |
Releases this instance’s owned subscriptions or pending work. Call it when the owning flow ends. |
ChestEnded
Responsible for: The chest was ended and its unopened cells and unused keys are gone.
Qualified name: Ostryzhnyi.CasualGameCore.Chest.ChestEnded. Declaration: public struct ChestEnded. Source.
| Member | Type | Description |
|---|---|---|
SessionId |
string |
Session Id. Without an initializer, a new instance uses default(string). |
OpenedCount |
int |
Opened Count. Without an initializer, a new instance uses default(int). |
ChestFeature
Responsible for: Composes the Chest when its toggle is on: registers the IChestService and its signals over the economy's reward grantor, and the ChestStep the win flow runs. A disabled Chest composes nothing, so the win flow has no chest step. The chest needs the economy's grantor and reward presenter; without them registration fails and leaves nothing half composed.
Qualified name: Ostryzhnyi.CasualGameCore.Chest.ChestFeature. Declaration: public sealed class ChestFeature : ICasualFeature. Source.
| Method | Description |
|---|---|
public ChestFeature(CasualGameSettings settings) |
Creates ChestFeature with the supplied dependencies and configuration. settings: The settings whose Chest toggle decides whether the feature composes. Throws ArgumentNullException when settings == null. |
public void Register(DIContainer container) |
Registers this feature’s services and signal bindings in the supplied container. Throws InvalidOperationException when !container.TryResolve(typeof(IRewardGrantor), out var grantor). Throws InvalidOperationException when !container.TryResolve(typeof(IRewardPresenter), out var presenter). |
| Member | Type | Description |
|---|---|---|
FeatureId |
string |
Feature Id. Declared initializer: "Chest". |
Id |
string |
Id. Getter returns FeatureId. |
Enabled |
bool |
Enabled. Getter returns _settings.Toggles.Chest. |
Priority |
int |
After the Missions feature, and so after the economy that provides the grantor. Getter returns int.MinValue + 12. |
ChestKeyOfferViewData
Responsible for: What one Get Keys button of the Chest screen shows: whether it is there, how many keys it gives, and what it costs.
Qualified name: Ostryzhnyi.CasualGameCore.Chest.ChestKeyOfferViewData. Declaration: public readonly struct ChestKeyOfferViewData. Source.
| Method | Description |
|---|---|
public ChestKeyOfferViewData(bool isOffered, int keys, string priceText, bool? isShown = null, long price = 0) |
Creates ChestKeyOfferViewData with the supplied dependencies and configuration. isShown: Whether the button is on the screen at all; defaults to isOffered. price: The Hard Currency price as a number, 0 for the ad pack. |
| Member | Type | Description |
|---|---|---|
IsOffered |
bool |
False makes the button inactive: it can be bought no more in this chest (the pack was taken). It stays on the screen. Read-only property. |
IsShown |
bool |
False hides the button: the pack gives no keys here or is not available at all (ads off), so there is nothing to show. Read-only property. |
Price |
long |
The Hard Currency price as a number; 0 for the ad pack. Read-only property. |
Keys |
int |
The keys the pack adds. Read-only property. |
PriceText |
string |
The Hard Currency price, for example 10 Gem; empty for the ad pack. Read-only property. |
ChestKeyPack
Responsible for: The two key packs a player can add to the free keys.
Qualified name: Ostryzhnyi.CasualGameCore.Chest.ChestKeyPack. Declaration: public enum ChestKeyPack. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Ad |
0 |
Ad. |
Gem |
1 |
Gem. |
ChestKeyPackOutcome
Responsible for: What happened when a key pack was taken.
Qualified name: Ostryzhnyi.CasualGameCore.Chest.ChestKeyPackOutcome. Declaration: public enum ChestKeyPackOutcome. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Added |
0 |
The pack's keys were added. |
AlreadyUsed |
1 |
The pack was taken before, so no keys were added. |
NoSession |
2 |
No chest is in progress. Nothing changed. |
ChestKeyPackResult
Responsible for: The outcome of taking a key pack, how many keys it added, and the keys the player has now.
Qualified name: Ostryzhnyi.CasualGameCore.Chest.ChestKeyPackResult. Declaration: public readonly struct ChestKeyPackResult. Source.
| Method | Description |
|---|---|
public ChestKeyPackResult(ChestKeyPackOutcome outcome, int added, int keys) |
Creates ChestKeyPackResult with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
Outcome |
ChestKeyPackOutcome |
Outcome. Read-only property. |
Added |
int |
The keys this call added; 0 unless Outcome is ChestKeyPackOutcome.Added. Read-only property. |
Keys |
int |
Keys. Read-only property. |
ChestKeyPackSettings
Responsible for: How many keys each of the chest's three key packs gives and what the Hard Currency pack costs. Each pack is taken at most once per chest; together they must reach ChestSettingsSection.CellCount so every cell can be opened.
Qualified name: Ostryzhnyi.CasualGameCore.Chest.ChestKeyPackSettings. Declaration: public sealed class ChestKeyPackSettings. Source.
| Member | Type | Description |
|---|---|---|
FreeKeys |
int |
Keys the player starts the chest with. Declared initializer: DefaultPackKeys. |
AdKeys |
int |
Keys one completed rewarded ad adds. Declared initializer: DefaultPackKeys. |
GemKeys |
int |
Keys the Hard Currency pack adds. Declared initializer: DefaultPackKeys. |
GemPackPrice |
long |
What the Hard Currency pack costs, in the Hard Currency. Declared initializer: DefaultGemPackPrice. |
TotalKeys |
int |
Every key the three packs give together. Getter returns FreeKeys + AdKeys + GemKeys. |
ChestKeyPurchaseOutcome
Responsible for: What happened when a key pack was bought.
Qualified name: Ostryzhnyi.CasualGameCore.Chest.ChestKeyPurchaseOutcome. Declaration: public enum ChestKeyPurchaseOutcome. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Added |
0 |
The pack was paid for and its keys were added. |
AlreadyUsed |
1 |
The pack was taken before in this chest. Nothing was requested or spent. |
NoSession |
2 |
No chest is in progress, or it ended while the ad was playing. Nothing was spent and no keys were added. |
NotOffered |
3 |
The pack is not offered: Ads is off or not composed, or the pack gives no keys. Nothing was requested or spent. |
Busy |
4 |
An ad for this pack is already playing, so the tap was ignored. |
Insufficient |
5 |
The Hard Currency is short. Nothing was spent and the player was told what is missing. |
AdUnavailable |
6 |
The ad did not complete. No keys were added and the player was told to try again. |
Failed |
7 |
The price is malformed. Nothing was spent and no keys were added. |
ChestKeyPurchaseResult
Responsible for: The outcome of buying a key pack, the keys it added, and the keys the player has now.
Qualified name: Ostryzhnyi.CasualGameCore.Chest.ChestKeyPurchaseResult. Declaration: public readonly struct ChestKeyPurchaseResult. Source.
| Method | Description |
|---|---|
public ChestKeyPurchaseResult(ChestKeyPurchaseOutcome outcome, int added, int keys) |
Creates ChestKeyPurchaseResult with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
Outcome |
ChestKeyPurchaseOutcome |
Outcome. Read-only property. |
Added |
int |
The keys this purchase added; 0 unless Outcome is ChestKeyPurchaseOutcome.Added. Read-only property. |
Keys |
int |
Keys. Read-only property. |
ChestKeyPurchases
Responsible for: Buys the chest's two key packs. The ad pack requests a rewarded ad under AdPlacement.ChestKey and adds its keys only when the ad completes; any other ending shows the ad-unavailable notice. The Hard Currency pack is charged through AffordabilityGuard, which shows what is missing when the player is short. A failed purchase changes nothing and leaves the chest open, and each pack is charged at most once per chest.
Qualified name: Ostryzhnyi.CasualGameCore.Chest.ChestKeyPurchases. Declaration: public sealed class ChestKeyPurchases. Source.
| Method | Description |
|---|---|
public ChestKeyPurchases(IChestService chest, ChestSettingsSection settings, AffordabilityGuard guard, INoticeService notices, IAdsService ads = null, IFeatureGate gate = null) |
Creates ChestKeyPurchases with the supplied dependencies and configuration. ads: The ad service; null when ads are not composed, which hides the ad pack. gate: Asked whether Ads is on; null counts as on. Throws ArgumentNullException when chest == null. Throws ArgumentNullException when settings == null. Throws ArgumentNullException when guard == null. Throws ArgumentNullException when notices == null. |
public void BuyAdPack(Action<ChestKeyPurchaseResult> complete = null) |
Requests the ad. complete, if given, is called exactly once: at once when nothing is requested, and otherwise when the ad ends. |
public ChestKeyPurchaseResult BuyGemPack() |
Charges the configured price and adds the pack's keys. |
| Member | Type | Description |
|---|---|---|
SpendReason |
string |
The reason the Hard Currency spend is recorded under. Declared initializer: "chest-keys". |
IsAdPackOffered |
bool |
True while a chest is in progress, its ad pack is unused and gives keys, and ads are on. Getter returns Refusal(ChestKeyPack.Ad) == null. |
IsGemPackOffered |
bool |
True while a chest is in progress and its Hard Currency pack is unused and gives keys. Getter returns Refusal(ChestKeyPack.Gem) == null. |
IsAdPackShown |
bool |
True while the ad pack's button belongs on the screen: offered, or taken already and so shown inactive. Getter returns IsShown(ChestKeyPack.Ad). |
IsGemPackShown |
bool |
True while the Hard Currency pack's button belongs on the screen: offered, or taken already and so shown inactive. Getter returns IsShown(ChestKeyPack.Gem). |
ChestKeysAdded
Responsible for: A key pack added keys.
Qualified name: Ostryzhnyi.CasualGameCore.Chest.ChestKeysAdded. Declaration: public struct ChestKeysAdded. Source.
| Member | Type | Description |
|---|---|---|
SessionId |
string |
Session Id. Without an initializer, a new instance uses default(string). |
Pack |
ChestKeyPack |
Pack. Without an initializer, a new instance uses default(ChestKeyPack). |
Added |
int |
Added. Without an initializer, a new instance uses default(int). |
Keys |
int |
Keys. Without an initializer, a new instance uses default(int). |
ChestOpenOutcome
Responsible for: What happened when a cell was opened.
Qualified name: Ostryzhnyi.CasualGameCore.Chest.ChestOpenOutcome. Declaration: public enum ChestOpenOutcome. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Opened |
0 |
The cell's bundle was granted, the cell is open and one key was spent. |
AlreadyOpened |
1 |
The cell was already open, so nothing was granted and no key was spent. |
NoKeys |
2 |
The player has no key. Nothing changed. |
InvalidCell |
3 |
There is no cell with that number. Nothing changed. |
NoSession |
4 |
No chest is in progress. Nothing changed. |
GrantFailed |
5 |
The bundle could not be granted. The cell is still closed and the key is kept, so the player can try again. |
ChestOpenResult
Responsible for: The outcome of opening a cell, and what that call granted.
Qualified name: Ostryzhnyi.CasualGameCore.Chest.ChestOpenResult. Declaration: public readonly struct ChestOpenResult. Source.
| Method | Description |
|---|---|
public ChestOpenResult(ChestOpenOutcome outcome, int cell, IReadOnlyList<ResolvedReward> rewards, bool isJackpot, int keysLeft) |
Creates ChestOpenResult with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
Outcome |
ChestOpenOutcome |
Outcome. Read-only property. |
Cell |
int |
Cell. Read-only property. |
Rewards |
IReadOnlyList<ResolvedReward> |
What this call granted; empty unless Outcome is ChestOpenOutcome.Opened and the grantor had not already granted the cell. Read-only property. |
IsJackpot |
bool |
True when the opened cell holds the jackpot. Read-only property. |
KeysLeft |
int |
The keys left after this call. Read-only property. |
ChestPoolRule
Responsible for: One entry of the chest's reward pool: a bundle that can fill a cell, and how likely it is relative to the other rules. A bundle may hold several reward types, so one cell can pay out more than one kind of reward.
Qualified name: Ostryzhnyi.CasualGameCore.Chest.ChestPoolRule. Declaration: public sealed class ChestPoolRule. Source.
| Member | Type | Description |
|---|---|---|
Weight |
int |
Relative chance of this rule; a rule with weight 0 is never picked. Declared initializer: 1. |
Bundle |
RewardBundle |
What a cell filled by this rule grants, each amount rolled from its range. Declared initializer: new RewardBundle(). |
ChestSchedule
Responsible for: The Chest's IChestSchedule: a chest after every N-th unit, N from ChestSettingsSection.Interval. It reads the section each time, so an edit made after composition applies at once. An interval below 1, which the validator blocks in a build, acts as 1 rather than dividing by zero.
Qualified name: Ostryzhnyi.CasualGameCore.Chest.ChestSchedule. Declaration: public sealed class ChestSchedule : IChestSchedule. Source.
| Method | Description |
|---|---|
public ChestSchedule(ChestSettingsSection settings) |
Creates ChestSchedule with the supplied dependencies and configuration. Throws ArgumentNullException when settings == null. |
public bool IsChestLevel(int unitIndex) |
True when winning the unit at zero-based unitIndex opens a chest: its one-based number is a multiple of Interval. |
| Member | Type | Description |
|---|---|---|
Interval |
int |
Every how many units a chest is offered. Always at least 1; 1 offers one after every win. Getter returns Math.Max(1, _settings.Interval). |
ChestService
Responsible for: The IChestService: keeps the one chest in progress in memory, generates its board with ChestBoardGenerator, and grants each opened cell through IRewardGrantor. It never touches the save layer, so a new instance, as after an app restart, has no chest.
Qualified name: Ostryzhnyi.CasualGameCore.Chest.ChestService. Declaration: public sealed class ChestService : IChestService. Source.
| Method | Description |
|---|---|
public ChestService(ChestSettingsSection settings, IRewardGrantor grantor, IRandom random, OstryzhnyiSignal<ChestStarted> started, OstryzhnyiSignal<ChestCellOpened> opened, OstryzhnyiSignal<ChestKeysAdded> keysAdded, OstryzhnyiSignal<ChestEnded> ended) |
Creates ChestService with the supplied dependencies and configuration. Throws ArgumentNullException when settings == null. Throws ArgumentNullException when grantor == null. Throws ArgumentNullException when random == null. Throws ArgumentNullException when started == null. Throws ArgumentNullException when opened == null. Throws ArgumentNullException when keysAdded == null. Throws ArgumentNullException when ended == null. |
public ChestSession Begin() |
Starts a new chest in place of any chest in progress: the whole board is generated and fixed now, and the player gets the free keys. Throws System.InvalidOperationException when the settings cannot make a board; the chest in progress is then kept. |
public ChestOpenResult Open(int cell) |
Opens a cell: spends one key and grants its bundle at most once, under the token chest:{sessionId}:{cell}. |
public ChestKeyPackResult TakeKeyPack(ChestKeyPack pack) |
Adds a key pack's keys, once per pack and chest. |
public void End() |
Discards the chest in progress with its closed cells and unused keys. Nothing already granted is taken back. |
| Member | Type | Description |
|---|---|---|
Current |
ChestSession |
The chest in progress, or null when there is none, as after an app restart. Setter: private set. |
ChestSession
Responsible for: One chest in progress: the fixed board, which cells are open, the keys left and which key packs were taken. It lives only in memory and is never saved, so an app restart cannot bring it back; what was granted from opened cells is already in the economy. Only ChestService changes it.
Qualified name: Ostryzhnyi.CasualGameCore.Chest.ChestSession. Declaration: public sealed class ChestSession. Source.
| Method | Description |
|---|---|
public bool IsOpened(int cell) |
False for a cell that is closed or that the board does not have. |
| Member | Type | Description |
|---|---|---|
Id |
string |
Tells this chest from every other; the grant token of a cell is built from it. Read-only property. |
Board |
ChestBoard |
Board. Read-only property. |
OpenedMask |
int |
Bit n is set once cell n is open. Setter: private set. |
OpenedCount |
int |
Opened Count. Read-only property. |
IsComplete |
bool |
True once every cell is open. Getter returns OpenedCount == Board.CellCount. |
Keys |
int |
Keys the player can still spend on closed cells. Setter: private set. |
AdPackUsed |
bool |
True once the ad pack was taken; it can be taken once. Setter: private set. |
GemPackUsed |
bool |
True once the Hard Currency pack was taken; it can be taken once. Setter: private set. |
ChestSettingsSection
Responsible for: The Chest settings section: the weighted pool the eight ordinary cells draw from, the jackpot bundle one cell always holds, and the three key packs. A section that was never saved starts with a pool of small Soft Currency ranges, a Hard Currency range and a Soft plus booster mix, a jackpot, and key packs of 3 free, 3 ad and 3 Hard Currency.
Qualified name: Ostryzhnyi.CasualGameCore.Chest.ChestSettingsSection. Declaration: public sealed class ChestSettingsSection : ICasualSettingsSection. Source.
| Method | Description |
|---|---|
public ChestSettingsSection() |
Creates ChestSettingsSection with the supplied dependencies and configuration. |
public ChestPoolRule AddRule() |
Adds a rule with weight 1 and a small Soft Currency reward, and returns it. |
| Member | Type | Description |
|---|---|---|
CellCount |
int |
How many cells a chest holds. Declared initializer: 9. |
DefaultInterval |
int |
A chest is offered after every fifth unit unless the author changes it. Declared initializer: 5. |
Interval |
int |
Every how many units a chest is offered (at least 1). A section saved before this existed loads with the default. Declared initializer: DefaultInterval. |
Pool |
List<ChestPoolRule> |
Pool. Declared initializer: new List<ChestPoolRule>(). |
Jackpot |
RewardBundle |
Jackpot. Declared initializer: new RewardBundle(). |
Keys |
ChestKeyPackSettings |
Keys. Declared initializer: new ChestKeyPackSettings(). |
ChestStarted
Responsible for: A new chest was started.
Qualified name: Ostryzhnyi.CasualGameCore.Chest.ChestStarted. Declaration: public struct ChestStarted. Source.
| Member | Type | Description |
|---|---|---|
SessionId |
string |
Session Id. Without an initializer, a new instance uses default(string). |
Keys |
int |
The free keys the player starts with. Without an initializer, a new instance uses default(int). |
ChestStep
Responsible for: The Chest as a step of the win flow. After a win it starts a chest and then waits for the player: leaving the chest (IChestService.End) or opening the ninth cell ends it. It then shows the chest's ChestSummary once through the reward presenter and completes only after that screen is dismissed, so the flow closes, and a due interstitial plays, after the chest and reward screens (AE11). The player cannot skip it from the win popup.
Qualified name: Ostryzhnyi.CasualGameCore.Chest.ChestStep. Declaration: public sealed class ChestStep : IPlayerPacedStep, IConditionalResultFlowStep. Source.
| Method | Description |
|---|---|
public ChestStep(IChestService chest, IRewardPresenter presenter, OstryzhnyiSignal<ChestCellOpened> opened, OstryzhnyiSignal<ChestEnded> ended, IChestSchedule schedule = null) |
Creates ChestStep with the supplied dependencies and configuration. schedule: Which units earn a chest; null offers one after every win. Throws ArgumentNullException when chest == null. Throws ArgumentNullException when presenter == null. Throws ArgumentNullException when opened == null. Throws ArgumentNullException when ended == null. |
public bool AppliesTo(AttemptOutcome outcome) |
Returns whether this step applies to the supplied result context. |
public bool AppliesTo(ResultFlowContext context) |
A win on a unit the schedule gives a chest, never the day's extra level. Without a schedule every win does. Throws ArgumentNullException when context == null. |
public void Run(ResultFlowContext context, Action done) |
Runs this result-flow step using the supplied context and completion operation. Throws ArgumentNullException when context == null. Throws ArgumentNullException when done == null. |
| Member | Type | Description |
|---|---|---|
Order |
int |
Order. Getter returns ResultFlowOrder.Chest. |
ChestSummary
Responsible for: What a chest granted, added up for the reward collection screen.
Qualified name: Ostryzhnyi.CasualGameCore.Chest.ChestSummary. Declaration: public static class ChestSummary. Source.
| Method | Description |
|---|---|
public static IReadOnlyList<ResolvedReward> Of(ChestSession session) |
Everything the opened cells granted, one entry per reward type and item with the amounts added up, in the order each first appeared (cell order). Closed cells add nothing, and a chest with no open cell gives an empty list. Throws ArgumentNullException when session == null. |
IChestService
Responsible for: The chest in progress and what moves it. One chest at a time, in memory only. Paying for a key pack (the rewarded ad, the Hard Currency) is the caller's job; this only adds the keys, once per pack.
Qualified name: Ostryzhnyi.CasualGameCore.Chest.IChestService. Declaration: public interface IChestService. Source.
| Method | Description |
|---|---|
ChestSession Begin() |
Starts a new chest in place of any chest in progress: the whole board is generated and fixed now, and the player gets the free keys. Throws System.InvalidOperationException when the settings cannot make a board; the chest in progress is then kept. |
ChestOpenResult Open(int cell) |
Opens a cell: spends one key and grants its bundle at most once, under the token chest:{sessionId}:{cell}. |
ChestKeyPackResult TakeKeyPack(ChestKeyPack pack) |
Adds a key pack's keys, once per pack and chest. |
void End() |
Discards the chest in progress with its closed cells and unused keys. Nothing already granted is taken back. |
| Member | Type | Description |
|---|---|---|
Current |
ChestSession |
The chest in progress, or null when there is none, as after an app restart. Read-only property. |
Namespace: Ostryzhnyi.CasualGameCore.Clock
DebugTimeOffset
Responsible for: A whole number of days added to the device clock by OfflineTimeProvider, so a developer can step through a missed-day or next-day scenario without waiting. It applies only in the Editor and in development builds; in a release build it is ignored whatever it is set to. Online mode never uses it: trusted time is the point of that mode.
Qualified name: Ostryzhnyi.CasualGameCore.Clock.DebugTimeOffset. Declaration: public static class DebugTimeOffset. Source.
| Method | Description |
|---|---|
public static DateTime Apply(DateTime utcNow) |
utcNow with Current added; the same moment when there is no offset. |
public static void Reset() |
Clears the offset and restores the default IsAllowed. |
| Member | Type | Description |
|---|---|---|
IsAllowed |
Func<bool> |
Whether the offset may apply at all: in the Editor or a development build by default. Replace it to test the release case; Reset puts the default back. Declared initializer: DefaultAllowed. Setter: set. |
Days |
int |
The days to add, negative for the past. Kept for the Editor session across Play Mode and domain reloads, and in memory in a development build. Setting it never fails, but it only takes effect while IsAllowed says so. Setter: set. |
Current |
TimeSpan |
The time added right now: Days days while the offset is allowed, otherwise nothing. Getter returns IsAllowed() ? TimeSpan.FromDays(Days) : TimeSpan.Zero. |
HttpDateTimeSource
Responsible for: Fetches trusted UTC through an HTTP endpoint.
Qualified name: Ostryzhnyi.CasualGameCore.Clock.HttpDateTimeSource. Declaration: public sealed class HttpDateTimeSource : ITrustedTimeSource. Source.
| Method | Description |
|---|---|
public HttpDateTimeSource(string endpoint) |
Creates HttpDateTimeSource with the supplied dependencies and configuration. |
public IEnumerator Fetch(Action<TimeResult> complete) |
Returns WebTimeRequest.Fetch(_endpoint, true, Parse, complete). |
public static TimeResult Parse(string date) |
Returns `DateTime.TryParseExact(date, "r", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal \ |
ITimeProvider
Responsible for: Delivers a UTC time result through a callback.
Qualified name: Ostryzhnyi.CasualGameCore.Clock.ITimeProvider. Declaration: public interface ITimeProvider. Source.
| Method | Description |
|---|---|
void GetUtcNow(Action<TimeResult> complete) |
Requests a UTC time result through the supplied completion callback. |
ITrustedTimeSource
Responsible for: Yields once per frame; disposal must abort and release pending network work.
Qualified name: Ostryzhnyi.CasualGameCore.Clock.ITrustedTimeSource. Declaration: public interface ITrustedTimeSource. Source.
| Method | Description |
|---|---|
IEnumerator Fetch(Action<TimeResult> complete) |
Defines fetch for implementations of ITrustedTimeSource. |
ITrustedTimeStore
Responsible for: Stores the latest accepted trusted UTC value.
Qualified name: Ostryzhnyi.CasualGameCore.Clock.ITrustedTimeStore. Declaration: public interface ITrustedTimeStore. Source.
| Method | Description |
|---|---|
void Record(DateTime utcNow) |
Defines record for implementations of ITrustedTimeStore. |
| Member | Type | Description |
|---|---|---|
LastAcceptedUtc |
DateTime |
Last Accepted Utc. Read-only property. |
JsonTimeSource
Responsible for: CORS-enabled HTTPS endpoint returning explicit UTC in utc or UTCTime's utc_iso field.
Qualified name: Ostryzhnyi.CasualGameCore.Clock.JsonTimeSource. Declaration: public sealed class JsonTimeSource : ITrustedTimeSource. Source.
| Method | Description |
|---|---|
public JsonTimeSource(string endpoint) |
Creates JsonTimeSource with the supplied dependencies and configuration. |
public IEnumerator Fetch(Action<TimeResult> complete) |
Clears the previous CORS header and returns the JSON HTTP request enumerator, reporting parsed UTC through the completion callback. |
public static TimeResult Parse(string json) |
Parses utc or utc_iso in UTC JSON, ending in Z with optional fractional seconds. Returns Invalid for an unsupported/malformed value. |
| Member | Type | Description |
|---|---|---|
CorsAllowOrigin |
string |
Last response's CORS declaration, for Editor diagnostics, not browser authorization. Setter: private set. |
OfflineTimeProvider
Responsible for: Returns device UTC with the allowed debug offset applied.
Qualified name: Ostryzhnyi.CasualGameCore.Clock.OfflineTimeProvider. Declaration: public sealed class OfflineTimeProvider : ITimeProvider. Source.
| Method | Description |
|---|---|
public OfflineTimeProvider(Func<DateTime> utcNow = null) |
Creates OfflineTimeProvider with the supplied dependencies and configuration. |
public void GetUtcNow(Action<TimeResult> complete) |
Immediately completes with device UTC and the allowed debug day offset. A null completion callback throws. Throws ArgumentNullException when complete == null. |
OnlineTimeProvider
Responsible for: Shares trusted-time requests, caches accepted UTC and rejects rollback.
Qualified name: Ostryzhnyi.CasualGameCore.Clock.OnlineTimeProvider. Declaration: public sealed class OnlineTimeProvider : ITimeProvider. Source.
| Method | Description |
|---|---|
public OnlineTimeProvider(ITrustedTimeSource source, ITrustedTimeStore store, double timeoutSeconds, double refreshSeconds, Action<IEnumerator> run = null, Func<double> seconds = null, Action<TimeUnavailable> unavailable = null) |
Creates OnlineTimeProvider with the supplied dependencies and configuration. Throws ArgumentNullException when source == null. Throws ArgumentNullException when store == null. Throws ArgumentOutOfRangeException when !(timeoutSeconds > 0) || double.IsInfinity(timeoutSeconds). Throws ArgumentOutOfRangeException when !(refreshSeconds >= 0) || double.IsInfinity(refreshSeconds). |
public void GetUtcNow(Action<TimeResult> complete) |
Completes with cached trusted UTC advanced by elapsed real time while fresh; otherwise joins or starts a fetch. Reports Timeout, Unreachable or Invalid without device-clock fallback. Rejects non-UTC, minimum and rollback values; isolates throwing observers. A null completion callback throws. Throws ArgumentNullException when complete == null. |
TimeEndpoint
Responsible for: Validates a trusted-time endpoint address.
Qualified name: Ostryzhnyi.CasualGameCore.Clock.TimeEndpoint. Declaration: public static class TimeEndpoint. Source.
| Method | Description |
|---|---|
public static bool IsValid(string value) |
Returns Uri.TryCreate(value, UriKind.Absolute, out var uri) && uri.Scheme == Uri.UriSchemeHttps && !string.IsNullOrEmpty(uri.Host) && string.IsNullOrEmpty(uri.UserInfo). |
TimeFailure
Responsible for: Identifies why a trusted-time request failed.
Qualified name: Ostryzhnyi.CasualGameCore.Clock.TimeFailure. Declaration: public enum TimeFailure. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
None |
0 |
None. |
Unreachable |
1 |
Unreachable. |
Timeout |
2 |
Timeout. |
Invalid |
3 |
Invalid. |
TimeFeature
Responsible for: Registers the configured time provider and trusted-time storage.
Qualified name: Ostryzhnyi.CasualGameCore.Clock.TimeFeature. Declaration: public sealed class TimeFeature : ICasualFeature. Source.
| Method | Description |
|---|---|
public TimeFeature(CasualGameSettings settings) |
Creates TimeFeature with the supplied dependencies and configuration. |
public void Register(DIContainer container) |
Registers this feature’s services and signal bindings in the supplied container. Throws InvalidOperationException when !(_settings.Mode == TimeMode.Offline) and store == null. |
| Member | Type | Description |
|---|---|---|
Id |
string |
Id. Getter returns "Time". |
Enabled |
bool |
Enabled. Getter returns true. |
Priority |
int |
Priority. Getter returns int.MinValue + 1. |
TimeMode
Responsible for: Selects device time or a trusted online source.
Qualified name: Ostryzhnyi.CasualGameCore.Clock.TimeMode. Declaration: public enum TimeMode. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Offline |
0 |
Offline. |
Online |
1 |
Online. |
TimeResult
Responsible for: Carries either an accepted UTC value or a time failure.
Qualified name: Ostryzhnyi.CasualGameCore.Clock.TimeResult. Declaration: public readonly struct TimeResult. Source.
| Method | Description |
|---|---|
public static TimeResult Ok(DateTime utcNow) |
Returns new TimeResult(utcNow, TimeFailure.None). |
public static TimeResult Fail(TimeFailure failure) |
Returns new TimeResult(default, failure). |
| Member | Type | Description |
|---|---|---|
Success |
bool |
Success. Getter returns Failure == TimeFailure.None. |
UtcNow |
DateTime |
Utc Now. Read-only property. |
Failure |
TimeFailure |
Failure. Read-only property. |
TimeSettingsSection
Responsible for: Configures clock mode, endpoints, request timeout and cache refresh.
Qualified name: Ostryzhnyi.CasualGameCore.Clock.TimeSettingsSection. Declaration: public sealed class TimeSettingsSection : ICasualSettingsSection. Source.
| Member | Type | Description |
|---|---|---|
Mode |
TimeMode |
Mode. Declared initializer: TimeMode.Offline. |
NativeEndpoint |
string |
Native Endpoint. Declared initializer: "". |
WebGlEndpoint |
string |
Web Gl Endpoint. Declared initializer: "". |
TimeoutSeconds |
float |
Timeout Seconds. Declared initializer: 10. |
RefreshSeconds |
float |
Refresh Seconds. Declared initializer: 60. |
TimeUnavailable
Responsible for: Signals an unavailable time result.
Qualified name: Ostryzhnyi.CasualGameCore.Clock.TimeUnavailable. Declaration: public struct TimeUnavailable. Source.
| Member | Type | Description |
|---|---|---|
Failure |
TimeFailure |
Failure. Without an initializer, a new instance uses default(TimeFailure). |
TrustedTimeData
Responsible for: Stores the ticks of the last accepted UTC value.
Qualified name: Ostryzhnyi.CasualGameCore.Clock.TrustedTimeData. Declaration: public sealed class TrustedTimeData. Source.
| Member | Type | Description |
|---|---|---|
HighestUtcTicks |
long |
Highest Utc Ticks. Without an initializer, a new instance uses default(long). |
TrustedTimeSave
Responsible for: Persists trusted-time state and rejects writes to read-only data.
Qualified name: Ostryzhnyi.CasualGameCore.Clock.TrustedTimeSave. Declaration: public sealed class TrustedTimeSave : VersionedSaveModel<TrustedTimeData>, ITrustedTimeStore. Source.
| Method | Description |
|---|---|
public void Record(DateTime utcNow) |
Rejects a read-only newer schema, non-UTC time and rollback. An unchanged tick count does nothing; a newer accepted value is saved. Throws InvalidOperationException when IsReadOnly. Throws ArgumentException when utcNow.Kind != DateTimeKind.Utc || utcNow < LastAcceptedUtc. |
| Member | Type | Description |
|---|---|---|
LastAcceptedUtc |
DateTime |
Last Accepted Utc. Getter returns new DateTime(Data.HighestUtcTicks, DateTimeKind.Utc). |
Namespace: Ostryzhnyi.CasualGameCore.Common
IRandom
Responsible for: The one source of randomness for rolls such as chest ranges and mission picks, so a test can supply a fixed or seeded sequence and a game can supply its own generator.
Qualified name: Ostryzhnyi.CasualGameCore.Common.IRandom. Declaration: public interface IRandom. Source.
| Method | Description |
|---|---|
long NextInclusive(long minInclusive, long maxInclusive) |
A uniformly distributed whole number from minInclusive to maxInclusive, both included. Throws System.ArgumentOutOfRangeException when the maximum is below the minimum. |
SystemRandomSource
Responsible for: IRandom over System.Random. The same seed gives the same sequence.
Qualified name: Ostryzhnyi.CasualGameCore.Common.SystemRandomSource. Declaration: public sealed class SystemRandomSource : IRandom. Source.
| Method | Description |
|---|---|
public SystemRandomSource() |
Creates SystemRandomSource with the supplied dependencies and configuration. |
public SystemRandomSource(int seed) |
Creates SystemRandomSource with the supplied dependencies and configuration. |
public long NextInclusive(long minInclusive, long maxInclusive) |
A uniformly distributed whole number from minInclusive to maxInclusive, both included. Throws System.ArgumentOutOfRangeException when the maximum is below the minimum. Throws ArgumentOutOfRangeException when maxInclusive < minInclusive. |
Namespace: Ostryzhnyi.CasualGameCore.Composition
CasualGameInstaller
Responsible for: Composes project services and connects the scene mechanic and controllers.
Qualified name: Ostryzhnyi.CasualGameCore.Composition.CasualGameInstaller. Declaration: public sealed class CasualGameInstaller : OstryzhnyiMonoInstaller. Source.
| Method | Description |
|---|---|
public override void Register() |
Composes shared services when needed, then connects the scene mechanic, result flow, optional controllers and scene injection targets. Requires an assigned DI container. Throws InvalidOperationException when Container == null. |
public void InjectSceneObject(object target) |
Injects dependencies into an existing scene object using the assigned container. Throws ArgumentNullException when target == null. Throws InvalidOperationException when Container == null. |
public static IFeatureGate Compose(DIContainer container, CasualGameSettings settings, IEnumerable<ICasualFeature> features, Func<Saves> createSaves = null, Action<FeatureRegistrationFailed> reportFailure = null) |
Composes once per container, with stable priority order. Gate entries reflect successful registration. Feature registrations are not transactional: a throwing feature must clean up its own partial side effects. Throws ArgumentNullException when container == null. Throws ArgumentNullException when settings == null. Throws ArgumentNullException when features == null. Throws ArgumentException when feature == null || string.IsNullOrWhiteSpace(feature.Id). This check is inside the iteration. Throws InvalidOperationException when !ids.Add(feature.Id). This check is inside the iteration. |
| Member | Type | Description |
|---|---|---|
CoreFeatureId |
string |
Core Feature Id. Declared initializer: "Core". |
CasualFeatureRegistry
Responsible for: Later systems register factories during AfterAssembliesLoaded, before the bootstrap.
Qualified name: Ostryzhnyi.CasualGameCore.Composition.CasualFeatureRegistry. Declaration: public static class CasualFeatureRegistry. Source.
| Method | Description |
|---|---|
public static void Register(Func<CasualGameSettings, ICasualFeature> factory) |
Registers a feature factory unless the same delegate is already registered. A null factory throws; register before bootstrap composition. Throws ArgumentNullException when factory == null. |
public static IReadOnlyList<ICasualFeature> Create(CasualGameSettings settings) |
Invokes the registered factories in registration order for the supplied settings and returns their feature instances. Throws ArgumentNullException when settings == null. |
public static void Reset() |
Clears feature factories and resets the cached project settings; subsystem registration also invokes this reset. |
FeatureGate
Responsible for: Tracks declared and successfully enabled feature IDs.
Qualified name: Ostryzhnyi.CasualGameCore.Composition.FeatureGate. Declaration: public sealed class FeatureGate : IKnownFeatureGate. Source.
| Method | Description |
|---|---|
public bool IsEnabled(string id) |
Returns whether the supplied feature ID is enabled. |
public bool IsKnown(string id) |
Returns whether the supplied ID is declared. |
FeatureRegistrationFailed
Responsible for: Carries the identity and sanitized message of a failed feature registration.
Qualified name: Ostryzhnyi.CasualGameCore.Composition.FeatureRegistrationFailed. Declaration: public struct FeatureRegistrationFailed. Source.
| Member | Type | Description |
|---|---|---|
FeatureId |
string |
Feature Id. Without an initializer, a new instance uses default(string). |
Message |
string |
Message. Without an initializer, a new instance uses default(string). |
ICasualFeature
Responsible for: One system's registration. Disabled systems must register no services or signals.
Qualified name: Ostryzhnyi.CasualGameCore.Composition.ICasualFeature. Declaration: public interface ICasualFeature. Source.
| Method | Description |
|---|---|
void Register(DIContainer container) |
Registers this feature’s services and signal bindings in the supplied container. |
| Member | Type | Description |
|---|---|---|
Id |
string |
Id. Read-only property. |
Enabled |
bool |
Enabled. Read-only property. |
Priority |
int |
Priority. Read-only property. |
IFeatureGate
Responsible for: Exposes feature declaration and enablement queries.
Qualified name: Ostryzhnyi.CasualGameCore.Composition.IFeatureGate. Declaration: public interface IFeatureGate. Source.
| Method | Description |
|---|---|
bool IsEnabled(string id) |
Returns whether the supplied feature ID is enabled. |
IKnownFeatureGate
Responsible for: Optional gate capability: tells a feature that is declared but disabled from an ID nobody declared.
Qualified name: Ostryzhnyi.CasualGameCore.Composition.IKnownFeatureGate. Declaration: public interface IKnownFeatureGate : IFeatureGate. Source.
| Method | Description |
|---|---|
bool IsKnown(string id) |
Returns whether the supplied ID is declared. |
Namespace: Ostryzhnyi.CasualGameCore.Consent
ConsentComposition
Responsible for: Binds the consent dialog for the scene. It runs from the scene's CasualGameInstaller, because the dialog lives in the scene's View service, and replaces the controller an earlier scene made.
Qualified name: Ostryzhnyi.CasualGameCore.Consent.ConsentComposition. Declaration: public static class ConsentComposition. Source.
| Method | Description |
|---|---|
public static ConsentController Connect(DIContainer container, Func<IViewService> views = null) |
Builds the ConsentController over the composed consent. Returns null, and does nothing, when consent is not composed or the mode shows no dialog (ConsentMode.External, or a child-directed app). views: Resolved on use; ViewService.Instance when null. Throws ArgumentNullException when container == null. Returns null when !container.TryResolve(typeof(IConsentState), out var state). Returns null when settings.Mode != ConsentMode.BuiltInDialog || !settings.RequiresChoice. |
ConsentController
Responsible for: Binds the consent dialog. When the player first reaches the home screen and a choice is still needed it opens the dialog, which blocks until the player accepts or declines; each choice is recorded in IConsentState and closes it. The dialog also opens from Settings (Privacy options), which shows the same dialog with the same two choices. Knows the consent dialog only; the home screen is recognised by its IHomeScreen marker.
Qualified name: Ostryzhnyi.CasualGameCore.Consent.ConsentController. Declaration: public sealed class ConsentController : IDisposable. Source.
| Method | Description |
|---|---|
public ConsentController(Func<IViewService> views, IConsentState state, ConsentSettingsSection settings, IPlayerSettingsService links = null) |
Creates ConsentController with the supplied dependencies and configuration. views: Resolved once; without a View service the controller stays inert. links: Opens the Privacy Policy link; null leaves the link doing nothing. Throws ArgumentNullException when views == null. Throws ArgumentNullException when state == null. Throws ArgumentNullException when settings == null. |
public void Dispose() |
Releases this instance’s owned subscriptions or pending work. Call it when the owning flow ends. |
ConsentData
Responsible for: The persisted consent decision and the version of the consent text it was made for.
Qualified name: Ostryzhnyi.CasualGameCore.Consent.ConsentData. Declaration: public sealed class ConsentData. Source.
| Member | Type | Description |
|---|---|---|
Decision |
ConsentDecision |
Decision. Without an initializer, a new instance uses default(ConsentDecision). |
PolicyVersion |
int |
Policy Version. Without an initializer, a new instance uses default(int). |
ConsentDecision
Responsible for: Carries the player consent decision.
Qualified name: Ostryzhnyi.CasualGameCore.Consent.ConsentDecision. Declaration: public enum ConsentDecision. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Unknown |
0 |
Unknown. |
Accepted |
1 |
Accepted. |
Declined |
2 |
Declined. |
ConsentFeature
Responsible for: Composes consent: when Ads or Analytics is on and either a choice is required or the app is child-directed, it registers the ConsentService as the IPrivacyConsent port and as IConsentState. It composes before Ads, so the default port never replaces it. With neither condition it composes nothing and ads and analytics start at once.
Qualified name: Ostryzhnyi.CasualGameCore.Consent.ConsentFeature. Declaration: public sealed class ConsentFeature : ICasualFeature. Source.
| Method | Description |
|---|---|
public ConsentFeature(CasualGameSettings settings) |
Creates ConsentFeature with the supplied dependencies and configuration. Throws ArgumentNullException when settings == null. |
public void Register(DIContainer container) |
Registers this feature’s services and signal bindings in the supplied container. Throws InvalidOperationException when !container.TryResolve(typeof(Saves), out var saves). Throws InvalidOperationException on the corresponding guard path. |
| Member | Type | Description |
|---|---|---|
FeatureId |
string |
Feature Id. Declared initializer: "Consent". |
Id |
string |
Id. Getter returns FeatureId. |
Enabled |
bool |
Enabled. Read-only property. |
Priority |
int |
Before the Ads feature, whose port it provides. Getter returns int.MinValue + 4. |
ConsentMode
Responsible for: How the player's consent is asked for.
Qualified name: Ostryzhnyi.CasualGameCore.Consent.ConsentMode. Declaration: public enum ConsentMode. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
NotRequired |
0 |
No consent flow: ads and analytics start at once. The developer owns the legal basis. |
BuiltInDialog |
1 |
The built-in popup: Accept, Decline and the Privacy Policy link. The conservative default. |
External |
2 |
The developer's own consent provider, an IConsentSource. |
ConsentSave
Responsible for: The player's consent. It is never restored from the recovery backup: a blob that cannot be read, is too new or fails to migrate loads as ConsentDecision.Unknown and the player is asked again. Changing or withdrawing the decision deletes the recovery backup of the consent key, so an old decision cannot come back.
Qualified name: Ostryzhnyi.CasualGameCore.Consent.ConsentSave. Declaration: public sealed class ConsentSave : VersionedSaveModel<ConsentData>. Source.
| Method | Description |
|---|---|
public void Record(ConsentDecision decision, int policyVersion) |
Stores the decision for a version of the consent text, saves it and clears the recovery backup. |
| Member | Type | Description |
|---|---|---|
Decision |
ConsentDecision |
Decision. Getter returns Data.Decision. |
PolicyVersion |
int |
Policy Version. Getter returns Data.PolicyVersion. |
ConsentService
Responsible for: The consent flow's state: implements IPrivacyConsent, so ads and analytics wait for it, and replaces ConsentNotRequired when the consent feature is composed. A decision made for an older version of the consent text is cleared when the service is made, so the player is asked again.
Qualified name: Ostryzhnyi.CasualGameCore.Consent.ConsentService. Declaration: public sealed class ConsentService : IPrivacyConsent, IConsentState. Source.
| Method | Description |
|---|---|
public ConsentService(ConsentSave save, ConsentSettingsSection settings, IConsentSource source = null, ITrackingPrompt trackingPrompt = null) |
Creates ConsentService with the supplied dependencies and configuration. source: The developer's provider for ConsentMode.External; null for the other modes. Throws ArgumentNullException when save == null. Throws ArgumentNullException when settings == null. |
public void WhenReady(Action<AdsConsent> callback) |
Calls callback once with the player's choice: at once when it is already known, otherwise when it has been made. Several callers may wait at the same time and each is called once. Throws ArgumentNullException when callback == null. |
public void Accept() |
Forwards the operation to Decide(ConsentDecision.Accepted). |
public void Decline() |
Forwards the operation to Decide(ConsentDecision.Declined). |
| Member | Type | Description |
|---|---|---|
Decision |
ConsentDecision |
The decision that stands now: ConsentDecision.Unknown for none, or one made for an older version of the consent text. Getter returns _save.Decision. |
NeedsDecision |
bool |
True while a choice is required and none stands, so ads and analytics are waiting. Getter returns _settings.RequiresChoice && _save.Decision == ConsentDecision.Unknown. |
Current |
AdsConsent |
What the standing choice means for ads and analytics. Meaningful once NeedsDecision is false. Read-only property. |
AllowsTrackingPrompt |
bool |
False for a child-directed app, which never asks for tracking permission. Getter returns !_settings.ChildDirected. |
Changed |
Action<AdsConsent> |
Raised after the choice changed, with what it now means. Not raised when the same choice is made again. |
ConsentSettingsSection
Responsible for: The consent settings.
Qualified name: Ostryzhnyi.CasualGameCore.Consent.ConsentSettingsSection. Declaration: public sealed class ConsentSettingsSection : ICasualSettingsSection. Source.
| Member | Type | Description |
|---|---|---|
Mode |
ConsentMode |
Mode. Declared initializer: ConsentMode.BuiltInDialog. |
PolicyVersion |
int |
The version of the consent text. Raising it clears every stored decision, so players are asked again. Declared initializer: 1. |
ChildDirected |
bool |
The app is directed at children: ads are age-restricted and not personalized, analytics stays off, no tracking prompt is asked for, and nobody is asked to consent, whatever the mode. Without an initializer, a new instance uses default(bool). |
BlockAdsOnDecline |
bool |
A declined choice also blocks ads instead of showing non-personalized ones. Without an initializer, a new instance uses default(bool). |
LegalBasisConfirmed |
bool |
The developer confirms the legal basis for collecting without asking (silences the validator when the mode is NotRequired). Without an initializer, a new instance uses default(bool). |
TrackingUsageDescription |
string |
NSUserTrackingUsageDescription, written to the built iOS plist. Empty means no ATT request. Declared initializer: "Test description" (demo placeholder; replace in the Consent tab before publishing an iOS app). |
OtherProvidersReadAdvertisingIdentifier |
bool |
Additional SDKs outside Ads/Analytics use the advertising identifier; include them in declaration checks. Without an initializer, a new instance uses default(bool). |
AdditionalSkAdNetworkIds |
string[] |
Extra identifiers documented by the project's installed mediation adapters. Validated, never written. Declared initializer: Array.Empty<string>(). |
DialogBody |
string |
What the built-in dialog says. Declared initializer: "We use ads and analytics to keep this game free and to make it better. You can accept or decline, and change your mind later in Settings.". |
RequiresChoice |
bool |
True when the player is asked to choose: a mode other than NotRequired, and not a child-directed app. Getter returns Mode != ConsentMode.NotRequired && !ChildDirected. |
EditorTrackingPrompt
Responsible for: SDK-free prompt for Editor and non-iOS players.
Qualified name: Ostryzhnyi.CasualGameCore.Consent.EditorTrackingPrompt. Declaration: public sealed class EditorTrackingPrompt : ITrackingPrompt. Source.
| Method | Description |
|---|---|
public void Request(Action<TrackingAuthorization> completed) |
Immediately completes with NotDetermined in the Editor. A null callback throws; no native authorization prompt is shown. Throws ArgumentNullException when completed == null. |
IConsentSource
Responsible for: The developer's own consent provider for ConsentMode.External. It is registered in the container before the consent feature composes. Ads and analytics wait until it answers, however late.
Qualified name: Ostryzhnyi.CasualGameCore.Consent.IConsentSource. Declaration: public interface IConsentSource. Source.
| Method | Description |
|---|---|
void Request(Action<bool> answered) |
Asks for consent and calls answered once with whether the player accepted. |
IConsentState
Responsible for: What the player has chosen and how it may change: read by the dialog, ads and analytics. IPrivacyConsent is the same service seen as the port ads wait on.
Qualified name: Ostryzhnyi.CasualGameCore.Consent.IConsentState. Declaration: public interface IConsentState. Source.
| Method | Description |
|---|---|
void Accept() |
Defines accept for implementations of IConsentState. |
void Decline() |
Defines decline for implementations of IConsentState. |
| Member | Type | Description |
|---|---|---|
Decision |
ConsentDecision |
The decision that stands now: ConsentDecision.Unknown for none, or one made for an older version of the consent text. Read-only property. |
NeedsDecision |
bool |
True while a choice is required and none stands, so ads and analytics are waiting. Read-only property. |
Current |
AdsConsent |
What the standing choice means for ads and analytics. Meaningful once NeedsDecision is false. Read-only property. |
AllowsTrackingPrompt |
bool |
False for a child-directed app, which never asks for tracking permission. Read-only property. |
Changed |
Action<AdsConsent> |
Raised after the choice changed, with what it now means. Not raised when the same choice is made again. |
ITrackingPrompt
Responsible for: Completes once, on Unity's main thread, after the platform's tracking choice is available.
Qualified name: Ostryzhnyi.CasualGameCore.Consent.ITrackingPrompt. Declaration: public interface ITrackingPrompt. Source.
| Method | Description |
|---|---|
void Request(Action<TrackingAuthorization> completed) |
Defines request for implementations of ITrackingPrompt. |
IosTrackingPrompt
Responsible for: ATT bridge. Native waits for an active app; completions return through Unity's synchronization context.
Qualified name: Ostryzhnyi.CasualGameCore.Consent.IosTrackingPrompt. Declaration: public sealed class IosTrackingPrompt : ITrackingPrompt. Source.
| Method | Description |
|---|---|
public void Request(Action<TrackingAuthorization> completed) |
Available only in iOS players. Requests native tracking authorization from Unity’s synchronization context. Concurrent requests share the pending native prompt; completions return through that context. Null callbacks and a missing main-thread context throw. Native-call failures clear the pending callbacks and propagate. Throws ArgumentNullException when completed == null. Throws InvalidOperationException on the corresponding guard path. Throws the current exception on the corresponding guard path. |
PrivacyOptionsFeature
Responsible for: A gate entry, like a policy link: enabled only while the player can reopen the consent dialog, so a FeatureGateBinder on the Settings button hides Privacy options when there is nothing to reopen. Registers nothing.
Qualified name: Ostryzhnyi.CasualGameCore.Consent.PrivacyOptionsFeature. Declaration: public sealed class PrivacyOptionsFeature : ICasualFeature. Source.
| Method | Description |
|---|---|
public PrivacyOptionsFeature(CasualGameSettings settings) |
Creates PrivacyOptionsFeature with the supplied dependencies and configuration. Throws ArgumentNullException when settings == null. |
public void Register(DIContainer container) |
Registers this feature’s services and signal bindings in the supplied container. |
| Member | Type | Description |
|---|---|---|
FeatureId |
string |
Feature Id. Declared initializer: "PrivacyOptions". |
Id |
string |
Id. Getter returns FeatureId. |
Enabled |
bool |
Enabled. Read-only property. |
Priority |
int |
Priority. Getter returns int.MinValue + 4. |
TrackingAuthorization
Responsible for: Apple ATT states; consent to analytics is a separate choice.
Qualified name: Ostryzhnyi.CasualGameCore.Consent.TrackingAuthorization. Declaration: public enum TrackingAuthorization. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
NotDetermined |
0 |
Not Determined. |
Restricted |
1 |
Restricted. |
Denied |
2 |
Denied. |
Authorized |
3 |
Authorized. |
Namespace: Ostryzhnyi.CasualGameCore.Daily
DailyClaimOutcome
Responsible for: What happened when a claim was asked for.
Qualified name: Ostryzhnyi.CasualGameCore.Daily.DailyClaimOutcome. Declaration: public enum DailyClaimOutcome. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Claimed |
0 |
The day's bundle was granted once and the saved place moved on. |
AlreadyClaimed |
1 |
Today's reward was already collected, so nothing was granted. |
Blocked |
2 |
Trusted time could not be read, so nothing was granted. |
Failed |
3 |
The grantor refused the bundle. Nothing was saved, so the claim can be tried again. |
DailyClaimResult
Responsible for: The outcome of a claim and what the screen should show afterwards.
Qualified name: Ostryzhnyi.CasualGameCore.Daily.DailyClaimResult. Declaration: public readonly struct DailyClaimResult. Source.
| Method | Description |
|---|---|
public DailyClaimResult(DailyClaimOutcome outcome, DailyViewModel view, IReadOnlyList<ResolvedReward> rewards) |
Creates DailyClaimResult with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
Outcome |
DailyClaimOutcome |
Outcome. Read-only property. |
View |
DailyViewModel |
The days after the claim; null when DailyClaimOutcome.Blocked or DailyClaimOutcome.Failed. Read-only property. |
Rewards |
IReadOnlyList<ResolvedReward> |
What this claim granted, for the reward screen. Empty unless Outcome is DailyClaimOutcome.Claimed, and empty for a replayed claim whose grant the grantor had already recorded. Read-only property. |
DailyDayIcons
Responsible for: Which picture a Daily day card shows for its reward.
Qualified name: Ostryzhnyi.CasualGameCore.Daily.DailyDayIcons. Declaration: public static class DailyDayIcons. Source.
| Method | Description |
|---|---|
public static Sprite Of(DailyRewardDay day, RewardHandlerRegistry handlers) |
The day's own DailyRewardDay.Icon when it has one, otherwise the icon of the first reward whose handler describes its item with one, read from the definition each time so a re-iconed currency shows at once. Null when there is nothing to show, which leaves the card's own art. Returns null when day == null. Returns null when entries == null || handlers == null. Returns null after the preceding guards/branches. |
DailyDayViewData
Responsible for: What one day card of the Daily Rewards screen shows: which day it is and whether it is collected, claimable or ahead.
Qualified name: Ostryzhnyi.CasualGameCore.Daily.DailyDayViewData. Declaration: public readonly struct DailyDayViewData. Source.
| Method | Description |
|---|---|
public DailyDayViewData(int number, DayState state, Sprite icon = null) |
Creates DailyDayViewData with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
Icon |
Sprite |
The picture of what the day grants, or null to keep the card's own art. Read-only property. |
Number |
int |
The day's place in the cycle, counted from 1. Read-only property. |
State |
DayState |
State. Read-only property. |
DailyOpenResult
Responsible for: The screen state after trusted time was read on open.
Qualified name: Ostryzhnyi.CasualGameCore.Daily.DailyOpenResult. Declaration: public readonly struct DailyOpenResult. Source.
| Method | Description |
|---|---|
public DailyOpenResult(DailyViewModel view, TimeFailure failure) |
Creates DailyOpenResult with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
View |
DailyViewModel |
The days to draw; null when IsBlocked. Read-only property. |
Failure |
TimeFailure |
Why time could not be read, or TimeFailure.None. Read-only property. |
IsBlocked |
bool |
True when time could not be read: the screen disables Claim and shows nothing claimable. Getter returns Failure != TimeFailure.None. |
DailyProgress
Responsible for: The saved position in the cycle as a plain value, so the calculator needs no save to run.
Qualified name: Ostryzhnyi.CasualGameCore.Daily.DailyProgress. Declaration: public readonly struct DailyProgress. Source.
| Method | Description |
|---|---|
public DailyProgress(int lastClaimedIndex, DayNumber lastClaimDay, int cycle) |
Creates DailyProgress with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
None |
DailyProgress |
The nothing-claimed-yet position. Getter returns new DailyProgress(-1, default, 0). |
LastClaimedIndex |
int |
The zero-based place of the last claimed day, or -1 when nothing has been claimed. Read-only property. |
LastClaimDay |
DayNumber |
Last Claim Day. Read-only property. |
Cycle |
int |
The pass through the cycle the last claim belonged to. Read-only property. |
HasClaimed |
bool |
Has Claimed. Getter returns LastClaimedIndex >= 0. |
DailyRewardCalculator
Responsible for: The one function that says what the Daily Rewards screen shows. Pure: it reads nothing but its arguments.
Qualified name: Ostryzhnyi.CasualGameCore.Daily.DailyRewardCalculator. Declaration: public static class DailyRewardCalculator. Source.
With no earlier claim, day one is available. The same day again, or a day earlier because the clock or the time zone moved back, is already claimed. The next day makes the following step available, and after the last day the cycle starts again at day one under a new pass number. Skipping a day applies the policy: MissedDayPolicy.Reset starts a new pass at day one with nothing collected, MissedDayPolicy.Preserve carries on from the step it reached.
| Method | Description |
|---|---|
public static DailyViewModel Evaluate(DailyProgress progress, DayNumber today, int dayCount, MissedDayPolicy policy) |
Calculates the cycle view without claiming. A first claim starts day zero; the same/earlier calendar day remains claimed. A completed cycle, or a missed day under Reset policy, starts a new cycle; otherwise advances to the next day. dayCount: How many days the cycle has; at least 1. Throws ArgumentOutOfRangeException when dayCount < 1. |
public static DailyViewModel Evaluate(DailyRewardsSave save, DayNumber today, DailyRewardsSettingsSection settings) |
Calculates the cycle view without claiming. A first claim starts day zero; the same/earlier calendar day remains claimed. A completed cycle, or a missed day under Reset policy, starts a new cycle; otherwise advances to the next day. Throws ArgumentNullException when save == null. Throws ArgumentNullException when settings == null. |
DailyRewardClaimed
Responsible for: A day's reward was granted and the saved place moved on, once. A claim refused as already claimed, blocked or failed raises nothing, so a consumer counting claims never counts one twice.
Qualified name: Ostryzhnyi.CasualGameCore.Daily.DailyRewardClaimed. Declaration: public struct DailyRewardClaimed. Source.
| Member | Type | Description |
|---|---|---|
Cycle |
int |
The pass through the cycle the claim belonged to. Without an initializer, a new instance uses default(int). |
DayIndex |
int |
The zero-based day of the cycle that was collected. Without an initializer, a new instance uses default(int). |
DailyRewardDay
Responsible for: One day of the Daily Rewards cycle: what a player collects that day. The day's number is its place in the list.
Qualified name: Ostryzhnyi.CasualGameCore.Daily.DailyRewardDay. Declaration: public sealed class DailyRewardDay. Source.
| Member | Type | Description |
|---|---|---|
Bundle |
RewardBundle |
What the day grants. Every day needs at least one reward. Declared initializer: new RewardBundle(). |
Icon |
Sprite |
The picture the day's card shows for its reward. Empty by default: the card then shows the icon of the first reward's item, so re-iconing a currency re-icons the day. Set it to give one day its own picture. Without an initializer, a new instance uses default(Sprite). |
DailyRewardsComposition
Responsible for: Connects the Daily Rewards popup to the project's services. The View service lives in a scene, so this runs from the scene's CasualGameInstaller, as the Shop does, and replaces the controller an earlier scene made.
Qualified name: Ostryzhnyi.CasualGameCore.Daily.DailyRewardsComposition. Declaration: public static class DailyRewardsComposition. Source.
| Method | Description |
|---|---|
public static DailyRewardsController Connect(DIContainer container, Func<IViewService> views = null) |
Builds the DailyRewardsController from what container holds and registers it. Returns null, and registers nothing, when Daily Rewards is not composed (no IDailyRewardsService) or there is no reward presenter. views: Resolved on use; ViewService.Instance when null. Throws ArgumentNullException when container == null. Returns null when !container.TryResolve(typeof(IDailyRewardsService), out var service) || !container.TryResolve(typeof(IRewardPresenter), out var presenter). |
DailyRewardsController
Responsible for: Binds the Daily Rewards popup to the claim flow. Each time the popup opens, never at start or on a win, it reads trusted time through IDailyRewardsService and shows the days. A tap on Claim claims through the service and shows what was granted through IRewardPresenter, then the popup comes back in the claimed state. With time unavailable the popup still shows and Claim is off. Knows the Daily popup only, and never opens it; the player or DailyStartupOffer does.
Qualified name: Ostryzhnyi.CasualGameCore.Daily.DailyRewardsController. Declaration: public sealed class DailyRewardsController : IDisposable. Source.
| Method | Description |
|---|---|
public DailyRewardsController(Func<IViewService> views, IDailyRewardsService service, IRewardPresenter presenter, int dayCount, Func<int, Sprite> dayIcon = null) |
Creates DailyRewardsController with the supplied dependencies and configuration. views: Resolved once; without a View service the controller stays inert. dayCount: How many days the cycle has, for the cards shown before trusted time has answered or when it cannot. dayIcon: The picture of the zero-based day's reward; null, or a null answer, leaves the card's own art. Throws ArgumentNullException when views == null. Throws ArgumentNullException when service == null. Throws ArgumentNullException when presenter == null. |
public static IReadOnlyList<DailyDayViewData> ToViewData(DailyViewModel model, Func<int, Sprite> iconOf = null) |
The day cards for a view model, numbered from 1, each with the picture iconOf gives its zero-based day. Throws ArgumentNullException when model == null. |
public void Dispose() |
Releases this instance’s owned subscriptions or pending work. Call it when the owning flow ends. |
DailyRewardsData
Responsible for: Stores Daily Rewards cycle and claim progress.
Qualified name: Ostryzhnyi.CasualGameCore.Daily.DailyRewardsData. Declaration: public sealed class DailyRewardsData. Source.
| Member | Type | Description |
|---|---|---|
LastClaimedIndex |
int |
The zero-based place in the cycle of the last claimed day, or -1 when nothing has been claimed. Declared initializer: -1. |
LastClaimDay |
long |
The DayNumber the last claim happened on. Without an initializer, a new instance uses default(long). |
CycleCount |
int |
Which pass through the cycle the last claim belonged to; it grows each time the cycle starts again. Without an initializer, a new instance uses default(int). |
DailyRewardsFeature
Responsible for: Composes Daily Rewards when its toggle is on: declares the DailyRewards feature the navigation button is gated on, and registers the IDailyRewardsService built from the saved place, the cycle settings, trusted time and the reward grantor. Registration fails, and Daily Rewards stay off, when the time provider or the economy is not composed.
Qualified name: Ostryzhnyi.CasualGameCore.Daily.DailyRewardsFeature. Declaration: public sealed class DailyRewardsFeature : ICasualFeature. Source.
| Method | Description |
|---|---|
public DailyRewardsFeature(CasualGameSettings settings) |
Creates DailyRewardsFeature with the supplied dependencies and configuration. settings: The settings whose Daily Rewards toggle decides whether the feature composes. Throws ArgumentNullException when settings == null. |
public void Register(DIContainer container) |
Registers this feature’s services and signal bindings in the supplied container. Throws InvalidOperationException on the corresponding guard path. |
| Member | Type | Description |
|---|---|---|
FeatureId |
string |
Feature Id. Declared initializer: "DailyRewards". |
Id |
string |
Id. Getter returns FeatureId. |
Enabled |
bool |
Enabled. Getter returns _settings.Toggles.DailyRewards. |
Priority |
int |
After the Time and Economy features it reads. Getter returns int.MinValue + 10. |
DailyRewardsSave
Responsible for: Where the player is in the Daily Rewards cycle: the last day claimed, when, and which pass through the cycle it was. Versioned, so it migrates through the envelope; found by the Saves catalog scan.
Qualified name: Ostryzhnyi.CasualGameCore.Daily.DailyRewardsSave. Declaration: public sealed class DailyRewardsSave : VersionedSaveModel<DailyRewardsData>. Source.
| Method | Description |
|---|---|
public void RecordClaim(int cycle, int index, DayNumber day) |
Remembers that index of pass cycle was claimed on day, and saves it before returning. Throws ArgumentOutOfRangeException when index < 0. |
| Member | Type | Description |
|---|---|---|
Progress |
DailyProgress |
The saved progress as a plain value, for the calculator. Getter returns new DailyProgress(Data.LastClaimedIndex, new DayNumber(Data.LastClaimDay), Data.CycleCount). |
DailyRewardsService
Responsible for: Opens and claims Daily Rewards. Both calls read trusted time from the ITimeProvider; a failure there is reported as blocked and grants nothing, and the provider itself raises the TimeUnavailable signal the network popup listens to. A claim grants the available day's bundle under the token daily:{Cycle}:{AvailableIndex} and only then saves the new place, so a claim replayed after a crash between the two gets GrantResult.AlreadyGranted and still advances the save once.
Qualified name: Ostryzhnyi.CasualGameCore.Daily.DailyRewardsService. Declaration: public sealed class DailyRewardsService : IDailyRewardsService. Source.
| Method | Description |
|---|---|
public DailyRewardsService(DailyRewardsSave save, DailyRewardsSettingsSection settings, ITimeProvider time, IRewardGrantor grantor, IRandom random, OstryzhnyiSignal<DailyRewardClaimed> claimed, Func<DateTime, TimeSpan> localOffset = null) |
Creates DailyRewardsService with the supplied dependencies and configuration. localOffset: The device's offset from UTC at a moment; the system time zone when null. For tests. Throws ArgumentNullException when save == null. Throws ArgumentNullException when settings == null. Throws ArgumentNullException when time == null. Throws ArgumentNullException when grantor == null. Throws ArgumentNullException when random == null. Throws ArgumentNullException when claimed == null. |
public void Open(Action<DailyOpenResult> complete) |
Reads trusted time and reports which days are collected, claimable or ahead. Completes once, possibly synchronously. Throws ArgumentNullException when complete == null. |
public void Claim(Action<DailyClaimResult> complete) |
Reads trusted time again, so a screen left open overnight cannot claim against stale state, then grants the available day's bundle once and saves the new place. Completes once, possibly synchronously. Throws ArgumentNullException when complete == null. |
DailyRewardsSettingsSection
Responsible for: The Daily Rewards settings section: the days of the cycle, in order, and what a missed day does. A section that was never saved starts with seven days, a small Soft Currency reward on days 1-6 and a larger mixed bundle on day 7, and the MissedDayPolicy.Reset policy.
Qualified name: Ostryzhnyi.CasualGameCore.Daily.DailyRewardsSettingsSection. Declaration: public sealed class DailyRewardsSettingsSection : ICasualSettingsSection. Source.
| Method | Description |
|---|---|
public DailyRewardsSettingsSection() |
Creates DailyRewardsSettingsSection with the supplied dependencies and configuration. |
public void AddDay() |
Adds an empty day at the end of the cycle; it reports an error until it has a reward. |
public bool TryRemoveLastDay(out string message) |
Removes the last day. Fails with a message, and changes nothing, when it is the only day left. Returns false when Days.Count <= 1. |
| Member | Type | Description |
|---|---|---|
Days |
List<DailyRewardDay> |
Days. Declared initializer: new List<DailyRewardDay>(). |
MissedDays |
MissedDayPolicy |
Missed Days. Declared initializer: MissedDayPolicy.Reset. |
DayCount |
int |
How many days the cycle has. Getter returns Days.Count. |
DailyStartupOffer
Responsible for: Offers an available Daily reward once per session. When the player reaches the home screen it asks the Daily service whether a day can be claimed, and opens the Daily popup if so. It waits for the consent choice, and for any popup, overlay or attempt the player is in, so it never displaces a flow: an available reward stays pending until the home is idle again. Opening Daily by hand, or a claim, ends the offer. Knows the Daily popup only; the home screen is recognised by its IHomeScreen marker.
Qualified name: Ostryzhnyi.CasualGameCore.Daily.DailyStartupOffer. Declaration: public sealed class DailyStartupOffer : IDisposable. Source.
| Method | Description |
|---|---|
public DailyStartupOffer(Func<IViewService> views, IDailyRewardsService service, DailyStartupSession session, IConsentState consent = null, OstryzhnyiSignal<DailyRewardClaimed> claimed = null) |
Creates DailyStartupOffer with the supplied dependencies and configuration. views: Resolved once; without a View service the offer stays inert. session: Shared by every offer of the session. consent: When given, the offer waits while a consent choice is still needed. claimed: When given, a claim made while the offer waits ends it. Throws ArgumentNullException when views == null. Throws ArgumentNullException when service == null. Throws ArgumentNullException when session == null. |
public void Dispose() |
Releases this instance’s owned subscriptions or pending work. Call it when the owning flow ends. |
| Member | Type | Description |
|---|---|---|
IsPending |
bool |
True while a reward is available and the offer waits for an idle home. Getter returns _session.Pending. |
DailyStartupSession
Responsible for: What the Daily startup offer has done this session. It is kept in the project container, outside the offer, so the offer a new scene makes carries on from it instead of starting over.
Qualified name: Ostryzhnyi.CasualGameCore.Daily.DailyStartupSession. Declaration: public sealed class DailyStartupSession. Source.
No declared public API members beyond the inherited lifecycle.
DailyStatus
Responsible for: Whether anything can be claimed right now: Available when a day is claimable, Claimed once today's is taken.
Qualified name: Ostryzhnyi.CasualGameCore.Daily.DailyStatus. Declaration: public enum DailyStatus. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Available |
0 |
Available. |
Claimed |
1 |
Claimed. |
DailyViewModel
Responsible for: Everything the Daily Rewards screen needs to draw: the state of each day, whether a claim is possible, and which pass through the cycle the next claim belongs to, which is what the grant token is built from.
Qualified name: Ostryzhnyi.CasualGameCore.Daily.DailyViewModel. Declaration: public sealed class DailyViewModel. Source.
| Method | Description |
|---|---|
public DailyViewModel(DailyStatus status, IReadOnlyList<DayState> days, int availableIndex, int cycle) |
Creates DailyViewModel with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
Status |
DailyStatus |
Status. Read-only property. |
Days |
IReadOnlyList<DayState> |
One state per day of the cycle, in order. Read-only property. |
AvailableIndex |
int |
The zero-based day a claim would collect, or -1 when nothing can be claimed. Read-only property. |
Cycle |
int |
The pass through the cycle that the shown days belong to, and that a claim now would be part of. Read-only property. |
DayNumber
Responsible for: A calendar day as a whole number: the day boundary is local midnight, found from trusted UTC plus the device's current offset from UTC. Two moments on the same local date have the same number, and the next date is exactly one more.
Qualified name: Ostryzhnyi.CasualGameCore.Daily.DayNumber. Declaration: public readonly struct DayNumber : IEquatable<DayNumber>, IComparable<DayNumber>. Source.
| Method | Description |
|---|---|
public DayNumber(long value) |
Creates DayNumber with the supplied dependencies and configuration. |
public static DayNumber FromUtc(DateTime utcNow, TimeSpan localOffset) |
The local day that utcNow falls on, when the device is localOffset ahead of UTC. |
public long DaysAfter(DayNumber earlier) |
How many days this one is after earlier; negative when it is before. |
public DayNumber AddDays(long days) |
Returns new DayNumber(Value + days). |
public bool Equals(DayNumber other) |
Returns whether the supplied value represents the same value. |
public override bool Equals(object obj) |
Returns whether the supplied value represents the same value. |
public override int GetHashCode() |
Returns the hash code for this value. |
public int CompareTo(DayNumber other) |
Returns Value.CompareTo(other.Value). |
public override string ToString() |
Returns this value’s text representation. |
public static bool operator ==(DayNumber left, DayNumber right) |
Returns left.Equals(right). |
public static bool operator !=(DayNumber left, DayNumber right) |
Returns !left.Equals(right). |
public static bool operator <(DayNumber left, DayNumber right) |
Returns left.Value < right.Value. |
public static bool operator >(DayNumber left, DayNumber right) |
Returns left.Value > right.Value. |
public static bool operator <=(DayNumber left, DayNumber right) |
Returns left.Value <= right.Value. |
public static bool operator >=(DayNumber left, DayNumber right) |
Returns left.Value >= right.Value. |
| Member | Type | Description |
|---|---|---|
Value |
long |
Value. Read-only property. |
DayState
Responsible for: What a day card shows: collected, the one that can be claimed now, or still ahead.
Qualified name: Ostryzhnyi.CasualGameCore.Daily.DayState. Declaration: public enum DayState. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Collected |
0 |
Collected. |
Available |
1 |
Available. |
Future |
2 |
Future. |
IDailyRewardsService
Responsible for: Opens and claims Daily Rewards against trusted time. Composed only while the Daily Rewards toggle is on.
Qualified name: Ostryzhnyi.CasualGameCore.Daily.IDailyRewardsService. Declaration: public interface IDailyRewardsService. Source.
| Method | Description |
|---|---|
void Open(Action<DailyOpenResult> complete) |
Reads trusted time and reports which days are collected, claimable or ahead. Completes once, possibly synchronously. |
void Claim(Action<DailyClaimResult> complete) |
Reads trusted time again, so a screen left open overnight cannot claim against stale state, then grants the available day's bundle once and saves the new place. Completes once, possibly synchronously. |
MissedDayPolicy
Responsible for: What a missed day does to the Daily Rewards cycle. The developer picks it in the Editor.
Qualified name: Ostryzhnyi.CasualGameCore.Daily.MissedDayPolicy. Declaration: public enum MissedDayPolicy. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Reset |
0 |
The cycle starts again at day one, with nothing collected. |
Preserve |
1 |
The cycle keeps its step and the days already collected, and carries on with the next day. |
Namespace: Ostryzhnyi.CasualGameCore.Demo
CustomMissionTypeSample
Responsible for: The walkthrough for a custom mission type. Implement IMissionType in your own assembly with a public parameterless constructor and it appears in the mission registry with no edit to this package. Follow the signal your mission counts in Track, say how much each event adds, and never read the clock. This sample counts every level the player starts.
Qualified name: Ostryzhnyi.CasualGameCore.Demo.CustomMissionTypeSample. Declaration: public sealed class CustomMissionTypeSample : IMissionType. Source.
| Method | Description |
|---|---|
public bool IsAvailable(MissionEnvironment environment) |
Say when the mission makes sense: this one always does. Other types check a capability or a currency here. Throws ArgumentNullException when environment == null. |
public IDisposable Track(MissionEnvironment environment, Action<long> addProgress) |
Each event adds one to the mission's progress. Return the result so the game can stop following the signal. |
| Member | Type | Description |
|---|---|---|
SampleTypeId |
string |
Sample Type Id. Declared initializer: "sample_start_units". |
Id |
string |
The stable id saved with a mission and chosen in the Editor. Unique among registered types. Getter returns SampleTypeId. |
DisplayTemplate |
string |
The text shown for a mission of this type, with {0} standing for its target, for example Complete {0} levels. Getter returns "Start {0} levels". |
CustomRewardHandlerSample
Responsible for: The walkthrough for a custom reward type. It declares a TypeId, the item ids an entry can pick, and how to grant one. Because it has a public parameterless constructor it appears in the Editor's bundle drawer with no Editor changes; register an instance with the RewardHandlerRegistry at runtime to make it grant.
Qualified name: Ostryzhnyi.CasualGameCore.Demo.CustomRewardHandlerSample. Declaration: public sealed class CustomRewardHandlerSample : IRewardHandler. Source.
| Method | Description |
|---|---|
public IReadOnlyList<string> GetItemChoices(CasualGameSettings settings) |
The item ids an entry of this type can name, for the Editor dropdown. |
public bool Grant(string itemId, long amount, string source) |
Replace the log line with your own effect, and return false when the item or amount is not valid. Returns false when amount <= 0 || !Items.Contains(itemId). |
| Member | Type | Description |
|---|---|---|
SampleTypeId |
string |
Sample Type Id. Declared initializer: "sample". |
TypeId |
string |
The id entries use to pick this handler, for example currency. Getter returns SampleTypeId. |
DemoAudio
Responsible for: The demo prefab uses the shared music, button and game-event audio player.
Qualified name: Ostryzhnyi.CasualGameCore.Demo.DemoAudio. Declaration: public sealed class DemoAudio : GameAudio. Source.
| Method | Description |
|---|---|
public void PlaySound() |
Plays the demo sound only when its source and output mixer group are assigned. |
DemoMechanic
Responsible for: A technical test surface, not a game: the player ends an attempt with Win, Lose or Use Booster from DemoPanelView. It shows how a mechanic reports through GameplayMechanic and is the mechanic the demo scene's installer connects.
Qualified name: Ostryzhnyi.CasualGameCore.Demo.DemoMechanic. Declaration: public sealed class DemoMechanic : GameplayMechanic, IScoredMechanic. Source.
| Method | Description |
|---|---|
public static long RollScore(System.Random random) |
A demo score from MinScore to MaxScore, taken from random. |
public override void StartUnit(ProgressionContext context) |
Forwards the operation to Begin(context, "started"). |
public override void RestartUnit(ProgressionContext context) |
Forwards the operation to Begin(context, context.IsRetry ? "retry" : "restarted"). |
public override void ContinueUnit(ProgressionContext context) |
Forwards the operation to Begin(context, "continued"). |
public override void ApplyBooster(BoosterId booster, Action<bool> onResult) |
Applies the demo booster at once and acknowledges it. Plan 07 routes the button through the booster service instead. |
public override void SetPaused(bool paused) |
Applies the requested pause state to this mechanic. |
| Member | Type | Description |
|---|---|---|
MinScore |
long |
The lowest score the demo gives an attempt. Declared initializer: 1000. |
MaxScore |
long |
The highest score the demo gives an attempt. Declared initializer: 99999. |
Context |
ProgressionContext? |
The unit Core last started, restarted or continued, or null before the first one. Setter: private set. |
Booster |
BoosterId |
The booster the Use Booster button applies. Getter returns _booster. |
Score |
long? |
The score of the attempt that just ended: a fresh random one each win or loss, null before the first. Setter: private set. |
Capabilities |
MechanicCapabilities |
Override to declare rating support. Defaults to no capabilities. Getter returns new MechanicCapabilities(_supportsRating). |
DemoPanelView
Responsible for: The demo's test surface: direct Win (with a star selector), Lose and Use Booster actions. It is a View like every other screen, so the View service shows and hides it. It sits on the bottom panel layer, which stays visible under popups and above the HUD, so the pause, win and lose popups cover it instead of displacing it.
Qualified name: Ostryzhnyi.CasualGameCore.Demo.DemoPanelView. Declaration: public sealed class DemoPanelView : CasualView. Source.
| Method | Description |
|---|---|
public void SetRatingVisible(bool visible) |
Updates rating visible using the supplied value. |
public void SelectStars(int stars) |
Selects the star toggle for stars, clamped to 1 to 3. |
public void SetStatus(string text) |
Updates status using the supplied value. |
public void SetInteractable(bool interactable) |
Enables or disables the three actions, so a paused attempt cannot be ended from the panel. |
| Member | Type | Description |
|---|---|---|
Layer |
ViewLayers |
Layer. Getter returns ViewLayers.BottomPanel. |
WinButton |
UnityEngine.UI.Button |
Win Button. Getter returns _winButton. |
LoseButton |
UnityEngine.UI.Button |
Lose Button. Getter returns _loseButton. |
UseBoosterButton |
UnityEngine.UI.Button |
Use Booster Button. Getter returns _useBoosterButton. |
RatingVisible |
bool |
True while the star selector is shown, which is when the mechanic supports rating. Getter returns _starRow != null && _starRow.activeSelf. |
SelectedStars |
int? |
The stars the Win button reports: the selected toggle, 1 to 3. Null while the star row is hidden. Returns null when !RatingVisible. Returns null after the preceding guards/branches. Read-only property. |
Status |
string |
Status. Getter returns _statusLabel != null ? _statusLabel.text : string.Empty. |
WinRequested |
Action<int?> |
Raised by the Win button with SelectedStars. |
LoseRequested |
Action |
Raised for lose requested notifications. |
UseBoosterRequested |
Action |
Raised for use booster requested notifications. |
DemoSceneBootstrap
Responsible for: The demo scene's entry point. Nothing in Core opens the first screen or hands the DI container to the View service, so a scene does both here: Views the service spawns then get their [DiInject] fields filled, and the main menu opens.
Qualified name: Ostryzhnyi.CasualGameCore.Demo.DemoSceneBootstrap. Declaration: public sealed class DemoSceneBootstrap : MonoBehaviour. Source.
| Method | Description |
|---|---|
public void UseSettings(CasualGameSettings settings) |
Test seam: varies this settings instance's win reward instead of the project's loaded settings. |
DemoWinReward
Responsible for: Makes the demo's win reward vary from win to win, so the rewarded multiplier's extra, base times the factor minus base, does too. The package default stays a fixed base: the range lives here, in the demo, and is applied to the loaded settings in memory only. It never writes the settings asset, never touches an amount the author configured, and is undone when the demo scene goes away.
Qualified name: Ostryzhnyi.CasualGameCore.Demo.DemoWinReward. Declaration: public static class DemoWinReward. Source.
| Method | Description |
|---|---|
public static IDisposable Vary(CasualGameSettings settings) |
Gives the win reward a MinBase to MaxBase coin range when the economy still holds the package default, and leaves any authored win reward alone. Returns the handle that puts the default back; disposing it twice is safe. |
| Member | Type | Description |
|---|---|---|
MinBase |
long |
The lowest base the demo grants for a win. Declared initializer: 10. |
MaxBase |
long |
The highest base the demo grants for a win. Declared initializer: 25. |
MinimalMechanicTemplate
Responsible for: The shortest valid mechanic and the starting point in Quick Start: copy this class, rename it, and replace the three unit methods with your gameplay. Place it in the scene and assign it as the mechanic on the CasualGameInstaller; Core then starts, restarts and continues it, and shows the menu, HUD, win and lose screens around it.
Qualified name: Ostryzhnyi.CasualGameCore.Demo.MinimalMechanicTemplate. Declaration: public class MinimalMechanicTemplate : GameplayMechanic. Source.
The mechanic owns content and live state only. It never knows about rewards, ads, saving or the screens: it reports a win or a loss and Core does the rest.
| Method | Description |
|---|---|
public override void StartUnit(ProgressionContext context) |
Empty template hook: implement loading and starting the supplied progression context. |
public override void RestartUnit(ProgressionContext context) |
Empty template hook: implement restarting the supplied attempt context. |
public override void ContinueUnit(ProgressionContext context) |
Empty template hook: implement resuming the supplied failed attempt. |
public override void ApplyBooster(BoosterId booster, Action<bool> onResult) |
Declines the booster by invoking a non-null callback with false; replace this stub to apply your own effect. |
public void CompleteUnit(int? stars = null) |
Reports a win through the base mechanic, with optional stars normalized by its rating capability. |
public void FailUnit() |
Call when the player fails the unit. |
| Member | Type | Description |
|---|---|---|
Capabilities |
MechanicCapabilities |
Declare once what the mechanic supports. Core reads it at startup, so it must not change afterwards. Getter returns new MechanicCapabilities(_supportsRating). |
Namespace: Ostryzhnyi.CasualGameCore.Diagnostics
CasualLog
Responsible for: Only registered exact credential values are masked. Never log raw SDK payloads or exceptions.
Qualified name: Ostryzhnyi.CasualGameCore.Diagnostics.CasualLog. Declaration: public static class CasualLog. Source.
| Method | Description |
|---|---|
public static bool RegisterCredential(string credential) |
Returns Redactor.Register(credential). |
public static void RegisterSettings(CasualGameSettings settings) |
Registers client-safe credential values and recognized secret/token fields from settings with the log redactor. |
public static string Redact(string message) |
Returns Redactor.Redact(message). |
public static void Info(string message, string feature = DefaultFeature) |
Forwards the operation to Write(CasualLogLevel.Info, message, feature). |
public static void Warning(string message, string feature = DefaultFeature) |
Forwards the operation to Write(CasualLogLevel.Warning, message, feature). |
public static void Critical(string message, string feature = DefaultFeature) |
Forwards the operation to Write(CasualLogLevel.Critical, message, feature). |
public static void Reset() |
Clears registered redactions and the output delegate, and restores the player threshold to Critical. |
| Member | Type | Description |
|---|---|---|
DefaultFeature |
string |
Default Feature. Declared initializer: "Default". |
Output |
Action<CasualLogLevel, string, string> |
Optional output adapter. It receives only redacted messages and feature names. Setter: set. |
PlayerLevel |
CasualLogLevel |
Player Level. Declared initializer: CasualLogLevel.Critical. Setter: set. |
CasualLogLevel
Responsible for: Selects the product log threshold.
Qualified name: Ostryzhnyi.CasualGameCore.Diagnostics.CasualLogLevel. Declaration: public enum CasualLogLevel. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Critical |
0 |
Critical. |
Warning |
1 |
Warning. |
Info |
2 |
Info. |
ClientSafeAttribute
Responsible for: Marks a credential documented by its provider as safe to distribute in a client. Not encryption.
Qualified name: Ostryzhnyi.CasualGameCore.Diagnostics.ClientSafeAttribute. Declaration: public sealed class ClientSafeAttribute : Attribute. Source.
No declared public API members beyond the inherited lifecycle.
CredentialField
Responsible for: Describes a credential field for validation and redaction.
Qualified name: Ostryzhnyi.CasualGameCore.Diagnostics.CredentialField. Declaration: public readonly struct CredentialField. Source.
| Method | Description |
|---|---|
public CredentialField(string path, string name, string value, bool clientSafe, string owner = null) |
Creates CredentialField with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
Path |
string |
Path. Read-only property. |
Name |
string |
Name. Read-only property. |
Value |
string |
Value. Read-only property. |
ClientSafe |
bool |
Client Safe. Read-only property. |
Owner |
string |
The name of the type that declares the field, for the allowlist of client-distributed secrets. Read-only property. |
CredentialFields
Responsible for: Inspects serialized string fields, including nested settings and lists, without invoking property getters.
Qualified name: Ostryzhnyi.CasualGameCore.Diagnostics.CredentialFields. Declaration: public static class CredentialFields. Source.
| Method | Description |
|---|---|
public static IEnumerable<CredentialField> Read(CasualGameSettings settings) |
Enumerates credential fields through the settings object graph, avoiding repeated reference objects. A null settings object throws. Throws ArgumentNullException when settings == null. |
public static bool IsServerSecret(string name) |
Returns true when the normalized field name contains secret, privatekey or password. |
public static bool IsClientDistributedSecret(string owner, string name, bool clientSafe) |
True for a field whose name looks like a server secret but that its provider documents as distributed inside the client: only the allowlisted fields, and only when they are also tagged [ClientSafe]. It is a declaration, not proof of safety. owner: The name of the type that declares the field. Returns false when !clientSafe. Returns false after the preceding guards/branches. |
public static bool IsToken(string name) |
Returns Normalize(name).Contains("token"). |
SecretRedactor
Responsible for: Removes registered credentials and recognizable secret payloads from messages.
Qualified name: Ostryzhnyi.CasualGameCore.Diagnostics.SecretRedactor. Declaration: public sealed class SecretRedactor. Source.
| Method | Description |
|---|---|
public bool Register(string credential) |
Registers an exact credential value for masking. Returns false for a blank value, fewer than four characters, or a duplicate; otherwise returns true. Returns false when string.IsNullOrWhiteSpace(credential) || credential.Length < MinimumCredentialLength || _credentials.Contains(credential). |
public string Redact(string message) |
Returns null for a null message. Replaces overlapping registered credential spans with [REDACTED]; returns an unchanged message when no credential matches. Returns null when message == null. |
public void Clear() |
Clears the recorded state owned by this instance. |
| Member | Type | Description |
|---|---|---|
MinimumCredentialLength |
int |
Minimum Credential Length. Declared initializer: 4. |
Namespace: Ostryzhnyi.CasualGameCore.Economy
AffordabilityGuard
Responsible for: The one place a View spends currency: it spends, or tells the player what is missing. It only ever raises a notice, so it never navigates and never closes the View that asked.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.AffordabilityGuard. Declaration: public sealed class AffordabilityGuard. Source.
| Method | Description |
|---|---|
public AffordabilityGuard(ICurrencyService currency, INoticeService notices, EconomySettingsSection settings) |
Creates AffordabilityGuard with the supplied dependencies and configuration. Throws ArgumentNullException when currency == null. Throws ArgumentNullException when notices == null. Throws ArgumentNullException when settings == null. |
public SpendResult TrySpendOrNotify(IReadOnlyList<CurrencyAmount> cost, string reason) |
Charges the cost through the currency service. When a currency is short it shows Not enough {display name} for the first short currency, read from the settings at the time of the call. A malformed cost shows nothing (the service already logged it). Returns the service's result unchanged. |
BalanceChanged
Responsible for: Raised after a balance changed and was saved, once per changed currency.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.BalanceChanged. Declaration: public struct BalanceChanged. Source.
| Member | Type | Description |
|---|---|---|
Id |
string |
Id. Without an initializer, a new instance uses default(string). |
Balance |
long |
Balance. Without an initializer, a new instance uses default(long). |
CurrencyAmount
Responsible for: An amount of one currency: an entry of a cost list.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.CurrencyAmount. Declaration: public readonly struct CurrencyAmount. Source.
| Method | Description |
|---|---|
public CurrencyAmount(string id, long amount) |
Creates CurrencyAmount with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
Id |
string |
Id. Read-only property. |
Amount |
long |
Amount. Read-only property. |
CurrencyCounterBinder
Responsible for: Drives a CasualCounter from one currency's balance: it shows the current balance when enabled, rolls up to a higher balance after an earn, and snaps to a lower one after a spend. Other currencies are ignored. Without a composed economy or a counter it stays inert and logs one warning.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.CurrencyCounterBinder. Declaration: public sealed class CurrencyCounterBinder : MonoBehaviour. Source.
| Method | Description |
|---|---|
public void Configure(string currencyId, CasualCounter counter) |
Editor and test seam: sets the serialized currency id and counter, and rebinds if enabled. |
public void SetSources(ICurrencyService currency, OstryzhnyiSignal<BalanceChanged> balanceChanged) |
Test seam: uses these sources instead of the injected or project ones, and rebinds if enabled. |
public void SetIcons(ICurrencyIcons icons) |
Test seam: uses this icon source instead of the injected or project one, and rebinds if enabled. |
public void RefreshIcon() |
Puts the currency's current icon on every icon layer; a currency without an icon keeps the prefab's art. |
public void HoldBack(long amount) |
Shows the balance less amount until ReleaseHold: a reward is granted before the screen that flies it to this counter opens, so the counter waits at what the player had and the flight brings it to the balance. |
public void ReleaseHold() |
Stops holding back and shows the real balance, wherever the flight left the counter. |
| Member | Type | Description |
|---|---|---|
CurrencyId |
string |
Currency Id. Getter returns _currencyId. |
Counter |
CasualCounter |
The assigned counter, or the one on this object. Getter returns _counter != null ? _counter : GetComponent<CasualCounter>(). |
IconTargets |
IReadOnlyList<Image> |
The images the currency's icon is put on: the assigned layers, or every image under the counter's icon. Getter returns _iconLayers != null && _iconLayers.Length > 0 ? _iconLayers : IconLayers.In(Counter != null ? Counter.Icon : null). |
CurrencyDefinition
Responsible for: One currency, as data. Id is the stable key every save, signal and reward entry uses, so it never changes after creation; the display name and icon are free to be renamed and re-iconed.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.CurrencyDefinition. Declaration: public sealed class CurrencyDefinition. Source.
| Member | Type | Description |
|---|---|---|
Id |
string |
Id. Without an initializer, a new instance uses default(string). |
DisplayName |
string |
Display Name. Without an initializer, a new instance uses default(string). |
Icon |
Sprite |
Icon. Without an initializer, a new instance uses default(Sprite). |
Role |
CurrencyRole |
Role. Declared initializer: CurrencyRole.Custom. |
StartingAmount |
long |
Starting Amount. Without an initializer, a new instance uses default(long). |
CurrencyEarned
Responsible for: Raised after currency was earned and saved. Amount is what was actually credited, which is less than the request when the balance saturated at long.MaxValue.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.CurrencyEarned. Declaration: public struct CurrencyEarned. Source.
| Member | Type | Description |
|---|---|---|
Id |
string |
Id. Without an initializer, a new instance uses default(string). |
Amount |
long |
Amount. Without an initializer, a new instance uses default(long). |
Source |
string |
Source. Without an initializer, a new instance uses default(string). |
CurrencyRole
Responsible for: What a currency is for. Exactly one currency is Soft and exactly one is Hard; every other currency the author adds is Custom.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.CurrencyRole. Declaration: public enum CurrencyRole. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Soft |
0 |
Soft. |
Hard |
1 |
Hard. |
Custom |
2 |
Custom. |
CurrencyService
Responsible for: Reads and persists currency balances, validates whole costs and emits balance signals.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.CurrencyService. Declaration: public sealed class CurrencyService : ICurrencyService, ICurrencyIcons. Source.
| Method | Description |
|---|---|
public CurrencyService(EconomySave save, EconomySettingsSection settings, OstryzhnyiSignal<CurrencyEarned> earned = null, OstryzhnyiSignal<CurrencySpent> spent = null, OstryzhnyiSignal<BalanceChanged> balanceChanged = null) |
Creates CurrencyService with the supplied dependencies and configuration. earned: Raised after every earn that credited something. spent: Raised once per charged currency after a successful spend. balanceChanged: Raised once per changed currency after an earn or a spend. Throws ArgumentNullException when save == null. Throws ArgumentNullException when settings == null. |
public Sprite IconOf(string currencyId) |
Returns the configured currency icon, or null for an unknown currency or unassigned icon. |
public long GetBalance(string currencyId) |
Returns zero for an unknown ID; otherwise returns the non-negative saved balance or the configured starting amount. |
public bool Earn(string currencyId, long amount, string source) |
Returns false for an unknown currency or a non-positive amount. Credits up to the remaining Int64 capacity, persists and emits signals for the actual credit. An already saturated balance returns true without a new signal. Returns false when currency == null. Returns false when amount <= 0. |
public bool CanAfford(IReadOnlyList<CurrencyAmount> cost) |
Returns true only when the whole cost is valid and affordable. Null costs, unknown IDs and non-positive amounts are invalid; duplicate IDs are totalled with saturation. An empty cost is affordable. |
public SpendResult TrySpend(IReadOnlyList<CurrencyAmount> cost, string reason) |
Validates the entire cost before charging anything. Returns Invalid for malformed costs, Insufficient with the first short currency, or Spent; an empty cost succeeds without a write. On success saves all balances, then emits per-currency signals. |
CurrencySpent
Responsible for: Raised after currency was spent and saved, once per charged currency.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.CurrencySpent. Declaration: public struct CurrencySpent. Source.
| Member | Type | Description |
|---|---|---|
Id |
string |
Id. Without an initializer, a new instance uses default(string). |
Amount |
long |
Amount. Without an initializer, a new instance uses default(long). |
Reason |
string |
Reason. Without an initializer, a new instance uses default(string). |
EconomyData
Responsible for: The persisted economy. Balances are keyed by currency id and are not tamper-resistant. A currency with no entry has not been touched yet and starts from its configured starting amount. A blob written before the token lists existed loads with them empty.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.EconomyData. Declaration: public sealed class EconomyData. Source.
| Member | Type | Description |
|---|---|---|
Balances |
Dictionary<string, long> |
Balances. Declared initializer: new Dictionary<string, long>(). |
RecentGrantTokens |
List<string> |
The most recent grant tokens, oldest first. Bounded by the grantor's ring capacity. Declared initializer: new List<string>(). |
DurableGrantTokens |
List<string> |
Durable grant tokens, kept until released. Unbounded. Declared initializer: new List<string>(). |
EconomyFeature
Responsible for: Always composed: currencies exist even when every optional system is off. Registers the currency service, the reward handler registry (with the built-in currency handler), the reward grantor, the affordability guard, the win base reward step and currency continue method the result flow collects, and the CurrencyEarned, CurrencySpent and BalanceChanged signals.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.EconomyFeature. Declaration: public sealed class EconomyFeature : ICasualFeature. Source.
| Method | Description |
|---|---|
public EconomyFeature(CasualGameSettings settings) |
Creates EconomyFeature with the supplied dependencies and configuration. Throws ArgumentNullException when settings == null. |
public void Register(DIContainer container) |
Registers this feature’s services and signal bindings in the supplied container. Throws InvalidOperationException when save == null. Throws InvalidOperationException when position == null. |
| Member | Type | Description |
|---|---|---|
FeatureId |
string |
Feature Id. Declared initializer: "Economy". |
Id |
string |
Id. Getter returns FeatureId. |
Enabled |
bool |
Enabled. Getter returns true. |
Priority |
int |
After the Notices and PlayerSettings features, whose notice service the guard needs. Getter returns int.MinValue + 4. |
EconomySave
Responsible for: Currency balances and grant tokens. Found by the Saves catalog scan; the service saves once per operation.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.EconomySave. Declaration: public sealed class EconomySave : VersionedSaveModel<EconomyData>. Source.
| Method | Description |
|---|---|
public bool HasGrantToken(string token) |
True when the token is among the recent tokens or the durable ones. |
public GrantTokenSnapshot RecordGrantToken(string token, bool durable, int ringCapacity) |
Remembers a token in memory (the caller saves). A recent token drops the oldest ones beyond ringCapacity; a durable token never drops anything. Returns the state before the change. |
public void RestoreGrantTokens(GrantTokenSnapshot snapshot) |
Puts the token lists back as they were in snapshot (the caller saves). |
public bool ReleaseDurableGrantToken(string token) |
Removes a durable token in memory (the caller saves). Returns false when it was not durable. |
EconomySettingsSection
Responsible for: The economy's settings section: the currency list. A new section seeds the default SoftCurrencyId (Soft) and HardCurrencyId (Hard); the defaults can be renamed and re-iconed but never removed.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.EconomySettingsSection. Declaration: public sealed class EconomySettingsSection : ICasualSettingsSection. Source.
| Method | Description |
|---|---|
public EconomySettingsSection() |
Creates EconomySettingsSection with the supplied dependencies and configuration. |
public CurrencyDefinition Find(string id) |
The currency with this id, or null when there is none. |
public bool TryAdd(string id, string displayName, out string message) |
Adds a CurrencyRole.Custom currency. Fails with a message, and changes nothing, when the id is empty or already used, or when the display name is empty. Returns false when trimmedId.Length == 0. Returns false when string.IsNullOrWhiteSpace(displayName). Returns false when Find(trimmedId) != null. |
public bool TryRemove(string id, out string message) |
Removes a currency. Fails with a message, and changes nothing, for the default currencies, for the only Soft or only Hard currency, and for an unknown id. Returns false when currency == null. Returns false when currency.Id == SoftCurrencyId || currency.Id == HardCurrencyId. Returns false when guardedRole && Currencies.Count(c => c != null && c.Role == currency.Role) == 1. |
| Member | Type | Description |
|---|---|---|
SoftCurrencyId |
string |
Soft Currency Id. Declared initializer: "coin". |
HardCurrencyId |
string |
Hard Currency Id. Declared initializer: "gem". |
Currencies |
List<CurrencyDefinition> |
Currencies. Declared initializer: new List<CurrencyDefinition>(). |
Progression |
ProgressionRewardRules |
What a win grants and what a continue costs. Declared initializer: new ProgressionRewardRules(). |
GrantTokenSnapshot
Responsible for: The grant tokens as they were, so a failed grant can put them back.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.GrantTokenSnapshot. Declaration: public sealed class GrantTokenSnapshot. Source.
| Method | Description |
|---|---|
public GrantTokenSnapshot(IReadOnlyList<string> recent, IReadOnlyList<string> durable) |
Creates GrantTokenSnapshot with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
Recent |
IReadOnlyList<string> |
Recent. Read-only property. |
Durable |
IReadOnlyList<string> |
Durable. Read-only property. |
ICurrencyIcons
Responsible for: The icon the author gave each currency in the Editor. It is separate from ICurrencyService so a screen can show a currency without depending on balances, and it reads the definition each time so a re-iconed currency shows at once.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.ICurrencyIcons. Declaration: public interface ICurrencyIcons. Source.
| Method | Description |
|---|---|
Sprite IconOf(string currencyId) |
The currency's icon, or null for an unknown currency or one without an icon, which keeps the screen's own art. |
ICurrencyService
Responsible for: Persistent balances with earn, spend and affordability checks. Every mutation is saved once and then signalled; a rejected call changes, saves and signals nothing.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.ICurrencyService. Declaration: public interface ICurrencyService. Source.
| Method | Description |
|---|---|
long GetBalance(string currencyId) |
The balance, starting from the currency's configured amount on first access. Zero for an unknown currency, which is never given a balance. |
bool Earn(string currencyId, long amount, string source) |
Adds a positive amount, saturating at long.MaxValue. Returns false, with a log line, for a non-positive amount or an unknown currency. source says why, for the CurrencyEarned signal. |
bool CanAfford(IReadOnlyList<CurrencyAmount> cost) |
True when every entry of the cost is covered. Never changes anything. |
SpendResult TrySpend(IReadOnlyList<CurrencyAmount> cost, string reason) |
Charges the whole cost or nothing. Entries naming the same currency are added up before the check. reason says why, for the CurrencySpent signal. |
SpendResult
Responsible for: The outcome of a spend. A failed spend has changed nothing.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.SpendResult. Declaration: public readonly struct SpendResult. Source.
| Method | Description |
|---|---|
public static SpendResult Spent() |
Returns new SpendResult(SpendStatus.Spent, null). |
public static SpendResult Insufficient(string shortCurrencyId) |
Returns new SpendResult(SpendStatus.Insufficient, shortCurrencyId). |
public static SpendResult Invalid() |
Returns new SpendResult(SpendStatus.Invalid, null). |
| Member | Type | Description |
|---|---|---|
Status |
SpendStatus |
Status. Read-only property. |
ShortCurrencyId |
string |
The first currency, in cost order, the player cannot cover. Null unless Status is SpendStatus.Insufficient. Read-only property. |
Succeeded |
bool |
Succeeded. Getter returns Status == SpendStatus.Spent. |
SpendStatus
Responsible for: Identifies a successful, unaffordable or invalid currency spend.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.SpendStatus. Declaration: public enum SpendStatus. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Spent |
0 |
Every entry was charged. An empty cost is trivially spent. |
Insufficient |
1 |
At least one currency is short; nothing was charged. SpendResult.ShortCurrencyId names the first one. |
Invalid |
2 |
The cost itself is malformed (null, a non-positive amount, or an unknown currency); nothing was charged. |
Namespace: Ostryzhnyi.CasualGameCore.Economy.Rewards
AmountRange
Responsible for: An authored amount: a fixed value when Min equals Max, otherwise a range rolled when a bundle is resolved (chest rewards).
Qualified name: Ostryzhnyi.CasualGameCore.Economy.Rewards.AmountRange. Declaration: public struct AmountRange. Source.
| Method | Description |
|---|---|
public AmountRange(long min, long max) |
Creates AmountRange with the supplied dependencies and configuration. |
public static AmountRange Fixed(long amount) |
Returns new AmountRange(amount, amount). |
public long Resolve(IRandom random) |
A value from Min to Max. A fixed range, or an inverted one the validator reports, returns Min without drawing from random. |
| Member | Type | Description |
|---|---|---|
Min |
long |
Min. Without an initializer, a new instance uses default(long). |
Max |
long |
Max. Without an initializer, a new instance uses default(long). |
CurrencyRewardHandler
Responsible for: The built-in currency reward type: the item is a currency id, granted through ICurrencyService.Earn. Given the economy settings it also describes a currency by its display name and icon for the reward collection screen.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.Rewards.CurrencyRewardHandler. Declaration: public sealed class CurrencyRewardHandler : IRewardHandler, IRewardDescriber. Source.
| Method | Description |
|---|---|
public CurrencyRewardHandler() |
An authoring instance for the Editor catalog: it lists currencies but cannot grant. |
public CurrencyRewardHandler(ICurrencyService currency, EconomySettingsSection settings = null) |
Creates CurrencyRewardHandler with the supplied dependencies and configuration. settings: The currencies to describe; without it a currency is shown by its id. Throws ArgumentNullException when currency == null. |
public bool TryDescribe(string itemId, out string label, out Sprite icon) |
The display label and icon for an item, or false when the item is unknown. The icon may be null. |
public IReadOnlyList<string> GetItemChoices(CasualGameSettings settings) |
The item ids an entry of this type can name, for the Editor dropdown. |
public bool Grant(string itemId, long amount, string source) |
Grants amount of the item. Returns false, granting nothing, when the item is unknown or the handler cannot grant. source says why, for the owning signal. Returns false when _currency == null. |
| Member | Type | Description |
|---|---|---|
CurrencyTypeId |
string |
Currency Type Id. Declared initializer: "currency". |
TypeId |
string |
The id entries use to pick this handler, for example currency. Getter returns CurrencyTypeId. |
GrantResult
Responsible for: The outcome of granting a bundle under a token.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.Rewards.GrantResult. Declaration: public enum GrantResult. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Granted |
0 |
Every entry that has a handler was granted and the token is recorded. |
AlreadyGranted |
1 |
The token was recorded by an earlier grant, so nothing was granted again. |
Failed |
2 |
The token or the rewards were missing, or an entry's handler refused or threw. The token is not recorded, so a retry is allowed. Entries granted before the failing one stay granted: handlers should validate before they change anything. |
IRewardGrantor
Responsible for: Grants a resolved bundle at most once per caller-built token, for example win:{AttemptKey}, daily:{cycle}:{day} or chest:{session}:{cell}. The token is passed to each handler as the source.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.Rewards.IRewardGrantor. Declaration: public interface IRewardGrantor. Source.
| Method | Description |
|---|---|
GrantResult Grant(string token, IReadOnlyList<ResolvedReward> rewards) |
Grants every reward whose type has a handler, once per token. The token is remembered among the most recent ones, so a token is only guaranteed to be rejected until enough newer tokens have been granted. |
GrantResult GrantDurable(string token, IReadOnlyList<ResolvedReward> rewards) |
As Grant, but the token is kept until Release is called, however many other grants happen. For store-delivered purchases that may stay pending for a long time. |
bool Release(string token) |
Forgets a durable token once the store confirmed the order, so it stops using space. Returns false when the token is not a durable one. The same token can be granted again afterwards. |
IRewardHandler
Responsible for: Knows how to grant one reward type. A handler also needs a public parameterless constructor so the Editor can list it in the bundle drawer; give it its services through a second constructor, and make the parameterless one an authoring instance that cannot grant.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.Rewards.IRewardHandler. Declaration: public interface IRewardHandler. Source.
| Method | Description |
|---|---|
IReadOnlyList<string> GetItemChoices(CasualGameSettings settings) |
The item ids an entry of this type can name, for the Editor dropdown. |
bool Grant(string itemId, long amount, string source) |
Grants amount of the item. Returns false, granting nothing, when the item is unknown or the handler cannot grant. source says why, for the owning signal. |
| Member | Type | Description |
|---|---|---|
TypeId |
string |
The id entries use to pick this handler, for example currency. Read-only property. |
ResolvedReward
Responsible for: One reward with its amount settled: what a bundle resolves to, and what a handler grants.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.Rewards.ResolvedReward. Declaration: public readonly struct ResolvedReward. Source.
| Method | Description |
|---|---|
public ResolvedReward(string typeId, string itemId, long amount) |
Creates ResolvedReward with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
TypeId |
string |
Type Id. Read-only property. |
ItemId |
string |
Item Id. Read-only property. |
Amount |
long |
Amount. Read-only property. |
RewardBundle
Responsible for: A list of mixed reward entries: currencies, boosters and registered custom types.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.Rewards.RewardBundle. Declaration: public sealed class RewardBundle. Source.
| Method | Description |
|---|---|
public IReadOnlyList<ResolvedReward> Resolve(IRandom random) |
The bundle with every range rolled, in entry order. A null entry is skipped. Only an entry with a real range draws from random, so a bundle of fixed amounts never touches it. |
| Member | Type | Description |
|---|---|---|
Entries |
List<RewardEntry> |
Entries. Declared initializer: new List<RewardEntry>(). |
RewardEntry
Responsible for: One authored reward: what kind (TypeId, resolved by a handler), which item of that kind (ItemId), and how much. Plain data, so it survives refactors and keeps migrations simple.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.Rewards.RewardEntry. Declaration: public sealed class RewardEntry. Source.
| Member | Type | Description |
|---|---|---|
TypeId |
string |
Type Id. Without an initializer, a new instance uses default(string). |
ItemId |
string |
Item Id. Without an initializer, a new instance uses default(string). |
Amount |
AmountRange |
Amount. Declared initializer: AmountRange.Fixed(1). |
RewardGrantor
Responsible for: Dispatches resolved rewards through handlers and tracks grant tokens.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.Rewards.RewardGrantor. Declaration: public sealed class RewardGrantor : IRewardGrantor. Source.
| Method | Description |
|---|---|
public RewardGrantor(EconomySave save, RewardHandlerRegistry handlers, int ringCapacity = DefaultRingCapacity) |
Creates RewardGrantor with the supplied dependencies and configuration. handlers: Looked up for every grant, so a handler registered later still takes part. ringCapacity: How many recent, non-durable tokens to remember. Throws ArgumentOutOfRangeException when ringCapacity < 1. Throws ArgumentNullException when save == null. Throws ArgumentNullException when handlers == null. |
public GrantResult Grant(string token, IReadOnlyList<ResolvedReward> rewards) |
Grants using the bounded recent-token ring. Returns Failed for a blank token, missing rewards or a failing/throwing handler; AlreadyGranted for a recorded token; otherwise Granted. Unknown handlers are skipped. A failure restores tokens, but does not roll back earlier handler effects. |
public GrantResult GrantDurable(string token, IReadOnlyList<ResolvedReward> rewards) |
Uses the same grant rules as Grant, but retains the token outside the bounded ring until Release. Repeated recorded tokens return AlreadyGranted. |
public bool Release(string token) |
Returns false when no durable token is released. Saves and returns true after releasing an existing durable token. Returns false when !_save.ReleaseDurableGrantToken(token). |
| Member | Type | Description |
|---|---|---|
DefaultRingCapacity |
int |
How many recent tokens are remembered. Size it above the number of grants that can happen while a flow is in flight. Declared initializer: 128. |
RewardHandlerRegistry
Responsible for: The handlers by type id. Look handlers up when granting, never at composition, so a plan that registers after the registry was built (boosters) still takes part.
Qualified name: Ostryzhnyi.CasualGameCore.Economy.Rewards.RewardHandlerRegistry. Declaration: public sealed class RewardHandlerRegistry. Source.
| Method | Description |
|---|---|
public void Register(IRewardHandler handler) |
Adds a handler. Throws for a null handler, an empty type id, or a type id that is already registered. Throws ArgumentNullException when handler == null. Throws ArgumentException when string.IsNullOrWhiteSpace(typeId). Throws InvalidOperationException when _byTypeId.ContainsKey(typeId). |
public IRewardHandler Find(string typeId) |
The handler for a type id, or null. Quiet: use it for validation and authoring, and TryGet when granting. |
public bool TryGet(string typeId, out IRewardHandler handler) |
The handler for a type id. For an unknown id it returns false and logs one warning per id for the lifetime of this registry, so a misconfigured entry does not flood the log. Returns false after the preceding guards/branches. |
| Member | Type | Description |
|---|---|---|
All |
IReadOnlyList<IRewardHandler> |
Handlers in registration order. Getter returns _handlers. |
Namespace: Ostryzhnyi.CasualGameCore.Iap
EntitlementData
Responsible for: The persisted entitlement cache. A blob written before a field existed loads with that field empty.
Qualified name: Ostryzhnyi.CasualGameCore.Iap.EntitlementData. Declaration: public sealed class EntitlementData. Source.
| Member | Type | Description |
|---|---|---|
Owned |
List<string> |
The product ids the player has been seen to own, in the order they were first recorded. Declared initializer: new List<string>(). |
EntitlementFeature
Responsible for: Composes entitlements on top of the purchase service and always settles the ad-free state. It is not toggled: when purchases are not composed (the toggle is off, the platform is Disabled, or Real SDK cannot run) no entitlement is active, and the ad-free state is resolved as not owned so a due interstitial does not wait for an answer that cannot come. Otherwise it registers IEntitlementService and RestorePurchasesFlow and starts verification. Real SDK is the only mode in which the store, not the saved cache, decides.
Qualified name: Ostryzhnyi.CasualGameCore.Iap.EntitlementFeature. Declaration: public sealed class EntitlementFeature : ICasualFeature. Source.
| Method | Description |
|---|---|
public EntitlementFeature(CasualGameSettings settings, ServicePlatform? platform = null) |
Creates EntitlementFeature with the supplied dependencies and configuration. platform: The platform to compose for; the running one when null. For tests. Throws ArgumentNullException when settings == null. |
public void Register(DIContainer container) |
Registers this feature’s services and signal bindings in the supplied container. |
| Member | Type | Description |
|---|---|---|
FeatureId |
string |
Feature Id. Declared initializer: "Entitlements". |
Id |
string |
Id. Getter returns FeatureId. |
Enabled |
bool |
Enabled. Getter returns true. |
Priority |
int |
After the IAP feature. Getter returns int.MinValue + 7. |
EntitlementSave
Responsible for: A versioned cache of the owned entitlement ids. It is only a cache: in Real SDK mode an entitlement is active only after the store verifies it in the current session, so what is saved here drives a "restoring" display and nothing else. In Simulation it is the record. Found by the Saves catalog scan; every change is saved at once.
Qualified name: Ostryzhnyi.CasualGameCore.Iap.EntitlementSave. Declaration: public sealed class EntitlementSave : VersionedSaveModel<EntitlementData>. Source.
| Method | Description |
|---|---|
public bool Contains(string productId) |
Whether the product id is recorded as owned. An empty id is never owned. |
public bool Add(string productId) |
Records the product id as owned and saves before returning. Returns false, and writes nothing, when it was already recorded or is empty. Returns false when string.IsNullOrWhiteSpace(productId) || Contains(productId). |
| Member | Type | Description |
|---|---|---|
Owned |
IReadOnlyList<string> |
The recorded product ids, in the order they were first recorded. Getter returns OwnedList().AsReadOnly(). |
EntitlementService
Responsible for: Keeps the entitlements the store sells once and wires Remove Ads to the ad-free state.
Qualified name: Ostryzhnyi.CasualGameCore.Iap.EntitlementService. Declaration: public sealed class EntitlementService : IEntitlementService. Source.
With a verifying store (Real SDK) it waits for the purchase service to initialize, asks it IsOwned for every non-consumable in the catalog, and activates only the ones the store confirms; the saved cache is never trusted. A store that does not answer within the timeout leaves everything it did not confirm inactive and still resolves, so ads are never blocked indefinitely. Without a verifying store (Simulation) the saved record is authoritative and resolves at once. A product the store delivers, bought or restored, is recorded through Activate and is active from then on. The ad-free state is told once ownership is known, with false when nothing is owned, because an unresolved state makes the interstitial scheduler wait out its own timeout.
| Method | Description |
|---|---|
public EntitlementService(IIapService iap, EntitlementSave save, ShopSettingsSection shop, IAdFreeState adFree, bool storeVerifies, double verificationSeconds = DefaultVerificationSeconds, Action<IEnumerator> run = null, Func<double> seconds = null) |
Creates EntitlementService with the supplied dependencies and configuration. iap: The purchase service whose store verifies ownership. save: The persisted cache of owned product ids. shop: The offer catalog: which products are non-consumable, and which one is Remove Ads. adFree: The ad-free state Remove Ads drives. storeVerifies: True for Real SDK, where only the store can make an entitlement active. verificationSeconds: How long to wait for the store to initialize and answer. run: Starts a coroutine; the shared tween core's runner when null. seconds: A monotonic clock in seconds; real time when null. Throws ArgumentOutOfRangeException when !(verificationSeconds > 0) || double.IsInfinity(verificationSeconds). Throws ArgumentNullException when iap == null. Throws ArgumentNullException when save == null. Throws ArgumentNullException when shop == null. Throws ArgumentNullException when adFree == null. |
public bool IsActive(string productId) |
Whether the entitlement is active. In Real SDK mode only a store answer makes it so, never the saved cache alone; in Simulation the saved record is authoritative. |
public bool IsRestoring(string productId) |
True while the saved cache claims the product but the store has not answered yet, so the Shop can show "restoring" instead of a buy button. Never true once IsResolved, and never for a product that is already active. |
public void Activate(string productId) |
Records the product as owned: active now, saved at once, and Remove Ads is passed to the ad-free state. Calling it again for the same product, as a restore or a redelivery with a new transaction id does, changes nothing. |
| Member | Type | Description |
|---|---|---|
DefaultVerificationSeconds |
double |
How long the store may take to answer before ownership resolves with what is confirmed so far. Declared initializer: 5. |
IsResolved |
bool |
True once ownership is known, whichever way: the store answered, the verification timed out, or no store verifies it (Simulation). Until then IsActive only reflects what was bought or restored this session. Getter returns _resolved. |
IEntitlementService
Responsible for: What the player owns that the store sells once. It is also the IEntitlementSink the purchase flow records a non-consumable product with, before the store is told the order was fulfilled.
Qualified name: Ostryzhnyi.CasualGameCore.Iap.IEntitlementService. Declaration: public interface IEntitlementService : IEntitlementSink. Source.
| Method | Description |
|---|---|
bool IsActive(string productId) |
Whether the entitlement is active. In Real SDK mode only a store answer makes it so, never the saved cache alone; in Simulation the saved record is authoritative. |
bool IsRestoring(string productId) |
True while the saved cache claims the product but the store has not answered yet, so the Shop can show "restoring" instead of a buy button. Never true once IsResolved, and never for a product that is already active. |
| Member | Type | Description |
|---|---|---|
IsResolved |
bool |
True once ownership is known, whichever way: the store answered, the verification timed out, or no store verifies it (Simulation). Until then IsActive only reflects what was bought or restored this session. Read-only property. |
IIapProvider
Responsible for: A store behind the purchase API. Implementations keep SDK types out of this surface, so a flow never sees one. Every callback is invoked exactly once, and a method that cannot proceed reports failure instead of throwing.
Qualified name: Ostryzhnyi.CasualGameCore.Iap.IIapProvider. Declaration: public interface IIapProvider. Source.
| Method | Description |
|---|---|
void Initialize(Action<bool> complete) |
Connects to the store and loads its products. complete receives whether the store is usable. |
void Purchase(string productId, Action<PurchaseResult> complete) |
Starts a purchase of one product. |
void Confirm(string transactionId, Action<bool> complete) |
Tells the store the order was fulfilled, once the grant is in place. Until then the store may deliver it again. complete receives whether the store accepted the confirmation. |
void Restore(Action<bool> complete) |
Asks the store for the player's earlier purchases; each arrives through Delivered. |
string GetPrice(string productId) |
The price text to show for a product, localized by the store; null when it is not known. |
bool IsOwned(string productId) |
Whether the store itself says the player owns a non-consumable product right now. A provider with no store behind it answers false; the saved cache is authoritative in Simulation. |
| Member | Type | Description |
|---|---|---|
SupportsRestore |
bool |
True when Restore does something. The Shop shows its Restore button only then (required on iOS). Read-only property. |
Delivered |
Action<PurchaseDelivery> |
An order that arrived outside a request: pending orders from an interrupted session at startup, a restore, or a deferred order that was approved. The same order may be delivered again until it is confirmed. |
IIapService
Responsible for: The purchase API the product calls. Flows never see a provider or an SDK. Every request ends in exactly one callback, and a request that cannot run reports PurchaseStatus.Unavailable at once instead of throwing.
Qualified name: Ostryzhnyi.CasualGameCore.Iap.IIapService. Declaration: public interface IIapService. Source.
| Method | Description |
|---|---|
void Purchase(string productId, Action<PurchaseResult> complete) |
Starts a purchase. A request before initialization, with an empty product id, or while another purchase is under way reports PurchaseStatus.Unavailable immediately. A provider that stays silent past the timeout is a failure. |
void Confirm(string transactionId, Action<bool> complete) |
Confirms a fulfilled order with the store. Reports false when the service is not ready or the store refused. |
void Restore(Action<bool> complete) |
Asks the store to redeliver earlier purchases. Reports false when restore is not supported or not ready. |
string GetPrice(string productId) |
The store's price text for a product, or null when it is not known or the service is not ready. |
bool IsOwned(string productId) |
Whether the store reports the product as owned; false when the service is not ready. |
| Member | Type | Description |
|---|---|---|
IsInitialized |
bool |
True once the provider has initialized and is ready to take requests. Read-only property. |
SupportsRestore |
bool |
True when the provider can restore purchases. Read-only property. |
Delivered |
Action<PurchaseDelivery> |
An order that arrived outside a request; see IIapProvider.Delivered. |
ISimulatedPurchasePresenter
Responsible for: Puts the fake purchase window on screen. The provider owns the timing and the result; the presenter only shows and hides the window, so the provider is testable without a View.
Qualified name: Ostryzhnyi.CasualGameCore.Iap.ISimulatedPurchasePresenter. Declaration: public interface ISimulatedPurchasePresenter. Source.
| Method | Description |
|---|---|
bool Show(string productName, string price, bool closable, Action closeRequested) |
Shows the window. closeRequested is called if the player presses the close button, which is only offered when closable is true. Returns false when there is no window to show. |
void Hide() |
Hides this view or UI element. |
IapFeature
Responsible for: Composes purchases when the IAP toggle is on and the platform's mode is not Disabled: a disabled platform composes nothing, so the feature gate hides every IAP-paid card while currency-paid ones stay. Simulation composes the visible fake store; Real SDK composes the provider of the chosen factory and, when it cannot run, composes nothing and warns. A platform with no mode-table row (the Editor on desktop, standalone) simulates.
Qualified name: Ostryzhnyi.CasualGameCore.Iap.IapFeature. Declaration: public sealed class IapFeature : ICasualFeature. Source.
| Method | Description |
|---|---|
public IapFeature(CasualGameSettings settings, ProviderRegistry registry = null, ServicePlatform? platform = null) |
Creates IapFeature with the supplied dependencies and configuration. registry: The installed provider factories; every public factory in the loaded assemblies when null. platform: The platform to compose for; the running one when null. For tests. Throws ArgumentNullException when settings == null. |
public void Register(DIContainer container) |
Registers this feature’s services and signal bindings in the supplied container. Throws InvalidOperationException when !(_factory == null) and typed == null. |
| Member | Type | Description |
|---|---|---|
FeatureId |
string |
Feature Id. Declared initializer: "Iap". |
Id |
string |
Id. Getter returns FeatureId. |
Enabled |
bool |
Enabled. Getter returns _enabled. |
Priority |
int |
After the Ads feature. Getter returns int.MinValue + 6. |
IapService
Responsible for: Runs purchases through one provider. It owns what no provider should have to: initialization gating, one request at a time, the timeout, a provider that throws, and callbacks that arrive twice.
Qualified name: Ostryzhnyi.CasualGameCore.Iap.IapService. Declaration: public sealed class IapService : IIapService. Source.
| Method | Description |
|---|---|
public IapService(IIapProvider provider, double timeoutSeconds = DefaultTimeoutSeconds, Action<IEnumerator> run = null, Func<double> seconds = null) |
Creates IapService with the supplied dependencies and configuration. run: Starts a coroutine; the shared tween core's runner when null. seconds: A monotonic clock in seconds; real time when null. Throws ArgumentOutOfRangeException when !(timeoutSeconds > 0) || double.IsInfinity(timeoutSeconds). Throws ArgumentNullException when provider == null. |
public void Purchase(string productId, Action<PurchaseResult> complete) |
Starts a purchase. A request before initialization, with an empty product id, or while another purchase is under way reports PurchaseStatus.Unavailable immediately. A provider that stays silent past the timeout is a failure. Throws ArgumentNullException when complete == null. |
public void Confirm(string transactionId, Action<bool> complete) |
Confirms a fulfilled order with the store. Reports false when the service is not ready or the store refused. Throws ArgumentNullException when complete == null. |
public void Restore(Action<bool> complete) |
Asks the store to redeliver earlier purchases. Reports false when restore is not supported or not ready. Throws ArgumentNullException when complete == null. |
public string GetPrice(string productId) |
The store's price text for a product, or null when it is not known or the service is not ready. Returns null when !_initialized. Returns null after the preceding guards/branches after a caught exception. |
public bool IsOwned(string productId) |
Whether the store reports the product as owned; false when the service is not ready. Returns false when !_initialized. Returns false after the preceding guards/branches after a caught exception. |
| Member | Type | Description |
|---|---|---|
DefaultTimeoutSeconds |
double |
How long a provider may stay silent before a purchase is reported as failed. Long, because a real store keeps its own purchase sheet open while the player decides; the store delivers a late order through IIapService.Delivered. Declared initializer: 120. |
IsInitialized |
bool |
True once the provider has initialized and is ready to take requests. Getter returns _initialized. |
SupportsRestore |
bool |
True when the provider can restore purchases. Returns false when !_initialized. Returns false after the preceding guards/branches after a caught exception. Read-only property. |
Delivered |
Action<PurchaseDelivery> |
An order that arrived outside a request; see IIapProvider.Delivered. |
IapSettingsSection
Responsible for: The purchase settings: which real provider to use and how the simulated store behaves.
Qualified name: Ostryzhnyi.CasualGameCore.Iap.IapSettingsSection. Declaration: public sealed class IapSettingsSection : ICasualSettingsSection. Source.
| Member | Type | Description |
|---|---|---|
ServiceId |
string |
The service id in the platform mode table. Declared initializer: "iap". |
ProviderId |
string |
The real provider to use when a platform's mode is Real SDK. Declared initializer: "unityiap". |
SimulationDelaySeconds |
float |
How long the fake purchase window stays on screen. Declared initializer: 1.5f. |
SimulationResult |
SimulatedPurchaseOutcome |
Simulation Result. Declared initializer: SimulatedPurchaseOutcome.Success. |
TimeoutSeconds |
float |
How long a provider may stay silent before a purchase is reported as failed. Declared initializer: 120f. |
VerificationTimeoutSeconds |
float |
How long a startup ownership check may wait for the store before Remove Ads is resolved as not owned. Short, because a paying player's ads and the Shop's buy button wait on it. Declared initializer: 5f. |
PurchaseDelivery
Responsible for: An order the store delivered outside a request: at startup, from a restore, or after a pending order was approved. The purchase flow handles it exactly like a delivered request.
Qualified name: Ostryzhnyi.CasualGameCore.Iap.PurchaseDelivery. Declaration: public readonly struct PurchaseDelivery. Source.
| Method | Description |
|---|---|
public PurchaseDelivery(string productId, string transactionId) |
Creates PurchaseDelivery with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
ProductId |
string |
Product Id. Read-only property. |
TransactionId |
string |
Transaction Id. Read-only property. |
PurchaseResult
Responsible for: The outcome of one purchase request.
Qualified name: Ostryzhnyi.CasualGameCore.Iap.PurchaseResult. Declaration: public readonly struct PurchaseResult. Source.
| Method | Description |
|---|---|
public static PurchaseResult Delivered(string transactionId) |
A delivered order. One with no transaction id cannot be told apart from a repeat, so it is a failure instead, the same way the reward grantor refuses a grant with no token. |
public override string ToString() |
Returns this value’s text representation. |
| Member | Type | Description |
|---|---|---|
Status |
PurchaseStatus |
Status. Read-only property. |
TransactionId |
string |
The store's id for the order; empty unless Status is PurchaseStatus.Delivered. Read-only property. |
IsDelivered |
bool |
Is Delivered. Getter returns Status == PurchaseStatus.Delivered. |
Cancelled |
PurchaseResult |
Cancelled. Getter returns new PurchaseResult(PurchaseStatus.Cancelled, null). |
Failed |
PurchaseResult |
Failed. Getter returns new PurchaseResult(PurchaseStatus.Failed, null). |
Pending |
PurchaseResult |
Pending. Getter returns new PurchaseResult(PurchaseStatus.Pending, null). |
Unavailable |
PurchaseResult |
Unavailable. Getter returns new PurchaseResult(PurchaseStatus.Unavailable, null). |
PurchaseStatus
Responsible for: How a purchase request ended. Only Delivered may grant a reward. Failed is the zero value on purpose, so a result that was never set can never be mistaken for a delivery.
Qualified name: Ostryzhnyi.CasualGameCore.Iap.PurchaseStatus. Declaration: public enum PurchaseStatus. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Failed |
0 |
The store or the provider reported an error, or stayed silent past the timeout. |
Delivered |
1 |
The store delivered the order. PurchaseResult.TransactionId identifies it. |
Cancelled |
2 |
The player backed out of the store's purchase sheet. |
Pending |
3 |
The order awaits approval, such as Ask to Buy. It arrives later as a PurchaseDelivery. |
Unavailable |
4 |
The request could not be made: not initialized, unknown product, or another purchase is under way. |
RestoreOutcome
Responsible for: How a restore request ended. What the restore found arrives as deliveries, not in this result.
Qualified name: Ostryzhnyi.CasualGameCore.Iap.RestoreOutcome. Declaration: public enum RestoreOutcome. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Completed |
0 |
The store finished the restore. Every earlier order it had was delivered and went through the purchase flow, so a restored entitlement is active and nothing was granted twice. A store with nothing to restore also completes. |
Failed |
1 |
The store reported an error, or stayed silent past the timeout. |
Unavailable |
2 |
Nothing was asked: the store cannot restore, is not ready, or another restore is under way. The Shop's Restore button is shown only where restore is supported, so this is a repeated tap or a store that is not up yet. |
RestorePurchasesFlow
Responsible for: Asks the store for the player's earlier purchases. It adds no grant path of its own: every restored order arrives as a delivery the purchase flow handles exactly like a purchase, so a restore grants a consumable once, runs a non-consumable's bundle never again, and activates the entitlement. Asking twice therefore grants nothing the second time.
Qualified name: Ostryzhnyi.CasualGameCore.Iap.RestorePurchasesFlow. Declaration: public sealed class RestorePurchasesFlow. Source.
One restore runs at a time, and a store that never answers is a failure after the timeout, so a silent store cannot leave the Restore button dead for the session. The flow shows no notice: the Shop decides what the player is told.
| Method | Description |
|---|---|
public RestorePurchasesFlow(IIapService iap, double timeoutSeconds = IapService.DefaultTimeoutSeconds, Action<IEnumerator> run = null, Func<double> seconds = null) |
Creates RestorePurchasesFlow with the supplied dependencies and configuration. iap: The purchase service that asks the store. timeoutSeconds: How long the store may stay silent before the restore is reported as failed. run: Starts a coroutine; the shared tween core's runner when null. seconds: A monotonic clock in seconds; real time when null. Throws ArgumentOutOfRangeException when !(timeoutSeconds > 0) || double.IsInfinity(timeoutSeconds). Throws ArgumentNullException when iap == null. |
public void Restore(Action<RestoreOutcome> complete = null) |
Starts a restore. complete is called exactly once with how it ended, at once when nothing was asked. |
| Member | Type | Description |
|---|---|---|
IsRunning |
bool |
True while a restore is under way. Getter returns _current != null. |
IsAvailable |
bool |
True when the store can restore and is ready, which is when the Shop shows its Restore button. Getter returns _iap.SupportsRestore. |
SimulatedIapProvider
Responsible for: The store that needs no SDK: it shows a fake purchase window for the configured delay and ends with the configured result. A purchase delivers a generated transaction id. It owns nothing and restores nothing: with no store behind it the saved entitlement cache is authoritative. Prices are the offers' configured price texts.
Qualified name: Ostryzhnyi.CasualGameCore.Iap.SimulatedIapProvider. Declaration: public sealed class SimulatedIapProvider : IIapProvider. Source.
| Method | Description |
|---|---|
public SimulatedIapProvider(IapSettingsSection settings, ShopSettingsSection shop, ISimulatedPurchasePresenter presenter, Action<IEnumerator> run = null, Func<double> seconds = null) |
Creates SimulatedIapProvider with the supplied dependencies and configuration. settings: Read at each purchase, so an edit during play takes effect on the next one. shop: The offer catalog: the price text and name of each product come from it. run: Starts a coroutine; the shared tween core's runner when null. seconds: A monotonic clock in seconds; real time when null. Throws ArgumentNullException when settings == null. Throws ArgumentNullException when shop == null. Throws ArgumentNullException when presenter == null. |
public void Initialize(Action<bool> complete) |
Connects to the store and loads its products. complete receives whether the store is usable. Throws ArgumentNullException when complete == null. |
public void Purchase(string productId, Action<PurchaseResult> complete) |
Starts a purchase of one product. Throws ArgumentNullException when complete == null. |
public void Confirm(string transactionId, Action<bool> complete) |
Tells the store the order was fulfilled, once the grant is in place. Until then the store may deliver it again. complete receives whether the store accepted the confirmation. Throws ArgumentNullException when complete == null. |
public void Restore(Action<bool> complete) |
Asks the store for the player's earlier purchases; each arrives through Delivered. Throws ArgumentNullException when complete == null. |
public string GetPrice(string productId) |
The price text to show for a product, localized by the store; null when it is not known. |
public bool IsOwned(string productId) |
Always false: with no store behind it the saved entitlement cache is authoritative. |
| Member | Type | Description |
|---|---|---|
SupportsRestore |
bool |
True so the Shop's Restore button can be tried in the Editor; restoring finds nothing. Getter returns true. |
Delivered |
Action<PurchaseDelivery> |
An order that arrived outside a request: pending orders from an interrupted session at startup, a restore, or a deferred order that was approved. The same order may be delivered again until it is confirmed. |
SimulatedPurchaseOutcome
Responsible for: What a simulated purchase ends with. Each value maps to one PurchaseStatus.
Qualified name: Ostryzhnyi.CasualGameCore.Iap.SimulatedPurchaseOutcome. Declaration: public enum SimulatedPurchaseOutcome. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Success |
0 |
Success. |
Cancel |
1 |
Cancel. |
Fail |
2 |
Fail. |
Pending |
3 |
Reports PurchaseStatus.Pending, then delivers the order after another delay. |
Unavailable |
4 |
Unavailable. |
SimulatedPurchasePresenter
Responsible for: Shows the fake purchase as a SimulatedPurchaseView through the View service.
Qualified name: Ostryzhnyi.CasualGameCore.Iap.SimulatedPurchasePresenter. Declaration: public sealed class SimulatedPurchasePresenter : ISimulatedPurchasePresenter. Source.
| Method | Description |
|---|---|
public SimulatedPurchasePresenter(Func<IViewService> viewService) |
Creates SimulatedPurchasePresenter with the supplied dependencies and configuration. viewService: Resolved on each use, because the View service lives in a scene and may not exist yet when this is composed. Throws ArgumentNullException when viewService == null. |
public bool Show(string productName, string price, bool closable, Action closeRequested) |
Shows the window. closeRequested is called if the player presses the close button, which is only offered when closable is true. Returns false when there is no window to show. Returns false when view == null. Returns false after the preceding guards/branches after a caught exception. |
public void Hide() |
Hides this view or UI element. |
SimulatedPurchaseView
Responsible for: The fake purchase window: the product, its price and a close button. It is a View on the Notice layer, so it looks and behaves the same in the Editor, on devices and on WebGL. The close button is only usable when the simulated result is SimulatedPurchaseOutcome.Cancel: otherwise the purchase cannot be dismissed early.
Qualified name: Ostryzhnyi.CasualGameCore.Iap.SimulatedPurchaseView. Declaration: public sealed class SimulatedPurchaseView : CasualView. Source.
| Method | Description |
|---|---|
public void Present(string productName, string price, bool closable) |
Sets the texts and whether the player may close the purchase early. Call before showing the View. |
| Member | Type | Description |
|---|---|---|
Layer |
Layers |
Layer. Getter returns Layers.Notice. |
CloseRequested |
Action |
The player pressed the close button, which is only possible while it is usable. |
Product |
string |
Product. Getter returns _productText != null ? _productText.text : string.Empty. |
Price |
string |
Price. Getter returns _priceText != null ? _priceText.text : string.Empty. |
CloseUsable |
bool |
True while the close button is shown and can be pressed. Getter returns _closable && _closeButton != null && _closeButton.gameObject.activeSelf && _closeButton.interactable. |
Namespace: Ostryzhnyi.CasualGameCore.LevelOfDay
ILevelOfDayService
Responsible for: Level of Day: one extra level a day, played on the game's own mechanic with a seed fixed by the date. The day changes at local midnight, read from trusted time; without trusted time it cannot start. The first win each day grants the configured reward.
Qualified name: Ostryzhnyi.CasualGameCore.LevelOfDay.ILevelOfDayService. Declaration: public interface ILevelOfDayService. Source.
| Method | Description |
|---|---|
void Open(Action<LevelOfDayOpenResult> complete) |
Reads today's state. The callback gets a blocked result, and nothing changes, when trusted time cannot be read. |
LevelOfDayCompletion CompleteActive() |
Grants the reward for the running Level of Day once (token levelofday:{day}) and records the win, in that order. Called by the result flow on a win. |
| Member | Type | Description |
|---|---|---|
ActiveDay |
DayNumber? |
The day of the Level of Day last started, which a win completes; null before the first start. Read-only property. |
LevelOfDayCompletion
Responsible for: Carries the result of completing a daily level.
Qualified name: Ostryzhnyi.CasualGameCore.LevelOfDay.LevelOfDayCompletion. Declaration: public readonly struct LevelOfDayCompletion. Source.
| Method | Description |
|---|---|
public LevelOfDayCompletion(LevelOfDayCompletionOutcome outcome, IReadOnlyList<ResolvedReward> rewards) |
Creates LevelOfDayCompletion with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
Outcome |
LevelOfDayCompletionOutcome |
Outcome. Read-only property. |
Rewards |
IReadOnlyList<ResolvedReward> |
What this call granted; empty unless Outcome is LevelOfDayCompletionOutcome.Completed. Read-only property. |
LevelOfDayCompletionOutcome
Responsible for: Identifies the outcome of a Level of Day completion.
Qualified name: Ostryzhnyi.CasualGameCore.LevelOfDay.LevelOfDayCompletionOutcome. Declaration: public enum LevelOfDayCompletionOutcome. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Completed |
0 |
The reward was granted and today's win recorded. |
AlreadyCompleted |
1 |
Today's win was already recorded, so nothing was granted. |
Failed |
2 |
There is no running Level of Day to complete, or the reward could not be granted. |
LevelOfDayComposition
Responsible for: Connects the main menu's Level of Day button to the service. The View service lives in a scene, so this runs from the scene's CasualGameInstaller, as Daily Rewards does, and replaces the controller an earlier scene made.
Qualified name: Ostryzhnyi.CasualGameCore.LevelOfDay.LevelOfDayComposition. Declaration: public static class LevelOfDayComposition. Source.
| Method | Description |
|---|---|
public static LevelOfDayController Connect(DIContainer container, Func<IViewService> views = null) |
Builds the LevelOfDayController and registers it. Returns null, and registers nothing, when Level of Day is not composed (no ILevelOfDayService). views: Resolved on use; ViewService.Instance when null. Throws ArgumentNullException when container == null. Returns null when !container.TryResolve(typeof(ILevelOfDayService), out var service). |
LevelOfDayController
Responsible for: Binds the main menu's Level of Day button: every time the menu opens it reads today's state and shows the button as available or done, and a press starts today's level. Without a View service it stays inert. A press that cannot start (no trusted time, or an attempt already running) changes nothing; the time provider raises its own network notice.
Qualified name: Ostryzhnyi.CasualGameCore.LevelOfDay.LevelOfDayController. Declaration: public sealed class LevelOfDayController : IDisposable. Source.
| Method | Description |
|---|---|
public LevelOfDayController(Func<IViewService> views, ILevelOfDayService service) |
Creates LevelOfDayController with the supplied dependencies and configuration. Throws ArgumentNullException when views == null. Throws ArgumentNullException when service == null. |
public void Dispose() |
Releases this instance’s owned subscriptions or pending work. Call it when the owning flow ends. |
LevelOfDayData
Responsible for: Stores the daily-level state used across launches.
Qualified name: Ostryzhnyi.CasualGameCore.LevelOfDay.LevelOfDayData. Declaration: public sealed class LevelOfDayData. Source.
| Member | Type | Description |
|---|---|---|
HasCompleted |
bool |
False until the first Level of Day has been won; LastCompletedDay means nothing before that. Without an initializer, a new instance uses default(bool). |
LastCompletedDay |
long |
The DayNumber of the day whose Level of Day was last won. Without an initializer, a new instance uses default(long). |
CompletedCount |
int |
How many days' Level of Day the player has won in all. Without an initializer, a new instance uses default(int). |
LevelOfDayFeature
Responsible for: Composes Level of Day when its toggle is on: declares the LevelOfDay feature the main-menu button is gated on, registers the ILevelOfDayService built from the saved day, trusted time and the reward grantor, and the LevelOfDayStep the win flow runs. Registration fails, and Level of Day stays off, when the time provider or the economy is not composed.
Qualified name: Ostryzhnyi.CasualGameCore.LevelOfDay.LevelOfDayFeature. Declaration: public sealed class LevelOfDayFeature : ICasualFeature. Source.
| Method | Description |
|---|---|
public LevelOfDayFeature(CasualGameSettings settings) |
Creates LevelOfDayFeature with the supplied dependencies and configuration. settings: The settings whose Level of Day toggle decides whether the feature composes. Throws ArgumentNullException when settings == null. |
public void Register(DIContainer container) |
Registers this feature’s services and signal bindings in the supplied container. Throws InvalidOperationException on the corresponding guard path. |
| Member | Type | Description |
|---|---|---|
FeatureId |
string |
Feature Id. Declared initializer: "LevelOfDay". |
Id |
string |
Id. Getter returns FeatureId. |
Enabled |
bool |
Enabled. Getter returns _settings.Toggles.LevelOfDay. |
Priority |
int |
After the Chest, whose slot in the win flow it takes over for Level of Day wins. Getter returns int.MinValue + 13. |
LevelOfDayOffer
Responsible for: Today's Level of Day as a plain value: which day it belongs to, its seed, and whether it has been won.
Qualified name: Ostryzhnyi.CasualGameCore.LevelOfDay.LevelOfDayOffer. Declaration: public readonly struct LevelOfDayOffer. Source.
| Method | Description |
|---|---|
public LevelOfDayOffer(DayNumber day, int seed, LevelOfDayStatus status) |
Creates LevelOfDayOffer with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
Day |
DayNumber |
Day. Read-only property. |
Seed |
int |
Seed. Read-only property. |
Status |
LevelOfDayStatus |
Status. Read-only property. |
LevelOfDayOpenResult
Responsible for: The answer to opening the menu: today's offer, or the reason trusted time could not be read.
Qualified name: Ostryzhnyi.CasualGameCore.LevelOfDay.LevelOfDayOpenResult. Declaration: public readonly struct LevelOfDayOpenResult. Source.
| Method | Description |
|---|---|
public LevelOfDayOpenResult(LevelOfDayOffer? offer, TimeFailure failure) |
Creates LevelOfDayOpenResult with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
Offer |
LevelOfDayOffer? |
Offer. Read-only property. |
Failure |
TimeFailure |
Failure. Read-only property. |
IsBlocked |
bool |
Is Blocked. Getter returns Offer == null. |
LevelOfDaySave
Responsible for: The day whose Level of Day the player last won. Versioned, so it migrates through the envelope; found by the Saves catalog scan.
Qualified name: Ostryzhnyi.CasualGameCore.LevelOfDay.LevelOfDaySave. Declaration: public sealed class LevelOfDaySave : VersionedSaveModel<LevelOfDayData>. Source.
| Method | Description |
|---|---|
public bool IsCompleted(DayNumber day) |
True when the Level of Day of day has been won, or of a later day because the clock moved back. |
public void RecordCompletion(DayNumber day) |
Remembers that the Level of Day of day was won, and saves it before returning. |
| Member | Type | Description |
|---|---|---|
CompletedCount |
int |
Completed Count. Getter returns Data.CompletedCount. |
LevelOfDaySeed
Responsible for: The same random seed for everyone on a given day, and a different one on each next day.
Qualified name: Ostryzhnyi.CasualGameCore.LevelOfDay.LevelOfDaySeed. Declaration: public static class LevelOfDaySeed. Source.
| Method | Description |
|---|---|
public static int For(DayNumber day) |
Returns a deterministic non-negative 31-bit seed derived from the supplied calendar day through unchecked 64-bit mixing. |
LevelOfDayService
Responsible for: Reads today's Level of Day from trusted time and starts it. The day boundary is local midnight, found as DayNumber.FromUtc does for Daily Rewards. A start or an open that cannot read time is blocked and changes nothing. The reward is granted under levelofday:{day} and only then is the win saved, so a win replayed after a crash between the two gets GrantResult.AlreadyGranted and still records the day once.
Qualified name: Ostryzhnyi.CasualGameCore.LevelOfDay.LevelOfDayService. Declaration: public sealed class LevelOfDayService : ILevelOfDayService. Source.
| Method | Description |
|---|---|
public LevelOfDayService(LevelOfDaySave save, LevelOfDaySettingsSection settings, ITimeProvider time, IRewardGrantor grantor, IRandom random, Func<ILevelOfDayLauncher> launcher, Func<DateTime, TimeSpan> localOffset = null) |
Creates LevelOfDayService with the supplied dependencies and configuration. launcher: Resolved on each start, because the mechanic's progression is connected after the project features. localOffset: The device's offset from UTC at a moment; the system time zone when null. For tests. Throws ArgumentNullException when save == null. Throws ArgumentNullException when settings == null. Throws ArgumentNullException when time == null. Throws ArgumentNullException when grantor == null. Throws ArgumentNullException when random == null. Throws ArgumentNullException when launcher == null. |
public void UseLauncher(Func<ILevelOfDayLauncher> launcher) |
Looks the launcher up somewhere else from now on. The service lives in the project container but the launcher is the progression service of a scene, registered in that scene's container, which the project container cannot see; each scene's installer points the service at its own. Throws ArgumentNullException when launcher == null. |
public void Open(Action<LevelOfDayOpenResult> complete) |
Reads today's state. The callback gets a blocked result, and nothing changes, when trusted time cannot be read. Throws ArgumentNullException when complete == null. |
public LevelOfDayCompletion CompleteActive() |
Grants the reward for the running Level of Day once (token levelofday:{day}) and records the win, in that order. Called by the result flow on a win. |
| Member | Type | Description |
|---|---|---|
ActiveDay |
DayNumber? |
The day of the Level of Day last started, which a win completes; null before the first start. Setter: private set. |
LevelOfDaySettingsSection
Responsible for: The Level of Day settings section: the bundle granted for the first win of each day. A section that was never saved starts with a Soft Currency reward and a little Hard Currency.
Qualified name: Ostryzhnyi.CasualGameCore.LevelOfDay.LevelOfDaySettingsSection. Declaration: public sealed class LevelOfDaySettingsSection : ICasualSettingsSection. Source.
| Member | Type | Description |
|---|---|---|
Reward |
RewardBundle |
Reward. Declared initializer: new RewardBundle { Entries = new List<RewardEntry> { new RewardEntry { TypeId = CurrencyRewardHandler.CurrencyTypeId, ItemId = EconomySettingsSection.SoftCurrencyId, Amount = AmountRange.Fixed(200) }, new RewardEntry { TypeId = CurrencyRewardHandler.CurrencyTypeId, ItemId = EconomySettingsSection.HardCurrencyId, Amount = AmountRange.Fixed(5) } } }. |
LevelOfDayStartOutcome
Responsible for: Identifies the outcome of a Level of Day start request.
Qualified name: Ostryzhnyi.CasualGameCore.LevelOfDay.LevelOfDayStartOutcome. Declaration: public enum LevelOfDayStartOutcome. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Started |
0 |
The attempt began on the connected mechanic. |
AlreadyCompleted |
1 |
Today's level was already won; nothing began. |
Blocked |
2 |
Trusted time could not be read; nothing began. |
Refused |
3 |
The progression service refused the start, for example because an attempt is running. |
LevelOfDayStartResult
Responsible for: Carries a Level of Day start outcome and its context.
Qualified name: Ostryzhnyi.CasualGameCore.LevelOfDay.LevelOfDayStartResult. Declaration: public readonly struct LevelOfDayStartResult. Source.
| Method | Description |
|---|---|
public LevelOfDayStartResult(LevelOfDayStartOutcome outcome, LevelOfDayOffer? offer) |
Creates LevelOfDayStartResult with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
Outcome |
LevelOfDayStartOutcome |
Outcome. Read-only property. |
Offer |
LevelOfDayOffer? |
Today's offer after the call; null when blocked. Read-only property. |
LevelOfDayStatus
Responsible for: What the Level of Day button shows for today.
Qualified name: Ostryzhnyi.CasualGameCore.LevelOfDay.LevelOfDayStatus. Declaration: public enum LevelOfDayStatus. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Available |
0 |
Available. |
Completed |
1 |
Completed. |
LevelOfDayStep
Responsible for: The win flow of a Level of Day, in the base reward's slot: grants the day's reward through ILevelOfDayService.CompleteActive and shows it on the Win popup. It applies only to a Level of Day win; the base reward and chest steps skip those wins.
Qualified name: Ostryzhnyi.CasualGameCore.LevelOfDay.LevelOfDayStep. Declaration: public sealed class LevelOfDayStep : IConditionalResultFlowStep. Source.
| Method | Description |
|---|---|
public LevelOfDayStep(ILevelOfDayService service, Func<IViewService> views, RewardHandlerRegistry handlers) |
Creates LevelOfDayStep with the supplied dependencies and configuration. views: Resolved on each use, because the View service lives in a scene. handlers: Describes a reward's item, for its icon. Throws ArgumentNullException when service == null. Throws ArgumentNullException when views == null. Throws ArgumentNullException when handlers == null. |
public bool AppliesTo(AttemptOutcome outcome) |
Returns whether this step applies to the supplied result context. |
public bool AppliesTo(ResultFlowContext context) |
A win of the day's extra level; every other win has the base reward instead. Throws ArgumentNullException when context == null. |
public void Run(ResultFlowContext context, Action done) |
Runs this result-flow step using the supplied context and completion operation. Throws ArgumentNullException when context == null. Throws ArgumentNullException when done == null. |
| Member | Type | Description |
|---|---|---|
Order |
int |
Order. Getter returns ResultFlowOrder.BaseReward. |
Namespace: Ostryzhnyi.CasualGameCore.Missions
CompleteUnitsMission
Responsible for: Win units. Every win adds one.
Qualified name: Ostryzhnyi.CasualGameCore.Missions.CompleteUnitsMission. Declaration: public sealed class CompleteUnitsMission : IMissionType. Source.
| Method | Description |
|---|---|
public bool IsAvailable(MissionEnvironment environment) |
Whether a mission of this type can be offered now. It depends on other systems (rating, boosters, a currency), so it is asked again whenever a slot is filled and when a saved mission is loaded. Throws ArgumentNullException when environment == null. |
public IDisposable Track(MissionEnvironment environment, Action<long> addProgress) |
Subscribes to this type's own signal and calls addProgress with the amount each qualifying event adds. Disposing the result unsubscribes. Returns a subscription that does nothing when the type's signal cannot exist. |
| Member | Type | Description |
|---|---|---|
TypeId |
string |
Type Id. Declared initializer: "complete_units". |
Id |
string |
The stable id saved with a mission and chosen in the Editor. Unique among registered types. Getter returns TypeId. |
DisplayTemplate |
string |
The text shown for a mission of this type, with {0} standing for its target, for example Complete {0} levels. Getter returns "Complete {0} levels". |
IMissionType
Responsible for: One kind of mission: what it is called, whether it can be offered right now, and which game events move it forward. A developer adds a kind by implementing this interface in any assembly, with a public parameterless constructor; the MissionTypeRegistry finds it without an edit to this package.
Qualified name: Ostryzhnyi.CasualGameCore.Missions.IMissionType. Declaration: public interface IMissionType. Source.
Progress is event-driven: a type subscribes to its own signal and reports how much each event adds. It never reads the clock, so a mission can neither be sped up nor held back by changing the device time.
| Method | Description |
|---|---|
bool IsAvailable(MissionEnvironment environment) |
Whether a mission of this type can be offered now. It depends on other systems (rating, boosters, a currency), so it is asked again whenever a slot is filled and when a saved mission is loaded. |
IDisposable Track(MissionEnvironment environment, Action<long> addProgress) |
Subscribes to this type's own signal and calls addProgress with the amount each qualifying event adds. Disposing the result unsubscribes. Returns a subscription that does nothing when the type's signal cannot exist. |
| Member | Type | Description |
|---|---|---|
Id |
string |
The stable id saved with a mission and chosen in the Editor. Unique among registered types. Read-only property. |
DisplayTemplate |
string |
The text shown for a mission of this type, with {0} standing for its target, for example Complete {0} levels. Read-only property. |
IMissionsService
Responsible for: The active missions and what moves them. Progress is event-driven: it never reads the clock, so changing the device time can neither finish a mission nor hold one back.
Qualified name: Ostryzhnyi.CasualGameCore.Missions.IMissionsService. Declaration: public interface IMissionsService : IDisposable. Source.
| Method | Description |
|---|---|
void Stop() |
Stops following signals. The missions and their progress stay as they are. |
| Member | Type | Description |
|---|---|---|
Slots |
IReadOnlyList<MissionSlot> |
The active missions in slot order. Empty until Start has repaired the profile. Read-only property. |
IsStarted |
bool |
True between Start and Stop. Read-only property. |
MissionClaimFlow
Responsible for: Claims a finished mission once and replaces it. The reward is granted under the token mission:{slot}:{generation} and only then is the slot replaced and saved, so a claim replayed after a crash between the two gets GrantResult.AlreadyGranted and still replaces the slot once. What was granted is shown through the reward presenter after the slot is replaced, and the caller hears about the claim once the player has dismissed it.
Qualified name: Ostryzhnyi.CasualGameCore.Missions.MissionClaimFlow. Declaration: public sealed class MissionClaimFlow. Source.
| Method | Description |
|---|---|
public MissionClaimFlow(MissionSlots slots, MissionsSettingsSection config, IRewardGrantor grantor, IRewardPresenter presenter, IRandom random) |
Creates MissionClaimFlow with the supplied dependencies and configuration. Throws ArgumentNullException when slots == null. Throws ArgumentNullException when config == null. Throws ArgumentNullException when grantor == null. Throws ArgumentNullException when presenter == null. Throws ArgumentNullException when random == null. |
public void Claim(int slot, Action<MissionClaimResult> complete = null) |
Claims the mission in slot. complete, if given, is called exactly once: at once when there was nothing to claim or the claim failed, and for a claim that granted something after the reward screen has been closed, so a screen that refreshes in it shows the new mission only after the reward. Throws ArgumentOutOfRangeException when slot < 0 || slot >= _slots.Slots.Count. |
MissionClaimOutcome
Responsible for: What happened when a mission was claimed.
Qualified name: Ostryzhnyi.CasualGameCore.Missions.MissionClaimOutcome. Declaration: public enum MissionClaimOutcome. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Claimed |
0 |
The reward was granted (now, or by an earlier run that died before the slot was replaced) and the slot holds a new mission. |
NotComplete |
1 |
The slot is empty or its mission is not finished, so nothing was granted and nothing changed. Claiming twice lands here the second time. |
Failed |
2 |
The reward could not be granted, or none is configured. Nothing was saved, so the claim can be tried again. |
MissionClaimResult
Responsible for: The outcome of a claim and the new mission that took the slot's place.
Qualified name: Ostryzhnyi.CasualGameCore.Missions.MissionClaimResult. Declaration: public readonly struct MissionClaimResult. Source.
| Method | Description |
|---|---|
public MissionClaimResult(MissionClaimOutcome outcome, int slot, MissionSlot replacement, IReadOnlyList<ResolvedReward> rewards) |
Creates MissionClaimResult with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
Outcome |
MissionClaimOutcome |
Outcome. Read-only property. |
Slot |
int |
The zero-based slot that was claimed. Read-only property. |
Replacement |
MissionSlot |
The mission now in the slot; null unless Outcome is MissionClaimOutcome.Claimed. Read-only property. |
Rewards |
IReadOnlyList<ResolvedReward> |
What this call granted. Empty unless this call did the granting: not for a replayed claim whose grant was already recorded. Read-only property. |
MissionCompleted
Responsible for: A mission just reached its target. Raised once per mission: progress stops at the target, so nothing advances or completes it again.
Qualified name: Ostryzhnyi.CasualGameCore.Missions.MissionCompleted. Declaration: public struct MissionCompleted. Source.
| Member | Type | Description |
|---|---|---|
Slot |
int |
The zero-based slot. Without an initializer, a new instance uses default(int). |
TypeId |
string |
Type Id. Without an initializer, a new instance uses default(string). |
Generation |
int |
The mission's generation, which the claim's grant token is built from. Without an initializer, a new instance uses default(int). |
MissionEnvironment
Responsible for: What a mission type may look at: the project settings, the services that are composed, and the game's signals. It is the only door a type needs, so a custom type in another assembly depends on nothing but this and the signal structs it counts.
Qualified name: Ostryzhnyi.CasualGameCore.Missions.MissionEnvironment. Declaration: public sealed class MissionEnvironment. Source.
| Method | Description |
|---|---|
public MissionEnvironment(DIContainer container, CasualGameSettings settings) |
Creates MissionEnvironment with the supplied dependencies and configuration. Throws ArgumentNullException when container == null. Throws ArgumentNullException when settings == null. |
public bool TryGet<T>(out T service) where T : class |
The composed service of type T, or false when that system is not composed. Returns false after the preceding guards/branches. |
public OstryzhnyiSignal<TEvent> Signal<TEvent>() where TEvent : struct |
The container's signal for TEvent. It is registered first when no system has done so yet, so a type can subscribe before the system that raises it is connected, and both end up on the same signal. |
| Member | Type | Description |
|---|---|---|
Settings |
CasualGameSettings |
Settings. Read-only property. |
MissionProgressService
Responsible for: Advances the active missions from the game's signals. Each enabled type follows its own signal and adds to the slot that holds that type; progress stops at the target, is saved once per change, and is reported through MissionProgressed and, the one time a mission reaches its target, MissionCompleted.
Qualified name: Ostryzhnyi.CasualGameCore.Missions.MissionProgressService. Declaration: public sealed class MissionProgressService : IMissionsService. Source.
| Method | Description |
|---|---|
public MissionProgressService(MissionSlots slots, MissionsSave save, MissionsSettingsSection config, MissionEnvironment environment, OstryzhnyiSignal<MissionProgressed> progressed, OstryzhnyiSignal<MissionCompleted> completed) |
Creates MissionProgressService with the supplied dependencies and configuration. Throws ArgumentNullException when slots == null. Throws ArgumentNullException when save == null. Throws ArgumentNullException when config == null. Throws ArgumentNullException when environment == null. Throws ArgumentNullException when progressed == null. Throws ArgumentNullException when completed == null. |
public void Stop() |
Stops following signals. The missions and their progress stay as they are. |
public void Dispose() |
Releases this instance’s owned subscriptions or pending work. Call it when the owning flow ends. |
| Member | Type | Description |
|---|---|---|
Slots |
IReadOnlyList<MissionSlot> |
The active missions in slot order. Empty until Start has repaired the profile. Getter returns _slots.Slots. |
IsStarted |
bool |
True between Start and Stop. Setter: private set. |
MissionProgressed
Responsible for: A mission moved forward and the new progress is saved.
Qualified name: Ostryzhnyi.CasualGameCore.Missions.MissionProgressed. Declaration: public struct MissionProgressed. Source.
| Member | Type | Description |
|---|---|---|
Slot |
int |
The zero-based slot. Without an initializer, a new instance uses default(int). |
TypeId |
string |
Type Id. Without an initializer, a new instance uses default(string). |
Progress |
long |
Progress. Without an initializer, a new instance uses default(long). |
Target |
long |
Target. Without an initializer, a new instance uses default(long). |
MissionSelector
Responsible for: Picks the type of a new mission. Pure: it reads nothing but its arguments, and draws from the supplied IRandom only when there is a real choice, so a seeded random gives the same pick every time.
Qualified name: Ostryzhnyi.CasualGameCore.Missions.MissionSelector. Declaration: public static class MissionSelector. Source.
| Method | Description |
|---|---|
public static string Pick(IReadOnlyList<string> available, IReadOnlyCollection<string> otherActive, string justCompleted, IRandom random) |
The first non-empty of: the available types that are not active in another slot and are not the one just completed; then the available types that are not active in another slot (the fallback for a catalog that is too small). One of that set is chosen at random, in the order available lists them. Returns null when every available type is already active. available: The ids that can be offered now, in a stable order. otherActive: The ids active in the other slots. justCompleted: The id of the mission just claimed, or null. Throws ArgumentNullException when available == null. Throws ArgumentNullException when otherActive == null. Throws ArgumentNullException when random == null. Returns null when candidates.Count == 0. |
MissionSlot
Responsible for: One of the three active missions: its type, how far it has to go, how far it has come, and the generation that makes its grant token unique. Plain data, saved as it is.
Qualified name: Ostryzhnyi.CasualGameCore.Missions.MissionSlot. Declaration: public sealed class MissionSlot. Source.
| Member | Type | Description |
|---|---|---|
TypeId |
string |
The IMissionType.Id of this mission; empty while the slot has no mission because the catalog cannot supply one. Declared initializer: "". |
Target |
long |
What the progress has to reach, selected from the type's configured range when the mission was made. Without an initializer, a new instance uses default(long). |
Progress |
long |
Progress so far; never above Target. Without an initializer, a new instance uses default(long). |
Generation |
int |
The value of the save's generation counter when this mission was made. The counter only grows, so the grant token mission:{slot}:{generation} is never the same for two missions. Without an initializer, a new instance uses default(int). |
IsEmpty |
bool |
Is Empty. Getter returns string.IsNullOrEmpty(TypeId). |
IsComplete |
bool |
True when the mission has a target and its progress has reached it. Getter returns !IsEmpty && Target > 0 && Progress >= Target. |
MissionSlotViewData
Responsible for: What one mission row of the Missions screen shows: the text, how far along, what claiming pays, and whether Claim is offered.
Qualified name: Ostryzhnyi.CasualGameCore.Missions.MissionSlotViewData. Declaration: public readonly struct MissionSlotViewData. Source.
| Method | Description |
|---|---|
public MissionSlotViewData(int slot, string typeId, string description, long progress, long target, string rewardText, bool isComplete, string rewardAmountText = null, UnityEngine.Sprite rewardIcon = null) |
Creates MissionSlotViewData with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
Slot |
int |
The zero-based slot; the row's Claim reports it. Read-only property. |
TypeId |
string |
The mission's type id; empty for a slot the catalog could not fill, which has no row. Read-only property. |
Description |
string |
The type's text with the target filled in, for example Use 3 boosters. Read-only property. |
Progress |
long |
Progress. Read-only property. |
Target |
long |
Target. Read-only property. |
RewardText |
string |
A short preview of the reward, for example 50 Coin. Read-only property. |
RewardAmountText |
string |
The reward's amount alone, for example 50 or 10-20, for a row that draws the item's icon beside it. Null when the caller gave none. Read-only property. |
RewardIcon |
UnityEngine.Sprite |
The icon of the reward's first item that has one, or null, which leaves the row's own art. Read-only property. |
IsComplete |
bool |
True when Claim is offered: the mission has reached its target. Read-only property. |
IsEmpty |
bool |
Is Empty. Getter returns string.IsNullOrEmpty(TypeId). |
Fraction |
float |
Progress as a part of the target, from 0 to 1. Getter returns Target <= 0 ? 0f : (float)System.Math.Min(1d, (double)Progress / Target). |
MissionSlots
Responsible for: The three active missions and the rules that keep them right: filling a fresh profile, replacing a claimed mission, and repairing a saved profile. It never grants anything; granting is the claim flow's job.
Qualified name: Ostryzhnyi.CasualGameCore.Missions.MissionSlots. Declaration: public sealed class MissionSlots. Source.
| Method | Description |
|---|---|
public MissionSlots(MissionsSave save, MissionsSettingsSection config, MissionTypeRegistry types, MissionEnvironment environment, IRandom random) |
Creates MissionSlots with the supplied dependencies and configuration. Throws ArgumentNullException when save == null. Throws ArgumentNullException when config == null. Throws ArgumentNullException when types == null. Throws ArgumentNullException when environment == null. Throws ArgumentNullException when random == null. |
public IMissionType TypeOf(string typeId) |
The mission type for an id, or null: an installed type, or for a configured spend_ entry the spend mission for its currency (discovery lists only the Soft Currency one). Returns null when string.IsNullOrEmpty(typeId). Returns null when config == null || !config.IsSpend || string.IsNullOrWhiteSpace(config.CurrencyId). |
public IReadOnlyList<string> AvailableTypeIds() |
The ids of the types that are enabled, configured, installed and available right now, in configuration order. |
public int Repair() |
Makes the slots right: fills a fresh profile with three different types, and replaces any slot whose type is no longer available, is unknown or disabled, repeats an earlier slot's type, or has no sensible target. Slots that are fine are left exactly as they are, progress included. Grants nothing. Saves once if anything changed. Returns how many slots changed. When the catalog cannot supply three different types, the slots it cannot fill stay empty and one warning is logged. |
public MissionSlot Replace(int index) |
Replaces the mission in index with a new one of a type that is neither active in another slot nor the one just completed, falling back to the just-completed type only when nothing else is left. The target is selected from the type's configured range and the generation moves on. Saves. Returns the new mission. Throws ArgumentOutOfRangeException when index < 0 || index >= slots.Count. |
| Member | Type | Description |
|---|---|---|
SlotCount |
int |
Exactly this many missions are active, each of a different type. Declared initializer: 3. |
Slots |
IReadOnlyList<MissionSlot> |
The active missions in slot order; always SlotCount of them once Repair has run. Getter returns Data.Slots. |
MissionTracking
Responsible for: The one-line way for a mission type to follow a signal: the built-ins and a custom type use the same helper.
Qualified name: Ostryzhnyi.CasualGameCore.Missions.MissionTracking. Declaration: public static class MissionTracking. Source.
| Method | Description |
|---|---|
public static IDisposable Count<TEvent>(MissionEnvironment environment, Func<TEvent, long> amountOf, Action<long> addProgress) where TEvent : struct |
Subscribes to the signal for TEvent and, for each event, passes amountOf's result to addProgress when it is above zero. Disposing the result unsubscribes. Throws ArgumentNullException when environment == null. Throws ArgumentNullException when amountOf == null. Throws ArgumentNullException when addProgress == null. |
MissionTypeConfig
Responsible for: How one mission type is offered: whether it is on, the range its target is selected from, what claiming it grants, and the text shown. The type itself is named by TypeId, which an IMissionType declares.
Qualified name: Ostryzhnyi.CasualGameCore.Missions.MissionTypeConfig. Declaration: public sealed class MissionTypeConfig. Source.
| Member | Type | Description |
|---|---|---|
TypeId |
string |
The id of the IMissionType this configures. Declared initializer: "". |
Enabled |
bool |
A type that is off is never offered, but its entry stays so it can be switched back on. Declared initializer: true. |
Target |
AmountRange |
The target of a new mission of this type is selected from AmountRange.Min to AmountRange.Max. Declared initializer: AmountRange.Fixed(1). |
Reward |
RewardBundle |
What claiming a finished mission of this type grants. Needs at least one reward. Declared initializer: new RewardBundle(). |
DisplayTemplate |
string |
The text shown for a mission of this type, with {0} for the target; empty uses the type's own template. Declared initializer: "". |
CurrencyId |
string |
The currency a spend mission counts. Empty for every other type. Declared initializer: "". |
IsSpend |
bool |
True for a spend-currency mission, whose id is SpendCurrencyMission.IdPrefix followed by its currency. Getter returns TypeId != null && TypeId.StartsWith(SpendCurrencyMission.IdPrefix, StringComparison.Ordinal). |
MissionTypeRegistry
Responsible for: The mission types available to the game. Discover builds it from every public concrete IMissionType with a public parameterless constructor in the loaded assemblies: the four built-ins, and any a developer adds in any assembly. A type that cannot be listed is skipped and named in Problems instead of failing the rest.
Qualified name: Ostryzhnyi.CasualGameCore.Missions.MissionTypeRegistry. Declaration: public sealed class MissionTypeRegistry. Source.
| Method | Description |
|---|---|
public void Register(IMissionType type) |
Adds a type. Throws for a null type, a blank id, or an id that is already registered. Throws ArgumentNullException when type == null. Throws ArgumentException when string.IsNullOrWhiteSpace(id). Throws InvalidOperationException when _byId.TryGetValue(id, out var existing). |
public IMissionType Find(string id) |
The type with this id, or null. |
public static MissionTypeRegistry Discover(IEnumerable<Assembly> assemblies = null) |
Builds a registry from the public mission types of assemblies, in type-name order; the loaded assemblies when null. Non-public types are left out, so test fixtures never become mission types. |
public static MissionTypeRegistry FromTypes(IEnumerable<Type> types) |
Builds the same registry from an indexed type catalog, preserving discovery filtering and problem reporting. Throws ArgumentNullException when types == null. |
| Member | Type | Description |
|---|---|---|
All |
IReadOnlyList<IMissionType> |
The types in registration order. Getter returns _types. |
Problems |
IReadOnlyList<string> |
One line per type that was skipped and why: no parameterless constructor, a constructor that threw, or an id already taken. Getter returns _problems. |
MissionsComposition
Responsible for: Starts Missions for the scene. It runs from the scene's CasualGameInstaller, after the mechanic is connected, because repairing the missions and following their signals depends on what the scene provides (the rating capability, Boosters). It also binds the Missions popup, whose View lives in the scene's View service, replacing the controller an earlier scene made.
Qualified name: Ostryzhnyi.CasualGameCore.Missions.MissionsComposition. Declaration: public static class MissionsComposition. Source.
| Method | Description |
|---|---|
public static IMissionsService Connect(DIContainer container, Func<IViewService> views = null) |
Starts the IMissionsService the container holds, which repairs the saved missions and follows their signals; running it again for the next scene follows each signal once. When missions can also be claimed, binds the Missions popup to them. Returns null, and does nothing, when Missions is not composed. views: Resolved on use; ViewService.Instance when null. Throws ArgumentNullException when container == null. Returns null when !container.TryResolve(typeof(IMissionsService), out var found). |
MissionsController
Responsible for: Binds the Missions popup to the active missions. Each time the popup opens it shows the three missions with their text, progress and reward preview, and Claim on the finished ones; while it is open a row moves as its mission progresses. A tap on Claim goes to MissionClaimFlow, and when the reward screen (which replaces this popup) is dismissed the popup comes back with the replacement mission. Knows the Missions popup only, and never opens it.
Qualified name: Ostryzhnyi.CasualGameCore.Missions.MissionsController. Declaration: public sealed class MissionsController : IDisposable. Source.
| Method | Description |
|---|---|
public MissionsController(Func<IViewService> views, MissionSlots slots, MissionsSettingsSection config, RewardHandlerRegistry handlers, MissionClaimFlow claim, OstryzhnyiSignal<MissionProgressed> progressed) |
Creates MissionsController with the supplied dependencies and configuration. views: Resolved once; without a View service the controller stays inert. Throws ArgumentNullException when views == null. Throws ArgumentNullException when slots == null. Throws ArgumentNullException when config == null. Throws ArgumentNullException when handlers == null. Throws ArgumentNullException when claim == null. Throws ArgumentNullException when progressed == null. |
public IReadOnlyList<MissionSlotViewData> BuildRows() |
The rows the popup would show right now, one per slot. |
public void Dispose() |
Releases this instance’s owned subscriptions or pending work. Call it when the owning flow ends. |
MissionsData
Responsible for: Stores the active missions and their saved progress.
Qualified name: Ostryzhnyi.CasualGameCore.Missions.MissionsData. Declaration: public sealed class MissionsData. Source.
| Member | Type | Description |
|---|---|---|
Slots |
List<MissionSlot> |
The active missions, in slot order. Empty on a fresh profile; MissionSlots fills it. Declared initializer: new List<MissionSlot>(). |
Generation |
int |
The highest generation handed to a mission so far; the next mission gets one more. Without an initializer, a new instance uses default(int). |
MissionsFeature
Responsible for: Composes Missions when its toggle is on: declares the Missions feature the navigation button is gated on and registers the installed mission types, the MissionSlots over the saved missions, the progress service and its signals, and, when the economy is composed, the MissionClaimFlow. A disabled Missions composes nothing: no service, no subscriptions. Registration neither repairs the slots nor starts the service, because the mechanic's rating answer only exists once its scene is connected; MissionsComposition.Connect does both from the scene's installer.
Qualified name: Ostryzhnyi.CasualGameCore.Missions.MissionsFeature. Declaration: public sealed class MissionsFeature : ICasualFeature. Source.
| Method | Description |
|---|---|
public MissionsFeature(CasualGameSettings settings) |
Creates MissionsFeature with the supplied dependencies and configuration. settings: The settings whose Missions toggle decides whether the feature composes. Throws ArgumentNullException when settings == null. |
public void Register(DIContainer container) |
Registers this feature’s services and signal bindings in the supplied container. Throws InvalidOperationException when !container.TryResolve(typeof(Saves), out var saves). Throws InvalidOperationException on the corresponding guard path. |
| Member | Type | Description |
|---|---|---|
FeatureId |
string |
Feature Id. Declared initializer: "Missions". |
Id |
string |
Id. Getter returns FeatureId. |
Enabled |
bool |
Enabled. Getter returns _settings.Toggles.Missions. |
Priority |
int |
After the Daily Rewards feature. Getter returns int.MinValue + 11. |
MissionsSave
Responsible for: The player's active missions: three slots and the generation counter. Versioned, so it migrates through the envelope; found by the Saves catalog scan. Mission progress is local state and not tamper-resistant.
Qualified name: Ostryzhnyi.CasualGameCore.Missions.MissionsSave. Declaration: public sealed class MissionsSave : VersionedSaveModel<MissionsData>. Source.
| Method | Description |
|---|---|
public void Save() |
Writes the slots and the counter to storage. |
MissionsSettingsSection
Responsible for: The Missions settings section: one MissionTypeConfig per mission type the project offers. A section that was never saved starts with the four built-in types, each with a sensible target range and a reward. The built-in types can be switched off but not removed; a spend-currency type for another currency, or a custom type, can be added and removed.
Qualified name: Ostryzhnyi.CasualGameCore.Missions.MissionsSettingsSection. Declaration: public sealed class MissionsSettingsSection : ICasualSettingsSection. Source.
| Method | Description |
|---|---|
public MissionsSettingsSection() |
Creates MissionsSettingsSection with the supplied dependencies and configuration. |
public MissionTypeConfig Find(string typeId) |
The configuration for a type id, or null. |
public bool TryAdd(string typeId, out string message) |
Configures another type with a default target range and reward. Fails with a message, and changes nothing, for a blank id or an id that is already configured. A spend_ id takes the rest of the id as its currency. Returns false when string.IsNullOrEmpty(id). Returns false when Find(id) != null. |
public bool TryRemove(string typeId, out string message) |
Removes a type's configuration. Fails with a message, and changes nothing, for a built-in type or an id that is not configured. Returns false when config == null. Returns false when BuiltInTypeIds.Contains(typeId). |
| Member | Type | Description |
|---|---|---|
BuiltInTypeIds |
IReadOnlyList<string> |
The types a project always has an entry for. Declared initializer: new[] { CompleteUnitsMission.TypeId, ThreeStarUnitsMission.TypeId, UseBoostersMission.TypeId, SpendCurrencyMission.IdPrefix + EconomySettingsSection.SoftCurrencyId }. |
Types |
List<MissionTypeConfig> |
Types. Declared initializer: new List<MissionTypeConfig>(). |
SpendCurrencyMission
Responsible for: Spend a configured currency. Whatever is spent of that currency adds its amount, whatever the reason. Only offered while the currency exists. The parameterless form is the Soft Currency, so discovery lists one; register another instance for another currency.
Qualified name: Ostryzhnyi.CasualGameCore.Missions.SpendCurrencyMission. Declaration: public sealed class SpendCurrencyMission : IMissionType. Source.
| Method | Description |
|---|---|
public SpendCurrencyMission() |
The mission for the Soft Currency. |
public SpendCurrencyMission(string currencyId) |
Creates SpendCurrencyMission with the supplied dependencies and configuration. currencyId: The currency whose spending counts; the mission's id is spend_ followed by it. Throws ArgumentNullException when currencyId == null. Throws ArgumentException when string.IsNullOrWhiteSpace(currencyId). |
public bool IsAvailable(MissionEnvironment environment) |
Whether a mission of this type can be offered now. It depends on other systems (rating, boosters, a currency), so it is asked again whenever a slot is filled and when a saved mission is loaded. Throws ArgumentNullException when environment == null. |
public IDisposable Track(MissionEnvironment environment, Action<long> addProgress) |
Subscribes to this type's own signal and calls addProgress with the amount each qualifying event adds. Disposing the result unsubscribes. Returns a subscription that does nothing when the type's signal cannot exist. |
| Member | Type | Description |
|---|---|---|
IdPrefix |
string |
Id Prefix. Declared initializer: "spend_". |
CurrencyId |
string |
Currency Id. Read-only property. |
Id |
string |
The stable id saved with a mission and chosen in the Editor. Unique among registered types. Getter returns IdPrefix + CurrencyId. |
DisplayTemplate |
string |
The text shown for a mission of this type, with {0} standing for its target, for example Complete {0} levels. Getter returns "Spend {0} " + CurrencyId. |
ThreeStarUnitsMission
Responsible for: Win units with three stars. Only offered while the mechanic rates its wins (AE15); a win with fewer stars, or with no rating at all, adds nothing.
Qualified name: Ostryzhnyi.CasualGameCore.Missions.ThreeStarUnitsMission. Declaration: public sealed class ThreeStarUnitsMission : IMissionType. Source.
| Method | Description |
|---|---|
public bool IsAvailable(MissionEnvironment environment) |
Whether a mission of this type can be offered now. It depends on other systems (rating, boosters, a currency), so it is asked again whenever a slot is filled and when a saved mission is loaded. Throws ArgumentNullException when environment == null. |
public IDisposable Track(MissionEnvironment environment, Action<long> addProgress) |
Subscribes to this type's own signal and calls addProgress with the amount each qualifying event adds. Disposing the result unsubscribes. Returns a subscription that does nothing when the type's signal cannot exist. |
| Member | Type | Description |
|---|---|---|
TypeId |
string |
Type Id. Declared initializer: "three_star_units". |
Id |
string |
The stable id saved with a mission and chosen in the Editor. Unique among registered types. Getter returns TypeId. |
DisplayTemplate |
string |
The text shown for a mission of this type, with {0} standing for its target, for example Complete {0} levels. Getter returns "Complete {0} levels with 3 stars". |
UseBoostersMission
Responsible for: Use boosters. Every acknowledged use of any booster adds one. Only offered while Boosters is composed.
Qualified name: Ostryzhnyi.CasualGameCore.Missions.UseBoostersMission. Declaration: public sealed class UseBoostersMission : IMissionType. Source.
| Method | Description |
|---|---|
public bool IsAvailable(MissionEnvironment environment) |
Whether a mission of this type can be offered now. It depends on other systems (rating, boosters, a currency), so it is asked again whenever a slot is filled and when a saved mission is loaded. Throws ArgumentNullException when environment == null. |
public IDisposable Track(MissionEnvironment environment, Action<long> addProgress) |
Subscribes to this type's own signal and calls addProgress with the amount each qualifying event adds. Disposing the result unsubscribes. Returns a subscription that does nothing when the type's signal cannot exist. |
| Member | Type | Description |
|---|---|---|
TypeId |
string |
Type Id. Declared initializer: "use_boosters". |
Id |
string |
The stable id saved with a mission and chosen in the Editor. Unique among registered types. Getter returns TypeId. |
DisplayTemplate |
string |
The text shown for a mission of this type, with {0} standing for its target, for example Complete {0} levels. Getter returns "Use {0} boosters". |
Namespace: Ostryzhnyi.CasualGameCore.Preferences
GameAudio
Responsible for: the shared music and feedback player. The DemoAudio prefab supplies its two AudioSources and four active clips. Music starts after saved settings apply. Confirmed UnitCompleted and BoosterUsed signals play Victory and BoosterUse through SFX; component destruction removes its subscriptions.
Qualified name: Ostryzhnyi.CasualGameCore.Preferences.GameAudio. Declaration: public class GameAudio : MonoBehaviour. Source.
| Member | Description |
|---|---|
public static GameAudio Instance { get; } |
The active player used by button feedback. A second simultaneous player is disabled. |
public void BindSignals(DIContainer container) |
Replaces subscriptions to completion and booster-use signals. Null disconnects them. |
public void PlaySound() |
Plays the SFX source's configured common button click. |
public void PlayEffect(AudioClip clip) |
Plays a non-null clip as a one-shot through the routed SFX source while the player is active. |
ButtonClickAudio
Responsible for: a single common click on Button.onClick, including pointer and submit activation. It subscribes while enabled and removes its listener when disabled. Packaged UI prefabs already include it.
Qualified name: Ostryzhnyi.CasualGameCore.Preferences.ButtonClickAudio. Declaration: public sealed class ButtonClickAudio : MonoBehaviour. Source.
No declared public API members beyond the inherited lifecycle.
AudioMixerOutput
Responsible for: Drives exposed AudioMixer parameters.
Qualified name: Ostryzhnyi.CasualGameCore.Preferences.AudioMixerOutput. Declaration: public sealed class AudioMixerOutput : IAudioVolumeOutput. Source.
| Method | Description |
|---|---|
public AudioMixerOutput(AudioMixer mixer) |
Creates AudioMixerOutput with the supplied dependencies and configuration. Throws ArgumentNullException when mixer == null. |
public bool TrySetVolumeDb(string parameter, float decibels) |
Returns _mixer.SetFloat(parameter, decibels). |
DefaultAudio
Responsible for: The packaged fallback; an assigned project mixer always takes precedence.
Qualified name: Ostryzhnyi.CasualGameCore.Preferences.DefaultAudio. Declaration: public static class DefaultAudio. Source.
| Method | Description |
|---|---|
public static AudioMixer ResolveMixer(UiSettingsSection section) |
Returns section.Mixer != null ? section.Mixer : Resources.Load<AudioMixer>(ResourcePath). |
| Member | Type | Description |
|---|---|---|
ResourcePath |
string |
Resource Path. Declared initializer: "Audio/CasualGameCore". |
HapticsService
Responsible for: Requests vibration only when the saved haptics preference allows it.
Qualified name: Ostryzhnyi.CasualGameCore.Preferences.HapticsService. Declaration: public sealed class HapticsService : IHapticsService. Source.
| Method | Description |
|---|---|
public HapticsService(IPlayerSettingsService settings, RuntimePlatform? platform = null, Action vibrate = null) |
Creates HapticsService with the supplied dependencies and configuration. platform: Application.platform when null. vibrate: Handheld.Vibrate when null. Throws ArgumentNullException when settings == null. |
public void Vibrate() |
Vibrates once. Does nothing when haptics are switched off or the platform has none. |
| Member | Type | Description |
|---|---|---|
IsSupported |
bool |
True on iOS and Android. WebGL and desktop have no vibration. Getter returns _platform == RuntimePlatform.IPhonePlayer || _platform == RuntimePlatform.Android. |
IAudioVolumeOutput
Responsible for: Where the music and sound volumes end up. A seam over AudioMixer, which cannot be built in a unit test.
Qualified name: Ostryzhnyi.CasualGameCore.Preferences.IAudioVolumeOutput. Declaration: public interface IAudioVolumeOutput. Source.
| Method | Description |
|---|---|
bool TrySetVolumeDb(string parameter, float decibels) |
Defines try set volume db for implementations of IAudioVolumeOutput. Returns: False when the output has no exposed parameter of that name. |
IHapticsService
Responsible for: Device vibration that respects the player's haptics switch.
Qualified name: Ostryzhnyi.CasualGameCore.Preferences.IHapticsService. Declaration: public interface IHapticsService. Source.
| Method | Description |
|---|---|
void Vibrate() |
Vibrates once. Does nothing when haptics are switched off or the platform has none. |
| Member | Type | Description |
|---|---|---|
IsSupported |
bool |
True on iOS and Android. WebGL and desktop have no vibration. Read-only property. |
IPlayerSettingsService
Responsible for: The player's music, sound and haptics switches and the policy links. A change applies at once, is saved at once, and survives a restart.
Qualified name: Ostryzhnyi.CasualGameCore.Preferences.IPlayerSettingsService. Declaration: public interface IPlayerSettingsService. Source.
| Method | Description |
|---|---|
void SetMusicEnabled(bool enabled) |
Applies, saves and signals. Setting the value it already has does nothing. |
void SetSoundEnabled(bool enabled) |
Updates sound enabled using the supplied value. |
void SetHapticsEnabled(bool enabled) |
Updates haptics enabled using the supplied value. |
void ApplyAll() |
Pushes the saved switches into the audio output. Called after composition, because nothing has applied them yet in a new session. |
bool OpenPrivacyPolicy() |
Opens privacy policy through this type’s configured UI or link handler. Returns: False when no valid link is configured; nothing is opened then. |
bool OpenTermsOfUse() |
Opens terms of use through this type’s configured UI or link handler. Returns: False when no valid link is configured; nothing is opened then. |
| Member | Type | Description |
|---|---|---|
MusicEnabled |
bool |
Music Enabled. Read-only property. |
SoundEnabled |
bool |
Sound Enabled. Read-only property. |
HapticsEnabled |
bool |
Haptics Enabled. Read-only property. |
PlayerSetting
Responsible for: Identifies a saved music, sound or haptics preference.
Qualified name: Ostryzhnyi.CasualGameCore.Preferences.PlayerSetting. Declaration: public enum PlayerSetting. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Music |
0 |
Music. |
Sound |
1 |
Sound. |
Haptics |
2 |
Haptics. |
PlayerSettingChanged
Responsible for: Raised after a player setting was saved and applied. It is raised whether or not an AudioMixer is assigned, so a game with its own audio can follow the switches. It is not raised when the new value equals the old one.
Qualified name: Ostryzhnyi.CasualGameCore.Preferences.PlayerSettingChanged. Declaration: public struct PlayerSettingChanged. Source.
| Member | Type | Description |
|---|---|---|
Setting |
PlayerSetting |
Setting. Without an initializer, a new instance uses default(PlayerSetting). |
Enabled |
bool |
Enabled. Without an initializer, a new instance uses default(bool). |
PlayerSettingsData
Responsible for: The persisted switches. A blob written before a field existed loads with that field's default (on).
Qualified name: Ostryzhnyi.CasualGameCore.Preferences.PlayerSettingsData. Declaration: public sealed class PlayerSettingsData. Source.
| Member | Type | Description |
|---|---|---|
MusicEnabled |
bool |
Music Enabled. Declared initializer: true. |
SoundEnabled |
bool |
Sound Enabled. Declared initializer: true. |
HapticsEnabled |
bool |
Haptics Enabled. Declared initializer: true. |
PlayerSettingsFeature
Responsible for: Always composed: sound, music and haptics switches exist even when every optional system is off. Registers IPlayerSettingsService, IHapticsService and the PlayerSettingChanged signal.
Qualified name: Ostryzhnyi.CasualGameCore.Preferences.PlayerSettingsFeature. Declaration: public sealed class PlayerSettingsFeature : ICasualFeature. Source.
| Method | Description |
|---|---|
public PlayerSettingsFeature(CasualGameSettings settings) |
Creates PlayerSettingsFeature with the supplied dependencies and configuration. Throws ArgumentNullException when settings == null. |
public void Register(DIContainer container) |
Registers this feature’s services and signal bindings in the supplied container. Throws InvalidOperationException when save == null. |
| Member | Type | Description |
|---|---|---|
FeatureId |
string |
Feature Id. Declared initializer: "PlayerSettings". |
Id |
string |
Id. Getter returns FeatureId. |
Enabled |
bool |
Enabled. Getter returns true. |
Priority |
int |
Priority. Getter returns int.MinValue + 3. |
PlayerSettingsSave
Responsible for: Music, sound and haptics switches. Found by the Saves catalog scan; the service saves on every change.
Qualified name: Ostryzhnyi.CasualGameCore.Preferences.PlayerSettingsSave. Declaration: public sealed class PlayerSettingsSave : VersionedSaveModel<PlayerSettingsData>. Source.
No declared public API members beyond the inherited lifecycle.
PlayerSettingsService
Responsible for: Reads and updates saved player preferences and their change signals.
Qualified name: Ostryzhnyi.CasualGameCore.Preferences.PlayerSettingsService. Declaration: public sealed class PlayerSettingsService : IPlayerSettingsService. Source.
| Method | Description |
|---|---|
public PlayerSettingsService(PlayerSettingsSave save, UiSettingsSection settings, IAudioVolumeOutput audio, OstryzhnyiSignal<PlayerSettingChanged> changed = null, Action<string> openUrl = null) |
Creates PlayerSettingsService with the supplied dependencies and configuration. audio: Null when no mixer is assigned: the first volume change then logs one hint and only the signal is raised. changed: Raised after every real change. openUrl: Opens a link; Application.OpenURL when null. Throws ArgumentNullException when save == null. Throws ArgumentNullException when settings == null. |
public void SetMusicEnabled(bool enabled) |
Applies, saves and signals. Setting the value it already has does nothing. |
public void SetSoundEnabled(bool enabled) |
Updates sound enabled using the supplied value. |
public void SetHapticsEnabled(bool enabled) |
Updates haptics enabled using the supplied value. |
public void ApplyAll() |
Pushes the saved switches into the audio output. Called after composition, because nothing has applied them yet in a new session. |
public bool OpenPrivacyPolicy() |
Opens privacy policy through this type’s configured UI or link handler. |
public bool OpenTermsOfUse() |
Opens terms of use through this type’s configured UI or link handler. |
| Member | Type | Description |
|---|---|---|
MutedDecibels |
float |
The lowest an AudioMixer volume goes: silent. Declared initializer: -80f. |
FullDecibels |
float |
Unattenuated. Declared initializer: 0f. |
MusicEnabled |
bool |
Music Enabled. Getter returns _save.Data.MusicEnabled. |
SoundEnabled |
bool |
Sound Enabled. Getter returns _save.Data.SoundEnabled. |
HapticsEnabled |
bool |
Haptics Enabled. Getter returns _save.Data.HapticsEnabled. |
PolicyLinkFeature
Responsible for: One policy link as a gate entry: enabled only while its URL is valid, and registers nothing. A FeatureGateBinder on the Settings button then hides it for an empty or invalid link, with no branch in the View.
Qualified name: Ostryzhnyi.CasualGameCore.Preferences.PolicyLinkFeature. Declaration: public sealed class PolicyLinkFeature : ICasualFeature. Source.
| Method | Description |
|---|---|
public PolicyLinkFeature(string id, CasualGameSettings settings) |
Creates PolicyLinkFeature with the supplied dependencies and configuration. id: PrivacyPolicyId or TermsOfUseId. Throws ArgumentNullException when settings == null. Throws ArgumentException on the corresponding guard path. |
public void Register(DIContainer container) |
Registers this feature’s services and signal bindings in the supplied container. |
| Member | Type | Description |
|---|---|---|
PrivacyPolicyId |
string |
Privacy Policy Id. Declared initializer: "PrivacyPolicyLink". |
TermsOfUseId |
string |
Terms Of Use Id. Declared initializer: "TermsOfUseLink". |
Id |
string |
Id. Read-only property. |
Enabled |
bool |
Enabled. Getter returns PolicyUrl.IsValid(_url()). |
Priority |
int |
Priority. Getter returns int.MinValue + 4. |
PolicyUrl
Responsible for: Shared by the Editor validator and the runtime, so a link that fails validation is never opened.
Qualified name: Ostryzhnyi.CasualGameCore.Preferences.PolicyUrl. Declaration: public static class PolicyUrl. Source.
| Method | Description |
|---|---|
public static bool IsValid(string value) |
True only for an absolute https:// URL with a host and no embedded credentials. Empty, relative, http:, file: and javascript: are not valid. |
UiSettingsSection
Responsible for: Settings-screen configuration: the AudioMixer whose exposed volume parameters the music and sound switches drive, and the policy links shown in Settings. A link left empty hides its button.
Qualified name: Ostryzhnyi.CasualGameCore.Preferences.UiSettingsSection. Declaration: public sealed class UiSettingsSection : ICasualSettingsSection. Source.
| Member | Type | Description |
|---|---|---|
Mixer |
AudioMixer |
Mixer. Without an initializer, a new instance uses default(AudioMixer). |
MusicVolumeParameter |
string |
Music Volume Parameter. Declared initializer: "MusicVolume". |
SoundVolumeParameter |
string |
Sound Volume Parameter. Declared initializer: "SoundVolume". |
PrivacyPolicyUrl |
string |
Privacy Policy Url. Declared initializer: "". |
TermsOfUseUrl |
string |
Terms Of Use Url. Declared initializer: "". |
Namespace: Ostryzhnyi.CasualGameCore.Progression
GameplayMechanic
Responsible for: Base class for a scene-placed mechanic. The installer injects the reporter into it, and the mechanic ends an attempt with Win or Lose. Stars are normalized here, so a mechanic can report what its own scoring produced.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.GameplayMechanic. Declaration: public abstract class GameplayMechanic : MonoBehaviour, IGameplayMechanic. Source.
| Method | Description |
|---|---|
public abstract void StartUnit(ProgressionContext context) |
Begin a fresh attempt at the unit in context. |
public abstract void RestartUnit(ProgressionContext context) |
Abandon the running attempt, if any, and begin a fresh one at the same unit. |
public abstract void ContinueUnit(ProgressionContext context) |
Resume a lost attempt after a continue method succeeded. |
public virtual void ApplyBooster(BoosterId booster, Action<bool> onResult) |
Default for a mechanic without boosters: the booster is not applied, so inventory keeps it. |
public virtual void SetPaused(bool paused) |
Pause or resume live gameplay. |
protected void Win(int? stars = null) |
Report a win. With rating enabled a value outside one to three is clamped; with rating disabled it is ignored. Either way the win is reported, and the first misuse is logged. |
protected void Lose() |
Reports a loss through the injected attempt reporter. Without injection, logs the missing-reporter diagnostic once and drops the outcome. |
| Member | Type | Description |
|---|---|---|
Capabilities |
MechanicCapabilities |
Override to declare rating support. Defaults to no capabilities. Getter returns default. |
AttemptOutcome
Responsible for: Identifies an attempt completion outcome.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.AttemptOutcome. Declaration: public enum AttemptOutcome. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Win |
0 |
Win. |
Lose |
1 |
Lose. |
AttemptState
Responsible for: Identifies the current state of a gameplay attempt.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.AttemptState. Declaration: public enum AttemptState. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Idle |
0 |
Idle. |
Running |
1 |
Running. |
Won |
2 |
Won. |
Lost |
3 |
Lost. |
ResultFlow |
4 |
Result Flow. |
AttemptStateMachine
Responsible for: The transition table with no side effects, so every state and trigger pair can be tested on its own. ProgressionService performs the work around an accepted transition.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.AttemptStateMachine. Declaration: public sealed class AttemptStateMachine. Source.
| Method | Description |
|---|---|
public bool TryFire(AttemptTrigger trigger) |
Move on trigger when the current state allows it. A refused trigger changes nothing. Returns false when next == null. |
| Member | Type | Description |
|---|---|---|
State |
AttemptState |
State. Setter: private set. |
Outcome |
AttemptOutcome? |
How the attempt ended; null until a win or loss is reported, and again once the attempt is over. Setter: private set. |
AttemptTrigger
Responsible for: Identifies the operation that initiated an attempt transition.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.AttemptTrigger. Declaration: public enum AttemptTrigger. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Start |
0 |
Start. |
ReportWin |
1 |
Report Win. |
ReportLose |
2 |
Report Lose. |
EnterResultFlow |
3 |
Enter Result Flow. |
Retry |
4 |
Retry. |
Continue |
5 |
Continue. |
Advance |
6 |
Advance. |
Abandon |
7 |
Abandon. |
RestartFromPause |
8 |
Restart From Pause. |
BoosterId
Responsible for: Stable identity of a booster, shared by booster definitions, inventory and the mechanic. Compared ordinally; a default value equals the empty id. Serializable so a booster definition asset can hold one.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.BoosterId. Declaration: public struct BoosterId : IEquatable<BoosterId>. Source.
| Method | Description |
|---|---|
public BoosterId(string value) |
Creates BoosterId with the supplied dependencies and configuration. |
public bool Equals(BoosterId other) |
Returns whether the supplied value represents the same value. |
public override bool Equals(object obj) |
Returns whether the supplied value represents the same value. |
public override int GetHashCode() |
Returns the hash code for this value. |
public override string ToString() |
Returns this value’s text representation. |
public static bool operator ==(BoosterId left, BoosterId right) |
Returns left.Equals(right). |
public static bool operator !=(BoosterId left, BoosterId right) |
Returns !left.Equals(right). |
| Member | Type | Description |
|---|---|---|
Value |
string |
Value. Getter returns _value ?? string.Empty. |
IsEmpty |
bool |
Is Empty. Getter returns string.IsNullOrEmpty(_value). |
ContinueUsed
Responsible for: A continue method succeeded and the lost attempt resumed. Raised after the progression service is back in the running state, and not for a method that failed or was cancelled.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.ContinueUsed. Declaration: public struct ContinueUsed. Source.
| Member | Type | Description |
|---|---|---|
MethodId |
string |
The ResultFlow.IContinueMethod.Id of the method that was used. Without an initializer, a new instance uses default(string). |
IAttemptReporter
Responsible for: How a mechanic tells Core the attempt ended. A report outside a running attempt is ignored.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.IAttemptReporter. Declaration: public interface IAttemptReporter. Source.
| Method | Description |
|---|---|
void ReportWin(int? stars) |
The attempt was won. stars is null when the mechanic has no rating. |
void ReportLose() |
Defines report lose for implementations of IAttemptReporter. |
IChestSchedule
Responsible for: Which units end with a Chest. The Chest feature registers it when it is on; with none registered, or with the feature off, no unit does. The win flow, the win popup's main button and the level path's golden markers all ask it, so they never disagree.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.IChestSchedule. Declaration: public interface IChestSchedule. Source.
| Method | Description |
|---|---|
bool IsChestLevel(int unitIndex) |
True when winning the unit at zero-based unitIndex opens a chest: its one-based number is a multiple of Interval. |
| Member | Type | Description |
|---|---|---|
Interval |
int |
Every how many units a chest is offered. Always at least 1; 1 offers one after every win. Read-only property. |
IGameplayMechanic
Responsible for: What a game mechanic implements so Core can run its attempts. The mechanic owns content and live state and reports the outcome through IAttemptReporter; it never knows about rewards, ads or saving.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.IGameplayMechanic. Declaration: public interface IGameplayMechanic. Source.
| Method | Description |
|---|---|
void StartUnit(ProgressionContext context) |
Begin a fresh attempt at the unit in context. |
void RestartUnit(ProgressionContext context) |
Abandon the running attempt, if any, and begin a fresh one at the same unit. |
void ContinueUnit(ProgressionContext context) |
Resume a lost attempt after a continue method succeeded. |
void ApplyBooster(BoosterId booster, Action<bool> onResult) |
Apply the booster effect. onResult receives true once the effect took hold and false when the booster could not be used, so inventory only spends a booster that was applied. It may be called later. |
void SetPaused(bool paused) |
Pause or resume live gameplay. |
| Member | Type | Description |
|---|---|---|
Capabilities |
MechanicCapabilities |
What the mechanic supports. Core reads it once at startup, so it must not change afterwards. Read-only property. |
ILevelOfDayLauncher
Responsible for: Runs the connected mechanic as the Level of Day. Such an attempt reports through the usual signals, flagged IsLevelOfDay, and a win leaves the player's place on the level path where it was.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.ILevelOfDayLauncher. Declaration: public interface ILevelOfDayLauncher. Source.
| Method | Description |
|---|---|
bool StartLevelOfDay(int seed) |
Starts a Level of Day attempt with seed from the menu. False when the state does not allow it. |
| Member | Type | Description |
|---|---|---|
IsLevelOfDay |
bool |
True while a Level of Day attempt is running or its result is still in the result flow. Read-only property. |
IProgressionPosition
Responsible for: The persisted progression counters and the only operations that change them.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.IProgressionPosition. Declaration: public interface IProgressionPosition. Source.
| Method | Description |
|---|---|
void Advance() |
Move to the next unit and count the one just won. A retry never calls this, so it never moves Position. |
int BeginAttempt() |
Count a started attempt and return its number, the attempt key that scopes reward grants. |
| Member | Type | Description |
|---|---|---|
Position |
int |
Zero-based index of the current unit. A fresh profile starts at 0. Read-only property. |
CompletedUnits |
int |
Units the player has won. Read-only property. |
TotalAttempts |
int |
Attempts started across all units. A retry is a new attempt. Read-only property. |
IProgressionService
Responsible for: The guarded attempt lifecycle. Every command returns true when it was accepted and false when the current state does not allow it; a refused command changes nothing and logs one line.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.IProgressionService. Declaration: public interface IProgressionService. Source.
| Method | Description |
|---|---|
bool StartCurrent() |
Start the unit at the current position, from the menu. |
bool Retry() |
Replay the same unit after a loss. The mechanic is told IsRetry = true. |
bool Continue() |
Resume a lost attempt after a continue method succeeded. Starts no new attempt. |
bool Advance() |
Move past a won unit. Call StartCurrent afterwards to play the next one. |
bool AbandonToMenu() |
Leave the attempt for the menu with no win or loss. |
bool RestartFromPause() |
Begin the running unit again from the pause menu. |
bool EnterResultFlow() |
The result-flow pipeline calls this once it takes over a won or lost attempt. |
| Member | Type | Description |
|---|---|---|
State |
AttemptState |
State. Read-only property. |
AttemptKey |
int |
The IProgressionPosition.TotalAttempts value assigned when the current attempt began, or 0 before the first one. It scopes attempt-bound reward grants. A continue keeps it. Read-only property. |
IRatingCapability
Responsible for: Whether the connected mechanic rates a win, so missions and the Win view can react to it.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.IRatingCapability. Declaration: public interface IRatingCapability. Source.
| Member | Type | Description |
|---|---|---|
IsEnabled |
bool |
Is Enabled. Read-only property. |
IScoredMechanic
Responsible for: Optional: a mechanic that keeps a score implements this so the Win and Lose popups can show it. Core has no score of its own, so a mechanic that does not implement it shows no score row at all.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.IScoredMechanic. Declaration: public interface IScoredMechanic. Source.
| Member | Type | Description |
|---|---|---|
Score |
long? |
The score of the attempt that just ended, read once when the result flow starts, or null when there is none. The mechanic sets it before it reports the win or the loss. Read-only property. |
MechanicCapabilities
Responsible for: What a mechanic can do beyond win and lose. Core reads it once at startup.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.MechanicCapabilities. Declaration: public readonly struct MechanicCapabilities. Source.
| Method | Description |
|---|---|
public MechanicCapabilities(bool supportsRating) |
Creates MechanicCapabilities with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
SupportsRating |
bool |
The mechanic reports a one to three star rating with its win. Read-only property. |
ProgressionComposition
Responsible for: Connects a scene's mechanic to progression. The mechanic only exists once its scene has loaded, so this runs from the scene's CasualGameInstaller rather than from a project-level feature.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.ProgressionComposition. Declaration: public static class ProgressionComposition. Source.
| Method | Description |
|---|---|
public static ProgressionService Connect(DIContainer container, IGameplayMechanic mechanic) |
Registers the unit signals, IProgressionService, IAttemptReporter, IRatingCapability and IProgressionPosition. Safe to call again for the next scene's mechanic: the signals stay, so existing subscribers keep listening, and the services are replaced. Throws ArgumentNullException when container == null. Throws ArgumentNullException when mechanic == null. Throws InvalidOperationException when save == null. |
public static ProgressionFlow ConnectFlow(DIContainer container, IGameplayMechanic mechanic, Func<IViewService> views = null) |
Builds the result pipeline, the continue registry and the menu, HUD, pause, win and lose controllers for the connected mechanic, and registers the pipeline and registry. Call it after Connect, once every feature has registered. Other features add to the flow by registering their IResultFlowStep or IContinueMethod instance under its own concrete type; this collects every one registered in container and its parents. The flow replaces the one a previous call built and disposes it, so the signals never reach two sets of controllers. views: Resolved on each use, because the View service lives in a scene. Defaults to ViewService.Instance. Throws ArgumentNullException when container == null. Throws ArgumentNullException when mechanic == null. Throws InvalidOperationException when !container.TryResolve(typeof(IProgressionService), out var service). |
ProgressionContext
Responsible for: What Core tells the mechanic about the unit it is about to run.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.ProgressionContext. Declaration: public readonly struct ProgressionContext. Source.
| Method | Description |
|---|---|
public ProgressionContext(int index, ProgressionKind kind, int attemptNumber, bool isRetry, bool isContinue, bool isLevelOfDay = false, int seed = 0) |
Creates ProgressionContext with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
IsLevelOfDay |
bool |
True when this is the day's extra level rather than the unit at the player's place. The mechanic plays its usual content, picked from Seed, and Index is the player's place so the difficulty matches. Winning it does not move that place. Read-only property. |
Seed |
int |
For a Level of Day, the same value all day, for every player and every attempt; 0 otherwise. Read-only property. |
Index |
int |
Zero-based position of the unit. A retry keeps it; only a win advances it. Read-only property. |
Kind |
ProgressionKind |
Kind. Read-only property. |
AttemptNumber |
int |
1 for the first attempt at Index. Read-only property. |
IsRetry |
bool |
True when the player replays the same unit after a loss. Read-only property. |
IsContinue |
bool |
True when the player resumes a lost attempt through a continue method. Read-only property. |
ProgressionData
Responsible for: The persisted counters. A blob written before a field existed loads with that field at 0.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.ProgressionData. Declaration: public sealed class ProgressionData. Source.
| Member | Type | Description |
|---|---|---|
Position |
int |
Position. Without an initializer, a new instance uses default(int). |
CompletedUnits |
int |
Completed Units. Without an initializer, a new instance uses default(int). |
TotalAttempts |
int |
Total Attempts. Without an initializer, a new instance uses default(int). |
ProgressionFlow
Responsible for: The wired lifecycle for one scene's mechanic: the pipeline, the continue registry and the controllers bound to them. ProgressionComposition.ConnectFlow builds it and disposes the one it replaces, so a second scene never leaves two controllers answering the same signal.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.ProgressionFlow. Declaration: public sealed class ProgressionFlow : IDisposable. Source.
| Method | Description |
|---|---|
public void Dispose() |
Releases this instance’s owned subscriptions or pending work. Call it when the owning flow ends. |
| Member | Type | Description |
|---|---|---|
Pipeline |
ResultFlowPipeline |
Pipeline. Read-only property. |
Continues |
ContinueRegistry |
Continues. Read-only property. |
ProgressionKind
Responsible for: Whether the mechanic is played as numbered levels or as an open-ended session.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.ProgressionKind. Declaration: public enum ProgressionKind. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Level |
0 |
Level. |
Session |
1 |
Session. |
ProgressionLabels
Responsible for: The player-facing name of a unit, in one one-based form for the menu, HUD, win and lose screens. The stored index stays zero-based (IProgressionPosition.Position); only the text is shifted, so no screen shows the raw index or a number from a different moment than the one it describes.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.ProgressionLabels. Declaration: public static class ProgressionLabels. Source.
| Method | Description |
|---|---|
public static int Number(int index) |
The one-based number of the unit at zero-based index; a negative index counts as the first. |
public static string Unit(ProgressionKind kind, int index) |
The heading for a unit, such as LEVEL 3 or SESSION 3. |
public static string Unit(ProgressionKind kind, int index, bool isLevelOfDay) |
The heading for a unit, or LevelOfDay when the attempt is the day's extra level. |
| Member | Type | Description |
|---|---|---|
LevelOfDay |
string |
The heading of the day's extra level, whatever the player's place. Declared initializer: "LEVEL OF DAY". |
ProgressionSave
Responsible for: Where the player is. Found by the Saves catalog scan; every change is saved at once. A save written by a newer build is read-only: changes stay in memory and the stored blob is left alone.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.ProgressionSave. Declaration: public sealed class ProgressionSave : VersionedSaveModel<ProgressionData>, IProgressionPosition. Source.
| Method | Description |
|---|---|
public void Advance() |
Move to the next unit and count the one just won. A retry never calls this, so it never moves Position. |
public int BeginAttempt() |
Count a started attempt and return its number, the attempt key that scopes reward grants. |
| Member | Type | Description |
|---|---|---|
Position |
int |
Zero-based index of the current unit. A fresh profile starts at 0. Getter returns Data.Position. |
CompletedUnits |
int |
Units the player has won. Getter returns Data.CompletedUnits. |
TotalAttempts |
int |
Attempts started across all units. A retry is a new attempt. Getter returns Data.TotalAttempts. |
ProgressionService
Responsible for: Runs attempts for the connected mechanic and raises the unit signals. It is also the IAttemptReporter the mechanic reports to, so a report outside a running attempt is refused here.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.ProgressionService. Declaration: public sealed class ProgressionService : IProgressionService, IAttemptReporter, ILevelOfDayLauncher. Source.
The state moves before anything else happens, so a mechanic that reports from inside StartUnit already finds the attempt running, and a signal handler already sees the new state. UnitStarted and UnitRestarted are raised just before the mechanic is told, for the same reason: a synchronous win must not be announced ahead of its own start.
| Method | Description |
|---|---|
public ProgressionService(IProgressionPosition position, IGameplayMechanic mechanic, ProgressionKind kind, OstryzhnyiSignal<UnitStarted> started = null, OstryzhnyiSignal<UnitCompleted> completed = null, OstryzhnyiSignal<UnitFailed> failed = null, OstryzhnyiSignal<UnitRestarted> restarted = null, OstryzhnyiSignal<UnitAbandoned> abandoned = null) |
Creates ProgressionService with the supplied dependencies and configuration. kind: Whether the mechanic is played as levels or as a session; copied into every context. started: Each signal may be null: an unwatched event costs nothing. Throws ArgumentNullException when position == null. Throws ArgumentNullException when mechanic == null. |
public bool StartCurrent() |
Start the unit at the current position, from the menu. Returns false when !Accept(AttemptTrigger.Start). |
public bool StartLevelOfDay(int seed) |
Starts a Level of Day attempt with seed from the menu. False when the state does not allow it. Returns false when !Accept(AttemptTrigger.Start). |
public bool Retry() |
Replay the same unit after a loss. The mechanic is told IsRetry = true. |
public bool RestartFromPause() |
Begin the running unit again from the pause menu. |
public bool Continue() |
Resume a lost attempt after a continue method succeeded. Starts no new attempt. Returns false when !Accept(AttemptTrigger.Continue). |
public bool Advance() |
Move past a won unit. Call StartCurrent afterwards to play the next one. Returns false when !Accept(AttemptTrigger.Advance). |
public bool AbandonToMenu() |
Leave the attempt for the menu with no win or loss. Returns false when !Accept(AttemptTrigger.Abandon). |
public bool EnterResultFlow() |
The result-flow pipeline calls this once it takes over a won or lost attempt. |
| Member | Type | Description |
|---|---|---|
State |
AttemptState |
State. Getter returns _machine.State. |
AttemptKey |
int |
The IProgressionPosition.TotalAttempts value assigned when the current attempt began, or 0 before the first one. It scopes attempt-bound reward grants. A continue keeps it. Setter: private set. |
IsLevelOfDay |
bool |
True while a Level of Day attempt is running or its result is still in the result flow. Getter returns _isLevelOfDay. |
ProgressionSettingsSection
Responsible for: Progression configuration. Rating support is a mechanic capability, so it is shown in the tab, not stored here.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.ProgressionSettingsSection. Declaration: public sealed class ProgressionSettingsSection : ICasualSettingsSection. Source.
| Member | Type | Description |
|---|---|---|
Kind |
ProgressionKind |
Whether the mechanic is played as numbered levels or as an open-ended session. Declared initializer: ProgressionKind.Level. |
PauseUsesTimeScale |
bool |
Pause also sets Time.timeScale to 0. Off by default: a mechanic that pauses itself needs no global change. Without an initializer, a new instance uses default(bool). |
RatingCapability
Responsible for: The IRatingCapability composition registers, fixed from the mechanic's capabilities.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.RatingCapability. Declaration: public sealed class RatingCapability : IRatingCapability. Source.
| Method | Description |
|---|---|
public RatingCapability(MechanicCapabilities capabilities) |
Creates RatingCapability with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
MinStars |
int |
Min Stars. Declared initializer: 1. |
MaxStars |
int |
Max Stars. Declared initializer: 3. |
IsEnabled |
bool |
Is Enabled. Read-only property. |
UnitAbandoned
Responsible for: The player left an unfinished attempt for the menu. It is not a failure: no completed or failed signal goes with it, and it is not raised when the service was already idle, so the menu is shown only when there was an attempt to leave.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.UnitAbandoned. Declaration: public struct UnitAbandoned. Source.
| Member | Type | Description |
|---|---|---|
Index |
int |
Index. Without an initializer, a new instance uses default(int). |
UnitCompleted
Responsible for: The mechanic reported a win. Stars is null when the mechanic does not rate (AE15).
Qualified name: Ostryzhnyi.CasualGameCore.Progression.UnitCompleted. Declaration: public struct UnitCompleted. Source.
| Member | Type | Description |
|---|---|---|
Index |
int |
Index. Without an initializer, a new instance uses default(int). |
Stars |
int? |
Stars. Without an initializer, a new instance uses default(int?). |
IsLevelOfDay |
bool |
True when the attempt is the day's extra level (Level of Day) rather than the unit at the player's place. Without an initializer, a new instance uses default(bool). |
UnitFailed
Responsible for: The mechanic reported a loss. Abandoning an attempt is not a failure and raises nothing.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.UnitFailed. Declaration: public struct UnitFailed. Source.
| Member | Type | Description |
|---|---|---|
Index |
int |
Index. Without an initializer, a new instance uses default(int). |
AttemptNumber |
int |
Attempt Number. Without an initializer, a new instance uses default(int). |
IsLevelOfDay |
bool |
True when the attempt is the day's extra level (Level of Day) rather than the unit at the player's place. Without an initializer, a new instance uses default(bool). |
UnitRestarted
Responsible for: The same unit began again, after a loss (retry) or from the pause menu.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.UnitRestarted. Declaration: public struct UnitRestarted. Source.
| Member | Type | Description |
|---|---|---|
Index |
int |
Index. Without an initializer, a new instance uses default(int). |
AttemptNumber |
int |
Attempt Number. Without an initializer, a new instance uses default(int). |
IsRetry |
bool |
True for a retry after a loss, false for a restart from pause. Without an initializer, a new instance uses default(bool). |
IsLevelOfDay |
bool |
True when the attempt is the day's extra level (Level of Day) rather than the unit at the player's place. Without an initializer, a new instance uses default(bool). |
UnitStarted
Responsible for: A unit was started from the menu. A retry or a restart from pause raises UnitRestarted instead, never both, so a consumer counting starts and restarts never counts one attempt twice. A continue raises neither: it is the same attempt.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.UnitStarted. Declaration: public struct UnitStarted. Source.
| Member | Type | Description |
|---|---|---|
Index |
int |
Index. Without an initializer, a new instance uses default(int). |
Kind |
ProgressionKind |
Kind. Without an initializer, a new instance uses default(ProgressionKind). |
AttemptNumber |
int |
Attempt Number. Without an initializer, a new instance uses default(int). |
IsLevelOfDay |
bool |
True when the attempt is the day's extra level (Level of Day) rather than the unit at the player's place. Without an initializer, a new instance uses default(bool). |
Namespace: Ostryzhnyi.CasualGameCore.Progression.Controllers
HudController
Responsible for: Shows the gameplay HUD while an attempt runs: when a unit starts or restarts, and hides it again when the attempt is abandoned. A continue changes nothing, because the HUD stayed under the lose popup.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.Controllers.HudController. Declaration: public sealed class HudController : IDisposable. Source.
| Method | Description |
|---|---|
public HudController(Func<IViewService> views, OstryzhnyiSignal<UnitStarted> started = null, OstryzhnyiSignal<UnitRestarted> restarted = null, OstryzhnyiSignal<UnitAbandoned> abandoned = null, ProgressionKind kind = ProgressionKind.Level) |
Creates HudController with the supplied dependencies and configuration. Throws ArgumentNullException when views == null. |
public void Dispose() |
Releases this instance’s owned subscriptions or pending work. Call it when the owning flow ends. |
LoseController
Responsible for: The lose half of the result flow. ShowStep opens the lose popup with the available continue methods and holds the flow until the player retries, exits, or a continue method succeeds. A failed method leaves the popup open. The controller never calls Continue() itself: ContinueRegistry.TryExecute resumes the attempt only on success.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.Controllers.LoseController. Declaration: public sealed class LoseController : IDisposable. Source.
While a continue method is running, Retry, Exit and a second option tap are ignored. A payment or ad that completes after the player left would otherwise resume a different attempt for nothing, because the registry resumes whatever attempt is lost when the method reports success.
| Method | Description |
|---|---|
public LoseController(Func<IViewService> views, IProgressionService progression, ContinueRegistry continues, OstryzhnyiSignal<ResultFlowClosed> closed = null, ProgressionKind kind = ProgressionKind.Level) |
Creates LoseController with the supplied dependencies and configuration. Throws ArgumentNullException when views == null. Throws ArgumentNullException when progression == null. Throws ArgumentNullException when continues == null. |
public void Dispose() |
Releases this instance’s owned subscriptions or pending work. Call it when the owning flow ends. |
| Member | Type | Description |
|---|---|---|
ShowStep |
IPlayerPacedStep |
At ResultFlowOrder.ShowResult: shows the popup and completes when the player has decided. Getter returns _showStep. |
MenuController
Responsible for: Binds the main menu to the lifecycle: Play (and a level tap) start the current unit, and an abandoned attempt brings the menu back. The bottom navigation belongs to the menu, so it opens and closes with it. Knows the Menu Views only; the HUD that replaces the menu is shown by HudController.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.Controllers.MenuController. Declaration: public sealed class MenuController : IDisposable. Source.
A View is bound the first time the service opens it, so nothing is spawned ahead of its screen. Without a View service the controller stays inert.
| Method | Description |
|---|---|
public MenuController(Func<IViewService> views, IProgressionService progression, OstryzhnyiSignal<UnitAbandoned> abandoned = null, IProgressionPosition position = null, ProgressionKind kind = ProgressionKind.Level, IChestSchedule chestSchedule = null) |
Creates MenuController with the supplied dependencies and configuration. Throws ArgumentNullException when views == null. Throws ArgumentNullException when progression == null. |
public void Dispose() |
Releases this instance’s owned subscriptions or pending work. Call it when the owning flow ends. |
PauseController
Responsible for: Pauses and resumes the attempt from the HUD's pause button. Pausing tells the mechanic and, when ProgressionSettingsSection.PauseUsesTimeScale is on, sets Time.timeScale to zero; every way out of the pause restores the scale that was there before. Restart and Exit follow KTD6: neither reports a win or a loss.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.Controllers.PauseController. Declaration: public sealed class PauseController : IDisposable. Source.
Knows the Level Views only: the HUD that asks for the pause and the pause popup itself.
| Method | Description |
|---|---|
public PauseController(Func<IViewService> views, IProgressionService progression, IGameplayMechanic mechanic, bool usesTimeScale) |
Creates PauseController with the supplied dependencies and configuration. Throws ArgumentNullException when views == null. Throws ArgumentNullException when progression == null. Throws ArgumentNullException when mechanic == null. |
public void Dispose() |
Releases this instance’s owned subscriptions or pending work. Call it when the owning flow ends. |
WinController
Responsible for: The win half of the result flow. ShowStep opens the win popup first so the reward and multiplier steps that follow run with it on screen; ChoiceStep then holds the flow until the player presses the main button (or close, when no chest is composed), so progress is saved only after the player has moved on. When the flow closes the next unit starts after the main button, and the menu comes back after close: the win is saved either way.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.Controllers.WinController. Declaration: public sealed class WinController : IDisposable. Source.
Without a win popup (no View service or prefab) the choice is made on the player's behalf, so a win can never strand the attempt. A flow that closes with the attempt not yet advanced leaves for the menu instead of replaying a won unit.
| Method | Description |
|---|---|
public WinController(Func<IViewService> views, IProgressionService progression, IRatingCapability rating, bool chestRegistered, OstryzhnyiSignal<ResultFlowClosed> closed = null, ProgressionKind kind = ProgressionKind.Level, IChestSchedule chestSchedule = null) |
Creates WinController with the supplied dependencies and configuration. chestRegistered: True when a step is registered at ResultFlowOrder.Chest: the main button then opens it. chestSchedule: Which units earn a chest; null offers one after every win while a chest step is registered. Throws ArgumentNullException when views == null. Throws ArgumentNullException when progression == null. Throws ArgumentNullException when rating == null. |
public void Dispose() |
Releases this instance’s owned subscriptions or pending work. Call it when the owning flow ends. |
| Member | Type | Description |
|---|---|---|
ShowStep |
IResultFlowStep |
At ResultFlowOrder.ShowResult: shows the popup with the stars (when rated) and completes at once. Getter returns _showStep. |
ChoiceStep |
IPlayerPacedStep |
At ResultFlowOrder.PlayerChoice: records the choice on the context and completes when it is made. Getter returns _choiceStep. |
Namespace: Ostryzhnyi.CasualGameCore.Progression.ResultFlow
ContinueRegistry
Responsible for: Finds available continue methods and resumes the current attempt only after confirmed success.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.ResultFlow.ContinueRegistry. Declaration: public sealed class ContinueRegistry. Source.
| Method | Description |
|---|---|
public ContinueRegistry(IEnumerable<IContinueMethod> methods, IProgressionService progression, OstryzhnyiSignal<ContinueUsed> used = null) |
Creates ContinueRegistry with the supplied dependencies and configuration. used: Raised when a method succeeded and the attempt resumed; none when null. Throws ArgumentNullException when methods == null. Throws ArgumentNullException when progression == null. Throws ArgumentException when _methods.Any(method => method == null || string.IsNullOrWhiteSpace(method.Id)). Throws ArgumentException when duplicate != null. |
public bool TryExecute(string id, Action<bool> complete) |
Returns false when the requested method is unknown or currently unavailable. Throws ArgumentNullException when complete == null. Returns false when method == null. |
| Member | Type | Description |
|---|---|---|
Available |
IReadOnlyList<IContinueMethod> |
Available. Getter returns _methods.Where(method => method.IsAvailable).ToArray(). |
IConditionalResultFlowStep
Responsible for: A step whose applicability depends on the attempt, not just its outcome (for example the Chest, which only some units earn). The pipeline asks this overload instead of IResultFlowStep.AppliesTo(AttemptOutcome) when a step implements it.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.ResultFlow.IConditionalResultFlowStep. Declaration: public interface IConditionalResultFlowStep : IResultFlowStep. Source.
| Method | Description |
|---|---|
bool AppliesTo(ResultFlowContext context) |
Returns whether this step applies to the supplied result context. |
IContinueMethod
Responsible for: A replaceable way to resume a lost attempt, such as currency or a rewarded ad.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.ResultFlow.IContinueMethod. Declaration: public interface IContinueMethod. Source.
| Method | Description |
|---|---|
void Execute(Action<bool> complete) |
Defines execute for implementations of IContinueMethod. |
| Member | Type | Description |
|---|---|---|
Id |
string |
Id. Read-only property. |
Label |
string |
What the lose popup shows on this method's button, such as "Continue" or "Watch ad". Read-only property. |
Price |
string |
The price shown beside Label, or null when the method is free. It may change between losses. Read-only property. |
IsAvailable |
bool |
Is Available. Read-only property. |
IPlayerPacedStep
Responsible for: A step that waits for a person, such as a result popup. The pipeline's stuck-step guard does not apply to it: a player deciding is not a hung step, and the popup stays usable. It must still call done once the player has decided.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.ResultFlow.IPlayerPacedStep. Declaration: public interface IPlayerPacedStep : IResultFlowStep. Source.
No declared public API members beyond the inherited lifecycle.
IResultFlowStep
Responsible for: One independently registered part of a win or lose flow. Implementations must invoke done once their asynchronous work and UI have finished.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.ResultFlow.IResultFlowStep. Declaration: public interface IResultFlowStep. Source.
| Method | Description |
|---|---|
bool AppliesTo(AttemptOutcome outcome) |
Returns whether this step applies to the supplied result context. |
void Run(ResultFlowContext context, Action done) |
Runs this result-flow step using the supplied context and completion operation. |
| Member | Type | Description |
|---|---|---|
Order |
int |
Order. Read-only property. |
MechanicScoreStep
Responsible for: Copies the score a mechanic reports onto ResultFlowContext.Score before the result popup opens, for wins and losses alike, so the popup shows this attempt's score and never a placeholder. Added by ProgressionComposition only for a mechanic that implements IScoredMechanic.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.ResultFlow.MechanicScoreStep. Declaration: public sealed class MechanicScoreStep : IResultFlowStep. Source.
| Method | Description |
|---|---|
public MechanicScoreStep(IScoredMechanic mechanic) |
Creates MechanicScoreStep with the supplied dependencies and configuration. Throws ArgumentNullException when mechanic == null. |
public bool AppliesTo(AttemptOutcome outcome) |
Returns whether this step applies to the supplied result context. |
public void Run(ResultFlowContext context, Action done) |
Runs this result-flow step using the supplied context and completion operation. Throws ArgumentNullException when context == null. Throws ArgumentNullException when done == null. |
| Member | Type | Description |
|---|---|---|
Order |
int |
Order. Getter returns ResultFlowOrder.Score. |
ResultFlowChoice
Responsible for: The route selected while the result UI is open.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.ResultFlow.ResultFlowChoice. Declaration: public enum ResultFlowChoice. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Undecided |
0 |
Undecided. |
OpenChest |
1 |
Open Chest. |
Close |
2 |
The win popup was closed: the win is saved and the player goes back to the menu. |
Next |
3 |
Move on: the next unit starts once the flow closes. |
ResultFlowClosed
Responsible for: Raised once after every applicable step has finished or its guard has recovered the flow.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.ResultFlow.ResultFlowClosed. Declaration: public struct ResultFlowClosed. Source.
| Member | Type | Description |
|---|---|---|
Outcome |
AttemptOutcome |
Outcome. Without an initializer, a new instance uses default(AttemptOutcome). |
ResultFlowContext
Responsible for: Mutable data shared by independent result-flow steps. BaseReward is deliberately opaque here: the Economy feature owns its concrete reward type while Progression only carries it between registered steps.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.ResultFlow.ResultFlowContext. Declaration: public sealed class ResultFlowContext. Source.
| Method | Description |
|---|---|
public ResultFlowContext(AttemptOutcome outcome, int? stars, int attemptKey, int unitIndex = 0, bool isLevelOfDay = false) |
Creates ResultFlowContext with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
IsLevelOfDay |
bool |
True when the attempt was the day's extra level. Its win grants the Level of Day reward instead of the base reward, multiplier and chest, does not move the player's place, and returns to the menu. Read-only property. |
Outcome |
AttemptOutcome |
Outcome. Read-only property. |
Stars |
int? |
Stars. Read-only property. |
AttemptKey |
int |
Attempt Key. Read-only property. |
UnitIndex |
int |
The zero-based unit this attempt played. It is fixed when the result is reported, so a later advance never changes it. Read-only property. |
BaseReward |
object |
Base Reward. Setter: set. |
Score |
long? |
The attempt's score, set by MechanicScoreStep for a mechanic that keeps one; null when there is none. Setter: set. |
Choice |
ResultFlowChoice |
Choice. Setter: set. |
ResultFlowOrder
Responsible for: Stable slots for the result pipeline. Gaps let later feature plans add steps without coupling their types together.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.ResultFlow.ResultFlowOrder. Declaration: public static class ResultFlowOrder. Source.
| Member | Type | Description |
|---|---|---|
Score |
int |
Before the result popup opens: reads the attempt's score from the mechanic, so the popup can show it. Declared initializer: 50. |
ShowResult |
int |
Show Result. Declared initializer: 100. |
BaseReward |
int |
Base Reward. Declared initializer: 200. |
ContinueOffer |
int |
Continue Offer. Declared initializer: 200. |
BaseRewardShown |
int |
After the base reward is granted and before the multiplier: puts what was granted on the Win popup. Declared initializer: 250. |
RewardMultiplier |
int |
Reward Multiplier. Declared initializer: 300. |
PlayerChoice |
int |
Where a win waits for the player's main button, after the reward and multiplier have had the result popup on screen and before progress is saved, so a won unit is advanced only once the player has moved on. Declared initializer: 350. |
SaveProgress |
int |
Save Progress. Declared initializer: 400. |
Chest |
int |
Chest. Declared initializer: 500. |
Close |
int |
Close. Declared initializer: 600. |
ResultFlowPipeline
Responsible for: Runs applicable result steps in stable order and prevents a broken step from trapping the player.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.ResultFlow.ResultFlowPipeline. Declaration: public sealed class ResultFlowPipeline : IDisposable. Source.
| Method | Description |
|---|---|
public ResultFlowPipeline(IEnumerable<IResultFlowStep> steps, IProgressionService progression, OstryzhnyiSignal<ResultFlowClosed> closed = null, double stepTimeoutSeconds = 10, Action<IEnumerator> run = null, Func<double> seconds = null, Action<string> warning = null) |
Creates ResultFlowPipeline with the supplied dependencies and configuration. Throws ArgumentNullException when steps == null. Throws ArgumentNullException when progression == null. Throws ArgumentOutOfRangeException when !(stepTimeoutSeconds > 0) || double.IsInfinity(stepTimeoutSeconds). Throws ArgumentException when _steps.Any(step => step == null). |
public void Dispose() |
Invalidates this scene's pending work without publishing a result to another scene. |
ResultFlowStarter
Responsible for: Hands a reported win or loss to the pipeline. It is the one place that turns UnitCompleted and UnitFailed into a flow, so no controller needs to know the pipeline exists.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.ResultFlow.ResultFlowStarter. Declaration: public sealed class ResultFlowStarter : IDisposable. Source.
| Method | Description |
|---|---|
public ResultFlowStarter(ResultFlowPipeline pipeline, IProgressionService progression, OstryzhnyiSignal<UnitCompleted> completed, OstryzhnyiSignal<UnitFailed> failed) |
Creates ResultFlowStarter with the supplied dependencies and configuration. Throws ArgumentNullException when pipeline == null. Throws ArgumentNullException when progression == null. Throws ArgumentNullException when completed == null. Throws ArgumentNullException when failed == null. |
public void Dispose() |
Releases this instance’s owned subscriptions or pending work. Call it when the owning flow ends. |
SaveProgressStep
Responsible for: Advances a won unit at the pipeline's save slot; advancing flushes the progression save.
Qualified name: Ostryzhnyi.CasualGameCore.Progression.ResultFlow.SaveProgressStep. Declaration: public sealed class SaveProgressStep : IResultFlowStep. Source.
| Method | Description |
|---|---|
public SaveProgressStep(IProgressionService progression) |
Creates SaveProgressStep with the supplied dependencies and configuration. Throws ArgumentNullException when progression == null. |
public bool AppliesTo(AttemptOutcome outcome) |
Returns whether this step applies to the supplied result context. |
public void Run(ResultFlowContext context, Action done) |
Runs this result-flow step using the supplied context and completion operation. Throws ArgumentNullException when context == null. Throws ArgumentNullException when done == null. |
| Member | Type | Description |
|---|---|---|
Order |
int |
Order. Getter returns ResultFlowOrder.SaveProgress. |
Namespace: Ostryzhnyi.CasualGameCore.Providers
IServiceProviderFactory
Responsible for: Describes one real provider of a service, such as LevelPlay for ads. Adding a provider is one new class that implements this interface: it is found by scanning, so no existing file changes. A factory needs a public parameterless constructor and must be cheap to construct, because the Editor lists it while authoring.
Qualified name: Ostryzhnyi.CasualGameCore.Providers.IServiceProviderFactory. Declaration: public interface IServiceProviderFactory. Source.
| Method | Description |
|---|---|
ProviderAvailability GetAvailability(ServicePlatform platform) |
Whether the provider can run on platform: its SDK is installed and it supports that platform. An unavailable answer carries the reason the Editor shows. |
| Member | Type | Description |
|---|---|---|
ServiceId |
string |
The service this provider implements, the same id the mode table uses, for example ads. Read-only property. |
ProviderId |
string |
Identifies this provider among those of the service, for example levelplay. This is what settings store. Read-only property. |
DisplayName |
string |
What the Editor calls the provider. Read-only property. |
IServiceProviderFactory<out TProvider>
Responsible for: A factory that builds the provider the service calls.
Qualified name: Ostryzhnyi.CasualGameCore.Providers.IServiceProviderFactory<out TProvider>. Declaration: public interface IServiceProviderFactory<out TProvider> : IServiceProviderFactory. Source.
| Method | Description |
|---|---|
TProvider Create(CasualGameSettings settings, ServicePlatform platform) |
Builds the provider. Only called after IServiceProviderFactory.GetAvailability said it is available. |
ModeResolution
Responsible for: What a platform mode comes to for one service.
Qualified name: Ostryzhnyi.CasualGameCore.Providers.ModeResolution. Declaration: public readonly struct ModeResolution. Source.
| Method | Description |
|---|---|
public ModeResolution(ServiceMode mode, bool isValid, IServiceProviderFactory factory, string reason) |
Creates ModeResolution with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
Mode |
ServiceMode |
The mode that was asked about. Read-only property. |
IsValid |
bool |
True when the mode can run. ServiceMode.Simulation and ServiceMode.Disabled always can. Read-only property. |
Factory |
IServiceProviderFactory |
The factory that will build the provider; set only for a valid ServiceMode.RealSdk. Read-only property. |
Reason |
string |
Why the mode cannot run, for the Editor; empty when it can. Read-only property. |
ModeResolver
Responsible for: Turns a platform mode into something runnable. Real SDK is valid only when the chosen provider is installed and supports the platform; otherwise it is invalid with a reason, never silently replaced by another mode.
Qualified name: Ostryzhnyi.CasualGameCore.Providers.ModeResolver. Declaration: public sealed class ModeResolver. Source.
| Method | Description |
|---|---|
public ModeResolver(ProviderRegistry registry) |
Creates ModeResolver with the supplied dependencies and configuration. Throws ArgumentNullException when registry == null. |
public ModeResolution ResolveSaved(PlatformServiceModes modes, string serviceId, ServicePlatform platform, string providerId) |
The mode saved for the platform in the table, resolved. A mode that was never set is ServiceMode.Disabled. Throws ArgumentNullException when modes == null. |
public ModeResolution Resolve(ServiceMode mode, string serviceId, ServicePlatform platform, string providerId) |
Resolves one mode, so an Editor can ask whether each choice can be selected. |
ProviderAvailability
Responsible for: Whether a provider can run on a platform. The reason of an unavailable one is the text the Editor shows the author, so it names what is missing or unsupported.
Qualified name: Ostryzhnyi.CasualGameCore.Providers.ProviderAvailability. Declaration: public readonly struct ProviderAvailability. Source.
| Method | Description |
|---|---|
public static ProviderAvailability Unavailable(string reason) |
Returns new ProviderAvailability(false, reason). |
| Member | Type | Description |
|---|---|---|
IsAvailable |
bool |
Is Available. Read-only property. |
Reason |
string |
Why the provider cannot run; empty when it is available. Read-only property. |
Available |
ProviderAvailability |
Available. Getter returns new ProviderAvailability(true, string.Empty). |
ProviderRegistry
Responsible for: The installed provider factories of every service. Plans 05 (ads), 06 (IAP) and 11 (analytics) share it, each asking for its own service id.
Qualified name: Ostryzhnyi.CasualGameCore.Providers.ProviderRegistry. Declaration: public sealed class ProviderRegistry. Source.
| Method | Description |
|---|---|
public ProviderRegistry(IEnumerable<IServiceProviderFactory> factories) |
Builds a registry from factory instances. Throws InvalidOperationException naming both types when two factories claim the same service and provider id, and ArgumentException for a null factory or an empty id. Throws ArgumentNullException when factories == null. Throws ArgumentException when factory == null. This check is inside the iteration. Throws ArgumentException when string.IsNullOrWhiteSpace(factory.ServiceId). This check is inside the iteration. Throws ArgumentException when string.IsNullOrWhiteSpace(factory.ProviderId). This check is inside the iteration. Throws InvalidOperationException when _byKey.TryGetValue(key, out var existing). This check is inside the iteration. |
public IReadOnlyList<IServiceProviderFactory> ForService(string serviceId) |
The factories of one service, in the order given. Empty when there are none. |
public IServiceProviderFactory Find(string serviceId, string providerId) |
The factory with this provider id for the service (ids compare ignoring case), or null. Returns null when string.IsNullOrWhiteSpace(serviceId) || string.IsNullOrWhiteSpace(providerId). |
public static ProviderRegistry FromTypes(IEnumerable<Type> factoryTypes) |
Builds a registry from factory types, constructing each with its public parameterless constructor. A type that is not a concrete factory throws InvalidOperationException naming it. Throws ArgumentNullException when factoryTypes == null. |
public static ProviderRegistry Discover() |
Builds a registry from every public concrete factory in the loaded assemblies. Non-public types are left out, so test fixtures never become providers. |
| Member | Type | Description |
|---|---|---|
All |
IReadOnlyList<IServiceProviderFactory> |
Every factory, in the order given. Getter returns _all. |
ServicePlatformDetector
Responsible for: Maps the running platform to a row of the mode table.
Qualified name: Ostryzhnyi.CasualGameCore.Providers.ServicePlatformDetector. Declaration: public static class ServicePlatformDetector. Source.
| Method | Description |
|---|---|
public static ServicePlatform? FromRuntimePlatform(RuntimePlatform platform) |
The table row for a runtime platform, or null when there is none. Returns null after the preceding guards/branches. |
| Member | Type | Description |
|---|---|---|
Current |
ServicePlatform? |
The platform the app runs on, or the active build target in the Editor. Null for any other platform (desktop standalone, or an Editor build target the table has no row for): callers treat that as simulation. Returns null after the preceding guards/branches. Read-only property. |
Namespace: Ostryzhnyi.CasualGameCore.Providers.GameAnalyticsSdk
GameAnalyticsConfiguration
Responsible for: Copies product configuration into SDK settings, in the Editor and after consent at runtime.
Qualified name: Ostryzhnyi.CasualGameCore.Providers.GameAnalyticsSdk.GameAnalyticsConfiguration. Declaration: public static class GameAnalyticsConfiguration. Source.
| Method | Description |
|---|---|
public static void Apply(CasualGameSettings source, GameAnalyticsSDK.Setup.Settings target) |
Copies per-platform analytics keys, application version and resource catalogs into the SDK settings. Adds missing platforms and clears previous keys before assignment. Rejects keys the SDK cannot retain distinctly. Throws ArgumentNullException when source == null. Throws ArgumentNullException when target == null. Throws InvalidOperationException when target.GetGameKey(index) != (keys?.GameKey ?? "") || target.GetSecretKey(index) != (keys?.SecretKey ?? ""). This check is inside the iteration. |
GameAnalyticsProvider
Responsible for: Consent-gated GameAnalytics adapter. Drops events before readiness and after withdrawal.
Qualified name: Ostryzhnyi.CasualGameCore.Providers.GameAnalyticsSdk.GameAnalyticsProvider. Declaration: public sealed class GameAnalyticsProvider : IAnalyticsProvider. Source.
| Method | Description |
|---|---|
public void TrackError(AnalyticsError error) |
Accepts an error already sanitized by ErrorReporter, while analytics is ready and consented. |
public GameAnalyticsProvider(CasualGameSettings settings, ServicePlatform platform, IGameAnalyticsClient client = null, Action<Action> dispatch = null) |
Creates GameAnalyticsProvider with the supplied dependencies and configuration. dispatch: Optional main-thread dispatcher; defaults to Unity's captured synchronization context. Throws ArgumentNullException when settings == null. |
public void Initialize(Action<bool> complete) |
Starts the provider. complete receives whether it is ready to take events. Throws ArgumentNullException when complete == null. |
public void Track(AnalyticsEvent analyticsEvent) |
Sends one event. Only called while the provider is ready and enabled. |
public void SetEnabled(bool enabled) |
Turns event sending on or off for a provider that is already running, for example when the player withdraws consent. A provider with an SDK maps this to the SDK's own opt-out so the SDK's internal traffic stops too. |
| Member | Type | Description |
|---|---|---|
SupportsErrorReporting |
bool |
False when the backend cannot accept sanitized errors. Getter returns true. |
GameAnalyticsProviderFactory
Responsible for: Offers GameAnalytics for Android, iOS and WebGL when its UPM package is installed.
Qualified name: Ostryzhnyi.CasualGameCore.Providers.GameAnalyticsSdk.GameAnalyticsProviderFactory. Declaration: public sealed class GameAnalyticsProviderFactory : IServiceProviderFactory<IAnalyticsProvider>. Source.
| Method | Description |
|---|---|
public ProviderAvailability GetAvailability(ServicePlatform platform) |
Whether the provider can run on platform: its SDK is installed and it supports that platform. An unavailable answer carries the reason the Editor shows. |
public IAnalyticsProvider Create(CasualGameSettings settings, ServicePlatform platform) |
Builds the provider. Only called after IServiceProviderFactory.GetAvailability said it is available. |
| Member | Type | Description |
|---|---|---|
Id |
string |
Id. Declared initializer: "gameanalytics". |
ServiceId |
string |
The service this provider implements, the same id the mode table uses, for example ads. Getter returns AnalyticsSettingsSection.ServiceId. |
ProviderId |
string |
Identifies this provider among those of the service, for example levelplay. This is what settings store. Getter returns Id. |
DisplayName |
string |
What the Editor calls the provider. Getter returns "GameAnalytics". |
IGameAnalyticsClient
Responsible for: The SDK calls used by the adapter. Implementations run on Unity's main thread.
Qualified name: Ostryzhnyi.CasualGameCore.Providers.GameAnalyticsSdk.IGameAnalyticsClient. Declaration: public interface IGameAnalyticsClient. Source.
| Method | Description |
|---|---|
void Initialize(Action<bool> complete) |
Initializes the SDK and completes with its readiness result on Unity’s main thread. |
void SetEnabled(bool enabled) |
Enables or disables SDK event collection. |
void Error(GAErrorSeverity severity, string message) |
Sends a GameAnalytics error event with the supplied severity and sanitized message. |
void Design(string id, IDictionary<string, object> fields) |
Sends a GameAnalytics design event with its ID and fields. |
void Progression(GAProgressionStatus status, string index, IDictionary<string, object> fields) |
Sends a GameAnalytics progression event with its status, index and fields. |
void Resource(GAResourceFlowType flow, string currency, float amount, string item, IDictionary<string, object> fields) |
Sends a GameAnalytics resource event with flow direction, currency, amount, item and fields. |
void Ad(GAAdAction action, GAAdType type, string placement, IDictionary<string, object> fields) |
Sends a GameAnalytics ad event with action, format, placement and fields. |
Namespace: Ostryzhnyi.CasualGameCore.Providers.LevelPlayAds
LevelPlayAdProvider
Responsible for: The real ad provider over LevelPlay's ad unit API. Keeping SDK types inside this assembly keeps IAdProvider free of them. It never logs the app key.
Qualified name: Ostryzhnyi.CasualGameCore.Providers.LevelPlayAds.LevelPlayAdProvider. Declaration: public sealed class LevelPlayAdProvider : IAdProvider. Source.
| Method | Description |
|---|---|
public LevelPlayAdProvider(AdsPlatformKeys keys) |
Creates LevelPlayAdProvider with the supplied dependencies and configuration. Throws ArgumentNullException when keys == null. |
public void Initialize(AdsConsent consent, Action<bool> complete) |
Starts the provider with what the player consented to. complete receives whether it is ready to show ads. Throws ArgumentNullException when complete == null. |
public void ShowRewarded(string placement, Action<AdResult> complete) |
Shows a rewarded ad. complete is called once with how it ended. Throws ArgumentNullException when complete == null. |
public void ShowInterstitial(Action<AdResult> complete) |
Shows an interstitial. complete is called once with how it ended. Throws ArgumentNullException when complete == null. |
| Member | Type | Description |
|---|---|---|
AllowInEditor |
bool |
The SDK has no native code in the Editor, so by default the provider declines to initialize there and ads stay unavailable. A test or tool can lift that for a run. Setter: set. |
IsRewardedReady |
bool |
True when a rewarded ad is loaded and can be shown now. Returns false after the preceding guards/branches after a caught exception. Read-only property. |
LevelPlayAdProviderFactory
Responsible for: Makes LevelPlay a Real SDK choice for ads. Availability describes the target platform, not the Editor session, so an author can pick Real SDK for Android or iOS while working in the Editor.
Qualified name: Ostryzhnyi.CasualGameCore.Providers.LevelPlayAds.LevelPlayAdProviderFactory. Declaration: public sealed class LevelPlayAdProviderFactory : IServiceProviderFactory<IAdProvider>. Source.
| Method | Description |
|---|---|
public ProviderAvailability GetAvailability(ServicePlatform platform) |
Whether the provider can run on platform: its SDK is installed and it supports that platform. An unavailable answer carries the reason the Editor shows. |
public IAdProvider Create(CasualGameSettings settings, ServicePlatform platform) |
Builds the provider. Only called after IServiceProviderFactory.GetAvailability said it is available. |
| Member | Type | Description |
|---|---|---|
Id |
string |
Id. Declared initializer: "levelplay". |
ServiceId |
string |
The service this provider implements, the same id the mode table uses, for example ads. Getter returns AdsSettingsSection.ServiceId. |
ProviderId |
string |
Identifies this provider among those of the service, for example levelplay. This is what settings store. Getter returns Id. |
DisplayName |
string |
What the Editor calls the provider. Getter returns "LevelPlay (Ads Mediation)". |
LevelPlayMapping
Responsible for: The SDK-free decisions of the provider, so they are tested without a device.
Qualified name: Ostryzhnyi.CasualGameCore.Providers.LevelPlayAds.LevelPlayMapping. Declaration: public static class LevelPlayMapping. Source.
| Method | Description |
|---|---|
public static AdResult RewardedResult(bool rewardReceived, bool displayFailed) |
How a rewarded ad ended once it closed or failed to display. A reward received means AdResult.Completed even if the close came first; a display failure with no reward is AdResult.Failed; a plain close is AdResult.Closed. A load or show error never produces AdResult.Completed. |
public static AdResult InterstitialResult(bool displayFailed) |
How an interstitial ended: shown and closed is AdResult.Completed, a display failure is AdResult.Failed. |
public static LevelPlayPrivacy Privacy(AdsConsent consent) |
Maps the player's consent to the SDK's consent and metadata values. |
LevelPlayPrivacy
Responsible for: What the player's consent comes to in LevelPlay terms (SDK 9.3, set before Init).
Qualified name: Ostryzhnyi.CasualGameCore.Providers.LevelPlayAds.LevelPlayPrivacy. Declaration: public readonly struct LevelPlayPrivacy. Source.
| Method | Description |
|---|---|
public LevelPlayPrivacy(bool consent, string doNotSell, string childDirected) |
Creates LevelPlayPrivacy with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
Consent |
bool |
For LevelPlay.SetConsent. Read-only property. |
DoNotSell |
string |
For SetMetaData("do_not_sell", ...): "true" when the player did not allow personalized ads. Read-only property. |
ChildDirected |
string |
For SetMetaData("is_child_directed", ...): "true" for an age restricted player. Read-only property. |
Namespace: Ostryzhnyi.CasualGameCore.Providers.UnityIapStore
UnityIapMapping
Responsible for: The decisions of the provider that need no store, so they are tested without a device.
Qualified name: Ostryzhnyi.CasualGameCore.Providers.UnityIapStore.UnityIapMapping. Declaration: public static class UnityIapMapping. Source.
| Method | Description |
|---|---|
public static PurchaseResult FailureResult(PurchaseFailureReason reason) |
How a failed purchase ends. The player backing out is PurchaseStatus.Cancelled; a store or product that cannot sell now is PurchaseStatus.Unavailable; anything else is PurchaseStatus.Failed. A store error never becomes PurchaseStatus.Delivered. |
public static ProductType StoreType(ShopProductType type) |
The store's product type for an offer's product type. |
public static List<ProductDefinition> Products(ShopSettingsSection shop) |
The products to fetch from the store: one per product id of every offer paid with real money, in catalog order. Offers paid with currency and IAP offers with no product id are not store products. |
public static bool SupportsRestore(ServicePlatform platform) |
Whether the Shop should offer Restore Purchases. Apple requires it; Google Play restores on its own when purchases are fetched, so the button is iOS only. |
UnityIapOrders<TOrder>
Responsible for: The provider's bookkeeping of store orders, free of store types so it is tested without a device. The store reports every order through the same events whether the player just asked for it or it arrived on its own (an interrupted order at startup, a restore, an approved deferred order); this decides which one answers the open request and which is a PurchaseDelivery, and keeps each pending order until the purchase flow confirms it.
Qualified name: Ostryzhnyi.CasualGameCore.Providers.UnityIapStore.UnityIapOrders<TOrder>. Declaration: public sealed class UnityIapOrders<TOrder>. Source.
| Method | Description |
|---|---|
public bool Begin(string productId, Action<PurchaseResult> complete) |
Opens a request for a product. Returns false, and keeps the open one, when a request is already open. Throws ArgumentNullException when complete == null. Returns false when HasRequest. |
public void Pending(string productId, string transactionId, TOrder order, Action<PurchaseDelivery> delivered) |
The store delivered an order and is waiting for it to be confirmed. It answers the open request for the same product, or otherwise goes to delivered. The order is kept under its transaction id, replacing an earlier copy. |
public bool Failed(string productId, PurchaseResult result) |
A purchase failed. It ends the open request when it is for the same product or the store did not say which product it was; otherwise there is no one waiting and it returns false. Returns false when !HasRequest || !(string.IsNullOrEmpty(productId) || IsRequested(productId)). |
public void Deferred(string productId) |
A purchase awaits approval, such as Ask to Buy. It ends the open request for that product as PurchaseStatus.Pending; the order arrives later through Pending. |
public TOrder BeginConfirm(string transactionId, Action<bool> complete) |
The kept order to confirm, with complete held until Confirmed. Null, with nothing held, for an unknown transaction or one whose confirmation is already under way; the caller then reports false. Returns null when string.IsNullOrEmpty(transactionId) || _confirming.ContainsKey(transactionId) || !_kept.TryGetValue(transactionId, out var order). |
public void Confirmed(string transactionId, bool accepted) |
The store answered a confirmation. The order is forgotten either way; a refused one is delivered again. |
| Member | Type | Description |
|---|---|---|
HasRequest |
bool |
True while a purchase request waits for the store's answer. Getter returns _request != null. |
UnityIapProvider
Responsible for: The real store provider over Unity IAP 5. It subscribes to every store event before connecting, so an order interrupted in an earlier session is delivered at startup; it fetches the offers' products, then the player's purchases, and only then reports ready, so IsOwned answers from the store. A delivered order is confirmed only when the purchase flow asks, after its grant. Keeping store types inside this assembly keeps IIapProvider free of them.
Qualified name: Ostryzhnyi.CasualGameCore.Providers.UnityIapStore.UnityIapProvider. Declaration: public sealed class UnityIapProvider : IIapProvider. Source.
| Method | Description |
|---|---|
public UnityIapProvider(ShopSettingsSection shop, ServicePlatform platform) |
Creates UnityIapProvider with the supplied dependencies and configuration. shop: The offer catalog the store products are built from. platform: The platform the provider runs on; it decides whether restore is offered. Throws ArgumentNullException when shop == null. |
public void Initialize(Action<bool> complete) |
Connects to the store and loads its products. complete receives whether the store is usable. Throws ArgumentNullException when complete == null. |
public void Purchase(string productId, Action<PurchaseResult> complete) |
Starts a purchase of one product. Throws ArgumentNullException when complete == null. |
public void Confirm(string transactionId, Action<bool> complete) |
Tells the store the order was fulfilled, once the grant is in place. Until then the store may deliver it again. complete receives whether the store accepted the confirmation. Throws ArgumentNullException when complete == null. |
public void Restore(Action<bool> complete) |
Asks the store for the player's earlier purchases; each arrives through Delivered. Throws ArgumentNullException when complete == null. |
public string GetPrice(string productId) |
The price text to show for a product, localized by the store; null when it is not known. |
public bool IsOwned(string productId) |
Whether the store itself says the player owns a non-consumable product right now. A provider with no store behind it answers false; the saved cache is authoritative in Simulation. |
| Member | Type | Description |
|---|---|---|
AllowInEditor |
bool |
The store runs as Unity IAP's fake store in the Editor, which is not the player's real store, so by default the provider declines to initialize there and purchases stay unavailable; Simulation is the way to see the flow. A test or tool can lift that for a run. Setter: set. |
SupportsRestore |
bool |
True when Restore does something. The Shop shows its Restore button only then (required on iOS). Read-only property. |
Delivered |
Action<PurchaseDelivery> |
An order that arrived outside a request: pending orders from an interrupted session at startup, a restore, or a deferred order that was approved. The same order may be delivered again until it is confirmed. |
UnityIapProviderFactory
Responsible for: Makes Unity IAP a Real SDK choice for purchases. Availability describes the target platform, not the Editor session, so an author can pick Real SDK for Android or iOS while working in the Editor. WebGL has no store Unity IAP sells through, so it is unavailable there (AE3).
Qualified name: Ostryzhnyi.CasualGameCore.Providers.UnityIapStore.UnityIapProviderFactory. Declaration: public sealed class UnityIapProviderFactory : IServiceProviderFactory<IIapProvider>. Source.
| Method | Description |
|---|---|
public ProviderAvailability GetAvailability(ServicePlatform platform) |
Whether the provider can run on platform: its SDK is installed and it supports that platform. An unavailable answer carries the reason the Editor shows. |
public IIapProvider Create(CasualGameSettings settings, ServicePlatform platform) |
Builds the provider. Only called after IServiceProviderFactory.GetAvailability said it is available. |
| Member | Type | Description |
|---|---|---|
Id |
string |
Id. Declared initializer: "unityiap". |
ServiceId |
string |
The service this provider implements, the same id the mode table uses, for example ads. Getter returns IapSettingsSection.ServiceId. |
ProviderId |
string |
Identifies this provider among those of the service, for example levelplay. This is what settings store. Getter returns Id. |
DisplayName |
string |
What the Editor calls the provider. Getter returns "Unity IAP (App Store, Google Play)". |
Namespace: Ostryzhnyi.CasualGameCore.Rewards
IRewardDescriber
Responsible for: Optional: a reward handler that also implements this tells the reward collection screen how to show its items. A handler that does not, or that returns false for an item, is shown by its item id with no icon, so a custom reward type needs nothing extra to appear.
Qualified name: Ostryzhnyi.CasualGameCore.Rewards.IRewardDescriber. Declaration: public interface IRewardDescriber. Source.
| Method | Description |
|---|---|
bool TryDescribe(string itemId, out string label, out Sprite icon) |
The display label and icon for an item, or false when the item is unknown. The icon may be null. |
IRewardPresenter
Responsible for: The one way to show a granted bundle on the reward collection screen, shared by Daily Rewards, Missions and the Chest. It shows what was already granted: it grants nothing and rolls nothing.
Qualified name: Ostryzhnyi.CasualGameCore.Rewards.IRewardPresenter. Declaration: public interface IRewardPresenter. Source.
| Method | Description |
|---|---|
void Show(IReadOnlyList<ResolvedReward> rewards, Action onClosed = null) |
Shows the rewards, one row each, and calls onClosed once when the player dismisses the screen. A call made while another presentation is showing waits its turn, so presentations appear in the order they were asked for and never stack. With nothing to show, or when the screen cannot be shown, onClosed is called at once so the calling flow never waits on a screen that will not appear. |
IRewardScreen
Responsible for: The reward collection screen as the presenter sees it, so queueing can be tested without a scene.
Qualified name: Ostryzhnyi.CasualGameCore.Rewards.IRewardScreen. Declaration: public interface IRewardScreen. Source.
| Method | Description |
|---|---|
bool Present(RewardViewData data, Action dismissed) |
Shows the rows and calls dismissed once when the player dismisses them. Returns false, calling nothing, when the screen cannot be shown. |
RewardPresenter
Responsible for: Turns granted rewards into rows and shows them one presentation at a time. Each row is labelled by the handler of its type when that handler implements IRewardDescriber, and otherwise by the item id with no icon.
Qualified name: Ostryzhnyi.CasualGameCore.Rewards.RewardPresenter. Declaration: public sealed class RewardPresenter : IRewardPresenter. Source.
| Method | Description |
|---|---|
public RewardPresenter(RewardHandlerRegistry handlers, IRewardScreen screen) |
Creates RewardPresenter with the supplied dependencies and configuration. Throws ArgumentNullException when handlers == null. Throws ArgumentNullException when screen == null. |
public void Show(IReadOnlyList<ResolvedReward> rewards, Action onClosed = null) |
Shows the rewards, one row each, and calls onClosed once when the player dismisses the screen. A call made while another presentation is showing waits its turn, so presentations appear in the order they were asked for and never stack. With nothing to show, or when the screen cannot be shown, onClosed is called at once so the calling flow never waits on a screen that will not appear. Throws ArgumentNullException when rewards == null. |
| Member | Type | Description |
|---|---|---|
IsShowing |
bool |
True while a presentation is on screen. Setter: private set. |
RewardPreview
Responsible for: A short text for what a reward bundle grants, for screens that show a reward before it is earned.
Qualified name: Ostryzhnyi.CasualGameCore.Rewards.RewardPreview. Declaration: public static class RewardPreview. Source.
| Method | Description |
|---|---|
public static string Describe(RewardBundle bundle, RewardHandlerRegistry handlers) |
For example 50 Coin, 5 Gem, or 10-20 Coin for a range. Each item is named by its handler when the handler implements IRewardDescriber and by its item id otherwise. Empty for a bundle with nothing in it. |
public static string DescribeAmounts(RewardBundle bundle) |
Only the amounts of a bundle, for example 50, 10-20 or 50, 5 for several items, for a screen that draws the item's icon next to the number instead of naming it. Empty for a bundle with nothing in it. |
public static UnityEngine.Sprite FirstBundleIcon(RewardBundle bundle, RewardHandlerRegistry handlers) |
The icon of the first entry whose handler describes its item with one, or null. Returns null when bundle?.Entries == null. Returns null after the preceding guards/branches. |
public static string DescribeResolved(IReadOnlyList<ResolvedReward> rewards, RewardHandlerRegistry handlers) |
As Describe for rewards whose amounts are settled, for example 50 Coin, 1 Booster 1. Empty for no rewards. |
public static UnityEngine.Sprite FirstIcon(IReadOnlyList<ResolvedReward> rewards, RewardHandlerRegistry handlers) |
The icon of the first reward whose handler describes it with one, or null. Returns null when rewards == null. Returns null after the preceding guards/branches. |
RewardRow
Responsible for: One line of the reward collection screen: what was granted, how much, and its icon when the handler has one.
Qualified name: Ostryzhnyi.CasualGameCore.Rewards.RewardRow. Declaration: public readonly struct RewardRow. Source.
| Method | Description |
|---|---|
public RewardRow(string label, long amount, Sprite icon, string typeId = null, string itemId = null) |
Creates RewardRow with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
TypeId |
string |
The reward type this row was built from, for example currency; null for a row built without one. Read-only property. |
ItemId |
string |
The item the reward granted, for example a currency id. Where the row flies to is decided by this, never by its label or icon. Read-only property. |
Label |
string |
Label. Read-only property. |
Amount |
long |
Amount. Read-only property. |
Icon |
Sprite |
Null for a reward whose handler has no icon, which the screen shows as a label-only row. Read-only property. |
RewardViewData
Responsible for: What the reward collection screen shows for one presentation: the rows, in the order the rewards were given.
Qualified name: Ostryzhnyi.CasualGameCore.Rewards.RewardViewData. Declaration: public sealed class RewardViewData. Source.
| Method | Description |
|---|---|
public RewardViewData(IReadOnlyList<RewardRow> rows) |
Creates RewardViewData with the supplied dependencies and configuration. Throws ArgumentNullException when rows == null. |
| Member | Type | Description |
|---|---|---|
Rows |
IReadOnlyList<RewardRow> |
Rows. Read-only property. |
ViewRewardScreen
Responsible for: Shows presentations on the RewardCollectionView through the View service.
Qualified name: Ostryzhnyi.CasualGameCore.Rewards.ViewRewardScreen. Declaration: public sealed class ViewRewardScreen : IRewardScreen. Source.
| Method | Description |
|---|---|
public ViewRewardScreen(Func<IViewService> viewService) |
Creates ViewRewardScreen with the supplied dependencies and configuration. viewService: Resolved on each use, because the View service lives in a scene and may not exist yet when this is composed. Throws ArgumentNullException when viewService == null. |
public bool Present(RewardViewData data, Action dismissed) |
Shows the rows and calls dismissed once when the player dismisses them. Returns false, calling nothing, when the screen cannot be shown. Throws ArgumentNullException when data == null. Returns false when view == null. Returns false after the preceding guards/branches after a caught exception. |
Namespace: Ostryzhnyi.CasualGameCore.Settings
CasualGameSettings
Responsible for: The single project-owned settings asset: feature toggles, the service-mode table, and one section per feature. It lives at Assets/CasualGameCoreGenerated/Resources/CasualGameSettings.asset.
Qualified name: Ostryzhnyi.CasualGameCore.Settings.CasualGameSettings. Declaration: public class CasualGameSettings : ScriptableObject. Source.
| Method | Description |
|---|---|
public T Section<T>() where T : class, ICasualSettingsSection, new() |
Returns this feature's section, adding a default one the first time it is requested. |
public static CasualGameSettings Load() |
The runtime entry point: the loaded asset, or in-memory defaults when it is missing. Cached after the first call. |
public static CasualGameSettings ResolveOrDefaults(CasualGameSettings loaded) |
Returns loaded, or when it is null defaults with every toggle off, logging a single warning for the lifetime of the process. |
public static void ResetCache() |
Clears the cached settings reference and the one-time missing-settings warning state. |
| Member | Type | Description |
|---|---|---|
ResourceName |
string |
Resource Name. Declared initializer: "CasualGameSettings". |
Toggles |
FeatureToggles |
Toggles. Declared initializer: new FeatureToggles(). |
ServiceModes |
PlatformServiceModes |
Service Modes. Declared initializer: new PlatformServiceModes(). |
Sections |
IReadOnlyList<ICasualSettingsSection> |
Sections. Getter returns _sections. |
FeatureToggles
Responsible for: Per-system on/off switches. Every toggle is off by default. Rating is a mechanic capability, not a toggle.
Qualified name: Ostryzhnyi.CasualGameCore.Settings.FeatureToggles. Declaration: public class FeatureToggles. Source.
| Method | Description |
|---|---|
public bool IsConsentComposed(bool consentRequired) |
Consent is not a stored toggle: it is composed when Ads or Analytics is on and the consent mode is not NotRequired. consentRequired is that mode, supplied by the analytics plan. |
| Member | Type | Description |
|---|---|---|
DailyRewards |
bool |
Daily Rewards. Without an initializer, a new instance uses default(bool). |
Missions |
bool |
Missions. Without an initializer, a new instance uses default(bool). |
Shop |
bool |
Shop. Without an initializer, a new instance uses default(bool). |
Boosters |
bool |
Boosters. Without an initializer, a new instance uses default(bool). |
Chest |
bool |
Chest. Without an initializer, a new instance uses default(bool). |
LevelOfDay |
bool |
Level Of Day. Without an initializer, a new instance uses default(bool). |
Ads |
bool |
Ads. Without an initializer, a new instance uses default(bool). |
Iap |
bool |
Iap. Without an initializer, a new instance uses default(bool). |
Analytics |
bool |
Analytics. Without an initializer, a new instance uses default(bool). |
ICasualSettingsSection
Responsible for: Marks a serializable settings section owned by one feature. A section class must be [Serializable] with a parameterless constructor so CasualGameSettings.Section{T} can add it.
Qualified name: Ostryzhnyi.CasualGameCore.Settings.ICasualSettingsSection. Declaration: public interface ICasualSettingsSection. Source.
No declared public API members beyond the inherited lifecycle.
PlatformServiceModes
Responsible for: The mode table keyed by platform and service id. An entry that was never set resolves to ServiceMode.Disabled.
Qualified name: Ostryzhnyi.CasualGameCore.Settings.PlatformServiceModes. Declaration: public class PlatformServiceModes. Source.
| Method | Description |
|---|---|
public ServiceMode Resolve(ServicePlatform platform, string serviceId) |
Returns the stored platform/service mode, or Disabled when no row matches. |
public bool IsDisabledOnEveryPlatform(string serviceId) |
True when every platform has an explicit ServiceMode.Disabled row for the service: the author switched it off everywhere. A platform or service nobody filled in is not "switched off", so an empty table is false. Returns false when index < 0 || Entries[index].Mode != ServiceMode.Disabled. This check is inside the iteration. |
public void Set(ServicePlatform platform, string serviceId, ServiceMode mode) |
Sets the mode for one platform and service, replacing any existing entry. |
| Member | Type | Description |
|---|---|---|
Entries |
List<ServiceModeEntry> |
Entries. Declared initializer: new List<ServiceModeEntry>(). |
ServiceMode
Responsible for: How a service behaves on one platform. Shared by the ads, IAP, and analytics plans.
Qualified name: Ostryzhnyi.CasualGameCore.Settings.ServiceMode. Declaration: public enum ServiceMode. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
RealSdk |
0 |
Real Sdk. |
Simulation |
1 |
Simulation. |
Disabled |
2 |
Disabled. |
ServiceModeEntry
Responsible for: Stores one platform/service mode selection.
Qualified name: Ostryzhnyi.CasualGameCore.Settings.ServiceModeEntry. Declaration: public struct ServiceModeEntry. Source.
| Member | Type | Description |
|---|---|---|
Platform |
ServicePlatform |
Platform. Without an initializer, a new instance uses default(ServicePlatform). |
ServiceId |
string |
Service Id. Without an initializer, a new instance uses default(string). |
Mode |
ServiceMode |
Mode. Without an initializer, a new instance uses default(ServiceMode). |
ServicePlatform
Responsible for: Identifies a platform row in provider configuration.
Qualified name: Ostryzhnyi.CasualGameCore.Settings.ServicePlatform. Declaration: public enum ServicePlatform. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
iOS |
0 |
i OS. |
Android |
1 |
Android. |
WebGL |
2 |
Web GL. |
Namespace: Ostryzhnyi.CasualGameCore.Shop
BoosterPackRef
Responsible for: A Shop offer's pointer to a booster definition. An offer that holds one sells that booster's pack, and reads what the pack grants and how it is paid from the definition, so the Shop and the Out of Booster popup cannot price the same pack differently.
Qualified name: Ostryzhnyi.CasualGameCore.Shop.BoosterPackRef. Declaration: public sealed class BoosterPackRef. Source.
| Member | Type | Description |
|---|---|---|
BoosterId |
string |
The id of the booster definition; empty means no reference. Declared initializer: "". |
IEntitlementSink
Responsible for: Where the purchase flow records a non-consumable product as owned. The flow calls it after the reward is granted and before it confirms the order with the store, so a confirmed order can never be missing from the cache. The entitlement service implements it.
Qualified name: Ostryzhnyi.CasualGameCore.Shop.IEntitlementSink. Declaration: public interface IEntitlementSink. Source.
| Method | Description |
|---|---|
void Activate(string productId) |
Records the product as owned and saves. Calling it again for the same product, as a restore or a redelivery with a new transaction id does, changes nothing. |
IShopOfferResolver
Responsible for: Turns an offer as authored into the offer as sold. An offer that points at a booster pack is filled in from the definition; every other offer is returned as it is.
Qualified name: Ostryzhnyi.CasualGameCore.Shop.IShopOfferResolver. Declaration: public interface IShopOfferResolver. Source.
| Method | Description |
|---|---|
ShopOffer Resolve(ShopOffer offer) |
The offer to sell, or null when it cannot be sold, such as a pack whose booster no longer exists. |
IapCompleted
Responsible for: A store order was fulfilled: its reward is granted. Raised once per order, however often the store redelivers it, and before the store is told, so a consumer can persist what it needs first.
Qualified name: Ostryzhnyi.CasualGameCore.Shop.IapCompleted. Declaration: public struct IapCompleted. Source.
| Member | Type | Description |
|---|---|---|
ProductId |
string |
Product Id. Without an initializer, a new instance uses default(string). |
TransactionId |
string |
Transaction Id. Without an initializer, a new instance uses default(string). |
IapStarted
Responsible for: A purchase was requested from the store, before the store is asked.
Qualified name: Ostryzhnyi.CasualGameCore.Shop.IapStarted. Declaration: public struct IapStarted. Source.
| Member | Type | Description |
|---|---|---|
ProductId |
string |
Product Id. Without an initializer, a new instance uses default(string). |
MainMenuRemoveAdsBinder
Responsible for: The menu owns its binding and polls asynchronous service state only while active.
Qualified name: Ostryzhnyi.CasualGameCore.Shop.MainMenuRemoveAdsBinder. Declaration: public sealed class MainMenuRemoveAdsBinder : MonoBehaviour. Source.
| Method | Description |
|---|---|
public void SetContainer(DIContainer container) |
Updates container using the supplied value. |
MainMenuRemoveAdsController
Responsible for: Binds one menu's Remove Ads action to the purchase and entitlement flows. Restore Purchases is the Shop's; a restore running there shows here as RESTORING.
Qualified name: Ostryzhnyi.CasualGameCore.Shop.MainMenuRemoveAdsController. Declaration: public sealed class MainMenuRemoveAdsController : IDisposable. Source.
| Method | Description |
|---|---|
public MainMenuRemoveAdsController(MainMenuView view, ShopSettingsSection shop, IFeatureGate gate, PurchaseFlow purchases = null, IIapService iap = null, IEntitlementService entitlements = null, RestorePurchasesFlow restore = null) |
Creates MainMenuRemoveAdsController with the supplied dependencies and configuration. Throws ArgumentNullException when view == null. Throws ArgumentNullException when shop == null. Throws ArgumentNullException when gate == null. |
public void Refresh() |
Called while the menu is active, so delayed ownership/restore answers update it without reopening. |
public void Dispose() |
Releases this instance’s owned subscriptions or pending work. Call it when the owning flow ends. |
| Member | Type | Description |
|---|---|---|
State |
RemoveAdsState |
State. Getter returns StateOf(Payment). |
MainMenuRemoveAdsFeature
Responsible for: Owns the menu's shared purchase path even when Shop and Boosters are off.
Qualified name: Ostryzhnyi.CasualGameCore.Shop.MainMenuRemoveAdsFeature. Declaration: public sealed class MainMenuRemoveAdsFeature : ICasualFeature. Source.
| Method | Description |
|---|---|
public MainMenuRemoveAdsFeature(CasualGameSettings settings) |
Creates MainMenuRemoveAdsFeature with the supplied dependencies and configuration. Throws ArgumentNullException when settings == null. |
public void Register(DIContainer container) |
Registers this feature’s services and signal bindings in the supplied container. |
| Member | Type | Description |
|---|---|---|
Id |
string |
Id. Getter returns "MainMenuRemoveAds". |
Enabled |
bool |
Enabled. Getter returns true. |
Priority |
int |
Priority. Getter returns int.MinValue + 8. |
PurchaseFlow
Responsible for: Pays for an offer by any method and grants its reward once. A currency offer is validated, spent, then granted under shop:{offerId}:{number}. A store offer is requested and, when the store delivers, granted under a durable iap:{transactionId} (a non-consumable under iap:{productId}:owned), recorded as an entitlement when it is one, and only then confirmed with the store; the durable token is released after the store confirms. Orders the store delivers outside a request take the same path, so a redelivery grants nothing.
Qualified name: Ostryzhnyi.CasualGameCore.Shop.PurchaseFlow. Declaration: public sealed class PurchaseFlow : IDisposable. Source.
A purchase the player started and that granted something is shown once on the reward screen through IRewardPresenter after the grant; orders the store delivers on its own, a redelivery, a restore and an offer with no reward show nothing, and a missing presenter never blocks a purchase. Every failure grants and spends nothing and leaves the Shop open: it shows Purchase failed. Try again, or Not enough {currency} through the affordability guard. A store delivery the catalog cannot grant, an unknown product or an unregistered reward type, is deliberately left unconfirmed, so the store delivers it again once it can.
| Method | Description |
|---|---|
public bool IsPending(string productId) |
A deferred non-consumable cannot be bought again before its delivery arrives. |
public PurchaseFlow(ShopSettingsSection shop, EconomySettingsSection economy, ICurrencyService currency, AffordabilityGuard guard, IRewardGrantor grantor, RewardHandlerRegistry handlers, INoticeService notices, ShopSave save, IRandom random, IIapService iap = null, IEntitlementSink entitlements = null, OstryzhnyiSignal<ShopOfferPurchased> purchased = null, OstryzhnyiSignal<IapStarted> started = null, OstryzhnyiSignal<IapCompleted> completed = null, IRewardPresenter presenter = null) |
Creates PurchaseFlow with the supplied dependencies and configuration. iap: The purchase service; null when IAP is off, which makes every store offer unavailable. entitlements: Records non-consumable products as owned; null until the entitlement service exists. presenter: Shows what a player's purchase granted; null when the reward screen is not composed, which skips it. Throws ArgumentNullException when shop == null. Throws ArgumentNullException when economy == null. Throws ArgumentNullException when currency == null. Throws ArgumentNullException when guard == null. Throws ArgumentNullException when grantor == null. Throws ArgumentNullException when handlers == null. Throws ArgumentNullException when notices == null. Throws ArgumentNullException when save == null. Throws ArgumentNullException when random == null. |
public void Purchase(string offerId, Action<PurchaseOutcome> complete = null) |
Buys an offer. complete is called exactly once and receives how it ended: at once for a failure, and for a purchase that granted something after the reward screen has been closed, so a screen that refreshes in it shows the new state only after the reward. A repeated tap while a store purchase is under way is PurchaseOutcome.Unavailable. |
public void Dispose() |
Stops listening for orders the store delivers on its own. |
| Member | Type | Description |
|---|---|---|
IsRequesting |
bool |
Is Requesting. Getter returns _requesting. |
PurchaseFlowComposition
Responsible for: Builds and registers the PurchaseFlow once for the main menu, Shop and Out of Booster. Call after economy, IAP and entitlements, so a first caller never captures a missing store too early.
Qualified name: Ostryzhnyi.CasualGameCore.Shop.PurchaseFlowComposition. Declaration: public static class PurchaseFlowComposition. Source.
| Method | Description |
|---|---|
public static PurchaseFlow Ensure(DIContainer container, CasualGameSettings settings) |
The registered flow, or a new one built from the economy, rewards, notices and saves in container and, when they are composed, the purchase and entitlement services. Also sets the resolver that sells booster packs from their definitions. Throws InvalidOperationException, naming the missing service, when the economy is not composed. Throws ArgumentNullException when container == null. Throws ArgumentNullException when settings == null. Throws InvalidOperationException on the corresponding guard path. |
PurchaseOutcome
Responsible for: How a purchase request ended. Everything but Purchased and Pending granted and spent nothing and left the Shop open; each of those but NotEnoughCurrency showed the Purchase failed. Try again notice, and that one showed Not enough {currency}.
Qualified name: Ostryzhnyi.CasualGameCore.Shop.PurchaseOutcome. Declaration: public enum PurchaseOutcome. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Purchased |
0 |
The reward was granted, and the price was spent for a currency offer. |
Pending |
1 |
The store accepted the order but has not delivered it. It is granted once, when it arrives. |
NotEnoughCurrency |
2 |
A currency offer the player cannot afford. |
Cancelled |
3 |
The player backed out of the store's purchase sheet. |
Failed |
4 |
The store failed, or the offer could not be granted: an unregistered reward type, or a failed grant. |
Unavailable |
5 |
No such offer, or purchases are not available: IAP is off, not ready, or another purchase is under way. |
RemoveAdsState
Responsible for: Identifies the current Remove Ads purchase/presentation state.
Qualified name: Ostryzhnyi.CasualGameCore.Shop.RemoveAdsState. Declaration: public enum RemoveAdsState. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Unavailable |
0 |
Unavailable. |
Buy |
1 |
Buy. |
Pending |
2 |
Pending. |
Restoring |
3 |
Restoring. |
Owned |
4 |
Owned. |
ShopComposition
Responsible for: Connects the Shop View to the project's services. The View service lives in a scene, so this runs from the scene's CasualGameInstaller, as the progression controllers do, and replaces the controller an earlier scene made.
Qualified name: Ostryzhnyi.CasualGameCore.Shop.ShopComposition. Declaration: public static class ShopComposition. Source.
| Method | Description |
|---|---|
public static ShopController Connect(DIContainer container, Func<IViewService> views = null) |
Builds the ShopController from what container holds and registers it. Returns null, and registers nothing, when the Shop gate is off or the shared purchase flow is missing. views: Resolved on use; ViewService.Instance when null. Throws ArgumentNullException when container == null. Returns null when !container.TryResolve(typeof(PurchaseFlow), out var flow) || !container.TryResolve(typeof(IFeatureGate), out var gate) || !((IFeatureGate)gate).IsEnabled(ShopFeature.FeatureId). |
ShopController
Responsible for: Binds the Shop View to the catalog and the purchase flow. Each time the Shop opens it lists the offers whose system is composed, taps go to PurchaseFlow, and the list is refreshed after every purchase and restore. Knows the Shop View only; the notices for a failed purchase or an unaffordable price come from the flow.
Qualified name: Ostryzhnyi.CasualGameCore.Shop.ShopController. Declaration: public sealed class ShopController : IDisposable. Source.
An offer is listed when: store-paid, only while the Iap feature is enabled; a booster-section offer, only while BoostersFeatureId is enabled; a non-consumable, only while it is neither owned nor being verified; and Remove Ads is excluded because its persistent entry belongs to the main menu. Restore Purchases is shown only when the restore flow can restore.
| Method | Description |
|---|---|
public ShopController(Func<IViewService> views, ShopSettingsSection shop, EconomySettingsSection economy, IFeatureGate gate, PurchaseFlow purchases, INoticeService notices, IIapService iap = null, IEntitlementService entitlements = null, RestorePurchasesFlow restore = null) |
Creates ShopController with the supplied dependencies and configuration. views: Resolved once; without a View service the controller stays inert. iap: Null when IAP is not composed, which hides every store-paid card. entitlements: Null when purchases are not composed; non-consumables are then never owned. restore: Null when purchases are not composed, which hides Restore Purchases. Throws ArgumentNullException when views == null. Throws ArgumentNullException when shop == null. Throws ArgumentNullException when economy == null. Throws ArgumentNullException when gate == null. Throws ArgumentNullException when purchases == null. Throws ArgumentNullException when notices == null. |
public IReadOnlyList<ShopOfferViewData> BuildOffers() |
The cards the Shop would show right now, in catalog order. |
public void Dispose() |
Releases this instance’s owned subscriptions or pending work. Call it when the owning flow ends. |
| Member | Type | Description |
|---|---|---|
BoostersFeatureId |
string |
The Boosters feature id; until then booster-section offers stay hidden. Declared initializer: "Boosters". |
ShopData
Responsible for: The persisted shop counters. A blob written before a field existed loads with that field empty.
Qualified name: Ostryzhnyi.CasualGameCore.Shop.ShopData. Declaration: public sealed class ShopData. Source.
| Member | Type | Description |
|---|---|---|
PurchaseCounts |
Dictionary<string, int> |
How many currency purchases of each offer have been numbered, keyed by offer id. Declared initializer: new Dictionary<string, int>(). |
ShopFeature
Responsible for: Composes the Shop when its toggle is on: declares the Shop feature the navigation button is gated on, and registers the PurchaseFlow built from the economy, rewards, notices, the saved purchase numbers, and, when they are composed, the purchase service and the entitlement service. Registration fails, and the Shop stays off, when the economy is not composed.
Qualified name: Ostryzhnyi.CasualGameCore.Shop.ShopFeature. Declaration: public sealed class ShopFeature : ICasualFeature. Source.
The flow is built by PurchaseFlowComposition, because Boosters need it too when the Shop is off.
| Method | Description |
|---|---|
public ShopFeature(CasualGameSettings settings) |
Creates ShopFeature with the supplied dependencies and configuration. settings: The settings whose Shop toggle decides whether the feature composes. Throws ArgumentNullException when settings == null. |
public void Register(DIContainer container) |
Registers this feature’s services and signal bindings in the supplied container. |
| Member | Type | Description |
|---|---|---|
FeatureId |
string |
Feature Id. Declared initializer: "Shop". |
Id |
string |
Id. Getter returns FeatureId. |
Enabled |
bool |
Enabled. Getter returns _settings.Toggles.Shop. |
Priority |
int |
After the entitlements, so the flow can record non-consumables with them. Getter returns int.MinValue + 8. |
ShopOffer
Responsible for: One thing the Shop sells: a reward bundle and the payment for it. Id is the stable key purchases and signals use, so it never changes after creation; the name and icon are free to change.
Qualified name: Ostryzhnyi.CasualGameCore.Shop.ShopOffer. Declaration: public sealed class ShopOffer. Source.
| Member | Type | Description |
|---|---|---|
Id |
string |
Id. Declared initializer: "". |
Section |
ShopSection |
Section. Declared initializer: ShopSection.Coins. |
DisplayName |
string |
Display Name. Declared initializer: "". |
Icon |
Sprite |
Icon. Without an initializer, a new instance uses default(Sprite). |
Bundle |
RewardBundle |
What a purchase grants. A non-consumable may leave it empty: it is an entitlement, and restoring it never grants again. Declared initializer: new RewardBundle(). |
Payment |
ShopPayment |
Payment. Declared initializer: new ShopPayment(). |
BoosterPack |
BoosterPackRef |
Points a Boosters-section offer at a booster definition. Unity always builds this object when it loads an offer, so only HasBoosterPack says whether there is a reference. Declared initializer: new BoosterPackRef(). |
HasBoosterPack |
bool |
True when the offer sells a booster definition's pack, and its own bundle and payment are not used. Getter returns BoosterPack != null && !string.IsNullOrWhiteSpace(BoosterPack.BoosterId). |
ShopOfferPurchased
Responsible for: An offer was paid for and its reward granted, once. A redelivered order or a replayed token raises nothing, so a consumer counting purchases never counts one twice.
Qualified name: Ostryzhnyi.CasualGameCore.Shop.ShopOfferPurchased. Declaration: public struct ShopOfferPurchased. Source.
| Member | Type | Description |
|---|---|---|
OfferId |
string |
Offer Id. Without an initializer, a new instance uses default(string). |
Method |
ShopPaymentMethod |
Method. Without an initializer, a new instance uses default(ShopPaymentMethod). |
ShopOfferViewData
Responsible for: What one Shop card shows: data in, nothing the View could decide for itself. A store-paid card carries the provider's price text and no price icon; a currency-paid card carries its amount as text and the currency's icon.
Qualified name: Ostryzhnyi.CasualGameCore.Shop.ShopOfferViewData. Declaration: public readonly struct ShopOfferViewData. Source.
| Method | Description |
|---|---|
public ShopOfferViewData(string offerId, ShopSection section, string title, string rewardText, string priceText, Sprite icon, Sprite priceIcon) |
Creates ShopOfferViewData with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
OfferId |
string |
The stable offer id a tap reports back. Read-only property. |
Section |
ShopSection |
Section. Read-only property. |
Title |
string |
Title. Read-only property. |
RewardText |
string |
The amount the offer grants, such as 500 or 100-200; empty when it grants nothing to count. Read-only property. |
PriceText |
string |
The store's price text, or the currency amount. Read-only property. |
Icon |
Sprite |
The offer's own icon; null keeps the card's prefab art. Read-only property. |
PriceIcon |
Sprite |
The currency icon of a currency-paid card; null for a store-paid one. Read-only property. |
ShopPayment
Responsible for: One offer's payment. Each offer chooses its own method, independently of every other offer, and the fields of the other methods are kept so switching a method back does not lose what was typed.
Qualified name: Ostryzhnyi.CasualGameCore.Shop.ShopPayment. Declaration: public sealed class ShopPayment. Source.
| Method | Description |
|---|---|
public string CurrencyIdIn(EconomySettingsSection economy) |
The id of the currency this payment spends: the Soft or Hard currency of economy as the method says. Null for an IAP payment, or when no currency has that role. Returns null when economy == null || !IsCurrency. |
| Member | Type | Description |
|---|---|---|
Method |
ShopPaymentMethod |
Method. Declared initializer: ShopPaymentMethod.Iap. |
ProductId |
string |
The store product id. Only an ShopPaymentMethod.Iap offer uses it. Declared initializer: "". |
ProductType |
ShopProductType |
Product Type. Declared initializer: ShopProductType.Consumable. |
Price |
long |
The amount of the Soft or Hard currency an offer costs. Only a currency method uses it. Without an initializer, a new instance uses default(long). |
DisplayPrice |
string |
The price text the simulated store shows for an IAP offer, such as $0.99. The real store shows its own localized price instead. Declared initializer: "". |
IsCurrency |
bool |
True for the Soft and Hard currency methods. Getter returns Method != ShopPaymentMethod.Iap. |
ShopPaymentMethod
Responsible for: How an offer is paid. The currency methods name a role, so the offer always follows a renamed or re-iconed currency.
Qualified name: Ostryzhnyi.CasualGameCore.Shop.ShopPaymentMethod. Declaration: public enum ShopPaymentMethod. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Iap |
0 |
Iap. |
SoftCurrency |
1 |
Soft Currency. |
HardCurrency |
2 |
Hard Currency. |
ShopPrice
Responsible for: The price text of a payment, in one place so the Shop card and the Out of Booster popup show the same thing for the same pack.
Qualified name: Ostryzhnyi.CasualGameCore.Shop.ShopPrice. Declaration: public static class ShopPrice. Source.
| Method | Description |
|---|---|
public static string Text(ShopPayment payment, IIapService iap) |
A store payment's price as the store reports it, or its configured text while the store has none; a currency payment's amount. Empty for a missing payment. iap: The purchase service that knows the store's price; null when IAP is not composed. |
ShopProductType
Responsible for: What the store sells for an IAP offer. A NonConsumable is an entitlement: it is bought once and restored afterwards, so it can only be paid for with real money.
Qualified name: Ostryzhnyi.CasualGameCore.Shop.ShopProductType. Declaration: public enum ShopProductType. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Consumable |
0 |
Consumable. |
NonConsumable |
1 |
Non Consumable. |
ShopSave
Responsible for: The number each currency purchase of an offer is given, so its grant token shop:{offerId}:{number} is never reused, not even after a restart. Found by the Saves catalog scan; every change is saved at once.
Qualified name: Ostryzhnyi.CasualGameCore.Shop.ShopSave. Declaration: public sealed class ShopSave : VersionedSaveModel<ShopData>. Source.
| Method | Description |
|---|---|
public int PurchaseCount(string offerId) |
How many purchase numbers have been handed out for the offer. |
public int NextPurchaseNumber(string offerId) |
Hands out the next number for the offer and saves it before returning, so a crash after the grant can never repeat it. Numbers start at 0 and saturate instead of wrapping. Throws ArgumentNullException when offerId == null. |
ShopSection
Responsible for: The Shop's sections. The Special section holds offers that are not a pack, such as Remove Ads.
Qualified name: Ostryzhnyi.CasualGameCore.Shop.ShopSection. Declaration: public enum ShopSection. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Coins |
0 |
Coins. |
Gems |
1 |
Gems. |
Boosters |
2 |
Boosters. |
Special |
3 |
Special. |
ShopSettingsSection
Responsible for: The Shop's settings section: the offer catalog. A section that was never saved starts with the nine starting offers and Remove Ads; each offer is edited on its own.
Qualified name: Ostryzhnyi.CasualGameCore.Shop.ShopSettingsSection. Declaration: public sealed class ShopSettingsSection : ICasualSettingsSection. Source.
| Method | Description |
|---|---|
public ShopSettingsSection() |
Creates ShopSettingsSection with the supplied dependencies and configuration. |
public void UseResolver(IShopOfferResolver resolver) |
Sets what fills in offers that point at a booster pack. Runtime only: it is never saved, and the composition sets it again each run. Without one, every offer is sold as authored. |
public ShopOffer FindEffective(string id) |
The offer as sold with this id, or null when there is none or it cannot be sold. |
public ShopOffer Find(string id) |
The offer with this id, or null when there is none. |
public IReadOnlyList<ShopOffer> OffersIn(ShopSection section) |
The offers of one section, in catalog order. |
public bool TryAdd(string id, ShopSection section, out string message) |
Adds an empty consumable IAP offer. Fails with a message, and changes nothing, when the id is empty or already used. Returns false when trimmed.Length == 0. Returns false when Find(trimmed) != null. |
public bool TryRemove(string id, out string message) |
Removes an offer. Fails with a message, and changes nothing, for an unknown id. Returns false when offer == null. |
| Member | Type | Description |
|---|---|---|
RemoveAdsOfferId |
string |
The id of the Remove Ads offer the entitlement flow looks for. Declared initializer: "remove_ads". |
BoosterRewardType |
string |
The reward type the Boosters feature registers; booster-section offers grant it. Declared initializer: "booster". |
Offers |
List<ShopOffer> |
Offers. Declared initializer: new List<ShopOffer>(). |
EffectiveOffers |
IReadOnlyList<ShopOffer> |
The offers as sold, in catalog order: each one resolved, and any the resolver cannot sell left out. Everything that sells or lists offers reads this; the editor reads Offers, because it edits what is authored. Read-only property. |
Namespace: Ostryzhnyi.CasualGameCore.UI
BoosterSlot
Responsible for: One booster slot: its button, its count or empty mark, and its icon.
Qualified name: Ostryzhnyi.CasualGameCore.UI.GameplayHudView.BoosterSlot. Declaration: public class BoosterSlot. Source.
| Method | Description |
|---|---|
public bool IsShowingIcon(Sprite icon) |
Returns _icons.Any(image => image != null && image.sprite == icon). |
public void Show(BoosterSlotViewData data) |
Displays this view or UI element using the supplied state. |
public void Hide() |
Hides this view or UI element. |
| Member | Type | Description |
|---|---|---|
Button |
UnityEngine.UI.Button |
Button. Getter returns _button. |
Id |
BoosterId |
The booster this slot shows; empty while the slot is hidden. Getter returns _id. |
IsShown |
bool |
True while the slot is visible. A slot with no root hides its button instead. Getter returns Container != null && Container.activeSelf. |
IsEmpty |
bool |
True while the slot shows the empty mark instead of a count. Getter returns _emptyMark != null && _emptyMark.activeSelf. |
CountText |
string |
The count text, or empty when the slot shows the empty mark. Getter returns _count != null ? _count.text : "". |
BottomNavigationView
Responsible for: Raises navigation intent for Daily, Missions and Shop.
Qualified name: Ostryzhnyi.CasualGameCore.UI.BottomNavigationView. Declaration: public class BottomNavigationView : CasualView. Source.
| Method | Description |
|---|---|
protected virtual void OpenDaily() |
Opens daily through this type’s configured UI or link handler. |
protected virtual void OpenMission() |
Opens mission through this type’s configured UI or link handler. |
protected virtual void OpenShop() |
Opens shop through this type’s configured UI or link handler. |
protected virtual void OpenSettings() |
Opens settings through this type’s configured UI or link handler. |
| Member | Type | Description |
|---|---|---|
Layer |
ViewLayers |
Layer. Getter returns ViewLayers.BottomPanel. |
DailyButton |
UnityEngine.UI.Button |
Daily Button. Getter returns _dailyButton. |
MissionButton |
UnityEngine.UI.Button |
Mission Button. Getter returns _missionButton. |
ShopButton |
UnityEngine.UI.Button |
Shop Button. Getter returns _shopButton. |
SettingsButton |
UnityEngine.UI.Button |
Settings Button. Getter returns _settingsButton. |
CasualLockFeedback
Responsible for: The refusal a locked card gives: while its button is not interactable, a tap plays the same squash and shake as a disabled button, and nothing else changes. CasualDisabledFeedback also dims every layer of a non-interactable control, which turns a day that is merely locked into a dark one; this keeps its tap reaction and leaves the art as the prefab drew it. Use it in place of CasualDisabledFeedback, never beside it (the base allows one per object).
Qualified name: Ostryzhnyi.CasualGameCore.UI.CasualLockFeedback. Declaration: public sealed class CasualLockFeedback : CasualDisabledFeedback. Source.
No declared public API members beyond the inherited lifecycle.
CasualView
Responsible for: Base View for every product screen: button listen helpers plus local navigation.
Qualified name: Ostryzhnyi.CasualGameCore.UI.CasualView. Declaration: public abstract class CasualView : BaseView. Source.
| Method | Description |
|---|---|
public void SetViewService(IViewService service) |
Test seam: routes this View's navigation through service. |
protected void CloseSelf() |
Closes this View through Navigation. Use it as the handler of a plain close button. |
protected static void Listen(Button button, UnityAction callback) |
Adds the callback to the supplied button or buttons, ignoring null buttons or a null array. |
protected static void StopListening(Button button, UnityAction callback) |
Removes the callback from the supplied button or buttons, ignoring null buttons or a null array. |
protected static void Listen(IEnumerable<Button> buttons, UnityAction callback) |
Adds the callback to the supplied button or buttons, ignoring null buttons or a null array. |
protected static void StopListening(IEnumerable<Button> buttons, UnityAction callback) |
Removes the callback from the supplied button or buttons, ignoring null buttons or a null array. |
| Member | Type | Description |
|---|---|---|
Navigation |
ViewNavigation |
Opens and closes Views through the service. Uses ViewService.Instance unless SetViewService replaced it. Getter returns _navigation ??= new ViewNavigation(_viewService ?? ViewService.Instance, this). |
ChestCellView
Responsible for: What one cell of the Chest screen shows: a closed chest, or once opened its icon and amount, with a mark on the jackpot. A jackpot that granted several rewards shows the jackpot icon (a pile of coins and gems) instead of the first reward's. The card's button belongs to ChestView, which raises the tap. Every part is optional.
Qualified name: Ostryzhnyi.CasualGameCore.UI.ChestCellView. Declaration: public sealed class ChestCellView : MonoBehaviour. Source.
| Method | Description |
|---|---|
public void Show(ChestCellViewData data) |
Shows the cell closed or opened. |
| Member | Type | Description |
|---|---|---|
IsRevealed |
bool |
Is Revealed. Getter returns _revealed. |
IsJackpotShown |
bool |
Is Jackpot Shown. Getter returns _revealed && _jackpot. |
HasIcon |
bool |
Has Icon. Getter returns _icon != null && _icon.gameObject.activeSelf && _icon.sprite != null. |
Label |
string |
Label. Getter returns _label != null ? _label.text : string.Empty. |
Icon |
Sprite |
Icon. Getter returns HasIcon ? _icon.sprite : null. |
JackpotIcon |
Sprite |
Jackpot Icon. Getter returns _jackpotIcon. |
ChestView
Responsible for: The Chest popup. Data in, intent out: SetCells, SetKeys and SetKeyOffers fill it, and a tap raises CellRequested, GetAdKeysRequested, GetGemKeysRequested or ExitRequested. Exit is always there, and the system back key behaves as Exit. What a cell holds, whether the player may open it and what a pack costs are not decided here.
Qualified name: Ostryzhnyi.CasualGameCore.UI.ChestView. Declaration: public class ChestView : CasualView. Source.
The popup starts empty, so one opened without its controller shows closed cells and no key buttons rather than the prefab's placeholders.
| Method | Description |
|---|---|
public void SetCells(IReadOnlyList<ChestCellViewData> cells) |
Shows cells on the slots in order. A slot with no data is shown closed; data with no slot is skipped. |
public void SetKeys(int keys, int total = -1) |
Updates keys using the supplied value. keys: The keys the player can still spend. total: The keys the chest has given so far, spent or not; the row shows that many slots. Defaults to keys. |
public void SetKeyOffers(ChestKeyOfferViewData ad, ChestKeyOfferViewData gem) |
Shows each Get Keys button with its keys and price. A button the player can still use is active; one whose pack was taken stays on the screen, inactive. Only a pack that is not there at all (no keys, ads off) hides its button. |
public void SetCellsInteractable(bool interactable) |
Whether the closed cells accept a tap. Opened cells never do. |
public void HighlightKeyOffers() |
Points out the Get Keys options, for a player who tapped a cell with no key. Ends by itself. |
public void Back() |
The system back gesture. Behaves as Exit; also what the Escape key calls. |
protected virtual void RaiseCellRequested(int cell) |
Raises CellRequested intent for subscribed controllers; no subscriber is required. |
protected virtual void RaiseGetAdKeysRequested() |
Raises GetAdKeysRequested intent for subscribed controllers; no subscriber is required. |
protected virtual void RaiseGetGemKeysRequested() |
Raises GetGemKeysRequested intent for subscribed controllers; no subscriber is required. |
protected virtual void RaiseExitRequested() |
Raises ExitRequested intent for subscribed controllers; no subscriber is required. |
| Member | Type | Description |
|---|---|---|
Layer |
ViewLayers |
Layer. Getter returns ViewLayers.Popup. |
Cells |
IReadOnlyList<ChestCellView> |
What each cell shows. Getter returns _cells. |
PrizeButtons |
IReadOnlyList<UnityEngine.UI.Button> |
The button of each cell's card, in cell order. Getter returns _prizeButtons. |
ExitButton |
UnityEngine.UI.Button |
Exit Button. Getter returns _exitButton. |
GetAdKeysButton |
UnityEngine.UI.Button |
Get Ad Keys Button. Getter returns _getKeysButton. |
GetGemKeysButton |
UnityEngine.UI.Button |
Get Gem Keys Button. Getter returns _getGemKeysButton. |
KeysText |
string |
The key counter text. Getter returns _keysText != null ? _keysText.text : string.Empty. |
AdKeysVisible |
bool |
Ad Keys Visible. Getter returns _getKeysButton != null && _getKeysButton.gameObject.activeSelf. |
GemKeysVisible |
bool |
Gem Keys Visible. Getter returns _getGemKeysButton != null && _getGemKeysButton.gameObject.activeSelf. |
AdKeysInteractable |
bool |
False once the pack was taken: the button stays on the screen, inactive. Getter returns _getKeysButton != null && _getKeysButton.interactable. |
GemKeysInteractable |
bool |
Gem Keys Interactable. Getter returns _getGemKeysButton != null && _getGemKeysButton.interactable. |
AdKeysLabel |
string |
Ad Keys Label. Getter returns _getAdKeysLabel != null ? _getAdKeysLabel.text : string.Empty. |
GemKeysLabel |
string |
Gem Keys Label. Getter returns _getGemKeysLabel != null ? _getGemKeysLabel.text : string.Empty. |
GemKeysAmountLabel |
string |
Gem Keys Amount Label. Getter returns _getGemKeysAmountLabel != null ? _getGemKeysAmountLabel.text : string.Empty. |
VisibleKeySlots |
int |
How many key slots are on the screen: one per key the chest has given so far, up to the slots there are. Read-only property. |
LitKeyIcons |
int |
How many of the key icons are lit, one per key the player has, up to the icons there are. Read-only property. |
KeyOffersNoteVisible |
bool |
True while the note that keys last for this chest only is showing, which is whenever a Get Keys button is. Getter returns _keyOffersNote != null && _keyOffersNote.activeSelf. |
KeyOffersHighlighted |
bool |
True while the Get Keys options are highlighted to point out how to get a key. Getter returns _highlight != null. |
CellRequested |
Action<int> |
Raised with the zero-based cell when a cell is tapped. |
GetAdKeysRequested |
Action |
Raised for get ad keys requested notifications. |
GetGemKeysRequested |
Action |
Raised for get gem keys requested notifications. |
ExitRequested |
Action |
The player left the chest: the Exit button or the system back key. |
ConsentView
Responsible for: The built-in consent dialog: a short body, Accept, Decline and the Privacy Policy link. Data in, intent out. It is blocking: it has no close button and ignores the back key, so the player has to choose. Its Privacy Policy link is hidden while no valid link is configured, by the gate on the button.
Qualified name: Ostryzhnyi.CasualGameCore.UI.ConsentView. Declaration: public class ConsentView : CasualView. Source.
| Method | Description |
|---|---|
public void SetBody(string text) |
Updates body using the supplied value. |
protected virtual void RaiseAcceptRequested() |
Raises AcceptRequested intent for subscribed controllers; no subscriber is required. |
protected virtual void RaiseDeclineRequested() |
Raises DeclineRequested intent for subscribed controllers; no subscriber is required. |
protected virtual void RaisePrivacyPolicyRequested() |
Raises PrivacyPolicyRequested intent for subscribed controllers; no subscriber is required. |
| Member | Type | Description |
|---|---|---|
Layer |
ViewLayers |
Layer. Getter returns ViewLayers.Overlay. |
AcceptButton |
UnityEngine.UI.Button |
Accept Button. Getter returns _acceptButton. |
DeclineButton |
UnityEngine.UI.Button |
Decline Button. Getter returns _declineButton. |
PrivacyPolicyButton |
UnityEngine.UI.Button |
Privacy Policy Button. Getter returns _privacyPolicyButton. |
BodyText |
string |
The text shown. Getter returns _bodyText != null ? _bodyText.text : string.Empty. |
AcceptRequested |
Action |
Raised for accept requested notifications. |
DeclineRequested |
Action |
Raised for decline requested notifications. |
PrivacyPolicyRequested |
Action |
Raised for privacy policy requested notifications. |
ContinueOptionViewData
Responsible for: One way to continue a lost attempt, as LoseView shows it.
Qualified name: Ostryzhnyi.CasualGameCore.UI.ContinueOptionViewData. Declaration: public readonly struct ContinueOptionViewData. Source.
| Method | Description |
|---|---|
public ContinueOptionViewData(string methodId, string label, string price = null) |
Creates ContinueOptionViewData with the supplied dependencies and configuration. |
| Member | Type | Description |
|---|---|---|
MethodId |
string |
The id raised back through LoseView.ContinueRequested. Read-only property. |
Label |
string |
Label. Read-only property. |
Price |
string |
Shown beside Label; null or empty for a free method. Read-only property. |
CurrencyShopLink
Responsible for: Put it on a currency counter: tapping the counter opens the Shop, as a player expects when they run short. It does nothing while the Shop feature is off, and it only needs the counter to have a graphic that takes pointer input.
Qualified name: Ostryzhnyi.CasualGameCore.UI.CurrencyShopLink. Declaration: public sealed class CurrencyShopLink : MonoBehaviour, IPointerClickHandler. Source.
| Method | Description |
|---|---|
public void SetViewService(IViewService service) |
Test seam: opens the Shop through service instead of ViewService.Instance. |
public void SetGate(IFeatureGate gate) |
Test seam: asks gate whether the Shop is on instead of the injected or project gate. |
DailyDayCardView
Responsible for: One day card of the Daily Rewards screen: a collected day shows its mark, the available day shows Claim, and a future day shows its number. Exactly one of the three is shown at a time, so none overlays another. It sits on the card's slot, so hiding the card also frees the slot in the layout. Every part is optional.
Qualified name: Ostryzhnyi.CasualGameCore.UI.DailyDayCardView. Declaration: public sealed class DailyDayCardView : MonoBehaviour. Source.
| Method | Description |
|---|---|
public void Show(DailyDayViewData data, bool claimEnabled) |
Shows the card for a day. Claim is visible on the available day only, and usable only when claimEnabled. |
public void SetClaimEnabled(bool enabled) |
Lets the available day's Claim be tapped or not, without changing what the card shows. |
public void Hide() |
Hides this view or UI element. |
| Member | Type | Description |
|---|---|---|
ClaimRequested |
Action |
Raised when Claim on this card is tapped. |
IsShown |
bool |
Is Shown. Getter returns gameObject.activeSelf. |
State |
DayState |
State. Setter: private set. |
Number |
int |
Number. Setter: private set. |
CollectedMarkVisible |
bool |
Collected Mark Visible. Getter returns _collectedMark != null && _collectedMark.activeSelf. |
ClaimVisible |
bool |
Claim Visible. Getter returns _claimButton != null && _claimButton.gameObject.activeSelf. |
ClaimInteractable |
bool |
Claim Interactable. Getter returns ClaimVisible && _claimButton.interactable. |
DayLabel |
string |
Day Label. Getter returns _dayNumber != null ? _dayNumber.text : string.Empty. |
DayLabelVisible |
bool |
Day Label Visible. Getter returns _dayNumber != null && _dayNumber.gameObject.activeSelf. |
ClaimButton |
Button |
Claim Button. Getter returns _claimButton. |
CardButton |
Button |
The card's own button; null when the prefab has none. Getter returns _cardButton. |
RewardIconLayers |
IReadOnlyList<Image> |
The images the reward's picture is put on, Main and Shadow. Getter returns _rewardIconLayers ?? Array.Empty<Image>(). |
DailyRewardsView
Responsible for: The Daily Rewards popup. Data in, intent out: SetDays fills the day cards in order and hides the ones with no day, SetClaimEnabled lets the available day be claimed, and a tap on Claim raises ClaimRequested. Which day is available and what it grants is not decided here.
Qualified name: Ostryzhnyi.CasualGameCore.UI.DailyRewardsView. Declaration: public class DailyRewardsView : CasualView. Source.
The popup starts empty, so one opened without its controller is blank rather than showing the prefab's placeholders.
| Method | Description |
|---|---|
public void SetDays(IReadOnlyList<DailyDayViewData> days) |
Shows days on the cards in order. A card with no day is hidden; a day with no card is skipped. |
public void SetClaimEnabled(bool enabled) |
Lets the available day be claimed or not. |
public void Return() |
Opens this popup again after the reward screen, which shares its layer, replaced it. Does nothing while it is open. Only Views open the Daily popup, so the controller asks the View to come back. |
protected virtual void RaiseRewardRequested() |
Raises RewardRequested intent for subscribed controllers; no subscriber is required. |
protected virtual void RaiseClaimRequested() |
Raises ClaimRequested intent for subscribed controllers; no subscriber is required. |
| Member | Type | Description |
|---|---|---|
Layer |
ViewLayers |
Layer. Getter returns ViewLayers.Popup. |
CloseButton |
UnityEngine.UI.Button |
Close Button. Getter returns _closeButton. |
DayCards |
IReadOnlyList<DailyDayCardView> |
The day card slots, shown or not. Getter returns _dayCards. |
RewardRequested |
Action |
Raised for reward requested notifications. |
ClaimRequested |
Action |
Raised when Claim on the available day is tapped. |
FeatureGateBinder
Responsible for: Shows its target only while a feature is enabled (or only while it is disabled with Invert). An ID no feature declared leaves the target visible and logs one warning.
Qualified name: Ostryzhnyi.CasualGameCore.UI.FeatureGateBinder. Declaration: public sealed class FeatureGateBinder : MonoBehaviour. Source.
| Method | Description |
|---|---|
public void Configure(string featureId, bool invert = false, GameObject target = null) |
Test and editor seam: sets the serialized fields. |
public void SetGate(IFeatureGate gate) |
Test seam: uses gate instead of the injected or project gate, then re-evaluates. |
public void Evaluate() |
Re-reads the gate and applies visibility to Target. |
| Member | Type | Description |
|---|---|---|
FeatureId |
string |
Feature Id. Getter returns _featureId. |
Invert |
bool |
Invert. Getter returns _invert. |
Target |
GameObject |
The object that is shown or hidden; this component's own object when unset. Getter returns _target != null ? _target : gameObject. |
FieldTapArea
Responsible for: Translates a UI pointer click into a field-tap event.
Qualified name: Ostryzhnyi.CasualGameCore.UI.FieldTapArea. Declaration: public class FieldTapArea : MonoBehaviour, IPointerClickHandler. Source.
| Member | Type | Description |
|---|---|---|
LeftTapped |
Action |
Raised for left tapped notifications. |
RightTapped |
Action |
Raised for right tapped notifications. |
GameplayHudView
Responsible for: The in-game HUD. Booster slots follow P02 KTD2: SetBoosters puts data in, a tap raises BoosterRequested with the slot's booster, and what a tap does (use it, or open Out of Booster for an empty one) is decided by the controller. A slot with no booster to show is hidden, so the HUD starts with none until something sets them.
Qualified name: Ostryzhnyi.CasualGameCore.UI.GameplayHudView. Declaration: public class GameplayHudView : CasualView. Source.
| Method | Description |
|---|---|
public virtual void SetUnitLabel(string text) |
The heading naming the unit this screen is about, such as LEVEL 3. A popup with no such label ignores the call. |
public void SetBoosters(IReadOnlyList<BoosterSlotViewData> boosters) |
Shows boosters in the slots, in order. A slot with no booster is hidden, and a booster with no slot left is skipped. |
protected virtual void OnBoosterClicked(BoosterSlot slot) |
Raises booster intent only when the clicked slot is shown. |
protected virtual void RaisePauseRequested() |
Raises PauseRequested intent for subscribed controllers; no subscriber is required. |
protected virtual void RaiseLeftFieldTapped() |
Raises the corresponding LeftFieldTapped notification when subscribed. |
protected virtual void RaiseRightFieldTapped() |
Raises the corresponding RightFieldTapped notification when subscribed. |
protected virtual void RaiseBoosterRequested(BoosterId booster) |
Raises BoosterRequested intent for subscribed controllers; no subscriber is required. |
| Member | Type | Description |
|---|---|---|
Layer |
ViewLayers |
Layer. Getter returns ViewLayers.Window. |
PauseButton |
UnityEngine.UI.Button |
Pause Button. Getter returns _pauseButton. |
FieldTapArea |
FieldTapArea |
Field Tap Area. Getter returns _fieldTapArea. |
Boosters |
IReadOnlyList<BoosterSlot> |
The booster slots the HUD has room for, shown or not. Getter returns _boosters. |
PauseRequested |
Action |
Raised for pause requested notifications. |
LeftFieldTapped |
Action |
Raised for left field tapped notifications. |
RightFieldTapped |
Action |
Raised for right field tapped notifications. |
BoosterRequested |
Action<BoosterId> |
Raised with the slot's booster when a shown slot is tapped. |
IHomeScreen
Responsible for: Marks the View the player lands on once loading is over. A feature that must act when the player first reaches home, such as asking for consent, listens for a View of this kind instead of naming the menu's own View, so it knows no other feature's screens.
Qualified name: Ostryzhnyi.CasualGameCore.UI.IHomeScreen. Declaration: public interface IHomeScreen. Source.
No declared public API members beyond the inherited lifecycle.
INoticeService
Responsible for: Shows one shared popup for retry, insufficient-funds and network messages. It shows over the current layer and never hides or navigates away from the View that raised it.
Qualified name: Ostryzhnyi.CasualGameCore.UI.INoticeService. Declaration: public interface INoticeService. Source.
| Method | Description |
|---|---|
void Show(NoticeKind kind, string detail = null) |
Displays this view or UI element using the supplied state. kind: Which message to show. detail: The currency display name for NoticeKind.NotEnoughCurrency; ignored by the other kinds. |
IOrientationControl
Responsible for: The screen orientation switches the lock sets. Abstracted so tests do not touch the real Screen.
Qualified name: Ostryzhnyi.CasualGameCore.UI.IOrientationControl. Declaration: public interface IOrientationControl. Source.
| Member | Type | Description |
|---|---|---|
Orientation |
ScreenOrientation |
Orientation. Setter: set. |
AutorotateToPortrait |
bool |
Autorotate To Portrait. Setter: set. |
AutorotateToPortraitUpsideDown |
bool |
Autorotate To Portrait Upside Down. Setter: set. |
AutorotateToLandscapeLeft |
bool |
Autorotate To Landscape Left. Setter: set. |
AutorotateToLandscapeRight |
bool |
Autorotate To Landscape Right. Setter: set. |
IconLayers
Responsible for: The one place a currency's or booster's icon is put onto the images that show it. An icon is rendered in two layers, Main and a darker Shadow copy of the same sprite, so every view sets all of them here instead of one image at a time. Only the sprite changes: each layer keeps the colour and alpha the prefab gave it.
Qualified name: Ostryzhnyi.CasualGameCore.UI.IconLayers. Declaration: public static class IconLayers. Source.
| Method | Description |
|---|---|
public static bool Apply(IEnumerable<Image> layers, Sprite sprite) |
Sets sprite on every non-null layer. A null sprite changes nothing, so a definition without an icon keeps the prefab's own art in every layer. Returns whether the sprite was applied. Returns false when layers == null || sprite == null. |
public static IReadOnlyList<Image> In(Transform root) |
Every image under root, active or not: the layers of an icon whose prefab lists none. Empty for a null root. |
InjectingViewService
Responsible for: A ViewService that fills [DiInject] fields on each spawned View and its components.
Qualified name: Ostryzhnyi.CasualGameCore.UI.InjectingViewService. Declaration: public sealed class InjectingViewService : ViewService. Source.
| Method | Description |
|---|---|
public void SetDiContainer(DIContainer container) |
Updates di container using the supplied value. |
| Member | Type | Description |
|---|---|---|
Container |
DIContainer |
Container. Setter: private set. |
LevelOfDayButtonState
Responsible for: What the main menu's Level of Day button shows.
Qualified name: Ostryzhnyi.CasualGameCore.UI.LevelOfDayButtonState. Declaration: public enum LevelOfDayButtonState. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Hidden |
0 |
Not composed, so the button is not on the menu. |
Available |
1 |
Today's level can be played. |
Completed |
2 |
Today's level was won; the button stays on the menu, disabled, until the day changes. |
LoadingView
Responsible for: Displays the loading screen through the shared view lifecycle.
Qualified name: Ostryzhnyi.CasualGameCore.UI.LoadingView. Declaration: public class LoadingView : CasualView. Source.
| Method | Description |
|---|---|
public virtual void Play(float duration) |
Stops a previous fill routine, resets the progress bar to zero and starts the loading fill coroutine for the supplied duration. |
protected virtual void RaiseCompleted() |
Raises the corresponding Completed notification when subscribed. |
| Member | Type | Description |
|---|---|---|
Layer |
ViewLayers |
Layer. Getter returns ViewLayers.Window. |
Completed |
Action |
Raised for completed notifications. |
LoseView
Responsible for: Displays retry, continue and exit intent after a loss.
Qualified name: Ostryzhnyi.CasualGameCore.UI.LoseView. Declaration: public class LoseView : CasualView. Source.
| Method | Description |
|---|---|
public virtual void SetUnitLabel(string text) |
The heading naming the unit this screen is about, such as LEVEL 3. A popup with no such label ignores the call. |
public virtual void SetScore(long? score) |
This attempt's score, or null to hide the row (a mechanic that keeps no score). A popup with no score row ignores the call. |
public virtual void SetContinueOptions(IReadOnlyList<ContinueOptionViewData> options) |
Replaces the listed continue options. An empty list leaves only retry and exit. |
protected virtual void RaiseRetryRequested() |
Raises RetryRequested intent for subscribed controllers; no subscriber is required. |
protected virtual void RaiseContinueRequested(string methodId) |
Raises ContinueRequested intent for subscribed controllers; no subscriber is required. |
protected virtual void RaiseExitRequested() |
Raises ExitRequested intent for subscribed controllers; no subscriber is required. |
| Member | Type | Description |
|---|---|---|
Layer |
ViewLayers |
Layer. Getter returns ViewLayers.Popup. |
RetryButton |
UnityEngine.UI.Button |
Retry Button. Getter returns _retryButton. |
RetryRequested |
Action |
Raised for retry requested notifications. |
ExitRequested |
Action |
Raised for exit requested notifications. |
ContinueRequested |
Action<string> |
The player chose a continue option; the argument is its ContinueOptionViewData.MethodId. |
ScoreVisible |
bool |
Score Visible. Getter returns _scoreRoot != null && _scoreRoot.activeSelf. |
ScoreText |
string |
Score Text. Getter returns _scoreLabel != null ? _scoreLabel.text : "". |
RewardVisible |
bool |
Reward Visible. Getter returns _rewardRoot != null && _rewardRoot.activeSelf. |
MainMenuView
Responsible for: The main menu. The level path is a fixed stack of slots with the current unit at the bottom: SetProgress numbers the slots upward from the saved position, and only the bottom one takes input. Future slots are disabled, and nothing scrolls.
Qualified name: Ostryzhnyi.CasualGameCore.UI.MainMenuView. Declaration: public class MainMenuView : CasualView, IHomeScreen. Source.
| Method | Description |
|---|---|
public void SetLevelOfDay(LevelOfDayButtonState state) |
Shows or hides the Level of Day button, and enables it only while today's level can be played. |
public void SetRemoveAdsVisible(bool visible) |
Shows or hides the Remove Ads action: with ads off there is nothing to remove. Restore Purchases lives in the Shop. |
public void SetRemoveAds(string text, bool canBuy) |
The state text and whether the button can buy. The text is kept even when the button has no label, as the icon-only button has none. |
public virtual void SetChestSchedule(Func<int, bool> isChestLevel) |
Shows a golden chest on every slot whose zero-based level makes isChestLevel true, and re-applies it each time the path moves. Null hides every marker, as when there is no Chest or the mechanic has sessions instead of levels. |
public virtual void SetProgress(int position, bool showPath = true) |
Binds the path to the zero-based position of the current unit: the bottom slot shows its one-based number and is the only one that takes input, and each slot above it shows the next number and is disabled. Calling it again with the same position changes nothing, so a repeated callback never moves the path twice. showPath: False for a mechanic with sessions instead of levels: Play stays, the path is hidden. |
protected virtual void RaisePlayRequested() |
Raises PlayRequested intent for subscribed controllers; no subscriber is required. |
protected virtual void RaiseLevelRequested() |
Raises LevelRequested intent for subscribed controllers; no subscriber is required. |
| Member | Type | Description |
|---|---|---|
LevelOfDayText |
string |
Level Of Day Text. Declared initializer: "LEVEL OF DAY". |
LevelOfDayDoneText |
string |
Level Of Day Done Text. Declared initializer: "DONE TODAY". |
Layer |
ViewLayers |
Layer. Getter returns ViewLayers.Window. |
PlayButton |
UnityEngine.UI.Button |
Play Button. Getter returns _playButton. |
PlayRequested |
Action |
Raised for play requested notifications. |
LevelRequested |
Action |
Raised for level requested notifications. |
RemoveAdsRequested |
Action |
Raised for remove ads requested notifications. |
LevelOfDayRequested |
Action |
Raised for level of day requested notifications. |
LevelOfDayButton |
UnityEngine.UI.Button |
Level Of Day Button. Getter returns _levelOfDayButton. |
LevelOfDay |
LevelOfDayButtonState |
Level Of Day. Declared initializer: LevelOfDayButtonState.Hidden. Setter: private set. |
RemoveAdsButton |
UnityEngine.UI.Button |
Remove Ads Button. Getter returns _removeAdsButton. |
RemoveAdsText |
string |
Remove Ads Text. Declared initializer: "". Setter: private set. |
LevelIdles |
CasualIdle[] |
Level Idles. Setter: set. |
CurrentLevelIndex |
int |
Current Level Index. Setter: set. |
LevelSlots |
System.Collections.Generic.IReadOnlyList<UnityEngine.UI.Button> |
The slots of the path, top to bottom; the last one is the current unit. Getter returns _levelButtons ?? Array.Empty<UnityEngine.UI.Button>(). |
LevelChestMarkers |
System.Collections.Generic.IReadOnlyList<GameObject> |
The golden chest marker of each slot, in slot order; a slot without one has a null entry. Getter returns _levelChestMarkers ?? Array.Empty<GameObject>(). |
LevelMapVisible |
bool |
Whether the level path is shown. Getter returns _levelMap == null || _levelMap.activeSelf. |
MissionRowView
Responsible for: One mission row of the Missions screen: the description, a progress bar and count, the reward preview, and Claim, which is only there when the mission is finished. The reward is its amount next to the item's icon, never the item's name. It sits on the row's slot, so hiding the row also frees the slot in the layout. Every part is optional.
Qualified name: Ostryzhnyi.CasualGameCore.UI.MissionRowView. Declaration: public sealed class MissionRowView : MonoBehaviour. Source.
| Method | Description |
|---|---|
public void Show(MissionSlotViewData data) |
Shows the row for a mission, with Claim only when it is complete. |
public void Hide() |
Hides this view or UI element. |
| Member | Type | Description |
|---|---|---|
RewardIconLayers |
IReadOnlyList<Image> |
The images the reward's icon is put on, Main and Shadow. Getter returns _rewardIconLayers ?? Array.Empty<Image>(). |
ClaimRequested |
Action |
Raised when Claim on this row is tapped. |
IsShown |
bool |
Is Shown. Getter returns gameObject.activeSelf. |
Description |
string |
Description. Getter returns _description != null ? _description.text : string.Empty. |
ProgressText |
string |
Progress Text. Getter returns _progressText != null ? _progressText.text : string.Empty. |
RewardText |
string |
Reward Text. Getter returns _reward != null ? _reward.text : string.Empty. |
BarValue |
float |
Bar Value. Getter returns _progressBar != null ? _progressBar.Value : 0f. |
ClaimVisible |
bool |
Claim Visible. Getter returns _claimButton != null && _claimButton.gameObject.activeSelf. |
ClaimButton |
Button |
Claim Button. Getter returns _claimButton. |
MissionsView
Responsible for: The Missions popup. Data in, intent out: SetSlots fills the mission rows in order and hides the rows that have no mission, and a tap on a row's Claim raises ClaimRequested with its slot. Which missions exist and what they pay is not decided here.
Qualified name: Ostryzhnyi.CasualGameCore.UI.MissionsView. Declaration: public class MissionsView : CasualView. Source.
The popup starts empty, so one opened without its controller is blank rather than showing the prefab's placeholders.
| Method | Description |
|---|---|
public void SetSlots(IReadOnlyList<MissionSlotViewData> slots) |
Shows slots on the rows in order. A row with no mission is hidden; a mission with no row is skipped. |
public void Return() |
Opens this popup again after the reward screen, which shares its layer, replaced it. Does nothing while it is open. Only Views open the Missions popup, so the controller asks the View to come back. |
protected virtual void RaiseClaimRequested(int slot) |
Raises ClaimRequested intent for subscribed controllers; no subscriber is required. |
| Member | Type | Description |
|---|---|---|
Layer |
ViewLayers |
Layer. Getter returns ViewLayers.Popup. |
CloseButton |
UnityEngine.UI.Button |
Close Button. Getter returns _closeButton. |
Rows |
IReadOnlyList<MissionRowView> |
The row slots, shown or not. Getter returns _rows. |
ClaimRequested |
Action<int> |
Raised with the zero-based slot when Claim on a row is tapped. |
NoticeFeature
Responsible for: Always composed: the network popup is required even when every optional system is off.
Qualified name: Ostryzhnyi.CasualGameCore.UI.NoticeFeature. Declaration: public sealed class NoticeFeature : ICasualFeature. Source.
| Method | Description |
|---|---|
public void Register(DIContainer container) |
Registers this feature’s services and signal bindings in the supplied container. |
| Member | Type | Description |
|---|---|---|
Id |
string |
Id. Getter returns "Notices". |
Enabled |
bool |
Enabled. Getter returns true. |
Priority |
int |
After the Time feature, whose signal this subscribes to. Getter returns int.MinValue + 2. |
NoticeKind
Responsible for: The messages the shared notice popup can show. Their text is fixed.
Qualified name: Ostryzhnyi.CasualGameCore.UI.NoticeKind. Declaration: public enum NoticeKind. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
NetworkProblem |
0 |
Network Problem. |
NotEnoughCurrency |
1 |
Needs the currency display name as the detail. |
AdUnavailable |
2 |
Ad Unavailable. |
PurchaseFailed |
3 |
Purchase Failed. |
NoticePopupView
Responsible for: The one shared notice popup. It sits on its own layer above popups and overlays and its backdrop does not block input. Its two buttons only close it, and the optional Shop button, offered with SetShopOffer, closes it and opens the Shop.
Qualified name: Ostryzhnyi.CasualGameCore.UI.NoticePopupView. Declaration: public sealed class NoticePopupView : CasualView. Source.
| Method | Description |
|---|---|
public void SetShopOffer(bool offered) |
Whether the Shop button is on the notice. A popup with no such button ignores the call. |
public void SetMessage(string message) |
Updates message using the supplied value. |
| Member | Type | Description |
|---|---|---|
Layer |
Layers |
Layer. Getter returns Layers.Notice. |
Message |
string |
The text currently shown. Getter returns _messageText != null ? _messageText.text : string.Empty. |
ShopButton |
Button |
The button that takes the player to the Shop; hidden unless SetShopOffer offered it. Null when the prefab has none. Getter returns _shopButton. |
NoticeService
Responsible for: Presents fixed user notices for service failures and unavailable time.
Qualified name: Ostryzhnyi.CasualGameCore.UI.NoticeService. Declaration: public sealed class NoticeService : INoticeService, IDisposable. Source.
| Method | Description |
|---|---|
public NoticeService(Func<IViewService> viewService, OstryzhnyiSignal<TimeUnavailable> timeUnavailable = null, Func<bool> shopAvailable = null) |
Creates NoticeService with the supplied dependencies and configuration. viewService: Resolved on each use, because the View service lives in a scene and may not exist yet when this is composed. timeUnavailable: When given, an unavailable trusted time shows NoticeKind.NetworkProblem. shopAvailable: Whether the Shop can be opened; asked each time a missing-currency notice shows. Null means it can. Throws ArgumentNullException when viewService == null. |
public static string MessageFor(NoticeKind kind, string detail = null) |
The exact text shown for a kind. A missing currency name falls back to "currency". Throws ArgumentOutOfRangeException on the corresponding guard path. |
public void Show(NoticeKind kind, string detail = null) |
Shows the notice over the current layer. A notice raised while one is already open replaces its text instead of stacking a second popup. A missing popup prefab logs once and does not throw. |
public void Dispose() |
Releases this instance’s owned subscriptions or pending work. Call it when the owning flow ends. |
OutOfBoosterView
Responsible for: The Out of Booster popup. Data in, intent out: Show says which booster ran out and what its pack costs, and a tap on Buy raises BuyRequested. The ad option is the shared RewardedAdButton, which the controller configures and which hides itself when ads are off.
Qualified name: Ostryzhnyi.CasualGameCore.UI.OutOfBoosterView. Declaration: public class OutOfBoosterView : CasualView. Source.
| Method | Description |
|---|---|
public bool IsShowingIcon(Sprite icon) |
Returns _icons.Any(image => image != null && image.sprite == icon). |
public void Show(OutOfBoosterViewData data) |
Fills in the booster that ran out and its pack, and shows or hides the Buy option. |
protected virtual void RaiseBuyRequested() |
Raises BuyRequested intent for subscribed controllers; no subscriber is required. |
protected virtual void RaiseAdsRequested() |
Raises AdsRequested intent for subscribed controllers; no subscriber is required. |
| Member | Type | Description |
|---|---|---|
Layer |
ViewLayers |
Layer. Getter returns ViewLayers.Popup. |
CloseButton |
UnityEngine.UI.Button |
Close Button. Getter returns _closeButton. |
BuyButton |
UnityEngine.UI.Button |
Buy Button. Getter returns _buyButton. |
AdsButton |
UnityEngine.UI.Button |
Ads Button. Getter returns _adsButton. |
AdButton |
RewardedAdButton |
The shared rewarded-ad component on the ad option. Getter returns _adButton. |
TitleText |
string |
Title Text. Getter returns _title != null ? _title.text : "". |
BuyLabelText |
string |
Buy Label Text. Getter returns _buyLabel != null ? _buyLabel.text : "". |
BuyVisible |
bool |
True while the Buy option is visible. Getter returns _buyButton != null && _buyButton.gameObject.activeSelf. |
AdsVisible |
bool |
True while the ad option is visible. Getter returns _adsButton != null && _adsButton.gameObject.activeSelf. |
BuyRequested |
Action |
Raised for buy requested notifications. |
AdsRequested |
Action |
Raised for ads requested notifications. |
PauseView
Responsible for: Displays pause actions and player preference controls.
Qualified name: Ostryzhnyi.CasualGameCore.UI.PauseView. Declaration: public class PauseView : CasualView. Source.
| Method | Description |
|---|---|
protected virtual void RaiseCloseRequested() |
Raises CloseRequested intent for subscribed controllers; no subscriber is required. |
protected virtual void RaiseContinueRequested() |
Raises ContinueRequested intent for subscribed controllers; no subscriber is required. |
protected virtual void RaiseRestartRequested() |
Raises RestartRequested intent for subscribed controllers; no subscriber is required. |
protected virtual void OpenSettings() |
Opens settings through this type’s configured UI or link handler. |
protected virtual void RaiseExitRequested() |
Raises ExitRequested intent for subscribed controllers; no subscriber is required. |
| Member | Type | Description |
|---|---|---|
Layer |
ViewLayers |
Layer. Getter returns ViewLayers.Popup. |
ContinueButton |
UnityEngine.UI.Button |
Continue Button. Getter returns _continueButton. |
SettingsButton |
UnityEngine.UI.Button |
Settings Button. Getter returns _settingsButton. |
CloseRequested |
Action |
Raised for close requested notifications. |
ContinueRequested |
Action |
Raised for continue requested notifications. |
RestartRequested |
Action |
Raised for restart requested notifications. |
ExitRequested |
Action |
Raised for exit requested notifications. |
PortraitOrientationLock
Responsible for: Put on the shared canvas: locks portrait on mobile platforms and configures the canvas scaler for the shell. The shell UI supports portrait only.
Qualified name: Ostryzhnyi.CasualGameCore.UI.PortraitOrientationLock. Declaration: public sealed class PortraitOrientationLock : MonoBehaviour. Source.
| Method | Description |
|---|---|
public static void Lock(IOrientationControl control) |
Locks portrait: no landscape autorotation, current orientation portrait. |
RewardCollectionView
Responsible for: Presents resolved rewards and coordinates collection animation and dismissal.
Qualified name: Ostryzhnyi.CasualGameCore.UI.RewardCollectionView. Declaration: public class RewardCollectionView : CasualView. Source.
| Method | Description |
|---|---|
public virtual void Present(RewardViewData data, Action dismissed) |
Shows one card per reward and calls dismissed once when the presentation is over. The rewards are already granted: the screen's fixed sample cards are not used, the counters wait at the balance from before the reward, and Collect flies each currency card to its own counter by currency id and ends on the real balance. Throws ArgumentNullException when data == null. |
public virtual void CollectReward() |
Plays the same reward collection as the Play button. |
protected virtual void RaisePlayRequested() |
Raises PlayRequested intent for subscribed controllers; no subscriber is required. |
protected virtual void Collect() |
Ignores a request while collection is already running, disables the play button, then starts either dismissal of a presentation or the collection sequence. |
protected virtual IEnumerator CollectSequence() |
Plays reward bursts, reveals panels, starts currency flights, waits for active flights, then plays the final burst, fades out and raises PlayRequested. |
protected virtual IEnumerator FadeGroups(CanvasGroup[] groups, float target, float duration) |
Fades the supplied CanvasGroups to the target using unscaled time, ignoring null groups, then sets their final visibility/interactivity. |
protected virtual Vector2 ResolveSourcePoint(RectTransform source, CasualFlyToTarget flight) |
Returns zero when the source, flight or flight layer is absent; otherwise converts the source world position into the flight layer’s local point. |
| Member | Type | Description |
|---|---|---|
Layer |
ViewLayers |
Layer. Getter returns ViewLayers.Popup. |
PlayButton |
Button |
Play Button. Getter returns _playButton. |
PlayRequested |
Action |
Raised for play requested notifications. |
IsCollecting |
bool |
Is Collecting. Getter returns _collectRoutine != null. |
RewardFlightDestination
Responsible for: Where one currency's reward flies on Collect: the counter that shows it and the flight that carries the icons there.
Qualified name: Ostryzhnyi.CasualGameCore.UI.RewardFlightDestination. Declaration: public sealed class RewardFlightDestination. Source.
| Member | Type | Description |
|---|---|---|
CurrencyId |
string |
Currency Id. Getter returns _currencyId. |
Counter |
CasualCounter |
Counter. Getter returns _counter. |
Flight |
CasualFlyToTarget |
Flight. Getter returns _flight. |
Panel |
CanvasGroup |
Panel. Getter returns _panel. |
IsUsable |
bool |
False when the counter was hidden or removed: the reward is then shown as a card and nothing flies. Getter returns _counter != null && _flight != null && _counter.gameObject.activeInHierarchy. |
RewardRowView
Responsible for: One line of the reward collection screen: an optional icon, the reward's label and its amount.
Qualified name: Ostryzhnyi.CasualGameCore.UI.RewardRowView. Declaration: public sealed class RewardRowView : MonoBehaviour. Source.
| Method | Description |
|---|---|
public void Bind(RewardRow row) |
Stores the row and updates assigned label/amount/icon fields. Amounts use invariant N0 formatting prefixed by x; absent icons hide their image objects. |
| Member | Type | Description |
|---|---|---|
Row |
RewardRow |
Row. Setter: private set. |
TypeId |
string |
Type Id. Getter returns Row.TypeId. |
ItemId |
string |
Item Id. Getter returns Row.ItemId. |
FlightSource |
RectTransform |
Where this reward's icons start flying from: its icon, or the card itself for a reward without one. Getter returns _icon != null && _icon.gameObject.activeInHierarchy ? _icon.rectTransform : (RectTransform)transform. |
Label |
string |
Label. Getter returns _labelText != null ? _labelText.text : string.Empty. |
Amount |
string |
Amount. Getter returns _amountText != null ? _amountText.text : string.Empty. |
HasIcon |
bool |
True when an icon is showing; a reward without one is a label-only row. Getter returns _icon != null && _icon.gameObject.activeSelf && _icon.sprite != null. |
SafeAreaEdges
Responsible for: Selects which screen-safe-area edges constrain a UI rectangle.
Qualified name: Ostryzhnyi.CasualGameCore.UI.SafeAreaEdges. Declaration: public enum SafeAreaEdges. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
None |
0 |
None. |
Left |
1 |
Left. |
Bottom |
2 |
Bottom. |
Right |
4 |
Right. |
Top |
8 |
Top. |
All |
Left | Bottom | Right | Top |
All. |
SafeAreaFitter
Responsible for: Pads a stretched rect by the device safe-area insets. Put it on the content layer of a screen, never on a full-bleed layer such as a backdrop or background, which must keep reaching the screen edges. Edges limits the padding to the edges the rect actually touches, so a bar at the bottom of the screen pads only its bottom and sides. Insets are converted to canvas units with ShellCanvasScaler.
Qualified name: Ostryzhnyi.CasualGameCore.UI.SafeAreaFitter. Declaration: public sealed class SafeAreaFitter : MonoBehaviour. Source.
| Method | Description |
|---|---|
public static void ComputeOffsets(Rect safeArea, Vector2 screenSize, SafeAreaEdges edges, out Vector2 offsetMinDelta, out Vector2 offsetMaxDelta) |
Offsets to add to a stretched rect's offsetMin and offsetMax, in canvas units. Insets on edges not in edges, and unusable screen sizes or safe areas, give zero. |
public void SetOverride(Rect safeArea, Vector2 screenSize) |
Test seam: uses this safe area and screen size, in pixels, instead of the device's. |
public void ClearOverride() |
Clears the explicit safe-area override and reapplies the actual screen safe area when the component is active. |
public void Apply() |
Applies the current safe area on top of the rect's authored offsets. |
| Member | Type | Description |
|---|---|---|
Edges |
SafeAreaEdges |
Edges. Setter: set. |
SettingsBinder
Responsible for: Connects SettingsView to IPlayerSettingsService: shows the saved switches each time the screen opens, applies a switch the moment the player flips it, and opens the policy links. The View stays data in, intent out. Without a composed service the screen stays inert and logs one warning.
Qualified name: Ostryzhnyi.CasualGameCore.UI.SettingsBinder. Declaration: public sealed class SettingsBinder : MonoBehaviour. Source.
| Method | Description |
|---|---|
public void SetService(IPlayerSettingsService settings) |
Test seam: uses settings instead of the injected or project service, and rebinds if the screen is open. |
SettingsView
Responsible for: Displays player preference, legal-link, restore and privacy-option actions.
Qualified name: Ostryzhnyi.CasualGameCore.UI.SettingsView. Declaration: public class SettingsView : CasualView. Source.
| Method | Description |
|---|---|
public void OpenPrivacyOptions() |
Opens the consent dialog so the player can change their choice. Like the bottom bar, a View opens the other Views; the button is hidden by a gate when there is no consent choice to reopen. |
public void SetMusic(bool enabled) |
Shows the current state without raising MusicChangeRequested. |
public void SetSound(bool enabled) |
Updates sound using the supplied value. |
public void SetHaptics(bool enabled) |
Updates haptics using the supplied value. |
protected virtual void RaisePrivacyPolicyRequested() |
Raises PrivacyPolicyRequested intent for subscribed controllers; no subscriber is required. |
protected virtual void RaiseTermsOfUseRequested() |
Raises TermsOfUseRequested intent for subscribed controllers; no subscriber is required. |
protected virtual void RaiseMusicChangeRequested(bool enabled) |
Raises MusicChangeRequested intent for subscribed controllers; no subscriber is required. |
protected virtual void RaiseSoundChangeRequested(bool enabled) |
Raises SoundChangeRequested intent for subscribed controllers; no subscriber is required. |
protected virtual void RaiseHapticsChangeRequested(bool enabled) |
Raises HapticsChangeRequested intent for subscribed controllers; no subscriber is required. |
| Member | Type | Description |
|---|---|---|
Layer |
ViewLayers |
Layer. Getter returns ViewLayers.Overlay. |
CloseButton |
UnityEngine.UI.Button |
Close Button. Getter returns _closeButton. |
PrivacyOptionsButton |
UnityEngine.UI.Button |
Privacy Options Button. Getter returns _privacyOptionsButton. |
PrivacyPolicyRequested |
Action |
Raised for privacy policy requested notifications. |
TermsOfUseRequested |
Action |
Raised for terms of use requested notifications. |
MusicChangeRequested |
Action<bool> |
The player switched music on or off; carries the state they asked for. The View does not change any setting itself. |
SoundChangeRequested |
Action<bool> |
Raised for sound change requested notifications. |
HapticsChangeRequested |
Action<bool> |
Raised for haptics change requested notifications. |
ShellCanvasScaler
Responsible for: Canvas scaling for the portrait shell. Expand mode keeps the whole reference rect visible on every aspect ratio, so screens authored for the reference resolution are never clipped, only padded.
Qualified name: Ostryzhnyi.CasualGameCore.UI.ShellCanvasScaler. Declaration: public static class ShellCanvasScaler. Source.
| Method | Description |
|---|---|
public static float ScaleFactor(Vector2 screenSize) |
Scale factor the CanvasScaler applies to a screen of screenSize pixels. An unusable size scales by one. |
public static Vector2 CanvasSize(Vector2 screenSize) |
Canvas size in canvas units for a screen of screenSize pixels. |
public static void Apply(CanvasScaler scaler) |
Sets ScaleWithScreenSize with the shell reference resolution and screen match mode. |
public static bool IsConfigured(CanvasScaler scaler) |
Returns scaler != null && scaler.uiScaleMode == CanvasScaler.ScaleMode.ScaleWithScreenSize && scaler.referenceResolution == ReferenceResolution && scaler.screenMatchMode == MatchMode. |
| Member | Type | Description |
|---|---|---|
ReferenceResolution |
Vector2 |
Reference Resolution. Declared initializer: new Vector2(1440f, 2970f). |
MatchMode |
CanvasScaler.ScreenMatchMode |
Match Mode. Declared initializer: CanvasScaler.ScreenMatchMode.Expand. |
ShopCardView
Responsible for: One offer card of the Shop: shows an offer's reward, price and icons and reports a tap with the offer's id. It sits on the card's slot, so hiding the card also frees the slot in the layout. Every text and image is optional, so a card design that leaves one out (the shipped cards have no title) still works.
Qualified name: Ostryzhnyi.CasualGameCore.UI.ShopCardView. Declaration: public sealed class ShopCardView : MonoBehaviour. Source.
| Method | Description |
|---|---|
public void Show(ShopOfferViewData data) |
Displays this view or UI element using the supplied state. |
public void Hide() |
Hides this view or UI element. |
| Member | Type | Description |
|---|---|---|
OfferId |
string |
The offer this card shows; null while it is hidden. Getter returns _offerId. |
Title |
string |
Title. Getter returns _title != null ? _title.text : _titleValue. |
RewardText |
string |
Reward Text. Getter returns _reward != null ? _reward.text : "". |
PriceText |
string |
Price Text. Getter returns _price != null ? _price.text : "". |
ShowsPriceIcon |
bool |
True when the price is shown with a currency icon. Getter returns PriceIconObject != null && PriceIconObject.activeSelf. |
IsShown |
bool |
Is Shown. Getter returns gameObject.activeSelf. |
Button |
Button |
Button. Getter returns _button. |
Tapped |
Action<string> |
Raised with the offer id when the card is tapped. |
ShopView
Responsible for: The Shop popup. Data in, intent out: SetOffers fills each section's card slots in order and hides the slots and sections that have nothing to show; a tap on a card raises OfferRequested and a tap on Restore Purchases raises RestoreRequested. Which offers exist, what they cost and who may buy them is not decided here.
Qualified name: Ostryzhnyi.CasualGameCore.UI.ShopView. Declaration: public class ShopView : CasualView. Source.
The popup starts empty: until something calls SetOffers no card or section shows, so a Shop opened without its controller is blank rather than showing the prefab's placeholders.
| Method | Description |
|---|---|
public IReadOnlyList<ShopCardView> CardsIn(ShopSection section) |
The card slots of one section, shown or not; empty for a section the popup does not have. |
public void SetOffers(IReadOnlyList<ShopOfferViewData> offers) |
Shows offers in their sections, in order. A slot with no offer, and a section with no offers, is hidden. An offer with no slot left in its section is skipped. |
public void SetRestoreVisible(bool visible) |
Updates restore visible using the supplied value. |
public void Return() |
Opens this popup again after the reward screen of a purchase, which shares its layer, replaced it. Does nothing while it is open. Only Views open the Shop, so the controller asks the View to come back. |
| Member | Type | Description |
|---|---|---|
Layer |
ViewLayers |
Layer. Getter returns ViewLayers.Popup. |
CloseButton |
UnityEngine.UI.Button |
Close Button. Getter returns _closeButton. |
RestoreButton |
UnityEngine.UI.Button |
Restore Button. Getter returns _restoreButton. |
OfferRequested |
Action<string> |
Raised with the offer id when a card is tapped. |
RestoreRequested |
Action |
Raised when Restore Purchases is tapped. |
RestoreVisible |
bool |
True while the Restore Purchases button is shown. Getter returns _restoreButton != null && _restoreButton.gameObject.activeSelf. |
ShopViewSection
Responsible for: One section of the Shop: its container (header and cards) and the card slots it has room for.
Qualified name: Ostryzhnyi.CasualGameCore.UI.ShopViewSection. Declaration: public sealed class ShopViewSection. Source.
| Member | Type | Description |
|---|---|---|
Id |
ShopSection |
Id. Without an initializer, a new instance uses default(ShopSection). |
Root |
GameObject |
Root. Without an initializer, a new instance uses default(GameObject). |
Cards |
ShopCardView[] |
Cards. Declared initializer: Array.Empty<ShopCardView>(). |
ViewNavigation
Responsible for: Local navigation for one View. It only talks to IViewService, so a View never reaches into another View's internals.
Qualified name: Ostryzhnyi.CasualGameCore.UI.ViewNavigation. Declaration: public sealed class ViewNavigation. Source.
| Method | Description |
|---|---|
public ViewNavigation(IViewService service, IView owner = null) |
Creates ViewNavigation with the supplied dependencies and configuration. service: The service that owns every View. owner: The View that Close() closes. Optional for a service-level helper. Throws ArgumentNullException when service == null. |
public bool Open<T>(ViewOption option = null) where T : IView |
Shows another View. Returns false, after logging once, when the View cannot be spawned. |
public bool Open(Type type, ViewOption option = null) |
Shows another View by type. Returns false, after logging once, when the View cannot be spawned. Throws ArgumentNullException when type == null. Returns false after the preceding guards/branches after a caught exception. |
public void Close() |
Hides the owning View. A View that is already hidden is left alone and raises no event. |
WinPrimaryAction
Responsible for: What the win popup's main button does, which decides its label and whether the close button stays.
Qualified name: Ostryzhnyi.CasualGameCore.UI.WinPrimaryAction. Declaration: public enum WinPrimaryAction. Source.
| Value | Numeric value / expression | Description |
|---|---|---|
Next |
0 |
Move on to the next unit. The close button stays and goes back to the menu instead, keeping the win. |
Chest |
1 |
Open the chest. The close button is hidden, so a win always runs the chest step. |
WinView
Responsible for: Displays win rewards, optional stars, multiplier offer and the next result action.
Qualified name: Ostryzhnyi.CasualGameCore.UI.WinView. Declaration: public class WinView : CasualView. Source.
| Method | Description |
|---|---|
public virtual void SetUnitLabel(string text) |
The heading naming the unit this screen is about, such as LEVEL 3. A popup with no such label ignores the call. |
public virtual void SetScore(long? score) |
This attempt's score, or null to hide the row (a mechanic that keeps no score). A popup with no score row ignores the call. |
public virtual void SetReward(long? amount, Sprite icon = null) |
What the win granted: the amount and its icon on both layers, or null to hide the row. A null icon keeps the prefab's art. A popup with no reward row ignores the call. |
public virtual void SetStars(int? stars) |
The earned stars, or null for a mechanic that does not rate (AE15). Set it before showing. A slot is the filled star, and the sequence lights it as it stamps, so every slot is left dark here: lighting them first would show all of them while the popup opens, and only then clear them for the stamp. |
public virtual void SetPrimaryAction(WinPrimaryAction action) |
Labels the main button and shows or hides the close button for action. |
public virtual void SetMultiplierOffer(int? multiplier) |
Offers the rewarded multiplier: shows the button labelled for multiplier, or hides it when null. A popup with no multiplier button ignores the call. |
public virtual void SetMultiplierClaimed() |
The offered multiplier was taken: the button stays on screen but is blocked, so the player sees it is spent and cannot take it again. The next SetMultiplierOffer makes it live again. |
protected override void Showed(ViewOption option = null) |
Plays the star sequence after the view is shown when a star value is present. |
protected virtual void RaisePrimaryRequested() |
Raises PrimaryRequested intent for subscribed controllers; no subscriber is required. |
protected virtual void RaiseCloseRequested() |
Raises CloseRequested intent for subscribed controllers; no subscriber is required. |
protected virtual void RaiseMultiplierRequested() |
Raises MultiplierRequested intent for subscribed controllers; no subscriber is required. |
| Member | Type | Description |
|---|---|---|
MinimumMultiplier |
int |
The smallest factor worth offering: below it the extra reward, base times the factor minus base, is nothing. Declared initializer: 2. |
Layer |
ViewLayers |
Layer. Getter returns ViewLayers.Popup. |
MainButton |
UnityEngine.UI.Button |
Main Button. Getter returns _mainButton. |
MultiplierButton |
UnityEngine.UI.Button |
The rewarded multiplier button; hidden until SetMultiplierOffer offers one. Getter returns _multiplierButton. |
ScoreVisible |
bool |
The main button was pressed: open the chest or move on, as SetPrimaryAction said. Getter returns _scoreRoot != null && _scoreRoot.activeSelf. |
ScoreText |
string |
Score Text. Getter returns _scoreLabel != null ? _scoreLabel.text : "". |
RewardVisible |
bool |
Reward Visible. Getter returns _rewardRoot != null && _rewardRoot.activeSelf. |
RewardText |
string |
Reward Text. Getter returns _rewardLabel != null ? _rewardLabel.text : "". |
RewardIconLayers |
IReadOnlyList<UnityEngine.UI.Image> |
The images the reward's icon is put on, Main and Shadow. Getter returns _rewardIconLayers ?? Array.Empty<UnityEngine.UI.Image>(). |
PrimaryRequested |
Action |
Raised for primary requested notifications. |
CloseRequested |
Action |
Raised for close requested notifications. |
MultiplierRequested |
Action |
The player took the rewarded multiplier offered by SetMultiplierOffer. |
Architecture
Composition and lifetimes
OstryzhnyiProjectContext owns the shared project DI container. Before the first scene, CasualGameInstaller bootstraps core settings/saves and composes registered features in stable priority order. Composition is idempotent per container. A disabled feature registers nothing; the feature gate records successful registrations, and a failed feature emits FeatureRegistrationFailed. Registration is not transactional: custom features must clean up partial side effects if they throw.
Scene installers reuse shared services, connect the scene mechanic before injecting it, connect progression/result controllers, and inject listed scene objects. The scene's ProgressionFlow is disposed when its installer is destroyed. Dispose your own subscriptions and asynchronous operations at the corresponding lifetime boundary. Product caches reset at subsystem registration so they do not assume Domain Reload is enabled.
Attempt, reward and presentation flow
The mechanic owns gameplay and reports Win/Lose through the injected attempt reporter. Progression owns attempt identity and state; the result pipeline coordinates rewards, optional multiplier, scheduled Chest and navigation. Currency/reward services save grants before presentation. Views render supplied state and raise intent; controllers decide whether an action can run. They do not grant rewards merely because a popup is shown.
Reward entries resolve a stable type/item ID and amount range through registered handlers. Grant tokens identify repeats. Recent tokens use a bounded ring; durable tokens are retained until explicitly released. A failed handler restores the token snapshot, but previously granted effects from other handlers are not automatically rolled back: custom multi-handler grants must account for partial side effects. Unknown reward handlers are skipped. Purchases and restore/redelivery use transaction identities to avoid repeating a grant.
Booster use waits for the mechanic's acknowledgement. A decline or timeout leaves inventory unspent. Chest boards are resolved before the first cell opens, contain one jackpot, and keep key packs within one Chest session. Daily/Missions/Level of Day use the time abstraction rather than each inventing a clock.
Time, consent and providers
Offline time uses device UTC and an allowed debug offset. Online time caches a trusted UTC value and advances it with elapsed real time; concurrent callers share a fetch. It rejects invalid/rollback time, reports unavailable time, and does not fall back to the device clock.
Each platform/service selects Real SDK, Simulation or Disabled through a provider resolver. Availability checks must be cheap and must not initialize SDKs during discovery. Consent gates ads/analytics startup; declining blocks analytics and child-directed mode disables it. External consent requires a registered consent source. A built-in dialog has Accept/Decline; Privacy Options reopens the choice. Legal URLs open the publisher's own pages.
Assemblies and package ownership
| Assembly | Boundary |
|---|---|
Ostryzhnyi.CasualGameCore |
Runtime services, contracts, settings, composition and views; references shared DI/Saves/Tools/EasyView/CasualUIToolkit and Unity UI/TMP/Input System |
Ostryzhnyi.CasualGameCore.Editor |
Editor-only settings, validation and packaging |
Ostryzhnyi.CasualGameCore.Dependencies.Editor |
Editor-only required-package reporting, without product dependencies |
Ostryzhnyi.CasualGameCore.Demo |
Example mechanic/controls; not auto-referenced |
Ostryzhnyi.CasualGameCore.Providers.LevelPlay |
Conditional LevelPlay adapter; com.unity.services.levelplay from 9.0.0 enables OSTRYZHNYI_LEVELPLAY |
Ostryzhnyi.CasualGameCore.Providers.UnityIap |
Conditional IAP adapter; com.unity.purchasing from 5.0.0 enables OSTRYZHNYI_UNITY_IAP |
Ostryzhnyi.CasualGameCore.Providers.GameAnalytics |
Conditional analytics adapter; com.gameanalytics.sdk from 8.3.1 enables OSTRYZHNYI_GAMEANALYTICS |
Ostryzhnyi.CasualGameCore.Providers.GameAnalytics.Editor |
Conditional Editor synchronization and scene validation |
Zenject/VContainer bridges belong to shared Core and are optional. They do not make their SDK implementations part of the checked export. No product assembly requires DOTween. Preserve link.xml and add preservation for reflection-discovered customer types in your own assemblies when stripping/IL2CPP is used.
Project-owned settings are outside the publisher folder. Keep reusable product assets under the checked product/Core roots, and keep configured keys out of a redistribution archive. Runtime Resources settings are client-visible; account passwords and administrative credentials belong on a backend. Save model identities and stable IDs are compatibility contracts; use migrations when changing their data.
Extending
Replace the mechanic
Derive from GameplayMechanic and implement Start/Restart/Continue for the supplied ProgressionContext. Call protected Win/Lose once per outcome. Declare rating capability before composition; implement pause and booster acknowledgement for your gameplay. Use Demo/MinimalMechanicTemplate.cs as a small starting point and Demo/DemoMechanic.cs for the wired example. Verify retry, continue, pause/exit, a scene change during a result and a rejected asynchronous booster.
Add a feature or settings section
Implement ICasualFeature with a stable ID, enablement flag, priority and registration operation. Register through CasualFeatureRegistry before composition. Clean up if registration fails and avoid duplicate IDs. Extend configuration through settings sections; provide an ICasualSettingsTab and register it in CasualSettingsTabRegistry, and add a validator to ConfigValidatorPipeline. Keep discovery constructors cheap and avoid SDK initialization in Editor discovery.
Add rewards or mission types
Implement IRewardHandler with a stable TypeId, authoring choices and Grant. Return false when an item cannot be granted. Supply a cheap public parameterless constructor for Editor discovery and register a runtime instance in RewardHandlerRegistry. Maintain transaction/token semantics; presentation retries must not mint another reward.
Implement IMissionType with a stable ID, display template, environment availability and a disposable tracking subscription. Dispose tracking when the mission changes. Use feature/capability checks to exclude unavailable types. The demo contains CustomRewardHandlerSample and CustomMissionTypeSample; inspect their exact IDs and assumptions before adapting them.
Add providers, views and save migrations
Implement IServiceProviderFactory<TProvider> in a separate conditional assembly. Supply its service/provider IDs, display name, platform availability and Create operation. Preserve custom factories for stripped builds. Use the existing provider assemblies as examples; install the external SDK separately.
Use view events for intent and controller/service APIs for effects. When extending protected view hooks, preserve the base view lifecycle. Route audio through the configured mixer and apply saved preferences before playback. Derive compatible save models from shared Core's versioned-save abstraction and supply ordered migrations; test old payloads, malformed data and second-process persistence. Changing a save namespace/type/key can create a different save instead of upgrading the original.