Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using Microsoft.Azure.Cosmos;
- using UnityEngine.Networking; // Ensure you have the Azure Cosmos DB SDK installed
- public class AzureDBManager : Singleton<AzureDBManager>
- {
- string cosmosUrl = "https://elimushop.documents.azure.com:443/"; // Replace with your Cosmos DB URL
- string cosmosKey = "e7VOarh1TWrIoqqIg6GXUdR2pTdYaHZsYZIyxVbHER6gqlaFWcQKMfoCaRxWW7Zhuw55QkpzYUpHACDb8qof7A==";
- string databaseName = "elimushopDB"; // Replace with your database name
- CosmosClient cosmosClient;
- Database database;
- protected override void Awake()
- {
- base.Awake();
- InitializeDB();
- }
- public void InitializeDB()
- {
- cosmosClient = new CosmosClient(cosmosUrl, cosmosKey); // Mono
- database = cosmosClient.GetDatabase(databaseName);
- Debug.Log("Intialized DB!");
- }
- // Access the containers
- // Create Items, Read Items, Update Items, Delete Items, etc.
- public Container GetClassContainer()
- {
- return database.GetContainer("class"); // Replace with your container name
- }
- public Container GetUserProfilesContainer()
- {
- return database.GetContainer("userProfiles"); // Replace with your container name
- }
- public Container GetUserProgressContainer()
- {
- return database.GetContainer("userProgress"); // Replace with your container name
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment