示例#1
0
 protected virtual void MetadataSelected(
     MenuSceneInfo sceneInfo,
     MenuEncounter menuEncounter,
     TaskResult <KeyValuePair <SaveType, EncounterMetadata> > metadata)
 {
     if (metadata.HasValue())
     {
         EnsureEncounterUnlocked(sceneInfo, menuEncounter, metadata.Value);
     }
 }
示例#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));
        }
示例#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);
     }
 }
示例#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);
        }
示例#6
0
 public void RemoveEncounter(MenuEncounter encounter)
 {
     Encounters.Remove(encounter);
     EncountersChanged?.Invoke();
 }
示例#7
0
 public bool ContainsEncounter(MenuEncounter encounter) => Encounters.Contains(encounter);
示例#8
0
 public void AddEncounter(MenuEncounter encounter)
 {
     Encounters.Add(encounter);
     EncountersChanged?.Invoke();
 }
示例#9
0
 public abstract WaitableTask <KeyValuePair <SaveType, EncounterMetadata> > GetMetadata(MenuEncounter menuEncounter);
 public MenuEncounterSelectedEventArgs(MenuEncounter encounter, EncounterSelectionType selectionType)
 {
     Encounter     = encounter;
     SelectionType = selectionType;
 }
示例#11
0
 public virtual void StartEncounter(MenuSceneInfo sceneInfo, MenuEncounter menuEncounter)
 => SelectMetadata(sceneInfo, menuEncounter);
示例#12
0
 public abstract void Display(MenuSceneInfo sceneInfo, MenuEncounter encounter);