private IEnumerator SaveBuildingRoutine(IBuildingSaveData buildingSaveData)
        {
            if (buildingSaveData != null && !savingBuildings.Contains(buildingSaveData.Id))
            {
                savingBuildings.Add(buildingSaveData.Id);
                var job = new UpdateBuildingJob(Database, Assets.onlineScene.SceneName, buildingSaveData);
                job.Start();
                yield return(StartCoroutine(job.WaitFor()));

                savingBuildings.Remove(buildingSaveData.Id);
                Debug.Log("Building [" + buildingSaveData.Id + "] Saved");
            }
        }
Exemple #2
0
        private IEnumerator SaveBuildingRoutine(IBuildingSaveData buildingSaveData)
        {
            if (buildingSaveData != null && !savingBuildings.Contains(buildingSaveData.Id))
            {
                savingBuildings.Add(buildingSaveData.Id);
                UpdateBuildingJob job = new UpdateBuildingJob(Database, Assets.onlineScene.SceneName, buildingSaveData);
                job.Start();
                yield return(StartCoroutine(job.WaitFor()));

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