Training
Percorso di apprendimento
Use advance techniques in canvas apps to perform custom updates and optimization - Training
Use advance techniques in canvas apps to perform custom updates and optimization
Questo browser non è più supportato.
Esegui l'aggiornamento a Microsoft Edge per sfruttare le funzionalità più recenti, gli aggiornamenti della sicurezza e il supporto tecnico.
Title News is a mechanism for communicating with your players for patch notes or big events your game may be hosting. It contains a few basic elements:
Nota
The Body element is a string which can contain raw text or JSON.
This quickstart builds on information presented in other topics. Please refer to the topic links that follow if you have questions.
Nota
You must already have a title default language set to continue with localized title news.
PlayFab supports storing localized strings on behalf of game developers, by associating a title and body with a language for a title news entry.
We have added the necessary logic to provide your players with the correct strings for the language they prefer. When the client queries for title news, they will receive different versions of title news, based on the players preferred language. You can add multiple translated versions to a single title news entry.
There are two ways to create Title News entries:
To create title news entries with Game Manager:
Navigate to your title -> Content -> Title News -> New Title News as shown in the following image.
For the purposes of this tutorial, we will assume your title's default language is English. This means that you must add strings for your default language before you can save the title news.
Adding more languages is as simple as clicking on ADD LANGUAGE, choosing the language you want to add, and then typing in the localized strings. Select the Save Title News button, and your entry is created.
The timestamp is the time that players will see next to the title news. The timestamp is automatically set to the system date at the moment you select the Save Title News button, but you can also set it manually. After saving the title news page, you'll be redirected back to the page that contains the list of your title news entries.
You can create title news by calling AddNews method. Using this Admin API allows you to specify a custom timestamp. News added this way is immediately published. You can then add localized content to the item you just created by calling AddLocalizedNews, with the news ID returned from the AddNews
method.
The code example that follows demonstrates this.
void CreateNews() {
PlayFabAdminAPI.AddNews(new AddNewsRequest {
Timestamp = new DateTime(2014, 1, 8, 12, 0, 0), // Any date - This one is the founding of PlayFab
Title = "My Second News",
Body = "This is my second news post."
},
result => Debug.Log("News post added!"),
error => Debug.LogError(error.GenerateErrorReport()));
}
void CreateNews() {
PlayFabAdminAPI.AddLocalizedNewsRequest(new AddLocalizedNewsRequest{
NewsId = "74623b12-6c80-ee4b-7c3b-58e638aa62bd",
Language = "de"
Title = " Meine zweite Nachricht",
Body = " Dies ist meine zweite Nachricht."
},
result => Debug.Log("Localized news post added!"),
error => Debug.LogError(error.GenerateErrorReport()));
}
The GetTitleNews
method makes reading the title news very easy. The method returns all published title news entries and does not return archived and unpublished entries.
// Using the Client API method
void ReadTitleNews() {
PlayFabClientAPI.GetTitleNews(new GetTitleNewsRequest(), result => {
Debug.Log("Got latest news!");
// Process news using result.News
}, error => Debug.LogError(error.GenerateErrorReport()));
}
// Using the Server API method
void ReadTitleNews() {
PlayFabServerAPI.GetTitleNews(new GetTitleNewsRequest(), result => {
Debug.Log("Got latest news!");
// Process news using result.News
}, error => Debug.LogError(error.GenerateErrorReport()));
}
The content of a title news entry can only be modified in Game Manager.
To locate and select the entry you wish to modify in Game Manager:
To make your updates, save them, and optionally add localized versions:
If you plan to post unpublished entries for a future release, this will be the way you transition them through a published and archived state. Updating title news also lets you fix typos.
Once an entry is no longer needed, you can delete it in the Game Manager.
Find the entry you wish to modify, then:
Training
Percorso di apprendimento
Use advance techniques in canvas apps to perform custom updates and optimization - Training
Use advance techniques in canvas apps to perform custom updates and optimization
Documentazione
Landing page for News.
Setting default languages - PlayFab
Describes how to set the default language for a title and for players.
Player Segment configuration - PlayFab
Describes the basics of Player Segment configuration.