This project has a set of Azure Functions used for managing the Tic-Tac-Toe sample's logic.
These are the current functions and their responsibilities:
Function | Responsibility | Link |
---|---|---|
CreateMatchLobby | Allows us to create a Match Lobby, where two players will face each other. | Link |
DeleteMatchLobby | Allows us to delete an existing Match Lobby from Cosmos DB. | Link |
JoinMatchLobby | Adds an player to an specific Match Lobby. | Link |
LeaveMatchLobby | Allows a player to leave an specified Match Lobby. | Link |
SearchMatchLobbies | Performs a Match Lobby search, based in their names and Ids. | Link |
SetMatchLobbyLockState | Allows us to lock or unlock a Match Lobby. | Link |
Before configuring this project, first ensure you have completed the next pre-requisites:
- Clone this project in your computer (
git clone https://github.com/southworks/playfab.git
). - Create an Azure account, or sign-in into your current account.
- Create a PlayFab account (tutorial), or sing-in into your current account.
- Create a new PlayFab Title in your PlayFab account.
- Download Visual Studio or Visual Studio Code.
- Read and complete the Azure Cosmos DB configuration.
Follow up the next steps for configuring this project to run in an Azure environment:
-
First, retrieve the next information from your PlayFab Title, as we'll be using them later:
- Retrieve your PlayFab's title ID.
- Retrieve your Title's developer secret key.
-
Create an Azure Function app in your Azure personal account following this guide.
-
Add the next application settings in your function app (you can follow up this guide):
- PLAYFAB_TITLE_ID: configure it with your PlayFab's title ID.
- PLAYFAB_DEV_SECRET_KEY: configure it with your Title's developer secret key.
- PlayFabTicTacToeCosmosDB: retrieve your AZ CosmosDB connection string.
-
Open the TicTacToeFunctions project using Visual Studio or Visual Studio Code.
-
Publish the TicTacToeFunctions project in your Azure Function App:
- If your are using Visual Studio, follow this guide.
- If your are using Visual Studio Code, follow this guide.
-
Enable CORS in your Azure Function APP from the Azure Portal (you can follow this guide).
NOTE: The enable all possible domains, you can use the
*
wildcard.
For getting your Azure Functions URLs, following the first steps of this tutorial.