private IEnumerator SaveCharacterRoutine(IPlayerCharacterData playerCharacterData)
        {
            if (playerCharacterData != null && !savingCharacters.Contains(playerCharacterData.Id))
            {
                savingCharacters.Add(playerCharacterData.Id);
                var job = new UpdateCharacterJob(Database, playerCharacterData);
                job.Start();
                yield return(StartCoroutine(job.WaitFor()));

                savingCharacters.Remove(playerCharacterData.Id);
                Debug.Log("Character [" + playerCharacterData.Id + "] Saved");
            }
        }
Ejemplo n.º 2
0
        private IEnumerator SaveCharacterRoutine(IPlayerCharacterData playerCharacterData, string userId)
        {
            if (playerCharacterData != null && !savingCharacters.Contains(playerCharacterData.Id))
            {
                savingCharacters.Add(playerCharacterData.Id);
                UpdateCharacterJob job = new UpdateCharacterJob(Database, playerCharacterData);
                job.Start();
                yield return(StartCoroutine(job.WaitFor()));

                StorageId storageId = new StorageId(StorageType.Player, userId);
                if (storageItems.ContainsKey(storageId))
                {
                    UpdateStorageItemsJob updateStorageItemsJob = new UpdateStorageItemsJob(Database, storageId.storageType, storageId.storageOwnerId, storageItems[storageId]);
                    updateStorageItemsJob.Start();
                    yield return(StartCoroutine(updateStorageItemsJob.WaitFor()));
                }
                savingCharacters.Remove(playerCharacterData.Id);
                if (LogInfo)
                {
                    Debug.Log("Character [" + playerCharacterData.Id + "] Saved");
                }
            }
        }