Overlay provides out-of-the-box functions based on the PGOS SDK.You can edit and send emails in the Engagement > Mail
module in the PGOS Web Portal.
mail Body Style
Overlay supports using simplified HTML format to define the style of the mail body. The body content must be enclosed by the <body>
and </body>
labels.
<body>
<p>Content...</p>
</body>
❗ Note: You can also write the mail body in plain text without using any labels, and the mail content will be displayed in plain text.
Labels supported by the current version are as follows:
Label | Function | Note |
---|---|---|
p | Text paragraph | |
br | Line break | |
img | Embedded image | You can use the alt attribute to make the image clickable. The image will be centered. |
a | Hyperlink | |
ol, ul, li | List item | The way to handle ol and ul is the same, supporting up to 3 levels of list nesting. |
❗ Note: Element nesting is not supported (except list nesting). All labels are arranged as block elements. Subsequent releases will provide improvements in this regard.
Here is a simple configuration sample:
<body>
<h1>Header 1</h1>
<p>Some text here</p>
<br/>
<img src="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_92x30dp.png" width="92" height="30" />
<br/>
<h2>Header 2</h2>
<p>Some text here</p>
<br/>
<img src="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_92x30dp.png" width="92" height="30" alt="https://www.google.com/" />
<br/>
<p>Simple hyperlink:</p>
<a href="https://www.google.com/">Google</a>
<br/>
<h3>Header 3</h3>
<p>Some text here</p>
<p>Lists:</p>
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>
Milk (with a embedded list)
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
<li>Milk is a white liquid food produced by the mammary glands of mammals. It is the primary source of nutrition for young mammals (including breastfed human infants) before they are able to digest solid food. Immune factors and immune-modulating components in milk contribute to milk immunity. Early-lactation milk, which is called colostrum, contains antibodies that strengthen the immune system, and thus reduces the risk of many diseases. Milk contains many nutrients, including protein and lactose.</li>
</ul>
</li>
</ol>
</body>
The display effect in the mail interface is as follows:
Custom Attachment Display
Overlay allows you to use the game's custom widget in the mail interface to display the attachment list. You just need to make your custom interface inherit following methods from UPgosMailAttachmentListWidget
and implement them:
Method | Function |
---|---|
ClearAttachments | Clears attachment list elements. Calling this method will call SetAttachmentInfo. |
SetClaimState | Sets the status of mail attachment claim. |
SetAttachmentInfo | Sets the content of attachments. For information on the data structure of attachments, see the PGOSSDK documentation. |
You need set the height limit of the custom interface. A height limit of 200
is recommended. The width is adaptive (currently, the width of the mail details interface is 720). After the interface to be used is all set, you need to call the API to modify the attachment window class:
#include "Extension/PgosMail.h"
// in your code
TSubClassOf<UPgosMailAttachmentListWidget> MyCustomClass = ...;
PgosWeaver::Mail::SetAttachmentListWidgetClassPath(MyCustomClass);
Processing Attachment Claim Messages
When a player claims a attachment in a mail, the response can be processed through the OnMailClaimResult
delegate:
#include "Extension/PgosMail.h"
// in your code
PgosWeaver::Mail::OnMailClaimResult().AddLambda([](const FClientClaimMailAttachmentResult& Result, const TArray<FString>& MailIds)
{
// Result: the response from PGOS server tells whether items are claimed successfully or not.
// MailIds: a list of mail in this claim request
// process here
});
For the detailed description of FClientClaimMailAttachmentResult
, see the PGOSSDK documentation.
Response Hyperlink
When the OnHyperLinkClicked
delegate is bound, the processing of hyperlink click responses will be taken over. This is very useful when you need to embed a link that redirects to another game interface in your mail.
❗ Note: When this delegate is not bound, UKismetSystemLibrary::LaunchURL will be called to open the link in the default browser.
#include "Extension/PgosMail.h"
// in your code
PgosWeaver::Mail::OnHyperLinkClicked().AddLambda([](const FString& InPath)
{
if (InPath.StartsWith("https://"))
{
UKismetSystemLibrary::LaunchURL(InPath);
}
else
{
//TODO open in-game panel
}
});
Adjusting Page Size
When a player logs in successfully, Overlay will first pull one page of mails from the server; when the player scrolls to the bottom of the mail list, Overlay will request the next page. You can adjust the page size via Project Settings
or the code.The valid size range is between 1 and 100 (inclusive).
Open Project Settings
, find Mail Page Size
in the PgosOverlay
section, and modify the page size to the desired size.
You can also call the SetPageSize
method in the game initialization code to modify the page size:
#include "Extension/PgosMail.h"
// in your code
PgosWeaver::Mail::SetPageSize(20);
❗ Note: The default page size is 20.