Пример #1
0
        private async void SpiritEditorWindow_Shown(object sender, EventArgs e)
        {
            UiHelper.ChangeControlsEnabled(this, false);
            await LoadDataAsync();

            UiHelper.ChangeControlsEnabled(this, true);
        }
Пример #2
0
        private async void RandomizeAllTool_Click(object sender, EventArgs e)
        {
            int seed     = TryGetSeed();
            var allTasks = new Task[dataTbls.config.randomizer_iterations];

            UiHelper.ChangeControlsEnabled(this, false);

            FileHelper.SaveSpiritTitles(dataTbls.battleData.GetBattles(), dataTbls.config.file_directory_preload);

            // If seed isn't positive, get random one.
            for (int i = 0; i < dataTbls.config.randomizer_iterations; i++)
            {
                allTasks[i] = Task.Run(() => dataTbls.ExecuteRandomizer(i, seed + i, seed));
                Thread.Sleep(50);
            }

            await Task.WhenAll(allTasks);

            UiHelper.ChangeControlsEnabled(this, true);
            UiHelper.PopUpMessage(String.Format("Spirit Battles Randomized {0} times.\r\nChaos: {1}. \r\nSeed: {2}\r\nLocation: {3}", dataTbls.config.randomizer_iterations, dataTbls.config.chaos, seed, dataTbls.config.file_directory_randomized));
        }