public void start(bool load) { //Startet den Thread if (!load) { saveAndLoad.LadeSpielstand = null; } ucc.HideUserControl(myUserControls.Hauptmenue); ucc.HideUserControl(myUserControls.Spielstaende); shopForm = null; quizForm = null; ausgehform = null; formMenue = null; this.Width = originWidth; this.Height = originHeight; gameClass = new game(this, load); Thread gameThread = new Thread(gameClass.start); pictureBoxStop_Click(this, new EventArgs()); gameThread.IsBackground = true; gameThread.Name = "spielThread"; gameThread.Start(); this.BringToFront(); if (gameClass.quizAbklingzeit > 0) { QuizEnabled = false; label_QuizZeit.Visible = true; } else { QuizEnabled = true; label_QuizZeit.Visible = false; } ucc = new UserControlControler(); }
//Klick auf Shop private void pictureBoxShop_Click(object sender, EventArgs e) { if (shopForm == null) { shopForm = new ShopForm(gameClass); } shopForm.Visible = true; }
public void CreateUserControl(myUserControls uc) { switch (uc) { case myUserControls.QuizEndScreen: qf = (QuizForm)form; EndScreenControl esc = new EndScreenControl(qf.qc, qf.myGame); esc.WeiterLabel.Click += qf.WeiterLabel_Click; myUserControlDictionary.Add(myUserControls.QuizEndScreen, esc); break; case myUserControls.QuizStartScreen: qf = (QuizForm)form; StartScreenControl ssc = new StartScreenControl(); ssc.StartLabel.Click += qf.StartLabel_Click; myUserControlDictionary.Add(uc, ssc); break; case myUserControls.Apotheke: sf = (ShopForm)form; ApothekenControl ac = new ApothekenControl(sf.myGame); ac.zurückApotheke.Click += sf.zurückApotheke_Click; myUserControlDictionary.Add(uc, ac); break; case myUserControls.Discounter: sf = (ShopForm)form; DiscounterControl dc = new DiscounterControl(sf.myGame); dc.buttonZurück.Click += sf.zurückApotheke_Click; myUserControlDictionary.Add(uc, dc); break; case myUserControls.Casino: fa = (FormAusgehen)form; CasinoControl cc = new CasinoControl(fa.game); cc.button1.Click += fa.buttonCasino_Click; myUserControlDictionary.Add(uc, cc); break; case myUserControls.Hauptmenue: f1 = (Form1)form; HauptmenueControl hc = new HauptmenueControl(f1); myUserControlDictionary.Add(uc, hc); break; case myUserControls.Party: fa = (FormAusgehen)form; PartyControl pc = new PartyControl(fa.game); pc.VisibleChanged += fa.pc_VisibleChanged; myUserControlDictionary.Add(uc, pc); break; case myUserControls.Schwarzmarkt: sf = (ShopForm)form; Shop.SchwarzmarktControl sc = new Shop.SchwarzmarktControl(sf.myGame); sc.buttonZurückSchwarzmarkt.Click += sf.zurückApotheke_Click; myUserControlDictionary.Add(uc, sc); break; case myUserControls.Spielstaende: f1 = (Form1)form; SpielstaendeControl spc = new SpielstaendeControl(f1); myUserControlDictionary.Add(uc, spc); break; case myUserControls.Endbildschirm: f1 = (Form1)form; Endbildschirm end = new Endbildschirm(f1); myUserControlDictionary.Add(uc, end); f1.endHeight = end.Height; f1.endWidth = end.Width; break; case myUserControls.SpeicherControl: fs = (SpielmenueForm)form; SpeicherControl spcc = new SpeicherControl(fs.myGame, fs); myUserControlDictionary.Add(uc, spcc); break; case myUserControls.Errungenschaften: f1 = (Form1)form; ErrungenschaftsControl ec = new ErrungenschaftsControl(f1); myUserControlDictionary.Add(uc, ec); break; } }