예제 #1
0
 private void CastResultS1_Click(object sender, EventArgs e)
 {
     show1.CastRole(castInProgress.GetRoles()[castInProgress.GetShows().IndexOf(show1.name)]);
     CastResultQuit_Click(sender, e);
 }
예제 #2
0
        private void castNext(string notThem = null)
        {
            castInProgress = getCastNext(notThem);
            if (castInProgress == null)
            {
                CastResultS1.Visible   = false;
                CastResultS2.Visible   = false;
                CastResultS3.Visible   = false;
                CastResultS4.Visible   = false;
                CastResultNone.Visible = false;
                CastResultQuit.Visible = false;

                CastNextFlavour.Text     = "";
                CastNextName.Text        = "CONGRATULATIONS!";
                CastNextRole.Text        = "All shows have now been cast" + Environment.NewLine + "Roles highlighted in pink will need to be reopened" + Environment.NewLine + Environment.NewLine;
                CastNextRole.Text       += BTN_Onstage.Checked ? "See you all soon for backstage casting!" : "Good luck with your first rehearsals on Sunday!";
                CastNextRoleFlavour.Text = "";
            }
            else if (!castInProgress.Name().Contains("CHAIN:"))
            {
                if (!castInProgress.Name().Contains("GREEDY:"))
                {
                    CastNextName.Text = castInProgress.Name();

                    CastNextRole.Text = "";
                    for (int i = 0; i < castInProgress.GetRoles().Count; i++)
                    {
                        CastNextRole.Text += castInProgress.GetRoles()[i] + " in " + castInProgress.GetShows()[i] + Environment.NewLine;
                    }

                    CastNextName.Visible        = true;
                    CastNextFlavour.Visible     = true;
                    CastNextRole.Visible        = true;
                    CastNextRoleFlavour.Visible = true;

                    show1.ColourTop(castInProgress.Name(), Color.DarkCyan);
                    show2.ColourTop(castInProgress.Name(), Color.DarkCyan);
                    show3.ColourTop(castInProgress.Name(), Color.DarkCyan);
                    show4.ColourTop(castInProgress.Name(), Color.DarkCyan);

                    List <string> shows = castInProgress.GetShows();

                    CastResultS1.Text      = show1.name + " chosen";
                    CastResultS2.Text      = show2.name + " chosen";
                    CastResultS3.Text      = show3.name + " chosen";
                    CastResultS4.Text      = show4.name + " chosen";
                    CastResultNone.Visible = true;
                    CastResultQuit.Visible = true;
                    updateButtons(shows);
                }
                else
                {
                    //GREEDY

                    CastResultS1.Visible   = false;
                    CastResultS2.Visible   = false;
                    CastResultS3.Visible   = false;
                    CastResultS4.Visible   = false;
                    CastResultNone.Visible = false;
                    CastResultQuit.Visible = false;
                    CastStart.Visible      = true;

                    show1.ColourTop(castInProgress.Name().Split(':')[1], Color.Red);
                    show2.ColourTop(castInProgress.Name().Split(':')[1], Color.Red);
                    show3.ColourTop(castInProgress.Name().Split(':')[1], Color.Red);
                    show4.ColourTop(castInProgress.Name().Split(':')[1], Color.Red);

                    CastStart.Text    = "Continue";
                    CastNextName.Text = castInProgress.Name().Split(':')[1] + " has too many roles!";
                    CastNextRole.Text = "";
                    for (int i = 0; i < castInProgress.GetRoles().Count; i++)
                    {
                        CastNextRole.Text += castInProgress.GetRoles()[i] + " in " + castInProgress.GetShows()[i] + Environment.NewLine;
                    }

                    CastNextRole.Text += Environment.NewLine + "You can only be offered at most 1 role per show"
                                         + Environment.NewLine + "Press continue when you have fixed this error";

                    //TODO
                }
            }
            else
            {
                //CHAIN
                CastResultS1.Visible   = false;
                CastResultS2.Visible   = false;
                CastResultS3.Visible   = false;
                CastResultS4.Visible   = false;
                CastResultNone.Visible = false;
                CastResultQuit.Visible = false;
                CastStart.Visible      = true;
                CastStart.Text         = "Continue";
                CastNextName.Text      = "Loop detected!";
                CastNextRole.Text      = "";
                List <string> chain = castInProgress.Name().Split(':')[1].Split(',').ToList();
                chain.Remove("");
                for (int i = 0; i < chain.Count - 1; i++)
                {
                    CastNextRole.Text += chain[i] + " is waiting for " + chain[i + 1] + Environment.NewLine;
                }

                CastNextRole.Text += chain[chain.Count - 1] + " is waiting for " + chain[0] + Environment.NewLine
                                     + Environment.NewLine + "Press continue when this chain is resolved";

                CastNextName.Visible        = true;
                CastNextFlavour.Visible     = true;
                CastNextRole.Visible        = true;
                CastNextRoleFlavour.Visible = true;
            }
        }