protected virtual void OnColorSelected(TaskResult <Color> colorResult)
 {
     if (colorResult.HasValue())
     {
         SetColor(colorResult.Value);
     }
 }
Exemplo n.º 2
0
        private void ProcessResults(WaitableTask <Dictionary <int, EncounterBasicStatus> > result, TaskResult <string[]> fileTexts)
        {
            if (!fileTexts.HasValue())
            {
                result.SetResult(new Dictionary <int, EncounterBasicStatus>());
                return;
            }

            var statuses = new Dictionary <int, EncounterBasicStatus>();

            foreach (var fileText in fileTexts.Value)
            {
                var metadata = parser.Deserialize(fileText);
                if (statuses.ContainsKey(metadata.Key))
                {
                    Debug.LogError($"Duplicate saved status for key {metadata.Key}");
                    continue;
                }
                if (metadata.Value != null)
                {
                    statuses.Add(metadata.Key, metadata.Value);
                }
            }

            result.SetResult(statuses);
        }
 protected virtual void OnIconSelected(TaskResult <Icon> iconResult)
 {
     if (iconResult.HasValue())
     {
         SetIcon(iconResult.Value);
     }
 }
Exemplo n.º 4
0
 protected virtual void MetadataSelected(
     MenuSceneInfo sceneInfo,
     MenuEncounter menuEncounter,
     TaskResult <KeyValuePair <SaveType, EncounterMetadata> > metadata)
 {
     if (metadata.HasValue())
     {
         EnsureEncounterUnlocked(sceneInfo, menuEncounter, metadata.Value);
     }
 }
Exemplo n.º 5
0
        protected virtual void RetrievedLocks(TaskResult <Dictionary <int, EncounterEditLock> > result)
        {
            if (!result.HasValue())
            {
                return;
            }

            var locks     = result.Value;
            var sceneInfo = SceneSelectedListener.CurrentValue.SceneInfo;

            foreach (var encounter in sceneInfo.MenuEncountersInfo.GetEncounters())
            {
                var recordNumber = encounter.GetLatestMetadata().RecordNumber;
                encounter.Lock = locks.ContainsKey(recordNumber) ? locks[recordNumber] : null;
            }
            SignalBus.Fire <EncounterLocksUpdatedSignal>();
        }
Exemplo n.º 6
0
        protected void ReadFiles(TaskResult <string[]> demoEncounters, WaitableTask <string[]> result, FileType fileType)
        {
            if (demoEncounters == null || !demoEncounters.HasValue() || demoEncounters.Value.Length == 0)
            {
                result.SetResult(new string[0]);
                return;
            }

            var serverResults = new WaitableTask <string> [demoEncounters.Value.Length];

            for (int i = 0; i < demoEncounters.Value.Length; i++)
            {
                var filePath   = GetFile(fileType, demoEncounters.Value[i]);
                var webRequest = UnityWebRequest.Get(filePath);
                serverResults[i] = serverReader.Begin(webRequest);
                serverResults[i].AddOnCompletedListener((serverResult) => SetFilesResults(result, serverResults));
            }
        }
 protected virtual void OnColorThemeSelected(TaskResult<CharacterColorTheme> colorThemeResult)
 {
     if (colorThemeResult.HasValue())
         SetIcon(colorThemeResult.Value);
 }