Example #1
0
        public void Save(User user, EncounterMetadata metadata)
        {
            metadata.ResetDateModified();
            var metadataText = MetadataSerializer.Serialize(metadata);

            FileManager.SetFileText(user, FileType.Metadata, metadata, metadataText);
        }
Example #2
0
        public static AdventureRequestResult RedeemCrystal(string playerId, PlayerAdventureRequest adventureRequest, Guid crystalId)
        {
            InventoryUtils.RemoveItemFromInv(playerId, crystalId);

            var selectedAdventureIcon = "genoa:adventure_generic_map_b";
            var selectedAdventureId   = "b7335819-c123-49b9-83fb-8a0ec5032779";

            var adventureLocation = new LocationResponse.ActiveLocation
            {
                coordinate        = adventureRequest.coordinate,
                encounterMetadata = new EncounterMetadata
                {
                    anchorId            = "",
                    anchorState         = "Off",
                    augmentedImageSetId = "",
                    encounterType       = EncounterType.None,
                    locationId          = Guid.Empty,
                    worldId             = Guid.NewGuid()         // TODO: Replace this with actual adventure id
                },
                expirationTime = DateTime.UtcNow.Add(TimeSpan.FromMinutes(10.00)),
                spawnTime      = DateTime.UtcNow,
                icon           = selectedAdventureIcon,
                id             = selectedAdventureId,
                metadata       = new(),
                tileId         = string.Join("-",
                                             Tile.getTileForCords(adventureRequest.coordinate.latitude, adventureRequest.coordinate.longitude)),
                type = "PlayerAdventure"
            };

            return(new AdventureRequestResult {
                result = adventureLocation, updates = new Updates()
            });
        }
    }
        public WaitableTask <EncounterImageContent> GetImageData(User user, EncounterMetadata metadata)
        {
            var imageData = new WaitableTask <EncounterImageContent>();

            var fileText = fileManager.GetFileText(user, FileType.Image, metadata);

            fileText.AddOnCompletedListener((result) => ProcessResults(imageData, result));

            return(imageData);
        }
        public WaitableTask <EncounterNonImageContent> GetNonImageContent(User user, EncounterMetadata metadata)
        {
            var content = new WaitableTask <EncounterNonImageContent>();

            var fileText = fileManager.GetFileText(user, FileType.Data, metadata);

            fileText.AddOnCompletedListener((result) => ProcessResults(content, result));

            return(content);
        }
Example #5
0
        public WaitableTask <EncounterMetadata> GetMetadata(User user, EncounterMetadata metadata)
        {
            var metadataResult = new WaitableTask <EncounterMetadata>();

            var fileText = fileManager.GetFileText(user, FileType.Metadata, metadata);

            fileText.AddOnCompletedListener((result) => ProcessResults(metadataResult, result));

            return(metadataResult);
        }
        public WaitableTask <EncounterStatus> GetDetailedStatus(User user,
                                                                EncounterMetadata metadata, EncounterBasicStatus basicStatus)
        {
            var detailedStatus = new WaitableTask <EncounterStatus>();

            var fileText = fileManager.GetFileText(user, FileType.DetailedStatus, metadata);

            fileText.AddOnCompletedListener((result) => ProcessResults(detailedStatus, result, basicStatus));

            return(detailedStatus);
        }
        public virtual WaitableTask <EncounterContent> GetEncounterData(User user, EncounterMetadata metadata)
        {
            var encounterData = new WaitableTask <EncounterContent>();
            var content       = ContentReader.GetNonImageContent(user, metadata);
            var imageData     = ImageDataReader.GetImageData(user, metadata);

            content.AddOnCompletedListener((result) => ProcessResults(encounterData, content, imageData));
            imageData.AddOnCompletedListener((result) => ProcessResults(encounterData, content, imageData));

            return(encounterData);
        }
Example #8
0
        public virtual WaitableTask <Encounter> GetEncounter(User user, EncounterMetadata metadata, SaveType saveType)
        {
            var dataReader = dataReaderSelector.GetEncounterDataReader(saveType);

            var data = dataReader.GetEncounterData(user, metadata);

            var encounterData = new WaitableTask <Encounter>();

            data.AddOnCompletedListener((result) => ProcessResults(encounterData, metadata, result));

            return(encounterData);
        }
Example #9
0
        protected virtual void ProcessResults(WaitableTask <Encounter> result,
                                              EncounterMetadata metadata,
                                              TaskResult <EncounterContent> data)
        {
            if (data.IsError())
            {
                result.SetError(data.Exception);
                return;
            }
            var encounterData = new Encounter(metadata, data.Value);

            result.SetResult(encounterData);
        }
Example #10
0
        protected override void Serialize(EncounterMetadata metadata)
        {
            var categories = InputField.text.Split(';');

            metadata.Categories.Clear();
            foreach (var category in categories)
            {
                if (!string.IsNullOrWhiteSpace(category))
                {
                    metadata.Categories.Add(category.Trim());
                }
            }
        }
Example #11
0
 protected override void Serialize(EncounterMetadata metadata) => metadata.Description = InputField.text;
Example #12
0
 protected override void Serialize(EncounterMetadata metadata)
 => ((INamed)metadata).Name.LastName = InputField.text;
 protected override void Serialize(EncounterMetadata metadata)
 => ((IWebCompletion)metadata).Url = InputField.text;
Example #14
0
 protected override void Serialize(EncounterMetadata metadata) => metadata.GrantInfo = InputField.text;
Example #15
0
 protected override void Serialize(EncounterMetadata metadata) => metadata.Subtitle = InputField.text;
 protected override void Serialize(EncounterMetadata metadata)
 => metadata.Difficulty = (Difficulty)Dropdown.value;
Example #17
0
 public Encounter(EncounterMetadata metadata, EncounterContent content)
 {
     Metadata = metadata;
     Content  = content;
 }
 protected override void Serialize(EncounterMetadata metadata) => metadata.Audience = GetValue();