Exemple #1
0
 protected virtual void MetadataSelected(
     MenuSceneInfo sceneInfo,
     MenuEncounter menuEncounter,
     TaskResult <KeyValuePair <SaveType, EncounterMetadata> > metadata)
 {
     if (metadata.HasValue())
     {
         EnsureEncounterUnlocked(sceneInfo, menuEncounter, metadata.Value);
     }
 }
Exemple #2
0
        protected virtual void SelectMetadata(MenuSceneInfo sceneInfo, MenuEncounter menuEncounter)
        {
            if (MetadataSelector == null)
            {
                EnsureEncounterUnlocked(sceneInfo, menuEncounter, menuEncounter.GetLatestTypedMetada());
                return;
            }

            var result = MetadataSelector.GetMetadata(menuEncounter);

            result.AddOnCompletedListener((value) => MetadataSelected(sceneInfo, menuEncounter, value));
        }
        public virtual void StartEncounter(MenuSceneInfo sceneInfo, MenuEncounter menuEncounter)
        {
            if (MetadataSelector == null)
            {
                MetadataSelected(sceneInfo, menuEncounter.Status, menuEncounter.GetLatestTypedMetada());
                return;
            }

            var result = MetadataSelector.GetMetadata(menuEncounter);

            result.AddOnCompletedListener((value) => MetadataSelected(sceneInfo, menuEncounter.Status, value));
        }
Exemple #4
0
 protected virtual void EnsureEncounterUnlocked(
     MenuSceneInfo sceneInfo,
     MenuEncounter menuEncounter,
     KeyValuePair <SaveType, EncounterMetadata> metadata)
 {
     if (menuEncounter.Metadata.ContainsKey(SaveType.Server))
     {
         var task = EncounterLocker.LockEncounter(sceneInfo.User, metadata.Value);
         task.AddOnCompletedListener((result) => EncounterLocked(result, sceneInfo, metadata));
     }
     else
     {
         StartWriter(sceneInfo, metadata);
     }
 }
Exemple #5
0
        protected virtual MenuEncounter GetMenuEncounter(
            KeyValuePair <int, Dictionary <SaveType, EncounterMetadata> > metadataGroup,
            WaitableTask <Dictionary <int, EncounterEditLock> > locks,
            WaitableTask <Dictionary <int, EncounterBasicStatus> > statuses)
        {
            EncounterBasicStatus status = null;

            if (statuses.Result.Value?.ContainsKey(metadataGroup.Key) == true)
            {
                status = statuses.Result.Value[metadataGroup.Key];
            }
            var menuEncounter = new MenuEncounter(metadataGroup.Value, status);

            if (!locks.Result.IsError() && locks.Result.Value?.ContainsKey(metadataGroup.Key) == true)
            {
                menuEncounter.Lock = locks.Result.Value[metadataGroup.Key];
            }

            return(menuEncounter);
        }
 public void RemoveEncounter(MenuEncounter encounter)
 {
     Encounters.Remove(encounter);
     EncountersChanged?.Invoke();
 }
 public bool ContainsEncounter(MenuEncounter encounter) => Encounters.Contains(encounter);
 public void AddEncounter(MenuEncounter encounter)
 {
     Encounters.Add(encounter);
     EncountersChanged?.Invoke();
 }
Exemple #9
0
 public abstract WaitableTask <KeyValuePair <SaveType, EncounterMetadata> > GetMetadata(MenuEncounter menuEncounter);
 public MenuEncounterSelectedEventArgs(MenuEncounter encounter, EncounterSelectionType selectionType)
 {
     Encounter     = encounter;
     SelectionType = selectionType;
 }
Exemple #11
0
 public virtual void StartEncounter(MenuSceneInfo sceneInfo, MenuEncounter menuEncounter)
 => SelectMetadata(sceneInfo, menuEncounter);
Exemple #12
0
 public abstract void Display(MenuSceneInfo sceneInfo, MenuEncounter encounter);