GS2-Showcase
This function is used to sell products in the game.
The difference from GS2-Exchange is that there is a Showcase. DisplayItem can be displayed on the Showcase, and the price required to purchase DisplayItem and the reward for purchasing the item can be set.
There are two types of display shelves: the “Standard Showcase”, which displays fixed DisplayItems, and the “Random Showcase”, which randomly selects DisplayItems at regular intervals.
Standard Showcase
In the standard Showcase, all the DisplayItems you specify are displayed. There are two types of DisplayItem: “SalesItem” and “SalesItemGroup”.
SalesItem
A SalesItem is a display item that contains the price required to purchase the item as well as the reward for making the purchase.
SalesItemGroup
SalesItemGroup is a system that changes the SalesItem to be sold according to the number of purchases.
A SalesItemGroup can have multiple SalesItems belonging to it, except for the last item on the list, for which a GS2-Limit counter increase must be set as the compensation. When a SalesItemGroup is displayed on a Showcase, the internal SalesItem is determined if it is available for purchase, and the first item determined to be available is displayed.
By using this function, it is possible to sell products at half price for the first purchase only, realize products that increase in price with each purchase, or add an extra item for the 10th purchase.
Random Showcase
The Random Showcase displays a randomly selected number of DisplayItems specified in the master data. Registering master data allows you to configure data and behaviors available to microservices.
The following types of master data exist:
ShowcaseModel: Defines standard display shelvesRandomShowcaseModel: Defines random display shelves
Master data can be registered via the Management Console. Alternatively, you can set up workflows to reflect data from GitHub or register via CI using GS2-Deploy.
Buff-Based Adjustments
Integrating with GS2-Buff enables dynamic adjustment of acquireActions, verifyActions, and consumeActions for DisplayItem and RandomDisplayItemModel. For random display items, stock values can also be overwritten. This allows flexible modification of rewards, required costs, and inventory quantities to align with events or campaigns.
Transaction Actions
GS2-Showcase provides the following transaction actions:
- Consume Action: Increment purchase count
- Acquire Action: Decrement purchase count, Force re-draw of random showcase
By using “Force re-draw of random showcase” as an acquire action, it is possible to safely perform processes within a transaction to forcefully update the shop’s displayed items as a reward for acquiring a specific item or completing a quest. This enables providing a product lineup that is timely and aligned with the player’s progress. Additionally, by using “Decrement purchase count,” it facilitates operations such as individually restoring purchase limits for products, for instance, to allow the re-purchase of limited items.
Example of implementation
Standard Showcase
Get the Showcase
var item = await gs2.Showcase.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Showcase(
showcaseName: "showcase-0001"
).ModelAsync(); const auto Domain = Gs2->Showcase->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Showcase(
"showcase-0001" // showcaseName
);
const auto item = Domain.Model();Buy Item
var result = await gs2.Showcase.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Showcase(
showcaseName: "showcase-0001"
).BuyAsync(
displayItemId: "display-item-0001",
quantity: 1,
); const auto Domain = Gs2->Showcase->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Showcase(
"showcase-0001" // showcaseName
);
const auto Future = Domain->Buy(
"display-item-0001", // displayItemId
nullptr, // quantity
nullptr // config
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError()) return false;Random Showcase
Get Showcase
var items = await gs2.Showcase.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).RandomShowcase(
showcaseName: "showcase-0001"
).RandomDisplayItemsAsync(
).ToListAsync(); const auto It = Gs2->Showcase->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->RandomShowcase(
"showcase-0001" // showcaseName
)->RandomDisplayItems(
);
TArray<Gs2::UE5::Showcase::Model::FEzRandomDisplayItemPtr> Result;
for (auto Item : *It)
{
if (Item.IsError())
{
return false;
}
Result.Add(Item.Current());
}Buy Item
var result = await gs2.Showcase.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).RandomShowcase(
showcaseName: "showcase-0001"
).RandomDisplayItem(
displayItemName: "display-item-0001"
).RandomShowcaseBuyAsync(
quantity: 1,
config: null
); const auto Future = Gs2->Showcase->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->RandomShowcase(
"showcase-0001" // showcaseName
)->RandomDisplayItem(
"display-item-0001" // displayItemName
)->RandomShowcaseBuy(
1, // quantity
nullptr // config
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError())
{
return false;
}