示例#1
0
    public void RemoveComparison(string name)
    {
        if (!file.ContainsKey(name, "Scoreset Type") || file[name, "Scoreset Type"] != "Comparison")
        {
            return;
        }

        int compIndex = Int32.Parse(file["comparison_index"]);

        if (compIndex >= (selector.Index + 2))
        {
            if (compIndex == selector.Index + 2)
            {
                file["comparison_index"] = "0";
            }
            else
            {
                file["comparison_index"] = "" + (compIndex - 1);
            }
        }
        file.RemoveSection(name);
        pages.Remove(name);
        selector.Reload();
        //ReloadComparisons();
    }
示例#2
0
    public void SwitchRoutes(object sender, EventArgs e)
    {
        try
        {
            if (tracker.IsRunning())
            {
                var confirmResult = MessageBox.Show("Your run is incomplete! Are you sure you wish to exit?\n\n(Any unsaved gold scores will be lost)\n(To save gold scores on an incomplete run fill in the rest of the levels with 0)",
                                                    "Continue Closing?",
                                                    MessageBoxButtons.YesNo);
                if (confirmResult == DialogResult.Yes)
                {
                    tracker.Reset();
                    SwapControls(submit);
                }
                else
                {
                    return;
                }
            }
            else
            {
                tracker.Reset();
                SwapControls(submit);
            }

            if (tracker.IsRunning())
            {
                return;
            }

            ScoreTracker.FileIndex += 1;
            config["file_index"]    = "" + ScoreTracker.FileIndex;
            config.Save();

            ScoreTracker.Data = new TrackerData(new FileReader(ScoreTracker.files[ScoreTracker.FileIndex], SortingStyle.Validate));

            Text = tracker.Data.Name;

            selector.Reload();
            selector.Index = tracker.Data.GetComparisonIndex();
            display.UpdateScores();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
        inputBox.Focus();
        display.UpdateScores();
    }
示例#3
0
    public ScoreTab(FileReader file)
    {
        this.file = file;
        TrackerData.ValidateFile(file);

        Text = "Scores";
        Dock = DockStyle.Fill;

        Controls.Add(tabs);

        addComparison.Dock    = DockStyle.Left;
        addComparison.Text    = "Add Comparison";
        removeComparison.Dock = DockStyle.Right;
        removeComparison.Text = "Remove Comparison";

        Panel p = new Panel();

        p.Height = 20;
        p.Controls.Add(addComparison);
        p.Controls.Add(removeComparison);
        p.Dock = DockStyle.Top;

        pages.Add("Best Run", ConfigureTab("Best Run"));
        pages.Add("Top Scores", ConfigureTab("Top Scores"));
        tabs.TabPages.Add(ToTabPage(pages["Best Run"]));
        tabs.TabPages.Add(ToTabPage(pages["Top Scores"]));
        comparisons.Text = "Comparisons";
        selector         = new ComparisonSelector(file);
        selector.SetType = ScoresetType.Comparison;
        selector.Reload();
        selector.Dock          = DockStyle.Top;
        currentComparison.Dock = DockStyle.Fill;
        comparisons.Controls.Add(currentComparison);
        comparisons.Controls.Add(selector);
        comparisons.Controls.Add(p);

        selector.Changed  = ReloadComparisons;
        selector.Reloaded = ReloadComparisons;
        selector.Index    = selectorIndex;

        ReloadComparisons();

        tabs.TabPages.Add(comparisons);

        tabs.SelectedIndexChanged += delegate { CacheTabIndex(); };
        addComparison.Click       += delegate { AddComparison(); };
        removeComparison.Click    += delegate { ConfirmComparisonDeletion(); };

        Layout += new LayoutEventHandler((object sender, LayoutEventArgs e) => DoLayout());

        tabs.SelectedIndex = tabIndex;

        DoLayout();
    }